Files
claude-relay-service/web/admin-spa/dist/assets/UserDashboardView-CAUM2yXW.js
2026-01-22 07:19:11 +00:00

2 lines
42 KiB
JavaScript

import{r as w,_ as E,o as Y,x as r,L as p,y as a,z as e,Y as W,K as F,aq as O,P as l,O as D,C as M,c as S,q as H,R as j,Q as N,ac as q,aV as G,aT as Q,u as J,aU as X}from"./vue-vendor-R8HMg95E.js";import{_ as V,b as z,s as _,a as Z}from"./index-B3t2NHq9.js";import{T as ee}from"./ThemeToggle-DRoGUDeP.js";import{C as te}from"./ConfirmModal-BAFPIqcc.js";import se from"./TutorialView-DeQdS06L.js";import"./element-plus-BUfCkBQO.js";import"./vendor-Dr8jvgFu.js";const oe={key:0,class:"fixed inset-0 z-50 h-full w-full overflow-y-auto bg-gray-600 bg-opacity-50"},le={class:"relative top-20 mx-auto w-[768px] max-w-4xl rounded-md border bg-white p-5 shadow-lg"},re={class:"mt-3"},ae={class:"mb-4 flex items-center justify-between"},de=["disabled"],ie=["disabled"],ne={key:0,class:"rounded-md border border-red-200 bg-red-50 p-3"},ue={class:"flex"},ce={class:"ml-3"},me={class:"text-sm text-red-700"},xe={class:"flex justify-end space-x-3 pt-4"},ge=["disabled"],ve=["disabled"],ye={key:0,class:"flex items-center"},pe={key:1},fe={key:0,class:"mt-6 rounded-md border border-green-200 bg-green-50 p-4"},he={class:"flex items-start"},ke={class:"ml-3 flex-1"},we={class:"mt-3"},be={class:"rounded-md border border-green-300 bg-white p-3"},_e={class:"flex items-center justify-between"},$e={class:"break-all font-mono text-sm text-gray-900"},Ae={__name:"CreateApiKeyModal",props:{show:{type:Boolean,default:!1}},emits:["close","created"],setup(x,{emit:b}){const f=x,h=b,m=z(),g=w(!1),v=w(""),y=w(null),s=E({name:"",description:""}),o=()=>{s.name="",s.description="",v.value="",y.value=null},$=async()=>{var i,t;if(!s.name.trim()){v.value="API key name is required";return}g.value=!0,v.value="";try{const d={name:s.name.trim(),description:s.description.trim()||void 0},k=await m.createApiKey(d);k.success?(y.value=k.apiKey,_("API key created successfully!","success")):v.value=k.message||"Failed to create API key"}catch(d){console.error("Create API key error:",d),v.value=((t=(i=d.response)==null?void 0:i.data)==null?void 0:t.message)||d.message||"Failed to create API key"}finally{g.value=!1}},A=async i=>{try{await navigator.clipboard.writeText(i),_("API key copied to clipboard!","success")}catch(t){console.error("Failed to copy:",t),_("Failed to copy to clipboard","error")}},C=()=>{o(),h("created"),h("close")};return Y(()=>f.show,i=>{i&&o()}),(i,t)=>x.show?(a(),r("div",oe,[e("div",le,[e("div",re,[e("div",ae,[t[6]||(t[6]=e("h3",{class:"text-lg font-medium text-gray-900"},"Create New API Key",-1)),e("button",{class:"text-gray-400 hover:text-gray-600",onClick:t[0]||(t[0]=d=>i.$emit("close"))},t[5]||(t[5]=[e("svg",{class:"h-6 w-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{d:"M6 18L18 6M6 6l12 12","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"})],-1)]))]),e("form",{class:"space-y-4",onSubmit:W($,["prevent"])},[e("div",null,[t[7]||(t[7]=e("label",{class:"block text-sm font-medium text-gray-700",for:"name"}," Name * ",-1)),F(e("input",{id:"name","onUpdate:modelValue":t[1]||(t[1]=d=>s.name=d),class:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 sm:text-sm",disabled:g.value,placeholder:"Enter API key name",required:"",type:"text"},null,8,de),[[O,s.name]])]),e("div",null,[t[8]||(t[8]=e("label",{class:"block text-sm font-medium text-gray-700",for:"description"}," Description ",-1)),F(e("textarea",{id:"description","onUpdate:modelValue":t[2]||(t[2]=d=>s.description=d),class:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 sm:text-sm",disabled:g.value,placeholder:"Optional description",rows:"3"},null,8,ie),[[O,s.description]])]),v.value?(a(),r("div",ne,[e("div",ue,[t[9]||(t[9]=e("div",{class:"flex-shrink-0"},[e("svg",{class:"h-5 w-5 text-red-400",fill:"currentColor",viewBox:"0 0 20 20"},[e("path",{"clip-rule":"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z","fill-rule":"evenodd"})])],-1)),e("div",ce,[e("p",me,l(v.value),1)])])])):p("",!0),e("div",xe,[e("button",{class:"rounded-md border border-gray-300 px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 disabled:opacity-50",disabled:g.value,type:"button",onClick:t[3]||(t[3]=d=>i.$emit("close"))}," Cancel ",8,ge),e("button",{class:"rounded-md border border-transparent bg-blue-600 px-4 py-2 text-sm font-medium text-white shadow-sm hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",disabled:g.value||!s.name.trim(),type:"submit"},[g.value?(a(),r("span",ye,t[10]||(t[10]=[e("svg",{class:"-ml-1 mr-2 h-4 w-4 animate-spin text-white",fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},[e("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"}),e("path",{class:"opacity-75",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z",fill:"currentColor"})],-1),D(" Creating... ",-1)]))):(a(),r("span",pe,"Create API Key"))],8,ve)])],32),y.value?(a(),r("div",fe,[e("div",he,[t[14]||(t[14]=e("div",{class:"flex-shrink-0"},[e("svg",{class:"h-5 w-5 text-green-400",fill:"currentColor",viewBox:"0 0 20 20"},[e("path",{"clip-rule":"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z","fill-rule":"evenodd"})])],-1)),e("div",ke,[t[13]||(t[13]=e("h4",{class:"text-sm font-medium text-green-800"},"API Key Created Successfully!",-1)),e("div",we,[t[12]||(t[12]=e("p",{class:"mb-2 text-sm text-green-700"},[e("strong",null,"Important:"),D(" Copy your API key now. You won't be able to see it again! ")],-1)),e("div",be,[e("div",_e,[e("code",$e,l(y.value.key),1),e("button",{class:"ml-3 inline-flex flex-shrink-0 items-center rounded border border-transparent bg-green-100 px-2 py-1 text-xs font-medium text-green-700 hover:bg-green-200 focus:outline-none focus:ring-2 focus:ring-green-500 focus:ring-offset-2",onClick:t[4]||(t[4]=d=>A(y.value.key))},t[11]||(t[11]=[e("svg",{class:"mr-1 h-3 w-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"})],-1),D(" Copy ",-1)]))])])]),e("div",{class:"mt-4 flex justify-end"},[e("button",{class:"rounded-md border border-transparent bg-green-600 px-4 py-2 text-sm font-medium text-white shadow-sm hover:bg-green-700 focus:outline-none focus:ring-2 focus:ring-green-500 focus:ring-offset-2",onClick:C}," Done ")])])])])):p("",!0)])])])):p("",!0)}},Ce=V(Ae,[["__scopeId","data-v-cc42dc9a"]]),Me={key:0,class:"fixed inset-0 z-50 h-full w-full overflow-y-auto bg-gray-600 bg-opacity-50"},De={class:"relative top-20 mx-auto w-[768px] max-w-4xl rounded-md border bg-white p-5 shadow-lg"},Ie={class:"mt-3"},Pe={class:"mb-4 flex items-center justify-between"},Ue={key:0,class:"space-y-4"},je={class:"mt-1 text-sm text-gray-900"},Ke={key:0},Te={class:"mt-1 text-sm text-gray-900"},Ve={class:"mt-1 flex items-center space-x-2"},Be={class:"flex-1"},Se={key:0,class:"rounded-md border border-gray-300 bg-gray-50 p-3"},ze={class:"break-all font-mono text-sm text-gray-900"},Le={key:1,class:"rounded-md border border-gray-300 bg-gray-50 p-3"},Fe={class:"font-mono text-sm text-gray-900"},Ne={class:"flex flex-col space-y-1"},qe={key:0,class:"mr-1 h-3 w-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},He={key:1,class:"mr-1 h-3 w-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Re={key:0,class:"mt-1 text-xs text-gray-500"},Oe={class:"mt-1"},Ee={key:1,class:"border-t border-gray-200 pt-4"},Ye={class:"grid grid-cols-2 gap-4 text-sm"},We={class:"ml-2 font-medium"},Ge={class:"ml-2 font-medium"},Qe={class:"ml-2 font-medium"},Je={class:"ml-2 font-medium"},Xe={class:"space-y-2 border-t border-gray-200 pt-4 text-sm"},Ze={class:"flex justify-between"},et={class:"text-gray-900"},tt={key:0,class:"flex justify-between"},st={class:"text-gray-900"},ot={key:1,class:"flex justify-between"},lt={class:"flex justify-end pt-4"},rt={__name:"ViewApiKeyModal",props:{show:{type:Boolean,default:!1},apiKey:{type:Object,default:null}},emits:["close"],setup(x,{emit:b}){const f=b,h=w(!1),m=y=>y>=1e6?(y/1e6).toFixed(1)+"M":y>=1e3?(y/1e3).toFixed(1)+"K":y.toString(),g=y=>y?new Date(y).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):null,v=async y=>{try{await navigator.clipboard.writeText(y),_("Copied to clipboard!","success")}catch(s){console.error("Failed to copy:",s),_("Failed to copy to clipboard","error")}};return(y,s)=>x.show?(a(),r("div",Me,[e("div",De,[e("div",Ie,[e("div",Pe,[s[5]||(s[5]=e("h3",{class:"text-lg font-medium text-gray-900"},"API Key Details",-1)),e("button",{class:"text-gray-400 hover:text-gray-600",onClick:s[0]||(s[0]=o=>f("close"))},s[4]||(s[4]=[e("svg",{class:"h-6 w-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{d:"M6 18L18 6M6 6l12 12","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"})],-1)]))]),x.apiKey?(a(),r("div",Ue,[e("div",null,[s[6]||(s[6]=e("label",{class:"block text-sm font-medium text-gray-700"},"Name",-1)),e("p",je,l(x.apiKey.name),1)]),x.apiKey.description?(a(),r("div",Ke,[s[7]||(s[7]=e("label",{class:"block text-sm font-medium text-gray-700"},"Description",-1)),e("p",Te,l(x.apiKey.description),1)])):p("",!0),e("div",null,[s[11]||(s[11]=e("label",{class:"block text-sm font-medium text-gray-700"},"API Key",-1)),e("div",Ve,[e("div",Be,[h.value?(a(),r("div",Se,[e("code",ze,l(x.apiKey.key||"Not available"),1)])):(a(),r("div",Le,[e("code",Fe,l(x.apiKey.keyPreview||"cr_****"),1)]))]),e("div",Ne,[x.apiKey.key?(a(),r("button",{key:0,class:"inline-flex items-center rounded border border-gray-300 bg-white px-2 py-1 text-xs font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2",onClick:s[1]||(s[1]=o=>h.value=!h.value)},[h.value?(a(),r("svg",qe,s[8]||(s[8]=[e("path",{d:"M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.878 9.878L3 3m6.878 6.878L12 12m-1.122-2.122L12 12m-1.122-2.122l-4.243-4.242m6.879 6.878L15 15","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},null,-1)]))):(a(),r("svg",He,s[9]||(s[9]=[e("path",{d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},null,-1),e("path",{d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},null,-1)]))),D(" "+l(h.value?"Hide":"Show"),1)])):p("",!0),h.value&&x.apiKey.key?(a(),r("button",{key:1,class:"inline-flex items-center rounded border border-gray-300 bg-white px-2 py-1 text-xs font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2",onClick:s[2]||(s[2]=o=>v(x.apiKey.key))},s[10]||(s[10]=[e("svg",{class:"mr-1 h-3 w-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"})],-1),D(" Copy ",-1)]))):p("",!0)])]),x.apiKey.key?p("",!0):(a(),r("p",Re," Full API key is only shown when first created or regenerated "))]),e("div",null,[s[12]||(s[12]=e("label",{class:"block text-sm font-medium text-gray-700"},"Status",-1)),e("div",Oe,[e("span",{class:M(["inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium",x.apiKey.isActive?"bg-green-100 text-green-800":"bg-red-100 text-red-800"])},l(x.apiKey.isActive?"Active":"Disabled"),3)])]),x.apiKey.usage?(a(),r("div",Ee,[s[17]||(s[17]=e("label",{class:"mb-2 block text-sm font-medium text-gray-700"},"Usage Statistics",-1)),e("div",Ye,[e("div",null,[s[13]||(s[13]=e("span",{class:"text-gray-500"},"Requests:",-1)),e("span",We,l(m(x.apiKey.usage.requests||0)),1)]),e("div",null,[s[14]||(s[14]=e("span",{class:"text-gray-500"},"Input Tokens:",-1)),e("span",Ge,l(m(x.apiKey.usage.inputTokens||0)),1)]),e("div",null,[s[15]||(s[15]=e("span",{class:"text-gray-500"},"Output Tokens:",-1)),e("span",Qe,l(m(x.apiKey.usage.outputTokens||0)),1)]),e("div",null,[s[16]||(s[16]=e("span",{class:"text-gray-500"},"Total Cost:",-1)),e("span",Je,"$"+l((x.apiKey.usage.totalCost||0).toFixed(4)),1)])])])):p("",!0),e("div",Xe,[e("div",Ze,[s[18]||(s[18]=e("span",{class:"text-gray-500"},"Created:",-1)),e("span",et,l(g(x.apiKey.createdAt)),1)]),x.apiKey.lastUsedAt?(a(),r("div",tt,[s[19]||(s[19]=e("span",{class:"text-gray-500"},"Last Used:",-1)),e("span",st,l(g(x.apiKey.lastUsedAt)),1)])):p("",!0),x.apiKey.expiresAt?(a(),r("div",ot,[s[20]||(s[20]=e("span",{class:"text-gray-500"},"Expires:",-1)),e("span",{class:M(["font-medium",new Date(x.apiKey.expiresAt)<new Date?"text-red-600":"text-gray-900"])},l(g(x.apiKey.expiresAt)),3)])):p("",!0)]),e("div",lt,[e("button",{class:"rounded-md border border-gray-300 px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2",onClick:s[3]||(s[3]=o=>f("close"))}," Close ")])])):p("",!0)])])])):p("",!0)}},at=V(rt,[["__scopeId","data-v-3bc05568"]]),dt={class:"space-y-6"},it={class:"sm:flex sm:items-center"},nt={class:"mt-4 sm:ml-16 sm:mt-0 sm:flex-none"},ut=["disabled"],ct={key:0,class:"rounded-md border border-yellow-200 bg-yellow-50 p-4"},mt={class:"flex"},xt={class:"ml-3"},gt={class:"text-sm text-yellow-700"},vt={key:1,class:"py-12 text-center"},yt={key:2,class:"overflow-hidden bg-white shadow sm:rounded-md"},pt={class:"divide-y divide-gray-200",role:"list"},ft={class:"flex items-center justify-between"},ht={class:"flex items-center"},kt={class:"flex-shrink-0"},wt={class:"ml-4"},bt={class:"flex items-center"},_t={class:"text-sm font-medium text-gray-900"},$t={key:0,class:"ml-2 inline-flex items-center rounded-full bg-gray-100 px-2.5 py-0.5 text-xs font-medium text-gray-800"},At={key:1,class:"ml-2 inline-flex items-center rounded-full bg-red-100 px-2.5 py-0.5 text-xs font-medium text-red-800"},Ct={class:"mt-1"},Mt={class:"text-sm text-gray-500"},Dt={class:"mt-1 flex items-center space-x-4 text-xs text-gray-400"},It={key:0},Pt={key:1},Ut={key:2},jt={key:3},Kt={class:"flex items-center space-x-2"},Tt={class:"text-right text-xs text-gray-500"},Vt={key:0},Bt={class:"flex items-center space-x-1"},St=["onClick"],zt=["onClick"],Lt={key:3,class:"py-12 text-center"},Ft={class:"mt-6"},Nt={__name:"UserApiKeysManager",setup(x){const b=z(),f=w(!0),h=w([]),m=S(()=>{var u;return((u=b.config)==null?void 0:u.maxApiKeysPerUser)||5}),g=S(()=>{var u;return((u=b.config)==null?void 0:u.allowUserDeleteApiKeys)===!0}),v=w(!1),y=w(!1),s=w(!1),o=w(null),$=S(()=>[...h.value].sort((u,c)=>{const U=new Date(u.createdAt);return new Date(c.createdAt)-U})),A=S(()=>h.value.filter(u=>!(u.isDeleted==="true"||u.deletedAt)).length),C=u=>u>=1e6?(u/1e6).toFixed(1)+"M":u>=1e3?(u/1e3).toFixed(1)+"K":u.toString(),i=u=>u?new Date(u).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):null,t=async()=>{f.value=!0;try{h.value=await b.getUserApiKeys(!0)}catch(u){console.error("Failed to load API keys:",u),_("Failed to load API keys","error")}finally{f.value=!1}},d=u=>{o.value=u,y.value=!0},k=u=>{o.value=u,s.value=!0},I=async()=>{try{(await b.deleteApiKey(o.value.id)).success&&(_("API key deleted successfully","success"),await t())}catch(u){console.error("Failed to delete API key:",u),_("Failed to delete API key","error")}finally{s.value=!1,o.value=null}},P=async()=>{v.value=!1,await t()};return H(()=>{t()}),(u,c)=>{var U;return a(),r("div",dt,[e("div",it,[c[6]||(c[6]=e("div",{class:"sm:flex-auto"},[e("h1",{class:"text-2xl font-semibold text-gray-900"},"My API Keys"),e("p",{class:"mt-2 text-sm text-gray-700"}," Manage your API keys to access Claude Relay services ")],-1)),e("div",nt,[e("button",{class:"inline-flex items-center justify-center rounded-md border border-transparent bg-blue-600 px-4 py-2 text-sm font-medium text-white shadow-sm hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 sm:w-auto",disabled:A.value>=m.value,onClick:c[0]||(c[0]=n=>v.value=!0)},c[5]||(c[5]=[e("svg",{class:"-ml-1 mr-2 h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{d:"M12 6v6m0 0v6m0-6h6m-6 0H6","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"})],-1),D(" Create API Key ",-1)]),8,ut)])]),A.value>=m.value?(a(),r("div",ct,[e("div",mt,[c[7]||(c[7]=e("div",{class:"flex-shrink-0"},[e("svg",{class:"h-5 w-5 text-yellow-400",fill:"currentColor",viewBox:"0 0 20 20"},[e("path",{"clip-rule":"evenodd",d:"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z","fill-rule":"evenodd"})])],-1)),e("div",xt,[e("p",gt," You have reached the maximum number of API keys ("+l(m.value)+"). Please delete an existing key to create a new one. ",1)])])])):p("",!0),f.value?(a(),r("div",vt,c[8]||(c[8]=[e("svg",{class:"mx-auto h-8 w-8 animate-spin text-blue-600",fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},[e("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"}),e("path",{class:"opacity-75",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z",fill:"currentColor"})],-1),e("p",{class:"mt-2 text-sm text-gray-500"},"Loading API keys...",-1)]))):$.value.length>0?(a(),r("div",yt,[e("ul",pt,[(a(!0),r(N,null,q($.value,n=>{var K,T;return a(),r("li",{key:n.id,class:"px-6 py-4"},[e("div",ft,[e("div",ht,[e("div",kt,[e("div",{class:M(["h-2 w-2 rounded-full",n.isDeleted==="true"||n.deletedAt?"bg-gray-400":n.isActive?"bg-green-400":"bg-red-400"])},null,2)]),e("div",wt,[e("div",bt,[e("p",_t,l(n.name),1),n.isDeleted==="true"||n.deletedAt?(a(),r("span",$t," Deleted ")):n.isActive?p("",!0):(a(),r("span",At," Deleted "))]),e("div",Ct,[e("p",Mt,l(n.description||"No description"),1),e("div",Dt,[e("span",null,"Created: "+l(i(n.createdAt)),1),n.isDeleted==="true"||n.deletedAt?(a(),r("span",It,"Deleted: "+l(i(n.deletedAt)),1)):n.lastUsedAt?(a(),r("span",Pt,"Last used: "+l(i(n.lastUsedAt)),1)):(a(),r("span",Ut,"Never used")),n.expiresAt&&!(n.isDeleted==="true"||n.deletedAt)?(a(),r("span",jt,"Expires: "+l(i(n.expiresAt)),1)):p("",!0)])])])]),e("div",Kt,[e("div",Tt,[e("div",null,l(C(((K=n.usage)==null?void 0:K.requests)||0))+" requests",1),(T=n.usage)!=null&&T.totalCost?(a(),r("div",Vt,"$"+l(n.usage.totalCost.toFixed(4)),1)):p("",!0)]),e("div",Bt,[e("button",{class:"inline-flex items-center rounded border border-transparent p-1 text-gray-400 hover:text-gray-600",title:"View API Key",onClick:B=>d(n)},c[9]||(c[9]=[e("svg",{class:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"}),e("path",{d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"})],-1)]),8,St),!(n.isDeleted==="true"||n.deletedAt)&&n.isActive&&g.value?(a(),r("button",{key:0,class:"inline-flex items-center rounded border border-transparent p-1 text-red-400 hover:text-red-600",title:"Delete API Key",onClick:B=>k(n)},c[10]||(c[10]=[e("svg",{class:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"})],-1)]),8,zt)):p("",!0)])])])])}),128))])])):(a(),r("div",Lt,[c[12]||(c[12]=e("svg",{class:"mx-auto h-12 w-12 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{d:"M15 7a2 2 0 012 2m0 0a2 2 0 012 2m-2-2h-6m6 0v6a2 2 0 01-2 2H9a2 2 0 01-2-2V9a2 2 0 012-2h6z","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"})],-1)),c[13]||(c[13]=e("h3",{class:"mt-2 text-sm font-medium text-gray-900"},"No API keys",-1)),c[14]||(c[14]=e("p",{class:"mt-1 text-sm text-gray-500"},"Get started by creating your first API key.",-1)),e("div",Ft,[e("button",{class:"inline-flex items-center rounded-md border border-transparent bg-blue-600 px-4 py-2 text-sm font-medium text-white shadow-sm hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2",onClick:c[1]||(c[1]=n=>v.value=!0)},c[11]||(c[11]=[e("svg",{class:"-ml-1 mr-2 h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{d:"M12 6v6m0 0v6m0-6h6m-6 0H6","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"})],-1),D(" Create API Key ",-1)]))])])),j(Ce,{show:v.value,onClose:c[2]||(c[2]=n=>v.value=!1),onCreated:P},null,8,["show"]),j(at,{"api-key":o.value,show:y.value,onClose:c[3]||(c[3]=n=>y.value=!1)},null,8,["api-key","show"]),j(te,{"confirm-class":"bg-red-600 hover:bg-red-700","confirm-text":"Delete",message:`Are you sure you want to delete '${(U=o.value)==null?void 0:U.name}'? This action cannot be undone.`,show:s.value,title:"Delete API Key",onCancel:c[4]||(c[4]=n=>s.value=!1),onConfirm:I},null,8,["message","show"])])}}},qt=V(Nt,[["__scopeId","data-v-db785682"]]),Ht={class:"space-y-6"},Rt={class:"sm:flex sm:items-center"},Ot={class:"mt-4 sm:ml-16 sm:mt-0 sm:flex-none"},Et={key:0,class:"py-12 text-center"},Yt={key:1,class:"grid grid-cols-1 gap-6 md:grid-cols-2 lg:grid-cols-4"},Wt={class:"overflow-hidden rounded-lg bg-white shadow"},Gt={class:"p-5"},Qt={class:"flex items-center"},Jt={class:"ml-5 w-0 flex-1"},Xt={class:"text-lg font-medium text-gray-900"},Zt={class:"overflow-hidden rounded-lg bg-white shadow"},es={class:"p-5"},ts={class:"flex items-center"},ss={class:"ml-5 w-0 flex-1"},os={class:"text-lg font-medium text-gray-900"},ls={class:"overflow-hidden rounded-lg bg-white shadow"},rs={class:"p-5"},as={class:"flex items-center"},ds={class:"ml-5 w-0 flex-1"},is={class:"text-lg font-medium text-gray-900"},ns={class:"overflow-hidden rounded-lg bg-white shadow"},us={class:"p-5"},cs={class:"flex items-center"},ms={class:"ml-5 w-0 flex-1"},xs={class:"text-lg font-medium text-gray-900"},gs={key:2,class:"rounded-lg bg-white shadow"},vs={key:3,class:"rounded-lg bg-white shadow"},ys={class:"px-4 py-5 sm:p-6"},ps={class:"space-y-3"},fs={class:"flex items-center"},hs={class:"ml-3"},ks={class:"text-sm font-medium text-gray-900"},ws={class:"text-right"},bs={class:"text-sm text-gray-900"},_s={class:"text-xs text-gray-500"},$s={key:4,class:"rounded-lg bg-white shadow"},As={class:"px-4 py-5 sm:p-6"},Cs={class:"overflow-hidden"},Ms={class:"min-w-full divide-y divide-gray-200"},Ds={class:"divide-y divide-gray-200 bg-white"},Is={class:"whitespace-nowrap px-6 py-4"},Ps={class:"text-sm font-medium text-gray-900"},Us={class:"text-sm text-gray-500"},js={class:"whitespace-nowrap px-6 py-4 text-sm text-gray-900"},Ks={class:"whitespace-nowrap px-6 py-4 text-sm text-gray-900"},Ts={class:"whitespace-nowrap px-6 py-4 text-sm text-gray-900"},Vs={class:"whitespace-nowrap px-6 py-4 text-sm text-gray-900"},Bs={class:"whitespace-nowrap px-6 py-4"},Ss={key:5,class:"py-12 text-center"},zs={__name:"UserUsageStats",setup(x){const b=z(),f=w(!0),h=w("week"),m=w(null),g=w([]),v=s=>s>=1e6?(s/1e6).toFixed(1)+"M":s>=1e3?(s/1e3).toFixed(1)+"K":s.toString(),y=async()=>{f.value=!0;try{const[s,o]=await Promise.all([b.getUserUsageStats({period:h.value}),b.getUserApiKeys(!0)]);m.value=s,g.value=o}catch(s){console.error("Failed to load usage stats:",s),_("Failed to load usage statistics","error")}finally{f.value=!1}};return H(()=>{y()}),(s,o)=>{var $,A,C,i,t;return a(),r("div",Ht,[e("div",Rt,[o[2]||(o[2]=e("div",{class:"sm:flex-auto"},[e("h1",{class:"text-2xl font-semibold text-gray-900"},"Usage Statistics"),e("p",{class:"mt-2 text-sm text-gray-700"},"View your API usage statistics and costs")],-1)),e("div",Ot,[F(e("select",{"onUpdate:modelValue":o[0]||(o[0]=d=>h.value=d),class:"block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 sm:text-sm",onChange:y},o[1]||(o[1]=[e("option",{value:"day"},"Last 24 Hours",-1),e("option",{value:"week"},"Last 7 Days",-1),e("option",{value:"month"},"Last 30 Days",-1),e("option",{value:"quarter"},"Last 90 Days",-1)]),544),[[G,h.value]])])]),f.value?(a(),r("div",Et,o[3]||(o[3]=[e("svg",{class:"mx-auto h-8 w-8 animate-spin text-blue-600",fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},[e("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"}),e("path",{class:"opacity-75",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z",fill:"currentColor"})],-1),e("p",{class:"mt-2 text-sm text-gray-500"},"Loading usage statistics...",-1)]))):(a(),r("div",Yt,[e("div",Wt,[e("div",Gt,[e("div",Qt,[o[5]||(o[5]=e("div",{class:"flex-shrink-0"},[e("svg",{class:"h-6 w-6 text-blue-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{d:"M13 10V3L4 14h7v7l9-11h-7z","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"})])],-1)),e("div",Jt,[e("dl",null,[o[4]||(o[4]=e("dt",{class:"truncate text-sm font-medium text-gray-500"},"Total Requests",-1)),e("dd",Xt,l(v((($=m.value)==null?void 0:$.totalRequests)||0)),1)])])])])]),e("div",Zt,[e("div",es,[e("div",ts,[o[7]||(o[7]=e("div",{class:"flex-shrink-0"},[e("svg",{class:"h-6 w-6 text-green-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{d:"M7 7h.01M7 3h5c.512 0 1.024.195 1.414.586l7 7a2 2 0 010 2.828l-7 7a2 2 0 01-2.828 0l-7-7A1.994 1.994 0 013 12V7a4 4 0 014-4z","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"})])],-1)),e("div",ss,[e("dl",null,[o[6]||(o[6]=e("dt",{class:"truncate text-sm font-medium text-gray-500"},"Input Tokens",-1)),e("dd",os,l(v(((A=m.value)==null?void 0:A.totalInputTokens)||0)),1)])])])])]),e("div",ls,[e("div",rs,[e("div",as,[o[9]||(o[9]=e("div",{class:"flex-shrink-0"},[e("svg",{class:"h-6 w-6 text-purple-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{d:"M7 7h.01M7 3h5c.512 0 1.024.195 1.414.586l7 7a2 2 0 010 2.828l-7 7a2 2 0 01-2.828 0l-7-7A1.994 1.994 0 013 12V7a4 4 0 014-4z","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"})])],-1)),e("div",ds,[e("dl",null,[o[8]||(o[8]=e("dt",{class:"truncate text-sm font-medium text-gray-500"},"Output Tokens",-1)),e("dd",is,l(v(((C=m.value)==null?void 0:C.totalOutputTokens)||0)),1)])])])])]),e("div",ns,[e("div",us,[e("div",cs,[o[11]||(o[11]=e("div",{class:"flex-shrink-0"},[e("svg",{class:"h-6 w-6 text-yellow-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{d:"M12 8c-1.657 0-3 .895-3 2s1.343 2 3 2 3 .895 3 2-1.343 2-3 2m0-8c1.11 0 2.08.402 2.599 1M12 8V7m0 1v8m0 0v1m0-1c-1.11 0-2.08-.402-2.599-1","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"})])],-1)),e("div",ms,[e("dl",null,[o[10]||(o[10]=e("dt",{class:"truncate text-sm font-medium text-gray-500"},"Total Cost",-1)),e("dd",xs," $"+l((((i=m.value)==null?void 0:i.totalCost)||0).toFixed(4)),1)])])])])])])),!f.value&&m.value?(a(),r("div",gs,o[12]||(o[12]=[Q('<div class="px-4 py-5 sm:p-6" data-v-9d260191><h3 class="mb-4 text-lg font-medium leading-6 text-gray-900" data-v-9d260191>Daily Usage Trend</h3><div class="flex h-64 items-center justify-center rounded-lg border-2 border-dashed border-gray-300" data-v-9d260191><div class="text-center" data-v-9d260191><svg class="mx-auto h-12 w-12 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24" data-v-9d260191><path d="M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" data-v-9d260191></path></svg><h3 class="mt-2 text-sm font-medium text-gray-900" data-v-9d260191>Usage Chart</h3><p class="mt-1 text-sm text-gray-500" data-v-9d260191>Daily usage trends would be displayed here</p><p class="mt-2 text-xs text-gray-400" data-v-9d260191> (Chart integration can be added with Chart.js, D3.js, or similar library) </p></div></div></div>',1)]))):p("",!0),!f.value&&m.value&&((t=m.value.modelStats)==null?void 0:t.length)>0?(a(),r("div",vs,[e("div",ys,[o[14]||(o[14]=e("h3",{class:"mb-4 text-lg font-medium leading-6 text-gray-900"},"Usage by Model",-1)),e("div",ps,[(a(!0),r(N,null,q(m.value.modelStats,d=>(a(),r("div",{key:d.name,class:"flex items-center justify-between"},[e("div",fs,[o[13]||(o[13]=e("div",{class:"flex-shrink-0"},[e("div",{class:"h-2 w-2 rounded-full bg-blue-500"})],-1)),e("div",hs,[e("p",ks,l(d.name),1)])]),e("div",ws,[e("p",bs,l(v(d.requests))+" requests",1),e("p",_s,"$"+l(d.cost.toFixed(4)),1)])]))),128))])])])):p("",!0),!f.value&&g.value.length>0?(a(),r("div",$s,[e("div",As,[o[16]||(o[16]=e("h3",{class:"mb-4 text-lg font-medium leading-6 text-gray-900"},"Usage by API Key",-1)),e("div",Cs,[e("table",Ms,[o[15]||(o[15]=e("thead",{class:"bg-gray-50"},[e("tr",null,[e("th",{class:"px-6 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500",scope:"col"}," API Key "),e("th",{class:"px-6 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500",scope:"col"}," Requests "),e("th",{class:"px-6 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500",scope:"col"}," Input Tokens "),e("th",{class:"px-6 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500",scope:"col"}," Output Tokens "),e("th",{class:"px-6 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500",scope:"col"}," Cost "),e("th",{class:"px-6 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500",scope:"col"}," Status ")])],-1)),e("tbody",Ds,[(a(!0),r(N,null,q(g.value,d=>{var k,I,P,u;return a(),r("tr",{key:d.id},[e("td",Is,[e("div",Ps,l(d.name),1),e("div",Us,l(d.keyPreview),1)]),e("td",js,l(v(((k=d.usage)==null?void 0:k.requests)||0)),1),e("td",Ks,l(v(((I=d.usage)==null?void 0:I.inputTokens)||0)),1),e("td",Ts,l(v(((P=d.usage)==null?void 0:P.outputTokens)||0)),1),e("td",Vs," $"+l((((u=d.usage)==null?void 0:u.totalCost)||0).toFixed(4)),1),e("td",Bs,[e("span",{class:M(["inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium",d.isDeleted==="true"||d.deletedAt?"bg-gray-100 text-gray-800":d.isActive?"bg-green-100 text-green-800":"bg-red-100 text-red-800"])},l(d.isDeleted==="true"||d.deletedAt?"Deleted":d.isActive?"Active":"Disabled"),3)])])}),128))])])])])])):p("",!0),!f.value&&(!m.value||m.value.totalRequests===0)?(a(),r("div",Ss,o[17]||(o[17]=[e("svg",{class:"mx-auto h-12 w-12 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{d:"M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"})],-1),e("h3",{class:"mt-2 text-sm font-medium text-gray-900"},"No usage data",-1),e("p",{class:"mt-1 text-sm text-gray-500"}," You haven't made any API requests yet. Create an API key and start using the service to see usage statistics. ",-1)]))):p("",!0)])}}},Ls=V(zs,[["__scopeId","data-v-9d260191"]]),Fs={class:"min-h-screen bg-gray-50 dark:bg-gray-900"},Ns={class:"bg-white shadow dark:bg-gray-800"},qs={class:"mx-auto max-w-7xl px-4 sm:px-6 lg:px-8"},Hs={class:"flex h-16 justify-between"},Rs={class:"flex items-center"},Os={class:"ml-10"},Es={class:"flex items-baseline space-x-4"},Ys={class:"flex items-center space-x-4"},Ws={class:"text-sm text-gray-700 dark:text-gray-300"},Gs={class:"font-medium"},Qs={class:"mx-auto max-w-7xl px-4 py-6 sm:px-6 lg:px-8"},Js={key:0,class:"space-y-6"},Xs={class:"grid grid-cols-1 gap-6 md:grid-cols-2 lg:grid-cols-5"},Zs={class:"overflow-hidden rounded-lg bg-white shadow dark:bg-gray-800"},eo={class:"p-5"},to={class:"flex items-center"},so={class:"ml-5 w-0 flex-1"},oo={class:"text-lg font-medium text-gray-900 dark:text-white"},lo={class:"overflow-hidden rounded-lg bg-white shadow dark:bg-gray-800"},ro={class:"p-5"},ao={class:"flex items-center"},io={class:"ml-5 w-0 flex-1"},no={class:"text-lg font-medium text-gray-900 dark:text-white"},uo={class:"overflow-hidden rounded-lg bg-white shadow dark:bg-gray-800"},co={class:"p-5"},mo={class:"flex items-center"},xo={class:"ml-5 w-0 flex-1"},go={class:"text-lg font-medium text-gray-900 dark:text-white"},vo={class:"overflow-hidden rounded-lg bg-white shadow dark:bg-gray-800"},yo={class:"p-5"},po={class:"flex items-center"},fo={class:"ml-5 w-0 flex-1"},ho={class:"text-lg font-medium text-gray-900 dark:text-white"},ko={class:"overflow-hidden rounded-lg bg-white shadow dark:bg-gray-800"},wo={class:"p-5"},bo={class:"flex items-center"},_o={class:"ml-5 w-0 flex-1"},$o={class:"text-lg font-medium text-gray-900 dark:text-white"},Ao={class:"rounded-lg bg-white shadow dark:bg-gray-800"},Co={class:"px-4 py-5 sm:p-6"},Mo={class:"mt-5 border-t border-gray-200 dark:border-gray-700"},Do={class:"divide-y divide-gray-200 dark:divide-gray-700"},Io={class:"py-4 sm:grid sm:grid-cols-3 sm:gap-4 sm:py-5"},Po={class:"mt-1 text-sm text-gray-900 dark:text-white sm:col-span-2 sm:mt-0"},Uo={class:"py-4 sm:grid sm:grid-cols-3 sm:gap-4 sm:py-5"},jo={class:"mt-1 text-sm text-gray-900 dark:text-white sm:col-span-2 sm:mt-0"},Ko={class:"py-4 sm:grid sm:grid-cols-3 sm:gap-4 sm:py-5"},To={class:"mt-1 text-sm text-gray-900 dark:text-white sm:col-span-2 sm:mt-0"},Vo={class:"py-4 sm:grid sm:grid-cols-3 sm:gap-4 sm:py-5"},Bo={class:"mt-1 text-sm text-gray-900 dark:text-white sm:col-span-2 sm:mt-0"},So={class:"inline-flex items-center rounded-full bg-blue-100 px-2.5 py-0.5 text-xs font-medium text-blue-800 dark:bg-blue-900 dark:text-blue-200"},zo={class:"py-4 sm:grid sm:grid-cols-3 sm:gap-4 sm:py-5"},Lo={class:"mt-1 text-sm text-gray-900 dark:text-white sm:col-span-2 sm:mt-0"},Fo={class:"py-4 sm:grid sm:grid-cols-3 sm:gap-4 sm:py-5"},No={class:"mt-1 text-sm text-gray-900 dark:text-white sm:col-span-2 sm:mt-0"},qo={key:1},Ho={key:2},Ro={key:3,class:"space-y-6"},Oo={__name:"UserDashboardView",setup(x){const b=X(),f=z(),h=Z(),m=w("overview"),g=w(null),v=w({active:0,deleted:0}),y=i=>i>=1e6?(i/1e6).toFixed(1)+"M":i>=1e3?(i/1e3).toFixed(1)+"K":i.toString(),s=i=>i?new Date(i).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):null,o=i=>{m.value=i,i==="overview"&&C()},$=async()=>{try{await f.logout(),_("Logged out successfully","success"),b.push("/user-login")}catch{_("Logout failed","error")}},A=async()=>{try{g.value=await f.getUserProfile()}catch(i){console.error("Failed to load user profile:",i),_("Failed to load user profile","error")}},C=async()=>{try{const i=await f.getUserApiKeys(!0);console.log("All API Keys received:",i);const t=i.filter(k=>!(k.isDeleted==="true"||k.deletedAt)&&k.isActive),d=i.filter(k=>k.isDeleted==="true"||k.deletedAt);console.log("Active keys:",t),console.log("Deleted keys:",d),console.log("Active count:",t.length),console.log("Deleted count:",d.length),v.value={active:t.length,deleted:d.length}}catch(i){console.error("Failed to load API keys stats:",i),v.value={active:0,deleted:0}}};return H(()=>{h.initTheme(),A(),C()}),(i,t)=>{var d,k,I,P,u,c,U,n,K,T,B,R;return a(),r("div",Fs,[e("nav",Ns,[e("div",qs,[e("div",Hs,[e("div",Rs,[t[4]||(t[4]=e("div",{class:"flex flex-shrink-0 items-center"},[e("svg",{class:"h-8 w-8 text-blue-600 dark:text-blue-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"})]),e("span",{class:"ml-2 text-xl font-bold text-gray-900 dark:text-white"},"Claude Relay")],-1)),e("div",Os,[e("div",Es,[e("button",{class:M(["rounded-md px-3 py-2 text-sm font-medium",m.value==="overview"?"bg-blue-100 text-blue-700 dark:bg-blue-900 dark:text-blue-300":"text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-300"]),onClick:t[0]||(t[0]=L=>o("overview"))}," Overview ",2),e("button",{class:M(["rounded-md px-3 py-2 text-sm font-medium",m.value==="api-keys"?"bg-blue-100 text-blue-700 dark:bg-blue-900 dark:text-blue-300":"text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-300"]),onClick:t[1]||(t[1]=L=>o("api-keys"))}," API Keys ",2),e("button",{class:M(["rounded-md px-3 py-2 text-sm font-medium",m.value==="usage"?"bg-blue-100 text-blue-700 dark:bg-blue-900 dark:text-blue-300":"text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-300"]),onClick:t[2]||(t[2]=L=>o("usage"))}," Usage Stats ",2),e("button",{class:M(["rounded-md px-3 py-2 text-sm font-medium",m.value==="tutorial"?"bg-blue-100 text-blue-700 dark:bg-blue-900 dark:text-blue-300":"text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-300"]),onClick:t[3]||(t[3]=L=>o("tutorial"))}," Tutorial ",2)])])]),e("div",Ys,[e("div",Ws,[t[5]||(t[5]=D(" Welcome, ",-1)),e("span",Gs,l(J(f).userName),1)]),j(ee,{mode:"icon"}),e("button",{class:"rounded-md px-3 py-2 text-sm font-medium text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-300",onClick:$}," Logout ")])])])]),e("main",Qs,[m.value==="overview"?(a(),r("div",Js,[t[23]||(t[23]=e("div",null,[e("h1",{class:"text-2xl font-semibold text-gray-900 dark:text-white"},"Dashboard Overview"),e("p",{class:"mt-2 text-sm text-gray-600 dark:text-gray-400"}," Welcome to your Claude Relay dashboard ")],-1)),e("div",Xs,[e("div",Zs,[e("div",eo,[e("div",to,[t[7]||(t[7]=e("div",{class:"flex-shrink-0"},[e("svg",{class:"h-6 w-6 text-green-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{d:"M15 7a2 2 0 012 2m0 0a2 2 0 012 2m-2-2h-6m6 0v6a2 2 0 01-2 2H9a2 2 0 01-2-2V9a2 2 0 012-2h6z","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"})])],-1)),e("div",so,[e("dl",null,[t[6]||(t[6]=e("dt",{class:"truncate text-sm font-medium text-gray-500 dark:text-gray-400"}," Active API Keys ",-1)),e("dd",oo,l(v.value.active),1)])])])])]),e("div",lo,[e("div",ro,[e("div",ao,[t[9]||(t[9]=e("div",{class:"flex-shrink-0"},[e("svg",{class:"h-6 w-6 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"})])],-1)),e("div",io,[e("dl",null,[t[8]||(t[8]=e("dt",{class:"truncate text-sm font-medium text-gray-500 dark:text-gray-400"}," Deleted API Keys ",-1)),e("dd",no,l(v.value.deleted),1)])])])])]),e("div",uo,[e("div",co,[e("div",mo,[t[11]||(t[11]=e("div",{class:"flex-shrink-0"},[e("svg",{class:"h-6 w-6 text-blue-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{d:"M13 10V3L4 14h7v7l9-11h-7z","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"})])],-1)),e("div",xo,[e("dl",null,[t[10]||(t[10]=e("dt",{class:"truncate text-sm font-medium text-gray-500 dark:text-gray-400"}," Total Requests ",-1)),e("dd",go,l(y(((k=(d=g.value)==null?void 0:d.totalUsage)==null?void 0:k.requests)||0)),1)])])])])]),e("div",vo,[e("div",yo,[e("div",po,[t[13]||(t[13]=e("div",{class:"flex-shrink-0"},[e("svg",{class:"h-6 w-6 text-purple-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{d:"M7 7h.01M7 3h5c.512 0 1.024.195 1.414.586l7 7a2 2 0 010 2.828l-7 7a2 2 0 01-2.828 0l-7-7A1.994 1.994 0 013 12V7a4 4 0 014-4z","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"})])],-1)),e("div",fo,[e("dl",null,[t[12]||(t[12]=e("dt",{class:"truncate text-sm font-medium text-gray-500 dark:text-gray-400"}," Input Tokens ",-1)),e("dd",ho,l(y(((P=(I=g.value)==null?void 0:I.totalUsage)==null?void 0:P.inputTokens)||0)),1)])])])])]),e("div",ko,[e("div",wo,[e("div",bo,[t[15]||(t[15]=e("div",{class:"flex-shrink-0"},[e("svg",{class:"h-6 w-6 text-yellow-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{d:"M12 8c-1.657 0-3 .895-3 2s1.343 2 3 2 3 .895 3 2-1.343 2-3 2m0-8c1.11 0 2.08.402 2.599 1M12 8V7m0 1v8m0 0v1m0-1c-1.11 0-2.08-.402-2.599-1","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"})])],-1)),e("div",_o,[e("dl",null,[t[14]||(t[14]=e("dt",{class:"truncate text-sm font-medium text-gray-500 dark:text-gray-400"}," Total Cost ",-1)),e("dd",$o," $"+l((((c=(u=g.value)==null?void 0:u.totalUsage)==null?void 0:c.totalCost)||0).toFixed(4)),1)])])])])])]),e("div",Ao,[e("div",Co,[t[22]||(t[22]=e("h3",{class:"text-lg font-medium leading-6 text-gray-900 dark:text-white"}," Account Information ",-1)),e("div",Mo,[e("dl",Do,[e("div",Io,[t[16]||(t[16]=e("dt",{class:"text-sm font-medium text-gray-500 dark:text-gray-400"},"Username",-1)),e("dd",Po,l((U=g.value)==null?void 0:U.username),1)]),e("div",Uo,[t[17]||(t[17]=e("dt",{class:"text-sm font-medium text-gray-500 dark:text-gray-400"},"Display Name",-1)),e("dd",jo,l(((n=g.value)==null?void 0:n.displayName)||"N/A"),1)]),e("div",Ko,[t[18]||(t[18]=e("dt",{class:"text-sm font-medium text-gray-500 dark:text-gray-400"},"Email",-1)),e("dd",To,l(((K=g.value)==null?void 0:K.email)||"N/A"),1)]),e("div",Vo,[t[19]||(t[19]=e("dt",{class:"text-sm font-medium text-gray-500 dark:text-gray-400"},"Role",-1)),e("dd",Bo,[e("span",So,l(((T=g.value)==null?void 0:T.role)||"user"),1)])]),e("div",zo,[t[20]||(t[20]=e("dt",{class:"text-sm font-medium text-gray-500 dark:text-gray-400"},"Member Since",-1)),e("dd",Lo,l(s((B=g.value)==null?void 0:B.createdAt)),1)]),e("div",Fo,[t[21]||(t[21]=e("dt",{class:"text-sm font-medium text-gray-500 dark:text-gray-400"},"Last Login",-1)),e("dd",No,l(s((R=g.value)==null?void 0:R.lastLoginAt)||"N/A"),1)])])])])])])):m.value==="api-keys"?(a(),r("div",qo,[j(qt)])):m.value==="usage"?(a(),r("div",Ho,[j(Ls)])):m.value==="tutorial"?(a(),r("div",Ro,[j(se)])):p("",!0)])])}}},Zo=V(Oo,[["__scopeId","data-v-7da5e7f6"]]);export{Zo as default};