import{j as e,m,A as tt}from"./vendor-Dy_Aqit6.js";import{a as o}from"./plotly-BRtgkqNO.js";import{u as st,g as x,I as rt,f as at,y as ot,o as it,J as lt,R as ke,E as nt,C as u,K as Se,H as _,S as dt,Z as ct,T as xt}from"./index-gw3efmjR.js";import{B as mt}from"./bar-chart-3-DmJ5EovG.js";import{C as ht}from"./chevron-up-Pz5wTZ5C.js";import{C as gt}from"./clock-5YOVlxXU.js";import{a0 as pt,a3 as bt,X as yt,Y as ft,a1 as ut}from"./generateCategoricalChart-CgN9tTma.js";import{A as jt}from"./AreaChart-DAMf6ulO.js";import{A as vt}from"./Area-BdvHd8jY.js";import{K as wt}from"./key-C145XUWI.js";import{E as Nt}from"./eye-off-DKOCXM1d.js";import{C as T}from"./copy-BRbVh0Bh.js";import{S as kt}from"./shield-BMSQUTIe.js";import{L}from"./loader-CRGllGLa.js";import{P as St}from"./play-DaRbgWxb.js";import{C as Ct}from"./code-2-hXkUnMKO.js";import{G as $t}from"./globe-BWJyfRos.js";import{B as At}from"./box-Bgt8EZdi.js";import{L as _t}from"./layers-C98tUB4O.js";import"./clsx-B-dksMZM.js";import"./debounce-Bnr1Yz2W.js";const Ce=s=>{if(!s)return"Never";const i=Date.now()-new Date(s).getTime(),h=Math.floor(i/6e4);if(h<1)return"Just now";if(h<60)return`${h} mins ago`;const p=Math.floor(h/60);return p<24?`${p} hours ago`:`${Math.floor(p/24)} days ago`},ss=()=>{var se,re,ae,oe,ie,le,ne,de,ce,xe,me,he,ge,pe,be,ye,fe,ue,je,ve,we;const{isDark:s}=st(),[i,h]=o.useState([]),[p,P]=o.useState(!0),[I,E]=o.useState(!1),[R,$e]=o.useState({}),[j,U]=o.useState(!1),[c,Ae]=o.useState("python"),[K,_e]=o.useState([]),[f,G]=o.useState(""),[r,Te]=o.useState(null),[Tt,F]=o.useState(!1),[v,Le]=o.useState(!0),[w,Pe]=o.useState("hourly");o.useEffect(()=>{S(),N(),Ie()},[]);const Ie=async()=>{F(!0);try{const t=await fetch("/api/v1/developer/usage-analytics",{headers:{"X-User-ID":x()}});if(t.ok){const a=await t.json();Te(a)}}catch(t){console.error("Failed to fetch usage analytics",t)}finally{F(!1)}},N=async()=>{try{const t=await fetch("/api/v1/developer/webhooks",{headers:{"X-User-ID":x()}});if(t.ok){const a=await t.json();_e(a)}}catch(t){console.error("Failed to fetch webhooks",t)}},Ee=async()=>{if(f.trim())try{(await fetch("/api/v1/developer/webhooks",{method:"POST",headers:{"X-User-ID":x(),"Content-Type":"application/json"},body:JSON.stringify({url:f.trim()})})).ok&&(await N(),G(""))}catch(t){console.error(t)}},Re=async t=>{try{(await fetch(`/api/v1/developer/webhooks/${t}`,{method:"DELETE",headers:{"X-User-ID":x()}})).ok&&await N()}catch(a){console.error("Failed to delete webhook",a)}},[W,z]=o.useState(null),[k,O]=o.useState(null),[g,X]=o.useState({}),[Ue,B]=o.useState({}),Ke=async t=>{if(g[t]){const a={...g};delete a[t],X(a);return}B(a=>({...a,[t]:!0}));try{const a=await fetch(`/api/v1/developer/webhooks/${t}/deliveries`,{headers:{"X-User-ID":x()}});if(a.ok){const l=await a.json();X(d=>({...d,[t]:l.deliveries||[]}))}}catch(a){console.error(a)}finally{B(a=>({...a,[t]:!1}))}},Ge=async t=>{z(t);try{const l=await(await fetch(`/api/v1/developer/webhooks/${t}/test`,{method:"POST",headers:{"X-User-ID":x()}})).json();l.success?(O(t),setTimeout(()=>O(null),3e3)):alert("Ping Failed: "+l.message)}catch(a){console.error(a),alert("Network error while pinging.")}finally{z(null)}},Fe=()=>{i.length>0&&i[0].key;const t=A(c||"python"),a=c==="python"?"datavision_starter.py":c==="js"?"datavision_starter.js":"datavision_starter.sh",l=new Blob([t],{type:"text/plain"}),d=URL.createObjectURL(l),n=document.createElement("a");n.href=d,n.download=a,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(d)},S=async()=>{P(!0);try{const t=await fetch("/api/v1/developer/keys",{headers:{"X-User-ID":x()}});if(t.ok){const a=await t.json();h(a)}}catch(t){console.error("Failed to fetch keys",t)}finally{P(!1)}},[C,We]=o.useState("dark"),[$,ze]=o.useState("full-dashboard"),[D,M]=o.useState(!1),[Lt,Pt]=o.useState(!1),[It,Et]=o.useState(null),Oe=t=>{navigator.clipboard.writeText(t),E(!0),setTimeout(()=>E(!1),2e3)},Xe=async()=>{U(!0);try{const t=await fetch("/api/v1/developer/keys/generate",{method:"POST",headers:{"Content-Type":"application/json","X-User-ID":x()}});if(t.ok)await S();else{const a=await t.json().catch(()=>({})),l=a.detail||a.message||"Failed to generate API key";alert(`Error: ${l}`),console.error("Key generation failed:",l)}}catch(t){console.error("Key generation error:",t),alert(`Network error: ${t.message||"Could not reach server"}`)}finally{U(!1)}},Be=async t=>{try{(await fetch(`/api/v1/developer/keys/${t}/revoke`,{method:"POST",headers:{"X-User-ID":x()}})).ok&&await S()}catch(a){console.error("Failed to revoke key",a)}},De=t=>{$e(a=>({...a,[t]:!a[t]}))},Me=``,Ve=()=>{navigator.clipboard.writeText(Me),M(!0),setTimeout(()=>M(!1),2e3)},[Ye,V]=o.useState(!1),[b,Y]=o.useState(""),[q,H]=o.useState(!1),[J,qe]=o.useState({}),[He,Je]=o.useState([]),[Z,Ze]=o.useState("YOUR_LOCAL_FILE.csv"),[Q,ee]=o.useState(!1),Qe=async()=>{ee(!0);try{const a=await(await fetch("/api/v1/developer/suggest-goals",{headers:{"X-User-ID":x()}})).json();a.suggestions&&(Je(a.suggestions),Ze(a.dataset||"YOUR_LOCAL_FILE.csv"))}catch(t){console.error("Failed to fetch suggestions",t)}finally{ee(!1)}},te=async()=>{var a;if(!b.trim())return;H(!0);const t=((a=i[0])==null?void 0:a.key)||"dv_live_...";try{const d=await(await fetch("/api/v1/developer/generate-code",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:b,language:c,api_key:t,base_url:window.location.origin,dataset_name:Z})})).json();d.code&&qe(n=>({...n,[c]:d.code}))}catch(l){console.error(l)}finally{H(!1)}},A=t=>{var y;if(J[t])return J[t];const a=((y=i[0])==null?void 0:y.key)||"dv_live_...",l=Z,d=window.location.origin,n=b||"Analyze this dataset and give me key insights";return t==="python"?`import requests import json headers = { "Authorization": "Bearer ${a}" } # 1. Point this to ANY local CSV or Excel file on your server/laptop files = {'file': open('${l}', 'rb')} data = {'goal': '${n}'} # 2. Send the request (stream=True is required for live AI updates!) response = requests.post( "${d}/api/v1/autopilot/run", headers=headers, files=files, data=data, stream=True ) # 3. Read the live AI stream for line in response.iter_lines(): if line: decoded = line.decode('utf-8') if decoded.startswith('data: '): try: event_data = json.loads(decoded[6:]) if event_data.get('type') == 'step_complete': safe_title = event_data['data']['step']['title'].encode('ascii', 'ignore').decode('ascii').strip() print(f"[SUCCESS] {safe_title}") elif event_data.get('type') == 'session_complete': print("\\n[COMPLETE] Analysis finished successfully.") except: pass`:t==="curl"?`curl -N -X POST ${d}/api/v1/autopilot/run \\ -H "Authorization: Bearer ${a}" \\ -F "file=@${l}" \\ -F "goal=${n}"`:t==="js"?`const formData = new FormData(); formData.append('file', fileInput.files[0]); formData.append('goal', '${n}'); fetch('${d}/api/v1/autopilot/run', { method: 'POST', headers: { 'Authorization': 'Bearer ${a}' }, body: formData }).then(async res => { const reader = res.body.getReader(); const decoder = new TextDecoder(); while (true) { const {done, value} = await reader.read(); if (done) break; console.log(decoder.decode(value)); } });`:""},et=()=>{navigator.clipboard.writeText(A(c)),V(!0),setTimeout(()=>V(!1),2e3)};return e.jsxs("div",{className:"p-3 sm:p-6 space-y-4 sm:space-y-6 max-w-7xl mx-auto",children:[e.jsx("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-3xl font-extrabold tracking-tight",style:{color:s?"#f8fafc":"#0f172a"},children:"🔧 Developer & Embed Center"}),e.jsx("p",{className:"text-sm mt-2",style:{color:s?"#94a3b8":"#64748b"},children:"Manage API keys, test endpoints, and configure embedded SDK dashboards."})]})}),e.jsxs(m.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},className:`p-4 sm:p-5 rounded-2xl border flex flex-col sm:flex-row gap-4 items-start sm:items-center ${s?"bg-indigo-500/10 border-indigo-500/20":"bg-indigo-50 border-indigo-100"}`,children:[e.jsx("div",{className:`p-3 rounded-xl ${s?"bg-indigo-500/20 text-indigo-400":"bg-indigo-100 text-indigo-600"}`,children:e.jsx(rt,{className:"w-6 h-6"})}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-bold text-sm mb-1",style:{color:s?"#e2e8f0":"#1e293b"},children:"How to use this page?"}),e.jsxs("p",{className:"text-xs leading-relaxed",style:{color:s?"#94a3b8":"#475569"},children:["This section is designed for your software engineering team. You can generate an ",e.jsx("strong",{children:"API Key"})," here and use the ",e.jsx("strong",{children:"Code Snippets"})," below to automatically trigger Datavision's AI pipelines from your company's own backend servers. You can also configure Webhooks to receive notifications when long-running AI tasks finish."]})]})]}),e.jsxs(m.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`rounded-3xl border shadow-xl overflow-hidden ${s?"bg-zinc-900/50 border-white/5 backdrop-blur-xl":"bg-white border-gray-100 shadow-gray-200/50"}`,children:[e.jsxs("button",{onClick:()=>Le(!v),className:"w-full px-6 py-5 flex items-center justify-between hover:bg-white/5 transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2.5 rounded-xl bg-gradient-to-br from-indigo-500 to-purple-600 text-white shadow-lg shadow-indigo-500/20",children:e.jsx(mt,{className:"w-5 h-5"})}),e.jsxs("div",{className:"text-left",children:[e.jsx("h3",{className:"font-bold text-base",style:{color:s?"white":"black"},children:"API Usage Analytics"}),e.jsx("p",{className:"text-xs text-gray-500",children:"Real-time performance monitoring & usage metrics"})]})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[r&&e.jsxs("div",{className:"hidden sm:flex gap-6 mr-4",children:[e.jsxs("div",{className:"text-right",children:[e.jsx("p",{className:"text-[10px] text-gray-500 uppercase tracking-wider",children:"Total Calls"}),e.jsx("p",{className:"text-lg font-black",style:{color:s?"white":"black"},children:(re=r.total_calls)==null?void 0:re.toLocaleString()})]}),e.jsxs("div",{className:"text-right",children:[e.jsx("p",{className:"text-[10px] text-gray-500 uppercase tracking-wider",children:"Avg Latency"}),e.jsxs("p",{className:"text-lg font-black text-emerald-500",children:[(ae=r.latency)==null?void 0:ae.avg,"ms"]})]}),e.jsxs("div",{className:"text-right",children:[e.jsx("p",{className:"text-[10px] text-gray-500 uppercase tracking-wider",children:"Error Rate"}),e.jsxs("p",{className:`text-lg font-black ${(((oe=r.errors)==null?void 0:oe.error_rate)||0)>5?"text-red-500":"text-emerald-500"}`,children:[(ie=r.errors)==null?void 0:ie.error_rate,"%"]})]})]}),v?e.jsx(ht,{className:"w-5 h-5 text-gray-400"}):e.jsx(at,{className:"w-5 h-5 text-gray-400"})]})]}),e.jsx(tt,{children:v&&e.jsx(m.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.3},className:"overflow-hidden",children:e.jsxs("div",{className:`px-6 pb-6 border-t ${s?"border-white/5":"border-gray-100"}`,children:[e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3 mt-5 mb-6",children:[e.jsxs("div",{className:`p-4 rounded-2xl border ${s?"bg-black/30 border-white/5":"bg-gray-50 border-gray-100"}`,children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(ot,{className:"w-4 h-4 text-indigo-400"}),e.jsx("p",{className:"text-[10px] text-gray-500 uppercase tracking-wider font-bold",children:"Total Calls"})]}),e.jsx("p",{className:"text-2xl font-black",style:{color:s?"white":"black"},children:((le=r==null?void 0:r.total_calls)==null?void 0:le.toLocaleString())||"—"}),e.jsxs("p",{className:`text-[10px] mt-1 font-semibold ${((r==null?void 0:r.week_change)||0)>=0?"text-emerald-500":"text-red-500"}`,children:[((r==null?void 0:r.week_change)||0)>0?"+":"",(r==null?void 0:r.week_change)||0,"% this week"]})]}),e.jsxs("div",{className:`p-4 rounded-2xl border ${s?"bg-black/30 border-white/5":"bg-gray-50 border-gray-100"}`,children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(gt,{className:"w-4 h-4 text-teal-400"}),e.jsx("p",{className:"text-[10px] text-gray-500 uppercase tracking-wider font-bold",children:"Latency P95"})]}),e.jsxs("p",{className:"text-2xl font-black",style:{color:s?"white":"black"},children:[((ne=r==null?void 0:r.latency)==null?void 0:ne.p95)||"—","ms"]}),e.jsxs("p",{className:"text-[10px] text-gray-500 mt-1 font-semibold",children:["P50: ",(de=r==null?void 0:r.latency)==null?void 0:de.p50,"ms · P99: ",(ce=r==null?void 0:r.latency)==null?void 0:ce.p99,"ms"]})]}),e.jsxs("div",{className:`p-4 rounded-2xl border ${s?"bg-black/30 border-white/5":"bg-gray-50 border-gray-100"}`,children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(it,{className:"w-4 h-4 text-amber-400"}),e.jsx("p",{className:"text-[10px] text-gray-500 uppercase tracking-wider font-bold",children:"Error Rate"})]}),e.jsxs("p",{className:`text-2xl font-black ${(((xe=r==null?void 0:r.errors)==null?void 0:xe.error_rate)||0)>5?"text-red-500":"text-emerald-500"}`,children:[((me=r==null?void 0:r.errors)==null?void 0:me.error_rate)||"—","%"]}),e.jsxs("p",{className:"text-[10px] text-gray-500 mt-1 font-semibold",children:["4xx: ",((he=r==null?void 0:r.errors)==null?void 0:he.total_4xx)||0," · 5xx: ",((ge=r==null?void 0:r.errors)==null?void 0:ge.total_5xx)||0]})]}),e.jsxs("div",{className:`p-4 rounded-2xl border ${s?"bg-black/30 border-white/5":"bg-gray-50 border-gray-100"}`,children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(lt,{className:"w-4 h-4 text-emerald-400"}),e.jsx("p",{className:"text-[10px] text-gray-500 uppercase tracking-wider font-bold",children:"Rate Limit"})]}),e.jsx("p",{className:"text-2xl font-black text-emerald-500",children:((be=(pe=r==null?void 0:r.rate_limit)==null?void 0:pe.remaining)==null?void 0:be.toLocaleString())||"—"}),e.jsxs("div",{className:"mt-2",children:[e.jsx("div",{className:`w-full h-1.5 rounded-full ${s?"bg-white/10":"bg-gray-200"}`,children:e.jsx("div",{className:"h-full rounded-full bg-gradient-to-r from-emerald-500 to-teal-400 transition-all",style:{width:`${Math.min(((ye=r==null?void 0:r.rate_limit)==null?void 0:ye.percentage)||0,100)}%`}})}),e.jsxs("p",{className:"text-[10px] text-gray-500 mt-1",children:[((fe=r==null?void 0:r.rate_limit)==null?void 0:fe.current)||0," / ",((je=(ue=r==null?void 0:r.rate_limit)==null?void 0:ue.limit)==null?void 0:je.toLocaleString())||"1,000"," per min"]})]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[e.jsxs("div",{className:`p-5 rounded-2xl border ${s?"bg-black/20 border-white/5":"bg-gray-50/50 border-gray-100"}`,children:[e.jsxs("div",{className:"flex justify-between items-center mb-4",children:[e.jsx("h4",{className:"text-sm font-bold",style:{color:s?"#e2e8f0":"#1e293b"},children:"API Calls"}),e.jsx("div",{className:"flex gap-1",children:["hourly","daily"].map(t=>e.jsx("button",{onClick:()=>Pe(t),className:`px-2.5 py-1 text-[10px] font-bold rounded-lg transition-colors uppercase ${w===t?"bg-indigo-500 text-white":s?"bg-white/5 text-gray-400":"bg-gray-200 text-gray-500"}`,children:t},t))})]}),e.jsx("div",{className:"h-[200px]",children:e.jsx(pt,{width:"100%",height:"100%",children:e.jsxs(jt,{data:w==="hourly"?(r==null?void 0:r.calls_per_hour)||[]:(r==null?void 0:r.calls_per_day)||[],children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:"callsGrad",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"#6366f1",stopOpacity:.3}),e.jsx("stop",{offset:"100%",stopColor:"#6366f1",stopOpacity:0})]})}),e.jsx(bt,{strokeDasharray:"3 3",stroke:s?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"}),e.jsx(yt,{dataKey:w==="hourly"?"hour":"day",tick:{fontSize:10,fill:"#94a3b8"}}),e.jsx(ft,{tick:{fontSize:10,fill:"#94a3b8"}}),e.jsx(ut,{contentStyle:{backgroundColor:s?"#18181b":"#fff",border:s?"1px solid rgba(255,255,255,0.1)":"1px solid #e2e8f0",borderRadius:"12px",fontSize:"12px"},labelStyle:{color:s?"#fff":"#000"}}),e.jsx(vt,{type:"monotone",dataKey:"calls",stroke:"#6366f1",fill:"url(#callsGrad)",strokeWidth:2})]})})})]}),e.jsxs("div",{className:`p-5 rounded-2xl border ${s?"bg-black/20 border-white/5":"bg-gray-50/50 border-gray-100"}`,children:[e.jsx("h4",{className:"text-sm font-bold mb-4",style:{color:s?"#e2e8f0":"#1e293b"},children:"Top Endpoints"}),e.jsx("div",{className:"space-y-3",children:((r==null?void 0:r.top_endpoints)||[]).map((t,a)=>{var y,Ne;const l=((Ne=(y=r==null?void 0:r.top_endpoints)==null?void 0:y[0])==null?void 0:Ne.calls)||1,d=t.calls/l*100,n=["bg-indigo-500","bg-purple-500","bg-teal-500","bg-amber-500","bg-pink-500"];return e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between items-center mb-1",children:[e.jsx("code",{className:"text-[11px] font-mono",style:{color:s?"#e2e8f0":"#334155"},children:t.endpoint}),e.jsx("span",{className:"text-xs font-bold",style:{color:s?"#e2e8f0":"#334155"},children:t.calls.toLocaleString()})]}),e.jsx("div",{className:`w-full h-2 rounded-full ${s?"bg-white/5":"bg-gray-200"}`,children:e.jsx("div",{className:`h-full rounded-full ${n[a%n.length]} transition-all duration-500`,style:{width:`${d}%`}})})]},a)})})]})]})]})})})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-8",children:[e.jsxs("div",{className:"lg:col-span-2 space-y-8",children:[e.jsxs(m.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:`p-5 sm:p-8 rounded-3xl border shadow-xl relative overflow-hidden ${s?"bg-zinc-900/50 border-white/5 backdrop-blur-xl":"bg-white border-gray-100 shadow-gray-200/50"}`,children:[e.jsx("div",{className:"absolute top-0 right-0 w-64 h-64 bg-indigo-500/10 rounded-full blur-3xl -translate-y-1/2 translate-x-1/2 pointer-events-none"}),e.jsxs("div",{className:"flex justify-between items-start mb-6",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"font-bold text-lg flex items-center gap-2",style:{color:s?"white":"black"},children:[e.jsx(wt,{className:"w-5 h-5 text-indigo-400"})," Authentication Keys"]}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Use this key to securely authenticate requests to the DataVision API. Keep it secret."})]}),e.jsx("div",{className:"flex gap-2 items-center",children:i.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"text-xs text-gray-500",children:["Last used: ",Ce(i[0].last_used||i[0].created_at)]}),e.jsxs("div",{className:`px-3 py-1 rounded-full text-[10px] font-bold tracking-widest uppercase flex items-center gap-1.5 border ${i[0].is_active?"bg-emerald-500/20 text-emerald-400 border-emerald-500/30":"bg-red-500/20 text-red-400 border-red-500/30"}`,children:[e.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${i[0].is_active?"bg-emerald-400 animate-pulse":"bg-red-400"}`})," ",i[0].is_active?"Active":"Revoked"]})]})})]}),e.jsx("div",{className:"space-y-4",children:p?e.jsxs("div",{className:"flex items-center gap-2 text-gray-500",children:[e.jsx(ke,{className:"w-4 h-4 animate-spin"})," Loading keys..."]}):Array.isArray(i)&&i.length===0?e.jsx("div",{className:"text-gray-500 text-sm",children:"No API keys found."}):Array.isArray(i)?i.map(t=>e.jsxs("div",{className:"flex flex-col sm:flex-row items-stretch sm:items-center gap-3",children:[e.jsxs("div",{className:`flex-1 px-4 py-3.5 rounded-xl border flex items-center justify-between text-sm transition-all focus-within:ring-2 focus-within:ring-indigo-500/50 ${s?"bg-black/40 border-white/10":"bg-gray-50 border-gray-200"}`,children:[e.jsx("code",{className:"font-mono text-sm tracking-widest",style:{color:s?"#e2e8f0":"#1e293b"},children:R[t.id]?t.key:"••••••••••••••••••••••••••••••••••••••••"}),e.jsx("button",{onClick:()=>De(t.id),className:"text-gray-400 hover:text-indigo-400 transition-colors ml-4",children:R[t.id]?e.jsx(Nt,{className:"w-4 h-4"}):e.jsx(nt,{className:"w-4 h-4"})})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:()=>Oe(t.key),className:`px-5 py-3.5 rounded-xl font-bold flex items-center justify-center gap-2 transition-all min-w-[120px] ${I?"bg-emerald-500 text-white":s?"bg-white/10 hover:bg-white/20":"bg-gray-100 hover:bg-gray-200 text-gray-700"}`,children:I?e.jsxs(e.Fragment,{children:[e.jsx(u,{className:"w-4 h-4"})," Copied"]}):e.jsxs(e.Fragment,{children:[e.jsx(T,{className:"w-4 h-4"})," Copy"]})}),e.jsx("button",{onClick:()=>Be(t.id),className:`px-4 py-3.5 rounded-xl font-bold flex items-center justify-center gap-2 transition-all ${s?"bg-red-500/10 hover:bg-red-500/20 text-red-400":"bg-red-50 hover:bg-red-100 text-red-600"}`,title:"Revoke Key",children:"Revoke"})]})]},t.id)):null}),e.jsxs("div",{className:"mt-6 pt-5 border-t flex justify-between items-center",style:{borderColor:s?"rgba(255,255,255,0.05)":"#f1f5f9"},children:[e.jsxs("p",{className:"text-xs text-gray-500 flex items-center gap-1.5",children:[e.jsx(kt,{className:"w-3.5 h-3.5 text-emerald-400"})," Never share this key in client-side code. Use environment variables."]}),e.jsxs("button",{onClick:Xe,disabled:j,className:"text-sm font-bold text-indigo-400 hover:text-indigo-300 transition-colors flex items-center gap-2",children:[e.jsx(ke,{className:`w-4 h-4 ${j?"animate-spin":""}`}),j?"Generating...":"Roll New Key"]})]})]}),e.jsxs(m.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.1},className:`p-5 sm:p-8 rounded-3xl border shadow-xl relative overflow-hidden ${s?"bg-zinc-900/50 border-white/5 backdrop-blur-xl":"bg-white border-gray-100 shadow-gray-200/50"}`,children:[e.jsxs("div",{className:"flex justify-between items-center mb-6",children:[e.jsxs("h3",{className:"font-bold text-lg flex items-center gap-2",style:{color:s?"white":"black"},children:[e.jsx(Se,{className:"w-5 h-5 text-indigo-400"})," API Integration"]}),e.jsx("div",{className:"flex gap-2",children:["python","curl","js"].map(t=>e.jsx("button",{onClick:()=>Ae(t),className:`px-3 py-1 text-xs font-bold rounded-lg transition-colors uppercase ${c===t?"bg-indigo-500 text-white":s?"bg-white/5 text-gray-400 hover:bg-white/10":"bg-gray-100 text-gray-500 hover:bg-gray-200"}`,children:t},t))})]}),e.jsx("p",{className:"text-xs text-gray-500 mb-4",children:"Generate code to programmatically run Agentic Autopilot from your servers."}),e.jsxs("div",{className:`p-4 rounded-xl border mb-4 flex gap-3 items-start ${s?"bg-black/30 border-white/10":"bg-gray-50 border-gray-200"}`,children:[e.jsx("div",{className:`p-2 rounded-lg mt-1 ${s?"bg-indigo-500/20 text-indigo-400":"bg-indigo-100 text-indigo-600"}`,children:e.jsx(_,{className:"w-4 h-4"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("label",{className:"text-xs font-bold mb-1 block",style:{color:s?"#e2e8f0":"#1e293b"},children:"AI Code Generator"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:b,onChange:t=>Y(t.target.value),placeholder:"e.g. Write a script to analyze sales.csv and predict revenue",className:`flex-1 px-3 py-2 text-sm rounded-lg border outline-none focus:ring-1 focus:ring-indigo-500 ${s?"bg-black/50 border-white/10 text-white":"bg-white border-gray-300 text-black"}`,onKeyDown:t=>t.key==="Enter"&&te()}),e.jsxs("button",{onClick:te,disabled:q||!b.trim(),className:"px-4 py-2 rounded-lg bg-indigo-600 hover:bg-indigo-700 text-white text-sm font-bold disabled:opacity-50 transition-colors flex items-center gap-2",children:[q?e.jsx(L,{className:"w-4 h-4 animate-spin"}):e.jsx(St,{className:"w-4 h-4"}),"Generate"]})]}),e.jsxs("div",{className:"flex gap-2 flex-wrap mt-3",children:[e.jsxs("button",{onClick:Qe,disabled:Q,className:"text-xs px-3 py-1.5 rounded-full border border-indigo-500/30 text-indigo-400 hover:bg-indigo-500/10 transition-colors flex items-center gap-1.5 shadow-sm",children:[Q?e.jsx(L,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(dt,{className:"w-3.5 h-3.5"}),"Auto-Suggest based on my data"]}),He.map((t,a)=>e.jsx("button",{onClick:()=>Y(t),className:`text-[11px] px-3 py-1.5 rounded-full border transition-colors ${s?"border-gray-700 bg-gray-800 text-gray-300 hover:border-indigo-500":"border-gray-200 bg-white text-gray-600 hover:border-indigo-400"}`,children:t},a))]})]})]}),e.jsxs("div",{className:"relative group",children:[e.jsx("div",{className:"absolute right-3 top-3 flex gap-2 opacity-0 group-hover:opacity-100 transition-opacity",children:e.jsx("button",{onClick:et,className:"px-3 py-1.5 rounded-lg bg-indigo-600 hover:bg-indigo-700 text-white text-xs font-semibold flex items-center gap-1.5 shadow-md transition-colors",children:Ye?e.jsxs(e.Fragment,{children:[e.jsx(u,{className:"w-3.5 h-3.5"})," Copied"]}):e.jsxs(e.Fragment,{children:[e.jsx(T,{className:"w-3.5 h-3.5"})," Copy Code"]})})}),e.jsx("pre",{className:`p-4 rounded-xl border font-mono text-sm overflow-x-auto ${s?"bg-[#0d1117] border-white/5 text-gray-300":"bg-gray-100 border-gray-200 text-gray-800"}`,children:e.jsx("code",{children:A(c)})})]}),e.jsxs("div",{className:`mt-6 pt-6 border-t flex flex-col gap-3 ${s?"border-white/10":"border-gray-200"}`,children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("h4",{className:"text-sm font-bold flex items-center gap-2",style:{color:s?"#e2e8f0":"#1e293b"},children:[e.jsx(Se,{className:"w-4 h-4 text-indigo-400"})," Environment Setup"]}),e.jsxs("button",{onClick:Fe,className:"px-3 py-1.5 text-xs font-bold rounded-lg bg-indigo-500 hover:bg-indigo-600 text-white flex items-center gap-2 transition-colors shadow-sm",children:[e.jsx(_,{className:"w-3.5 h-3.5"})," Download Starter Kit"]})]}),e.jsx("p",{className:"text-xs text-gray-400 mb-2",children:"Download the starter script, install the dependencies, and run it locally to see real AI predictions stream to your Webhook."}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:`p-4 rounded-xl border ${s?"bg-black/30 border-white/10":"bg-gray-50 border-gray-200"}`,children:[e.jsx("p",{className:"text-xs text-gray-500 font-bold mb-2 uppercase",children:"1. Install Dependencies"}),e.jsx("code",{className:"text-[11px] font-mono block p-2 rounded bg-black/50 text-green-400 border border-white/5",children:c==="python"?"pip install requests httpx":c==="js"?"npm install node-fetch form-data":"apt-get install curl"})]}),e.jsxs("div",{className:`p-4 rounded-xl border ${s?"bg-black/30 border-white/10":"bg-gray-50 border-gray-200"}`,children:[e.jsx("p",{className:"text-xs text-gray-500 font-bold mb-2 uppercase",children:"2. Secure API Key (.env)"}),e.jsxs("code",{className:"text-[11px] font-mono block p-2 rounded bg-black/50 text-indigo-300 border border-white/5",children:["DATAVISION_API_KEY=",(((ve=i[0])==null?void 0:ve.key)||"dv_live_...").substring(0,16),"..."]})]})]})]})]}),e.jsxs(m.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.2},className:`p-5 sm:p-8 rounded-3xl border shadow-xl relative overflow-hidden ${s?"bg-zinc-900/50 border-white/5 backdrop-blur-xl":"bg-white border-gray-100 shadow-gray-200/50"}`,children:[e.jsx("div",{className:"absolute bottom-0 left-0 w-64 h-64 bg-teal-500/10 rounded-full blur-3xl translate-y-1/2 -translate-x-1/2 pointer-events-none"}),e.jsxs("h3",{className:"font-bold text-lg flex items-center gap-2 mb-6",style:{color:s?"white":"black"},children:[e.jsx(Ct,{className:"w-5 h-5 text-teal-400"})," Embedded Dashboards"]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 sm:gap-6 mb-6 relative z-10",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-semibold text-gray-400 mb-2 uppercase tracking-wider",children:"Widget Target"}),e.jsxs("select",{value:$,onChange:t=>ze(t.target.value),className:`w-full p-3 rounded-xl border focus:outline-none focus:ring-1 focus:ring-teal-500 text-sm ${s?"bg-black/40 border-white/10 text-white":"bg-gray-50 border-gray-200 text-black"}`,children:[e.jsx("option",{value:"full-dashboard",children:"Full Dashboard"}),e.jsx("option",{value:"ml-predictions",children:"ML Predictions Chart"}),e.jsx("option",{value:"data-hub",children:"Data Hub Browser"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-semibold text-gray-400 mb-2 uppercase tracking-wider",children:"Appearance"}),e.jsxs("select",{value:C,onChange:t=>We(t.target.value),className:`w-full p-3 rounded-xl border focus:outline-none focus:ring-1 focus:ring-teal-500 text-sm ${s?"bg-black/40 border-white/10 text-white":"bg-gray-50 border-gray-200 text-black"}`,children:[e.jsx("option",{value:"dark",children:"Dark Theme (Premium)"}),e.jsx("option",{value:"light",children:"Light Theme (Clean)"}),e.jsx("option",{value:"system",children:"Auto Match System"})]})]})]}),e.jsxs("div",{className:"relative group z-10",children:[e.jsx("div",{className:"absolute right-3 top-3 flex gap-2 opacity-0 group-hover:opacity-100 transition-opacity",children:e.jsxs("button",{onClick:Ve,className:"px-3 py-1.5 rounded-lg bg-teal-600 hover:bg-teal-700 text-white text-xs font-semibold flex items-center gap-1.5 shadow-md",children:[D?e.jsx(u,{className:"w-3.5 h-3.5"}):e.jsx(T,{className:"w-3.5 h-3.5"}),D?"Copied":"Copy"]})}),e.jsxs("pre",{className:`p-5 rounded-2xl border overflow-x-auto text-sm font-mono leading-relaxed transition-all ${s?"bg-[#0d1117] border-white/5 text-gray-300":"bg-gray-100 border-gray-200 text-gray-800"}`,children:[e.jsx("code",{className:"text-teal-400",children:""})]})]})]})]}),e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsxs(m.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},className:`p-5 sm:p-6 rounded-3xl border shadow-lg ${s?"bg-zinc-900/50 border-white/5 backdrop-blur-xl":"bg-white border-gray-200/60 shadow-sm"}`,children:[e.jsxs("h3",{className:"font-bold text-base flex items-center gap-2 mb-4",style:{color:s?"#f8fafc":"#0f172a"},children:[e.jsx($t,{className:"w-4 h-4 text-indigo-400"})," Webhook Management"]}),e.jsx("p",{className:"text-xs text-gray-500 mb-4 pb-4 border-b",style:{borderColor:s?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},children:"Get real-time HTTP callbacks when async jobs complete."}),e.jsx("div",{className:"space-y-3 mb-4",children:Array.isArray(K)&&K.map(t=>e.jsxs("div",{className:`p-3 rounded-xl border text-xs ${s?"bg-black/40 border-white/10":"bg-gray-50 border-gray-200"}`,children:[e.jsxs("div",{className:"flex justify-between items-center mb-1.5",children:[e.jsx("span",{className:"font-semibold",style:{color:s?"white":"black"},children:t.url}),e.jsx("span",{className:"px-1.5 py-0.5 bg-emerald-500/20 text-emerald-400 rounded-md text-[10px] uppercase font-bold tracking-widest",children:t.status})]}),e.jsx("div",{className:"flex gap-1 flex-wrap",children:Array.isArray(t.events)&&t.events.map(a=>e.jsx("span",{className:"px-2 py-0.5 rounded-full bg-indigo-500/20 text-indigo-400 text-[10px]",children:a},a))}),e.jsxs("div",{className:"mt-2 pt-2 border-t flex justify-between items-center",style:{borderColor:s?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},children:[e.jsx("button",{onClick:()=>Ke(t.id),className:"text-xs font-bold text-indigo-400 hover:text-indigo-300 transition-colors",children:Ue[t.id]?"Loading...":g[t.id]?"Hide Logs":"View Logs"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{onClick:()=>Ge(t.id),disabled:W===t.id,className:`text-xs font-bold px-3 py-1.5 rounded flex items-center gap-1.5 transition-colors ${k===t.id?"bg-emerald-500 text-white":s?"bg-indigo-600 hover:bg-indigo-500 text-white":"bg-indigo-600 hover:bg-indigo-700 text-white"}`,children:[W===t.id?e.jsx(L,{className:"w-3.5 h-3.5 animate-spin"}):k===t.id?e.jsx(u,{className:"w-3.5 h-3.5"}):e.jsx(ct,{className:"w-3.5 h-3.5"}),k===t.id?"PING SENT":"PING TEST"]}),e.jsx("button",{onClick:()=>Re(t.id),className:`px-2 py-1.5 rounded-lg transition-all ${s?"bg-red-500/10 hover:bg-red-500/20 text-red-400":"bg-red-50 hover:bg-red-100 text-red-600"}`,title:"Delete Webhook",children:e.jsx(xt,{className:"w-4 h-4"})})]})]}),g[t.id]&&e.jsx("div",{className:`mt-2 p-2 rounded max-h-40 overflow-y-auto border ${s?"bg-black/40 border-white/5":"bg-white border-gray-100"}`,children:g[t.id].length===0?e.jsx("div",{className:"text-[10px] text-gray-500 text-center",children:"No deliveries yet."}):g[t.id].map(a=>e.jsxs("div",{className:`flex justify-between items-center text-[10px] py-1.5 border-b last:border-0 ${s?"border-white/5":"border-gray-100"}`,children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:`px-1.5 py-0.5 rounded text-[9px] font-bold ${a.success?"bg-emerald-500/20 text-emerald-500":"bg-red-500/20 text-red-500"}`,children:a.status_code||(a.success?"200":"ERR")}),e.jsx("span",{className:s?"text-gray-300":"text-gray-700",children:a.event})]}),e.jsx("div",{className:"text-gray-500",children:Ce(a.timestamp)})]},a.id))})]},t.id))}),e.jsxs("div",{className:"mt-4 pt-4 border-t",style:{borderColor:s?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},children:[e.jsx("input",{type:"text",value:f,onChange:t=>G(t.target.value),placeholder:"https://your-domain.com/webhook",className:`w-full px-3 py-2 text-xs rounded-lg border mb-2 outline-none focus:ring-1 focus:ring-indigo-500 ${s?"bg-black/50 border-white/10 text-white":"bg-white border-gray-300 text-black"}`}),e.jsx("button",{onClick:Ee,disabled:!f.trim(),className:"w-full py-2 rounded-lg bg-indigo-600 hover:bg-indigo-700 text-white text-xs font-bold disabled:opacity-50 transition-colors",children:"Add Endpoint"})]})]}),e.jsxs(m.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},transition:{delay:.1},className:`p-5 sm:p-6 rounded-3xl border shadow-lg ${s?"bg-zinc-900/50 border-white/5 backdrop-blur-xl":"bg-white border-gray-200/60 shadow-sm"}`,children:[e.jsxs("h3",{className:"font-bold text-base flex items-center gap-2",style:{color:s?"#f8fafc":"#0f172a"},children:[e.jsx(_,{className:"w-4 h-4 text-indigo-400"})," Interactive API Docs"]}),e.jsx("p",{className:"text-xs text-gray-500 mt-2 mb-4 pb-4 border-b",style:{borderColor:s?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},children:"Explore the full OpenAPI 3.0 specification."}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("a",{href:"/docs",target:"_blank",rel:"noopener noreferrer",className:`p-3 rounded-xl border flex items-center justify-between cursor-pointer group transition-colors ${s?"bg-black/40 border-white/10 hover:border-indigo-500/50":"bg-gray-50 border-gray-200 hover:border-indigo-300"}`,children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(At,{className:"w-4 h-4 text-purple-400"}),e.jsx("span",{className:"text-sm font-semibold",style:{color:s?"white":"black"},children:"Autopilot API"})]}),e.jsx("span",{className:"text-xs text-gray-400 group-hover:text-indigo-400",children:"View →"})]}),e.jsxs("a",{href:"/docs",target:"_blank",rel:"noopener noreferrer",className:`p-3 rounded-xl border flex items-center justify-between cursor-pointer group transition-colors ${s?"bg-black/40 border-white/10 hover:border-indigo-500/50":"bg-gray-50 border-gray-200 hover:border-indigo-300"}`,children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_t,{className:"w-4 h-4 text-emerald-400"}),e.jsx("span",{className:"text-sm font-semibold",style:{color:s?"white":"black"},children:"Decision Swarm"})]}),e.jsx("span",{className:"text-xs text-gray-400 group-hover:text-indigo-400",children:"View →"})]})]}),e.jsx("a",{href:"/docs",target:"_blank",rel:"noopener noreferrer",className:"w-full mt-6 py-2.5 rounded-xl border border-indigo-500/30 text-indigo-400 text-xs font-semibold hover:bg-indigo-500/10 transition-colors flex items-center justify-center block text-center",children:"Open Swagger UI"})]})]})]})]})};export{ss as default};