import{a as l,j as e,c as z}from"./vendor-react-BHG7lGYR.js";import{l as b,B as c,i as j,g as D,d as u}from"./index-BWcMVITa.js";import{V as F}from"./vendor-IYr-MHu4.js";import{A as L,a9 as $,b8 as S,X as M,l as U,C as G,i as C,Z as O,b9 as B,b6 as V,aa as K,_ as R,ba as E,aR as H,T as W,ag as X,bb as Y,bc as Z}from"./vendor-icons-DaGlTw4_.js";import{I as q}from"./input-BGBI2Wze.js";import"./vendor-router-D-s5vIeO.js";import"./vendor-tanstack-BzWBL1hV.js";import"./vendor-utils-CgOSfOkx.js";function J({specUrl:a,spec:i,useIframe:h=!1}){const d=l.useRef(null),p=l.useRef(null),[m,g]=l.useState(null),n=()=>{if(a)return a;const x=(j.API_URL.startsWith("http")?j.API_URL:`${window.location.origin}${j.API_URL}`).replace(/\/api\/v1$/,"");return h?`${x}/swagger/index.html`:`${x}/swagger/doc.json`},w=()=>`${(j.API_URL.startsWith("http")?j.API_URL:`${window.location.origin}${j.API_URL}`).replace(/\/api\/v1$/,"")}/swagger/index.html`;l.useEffect(()=>{d.current&&b.debug("Swagger UI initialized",{specUrl:a||n(),hasSpec:!!i,useIframe:h})},[a,i,h]);const y={url:i?void 0:n(),spec:i,deepLinking:!0,displayOperationId:!1,defaultModelsExpandDepth:1,defaultModelExpandDepth:1,docExpansion:"list",filter:!0,showExtensions:!0,showCommonExtensions:!0,tryItOutEnabled:!0,supportedSubmitMethods:["get","post","put","delete","patch"],requestInterceptor:r=>{const x=localStorage.getItem("access_token");x&&r.headers&&(r.headers.Authorization=`Bearer ${x}`);const v=localStorage.getItem("csrf_token");return v&&r.headers&&(r.headers["X-CSRF-Token"]=v),r},onComplete:()=>{g(null),b.debug("Swagger UI loaded successfully",{url:n()})},onFailure:r=>{g(r.message||"Failed to load Swagger documentation"),b.error("Failed to load Swagger UI",{error:r.message,stack:r.stack,url:n()})}},f=()=>{g(null),window.location.reload()};if(h)return e.jsx("div",{ref:d,className:"swagger-ui-container",style:{height:"100%",minHeight:"600px"},children:e.jsx("iframe",{ref:p,src:w(),className:"w-full h-full border-0 rounded-lg",style:{minHeight:"600px"},title:"Swagger UI Documentation",onLoad:()=>{b.debug("Swagger UI iframe loaded successfully"),g(null)},onError:()=>{g("Failed to load Swagger UI in iframe"),b.error("Failed to load Swagger UI iframe")}})});if(m){const r=w();return e.jsxs("div",{className:"flex flex-col items-center justify-center p-12 min-h-[600px]",children:[e.jsx(L,{className:"w-16 h-16 text-kodo-red mb-4"}),e.jsx("h3",{className:"text-xl font-bold text-white mb-2",children:"Failed to Load API Documentation"}),e.jsx("p",{className:"text-sm text-kodo-secondary mb-4 text-center max-w-md",children:m}),e.jsxs("p",{className:"text-xs text-kodo-content-dim mb-6 text-center max-w-md",children:["Trying to load from: ",n(),e.jsx("br",{}),e.jsx("span",{className:"text-kodo-steel",children:"The Swagger JSON endpoint may not be available. Try opening Swagger UI directly."})]}),e.jsxs("div",{className:"flex gap-4",children:[e.jsxs(c,{onClick:f,variant:"default",children:[e.jsx($,{className:"w-4 h-4 mr-2"}),"Retry"]}),e.jsx(c,{onClick:()=>window.open(r,"_blank"),variant:"outline",children:"Open Swagger UI"}),e.jsx(c,{onClick:()=>{window.location.reload()},variant:"outline",children:"Use Iframe Mode"})]})]})}return e.jsxs("div",{ref:d,className:"swagger-ui-container",style:{height:"100%",minHeight:"600px"},children:[e.jsx("style",{children:` .swagger-ui-container .swagger-ui { background: transparent; } .swagger-ui-container .swagger-ui .topbar { display: none; } .swagger-ui-container .swagger-ui .info { margin: 20px 0; } .swagger-ui-container .swagger-ui .info .title { color: #fff; } .swagger-ui-container .swagger-ui .scheme-container { background: rgba(255, 255, 255, 0.05); padding: 10px; border-radius: 8px; margin: 20px 0; } .swagger-ui-container .swagger-ui .opblock { background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 8px; margin: 10px 0; } .swagger-ui-container .swagger-ui .opblock.opblock-post { border-color: rgba(102, 252, 241, 0.3); } .swagger-ui-container .swagger-ui .opblock.opblock-get { border-color: rgba(102, 252, 241, 0.3); } .swagger-ui-container .swagger-ui .opblock.opblock-put { border-color: rgba(255, 193, 7, 0.3); } .swagger-ui-container .swagger-ui .opblock.opblock-delete { border-color: rgba(244, 67, 54, 0.3); } .swagger-ui-container .swagger-ui .opblock .opblock-summary { color: #fff; } .swagger-ui-container .swagger-ui .opblock .opblock-description-wrapper { color: rgba(255, 255, 255, 0.8); } .swagger-ui-container .swagger-ui .parameter__name { color: #66fcf1; } .swagger-ui-container .swagger-ui .response-col_status { color: #fff; } .swagger-ui-container .swagger-ui .response-col_description { color: rgba(255, 255, 255, 0.8); } .swagger-ui-container .swagger-ui input, .swagger-ui-container .swagger-ui select, .swagger-ui-container .swagger-ui textarea { background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.2); color: #fff; } .swagger-ui-container .swagger-ui .btn { background: #66fcf1; color: #000; border: none; } .swagger-ui-container .swagger-ui .btn:hover { background: #52e8e0; } .swagger-ui-container .swagger-ui .btn.execute { background: #66fcf1; color: #000; } .swagger-ui-container .swagger-ui .btn.cancel { background: rgba(255, 255, 255, 0.1); color: #fff; } `}),e.jsx(F,{...y})]})}const T=[{id:"k1",name:"Production App",prefix:"vz_8x92...",created:"Oct 10, 2023",lastUsed:"2 mins ago",status:"active",scopes:["read","write"]},{id:"k2",name:"Test Environment",prefix:"vz_9a21...",created:"Sep 15, 2023",lastUsed:"5 days ago",status:"active",scopes:["read"]}],I={listKeys:async()=>(await new Promise(a=>setTimeout(a,500)),T),createKey:async a=>{await new Promise(n=>setTimeout(n,800));const i=Math.random().toString(36).substr(2,8),h=Math.random().toString(36).substr(2,16),d=`vz_${i}_${h}`,p=`vz_${i}...`,g=new Date().toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return{id:`k-${Date.now()}`,name:a.name,prefix:p,created:g,lastUsed:"Never",status:"active",scopes:a.scopes,key:d}},revokeKey:async a=>(await new Promise(i=>setTimeout(i,400)),{success:!0}),getStats:async()=>(await new Promise(a=>setTimeout(a,400)),{requests_24h:145200,avg_latency:45,active_keys:T.length})},Q=[{id:"user.read",label:"Read User Data"},{id:"user.write",label:"Update User Profile"},{id:"tracks.read",label:"Read Tracks"},{id:"tracks.upload",label:"Upload Tracks"},{id:"sales.read",label:"Read Sales Data"}],ee=({onClose:a,onCreate:i})=>{const h=D(),[d,p]=l.useState(1),[m,g]=l.useState(""),[n,w]=l.useState(["user.read"]),[y,f]=l.useState(""),[r,x]=l.useState(!1),[v,k]=l.useState(!1);l.useEffect(()=>(k(!0),()=>k(!1)),[]);const _=o=>{w(s=>s.includes(o)?s.filter(t=>t!==o):[...s,o])},P=async o=>{if(o?.preventDefault(),o?.stopPropagation(),!m.trim()){h.error("Please enter a name for your API key");return}if(n.length===0){h.error("Please select at least one permission scope");return}x(!0);try{const s=await i({name:m.trim(),scopes:n});if(s.key)f(s.key);else{const t=`vz_${Math.random().toString(36).substr(2,8)}_${Math.random().toString(36).substr(2,16)}`;f(t)}p(2),x(!1)}catch(s){throw x(!1),s}},A=()=>{navigator.clipboard.writeText(y),h.success("API Key copied to clipboard")};return v?z.createPortal(e.jsxs("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center p-4",style:{zIndex:9999},children:[e.jsx("div",{className:"absolute inset-0 bg-kodo-void/90 backdrop-blur-md",onClick:d===1?a:void 0}),e.jsxs("div",{className:"relative w-full max-w-2xl bg-kodo-graphite border border-kodo-steel rounded-xl shadow-2xl animate-scaleIn overflow-hidden glass-hud flex flex-col max-h-[85vh]",children:[e.jsxs("div",{className:"p-6 border-b border-kodo-steel/50 flex justify-between items-center bg-white/5 flex-none z-10",children:[e.jsxs("h3",{className:"text-xl font-bold text-white flex items-center gap-3 font-display",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-kodo-gold/20 flex items-center justify-center border border-kodo-gold/30",children:e.jsx(S,{className:"w-5 h-5 text-kodo-gold"})}),d===1?"Create API Key":"API Key Generated"]}),e.jsx("button",{onClick:a,className:"p-2 hover:bg-white/10 rounded-lg transition-colors",children:e.jsx(M,{className:"w-5 h-5 text-kodo-content-dim hover:text-white"})})]}),e.jsx("div",{className:"p-8 overflow-y-auto custom-scrollbar flex-1 relative",children:d===1?e.jsxs("div",{className:"space-y-8",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-bold text-kodo-secondary uppercase tracking-wider mb-3",children:"Key Name"}),e.jsx(q,{placeholder:"e.g. Production Server, Mobile App",value:m,onChange:o=>g(o.target.value),autoFocus:!0,disabled:r,className:"bg-kodo-void/50 border-kodo-steel focus:border-kodo-cyan h-12 text-lg w-full"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-bold text-kodo-secondary uppercase tracking-wider mb-4",children:"Permissions (Scopes)"}),e.jsx("div",{className:"grid grid-cols-1 gap-3",children:Q.map(o=>e.jsxs("label",{className:u("flex items-center justify-between p-4 rounded-xl border cursor-pointer transition-all duration-200 group relative overflow-hidden",n.includes(o.id)?"bg-kodo-cyan/10 border-kodo-cyan/50 shadow-[0_0_15px_rgba(102,252,241,0.1)]":"bg-kodo-void/30 border-kodo-steel/50 hover:border-kodo-steel hover:bg-white/5"),children:[e.jsxs("div",{className:"flex items-center gap-4 z-10 relative",children:[e.jsx("div",{className:u("w-5 h-5 rounded border flex items-center justify-center transition-colors flex-none",n.includes(o.id)?"bg-kodo-cyan border-kodo-cyan":"border-kodo-steel group-hover:border-kodo-content-dim"),children:n.includes(o.id)&&e.jsx(U,{className:"w-3 h-3 text-black"})}),e.jsx("span",{className:u("text-sm font-medium transition-colors",n.includes(o.id)?"text-white":"text-kodo-content-dim group-hover:text-kodo-text-main"),children:o.label})]}),e.jsx("div",{className:"text-xs font-mono text-kodo-steel z-10 hidden sm:block opacity-60 relative",children:o.id}),e.jsx("input",{type:"checkbox",className:"hidden",checked:n.includes(o.id),onChange:()=>_(o.id)})]},o.id))})]})]}):e.jsxs("div",{className:"text-center space-y-8 py-4",children:[e.jsxs("div",{className:"relative w-20 h-20 mx-auto",children:[e.jsx("div",{className:"absolute inset-0 bg-kodo-lime/20 rounded-full animate-ping opacity-50"}),e.jsx("div",{className:"relative w-full h-full bg-gradient-to-br from-kodo-lime/20 to-kodo-cyan/20 rounded-full flex items-center justify-center border border-kodo-lime/30 shadow-[0_0_30px_rgba(54,229,209,0.2)]",children:e.jsx(U,{className:"w-10 h-10 text-kodo-lime drop-shadow-[0_0_10px_rgba(54,229,209,0.5)]"})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"text-2xl font-bold text-white font-display",children:"Key Created Successfully"}),e.jsx("p",{className:"text-sm text-kodo-content-dim max-w-xs mx-auto leading-relaxed",children:"Please copy your API key now. For security reasons, it cannot be displayed again properly."})]}),e.jsxs("div",{className:"bg-black/40 border border-kodo-steel/50 rounded-xl p-1 flex items-center gap-2 relative group overflow-hidden",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/5 to-transparent skew-x-12 translate-x-[-200%] group-hover:animate-shimmer"}),e.jsx("div",{className:"flex-1 px-4 py-3 font-mono text-sm text-kodo-gold overflow-x-auto no-scrollbar whitespace-nowrap text-left",children:y}),e.jsx(c,{variant:"ghost",size:"icon",onClick:A,className:"h-10 w-10 text-kodo-content-dim hover:text-white hover:bg-white/10 rounded-lg hover:scale-105 transition-all flex-none",title:"Copy to clipboard",children:e.jsx(G,{className:"w-5 h-5"})})]})]})}),e.jsx("div",{className:"p-6 border-t border-kodo-steel/50 bg-white/5 flex justify-end gap-3 backdrop-blur-sm flex-none z-10 transition-colors",children:d===1?e.jsxs(e.Fragment,{children:[e.jsx(c,{variant:"ghost",onClick:a,disabled:r,className:"hover:bg-white/10 text-kodo-content-dim hover:text-white",children:"Cancel"}),e.jsx(c,{variant:"default",onClick:o=>{o.preventDefault(),o.stopPropagation(),P(o)},disabled:r||!m.trim()||n.length===0,type:"button",className:"bg-kodo-cyan hover:bg-kodo-cyan/80 text-black font-semibold shadow-[0_0_20px_rgba(102,252,241,0.3)] hover:shadow-[0_0_30px_rgba(102,252,241,0.5)] transition-all duration-300",children:r?e.jsxs(e.Fragment,{children:[e.jsx(C,{className:"w-4 h-4 mr-2 animate-spin"}),"Generating..."]}):"Generate Key"})]}):e.jsx(c,{onClick:a,className:"bg-kodo-cyan hover:bg-kodo-cyan/80 text-black font-semibold min-w-[100px] shadow-[0_0_20px_rgba(102,252,241,0.3)] hover:shadow-[0_0_30px_rgba(102,252,241,0.5)] transition-all duration-300",children:"Done"})})]})]}),document.body):null};function de(){const a=D(),[i,h]=l.useState("docs"),[d,p]=l.useState([]),[m,g]=l.useState({}),[n,w]=l.useState(!1),[y,f]=l.useState(!1),[r,x]=l.useState(!1);l.useEffect(()=>{(i==="keys"||i==="stats")&&v()},[i]);const v=async()=>{w(!0);try{const[s,t]=await Promise.all([I.listKeys(),I.getStats()]);p(s),g(t)}catch(s){b.error("Error loading developer data",{error:s instanceof Error?s.message:String(s),stack:s instanceof Error?s.stack:void 0}),a.error("Failed to load developer data")}finally{w(!1)}},k=async()=>{x(!0),await v(),setTimeout(()=>x(!1),500)},_=()=>{f(!0)},P=async s=>{try{const t=await I.createKey(s);return p([t,...d]),a.success("API Key created successfully"),{key:t.key||void 0,id:t.id,name:t.name,prefix:t.prefix}}catch(t){throw b.error("Failed to create API key",{error:t instanceof Error?t.message:String(t)}),a.error("Failed to create API key"),t}},A=async s=>{if(confirm("Are you sure you want to revoke this API key? This action cannot be undone."))try{await I.revokeKey(s),p(d.filter(t=>t.id!==s)),a.success("API Key revoked successfully")}catch(t){b.error("Failed to revoke API key",{error:t instanceof Error?t.message:String(t)}),a.error("Failed to revoke API key")}},o=[{id:"docs",label:"Documentation",icon:V,desc:"References & Guides"},{id:"keys",label:"API Keys",icon:S,desc:"Security & Access"},{id:"stats",label:"Analytics",icon:K,desc:"Usage & Latency"}];return e.jsxs("div",{className:"min-h-screen p-8 space-y-8 bg-gradient-to-b from-transparent via-kodo-void/20 to-transparent",children:[e.jsxs("div",{className:"relative overflow-hidden rounded-2xl glass-hud border border-white/10 p-8 hud-corner",children:[e.jsx("div",{className:"absolute top-0 right-0 w-[500px] h-[500px] bg-kodo-cyan/5 rounded-full blur-[100px] -translate-y-1/2 translate-x-1/3 pointer-events-none"}),e.jsxs("div",{className:"relative z-10 flex flex-col md:flex-row items-start md:items-center justify-between gap-6",children:[e.jsxs("div",{className:"flex items-center gap-6",children:[e.jsxs("div",{className:"relative w-16 h-16 shrink-0 rounded-2xl bg-gradient-to-br from-kodo-steel/20 to-kodo-void border border-white/10 flex items-center justify-center shadow-lg group",children:[e.jsx("div",{className:"absolute inset-0 bg-kodo-cyan/10 rounded-2xl opacity-0 group-hover:opacity-100 transition-opacity duration-500"}),e.jsx(O,{className:"w-8 h-8 text-kodo-cyan group-hover:scale-110 transition-transform duration-300"})]}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-4xl font-display font-bold text-white mb-2 tracking-tight",children:"Developer Hub"}),e.jsx("p",{className:"text-kodo-secondary max-w-lg leading-relaxed",children:"Build powerful integrations with Veza's API. Access comprehensive documentation, manage your security keys, and monitor usage in real-time."})]})]}),e.jsxs("div",{className:"flex gap-3 shrink-0",children:[e.jsxs(c,{variant:"outline",className:"border-white/10 bg-white/5 hover:bg-white/10 hover:border-white/20 text-kodo-content-dim hover:text-white transition-all duration-300",onClick:()=>window.open("https://docs.veza.com","_blank"),children:[e.jsx(B,{className:"w-4 h-4 mr-2"}),"External Docs"]}),e.jsxs(c,{onClick:_,className:"bg-kodo-cyan hover:bg-kodo-cyan/80 text-black font-semibold shadow-[0_0_20px_rgba(102,252,241,0.2)] hover:shadow-[0_0_30px_rgba(102,252,241,0.4)] transition-all duration-300",children:[e.jsx(S,{className:"w-4 h-4 mr-2"}),"Generate API Key"]})]})]})]}),e.jsx("div",{className:"flex items-center gap-2 border-b border-white/10 pb-1 relative overflow-x-auto scrollbar-hide",children:o.map(s=>{const t=s.icon,N=i===s.id;return e.jsxs("button",{onClick:()=>h(s.id),className:u("relative flex items-center gap-3 px-6 py-4 rounded-t-xl transition-all duration-300 min-w-[180px] group",N?"text-white":"text-kodo-secondary hover:text-white hover:bg-white/5"),children:[N&&e.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-[2px] bg-gradient-to-r from-kodo-cyan via-kodo-lime to-kodo-cyan animate-shimmer"}),N&&e.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-kodo-cyan/10 to-transparent opacity-20"}),e.jsx("div",{className:u("w-8 h-8 rounded-lg flex items-center justify-center transition-all duration-300",N?"bg-kodo-cyan/20 text-kodo-cyan":"bg-white/5 text-kodo-steel group-hover:bg-white/10"),children:e.jsx(t,{className:"w-4 h-4"})}),e.jsxs("div",{className:"text-left",children:[e.jsx("div",{className:u("font-semibold text-sm",N?"text-white":"text-kodo-content-dim group-hover:text-kodo-text-main"),children:s.label}),e.jsx("div",{className:"text-xs text-kodo-steel/70",children:s.desc})]})]},s.id)})}),e.jsxs("div",{className:"animate-in fade-in slide-in-from-bottom-4 duration-500",children:[i==="docs"&&e.jsx("div",{className:"space-y-6",children:e.jsx("div",{className:"glass-hud p-1 rounded-xl border border-white/10 overflow-hidden bg-[#0d1117]",children:e.jsx(J,{useIframe:!0})})}),i==="keys"&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[e.jsx(R,{className:"w-5 h-5 text-kodo-cyan"}),"Active Credentials"]}),e.jsx(c,{variant:"ghost",size:"sm",onClick:k,className:u("text-kodo-content-dim hover:text-white",r&&"animate-spin"),children:e.jsx(E,{className:"w-4 h-4"})})]}),n?e.jsxs("div",{className:"flex flex-col items-center justify-center py-24 space-y-4",children:[e.jsx(C,{className:"w-8 h-8 text-kodo-cyan animate-spin"}),e.jsx("p",{className:"text-kodo-content-dim",children:"Loading credentials..."})]}):d.length===0?e.jsxs("div",{className:"border border-dashed border-white/10 rounded-2xl p-12 text-center bg-white/2 hover:bg-white/5 transition-colors group",children:[e.jsx("div",{className:"w-20 h-20 bg-kodo-steel/10 rounded-full flex items-center justify-center mx-auto mb-6 group-hover:scale-110 transition-transform duration-300",children:e.jsx(S,{className:"w-10 h-10 text-kodo-steel group-hover:text-kodo-cyan transition-colors"})}),e.jsx("h3",{className:"text-xl font-bold text-white mb-2",children:"No API Keys Generated"}),e.jsx("p",{className:"text-kodo-content-dim max-w-md mx-auto mb-8",children:"Create an API key to start integrating your application with Veza's platform. You'll be able to manage scopes and monitor usage here."}),e.jsx(c,{onClick:_,className:"bg-kodo-cyan text-black hover:bg-kodo-cyan/90",children:"Create First Key"})]}):e.jsx("div",{className:"glass-hud rounded-xl border border-white/10 overflow-hidden",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-left border-collapse",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-white/5 text-xs text-kodo-secondary uppercase tracking-wider",children:[e.jsx("th",{className:"px-6 py-4 font-semibold",children:"Name"}),e.jsx("th",{className:"px-6 py-4 font-semibold",children:"Token Prefix"}),e.jsx("th",{className:"px-6 py-4 font-semibold",children:"Scope"}),e.jsx("th",{className:"px-6 py-4 font-semibold",children:"Status"}),e.jsx("th",{className:"px-6 py-4 font-semibold",children:"Last Used"}),e.jsx("th",{className:"px-6 py-4 font-semibold text-right",children:"Actions"})]})}),e.jsx("tbody",{className:"divide-y divide-white/5 text-sm",children:d.map(s=>e.jsxs("tr",{className:"hover:bg-white/5 transition-colors group",children:[e.jsxs("td",{className:"px-6 py-4",children:[e.jsx("div",{className:"font-bold text-white group-hover:text-kodo-cyan transition-colors",children:s.name}),e.jsxs("div",{className:"text-xs text-kodo-content-dim mt-0.5",children:["ID: ",s.id]})]}),e.jsx("td",{className:"px-6 py-4",children:e.jsxs("code",{className:"bg-black/30 px-2 py-1 rounded text-kodo-gold font-mono text-xs border border-white/5",children:[s.prefix,"••••••••"]})}),e.jsx("td",{className:"px-6 py-4",children:e.jsxs("div",{className:"flex flex-wrap gap-1",children:[(s.scopes||["user.read"]).slice(0,2).map(t=>e.jsx("span",{className:"px-1.5 py-0.5 rounded-sm bg-white/5 border border-white/5 text-[10px] text-kodo-steel",children:t},t)),(s.scopes||[]).length>2&&e.jsxs("span",{className:"px-1.5 py-0.5 rounded-sm bg-white/5 text-[10px] text-kodo-steel",children:["+",(s.scopes||[]).length-2]})]})}),e.jsx("td",{className:"px-6 py-4",children:e.jsxs("div",{className:u("inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium border",s.status==="active"?"bg-kodo-lime/10 text-kodo-lime border-kodo-lime/20":"bg-kodo-red/10 text-kodo-red border-kodo-red/20"),children:[e.jsx("span",{className:u("w-1.5 h-1.5 rounded-full",s.status==="active"?"bg-kodo-lime animate-pulse":"bg-kodo-red")}),s.status==="active"?"Active":"Revoked"]})}),e.jsx("td",{className:"px-6 py-4 text-kodo-content-dim",children:s.lastUsed}),e.jsx("td",{className:"px-6 py-4 text-right",children:e.jsxs("div",{className:"flex justify-end gap-2 opacity-0 group-hover:opacity-100 transition-opacity",children:[e.jsx(c,{variant:"ghost",size:"icon",className:"h-8 w-8 text-kodo-content-dim hover:text-white hover:bg-white/10",onClick:()=>a.info("Full key hidden. Generate a new key if lost."),title:"View Key",children:e.jsx(H,{className:"w-4 h-4"})}),e.jsx(c,{variant:"ghost",size:"icon",className:"h-8 w-8 text-kodo-red/70 hover:text-kodo-red hover:bg-kodo-red/10",onClick:()=>A(s.id),title:"Revoke Key",children:e.jsx(W,{className:"w-4 h-4"})})]})})]},s.id))})]})})})]}),i==="stats"&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex justify-between items-center mb-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-bold text-white mb-1",children:"API Performance"}),e.jsx("p",{className:"text-sm text-kodo-secondary",children:"Real-time metrics from the last 24 hours."})]}),e.jsx(c,{variant:"ghost",size:"sm",onClick:k,className:u(r&&"animate-spin"),children:e.jsx(E,{className:"w-4 h-4"})})]}),n?e.jsx("div",{className:"flex justify-center py-24",children:e.jsx(C,{className:"w-8 h-8 text-kodo-cyan animate-spin"})}):e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4 mb-8",children:[e.jsxs("div",{className:"p-6 rounded-2xl glass-hud border border-white/5 relative overflow-hidden group hover:border-kodo-cyan/30 transition-colors",children:[e.jsx("div",{className:"absolute top-0 right-0 p-4 opacity-50 group-hover:opacity-100 transition-opacity",children:e.jsx(X,{className:"w-5 h-5 text-kodo-cyan"})}),e.jsx("div",{className:"text-kodo-secondary text-xs uppercase tracking-wider mb-2 font-bold",children:"Total Requests"}),e.jsx("div",{className:"text-3xl font-display font-bold text-white mb-2",children:m.requests_24h?.toLocaleString()||0}),e.jsxs("div",{className:"flex items-center text-xs text-kodo-lime bg-kodo-lime/10 w-fit px-2 py-1 rounded-md",children:[e.jsx(Y,{className:"w-3 h-3 mr-1"}),"+12.5%"]})]}),e.jsxs("div",{className:"p-6 rounded-2xl glass-hud border border-white/5 relative overflow-hidden group hover:border-kodo-lime/30 transition-colors",children:[e.jsx("div",{className:"absolute top-0 right-0 p-4 opacity-50 group-hover:opacity-100 transition-opacity",children:e.jsx(K,{className:"w-5 h-5 text-kodo-lime"})}),e.jsx("div",{className:"text-kodo-secondary text-xs uppercase tracking-wider mb-2 font-bold",children:"Avg Latency"}),e.jsxs("div",{className:"text-3xl font-display font-bold text-white mb-2",children:[m.avg_latency||0,e.jsx("span",{className:"text-sm text-kodo-steel ml-1",children:"ms"})]}),e.jsxs("div",{className:"flex items-center text-xs text-kodo-lime bg-kodo-lime/10 w-fit px-2 py-1 rounded-md",children:[e.jsx(Z,{className:"w-3 h-3 mr-1"}),"-4ms"]})]}),e.jsxs("div",{className:"p-6 rounded-2xl glass-hud border border-white/5 relative overflow-hidden group hover:border-kodo-magenta/30 transition-colors",children:[e.jsx("div",{className:"absolute top-0 right-0 p-4 opacity-50 group-hover:opacity-100 transition-opacity",children:e.jsx(R,{className:"w-5 h-5 text-kodo-magenta"})}),e.jsx("div",{className:"text-kodo-secondary text-xs uppercase tracking-wider mb-2 font-bold",children:"Error Rate"}),e.jsxs("div",{className:"text-3xl font-display font-bold text-white mb-2",children:["0.05",e.jsx("span",{className:"text-sm text-kodo-steel ml-1",children:"%"})]}),e.jsx("div",{className:"flex items-center text-xs text-kodo-secondary bg-white/5 w-fit px-2 py-1 rounded-md",children:"Stable"})]}),e.jsxs("div",{className:"p-6 rounded-2xl glass-hud border border-white/5 relative overflow-hidden group hover:border-kodo-gold/30 transition-colors",children:[e.jsx("div",{className:"absolute top-0 right-0 p-4 opacity-50 group-hover:opacity-100 transition-opacity",children:e.jsx(S,{className:"w-5 h-5 text-kodo-gold"})}),e.jsx("div",{className:"text-kodo-secondary text-xs uppercase tracking-wider mb-2 font-bold",children:"Active Keys"}),e.jsx("div",{className:"text-3xl font-display font-bold text-white mb-2",children:d.filter(s=>s.status==="active").length}),e.jsxs("div",{className:"flex items-center text-xs text-kodo-gold bg-kodo-gold/10 w-fit px-2 py-1 rounded-md",children:[d.length," total"]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"lg:col-span-2 p-6 rounded-2xl glass-hud border border-white/5",children:[e.jsx("h3",{className:"font-bold text-white mb-6",children:"Traffic Volume (24h)"}),e.jsx("div",{className:"flex items-end justify-between h-48 gap-2",children:[35,45,30,60,75,50,45,60,80,70,55,65,50,45,60,75,85,90,60,50,40,30,25,20].map((s,t)=>e.jsx("div",{className:"w-full bg-white/5 rounded-t-sm hover:bg-kodo-cyan/50 transition-colors relative group",style:{height:`${s}%`},children:e.jsxs("div",{className:"opacity-0 group-hover:opacity-100 absolute -top-8 left-1/2 -translate-x-1/2 bg-black text-xs px-2 py-1 rounded text-white whitespace-nowrap z-10 pointer-events-none",children:[Math.round(s*12.5)," reqs"]})},t))}),e.jsxs("div",{className:"flex justify-between mt-2 text-xs text-kodo-steel",children:[e.jsx("span",{children:"00:00"}),e.jsx("span",{children:"06:00"}),e.jsx("span",{children:"12:00"}),e.jsx("span",{children:"18:00"}),e.jsx("span",{children:"23:59"})]})]}),e.jsxs("div",{className:"p-6 rounded-2xl glass-hud border border-white/5",children:[e.jsx("h3",{className:"font-bold text-white mb-6",children:"Method Distribution"}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between text-sm mb-2 text-kodo-content-dim",children:[e.jsx("span",{children:"GET"}),e.jsx("span",{className:"text-white",children:"65%"})]}),e.jsx("div",{className:"h-2 bg-white/5 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-kodo-cyan w-[65%] rounded-full shadow-[0_0_10px_rgba(102,252,241,0.5)]"})})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between text-sm mb-2 text-kodo-content-dim",children:[e.jsx("span",{children:"POST"}),e.jsx("span",{className:"text-white",children:"25%"})]}),e.jsx("div",{className:"h-2 bg-white/5 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-kodo-lime w-[25%] rounded-full shadow-[0_0_10px_rgba(54,229,209,0.5)]"})})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between text-sm mb-2 text-kodo-content-dim",children:[e.jsx("span",{children:"PUT/DELETE"}),e.jsx("span",{className:"text-white",children:"10%"})]}),e.jsx("div",{className:"h-2 bg-white/5 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-kodo-magenta w-[10%] rounded-full shadow-[0_0_10px_rgba(255,102,255,0.5)]"})})]})]})]})]})]})]}),y&&e.jsx(ee,{onClose:()=>f(!1),onCreate:P})]})}export{de as DeveloperPage};