module.exports=[6870,a=>{"use strict";var b=a.i(87924),c=a.i(38246),d=a.i(50944),e=a.i(72131);function f(){let a=(0,d.useParams)().botId,[f,g]=(0,e.useState)(null),[h,i]=(0,e.useState)(!0),[j,k]=(0,e.useState)(!1);async function l(){if(!f)return;k(!0);let b="active"===f.status?"paused":"active";try{(await fetch(`/api/bots/${a}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:b})})).ok&&g(a=>a?{...a,status:b}:a)}catch(a){console.error(a)}k(!1)}if((0,e.useEffect)(()=>{fetch(`/api/bots/${a}`).then(a=>a.json()).then(g).catch(console.error).finally(()=>i(!1))},[a]),h)return(0,b.jsx)("div",{className:"py-12 text-center text-[var(--color-text-secondary)]",children:"Loading..."});if(!f)return(0,b.jsx)("div",{className:"py-12 text-center text-red-500",children:"Bot not found"});let m="https://aeye.lk";return(0,b.jsxs)("div",{className:"space-y-6",children:[(0,b.jsxs)("div",{className:"flex flex-col gap-3 md:flex-row md:items-center md:justify-between",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"text-sm font-semibold text-[var(--color-text-secondary)]",children:"Bot overview"}),(0,b.jsx)("h1",{className:"font-display text-3xl font-bold",children:f.name}),(0,b.jsxs)("p",{className:"text-[var(--color-text-secondary)]",children:[f.config?.goal||"Not configured"," · Updated ",new Date(f.updatedAt).toLocaleDateString()]})]}),(0,b.jsx)("button",{onClick:l,disabled:j,className:`inline-flex items-center rounded-xl px-5 py-2.5 text-sm font-semibold transition ${"active"===f.status?"border border-[var(--color-border-subtle)] text-[var(--color-text-main)] hover:bg-[var(--color-bg-soft)]":"bg-[var(--color-bg-brand)] text-white hover:bg-[var(--color-bg-brand-light)]"}`,children:"active"===f.status?"Pause bot":"Activate bot"})]}),(0,b.jsxs)("div",{className:"grid gap-4 md:grid-cols-3",children:[(0,b.jsxs)("div",{className:"rounded-2xl border border-[var(--color-border-light)] bg-white p-5 shadow-sm",children:[(0,b.jsx)("p",{className:"text-sm font-semibold text-[var(--color-text-secondary)]",children:"Widget snippet"}),(0,b.jsx)("p",{className:"mt-1 text-xs text-[var(--color-text-secondary)]",children:"Add this to your website before </body>"}),(0,b.jsx)("code",{className:"mt-3 block overflow-x-auto rounded-xl bg-[#1a1a2e] p-3 text-xs leading-relaxed text-slate-300",children:`<script src="${m}/widget.js" data-bot-id="${a}" data-base-url="${m}"></script>`})]}),(0,b.jsxs)("div",{className:"rounded-2xl border border-[var(--color-border-light)] bg-white p-5 shadow-sm",children:[(0,b.jsx)("p",{className:"text-sm font-semibold text-[var(--color-text-secondary)]",children:"Knowledge base"}),(0,b.jsx)("p",{className:"mt-1 text-sm text-[var(--color-text-secondary)]",children:"Add URLs and documents for your bot to reference."}),(0,b.jsx)(c.default,{href:`/dashboard/bots/${a}/knowledge`,className:"mt-3 inline-block text-sm font-semibold text-[var(--color-bg-brand)]",children:"Manage knowledge →"})]}),(0,b.jsxs)("div",{className:"rounded-2xl border border-[var(--color-border-light)] bg-white p-5 shadow-sm",children:[(0,b.jsx)("p",{className:"text-sm font-semibold text-[var(--color-text-secondary)]",children:"Questionnaire"}),(0,b.jsx)("p",{className:"mt-1 text-sm text-[var(--color-text-secondary)]",children:"Configure your bot's personality, rules, and goals."}),(0,b.jsx)(c.default,{href:`/dashboard/bots/${a}/questionnaire`,className:"mt-3 inline-block text-sm font-semibold text-[var(--color-bg-brand)]",children:"Open questionnaire →"})]})]}),f.systemPrompt&&(0,b.jsxs)("div",{className:"rounded-2xl border border-[var(--color-border-light)] bg-white p-5 shadow-sm",children:[(0,b.jsx)("p",{className:"text-sm font-semibold text-[var(--color-text-secondary)]",children:"Generated system prompt"}),(0,b.jsx)("pre",{className:"mt-3 max-h-48 overflow-auto rounded-xl bg-[var(--color-bg-soft)] p-4 text-xs leading-relaxed text-[var(--color-text-secondary)]",children:f.systemPrompt})]})]})}a.s(["default",()=>f])}];

//# sourceMappingURL=src_app_%28app%29_dashboard_bots_%5BbotId%5D_page_tsx_6033fadd._.js.map