mirror of
https://github.com/Wei-Shaw/claude-relay-service.git
synced 2026-01-23 21:17:30 +00:00
20 lines
129 KiB
JavaScript
20 lines
129 KiB
JavaScript
import{E as ft}from"./element-plus-BaMaLFJp.js";import{aR as et,r as M,c as F,q as Ie,V as gt,o as Ce,x as d,y as r,z as e,I as oe,C as U,P as c,R as ne,J as yt,L as v,B as he,K as P,aq as ee,Q,ac as te,T as bt,a5 as ge,D as vt,_ as De,Y as me,an as ue,O as K,aa as Ke,aX as Se,al as ye}from"./vue-vendor-DfnFpxGJ.js";import{s as q}from"./toast-BvwA7Mwb.js";import{a as G,_ as pe}from"./index-KCMFVMd0.js";import{_ as Te}from"./WindowCountdown-RaAYa1A3.js";import{C as Ze}from"./CustomDropdown-D53_19Q1.js";import"./vendor-BDiMbLwQ.js";const Re=et("clients",{state:()=>({supportedClients:[],loading:!1,error:null}),actions:{async loadSupportedClients(){if(this.supportedClients.length>0)return this.supportedClients;this.loading=!0,this.error=null;try{const w=await G.get("/admin/supported-clients");return w.success?this.supportedClients=w.data||[]:(this.error=w.message||"加载支持的客户端失败",console.error("Failed to load supported clients:",this.error)),this.supportedClients}catch(w){return this.error=w.message||"加载支持的客户端失败",console.error("Error loading supported clients:",w),[]}finally{this.loading=!1}}}}),tt=et("apiKeys",()=>{const w=M([]),H=M(!1),u=M(null),V=M("all"),E=M(""),h=M("asc"),k=async()=>{H.value=!0,u.value=null;try{const I=await G.get("/admin/api-keys");if(I.success)w.value=I.data||[];else throw new Error(I.message||"获取API Keys失败")}catch(I){throw u.value=I.message,I}finally{H.value=!1}};return{apiKeys:w,loading:H,error:u,statsTimeRange:V,sortBy:E,sortOrder:h,fetchApiKeys:k,createApiKey:async I=>{H.value=!0,u.value=null;try{const A=await G.post("/admin/api-keys",I);if(A.success)return await k(),A.data;throw new Error(A.message||"创建API Key失败")}catch(A){throw u.value=A.message,A}finally{H.value=!1}},updateApiKey:async(I,A)=>{H.value=!0,u.value=null;try{const f=await G.put(`/admin/api-keys/${I}`,A);if(f.success)return await k(),f;throw new Error(f.message||"更新API Key失败")}catch(f){throw u.value=f.message,f}finally{H.value=!1}},toggleApiKey:async I=>{H.value=!0,u.value=null;try{const A=await G.put(`/admin/api-keys/${I}/toggle`);if(A.success)return await k(),A;throw new Error(A.message||"切换状态失败")}catch(A){throw u.value=A.message,A}finally{H.value=!1}},renewApiKey:async(I,A)=>{H.value=!0,u.value=null;try{const f=await G.put(`/admin/api-keys/${I}`,A);if(f.success)return await k(),f;throw new Error(f.message||"续期失败")}catch(f){throw u.value=f.message,f}finally{H.value=!1}},deleteApiKey:async I=>{H.value=!0,u.value=null;try{const A=await G.delete(`/admin/api-keys/${I}`);if(A.success)return await k(),A;throw new Error(A.message||"删除失败")}catch(A){throw u.value=A.message,A}finally{H.value=!1}},fetchApiKeyStats:async(I,A="all")=>{try{const f=await G.get(`/admin/api-keys/${I}/stats`,{params:{timeRange:A}});if(f.success)return f.stats;throw new Error(f.message||"获取统计失败")}catch(f){return console.error("获取API Key统计失败:",f),null}},fetchTags:async()=>{try{const I=await G.get("/admin/api-keys/tags");if(I.success)return I.data||[];throw new Error(I.message||"获取标签失败")}catch(I){return console.error("获取标签失败:",I),[]}},sortApiKeys:I=>{E.value===I?h.value=h.value==="asc"?"desc":"asc":(E.value=I,h.value="asc")},reset:()=>{w.value=[],H.value=!1,u.value=null,V.value="all",E.value="",h.value="asc"}}}),wt={class:"flex-shrink-0 border-b border-gray-200 p-3"},ht={class:"relative"},$t={class:"custom-scrollbar flex-1 overflow-y-auto"},At={class:"text-gray-700"},kt={key:0},Ct=["onClick"],Kt={class:"flex items-center justify-between"},It={class:"text-gray-700"},Dt={class:"text-xs text-gray-500"},Lt={key:1},_t={class:"bg-gray-50 px-4 py-2 text-xs font-semibold text-gray-500"},Mt=["onClick"],Tt={class:"flex items-center justify-between"},St={class:"text-gray-700"},Rt={class:"text-xs text-gray-400"},jt={key:2},Et=["onClick"],Vt={class:"flex items-center justify-between"},Pt={class:"text-gray-700"},Ut={class:"text-xs text-gray-400"},qt={key:3,class:"px-4 py-8 text-center text-gray-500"},Gt={__name:"AccountSelector",props:{modelValue:{type:String,default:""},platform:{type:String,required:!0,validator:w=>["claude","gemini"].includes(w)},accounts:{type:Array,default:()=>[]},groups:{type:Array,default:()=>[]},disabled:{type:Boolean,default:!1},placeholder:{type:String,default:"请选择账号"},defaultOptionText:{type:String,default:"使用共享账号池"}},emits:["update:modelValue"],setup(w,{emit:H}){const u=w,V=H,E=M(!1),h=M(""),k=M(null),B=M(null),C=M({}),O=M(null),j=M(""),y=F(()=>{if(!u.modelValue)return u.defaultOptionText;if(u.modelValue.startsWith("group:")){const $=u.modelValue.substring(6),_=u.groups.find(b=>b.id===$);return _?`${_.name} (${_.memberCount||0} 个成员)`:""}if(u.modelValue.startsWith("console:")){const $=u.modelValue.substring(8),_=u.accounts.find(b=>b.id===$&&b.platform==="claude-console");return _?`${_.name} (${T(_)})`:""}const m=u.accounts.find($=>$.id===u.modelValue);return m?`${m.name} (${T(m)})`:""}),T=m=>{if(!m)return"未知";if(m.isActive===!1)switch(m.status){case"unauthorized":return"未授权";case"error":return"Token错误";case"created":return"待验证";case"rate_limited":return"限流中";default:return"异常"}return"正常"},n=F(()=>[...u.accounts].sort((m,$)=>{const _=new Date(m.createdAt||0);return new Date($.createdAt||0)-_})),l=F(()=>{if(!h.value)return u.groups;const m=h.value.toLowerCase();return u.groups.filter($=>$.name.toLowerCase().includes(m))}),J=F(()=>{let m=n.value.filter($=>$.accountType==="dedicated"&&(u.platform==="claude"?$.platform==="claude-oauth":$.platform!=="claude-console"));if(h.value){const $=h.value.toLowerCase();m=m.filter(_=>_.name.toLowerCase().includes($))}return m}),I=F(()=>{if(u.platform!=="claude")return[];let m=n.value.filter($=>$.accountType==="dedicated"&&$.platform==="claude-console");if(h.value){const $=h.value.toLowerCase();m=m.filter(_=>_.name.toLowerCase().includes($))}return m}),A=F(()=>l.value.length>0||J.value.length>0||I.value.length>0),f=m=>{if(!m)return"";const $=new Date(m),b=(new Date-$)/(1e3*60*60);return b<24?"今天创建":b<48?"昨天创建":b<168?`${Math.floor(b/24)} 天前`:$.toLocaleDateString("zh-CN",{month:"2-digit",day:"2-digit"})},N=()=>{if(!E.value||!B.value||!O.value)return;const m=O.value;if(!m)return;const $=m.getBoundingClientRect(),_=window.innerHeight,b=window.innerWidth,o=_-$.bottom,x=$.top,Y=8,W=o-Y,Z=x-Y;let le=!1,ce=W;j.value==="above"&&Z>=150?(le=!0,ce=Z):j.value==="below"&&W>=150?(le=!1,ce=W):Z>W&&W<200&&(le=!0,ce=Z),j.value=le?"above":"below";let re=$.left;const X=$.width;re+X>b-Y&&(re=b-X-Y),re<Y&&(re=Y),C.value={position:"fixed",left:`${re}px`,width:`${$.width}px`,maxHeight:`${Math.min(ce,400)}px`,...le?{bottom:`${_-$.top}px`}:{top:`${$.bottom}px`}}},se=()=>{if(!E.value&&O.value){const m=O.value.getBoundingClientRect(),_=window.innerHeight-m.bottom,b=8;C.value={position:"fixed",left:`${m.left}px`,width:`${m.width}px`,maxHeight:`${Math.min(_-b,400)}px`,top:`${m.bottom}px`}}E.value=!E.value,E.value&&vt(()=>{var m;N(),(m=k.value)==null||m.focus()})},D=m=>{V("update:modelValue",m||""),E.value=!1,h.value=""},p=()=>{},ae=()=>{var m;h.value="",(m=k.value)==null||m.focus()},R=m=>{var $,_;!(($=O.value)!=null&&$.contains(m.target))&&!((_=B.value)!=null&&_.contains(m.target))&&(E.value=!1)},a=()=>{E.value&&N()};return Ie(()=>{document.addEventListener("click",R),window.addEventListener("scroll",a,!0),window.addEventListener("resize",N)}),gt(()=>{document.removeEventListener("click",R),window.removeEventListener("scroll",a,!0),window.removeEventListener("resize",N)}),Ce(E,m=>{m||(h.value="",j.value="")}),(m,$)=>(r(),d("div",{ref_key:"triggerRef",ref:O,class:"relative"},[e("div",{class:U(["form-input flex w-full cursor-pointer items-center justify-between",{"opacity-50":w.disabled}]),onClick:$[0]||($[0]=_=>!w.disabled&&se())},[e("span",{class:U(w.modelValue?"text-gray-900":"text-gray-500")},c(y.value),3),e("i",{class:U(["fas fa-chevron-down text-gray-400 transition-transform duration-200",{"rotate-180":E.value}])},null,2)],2),(r(),oe(ge,{to:"body"},[ne(bt,{"enter-active-class":"transition ease-out duration-100","enter-from-class":"transform opacity-0 scale-95","enter-to-class":"transform opacity-100 scale-100","leave-active-class":"transition ease-in duration-75","leave-from-class":"transform opacity-100 scale-100","leave-to-class":"transform opacity-0 scale-95"},{default:yt(()=>[E.value?(r(),d("div",{key:0,ref_key:"dropdownRef",ref:B,class:"absolute z-50 flex flex-col rounded-lg border border-gray-200 bg-white shadow-lg",style:he(C.value)},[e("div",wt,[e("div",ht,[P(e("input",{ref_key:"searchInput",ref:k,"onUpdate:modelValue":$[1]||($[1]=_=>h.value=_),class:"form-input w-full text-sm",placeholder:"搜索账号名称...",style:{"padding-left":"40px","padding-right":"36px"},type:"text",onInput:p},null,544),[[ee,h.value]]),$[4]||($[4]=e("i",{class:"fas fa-search pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-sm text-gray-400"},null,-1)),h.value?(r(),d("button",{key:0,class:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600",type:"button",onClick:ae},$[3]||($[3]=[e("i",{class:"fas fa-times text-sm"},null,-1)]))):v("",!0)])]),e("div",$t,[e("div",{class:U(["cursor-pointer px-4 py-2 transition-colors hover:bg-gray-50",{"bg-blue-50":!w.modelValue}]),onClick:$[2]||($[2]=_=>D(null))},[e("span",At,c(w.defaultOptionText),1)],2),l.value.length>0?(r(),d("div",kt,[$[5]||($[5]=e("div",{class:"bg-gray-50 px-4 py-2 text-xs font-semibold text-gray-500"},"调度分组",-1)),(r(!0),d(Q,null,te(l.value,_=>(r(),d("div",{key:`group:${_.id}`,class:U(["cursor-pointer px-4 py-2 transition-colors hover:bg-gray-50",{"bg-blue-50":w.modelValue===`group:${_.id}`}]),onClick:b=>D(`group:${_.id}`)},[e("div",Kt,[e("span",It,c(_.name),1),e("span",Dt,c(_.memberCount||0)+" 个成员",1)])],10,Ct))),128))])):v("",!0),J.value.length>0?(r(),d("div",Lt,[e("div",_t,c(w.platform==="claude"?"Claude OAuth 专属账号":"OAuth 专属账号"),1),(r(!0),d(Q,null,te(J.value,_=>(r(),d("div",{key:_.id,class:U(["cursor-pointer px-4 py-2 transition-colors hover:bg-gray-50",{"bg-blue-50":w.modelValue===_.id}]),onClick:b=>D(_.id)},[e("div",Tt,[e("div",null,[e("span",St,c(_.name),1),e("span",{class:U(["ml-2 rounded-full px-2 py-0.5 text-xs",_.isActive?"bg-green-100 text-green-700":_.status==="unauthorized"?"bg-orange-100 text-orange-700":"bg-red-100 text-red-700"])},c(T(_)),3)]),e("span",Rt,c(f(_.createdAt)),1)])],10,Mt))),128))])):v("",!0),w.platform==="claude"&&I.value.length>0?(r(),d("div",jt,[$[6]||($[6]=e("div",{class:"bg-gray-50 px-4 py-2 text-xs font-semibold text-gray-500"}," Claude Console 专属账号 ",-1)),(r(!0),d(Q,null,te(I.value,_=>(r(),d("div",{key:_.id,class:U(["cursor-pointer px-4 py-2 transition-colors hover:bg-gray-50",{"bg-blue-50":w.modelValue===`console:${_.id}`}]),onClick:b=>D(`console:${_.id}`)},[e("div",Vt,[e("div",null,[e("span",Pt,c(_.name),1),e("span",{class:U(["ml-2 rounded-full px-2 py-0.5 text-xs",_.isActive?"bg-green-100 text-green-700":_.status==="unauthorized"?"bg-orange-100 text-orange-700":"bg-red-100 text-red-700"])},c(T(_)),3)]),e("span",Ut,c(f(_.createdAt)),1)])],10,Et))),128))])):v("",!0),h.value&&!A.value?(r(),d("div",qt,$[7]||($[7]=[e("i",{class:"fas fa-search mb-2 text-2xl"},null,-1),e("p",{class:"text-sm"},"没有找到匹配的账号",-1)]))):v("",!0)])],4)):v("",!0)]),_:1})]))],512))}},fe=pe(Gt,[["__scopeId","data-v-b315d95a"]]),Ot={class:"modal fixed inset-0 z-50 flex items-center justify-center p-3 sm:p-4"},Wt={class:"modal-content mx-auto flex max-h-[90vh] w-full max-w-4xl flex-col p-4 sm:p-6"},Ft={class:"mb-4 flex items-center justify-between"},Bt={class:"rounded-lg border border-blue-200 bg-gradient-to-r from-blue-50 to-indigo-50 p-3 sm:p-4"},zt={class:"flex items-center gap-3 sm:gap-4"},Ht={class:"flex cursor-pointer items-center"},Nt={class:"flex cursor-pointer items-center"},Yt={key:0,class:"mt-3"},Qt={class:"flex items-center gap-4"},Jt={class:"flex-1"},Xt={class:"flex items-center gap-2"},Zt={class:"mt-2 flex items-start text-xs text-amber-600"},es=["placeholder"],ts={key:0,class:"mt-1 text-xs text-red-500"},ss={class:"space-y-4"},ls={key:0},os={class:"flex flex-wrap gap-2"},ns=["onClick"],is={key:1},as={class:"flex flex-wrap gap-2"},rs=["onClick"],ds={class:"flex gap-2"},us=["onKeypress"],cs={class:"rounded-lg border border-blue-200 bg-blue-50 p-3"},ms={class:"space-y-2"},ps={class:"grid grid-cols-1 gap-2 lg:grid-cols-3"},xs={class:"space-y-2"},fs={class:"flex gap-2"},gs={key:0,class:"mt-3"},ys=["min"],bs={key:1,class:"mt-2 text-xs text-gray-500"},vs={class:"flex gap-4"},ws={class:"flex cursor-pointer items-center"},hs={class:"flex cursor-pointer items-center"},$s={class:"flex cursor-pointer items-center"},As={class:"flex cursor-pointer items-center"},ks={class:"mb-2 flex items-center justify-between"},Cs=["disabled"],Ks={class:"grid grid-cols-1 gap-3"},Is={class:"mb-2 flex items-center"},Ds={key:0,class:"space-y-3"},Ls={class:"mb-3 flex min-h-[32px] flex-wrap gap-2 rounded-lg border border-gray-200 bg-gray-50 p-2"},_s=["onClick"],Ms={key:0,class:"text-sm text-gray-400"},Ts={class:"space-y-3"},Ss={class:"flex flex-wrap gap-2"},Rs=["onClick"],js={key:0,class:"text-sm italic text-gray-400"},Es={class:"flex gap-2"},Vs=["onKeydown"],Ps={class:"mb-2 flex items-center"},Us={key:0,class:"rounded-lg border border-green-200 bg-green-50 p-3"},qs={class:"space-y-1"},Gs=["id","value"],Os=["for"],Ws={class:"text-sm font-medium text-gray-700"},Fs={class:"block text-xs text-gray-500"},Bs={class:"flex gap-3 pt-2"},zs=["disabled"],Hs={key:0,class:"loading-spinner mr-2"},Ns={key:1,class:"fas fa-plus mr-2"},Ys={__name:"CreateApiKeyModal",props:{accounts:{type:Object,default:()=>({claude:[],gemini:[]})}},emits:["close","success","batch-success"],setup(w,{emit:H}){const u=w,V=H,E=Re(),h=tt(),k=M(!1),B=M(!1),C=M({claude:[],gemini:[],openai:[],bedrock:[],claudeGroups:[],geminiGroups:[],openaiGroups:[]}),O=M({name:""}),j=M(""),y=M([]),T=F(()=>y.value.filter(b=>!l.tags.includes(b))),n=M([]),l=De({createType:"single",batchCount:10,name:"",description:"",tokenLimit:"",rateLimitWindow:"",rateLimitRequests:"",concurrencyLimit:"",dailyCostLimit:"",expireDuration:"",customExpireDate:"",expiresAt:null,permissions:"all",claudeAccountId:"",geminiAccountId:"",openaiAccountId:"",bedrockAccountId:"",enableModelRestriction:!1,restrictedModels:[],modelInput:"",enableClientRestriction:!1,allowedClients:[],tags:[]});Ie(async()=>{n.value=await E.loadSupportedClients(),y.value=await h.fetchTags(),u.accounts&&(C.value={claude:u.accounts.claude||[],gemini:u.accounts.gemini||[],openai:u.accounts.openai||[],bedrock:u.accounts.bedrock||[],claudeGroups:u.accounts.claudeGroups||[],geminiGroups:u.accounts.geminiGroups||[],openaiGroups:u.accounts.openaiGroups||[]})});const J=async()=>{var b,o;B.value=!0;try{const[x,Y,W,Z,le,ce]=await Promise.all([G.get("/admin/claude-accounts"),G.get("/admin/claude-console-accounts"),G.get("/admin/gemini-accounts"),G.get("/admin/openai-accounts"),G.get("/admin/bedrock-accounts"),G.get("/admin/account-groups")]),re=[];if(x.success&&((b=x.data)==null||b.forEach(X=>{re.push({...X,platform:"claude-oauth",isDedicated:X.accountType==="dedicated"})})),Y.success&&((o=Y.data)==null||o.forEach(X=>{re.push({...X,platform:"claude-console",isDedicated:X.accountType==="dedicated"})})),C.value.claude=re,W.success&&(C.value.gemini=(W.data||[]).map(X=>({...X,isDedicated:X.accountType==="dedicated"}))),Z.success&&(C.value.openai=(Z.data||[]).map(X=>({...X,isDedicated:X.accountType==="dedicated"}))),le.success&&(C.value.bedrock=(le.data||[]).map(X=>({...X,isDedicated:X.accountType==="dedicated"}))),ce.success){const X=ce.data||[];C.value.claudeGroups=X.filter(ie=>ie.platform==="claude"),C.value.geminiGroups=X.filter(ie=>ie.platform==="gemini"),C.value.openaiGroups=X.filter(ie=>ie.platform==="openai")}q("账号列表已刷新","success")}catch{q("刷新账号列表失败","error")}finally{B.value=!1}},I=F(()=>{const b=new Date;return b.setMinutes(b.getMinutes()+1),b.toISOString().slice(0,16)}),A=()=>{if(!l.expireDuration){l.expiresAt=null;return}if(l.expireDuration==="custom")return;const b=new Date,x=l.expireDuration.match(/(\d+)([dhmy])/);if(x){const[,Y,W]=x,Z=parseInt(Y);switch(W){case"d":b.setDate(b.getDate()+Z);break;case"h":b.setHours(b.getHours()+Z);break;case"m":b.setMonth(b.getMonth()+Z);break;case"y":b.setFullYear(b.getFullYear()+Z);break}l.expiresAt=b.toISOString()}},f=()=>{l.customExpireDate&&(l.expiresAt=new Date(l.customExpireDate).toISOString())},N=b=>new Date(b).toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}),se=()=>{l.modelInput&&!l.restrictedModels.includes(l.modelInput)&&(l.restrictedModels.push(l.modelInput),l.modelInput="")},D=b=>{l.restrictedModels.splice(b,1)},p=M(["claude-opus-4-20250514","claude-opus-4-1-20250805"]),ae=F(()=>p.value.filter(b=>!l.restrictedModels.includes(b))),R=b=>{l.restrictedModels.includes(b)||l.restrictedModels.push(b)},a=()=>{if(j.value&&j.value.trim()){const b=j.value.trim();l.tags.includes(b)||l.tags.push(b),j.value=""}},m=b=>{l.tags.includes(b)||l.tags.push(b)},$=b=>{l.tags.splice(b,1)},_=async()=>{if(O.value.name="",!l.name||!l.name.trim()){O.value.name="请输入API Key名称";return}if(l.createType==="batch"&&(!l.batchCount||l.batchCount<2||l.batchCount>500)){q("批量创建数量必须在 2-500 之间","error");return}k.value=!0;try{const b={description:l.description||void 0,tokenLimit:l.tokenLimit!==""&&l.tokenLimit!==null?parseInt(l.tokenLimit):null,rateLimitWindow:l.rateLimitWindow!==""&&l.rateLimitWindow!==null?parseInt(l.rateLimitWindow):null,rateLimitRequests:l.rateLimitRequests!==""&&l.rateLimitRequests!==null?parseInt(l.rateLimitRequests):null,concurrencyLimit:l.concurrencyLimit!==""&&l.concurrencyLimit!==null?parseInt(l.concurrencyLimit):0,dailyCostLimit:l.dailyCostLimit!==""&&l.dailyCostLimit!==null?parseFloat(l.dailyCostLimit):0,expiresAt:l.expiresAt||void 0,permissions:l.permissions,tags:l.tags.length>0?l.tags:void 0,enableModelRestriction:l.enableModelRestriction,restrictedModels:l.restrictedModels,enableClientRestriction:l.enableClientRestriction,allowedClients:l.allowedClients};if(l.claudeAccountId&&(l.claudeAccountId.startsWith("console:")?(b.claudeConsoleAccountId=l.claudeAccountId.substring(8),delete b.claudeAccountId):(b.claudeAccountId=l.claudeAccountId,delete b.claudeConsoleAccountId)),l.geminiAccountId&&(b.geminiAccountId=l.geminiAccountId),l.openaiAccountId&&(b.openaiAccountId=l.openaiAccountId),l.bedrockAccountId&&(b.bedrockAccountId=l.bedrockAccountId),l.createType==="single"){const o={...b,name:l.name},x=await G.post("/admin/api-keys",o);x.success?(q("API Key 创建成功","success"),V("success",x.data),V("close")):q(x.message||"创建失败","error")}else{const o={...b,createType:"batch",baseName:l.name,count:l.batchCount},x=await G.post("/admin/api-keys/batch",o);x.success?(q(`成功创建 ${x.data.length} 个 API Key`,"success"),V("batch-success",x.data),V("close")):q(x.message||"批量创建失败","error")}}catch{q("创建失败","error")}finally{k.value=!1}};return(b,o)=>(r(),oe(ge,{to:"body"},[e("div",Ot,[e("div",Wt,[e("div",Ft,[o[33]||(o[33]=e("div",{class:"flex items-center gap-2 sm:gap-3"},[e("div",{class:"flex h-8 w-8 items-center justify-center rounded-lg bg-gradient-to-br from-blue-500 to-blue-600 sm:h-10 sm:w-10 sm:rounded-xl"},[e("i",{class:"fas fa-key text-sm text-white sm:text-base"})]),e("h3",{class:"text-lg font-bold text-gray-900 sm:text-xl"},"创建新的 API Key")],-1)),e("button",{class:"p-1 text-gray-400 transition-colors hover:text-gray-600",onClick:o[0]||(o[0]=x=>b.$emit("close"))},o[32]||(o[32]=[e("i",{class:"fas fa-times text-lg sm:text-xl"},null,-1)]))]),e("form",{class:"modal-scroll-content custom-scrollbar flex-1 space-y-4",onSubmit:me(_,["prevent"])},[e("div",Bt,[e("div",{class:U(["flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",l.createType==="batch"?"mb-3":""])},[o[36]||(o[36]=e("label",{class:"flex h-full items-center text-xs font-semibold text-gray-700 sm:text-sm"},"创建类型",-1)),e("div",zt,[e("label",Ht,[P(e("input",{"onUpdate:modelValue":o[1]||(o[1]=x=>l.createType=x),class:"mr-1.5 text-blue-600 sm:mr-2",type:"radio",value:"single"},null,512),[[ue,l.createType]]),o[34]||(o[34]=e("span",{class:"flex items-center text-xs text-gray-700 sm:text-sm"},[e("i",{class:"fas fa-key mr-1 text-xs"}),K(" 单个创建 ")],-1))]),e("label",Nt,[P(e("input",{"onUpdate:modelValue":o[2]||(o[2]=x=>l.createType=x),class:"mr-1.5 text-blue-600 sm:mr-2",type:"radio",value:"batch"},null,512),[[ue,l.createType]]),o[35]||(o[35]=e("span",{class:"flex items-center text-xs text-gray-700 sm:text-sm"},[e("i",{class:"fas fa-layer-group mr-1 text-xs"}),K(" 批量创建 ")],-1))])])],2),l.createType==="batch"?(r(),d("div",Yt,[e("div",Qt,[e("div",Jt,[o[38]||(o[38]=e("label",{class:"mb-1 block text-xs font-medium text-gray-600"},"创建数量",-1)),e("div",Xt,[P(e("input",{"onUpdate:modelValue":o[3]||(o[3]=x=>l.batchCount=x),class:"form-input w-full text-sm",max:"500",min:"2",placeholder:"输入数量 (2-500)",required:"",type:"number"},null,512),[[ee,l.batchCount,void 0,{number:!0}]]),o[37]||(o[37]=e("div",{class:"whitespace-nowrap text-xs text-gray-500"},"最大支持 500 个",-1))])])]),e("p",Zt,[o[39]||(o[39]=e("i",{class:"fas fa-info-circle mr-1 mt-0.5 flex-shrink-0"},null,-1)),e("span",null,"批量创建时,每个 Key 的名称会自动添加序号后缀,例如:"+c(l.name||"MyKey")+"_1, "+c(l.name||"MyKey")+"_2 ...",1)])])):v("",!0)]),e("div",null,[o[40]||(o[40]=e("label",{class:"mb-1.5 block text-xs font-semibold text-gray-700 sm:mb-2 sm:text-sm"},[K("名称 "),e("span",{class:"text-red-500"},"*")],-1)),P(e("input",{"onUpdate:modelValue":o[4]||(o[4]=x=>l.name=x),class:U(["form-input w-full text-sm",{"border-red-500":O.value.name}]),placeholder:l.createType==="batch"?"输入基础名称(将自动添加序号)":"为您的 API Key 取一个名称",required:"",type:"text",onInput:o[5]||(o[5]=x=>O.value.name="")},null,42,es),[[ee,l.name]]),O.value.name?(r(),d("p",ts,c(O.value.name),1)):v("",!0)]),e("div",null,[o[48]||(o[48]=e("label",{class:"mb-2 block text-sm font-semibold text-gray-700"},"标签",-1)),e("div",ss,[l.tags.length>0?(r(),d("div",ls,[o[42]||(o[42]=e("div",{class:"mb-2 text-xs font-medium text-gray-600"},"已选择的标签:",-1)),e("div",os,[(r(!0),d(Q,null,te(l.tags,(x,Y)=>(r(),d("span",{key:"selected-"+Y,class:"inline-flex items-center gap-1 rounded-full bg-blue-100 px-3 py-1 text-sm text-blue-800"},[K(c(x)+" ",1),e("button",{class:"ml-1 hover:text-blue-900",type:"button",onClick:W=>$(Y)},o[41]||(o[41]=[e("i",{class:"fas fa-times text-xs"},null,-1)]),8,ns)]))),128))])])):v("",!0),T.value.length>0?(r(),d("div",is,[o[44]||(o[44]=e("div",{class:"mb-2 text-xs font-medium text-gray-600"},"点击选择已有标签:",-1)),e("div",as,[(r(!0),d(Q,null,te(T.value,x=>(r(),d("button",{key:"available-"+x,class:"inline-flex items-center gap-1 rounded-full bg-gray-100 px-3 py-1 text-sm text-gray-700 transition-colors hover:bg-blue-100 hover:text-blue-700",type:"button",onClick:Y=>m(x)},[o[43]||(o[43]=e("i",{class:"fas fa-tag text-xs text-gray-500"},null,-1)),K(" "+c(x),1)],8,rs))),128))])])):v("",!0),e("div",null,[o[46]||(o[46]=e("div",{class:"mb-2 text-xs font-medium text-gray-600"},"创建新标签:",-1)),e("div",ds,[P(e("input",{"onUpdate:modelValue":o[6]||(o[6]=x=>j.value=x),class:"form-input flex-1",placeholder:"输入新标签名称",type:"text",onKeypress:Ke(me(a,["prevent"]),["enter"])},null,40,us),[[ee,j.value]]),e("button",{class:"rounded-lg bg-green-500 px-4 py-2 text-white transition-colors hover:bg-green-600",type:"button",onClick:a},o[45]||(o[45]=[e("i",{class:"fas fa-plus"},null,-1)]))])]),o[47]||(o[47]=e("p",{class:"text-xs text-gray-500"},"用于标记不同团队或用途,方便筛选管理",-1))])]),e("div",cs,[o[56]||(o[56]=e("div",{class:"mb-2 flex items-center gap-2"},[e("div",{class:"flex h-6 w-6 flex-shrink-0 items-center justify-center rounded bg-blue-500"},[e("i",{class:"fas fa-tachometer-alt text-xs text-white"})]),e("h4",{class:"text-sm font-semibold text-gray-800"},"速率限制设置 (可选)")],-1)),e("div",ms,[e("div",ps,[e("div",null,[o[49]||(o[49]=e("label",{class:"mb-1 block text-xs font-medium text-gray-700"},"时间窗口 (分钟)",-1)),P(e("input",{"onUpdate:modelValue":o[7]||(o[7]=x=>l.rateLimitWindow=x),class:"form-input w-full text-sm",min:"1",placeholder:"无限制",type:"number"},null,512),[[ee,l.rateLimitWindow]]),o[50]||(o[50]=e("p",{class:"ml-2 mt-0.5 text-xs text-gray-500"},"时间段单位",-1))]),e("div",null,[o[51]||(o[51]=e("label",{class:"mb-1 block text-xs font-medium text-gray-700"},"请求次数限制",-1)),P(e("input",{"onUpdate:modelValue":o[8]||(o[8]=x=>l.rateLimitRequests=x),class:"form-input w-full text-sm",min:"1",placeholder:"无限制",type:"number"},null,512),[[ee,l.rateLimitRequests]]),o[52]||(o[52]=e("p",{class:"ml-2 mt-0.5 text-xs text-gray-500"},"窗口内最大请求",-1))]),e("div",null,[o[53]||(o[53]=e("label",{class:"mb-1 block text-xs font-medium text-gray-700"},"Token 限制",-1)),P(e("input",{"onUpdate:modelValue":o[9]||(o[9]=x=>l.tokenLimit=x),class:"form-input w-full text-sm",placeholder:"无限制",type:"number"},null,512),[[ee,l.tokenLimit]]),o[54]||(o[54]=e("p",{class:"ml-2 mt-0.5 text-xs text-gray-500"},"窗口内最大Token",-1))])]),o[55]||(o[55]=e("div",{class:"rounded-lg bg-blue-100 p-2"},[e("h5",{class:"mb-1 text-xs font-semibold text-blue-800"},"💡 使用示例"),e("div",{class:"space-y-0.5 text-xs text-blue-700"},[e("div",null,[e("strong",null,"示例1:"),K(" 时间窗口=60,请求次数=1000 → 每60分钟最多1000次请求 ")]),e("div",null,[e("strong",null,"示例2:"),K(" 时间窗口=1,Token=10000 → 每分钟最多10,000个Token ")]),e("div",null,[e("strong",null,"示例3:"),K(" 窗口=30,请求=50,Token=100000 → 每30分钟50次请求且不超10万Token ")])])],-1))])]),e("div",null,[o[58]||(o[58]=e("label",{class:"mb-2 block text-sm font-semibold text-gray-700"},"每日费用限制 (美元)",-1)),e("div",xs,[e("div",fs,[e("button",{class:"rounded bg-gray-100 px-2 py-1 text-xs font-medium hover:bg-gray-200",type:"button",onClick:o[10]||(o[10]=x=>l.dailyCostLimit="50")}," $50 "),e("button",{class:"rounded bg-gray-100 px-2 py-1 text-xs font-medium hover:bg-gray-200",type:"button",onClick:o[11]||(o[11]=x=>l.dailyCostLimit="100")}," $100 "),e("button",{class:"rounded bg-gray-100 px-2 py-1 text-xs font-medium hover:bg-gray-200",type:"button",onClick:o[12]||(o[12]=x=>l.dailyCostLimit="200")}," $200 "),e("button",{class:"rounded bg-gray-100 px-2 py-1 text-xs font-medium hover:bg-gray-200",type:"button",onClick:o[13]||(o[13]=x=>l.dailyCostLimit="")}," 自定义 ")]),P(e("input",{"onUpdate:modelValue":o[14]||(o[14]=x=>l.dailyCostLimit=x),class:"form-input w-full",min:"0",placeholder:"0 表示无限制",step:"0.01",type:"number"},null,512),[[ee,l.dailyCostLimit]]),o[57]||(o[57]=e("p",{class:"text-xs text-gray-500"}," 设置此 API Key 每日的费用限制,超过限制将拒绝请求,0 或留空表示无限制 ",-1))])]),e("div",null,[o[59]||(o[59]=e("label",{class:"mb-2 block text-sm font-semibold text-gray-700"},"并发限制 (可选)",-1)),P(e("input",{"onUpdate:modelValue":o[15]||(o[15]=x=>l.concurrencyLimit=x),class:"form-input w-full",min:"0",placeholder:"0 表示无限制",type:"number"},null,512),[[ee,l.concurrencyLimit]]),o[60]||(o[60]=e("p",{class:"mt-2 text-xs text-gray-500"}," 设置此 API Key 可同时处理的最大请求数,0 或留空表示无限制 ",-1))]),e("div",null,[o[61]||(o[61]=e("label",{class:"mb-2 block text-sm font-semibold text-gray-700"},"备注 (可选)",-1)),P(e("textarea",{"onUpdate:modelValue":o[16]||(o[16]=x=>l.description=x),class:"form-input w-full resize-none text-sm",placeholder:"描述此 API Key 的用途...",rows:"2"},null,512),[[ee,l.description]])]),e("div",null,[o[63]||(o[63]=e("label",{class:"mb-2 block text-sm font-semibold text-gray-700"},"有效期限",-1)),P(e("select",{"onUpdate:modelValue":o[17]||(o[17]=x=>l.expireDuration=x),class:"form-input w-full",onChange:A},o[62]||(o[62]=[e("option",{value:""},"永不过期",-1),e("option",{value:"1d"},"1 天",-1),e("option",{value:"7d"},"7 天",-1),e("option",{value:"30d"},"30 天",-1),e("option",{value:"90d"},"90 天",-1),e("option",{value:"180d"},"180 天",-1),e("option",{value:"365d"},"365 天",-1),e("option",{value:"custom"},"自定义日期",-1)]),544),[[Se,l.expireDuration]]),l.expireDuration==="custom"?(r(),d("div",gs,[P(e("input",{"onUpdate:modelValue":o[18]||(o[18]=x=>l.customExpireDate=x),class:"form-input w-full",min:I.value,type:"datetime-local",onChange:f},null,40,ys),[[ee,l.customExpireDate]])])):v("",!0),l.expiresAt?(r(),d("p",bs," 将于 "+c(N(l.expiresAt))+" 过期 ",1)):v("",!0)]),e("div",null,[o[68]||(o[68]=e("label",{class:"mb-2 block text-sm font-semibold text-gray-700"},"服务权限",-1)),e("div",vs,[e("label",ws,[P(e("input",{"onUpdate:modelValue":o[19]||(o[19]=x=>l.permissions=x),class:"mr-2",type:"radio",value:"all"},null,512),[[ue,l.permissions]]),o[64]||(o[64]=e("span",{class:"text-sm text-gray-700"},"全部服务",-1))]),e("label",hs,[P(e("input",{"onUpdate:modelValue":o[20]||(o[20]=x=>l.permissions=x),class:"mr-2",type:"radio",value:"claude"},null,512),[[ue,l.permissions]]),o[65]||(o[65]=e("span",{class:"text-sm text-gray-700"},"仅 Claude",-1))]),e("label",$s,[P(e("input",{"onUpdate:modelValue":o[21]||(o[21]=x=>l.permissions=x),class:"mr-2",type:"radio",value:"gemini"},null,512),[[ue,l.permissions]]),o[66]||(o[66]=e("span",{class:"text-sm text-gray-700"},"仅 Gemini",-1))]),e("label",As,[P(e("input",{"onUpdate:modelValue":o[22]||(o[22]=x=>l.permissions=x),class:"mr-2",type:"radio",value:"openai"},null,512),[[ue,l.permissions]]),o[67]||(o[67]=e("span",{class:"text-sm text-gray-700"},"仅 OpenAI",-1))])]),o[69]||(o[69]=e("p",{class:"mt-2 text-xs text-gray-500"},"控制此 API Key 可以访问哪些服务",-1))]),e("div",null,[e("div",ks,[o[70]||(o[70]=e("label",{class:"text-sm font-semibold text-gray-700"},"专属账号绑定 (可选)",-1)),e("button",{class:"flex items-center gap-1 text-sm text-blue-600 transition-colors hover:text-blue-800 disabled:cursor-not-allowed disabled:opacity-50",disabled:B.value,title:"刷新账号列表",type:"button",onClick:J},[e("i",{class:U(["fas",B.value?"fa-spinner fa-spin":"fa-sync-alt","text-xs"])},null,2),e("span",null,c(B.value?"刷新中...":"刷新账号"),1)],8,Cs)]),e("div",Ks,[e("div",null,[o[71]||(o[71]=e("label",{class:"mb-1 block text-sm font-medium text-gray-600"},"Claude 专属账号",-1)),ne(fe,{modelValue:l.claudeAccountId,"onUpdate:modelValue":o[23]||(o[23]=x=>l.claudeAccountId=x),accounts:C.value.claude,"default-option-text":"使用共享账号池",disabled:l.permissions==="gemini"||l.permissions==="openai",groups:C.value.claudeGroups,placeholder:"请选择Claude账号",platform:"claude"},null,8,["modelValue","accounts","disabled","groups"])]),e("div",null,[o[72]||(o[72]=e("label",{class:"mb-1 block text-sm font-medium text-gray-600"},"Gemini 专属账号",-1)),ne(fe,{modelValue:l.geminiAccountId,"onUpdate:modelValue":o[24]||(o[24]=x=>l.geminiAccountId=x),accounts:C.value.gemini,"default-option-text":"使用共享账号池",disabled:l.permissions==="claude"||l.permissions==="openai",groups:C.value.geminiGroups,placeholder:"请选择Gemini账号",platform:"gemini"},null,8,["modelValue","accounts","disabled","groups"])]),e("div",null,[o[73]||(o[73]=e("label",{class:"mb-1 block text-sm font-medium text-gray-600"},"OpenAI 专属账号",-1)),ne(fe,{modelValue:l.openaiAccountId,"onUpdate:modelValue":o[25]||(o[25]=x=>l.openaiAccountId=x),accounts:C.value.openai,"default-option-text":"使用共享账号池",disabled:l.permissions==="claude"||l.permissions==="gemini",groups:C.value.openaiGroups,placeholder:"请选择OpenAI账号",platform:"openai"},null,8,["modelValue","accounts","disabled","groups"])]),e("div",null,[o[74]||(o[74]=e("label",{class:"mb-1 block text-sm font-medium text-gray-600"},"Bedrock 专属账号",-1)),ne(fe,{modelValue:l.bedrockAccountId,"onUpdate:modelValue":o[26]||(o[26]=x=>l.bedrockAccountId=x),accounts:C.value.bedrock,"default-option-text":"使用共享账号池",disabled:l.permissions==="gemini"||l.permissions==="openai",groups:[],placeholder:"请选择Bedrock账号",platform:"bedrock"},null,8,["modelValue","accounts","disabled"])])]),o[75]||(o[75]=e("p",{class:"mt-2 text-xs text-gray-500"}," 选择专属账号后,此API Key将只使用该账号,不选择则使用共享账号池 ",-1))]),e("div",null,[e("div",Is,[P(e("input",{id:"enableModelRestriction","onUpdate:modelValue":o[27]||(o[27]=x=>l.enableModelRestriction=x),class:"h-4 w-4 rounded border-gray-300 bg-gray-100 text-blue-600 focus:ring-blue-500",type:"checkbox"},null,512),[[ye,l.enableModelRestriction]]),o[76]||(o[76]=e("label",{class:"ml-2 cursor-pointer text-sm font-semibold text-gray-700",for:"enableModelRestriction"}," 启用模型限制 ",-1))]),l.enableModelRestriction?(r(),d("div",Ds,[e("div",null,[o[79]||(o[79]=e("label",{class:"mb-2 block text-sm font-medium text-gray-600"},"限制的模型列表",-1)),e("div",Ls,[(r(!0),d(Q,null,te(l.restrictedModels,(x,Y)=>(r(),d("span",{key:Y,class:"inline-flex items-center rounded-full bg-red-100 px-3 py-1 text-sm text-red-800"},[K(c(x)+" ",1),e("button",{class:"ml-2 text-red-600 hover:text-red-800",type:"button",onClick:W=>D(Y)},o[77]||(o[77]=[e("i",{class:"fas fa-times text-xs"},null,-1)]),8,_s)]))),128)),l.restrictedModels.length===0?(r(),d("span",Ms," 暂无限制的模型 ")):v("",!0)]),e("div",Ts,[e("div",Ss,[(r(!0),d(Q,null,te(ae.value,x=>(r(),d("button",{key:x,class:"flex-shrink-0 rounded-lg bg-gray-100 px-3 py-1 text-xs text-gray-700 transition-colors hover:bg-gray-200 sm:text-sm",type:"button",onClick:Y=>R(x)},c(x),9,Rs))),128)),ae.value.length===0?(r(),d("span",js," 所有常用模型已在限制列表中 ")):v("",!0)]),e("div",Es,[P(e("input",{"onUpdate:modelValue":o[28]||(o[28]=x=>l.modelInput=x),class:"form-input flex-1",placeholder:"输入模型名称,按回车添加",type:"text",onKeydown:Ke(me(se,["prevent"]),["enter"])},null,40,Vs),[[ee,l.modelInput]]),e("button",{class:"rounded-lg bg-red-500 px-4 py-2 text-white transition-colors hover:bg-red-600",type:"button",onClick:se},o[78]||(o[78]=[e("i",{class:"fas fa-plus"},null,-1)]))])]),o[80]||(o[80]=e("p",{class:"mt-2 text-xs text-gray-500"}," 设置此API Key无法访问的模型,例如:claude-opus-4-20250514 ",-1))])])):v("",!0)]),e("div",null,[e("div",Ps,[P(e("input",{id:"enableClientRestriction","onUpdate:modelValue":o[29]||(o[29]=x=>l.enableClientRestriction=x),class:"h-4 w-4 rounded border-gray-300 bg-gray-100 text-blue-600 focus:ring-blue-500",type:"checkbox"},null,512),[[ye,l.enableClientRestriction]]),o[81]||(o[81]=e("label",{class:"ml-2 cursor-pointer text-sm font-semibold text-gray-700",for:"enableClientRestriction"}," 启用客户端限制 ",-1))]),l.enableClientRestriction?(r(),d("div",Us,[e("div",null,[o[82]||(o[82]=e("label",{class:"mb-2 block text-xs font-medium text-gray-700"},"允许的客户端",-1)),e("div",qs,[(r(!0),d(Q,null,te(n.value,x=>(r(),d("div",{key:x.id,class:"flex items-start"},[P(e("input",{id:`client_${x.id}`,"onUpdate:modelValue":o[30]||(o[30]=Y=>l.allowedClients=Y),class:"mt-0.5 h-4 w-4 rounded border-gray-300 bg-gray-100 text-blue-600 focus:ring-blue-500",type:"checkbox",value:x.id},null,8,Gs),[[ye,l.allowedClients]]),e("label",{class:"ml-2 flex-1 cursor-pointer",for:`client_${x.id}`},[e("span",Ws,c(x.name),1),e("span",Fs,c(x.description),1)],8,Os)]))),128))])])])):v("",!0)]),e("div",Bs,[e("button",{class:"flex-1 rounded-lg bg-gray-100 px-4 py-2.5 text-sm font-semibold text-gray-700 transition-colors hover:bg-gray-200",type:"button",onClick:o[31]||(o[31]=x=>b.$emit("close"))}," 取消 "),e("button",{class:"btn btn-primary flex-1 px-4 py-2.5 text-sm font-semibold",disabled:k.value,type:"submit"},[k.value?(r(),d("div",Hs)):(r(),d("i",Ns)),K(" "+c(k.value?"创建中...":"创建"),1)],8,zs)])],32)])])]))}},Qs=pe(Ys,[["__scopeId","data-v-0e109f3d"]]),Js={class:"modal fixed inset-0 z-50 flex items-center justify-center p-3 sm:p-4"},Xs={class:"modal-content mx-auto flex max-h-[90vh] w-full max-w-4xl flex-col p-4 sm:p-6 md:p-8"},Zs={class:"mb-4 flex items-center justify-between sm:mb-6"},el=["value"],tl={class:"space-y-4"},sl={key:0},ll={class:"flex flex-wrap gap-2"},ol=["onClick"],nl={key:1},il={class:"flex flex-wrap gap-2"},al=["onClick"],rl={class:"flex gap-2"},dl=["onKeypress"],ul={class:"rounded-lg border border-blue-200 bg-blue-50 p-3"},cl={class:"space-y-2"},ml={class:"grid grid-cols-1 gap-2 lg:grid-cols-3"},pl={class:"space-y-3"},xl={class:"flex gap-2"},fl={class:"mb-3 flex items-center"},gl={class:"flex gap-4"},yl={class:"flex cursor-pointer items-center"},bl={class:"flex cursor-pointer items-center"},vl={class:"flex cursor-pointer items-center"},wl={class:"flex cursor-pointer items-center"},hl={class:"mb-3 flex items-center justify-between"},$l=["disabled"],Al={class:"grid grid-cols-1 gap-3"},kl={class:"mb-3 flex items-center"},Cl={key:0,class:"space-y-3"},Kl={class:"mb-3 flex min-h-[32px] flex-wrap gap-2 rounded-lg border border-gray-200 bg-gray-50 p-2"},Il=["onClick"],Dl={key:0,class:"text-sm text-gray-400"},Ll={class:"space-y-3"},_l={class:"flex flex-wrap gap-2"},Ml=["onClick"],Tl={key:0,class:"text-sm italic text-gray-400"},Sl={class:"flex gap-2"},Rl=["onKeydown"],jl={class:"mb-3 flex items-center"},El={key:0,class:"space-y-3"},Vl={class:"space-y-2"},Pl=["id","value"],Ul=["for"],ql={class:"text-sm font-medium text-gray-700"},Gl={class:"block text-xs text-gray-500"},Ol={class:"flex gap-3 pt-4"},Wl=["disabled"],Fl={key:0,class:"loading-spinner mr-2"},Bl={key:1,class:"fas fa-save mr-2"},zl={__name:"EditApiKeyModal",props:{apiKey:{type:Object,required:!0},accounts:{type:Object,default:()=>({claude:[],gemini:[]})}},emits:["close","success"],setup(w,{emit:H}){const u=w,V=H,E=Re(),h=tt(),k=M(!1),B=M(!1),C=M({claude:[],gemini:[],openai:[],bedrock:[],claudeGroups:[],geminiGroups:[],openaiGroups:[]}),O=M([]),j=M(""),y=M([]),T=F(()=>y.value.filter(R=>!n.tags.includes(R))),n=De({name:"",tokenLimit:"",rateLimitWindow:"",rateLimitRequests:"",concurrencyLimit:"",dailyCostLimit:"",permissions:"all",claudeAccountId:"",geminiAccountId:"",openaiAccountId:"",bedrockAccountId:"",enableModelRestriction:!1,restrictedModels:[],modelInput:"",enableClientRestriction:!1,allowedClients:[],tags:[],isActive:!0}),l=()=>{n.modelInput&&!n.restrictedModels.includes(n.modelInput)&&(n.restrictedModels.push(n.modelInput),n.modelInput="")},J=R=>{n.restrictedModels.splice(R,1)},I=M(["claude-opus-4-20250514","claude-opus-4-1-20250805"]),A=F(()=>I.value.filter(R=>!n.restrictedModels.includes(R))),f=R=>{n.restrictedModels.includes(R)||n.restrictedModels.push(R)},N=()=>{if(j.value&&j.value.trim()){const R=j.value.trim();n.tags.includes(R)||n.tags.push(R),j.value=""}},se=R=>{n.tags.includes(R)||n.tags.push(R)},D=R=>{n.tags.splice(R,1)},p=async()=>{k.value=!0;try{const R={tokenLimit:n.tokenLimit!==""&&n.tokenLimit!==null?parseInt(n.tokenLimit):0,rateLimitWindow:n.rateLimitWindow!==""&&n.rateLimitWindow!==null?parseInt(n.rateLimitWindow):0,rateLimitRequests:n.rateLimitRequests!==""&&n.rateLimitRequests!==null?parseInt(n.rateLimitRequests):0,concurrencyLimit:n.concurrencyLimit!==""&&n.concurrencyLimit!==null?parseInt(n.concurrencyLimit):0,dailyCostLimit:n.dailyCostLimit!==""&&n.dailyCostLimit!==null?parseFloat(n.dailyCostLimit):0,permissions:n.permissions,tags:n.tags};n.claudeAccountId?n.claudeAccountId.startsWith("console:")?(R.claudeConsoleAccountId=n.claudeAccountId.substring(8),R.claudeAccountId=null):(n.claudeAccountId.startsWith("group:"),R.claudeAccountId=n.claudeAccountId,R.claudeConsoleAccountId=null):(R.claudeAccountId=null,R.claudeConsoleAccountId=null),n.geminiAccountId?R.geminiAccountId=n.geminiAccountId:R.geminiAccountId=null,n.openaiAccountId?R.openaiAccountId=n.openaiAccountId:R.openaiAccountId=null,n.bedrockAccountId?R.bedrockAccountId=n.bedrockAccountId:R.bedrockAccountId=null,R.enableModelRestriction=n.enableModelRestriction,R.restrictedModels=n.restrictedModels,R.enableClientRestriction=n.enableClientRestriction,R.allowedClients=n.allowedClients,R.isActive=n.isActive;const a=await G.put(`/admin/api-keys/${u.apiKey.id}`,R);a.success?(V("success"),V("close")):q(a.message||"更新失败","error")}catch{q("更新失败","error")}finally{k.value=!1}},ae=async()=>{var R,a;B.value=!0;try{const[m,$,_,b,o,x]=await Promise.all([G.get("/admin/claude-accounts"),G.get("/admin/claude-console-accounts"),G.get("/admin/gemini-accounts"),G.get("/admin/openai-accounts"),G.get("/admin/bedrock-accounts"),G.get("/admin/account-groups")]),Y=[];if(m.success&&((R=m.data)==null||R.forEach(W=>{Y.push({...W,platform:"claude-oauth",isDedicated:W.accountType==="dedicated"})})),$.success&&((a=$.data)==null||a.forEach(W=>{Y.push({...W,platform:"claude-console",isDedicated:W.accountType==="dedicated"})})),C.value.claude=Y,_.success&&(C.value.gemini=(_.data||[]).map(W=>({...W,isDedicated:W.accountType==="dedicated"}))),b.success&&(C.value.openai=(b.data||[]).map(W=>({...W,isDedicated:W.accountType==="dedicated"}))),o.success&&(C.value.bedrock=(o.data||[]).map(W=>({...W,isDedicated:W.accountType==="dedicated"}))),x.success){const W=x.data||[];C.value.claudeGroups=W.filter(Z=>Z.platform==="claude"),C.value.geminiGroups=W.filter(Z=>Z.platform==="gemini"),C.value.openaiGroups=W.filter(Z=>Z.platform==="openai")}q("账号列表已刷新","success")}catch{q("刷新账号列表失败","error")}finally{B.value=!1}};return Ie(async()=>{O.value=await E.loadSupportedClients(),y.value=await h.fetchTags(),u.accounts&&(C.value={claude:u.accounts.claude||[],gemini:u.accounts.gemini||[],openai:u.accounts.openai||[],bedrock:u.accounts.bedrock||[],claudeGroups:u.accounts.claudeGroups||[],geminiGroups:u.accounts.geminiGroups||[],openaiGroups:u.accounts.openaiGroups||[]}),n.name=u.apiKey.name,n.tokenLimit=u.apiKey.tokenLimit||"",n.rateLimitWindow=u.apiKey.rateLimitWindow||"",n.rateLimitRequests=u.apiKey.rateLimitRequests||"",n.concurrencyLimit=u.apiKey.concurrencyLimit||"",n.dailyCostLimit=u.apiKey.dailyCostLimit||"",n.permissions=u.apiKey.permissions||"all",u.apiKey.claudeConsoleAccountId?n.claudeAccountId=`console:${u.apiKey.claudeConsoleAccountId}`:n.claudeAccountId=u.apiKey.claudeAccountId||"",n.geminiAccountId=u.apiKey.geminiAccountId||"",n.openaiAccountId=u.apiKey.openaiAccountId||"",n.bedrockAccountId=u.apiKey.bedrockAccountId||"",n.restrictedModels=u.apiKey.restrictedModels||[],n.allowedClients=u.apiKey.allowedClients||[],n.tags=u.apiKey.tags||[],n.enableModelRestriction=u.apiKey.enableModelRestriction||!1,n.enableClientRestriction=u.apiKey.enableClientRestriction||!1,n.isActive=u.apiKey.isActive!==void 0?u.apiKey.isActive:!0}),(R,a)=>(r(),oe(ge,{to:"body"},[e("div",Js,[e("div",Xs,[e("div",Zs,[a[26]||(a[26]=e("div",{class:"flex items-center gap-2 sm:gap-3"},[e("div",{class:"flex h-8 w-8 items-center justify-center rounded-lg bg-gradient-to-br from-blue-500 to-blue-600 sm:h-10 sm:w-10 sm:rounded-xl"},[e("i",{class:"fas fa-edit text-sm text-white sm:text-base"})]),e("h3",{class:"text-lg font-bold text-gray-900 sm:text-xl"},"编辑 API Key")],-1)),e("button",{class:"p-1 text-gray-400 transition-colors hover:text-gray-600",onClick:a[0]||(a[0]=m=>R.$emit("close"))},a[25]||(a[25]=[e("i",{class:"fas fa-times text-lg sm:text-xl"},null,-1)]))]),e("form",{class:"modal-scroll-content custom-scrollbar flex-1 space-y-4 sm:space-y-6",onSubmit:me(p,["prevent"])},[e("div",null,[a[27]||(a[27]=e("label",{class:"mb-1.5 block text-xs font-semibold text-gray-700 sm:mb-3 sm:text-sm"},"名称",-1)),e("input",{class:"form-input w-full cursor-not-allowed bg-gray-100 text-sm",disabled:"",type:"text",value:n.name},null,8,el),a[28]||(a[28]=e("p",{class:"mt-1 text-xs text-gray-500 sm:mt-2"},"名称不可修改",-1))]),e("div",null,[a[36]||(a[36]=e("label",{class:"mb-1.5 block text-xs font-semibold text-gray-700 sm:mb-3 sm:text-sm"},"标签",-1)),e("div",tl,[n.tags.length>0?(r(),d("div",sl,[a[30]||(a[30]=e("div",{class:"mb-2 text-xs font-medium text-gray-600"},"已选择的标签:",-1)),e("div",ll,[(r(!0),d(Q,null,te(n.tags,(m,$)=>(r(),d("span",{key:"selected-"+$,class:"inline-flex items-center gap-1 rounded-full bg-blue-100 px-3 py-1 text-sm text-blue-800"},[K(c(m)+" ",1),e("button",{class:"ml-1 hover:text-blue-900",type:"button",onClick:_=>D($)},a[29]||(a[29]=[e("i",{class:"fas fa-times text-xs"},null,-1)]),8,ol)]))),128))])])):v("",!0),T.value.length>0?(r(),d("div",nl,[a[32]||(a[32]=e("div",{class:"mb-2 text-xs font-medium text-gray-600"},"点击选择已有标签:",-1)),e("div",il,[(r(!0),d(Q,null,te(T.value,m=>(r(),d("button",{key:"available-"+m,class:"inline-flex items-center gap-1 rounded-full bg-gray-100 px-3 py-1 text-sm text-gray-700 transition-colors hover:bg-blue-100 hover:text-blue-700",type:"button",onClick:$=>se(m)},[a[31]||(a[31]=e("i",{class:"fas fa-tag text-xs text-gray-500"},null,-1)),K(" "+c(m),1)],8,al))),128))])])):v("",!0),e("div",null,[a[34]||(a[34]=e("div",{class:"mb-2 text-xs font-medium text-gray-600"},"创建新标签:",-1)),e("div",rl,[P(e("input",{"onUpdate:modelValue":a[1]||(a[1]=m=>j.value=m),class:"form-input flex-1",placeholder:"输入新标签名称",type:"text",onKeypress:Ke(me(N,["prevent"]),["enter"])},null,40,dl),[[ee,j.value]]),e("button",{class:"rounded-lg bg-green-500 px-4 py-2 text-white transition-colors hover:bg-green-600",type:"button",onClick:N},a[33]||(a[33]=[e("i",{class:"fas fa-plus"},null,-1)]))])]),a[35]||(a[35]=e("p",{class:"text-xs text-gray-500"},"用于标记不同团队或用途,方便筛选管理",-1))])]),e("div",ul,[a[44]||(a[44]=e("div",{class:"mb-2 flex items-center gap-2"},[e("div",{class:"flex h-6 w-6 flex-shrink-0 items-center justify-center rounded bg-blue-500"},[e("i",{class:"fas fa-tachometer-alt text-xs text-white"})]),e("h4",{class:"text-sm font-semibold text-gray-800"},"速率限制设置 (可选)")],-1)),e("div",cl,[e("div",ml,[e("div",null,[a[37]||(a[37]=e("label",{class:"mb-1 block text-xs font-medium text-gray-700"},"时间窗口 (分钟)",-1)),P(e("input",{"onUpdate:modelValue":a[2]||(a[2]=m=>n.rateLimitWindow=m),class:"form-input w-full text-sm",min:"1",placeholder:"无限制",type:"number"},null,512),[[ee,n.rateLimitWindow]]),a[38]||(a[38]=e("p",{class:"ml-2 mt-0.5 text-xs text-gray-500"},"时间段单位",-1))]),e("div",null,[a[39]||(a[39]=e("label",{class:"mb-1 block text-xs font-medium text-gray-700"},"请求次数限制",-1)),P(e("input",{"onUpdate:modelValue":a[3]||(a[3]=m=>n.rateLimitRequests=m),class:"form-input w-full text-sm",min:"1",placeholder:"无限制",type:"number"},null,512),[[ee,n.rateLimitRequests]]),a[40]||(a[40]=e("p",{class:"ml-2 mt-0.5 text-xs text-gray-500"},"窗口内最大请求",-1))]),e("div",null,[a[41]||(a[41]=e("label",{class:"mb-1 block text-xs font-medium text-gray-700"},"Token 限制",-1)),P(e("input",{"onUpdate:modelValue":a[4]||(a[4]=m=>n.tokenLimit=m),class:"form-input w-full text-sm",placeholder:"无限制",type:"number"},null,512),[[ee,n.tokenLimit]]),a[42]||(a[42]=e("p",{class:"ml-2 mt-0.5 text-xs text-gray-500"},"窗口内最大Token",-1))])]),a[43]||(a[43]=e("div",{class:"rounded-lg bg-blue-100 p-2"},[e("h5",{class:"mb-1 text-xs font-semibold text-blue-800"},"💡 使用示例"),e("div",{class:"space-y-0.5 text-xs text-blue-700"},[e("div",null,[e("strong",null,"示例1:"),K(" 时间窗口=60,请求次数=1000 → 每60分钟最多1000次请求 ")]),e("div",null,[e("strong",null,"示例2:"),K(" 时间窗口=1,Token=10000 → 每分钟最多10,000个Token ")]),e("div",null,[e("strong",null,"示例3:"),K(" 窗口=30,请求=50,Token=100000 → 每30分钟50次请求且不超10万Token ")])])],-1))])]),e("div",null,[a[46]||(a[46]=e("label",{class:"mb-3 block text-sm font-semibold text-gray-700"},"每日费用限制 (美元)",-1)),e("div",pl,[e("div",xl,[e("button",{class:"rounded-lg bg-gray-100 px-3 py-1 text-sm font-medium hover:bg-gray-200",type:"button",onClick:a[5]||(a[5]=m=>n.dailyCostLimit="50")}," $50 "),e("button",{class:"rounded-lg bg-gray-100 px-3 py-1 text-sm font-medium hover:bg-gray-200",type:"button",onClick:a[6]||(a[6]=m=>n.dailyCostLimit="100")}," $100 "),e("button",{class:"rounded-lg bg-gray-100 px-3 py-1 text-sm font-medium hover:bg-gray-200",type:"button",onClick:a[7]||(a[7]=m=>n.dailyCostLimit="200")}," $200 "),e("button",{class:"rounded-lg bg-gray-100 px-3 py-1 text-sm font-medium hover:bg-gray-200",type:"button",onClick:a[8]||(a[8]=m=>n.dailyCostLimit="")}," 自定义 ")]),P(e("input",{"onUpdate:modelValue":a[9]||(a[9]=m=>n.dailyCostLimit=m),class:"form-input w-full",min:"0",placeholder:"0 表示无限制",step:"0.01",type:"number"},null,512),[[ee,n.dailyCostLimit]]),a[45]||(a[45]=e("p",{class:"text-xs text-gray-500"}," 设置此 API Key 每日的费用限制,超过限制将拒绝请求,0 或留空表示无限制 ",-1))])]),e("div",null,[a[47]||(a[47]=e("label",{class:"mb-3 block text-sm font-semibold text-gray-700"},"并发限制",-1)),P(e("input",{"onUpdate:modelValue":a[10]||(a[10]=m=>n.concurrencyLimit=m),class:"form-input w-full",min:"0",placeholder:"0 表示无限制",type:"number"},null,512),[[ee,n.concurrencyLimit]]),a[48]||(a[48]=e("p",{class:"mt-2 text-xs text-gray-500"},"设置此 API Key 可同时处理的最大请求数",-1))]),e("div",null,[e("div",fl,[P(e("input",{id:"editIsActive","onUpdate:modelValue":a[11]||(a[11]=m=>n.isActive=m),class:"h-4 w-4 rounded border-gray-300 bg-gray-100 text-blue-600 focus:ring-blue-500",type:"checkbox"},null,512),[[ye,n.isActive]]),a[49]||(a[49]=e("label",{class:"ml-2 cursor-pointer text-sm font-semibold text-gray-700",for:"editIsActive"}," 激活账号 ",-1))]),a[50]||(a[50]=e("p",{class:"mb-4 text-xs text-gray-500"}," 取消勾选将禁用此 API Key,暂停所有请求,客户端返回 401 错误 ",-1))]),e("div",null,[a[55]||(a[55]=e("label",{class:"mb-3 block text-sm font-semibold text-gray-700"},"服务权限",-1)),e("div",gl,[e("label",yl,[P(e("input",{"onUpdate:modelValue":a[12]||(a[12]=m=>n.permissions=m),class:"mr-2",type:"radio",value:"all"},null,512),[[ue,n.permissions]]),a[51]||(a[51]=e("span",{class:"text-sm text-gray-700"},"全部服务",-1))]),e("label",bl,[P(e("input",{"onUpdate:modelValue":a[13]||(a[13]=m=>n.permissions=m),class:"mr-2",type:"radio",value:"claude"},null,512),[[ue,n.permissions]]),a[52]||(a[52]=e("span",{class:"text-sm text-gray-700"},"仅 Claude",-1))]),e("label",vl,[P(e("input",{"onUpdate:modelValue":a[14]||(a[14]=m=>n.permissions=m),class:"mr-2",type:"radio",value:"gemini"},null,512),[[ue,n.permissions]]),a[53]||(a[53]=e("span",{class:"text-sm text-gray-700"},"仅 Gemini",-1))]),e("label",wl,[P(e("input",{"onUpdate:modelValue":a[15]||(a[15]=m=>n.permissions=m),class:"mr-2",type:"radio",value:"openai"},null,512),[[ue,n.permissions]]),a[54]||(a[54]=e("span",{class:"text-sm text-gray-700"},"仅 OpenAI",-1))])]),a[56]||(a[56]=e("p",{class:"mt-2 text-xs text-gray-500"},"控制此 API Key 可以访问哪些服务",-1))]),e("div",null,[e("div",hl,[a[57]||(a[57]=e("label",{class:"text-sm font-semibold text-gray-700"},"专属账号绑定",-1)),e("button",{class:"flex items-center gap-1 text-sm text-blue-600 transition-colors hover:text-blue-800 disabled:cursor-not-allowed disabled:opacity-50",disabled:B.value,title:"刷新账号列表",type:"button",onClick:ae},[e("i",{class:U(["fas",B.value?"fa-spinner fa-spin":"fa-sync-alt","text-xs"])},null,2),e("span",null,c(B.value?"刷新中...":"刷新账号"),1)],8,$l)]),e("div",Al,[e("div",null,[a[58]||(a[58]=e("label",{class:"mb-1 block text-sm font-medium text-gray-600"},"Claude 专属账号",-1)),ne(fe,{modelValue:n.claudeAccountId,"onUpdate:modelValue":a[16]||(a[16]=m=>n.claudeAccountId=m),accounts:C.value.claude,"default-option-text":"使用共享账号池",disabled:n.permissions==="gemini"||n.permissions==="openai",groups:C.value.claudeGroups,placeholder:"请选择Claude账号",platform:"claude"},null,8,["modelValue","accounts","disabled","groups"])]),e("div",null,[a[59]||(a[59]=e("label",{class:"mb-1 block text-sm font-medium text-gray-600"},"Gemini 专属账号",-1)),ne(fe,{modelValue:n.geminiAccountId,"onUpdate:modelValue":a[17]||(a[17]=m=>n.geminiAccountId=m),accounts:C.value.gemini,"default-option-text":"使用共享账号池",disabled:n.permissions==="claude"||n.permissions==="openai",groups:C.value.geminiGroups,placeholder:"请选择Gemini账号",platform:"gemini"},null,8,["modelValue","accounts","disabled","groups"])]),e("div",null,[a[60]||(a[60]=e("label",{class:"mb-1 block text-sm font-medium text-gray-600"},"OpenAI 专属账号",-1)),ne(fe,{modelValue:n.openaiAccountId,"onUpdate:modelValue":a[18]||(a[18]=m=>n.openaiAccountId=m),accounts:C.value.openai,"default-option-text":"使用共享账号池",disabled:n.permissions==="claude"||n.permissions==="gemini",groups:C.value.openaiGroups,placeholder:"请选择OpenAI账号",platform:"openai"},null,8,["modelValue","accounts","disabled","groups"])]),e("div",null,[a[61]||(a[61]=e("label",{class:"mb-1 block text-sm font-medium text-gray-600"},"Bedrock 专属账号",-1)),ne(fe,{modelValue:n.bedrockAccountId,"onUpdate:modelValue":a[19]||(a[19]=m=>n.bedrockAccountId=m),accounts:C.value.bedrock,"default-option-text":"使用共享账号池",disabled:n.permissions==="gemini"||n.permissions==="openai",groups:[],placeholder:"请选择Bedrock账号",platform:"bedrock"},null,8,["modelValue","accounts","disabled"])])]),a[62]||(a[62]=e("p",{class:"mt-2 text-xs text-gray-500"},"修改绑定账号将影响此API Key的请求路由",-1))]),e("div",null,[e("div",kl,[P(e("input",{id:"editEnableModelRestriction","onUpdate:modelValue":a[20]||(a[20]=m=>n.enableModelRestriction=m),class:"h-4 w-4 rounded border-gray-300 bg-gray-100 text-blue-600 focus:ring-blue-500",type:"checkbox"},null,512),[[ye,n.enableModelRestriction]]),a[63]||(a[63]=e("label",{class:"ml-2 cursor-pointer text-sm font-semibold text-gray-700",for:"editEnableModelRestriction"}," 启用模型限制 ",-1))]),n.enableModelRestriction?(r(),d("div",Cl,[e("div",null,[a[66]||(a[66]=e("label",{class:"mb-2 block text-sm font-medium text-gray-600"},"限制的模型列表",-1)),e("div",Kl,[(r(!0),d(Q,null,te(n.restrictedModels,(m,$)=>(r(),d("span",{key:$,class:"inline-flex items-center rounded-full bg-red-100 px-3 py-1 text-sm text-red-800"},[K(c(m)+" ",1),e("button",{class:"ml-2 text-red-600 hover:text-red-800",type:"button",onClick:_=>J($)},a[64]||(a[64]=[e("i",{class:"fas fa-times text-xs"},null,-1)]),8,Il)]))),128)),n.restrictedModels.length===0?(r(),d("span",Dl," 暂无限制的模型 ")):v("",!0)]),e("div",Ll,[e("div",_l,[(r(!0),d(Q,null,te(A.value,m=>(r(),d("button",{key:m,class:"flex-shrink-0 rounded-lg bg-gray-100 px-3 py-1 text-xs text-gray-700 transition-colors hover:bg-gray-200 sm:text-sm",type:"button",onClick:$=>f(m)},c(m),9,Ml))),128)),A.value.length===0?(r(),d("span",Tl," 所有常用模型已在限制列表中 ")):v("",!0)]),e("div",Sl,[P(e("input",{"onUpdate:modelValue":a[21]||(a[21]=m=>n.modelInput=m),class:"form-input flex-1",placeholder:"输入模型名称,按回车添加",type:"text",onKeydown:Ke(me(l,["prevent"]),["enter"])},null,40,Rl),[[ee,n.modelInput]]),e("button",{class:"rounded-lg bg-red-500 px-4 py-2 text-white transition-colors hover:bg-red-600",type:"button",onClick:l},a[65]||(a[65]=[e("i",{class:"fas fa-plus"},null,-1)]))])]),a[67]||(a[67]=e("p",{class:"mt-2 text-xs text-gray-500"}," 设置此API Key无法访问的模型,例如:claude-opus-4-20250514 ",-1))])])):v("",!0)]),e("div",null,[e("div",jl,[P(e("input",{id:"editEnableClientRestriction","onUpdate:modelValue":a[22]||(a[22]=m=>n.enableClientRestriction=m),class:"h-4 w-4 rounded border-gray-300 bg-gray-100 text-blue-600 focus:ring-blue-500",type:"checkbox"},null,512),[[ye,n.enableClientRestriction]]),a[68]||(a[68]=e("label",{class:"ml-2 cursor-pointer text-sm font-semibold text-gray-700",for:"editEnableClientRestriction"}," 启用客户端限制 ",-1))]),n.enableClientRestriction?(r(),d("div",El,[e("div",null,[a[69]||(a[69]=e("label",{class:"mb-2 block text-sm font-medium text-gray-600"},"允许的客户端",-1)),a[70]||(a[70]=e("p",{class:"mb-3 text-xs text-gray-500"},"勾选允许使用此API Key的客户端",-1)),e("div",Vl,[(r(!0),d(Q,null,te(O.value,m=>(r(),d("div",{key:m.id,class:"flex items-start"},[P(e("input",{id:`edit_client_${m.id}`,"onUpdate:modelValue":a[23]||(a[23]=$=>n.allowedClients=$),class:"mt-0.5 h-4 w-4 rounded border-gray-300 bg-gray-100 text-blue-600 focus:ring-blue-500",type:"checkbox",value:m.id},null,8,Pl),[[ye,n.allowedClients]]),e("label",{class:"ml-2 flex-1 cursor-pointer",for:`edit_client_${m.id}`},[e("span",ql,c(m.name),1),e("span",Gl,c(m.description),1)],8,Ul)]))),128))])])])):v("",!0)]),e("div",Ol,[e("button",{class:"flex-1 rounded-xl bg-gray-100 px-6 py-3 font-semibold text-gray-700 transition-colors hover:bg-gray-200",type:"button",onClick:a[24]||(a[24]=m=>R.$emit("close"))}," 取消 "),e("button",{class:"btn btn-primary flex-1 px-6 py-3 font-semibold",disabled:k.value,type:"submit"},[k.value?(r(),d("div",Fl)):(r(),d("i",Bl)),K(" "+c(k.value?"保存中...":"保存修改"),1)],8,Wl)])],32)])])]))}},Hl=pe(zl,[["__scopeId","data-v-daa37736"]]),Nl={class:"modal fixed inset-0 z-50 flex items-center justify-center p-4"},Yl={class:"modal-content mx-auto flex max-h-[90vh] w-full max-w-md flex-col p-8"},Ql={class:"mb-6 flex items-center justify-between"},Jl={class:"modal-scroll-content custom-scrollbar flex-1 space-y-6"},Xl={class:"rounded-lg border border-blue-200 bg-blue-50 p-4"},Zl={class:"flex items-start gap-3"},eo={class:"text-sm text-gray-700"},to={class:"mt-1 text-xs text-gray-600"},so={key:0,class:"mt-3"},lo=["min"],oo={key:1,class:"mt-2 text-xs text-gray-500"},no={class:"flex gap-3 pt-4"},io=["disabled"],ao={key:0,class:"loading-spinner mr-2"},ro={key:1,class:"fas fa-clock mr-2"},uo={__name:"RenewApiKeyModal",props:{apiKey:{type:Object,required:!0}},emits:["close","success"],setup(w,{emit:H}){const u=w,V=H,E=M(!1),h=De({renewDuration:"30d",customExpireDate:"",newExpiresAt:null}),k=F(()=>{const y=new Date;return u.apiKey.expiresAt&&new Date(u.apiKey.expiresAt)>y?new Date(u.apiKey.expiresAt).toISOString().slice(0,16):(y.setMinutes(y.getMinutes()+1),y.toISOString().slice(0,16))}),B=y=>new Date(y).toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}),C=()=>{if(!h.renewDuration){h.newExpiresAt=null;return}if(h.renewDuration==="permanent"){h.newExpiresAt=null;return}if(h.renewDuration==="custom")return;const y=u.apiKey.expiresAt&&new Date(u.apiKey.expiresAt)>new Date?new Date(u.apiKey.expiresAt):new Date,n=h.renewDuration.match(/(\d+)([dhmy])/);if(n){const[,l,J]=n,I=parseInt(l);switch(J){case"d":y.setDate(y.getDate()+I);break;case"h":y.setHours(y.getHours()+I);break;case"m":y.setMonth(y.getMonth()+I);break;case"y":y.setFullYear(y.getFullYear()+I);break}h.newExpiresAt=y.toISOString()}},O=()=>{h.customExpireDate&&(h.newExpiresAt=new Date(h.customExpireDate).toISOString())},j=async()=>{E.value=!0;try{const y={expiresAt:h.renewDuration==="permanent"?null:h.newExpiresAt},T=await G.put(`/admin/api-keys/${u.apiKey.id}`,y);T.success?(q("API Key 续期成功","success"),V("success"),V("close")):q(T.message||"续期失败","error")}catch{q("续期失败","error")}finally{E.value=!1}};return C(),(y,T)=>(r(),oe(ge,{to:"body"},[e("div",Nl,[e("div",Yl,[e("div",Ql,[T[5]||(T[5]=e("div",{class:"flex items-center gap-3"},[e("div",{class:"flex h-10 w-10 items-center justify-center rounded-xl bg-gradient-to-br from-green-500 to-green-600"},[e("i",{class:"fas fa-clock text-white"})]),e("h3",{class:"text-xl font-bold text-gray-900"},"续期 API Key")],-1)),e("button",{class:"text-gray-400 transition-colors hover:text-gray-600",onClick:T[0]||(T[0]=n=>y.$emit("close"))},T[4]||(T[4]=[e("i",{class:"fas fa-times text-xl"},null,-1)]))]),e("div",Jl,[e("div",Xl,[e("div",Zl,[T[7]||(T[7]=e("div",{class:"flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-lg bg-blue-500"},[e("i",{class:"fas fa-info text-sm text-white"})],-1)),e("div",null,[T[6]||(T[6]=e("h4",{class:"mb-1 font-semibold text-gray-800"},"API Key 信息",-1)),e("p",eo,c(w.apiKey.name),1),e("p",to," 当前过期时间:"+c(w.apiKey.expiresAt?B(w.apiKey.expiresAt):"永不过期"),1)])])]),e("div",null,[T[9]||(T[9]=e("label",{class:"mb-3 block text-sm font-semibold text-gray-700"},"续期时长",-1)),P(e("select",{"onUpdate:modelValue":T[1]||(T[1]=n=>h.renewDuration=n),class:"form-input w-full",onChange:C},T[8]||(T[8]=[e("option",{value:"7d"},"延长 7 天",-1),e("option",{value:"30d"},"延长 30 天",-1),e("option",{value:"90d"},"延长 90 天",-1),e("option",{value:"180d"},"延长 180 天",-1),e("option",{value:"365d"},"延长 365 天",-1),e("option",{value:"custom"},"自定义日期",-1),e("option",{value:"permanent"},"设为永不过期",-1)]),544),[[Se,h.renewDuration]]),h.renewDuration==="custom"?(r(),d("div",so,[P(e("input",{"onUpdate:modelValue":T[2]||(T[2]=n=>h.customExpireDate=n),class:"form-input w-full",min:k.value,type:"datetime-local",onChange:O},null,40,lo),[[ee,h.customExpireDate]])])):v("",!0),h.newExpiresAt?(r(),d("p",oo," 新的过期时间:"+c(B(h.newExpiresAt)),1)):v("",!0)])]),e("div",no,[e("button",{class:"flex-1 rounded-xl bg-gray-100 px-6 py-3 font-semibold text-gray-700 transition-colors hover:bg-gray-200",type:"button",onClick:T[3]||(T[3]=n=>y.$emit("close"))}," 取消 "),e("button",{class:"btn btn-primary flex-1 px-6 py-3 font-semibold",disabled:E.value||!h.renewDuration,type:"button",onClick:j},[E.value?(r(),d("div",ao)):(r(),d("i",ro)),K(" "+c(E.value?"续期中...":"确认续期"),1)],8,io)])])])]))}},co=pe(uo,[["__scopeId","data-v-2fba52a3"]]),mo={class:"modal fixed inset-0 z-50 flex items-center justify-center p-4"},po={class:"modal-content custom-scrollbar mx-auto max-h-[90vh] w-full max-w-lg overflow-y-auto p-8"},xo={class:"mb-6 space-y-4"},fo={class:"rounded-lg border bg-gray-50 p-3"},go={class:"font-medium text-gray-900"},yo={key:0},bo={class:"rounded-lg border bg-gray-50 p-3"},vo={class:"text-gray-700"},wo={class:"relative"},ho={class:"flex min-h-[60px] items-center break-all rounded-lg border bg-gray-900 p-4 pr-14 font-mono text-sm text-white"},$o={class:"absolute right-3 top-3"},Ao=["title"],ko={__name:"NewApiKeyModal",props:{apiKey:{type:Object,required:!0}},emits:["close"],setup(w,{emit:H}){const u=w,V=H,E=M(!1),h=()=>{E.value=!E.value},k=()=>{const j=u.apiKey.apiKey||u.apiKey.key||"";return j?E.value||j.length<=12?j:j.substring(0,8)+"●".repeat(Math.max(0,j.length-12))+j.substring(j.length-4):""},B=async()=>{const j=u.apiKey.apiKey||u.apiKey.key||"";if(!j){q("API Key 不存在","error");return}try{await navigator.clipboard.writeText(j),q("API Key 已复制到剪贴板","success")}catch(y){console.error("Failed to copy:",y);const T=document.createElement("textarea");T.value=j,document.body.appendChild(T),T.select();try{document.execCommand("copy"),q("API Key 已复制到剪贴板","success")}catch{q("复制失败,请手动复制","error")}finally{document.body.removeChild(T)}}},C=async()=>{window.showConfirm?await window.showConfirm("关闭提醒",`关闭后将无法再次查看完整的API Key,请确保已经妥善保存。
|
||
|
||
确定要关闭吗?`,"确定关闭","取消")&&V("close"):confirm(`关闭后将无法再次查看完整的API Key,请确保已经妥善保存。
|
||
|
||
确定要关闭吗?`)&&V("close")},O=async()=>{window.showConfirm?await window.showConfirm("确定要关闭吗?",`您还没有保存API Key,关闭后将无法再次查看。
|
||
|
||
建议您先复制API Key再关闭。`,"仍然关闭","返回复制")&&V("close"):confirm(`您还没有保存API Key,关闭后将无法再次查看。
|
||
|
||
确定要关闭吗?`)&&V("close")};return(j,y)=>(r(),oe(ge,{to:"body"},[e("div",mo,[e("div",po,[e("div",{class:"mb-6 flex items-center justify-between"},[y[1]||(y[1]=e("div",{class:"flex items-center gap-3"},[e("div",{class:"flex h-12 w-12 items-center justify-center rounded-xl bg-gradient-to-br from-green-500 to-green-600"},[e("i",{class:"fas fa-check text-lg text-white"})]),e("div",null,[e("h3",{class:"text-xl font-bold text-gray-900"},"API Key 创建成功"),e("p",{class:"text-sm text-gray-600"},"请妥善保存您的 API Key")])],-1)),e("button",{class:"text-gray-400 transition-colors hover:text-gray-600",title:"直接关闭(不推荐)",onClick:O},y[0]||(y[0]=[e("i",{class:"fas fa-times text-xl"},null,-1)]))]),y[7]||(y[7]=e("div",{class:"mb-6 border-l-4 border-amber-400 bg-amber-50 p-4"},[e("div",{class:"flex items-start"},[e("div",{class:"mt-0.5 flex h-6 w-6 flex-shrink-0 items-center justify-center rounded-lg bg-amber-400"},[e("i",{class:"fas fa-exclamation-triangle text-sm text-white"})]),e("div",{class:"ml-3"},[e("h5",{class:"mb-1 font-semibold text-amber-900"},"重要提醒"),e("p",{class:"text-sm text-amber-800"}," 这是您唯一能看到完整 API Key 的机会。关闭此窗口后,系统将不再显示完整的 API Key。请立即复制并妥善保存。 ")])])],-1)),e("div",xo,[e("div",null,[y[2]||(y[2]=e("label",{class:"mb-2 block text-sm font-semibold text-gray-700"},"API Key 名称",-1)),e("div",fo,[e("span",go,c(w.apiKey.name),1)])]),w.apiKey.description?(r(),d("div",yo,[y[3]||(y[3]=e("label",{class:"mb-2 block text-sm font-semibold text-gray-700"},"备注",-1)),e("div",bo,[e("span",vo,c(w.apiKey.description||"无描述"),1)])])):v("",!0),e("div",null,[y[4]||(y[4]=e("label",{class:"mb-2 block text-sm font-semibold text-gray-700"},"API Key",-1)),e("div",wo,[e("div",ho,c(k()),1),e("div",$o,[e("button",{class:"btn-icon-sm bg-gray-700 hover:bg-gray-800",title:E.value?"隐藏API Key":"显示完整API Key",type:"button",onClick:h},[e("i",{class:U(["fas",E.value?"fa-eye-slash":"fa-eye","text-gray-300"])},null,2)],8,Ao)])]),y[5]||(y[5]=e("p",{class:"mt-2 text-xs text-gray-500"}," 点击眼睛图标切换显示模式,使用下方按钮复制完整 API Key ",-1))])]),e("div",{class:"flex gap-3"},[e("button",{class:"btn btn-primary flex flex-1 items-center justify-center gap-2 px-6 py-3 font-semibold",onClick:B},y[6]||(y[6]=[e("i",{class:"fas fa-copy"},null,-1),K(" 复制 API Key ",-1)])),e("button",{class:"rounded-xl border border-gray-300 bg-gray-200 px-6 py-3 font-semibold text-gray-800 transition-colors hover:bg-gray-300",onClick:C}," 我已保存 ")])])])]))}},Co=pe(ko,[["__scopeId","data-v-75e2b028"]]),Ko={class:"modal fixed inset-0 z-50 flex items-center justify-center p-4"},Io={class:"modal-content custom-scrollbar mx-auto max-h-[90vh] w-full max-w-2xl overflow-y-auto p-8"},Do={class:"mb-6 flex items-center justify-between"},Lo={class:"flex items-center gap-3"},_o={class:"text-sm text-gray-600"},Mo={class:"mb-6 grid grid-cols-2 gap-4 md:grid-cols-4"},To={class:"rounded-lg border border-blue-200 bg-gradient-to-br from-blue-50 to-blue-100 p-4"},So={class:"flex items-center justify-between"},Ro={class:"mt-1 text-2xl font-bold text-blue-900"},jo={class:"rounded-lg border border-green-200 bg-gradient-to-br from-green-50 to-green-100 p-4"},Eo={class:"flex items-center justify-between"},Vo={class:"mt-1 truncate text-lg font-bold text-green-900"},Po={class:"rounded-lg border border-purple-200 bg-gradient-to-br from-purple-50 to-purple-100 p-4"},Uo={class:"flex items-center justify-between"},qo={class:"mt-1 text-lg font-bold text-purple-900"},Go={class:"rounded-lg border border-orange-200 bg-gradient-to-br from-orange-50 to-orange-100 p-4"},Oo={class:"flex items-center justify-between"},Wo={class:"mt-1 text-lg font-bold text-orange-900"},Fo={class:"mb-6"},Bo={class:"mb-3 flex items-center justify-between"},zo={class:"flex items-center gap-2"},Ho={key:0,class:"custom-scrollbar max-h-48 overflow-y-auto rounded-lg bg-gray-900 p-4"},No={class:"font-mono text-xs text-gray-300"},Yo={__name:"BatchApiKeyModal",props:{apiKeys:{type:Array,required:!0}},emits:["close"],setup(w,{emit:H}){const u=w,V=H,E=M(!1),h=F(()=>{if(u.apiKeys.length>0){const n=u.apiKeys[0],l=n.name.match(/^(.+)_\d+$/);return l?l[1]:n.name}return""}),k=()=>{if(u.apiKeys.length===0)return"未知";const n=u.apiKeys[0].permissions;return{all:"全部服务",claude:"仅 Claude",gemini:"仅 Gemini"}[n]||n},B=()=>{if(u.apiKeys.length===0)return"未知";const n=u.apiKeys[0].expiresAt;if(!n)return"永不过期";const l=new Date(n),I=Math.ceil((l-new Date)/(1e3*60*60*24));return I<=7?`${I}天`:I<=30?`${Math.ceil(I/7)}周`:I<=365?`${Math.ceil(I/30)}个月`:`${Math.ceil(I/365)}年`},C=()=>{E.value=!E.value},O=()=>{const l=u.apiKeys.slice(0,10).map(J=>`${J.name}: ${J.apiKey||J.key||""}`);return u.apiKeys.length>10&&l.push(`... 还有 ${u.apiKeys.length-10} 个 API Key`),l.join(`
|
||
`)},j=()=>{const n=u.apiKeys.map(f=>`${f.name}: ${f.apiKey||f.key||""}`).join(`
|
||
`),l=new Blob([n],{type:"text/plain;charset=utf-8"}),J=URL.createObjectURL(l),I=document.createElement("a");I.href=J;const A=new Date().toISOString().replace(/[:.]/g,"-").slice(0,-5);I.download=`api-keys-${h.value}-${A}.txt`,document.body.appendChild(I),I.click(),document.body.removeChild(I),URL.revokeObjectURL(J),q("API Keys 文件已下载","success")},y=async()=>{window.showConfirm?await window.showConfirm("关闭提醒",`关闭后将无法再次查看这些 API Key,请确保已经下载并妥善保存。
|
||
|
||
确定要关闭吗?`,"确定关闭","返回下载")&&V("close"):confirm(`关闭后将无法再次查看这些 API Key,请确保已经下载并妥善保存。
|
||
|
||
确定要关闭吗?`)&&V("close")},T=async()=>{window.showConfirm?await window.showConfirm("确定要关闭吗?",`您还没有下载 API Keys,关闭后将无法再次查看。
|
||
|
||
强烈建议您先下载保存。`,"仍然关闭","返回下载")&&V("close"):confirm(`您还没有下载 API Keys,关闭后将无法再次查看。
|
||
|
||
确定要关闭吗?`)&&V("close")};return(n,l)=>(r(),oe(ge,{to:"body"},[e("div",Ko,[e("div",Io,[e("div",Do,[e("div",Lo,[l[1]||(l[1]=e("div",{class:"flex h-12 w-12 items-center justify-center rounded-xl bg-gradient-to-br from-green-500 to-green-600"},[e("i",{class:"fas fa-layer-group text-lg text-white"})],-1)),e("div",null,[l[0]||(l[0]=e("h3",{class:"text-xl font-bold text-gray-900"},"批量创建成功",-1)),e("p",_o,"成功创建 "+c(w.apiKeys.length)+" 个 API Key",1)])]),e("button",{class:"text-gray-400 transition-colors hover:text-gray-600",title:"直接关闭(不推荐)",onClick:T},l[2]||(l[2]=[e("i",{class:"fas fa-times text-xl"},null,-1)]))]),l[14]||(l[14]=e("div",{class:"mb-6 border-l-4 border-amber-400 bg-amber-50 p-4"},[e("div",{class:"flex items-start"},[e("div",{class:"mt-0.5 flex h-6 w-6 flex-shrink-0 items-center justify-center rounded-lg bg-amber-400"},[e("i",{class:"fas fa-exclamation-triangle text-sm text-white"})]),e("div",{class:"ml-3"},[e("h5",{class:"mb-1 font-semibold text-amber-900"},"重要提醒"),e("p",{class:"text-sm text-amber-800"}," 这是您唯一能看到所有 API Key 的机会。关闭此窗口后,系统将不再显示完整的 API Key。请立即下载并妥善保存。 ")])])],-1)),e("div",Mo,[e("div",To,[e("div",So,[e("div",null,[l[3]||(l[3]=e("p",{class:"text-xs font-medium text-blue-600"},"创建数量",-1)),e("p",Ro,c(w.apiKeys.length),1)]),l[4]||(l[4]=e("div",{class:"flex h-10 w-10 items-center justify-center rounded-lg bg-blue-500 bg-opacity-20"},[e("i",{class:"fas fa-key text-blue-600"})],-1))])]),e("div",jo,[e("div",Eo,[e("div",null,[l[5]||(l[5]=e("p",{class:"text-xs font-medium text-green-600"},"基础名称",-1)),e("p",Vo,c(h.value),1)]),l[6]||(l[6]=e("div",{class:"flex h-10 w-10 items-center justify-center rounded-lg bg-green-500 bg-opacity-20"},[e("i",{class:"fas fa-tag text-green-600"})],-1))])]),e("div",Po,[e("div",Uo,[e("div",null,[l[7]||(l[7]=e("p",{class:"text-xs font-medium text-purple-600"},"权限范围",-1)),e("p",qo,c(k()),1)]),l[8]||(l[8]=e("div",{class:"flex h-10 w-10 items-center justify-center rounded-lg bg-purple-500 bg-opacity-20"},[e("i",{class:"fas fa-shield-alt text-purple-600"})],-1))])]),e("div",Go,[e("div",Oo,[e("div",null,[l[9]||(l[9]=e("p",{class:"text-xs font-medium text-orange-600"},"过期时间",-1)),e("p",Wo,c(B()),1)]),l[10]||(l[10]=e("div",{class:"flex h-10 w-10 items-center justify-center rounded-lg bg-orange-500 bg-opacity-20"},[e("i",{class:"fas fa-clock text-orange-600"})],-1))])])]),e("div",Fo,[e("div",Bo,[l[12]||(l[12]=e("label",{class:"text-sm font-semibold text-gray-700"},"API Keys 预览",-1)),e("div",zo,[e("button",{class:"flex items-center gap-1 text-xs text-blue-600 hover:text-blue-800",type:"button",onClick:C},[e("i",{class:U(["fas",E.value?"fa-eye-slash":"fa-eye"])},null,2),K(" "+c(E.value?"隐藏":"显示")+"预览 ",1)]),l[11]||(l[11]=e("span",{class:"text-xs text-gray-500"},"(最多显示前10个)",-1))])]),E.value?(r(),d("div",Ho,[e("pre",No,c(O()),1)])):v("",!0)]),e("div",{class:"flex gap-3"},[e("button",{class:"btn btn-primary flex flex-1 items-center justify-center gap-2 px-6 py-3 font-semibold",onClick:j},l[13]||(l[13]=[e("i",{class:"fas fa-download"},null,-1),K(" 下载所有 API Keys ",-1)])),e("button",{class:"rounded-xl border border-gray-300 bg-gray-200 px-6 py-3 font-semibold text-gray-800 transition-colors hover:bg-gray-300",onClick:y}," 我已保存 ")]),l[15]||(l[15]=e("div",{class:"mt-4 rounded-lg border border-blue-200 bg-blue-50 p-3"},[e("p",{class:"flex items-start text-xs text-blue-700"},[e("i",{class:"fas fa-info-circle mr-2 mt-0.5 flex-shrink-0"}),e("span",null," 下载的文件格式为文本文件(.txt),每行包含一个 API Key。 请将文件保存在安全的位置,避免泄露。 ")])],-1))])])]))}},Qo=pe(Yo,[["__scopeId","data-v-b0b904b9"]]),Jo={key:0,class:"modal fixed inset-0 z-50 flex items-center justify-center p-4"},Xo={class:"modal-content mx-auto w-full max-w-lg p-8"},Zo={class:"mb-6 flex items-center justify-between"},en={class:"flex items-center gap-3"},tn={class:"text-sm text-gray-600"},sn={class:"space-y-6"},ln={class:"rounded-lg border border-gray-200 bg-gradient-to-r from-gray-50 to-gray-100 p-4"},on={class:"flex items-center justify-between"},nn={class:"text-sm font-semibold text-gray-800"},an={class:"flex h-12 w-12 items-center justify-center rounded-lg bg-white shadow-sm"},rn={class:"mb-3 grid grid-cols-3 gap-2"},dn=["onClick"],un={key:0,class:"animate-fadeIn"},cn=["min"],mn={key:1,class:"rounded-lg border border-blue-200 bg-gradient-to-r from-blue-50 to-indigo-50 p-4"},pn={class:"flex items-center justify-between"},xn={class:"text-sm font-semibold text-blue-900"},fn={class:"flex gap-3 pt-2"},gn=["disabled"],yn={key:0,class:"loading-spinner mr-2"},bn={key:1,class:"fas fa-save mr-2"},vn={__name:"ExpiryEditModal",props:{show:{type:Boolean,required:!0},apiKey:{type:Object,required:!0}},emits:["close","save"],setup(w,{expose:H,emit:u}){const V=w,E=u,h=M(!1),k=De({expireDuration:"",customExpireDate:"",expiresAt:null}),B=[{value:"",label:"永不过期"},{value:"1d",label:"1 天"},{value:"7d",label:"7 天"},{value:"30d",label:"30 天"},{value:"90d",label:"90 天"},{value:"180d",label:"180 天"},{value:"365d",label:"1 年"},{value:"730d",label:"2 年"}],C=F(()=>{const A=new Date;return A.setMinutes(A.getMinutes()+1),A.toISOString().slice(0,16)});Ce(()=>V.show,A=>{A&&O()}),Ce(()=>{var A;return(A=V.apiKey)==null?void 0:A.id},A=>{A&&V.show&&O()});const O=()=>{h.value=!1,V.apiKey.expiresAt?(k.expireDuration="custom",k.customExpireDate=new Date(V.apiKey.expiresAt).toISOString().slice(0,16),k.expiresAt=V.apiKey.expiresAt):(k.expireDuration="",k.customExpireDate="",k.expiresAt=null)},j=A=>{if(k.expireDuration=A,!A){k.expiresAt=null;return}if(A==="custom")return;const f=new Date,N=A.match(/(\d+)([dhmy])/);if(N){const[,se,D]=N,p=parseInt(se);switch(D){case"d":f.setDate(f.getDate()+p);break;case"h":f.setHours(f.getHours()+p);break;case"m":f.setMonth(f.getMonth()+p);break;case"y":f.setFullYear(f.getFullYear()+p);break}k.expiresAt=f.toISOString()}},y=()=>{k.customExpireDate&&(k.expiresAt=new Date(k.customExpireDate).toISOString())},T=A=>A?new Date(A).toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}):"",n=A=>A?new Date(A)<new Date:!1,l=A=>{if(!A)return null;const f=new Date,se=new Date(A)-f,D=Math.ceil(se/(1e3*60*60*24));return se<0?{text:"已过期",class:"text-red-600"}:D<=7?{text:`${D} 天后过期`,class:"text-orange-600"}:D<=30?{text:`${D} 天后过期`,class:"text-yellow-600"}:{text:`${Math.ceil(D/30)} 个月后过期`,class:"text-green-600"}},J=()=>{h.value=!0,E("save",{keyId:V.apiKey.id,expiresAt:k.expiresAt})};return H({resetSaving:()=>{h.value=!1}}),(A,f)=>(r(),oe(ge,{to:"body"},[w.show?(r(),d("div",Jo,[e("div",Xo,[e("div",Zo,[e("div",en,[f[5]||(f[5]=e("div",{class:"flex h-10 w-10 items-center justify-center rounded-xl bg-gradient-to-br from-amber-500 to-orange-600"},[e("i",{class:"fas fa-clock text-white"})],-1)),e("div",null,[f[4]||(f[4]=e("h3",{class:"text-xl font-bold text-gray-900"},"修改过期时间",-1)),e("p",tn,' 为 "'+c(w.apiKey.name||"API Key")+'" 设置新的过期时间 ',1)])]),e("button",{class:"text-gray-400 transition-colors hover:text-gray-600",onClick:f[0]||(f[0]=N=>A.$emit("close"))},f[6]||(f[6]=[e("i",{class:"fas fa-times text-xl"},null,-1)]))]),e("div",sn,[e("div",ln,[e("div",on,[e("div",null,[f[9]||(f[9]=e("p",{class:"mb-1 text-xs font-medium text-gray-600"},"当前过期时间",-1)),e("p",nn,[w.apiKey.expiresAt?(r(),d(Q,{key:0},[K(c(T(w.apiKey.expiresAt))+" ",1),l(w.apiKey.expiresAt)?(r(),d("span",{key:0,class:U(["ml-2 text-xs font-normal",l(w.apiKey.expiresAt).class])}," ("+c(l(w.apiKey.expiresAt).text)+") ",3)):v("",!0)],64)):(r(),d(Q,{key:1},[f[7]||(f[7]=e("i",{class:"fas fa-infinity mr-1 text-gray-500"},null,-1)),f[8]||(f[8]=K(" 永不过期 ",-1))],64))])]),e("div",an,[e("i",{class:U(["fas fa-hourglass-half text-lg",w.apiKey.expiresAt&&n(w.apiKey.expiresAt)?"text-red-500":"text-gray-400"])},null,2)])])]),e("div",null,[f[11]||(f[11]=e("label",{class:"mb-3 block text-sm font-semibold text-gray-700"},"选择新的期限",-1)),e("div",rn,[(r(),d(Q,null,te(B,N=>e("button",{key:N.value,class:U(["rounded-lg px-3 py-2 text-sm font-medium transition-all",k.expireDuration===N.value?"bg-blue-500 text-white shadow-md":"bg-gray-100 text-gray-700 hover:bg-gray-200"]),onClick:se=>j(N.value)},c(N.label),11,dn)),64)),e("button",{class:U(["rounded-lg px-3 py-2 text-sm font-medium transition-all",k.expireDuration==="custom"?"bg-blue-500 text-white shadow-md":"bg-gray-100 text-gray-700 hover:bg-gray-200"]),onClick:f[1]||(f[1]=N=>j("custom"))},f[10]||(f[10]=[e("i",{class:"fas fa-calendar-alt mr-1"},null,-1),K(" 自定义 ",-1)]),2)])]),k.expireDuration==="custom"?(r(),d("div",un,[f[12]||(f[12]=e("label",{class:"mb-2 block text-sm font-semibold text-gray-700"},"选择日期和时间",-1)),P(e("input",{"onUpdate:modelValue":f[2]||(f[2]=N=>k.customExpireDate=N),class:"form-input w-full",min:C.value,type:"datetime-local",onChange:y},null,40,cn),[[ee,k.customExpireDate]]),f[13]||(f[13]=e("p",{class:"mt-2 text-xs text-gray-500"},"选择一个未来的日期和时间作为过期时间",-1))])):v("",!0),k.expiresAt!==w.apiKey.expiresAt?(r(),d("div",mn,[e("div",pn,[e("div",null,[f[16]||(f[16]=e("p",{class:"mb-1 text-xs font-medium text-blue-700"},[e("i",{class:"fas fa-arrow-right mr-1"}),K(" 新的过期时间 ")],-1)),e("p",xn,[k.expiresAt?(r(),d(Q,{key:0},[K(c(T(k.expiresAt))+" ",1),l(k.expiresAt)?(r(),d("span",{key:0,class:U(["ml-2 text-xs font-normal",l(k.expiresAt).class])}," ("+c(l(k.expiresAt).text)+") ",3)):v("",!0)],64)):(r(),d(Q,{key:1},[f[14]||(f[14]=e("i",{class:"fas fa-infinity mr-1"},null,-1)),f[15]||(f[15]=K(" 永不过期 ",-1))],64))])]),f[17]||(f[17]=e("div",{class:"flex h-12 w-12 items-center justify-center rounded-lg bg-white shadow-sm"},[e("i",{class:"fas fa-check text-lg text-green-500"})],-1))])])):v("",!0),e("div",fn,[e("button",{class:"flex-1 rounded-lg bg-gray-100 px-4 py-2.5 font-semibold text-gray-700 transition-colors hover:bg-gray-200",onClick:f[3]||(f[3]=N=>A.$emit("close"))}," 取消 "),e("button",{class:"btn btn-primary flex-1 px-4 py-2.5 font-semibold",disabled:h.value||k.expiresAt===w.apiKey.expiresAt,onClick:J},[h.value?(r(),d("div",yn)):(r(),d("i",bn)),K(" "+c(h.value?"保存中...":"保存更改"),1)],8,gn)])])])])):v("",!0)]))}},wn=pe(vn,[["__scopeId","data-v-cfb0d627"]]),hn={key:0,class:"modal fixed inset-0 z-50 flex items-center justify-center p-3 sm:p-4"},$n={class:"modal-content relative mx-auto flex max-h-[90vh] w-[95%] max-w-2xl flex-col p-4 sm:w-full sm:max-w-3xl sm:p-6 md:p-8"},An={class:"mb-4 flex items-center justify-between sm:mb-6"},kn={class:"flex items-center gap-2 sm:gap-3"},Cn={class:"text-lg font-bold text-gray-900 sm:text-xl"},Kn={class:"modal-scroll-content custom-scrollbar flex-1 overflow-y-auto"},In={class:"mb-6 grid grid-cols-1 gap-4 md:grid-cols-2"},Dn={class:"rounded-lg border border-blue-200 bg-gradient-to-br from-blue-50 to-blue-100 p-4"},Ln={class:"text-2xl font-bold text-gray-900"},_n={class:"mt-1 text-xs text-gray-600"},Mn={class:"rounded-lg border border-green-200 bg-gradient-to-br from-green-50 to-green-100 p-4"},Tn={class:"text-2xl font-bold text-gray-900"},Sn={class:"mt-1 text-xs text-gray-600"},Rn={class:"rounded-lg border border-yellow-200 bg-gradient-to-br from-yellow-50 to-yellow-100 p-4"},jn={class:"text-2xl font-bold text-gray-900"},En={class:"mt-1 text-xs text-gray-600"},Vn={class:"rounded-lg border border-purple-200 bg-gradient-to-br from-purple-50 to-purple-100 p-4"},Pn={class:"space-y-1 text-sm"},Un={class:"flex justify-between"},qn={class:"font-semibold"},Gn={class:"flex justify-between"},On={class:"font-semibold"},Wn={class:"mb-6"},Fn={class:"space-y-3 rounded-lg bg-gray-50 p-4"},Bn={class:"flex items-center justify-between"},zn={class:"text-sm font-semibold text-gray-900"},Hn={class:"flex items-center justify-between"},Nn={class:"text-sm font-semibold text-gray-900"},Yn={key:0,class:"flex items-center justify-between"},Qn={class:"text-sm font-semibold text-purple-600"},Jn={key:1,class:"flex items-center justify-between"},Xn={class:"text-sm font-semibold text-purple-600"},Zn={key:0,class:"mb-6"},ei={class:"space-y-3 rounded-lg bg-gray-50 p-4"},ti={key:0,class:"space-y-2"},si={class:"flex items-center justify-between text-sm"},li={class:"font-semibold text-gray-900"},oi={class:"h-2 w-full rounded-full bg-gray-200"},ni={class:"text-right text-xs text-gray-500"},ii={key:1,class:"flex items-center justify-between text-sm"},ai={class:"font-semibold text-purple-600"},ri={key:2,class:"space-y-2"},di={__name:"UsageDetailModal",props:{show:{type:Boolean,required:!0},apiKey:{type:Object,required:!0}},emits:["close"],setup(w,{emit:H}){const u=w,V=H,E=F(()=>{var D,p;return((p=(D=u.apiKey.usage)==null?void 0:D.total)==null?void 0:p.requests)||0}),h=F(()=>{var D,p;return((p=(D=u.apiKey.usage)==null?void 0:D.daily)==null?void 0:p.requests)||0}),k=F(()=>{var D,p;return((p=(D=u.apiKey.usage)==null?void 0:D.total)==null?void 0:p.tokens)||0}),B=F(()=>{var D,p;return((p=(D=u.apiKey.usage)==null?void 0:D.daily)==null?void 0:p.tokens)||0}),C=F(()=>{var D,p;return((p=(D=u.apiKey.usage)==null?void 0:D.total)==null?void 0:p.cost)||0}),O=F(()=>u.apiKey.dailyCost||0),j=F(()=>{var D,p;return((p=(D=u.apiKey.usage)==null?void 0:D.total)==null?void 0:p.inputTokens)||0}),y=F(()=>{var D,p;return((p=(D=u.apiKey.usage)==null?void 0:D.total)==null?void 0:p.outputTokens)||0}),T=F(()=>{var D,p;return((p=(D=u.apiKey.usage)==null?void 0:D.total)==null?void 0:p.cacheCreateTokens)||0}),n=F(()=>{var D,p;return((p=(D=u.apiKey.usage)==null?void 0:D.total)==null?void 0:p.cacheReadTokens)||0}),l=F(()=>{var D,p;return((p=(D=u.apiKey.usage)==null?void 0:D.averages)==null?void 0:p.rpm)||0}),J=F(()=>{var D,p;return((p=(D=u.apiKey.usage)==null?void 0:D.averages)==null?void 0:p.tpm)||0}),I=F(()=>u.apiKey.dailyCostLimit>0||u.apiKey.concurrencyLimit>0||u.apiKey.rateLimitWindow>0||u.apiKey.tokenLimit>0),A=F(()=>!u.apiKey.dailyCostLimit||u.apiKey.dailyCostLimit===0?0:O.value/u.apiKey.dailyCostLimit*100),f=D=>!D&&D!==0?"0":D.toLocaleString("zh-CN"),N=D=>D>=1e6?(D/1e6).toFixed(1)+"M":D>=1e3?(D/1e3).toFixed(1)+"K":D.toString(),se=()=>{V("close")};return(D,p)=>(r(),oe(ge,{to:"body"},[w.show?(r(),d("div",hn,[e("div",{class:"fixed inset-0 bg-gray-900 bg-opacity-50 backdrop-blur-sm",onClick:se}),e("div",$n,[e("div",An,[e("div",kn,[p[0]||(p[0]=e("div",{class:"flex h-8 w-8 items-center justify-center rounded-lg bg-gradient-to-br from-blue-500 to-blue-600 sm:h-10 sm:w-10 sm:rounded-xl"},[e("i",{class:"fas fa-chart-line text-sm text-white sm:text-base"})],-1)),e("h3",Cn," 使用统计详情 - "+c(w.apiKey.name),1)]),e("button",{class:"p-1 text-gray-400 transition-colors hover:text-gray-600",onClick:se},p[1]||(p[1]=[e("i",{class:"fas fa-times text-lg sm:text-xl"},null,-1)]))]),e("div",Kn,[e("div",In,[e("div",Dn,[p[2]||(p[2]=e("div",{class:"mb-3 flex items-center justify-between"},[e("span",{class:"text-sm font-medium text-gray-700"},"总请求数"),e("i",{class:"fas fa-paper-plane text-blue-500"})],-1)),e("div",Ln,c(f(E.value)),1),e("div",_n," 今日: "+c(f(h.value))+" 次 ",1)]),e("div",Mn,[p[3]||(p[3]=e("div",{class:"mb-3 flex items-center justify-between"},[e("span",{class:"text-sm font-medium text-gray-700"},"总Token数"),e("i",{class:"fas fa-coins text-green-500"})],-1)),e("div",Tn,c(N(k.value)),1),e("div",Sn," 今日: "+c(N(B.value)),1)]),e("div",Rn,[p[4]||(p[4]=e("div",{class:"mb-3 flex items-center justify-between"},[e("span",{class:"text-sm font-medium text-gray-700"},"总费用"),e("i",{class:"fas fa-dollar-sign text-yellow-600"})],-1)),e("div",jn,"$"+c(C.value.toFixed(4)),1),e("div",En,"今日: $"+c(O.value.toFixed(4)),1)]),e("div",Vn,[p[7]||(p[7]=e("div",{class:"mb-3 flex items-center justify-between"},[e("span",{class:"text-sm font-medium text-gray-700"},"平均速率"),e("i",{class:"fas fa-tachometer-alt text-purple-500"})],-1)),e("div",Pn,[e("div",Un,[p[5]||(p[5]=e("span",{class:"text-gray-600"},"RPM:",-1)),e("span",qn,c(l.value),1)]),e("div",Gn,[p[6]||(p[6]=e("span",{class:"text-gray-600"},"TPM:",-1)),e("span",On,c(J.value),1)])])])]),e("div",Wn,[p[12]||(p[12]=e("h4",{class:"mb-3 flex items-center text-sm font-semibold text-gray-700"},[e("i",{class:"fas fa-chart-pie mr-2 text-indigo-500"}),K(" Token 使用分布 ")],-1)),e("div",Fn,[e("div",Bn,[p[8]||(p[8]=e("div",{class:"flex items-center"},[e("i",{class:"fas fa-arrow-down mr-2 text-green-500"}),e("span",{class:"text-sm text-gray-600"},"输入 Token")],-1)),e("span",zn,c(N(j.value)),1)]),e("div",Hn,[p[9]||(p[9]=e("div",{class:"flex items-center"},[e("i",{class:"fas fa-arrow-up mr-2 text-blue-500"}),e("span",{class:"text-sm text-gray-600"},"输出 Token")],-1)),e("span",Nn,c(N(y.value)),1)]),T.value>0?(r(),d("div",Yn,[p[10]||(p[10]=e("div",{class:"flex items-center"},[e("i",{class:"fas fa-save mr-2 text-purple-500"}),e("span",{class:"text-sm text-gray-600"},"缓存创建 Token")],-1)),e("span",Qn,c(N(T.value)),1)])):v("",!0),n.value>0?(r(),d("div",Jn,[p[11]||(p[11]=e("div",{class:"flex items-center"},[e("i",{class:"fas fa-download mr-2 text-purple-500"}),e("span",{class:"text-sm text-gray-600"},"缓存读取 Token")],-1)),e("span",Xn,c(N(n.value)),1)])):v("",!0)])]),I.value?(r(),d("div",Zn,[p[16]||(p[16]=e("h4",{class:"mb-3 flex items-center text-sm font-semibold text-gray-700"},[e("i",{class:"fas fa-shield-alt mr-2 text-red-500"}),K(" 限制设置 ")],-1)),e("div",ei,[w.apiKey.dailyCostLimit>0?(r(),d("div",ti,[e("div",si,[p[13]||(p[13]=e("span",{class:"text-gray-600"},"每日费用限制",-1)),e("span",li," $"+c(w.apiKey.dailyCostLimit.toFixed(2)),1)]),e("div",oi,[e("div",{class:U(["h-2 rounded-full transition-all duration-300",A.value>=100?"bg-red-500":A.value>=80?"bg-yellow-500":"bg-green-500"]),style:he({width:Math.min(A.value,100)+"%"})},null,6)]),e("div",ni," 已使用 "+c(A.value.toFixed(1))+"% ",1)])):v("",!0),w.apiKey.concurrencyLimit>0?(r(),d("div",ii,[p[14]||(p[14]=e("span",{class:"text-gray-600"},"并发限制",-1)),e("span",ai,c(w.apiKey.currentConcurrency||0)+" / "+c(w.apiKey.concurrencyLimit),1)])):v("",!0),w.apiKey.rateLimitWindow>0?(r(),d("div",ri,[p[15]||(p[15]=e("h5",{class:"text-sm font-medium text-gray-700"},[e("i",{class:"fas fa-clock mr-1 text-blue-500"}),K(" 时间窗口限制 ")],-1)),ne(Te,{"current-requests":w.apiKey.currentWindowRequests,"current-tokens":w.apiKey.currentWindowTokens,label:"窗口状态","rate-limit-window":w.apiKey.rateLimitWindow,"request-limit":w.apiKey.rateLimitRequests,"show-progress":!0,"show-tooltip":!0,"token-limit":w.apiKey.tokenLimit,"window-end-time":w.apiKey.windowEndTime,"window-remaining-seconds":w.apiKey.windowRemainingSeconds,"window-start-time":w.apiKey.windowStartTime},null,8,["current-requests","current-tokens","rate-limit-window","request-limit","token-limit","window-end-time","window-remaining-seconds","window-start-time"])])):v("",!0)])])):v("",!0)]),e("div",{class:"mt-4 flex justify-end gap-2 sm:mt-6 sm:gap-3"},[e("button",{class:"btn btn-secondary px-4 py-2 text-sm",type:"button",onClick:se}," 关闭 ")])])])):v("",!0)]))}},ui=pe(di,[["__scopeId","data-v-cbed7d44"]]),ci={class:"tab-content"},mi={class:"card p-4 sm:p-6"},pi={class:"mb-4 flex flex-col gap-4 sm:mb-6"},xi={class:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between"},fi={class:"flex flex-col gap-3 sm:flex-row sm:flex-wrap sm:items-center sm:gap-3"},gi={class:"group relative min-w-[140px]"},yi={class:"group relative min-w-[140px]"},bi={class:"relative"},vi={key:0,class:"absolute -right-2 -top-2 z-10 flex h-5 w-5 items-center justify-center rounded-full bg-purple-500 text-xs text-white shadow-sm"},wi={class:"group relative min-w-[200px]"},hi={class:"relative flex items-center"},$i=["disabled"],Ai={key:0,class:"py-12 text-center"},ki={key:1,class:"py-12 text-center"},Ci={key:2,class:"table-container hidden md:block"},Ki={class:"w-full table-fixed"},Ii={class:"bg-gray-50/80 backdrop-blur-sm"},Di={key:1,class:"fas fa-sort ml-1 text-gray-400"},Li={key:1,class:"fas fa-sort ml-1 text-gray-400"},_i={class:"w-[17%] min-w-[140px] px-3 py-4 text-left text-xs font-bold uppercase tracking-wider text-gray-700"},Mi={key:1,class:"fas fa-sort ml-1 text-gray-400"},Ti={key:1,class:"fas fa-sort ml-1 text-gray-400"},Si={key:1,class:"fas fa-sort ml-1 text-gray-400"},Ri={class:"divide-y divide-gray-200/50"},ji={class:"table-row"},Ei={class:"px-3 py-4"},Vi={class:"flex items-center"},Pi={class:"min-w-0"},Ui=["title"],qi=["title"],Gi={class:"mt-1.5 space-y-1"},Oi={key:0,class:"flex items-center gap-1 text-xs"},Wi={class:"truncate text-gray-600"},Fi={key:1,class:"flex items-center gap-1 text-xs"},Bi={class:"truncate text-gray-600"},zi={key:2,class:"flex items-center gap-1 text-xs"},Hi={class:"truncate text-gray-600"},Ni={key:3,class:"text-xs text-gray-500"},Yi={class:"px-3 py-4"},Qi={class:"flex flex-wrap gap-1"},Ji={key:0,class:"text-xs text-gray-400"},Xi={class:"whitespace-nowrap px-3 py-4"},Zi={class:"px-3 py-4"},ea={class:"space-y-2"},ta={class:"mb-2"},sa={class:"mb-1 flex items-center justify-between text-sm"},la={class:"font-semibold text-gray-900"},oa={class:"flex items-center justify-between text-sm"},na={class:"font-semibold text-green-600"},ia={class:"flex items-center justify-between text-sm"},aa={class:"font-medium text-gray-700"},ra={key:0,class:"space-y-1"},da={class:"flex items-center justify-between text-xs"},ua={class:"text-gray-700"},ca={class:"h-1.5 w-full rounded-full bg-gray-200"},ma={class:"pt-1"},pa=["onClick"],xa={class:"whitespace-nowrap px-3 py-4 text-sm text-gray-500"},fa={class:"whitespace-nowrap px-3 py-4 text-sm"},ga={class:"inline-flex items-center gap-1.5"},ya={key:0},ba={key:0,class:"inline-flex items-center text-red-600"},va={key:1,class:"inline-flex items-center text-orange-600"},wa={key:2,class:"text-gray-600"},ha={key:1,class:"inline-flex items-center text-gray-400"},$a=["onClick"],Aa={class:"whitespace-nowrap px-3 py-4 text-sm"},ka={class:"flex gap-1"},Ca=["onClick"],Ka=["onClick"],Ia=["onClick"],Da=["onClick"],La=["title","onClick"],_a={class:"ml-1 hidden xl:inline"},Ma=["onClick"],Ta={key:0},Sa={class:"bg-gray-50 px-3 py-4",colspan:"7"},Ra={key:0,class:"py-4 text-center"},ja={class:"space-y-4"},Ea={class:"mb-4 flex items-center justify-between"},Va={class:"flex items-center gap-2"},Pa={key:0,class:"rounded-full bg-gray-100 px-2 py-1 text-xs text-gray-500"},Ua={class:"flex items-center gap-1"},qa={class:"flex gap-1 rounded bg-gray-100 p-1"},Ga=["onClick"],Oa={key:0,class:"py-8 text-center"},Wa={class:"mb-3 flex items-center justify-center gap-2"},Fa=["onClick"],Ba={key:1,class:"grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3"},za={class:"mb-3 flex items-start justify-between"},Ha={class:"flex-1"},Na={class:"mb-1 block text-sm font-semibold text-gray-800"},Ya={class:"rounded-full bg-blue-50 px-2 py-1 text-xs text-gray-500"},Qa={class:"mb-3 space-y-2"},Ja={class:"flex items-center justify-between text-sm"},Xa={class:"font-semibold text-gray-900"},Za={class:"flex items-center justify-between text-sm"},er={class:"font-semibold text-green-600"},tr={class:"mt-2 border-t border-gray-100 pt-2"},sr={class:"flex items-center justify-between text-xs text-gray-500"},lr={class:"font-medium"},or={class:"flex items-center justify-between text-xs text-gray-500"},nr={class:"font-medium"},ir={key:0,class:"flex items-center justify-between text-xs text-purple-600"},ar={class:"font-medium"},rr={key:1,class:"flex items-center justify-between text-xs text-purple-600"},dr={class:"font-medium"},ur={class:"mt-3 h-2 w-full rounded-full bg-gray-200"},cr={class:"mt-1 text-right"},mr={class:"text-xs font-medium text-indigo-600"},pr={key:2,class:"mt-4 rounded-lg border border-indigo-100 bg-gradient-to-r from-indigo-50 to-purple-50 p-3"},xr={class:"flex items-center justify-between text-sm"},fr={class:"flex gap-4 text-xs"},gr={class:"text-gray-600"},yr={class:"font-semibold text-gray-800"},br={class:"text-gray-600"},vr={class:"font-semibold text-gray-800"},wr={key:3,class:"space-y-3 md:hidden"},hr={class:"mb-3 flex items-start justify-between"},$r={class:"flex items-center gap-3"},Ar={class:"text-sm font-semibold text-gray-900"},kr={class:"mt-0.5 text-xs text-gray-500"},Cr={class:"mb-3 space-y-1.5"},Kr={key:0,class:"flex flex-wrap items-center gap-1 text-xs"},Ir={class:"text-gray-600"},Dr={key:1,class:"flex flex-wrap items-center gap-1 text-xs"},Lr={class:"text-gray-600"},_r={key:2,class:"flex flex-wrap items-center gap-1 text-xs"},Mr={class:"text-gray-600"},Tr={key:3,class:"text-xs text-gray-500"},Sr={class:"mb-3 space-y-2"},Rr={class:"rounded-lg bg-gray-50 p-3"},jr={class:"mb-2 flex items-center justify-between"},Er=["onClick"],Vr={class:"grid grid-cols-2 gap-3"},Pr={class:"text-sm font-semibold text-gray-900"},Ur={class:"text-sm font-semibold text-green-600"},qr={class:"mt-2 flex items-center justify-between"},Gr={class:"text-xs font-medium text-gray-700"},Or={key:0,class:"space-y-1"},Wr={class:"flex items-center justify-between text-xs"},Fr={class:"text-gray-700"},Br={class:"h-2 w-full rounded-full bg-gray-200"},zr={class:"mb-3 text-xs text-gray-500"},Hr={class:"mb-1 flex justify-between"},Nr={class:"flex items-center justify-between"},Yr={class:"flex items-center gap-1"},Qr=["onClick"],Jr={key:0,class:"mb-3 flex flex-wrap gap-1"},Xr={class:"mt-3 flex gap-2 border-t border-gray-100 pt-3"},Zr=["onClick"],ed=["onClick"],td=["onClick"],sd=["onClick"],ld=["onClick"],od={key:4,class:"mt-4 flex flex-col items-center justify-between gap-4 sm:mt-6 sm:flex-row"},nd={class:"flex w-full flex-col items-center gap-3 sm:w-auto sm:flex-row"},id={class:"text-xs text-gray-600 sm:text-sm"},ad={class:"flex items-center gap-2"},rd=["value"],dd={class:"flex items-center gap-2"},ud=["disabled"],cd={class:"flex items-center gap-1"},md={key:1,class:"hidden px-2 text-gray-500 sm:inline"},pd=["onClick"],xd={key:2,class:"hidden px-2 text-gray-500 sm:inline"},fd=["disabled"],gd={__name:"ApiKeysView",setup(w){const H=Re(),u=M([]),V=M(!1),E=M("today"),h=M(""),k=M("asc"),B=M({}),C=M({}),O=M({}),j=M([new Date(2e3,1,1,0,0,0),new Date(2e3,2,1,23,59,59)]),y=M({claude:[],gemini:[],openai:[],claudeGroups:[],geminiGroups:[],openaiGroups:[]}),T=M(null),n=M(null),l=M(!1),J=M(null),I=M(""),A=M([]),f=M(""),N=M([{value:"today",label:"今日",icon:"fa-clock"},{value:"7days",label:"最近7天",icon:"fa-calendar-week"},{value:"monthly",label:"本月",icon:"fa-calendar"},{value:"all",label:"全部时间",icon:"fa-infinity"}]),se=F(()=>{const i=[{value:"",label:"所有标签",icon:"fa-asterisk"}];return A.value.forEach(t=>{i.push({value:t,label:t,icon:"fa-tag"})}),i}),D=F(()=>I.value?u.value.filter(i=>i.tags&&i.tags.includes(I.value)).length:0),p=M(1),ae=M(10),R=[10,20,50,100],a=M(!1),m=M(!1),$=M(!1),_=M(!1),b=M(!1),o=M(null),x=M(null),Y=M(null),W=M([]),Z=F(()=>{let i=u.value;if(I.value&&(i=u.value.filter(g=>g.tags&&g.tags.includes(I.value))),f.value){const g=f.value.toLowerCase().trim();i=i.filter(s=>s.name&&s.name.toLowerCase().includes(g))}return h.value?[...i].sort((g,s)=>{let S=g[h.value],z=s[h.value];return h.value==="status"?(S=g.isActive?1:0,z=s.isActive?1:0):h.value==="cost"?(S=parseFloat(Ee(g.usage).replace("$","")),z=parseFloat(Ee(s.usage).replace("$",""))):(h.value==="createdAt"||h.value==="expiresAt")&&(S=S?new Date(S).getTime():0,z=z?new Date(z).getTime():0),S<z?k.value==="asc"?-1:1:S>z?k.value==="asc"?1:-1:0}):i}),le=F(()=>{const i=Z.value.length;return Math.ceil(i/ae.value)||0}),ce=F(()=>{const i=[],t=p.value,g=le.value;if(g<=7)for(let s=1;s<=g;s++)i.push(s);else{let s=Math.max(1,t-2),S=Math.min(g,t+2);t<=3?S=5:t>=g-2&&(s=g-4);for(let z=s;z<=S;z++)i.push(z)}return i}),re=F(()=>{const i=(p.value-1)*ae.value,t=i+ae.value;return Z.value.slice(i,t)}),X=async()=>{try{const[i,t,g,s,S]=await Promise.all([G.get("/admin/claude-accounts"),G.get("/admin/claude-console-accounts"),G.get("/admin/gemini-accounts"),G.get("/admin/openai-accounts"),G.get("/admin/account-groups")]);if(i.success&&(y.value.claude=i.data||[]),t.success){const z=(t.data||[]).map(L=>({...L,platform:"claude-console"}));y.value.claude=[...y.value.claude,...z]}if(g.success&&(y.value.gemini=g.data||[]),s.success&&(y.value.openai=s.data||[]),S.success){const z=S.data||[];y.value.claudeGroups=z.filter(L=>L.platform==="claude"),y.value.geminiGroups=z.filter(L=>L.platform==="gemini"),y.value.openaiGroups=z.filter(L=>L.platform==="openai")}}catch(i){console.error("加载账户列表失败:",i)}},ie=async()=>{V.value=!0;try{const i=await G.get(`/admin/api-keys?timeRange=${E.value}`);if(i.success){u.value=i.data||[];const t=new Set;u.value.forEach(g=>{g.tags&&Array.isArray(g.tags)&&g.tags.forEach(s=>t.add(s))}),A.value=Array.from(t).sort()}}catch{q("加载 API Keys 失败","error")}finally{V.value=!1}},ve=i=>{h.value===i?k.value=k.value==="asc"?"desc":"asc":(h.value=i,k.value="asc")},je=i=>!i&&i!==0?"0":i.toLocaleString("zh-CN"),Ee=i=>!i||!i.total?"$0.0000":`$${(i.total.cost||0).toFixed(4)}`,Le=i=>{if(!i)return"未知账户";if(i.startsWith("group:")){const S=i.substring(6),z=y.value.claudeGroups.find(we=>we.id===S);if(z)return`分组-${z.name}`;const L=y.value.geminiGroups.find(we=>we.id===S);if(L)return`分组-${L.name}`;const de=y.value.openaiGroups.find(we=>we.id===S);return de?`分组-${de.name}`:`分组-${S.substring(0,8)}`}const t=y.value.claude.find(S=>S.id===i);if(t)return`${t.name}`;const g=y.value.gemini.find(S=>S.id===i);if(g)return`${g.name}`;const s=y.value.openai.find(S=>S.id===i);return s?`${s.name}`:`${i.substring(0,8)}`},Ve=i=>{if(i.claudeAccountId){const t=Le(i.claudeAccountId);if(i.claudeAccountId.startsWith("group:"))return t;const g=y.value.claude.find(s=>s.id===i.claudeAccountId);return g?g.accountType==="dedicated"?`🔒 专属-${t}`:t:`⚠️ ${t} (账户不存在)`}if(i.claudeConsoleAccountId){const t=y.value.claude.find(g=>g.id===i.claudeConsoleAccountId&&g.platform==="claude-console");return t?`Console-${t.name}`:"⚠️ Console账户不存在"}return""},Pe=i=>{if(i.geminiAccountId){const t=Le(i.geminiAccountId);if(i.geminiAccountId.startsWith("group:"))return t;const g=y.value.gemini.find(s=>s.id===i.geminiAccountId);return g?g.accountType==="dedicated"?`🔒 专属-${t}`:t:`⚠️ ${t} (账户不存在)`}return""},Ue=i=>{if(i.openaiAccountId){const t=Le(i.openaiAccountId);if(i.openaiAccountId.startsWith("group:"))return t;const g=y.value.openai.find(s=>s.id===i.openaiAccountId);return g?g.accountType==="dedicated"?`🔒 专属-${t}`:t:`⚠️ ${t} (账户不存在)`}return""},$e=i=>i?new Date(i)<new Date:!1,Ae=i=>!i||$e(i)?!1:(new Date(i)-new Date)/(1e3*60*60*24)<=7,qe=i=>i?new Date(i).toLocaleDateString("zh-CN"):"",st=async i=>{B.value[i]?B.value[i]=!1:(B.value[i]=!0,O.value[i]||Oe(i),await ke(i,!0))},ke=async(i,t=!1)=>{if(!t&&C.value[i]&&C.value[i].length>0)return;const g=xe(i);try{let s=`/admin/api-keys/${i}/model-stats`;const S=new URLSearchParams;if(g.customStart&&g.customEnd)S.append("startDate",g.customStart),S.append("endDate",g.customEnd),S.append("period","custom");else{const L=g.preset==="today"||g.preset==="7days"?"daily":"monthly";S.append("period",L)}s+="?"+S.toString();const z=await G.get(s);z.success&&(C.value[i]=z.data||[])}catch{q("加载模型统计失败","error"),C.value[i]=[]}},Ge=(i,t)=>{const g=t.reduce((s,S)=>s+(S.allTokens||0),0);return g===0?0:Math.round(i/g*100)},lt=i=>i.formatted&&i.formatted.total?i.formatted.total:i.cost!==void 0?`$${i.cost.toFixed(6)}`:"$0.000000",Oe=i=>{const t=new Date,g=new Date(t);g.setDate(t.getDate()-6),O.value[i]={type:"preset",preset:"7days",customStart:g.toISOString().split("T")[0],customEnd:t.toISOString().split("T")[0],customRange:null,presetOptions:[{value:"today",label:"今日",days:1},{value:"7days",label:"7天",days:7},{value:"30days",label:"30天",days:30}]}},xe=i=>(O.value[i]||Oe(i),O.value[i]),We=(i,t)=>{const g=xe(t);g.type="preset",g.preset=i;const s=g.presetOptions.find(S=>S.value===i);if(s){const S=new Date,z=new Date(S);z.setDate(S.getDate()-(s.days-1)),g.customStart=z.toISOString().split("T")[0],g.customEnd=S.toISOString().split("T")[0];const L=de=>de.getFullYear()+"-"+String(de.getMonth()+1).padStart(2,"0")+"-"+String(de.getDate()).padStart(2,"0")+" 00:00:00";g.customRange=[L(z),L(S)]}ke(t,!0)},ot=(i,t)=>{const g=xe(i);t&&t.length===2?(g.type="custom",g.preset="",g.customRange=t,g.customStart=t[0].split(" ")[0],g.customEnd=t[1].split(" ")[0],ke(i,!0)):t===null&&We("7days",i)},nt=i=>i>new Date,it=i=>{const t=xe(i);t.type="preset",t.preset="7days";const g=new Date,s=new Date(g);s.setDate(g.getDate()-6),t.customStart=s.toISOString().split("T")[0],t.customEnd=g.toISOString().split("T")[0],t.customRange=null,ke(i,!0),q("已重置筛选条件并刷新数据","info")},at=async()=>{await X(),a.value=!0},Fe=async i=>{await X(),o.value=i,m.value=!0},Be=i=>{x.value=i,$.value=!0},rt=i=>{a.value=!1,Y.value=i,_.value=!0,ie()},dt=i=>{a.value=!1,W.value=i,b.value=!0,ie()},ut=()=>{m.value=!1,q("API Key 更新成功","success"),ie()},ct=()=>{$.value=!1,q("API Key 续期成功","success"),ie()},ze=async i=>{let t=!0;if(i.isActive&&(window.showConfirm?t=await window.showConfirm("禁用 API Key",`确定要禁用 API Key "${i.name}" 吗?禁用后所有使用此 Key 的请求将返回 401 错误。`,"确定禁用","取消"):t=confirm(`确定要禁用 API Key "${i.name}" 吗?禁用后所有使用此 Key 的请求将返回 401 错误。`)),!!t)try{const g=await G.put(`/admin/api-keys/${i.id}`,{isActive:!i.isActive});if(g.success){q(`API Key 已${i.isActive?"禁用":"激活"}`,"success");const s=u.value.find(S=>S.id===i.id);s&&(s.isActive=!i.isActive)}else q(g.message||"操作失败","error")}catch{q("操作失败","error")}},He=async i=>{let t=!1;if(window.showConfirm?t=await window.showConfirm("删除 API Key","确定要删除这个 API Key 吗?此操作不可恢复。","确定删除","取消"):t=confirm("确定要删除这个 API Key 吗?此操作不可恢复。"),!!t)try{const g=await G.delete(`/admin/api-keys/${i}`);g.success?(q("API Key 已删除","success"),ie()):q(g.message||"删除失败","error")}catch{q("删除失败","error")}},mt=i=>{const g=`${window.location.origin}/admin-next/api-stats?apiId=${i.id}`,s=document.createElement("textarea");s.value=g,s.style.position="fixed",s.style.opacity="0",s.style.left="-9999px",document.body.appendChild(s),s.select(),s.setSelectionRange(0,99999);try{document.execCommand("copy")?q("已复制统计页面链接","success"):(q("复制失败,请手动复制","error"),console.log("统计页面链接:",g))}catch(S){q("复制失败,请手动复制","error"),console.error("复制错误:",S),console.log("统计页面链接:",g)}finally{document.body.removeChild(s)}},Ne=i=>{T.value=i},Ye=()=>{T.value=null},pt=async({keyId:i,expiresAt:t})=>{try{const g=await G.put(`/admin/api-keys/${i}`,{expiresAt:t||null});if(g.success){q("过期时间已更新","success");const s=u.value.find(S=>S.id===i);s&&(s.expiresAt=t||null),Ye()}else q(g.message||"更新失败","error"),n.value&&n.value.resetSaving()}catch{q("更新失败","error"),n.value&&n.value.resetSaving()}},Qe=i=>i?new Date(i).toLocaleDateString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).replace(/\//g,"-"):"",_e=i=>{if(!i.dailyCostLimit||i.dailyCostLimit===0)return 0;const t=(i.dailyCost||0)/i.dailyCostLimit*100;return Math.min(t,100)},Je=i=>{const t=_e(i);return t>=100?"bg-red-500":t>=80?"bg-yellow-500":"bg-green-500"},Me=i=>{J.value=i,l.value=!0},be=i=>i>=1e6?(i/1e6).toFixed(1)+"M":i>=1e3?(i/1e3).toFixed(1)+"K":i.toString(),Xe=i=>{if(!i)return"从未使用";const t=new Date(i),s=new Date-t;return s<6e4?"刚刚":s<36e5?`${Math.floor(s/6e4)} 分钟前`:s<864e5?`${Math.floor(s/36e5)} 小时前`:s<6048e5?`${Math.floor(s/864e5)} 天前`:t.toLocaleDateString("zh-CN")},xt=()=>{f.value="",p.value=1};return Ce([I,E,f],()=>{p.value=1}),Ie(async()=>{await Promise.all([H.loadSupportedClients(),X(),ie()])}),(i,t)=>{const g=ft;return r(),d("div",ci,[e("div",mi,[e("div",pi,[t[32]||(t[32]=e("div",null,[e("h3",{class:"mb-1 text-lg font-bold text-gray-900 sm:mb-2 sm:text-xl"},"API Keys 管理"),e("p",{class:"text-sm text-gray-600 sm:text-base"},"管理和监控您的 API 密钥")],-1)),e("div",xi,[e("div",fi,[e("div",gi,[t[24]||(t[24]=e("div",{class:"absolute -inset-0.5 rounded-lg bg-gradient-to-r from-blue-500 to-purple-500 opacity-0 blur transition duration-300 group-hover:opacity-20"},null,-1)),ne(Ze,{modelValue:E.value,"onUpdate:modelValue":t[0]||(t[0]=s=>E.value=s),icon:"fa-calendar-alt","icon-color":"text-blue-500",options:N.value,placeholder:"选择时间范围",onChange:t[1]||(t[1]=s=>ie())},null,8,["modelValue","options"])]),e("div",yi,[t[25]||(t[25]=e("div",{class:"absolute -inset-0.5 rounded-lg bg-gradient-to-r from-purple-500 to-pink-500 opacity-0 blur transition duration-300 group-hover:opacity-20"},null,-1)),e("div",bi,[ne(Ze,{modelValue:I.value,"onUpdate:modelValue":t[2]||(t[2]=s=>I.value=s),icon:"fa-tags","icon-color":"text-purple-500",options:se.value,placeholder:"所有标签",onChange:t[3]||(t[3]=s=>p.value=1)},null,8,["modelValue","options"]),I.value?(r(),d("span",vi,c(D.value),1)):v("",!0)])]),e("div",wi,[t[28]||(t[28]=e("div",{class:"absolute -inset-0.5 rounded-lg bg-gradient-to-r from-cyan-500 to-teal-500 opacity-0 blur transition duration-300 group-hover:opacity-20"},null,-1)),e("div",hi,[P(e("input",{"onUpdate:modelValue":t[4]||(t[4]=s=>f.value=s),class:"w-full rounded-lg border border-gray-200 bg-white px-3 py-2 pl-9 text-sm text-gray-700 placeholder-gray-400 shadow-sm transition-all duration-200 hover:border-gray-300 focus:border-cyan-500 focus:outline-none focus:ring-2 focus:ring-cyan-500/20",placeholder:"搜索名称...",type:"text",onInput:t[5]||(t[5]=s=>p.value=1)},null,544),[[ee,f.value]]),t[27]||(t[27]=e("i",{class:"fas fa-search absolute left-3 text-sm text-cyan-500"},null,-1)),f.value?(r(),d("button",{key:0,class:"absolute right-2 flex h-5 w-5 items-center justify-center rounded-full text-gray-400 hover:bg-gray-100 hover:text-gray-600",onClick:xt},t[26]||(t[26]=[e("i",{class:"fas fa-times text-xs"},null,-1)]))):v("",!0)])]),e("button",{class:"group relative flex items-center justify-center gap-2 rounded-lg border border-gray-200 bg-white px-4 py-2 text-sm font-medium text-gray-700 shadow-sm transition-all duration-200 hover:border-gray-300 hover:shadow-md disabled:cursor-not-allowed disabled:opacity-50 sm:w-auto",disabled:V.value,onClick:t[6]||(t[6]=s=>ie())},[t[29]||(t[29]=e("div",{class:"absolute -inset-0.5 rounded-lg bg-gradient-to-r from-green-500 to-teal-500 opacity-0 blur transition duration-300 group-hover:opacity-20"},null,-1)),e("i",{class:U(["fas relative text-green-500",V.value?"fa-spinner fa-spin":"fa-sync-alt"])},null,2),t[30]||(t[30]=e("span",{class:"relative"},"刷新",-1))],8,$i)]),e("button",{class:"flex w-full items-center justify-center gap-2 rounded-lg bg-gradient-to-r from-blue-500 to-blue-600 px-5 py-2.5 text-sm font-medium text-white shadow-md transition-all duration-200 hover:from-blue-600 hover:to-blue-700 hover:shadow-lg sm:w-auto",onClick:me(at,["stop"])},t[31]||(t[31]=[e("i",{class:"fas fa-plus"},null,-1),e("span",null,"创建新 Key",-1)]))])]),V.value?(r(),d("div",Ai,t[33]||(t[33]=[e("div",{class:"loading-spinner mx-auto mb-4"},null,-1),e("p",{class:"text-gray-500"},"正在加载 API Keys...",-1)]))):u.value.length===0?(r(),d("div",ki,t[34]||(t[34]=[e("div",{class:"mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-gray-100"},[e("i",{class:"fas fa-key text-xl text-gray-400"})],-1),e("p",{class:"text-lg text-gray-500"},"暂无 API Keys",-1),e("p",{class:"mt-2 text-sm text-gray-400"},"点击上方按钮创建您的第一个 API Key",-1)]))):(r(),d("div",Ci,[e("table",Ki,[e("thead",Ii,[e("tr",null,[e("th",{class:"w-[25%] min-w-[200px] cursor-pointer px-3 py-4 text-left text-xs font-bold uppercase tracking-wider text-gray-700 hover:bg-gray-100",onClick:t[7]||(t[7]=s=>ve("name"))},[t[35]||(t[35]=K(" 名称 ",-1)),h.value==="name"?(r(),d("i",{key:0,class:U(["fas",k.value==="asc"?"fa-sort-up":"fa-sort-down","ml-1"])},null,2)):(r(),d("i",Di))]),t[42]||(t[42]=e("th",{class:"w-[10%] min-w-[80px] px-3 py-4 text-left text-xs font-bold uppercase tracking-wider text-gray-700"}," 标签 ",-1)),e("th",{class:"w-[8%] min-w-[70px] cursor-pointer px-3 py-4 text-left text-xs font-bold uppercase tracking-wider text-gray-700 hover:bg-gray-100",onClick:t[8]||(t[8]=s=>ve("status"))},[t[36]||(t[36]=K(" 状态 ",-1)),h.value==="status"?(r(),d("i",{key:0,class:U(["fas",k.value==="asc"?"fa-sort-up":"fa-sort-down","ml-1"])},null,2)):(r(),d("i",Li))]),e("th",_i,[t[39]||(t[39]=K(" 使用统计 ",-1)),e("span",{class:"cursor-pointer rounded px-2 py-1 hover:bg-gray-100",onClick:t[9]||(t[9]=s=>ve("cost"))},[t[37]||(t[37]=K(" (费用 ",-1)),h.value==="cost"?(r(),d("i",{key:0,class:U(["fas",k.value==="asc"?"fa-sort-up":"fa-sort-down","ml-1"])},null,2)):(r(),d("i",Mi)),t[38]||(t[38]=K(") ",-1))])]),e("th",{class:"w-[10%] min-w-[90px] cursor-pointer px-3 py-4 text-left text-xs font-bold uppercase tracking-wider text-gray-700 hover:bg-gray-100",onClick:t[10]||(t[10]=s=>ve("createdAt"))},[t[40]||(t[40]=K(" 创建时间 ",-1)),h.value==="createdAt"?(r(),d("i",{key:0,class:U(["fas",k.value==="asc"?"fa-sort-up":"fa-sort-down","ml-1"])},null,2)):(r(),d("i",Ti))]),e("th",{class:"w-[10%] min-w-[90px] cursor-pointer px-3 py-4 text-left text-xs font-bold uppercase tracking-wider text-gray-700 hover:bg-gray-100",onClick:t[11]||(t[11]=s=>ve("expiresAt"))},[t[41]||(t[41]=K(" 过期时间 ",-1)),h.value==="expiresAt"?(r(),d("i",{key:0,class:U(["fas",k.value==="asc"?"fa-sort-up":"fa-sort-down","ml-1"])},null,2)):(r(),d("i",Si))]),t[43]||(t[43]=e("th",{class:"w-[20%] min-w-[180px] px-3 py-4 text-left text-xs font-bold uppercase tracking-wider text-gray-700"}," 操作 ",-1))])]),e("tbody",Ri,[(r(!0),d(Q,null,te(re.value,s=>{var S,z;return r(),d(Q,{key:s.id},[e("tr",ji,[e("td",Ei,[e("div",Vi,[t[48]||(t[48]=e("div",{class:"mr-2 flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-lg bg-gradient-to-br from-blue-500 to-blue-600"},[e("i",{class:"fas fa-key text-xs text-white"})],-1)),e("div",Pi,[e("div",{class:"truncate text-sm font-semibold text-gray-900",title:s.name},c(s.name),9,Ui),e("div",{class:"truncate text-xs text-gray-500",title:s.id},c(s.id),9,qi),e("div",Gi,[s.claudeAccountId||s.claudeConsoleAccountId?(r(),d("div",Oi,[t[44]||(t[44]=e("span",{class:"inline-flex items-center rounded bg-indigo-100 px-1.5 py-0.5 text-indigo-700"},[e("i",{class:"fas fa-brain mr-1 text-[10px]"}),K(" Claude ")],-1)),e("span",Wi,c(Ve(s)),1)])):v("",!0),s.geminiAccountId?(r(),d("div",Fi,[t[45]||(t[45]=e("span",{class:"inline-flex items-center rounded bg-yellow-100 px-1.5 py-0.5 text-yellow-700"},[e("i",{class:"fas fa-robot mr-1 text-[10px]"}),K(" Gemini ")],-1)),e("span",Bi,c(Pe(s)),1)])):v("",!0),s.openaiAccountId?(r(),d("div",zi,[t[46]||(t[46]=e("span",{class:"inline-flex items-center rounded bg-gray-100 px-1.5 py-0.5 text-gray-700"},[e("i",{class:"fa-openai mr-1 text-[10px]"}),K(" OpenAI ")],-1)),e("span",Hi,c(Ue(s)),1)])):v("",!0),!s.claudeAccountId&&!s.claudeConsoleAccountId&&!s.geminiAccountId&&!s.openaiAccountId?(r(),d("div",Ni,t[47]||(t[47]=[e("i",{class:"fas fa-share-alt mr-1"},null,-1),K(" 使用共享池 ",-1)]))):v("",!0)])])])]),e("td",Yi,[e("div",Qi,[(r(!0),d(Q,null,te(s.tags||[],L=>(r(),d("span",{key:L,class:"inline-flex items-center rounded-full bg-blue-100 px-2 py-0.5 text-xs text-blue-800"},c(L),1))),128)),!s.tags||s.tags.length===0?(r(),d("span",Ji,"无标签")):v("",!0)])]),e("td",Xi,[e("span",{class:U(["inline-flex items-center rounded-full px-3 py-1 text-xs font-semibold",s.isActive?"bg-green-100 text-green-800":"bg-red-100 text-red-800"])},[e("div",{class:U(["mr-2 h-2 w-2 rounded-full",s.isActive?"bg-green-500":"bg-red-500"])},null,2),K(" "+c(s.isActive?"活跃":"禁用"),1)],2)]),e("td",Zi,[e("div",ea,[e("div",ta,[e("div",sa,[t[49]||(t[49]=e("span",{class:"text-gray-600"},"今日请求",-1)),e("span",la,c(je(((z=(S=s.usage)==null?void 0:S.daily)==null?void 0:z.requests)||0))+"次",1)]),e("div",oa,[t[50]||(t[50]=e("span",{class:"text-gray-600"},"今日费用",-1)),e("span",na,"$"+c((s.dailyCost||0).toFixed(4)),1)]),e("div",ia,[t[51]||(t[51]=e("span",{class:"text-gray-600"},"最后使用",-1)),e("span",aa,c(Xe(s.lastUsedAt)),1)])]),s.dailyCostLimit>0?(r(),d("div",ra,[e("div",da,[t[52]||(t[52]=e("span",{class:"text-gray-500"},"费用限额",-1)),e("span",ua," $"+c((s.dailyCost||0).toFixed(2))+" / $"+c(s.dailyCostLimit.toFixed(2)),1)]),e("div",ca,[e("div",{class:U(["h-1.5 rounded-full transition-all duration-300",Je(s)]),style:he({width:_e(s)+"%"})},null,6)])])):v("",!0),s.rateLimitWindow>0?(r(),oe(Te,{key:1,"current-requests":s.currentWindowRequests,"current-tokens":s.currentWindowTokens,"rate-limit-window":s.rateLimitWindow,"request-limit":s.rateLimitRequests,"show-progress":!0,"show-tooltip":!1,"token-limit":s.tokenLimit,"window-end-time":s.windowEndTime,"window-remaining-seconds":s.windowRemainingSeconds,"window-start-time":s.windowStartTime},null,8,["current-requests","current-tokens","rate-limit-window","request-limit","token-limit","window-end-time","window-remaining-seconds","window-start-time"])):v("",!0),e("div",ma,[e("button",{class:"flex w-full items-center justify-center gap-1 rounded py-1 text-xs font-medium text-blue-600 transition-colors hover:bg-blue-50 hover:text-blue-800",onClick:L=>Me(s)},t[53]||(t[53]=[e("i",{class:"fas fa-chart-line"},null,-1),K(" 查看详细统计 ",-1)]),8,pa)])])]),e("td",xa,c(new Date(s.createdAt).toLocaleDateString()),1),e("td",fa,[e("div",ga,[s.expiresAt?(r(),d("span",ya,[$e(s.expiresAt)?(r(),d("span",ba,t[54]||(t[54]=[e("i",{class:"fas fa-exclamation-circle mr-1"},null,-1),K(" 已过期 ",-1)]))):Ae(s.expiresAt)?(r(),d("span",va,[t[55]||(t[55]=e("i",{class:"fas fa-clock mr-1"},null,-1)),K(" "+c(qe(s.expiresAt)),1)])):(r(),d("span",wa,c(qe(s.expiresAt)),1))])):(r(),d("span",ha,t[56]||(t[56]=[e("i",{class:"fas fa-infinity mr-1"},null,-1),K(" 永不过期 ",-1)]))),e("button",{class:"inline-flex h-6 w-6 items-center justify-center rounded-md text-gray-300 transition-all duration-200 hover:bg-blue-50 hover:text-blue-500",title:"编辑过期时间",onClick:me(L=>Ne(s),["stop"])},t[57]||(t[57]=[e("svg",{class:"h-3 w-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"})],-1)]),8,$a)])]),e("td",Aa,[e("div",ka,[s&&s.id?(r(),d("button",{key:0,class:"rounded px-2 py-1 text-xs font-medium text-indigo-600 transition-colors hover:bg-indigo-50 hover:text-indigo-900",title:"模型使用分布",onClick:L=>st(s.id)},[e("i",{class:U(["fas",B.value[s.id]?"fa-chevron-up":"fa-chevron-down"])},null,2),t[58]||(t[58]=e("span",{class:"ml-1 hidden xl:inline"},"模型",-1))],8,Ca)):v("",!0),e("button",{class:"rounded px-2 py-1 text-xs font-medium text-purple-600 transition-colors hover:bg-purple-50 hover:text-purple-900",title:"复制统计页面链接",onClick:L=>mt(s)},t[59]||(t[59]=[e("i",{class:"fas fa-chart-bar"},null,-1),e("span",{class:"ml-1 hidden xl:inline"},"统计",-1)]),8,Ka),e("button",{class:"rounded px-2 py-1 text-xs font-medium text-blue-600 transition-colors hover:bg-blue-50 hover:text-blue-900",title:"编辑",onClick:L=>Fe(s)},t[60]||(t[60]=[e("i",{class:"fas fa-edit"},null,-1),e("span",{class:"ml-1 hidden xl:inline"},"编辑",-1)]),8,Ia),s.expiresAt&&($e(s.expiresAt)||Ae(s.expiresAt))?(r(),d("button",{key:1,class:"rounded px-2 py-1 text-xs font-medium text-green-600 transition-colors hover:bg-green-50 hover:text-green-900",title:"续期",onClick:L=>Be(s)},t[61]||(t[61]=[e("i",{class:"fas fa-clock"},null,-1),e("span",{class:"ml-1 hidden xl:inline"},"续期",-1)]),8,Da)):v("",!0),e("button",{class:U([s.isActive?"text-orange-600 hover:bg-orange-50 hover:text-orange-900":"text-green-600 hover:bg-green-50 hover:text-green-900","rounded px-2 py-1 text-xs font-medium transition-colors"]),title:s.isActive?"禁用":"激活",onClick:L=>ze(s)},[e("i",{class:U(["fas",s.isActive?"fa-ban":"fa-check-circle"])},null,2),e("span",_a,c(s.isActive?"禁用":"激活"),1)],10,La),e("button",{class:"rounded px-2 py-1 text-xs font-medium text-red-600 transition-colors hover:bg-red-50 hover:text-red-900",title:"删除",onClick:L=>He(s.id)},t[62]||(t[62]=[e("i",{class:"fas fa-trash"},null,-1),e("span",{class:"ml-1 hidden xl:inline"},"删除",-1)]),8,Ma)])])]),s&&s.id&&B.value[s.id]?(r(),d("tr",Ta,[e("td",Sa,[C.value[s.id]?v("",!0):(r(),d("div",Ra,t[63]||(t[63]=[e("div",{class:"loading-spinner mx-auto"},null,-1),e("p",{class:"mt-2 text-sm text-gray-500"},"加载模型统计...",-1)]))),e("div",ja,[e("div",Ea,[t[64]||(t[64]=e("h5",{class:"flex items-center text-sm font-semibold text-gray-700"},[e("i",{class:"fas fa-chart-pie mr-2 text-indigo-500"}),K(" 模型使用分布 ")],-1)),e("div",Va,[C.value[s.id]&&C.value[s.id].length>0?(r(),d("span",Pa,c(C.value[s.id].length)+" 个模型 ",1)):v("",!0),e("div",Ua,[e("div",qa,[(r(!0),d(Q,null,te(xe(s.id).presetOptions,L=>(r(),d("button",{key:L.value,class:U(["rounded px-2 py-1 text-xs font-medium transition-colors",xe(s.id).preset===L.value&&xe(s.id).type==="preset"?"bg-white text-blue-600 shadow-sm":"text-gray-600 hover:text-gray-900"]),onClick:de=>We(L.value,s.id)},c(L.label),11,Ga))),128))]),ne(g,{class:"api-key-date-picker",clearable:!0,"default-time":j.value,"disabled-date":nt,"end-placeholder":"结束日期",format:"YYYY-MM-DD HH:mm:ss","model-value":xe(s.id).customRange,"range-separator":"至",size:"small","start-placeholder":"开始日期",style:{width:"280px"},type:"datetimerange","unlink-panels":!1,"value-format":"YYYY-MM-DD HH:mm:ss","onUpdate:modelValue":L=>ot(s.id,L)},null,8,["default-time","model-value","onUpdate:modelValue"])])])]),C.value[s.id]&&C.value[s.id].length===0?(r(),d("div",Oa,[e("div",Wa,[t[66]||(t[66]=e("i",{class:"fas fa-chart-line text-lg text-gray-400"},null,-1)),t[67]||(t[67]=e("p",{class:"text-sm text-gray-500"},"暂无模型使用数据",-1)),e("button",{class:"ml-2 flex items-center gap-1 text-sm text-blue-500 transition-colors hover:text-blue-700",title:"重置筛选条件并刷新",onClick:L=>it(s.id)},t[65]||(t[65]=[e("i",{class:"fas fa-sync-alt text-xs"},null,-1),e("span",{class:"text-xs"},"刷新",-1)]),8,Fa)]),t[68]||(t[68]=e("p",{class:"text-xs text-gray-400"},"尝试调整时间范围或点击刷新重新加载数据",-1))])):C.value[s.id]&&C.value[s.id].length>0?(r(),d("div",Ba,[(r(!0),d(Q,null,te(C.value[s.id],L=>(r(),d("div",{key:L.model,class:"rounded-xl border border-gray-200 bg-gradient-to-br from-white to-gray-50 p-4 transition-all duration-200 hover:border-indigo-300 hover:shadow-lg"},[e("div",za,[e("div",Ha,[e("span",Na,c(L.model),1),e("span",Ya,c(L.requests)+" 次请求",1)])]),e("div",Qa,[e("div",Ja,[t[69]||(t[69]=e("span",{class:"flex items-center text-gray-600"},[e("i",{class:"fas fa-coins mr-1 text-xs text-yellow-500"}),K(" 总Token: ")],-1)),e("span",Xa,c(be(L.allTokens)),1)]),e("div",Za,[t[70]||(t[70]=e("span",{class:"flex items-center text-gray-600"},[e("i",{class:"fas fa-dollar-sign mr-1 text-xs text-green-500"}),K(" 费用: ")],-1)),e("span",er,c(lt(L)),1)]),e("div",tr,[e("div",sr,[t[71]||(t[71]=e("span",{class:"flex items-center"},[e("i",{class:"fas fa-arrow-down mr-1 text-green-500"}),K(" 输入: ")],-1)),e("span",lr,c(be(L.inputTokens)),1)]),e("div",or,[t[72]||(t[72]=e("span",{class:"flex items-center"},[e("i",{class:"fas fa-arrow-up mr-1 text-blue-500"}),K(" 输出: ")],-1)),e("span",nr,c(be(L.outputTokens)),1)]),L.cacheCreateTokens>0?(r(),d("div",ir,[t[73]||(t[73]=e("span",{class:"flex items-center"},[e("i",{class:"fas fa-save mr-1"}),K(" 缓存创建: ")],-1)),e("span",ar,c(be(L.cacheCreateTokens)),1)])):v("",!0),L.cacheReadTokens>0?(r(),d("div",rr,[t[74]||(t[74]=e("span",{class:"flex items-center"},[e("i",{class:"fas fa-download mr-1"}),K(" 缓存读取: ")],-1)),e("span",dr,c(be(L.cacheReadTokens)),1)])):v("",!0)])]),e("div",ur,[e("div",{class:"h-2 rounded-full bg-gradient-to-r from-indigo-500 to-purple-600 transition-all duration-500",style:he({width:Ge(L.allTokens,C.value[s.id])+"%"})},null,4)]),e("div",cr,[e("span",mr,c(Ge(L.allTokens,C.value[s.id]))+"% ",1)])]))),128))])):v("",!0),C.value[s.id]&&C.value[s.id].length>0?(r(),d("div",pr,[e("div",xr,[t[77]||(t[77]=e("span",{class:"flex items-center font-semibold text-gray-700"},[e("i",{class:"fas fa-calculator mr-2 text-indigo-500"}),K(" 总计统计 ")],-1)),e("div",fr,[e("span",gr,[t[75]||(t[75]=K(" 总请求: ",-1)),e("span",yr,c(C.value[s.id].reduce((L,de)=>L+de.requests,0)),1)]),e("span",br,[t[76]||(t[76]=K(" 总Token: ",-1)),e("span",vr,c(be(C.value[s.id].reduce((L,de)=>L+de.allTokens,0))),1)])])])])):v("",!0)])])])):v("",!0)],64)}),128))])])])),!V.value&&Z.value.length>0?(r(),d("div",wr,[(r(!0),d(Q,null,te(re.value,s=>{var S,z;return r(),d("div",{key:s.id,class:"card p-4 transition-shadow hover:shadow-lg"},[e("div",hr,[e("div",$r,[t[78]||(t[78]=e("div",{class:"flex h-10 w-10 flex-shrink-0 items-center justify-center rounded-lg bg-gradient-to-br from-blue-500 to-blue-600"},[e("i",{class:"fas fa-key text-sm text-white"})],-1)),e("div",null,[e("h4",Ar,c(s.name),1),e("p",kr,c(s.id),1)])]),e("span",{class:U(["inline-flex items-center rounded-full px-2 py-1 text-xs font-semibold",s.isActive?"bg-green-100 text-green-800":"bg-red-100 text-red-800"])},[e("div",{class:U(["mr-1.5 h-1.5 w-1.5 rounded-full",s.isActive?"bg-green-500":"bg-red-500"])},null,2),K(" "+c(s.isActive?"活跃":"已停用"),1)],2)]),e("div",Cr,[s.claudeAccountId||s.claudeConsoleAccountId?(r(),d("div",Kr,[t[79]||(t[79]=e("span",{class:"inline-flex items-center rounded bg-indigo-100 px-2 py-0.5 text-indigo-700"},[e("i",{class:"fas fa-brain mr-1"}),K(" Claude ")],-1)),e("span",Ir,c(Ve(s)),1)])):v("",!0),s.geminiAccountId?(r(),d("div",Dr,[t[80]||(t[80]=e("span",{class:"inline-flex items-center rounded bg-yellow-100 px-2 py-0.5 text-yellow-700"},[e("i",{class:"fas fa-robot mr-1"}),K(" Gemini ")],-1)),e("span",Lr,c(Pe(s)),1)])):v("",!0),s.openaiAccountId?(r(),d("div",_r,[t[81]||(t[81]=e("span",{class:"inline-flex items-center rounded bg-gray-100 px-2 py-0.5 text-gray-700"},[e("i",{class:"fa-openai mr-1"}),K(" OpenAI ")],-1)),e("span",Mr,c(Ue(s)),1)])):v("",!0),!s.claudeAccountId&&!s.claudeConsoleAccountId&&!s.geminiAccountId&&!s.openaiAccountId?(r(),d("div",Tr,t[82]||(t[82]=[e("i",{class:"fas fa-share-alt mr-1"},null,-1),K(" 使用共享池 ",-1)]))):v("",!0)]),e("div",Sr,[e("div",Rr,[e("div",jr,[t[84]||(t[84]=e("span",{class:"text-xs text-gray-600"},"今日使用",-1)),e("button",{class:"text-xs text-blue-600 hover:text-blue-800",onClick:L=>Me(s)},t[83]||(t[83]=[e("i",{class:"fas fa-chart-line mr-1"},null,-1),K("详情 ",-1)]),8,Er)]),e("div",Vr,[e("div",null,[e("p",Pr,c(je(((z=(S=s.usage)==null?void 0:S.daily)==null?void 0:z.requests)||0))+" 次 ",1),t[85]||(t[85]=e("p",{class:"text-xs text-gray-500"},"请求",-1))]),e("div",null,[e("p",Ur," $"+c((s.dailyCost||0).toFixed(4)),1),t[86]||(t[86]=e("p",{class:"text-xs text-gray-500"},"费用",-1))])]),e("div",qr,[t[87]||(t[87]=e("span",{class:"text-xs text-gray-600"},"最后使用",-1)),e("span",Gr,c(Xe(s.lastUsedAt)),1)])]),s.dailyCostLimit>0?(r(),d("div",Or,[e("div",Wr,[t[88]||(t[88]=e("span",{class:"text-gray-500"},"每日费用限额",-1)),e("span",Fr," $"+c((s.dailyCost||0).toFixed(2))+" / $"+c(s.dailyCostLimit.toFixed(2)),1)]),e("div",Br,[e("div",{class:U(["h-2 rounded-full transition-all duration-300",Je(s)]),style:he({width:_e(s)+"%"})},null,6)])])):v("",!0),s.rateLimitWindow>0&&(s.rateLimitRequests>0||s.tokenLimit>0)?(r(),oe(Te,{key:1,"current-requests":s.currentWindowRequests,"current-tokens":s.currentWindowTokens,"rate-limit-window":s.rateLimitWindow,"request-limit":s.rateLimitRequests,"show-progress":!0,"show-tooltip":!1,"token-limit":s.tokenLimit,"window-end-time":s.windowEndTime,"window-remaining-seconds":s.windowRemainingSeconds,"window-start-time":s.windowStartTime},null,8,["current-requests","current-tokens","rate-limit-window","request-limit","token-limit","window-end-time","window-remaining-seconds","window-start-time"])):v("",!0)]),e("div",zr,[e("div",Hr,[t[89]||(t[89]=e("span",null,"创建时间",-1)),e("span",null,c(Qe(s.createdAt)),1)]),e("div",Nr,[t[91]||(t[91]=e("span",null,"过期时间",-1)),e("div",Yr,[e("span",{class:U(Ae(s.expiresAt)?"font-semibold text-orange-600":"")},c(s.expiresAt?Qe(s.expiresAt):"永不过期"),3),e("button",{class:"inline-flex h-5 w-5 items-center justify-center rounded text-gray-300 transition-all duration-200 hover:bg-blue-50 hover:text-blue-500",title:"编辑过期时间",onClick:me(L=>Ne(s),["stop"])},t[90]||(t[90]=[e("svg",{class:"h-3 w-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"})],-1)]),8,Qr)])])]),s.tags&&s.tags.length>0?(r(),d("div",Jr,[(r(!0),d(Q,null,te(s.tags,L=>(r(),d("span",{key:L,class:"inline-flex items-center rounded-full bg-blue-100 px-2 py-0.5 text-xs text-blue-800"},c(L),1))),128))])):v("",!0),e("div",Xr,[e("button",{class:"flex flex-1 items-center justify-center gap-1 rounded-lg bg-blue-50 px-3 py-2 text-xs text-blue-600 transition-colors hover:bg-blue-100",onClick:L=>Me(s)},t[92]||(t[92]=[e("i",{class:"fas fa-chart-line"},null,-1),K(" 查看详情 ",-1)]),8,Zr),e("button",{class:"flex-1 rounded-lg bg-gray-50 px-3 py-2 text-xs text-gray-600 transition-colors hover:bg-gray-100",onClick:L=>Fe(s)},t[93]||(t[93]=[e("i",{class:"fas fa-edit mr-1"},null,-1),K(" 编辑 ",-1)]),8,ed),s.expiresAt&&($e(s.expiresAt)||Ae(s.expiresAt))?(r(),d("button",{key:0,class:"flex-1 rounded-lg bg-orange-50 px-3 py-2 text-xs text-orange-600 transition-colors hover:bg-orange-100",onClick:L=>Be(s)},t[94]||(t[94]=[e("i",{class:"fas fa-clock mr-1"},null,-1),K(" 续期 ",-1)]),8,td)):v("",!0),e("button",{class:U([s.isActive?"bg-orange-50 text-orange-600 hover:bg-orange-100":"bg-green-50 text-green-600 hover:bg-green-100","rounded-lg px-3 py-2 text-xs transition-colors"]),onClick:L=>ze(s)},[e("i",{class:U(["fas",s.isActive?"fa-ban":"fa-check-circle","mr-1"])},null,2),K(" "+c(s.isActive?"禁用":"激活"),1)],10,sd),e("button",{class:"rounded-lg bg-red-50 px-3 py-2 text-xs text-red-600 transition-colors hover:bg-red-100",onClick:L=>He(s.id)},t[95]||(t[95]=[e("i",{class:"fas fa-trash"},null,-1)]),8,ld)])])}),128))])):v("",!0),Z.value.length>0?(r(),d("div",od,[e("div",nd,[e("span",id," 共 "+c(Z.value.length)+" 条记录 ",1),e("div",ad,[t[96]||(t[96]=e("span",{class:"text-xs text-gray-600 sm:text-sm"},"每页显示",-1)),P(e("select",{"onUpdate:modelValue":t[12]||(t[12]=s=>ae.value=s),class:"rounded-md border border-gray-200 bg-white px-2 py-1 text-xs text-gray-700 transition-colors hover:border-gray-300 focus:border-transparent focus:outline-none focus:ring-2 focus:ring-blue-500 sm:text-sm",onChange:t[13]||(t[13]=s=>p.value=1)},[(r(),d(Q,null,te(R,s=>e("option",{key:s,value:s},c(s),9,rd)),64))],544),[[Se,ae.value]]),t[97]||(t[97]=e("span",{class:"text-xs text-gray-600 sm:text-sm"},"条",-1))])]),e("div",dd,[e("button",{class:"rounded-md border border-gray-300 bg-white px-3 py-1.5 text-xs font-medium text-gray-700 hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-50 sm:py-1 sm:text-sm",disabled:p.value===1,onClick:t[14]||(t[14]=s=>p.value--)},t[98]||(t[98]=[e("i",{class:"fas fa-chevron-left"},null,-1)]),8,ud),e("div",cd,[p.value>3?(r(),d("button",{key:0,class:"hidden rounded-md border border-gray-300 bg-white px-3 py-1 text-sm font-medium text-gray-700 hover:bg-gray-50 sm:block",onClick:t[15]||(t[15]=s=>p.value=1)}," 1 ")):v("",!0),p.value>4?(r(),d("span",md,"...")):v("",!0),(r(!0),d(Q,null,te(ce.value,s=>(r(),d("button",{key:s,class:U(["rounded-md px-2 py-1 text-xs font-medium sm:px-3 sm:text-sm",s===p.value?"bg-blue-600 text-white":"border border-gray-300 bg-white text-gray-700 hover:bg-gray-50"]),onClick:S=>p.value=s},c(s),11,pd))),128)),p.value<le.value-3?(r(),d("span",xd,"...")):v("",!0),le.value>1&&p.value<le.value-2?(r(),d("button",{key:3,class:"hidden rounded-md border border-gray-300 bg-white px-3 py-1 text-sm font-medium text-gray-700 hover:bg-gray-50 sm:block",onClick:t[16]||(t[16]=s=>p.value=le.value)},c(le.value),1)):v("",!0)]),e("button",{class:"rounded-md border border-gray-300 bg-white px-3 py-1.5 text-xs font-medium text-gray-700 hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-50 sm:py-1 sm:text-sm",disabled:p.value===le.value||le.value===0,onClick:t[17]||(t[17]=s=>p.value++)},t[99]||(t[99]=[e("i",{class:"fas fa-chevron-right"},null,-1)]),8,fd)])])):v("",!0)]),a.value?(r(),oe(Qs,{key:0,accounts:y.value,onBatchSuccess:dt,onClose:t[18]||(t[18]=s=>a.value=!1),onSuccess:rt},null,8,["accounts"])):v("",!0),m.value?(r(),oe(Hl,{key:1,accounts:y.value,"api-key":o.value,onClose:t[19]||(t[19]=s=>m.value=!1),onSuccess:ut},null,8,["accounts","api-key"])):v("",!0),$.value?(r(),oe(co,{key:2,"api-key":x.value,onClose:t[20]||(t[20]=s=>$.value=!1),onSuccess:ct},null,8,["api-key"])):v("",!0),_.value?(r(),oe(Co,{key:3,"api-key":Y.value,onClose:t[21]||(t[21]=s=>_.value=!1)},null,8,["api-key"])):v("",!0),b.value?(r(),oe(Qo,{key:4,"api-keys":W.value,onClose:t[22]||(t[22]=s=>b.value=!1)},null,8,["api-keys"])):v("",!0),ne(wn,{ref_key:"expiryEditModalRef",ref:n,"api-key":T.value||{id:null,expiresAt:null,name:""},show:!!T.value,onClose:Ye,onSave:pt},null,8,["api-key","show"]),ne(ui,{"api-key":J.value||{},show:l.value,onClose:t[23]||(t[23]=s=>l.value=!1)},null,8,["api-key","show"])])}}},kd=pe(gd,[["__scopeId","data-v-99508535"]]);export{kd as default};
|