@bricks2k/governance 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +51 -0
- package/README.md +357 -0
- package/dist/index.cjs +29 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.esm.js +2603 -0
- package/dist/index.esm.js.map +1 -0
- package/package.json +56 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),ye=require("react-router-dom"),C=require("lucide-react"),m=require("react");function O({tabs:s,activeTab:r,onTabChange:t,onRefresh:l,isRefreshing:a,refreshSuccess:o,children:i}){const d=ye.useNavigate();return e.jsxs("div",{className:"min-h-screen bg-slate-900",children:[e.jsx("header",{className:"bg-slate-800 border-b border-slate-700 sticky top-0 z-30",children:e.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:[e.jsxs("div",{className:"flex items-center justify-between h-16",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("button",{onClick:()=>d("/"),className:"p-2 text-slate-400 hover:text-slate-200 hover:bg-slate-700 rounded-lg transition-colors",children:e.jsx(C.ChevronLeft,{className:"w-5 h-5"})}),e.jsx("h1",{className:"text-xl font-bold text-slate-100",children:"🛠️ Dev Dashboard"})]}),l&&e.jsx("button",{onClick:l,disabled:a,className:`
|
|
2
|
+
flex items-center gap-2 px-4 py-2 rounded-lg font-medium text-sm
|
|
3
|
+
transition-colors duration-200
|
|
4
|
+
${o?"bg-green-600 text-white":"bg-blue-600 text-white hover:bg-blue-700"}
|
|
5
|
+
${a?"opacity-50 cursor-not-allowed":""}
|
|
6
|
+
`,children:o?e.jsxs(e.Fragment,{children:[e.jsx(C.Check,{className:"w-4 h-4"}),"Atualizado!"]}):e.jsxs(e.Fragment,{children:[e.jsx(C.RefreshCw,{className:`w-4 h-4 ${a?"animate-spin":""}`}),a?"Atualizando...":"Atualizar Dados"]})})]}),e.jsx("div",{className:"flex gap-1 -mb-px overflow-x-auto scrollbar-thin",children:s.map(n=>e.jsxs("button",{onClick:()=>t(n.id),className:`px-4 py-3 text-sm font-medium whitespace-nowrap transition-colors border-b-2 ${r===n.id?"border-emerald-500 text-emerald-400":"border-transparent text-slate-400 hover:text-slate-300 hover:border-slate-600"}`,children:[e.jsx("span",{className:"mr-2",children:n.icon}),n.label]},n.id))})]})}),e.jsx("main",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8",children:i})]})}function E({title:s,value:r,subtitle:t,icon:l,trend:a="neutral"}){const o={success:"text-emerald-400",danger:"text-red-400",warning:"text-amber-400",neutral:"text-slate-400"};return e.jsxs("div",{className:"bg-slate-800 border border-slate-700 rounded-lg p-6",children:[e.jsxs("div",{className:"flex items-start justify-between mb-4",children:[e.jsx("span",{className:"text-3xl",children:l}),e.jsx("span",{className:`text-2xl font-bold ${o[a]}`,children:r})]}),e.jsx("h3",{className:"text-slate-300 font-medium mb-1",children:s}),e.jsx("p",{className:"text-sm text-slate-500",children:t})]})}function q({score:s}){const t=(l=>l>=80?{bg:"bg-emerald-500",text:"text-emerald-400"}:l>=60?{bg:"bg-amber-500",text:"text-amber-400"}:{bg:"bg-red-500",text:"text-red-400"})(s);return e.jsx("div",{className:"bg-gradient-to-r from-slate-800 to-slate-700 border border-slate-600 rounded-lg p-8",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg text-slate-400 mb-2",children:"Project Health Score"}),e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsx("span",{className:`text-6xl font-bold ${t.text}`,children:s}),e.jsx("span",{className:"text-2xl text-slate-500",children:"/100"})]}),e.jsx("p",{className:"text-sm text-slate-500 mt-2",children:"Baseado em débitos técnicos, cobertura de testes e docs"})]}),e.jsx("div",{className:"relative w-32 h-32",children:e.jsxs("svg",{className:"transform -rotate-90",viewBox:"0 0 120 120",children:[e.jsx("circle",{cx:"60",cy:"60",r:"50",stroke:"currentColor",strokeWidth:"10",fill:"none",className:"text-slate-700"}),e.jsx("circle",{cx:"60",cy:"60",r:"50",stroke:"currentColor",strokeWidth:"10",fill:"none",strokeDasharray:`${s*3.14} 314`,className:t.bg.replace("bg-","text-"),strokeLinecap:"round"})]})})]})})}function K({stack:s}){const r=[{label:"Frontend",value:s.frontend,icon:"⚛️"},{label:"Backend",value:s.backend,icon:"🔥"},{label:"Database",value:s.database,icon:"🗄️"},{label:"Styling",value:s.styling,icon:"🎨"}];return e.jsxs("div",{className:"bg-slate-800 border border-slate-700 rounded-lg p-6",children:[e.jsx("h3",{className:"text-lg font-semibold text-slate-100 mb-4",children:"Tech Stack"}),e.jsx("div",{className:"space-y-3",children:r.map((t,l)=>e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-2xl",children:t.icon}),e.jsx("span",{className:"text-sm text-slate-400",children:t.label})]}),e.jsx("span",{className:"text-sm font-medium text-slate-200",children:t.value})]},l))})]})}function U(s){const r=s.split(/\r?\n/).map(a=>a.trimEnd()),t=[];r.forEach(a=>{if(a.trim().startsWith("| TD-")){const i=a.split("|").map(d=>d.trim()).filter(Boolean);i.length>=8&&t.push({id:i[0],description:i[1],severity:i[2],trigger:i[3],location:i[4],owner:i[5],status:i[6],created:i[7]})}});const l={total:t.length,pending:t.filter(a=>a.status.includes("Pendente")||a.status.includes("⏳")).length,critical:t.filter(a=>a.severity.includes("🔴")||a.severity.includes("Crítico")).length,high:t.filter(a=>a.severity.includes("🟠")||a.severity.includes("Alto")).length,medium:t.filter(a=>a.severity.includes("🟡")||a.severity.includes("Médio")).length,low:t.filter(a=>a.severity.includes("🟢")||a.severity.includes("Baixo")).length};return{debts:t,stats:l}}function V(s){const r=s.split(/\r?\n/).map(a=>a.trimEnd()),t=[];r.forEach(a=>{if(a.trim().startsWith("| BL-")){const i=a.split("|").map(d=>d.trim()).filter(Boolean);i.length>=7&&t.push({id:i[0],title:i[1],category:i[2],status:i[3],owner:i[4],estimate:i[5],created:i[6]})}});const l={total:t.length,highPriority:t.filter(()=>s.includes("🔴 Alta Prioridade")).length,mediumPriority:t.filter(()=>s.includes("🟡 Média Prioridade")).length,lowPriority:t.filter(()=>s.includes("🟢 Baixa Prioridade")).length,backlog:t.filter(a=>a.status.includes("📋")).length,planned:t.filter(a=>a.status.includes("📅")).length,doing:t.filter(a=>a.status.includes("🚧")).length,done:t.filter(a=>a.status.includes("✅")).length};return{items:t,stats:l}}function G(s){const r=[],t=s.split(/\r?\n/).map(o=>o.trimEnd());let l=null,a=[];return t.forEach(o=>{var d,n,c;const i=o.match(/^#\s+(\d{4}-\d{2}-\d{2}T[\d:.]+Z):\s*(.+)$/);i?(l&&(l.content=a.join(`
|
|
7
|
+
`),r.push(l)),l={timestamp:i[1],title:i[2].trim(),content:"",module:"",type:"",author:""},a=[]):l&&o.trim()!==""&&!o.includes("<!-- ")&&o!=="---"&&(o.includes("**Módulo:**")?l.module=((d=o.split("**Módulo:**")[1])==null?void 0:d.trim().replace(/^-\s*/,""))||"":o.includes("**Tipo:**")?l.type=((n=o.split("**Tipo:**")[1])==null?void 0:n.trim().replace(/^-\s*/,""))||"":o.includes("**Responsável:**")&&(l.author=((c=o.split("**Responsável:**")[1])==null?void 0:c.trim().replace(/^-\s*/,""))||""),a.push(o))}),l&&(l.content=a.join(`
|
|
8
|
+
`),r.push(l)),r}function H(s,r){let t=100;return t-=s.critical*10,t-=s.high*5,t-=s.pending*2,r.total>0&&(t+=5),Math.max(0,Math.min(100,t))}function W(s){return s.includes("✨")||s.includes("Feature")?"✨":s.includes("⚡")||s.includes("Improvement")?"⚡":s.includes("🔬")||s.includes("Research")?"🔬":s.includes("🔗")||s.includes("Integration")?"🔗":s.includes("🎨")||s.includes("UI/UX")?"🎨":"📦"}function Q(s){return s.includes("🔴")||s.includes("Crítico")?"🔴":s.includes("🟠")||s.includes("Alto")?"🟠":s.includes("🟡")||s.includes("Médio")?"🟡":s.includes("🟢")||s.includes("Baixo")?"🟢":"⚪"}function Ce(s){return s.includes("🔴")||s.includes("Crítico")?"Crítico":s.includes("🟠")||s.includes("Alto")?"Alto":s.includes("🟡")||s.includes("Médio")?"Médio":s.includes("🟢")||s.includes("Baixo")?"Baixo":"Desconhecido"}function z(s){return s.includes("🔴")||s.includes("Crítico")?"bg-red-500/20 text-red-400 border-red-500/20":s.includes("🟠")||s.includes("Alto")?"bg-orange-500/20 text-orange-400 border-orange-500/20":s.includes("🟡")||s.includes("Médio")?"bg-amber-500/20 text-amber-400 border-amber-500/20":s.includes("🟢")||s.includes("Baixo")?"bg-emerald-500/20 text-emerald-400 border-emerald-500/20":"bg-slate-700 text-slate-400"}function Y(s,r){const t=s.split(/\r?\n/).map(d=>d.trimEnd()),l={};let a=0;for(let d=0;d<t.length;d++){const n=t[d];if(n.startsWith("> **")){const c=n.match(/\*\*(.+?):\*\*\s*(.+)/);c&&(l[c[1]]=c[2].trim())}else if(n.trim()==="---"){a=d+1;break}}let o=0,i=0;return t.forEach(d=>{d.includes("- [ ]")&&o++,(d.includes("- [x]")||d.includes("- [X]"))&&(o++,i++)}),{filename:r,title:l.Contexto||r.replace("PLAN_","").replace(".md",""),status:l.Status||"📋 Proposta",author:l.Autor||"Desconhecido",date:l.Data||"",priority:l.Prioridade||"🟡 Média",totalTasks:o,completedTasks:i,progress:o>0?Math.round(i/o*100):0,content:t.slice(a).join(`
|
|
9
|
+
`)}}function J(s){const r=[],t=s.split(/\r?\n/).map(o=>o.trimEnd());let l=null,a=[];return t.forEach(o=>{var d,n,c,x;const i=o.match(/^#\s+(\d{4}-\d{2}-\d{2}T[\d:.]+Z):\s*(.+)$/);i?(l&&(l.content=a.join(`
|
|
10
|
+
`),r.push(l)),l={timestamp:i[1],title:i[2].trim(),content:"",type:"decision",context:"",decision:"",alternatives:[],consequences:"",author:""},a=[]):l&&o.trim()!==""&&!o.includes("<!-- ")&&o!=="---"&&(o.includes("**Tipo:**")?l.type=((d=o.split("**Tipo:**")[1])==null?void 0:d.trim().replace(/^-\s*/,""))||"decision":o.includes("**Contexto:**")?l.context=((n=o.split("**Contexto:**")[1])==null?void 0:n.trim().replace(/^-\s*/,""))||"":o.includes("**Decisão:**")?l.decision=((c=o.split("**Decisão:**")[1])==null?void 0:c.trim().replace(/^-\s*/,""))||"":o.includes("**Responsável:**")&&(l.author=((x=o.split("**Responsável:**")[1])==null?void 0:x.trim().replace(/^-\s*/,""))||""),a.push(o))}),l&&(l.content=a.join(`
|
|
11
|
+
`),r.push(l)),r}function X(s){const r=[];if(s.architecture){const t=G(s.architecture);r.push(...t.map(l=>({...l,logType:"architecture",icon:"🏗️"})))}if(s.decisions){const t=J(s.decisions);r.push(...t.map(l=>({...l,logType:"decisions",icon:"📝"})))}return r.sort((t,l)=>new Date(l.timestamp)-new Date(t.timestamp)),r}function we(s){return s.includes("🔴")||s.includes("Alta")?"bg-red-500/20 text-red-400 border-red-500/20":s.includes("🟡")||s.includes("Média")?"bg-amber-500/20 text-amber-400 border-amber-500/20":s.includes("🟢")||s.includes("Baixa")?"bg-emerald-500/20 text-emerald-400 border-emerald-500/20":"bg-slate-700 text-slate-400"}function Z(s){return s.includes("📋")?"bg-slate-600 text-slate-300":s.includes("📅")?"bg-blue-600 text-blue-200":s.includes("🚧")?"bg-amber-600 text-amber-200":s.includes("✅")?"bg-emerald-600 text-emerald-200":"bg-slate-700 text-slate-400"}function P(s){try{return new Date(s).toLocaleDateString("pt-BR",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}catch{return s}}function ee({activities:s}){return!s||s.length===0?e.jsxs("div",{className:"bg-slate-800 border border-slate-700 rounded-lg p-6",children:[e.jsx("h3",{className:"text-lg font-semibold text-slate-100 mb-4",children:"Atividades Recentes"}),e.jsx("p",{className:"text-sm text-slate-500",children:"Nenhuma atividade registrada"})]}):e.jsxs("div",{className:"bg-slate-800 border border-slate-700 rounded-lg p-6",children:[e.jsx("h3",{className:"text-lg font-semibold text-slate-100 mb-4",children:"Atividades Recentes"}),e.jsx("div",{className:"space-y-4",children:s.slice(0,5).map((r,t)=>e.jsxs("div",{className:"flex gap-3 border-b border-slate-700 pb-3 last:border-0 last:pb-0",children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx("span",{className:"text-xl",children:r.icon})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium text-slate-200 truncate",children:r.title}),e.jsx("p",{className:"text-xs text-slate-500 mt-1",children:P(r.timestamp)})]})]},t))})]})}function se({onTabChange:s}){const r=[{label:"Ver Architecture",icon:C.FileText,onClick:()=>s==null?void 0:s("architecture"),color:"emerald"},{label:"Ver Logs",icon:C.GitBranch,onClick:()=>s==null?void 0:s("logs"),color:"blue"},{label:"Tech Debt",icon:C.AlertTriangle,onClick:()=>s==null?void 0:s("techdebt"),color:"amber"},{label:"Backlog",icon:C.Target,onClick:()=>s==null?void 0:s("backlog"),color:"purple"}],t={emerald:"bg-emerald-500/10 text-emerald-400 hover:bg-emerald-500/20 border-emerald-500/30",blue:"bg-blue-500/10 text-blue-400 hover:bg-blue-500/20 border-blue-500/30",amber:"bg-amber-500/10 text-amber-400 hover:bg-amber-500/20 border-amber-500/30",purple:"bg-purple-500/10 text-purple-400 hover:bg-purple-500/20 border-purple-500/30"};return e.jsxs("div",{className:"bg-slate-800 border border-slate-700 rounded-lg p-6",children:[e.jsx("h3",{className:"text-lg font-semibold text-slate-100 mb-4",children:"Ações Rápidas"}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:r.map((l,a)=>{const o=l.icon;return e.jsxs("button",{onClick:l.onClick,className:`flex flex-col items-center justify-center p-4 rounded-lg border transition-colors ${t[l.color]} hover:scale-105`,children:[e.jsx(o,{className:"w-6 h-6 mb-2"}),e.jsx("span",{className:"text-sm font-medium",children:l.label})]},a)})})]})}function Se({metrics:s,onTabChange:r}){return s?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold text-slate-100 mb-2",children:"Project Health Overview"}),e.jsx("p",{className:"text-slate-400",children:"Snapshot do estado atual do projeto"})]}),e.jsx(q,{score:s.healthScore}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[e.jsx(E,{title:"Tech Debt",value:s.techDebt.total,subtitle:`${s.techDebt.critical} críticos`,icon:"⚠️",trend:s.techDebt.critical>0?"danger":"success"}),e.jsx(E,{title:"Backlog Items",value:s.backlog.total,subtitle:`${s.backlog.doing} em progresso`,icon:"🎯",trend:"neutral"}),e.jsx(E,{title:"PLANs Ativos",value:12,subtitle:"3 em progresso",icon:"📋",trend:"success"}),e.jsx(E,{title:"Migrations",value:14,subtitle:"Todas aplicadas",icon:"🗄️",trend:"success"})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsx(K,{stack:s.techStack}),e.jsx(ee,{activities:s.recentActivity})]}),e.jsx(se,{onTabChange:r})]}):null}async function L(s,r=null){try{const t=r?`${s}?t=${r}`:s,l=await fetch(t);if(!l.ok)throw new Error(`Failed to fetch ${s}`);return await l.text()}catch(t){return console.error(`Error fetching ${s}:`,t),""}}async function $(s=null){try{const t=await L(`${s?"../docs":"/docs"}/TECHNICAL_DEBT_REGISTRY.md`,s);return U(t)}catch(r){return console.error("Error loading tech debt data:",r),{debts:[],stats:{total:0,pending:0,critical:0,high:0,medium:0,low:0}}}}async function I(s=null){try{const t=await L(`${s?"../docs":"/docs"}/BACKLOG_REGISTRY.md`,s);return V(t)}catch(r){return console.error("Error loading backlog data:",r),{items:[],stats:{total:0,highPriority:0,mediumPriority:0,lowPriority:0,backlog:0,planned:0,doing:0,done:0}}}}async function R(s=null){try{const[r,t]=await Promise.all([L("/.logs/architecture.log.md",s),L("/.logs/decisions.log.md",s)]);return X({architecture:r,decisions:t})}catch(r){return console.error("Error loading logs data:",r),[]}}async function ke(){const s=["PLAN_DEV_DASHBOARD_GOVERNANCE.md","PLAN_TECHNICAL_DEBT_MANAGEMENT.md","PLAN_BACKLOG_MANAGEMENT.md","PLAN_SAAS_INTEGRATION_ARCHITECTURE.md","PLAN_CRM.md","PLAN_CRM_MELHORIAS.md"];try{return(await Promise.all(s.map(async t=>{const l=await L(`/docs/plans/${t}`);return l?Y(l,t):null}))).filter(Boolean)}catch(r){return console.error("Error loading plans data:",r),[]}}async function Te(s=null){try{const[r,t,l]=await Promise.all([$(s),I(s),R(s)]);return{healthScore:H(r.stats,t.stats),techDebt:r.stats,backlog:t.stats,recentActivity:l.slice(0,5),techStack:{frontend:"React 19",backend:"Supabase",database:"PostgreSQL 17",styling:"Tailwind CSS 4"}}}catch(r){return console.error("[ERROR] Error calculating project metrics:",r),{healthScore:0,techDebt:{total:0,pending:0,critical:0,high:0,medium:0,low:0},backlog:{total:0,highPriority:0,mediumPriority:0,lowPriority:0,backlog:0,planned:0,doing:0,done:0},recentActivity:[],techStack:{frontend:"React 19",backend:"Supabase",database:"PostgreSQL 17",styling:"Tailwind CSS 4"}}}}function te({stats:s}){const r=[{label:"Total",value:s.total,color:"slate",icon:"📊"},{label:"Críticos",value:s.critical,color:"red",icon:"🔴"},{label:"Altos",value:s.high,color:"orange",icon:"🟠"},{label:"Médios",value:s.medium,color:"amber",icon:"🟡"},{label:"Baixos",value:s.low,color:"emerald",icon:"🟢"}],t={slate:"bg-slate-700 border-slate-600",red:"bg-red-500/10 border-red-500/30",orange:"bg-orange-500/10 border-orange-500/30",amber:"bg-amber-500/10 border-amber-500/30",emerald:"bg-emerald-500/10 border-emerald-500/30"};return e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-4",children:r.map((l,a)=>e.jsxs("div",{className:`border rounded-lg p-4 ${t[l.color]}`,children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-2xl",children:l.icon}),e.jsx("span",{className:"text-2xl font-bold text-slate-200",children:l.value})]}),e.jsx("p",{className:"text-sm text-slate-400",children:l.label})]},a))})}function ae({filters:s,onFilterChange:r}){const t=o=>{r({...s,severity:o.target.value})},l=o=>{r({...s,status:o.target.value})},a=o=>{r({...s,search:o.target.value})};return e.jsx("div",{className:"bg-slate-800 border border-slate-700 rounded-lg p-4",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-slate-300 mb-2",children:"Severidade"}),e.jsxs("select",{value:s.severity,onChange:t,className:"w-full bg-slate-700 border border-slate-600 text-slate-200 rounded-lg px-3 py-2 focus:ring-2 focus:ring-emerald-500 focus:border-transparent",children:[e.jsx("option",{value:"all",children:"Todas"}),e.jsx("option",{value:"crítico",children:"🔴 Crítico"}),e.jsx("option",{value:"alto",children:"🟠 Alto"}),e.jsx("option",{value:"médio",children:"🟡 Médio"}),e.jsx("option",{value:"baixo",children:"🟢 Baixo"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-slate-300 mb-2",children:"Status"}),e.jsxs("select",{value:s.status,onChange:l,className:"w-full bg-slate-700 border border-slate-600 text-slate-200 rounded-lg px-3 py-2 focus:ring-2 focus:ring-emerald-500 focus:border-transparent",children:[e.jsx("option",{value:"all",children:"Todos"}),e.jsx("option",{value:"pendente",children:"⏳ Pendente"}),e.jsx("option",{value:"resolvido",children:"✅ Resolvido"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-slate-300 mb-2",children:"Buscar"}),e.jsx("input",{type:"text",value:s.search,onChange:a,placeholder:"ID, descrição, arquivo...",className:"w-full bg-slate-700 border border-slate-600 text-slate-200 rounded-lg px-3 py-2 focus:ring-2 focus:ring-emerald-500 focus:border-transparent placeholder-slate-500"})]})]})})}function re({severity:s}){const r=Q(s),t=z(s);return e.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-1 rounded text-xs font-medium border ${t}`,children:[e.jsx("span",{children:r}),e.jsx("span",{children:s})]})}async function Ae(){return{components:25,pages:12,migrations:14,plans:15}}function Ee(s,r){let t;return function(...a){const o=()=>{clearTimeout(t),s(...a)};clearTimeout(t),t=setTimeout(o,r)}}function Le(s,r,...t){if(!r)return s;const l=r.toLowerCase();return s.filter(a=>t.some(o=>{const i=a[o];return i&&String(i).toLowerCase().includes(l)}))}function De(s,r){return s.reduce((t,l)=>{const a=l[r]||"Outros";return t[a]||(t[a]=[]),t[a].push(l),t},{})}async function _(s){try{return await navigator.clipboard.writeText(s),!0}catch(r){return console.error("Failed to copy:",r),!1}}function le({debt:s}){const r=async()=>{await _(s.id)&&console.log(`${s.id} copiado!`)},t=s.status.includes("✅")||s.status.toLowerCase().includes("resolvido");return e.jsxs("div",{className:`bg-slate-800 border rounded-lg p-5 ${t?"border-emerald-500/30 opacity-60":"border-slate-700"}`,children:[e.jsxs("div",{className:"flex items-start justify-between gap-4 mb-3",children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs("button",{onClick:r,className:"flex items-center gap-2 text-sm font-mono font-semibold text-emerald-400 hover:text-emerald-300 transition-colors",title:"Copiar ID",children:[s.id,e.jsx(C.Copy,{className:"w-3 h-3"})]})}),e.jsx(re,{severity:s.severity})]}),e.jsx("p",{className:"text-slate-200 mb-4",children:s.description}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3 text-sm",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-slate-500",children:"Trigger:"}),e.jsx("p",{className:"text-slate-300 font-medium mt-1",children:s.trigger})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-slate-500",children:"Localização:"}),e.jsx("p",{className:"text-slate-300 font-mono text-xs mt-1 truncate",title:s.location,children:s.location})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-slate-500",children:"Owner:"}),e.jsx("p",{className:"text-slate-300 mt-1",children:s.owner})]})]}),e.jsxs("div",{className:"mt-3 pt-3 border-t border-slate-700",children:[e.jsx("span",{className:"text-xs text-slate-500",children:"Status: "}),e.jsx("span",{className:"text-xs text-slate-300",children:s.status}),s.created&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-xs text-slate-600 mx-2",children:"•"}),e.jsx("span",{className:"text-xs text-slate-500",children:"Criado em: "}),e.jsx("span",{className:"text-xs text-slate-400",children:s.created})]})]})]})}function Me(){const[s,r]=m.useState(null),[t,l]=m.useState([]),[a,o]=m.useState({severity:"all",status:"all",search:""}),[i,d]=m.useState(!0);return m.useEffect(()=>{async function n(){try{const c=await $();r(c),l(c.debts)}catch(c){console.error("Error loading tech debt:",c)}finally{d(!1)}}n()},[]),m.useEffect(()=>{if(!s)return;let n=s.debts;if(a.severity!=="all"&&(n=n.filter(c=>c.severity.toLowerCase().includes(a.severity.toLowerCase()))),a.status!=="all"&&(n=n.filter(c=>c.status.toLowerCase().includes(a.status.toLowerCase()))),a.search){const c=a.search.toLowerCase();n=n.filter(x=>x.id.toLowerCase().includes(c)||x.description.toLowerCase().includes(c)||x.location.toLowerCase().includes(c)||x.owner.toLowerCase().includes(c))}l(n)},[a,s]),i?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-emerald-500"})}):s?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold text-slate-100 mb-2",children:"Technical Debt Registry"}),e.jsx("p",{className:"text-slate-400",children:"Débitos técnicos rastreados e priorizados"})]}),e.jsx(te,{stats:s.stats}),e.jsx(ae,{filters:a,onFilterChange:o}),e.jsx("div",{className:"space-y-4",children:t.map(n=>e.jsx(le,{debt:n},n.id))}),t.length===0&&e.jsx("div",{className:"text-center py-12",children:e.jsx("p",{className:"text-slate-500",children:"Nenhum débito técnico encontrado"})})]}):e.jsx("div",{className:"text-center py-12",children:e.jsx("p",{className:"text-slate-500",children:"Erro ao carregar dados"})})}function ne({stats:s}){const r=[{label:"Total",value:s.total,color:"slate",icon:"📊"},{label:"Backlog",value:s.backlog,color:"slate",icon:"📋"},{label:"Planned",value:s.planned,color:"blue",icon:"📅"},{label:"Em Progresso",value:s.doing,color:"amber",icon:"🚧"},{label:"Concluídos",value:s.done,color:"emerald",icon:"✅"}],t={slate:"bg-slate-700 border-slate-600",blue:"bg-blue-500/10 border-blue-500/30",amber:"bg-amber-500/10 border-amber-500/30",emerald:"bg-emerald-500/10 border-emerald-500/30"};return e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-4",children:r.map((l,a)=>e.jsxs("div",{className:`border rounded-lg p-4 ${t[l.color]}`,children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-2xl",children:l.icon}),e.jsx("span",{className:"text-2xl font-bold text-slate-200",children:l.value})]}),e.jsx("p",{className:"text-sm text-slate-400",children:l.label})]},a))})}function oe({filters:s,onFilterChange:r}){const t=o=>{r({...s,status:o.target.value})},l=o=>{r({...s,category:o.target.value})},a=o=>{r({...s,search:o.target.value})};return e.jsx("div",{className:"bg-slate-800 border border-slate-700 rounded-lg p-4",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-slate-300 mb-2",children:"Status"}),e.jsxs("select",{value:s.status,onChange:t,className:"w-full bg-slate-700 border border-slate-600 text-slate-200 rounded-lg px-3 py-2 focus:ring-2 focus:ring-emerald-500 focus:border-transparent",children:[e.jsx("option",{value:"all",children:"Todos"}),e.jsx("option",{value:"backlog",children:"📋 Backlog"}),e.jsx("option",{value:"planned",children:"📅 Planned"}),e.jsx("option",{value:"doing",children:"🚧 Doing"}),e.jsx("option",{value:"done",children:"✅ Done"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-slate-300 mb-2",children:"Categoria"}),e.jsxs("select",{value:s.category,onChange:l,className:"w-full bg-slate-700 border border-slate-600 text-slate-200 rounded-lg px-3 py-2 focus:ring-2 focus:ring-emerald-500 focus:border-transparent",children:[e.jsx("option",{value:"all",children:"Todas"}),e.jsx("option",{value:"feature",children:"✨ Feature"}),e.jsx("option",{value:"improvement",children:"⚡ Improvement"}),e.jsx("option",{value:"research",children:"🔬 Research"}),e.jsx("option",{value:"integration",children:"🔗 Integration"}),e.jsx("option",{value:"ui/ux",children:"🎨 UI/UX"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-slate-300 mb-2",children:"Buscar"}),e.jsx("input",{type:"text",value:s.search,onChange:a,placeholder:"ID, título, owner...",className:"w-full bg-slate-700 border border-slate-600 text-slate-200 rounded-lg px-3 py-2 focus:ring-2 focus:ring-emerald-500 focus:border-transparent placeholder-slate-500"})]})]})})}function ie({category:s}){const r=W(s),l={"✨":"bg-purple-500/20 text-purple-400 border-purple-500/30","⚡":"bg-blue-500/20 text-blue-400 border-blue-500/30","🔬":"bg-amber-500/20 text-amber-400 border-amber-500/30","🔗":"bg-emerald-500/20 text-emerald-400 border-emerald-500/30","🎨":"bg-pink-500/20 text-pink-400 border-pink-500/30"}[r]||"bg-slate-700 text-slate-400 border-slate-600";return e.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-1 rounded text-xs font-medium border ${l}`,children:[e.jsx("span",{children:r}),e.jsx("span",{children:s})]})}function ce({item:s}){const r=async()=>{await _(s.id)&&console.log(`${s.id} copiado!`)},t=Z(s.status),l=s.status.includes("✅")||s.status.toLowerCase().includes("done");return e.jsxs("div",{className:`bg-slate-800 border rounded-lg p-5 ${l?"border-emerald-500/30 opacity-60":"border-slate-700"}`,children:[e.jsxs("div",{className:"flex items-start justify-between gap-4 mb-3",children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs("button",{onClick:r,className:"flex items-center gap-2 text-sm font-mono font-semibold text-emerald-400 hover:text-emerald-300 transition-colors",title:"Copiar ID",children:[s.id,e.jsx(C.Copy,{className:"w-3 h-3"})]})}),e.jsx(ie,{category:s.category})]}),e.jsx("h3",{className:"text-lg font-medium text-slate-200 mb-4",children:s.title}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3 text-sm",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-slate-500",children:"Status:"}),e.jsx("p",{className:"mt-1",children:e.jsx("span",{className:`inline-flex items-center px-2 py-1 rounded text-xs font-medium ${t}`,children:s.status})})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-slate-500",children:"Owner:"}),e.jsx("p",{className:"text-slate-300 mt-1",children:s.owner})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-slate-500",children:"Estimativa:"}),e.jsx("p",{className:"text-slate-300 mt-1",children:s.estimate})]})]}),s.created&&e.jsxs("div",{className:"mt-3 pt-3 border-t border-slate-700",children:[e.jsx("span",{className:"text-xs text-slate-500",children:"Criado em: "}),e.jsx("span",{className:"text-xs text-slate-400",children:s.created})]})]})}function Pe(){const[s,r]=m.useState(null),[t,l]=m.useState([]),[a,o]=m.useState({status:"all",category:"all",search:""}),[i,d]=m.useState(!0);return m.useEffect(()=>{async function n(){try{const c=await I();r(c),l(c.items)}catch(c){console.error("Error loading backlog:",c)}finally{d(!1)}}n()},[]),m.useEffect(()=>{if(!s)return;let n=s.items;if(a.status!=="all"&&(n=n.filter(c=>c.status.toLowerCase().includes(a.status.toLowerCase()))),a.category!=="all"&&(n=n.filter(c=>c.category.toLowerCase().includes(a.category.toLowerCase()))),a.search){const c=a.search.toLowerCase();n=n.filter(x=>x.id.toLowerCase().includes(c)||x.title.toLowerCase().includes(c)||x.owner.toLowerCase().includes(c))}l(n)},[a,s]),i?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-emerald-500"})}):s?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold text-slate-100 mb-2",children:"Backlog Registry"}),e.jsx("p",{className:"text-slate-400",children:"Features e melhorias planejadas"})]}),e.jsx(ne,{stats:s.stats}),e.jsx(oe,{filters:a,onFilterChange:o}),e.jsx("div",{className:"space-y-4",children:t.map(n=>e.jsx(ce,{item:n},n.id))}),t.length===0&&e.jsx("div",{className:"text-center py-12",children:e.jsx("p",{className:"text-slate-500",children:"Nenhum item de backlog encontrado"})})]}):e.jsx("div",{className:"text-center py-12",children:e.jsx("p",{className:"text-slate-500",children:"Erro ao carregar dados"})})}function B({content:s,className:r=""}){const[t,l]=m.useState({});if(!s)return e.jsx("div",{className:"text-slate-500 italic",children:"Nenhum conteúdo disponível"});const a=i=>{const d=i.split(`
|
|
12
|
+
`),n=[];let c=[],x=null,N=[],j=!1,y=[];const f=()=>{c.length>0&&(n.push(e.jsx("ul",{className:"list-disc list-inside space-y-1 ml-4 text-slate-300",children:c.map((b,w)=>e.jsx("li",{className:"leading-relaxed",children:b},w))},`list-${n.length}`)),c=[])},u=()=>{if(x!==null){const b=N.join(`
|
|
13
|
+
`);n.push(e.jsx("div",{className:"my-4",children:e.jsxs("div",{className:"bg-slate-950 border border-slate-700 rounded-lg overflow-hidden",children:[e.jsx("div",{className:"px-3 py-2 bg-slate-800 border-b border-slate-700 text-xs text-slate-400",children:x||"code"}),e.jsx("pre",{className:"p-4 overflow-x-auto text-sm",children:e.jsx("code",{className:"text-emerald-400 font-mono",children:b})})]})},`code-${n.length}`)),x=null,N=[]}},g=()=>{y.length>0&&(n.push(e.jsx("blockquote",{className:"border-l-4 border-emerald-500 pl-4 py-2 my-3 bg-emerald-500/5 text-slate-300 italic",children:y.join(" ")},`quote-${n.length}`)),y=[],j=!1)};return d.forEach((b,w)=>{if(b.startsWith("```")){f(),g(),x===null?x=b.slice(3).trim():u();return}if(x!==null){N.push(b);return}if(b.startsWith(">")){f(),j=!0,y.push(b.slice(1).trim());return}else j&&g();if(b.startsWith("# ")){f();const h=b.slice(2),v=`section-${n.length}`,k=t[v];n.push(e.jsxs("div",{className:"mb-4",children:[e.jsxs("h1",{className:"text-2xl font-bold text-emerald-400 mb-2 cursor-pointer hover:text-emerald-300 transition-colors flex items-center gap-2",onClick:()=>l(T=>({...T,[v]:!T[v]})),children:[e.jsx("span",{className:"text-slate-500",children:k?"▶":"▼"}),o(h)]}),!k&&e.jsx("div",{className:"border-b border-slate-700 mb-4"})]},`h1-${w}`));return}if(b.startsWith("## ")){f(),n.push(e.jsx("h2",{className:"text-xl font-semibold text-slate-100 mt-6 mb-3",children:o(b.slice(3))},`h2-${w}`));return}if(b.startsWith("### ")){f(),n.push(e.jsx("h3",{className:"text-lg font-medium text-slate-200 mt-4 mb-2",children:o(b.slice(4))},`h3-${w}`));return}if(b.startsWith("#### ")){f(),n.push(e.jsx("h4",{className:"text-base font-medium text-slate-300 mt-3 mb-2",children:o(b.slice(5))},`h4-${w}`));return}if(b.trim()==="---"||b.trim()==="***"){f(),n.push(e.jsx("hr",{className:"my-6 border-slate-700"},`hr-${w}`));return}if(b.match(/^\s*[-*+]\s+/)){const h=b.replace(/^\s*[-*+]\s+/,"");c.push(o(h));return}else f();b.trim()?n.push(e.jsx("p",{className:"text-slate-300 leading-relaxed mb-3",children:o(b)},`p-${w}`)):n.length>0&&n.push(e.jsx("div",{className:"h-2"},`space-${w}`))}),f(),u(),g(),n},o=i=>{const d=[];let n=0,c=0;const x=/\*\*(.+?)\*\*/g,N=/\*(.+?)\*/g,j=/`([^`]+)`/g,y=/\[([^\]]+)\]\(([^)]+)\)/g,f=[];let u;for(;(u=x.exec(i))!==null;)f.push({type:"bold",index:u.index,length:u[0].length,content:u[1]});for(;(u=N.exec(i))!==null;)f.some(g=>g.index<=u.index&&u.index<g.index+g.length)||f.push({type:"italic",index:u.index,length:u[0].length,content:u[1]});for(;(u=j.exec(i))!==null;)f.push({type:"code",index:u.index,length:u[0].length,content:u[1]});for(;(u=y.exec(i))!==null;)f.push({type:"link",index:u.index,length:u[0].length,content:u[1],url:u[2]});return f.sort((g,b)=>g.index-b.index),f.forEach(g=>{switch(g.index>n&&d.push(e.jsx("span",{children:i.slice(n,g.index)},`text-${c++}`)),g.type){case"bold":d.push(e.jsx("strong",{className:"font-bold text-slate-100",children:g.content},`bold-${c++}`));break;case"italic":d.push(e.jsx("em",{className:"italic",children:g.content},`italic-${c++}`));break;case"code":d.push(e.jsx("code",{className:"bg-slate-800 text-emerald-400 px-1.5 py-0.5 rounded text-sm font-mono",children:g.content},`code-${c++}`));break;case"link":d.push(e.jsx("a",{href:g.url,target:"_blank",rel:"noopener noreferrer",className:"text-emerald-400 hover:text-emerald-300 underline",children:g.content},`link-${c++}`));break}n=g.index+g.length}),n<i.length&&d.push(e.jsx("span",{children:i.slice(n)},`text-${c++}`)),d.length>0?d:i};return e.jsx("div",{className:`prose prose-invert max-w-none ${r}`,children:a(s)})}function de({log:s}){const[r,t]=m.useState(!1),l={architecture:"border-blue-500/30 bg-blue-500/5",decisions:"border-amber-500/30 bg-amber-500/5"},a={architecture:"Arquitetura",decisions:"Decisão"},o=l[s.logType]||"border-slate-700 bg-slate-800";return e.jsxs("div",{className:`border rounded-lg overflow-hidden ${o}`,children:[e.jsxs("button",{onClick:()=>t(!r),className:"w-full p-4 flex items-start gap-3 hover:bg-slate-700/30 transition-colors",children:[e.jsx("div",{className:"flex-shrink-0 mt-1",children:r?e.jsx(C.ChevronDown,{className:"w-5 h-5 text-slate-400"}):e.jsx(C.ChevronRight,{className:"w-5 h-5 text-slate-400"})}),e.jsx("div",{className:"flex-shrink-0 text-2xl",children:s.icon}),e.jsxs("div",{className:"flex-1 text-left",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("h3",{className:"text-sm font-medium text-slate-200",children:s.title}),e.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full bg-slate-700 text-slate-300",children:a[s.logType]||s.logType})]}),e.jsxs("div",{className:"flex items-center gap-3 text-xs text-slate-500",children:[e.jsx("span",{children:P(s.timestamp)}),s.author&&e.jsxs("span",{children:["• ",s.author]}),s.module&&e.jsxs("span",{children:["• ",s.module]}),s.type&&e.jsxs("span",{children:["• ",s.type]})]})]})]}),r&&e.jsx("div",{className:"px-4 pb-4 pt-2 border-t border-slate-700 max-h-[600px] overflow-y-auto custom-scrollbar",children:e.jsx(B,{content:s.content.trim()})})]})}function xe({logs:s}){return!s||s.length===0?null:e.jsx("div",{className:"space-y-4",children:s.map((r,t)=>e.jsx(de,{log:r},`${r.timestamp}-${t}`))})}function me({filters:s,onFilterChange:r,totalLogs:t}){const l=o=>{r({...s,type:o.target.value})},a=o=>{r({...s,search:o.target.value})};return e.jsx("div",{className:"bg-slate-800 border border-slate-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex flex-col md:flex-row gap-4",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("label",{className:"block text-sm font-medium text-slate-300 mb-2",children:"Tipo de Log"}),e.jsxs("select",{value:s.type,onChange:l,className:"w-full bg-slate-700 border border-slate-600 text-slate-200 rounded-lg px-3 py-2 focus:ring-2 focus:ring-emerald-500 focus:border-transparent",children:[e.jsx("option",{value:"all",children:"Todos"}),e.jsx("option",{value:"architecture",children:"🏗️ Architecture"}),e.jsx("option",{value:"decisions",children:"📝 Decisions"})]})]}),e.jsxs("div",{className:"flex-1",children:[e.jsx("label",{className:"block text-sm font-medium text-slate-300 mb-2",children:"Buscar"}),e.jsx("input",{type:"text",value:s.search,onChange:a,placeholder:"Digite para buscar...",className:"w-full bg-slate-700 border border-slate-600 text-slate-200 rounded-lg px-3 py-2 focus:ring-2 focus:ring-emerald-500 focus:border-transparent placeholder-slate-500"})]}),e.jsx("div",{className:"flex items-end",children:e.jsxs("div",{className:"px-4 py-2 bg-slate-700 border border-slate-600 rounded-lg",children:[e.jsx("span",{className:"text-sm text-slate-400",children:"Total:"}),e.jsx("span",{className:"ml-2 text-lg font-bold text-emerald-400",children:t})]})})]})})}function $e(){const[s,r]=m.useState([]),[t,l]=m.useState([]),[a,o]=m.useState({type:"all",search:""}),[i,d]=m.useState(!0);return m.useEffect(()=>{async function n(){try{const x=(await R()).slice(0,50);r(x),l(x)}catch(c){console.error("Error loading logs:",c)}finally{d(!1)}}n()},[]),m.useEffect(()=>{let n=s;if(a.type!=="all"&&(n=n.filter(c=>c.logType===a.type)),a.search){const c=a.search.toLowerCase();n=n.filter(x=>x.title.toLowerCase().includes(c)||x.content.toLowerCase().includes(c))}l(n)},[a,s]),i?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-emerald-500"})}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold text-slate-100 mb-2",children:"Logs Timeline"}),e.jsx("p",{className:"text-slate-400",children:"Histórico de mudanças arquiteturais e decisões técnicas"})]}),e.jsx(me,{filters:a,onFilterChange:o,totalLogs:s.length}),e.jsx(xe,{logs:t}),t.length===0&&e.jsx("div",{className:"text-center py-12",children:e.jsx("p",{className:"text-slate-500",children:"Nenhum log encontrado"})})]})}function Ie(){const[s,r]=m.useState(""),[t,l]=m.useState(!0),[a,o]=m.useState("architecture");return m.useEffect(()=>{async function i(){try{const d=a==="architecture"?"/docs/ARCHITECTURE.md":"/docs/DATABASE_SCHEMA.md",n=await fetch(d);if(!n.ok)throw new Error(`Failed to fetch ${d}`);const c=await n.text();r(c)}catch(d){console.error("Error loading architecture doc:",d),r("## ❌ Erro ao Carregar\n\nNão foi possível carregar o documento. Verifique se os arquivos estão em `public/docs/`.")}finally{l(!1)}}l(!0),i()},[a]),t?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-emerald-500"})}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold text-slate-100 mb-2",children:"Architecture Overview"}),e.jsx("p",{className:"text-slate-400",children:"Documentação da arquitetura do sistema"})]}),e.jsxs("div",{className:"flex gap-2 border-b border-slate-700",children:[e.jsx("button",{onClick:()=>o("architecture"),className:`px-4 py-2 font-medium transition-colors ${a==="architecture"?"text-emerald-400 border-b-2 border-emerald-400":"text-slate-400 hover:text-slate-300"}`,children:"🏗️ Architecture"}),e.jsx("button",{onClick:()=>o("database"),className:`px-4 py-2 font-medium transition-colors ${a==="database"?"text-emerald-400 border-b-2 border-emerald-400":"text-slate-400 hover:text-slate-300"}`,children:"🗄️ Database Schema"})]}),e.jsx("div",{className:"bg-slate-800 border border-slate-700 rounded-lg p-6 max-h-[calc(100vh-300px)] overflow-y-auto custom-scrollbar",children:e.jsx(B,{content:s})})]})}const ue=m.createContext(null);function Re({children:s,utils:r,client:t,config:l,healthCheck:a,ChatInterface:o,chatConfig:i}){const d={utils:r||{copyToClipboard:async n=>{await navigator.clipboard.writeText(n)},maskCredential:n=>"•".repeat(n.length)},client:t,config:l,healthCheck:a,ChatInterface:o,chatConfig:i};return e.jsx(ue.Provider,{value:d,children:s})}function A(){return m.useContext(ue)}const _e={copyToClipboard:async s=>{try{await navigator.clipboard.writeText(s)}catch(r){throw console.error("Failed to copy:",r),r}},maskCredential:s=>s?"•".repeat(s.length):""};function he({name:s,url:r,status:t="checking",icon:l="🔗",description:a,onCopy:o}){var u;const i=A(),[d,n]=m.useState(!1),c=o||((u=i==null?void 0:i.utils)==null?void 0:u.copyToClipboard),x=async()=>{try{c?await c(r):await navigator.clipboard.writeText(r),n(!0),setTimeout(()=>n(!1),2e3)}catch(g){console.error("Erro ao copiar:",g),alert("Erro ao copiar URL")}},N=()=>{window.open(r,"_blank","noopener,noreferrer")},y=(()=>{switch(t){case"online":return{badge:"🟢 Online",bgColor:"bg-green-500/10",borderColor:"border-green-500/30",textColor:"text-green-400"};case"offline":return{badge:"🔴 Offline",bgColor:"bg-red-500/10",borderColor:"border-red-500/30",textColor:"text-red-400"};case"checking":default:return{badge:"🟡 Verificando...",bgColor:"bg-yellow-500/10",borderColor:"border-yellow-500/30",textColor:"text-yellow-400"}}})(),f=t==="offline"||t==="checking";return e.jsxs("div",{className:`rounded-lg border ${y.borderColor} ${y.bgColor} p-4 transition-all hover:shadow-lg`,children:[e.jsxs("div",{className:"flex items-start justify-between mb-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-2xl",children:l}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold text-slate-100",children:s}),a&&e.jsx("p",{className:"text-xs text-slate-400 mt-0.5",children:a})]})]}),e.jsx("span",{className:`text-xs font-medium px-2 py-1 rounded ${y.textColor}`,children:y.badge})]}),e.jsx("div",{className:"mb-3",children:e.jsx("code",{className:"text-xs text-slate-300 bg-slate-800 px-2 py-1 rounded block truncate",children:r})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{onClick:N,disabled:f,className:`flex-1 flex items-center justify-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-colors ${f?"bg-slate-700 text-slate-500 cursor-not-allowed":"bg-blue-600 hover:bg-blue-700 text-white"}`,title:f?"Serviço offline":"Abrir em nova aba",children:[e.jsx(C.ExternalLink,{className:"w-4 h-4"}),"Abrir"]}),e.jsx("button",{onClick:x,className:"flex items-center justify-center gap-2 px-3 py-2 rounded-lg text-sm font-medium bg-slate-700 hover:bg-slate-600 text-slate-200 transition-colors",title:"Copiar URL",children:d?e.jsxs(e.Fragment,{children:[e.jsx(C.Check,{className:"w-4 h-4 text-green-400"}),e.jsx("span",{className:"text-green-400",children:"Copiado!"})]}):e.jsxs(e.Fragment,{children:[e.jsx(C.Copy,{className:"w-4 h-4"}),"Copiar"]})})]})]})}function pe({tools:s,healthStatus:r={}}){return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-2xl",children:"🛠️"}),e.jsx("h2",{className:"text-xl font-semibold text-slate-100",children:"Development Tools"})]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:s.map(t=>e.jsx(he,{name:t.name,url:t.url,icon:t.icon,description:t.description,status:r[t.id]||"checking"},t.id))})]})}function M({label:s,value:r,onCopy:t,maskFunction:l,warning:a,placeholder:o="Não configurada"}){var w,h;const i=A(),d=t||((w=i==null?void 0:i.utils)==null?void 0:w.copyToClipboard),n=l||((h=i==null?void 0:i.utils)==null?void 0:h.maskCredential),[c,x]=m.useState(!1),[N,j]=m.useState(!1),y=async()=>{if(r)try{d?await d(r):await navigator.clipboard.writeText(r),j(!0),setTimeout(()=>j(!1),2e3)}catch(v){console.error("Erro ao copiar:",v),alert("Erro ao copiar para área de transferência")}},f=()=>{x(!c)},g=r?c?r:(v=>n?n(v):"•".repeat(v.length))(r):o,b=!!r;return e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium text-slate-300 flex items-center gap-2",children:s}),e.jsxs("div",{className:`flex items-center gap-2 rounded-lg border p-3 transition-colors ${b?"bg-slate-800 border-slate-700":"bg-slate-900 border-slate-800"}`,children:[e.jsx("code",{className:`flex-1 text-sm font-mono truncate ${b?"text-slate-200":"text-slate-500 italic"}`,children:g}),b&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:f,className:"p-2 text-slate-400 hover:text-slate-200 hover:bg-slate-700 rounded transition-colors",title:c?"Ocultar":"Mostrar",type:"button",children:c?e.jsx(C.EyeOff,{className:"w-4 h-4"}):e.jsx(C.Eye,{className:"w-4 h-4"})}),e.jsx("button",{onClick:y,className:"p-2 text-slate-400 hover:text-slate-200 hover:bg-slate-700 rounded transition-colors",title:N?"Copiado!":"Copiar",type:"button",children:N?e.jsx(C.Check,{className:"w-4 h-4 text-green-400"}):e.jsx(C.Copy,{className:"w-4 h-4"})})]})]}),a&&b&&e.jsxs("p",{className:"text-xs text-amber-400 flex items-center gap-1.5 bg-amber-500/10 border border-amber-500/30 rounded px-2 py-1.5",children:[e.jsx("span",{children:"⚠️"}),e.jsx("span",{children:a})]}),!b&&e.jsxs("p",{className:"text-xs text-slate-500 flex items-center gap-1.5",children:[e.jsx("span",{children:"ℹ️"}),e.jsxs("span",{children:["Configure esta variável no arquivo ",e.jsx("code",{className:"bg-slate-800 px-1 rounded",children:".env"})]})]})]})}function ge(){return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-2xl",children:"🔐"}),e.jsx("h2",{className:"text-xl font-semibold text-slate-100",children:"Authentication Keys"})]}),e.jsx("div",{className:"bg-red-500/10 border border-red-500/30 rounded-lg p-4",children:e.jsxs("p",{className:"text-red-300 text-sm flex items-center gap-2",children:[e.jsx("span",{className:"text-lg",children:"⚠️"}),e.jsx("strong",{children:"ATENÇÃO:"})," Nunca commitar a Service Role Key no repositório. Esta chave tem acesso total ao banco de dados."]})}),e.jsxs("div",{className:"bg-slate-800 p-6 rounded-lg border border-slate-700 space-y-4",children:[e.jsx(M,{label:"Anon Key (Public)",value:void 0,placeholder:"Configure VITE_SUPABASE_ANON_KEY no .env"}),e.jsx(M,{label:"Service Role Key (Private)",value:void 0,warning:"Esta chave tem acesso administrativo total. Use apenas em development.",placeholder:"Configure VITE_SUPABASE_SERVICE_ROLE_KEY no .env"}),e.jsxs("div",{className:"pt-4 border-t border-slate-700",children:[e.jsx("p",{className:"text-xs text-slate-400 mb-2",children:e.jsx("strong",{className:"text-slate-300",children:"Como obter as keys:"})}),e.jsxs("ol",{className:"text-xs text-slate-400 space-y-1 list-decimal list-inside",children:[e.jsxs("li",{children:["Execute: ",e.jsx("code",{className:"bg-slate-900 px-1.5 py-0.5 rounded text-slate-300",children:"npx supabase start"})]}),e.jsxs("li",{children:["Execute: ",e.jsx("code",{className:"bg-slate-900 px-1.5 py-0.5 rounded text-slate-300",children:"npx supabase status"})]}),e.jsxs("li",{children:["Copie as keys exibidas para o arquivo ",e.jsx("code",{className:"bg-slate-900 px-1.5 py-0.5 rounded text-slate-300",children:".env"})]})]})]})]})]})}function be({healthCheck:s}){const r=A(),[t,l]=m.useState({}),[a,o]=m.useState(!0),[i,d]=m.useState(null),n=s||(r==null?void 0:r.healthCheck),c=async(u=!1)=>{if(!n){console.warn("HealthStatusSection: healthCheck function not provided"),o(!1);return}o(!0);try{const g=await n(u);l(g),d(new Date)}catch(g){console.error("Health check failed:",g)}finally{o(!1)}};m.useEffect(()=>{c()},[n]);const x=u=>{if(a&&!i)return"🟡";switch(u){case"online":return"🟢";case"offline":return"🔴";case"timeout":return"🟠";default:return"🟡"}},N=u=>{switch(u){case"online":return"Online";case"offline":return"Offline";case"timeout":return"Timeout";default:return"Verificando..."}},j=[{id:"studio",label:"Supabase Studio"},{id:"database",label:"Database (Kong)"},{id:"mailpit",label:"Mailpit"},{id:"mcp",label:"MCP Server"},{id:"functions",label:"Edge Functions"}],y=Object.values(t).every(u=>u==="offline"),f=Object.values(t).every(u=>u==="online");return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-2xl",children:"🩺"}),e.jsx("h2",{className:"text-xl font-semibold text-slate-100",children:"Health Status"})]}),e.jsxs("button",{onClick:()=>c(!0),disabled:a,className:`flex items-center gap-2 px-3 py-1.5 text-sm bg-slate-700 hover:bg-slate-600 text-slate-200 rounded-lg transition-colors ${a?"opacity-50 cursor-not-allowed":""}`,title:"Verificar novamente",children:[e.jsx(C.RefreshCw,{className:`w-4 h-4 ${a?"animate-spin":""}`}),"Verificar"]})]}),y&&i&&e.jsx("div",{className:"bg-red-500/10 border border-red-500/30 rounded-lg p-4",children:e.jsxs("p",{className:"text-red-300 text-sm flex items-center gap-2",children:[e.jsx("span",{className:"text-lg",children:"🔴"}),e.jsxs("span",{children:[e.jsx("strong",{children:"Supabase Offline:"})," Execute"," ",e.jsx("code",{className:"bg-red-900/30 px-1.5 py-0.5 rounded",children:"npx supabase start"})," ","para iniciar os serviços locais."]})]})}),f&&i&&e.jsx("div",{className:"bg-green-500/10 border border-green-500/30 rounded-lg p-3",children:e.jsxs("p",{className:"text-green-300 text-sm flex items-center gap-2",children:[e.jsx("span",{className:"text-lg",children:"✅"}),e.jsx("strong",{children:"Todos os serviços online"})]})}),e.jsxs("div",{className:"bg-slate-800 p-6 rounded-lg border border-slate-700",children:[e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:j.map(u=>{const g=t[u.id]||"checking",b=x(g),w=N(g);return e.jsxs("div",{className:"flex items-center justify-between p-3 bg-slate-900 rounded-lg border border-slate-700",children:[e.jsx("span",{className:"text-sm text-slate-300",children:u.label}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-lg",children:b}),e.jsx("span",{className:"text-xs text-slate-400",children:w})]})]},u.id)})}),i&&e.jsxs("p",{className:"mt-4 text-xs text-slate-500 text-center",children:["Última verificação: ",i.toLocaleTimeString("pt-BR")]})]})]})}function je({endpoints:s,onCopy:r}){var d;const t=A(),[l,a]=m.useState(null),o=r||((d=t==null?void 0:t.utils)==null?void 0:d.copyToClipboard),i=async(n,c)=>{try{o?await o(n):await navigator.clipboard.writeText(n),a(c),setTimeout(()=>a(null),2e3)}catch(x){console.error("Erro ao copiar:",x),alert("Erro ao copiar URL")}};return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-2xl",children:"🌐"}),e.jsx("h2",{className:"text-xl font-semibold text-slate-100",children:"APIs"})]}),e.jsxs("div",{className:"bg-slate-800 p-6 rounded-lg border border-slate-700 space-y-3",children:[s.map(n=>e.jsxs("div",{className:"p-4 bg-slate-900 rounded-lg border border-slate-700 hover:border-slate-600 transition-colors",children:[e.jsxs("div",{className:"flex items-start justify-between mb-2",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold text-slate-100",children:n.name}),e.jsx("p",{className:"text-xs text-slate-400 mt-0.5",children:n.description})]}),e.jsx("button",{onClick:()=>i(n.url,n.id),className:"p-2 text-slate-400 hover:text-slate-200 hover:bg-slate-700 rounded transition-colors flex-shrink-0",title:"Copiar URL",children:l===n.id?e.jsx(C.Check,{className:"w-4 h-4 text-green-400"}):e.jsx(C.Copy,{className:"w-4 h-4"})})]}),e.jsx("code",{className:"text-xs text-slate-300 bg-slate-800 px-2 py-1 rounded block truncate",children:n.url})]},n.id)),e.jsxs("div",{className:"pt-4 border-t border-slate-700",children:[e.jsx("p",{className:"text-xs text-slate-400",children:e.jsx("strong",{className:"text-slate-300",children:"Headers obrigatórios:"})}),e.jsxs("ul",{className:"text-xs text-slate-400 space-y-1 mt-2",children:[e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{children:"•"}),e.jsxs("span",{children:[e.jsx("code",{className:"bg-slate-800 px-1.5 py-0.5 rounded text-slate-300",children:"apikey"})," ",": Anon Key ou Service Role Key"]})]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{children:"•"}),e.jsxs("span",{children:[e.jsx("code",{className:"bg-slate-800 px-1.5 py-0.5 rounded text-slate-300",children:"Authorization"})," ",": Bearer [seu-token-jwt]"]})]})]})]})]})]})}function fe({config:s,onCopy:r,databaseStatus:t="checking"}){var x;const l=A(),[a,o]=m.useState(!1),i=r||((x=l==null?void 0:l.utils)==null?void 0:x.copyToClipboard),d=async()=>{try{i?await i(s.connectionString):await navigator.clipboard.writeText(s.connectionString),o(!0),setTimeout(()=>o(!1),2e3)}catch(N){console.error("Erro ao copiar:",N),alert("Erro ao copiar connection string")}},c=(()=>{switch(t){case"online":return{badge:"🟢 Online",bgColor:"bg-green-500/10",borderColor:"border-green-500/30",textColor:"text-green-400"};case"offline":return{badge:"🔴 Offline",bgColor:"bg-red-500/10",borderColor:"border-red-500/30",textColor:"text-red-400"};default:return{badge:"🟡 Verificando...",bgColor:"bg-yellow-500/10",borderColor:"border-yellow-500/30",textColor:"text-yellow-400"}}})();return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-2xl",children:"🗄️"}),e.jsx("h2",{className:"text-xl font-semibold text-slate-100",children:"Database"})]}),e.jsxs("div",{className:`rounded-lg border ${c.borderColor} ${c.bgColor} p-6`,children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C.Database,{className:"w-5 h-5 text-slate-300"}),e.jsx("span",{className:"font-medium text-slate-100",children:"PostgreSQL"})]}),e.jsx("span",{className:`text-xs font-medium px-2 py-1 rounded ${c.textColor}`,children:c.badge})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-slate-400",children:"Host:"}),e.jsx("span",{className:"ml-2 text-slate-200",children:s.host})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-slate-400",children:"Port:"}),e.jsx("span",{className:"ml-2 text-slate-200",children:s.port})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-slate-400",children:"Database:"}),e.jsx("span",{className:"ml-2 text-slate-200",children:s.database})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-slate-400",children:"User:"}),e.jsx("span",{className:"ml-2 text-slate-200",children:s.user})]})]}),e.jsxs("div",{className:"pt-3 border-t border-slate-700",children:[e.jsx("label",{className:"text-sm font-medium text-slate-300 mb-2 block",children:"Connection String"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"flex-1 text-xs text-slate-300 bg-slate-800 px-3 py-2 rounded border border-slate-700 truncate",children:s.connectionString}),e.jsx("button",{onClick:d,className:"p-2 text-slate-400 hover:text-slate-200 hover:bg-slate-700 rounded transition-colors flex-shrink-0",title:"Copiar connection string",children:a?e.jsx(C.Check,{className:"w-4 h-4 text-green-400"}):e.jsx(C.Copy,{className:"w-4 h-4"})})]})]}),e.jsxs("div",{className:"pt-3 border-t border-slate-700",children:[e.jsx("p",{className:"text-xs text-slate-400",children:e.jsx("strong",{className:"text-slate-300",children:"Conectar via CLI:"})}),e.jsxs("code",{className:"text-xs text-slate-300 bg-slate-800 px-2 py-1 rounded block mt-2",children:["psql ",s.connectionString]})]})]})]})]})}function Be({healthCheck:s,config:r,onCopy:t}){var c,x;const l=A(),[a,o]=m.useState({}),i=s||(l==null?void 0:l.healthCheck),d=r||((c=l==null?void 0:l.config)==null?void 0:c.supabase),n=t||((x=l==null?void 0:l.utils)==null?void 0:x.copyToClipboard);return m.useEffect(()=>{if(!i)return;const N=async()=>{try{const y=await i();o(y)}catch(y){console.error("Erro ao carregar health status:",y)}};N();const j=setInterval(N,3e4);return()=>clearInterval(j)},[i]),e.jsxs("div",{className:"space-y-6 pb-8",children:[e.jsx("div",{className:"bg-amber-500/10 border border-amber-500/30 rounded-lg p-4",children:e.jsxs("p",{className:"text-amber-300 text-sm flex items-center gap-2",children:[e.jsx("span",{className:"text-xl",children:"⚠️"}),e.jsxs("span",{children:[e.jsx("strong",{children:"Ambiente de Desenvolvimento Local"})," - Esta aba exibe informações do Supabase rodando em localhost. Não é visível em produção."]})]})}),(d==null?void 0:d.tools)&&e.jsx(pe,{tools:d.tools,healthStatus:a}),e.jsx(ge,{}),e.jsx(be,{healthCheck:i}),(d==null?void 0:d.apis)&&e.jsx(je,{endpoints:d.apis,onCopy:n}),(d==null?void 0:d.database)&&e.jsx(fe,{config:d.database,onCopy:n,databaseStatus:a.database}),e.jsx("div",{className:"bg-slate-800 border border-slate-700 rounded-lg p-4",children:e.jsxs("p",{className:"text-xs text-slate-400 text-center",children:["💡 ",e.jsx("strong",{children:"Dica:"})," Para iniciar o Supabase local, execute"," ",e.jsx("code",{className:"bg-slate-900 px-1.5 py-0.5 rounded text-slate-300",children:"npx supabase start"})," ","no terminal."]})})]})}function Fe(){const[s,r]=m.useState("checking"),[t,l]=m.useState(""),[a,o]=m.useState(!1),[i,d]=m.useState("anthropic/claude-sonnet-4"),[n,c]=m.useState(.3),[x,N]=m.useState(2e3),[j,y]=m.useState({dev:50,user:20,admin:-1}),[f,u]=m.useState({dev:1.5,user:.5,admin:-1}),g=[{id:"anthropic/claude-sonnet-4",name:"Claude Sonnet 4",provider:"Anthropic",speed:3,quality:5,cost:3,contextWindow:2e5,pricing:{prompt:3,completion:15},description:"Excelente para análise de código e arquitetura"},{id:"anthropic/claude-opus-4",name:"Claude Opus 4",provider:"Anthropic",speed:2,quality:5,cost:5,contextWindow:2e5,pricing:{prompt:15,completion:75},description:"Máxima qualidade para tarefas complexas"},{id:"openai/gpt-4-turbo",name:"GPT-4 Turbo",provider:"OpenAI",speed:3,quality:5,cost:4,contextWindow:128e3,pricing:{prompt:10,completion:30},description:"Precisão alta e confiável"},{id:"openai/gpt-4o",name:"GPT-4o",provider:"OpenAI",speed:4,quality:5,cost:2,contextWindow:128e3,pricing:{prompt:2.5,completion:10},description:"Rápido e custo-benefício excelente"},{id:"openai/gpt-4o-mini",name:"GPT-4o Mini",provider:"OpenAI",speed:5,quality:4,cost:1,contextWindow:128e3,pricing:{prompt:.15,completion:.6},description:"Muito econômico para alto volume"},{id:"google/gemini-pro-1.5",name:"Gemini Pro 1.5",provider:"Google",speed:4,quality:4,cost:2,contextWindow:1e6,pricing:{prompt:1.25,completion:5},description:"Contexto gigante e bom custo-benefício"},{id:"google/gemini-flash-1.5",name:"Gemini Flash 1.5",provider:"Google",speed:5,quality:3,cost:1,contextWindow:1e6,pricing:{prompt:.075,completion:.3},description:"Ultra rápido e econômico"},{id:"meta-llama/llama-3.3-70b-instruct",name:"Llama 3.3 70B",provider:"Meta",speed:4,quality:4,cost:1,contextWindow:131072,pricing:{prompt:.52,completion:.68},description:"Open-source e econômico"},{id:"meta-llama/llama-3.3-70b-instruct:free",name:"Llama 3.3 70B (Free)",provider:"Meta",speed:3,quality:4,cost:0,contextWindow:131072,pricing:{prompt:0,completion:0},description:"Gratuito! Ideal para testes"}];m.useEffect(()=>{b()},[]);async function b(){try{r("missing"),l("Não configurada")}catch{r("invalid")}}async function w(){var p;o(!0);try{const S=await fetch("http://localhost:54321/functions/v1/openrouter-ai-service",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:"test",context:"dev",stream:!1})});if(S.ok)r("valid"),alert("✅ API Key válida e funcionando!");else{r("invalid");const D=await S.json();alert("❌ Erro: "+(((p=D.error)==null?void 0:p.message)||"API Key inválida"))}}catch(S){r("invalid"),alert("❌ Erro ao testar: "+S.message)}finally{o(!1)}}function h(p){const S=g.find(ve=>ve.id===p);if(!S)return 0;const D=1e3/1e6*S.pricing.prompt,Ne=500/1e6*S.pricing.completion;return(D+Ne).toFixed(4)}function v(p){return"⭐".repeat(p)}function k(p){return"💰".repeat(p)}const T=g.find(p=>p.id===i);return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold text-gray-900",children:"⚙️ Configurações do AI Assistant"}),e.jsx("p",{className:"text-gray-600",children:"Configure modelos, parâmetros e limites do OpenRouter"})]}),e.jsx("div",{className:`p-4 rounded-lg border-2 ${s==="valid"?"bg-green-50 border-green-200":s==="invalid"?"bg-red-50 border-red-200":s==="missing"?"bg-yellow-50 border-yellow-200":"bg-gray-50 border-gray-200"}`,children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"font-semibold text-gray-900 mb-1",children:[s==="valid"&&"✅ API Key Válida",s==="invalid"&&"❌ API Key Inválida",s==="missing"&&"⚠️ API Key Não Configurada",s==="unknown"&&"🔍 API Key Status",s==="checking"&&"⏳ Verificando..."]}),e.jsx("p",{className:"text-sm text-gray-600 font-mono",children:t}),s==="missing"&&e.jsxs("p",{className:"text-sm text-orange-700 mt-2",children:["Configure ",e.jsx("code",{className:"bg-orange-100 px-1 rounded",children:"OPENROUTER_API_KEY"})," no arquivo ",e.jsx("code",{className:"bg-orange-100 px-1 rounded",children:".env"})]})]}),e.jsx("button",{onClick:w,disabled:a||s==="missing",className:"px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors disabled:bg-gray-300 disabled:cursor-not-allowed",children:a?"🔄 Testando...":"🧪 Testar API Key"})]})}),e.jsxs("div",{className:"bg-white rounded-lg border border-gray-200 p-6",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-4",children:"🤖 Seleção de Modelo"}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:g.map(p=>e.jsxs("button",{onClick:()=>d(p.id),className:`p-4 rounded-lg border-2 text-left transition-all ${i===p.id?"border-blue-500 bg-blue-50":"border-gray-200 hover:border-blue-300"}`,children:[e.jsxs("div",{className:"flex items-start justify-between mb-2",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-semibold text-gray-900",children:p.name}),e.jsx("p",{className:"text-xs text-gray-500",children:p.provider})]}),i===p.id&&e.jsx("div",{className:"text-blue-600",children:"✓"})]}),e.jsx("p",{className:"text-xs text-gray-600 mb-3",children:p.description}),e.jsxs("div",{className:"space-y-1 text-xs",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-gray-600",children:"Velocidade:"}),e.jsx("span",{children:v(p.speed)})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-gray-600",children:"Qualidade:"}),e.jsx("span",{children:v(p.quality)})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-gray-600",children:"Custo:"}),e.jsx("span",{children:k(p.cost)||"🆓 GRÁTIS"})]}),e.jsxs("div",{className:"flex justify-between items-center mt-2 pt-2 border-t border-gray-200",children:[e.jsx("span",{className:"text-gray-600",children:"$/msg:"}),e.jsxs("span",{className:"font-semibold text-green-600",children:["$",h(p.id)]})]})]})]},p.id))}),T&&e.jsxs("div",{className:"mt-4 p-4 bg-blue-50 rounded-lg",children:[e.jsxs("h4",{className:"font-semibold text-blue-900 mb-2",children:["Modelo Selecionado: ",T.name]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-blue-700",children:"Context Window:"}),e.jsxs("span",{className:"ml-2 font-semibold",children:[T.contextWindow.toLocaleString()," tokens"]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-blue-700",children:"Preço Prompt:"}),e.jsxs("span",{className:"ml-2 font-semibold",children:["$",T.pricing.prompt,"/1M tokens"]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-blue-700",children:"Preço Completion:"}),e.jsxs("span",{className:"ml-2 font-semibold",children:["$",T.pricing.completion,"/1M tokens"]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-blue-700",children:"Estimativa/msg:"}),e.jsxs("span",{className:"ml-2 font-semibold text-green-600",children:["$",h(T.id)]})]})]})]})]}),e.jsxs("div",{className:"bg-white rounded-lg border border-gray-200 p-6",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-4",children:"🎛️ Parâmetros do Modelo"}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:["Temperature (Criatividade): ",n.toFixed(2)]}),e.jsx("input",{type:"range",min:"0",max:"1",step:"0.05",value:n,onChange:p=>c(parseFloat(p.target.value)),className:"w-full"}),e.jsxs("div",{className:"flex justify-between text-xs text-gray-500 mt-1",children:[e.jsx("span",{children:"0.0 (Preciso)"}),e.jsx("span",{children:"0.5 (Balanceado)"}),e.jsx("span",{children:"1.0 (Criativo)"})]}),e.jsxs("p",{className:"text-xs text-gray-600 mt-2",children:[n<.3&&"💼 Ideal para código e análise técnica",n>=.3&&n<.7&&"⚖️ Balanceado para uso geral",n>=.7&&"🎨 Mais criativo e variado"]})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:["Max Tokens (Tamanho da Resposta): ",x]}),e.jsx("input",{type:"range",min:"500",max:"4000",step:"100",value:x,onChange:p=>N(parseInt(p.target.value)),className:"w-full"}),e.jsxs("div",{className:"flex justify-between text-xs text-gray-500 mt-1",children:[e.jsx("span",{children:"500 (Curta)"}),e.jsx("span",{children:"2000 (Média)"}),e.jsx("span",{children:"4000 (Longa)"})]}),e.jsxs("p",{className:"text-xs text-gray-600 mt-2",children:["~",Math.floor(x/4)," palavras • $",(x/1e6*((T==null?void 0:T.pricing.completion)||0)).toFixed(4),"/resposta"]})]})]})]}),e.jsxs("div",{className:"bg-white rounded-lg border border-gray-200 p-6",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-4",children:"🚦 Rate Limits"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"👨💻 Desenvolvedores"}),e.jsx("input",{type:"number",value:j.dev,onChange:p=>y({...j,dev:parseInt(p.target.value)}),className:"w-full px-3 py-2 border border-gray-300 rounded-lg"}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"mensagens/dia"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"👤 Usuários"}),e.jsx("input",{type:"number",value:j.user,onChange:p=>y({...j,user:parseInt(p.target.value)}),className:"w-full px-3 py-2 border border-gray-300 rounded-lg"}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"mensagens/dia"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"👑 Administradores"}),e.jsx("div",{className:"px-3 py-2 bg-gray-100 border border-gray-300 rounded-lg text-center",children:e.jsx("span",{className:"font-semibold",children:"∞ Ilimitado"})}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"sem limite"})]})]}),e.jsxs("div",{className:"mt-6 grid grid-cols-1 md:grid-cols-3 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"💰 Custo Máximo/Dia (Dev)"}),e.jsx("input",{type:"number",step:"0.50",value:f.dev,onChange:p=>u({...f,dev:parseFloat(p.target.value)}),className:"w-full px-3 py-2 border border-gray-300 rounded-lg"}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"USD/dia"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"💰 Custo Máximo/Dia (User)"}),e.jsx("input",{type:"number",step:"0.10",value:f.user,onChange:p=>u({...f,user:parseFloat(p.target.value)}),className:"w-full px-3 py-2 border border-gray-300 rounded-lg"}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"USD/dia"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"💰 Custo Máximo/Dia (Admin)"}),e.jsx("div",{className:"px-3 py-2 bg-gray-100 border border-gray-300 rounded-lg text-center",children:e.jsx("span",{className:"font-semibold",children:"∞ Ilimitado"})}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"sem limite"})]})]})]}),e.jsxs("div",{className:"flex items-center justify-between p-4 bg-blue-50 border border-blue-200 rounded-lg",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-blue-900 font-semibold",children:"💡 Configurações Locais"}),e.jsx("p",{className:"text-xs text-blue-700",children:"Estas configurações são apenas visuais. Para aplicar permanentemente, edite os arquivos de configuração no código."})]}),e.jsx("button",{onClick:()=>{console.log("Configurações:",{model:i,temperature:n,maxTokens:x,rateLimits:j,maxCosts:f}),alert(`💾 Configurações salvas (console)!
|
|
14
|
+
|
|
15
|
+
Para aplicar permanentemente, edite os arquivos de código.`)},className:"px-6 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors font-semibold",children:"💾 Salvar no Console"})]})]})}function Oe({client:s,tableName:r="ai_consumption"}){const t=A(),l=s||(t==null?void 0:t.client),[a,o]=m.useState(!0),[i,d]=m.useState(F()),[n,c]=m.useState([]),[x,N]=m.useState(null),[j,y]=m.useState(null);m.useEffect(()=>{f(),u()},[i]);async function f(){if(!l){console.warn("AIConsumptionTab: client not provided"),o(!1);return}try{o(!0);const{data:h,error:v}=await l.from("ai_user_consumption_summary").select("*").gte("month",`${i}-01`).lt("month",qe(i)).order("total_cost_usd",{ascending:!1});if(v)throw v;c(h||[]);const k=Ve(h||[]);N(k)}catch(h){console.error("Error loading consumption data:",h)}finally{o(!1)}}async function u(){if(l)try{const{data:h,error:v}=await l.from("ai_monthly_billing").select("*").eq("month",`${i}-01`).maybeSingle();if(v&&v.code!=="PGRST116")throw v;y(h)}catch(h){console.error("Error loading billing status:",h)}}async function g(){if(!n.length)return;const h=["Usuário","Email","Contexto","Mensagens","Tokens","Custo (USD)","Dias Ativos"],v=n.map(S=>[S.user_id,S.email,S.context,S.total_messages,S.total_tokens,S.total_cost_usd.toFixed(4),S.active_days]),k=[h.join(","),...v.map(S=>S.join(","))].join(`
|
|
16
|
+
`),T=new Blob([k],{type:"text/csv;charset=utf-8;"}),p=document.createElement("a");p.href=URL.createObjectURL(T),p.download=`ai-consumption-${i}.csv`,p.click()}async function b(){if(!l){alert("Cliente de banco de dados não configurado");return}if(confirm(`Fechar mês ${i} para billing?
|
|
17
|
+
|
|
18
|
+
Isso marcará o período como fechado e impedirá alterações.`))try{o(!0);const h=n.map(k=>({user_id:k.user_id,month:`${i}-01`,context:k.context,total_messages:k.total_messages,total_tokens:k.total_tokens,total_cost_usd:k.total_cost_usd,status:"closed",closed_at:new Date().toISOString()})),{error:v}=await l.from("ai_monthly_billing").upsert(h,{onConflict:"user_id,month,context"});if(v)throw v;alert(`✅ Mês ${i} fechado com sucesso!`),u()}catch(h){console.error("Error closing month:",h),alert("Erro ao fechar mês: "+h.message)}finally{o(!1)}}async function w(){if(!l){alert("Cliente de banco de dados não configurado");return}if(confirm(`Marcar mês ${i} como faturado?`))try{const{error:h}=await l.from("ai_monthly_billing").update({status:"billed",billed_at:new Date().toISOString()}).eq("month",`${i}-01`);if(h)throw h;alert("✅ Mês marcado como faturado!"),u()}catch(h){console.error("Error marking as billed:",h),alert("Erro: "+h.message)}}return a?e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600 mx-auto mb-4"}),e.jsx("p",{className:"text-gray-600",children:"Carregando dados de consumo..."})]})}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold text-gray-900",children:"💰 Consumo de AI"}),e.jsx("p",{className:"text-gray-600",children:"Monitore o uso de tokens e custos por usuário"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("select",{value:i,onChange:h=>d(h.target.value),className:"px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500",children:Ke().map(h=>e.jsx("option",{value:h,children:Ue(h)},h))}),e.jsx("button",{onClick:g,disabled:!n.length,className:"px-4 py-2 bg-green-600 text-white rounded-lg hover:bg-green-700 transition-colors disabled:bg-gray-300 disabled:cursor-not-allowed",children:"📥 Exportar CSV"})]})]}),j&&e.jsx("div",{className:`p-4 rounded-lg border-2 ${j.status==="open"?"bg-blue-50 border-blue-200":j.status==="closed"?"bg-yellow-50 border-yellow-200":j.status==="billed"?"bg-green-50 border-green-200":"bg-gray-50 border-gray-200"}`,children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs("p",{className:"font-semibold text-gray-900",children:["Status do Mês: ",j.status==="open"?"🔓 Aberto":j.status==="closed"?"🔒 Fechado":j.status==="billed"?"✅ Faturado":j.status==="paid"?"💰 Pago":j.status]}),j.closed_at&&e.jsxs("p",{className:"text-sm text-gray-600",children:["Fechado em: ",new Date(j.closed_at).toLocaleString("pt-BR")]})]}),e.jsxs("div",{className:"flex gap-2",children:[j.status==="open"&&e.jsx("button",{onClick:b,className:"px-4 py-2 bg-yellow-600 text-white rounded-lg hover:bg-yellow-700",children:"🔒 Fechar Mês"}),j.status==="closed"&&e.jsx("button",{onClick:w,className:"px-4 py-2 bg-green-600 text-white rounded-lg hover:bg-green-700",children:"✅ Marcar como Faturado"})]})]})}),!j&&i===F()&&e.jsx("div",{className:"p-4 bg-blue-50 border border-blue-200 rounded-lg",children:e.jsxs("p",{className:"text-blue-900",children:["💡 ",e.jsx("strong",{children:"Mês atual em andamento."})," Feche o mês no último dia para gerar billing."]})}),x&&e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"bg-white p-4 rounded-lg border border-gray-200",children:[e.jsx("p",{className:"text-sm text-gray-600",children:"Total de Usuários"}),e.jsx("p",{className:"text-2xl font-bold text-gray-900",children:x.uniqueUsers})]}),e.jsxs("div",{className:"bg-white p-4 rounded-lg border border-gray-200",children:[e.jsx("p",{className:"text-sm text-gray-600",children:"Total de Mensagens"}),e.jsx("p",{className:"text-2xl font-bold text-gray-900",children:x.totalMessages.toLocaleString()})]}),e.jsxs("div",{className:"bg-white p-4 rounded-lg border border-gray-200",children:[e.jsx("p",{className:"text-sm text-gray-600",children:"Total de Tokens"}),e.jsx("p",{className:"text-2xl font-bold text-gray-900",children:x.totalTokens.toLocaleString()})]}),e.jsxs("div",{className:"bg-white p-4 rounded-lg border border-gray-200",children:[e.jsx("p",{className:"text-sm text-gray-600",children:"Custo Total"}),e.jsxs("p",{className:"text-2xl font-bold text-green-600",children:["$",x.totalCost.toFixed(2)]})]})]}),n.length>0?e.jsx("div",{className:"bg-white rounded-lg border border-gray-200 overflow-hidden",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{className:"bg-gray-50",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-4 py-3 text-left text-sm font-semibold text-gray-900",children:"Usuário"}),e.jsx("th",{className:"px-4 py-3 text-left text-sm font-semibold text-gray-900",children:"Contexto"}),e.jsx("th",{className:"px-4 py-3 text-right text-sm font-semibold text-gray-900",children:"Mensagens"}),e.jsx("th",{className:"px-4 py-3 text-right text-sm font-semibold text-gray-900",children:"Tokens"}),e.jsx("th",{className:"px-4 py-3 text-right text-sm font-semibold text-gray-900",children:"Custo (USD)"}),e.jsx("th",{className:"px-4 py-3 text-right text-sm font-semibold text-gray-900",children:"Dias Ativos"})]})}),e.jsx("tbody",{className:"divide-y divide-gray-200",children:n.map((h,v)=>{var k,T;return e.jsxs("tr",{className:"hover:bg-gray-50",children:[e.jsx("td",{className:"px-4 py-3",children:e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-gray-900",children:h.email}),e.jsxs("p",{className:"text-xs text-gray-500",children:[h.user_id.substring(0,8),"..."]})]})}),e.jsx("td",{className:"px-4 py-3",children:e.jsx("span",{className:`px-2 py-1 text-xs rounded-full ${h.context==="dev"?"bg-blue-100 text-blue-800":h.context==="user"?"bg-green-100 text-green-800":"bg-purple-100 text-purple-800"}`,children:h.context})}),e.jsx("td",{className:"px-4 py-3 text-right text-sm text-gray-900",children:((k=h.total_messages)==null?void 0:k.toLocaleString())||0}),e.jsx("td",{className:"px-4 py-3 text-right text-sm text-gray-900",children:((T=h.total_tokens)==null?void 0:T.toLocaleString())||0}),e.jsxs("td",{className:"px-4 py-3 text-right text-sm font-semibold text-green-600",children:["$",(h.total_cost_usd||0).toFixed(4)]}),e.jsx("td",{className:"px-4 py-3 text-right text-sm text-gray-600",children:h.active_days||0})]},v)})})]})}):e.jsxs("div",{className:"bg-gray-50 rounded-lg p-12 text-center",children:[e.jsx("div",{className:"text-6xl mb-4",children:"📊"}),e.jsx("p",{className:"text-gray-600",children:"Nenhum consumo registrado neste mês"})]})]})}function F(){const s=new Date;return`${s.getFullYear()}-${String(s.getMonth()+1).padStart(2,"0")}`}function qe(s){const[r,t]=s.split("-").map(Number);return t===12?`${r+1}-01`:`${r}-${String(t+1).padStart(2,"0")}`}function Ke(){const s=[],r=new Date;for(let t=5;t>=0;t--){const l=new Date(r.getFullYear(),r.getMonth()-t,1),a=`${l.getFullYear()}-${String(l.getMonth()+1).padStart(2,"0")}`;s.push(a)}return s}function Ue(s){const[r,t]=s.split("-");return`${["Jan","Fev","Mar","Abr","Mai","Jun","Jul","Ago","Set","Out","Nov","Dez"][parseInt(t)-1]}/${r}`}function Ve(s){const r=new Set(s.map(o=>o.user_id)).size,t=s.reduce((o,i)=>o+(i.total_messages||0),0),l=s.reduce((o,i)=>o+(i.total_tokens||0),0),a=s.reduce((o,i)=>o+(i.total_cost_usd||0),0);return{uniqueUsers:r,totalMessages:t,totalTokens:l,totalCost:a}}function Ge({ChatInterface:s,chatConfig:r}){const t=A(),l=s||(t==null?void 0:t.ChatInterface),a=r||(t==null?void 0:t.chatConfig),o="http://localhost:54321/functions/v1/openrouter-ai-service",i=`👋 Olá! Sou o **Nexus Dev Assistant**.
|
|
19
|
+
|
|
20
|
+
Posso ajudar você com:
|
|
21
|
+
• 🏗️ Arquitetura e design do projeto
|
|
22
|
+
• 💻 Localizar código e componentes
|
|
23
|
+
• 📋 Explicar PLANs e decisões técnicas
|
|
24
|
+
• 🐛 Entender débitos técnicos
|
|
25
|
+
• 📊 Consultar logs e histórico
|
|
26
|
+
• 🔧 Sugerir padrões e boas práticas
|
|
27
|
+
|
|
28
|
+
**Dica:** Seja específico nas suas perguntas para respostas mais precisas!`,d=["Como funciona o sistema de débitos técnicos?","Onde está o código de autenticação?","Quais migrations foram aplicadas recentemente?","Como funciona o drag and drop no CRM?","Qual é a estrutura de componentes do projeto?","Como criar um novo componente seguindo os padrões?"],n=N=>{console.log("[Dev Assistant] Message sent:",N)},c=N=>{console.log("[Dev Assistant] Response received:",N.substring(0,100)+"...")},x=N=>{console.error("[Dev Assistant] Error:",N)};return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsx("div",{className:"mb-4 bg-blue-50 border border-blue-200 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"text-2xl",children:"💡"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"font-semibold text-blue-900 mb-1",children:"Como usar o Dev Assistant"}),e.jsxs("ul",{className:"text-sm text-blue-800 space-y-1",children:[e.jsx("li",{children:"• Faça perguntas sobre a arquitetura, código ou decisões do projeto"}),e.jsx("li",{children:"• Use sugestões de perguntas para começar rapidamente"}),e.jsx("li",{children:"• Todas as respostas são baseadas na documentação e código do projeto"}),e.jsx("li",{children:"• Links clicáveis levam diretamente aos arquivos mencionados"})]})]})]})}),e.jsx("div",{className:"flex-1 min-h-0",children:l?e.jsx(l,{endpoint:(a==null?void 0:a.endpoint)||o,context:(a==null?void 0:a.context)||"dev",defaultModel:(a==null?void 0:a.defaultModel)||"anthropic/claude-sonnet-4",modelSelectable:(a==null?void 0:a.modelSelectable)||!1,temperature:(a==null?void 0:a.temperature)||.3,placeholder:(a==null?void 0:a.placeholder)||"Pergunte sobre o projeto...",welcomeMessage:(a==null?void 0:a.welcomeMessage)||i,suggestedQuestions:(a==null?void 0:a.suggestedQuestions)||d,onMessageSent:n,onResponseReceived:c,onError:x}):e.jsx("div",{className:"flex items-center justify-center h-full bg-gray-50 rounded-lg border-2 border-dashed border-gray-300",children:e.jsxs("div",{className:"text-center p-8",children:[e.jsx("div",{className:"text-6xl mb-4",children:"💬"}),e.jsx("p",{className:"text-gray-600 text-lg font-medium mb-2",children:"Chat Interface não configurado"}),e.jsx("p",{className:"text-gray-500 text-sm",children:"Passe o componente ChatInterface via props para habilitar o assistente"})]})})}),e.jsx("div",{className:"mt-4 text-xs text-gray-500 text-center",children:e.jsx("p",{children:'💰 Cada pergunta consome créditos da OpenRouter • 📊 Veja o consumo na aba "Consumo AI"'})})]})}exports.AIConsumptionTab=Oe;exports.AISettingsTab=Fe;exports.APIsSection=je;exports.ArchitectureTab=Ie;exports.AuthKeysSection=ge;exports.BacklogFilters=oe;exports.BacklogItem=ce;exports.BacklogStats=ne;exports.BacklogTab=Pe;exports.CategoryBadge=ie;exports.CredentialField=M;exports.DashboardLayout=O;exports.DatabaseSection=fe;exports.DebtCard=le;exports.DebtFilters=ae;exports.DebtStats=te;exports.DevAssistantTab=Ge;exports.DevToolsSection=pe;exports.GovernanceDashboard=O;exports.GovernanceProvider=Re;exports.HealthScore=q;exports.HealthStatusSection=be;exports.LogEntry=de;exports.LogFilters=me;exports.LogTimeline=xe;exports.LogsTab=$e;exports.MarkdownViewer=B;exports.MetricCard=E;exports.OverviewTab=Se;exports.QuickActionsGrid=se;exports.RecentActivityFeed=ee;exports.ServiceCard=he;exports.SeverityBadge=re;exports.SupabaseTab=Be;exports.TechDebtTab=Me;exports.TechStackList=K;exports.calculateHealthScore=H;exports.calculateProjectMetrics=Te;exports.copyToClipboard=_;exports.countProjectFiles=Ae;exports.debounce=Ee;exports.defaultUtils=_e;exports.filterBySearchText=Le;exports.formatTimestamp=P;exports.getCategoryIcon=W;exports.getPriorityColor=we;exports.getSeverityColor=z;exports.getSeverityIcon=Q;exports.getSeverityName=Ce;exports.getStatusColor=Z;exports.groupBy=De;exports.loadBacklogData=I;exports.loadLogsData=R;exports.loadPlansData=ke;exports.loadTechDebtData=$;exports.parseAllLogs=X;exports.parseArchitectureLog=G;exports.parseBacklogRegistry=V;exports.parseDecisionsLog=J;exports.parsePlan=Y;exports.parseTechDebtRegistry=U;exports.useGovernance=A;
|
|
29
|
+
//# sourceMappingURL=index.cjs.map
|