(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,74433,e=>{"use strict";var t=e.i(43476),s=e.i(22016),r=e.i(18566),o=e.i(71645);function a(){let e=(0,r.useParams)().botId,[a,d]=(0,o.useState)(null),[l,c]=(0,o.useState)(!0),[n,i]=(0,o.useState)(!1);async function x(){if(!a)return;i(!0);let t="active"===a.status?"paused":"active";try{(await fetch(`/api/bots/${e}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:t})})).ok&&d(e=>e?{...e,status:t}:e)}catch(e){console.error(e)}i(!1)}if((0,o.useEffect)(()=>{fetch(`/api/bots/${e}`).then(e=>e.json()).then(d).catch(console.error).finally(()=>c(!1))},[e]),l)return(0,t.jsx)("div",{className:"py-12 text-center text-[var(--color-text-secondary)]",children:"Loading..."});if(!a)return(0,t.jsx)("div",{className:"py-12 text-center text-red-500",children:"Bot not found"});let m="https://aeye.lk";return(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:"Bot overview"}),(0,t.jsx)("h1",{className:"font-display text-3xl font-bold",children:a.name}),(0,t.jsxs)("p",{className:"text-[var(--color-text-secondary)]",children:[a.config?.goal||"Not configured"," · Updated ",new Date(a.updatedAt).toLocaleDateString()]})]}),(0,t.jsx)("button",{onClick:x,disabled:n,className:`inline-flex items-center rounded-xl px-5 py-2.5 text-sm font-semibold transition ${"active"===a.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"===a.status?"Pause bot":"Activate bot"})]}),(0,t.jsxs)("div",{className:"grid gap-4 md:grid-cols-3",children:[(0,t.jsxs)("div",{className:"rounded-2xl border border-[var(--color-border-light)] bg-white p-5 shadow-sm",children:[(0,t.jsx)("p",{className:"text-sm font-semibold text-[var(--color-text-secondary)]",children:"Widget snippet"}),(0,t.jsx)("p",{className:"mt-1 text-xs text-[var(--color-text-secondary)]",children:"Add this to your website before </body>"}),(0,t.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="${e}" data-base-url="${m}"></script>`})]}),(0,t.jsxs)("div",{className:"rounded-2xl border border-[var(--color-border-light)] bg-white p-5 shadow-sm",children:[(0,t.jsx)("p",{className:"text-sm font-semibold text-[var(--color-text-secondary)]",children:"Knowledge base"}),(0,t.jsx)("p",{className:"mt-1 text-sm text-[var(--color-text-secondary)]",children:"Add URLs and documents for your bot to reference."}),(0,t.jsx)(s.default,{href:`/dashboard/bots/${e}/knowledge`,className:"mt-3 inline-block text-sm font-semibold text-[var(--color-bg-brand)]",children:"Manage knowledge →"})]}),(0,t.jsxs)("div",{className:"rounded-2xl border border-[var(--color-border-light)] bg-white p-5 shadow-sm",children:[(0,t.jsx)("p",{className:"text-sm font-semibold text-[var(--color-text-secondary)]",children:"Questionnaire"}),(0,t.jsx)("p",{className:"mt-1 text-sm text-[var(--color-text-secondary)]",children:"Configure your bot's personality, rules, and goals."}),(0,t.jsx)(s.default,{href:`/dashboard/bots/${e}/questionnaire`,className:"mt-3 inline-block text-sm font-semibold text-[var(--color-bg-brand)]",children:"Open questionnaire →"})]})]}),a.systemPrompt&&(0,t.jsxs)("div",{className:"rounded-2xl border border-[var(--color-border-light)] bg-white p-5 shadow-sm",children:[(0,t.jsx)("p",{className:"text-sm font-semibold text-[var(--color-text-secondary)]",children:"Generated system prompt"}),(0,t.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:a.systemPrompt})]})]})}e.s(["default",()=>a])}]);