Files
claude-relay-service/web/admin-spa/dist/assets/UserDashboardView-CxHhaP6a.js
2026-01-22 13:58:01 +00:00

2 lines
41 KiB
JavaScript

import{r as b,_ as E,o as Y,x as a,L as y,y as d,z as e,Y as W,K as F,aq as O,P as r,O as j,C as I,u as v,c as K,q as H,R as B,Q as N,ac as q,aV as G,aT as Q,aU as J}from"./vue-vendor-DV7DYXbz.js";import{b as L,s as C,f as A,c as D,a as X}from"./index-BahP9Xx9.js";import{T as Z}from"./ThemeToggle-DROshBR1.js";import{C as ee}from"./ConfirmModal-C2rCOkXI.js";import{T as te}from"./TutorialView-Cpvhof5r.js";import"./element-plus-BSjV1f9S.js";import"./vendor-Dr8jvgFu.js";const se={key:0,class:"fixed inset-0 z-50 h-full w-full overflow-y-auto bg-gray-600 bg-opacity-50"},oe={class:"relative top-20 mx-auto w-[768px] max-w-4xl rounded-md border bg-white p-5 shadow-lg"},le={class:"mt-3"},re={class:"mb-4 flex items-center justify-between"},ae=["disabled"],de=["disabled"],ie={key:0,class:"rounded-md border border-red-200 bg-red-50 p-3"},ne={class:"flex"},ue={class:"ml-3"},ce={class:"text-sm text-red-700"},me={class:"flex justify-end space-x-3 pt-4"},xe=["disabled"],ge=["disabled"],ve={key:0,class:"flex items-center"},ye={key:1},pe={key:0,class:"mt-6 rounded-md border border-green-200 bg-green-50 p-4"},fe={class:"flex items-start"},he={class:"ml-3 flex-1"},ke={class:"mt-3"},we={class:"rounded-md border border-green-300 bg-white p-3"},be={class:"flex items-center justify-between"},_e={class:"break-all font-mono text-sm text-gray-900"},$e={__name:"CreateApiKeyModal",props:{show:{type:Boolean,default:!1}},emits:["close","created"],setup(u,{emit:$}){const p=u,w=$,c=L(),m=b(!1),s=b(""),g=b(null),l=E({name:"",description:""}),_=()=>{l.name="",l.description="",s.value="",g.value=null},P=async()=>{var f,t;if(!l.name.trim()){s.value="API key name is required";return}m.value=!0,s.value="";try{const k={name:l.name.trim(),description:l.description.trim()||void 0},M=await c.createApiKey(k);M.success?(g.value=M.apiKey,C("API key created successfully!","success")):s.value=M.message||"Failed to create API key"}catch(k){console.error("Create API key error:",k),s.value=((t=(f=k.response)==null?void 0:f.data)==null?void 0:t.message)||k.message||"Failed to create API key"}finally{m.value=!1}},h=async f=>{try{await navigator.clipboard.writeText(f),C("API key copied to clipboard!","success")}catch(t){console.error("Failed to copy:",t),C("Failed to copy to clipboard","error")}},o=()=>{_(),w("created"),w("close")};return Y(()=>p.show,f=>{f&&_()}),(f,t)=>u.show?(d(),a("div",se,[e("div",oe,[e("div",le,[e("div",re,[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]=k=>f.$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(P,["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]=k=>l.name=k),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:m.value,placeholder:"Enter API key name",required:"",type:"text"},null,8,ae),[[O,l.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]=k=>l.description=k),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:m.value,placeholder:"Optional description",rows:"3"},null,8,de),[[O,l.description]])]),s.value?(d(),a("div",ie,[e("div",ne,[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",ue,[e("p",ce,r(s.value),1)])])])):y("",!0),e("div",me,[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:m.value,type:"button",onClick:t[3]||(t[3]=k=>f.$emit("close"))}," Cancel ",8,xe),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:m.value||!l.name.trim(),type:"submit"},[m.value?(d(),a("span",ve,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),j(" Creating... ",-1)]))):(d(),a("span",ye,"Create API Key"))],8,ge)])],32),g.value?(d(),a("div",pe,[e("div",fe,[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",he,[t[13]||(t[13]=e("h4",{class:"text-sm font-medium text-green-800"},"API Key Created Successfully!",-1)),e("div",ke,[t[12]||(t[12]=e("p",{class:"mb-2 text-sm text-green-700"},[e("strong",null,"Important:"),j(" Copy your API key now. You won't be able to see it again! ")],-1)),e("div",we,[e("div",be,[e("code",_e,r(g.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]=k=>h(g.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),j(" 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:o}," Done ")])])])])):y("",!0)])])])):y("",!0)}},Ae={key:0,class:"fixed inset-0 z-50 h-full w-full overflow-y-auto bg-gray-600 bg-opacity-50"},Ce={class:"relative top-20 mx-auto w-[768px] max-w-4xl rounded-md border bg-white p-5 shadow-lg"},Me={class:"mt-3"},Pe={class:"mb-4 flex items-center justify-between"},De={key:0,class:"space-y-4"},Ie={class:"mt-1 text-sm text-gray-900"},je={key:0},Te={class:"mt-1 text-sm text-gray-900"},Be={class:"mt-1 flex items-center space-x-2"},Ue={class:"flex-1"},Ve={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"},Ke={key:1,class:"rounded-md border border-gray-300 bg-gray-50 p-3"},Le={class:"font-mono text-sm text-gray-900"},Se={class:"flex flex-col space-y-1"},Fe={key:0,class:"mr-1 h-3 w-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Ne={key:1,class:"mr-1 h-3 w-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},qe={key:0,class:"mt-1 text-xs text-gray-500"},He={class:"mt-1"},Re={key:1,class:"border-t border-gray-200 pt-4"},Oe={class:"grid grid-cols-2 gap-4 text-sm"},Ee={class:"ml-2 font-medium"},Ye={class:"ml-2 font-medium"},We={class:"ml-2 font-medium"},Ge={class:"ml-2 font-medium"},Qe={class:"space-y-2 border-t border-gray-200 pt-4 text-sm"},Je={class:"flex justify-between"},Xe={class:"text-gray-900"},Ze={key:0,class:"flex justify-between"},et={class:"text-gray-900"},tt={key:1,class:"flex justify-between"},st={class:"flex justify-end pt-4"},ot={__name:"ViewApiKeyModal",props:{show:{type:Boolean,default:!1},apiKey:{type:Object,default:null}},emits:["close"],setup(u,{emit:$}){const p=$,w=b(!1),c=async m=>{try{await navigator.clipboard.writeText(m),C("Copied to clipboard!","success")}catch(s){console.error("Failed to copy:",s),C("Failed to copy to clipboard","error")}};return(m,s)=>u.show?(d(),a("div",Ae,[e("div",Ce,[e("div",Me,[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]=g=>p("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)]))]),u.apiKey?(d(),a("div",De,[e("div",null,[s[6]||(s[6]=e("label",{class:"block text-sm font-medium text-gray-700"},"Name",-1)),e("p",Ie,r(u.apiKey.name),1)]),u.apiKey.description?(d(),a("div",je,[s[7]||(s[7]=e("label",{class:"block text-sm font-medium text-gray-700"},"Description",-1)),e("p",Te,r(u.apiKey.description),1)])):y("",!0),e("div",null,[s[11]||(s[11]=e("label",{class:"block text-sm font-medium text-gray-700"},"API Key",-1)),e("div",Be,[e("div",Ue,[w.value?(d(),a("div",Ve,[e("code",ze,r(u.apiKey.key||"Not available"),1)])):(d(),a("div",Ke,[e("code",Le,r(u.apiKey.keyPreview||"cr_****"),1)]))]),e("div",Se,[u.apiKey.key?(d(),a("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]=g=>w.value=!w.value)},[w.value?(d(),a("svg",Fe,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)]))):(d(),a("svg",Ne,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)]))),j(" "+r(w.value?"Hide":"Show"),1)])):y("",!0),w.value&&u.apiKey.key?(d(),a("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]=g=>c(u.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),j(" Copy ",-1)]))):y("",!0)])]),u.apiKey.key?y("",!0):(d(),a("p",qe," 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",He,[e("span",{class:I(["inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium",u.apiKey.isActive?"bg-green-100 text-green-800":"bg-red-100 text-red-800"])},r(u.apiKey.isActive?"Active":"Disabled"),3)])]),u.apiKey.usage?(d(),a("div",Re,[s[17]||(s[17]=e("label",{class:"mb-2 block text-sm font-medium text-gray-700"},"Usage Statistics",-1)),e("div",Oe,[e("div",null,[s[13]||(s[13]=e("span",{class:"text-gray-500"},"Requests:",-1)),e("span",Ee,r(v(A)(u.apiKey.usage.requests||0)),1)]),e("div",null,[s[14]||(s[14]=e("span",{class:"text-gray-500"},"Input Tokens:",-1)),e("span",Ye,r(v(A)(u.apiKey.usage.inputTokens||0)),1)]),e("div",null,[s[15]||(s[15]=e("span",{class:"text-gray-500"},"Output Tokens:",-1)),e("span",We,r(v(A)(u.apiKey.usage.outputTokens||0)),1)]),e("div",null,[s[16]||(s[16]=e("span",{class:"text-gray-500"},"Total Cost:",-1)),e("span",Ge,"$"+r((u.apiKey.usage.totalCost||0).toFixed(4)),1)])])])):y("",!0),e("div",Qe,[e("div",Je,[s[18]||(s[18]=e("span",{class:"text-gray-500"},"Created:",-1)),e("span",Xe,r(v(D)(u.apiKey.createdAt)),1)]),u.apiKey.lastUsedAt?(d(),a("div",Ze,[s[19]||(s[19]=e("span",{class:"text-gray-500"},"Last Used:",-1)),e("span",et,r(v(D)(u.apiKey.lastUsedAt)),1)])):y("",!0),u.apiKey.expiresAt?(d(),a("div",tt,[s[20]||(s[20]=e("span",{class:"text-gray-500"},"Expires:",-1)),e("span",{class:I(["font-medium",new Date(u.apiKey.expiresAt)<new Date?"text-red-600":"text-gray-900"])},r(v(D)(u.apiKey.expiresAt)),3)])):y("",!0)]),e("div",st,[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]=g=>p("close"))}," Close ")])])):y("",!0)])])])):y("",!0)}},lt={class:"space-y-6"},rt={class:"sm:flex sm:items-center"},at={class:"mt-4 sm:ml-16 sm:mt-0 sm:flex-none"},dt=["disabled"],it={key:0,class:"rounded-md border border-yellow-200 bg-yellow-50 p-4"},nt={class:"flex"},ut={class:"ml-3"},ct={class:"text-sm text-yellow-700"},mt={key:1,class:"py-12 text-center"},xt={key:2,class:"overflow-hidden bg-white shadow sm:rounded-md"},gt={class:"divide-y divide-gray-200",role:"list"},vt={class:"flex items-center justify-between"},yt={class:"flex items-center"},pt={class:"flex-shrink-0"},ft={class:"ml-4"},ht={class:"flex items-center"},kt={class:"text-sm font-medium text-gray-900"},wt={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"},bt={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"},_t={class:"mt-1"},$t={class:"text-sm text-gray-500"},At={class:"mt-1 flex items-center space-x-4 text-xs text-gray-400"},Ct={key:0},Mt={key:1},Pt={key:2},Dt={key:3},It={class:"flex items-center space-x-2"},jt={class:"text-right text-xs text-gray-500"},Tt={key:0},Bt={class:"flex items-center space-x-1"},Ut=["onClick"],Vt=["onClick"],zt={key:3,class:"py-12 text-center"},Kt={class:"mt-6"},Lt={__name:"UserApiKeysManager",setup(u){const $=L(),p=b(!0),w=b([]),c=K(()=>{var x;return((x=$.config)==null?void 0:x.maxApiKeysPerUser)||5}),m=K(()=>{var x;return((x=$.config)==null?void 0:x.allowUserDeleteApiKeys)===!0}),s=b(!1),g=b(!1),l=b(!1),_=b(null),P=K(()=>[...w.value].sort((x,i)=>{const T=new Date(x.createdAt);return new Date(i.createdAt)-T})),h=K(()=>w.value.filter(x=>!(x.isDeleted==="true"||x.deletedAt)).length),o=async()=>{p.value=!0;try{w.value=await $.getUserApiKeys(!0)}catch(x){console.error("Failed to load API keys:",x),C("Failed to load API keys","error")}finally{p.value=!1}},f=x=>{_.value=x,g.value=!0},t=x=>{_.value=x,l.value=!0},k=async()=>{try{(await $.deleteApiKey(_.value.id)).success&&(C("API key deleted successfully","success"),await o())}catch(x){console.error("Failed to delete API key:",x),C("Failed to delete API key","error")}finally{l.value=!1,_.value=null}},M=async()=>{s.value=!1,await o()};return H(()=>{o()}),(x,i)=>{var T;return d(),a("div",lt,[e("div",rt,[i[6]||(i[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",at,[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:h.value>=c.value,onClick:i[0]||(i[0]=n=>s.value=!0)},i[5]||(i[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),j(" Create API Key ",-1)]),8,dt)])]),h.value>=c.value?(d(),a("div",it,[e("div",nt,[i[7]||(i[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",ut,[e("p",ct," You have reached the maximum number of API keys ("+r(c.value)+"). Please delete an existing key to create a new one. ",1)])])])):y("",!0),p.value?(d(),a("div",mt,i[8]||(i[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)]))):P.value.length>0?(d(),a("div",xt,[e("ul",gt,[(d(!0),a(N,null,q(P.value,n=>{var U,V;return d(),a("li",{key:n.id,class:"px-6 py-4"},[e("div",vt,[e("div",yt,[e("div",pt,[e("div",{class:I(["h-2 w-2 rounded-full",n.isDeleted===!0||n.deletedAt?"bg-gray-400":n.isActive?"bg-green-400":"bg-red-400"])},null,2)]),e("div",ft,[e("div",ht,[e("p",kt,r(n.name),1),n.isDeleted===!0||n.deletedAt?(d(),a("span",wt," Deleted ")):n.isActive?y("",!0):(d(),a("span",bt," Deleted "))]),e("div",_t,[e("p",$t,r(n.description||"No description"),1),e("div",At,[e("span",null,"Created: "+r(v(D)(n.createdAt)),1),n.isDeleted==="true"||n.deletedAt?(d(),a("span",Ct,"Deleted: "+r(v(D)(n.deletedAt)),1)):n.lastUsedAt?(d(),a("span",Mt,"Last used: "+r(v(D)(n.lastUsedAt)),1)):(d(),a("span",Pt,"Never used")),n.expiresAt&&!(n.isDeleted==="true"||n.deletedAt)?(d(),a("span",Dt,"Expires: "+r(v(D)(n.expiresAt)),1)):y("",!0)])])])]),e("div",It,[e("div",jt,[e("div",null,r(v(A)(((U=n.usage)==null?void 0:U.requests)||0))+" requests",1),(V=n.usage)!=null&&V.totalCost?(d(),a("div",Tt,"$"+r(n.usage.totalCost.toFixed(4)),1)):y("",!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:z=>f(n)},i[9]||(i[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,Ut),!(n.isDeleted==="true"||n.deletedAt)&&n.isActive&&m.value?(d(),a("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:z=>t(n)},i[10]||(i[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,Vt)):y("",!0)])])])])}),128))])])):(d(),a("div",zt,[i[12]||(i[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)),i[13]||(i[13]=e("h3",{class:"mt-2 text-sm font-medium text-gray-900"},"No API keys",-1)),i[14]||(i[14]=e("p",{class:"mt-1 text-sm text-gray-500"},"Get started by creating your first API key.",-1)),e("div",Kt,[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:i[1]||(i[1]=n=>s.value=!0)},i[11]||(i[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),j(" Create API Key ",-1)]))])])),B($e,{show:s.value,onClose:i[2]||(i[2]=n=>s.value=!1),onCreated:M},null,8,["show"]),B(ot,{"api-key":_.value,show:g.value,onClose:i[3]||(i[3]=n=>g.value=!1)},null,8,["api-key","show"]),B(ee,{"confirm-class":"bg-red-600 hover:bg-red-700","confirm-text":"Delete",message:`Are you sure you want to delete '${(T=_.value)==null?void 0:T.name}'? This action cannot be undone.`,show:l.value,title:"Delete API Key",onCancel:i[4]||(i[4]=n=>l.value=!1),onConfirm:k},null,8,["message","show"])])}}},St={class:"space-y-6"},Ft={class:"sm:flex sm:items-center"},Nt={class:"mt-4 sm:ml-16 sm:mt-0 sm:flex-none"},qt={key:0,class:"py-12 text-center"},Ht={key:1,class:"grid grid-cols-1 gap-6 md:grid-cols-2 lg:grid-cols-4"},Rt={class:"overflow-hidden rounded-lg bg-white shadow"},Ot={class:"p-5"},Et={class:"flex items-center"},Yt={class:"ml-5 w-0 flex-1"},Wt={class:"text-lg font-medium text-gray-900"},Gt={class:"overflow-hidden rounded-lg bg-white shadow"},Qt={class:"p-5"},Jt={class:"flex items-center"},Xt={class:"ml-5 w-0 flex-1"},Zt={class:"text-lg font-medium text-gray-900"},es={class:"overflow-hidden rounded-lg bg-white shadow"},ts={class:"p-5"},ss={class:"flex items-center"},os={class:"ml-5 w-0 flex-1"},ls={class:"text-lg font-medium text-gray-900"},rs={class:"overflow-hidden rounded-lg bg-white shadow"},as={class:"p-5"},ds={class:"flex items-center"},is={class:"ml-5 w-0 flex-1"},ns={class:"text-lg font-medium text-gray-900"},us={key:2,class:"rounded-lg bg-white shadow"},cs={key:3,class:"rounded-lg bg-white shadow"},ms={class:"px-4 py-5 sm:p-6"},xs={class:"space-y-3"},gs={class:"flex items-center"},vs={class:"ml-3"},ys={class:"text-sm font-medium text-gray-900"},ps={class:"text-right"},fs={class:"text-sm text-gray-900"},hs={class:"text-xs text-gray-500"},ks={key:4,class:"rounded-lg bg-white shadow"},ws={class:"px-4 py-5 sm:p-6"},bs={class:"overflow-hidden"},_s={class:"min-w-full divide-y divide-gray-200"},$s={class:"divide-y divide-gray-200 bg-white"},As={class:"whitespace-nowrap px-6 py-4"},Cs={class:"text-sm font-medium text-gray-900"},Ms={class:"text-sm text-gray-500"},Ps={class:"whitespace-nowrap px-6 py-4 text-sm text-gray-900"},Ds={class:"whitespace-nowrap px-6 py-4 text-sm text-gray-900"},Is={class:"whitespace-nowrap px-6 py-4 text-sm text-gray-900"},js={class:"whitespace-nowrap px-6 py-4 text-sm text-gray-900"},Ts={class:"whitespace-nowrap px-6 py-4"},Bs={key:5,class:"py-12 text-center"},Us={__name:"UserUsageStats",setup(u){const $=L(),p=b(!0),w=b("week"),c=b(null),m=b([]),s=async()=>{p.value=!0;try{const[g,l]=await Promise.all([$.getUserUsageStats({period:w.value}),$.getUserApiKeys(!0)]);c.value=g,m.value=l}catch(g){console.error("Failed to load usage stats:",g),C("Failed to load usage statistics","error")}finally{p.value=!1}};return H(()=>{s()}),(g,l)=>{var _,P,h,o,f;return d(),a("div",St,[e("div",Ft,[l[2]||(l[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",Nt,[F(e("select",{"onUpdate:modelValue":l[0]||(l[0]=t=>w.value=t),class:"block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 sm:text-sm",onChange:s},l[1]||(l[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,w.value]])])]),p.value?(d(),a("div",qt,l[3]||(l[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)]))):(d(),a("div",Ht,[e("div",Rt,[e("div",Ot,[e("div",Et,[l[5]||(l[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",Yt,[e("dl",null,[l[4]||(l[4]=e("dt",{class:"truncate text-sm font-medium text-gray-500"},"Total Requests",-1)),e("dd",Wt,r(v(A)(((_=c.value)==null?void 0:_.totalRequests)||0)),1)])])])])]),e("div",Gt,[e("div",Qt,[e("div",Jt,[l[7]||(l[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",Xt,[e("dl",null,[l[6]||(l[6]=e("dt",{class:"truncate text-sm font-medium text-gray-500"},"Input Tokens",-1)),e("dd",Zt,r(v(A)(((P=c.value)==null?void 0:P.totalInputTokens)||0)),1)])])])])]),e("div",es,[e("div",ts,[e("div",ss,[l[9]||(l[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",os,[e("dl",null,[l[8]||(l[8]=e("dt",{class:"truncate text-sm font-medium text-gray-500"},"Output Tokens",-1)),e("dd",ls,r(v(A)(((h=c.value)==null?void 0:h.totalOutputTokens)||0)),1)])])])])]),e("div",rs,[e("div",as,[e("div",ds,[l[11]||(l[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",is,[e("dl",null,[l[10]||(l[10]=e("dt",{class:"truncate text-sm font-medium text-gray-500"},"Total Cost",-1)),e("dd",ns," $"+r((((o=c.value)==null?void 0:o.totalCost)||0).toFixed(4)),1)])])])])])])),!p.value&&c.value?(d(),a("div",us,l[12]||(l[12]=[Q('<div class="px-4 py-5 sm:p-6"><h3 class="mb-4 text-lg font-medium leading-6 text-gray-900">Daily Usage Trend</h3><div class="flex h-64 items-center justify-center rounded-lg border-2 border-dashed border-gray-300"><div class="text-center"><svg class="mx-auto h-12 w-12 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24"><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"></path></svg><h3 class="mt-2 text-sm font-medium text-gray-900">Usage Chart</h3><p class="mt-1 text-sm text-gray-500">Daily usage trends would be displayed here</p><p class="mt-2 text-xs text-gray-400"> (Chart integration can be added with Chart.js, D3.js, or similar library) </p></div></div></div>',1)]))):y("",!0),!p.value&&c.value&&((f=c.value.modelStats)==null?void 0:f.length)>0?(d(),a("div",cs,[e("div",ms,[l[14]||(l[14]=e("h3",{class:"mb-4 text-lg font-medium leading-6 text-gray-900"},"Usage by Model",-1)),e("div",xs,[(d(!0),a(N,null,q(c.value.modelStats,t=>(d(),a("div",{key:t.name,class:"flex items-center justify-between"},[e("div",gs,[l[13]||(l[13]=e("div",{class:"flex-shrink-0"},[e("div",{class:"h-2 w-2 rounded-full bg-blue-500"})],-1)),e("div",vs,[e("p",ys,r(t.name),1)])]),e("div",ps,[e("p",fs,r(v(A)(t.requests))+" requests",1),e("p",hs,"$"+r(t.cost.toFixed(4)),1)])]))),128))])])])):y("",!0),!p.value&&m.value.length>0?(d(),a("div",ks,[e("div",ws,[l[16]||(l[16]=e("h3",{class:"mb-4 text-lg font-medium leading-6 text-gray-900"},"Usage by API Key",-1)),e("div",bs,[e("table",_s,[l[15]||(l[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",$s,[(d(!0),a(N,null,q(m.value,t=>{var k,M,x,i;return d(),a("tr",{key:t.id},[e("td",As,[e("div",Cs,r(t.name),1),e("div",Ms,r(t.keyPreview),1)]),e("td",Ps,r(v(A)(((k=t.usage)==null?void 0:k.requests)||0)),1),e("td",Ds,r(v(A)(((M=t.usage)==null?void 0:M.inputTokens)||0)),1),e("td",Is,r(v(A)(((x=t.usage)==null?void 0:x.outputTokens)||0)),1),e("td",js," $"+r((((i=t.usage)==null?void 0:i.totalCost)||0).toFixed(4)),1),e("td",Ts,[e("span",{class:I(["inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium",t.isDeleted==="true"||t.deletedAt?"bg-gray-100 text-gray-800":t.isActive?"bg-green-100 text-green-800":"bg-red-100 text-red-800"])},r(t.isDeleted==="true"||t.deletedAt?"Deleted":t.isActive?"Active":"Disabled"),3)])])}),128))])])])])])):y("",!0),!p.value&&(!c.value||c.value.totalRequests===0)?(d(),a("div",Bs,l[17]||(l[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)]))):y("",!0)])}}},Vs={class:"min-h-screen bg-gray-50 dark:bg-gray-900"},zs={class:"bg-white shadow dark:bg-gray-800"},Ks={class:"mx-auto max-w-7xl px-4 sm:px-6 lg:px-8"},Ls={class:"flex h-16 justify-between"},Ss={class:"flex items-center"},Fs={class:"ml-10"},Ns={class:"flex items-baseline space-x-4"},qs={class:"flex items-center space-x-4"},Hs={class:"text-sm text-gray-700 dark:text-gray-300"},Rs={class:"font-medium"},Os={class:"mx-auto max-w-7xl px-4 py-6 sm:px-6 lg:px-8"},Es={key:0,class:"space-y-6"},Ys={class:"grid grid-cols-1 gap-6 md:grid-cols-2 lg:grid-cols-5"},Ws={class:"overflow-hidden rounded-lg bg-white shadow dark:bg-gray-800"},Gs={class:"p-5"},Qs={class:"flex items-center"},Js={class:"ml-5 w-0 flex-1"},Xs={class:"text-lg font-medium text-gray-900 dark:text-white"},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:"rounded-lg bg-white shadow dark:bg-gray-800"},wo={class:"px-4 py-5 sm:p-6"},bo={class:"mt-5 border-t border-gray-200 dark:border-gray-700"},_o={class:"divide-y divide-gray-200 dark:divide-gray-700"},$o={class:"py-4 sm:grid sm:grid-cols-3 sm:gap-4 sm:py-5"},Ao={class:"mt-1 text-sm text-gray-900 dark:text-white sm:col-span-2 sm:mt-0"},Co={class:"py-4 sm:grid sm:grid-cols-3 sm:gap-4 sm:py-5"},Mo={class:"mt-1 text-sm text-gray-900 dark:text-white sm:col-span-2 sm:mt-0"},Po={class:"py-4 sm:grid sm:grid-cols-3 sm:gap-4 sm:py-5"},Do={class:"mt-1 text-sm text-gray-900 dark:text-white sm:col-span-2 sm:mt-0"},Io={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"},To={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"},Bo={class:"py-4 sm:grid sm:grid-cols-3 sm:gap-4 sm:py-5"},Uo={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"},zo={class:"mt-1 text-sm text-gray-900 dark:text-white sm:col-span-2 sm:mt-0"},Ko={key:1},Lo={key:2},So={key:3,class:"space-y-6"},Yo={__name:"UserDashboardView",setup(u){const $=J(),p=L(),w=X(),c=b("overview"),m=b(null),s=b({active:0,deleted:0}),g=h=>{c.value=h,h==="overview"&&P()},l=async()=>{try{await p.logout(),C("Logged out successfully","success"),$.push("/user-login")}catch{C("Logout failed","error")}},_=async()=>{try{m.value=await p.getUserProfile()}catch(h){console.error("Failed to load user profile:",h),C("Failed to load user profile","error")}},P=async()=>{try{const h=await p.getUserApiKeys(!0);console.log("All API Keys received:",h);const o=h.filter(t=>!(t.isDeleted==="true"||t.deletedAt)&&t.isActive),f=h.filter(t=>t.isDeleted==="true"||t.deletedAt);console.log("Active keys:",o),console.log("Deleted keys:",f),console.log("Active count:",o.length),console.log("Deleted count:",f.length),s.value={active:o.length,deleted:f.length}}catch(h){console.error("Failed to load API keys stats:",h),s.value={active:0,deleted:0}}};return H(()=>{w.initTheme(),_(),P()}),(h,o)=>{var f,t,k,M,x,i,T,n,U,V,z,R;return d(),a("div",Vs,[e("nav",zs,[e("div",Ks,[e("div",Ls,[e("div",Ss,[o[4]||(o[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",Fs,[e("div",Ns,[e("button",{class:I(["rounded-md px-3 py-2 text-sm font-medium",c.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:o[0]||(o[0]=S=>g("overview"))}," Overview ",2),e("button",{class:I(["rounded-md px-3 py-2 text-sm font-medium",c.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:o[1]||(o[1]=S=>g("api-keys"))}," API Keys ",2),e("button",{class:I(["rounded-md px-3 py-2 text-sm font-medium",c.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:o[2]||(o[2]=S=>g("usage"))}," Usage Stats ",2),e("button",{class:I(["rounded-md px-3 py-2 text-sm font-medium",c.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:o[3]||(o[3]=S=>g("tutorial"))}," Tutorial ",2)])])]),e("div",qs,[e("div",Hs,[o[5]||(o[5]=j(" Welcome, ",-1)),e("span",Rs,r(v(p).userName),1)]),B(Z,{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:l}," Logout ")])])])]),e("main",Os,[c.value==="overview"?(d(),a("div",Es,[o[23]||(o[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",Ys,[e("div",Ws,[e("div",Gs,[e("div",Qs,[o[7]||(o[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",Js,[e("dl",null,[o[6]||(o[6]=e("dt",{class:"truncate text-sm font-medium text-gray-500 dark:text-gray-400"}," Active API Keys ",-1)),e("dd",Xs,r(s.value.active),1)])])])])]),e("div",Zs,[e("div",eo,[e("div",to,[o[9]||(o[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",so,[e("dl",null,[o[8]||(o[8]=e("dt",{class:"truncate text-sm font-medium text-gray-500 dark:text-gray-400"}," Deleted API Keys ",-1)),e("dd",oo,r(s.value.deleted),1)])])])])]),e("div",lo,[e("div",ro,[e("div",ao,[o[11]||(o[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",io,[e("dl",null,[o[10]||(o[10]=e("dt",{class:"truncate text-sm font-medium text-gray-500 dark:text-gray-400"}," Total Requests ",-1)),e("dd",no,r(v(A)(((t=(f=m.value)==null?void 0:f.totalUsage)==null?void 0:t.requests)||0)),1)])])])])]),e("div",uo,[e("div",co,[e("div",mo,[o[13]||(o[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",xo,[e("dl",null,[o[12]||(o[12]=e("dt",{class:"truncate text-sm font-medium text-gray-500 dark:text-gray-400"}," Input Tokens ",-1)),e("dd",go,r(v(A)(((M=(k=m.value)==null?void 0:k.totalUsage)==null?void 0:M.inputTokens)||0)),1)])])])])]),e("div",vo,[e("div",yo,[e("div",po,[o[15]||(o[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",fo,[e("dl",null,[o[14]||(o[14]=e("dt",{class:"truncate text-sm font-medium text-gray-500 dark:text-gray-400"}," Total Cost ",-1)),e("dd",ho," $"+r((((i=(x=m.value)==null?void 0:x.totalUsage)==null?void 0:i.totalCost)||0).toFixed(4)),1)])])])])])]),e("div",ko,[e("div",wo,[o[22]||(o[22]=e("h3",{class:"text-lg font-medium leading-6 text-gray-900 dark:text-white"}," Account Information ",-1)),e("div",bo,[e("dl",_o,[e("div",$o,[o[16]||(o[16]=e("dt",{class:"text-sm font-medium text-gray-500 dark:text-gray-400"},"Username",-1)),e("dd",Ao,r((T=m.value)==null?void 0:T.username),1)]),e("div",Co,[o[17]||(o[17]=e("dt",{class:"text-sm font-medium text-gray-500 dark:text-gray-400"},"Display Name",-1)),e("dd",Mo,r(((n=m.value)==null?void 0:n.displayName)||"N/A"),1)]),e("div",Po,[o[18]||(o[18]=e("dt",{class:"text-sm font-medium text-gray-500 dark:text-gray-400"},"Email",-1)),e("dd",Do,r(((U=m.value)==null?void 0:U.email)||"N/A"),1)]),e("div",Io,[o[19]||(o[19]=e("dt",{class:"text-sm font-medium text-gray-500 dark:text-gray-400"},"Role",-1)),e("dd",jo,[e("span",To,r(((V=m.value)==null?void 0:V.role)||"user"),1)])]),e("div",Bo,[o[20]||(o[20]=e("dt",{class:"text-sm font-medium text-gray-500 dark:text-gray-400"},"Member Since",-1)),e("dd",Uo,r(v(D)((z=m.value)==null?void 0:z.createdAt)),1)]),e("div",Vo,[o[21]||(o[21]=e("dt",{class:"text-sm font-medium text-gray-500 dark:text-gray-400"},"Last Login",-1)),e("dd",zo,r(v(D)((R=m.value)==null?void 0:R.lastLoginAt)||"N/A"),1)])])])])])])):c.value==="api-keys"?(d(),a("div",Ko,[B(Lt)])):c.value==="usage"?(d(),a("div",Lo,[B(Us)])):c.value==="tutorial"?(d(),a("div",So,[B(te)])):y("",!0)])])}}};export{Yo as default};