(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,60812,e=>{"use strict";var t=e.i(43476),s=e.i(22016),a=e.i(71645);function o(){let[e,o]=(0,a.useState)([]),[r,l]=(0,a.useState)(!0),[d,c]=(0,a.useState)(!1);async function n(){c(!0);try{let e=await fetch("/api/bots",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:"New Bot"})}),t=await e.json();e.ok?o(e=>[t,...e]):alert(t.error)}catch(e){console.error(e)}c(!1)}return(0,a.useEffect)(()=>{fetch("/api/bots").then(e=>e.json()).then(o).catch(console.error).finally(()=>l(!1))},[]),(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-3 md:flex-row md:items-center md:justify-between",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-sm font-semibold text-[var(--color-text-secondary)]",children:"Bots"}),(0,t.jsx)("h1",{className:"font-display text-3xl font-bold",children:"Your bots"}),(0,t.jsx)("p",{className:"text-[var(--color-text-secondary)]",children:"Manage status, widget snippets, and knowledge bases."})]}),(0,t.jsx)("button",{onClick:n,disabled:d,className:"inline-flex items-center rounded-xl bg-[var(--color-bg-brand)] px-5 py-3 text-sm font-semibold text-white shadow-sm transition hover:bg-[var(--color-bg-brand-light)] disabled:opacity-50",children:d?"Creating...":"Create bot"})]}),r?(0,t.jsx)("div",{className:"py-12 text-center text-[var(--color-text-secondary)]",children:"Loading bots..."}):0===e.length?(0,t.jsxs)("div",{className:"rounded-2xl border border-[var(--color-border-light)] bg-white p-12 text-center shadow-sm",children:[(0,t.jsx)("p",{className:"text-lg font-semibold",children:"No bots yet"}),(0,t.jsx)("p",{className:"mt-1 text-sm text-[var(--color-text-secondary)]",children:"Create your first chatbot to get started."}),(0,t.jsx)("button",{onClick:n,className:"mt-4 inline-flex items-center rounded-xl bg-[var(--color-bg-brand)] px-5 py-3 text-sm font-semibold text-white transition hover:bg-[var(--color-bg-brand-light)]",children:"Create your first bot"})]}):(0,t.jsx)("div",{className:"overflow-hidden rounded-2xl border border-[var(--color-border-light)] bg-white shadow-sm",children:(0,t.jsxs)("table",{className:"min-w-full",children:[(0,t.jsx)("thead",{className:"bg-[var(--color-bg-soft)] text-left text-sm text-[var(--color-text-secondary)]",children:(0,t.jsxs)("tr",{children:[(0,t.jsx)("th",{className:"px-4 py-3 font-semibold",children:"Name"}),(0,t.jsx)("th",{className:"px-4 py-3 font-semibold",children:"Goal"}),(0,t.jsx)("th",{className:"px-4 py-3 font-semibold",children:"Status"}),(0,t.jsx)("th",{className:"px-4 py-3 font-semibold",children:"Updated"}),(0,t.jsx)("th",{className:"px-4 py-3 font-semibold",children:"Actions"})]})}),(0,t.jsx)("tbody",{className:"divide-y divide-[var(--color-border-light)] text-sm",children:e.map(e=>(0,t.jsxs)("tr",{className:"hover:bg-[var(--color-bg-soft)]",children:[(0,t.jsx)("td",{className:"px-4 py-3 font-semibold",children:e.name}),(0,t.jsx)("td",{className:"px-4 py-3 text-[var(--color-text-secondary)]",children:e.config?.goal||"Not set"}),(0,t.jsx)("td",{className:"px-4 py-3",children:(0,t.jsx)("span",{className:`rounded-full px-2 py-1 text-xs font-semibold text-white ${"active"===e.status?"bg-[var(--color-accent-green)]":"bg-slate-400"}`,children:e.status})}),(0,t.jsx)("td",{className:"px-4 py-3 text-[var(--color-text-secondary)]",children:new Date(e.updatedAt).toLocaleDateString()}),(0,t.jsx)("td",{className:"px-4 py-3",children:(0,t.jsx)(s.default,{href:`/dashboard/bots/${e._id}`,className:"text-sm font-semibold text-[var(--color-bg-brand)]",children:"Open"})})]},e._id))})]})})]})}e.s(["default",()=>o])}]);