@decido/shell 4.0.3 → 4.0.4
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/dist/CenterComposite-V3LL23PG.mjs +64 -0
- package/dist/DebugPanel-NFXQOZQ6.mjs +1 -0
- package/dist/MorphShell-4JGDAN46.mjs +1 -0
- package/dist/PlaygroundAppSidebar-QI73PNRI.mjs +1 -0
- package/dist/PlaygroundChat-CBIIQMWU.mjs +1 -0
- package/dist/PlaygroundTerminal-MVZKXTYW.mjs +1 -0
- package/dist/PluginSandbox-MUNBFWGH.mjs +1 -0
- package/dist/ReactFlowEditor-2ALQWCHQ.mjs +6 -0
- package/dist/ReactFlowEditor-ROZ6RF3K.css +1 -0
- package/dist/TimelineEditor-UPRRXXVM.mjs +3 -0
- package/dist/WidgetSlotPanel-YX2VBQAP.mjs +1 -0
- package/dist/chunk-3YEFIKFH.mjs +1 -0
- package/dist/chunk-53FADIUX.mjs +1 -0
- package/dist/chunk-5FWJFDER.mjs +285 -0
- package/dist/chunk-6K3AFDP5.mjs +1 -0
- package/dist/chunk-AGAAZ2MU.mjs +1 -0
- package/dist/chunk-BCP43BRV.mjs +2 -0
- package/dist/chunk-BSJBW64M.mjs +1 -0
- package/dist/chunk-C5FD536O.mjs +1 -0
- package/dist/chunk-DTH34ILQ.mjs +1 -0
- package/dist/chunk-DWP77YZU.mjs +1 -0
- package/dist/chunk-O3OWL3Q2.mjs +1 -0
- package/dist/chunk-POBZMHZ5.mjs +7 -0
- package/dist/chunk-S3AQ4QDD.mjs +42 -0
- package/dist/chunk-XDA6ZRIQ.mjs +1 -0
- package/dist/chunk-XTDMHHMW.mjs +5 -0
- package/dist/chunk-YAYNNUEX.mjs +12 -0
- package/dist/chunk-YEKQJ4YC.mjs +1 -0
- package/dist/chunk-YHFKY5MB.mjs +1 -0
- package/dist/chunk-ZKD74U4X.mjs +1 -0
- package/dist/index.css +1 -561
- package/dist/index.js +462 -65086
- package/dist/index.mjs +50 -40209
- package/dist/useIntentLens-OCAUBNOQ.mjs +1 -0
- package/dist/useSuggestionsStore-Q4KVPU7L.mjs +1 -0
- package/dist/wasm-A4BTVJWV.mjs +1 -0
- package/package.json +15 -15
- package/dist/CenterComposite-RPEGBKQU.mjs +0 -1697
- package/dist/DebugPanel-KEKDMHDN.mjs +0 -14
- package/dist/MorphShell-FKDBB7E5.mjs +0 -14
- package/dist/PlaygroundAppSidebar-ALYJJGAO.mjs +0 -9
- package/dist/PlaygroundChat-MI2KXMK6.mjs +0 -15
- package/dist/PlaygroundTerminal-5AV4BJAI.mjs +0 -7
- package/dist/PluginSandbox-WMNAUQOJ.mjs +0 -188
- package/dist/ReactFlowEditor-RTF2652X.mjs +0 -3574
- package/dist/ReactFlowEditor-ZW5MCN5Y.css +0 -561
- package/dist/TimelineEditor-N4HRMHTB.mjs +0 -226
- package/dist/WidgetSlotPanel-KJI4CHHD.mjs +0 -11
- package/dist/chunk-2YMI4N5I.mjs +0 -2004
- package/dist/chunk-3BZX7LF2.mjs +0 -139
- package/dist/chunk-3P4P3M54.mjs +0 -136
- package/dist/chunk-F3OTFHNO.mjs +0 -40
- package/dist/chunk-IMHORBTL.mjs +0 -48
- package/dist/chunk-JF5QSJYT.mjs +0 -295
- package/dist/chunk-LWMMFTJC.mjs +0 -382
- package/dist/chunk-MSVEFEXE.mjs +0 -179
- package/dist/chunk-OCHGY2MN.mjs +0 -1662
- package/dist/chunk-PMYAM764.mjs +0 -813
- package/dist/chunk-Q64KZXPK.mjs +0 -43
- package/dist/chunk-QHQW2HMU.mjs +0 -155
- package/dist/chunk-RWZ4BOIN.mjs +0 -385
- package/dist/chunk-UHT6FIYF.mjs +0 -195
- package/dist/chunk-UJCSKKID.mjs +0 -30
- package/dist/chunk-V3CYNPGL.mjs +0 -8758
- package/dist/chunk-VBPGEFNM.mjs +0 -2381
- package/dist/chunk-XMSU6UWD.mjs +0 -158
- package/dist/chunk-ZCCCBHE6.mjs +0 -55
- package/dist/useIntentLens-LEQCAXCK.mjs +0 -13
- package/dist/useSuggestionsStore-4L2AIZ2D.mjs +0 -7
- package/dist/wasm-QFXGEYGP.mjs +0 -81
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import{d as Ae,e as ne}from"./chunk-C5FD536O.mjs";import{a as be}from"./chunk-6K3AFDP5.mjs";import{c as _e,d as Ee}from"./chunk-DTH34ILQ.mjs";import{a as V}from"./chunk-ZKD74U4X.mjs";import{a as se}from"./chunk-BSJBW64M.mjs";import{b as fe}from"./chunk-AGAAZ2MU.mjs";import{a as H}from"./chunk-XDA6ZRIQ.mjs";import J from"react";import{motion as de,AnimatePresence as lt}from"motion/react";import{Building2 as Ko,BrainCircuit as qo,Sparkles as Yo,Download as Zo}from"lucide-react";import Qt from"react";import{Search as pt,Workflow as ut,Zap as gt,Terminal as xt,BrainCircuit as ft,Command as $e,FileText as bt,Cpu as yt,ShoppingCart as ht,Building2 as vt,Activity as wt,Thermometer as kt,AlertTriangle as Nt,TrendingUp as Ct,PackageCheck as St,Network as It,Home as Mt,Settings as Pt,MessageSquare as Lt,Globe as Tt,Lock as At,Shield as _t,Database as Et,HardDrive as $t,Wifi as jt,Cloud as Rt,Server as Dt,BarChart3 as Ot,PieChart as Bt,Gauge as zt,Bell as Gt,Mail as Ht,Users as Vt,FolderOpen as Ft,Code as Ut,Layers as Wt,Box as Kt,Rocket as qt,Sparkles as Yt}from"lucide-react";var Zt={Search:pt,MessageSquare:Lt,BrainCircuit:ft,Sparkles:Yt,Command:$e,Terminal:xt,Workflow:ut,Zap:gt,Rocket:qt,Network:It,FileText:bt,FolderOpen:Ft,Code:Ut,Database:Et,ShoppingCart:ht,Building2:vt,Users:Vt,Activity:wt,Thermometer:kt,AlertTriangle:Nt,TrendingUp:Ct,BarChart3:Ot,PieChart:Bt,Gauge:zt,Bell:Gt,Cpu:yt,HardDrive:$t,Server:Dt,Cloud:Rt,Wifi:jt,PackageCheck:St,Lock:At,Shield:_t,Settings:Pt,Globe:Tt,Mail:Ht,Home:Mt,Layers:Wt,Box:Kt};function je(i){return Zt[i]||$e}var Re={emerald:"text-emerald-400",cyan:"text-cyan-400",purple:"text-purple-400",orange:"text-orange-400",yellow:"text-yellow-400",rose:"text-rose-400",red:"text-red-400",blue:"text-blue-400",indigo:"text-indigo-400",pink:"text-pink-400",amber:"text-amber-400",teal:"text-teal-400",lime:"text-lime-400",sky:"text-sky-400",violet:"text-violet-400",fuchsia:"text-fuchsia-400",white:"text-white"};function De(i){return Re[i]||"text-white"}function ta(i){return{text:Re[i]||"text-white",bg:`bg-${i}-500/10`,border:`border-${i}-500/20`}}import{jsx as le,jsxs as we}from"react/jsx-runtime";var Oe=Qt.memo(function({suggestions:s,onSelect:u}){return le("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-2.5 sm:gap-3 w-full min-w-0 max-w-full mt-3 sm:mt-4",children:s.map((l,d)=>{let o=je(l.icon),n=De(l.color);return le("div",{className:"group relative flex flex-col p-3 sm:p-4 bg-surface-tertiary hover:bg-surface-elevated border border-border-subtle hover:border-border-default rounded-xl sm:rounded-2xl text-left transition-all overflow-hidden h-auto min-h-[6rem] sm:h-32 min-w-0",children:we("div",{className:"flex-1 cursor-pointer flex flex-col min-w-0",onClick:()=>u(l.command),children:[we("div",{className:"flex items-center gap-2 mb-1.5 sm:mb-2",children:[le("div",{className:`p-1 sm:p-1.5 rounded-full bg-surface-glass shrink-0 ${n}`,children:le(o,{size:12,className:"sm:w-3.5 sm:h-3.5"})}),le("span",{className:`text-[11px] sm:text-xs font-bold truncate ${n}`,children:l.title})]}),we("p",{className:"text-xs sm:text-sm text-text-secondary flex-1 leading-snug line-clamp-2 sm:line-clamp-3 overflow-hidden break-words",children:['"',l.command,'"']})]})},d)})})});import{useState as K,useRef as Go,useEffect as Q,useMemo as Ce,useCallback as Ho}from"react";import{motion as Se,AnimatePresence as at}from"motion/react";import{Paperclip as Vo,FolderOpen as Fo}from"lucide-react";import{useTimelineStore as rt}from"@decido/engine";import{SlashCommandMenu as Uo,VoiceLiveMode as Wo}from"@decido/chat";import{useState as Be,useEffect as Jt,useMemo as ze,useCallback as Xt}from"react";import{getProviderStatuses as eo}from"@decido/kernel-bridge";var to={ollama:[{id:"qwen2.5:7b",label:"Qwen 2.5 7B",provider:"ollama",tag:"local",isLocal:!0},{id:"llama3.1:8b",label:"Llama 3.1 8B",provider:"ollama",tag:"local",isLocal:!0},{id:"codellama:7b",label:"CodeLlama 7B",provider:"ollama",tag:"code",isLocal:!0},{id:"mistral:7b",label:"Mistral 7B",provider:"ollama",tag:"local",isLocal:!0}],gemini:[{id:"gemini-3-flash-preview",label:"3.0 Flash",provider:"gemini",tag:"fast",isLocal:!1},{id:"gemini-3.1-pro-preview",label:"3.1 Pro",provider:"gemini",tag:"smart",isLocal:!1},{id:"gemini-3.1-flash-lite-preview",label:"3.1 Flash Lite",provider:"gemini",tag:"stable",isLocal:!1}],anthropic:[{id:"claude-sonnet-4-20250514",label:"Sonnet 4",provider:"anthropic",tag:"balanced",isLocal:!1},{id:"claude-3-5-haiku-20241022",label:"3.5 Haiku",provider:"anthropic",tag:"fast",isLocal:!1}],openai:[{id:"gpt-4o",label:"GPT-4o",provider:"openai",tag:"smart",isLocal:!1},{id:"gpt-4o-mini",label:"GPT-4o Mini",provider:"openai",tag:"fast",isLocal:!1}]},oo={ollama:{label:"Ollama",icon:"\u{1F999}",color:"#10b981",isLocal:!0},gemini:{label:"Gemini",icon:"\u2728",color:"#3b82f6",isLocal:!1},anthropic:{label:"Claude",icon:"\u{1F9E0}",color:"#a855f7",isLocal:!1},openai:{label:"OpenAI",icon:"\u26A1",color:"#06b6d4",isLocal:!1},mlx:{label:"MLX",icon:"\u{1F34E}",color:"#f59e0b",isLocal:!0}},Ge="decido_ai_model";function He(){let[i,s]=Be(()=>localStorage.getItem(Ge)||"gemini-3-flash-preview"),[u,l]=Be({});Jt(()=>{let a=!0,w=async()=>{try{let b=await eo();if(!a)return;let k={};for(let[y,P]of Object.entries(b))k[y]=P==="available"?"online":"offline";l(k)}catch{}};w();let f=setInterval(w,3e4);return()=>{a=!1,clearInterval(f)}},[]);let d=ze(()=>Object.entries(to).map(([a,w])=>{let f=oo[a]||{label:a,icon:"\u{1F916}",color:"#888",isLocal:!1};return{provider:a,label:f.label,icon:f.icon,color:f.color,isLocal:f.isLocal,models:w,status:u[a]||"unknown"}}),[u]),o=ze(()=>{for(let a of d){let w=a.models.find(f=>f.id===i);if(w)return{model:w,group:a}}return{model:{id:i,label:i,provider:"unknown",tag:"",isLocal:!1},group:d[0]||null}},[i,d]),n=Xt(a=>{s(a),localStorage.setItem(Ge,a),typeof window<"u"&&window.__DECIDO__&&(window.__DECIDO__.selectedModel=a)},[]);return{selectedModelId:i,selectedModel:o.model,selectedProvider:o.group,providerGroups:d,selectModel:n,providerStatuses:u}}import ao,{useState as ro}from"react";import{motion as so,AnimatePresence as no}from"motion/react";import{ChevronDown as lo,Zap as io}from"lucide-react";import{jsx as D,jsxs as oe}from"react/jsx-runtime";var Ve=ao.memo(function({onSelect:s}){let u=_e(),[l,d]=ro(null);return oe("div",{className:"w-full bg-surface-tertiary border border-border-default rounded-xl overflow-hidden shadow-2xl",children:[oe("div",{className:"px-3 py-2 flex items-center gap-2 border-b border-border-subtle",children:[D(io,{size:12,className:"text-cyan-400"}),D("span",{className:"text-[10px] text-text-muted font-mono uppercase tracking-wider",children:"Intenciones Disponibles"})]}),oe("div",{className:"max-h-[240px] overflow-y-auto custom-scrollbar",children:[u.map(o=>oe("div",{className:"border-b border-border-subtle last:border-0",children:[oe("button",{onClick:()=>d(l===o.type?null:o.type),className:"w-full flex items-center gap-2 px-3 py-2 text-xs hover:bg-surface-glass transition-colors",children:[D("span",{className:"text-base leading-none",children:o.icon}),D("span",{className:"font-semibold text-text-primary flex-1 text-left",children:o.label}),D("span",{className:"w-2 h-2 rounded-full shrink-0",style:{background:o.color}}),D(lo,{size:12,className:`text-text-muted transition-transform ${l===o.type?"rotate-180":""}`})]}),D(no,{children:l===o.type&&D(so.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.15},className:"overflow-hidden",children:D("div",{className:"px-3 pb-2 space-y-1",children:o.examples.map((n,a)=>oe("button",{onClick:()=>s(n),className:"w-full text-left px-2.5 py-1.5 rounded-lg text-[11px] text-text-secondary hover:text-text-primary hover:bg-surface-glass transition-colors font-mono leading-snug flex items-center gap-2 group",children:[D("span",{className:"w-1 h-1 rounded-full shrink-0 opacity-40 group-hover:opacity-100 transition-opacity",style:{background:o.color}}),D("span",{className:"flex-1",children:n}),D("span",{className:"text-[9px] text-text-muted opacity-0 group-hover:opacity-100 transition-opacity",children:"\u21B5"})]},a))})})})]},o.type)),u.length===0&&D("div",{className:"px-3 py-4 text-xs text-text-muted italic text-center",children:"Sin intenciones registradas"})]})]})});import yo,{useState as Ke,useMemo as ho,useRef as qe,useEffect as Ye}from"react";import{MonitorPlay as vo,Code2 as wo,ChevronDown as ko,Zap as No,Brain as Co,Settings2 as So}from"lucide-react";import co,{useState as mo,useRef as po,useEffect as uo}from"react";import{ChevronDown as go,Cpu as xo}from"lucide-react";import{Fragment as Ue,jsx as F,jsxs as U}from"react/jsx-runtime";var fo={fast:"bg-cyan-500/20 text-cyan-400",smart:"bg-purple-500/20 text-purple-400",stable:"bg-emerald-500/20 text-emerald-400",new:"bg-emerald-500/20 text-emerald-400",code:"bg-amber-500/20 text-amber-400",local:"bg-emerald-500/15 text-emerald-400",balanced:"bg-purple-500/15 text-purple-400",vision:"bg-pink-500/20 text-pink-400",audio:"bg-amber-500/20 text-amber-400",lite:"bg-surface-glass text-text-secondary"},bo={online:"bg-emerald-400 shadow-[0_0_6px_rgba(52,211,153,0.5)]",offline:"bg-red-400/60",unknown:"bg-surface-tertiary"},We=co.memo(function({selectedModelId:s,selectedModel:u,providerGroups:l,onSelect:d}){let[o,n]=mo(!1),a=po(null);uo(()=>{if(!o)return;let b=k=>{a.current&&!a.current.contains(k.target)&&n(!1)};return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[o]);let w=l.filter(b=>b.isLocal),f=l.filter(b=>!b.isLocal);return U("div",{ref:a,className:"relative",children:[U("button",{type:"button",onClick:b=>{b.stopPropagation(),n(!o)},className:`flex items-center gap-1.5 px-2 py-1.5 rounded-xl text-text-muted
|
|
2
|
+
hover:text-text-primary hover:bg-surface-glass transition-all text-[10px] font-mono`,title:`Modelo AI: ${u.label}`,children:[F(xo,{size:14}),F(go,{size:10})]}),o&&U("div",{className:`absolute left-0 w-64 bg-white/90 dark:bg-surface-tertiary border border-black/[0.06] dark:border-border-default
|
|
3
|
+
rounded-xl shadow-xl dark:shadow-2xl z-50 max-h-[360px] overflow-y-auto custom-scrollbar`,style:{bottom:"100%",marginBottom:"0.5rem"},children:[w.length>0&&U(Ue,{children:[U("div",{className:`px-3 py-1.5 text-[9px] text-text-muted font-mono uppercase tracking-wider
|
|
4
|
+
border-b border-border-subtle flex items-center gap-1.5`,children:[F("span",{className:"text-emerald-400",children:"\u25CF"})," Local"]}),w.map(b=>F(Fe,{group:b,selectedModelId:s,onSelect:k=>{d(k),n(!1)}},b.provider))]}),f.length>0&&U(Ue,{children:[U("div",{className:`px-3 py-1.5 text-[9px] text-text-muted font-mono uppercase tracking-wider
|
|
5
|
+
border-b border-border-subtle flex items-center gap-1.5`,children:[F("span",{className:"text-cyan-400",children:"\u2601"})," Cloud (BYOK)"]}),f.map(b=>F(Fe,{group:b,selectedModelId:s,onSelect:k=>{d(k),n(!1)}},b.provider))]})]})]})});function Fe({group:i,selectedModelId:s,onSelect:u}){return U("div",{children:[U("div",{className:"flex items-center gap-2 px-3 py-1.5 text-[10px] font-semibold text-text-secondary",children:[F("span",{children:i.icon}),F("span",{children:i.label}),F("span",{className:`w-1.5 h-1.5 rounded-full ml-auto ${bo[i.status]}`})]}),i.models.map(l=>U("button",{type:"button",onClick:d=>{d.stopPropagation(),u(l.id)},className:`w-full text-left px-3 py-2 text-xs flex items-center justify-between transition-colors
|
|
6
|
+
${s===l.id?"text-text-primary":"text-text-secondary hover:bg-surface-glass hover:text-text-primary"}`,style:s===l.id?{background:`${i.color}20`}:void 0,children:[F("span",{className:"font-mono truncate",children:l.label}),l.tag&&F("span",{className:`text-[9px] px-1.5 py-0.5 rounded-full font-semibold shrink-0 ${fo[l.tag]||"bg-surface-glass text-text-muted"}`,children:l.tag})]},l.id))]})}import{jsx as x,jsxs as C}from"react/jsx-runtime";var Ze=yo.memo(function({selectedModelId:s,selectedModel:u,providerGroups:l,onModelSelect:d,selectedShell:o,onShellSelect:n,showCanvas:a,setShowCanvas:w,prototypeBrand:f="decido",setPrototypeBrand:b,intentEnabled:k,onIntentToggle:y,showIntentPanel:P,onIntentPanelToggle:$}){let[G,A]=Ke(!1),[j,R]=Ke(!1),O=qe(null),t=qe(null),N=ho(()=>{try{return Ae()}catch{return[]}},[]),v=()=>{if(!b)return;let c=["startup_demo","enterprise_demo","industrial_demo"];b(c[(c.indexOf(f)+1)%c.length])};Ye(()=>{if(!G)return;let c=g=>{O.current&&!O.current.contains(g.target)&&A(!1)};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[G]),Ye(()=>{if(!j)return;let c=g=>{t.current&&!t.current.contains(g.target)&&R(!1)};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[j]);let L=o?ne(o):null,T=a||k||P;return C("div",{className:"flex flex-wrap items-center justify-center gap-0.5 sm:gap-1 xl:gap-2 relative flex-1 min-w-0",children:[x(We,{selectedModelId:s,selectedModel:u,providerGroups:l,onSelect:d}),x("div",{className:"w-px h-4 bg-surface-glass/80 mx-1"}),C("div",{ref:t,className:"relative",children:[C("button",{type:"button",onClick:c=>{c.stopPropagation(),R(!j),A(!1)},className:`flex items-center gap-1 px-2 py-1.5 rounded-xl hover:bg-surface-glass transition-all text-[10px] font-mono
|
|
7
|
+
${o?"":"text-text-muted hover:text-cyan-400"}`,style:o&&L?{color:L.color}:void 0,title:`Destino de salida: ${L?.label||o||"Ninguna (chat)"}`,children:[x("span",{className:"text-sm",children:L?.icon||"\u{1F4AC}"}),x(ko,{size:10})]}),j&&C("div",{className:`absolute left-1/2 -translate-x-1/2 sm:left-auto sm:translate-x-0 w-[220px] bg-white/95 dark:bg-surface-tertiary border border-black/[0.06] dark:border-border-default
|
|
8
|
+
rounded-2xl shadow-xl dark:shadow-2xl z-[100] max-h-[300px] overflow-y-auto custom-scrollbar flex flex-col backdrop-blur-xl`,style:{bottom:"100%",marginBottom:"0.6rem"},children:[x("div",{className:"px-3 py-2 text-[10px] text-text-muted font-mono uppercase tracking-wider bg-surface-base/50",children:"Destino de Salida"}),C("div",{className:"p-1 pb-2",children:[C("button",{type:"button",onClick:c=>{c.stopPropagation(),n(null),R(!1)},className:`w-full text-left px-3 py-2.5 rounded-xl text-xs transition-colors font-mono flex items-center gap-2.5
|
|
9
|
+
${o?"text-text-secondary hover:bg-surface-glass hover:text-text-primary":"bg-cyan-500/10 text-cyan-400 font-semibold"}`,children:[x("span",{className:"text-base leading-none w-4 text-center",children:"\u{1F4AC}"}),x("span",{children:"Ninguna (Chat)"})]}),x("div",{className:"h-px bg-border-subtle my-1 mx-1"}),N.map(c=>{let g=ne(c);return C("button",{type:"button",onClick:X=>{X.stopPropagation(),n(c),R(!1)},className:`w-full text-left px-3 py-2.5 mt-0.5 rounded-xl text-xs transition-colors font-mono flex items-center gap-2.5
|
|
10
|
+
${o===c?"text-text-primary font-semibold":"text-text-secondary hover:bg-surface-glass hover:text-text-primary"}`,style:o===c?{background:`${g.color}20`}:void 0,children:[x("span",{className:"text-base leading-none w-4 text-center",children:g.icon}),x("span",{className:"flex-1 truncate",children:g.label}),x("span",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{background:g.color}})]},c)})]})]})]}),x("div",{className:"w-px h-4 bg-surface-glass/80 mx-1"}),C("div",{ref:O,className:"relative",children:[C("button",{type:"button",onClick:c=>{c.stopPropagation(),A(!G),R(!1)},className:`w-8 h-8 rounded-xl flex items-center justify-center transition-all relative
|
|
11
|
+
${G||T?"text-text-primary bg-surface-glass":"text-text-secondary hover:text-text-primary hover:bg-surface-glass"}`,title:"Opciones del Agente",children:[x(So,{size:16}),T&&x("div",{className:"absolute top-1.5 right-1.5 w-1.5 h-1.5 rounded-full bg-cyan-400"})]}),G&&C("div",{className:`absolute left-1/2 -translate-x-1/2 sm:left-auto sm:translate-x-0 sm:-right-2 w-[240px] sm:w-[260px] bg-white/95 dark:bg-surface-tertiary border border-black/[0.06] dark:border-border-default
|
|
12
|
+
rounded-2xl shadow-xl dark:shadow-2xl z-[100] max-h-[380px] overflow-y-auto custom-scrollbar flex flex-col backdrop-blur-xl`,style:{bottom:"100%",marginBottom:"0.6rem"},children:[x("div",{className:"px-3 py-2 text-[10px] text-text-muted font-mono uppercase tracking-wider bg-surface-base/50",children:"Agente y Contexto"}),C("div",{className:"p-1",children:[C("button",{type:"button",onClick:c=>{c.stopPropagation(),y()},className:`w-full text-left px-3 py-2.5 rounded-xl text-xs transition-colors font-mono flex items-center justify-between group
|
|
13
|
+
${k?"text-emerald-500 bg-emerald-500/10":"text-text-secondary hover:bg-surface-glass hover:text-text-primary"}`,children:[C("div",{className:"flex items-center gap-2.5",children:[x(Co,{size:15}),x("span",{children:"Interpretar intenciones"})]}),x("div",{className:`w-7 h-4 rounded-full flex items-center p-0.5 transition-colors border ${k?"bg-emerald-500 border-emerald-500/0":"bg-surface-glass border-border-default group-hover:bg-border-subtle"}`,children:x("div",{className:`w-3 h-3 rounded-full bg-white transition-transform ${k?"translate-x-[12px]":"translate-x-0"}`})})]}),C("button",{type:"button",onClick:c=>{c.stopPropagation(),$(),A(!1)},className:"w-full text-left px-3 py-2.5 mt-0.5 rounded-xl text-xs text-text-secondary hover:bg-surface-glass hover:text-cyan-500 transition-colors font-mono flex items-center gap-2.5",children:[x(No,{size:15}),x("span",{children:"Explorar cat\xE1logo"})]})]}),x("div",{className:"h-px bg-border-subtle"}),x("div",{className:"px-3 py-2 text-[10px] text-text-muted font-mono uppercase tracking-wider bg-surface-base/50",children:"Entorno Visual"}),C("div",{className:"p-1 pb-2",children:[w&&C("button",{type:"button",onClick:c=>{c.stopPropagation(),w(!a),A(!1)},className:`w-full text-left px-3 py-2.5 rounded-xl text-xs transition-colors font-mono flex items-center justify-between
|
|
14
|
+
${a?"text-primary bg-primary/10":"text-text-secondary hover:bg-surface-glass hover:text-text-primary"}`,children:[C("div",{className:"flex items-center gap-2.5",children:[x(vo,{size:15}),x("span",{children:"Lienzo (Canvas)"})]}),a&&x("div",{className:"w-2 h-2 rounded-full bg-primary"})]}),b&&x("button",{type:"button",onClick:c=>{c.stopPropagation(),v()},className:"w-full mt-0.5 text-left px-3 py-2.5 rounded-xl text-xs text-amber-500 hover:bg-surface-glass transition-colors font-mono flex items-center justify-between",children:C("div",{className:"flex items-center gap-2.5",children:[x(wo,{size:15}),C("span",{children:["UI: ",f]})]})})]})]})]})]})});import Io from"react";import{Send as Mo,Mic as Po,Square as Lo,Sparkles as To}from"lucide-react";import{jsx as W,jsxs as Qe}from"react/jsx-runtime";var Je=Io.memo(function({inputHasText:s,isGenerating:u,isTranscribing:l,onToggleTranscribing:d,onSend:o,setIsVoiceActive:n}){return u?W("div",{className:"flex items-center gap-2 min-w-[100px] justify-end",children:W("button",{type:"button",onClick:a=>a.stopPropagation(),className:`w-12 h-12 rounded-full text-text-primary bg-red-500/80 hover:bg-red-500 flex items-center justify-center
|
|
15
|
+
transition-colors shadow-[0_0_15px_rgba(239,68,68,0.3)]`,title:"Detener generaci\xF3n",children:W(Lo,{size:18})})}):Qe("div",{className:"flex items-center gap-2 min-w-[100px] justify-end",children:[W("button",{type:"button",onClick:a=>{a.stopPropagation(),d()},className:`w-10 h-10 rounded-full flex items-center justify-center transition-all
|
|
16
|
+
${l?"text-red-400 bg-red-400/10 animate-pulse":"text-text-secondary hover:text-text-primary hover:bg-surface-glass"}`,title:"Reconocimiento de voz (STT)",children:W(Po,{size:20})}),s?W("button",{type:"button",onClick:a=>{a.stopPropagation(),o()},className:`w-12 h-12 rounded-full text-text-inverse bg-cyan-400 hover:bg-cyan-300 flex items-center justify-center
|
|
17
|
+
transition-colors shadow-[0_0_15px_rgba(34,211,238,0.3)]`,title:"Enviar",children:W(Mo,{size:20,className:"ml-1"})}):n?Qe("button",{type:"button",onClick:a=>{a.stopPropagation(),n(!0)},className:`w-12 h-12 rounded-full text-cyan-400 bg-cyan-500/10 hover:bg-cyan-500/20 flex items-center justify-center
|
|
18
|
+
border border-cyan-500/20 transition-all shadow-[0_0_15px_rgba(6,182,212,0.15)]
|
|
19
|
+
hover:shadow-[0_0_20px_rgba(6,182,212,0.3)] group relative overflow-hidden`,title:"Hablar con la IA (Live)",children:[W(To,{size:22,className:"relative z-10 transition-transform group-hover:scale-110"}),W("div",{className:"absolute inset-0 bg-linear-to-r from-cyan-400 to-purple-500 rounded-full opacity-0 group-hover:opacity-20 transition-opacity"})]}):null]})});import Ao,{useState as ke,useMemo as Ne,useCallback as Xe}from"react";import{motion as ie,AnimatePresence as et}from"motion/react";import{FolderOpen as tt,Palette as _o,Search as Eo,Tag as $o,Clock as jo,Trash2 as Ro,X as Do}from"lucide-react";import{useShallow as Oo}from"zustand/react/shallow";import{jsx as m,jsxs as E}from"react/jsx-runtime";var Bo=[{id:"landing-saas",title:"Landing SaaS",category:"Marketing",emoji:"\u{1F680}",color:"#7c3aed",description:"Hero, CTA, features",html:'<section class="min-h-screen bg-linear-to-br from-violet-950 via-indigo-950 to-black text-white flex items-center justify-center"><h1 class="text-5xl font-bold">Landing SaaS</h1></section>'},{id:"dashboard",title:"Dashboard",category:"App",emoji:"\u{1F4CA}",color:"#06b6d4",description:"M\xE9tricas, sidebar, cards",html:'<div class="min-h-screen bg-gray-950 text-white flex items-center justify-center"><h1 class="text-5xl font-bold">Dashboard</h1></div>'},{id:"portfolio",title:"Portfolio",category:"Personal",emoji:"\u{1F3A8}",color:"#ec4899",description:"Bio, proyectos, contacto",html:'<div class="min-h-screen bg-gray-950 text-white flex items-center justify-center"><h1 class="text-5xl font-bold">Portfolio</h1></div>'},{id:"pricing",title:"Pricing",category:"Marketing",emoji:"\u{1F4B3}",color:"#10b981",description:"3 planes, toggle anual",html:'<section class="min-h-screen bg-gray-950 text-white flex items-center justify-center"><h1 class="text-5xl font-bold">Pricing</h1></section>'},{id:"login",title:"Login",category:"Auth",emoji:"\u{1F510}",color:"#f59e0b",description:"Form, social, glassmorphism",html:'<div class="min-h-screen bg-gray-950 text-white flex items-center justify-center"><h1 class="text-5xl font-bold">Login</h1></div>'},{id:"blog",title:"Blog",category:"Content",emoji:"\u{1F4DD}",color:"#3b82f6",description:"Lista de art\xEDculos",html:'<div class="min-h-screen bg-gray-950 text-white flex items-center justify-center"><h1 class="text-5xl font-bold">Blog</h1></div>'}],zo=["All","Marketing","App","Personal","Auth","Content","Generated"],ot=Ao.memo(function({isOpen:s,onClose:u,onLoadTemplate:l,onOpenInstance:d}){let[o,n]=ke("creations"),[a,w]=ke(""),[f,b]=ke("All"),k=V(Oo(t=>Array.from(t.instances.values()))),y=V(t=>t.setActiveInstance),P=V(t=>t.removeInstance),$=Ne(()=>k.filter(t=>t.data?.html||t.shellType==="iframe").sort((t,N)=>N.createdAt-t.createdAt),[k]),G=Ne(()=>Bo.filter(t=>{let N=!a||t.title.toLowerCase().includes(a.toLowerCase())||t.description.toLowerCase().includes(a.toLowerCase()),v=f==="All"||t.category===f;return N&&v}),[a,f]),A=Ne(()=>{if(!a)return $;let t=a.toLowerCase();return $.filter(N=>N.label.toLowerCase().includes(t)||N.shellType.toLowerCase().includes(t))},[$,a]),j=Xe(t=>{y(t.id),fe.getState().setActiveTab(`morph-${t.id}`),d(t.id),u()},[y,d,u]),R=Xe(t=>{l(t.html),u()},[l,u]),O=t=>{let N=Date.now()-t,v=Math.floor(N/6e4);if(v<1)return"ahora";if(v<60)return`${v}m`;let L=Math.floor(v/60);return L<24?`${L}h`:`${Math.floor(L/24)}d`};return m(et,{children:s&&m(ie.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0,y:8},className:"absolute bottom-full left-0 right-0 z-50 mb-2",children:E("div",{className:`bg-white/95 dark:bg-[#1a1a2e] border border-black/[0.08] dark:border-border-default
|
|
20
|
+
rounded-2xl shadow-xl dark:shadow-2xl overflow-hidden max-h-[420px] flex flex-col backdrop-blur-xl`,children:[E("div",{className:"flex items-center justify-between px-4 py-3 border-b border-black/[0.06] dark:border-border-subtle shrink-0",children:[E("div",{className:"flex items-center gap-3",children:[m("h3",{className:"text-sm font-bold text-text-primary",children:"Librer\xEDa"}),E("div",{className:"flex bg-black/[0.04] dark:bg-surface-glass rounded-lg p-0.5",children:[E("button",{onClick:()=>n("creations"),className:`px-3 py-1.5 text-[11px] font-semibold rounded-md transition-all flex items-center gap-1.5
|
|
21
|
+
${o==="creations"?"bg-white dark:bg-surface-tertiary text-text-primary shadow-sm":"text-text-muted hover:text-text-secondary"}`,children:[m(tt,{size:12})," Mis Creaciones",$.length>0&&m("span",{className:"text-[9px] bg-cyan-500/20 text-cyan-600 dark:text-cyan-400 px-1.5 py-0.5 rounded-full font-bold",children:$.length})]}),E("button",{onClick:()=>n("templates"),className:`px-3 py-1.5 text-[11px] font-semibold rounded-md transition-all flex items-center gap-1.5
|
|
22
|
+
${o==="templates"?"bg-white dark:bg-surface-tertiary text-text-primary shadow-sm":"text-text-muted hover:text-text-secondary"}`,children:[m(_o,{size:12})," Templates"]})]})]}),m("button",{onClick:u,className:"w-7 h-7 rounded-lg text-text-muted hover:text-text-primary hover:bg-black/[0.04] dark:hover:bg-surface-glass flex items-center justify-center transition-colors",children:m(Do,{size:14})})]}),E("div",{className:"px-4 py-2 border-b border-black/[0.04] dark:border-border-subtle shrink-0 flex items-center gap-2",children:[E("div",{className:"flex-1 relative",children:[m(Eo,{size:13,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-text-muted"}),m("input",{type:"text",placeholder:"Buscar...",value:a,onChange:t=>w(t.target.value),className:`w-full pl-8 pr-3 py-1.5 bg-black/[0.03] dark:bg-surface-glass border border-transparent focus:border-cyan-500/30
|
|
23
|
+
rounded-lg text-xs text-text-primary placeholder-text-muted outline-hidden transition`})]}),o==="templates"&&m("div",{className:"flex gap-1 overflow-x-auto no-scrollbar",children:zo.filter(t=>t!=="Generated").map(t=>m("button",{onClick:()=>b(t),className:`px-2 py-1 text-[10px] font-semibold rounded-md whitespace-nowrap transition-all
|
|
24
|
+
${f===t?"bg-cyan-500/15 text-cyan-600 dark:text-cyan-400":"text-text-muted hover:text-text-secondary hover:bg-black/[0.04] dark:hover:bg-surface-glass"}`,children:t},t))})]}),m("div",{className:"flex-1 overflow-y-auto px-3 py-3 custom-scrollbar",children:m(et,{mode:"wait",children:o==="creations"?m(ie.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},children:A.length===0?E("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[m(tt,{size:32,className:"text-text-muted/30 mb-3"}),m("p",{className:"text-sm text-text-muted",children:"Sin creaciones a\xFAn"}),m("p",{className:"text-[10px] text-text-muted/60 mt-1",children:"Genera una p\xE1gina desde el chat para verla aqu\xED"})]}):m("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-2",children:A.map((t,N)=>E(ie.button,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{delay:N*.03},onClick:()=>j(t),className:`group relative bg-black/[0.02] dark:bg-surface-glass border border-black/[0.06] dark:border-border-subtle
|
|
25
|
+
hover:border-cyan-500/30 rounded-xl p-3 text-left transition-all hover:shadow-md overflow-hidden`,children:[m("div",{className:`h-16 rounded-lg bg-gradient-to-br from-cyan-500/10 to-purple-500/10 dark:from-cyan-500/5 dark:to-purple-500/5
|
|
26
|
+
mb-2 flex items-center justify-center overflow-hidden border border-black/[0.04] dark:border-border-subtle`,children:m("span",{className:"text-lg opacity-50",children:"\u{1F310}"})}),m("h4",{className:"text-[11px] font-semibold text-text-primary truncate",children:t.label}),E("div",{className:"flex items-center gap-1.5 mt-1",children:[E("span",{className:"flex items-center gap-1 text-[9px] text-text-muted",children:[m(jo,{size:9})," ",O(t.createdAt)]}),E("span",{className:"flex items-center gap-1 text-[9px] px-1.5 py-0.5 rounded bg-cyan-500/10 text-cyan-600 dark:text-cyan-400 font-semibold",children:[m($o,{size:8})," ",t.shellType]})]}),m("div",{className:"absolute top-1.5 right-1.5 opacity-0 group-hover:opacity-100 transition-opacity flex gap-1",children:m("button",{onClick:v=>{v.stopPropagation(),P(t.id)},className:"w-5 h-5 rounded bg-red-500/10 hover:bg-red-500/20 text-red-400 flex items-center justify-center",title:"Eliminar",children:m(Ro,{size:10})})})]},t.id))})},"creations"):m(ie.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},children:m("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-2",children:G.map((t,N)=>E(ie.button,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{delay:N*.03},onClick:()=>R(t),className:`group bg-black/[0.02] dark:bg-surface-glass border border-black/[0.06] dark:border-border-subtle
|
|
27
|
+
hover:border-opacity-50 rounded-xl p-3 text-left transition-all hover:shadow-md overflow-hidden`,style:{"--hover-color":t.color},children:[m("div",{className:"h-14 rounded-lg mb-2 flex items-center justify-center transition-all group-hover:scale-[1.02]",style:{background:`linear-gradient(135deg, ${t.color}20, ${t.color}08)`},children:m("span",{className:"text-2xl",children:t.emoji})}),m("h4",{className:"text-[11px] font-semibold text-text-primary",children:t.title}),m("p",{className:"text-[9px] text-text-muted mt-0.5",children:t.description}),m("span",{className:"inline-block mt-1.5 text-[9px] font-semibold px-1.5 py-0.5 rounded",style:{background:`${t.color}15`,color:t.color},children:t.category})]},t.id))})},"templates")})})]})})})});import{jsx as S,jsxs as ae}from"react/jsx-runtime";var st=({onSend:i,isGenerating:s,isVoiceActive:u=!1,setIsVoiceActive:l,VoiceWidget:d,dynamicPersona:o,setSuggestions:n,selectedVoice:a,showCanvas:w,setShowCanvas:f,prototypeBrand:b="decido",setPrototypeBrand:k})=>{let[y,P]=K(""),[$,G]=K(!1),[A,j]=K(!1),[R,O]=K(0),[t,N]=K(!1),[v,L]=K(!1),[T,c]=K(!0),[g,X]=K(()=>localStorage.getItem("decido_selected_shell")),ee=Go(null),{selectedModelId:Y,selectedModel:ce,providerGroups:me,selectModel:pe}=He();Q(()=>{typeof window<"u"&&window.__DECIDO__&&(window.__DECIDO__.intentEnabled=T)},[T]);let B=H(e=>e.activeChatId);Q(()=>{B&&H.setState(e=>({chatInstances:e.chatInstances.map(h=>h.id===B?{...h,model:Y}:h)}))},[Y,B]),Q(()=>{if(g?localStorage.setItem("decido_selected_shell",g):localStorage.removeItem("decido_selected_shell"),typeof window<"u"&&window.__DECIDO__&&(window.__DECIDO__.selectedShell=g),!!B)if(H.setState(e=>({chatInstances:e.chatInstances.map(h=>h.id===B?{...h,shellType:g||void 0}:h)})),g){let e=ne(g);V.getState().upsertInstance({id:B,sourceChatId:B,shellType:g,label:e.label||g,data:{}})}else V.getState().removeInstance(B)},[g,B]);let Z=H(e=>e.chatInstances.find(h=>h.id===e.activeChatId));Q(()=>{if(!Z)return;Z.model&&Z.model!==Y&&pe(Z.model);let e=Z.shellType||null;e!==g&&X(e)},[B]);let{primaryIntent:q}=Ee(T?y:""),ue=be(e=>e.seeds),ge=be(e=>e.generated),r=be(e=>e.pluginSuggestions),z=Ce(()=>{let e=Object.values(r).flat();return[...ge,...ue,...e]},[ge,ue,r]),[ye,xe]=K(0);Q(()=>{if(z.length<=1)return;let e=setInterval(()=>xe(h=>(h+1)%z.length),4e3);return()=>clearInterval(e)},[z.length]);let it=z.length>0?z[ye%z.length]:"Escribe / para comandos... (Shift+Enter nueva l\xEDnea)";Q(()=>{let e=ee.current;e&&(e.style.height="auto",e.style.height=`${Math.min(e.scrollHeight,200)}px`)},[y]);let he=rt(e=>e.timelines),Pe=rt(e=>e.blueprintLibrary),Le=se(e=>e.components),ve=Ce(()=>{let e=Object.keys(he).map(_=>({id:_,label:_,description:he[_]?.name||_})),h=Object.entries(Pe).map(([_,I])=>({id:_,label:I.name||_,description:`v${I.metadata?.version||"?"} \xB7 ${I.metadata?.tags?.join(", ")||""}`})),re=Object.values(Le).map(_=>({id:_.id,label:_.name,description:_.category}));return[{command:"/run",label:"Run Flow",description:"Ejecutar un flujo",icon:"\u25B6",subCommands:e},{command:"/flows",label:"List Flows",description:"Ver todos los flujos",icon:"\u{1F4CB}"},{command:"/blueprints",label:"Blueprints",description:"Subflujos disponibles",icon:"\u{1F517}",subCommands:h},{command:"/ui",label:"UI Components",description:"Biblioteca de componentes",icon:"\u{1F3A8}",subCommands:re},{command:"/reset",label:"Reset Engine",description:"Reiniciar el motor",icon:"\u{1F504}"},{command:"/tts",label:"Voice Synthesis",description:"Generar audio TTS con Kokoro",icon:"\u{1F399}\uFE0F"}]},[he,Pe,Le]),te=Ce(()=>{if(!y.startsWith("/"))return[];let e=y.split(" "),h=e[0].toLowerCase(),re=e.slice(1).join(" ").toLowerCase(),_=ve.find(I=>I.command===h);return _?.subCommands?_.subCommands.filter(I=>!re||I.id.toLowerCase().includes(re)||I.label.toLowerCase().includes(re)).map(I=>({...I,type:"sub",parentCommand:h})):ve.filter(I=>I.command.startsWith(h)).map(I=>({id:I.command,label:I.label,description:I.description,icon:I.icon,type:"command",subCommands:I.subCommands}))},[y,ve]);Q(()=>{j(y.startsWith("/")&&te.length>0),O(0)},[y,te.length]);let Te=e=>{e.type==="command"?e.subCommands?(P(e.id+" "),ee.current?.focus()):(i(e.id),P(""),j(!1)):e.type==="sub"&&(i(`${e.parentCommand} ${e.id}`),P(""),j(!1))},dt=e=>{if(A){e.key==="ArrowDown"?(e.preventDefault(),O(h=>Math.min(h+1,te.length-1))):e.key==="ArrowUp"?(e.preventDefault(),O(h=>Math.max(h-1,0))):e.key==="Enter"&&te[R]?(e.preventDefault(),Te(te[R])):e.key==="Escape"&&j(!1);return}e.key==="Enter"&&!e.shiftKey&&(e.preventDefault(),y.trim()&&!s&&(i(y.trim()),P("")))},ct=e=>{e.preventDefault(),y.trim()&&!s&&(i(y.trim()),P(""))},mt=Ho(()=>{y.trim()&&!s&&(i(y.trim()),P(""))},[y,s,i]);return ae(Se.div,{layout:!0,className:`w-full relative ${u?"h-64":""}`,children:[S(Uo,{isOpen:A,items:te,activeIndex:R,onSelect:Te,onHover:O}),S(at,{children:t&&S(Se.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},className:"absolute bottom-full left-0 right-0 mb-2 z-50",children:S(Ve,{onSelect:e=>{P(e),N(!1),ee.current?.focus()}})})}),S(ot,{isOpen:v,onClose:()=>L(!1),onLoadTemplate:e=>{i(`/template ${e.slice(0,100)}`)},onOpenInstance:e=>{V.getState().setActiveInstance(e),f&&f(!0)}}),S("div",{className:`bg-white/80 dark:bg-surface-tertiary border border-black/[0.08] dark:border-border-default rounded-4xl flex flex-col p-2 shadow-sm dark:shadow-2xl transition-all duration-300
|
|
28
|
+
${u?"h-full border-cyan-500/30":"focus-within:border-black/[0.12] dark:focus-within:border-border-strong focus-within:shadow-md dark:focus-within:shadow-lg"}`,children:S(at,{mode:"wait",children:u?S(Wo,{VoiceWidget:d,dynamicPersona:o,setSuggestions:n,selectedVoice:a,onClose:()=>l?.(!1)}):ae(Se.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"flex flex-col w-full h-full cursor-text",onClick:e=>{let h=e.currentTarget.querySelector("textarea");h&&e.target===e.currentTarget&&h.focus()},children:[ae("form",{onSubmit:ct,className:"relative flex items-center px-3 sm:px-4 py-2 sm:py-3 min-h-[48px] sm:min-h-[60px]",children:[S("textarea",{ref:ee,placeholder:$?"Escuchando...":it,value:y,onChange:e=>P(e.target.value),onKeyDown:dt,rows:1,className:"w-full bg-transparent text-text-primary placeholder-text-muted outline-hidden text-sm sm:text-[15px] leading-relaxed resize-none",disabled:s,style:{maxHeight:"200px"}}),q&&!A&&ae("div",{className:"absolute right-4 top-1/2 -translate-y-1/2 flex items-center gap-1 px-2 py-1 rounded-full text-[10px] font-semibold border",style:{background:`${q.color}15`,borderColor:`${q.color}30`,color:q.color},children:[S("span",{children:q.icon}),S("span",{children:q.label})]})]}),ae("div",{className:"flex flex-wrap items-center justify-between px-2 pb-1 relative z-10 w-full gap-y-2",children:[ae("div",{className:"flex items-center gap-1 shrink-0",children:[S("button",{type:"button",onClick:()=>{L(!v),N(!1)},className:`w-10 h-10 rounded-full flex items-center justify-center transition-colors
|
|
29
|
+
${v?"text-cyan-400 bg-cyan-500/10":"text-text-secondary hover:text-text-primary hover:bg-surface-glass"}`,title:"Librer\xEDa de recursos",children:S(Fo,{size:20})}),S("button",{type:"button",className:"w-10 h-10 rounded-full text-text-secondary hover:text-text-primary hover:bg-surface-glass flex items-center justify-center transition-colors",title:"Adjuntar",children:S(Vo,{size:20})})]}),S(Ze,{selectedModelId:Y,selectedModel:ce,providerGroups:me,onModelSelect:pe,selectedShell:g,onShellSelect:X,showCanvas:w,setShowCanvas:f,prototypeBrand:b,setPrototypeBrand:k,intentEnabled:T,onIntentToggle:()=>c(!T),showIntentPanel:t,onIntentPanelToggle:()=>N(!t)}),S(Je,{inputHasText:!!y.trim(),isGenerating:s,isTranscribing:$,onToggleTranscribing:()=>G(!$),onSend:mt,setIsVoiceActive:l})]})]},"text-mode")})}),S("div",{className:"text-center mt-3",children:S("p",{className:"text-[10px] md:text-[11px] text-text-muted font-medium tracking-wide",children:"Decido puede equivocarse. Considera revisar la informaci\xF3n importante."})})]})};import{ChatProvider as Qo,ChatMessageRow as Jo,ChatExportMenu as Xo}from"@decido/chat";import{useTimelineStore as Ie}from"@decido/engine";import{useEngineStore as Me}from"@decido/engine";function nt(i,s){if(!i.startsWith("/"))return!1;let u=i.split(" "),l=u[0].toLowerCase(),d=u.slice(1).join(" ");switch(l){case"/run":return d?(Ie.getState().timelines[d]?(s.setPrototypeBrand(d),Me.getState().resetEngine(),s.addChatMessage({type:"text",sender:"system",text:`\u25B6\uFE0F Ejecutando flujo: **${d}**`,actorId:"system"}),setTimeout(()=>{Me.getState().dispatchEvent({type:"SYSTEM_START"})},100)):s.addChatMessage({type:"alert",sender:"system",text:`Flujo "${d}" no encontrado. Usa /flows para ver los disponibles.`,actorId:"system"}),!0):!1;case"/flows":{let o=Object.keys(Ie.getState().timelines);return s.addChatMessage({type:"text",sender:"system",text:`\u{1F4CB} Flujos disponibles:
|
|
30
|
+
${o.map(n=>`\u2022 ${n}`).join(`
|
|
31
|
+
`)}
|
|
32
|
+
|
|
33
|
+
Usa /run [nombre] para ejecutar.`,actorId:"system"}),!0}case"/blueprints":{let o=Object.entries(Ie.getState().blueprintLibrary);return s.addChatMessage({type:"text",sender:"system",text:`\u{1F4E6} Blueprints:
|
|
34
|
+
${o.map(([n,a])=>`\u2022 ${n} \u2014 ${a.name||"?"}`).join(`
|
|
35
|
+
`)||"Ninguno registrado."}`,actorId:"system"}),!0}case"/ui":{if(d){let o=se.getState().components[d];o?s.addChatMessage({type:"ui-artifact",sender:"agent",text:`\u{1F3A8} ${o.name}`,actorId:"system",uiSchema:JSON.stringify(o.schema)}):s.addChatMessage({type:"alert",sender:"system",text:`Componente "${d}" no encontrado.`,actorId:"system"})}else{let o=Object.values(se.getState().components);s.addChatMessage({type:"text",sender:"system",text:`\u{1F3A8} UI Components:
|
|
36
|
+
${o.map(n=>`\u2022 ${n.name} (${n.category}) \u2014 ${n.source}`).join(`
|
|
37
|
+
`)||"Ninguno."}
|
|
38
|
+
|
|
39
|
+
Usa /ui [id] para renderizar.`,actorId:"system"})}return!0}case"/tts":return d?(s.addChatMessage({type:"text",sender:"system",text:`\u{1F399}\uFE0F Generando audio neuronal para:
|
|
40
|
+
"${d}"...`,actorId:"system"}),import("@decido/kernel-bridge").then(({kernel:o})=>{o.execute("call_mcp_tool",{server_name:"Kokoro TTS",tool_name:"generate_tts",arguments:{text:d,voice:"em_alex",speed:1,lang:"es",return_base64:!0}}).then(n=>{let a=typeof n=="string"?n:JSON.stringify(n);if(a.includes("DATA_URI:")){let w=a.split("DATA_URI:")[1].trim();s.addChatMessage({type:"audio",sender:"system",text:"\u2705 Emisi\xF3n de voz generada con \xE9xito",audioSrc:w,actorId:"system"})}else s.addChatMessage({type:"alert",sender:"system",text:`La respuesta no incluy\xF3 un URI v\xE1lido:
|
|
41
|
+
${a}`,actorId:"system"})}).catch(n=>{s.addChatMessage({type:"alert",sender:"system",text:`\u274C Error de TTS: ${String(n)}`,actorId:"system"})})}),!0):(s.addChatMessage({type:"alert",sender:"system",text:`Debes indicar el texto a leer. Ejemplo:
|
|
42
|
+
/tts Hola mundo`,actorId:"system"}),!0);case"/reset":return Me.getState().resetEngine(),s.addChatMessage({type:"text",sender:"system",text:"\u23F9 Motor reiniciado.",actorId:"system"}),!0;default:return s.addChatMessage({type:"alert",sender:"system",text:`Comando desconocido: ${l}`,actorId:"system"}),!0}}import{jsx as p,jsxs as M}from"react/jsx-runtime";var kr=J.memo(function({step:s,selectedProfile:u,authAvailableLicenses:l,handleProfileSelect:d,activeConfig:o,demoState:n,suggestions:a,setInputValue:w,isGenerating:f,config:b,handleGeneratePlayground:k,isCreatorMode:y=!0,isVoiceActive:P=!1,setIsVoiceActive:$,VoiceWidget:G,dynamicPersona:A,setSuggestions:j,selectedVoice:R,showCanvas:O,setShowCanvas:t}){let N=H(r=>r.activeChatId),v=H(r=>r.chatMessagesByInstance[r.activeChatId||"_default"]||[]),L=H(r=>r.addChatMessage),T=H(r=>r.prototypeBrand),c=H(r=>r.setPrototypeBrand),g=J.useRef(null),[X,ee]=J.useState(!0),[Y,ce]=J.useState(!1),me=J.useRef(!0),pe=()=>{if(!g.current)return;let{scrollTop:r,scrollHeight:z,clientHeight:ye}=g.current,xe=z-r-ye<100;ee(xe),me.current=xe},B=v[v.length-1],Z=`${v.length}-${B?.text?.length||0}`;J.useEffect(()=>{me.current&&g.current&&g.current.scrollTo({top:g.current.scrollHeight,behavior:"smooth"})},[Z]);let q=()=>{let r=0,z=setInterval(()=>{if(r>200){clearInterval(z);return}L({type:r%3===0?"alert":r%5===0?"card":"text",sender:r%2===0?"agent":"system",text:`Stresstesting message ${r} para medir rendimiento en el sistema.`}),r++},10)},ue=()=>{let r=o&&typeof o=="object"&&b?.environments?Object.keys(b.environments):["brand-a","brand-b","brand-c"],z=(r.indexOf(T)+1)%r.length;c(r[z])},ge=J.useMemo(()=>({activeConfig:o,onMorphInstanceSelect:r=>{V.getState().setActiveInstance(r),fe.getState().setActiveTab(`morph-${r}`),t&&t(!0)},extensions:{getPreviewHTML:()=>V.getState().getActiveInstance?.()?.data?.html||null,onSendMessage:r=>L({type:"text",sender:"user",text:r}),renderMessageActions:r=>null}}),[o,t,L]);return p(lt,{mode:"wait",children:s==="action"?M(de.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},className:"flex flex-col items-center justify-center h-full text-center",children:[p("div",{className:"w-24 h-24 mx-auto rounded-full border-[3px] border-cyan-500/30 border-t-cyan-400 animate-spin mb-8 shadow-[0_0_30px_rgba(34,211,238,0.2)]"}),p("h2",{className:"text-3xl font-bold text-text-primary mb-4",children:"Reestructurando el OS..."}),M("p",{className:"text-cyan-400 font-mono text-sm tracking-widest uppercase bg-cyan-500/10 py-2 px-6 rounded-full inline-block border border-cyan-500/20",children:["Cargando m\xF3dulos para: ",u]})]},"action-step"):s==="profile"?M(de.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"flex flex-col items-center justify-center h-full w-full max-w-4xl mx-auto pb-20",children:[p("h2",{className:"text-2xl md:text-3xl font-bold text-text-primary text-center mb-8",children:"Selecciona tu Perfil"}),p("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 w-full",children:l.map(r=>p("button",{onClick:()=>d(r),className:`group relative p-6 rounded-3xl bg-surface-tertiary border border-border-subtle transition-all text-left overflow-hidden ${r.type==="enterprise"?"hover:border-emerald-500/50":"hover:border-cyan-500/50"}`,children:M("div",{className:"flex items-center gap-4 mb-4",children:[p("div",{className:`w-12 h-12 rounded-full flex items-center justify-center shadow-inner ${r.type==="enterprise"?"bg-emerald-500/10 text-emerald-400":"bg-cyan-500/10 text-cyan-400"}`,children:r.type==="enterprise"?p(Ko,{size:24}):p(qo,{size:24})}),p("h3",{className:"text-xl font-bold text-text-primary",children:r.name})]})},r.id))})]},"profile-step"):M(de.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0},className:"flex flex-col h-full overflow-hidden w-full max-w-full lg:max-w-4xl mx-auto pb-4 px-3 sm:px-6 md:px-8 lg:px-4 min-w-0 min-h-0 box-border",children:[M("div",{ref:g,onScroll:pe,className:`flex-1 overflow-y-auto overflow-x-hidden custom-scrollbar scroll-smooth flex flex-col gap-6 md:gap-8 min-w-0 min-h-0 ${y?"pb-48 md:pb-64":"justify-end pb-6"}`,children:[M("div",{className:"flex flex-col gap-3 md:gap-4 transition-all mt-4 sm:mt-6 md:mt-8",children:[M("h1",{className:"text-2xl sm:text-3xl md:text-5xl font-semibold leading-tight text-text-primary/50",children:[p("span",{className:`bg-linear-to-r ${o.gradient} text-transparent bg-clip-text transition-all duration-700`,children:o.greetingText}),p("br",{}),o.greetingPrompt||"\xBFEn qu\xE9 puedo ayudarte hoy?"]}),M("div",{className:"flex items-center gap-4 flex-wrap mt-2",children:[p("p",{className:"text-sm text-text-muted font-mono transition-all duration-700",children:o.subtitle}),M("div",{className:"hidden md:flex gap-2 items-center",children:[M("button",{onClick:ue,className:"text-[10px] text-text-secondary hover:text-text-primary uppercase tracking-wider transition-colors bg-surface-glass hover:bg-surface-glass px-3 py-1.5 rounded-full border border-border-default flex items-center gap-2",children:[p("span",{className:`w-2 h-2 rounded-full ${T==="brand-b"?"bg-emerald-400":T==="brand-c"?"bg-purple-400":"bg-cyan-400"}`}),"Tema: ",T]}),M("button",{onClick:q,className:"text-[10px] text-text-secondary hover:text-orange-400 uppercase tracking-wider transition-colors bg-orange-500/5 hover:bg-orange-500/10 px-3 py-1.5 rounded-full border border-orange-500/20 border-dashed flex items-center gap-2",children:[p("span",{className:"text-orange-500 font-bold",children:"\u26A0"})," Estr\xE9s (200 msgs)"]}),M("div",{className:"relative",children:[M("button",{onClick:()=>ce(!Y),className:"text-[10px] text-text-secondary hover:text-cyan-400 uppercase tracking-wider transition-colors bg-surface-glass hover:bg-surface-glass px-3 py-1.5 rounded-full border border-border-default flex items-center gap-2",children:[p(Zo,{size:10})," Export"]}),p(Xo,{isOpen:Y,onClose:()=>ce(!1)})]})]})]})]}),p(Qo,{value:ge,children:(v.length>0||f)&&M("div",{className:"flex flex-col gap-6 mt-6 max-w-full md:max-w-3xl min-w-0",children:[v.map(r=>p(Jo,{msg:r},r.id)),p(lt,{children:f&&M(de.div,{initial:{opacity:0,y:10,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,scale:.95},className:"flex gap-4",children:[p("div",{className:"w-10 h-10 rounded-full flex items-center justify-center shadow-lg border shrink-0 bg-transparent border-border-strong text-text-primary",children:p(Yo,{size:18,className:"text-text-muted animate-pulse"})}),p("div",{className:"flex-1 space-y-2 flex flex-col items-start justify-center",children:M("div",{className:"bg-surface-tertiary border border-border-subtle rounded-2xl p-4 shadow-xl inline-flex gap-1.5 items-center justify-center",children:[p("div",{className:"w-1.5 h-1.5 rounded-full bg-surface-elevated animate-bounce",style:{animationDelay:"0ms"}}),p("div",{className:"w-1.5 h-1.5 rounded-full bg-surface-elevated animate-bounce",style:{animationDelay:"150ms"}}),p("div",{className:"w-1.5 h-1.5 rounded-full bg-surface-elevated animate-bounce",style:{animationDelay:"300ms"}})]})})]})})]})}),!v.length&&n!=="idle"&&p("div",{className:"flex flex-col gap-6 mt-6 max-w-full md:max-w-3xl opacity-50 min-w-0",children:p("p",{className:"text-sm text-text-muted italic",children:"Ejecutando secuencia en el simulador sin salida de chat..."})}),!v.length&&n==="idle"&&p(Oe,{suggestions:a,onSelect:w})]}),!X&&v.length>5&&p(de.button,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},onClick:()=>g.current?.scrollTo({top:g.current.scrollHeight,behavior:"smooth"}),className:`absolute ${y?"bottom-[100px]":"bottom-20"} left-1/2 transform -translate-x-1/2 bg-cyan-500 text-text-primary rounded-full px-4 py-2 text-xs font-bold shadow-[0_0_15px_rgba(34,211,238,0.5)] border border-cyan-400 flex items-center gap-2 z-50 hover:bg-cyan-400`,children:"\u2B07 Nuevos Mensajes"}),!y&&p("div",{className:"shrink-0 w-full max-w-full lg:max-w-3xl mx-auto pb-2",children:p(st,{isGenerating:f,onSend:r=>{nt(r,{prototypeBrand:T,setPrototypeBrand:c,addChatMessage:L})||(w(r),k?k(r):window.__DECIDO__?.geminiStream&&window.__DECIDO__.geminiStream(r))},isVoiceActive:P,setIsVoiceActive:$,VoiceWidget:G,dynamicPersona:A,setSuggestions:j,selectedVoice:R,showCanvas:O,setShowCanvas:t,prototypeBrand:T,setPrototypeBrand:c})})]},"chat-greeting")})});export{je as a,De as b,ta as c,st as d,kr as e};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{create as g}from"zustand";import{persist as h,createJSONStorage as u}from"zustand/middleware";import{get as v,set as p,del as I}from"idb-keyval";var S={getItem:async t=>await v(t)||null,setItem:async(t,e)=>{await p(t,e)},removeItem:async t=>{await I(t)}},C=g()(h(t=>({isBooting:!0,setIsBooting:e=>t({isBooting:e}),step:"chat",setStep:e=>t({step:e}),selectedProfile:null,setSelectedProfile:e=>t({selectedProfile:e}),prototypeBrand:"decido",setPrototypeBrand:e=>t(a=>({prototypeBrand:typeof e=="function"?e(a.prototypeBrand):e})),activeArtifactData:null,setActiveArtifactData:e=>t({activeArtifactData:e}),demoState:"idle",setDemoState:e=>t({demoState:e}),showCanvas:!1,setShowCanvas:e=>t({showCanvas:e}),showChat:!0,setShowChat:e=>t({showChat:e}),isMuted:!1,setIsMuted:e=>t(a=>({isMuted:typeof e=="function"?e(a.isMuted):e})),selectedVoice:"Kore",setSelectedVoice:e=>t({selectedVoice:e}),isFullscreen:!1,setIsFullscreen:e=>t({isFullscreen:e}),isVoiceActive:!1,setIsVoiceActive:e=>t({isVoiceActive:e}),isSidebarOpen:!1,setIsSidebarOpen:e=>t({isSidebarOpen:e}),isTerminalOpen:!1,setIsTerminalOpen:e=>t({isTerminalOpen:e}),inputValue:"",setInputValue:e=>t({inputValue:e}),isCreatorMode:!1,setIsCreatorMode:e=>t({isCreatorMode:e}),creatorViewMode:"graph",setCreatorViewMode:e=>t({creatorViewMode:e}),logs:[],addLog:(e,a="info")=>t(s=>({logs:[...s.logs.slice(-49),{time:new Date().toLocaleTimeString([],{hour12:!1}),msg:e,type:a}]})),setLogs:e=>t(a=>({logs:typeof e=="function"?e(a.logs):e})),savedSequences:[],addSavedSequence:e=>t(a=>({savedSequences:[...a.savedSequences,e]})),removeSavedSequence:e=>t(a=>({savedSequences:a.savedSequences.filter(s=>s.id!==e)})),chatMessagesByInstance:{},addChatMessage:e=>t(a=>{let s=a.activeChatId||"_default",n=a.chatMessagesByInstance[s]||[],o={...e,id:Math.random().toString(36).substring(2,9),timestamp:Date.now()},r={...a.chatMessagesByInstance,[s]:[...n,o]},d=a.chatInstances.map(i=>{if(i.id===s){let c=e.sender==="user"?e.text.slice(0,60):i.preview,l=i.title==="Nueva conversaci\xF3n"&&e.sender==="user"?e.text.slice(0,40):i.title;return{...i,preview:c,title:l,messageCount:(i.messageCount||0)+1,updatedAt:Date.now()}}return i});return{chatMessagesByInstance:r,chatInstances:d}}),upsertChatMessage:(e,a)=>t(s=>{let n=s.activeChatId||"_default",o=s.chatMessagesByInstance[n]||[],r=o.findIndex(i=>i.id===e),d;return r>=0?(d=[...o],d[r]={...d[r],...a}):d=[...o,a],{chatMessagesByInstance:{...s.chatMessagesByInstance,[n]:d}}}),clearChatMessages:()=>t(e=>{let a=e.activeChatId||"_default";return{chatMessagesByInstance:{...e.chatMessagesByInstance,[a]:[]}}}),getChatMessages:()=>{let e=C.getState(),a=e.activeChatId||"_default";return e.chatMessagesByInstance[a]||[]},chatInstances:[],activeChatId:null,addChatInstance:e=>{let a=Date.now().toString(36)+Math.random().toString(36).substring(2,7),s=Date.now(),n=localStorage.getItem("decido_gemini_model")||void 0,o=localStorage.getItem("decido_selected_shell")||void 0;return t(r=>({chatInstances:[{id:a,title:e||"Nueva conversaci\xF3n",createdAt:s,updatedAt:s,model:n,shellType:o},...r.chatInstances],activeChatId:a})),a},removeChatInstance:e=>t(a=>{let{[e]:s,...n}=a.chatMessagesByInstance;return{chatInstances:a.chatInstances.filter(o=>o.id!==e),activeChatId:a.activeChatId===e?a.chatInstances.find(o=>o.id!==e)?.id??null:a.activeChatId,chatMessagesByInstance:n}}),renameChatInstance:(e,a)=>t(s=>({chatInstances:s.chatInstances.map(n=>n.id===e?{...n,title:a,updatedAt:Date.now()}:n)})),setActiveChatId:e=>t({activeChatId:e})}),{name:"playground-storage",storage:u(()=>S),partialize:t=>({showChat:t.showChat,logs:t.logs,inputValue:t.inputValue,prototypeBrand:t.prototypeBrand,isCreatorMode:t.isCreatorMode,isMuted:t.isMuted,selectedVoice:t.selectedVoice,isTerminalOpen:t.isTerminalOpen,isSidebarOpen:t.isSidebarOpen,step:t.step,selectedProfile:t.selectedProfile,savedSequences:t.savedSequences,chatMessagesByInstance:t.chatMessagesByInstance,chatInstances:t.chatInstances,activeChatId:t.activeChatId})}));export{C as a};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{a as E}from"./chunk-6K3AFDP5.mjs";import{a as u}from"./chunk-XDA6ZRIQ.mjs";import ne,{useState as z}from"react";import{motion as O,AnimatePresence as $}from"motion/react";import{Search as ie,Plus as le,X as U,Settings as de,ChevronDown as ce,Plug as me,Wrench as pe,Network as ue,PackageOpen as xe,Paintbrush as ge}from"lucide-react";import{ChatHistoryList as be}from"@decido/chat";import X,{useState as x,useCallback as A}from"react";import{motion as F,AnimatePresence as q}from"motion/react";import{X as V,Plus as Y,Trash2 as Z,Sparkles as K,Loader2 as ee,Key as te,Box as ae,BrainCircuit as se}from"lucide-react";import{Fragment as oe,jsx as t,jsxs as s}from"react/jsx-runtime";var re=[{id:"gemini-3-flash-preview",name:"Gemini 3 Flash",type:"Ultra-Fast"},{id:"gemini-3.1-pro-preview",name:"Gemini 3.1 Pro",type:"Deep-Reasoning"},{id:"gemini-3.1-flash-lite-preview",name:"Gemini 3.1 Flash Lite",type:"Cutting-Edge"}],W=X.memo(function({isOpen:c,onClose:k}){let{seeds:d,generated:_,addSeed:I,removeSeed:P,updateSeed:D,setGenerated:g}=E(),[m,N]=x(""),[b,j]=x(5),[f,w]=x(!1),[G,C]=x(null),[v,M]=x(()=>localStorage.getItem("google_gemini_api_key")||""),[S,T]=x(!1),[h,L]=x(()=>localStorage.getItem("decido_gemini_model")||"gemini-3-flash-preview"),r=A(a=>{L(a),localStorage.setItem("decido_gemini_model",a),fetch("http://localhost:3100/api/models/active",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({model_id:a})}).catch(()=>console.warn("Orquestador local no expone /api/models/active a\xFAn."))},[]),o=A(()=>{m.trim()&&(I(m.trim()),N(""))},[m,I]),n=A(async()=>{if(d.length!==0){w(!0);try{let a=localStorage.getItem("google_gemini_api_key")||window.__DECIDO__?._apiKey||"",l=localStorage.getItem("decido_gemini_model")||"gemini-3-flash-preview";if(!a){console.warn("\u274C No API key for suggestions"),w(!1);return}let p=`Bas\xE1ndote en estas frases semilla, genera exactamente ${b} sugerencias similares para un chat de IA de productividad. Solo devuelve las sugerencias, una por l\xEDnea, sin numeraci\xF3n ni bullets:
|
|
2
|
+
|
|
3
|
+
${d.join(`
|
|
4
|
+
`)}`,J=((await(await fetch(`https://generativelanguage.googleapis.com/v1beta/models/${l}:generateContent?key=${a}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({contents:[{parts:[{text:p}]}]})})).json())?.candidates?.[0]?.content?.parts?.[0]?.text||"").split(`
|
|
5
|
+
`).map(R=>R.trim()).filter(R=>R.length>3);g(J.slice(0,b))}catch(a){console.error("Error generating suggestions:",a)}finally{w(!1)}}},[d,b,g]),H=A(()=>{v.trim()?localStorage.setItem("google_gemini_api_key",v.trim()):localStorage.removeItem("google_gemini_api_key")},[v]);return t(q,{children:c&&s(oe,{children:[t(F.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-surface-overlay backdrop-blur-xs z-200",style:{position:"fixed",inset:0,zIndex:200}}),s(F.div,{initial:{x:"-100%"},animate:{x:0},exit:{x:"-100%"},transition:{type:"spring",damping:30,stiffness:300},className:"fixed inset-y-0 left-0 w-full sm:w-[360px] bg-surface-secondary border-r border-border-default z-201 flex flex-col shadow-2xl",style:{position:"fixed",top:0,bottom:0,left:0,zIndex:201},children:[s("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border-subtle",children:[t("h2",{className:"text-sm font-bold text-text-primary",children:"\u2699\uFE0F Configuraci\xF3n"}),t("button",{onClick:k,className:"w-7 h-7 rounded-full bg-surface-glass hover:bg-surface-glass flex items-center justify-center text-text-secondary hover:text-text-primary transition-colors",children:t(V,{size:14})})]}),s("div",{className:"flex-1 overflow-y-auto px-4 py-4 space-y-6",style:{scrollbarWidth:"thin",scrollbarColor:"rgba(255,255,255,0.15) transparent"},children:[s("section",{children:[s("div",{className:"flex items-center gap-2 mb-3",children:[t(te,{size:14,className:"text-amber-400"}),t("h3",{className:"text-xs font-semibold text-text-secondary uppercase tracking-wider",children:"API Key"})]}),s("div",{className:"flex gap-2",children:[t("input",{type:S?"text":"password",value:v,onChange:a=>M(a.target.value),onBlur:H,placeholder:"AIzaSy...",className:"flex-1 bg-surface-glass border border-border-default rounded-lg px-3 py-2 text-xs text-text-primary placeholder-zinc-600 outline-hidden focus:border-border-strong font-mono"}),t("button",{onClick:()=>T(!S),className:"px-2 rounded-lg text-[10px] text-text-muted hover:text-text-primary bg-surface-glass hover:bg-surface-glass border border-border-default transition-colors",children:S?"\u{1F648}":"\u{1F441}\uFE0F"})]})]}),s("section",{children:[s("div",{className:"flex items-center gap-2 mb-3",children:[t(se,{size:14,className:"text-emerald-400"}),t("h3",{className:"text-xs font-semibold text-text-secondary uppercase tracking-wider",children:"Brain Router (Enjambre)"})]}),t("div",{className:"flex flex-col gap-2",children:re.map(a=>s("button",{onClick:()=>r(a.id),className:`flex items-center justify-between px-3 py-2 rounded-xl transition-all border ${h===a.id?"bg-emerald-500/10 border-emerald-500/30 shadow-[0_0_10px_rgba(16,185,129,0.2)]":"bg-surface-glass border-border-default hover:border-border-strong"}`,children:[s("div",{className:"flex flex-col items-start gap-0.5",children:[t("span",{className:`text-xs font-bold ${h===a.id?"text-emerald-400":"text-text-primary"}`,children:a.name}),t("span",{className:"text-[9px] font-mono text-text-muted uppercase tracking-wider",children:a.id})]}),t("span",{className:`text-[9px] px-2 py-0.5 rounded-full font-bold uppercase tracking-widest ${h===a.id?"bg-emerald-500/20 text-emerald-300":"bg-surface-tertiary text-text-secondary"}`,children:a.type})]},a.id))})]}),s("section",{children:[s("div",{className:"flex items-center gap-2 mb-3",children:[t(K,{size:14,className:"text-cyan-400"}),t("h3",{className:"text-xs font-semibold text-text-secondary uppercase tracking-wider",children:"Frases Semilla"}),t("span",{className:"text-[10px] text-text-muted font-mono ml-auto",children:d.length})]}),t("div",{className:"space-y-1.5 mb-3",children:d.map((a,l)=>s("div",{className:"flex items-center gap-1.5 group",children:[G===l?t("input",{autoFocus:!0,value:a,onChange:p=>D(l,p.target.value),onBlur:()=>C(null),onKeyDown:p=>p.key==="Enter"&&C(null),className:"flex-1 bg-surface-glass border border-cyan-500/30 rounded-lg px-2.5 py-1.5 text-xs text-text-primary outline-hidden font-mono"}):t("button",{onClick:()=>C(l),className:"flex-1 text-left px-2.5 py-1.5 rounded-lg text-xs text-text-secondary hover:text-text-primary hover:bg-surface-glass transition-colors font-mono truncate",children:a}),t("button",{onClick:()=>P(l),className:"w-6 h-6 rounded-md text-text-muted hover:text-red-400 hover:bg-red-500/10 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-all shrink-0",children:t(Z,{size:12})})]},l))}),s("div",{className:"flex gap-1.5",children:[t("input",{value:m,onChange:a=>N(a.target.value),onKeyDown:a=>a.key==="Enter"&&o(),placeholder:"Nueva frase semilla...",className:"flex-1 bg-surface-glass border border-border-default rounded-lg px-2.5 py-1.5 text-xs text-text-primary placeholder-zinc-600 outline-hidden focus:border-border-strong font-mono"}),t("button",{onClick:o,className:"w-8 h-8 rounded-lg bg-cyan-500/10 border border-cyan-500/20 text-cyan-400 hover:bg-cyan-500/20 flex items-center justify-center transition-colors",children:t(Y,{size:14})})]})]}),s("section",{children:[s("div",{className:"flex items-center gap-2 mb-3",children:[t(K,{size:14,className:"text-purple-400"}),t("h3",{className:"text-xs font-semibold text-text-secondary uppercase tracking-wider",children:"Generar con AI"})]}),s("div",{className:"flex items-center gap-2 mb-3",children:[t("label",{className:"text-[10px] text-text-muted font-mono",children:"Cantidad:"}),t("input",{type:"number",min:1,max:20,value:b,onChange:a=>j(Math.max(1,Math.min(20,parseInt(a.target.value)||5))),className:"w-14 bg-surface-glass border border-border-default rounded-lg px-2 py-1 text-xs text-text-primary outline-hidden text-center font-mono"}),s("button",{onClick:n,disabled:f||d.length===0,className:"flex-1 flex items-center justify-center gap-2 px-3 py-1.5 rounded-lg bg-purple-500/15 border border-purple-500/20 text-purple-300 hover:bg-purple-500/25 disabled:opacity-40 disabled:cursor-not-allowed transition-colors text-xs font-semibold",children:[f?t(ee,{size:14,className:"animate-spin"}):t(K,{size:14}),f?"Generando...":"Generar Sugerencias"]})]}),_.length>0&&s("div",{className:"space-y-1 bg-surface-glass rounded-lg p-2 border border-border-subtle",children:[s("div",{className:"text-[9px] text-text-muted font-mono uppercase mb-1",children:["Generadas (",_.length,")"]}),_.map((a,l)=>t("div",{className:"text-xs text-text-secondary font-mono px-2 py-1 rounded hover:bg-surface-glass transition-colors",children:a},l))]})]}),Object.keys(E.getState().pluginSuggestions).length>0&&s("section",{children:[s("div",{className:"flex items-center gap-2 mb-3",children:[t(ae,{size:14,className:"text-emerald-400"}),t("h3",{className:"text-xs font-semibold text-text-secondary uppercase tracking-wider",children:"Plugins"})]}),Object.entries(E.getState().pluginSuggestions).map(([a,l])=>s("div",{className:"mb-2",children:[s("div",{className:"text-[10px] text-text-muted font-mono mb-1",children:[a," (",l.length,")"]}),l.map((p,B)=>t("div",{className:"text-xs text-text-secondary font-mono px-2 py-1",children:p},B))]},a))]})]})]})]})})});import{Fragment as Q,jsx as e,jsxs as i}from"react/jsx-runtime";var fe=()=>{let[y,c]=z(!1);return i("div",{className:"relative",onMouseLeave:()=>c(!1),children:[e("button",{onClick:()=>c(!y),className:`w-8 h-8 rounded-lg flex items-center justify-center transition-colors shrink-0 ${y?"bg-surface-elevated text-text-primary":"text-text-muted hover:text-text-primary hover:bg-surface-glass"}`,title:"Herramientas de Desarrollador",children:e(pe,{size:16})}),e($,{children:y&&i(O.div,{initial:{opacity:0,scale:.9,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.9,y:10},transition:{type:"spring",stiffness:400,damping:25},className:"absolute bottom-full right-0 mb-2 flex flex-col gap-2 p-2 rounded-2xl bg-surface-elevated border border-border-default shadow-2xl origin-bottom z-50",children:[e("button",{onClick:()=>window.dispatchEvent(new CustomEvent("DECIDO_OPEN_SWARM_WIZARD")),className:"w-10 h-10 rounded-full bg-surface-secondary border border-border-default hover:border-cyan-400/50 flex items-center justify-center text-text-secondary hover:text-cyan-400 transition-all hover:shadow-[0_0_15px_rgba(6,182,212,0.3)]",title:"Configuraci\xF3n del Enjambre",children:e("i",{className:"fas fa-cog text-sm"})}),e("button",{onClick:()=>window.dispatchEvent(new CustomEvent("DECIDO_TOGGLE_TOPOLOGY")),className:"w-10 h-10 rounded-full bg-surface-secondary border border-border-default hover:border-emerald-400/50 flex items-center justify-center text-text-secondary hover:text-emerald-400 transition-all hover:shadow-[0_0_15px_rgba(16,185,129,0.3)]",title:"Live Topology",children:e(ue,{size:16})}),e("button",{onClick:()=>window.dispatchEvent(new CustomEvent("DECIDO_OPEN_MARKETPLACE")),className:"w-10 h-10 rounded-full bg-surface-secondary border border-border-default hover:border-indigo-400/50 flex items-center justify-center text-text-secondary hover:text-indigo-400 transition-all hover:shadow-[0_0_15px_rgba(99,102,241,0.3)]",title:"Plugin Marketplace",children:e(xe,{size:16})}),e("button",{onClick:()=>window.dispatchEvent(new CustomEvent("DECIDO_TOGGLE_TW_EDITOR")),className:"w-10 h-10 rounded-full bg-surface-secondary border border-border-default hover:border-purple-400/50 flex items-center justify-center text-text-secondary hover:text-purple-400 transition-all hover:shadow-[0_0_15px_rgba(139,92,246,0.3)]",title:"Tailwind Editor",children:e(ge,{size:16})})]})})]})},De=ne.memo(function({isOpen:c,onClose:k,menuSections:d=[],onSettings:_,onProfile:I,profileName:P="Usuario",profileAvatar:D}){let[g,m]=z(""),[N,b]=z(new Set),[j,f]=z(!1),w=u(r=>r.chatInstances),G=u(r=>r.activeChatId),C=u(r=>r.addChatInstance),v=u(r=>r.removeChatInstance),M=u(r=>r.renameChatInstance),S=u(r=>r.setActiveChatId),T=r=>{b(o=>{let n=new Set(o);return n.has(r)?n.delete(r):n.add(r),n})},h=(r=!1)=>i("div",{className:"flex flex-col h-full bg-surface-secondary text-text-primary",children:[i("div",{className:"flex-none p-3 pt-4 space-y-2",children:[r&&e("div",{className:"flex justify-end mb-1",children:e("button",{onClick:k,className:"w-7 h-7 rounded-full bg-surface-glass hover:bg-surface-elevated flex items-center justify-center text-text-secondary hover:text-text-primary transition-colors",children:e(U,{size:14})})}),i("div",{className:"relative",children:[e(ie,{size:14,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-text-muted"}),e("input",{value:g,onChange:o=>m(o.target.value),placeholder:"Buscar conversaciones...",className:"w-full bg-surface-glass border border-border-subtle rounded-lg pl-8 pr-3 py-2 text-sm text-text-primary placeholder-text-muted outline-hidden focus:border-border-strong focus:bg-surface-glass transition-colors"}),g&&e("button",{onClick:()=>m(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-text-muted hover:text-text-primary",children:e(U,{size:12})})]}),i("button",{onClick:()=>C(),className:"w-full flex items-center gap-2 px-3 py-2 rounded-lg bg-surface-glass border border-border-subtle hover:bg-surface-glass hover:border-border-default transition-colors text-sm text-text-primary hover:text-text-primary",children:[e(le,{size:16}),e("span",{children:"Nueva conversaci\xF3n"})]})]}),i("div",{className:"flex-1 overflow-y-auto px-3 pb-2 space-y-1",style:{scrollbarWidth:"thin",scrollbarColor:"rgba(255,255,255,0.15) transparent"},children:[e(be,{chatInstances:w,activeChatId:G||"",searchQuery:g,setActiveChatId:S,renameChatInstance:M,removeChatInstance:v}),d.length>0&&e("div",{className:"mt-4 pt-3 border-t border-border-subtle",children:d.map(o=>i("div",{className:"mb-3",children:[i("button",{onClick:()=>o.collapsible&&T(o.id),className:"flex items-center gap-1.5 px-2 py-1.5 text-[11px] font-semibold text-text-muted uppercase tracking-wider w-full hover:text-text-primary transition-colors",children:[o.icon,e("span",{className:"flex-1 text-left",children:o.title}),o.collapsible&&e(ce,{size:12,className:`transition-transform ${N.has(o.id)?"-rotate-90":""}`})]}),e($,{children:!N.has(o.id)&&e(O.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:o.items.map(n=>i("button",{onClick:n.onClick,className:`w-full flex items-center gap-2 px-2 py-2 rounded-lg text-sm transition-colors ${n.active?"bg-surface-glass text-text-primary":"text-text-secondary hover:bg-surface-glass hover:text-text-primary"}`,children:[n.icon,e("span",{className:"flex-1 text-left truncate",children:n.label}),n.badge!==void 0&&e("span",{className:"px-1.5 py-0.5 rounded-full bg-cyan-500/15 text-cyan-400 text-[10px] font-bold",children:n.badge})]},n.id))})})]},o.id))})]}),e("div",{className:"flex-none border-t border-border-subtle px-3 py-2",children:i("div",{className:"flex items-center gap-2",children:[i("button",{onClick:I,className:"flex-1 flex items-center gap-2 px-2 py-2 rounded-lg hover:bg-surface-glass transition-colors group",children:[e("div",{className:"w-7 h-7 rounded-full bg-linear-to-br from-cyan-500 to-purple-600 flex items-center justify-center text-text-primary text-xs font-bold shrink-0",children:D||P.charAt(0).toUpperCase()}),e("span",{className:"text-sm text-text-primary group-hover:text-text-primary truncate",children:P})]}),e(fe,{}),e("button",{onClick:()=>window.dispatchEvent(new CustomEvent("DECIDO_OPEN_MCP_MODAL")),className:"w-8 h-8 rounded-lg text-text-muted hover:text-text-primary hover:bg-surface-glass flex items-center justify-center transition-colors shrink-0",title:"Configuraci\xF3n MCP",children:e(me,{size:16})}),e("button",{onClick:()=>f(!0),className:"w-8 h-8 rounded-lg text-text-muted hover:text-text-primary hover:bg-surface-glass flex items-center justify-center transition-colors shrink-0",title:"Configuraci\xF3n",children:e(de,{size:16})})]})}),e(W,{isOpen:j,onClose:()=>f(!1)})]}),L=e($,{children:c&&i(Q,{children:[e(O.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:k,className:"md:hidden fixed inset-0 bg-surface-overlay backdrop-blur-xs z-40"}),e(O.div,{initial:{x:"-100%"},animate:{x:0},exit:{x:"-100%"},transition:{type:"spring",damping:30,stiffness:300},className:"md:hidden fixed inset-y-0 left-0 w-[380px] z-50 shadow-2xl",children:h(!0)})]})});return i(Q,{children:[L,c&&e("div",{className:"hidden md:flex h-full w-full min-h-0",children:h(!1)})]})});export{De as a};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import{g as De,h as Se}from"./chunk-BCP43BRV.mjs";import{a as j}from"./chunk-O3OWL3Q2.mjs";import{a as ue}from"./chunk-ZKD74U4X.mjs";import{a as xe}from"./chunk-BSJBW64M.mjs";import{b as X}from"./chunk-AGAAZ2MU.mjs";import{a as O,b as K}from"./chunk-YHFKY5MB.mjs";import{a as Z}from"./chunk-XDA6ZRIQ.mjs";import jr from"react";import{motion as Ur,AnimatePresence as Fr}from"motion/react";import{X as _r,Bug as Wr,Activity as Gr,Map as Jr,PlayCircle as qr,Database as Vr,Layers as Kr,Globe as Xr,UserCog as Zr,Clock as Yr,Gauge as Qr,Download as es,Palette as ts}from"lucide-react";import{useEffect as Bt,useRef as Ht,useMemo as He,useState as je}from"react";import{AnimatePresence as jt,motion as Ut}from"motion/react";import{Filter as Ft,Trash2 as _t,Copy as Wt,Check as Gt}from"lucide-react";import Lt from"react";import{Info as Rt,AlertTriangle as $t,AlertCircle as Pt,Bug as At,Zap as Mt,MessageSquare as zt,Settings as Oe,GitBranch as Dt,ArrowRight as Ie,Circle as Ot,Map as we}from"lucide-react";import{jsx as te,jsxs as It}from"react/jsx-runtime";var ne={info:{icon:Rt,color:"text-blue-400",bg:"bg-blue-500/10",label:"INFO"},warn:{icon:$t,color:"text-amber-400",bg:"bg-amber-500/10",label:"WARN"},error:{icon:Pt,color:"text-red-400",bg:"bg-red-500/10",label:"ERROR"},debug:{icon:At,color:"text-purple-400",bg:"bg-purple-500/10",label:"DEBUG"}},be={trigger:{icon:Mt,color:"text-yellow-400",label:"Trigger"},dialogue:{icon:zt,color:"text-blue-400",label:"Di\xE1logo"},logic:{icon:Oe,color:"text-orange-400",label:"L\xF3gica"},ui:{icon:we,color:"text-green-400",label:"UI"},render:{icon:we,color:"text-pink-400",label:"Render"},condition:{icon:Dt,color:"text-amber-400",label:"Condici\xF3n"},subflow:{icon:Ie,color:"text-purple-400",label:"Subflow"},entry:{icon:Ot,color:"text-emerald-400",label:"Entry"},return:{icon:Ie,color:"text-red-400",label:"Return"},set:{icon:Oe,color:"text-cyan-400",label:"Variable"},morph:{icon:we,color:"text-violet-400",label:"Morph"}},Be=Lt.memo(function({entry:t}){let r=ne[t.level],o=r.icon;return It("div",{className:`flex items-start gap-2 px-3 py-1 hover:bg-surface-glass font-mono text-[11px] leading-relaxed border-b border-border-subtle ${r.bg}`,children:[te("span",{className:"text-text-muted shrink-0 w-[70px] pt-0.5",children:t.timestamp}),te(o,{size:12,className:`${r.color} shrink-0 mt-0.5`}),te("span",{className:`font-bold shrink-0 w-[38px] ${r.color}`,children:r.label}),t.categories.length>0&&te("span",{className:"shrink-0 flex gap-1",children:t.categories.map((a,l)=>te("span",{className:"px-1.5 py-0.5 rounded text-[9px] font-bold bg-surface-glass text-text-secondary uppercase tracking-widest",children:a},l))}),te("span",{className:"text-text-primary flex-1 break-all",children:t.message}),t.data!==void 0&&te("span",{className:"text-text-muted shrink-0 truncate max-w-[200px]",children:typeof t.data=="object"?JSON.stringify(t.data):String(t.data)})]})});import{jsx as I,jsxs as ge}from"react/jsx-runtime";function Ue(){let e=O(u=>u.logEntries),t=O(u=>u.logFilters),r=O(u=>u.allCategories),o=O(u=>u.clearLogs),a=O(u=>u.toggleLevel),l=O(u=>u.toggleCategory),[s,n]=je(!1),[i,c]=je(!1),m=Ht(null);Bt(()=>{m.current&&(m.current.scrollTop=m.current.scrollHeight)},[e.length]);let y=He(()=>e.filter(u=>!(!t.levels.has(u.level)||t.categories.size>0&&!u.categories.some(d=>t.categories.has(d)))),[e,t]),w=He(()=>Array.from(r).sort(),[r]);return ge("div",{className:"flex flex-col h-full",children:[ge("div",{className:"flex items-center gap-2 px-3 py-1.5 border-b border-border-subtle shrink-0 bg-surface-primary/50",children:[I("div",{className:"flex gap-1",children:Object.keys(ne).map(u=>{let d=ne[u],v=t.levels.has(u),b=e.filter(p=>p.level===u).length;return ge("button",{onClick:()=>a(u),className:`flex items-center gap-1 px-2 py-0.5 rounded text-[10px] font-bold transition-all border ${v?`${d.bg} ${d.color} border-current/20`:"bg-transparent text-text-muted border-transparent hover:text-text-secondary"}`,children:[d.label,b>0&&I("span",{className:"text-[9px] opacity-60",children:b})]},u)})}),I("div",{className:"flex-1"}),w.length>0&&I("button",{onClick:()=>n(!s),className:`p-1 rounded transition-colors ${s?"bg-cyan-500/20 text-cyan-400":"text-text-muted hover:text-text-primary hover:bg-surface-glass"}`,title:"Filtrar categor\xEDas",children:I(Ft,{size:12})}),ge("span",{className:"text-[10px] text-text-muted font-mono",children:[y.length,"/",e.length]}),I("button",{onClick:()=>{let u=y.map(d=>{let v=d.categories.length>0?` [${d.categories.join(",")}]`:"",b=d.data!==void 0?` | ${typeof d.data=="object"?JSON.stringify(d.data):String(d.data)}`:"";return`[${d.timestamp}] ${ne[d.level].label}${v} ${d.message}${b}`}).join(`
|
|
2
|
+
`);navigator.clipboard.writeText(u).then(()=>{c(!0),setTimeout(()=>c(!1),1500)})},className:`p-1 rounded transition-colors ${i?"text-green-400 bg-green-500/10":"text-text-muted hover:text-cyan-400 hover:bg-cyan-500/10"}`,title:"Copiar logs visibles",children:i?I(Gt,{size:12}):I(Wt,{size:12})}),I("button",{onClick:o,className:"p-1 rounded text-text-muted hover:text-red-400 hover:bg-red-500/10 transition-colors",title:"Limpiar logs",children:I(_t,{size:12})})]}),I(jt,{children:s&&w.length>0&&I(Ut.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden border-b border-border-subtle",children:I("div",{className:"flex flex-wrap gap-1 px-3 py-2 bg-surface-primary/80",children:w.map(u=>{let d=t.categories.size===0||t.categories.has(u);return I("button",{onClick:()=>l(u),className:`px-2 py-0.5 rounded text-[10px] font-bold uppercase tracking-wider transition-all border ${d?"bg-cyan-500/10 text-cyan-400 border-cyan-500/20":"bg-transparent text-text-muted border-transparent hover:text-text-secondary"}`,children:u},u)})})})}),I("div",{ref:m,className:"flex-1 overflow-y-auto custom-scrollbar",children:y.length===0?I("div",{className:"flex items-center justify-center h-full text-text-muted text-xs font-mono",children:"Sin entradas de log"}):y.map(u=>I(Be,{entry:u},u.id))})]})}import{useMemo as Jt}from"react";import{AlertTriangle as qt,XCircle as Vt,Info as Kt,CheckCircle as Xt,Circle as Zt}from"lucide-react";import{useTimelineStore as Yt}from"@decido/engine";import{jsx as F,jsxs as P}from"react/jsx-runtime";function Fe(){let e=Z(s=>s.prototypeBrand),r=Yt(s=>s.timelines)[e],o=Jt(()=>{if(!r)return null;let s=r.keyframes||[],n=r.edges||[],i=new Set(s.map(g=>g.id)),c={};s.forEach(g=>{let E=g.track||"unknown";c[E]=(c[E]||0)+1});let m=new Set(n.map(g=>g.target)),y=new Set(n.map(g=>g.source)),w=s.filter(g=>g.track==="trigger"||g.track==="entry"?!1:!m.has(g.id)&&n.length>0),u=s.filter(g=>m.has(g.id)&&!y.has(g.id)&&g.track!=="return"),d=n.filter(g=>!i.has(g.target)||!i.has(g.source)),v=s.filter(g=>!g.label&&!g.state&&g.track!=="trigger"),b=w.length+d.length+v.length,p=Math.max(0,Math.min(100,100-b*10));return{kfs:s,edges:n,trackCounts:c,orphans:w,terminals:u,deadEdges:d,unlabeled:v,score:p,issues:b}},[r]);if(!r||!o)return F("div",{className:"flex items-center justify-center h-full text-text-muted text-xs font-mono",children:"Sin blueprint activo"});let a=o.score>=80?"text-green-400":o.score>=50?"text-amber-400":"text-red-400",l=o.score>=80?"bg-green-500/10":o.score>=50?"bg-amber-500/10":"bg-red-500/10";return P("div",{className:"h-full overflow-y-auto custom-scrollbar p-4 space-y-4",children:[P("div",{className:`flex items-center gap-4 p-4 rounded-xl ${l} border border-border-subtle`,children:[F("div",{className:`text-4xl font-black ${a} font-mono`,children:o.score}),P("div",{children:[F("div",{className:`text-sm font-bold ${a}`,children:o.score>=80?"\u2705 Saludable":o.score>=50?"\u26A0\uFE0F Revisar":"\u{1F534} Problemas detectados"}),P("div",{className:"text-[11px] text-text-muted",children:[o.kfs.length," nodos \xB7 ",o.edges.length," conexiones \xB7 ",o.issues," problemas"]})]})]}),P("div",{className:"space-y-2",children:[F("div",{className:"text-[11px] font-bold text-text-secondary uppercase tracking-widest",children:"Distribuci\xF3n por Track"}),F("div",{className:"grid grid-cols-2 lg:grid-cols-3 gap-2",children:Object.entries(o.trackCounts).map(([s,n])=>{let i=be[s]||{icon:Zt,color:"text-text-secondary",label:s},c=i.icon;return P("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-surface-glass border border-border-subtle",children:[F(c,{size:14,className:i.color}),F("span",{className:"text-[11px] text-text-primary font-semibold",children:i.label}),F("span",{className:"ml-auto text-[11px] font-mono text-text-muted",children:n})]},s)})})]}),o.orphans.length>0&&P("div",{className:"space-y-1",children:[P("div",{className:"text-[11px] font-bold text-amber-400 flex items-center gap-1",children:[F(qt,{size:12})," Nodos Hu\xE9rfanos (",o.orphans.length,")"]}),o.orphans.map(s=>P("div",{className:"pl-5 text-[11px] text-text-muted font-mono",children:["\xB7 ",s.label||s.id," ",P("span",{className:"text-text-muted",children:["(",s.track,")"]})]},s.id))]}),o.deadEdges.length>0&&P("div",{className:"space-y-1",children:[P("div",{className:"text-[11px] font-bold text-red-400 flex items-center gap-1",children:[F(Vt,{size:12})," Conexiones Rotas (",o.deadEdges.length,")"]}),o.deadEdges.map((s,n)=>P("div",{className:"pl-5 text-[11px] text-text-muted font-mono",children:["\xB7 ",s.source," \u2192 ",s.target]},n))]}),o.unlabeled.length>0&&P("div",{className:"space-y-1",children:[P("div",{className:"text-[11px] font-bold text-text-muted flex items-center gap-1",children:[F(Kt,{size:12})," Sin Etiqueta (",o.unlabeled.length,")"]}),o.unlabeled.slice(0,5).map(s=>P("div",{className:"pl-5 text-[11px] text-text-muted font-mono",children:["\xB7 ",s.id," ",P("span",{className:"text-text-muted",children:["(",s.track,")"]})]},s.id))]}),o.terminals.length>0&&P("div",{className:"space-y-1",children:[P("div",{className:"text-[11px] font-bold text-text-secondary flex items-center gap-1",children:[F(Xt,{size:12})," Nodos Terminales (",o.terminals.length,")"]}),o.terminals.map(s=>P("div",{className:"pl-5 text-[11px] text-text-muted font-mono",children:["\xB7 ",s.label||s.id," ",P("span",{className:"text-text-muted",children:["(",s.track,")"]})]},s.id))]})]})}import{ArrowRight as Qt,Circle as eo}from"lucide-react";import{useTimelineStore as to}from"@decido/engine";import{useEngineStore as oo}from"@decido/engine";import{jsx as Y,jsxs as se}from"react/jsx-runtime";function _e(){let e=Z(n=>n.prototypeBrand),t=to(n=>n.timelines),r=oo(n=>n.activeNodeIds),o=t[e];if(!o)return Y("div",{className:"flex items-center justify-center h-full text-text-muted text-xs font-mono",children:"Sin blueprint activo"});let a=o.keyframes||[],l=o.edges||[],s=new Set(r);return se("div",{className:"h-full overflow-y-auto custom-scrollbar p-3",children:[se("div",{className:"text-[10px] font-bold text-text-muted uppercase tracking-widest mb-3",children:["Grafo: ",o.name||e," \xB7 ",a.length," nodos \xB7 ",l.length," aristas"]}),Y("div",{className:"space-y-1",children:a.map(n=>{let i=be[n.track]||{icon:eo,color:"text-text-secondary",label:n.track},c=i.icon,m=s.has(n.id),y=l.filter(w=>w.source===n.id);return se("div",{className:`group rounded-lg border transition-all ${m?"bg-cyan-500/10 border-cyan-500/30 ring-1 ring-cyan-500/20":"bg-surface-glass border-border-subtle hover:bg-surface-glass"}`,children:[se("div",{className:"flex items-center gap-2 px-3 py-2",children:[Y(c,{size:13,className:i.color}),Y("span",{className:`text-[11px] font-semibold flex-1 ${m?"text-cyan-300":"text-text-primary"}`,children:n.label||n.state||n.id}),Y("span",{className:"text-[9px] text-text-muted font-mono",children:n.track}),m&&Y("span",{className:"w-2 h-2 rounded-full bg-cyan-400 animate-pulse"})]}),y.length>0&&Y("div",{className:"px-3 pb-2 flex flex-wrap gap-1",children:y.map((w,u)=>{let d=a.find(v=>v.id===w.target);return se("span",{className:"inline-flex items-center gap-1 text-[9px] text-text-muted bg-surface-glass rounded px-1.5 py-0.5",children:[Y(Qt,{size:8,className:"text-text-muted"}),d?.label||d?.state||w.target,w.sourceHandle&&w.sourceHandle!=="success"&&se("span",{className:"text-amber-500/70",children:["(",w.sourceHandle,")"]})]},u)})})]},n.id)})})]})}import{useMemo as ro,useState as so}from"react";import{SkipBack as ao,SkipForward as no}from"lucide-react";import{useEngineStore as io}from"@decido/engine";import{jsx as H,jsxs as oe}from"react/jsx-runtime";function We(){let e=O(s=>s.logEntries),t=io(s=>s.activeNodeIds),[r,o]=so(-1),a=ro(()=>e.filter(s=>s.categories.some(n=>["ENGINE","PLUGIN:DIALOGUE","PLUGIN:LOGIC","PLUGIN:SUBFLOW","PLUGIN:RETURN","PLUGIN:UI","PLUGIN:UIRENDER"].includes(n.toUpperCase()))||s.message.includes("\u{1F680}")||s.message.includes("\u{1F500}")||s.message.includes("\u{1F5E3}")||s.message.includes("\u26A1")||s.message.includes("\u{1F3C1}")),[e]),l=r>=0?a[r]:null;return oe("div",{className:"h-full flex flex-col",children:[oe("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-border-subtle shrink-0 bg-surface-primary/50",children:[H("button",{onClick:()=>o(Math.max(0,r-1)),disabled:r<=0,className:"p-1 rounded text-text-muted hover:text-text-primary hover:bg-surface-glass disabled:opacity-30 transition-colors",children:H(ao,{size:14})}),H("span",{className:"text-[10px] text-text-muted font-mono w-16 text-center",children:r>=0?`${r+1}/${a.length}`:`\u2014/${a.length}`}),H("button",{onClick:()=>o(Math.min(a.length-1,r+1)),disabled:r>=a.length-1,className:"p-1 rounded text-text-muted hover:text-text-primary hover:bg-surface-glass disabled:opacity-30 transition-colors",children:H(no,{size:14})}),H("div",{className:"flex-1"}),H("span",{className:"text-[10px] text-text-muted",children:t.length>0&&`Nodo activo: ${t[0]?.substring(0,12)}...`})]}),H("div",{className:"flex-1 overflow-y-auto custom-scrollbar",children:a.length===0?H("div",{className:"flex items-center justify-center h-full text-text-muted text-xs font-mono",children:"Ejecuta un flujo para ver el replay"}):H("div",{className:"py-1",children:a.map((s,n)=>{let i=n===r,c=n<r;return oe("button",{onClick:()=>o(n),className:`w-full flex items-start gap-2 px-3 py-1.5 text-left transition-all border-l-2 ${i?"bg-amber-500/10 border-amber-400 text-amber-300":c?"border-border-default text-text-muted hover:bg-surface-glass":"border-transparent text-text-secondary hover:bg-surface-glass"}`,children:[H("span",{className:`shrink-0 w-5 h-5 rounded-full flex items-center justify-center text-[9px] font-bold mt-0.5 ${i?"bg-amber-500/20 text-amber-400":"bg-surface-glass text-text-muted"}`,children:n+1}),oe("div",{className:"flex-1 min-w-0",children:[H("div",{className:"text-[11px] font-mono truncate",children:s.message}),oe("div",{className:"flex items-center gap-2 mt-0.5",children:[H("span",{className:"text-[9px] text-text-muted",children:s.timestamp}),s.categories.map((m,y)=>H("span",{className:"text-[8px] px-1 py-0.5 rounded bg-surface-glass text-text-muted uppercase tracking-widest",children:m},y))]})]})]},s.id)})})}),l&&oe("div",{className:"border-t border-border-subtle px-3 py-2 bg-surface-primary/80 shrink-0",children:[oe("div",{className:"text-[10px] font-bold text-text-secondary mb-1",children:["Detalle del paso ",r+1]}),H("div",{className:"text-[11px] text-text-primary font-mono break-all",children:l.message}),l.data&&H("pre",{className:"text-[10px] text-text-muted font-mono mt-1 max-h-20 overflow-y-auto",children:typeof l.data=="object"?JSON.stringify(l.data,null,2):String(l.data)})]})]})}import{useState as ie,useMemo as ke,useCallback as Ce,useSyncExternalStore as lo}from"react";import{Database as co,Zap as mo,ChevronRight as fe,ChevronDown as ve,ToggleLeft as po,ToggleRight as uo,Camera as xo,ArrowLeftRight as bo,Download as go}from"lucide-react";import{useEngineStore as fo,useTimelineStore as vo,useUserStateStore as yo}from"@decido/engine";import{jsx as h,jsxs as S}from"react/jsx-runtime";var ye=null;function ho(){return ye||(ye=globalThis.__DECIDO_SHELL_STORES__||[],ye)}var No=[{name:"Playground",group:"studio",store:Z},{name:"Engine",group:"studio",store:fo},{name:"Timeline",group:"studio",store:vo},{name:"Morphology",group:"studio",store:j},{name:"UserState",group:"studio",store:yo},{name:"UIComponents",group:"studio",store:xe}];function le({value:e,path:t,onUpdate:r,depth:o=0}){let[a,l]=ie(o>1);if(e==null)return h("span",{className:"text-text-muted italic text-[10px] font-mono",children:String(e)});if(typeof e=="function")return null;if(typeof e=="boolean")return S("button",{onClick:()=>r(t,!e),className:`flex items-center gap-1 text-[10px] font-mono transition-colors ${e?"text-emerald-400":"text-text-muted"}`,children:[e?h(uo,{size:14}):h(po,{size:14}),String(e)]});if(typeof e=="number")return h("input",{type:"number",value:e,onChange:n=>r(t,Number(n.target.value)),className:"bg-surface-tertiary border border-border-default rounded px-1.5 py-0.5 text-[10px] font-mono text-cyan-300 w-24 outline-hidden focus:border-cyan-500/50"});if(typeof e=="string")return h("input",{type:"text",value:e,onChange:n=>r(t,n.target.value),className:"bg-surface-tertiary border border-border-default rounded px-1.5 py-0.5 text-[10px] font-mono text-amber-300 flex-1 min-w-[80px] max-w-[300px] outline-hidden focus:border-amber-500/50"});let s=Object.prototype.toString.call(e);if(s==="[object Map]"){let n=Array.from(e.entries());return S("div",{className:"pl-3 border-l border-border-subtle",children:[S("button",{onClick:()=>l(!a),className:"flex items-center gap-1 text-[10px] text-text-muted hover:text-text-primary",children:[a?h(fe,{size:10}):h(ve,{size:10}),h("span",{className:"text-violet-400",children:"Map"}),"(",n.length,")"]}),!a&&n.map((i,c)=>S("div",{className:"flex items-start gap-2 py-0.5 pl-2",children:[S("span",{className:"text-[10px] text-text-muted font-mono shrink-0",children:[String(i[0]),":"]}),h(le,{value:i[1],path:`${t}.${String(i[0])}`,onUpdate:()=>{},depth:o+1})]},c))]})}if(s==="[object Set]"){let n=Array.from(e);return S("div",{className:"pl-3 border-l border-border-subtle",children:[S("button",{onClick:()=>l(!a),className:"flex items-center gap-1 text-[10px] text-text-muted hover:text-text-primary",children:[a?h(fe,{size:10}):h(ve,{size:10}),h("span",{className:"text-violet-400",children:"Set"}),"(",n.length,")"]}),!a&&n.map((i,c)=>h("div",{className:"pl-2 py-0.5",children:h(le,{value:i,path:`${t}[${c}]`,onUpdate:()=>{},depth:o+1})},c))]})}if(Array.isArray(e))return S("div",{className:"pl-3 border-l border-border-subtle",children:[S("button",{onClick:()=>l(!a),className:"flex items-center gap-1 text-[10px] text-text-muted hover:text-text-primary",children:[a?h(fe,{size:10}):h(ve,{size:10}),h("span",{className:"text-blue-400",children:"Array"}),S("span",{className:"text-text-muted",children:["[",e.length,"]"]})]}),!a&&e.slice(0,50).map((n,i)=>S("div",{className:"flex items-start gap-2 py-0.5 pl-2",children:[h("span",{className:"text-[9px] text-text-muted font-mono shrink-0 w-4 text-right",children:i}),h(le,{value:n,path:`${t}[${i}]`,onUpdate:r,depth:o+1})]},i)),e.length>50&&S("span",{className:"text-[9px] text-text-muted pl-2",children:["... +",e.length-50," m\xE1s"]})]});if(typeof e=="object"){let n=Object.entries(e).filter(([,i])=>typeof i!="function");return S("div",{className:"pl-3 border-l border-border-subtle",children:[S("button",{onClick:()=>l(!a),className:"flex items-center gap-1 text-[10px] text-text-muted hover:text-text-primary",children:[a?h(fe,{size:10}):h(ve,{size:10}),h("span",{className:"text-orange-400",children:`{${n.length}}`})]}),!a&&n.map(([i,c])=>S("div",{className:"flex items-start gap-2 py-0.5 pl-2",children:[S("span",{className:"text-[10px] text-text-secondary font-mono shrink-0",children:[i,":"]}),h(le,{value:c,path:`${t}.${i}`,onUpdate:r,depth:o+1})]},i))]})}return h("span",{className:"text-text-muted text-[10px] font-mono",children:String(e)})}function Ge(){let e=ke(()=>[...ho(),...No],[]),[t,r]=ie(e[0]?.name||""),o=ke(()=>e.find(d=>d.name===t),[e,t]),a=lo(Ce(d=>o?.store?.subscribe?.(d)||(()=>{}),[o]),Ce(()=>o?.store?.getState?.()??{},[o])),{stateEntries:l,actionEntries:s}=ke(()=>{let d=[],v=[];for(let[b,p]of Object.entries(a))typeof p=="function"?v.push([b,p]):d.push([b,p]);return{stateEntries:d,actionEntries:v}},[a]),n=Ce((d,v)=>{if(!o)return;let b=d.split("."),p=b[1];if(p)if(b.length===2)o.store.setState({[p]:v});else{let g=o.store.getState()[p];try{let E=JSON.parse(JSON.stringify(g)),W=E;for(let re=2;re<b.length-1;re++)W=W[b[re].replace(/\[(\d+)\]/,".$1")];let J=b[b.length-1].replace(/\[(\d+)\]/,"$1");W[J]=v,o.store.setState({[p]:E})}catch{o.store.setState({[p]:v})}}},[o]),[i,c]=ie(null),[m,y]=ie([]),[w,u]=ie(null);return S("div",{className:"flex h-full",children:[h("div",{className:"w-32 shrink-0 border-r border-border-subtle overflow-y-auto bg-surface-primary/50",children:["shell","studio"].map(d=>{let v=e.filter(b=>b.group===d);return v.length===0?null:S("div",{children:[h("div",{className:"px-2 py-1 text-[8px] font-bold text-text-muted uppercase tracking-widest",children:d}),v.map(b=>h("button",{onClick:()=>r(b.name),className:`w-full text-left px-2 py-1.5 text-[10px] font-semibold transition-all ${t===b.name?"bg-emerald-500/10 text-emerald-400 border-r-2 border-emerald-400":"text-text-muted hover:text-text-primary hover:bg-surface-glass"}`,children:b.name},b.name))]},d)})}),S("div",{className:"flex-1 overflow-y-auto custom-scrollbar p-3 space-y-3",children:[S("div",{children:[S("div",{className:"text-[10px] font-bold text-text-secondary uppercase tracking-widest mb-2 flex items-center gap-1",children:[h(co,{size:10})," Estado (",l.length,")"]}),h("div",{className:"space-y-1",children:l.map(([d,v])=>S("div",{className:"flex items-start gap-2 py-0.5",children:[h("span",{className:"text-[10px] text-text-primary font-mono font-semibold shrink-0 min-w-[100px]",children:d}),h(le,{value:v,path:`root.${d}`,onUpdate:n,depth:0})]},d))})]}),s.length>0&&S("div",{children:[S("div",{className:"text-[10px] font-bold text-text-secondary uppercase tracking-widest mb-2 flex items-center gap-1",children:[h(mo,{size:10})," Acciones (",s.length,")"]}),h("div",{className:"flex flex-wrap gap-1",children:s.map(([d,v])=>S("button",{onClick:()=>{try{let b=v();b instanceof Promise&&b.catch(p=>c(`\u274C ${d}: ${p.message}`)),c(`\u2705 ${d}()`)}catch(b){c(`\u274C ${d}: ${b.message}`)}setTimeout(()=>c(null),2e3)},className:"px-2 py-1 rounded text-[9px] font-mono font-bold bg-surface-glass text-text-secondary hover:text-emerald-400 hover:bg-emerald-500/10 border border-border-subtle hover:border-emerald-500/20 transition-all",title:`Ejecutar ${d}()`,children:["\u25B6 ",d]},d))}),i&&h("div",{className:"mt-2 text-[10px] font-mono text-text-secondary animate-pulse",children:i})]}),S("div",{className:"border-t border-border-subtle pt-3 mt-3",children:[S("div",{className:"text-[10px] font-bold text-text-secondary uppercase tracking-widest mb-2 flex items-center gap-1",children:[h(xo,{size:10})," Snapshots"]}),S("div",{className:"flex flex-wrap gap-1 mb-2",children:[h("button",{onClick:()=>{if(!o)return;let d=o.store.getState(),v={};for(let[b,p]of Object.entries(d))typeof p!="function"&&(v[b]=p);y(b=>[...b,{id:Date.now(),label:`${t} @ ${new Date().toLocaleTimeString()}`,data:JSON.parse(JSON.stringify(v,(p,g)=>g instanceof Map?Object.fromEntries(g):g instanceof Set?Array.from(g):g))}])},className:"px-2 py-1 rounded text-[9px] font-mono font-bold bg-violet-500/10 text-violet-400 hover:bg-violet-500/20 border border-violet-500/20",children:"\u{1F4F8} Snapshot"}),m.length>0&&w===null&&S("button",{onClick:()=>u(m[m.length-1].id),className:"px-2 py-1 rounded text-[9px] font-mono font-bold bg-cyan-500/10 text-cyan-400 hover:bg-cyan-500/20 border border-cyan-500/20",children:[h(bo,{size:10,className:"inline mr-1"}),"Diff vs \xFAltimo"]}),w!==null&&h("button",{onClick:()=>u(null),className:"px-2 py-1 rounded text-[9px] font-mono bg-surface-tertiary text-text-secondary hover:bg-surface-tertiary",children:"Cerrar diff"}),m.length>0&&S("button",{onClick:()=>{let d=new Blob([JSON.stringify(m,null,2)],{type:"application/json"}),v=URL.createObjectURL(d),b=document.createElement("a");b.href=v,b.download=`snapshots-${t}.json`,b.click(),URL.revokeObjectURL(v)},className:"px-2 py-1 rounded text-[9px] font-mono text-text-muted hover:text-text-primary hover:bg-surface-glass",children:[h(go,{size:10,className:"inline mr-1"}),"Export"]})]}),m.map((d,v)=>S("div",{className:"flex items-center gap-2 py-0.5 text-[9px]",children:[h("span",{className:"text-text-muted font-mono",children:d.label}),h("button",{onClick:()=>u(w===d.id?null:d.id),className:`px-1.5 py-0.5 rounded font-bold ${w===d.id?"bg-cyan-500/20 text-cyan-400":"text-text-muted hover:text-cyan-400"}`,children:"diff"}),h("button",{onClick:()=>y(b=>b.filter(p=>p.id!==d.id)),className:"text-text-muted hover:text-red-400",children:"\xD7"})]},d.id)),w!==null&&(()=>{let d=m.find(p=>p.id===w);if(!d)return null;let v={};for(let[p,g]of l)v[p]=g;let b=new Set([...Object.keys(d.data),...Object.keys(v)]);return S("div",{className:"mt-2 bg-surface-primary rounded border border-border-subtle p-2 max-h-[200px] overflow-y-auto custom-scrollbar",children:[S("div",{className:"text-[8px] text-text-muted mb-1",children:["Diff: ",d.label," \u2192 actual"]}),Array.from(b).map(p=>{let g=JSON.stringify(d.data[p]),E=JSON.stringify(v[p],(W,J)=>J instanceof Map?Object.fromEntries(J):J instanceof Set?Array.from(J):J);return g===E?null:S("div",{className:"py-0.5 font-mono text-[9px]",children:[S("span",{className:"text-text-secondary font-semibold",children:[p,":"]}),g!==void 0&&S("div",{className:"text-red-400/70 pl-3",children:["- ",g?.slice(0,100)]}),E!==void 0&&S("div",{className:"text-emerald-400/70 pl-3",children:["+ ",E?.slice(0,100)]})]},p)})]})})()]})]})]})}import{useMemo as So,useEffect as Je,useState as wo,useRef as ko}from"react";import{Layers as Co,AlertTriangle as qe,ArrowUp as Eo,Clock as To,RotateCcw as Lo}from"lucide-react";import{jsx as T,jsxs as R}from"react/jsx-runtime";var Ro=0,Ve=100,Ke={"2d":"\u{1F4CA}","3d":"\u{1F9CA}",workbench:"\u{1F527}",liquid:"\u{1F4A7}",artifact:"\u{1F4C4}",custom:"\u2699\uFE0F"},Xe={"2d":"border-cyan-500 bg-cyan-500/10","3d":"border-violet-500 bg-violet-500/10",workbench:"border-amber-500 bg-amber-500/10",liquid:"border-blue-500 bg-blue-500/10",artifact:"border-emerald-500 bg-emerald-500/10",custom:"border-border-default bg-surface-glass"};function $o(){let e=new Date;return`${String(e.getHours()).padStart(2,"0")}:${String(e.getMinutes()).padStart(2,"0")}:${String(e.getSeconds()).padStart(2,"0")}`}function Ze(){let e=j(m=>m.activeStage),t=j(m=>m.stageHistory),r=X(m=>m.activeStage),o=X(m=>m.stageHistory),[a,l]=wo([]),s=ko(null),n=So(()=>{let m=e?.type||null,y=r?.type||null;return m!==y},[e,r]),i=t.length,c=i>5;return Je(()=>{let m=j.getState().activeStage,y=j.getState().stageHistory.length;return j.subscribe(u=>{let d=u.activeStage,v=u.stageHistory.length;if(d!==m||v!==y){let b="change",p="info";v>y?b="\u2B07\uFE0F pushStage":v<y&&d?b="\u2B06\uFE0F popStage":!d&&m?(b="\u{1F5D1}\uFE0F clearStages",p="warn"):d&&!m?b="\u{1F4CC} setStage":b="\u{1F504} setStage",l(g=>{let E=[...g,{id:++Ro,timestamp:$o(),action:b,stageType:d?.type||null,label:d?.label||d?.type||"null",data:{depth:v,sourceNodeId:d?.sourceNodeId},level:p}];return E.length>Ve?E.slice(-Ve):E}),m=d,y=v}})},[]),Je(()=>{s.current&&(s.current.scrollTop=s.current.scrollHeight)},[a]),R("div",{className:"flex h-full text-[10px]",children:[R("div",{className:"w-48 shrink-0 border-r border-border-subtle p-3 space-y-2 overflow-y-auto",children:[R("div",{className:"text-[9px] font-bold text-text-muted uppercase tracking-widest mb-2 flex items-center gap-1",children:[T(Co,{size:10})," Stack (",i+(e?1:0),")"]}),n&&R("div",{className:"px-2 py-1.5 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-[9px] font-bold flex items-center gap-1 animate-pulse",children:[T(qe,{size:10})," Stores desincronizados"]}),c&&R("div",{className:"px-2 py-1.5 rounded-lg bg-amber-500/10 border border-amber-500/30 text-amber-400 text-[9px] font-bold flex items-center gap-1",children:[T(qe,{size:10})," Stack depth: ",i," (posible leak)"]}),e?R("div",{className:`px-3 py-2 rounded-xl border-2 ${Xe[e.type]||"border-border-default bg-surface-glass"} relative`,children:[T("div",{className:"absolute -top-2 right-2 px-1.5 py-0.5 rounded text-[7px] font-bold bg-cyan-500 text-text-inverse uppercase",children:"Activo"}),R("div",{className:"flex items-center gap-1.5",children:[T("span",{className:"text-lg",children:Ke[e.type]||"\u2753"}),R("div",{children:[T("div",{className:"font-bold text-text-primary text-[11px]",children:e.type.toUpperCase()}),e.label&&T("div",{className:"text-text-secondary text-[9px]",children:e.label})]})]}),e.sourceNodeId&&R("div",{className:"mt-1 text-[8px] text-text-muted font-mono truncate",children:["src: ",e.sourceNodeId]})]}):T("div",{className:"px-3 py-2 rounded-xl border border-dashed border-border-default text-text-muted text-center italic",children:"Sin stage activo"}),t.length>0&&T("div",{className:"flex justify-center text-text-muted",children:T(Eo,{size:12})}),[...t].reverse().map((m,y)=>T("div",{className:`px-3 py-1.5 rounded-lg border ${Xe[m.type]||"border-border-default bg-surface-tertiary/50"} opacity-50 hover:opacity-80 cursor-pointer transition-all`,onClick:()=>{let w=y+1,u=j.getState(),d=X.getState();for(let v=0;v<w;v++)u.popStage(),d.popStage()},title:`Click para volver a: ${m.label||m.type}`,children:R("div",{className:"flex items-center gap-1.5",children:[T("span",{children:Ke[m.type]||"\u2753"}),T("span",{className:"font-semibold text-text-primary",children:m.type}),m.label&&R("span",{className:"text-text-muted truncate max-w-[80px]",children:[" \xB7 ",m.label]})]})},y))]}),R("div",{className:"flex-1 flex flex-col",children:[R("div",{className:"px-3 py-1.5 border-b border-border-subtle flex items-center justify-between",children:[R("div",{className:"text-[9px] font-bold text-text-muted uppercase tracking-widest flex items-center gap-1",children:[T(To,{size:10})," Eventos (",a.length,")"]}),T("button",{onClick:()=>l([]),className:"p-0.5 rounded hover:bg-surface-glass text-text-muted hover:text-text-secondary",title:"Limpiar eventos",children:T(Lo,{size:10})})]}),T("div",{ref:s,className:"flex-1 overflow-y-auto custom-scrollbar",children:a.length===0?T("div",{className:"flex items-center justify-center h-full text-text-muted italic",children:"Esperando eventos morph..."}):a.map(m=>R("div",{className:`flex items-start gap-2 px-3 py-1 border-b border-border-subtle hover:bg-surface-glass ${m.level==="warn"?"bg-amber-500/5":m.level==="error"?"bg-red-500/5":""}`,children:[T("span",{className:"text-text-muted shrink-0 font-mono w-[50px]",children:m.timestamp}),T("span",{className:"shrink-0 w-[90px] font-semibold text-text-secondary",children:m.action}),T("span",{className:`font-mono ${m.stageType?"text-cyan-400":"text-text-muted"}`,children:m.label}),m.data?.depth!==void 0&&R("span",{className:"text-text-muted ml-auto shrink-0",children:["depth: ",m.data.depth]})]},m.id))}),n&&R("div",{className:"px-3 py-2 border-t border-red-500/20 bg-red-500/5",children:[T("div",{className:"text-[9px] font-bold text-red-400 mb-1",children:"\u26A0\uFE0F Store Desync Detectado"}),R("div",{className:"grid grid-cols-2 gap-2 text-[9px] font-mono",children:[R("div",{children:[T("span",{className:"text-text-muted",children:"morph:"})," ",T("span",{className:"text-violet-400",children:e?.type||"null"}),R("span",{className:"text-text-muted",children:[" (depth: ",t.length,")"]})]}),R("div",{children:[T("span",{className:"text-text-muted",children:"layout:"})," ",T("span",{className:"text-emerald-400",children:r?.type||"null"}),R("span",{className:"text-text-muted",children:[" (depth: ",o.length,")"]})]})]})]})]})]})}import{useState as st,useSyncExternalStore as Mo,useCallback as Ee,useMemo as Te}from"react";import{Globe as zo,ChevronDown as Do,ChevronRight as Oo,RotateCcw as Io}from"lucide-react";var Po=0,Ao=200,ce=[],he=new Set;function Ye(){let e=new Date;return`${String(e.getHours()).padStart(2,"0")}:${String(e.getMinutes()).padStart(2,"0")}:${String(e.getSeconds()).padStart(2,"0")}`}function Qe(e){ce.push(e),ce.length>Ao&&ce.shift(),he.forEach(t=>t())}function de(){return ce}function tt(){ce.length=0,he.forEach(e=>e())}function ot(e){return he.add(e),()=>he.delete(e)}var et=!1;function rt(){if(et)return;et=!0;let e=window.fetch;window.fetch=async function(t,r){let o=r?.method?.toUpperCase()||"GET",a=typeof t=="string"?t:t instanceof URL?t.toString():t.url,l=++Po,s=performance.now(),n;try{r?.body&&(n=typeof r.body=="string"?r.body.slice(0,2048):"[binary]")}catch{}try{let i=await e.call(window,t,r),c=Math.round(performance.now()-s),m,y=0;try{let u=await i.clone().text();y=u.length,m=u.slice(0,2048)}catch{}return Qe({id:l,timestamp:Ye(),method:o,url:a,status:i.status,duration:c,requestBody:n,responseBody:m,size:y}),i}catch(i){let c=Math.round(performance.now()-s);throw Qe({id:l,timestamp:Ye(),method:o,url:a,status:0,duration:c,requestBody:n,size:0,error:i.message}),i}}}import{Fragment as _o,jsx as C,jsxs as U}from"react/jsx-runtime";rt();var Bo={2:"text-emerald-400",3:"text-amber-400",4:"text-red-400",5:"text-red-500",0:"text-text-muted"};function Ho(e){return Bo[String(e).charAt(0)]||"text-text-secondary"}function jo(e){try{let t=new URL(e),r=t.pathname+t.search;return r.length>60?r.slice(0,57)+"...":r}catch{return e.length>60?e.slice(0,57)+"...":e}}function at(e){try{return new URL(e).hostname}catch{return""}}function Uo(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:`${(e/(1024*1024)).toFixed(1)}MB`}function Fo({entry:e,isExpanded:t,onToggle:r}){return U(_o,{children:[U("div",{onClick:r,className:`flex items-center gap-2 px-3 py-1 text-[10px] font-mono cursor-pointer hover:bg-surface-glass border-b border-border-subtle ${e.error?"bg-red-500/5":""}`,children:[t?C(Do,{size:10,className:"text-text-muted"}):C(Oo,{size:10,className:"text-text-muted"}),C("span",{className:"text-text-muted w-[50px] shrink-0",children:e.timestamp}),C("span",{className:`w-[40px] shrink-0 font-bold ${e.method==="POST"?"text-amber-400":"text-cyan-400"}`,children:e.method}),C("span",{className:`w-[30px] shrink-0 font-bold ${Ho(e.status)}`,children:e.status||"ERR"}),C("span",{className:"flex-1 text-text-primary truncate",title:e.url,children:jo(e.url)}),U("span",{className:"text-text-muted w-[50px] shrink-0 text-right",children:[e.duration,"ms"]}),C("span",{className:"text-text-muted w-[40px] shrink-0 text-right",children:Uo(e.size)})]}),t&&U("div",{className:"px-6 py-2 bg-surface-primary/80 border-b border-border-subtle text-[9px] font-mono space-y-2",children:[U("div",{children:[C("span",{className:"text-text-muted",children:"URL:"})," ",C("span",{className:"text-text-primary break-all",children:e.url})]}),e.error&&U("div",{className:"text-red-400",children:["Error: ",e.error]}),e.requestBody&&U("div",{children:[C("div",{className:"text-text-muted mb-0.5",children:"Request Body:"}),C("pre",{className:"bg-surface-secondary rounded p-2 text-text-secondary overflow-x-auto max-h-[150px] overflow-y-auto whitespace-pre-wrap",children:(()=>{try{return JSON.stringify(JSON.parse(e.requestBody),null,2)}catch{return e.requestBody}})()})]}),e.responseBody&&U("div",{children:[C("div",{className:"text-text-muted mb-0.5",children:"Response Body:"}),C("pre",{className:"bg-surface-secondary rounded p-2 text-text-secondary overflow-x-auto max-h-[150px] overflow-y-auto whitespace-pre-wrap",children:(()=>{try{return JSON.stringify(JSON.parse(e.responseBody),null,2)}catch{return e.responseBody}})()})]})]})]})}function nt(){let e=Mo(Ee(c=>ot(c),[]),Ee(()=>de(),[])),[t,r]=st(new Set),[o,a]=st(""),l=Te(()=>{let c=new Set;return e.forEach(m=>{let y=at(m.url);y&&c.add(y)}),Array.from(c).sort()},[e]),s=Te(()=>o?e.filter(c=>at(c.url).includes(o)):e,[e,o]),n=Ee(c=>{r(m=>{let y=new Set(m);return y.has(c)?y.delete(c):y.add(c),y})},[]),i=Te(()=>e.filter(c=>c.status>=400||c.error).length,[e]);return U("div",{className:"flex flex-col h-full",children:[U("div",{className:"flex items-center gap-2 px-3 py-1.5 border-b border-border-subtle shrink-0",children:[C(zo,{size:12,className:"text-cyan-400"}),C("span",{className:"text-[10px] font-bold text-text-secondary uppercase tracking-widest",children:"Network"}),U("span",{className:"text-[9px] text-text-muted font-mono",children:[s.length,"/",e.length]}),i>0&&U("span",{className:"px-1.5 py-0.5 rounded-full text-[8px] font-bold bg-red-500/20 text-red-400",children:[i," err"]}),C("div",{className:"flex-1"}),l.length>0&&U("select",{value:o,onChange:c=>a(c.target.value),className:"bg-surface-secondary border border-border-default rounded px-1.5 py-0.5 text-[9px] text-text-secondary outline-hidden",children:[C("option",{value:"",children:"All domains"}),l.map(c=>C("option",{value:c,children:c},c))]}),C("button",{onClick:tt,className:"p-0.5 rounded hover:bg-surface-glass text-text-muted hover:text-text-secondary",title:"Limpiar",children:C(Io,{size:10})})]}),U("div",{className:"flex items-center gap-2 px-3 py-0.5 text-[8px] font-bold text-text-muted uppercase tracking-widest border-b border-border-subtle shrink-0",children:[C("span",{className:"w-[14px]"}),C("span",{className:"w-[50px]",children:"Time"}),C("span",{className:"w-[40px]",children:"Method"}),C("span",{className:"w-[30px]",children:"Status"}),C("span",{className:"flex-1",children:"URL"}),C("span",{className:"w-[50px] text-right",children:"Duration"}),C("span",{className:"w-[40px] text-right",children:"Size"})]}),C("div",{className:"flex-1 overflow-y-auto custom-scrollbar",children:s.length===0?C("div",{className:"flex items-center justify-center h-full text-text-muted text-[10px] italic",children:"Sin peticiones de red capturadas"}):s.map(c=>C(Fo,{entry:c,isExpanded:t.has(c.id),onToggle:()=>n(c.id)},c.id))})]})}import{useState as me,useMemo as Le,useCallback as it,useSyncExternalStore as Jo}from"react";import{Plus as Re,Trash2 as qo,Eye as Vo,Zap as Ko,StickyNote as Xo,X as lt,Star as Zo,StarOff as Yo}from"lucide-react";import{create as Wo}from"zustand";import{persist as Go}from"zustand/middleware";var Q=Wo()(Go((e,t)=>({profiles:[],activeProfileId:null,createProfile:r=>{let o={id:Date.now().toString(36),name:r,watchList:[],pinnedActions:[],logCategories:[],logLevels:["info","warn","error","debug"],notes:"",createdAt:Date.now()};e(a=>({profiles:[...a.profiles,o],activeProfileId:o.id}))},updateProfile:(r,o)=>{e(a=>({profiles:a.profiles.map(l=>l.id===r?{...l,...o}:l)}))},deleteProfile:r=>{e(o=>({profiles:o.profiles.filter(a=>a.id!==r),activeProfileId:o.activeProfileId===r?null:o.activeProfileId}))},activateProfile:r=>e({activeProfileId:r}),getActiveProfile:()=>{let{profiles:r,activeProfileId:o}=t();return r.find(a=>a.id===o)},addWatch:(r,o)=>{e(a=>({profiles:a.profiles.map(l=>l.id===r?{...l,watchList:[...l.watchList,o]}:l)}))},removeWatch:(r,o)=>{e(a=>({profiles:a.profiles.map(l=>l.id===r?{...l,watchList:l.watchList.filter((s,n)=>n!==o)}:l)}))},addPinnedAction:(r,o)=>{e(a=>({profiles:a.profiles.map(l=>l.id===r?{...l,pinnedActions:[...l.pinnedActions,o]}:l)}))},removePinnedAction:(r,o)=>{e(a=>({profiles:a.profiles.map(l=>l.id===r?{...l,pinnedActions:l.pinnedActions.filter((s,n)=>n!==o)}:l)}))}}),{name:"decido-debug-profiles-v1"}));import{useEngineStore as Qo,useTimelineStore as er,useUserStateStore as tr}from"@decido/engine";import{jsx as N,jsxs as M}from"react/jsx-runtime";var ee={Playground:Z,Engine:Qo,Timeline:er,Morphology:j,UserState:tr,UIComponents:xe,MorphInstance:ue};function or(e,t){let r=t.split("."),o=e;for(let a of r){if(o==null)return;o=o[a]}return o}function rr(e){if(e==null)return String(e);if(typeof e=="function")return"[fn]";if(typeof e=="object"){let t=Object.prototype.toString.call(e);if(t==="[object Map]")return`Map(${e.size})`;if(t==="[object Set]")return`Set(${e.size})`;if(Array.isArray(e))return`Array(${e.length})`;try{return JSON.stringify(e).slice(0,100)}catch{return"[object]"}}return String(e)}function sr({storeName:e,path:t}){let r=ee[e],o=Jo(it(n=>r?.subscribe?.(n)||(()=>{}),[r]),it(()=>r?.getState?.()??{},[r])),a=or(o,t),l=rr(a),s=typeof a=="number"?"text-cyan-300":typeof a=="string"?"text-amber-300":typeof a=="boolean"?a?"text-emerald-400":"text-text-muted":a==null?"text-text-muted italic":"text-text-secondary";return N("span",{className:`font-mono text-[9px] ${s} max-w-[200px] truncate`,title:l,children:l})}function ar({profile:e}){let{updateProfile:t,addWatch:r,removeWatch:o,addPinnedAction:a,removePinnedAction:l,deleteProfile:s}=Q(),[n,i]=me(Object.keys(ee)[0]),[c,m]=me(""),[y,w]=me(Object.keys(ee)[0]),[u,d]=me(""),v=Le(()=>{let p=ee[n];if(!p)return[];let g=p.getState();return Object.entries(g).filter(([,E])=>typeof E!="function").map(([E])=>E)},[n]),b=Le(()=>{let p=ee[y];if(!p)return[];let g=p.getState();return Object.entries(g).filter(([,E])=>typeof E=="function").map(([E])=>E)},[y]);return M("div",{className:"space-y-3 p-3",children:[M("div",{children:[M("div",{className:"text-[9px] font-bold text-text-secondary uppercase tracking-widest mb-1.5 flex items-center gap-1",children:[N(Vo,{size:10})," Watch List (",e.watchList.length,")"]}),e.watchList.map((p,g)=>M("div",{className:"flex items-center gap-2 py-0.5 group",children:[N("span",{className:"text-[8px] text-text-muted font-bold uppercase",children:p.storeName}),N("span",{className:"text-[9px] text-text-secondary font-mono",children:p.path}),N("span",{className:"text-text-muted",children:"="}),N(sr,{storeName:p.storeName,path:p.path}),N("button",{onClick:()=>o(e.id,g),className:"opacity-0 group-hover:opacity-100 text-text-muted hover:text-red-400 transition-all ml-auto",children:N(lt,{size:10})})]},g)),M("div",{className:"flex items-center gap-1 mt-1",children:[N("select",{value:n,onChange:p=>i(p.target.value),className:"bg-surface-secondary border border-border-default rounded px-1 py-0.5 text-[8px] text-text-secondary",children:Object.keys(ee).map(p=>N("option",{value:p,children:p},p))}),M("select",{value:c,onChange:p=>m(p.target.value),className:"bg-surface-secondary border border-border-default rounded px-1 py-0.5 text-[8px] text-text-secondary flex-1",children:[N("option",{value:"",children:"Select property..."}),v.map(p=>N("option",{value:p,children:p},p))]}),N("button",{onClick:()=>{c&&(r(e.id,{storeName:n,path:c}),m(""))},disabled:!c,className:"px-1.5 py-0.5 rounded text-[8px] font-bold bg-emerald-500/10 text-emerald-400 hover:bg-emerald-500/20 border border-emerald-500/20 disabled:opacity-30",children:N(Re,{size:10})})]})]}),M("div",{children:[M("div",{className:"text-[9px] font-bold text-text-secondary uppercase tracking-widest mb-1.5 flex items-center gap-1",children:[N(Ko,{size:10})," Quick Actions (",e.pinnedActions.length,")"]}),N("div",{className:"flex flex-wrap gap-1 mb-1",children:e.pinnedActions.map((p,g)=>M("button",{onClick:()=>{let E=ee[p.storeName];if(E){let W=E.getState()[p.actionName];typeof W=="function"&&W()}},className:"group px-2 py-0.5 rounded text-[8px] font-mono bg-surface-glass text-text-secondary hover:text-amber-400 hover:bg-amber-500/10 border border-border-subtle hover:border-amber-500/20 flex items-center gap-1",children:["\u25B6 ",p.storeName,".",p.actionName,N("span",{onClick:E=>{E.stopPropagation(),l(e.id,g)},className:"opacity-0 group-hover:opacity-100 text-text-muted hover:text-red-400",children:N(lt,{size:8})})]},g))}),M("div",{className:"flex items-center gap-1",children:[N("select",{value:y,onChange:p=>w(p.target.value),className:"bg-surface-secondary border border-border-default rounded px-1 py-0.5 text-[8px] text-text-secondary",children:Object.keys(ee).map(p=>N("option",{value:p,children:p},p))}),M("select",{value:u,onChange:p=>d(p.target.value),className:"bg-surface-secondary border border-border-default rounded px-1 py-0.5 text-[8px] text-text-secondary flex-1",children:[N("option",{value:"",children:"Select action..."}),b.map(p=>N("option",{value:p,children:p},p))]}),N("button",{onClick:()=>{u&&(a(e.id,{storeName:y,actionName:u}),d(""))},disabled:!u,className:"px-1.5 py-0.5 rounded text-[8px] font-bold bg-amber-500/10 text-amber-400 hover:bg-amber-500/20 border border-amber-500/20 disabled:opacity-30",children:N(Re,{size:10})})]})]}),M("div",{children:[M("div",{className:"text-[9px] font-bold text-text-secondary uppercase tracking-widest mb-1 flex items-center gap-1",children:[N(Xo,{size:10})," Notas"]}),N("textarea",{value:e.notes,onChange:p=>t(e.id,{notes:p.target.value}),placeholder:"Hip\xF3tesis de debugging, observaciones...",className:"w-full bg-surface-secondary border border-border-default rounded px-2 py-1.5 text-[9px] text-text-primary font-mono outline-hidden focus:border-violet-500/50 resize-y min-h-[40px] max-h-[120px]"})]}),M("button",{onClick:()=>s(e.id),className:"flex items-center gap-1 px-2 py-1 rounded text-[9px] text-red-400/60 hover:text-red-400 hover:bg-red-500/10 transition-all",children:[N(qo,{size:10})," Eliminar perfil"]})]})}function ct(){let e=Q(n=>n.profiles),t=Q(n=>n.activeProfileId),{createProfile:r,activateProfile:o}=Q(),[a,l]=me(""),s=Le(()=>e.find(n=>n.id===t),[e,t]);return M("div",{className:"flex h-full",children:[M("div",{className:"w-40 shrink-0 border-r border-border-subtle overflow-y-auto bg-surface-primary/50 flex flex-col",children:[M("div",{className:"p-2",children:[N("div",{className:"text-[8px] font-bold text-text-muted uppercase tracking-widest mb-1",children:"Perfiles"}),e.map(n=>M("button",{onClick:()=>o(n.id),className:`w-full text-left px-2 py-1.5 text-[10px] font-semibold transition-all rounded mb-0.5 flex items-center gap-1.5 ${t===n.id?"bg-violet-500/10 text-violet-400 border-r-2 border-violet-400":"text-text-muted hover:text-text-primary hover:bg-surface-glass"}`,children:[t===n.id?N(Zo,{size:10}):N(Yo,{size:10,className:"opacity-30"}),N("span",{className:"truncate",children:n.name}),N("span",{className:"ml-auto text-[8px] text-text-muted",children:n.watchList.length})]},n.id))]}),N("div",{className:"mt-auto p-2 border-t border-border-subtle",children:M("div",{className:"flex items-center gap-1",children:[N("input",{value:a,onChange:n=>l(n.target.value),onKeyDown:n=>{n.key==="Enter"&&a.trim()&&(r(a.trim()),l(""))},placeholder:"Nuevo perfil...",className:"flex-1 bg-surface-secondary border border-border-default rounded px-1.5 py-0.5 text-[9px] text-text-primary outline-hidden focus:border-violet-500/50"}),N("button",{onClick:()=>{a.trim()&&(r(a.trim()),l(""))},disabled:!a.trim(),className:"p-1 rounded bg-violet-500/10 text-violet-400 hover:bg-violet-500/20 disabled:opacity-30",children:N(Re,{size:12})})]})})]}),N("div",{className:"flex-1 overflow-y-auto custom-scrollbar",children:s?N(ar,{profile:s}):M("div",{className:"flex items-center justify-center h-full text-text-muted text-[10px] italic flex-col gap-2",children:[N("span",{children:"Selecciona o crea un perfil de debug"}),N("span",{className:"text-[8px] text-text-muted",children:"Los perfiles te permiten monitorear variables espec\xEDficas, ejecutar acciones, y tomar notas"})]})})]})}import{useMemo as nr,useRef as ir,useEffect as lr}from"react";import{Clock as cr,Pause as dr,Play as mr,RotateCcw as pr,Search as ur}from"lucide-react";import{jsx as z,jsxs as ae}from"react/jsx-runtime";var xr={morph:"border-l-violet-500 bg-violet-500/5",layout:"border-l-emerald-500 bg-emerald-500/5",gemini:"border-l-blue-500 bg-blue-500/5",chat:"border-l-cyan-500 bg-cyan-500/5",store:"border-l-amber-500 bg-amber-500/5",engine:"border-l-orange-500 bg-orange-500/5",network:"border-l-teal-500 bg-teal-500/5",shell:"border-l-pink-500 bg-pink-500/5",system:"border-l-text-muted bg-surface-glass"},br={morph:"bg-violet-500/20 text-violet-400",layout:"bg-emerald-500/20 text-emerald-400",gemini:"bg-blue-500/20 text-blue-400",chat:"bg-cyan-500/20 text-cyan-400",store:"bg-amber-500/20 text-amber-400",engine:"bg-orange-500/20 text-orange-400",network:"bg-teal-500/20 text-teal-400",shell:"bg-pink-500/20 text-pink-400",system:"bg-surface-glass text-text-secondary"};function gr({event:e}){let t=xr[e.storeName]||"border-l-text-muted bg-surface-glass",r=br[e.storeName]||"bg-surface-glass text-text-secondary";return ae("div",{className:`border-l-2 ${t} px-3 py-1.5 hover:bg-surface-glass transition-colors`,children:[ae("div",{className:"flex items-center gap-2 text-[10px]",children:[z("span",{className:"text-text-muted font-mono shrink-0 w-[65px]",children:e.timestamp}),z("span",{className:`px-1.5 py-0.5 rounded text-[8px] font-bold uppercase tracking-wider ${r}`,children:e.storeName}),z("span",{className:"font-semibold text-text-primary truncate",children:e.actionName}),e.level==="warn"&&z("span",{className:"text-[8px] text-amber-400",children:"\u26A0"}),e.level==="error"&&z("span",{className:"text-[8px] text-red-400",children:"\u2715"})]}),e.data&&z("div",{className:"mt-0.5 text-[9px] text-text-muted font-mono truncate max-w-full",children:typeof e.data=="object"?JSON.stringify(e.data):String(e.data)})]})}function dt(){let e=K(i=>i.events),t=K(i=>i.isPaused),r=K(i=>i.filter),{clear:o,togglePause:a,setFilter:l}=K(),s=ir(null),n=nr(()=>{if(!r)return e;let i=r.toLowerCase();return e.filter(c=>c.storeName.includes(i)||c.actionName.toLowerCase().includes(i))},[e,r]);return lr(()=>{!t&&s.current&&(s.current.scrollTop=s.current.scrollHeight)},[n,t]),ae("div",{className:"flex flex-col h-full",children:[ae("div",{className:"flex items-center gap-2 px-3 py-1.5 border-b border-border-subtle shrink-0",children:[z(cr,{size:12,className:"text-amber-400"}),z("span",{className:"text-[10px] font-bold text-text-secondary uppercase tracking-widest",children:"Timeline"}),ae("span",{className:"text-[9px] text-text-muted font-mono",children:[n.length,"/",e.length]}),t&&z("span",{className:"px-1.5 py-0.5 rounded text-[8px] font-bold bg-amber-500/20 text-amber-400 animate-pulse",children:"PAUSADO"}),z("div",{className:"flex-1"}),ae("div",{className:"flex items-center bg-surface-secondary border border-border-default rounded px-1.5 gap-1",children:[z(ur,{size:10,className:"text-text-muted"}),z("input",{value:r,onChange:i=>l(i.target.value),placeholder:"Filtrar...",className:"bg-transparent text-[9px] text-text-primary outline-hidden w-24 py-0.5"})]}),z("button",{onClick:a,className:`p-1 rounded transition-colors ${t?"bg-amber-500/10 text-amber-400":"text-text-muted hover:text-text-secondary hover:bg-surface-glass"}`,title:t?"Reanudar":"Pausar",children:t?z(mr,{size:10}):z(dr,{size:10})}),z("button",{onClick:o,className:"p-0.5 rounded hover:bg-surface-glass text-text-muted hover:text-text-secondary",title:"Limpiar",children:z(pr,{size:10})})]}),z("div",{ref:s,className:"flex-1 overflow-y-auto custom-scrollbar",children:n.length===0?z("div",{className:"flex items-center justify-center h-full text-text-muted text-[10px] italic",children:e.length===0?"Esperando acciones...":"Sin resultados para el filtro"}):n.map(i=>z(gr,{event:i},i.id))})]})}import{useEffect as ut,useRef as mt,useState as $e}from"react";import{Cpu as fr,HardDrive as vr,BarChart3 as yr}from"lucide-react";import{Fragment as Sr,jsx as $,jsxs as B}from"react/jsx-runtime";function hr(e=1e3){let[t,r]=$e({fps:0,memory:null,domNodes:0}),o=mt(0),a=mt(performance.now());return ut(()=>{let l,s=()=>{o.current++,l=requestAnimationFrame(s)};l=requestAnimationFrame(s);let n=setInterval(()=>{let i=performance.now(),c=(i-a.current)/1e3,m=Math.round(o.current/c);o.current=0,a.current=i;let y=null,w=performance.memory;if(w){let d=Math.round(w.usedJSHeapSize/1024/1024),v=Math.round(w.jsHeapSizeLimit/1024/1024);y={usedMB:d,totalMB:v,percent:Math.round(d/v*100)}}let u=document.querySelectorAll("*").length;r({fps:m,memory:y,domNodes:u})},e);return()=>{cancelAnimationFrame(l),clearInterval(n)}},[e]),t}function pt({data:e,color:t,height:r=24,width:o=80}){if(e.length<2)return null;let a=Math.max(...e,1),l=Math.min(...e,0),s=a-l||1,n=e.map((i,c)=>{let m=c/(e.length-1)*o,y=r-(i-l)/s*r;return`${m},${y}`}).join(" ");return $("svg",{width:o,height:r,className:"shrink-0",children:$("polyline",{points:n,fill:"none",stroke:t,strokeWidth:"1.5",strokeLinejoin:"round"})})}function Nr({fps:e}){let t=e>=50?"text-emerald-400":e>=30?"text-amber-400":"text-red-400",r=e>=50?"bg-emerald-500/10":e>=30?"bg-amber-500/10":"bg-red-500/10",o=Math.min(e/60,1);return B("div",{className:`rounded-xl ${r} px-4 py-3 flex items-center gap-3`,children:[B("div",{className:"relative w-12 h-12",children:[B("svg",{className:"w-12 h-12 -rotate-90",viewBox:"0 0 48 48",children:[$("circle",{cx:"24",cy:"24",r:"20",fill:"none",stroke:"currentColor",className:"text-text-muted",strokeWidth:"3"}),$("circle",{cx:"24",cy:"24",r:"20",fill:"none",stroke:"currentColor",className:t,strokeWidth:"3",strokeDasharray:`${o*125.6} 125.6`,strokeLinecap:"round"})]}),$("span",{className:`absolute inset-0 flex items-center justify-center text-[11px] font-bold ${t}`,children:e})]}),B("div",{children:[$("div",{className:"text-[10px] font-bold text-text-primary",children:"FPS"}),$("div",{className:`text-[9px] ${t}`,children:e>=50?"\u2705 Excelente":e>=30?"\u26A0\uFE0F Aceptable":"\u{1F534} Bajo"})]})]})}function xt(){let e=hr(500),[t,r]=$e([]),[o,a]=$e([]);return ut(()=>{r(l=>{let s=[...l,e.fps];return s.length>60?s.slice(-60):s}),e.memory&&a(l=>{let s=[...l,e.memory.usedMB];return s.length>60?s.slice(-60):s})},[e.fps,e.memory?.usedMB]),B("div",{className:"p-3 space-y-3 overflow-y-auto h-full custom-scrollbar",children:[B("div",{className:"text-[9px] font-bold text-text-muted uppercase tracking-widest flex items-center gap-1",children:[$(yr,{size:10})," Performance Dashboard"]}),B("div",{className:"grid grid-cols-3 gap-3",children:[$(Nr,{fps:e.fps}),B("div",{className:"rounded-xl bg-blue-500/10 px-4 py-3",children:[B("div",{className:"flex items-center gap-1.5 mb-1",children:[$(vr,{size:12,className:"text-blue-400"}),$("span",{className:"text-[10px] font-bold text-text-primary",children:"Memoria"})]}),e.memory?B(Sr,{children:[B("div",{className:"text-[14px] font-bold text-blue-400",children:[e.memory.usedMB,"MB"]}),B("div",{className:"text-[9px] text-text-muted",children:[e.memory.percent,"% de ",e.memory.totalMB,"MB"]}),$("div",{className:"mt-1 h-1.5 bg-surface-tertiary rounded-full overflow-hidden",children:$("div",{className:`h-full rounded-full transition-all ${e.memory.percent>80?"bg-red-500":e.memory.percent>50?"bg-amber-500":"bg-blue-500"}`,style:{width:`${e.memory.percent}%`}})})]}):$("div",{className:"text-[9px] text-text-muted italic",children:"No disponible"})]}),B("div",{className:"rounded-xl bg-violet-500/10 px-4 py-3",children:[B("div",{className:"flex items-center gap-1.5 mb-1",children:[$(fr,{size:12,className:"text-violet-400"}),$("span",{className:"text-[10px] font-bold text-text-primary",children:"DOM"})]}),$("div",{className:"text-[14px] font-bold text-violet-400",children:e.domNodes.toLocaleString()}),$("div",{className:"text-[9px] text-text-muted",children:e.domNodes>5e3?"\u26A0\uFE0F Alto":e.domNodes>2e3?"Normal":"\u2705 Ligero"})]})]}),B("div",{className:"grid grid-cols-2 gap-3",children:[B("div",{className:"rounded-xl bg-surface-secondary/50 border border-border-subtle px-3 py-2",children:[$("div",{className:"text-[9px] text-text-muted mb-1",children:"FPS (\xFAltimos 30s)"}),$(pt,{data:t,color:"#34d399",width:200,height:30})]}),e.memory&&B("div",{className:"rounded-xl bg-surface-secondary/50 border border-border-subtle px-3 py-2",children:[$("div",{className:"text-[9px] text-text-muted mb-1",children:"Memoria (\xFAltimos 30s)"}),$(pt,{data:o,color:"#60a5fa",width:200,height:30})]})]})]})}import{useCallback as Pe,useState as bt}from"react";import{Download as wr,Copy as kr,Check as Cr,FileJson as Er,FileText as Tr}from"lucide-react";import{jsx as A,jsxs as _}from"react/jsx-runtime";function vt(){return{meta:{exportedAt:new Date().toISOString(),userAgent:navigator.userAgent,url:window.location.href,screenSize:`${window.innerWidth}x${window.innerHeight}`},logs:O.getState().logEntries.slice(-100),timeline:K.getState().events,network:de(),morphology:{activeStage:j.getState().activeStage,stageHistory:j.getState().stageHistory},layout:{activeStage:X.getState().activeStage,stageHistory:X.getState().stageHistory,slots:X.getState().slots},instances:(()=>{let t=ue.getState().instances,r=[];return t.forEach((o,a)=>r.push({instanceId:a,...o})),r})(),profiles:Q.getState().profiles}}function gt(){let e=vt(),t=[],r=new Date().toLocaleString();t.push(`# Debug Report \u2014 ${r}
|
|
3
|
+
`),t.push("## Meta"),t.push(`- **Screen**: ${e.meta.screenSize}`),t.push(`- **URL**: ${e.meta.url}`),t.push(`- **UA**: ${e.meta.userAgent}
|
|
4
|
+
`),t.push("## Morphology State"),t.push(`- **Active Stage**: ${e.morphology.activeStage?.type||"null"} (${e.morphology.activeStage?.label||"\u2013"})`),t.push(`- **History Depth**: ${e.morphology.stageHistory.length}`);let o=e.morphology.activeStage?.type===e.layout.activeStage?.type?"\u2705 Sincronizado":"\u26A0\uFE0F DESINCRONIZADO";t.push(`- **Layout Sync**: ${o}
|
|
5
|
+
`);let a={info:0,warn:0,error:0,debug:0};e.logs.forEach(s=>{a[s.level]++}),t.push(`## Logs Summary (${e.logs.length})`),t.push(`| Level | Count |
|
|
6
|
+
|-------|-------|
|
|
7
|
+
| info | ${a.info} |
|
|
8
|
+
| warn | ${a.warn} |
|
|
9
|
+
| error | ${a.error} |
|
|
10
|
+
| debug | ${a.debug} |
|
|
11
|
+
`);let l=e.network.filter(s=>s.status>=400||s.error).length;return t.push(`## Network (${e.network.length} requests, ${l} errors)`),e.network.length>0&&(t.push("| Time | Method | Status | URL | Duration |"),t.push("|------|--------|--------|-----|----------|"),e.network.slice(-20).forEach(s=>{let n=s.url.length>50?s.url.slice(0,47)+"...":s.url;t.push(`| ${s.timestamp} | ${s.method} | ${s.status||"ERR"} | ${n} | ${s.duration}ms |`)})),t.push(""),t.push(`## Timeline Events (${e.timeline.length})`),e.timeline.slice(-30).forEach(s=>{t.push(`- \`${s.timestamp}\` **${s.storeName}**.${s.actionName} ${s.level!=="info"?`(${s.level})`:""}`)}),t.join(`
|
|
12
|
+
`)}function ft(e,t,r){let o=new Blob([e],{type:r}),a=URL.createObjectURL(o),l=document.createElement("a");l.href=a,l.download=t,l.click(),URL.revokeObjectURL(a)}function yt(){let[e,t]=bt(!1),[r,o]=bt(null),a=Pe(()=>{let c=vt(),m=new Date().toISOString().replace(/[:.]/g,"-");ft(JSON.stringify(c,null,2),`debug-report-${m}.json`,"application/json"),o("\u{1F4E6} JSON exportado"),setTimeout(()=>o(null),2e3)},[]),l=Pe(()=>{let c=gt(),m=new Date().toISOString().replace(/[:.]/g,"-");ft(c,`debug-report-${m}.md`,"text/markdown"),o("\u{1F4DD} Markdown exportado"),setTimeout(()=>o(null),2e3)},[]),s=Pe(async()=>{let c=gt();await navigator.clipboard.writeText(c),t(!0),o("\u{1F4CB} Copiado al portapapeles"),setTimeout(()=>{t(!1),o(null)},2e3)},[]),n=O(c=>c.logEntries.length),i=K(c=>c.events.length);return _("div",{className:"p-4 space-y-4 overflow-y-auto h-full custom-scrollbar",children:[_("div",{className:"text-[10px] font-bold text-text-secondary uppercase tracking-widest flex items-center gap-1",children:[A(wr,{size:10})," Exportar Sesi\xF3n de Debug"]}),_("div",{className:"grid grid-cols-3 gap-3",children:[_("button",{onClick:a,className:"rounded-xl bg-blue-500/10 border border-blue-500/20 p-4 hover:bg-blue-500/15 transition-all group",children:[A(Er,{size:24,className:"text-blue-400 mb-2 group-hover:scale-110 transition-transform"}),A("div",{className:"text-[11px] font-bold text-text-primary",children:"JSON Completo"}),A("div",{className:"text-[9px] text-text-muted mt-1",children:"Logs, timeline, network, morph state, profiles"})]}),_("button",{onClick:l,className:"rounded-xl bg-violet-500/10 border border-violet-500/20 p-4 hover:bg-violet-500/15 transition-all group",children:[A(Tr,{size:24,className:"text-violet-400 mb-2 group-hover:scale-110 transition-transform"}),A("div",{className:"text-[11px] font-bold text-text-primary",children:"Markdown Report"}),A("div",{className:"text-[9px] text-text-muted mt-1",children:"Resumen legible con tablas y m\xE9tricas"})]}),_("button",{onClick:s,className:"rounded-xl bg-emerald-500/10 border border-emerald-500/20 p-4 hover:bg-emerald-500/15 transition-all group",children:[e?A(Cr,{size:24,className:"text-emerald-400 mb-2"}):A(kr,{size:24,className:"text-emerald-400 mb-2 group-hover:scale-110 transition-transform"}),A("div",{className:"text-[11px] font-bold text-text-primary",children:"Copiar al Clipboard"}),A("div",{className:"text-[9px] text-text-muted mt-1",children:"Pegar en chat, issue, o documento"})]})]}),_("div",{className:"rounded-xl bg-surface-secondary/50 border border-border-subtle p-3",children:[A("div",{className:"text-[9px] font-bold text-text-muted uppercase tracking-widest mb-2",children:"Datos a exportar"}),_("div",{className:"grid grid-cols-4 gap-3 text-center",children:[_("div",{children:[A("div",{className:"text-[14px] font-bold text-green-400",children:n}),A("div",{className:"text-[8px] text-text-muted",children:"Logs"})]}),_("div",{children:[A("div",{className:"text-[14px] font-bold text-amber-400",children:i}),A("div",{className:"text-[8px] text-text-muted",children:"Timeline"})]}),_("div",{children:[A("div",{className:"text-[14px] font-bold text-cyan-400",children:de().length}),A("div",{className:"text-[8px] text-text-muted",children:"Network"})]}),_("div",{children:[A("div",{className:"text-[14px] font-bold text-violet-400",children:Q.getState().profiles.length}),A("div",{className:"text-[8px] text-text-muted",children:"Profiles"})]})]})]}),r&&A("div",{className:"text-[10px] text-emerald-400 font-mono animate-pulse text-center",children:r})]})}import{useState as q,useCallback as Ae,useEffect as kt,useMemo as Me}from"react";import{Eye as ht,EyeOff as Lr,Search as Rr,Palette as $r,Copy as Nt,X as Pr,Plus as Ar,AlertTriangle as Mr,Box as St,Layers as zr}from"lucide-react";import{Fragment as Hr,jsx as f,jsxs as k}from"react/jsx-runtime";var wt=({target:e,color:t="#3b82f6"})=>{let[r,o]=q(null);return kt(()=>{if(!e){o(null);return}let a=()=>o(e.getBoundingClientRect());a();let l=new ResizeObserver(a);return l.observe(e),window.addEventListener("scroll",a,!0),()=>{l.disconnect(),window.removeEventListener("scroll",a,!0)}},[e]),r?f("div",{className:"fixed pointer-events-none z-99999",style:{left:r.left-2,top:r.top-2,width:r.width+4,height:r.height+4,border:`2px solid ${t}`,borderRadius:4,background:`${t}11`,transition:"all 0.15s ease"},children:k("span",{className:"absolute -top-5 left-0 text-[9px] font-mono px-1.5 py-0.5 rounded",style:{background:t,color:"#fff"},children:[e?.tagName.toLowerCase(),e?.id?`#${e.id}`:"",e?.classList.length?`.${Array.from(e.classList).slice(0,2).join(".")}`:""]})}):null},Dr=["display","position","z-index","opacity","width","height","max-width","max-height","margin","padding","gap","flex","flex-direction","align-items","justify-content","background-color","color","font-size","font-weight","border","border-radius","box-shadow","backdrop-filter","overflow","transform","pointer-events"];function Or(e){return e?/^#[0-9a-f]{3,8}$/i.test(e)||/^rgb/i.test(e):!1}function Ir(e){let t=getComputedStyle(e),r=getComputedStyle(document.documentElement),o=[],a=["surface-primary","surface-secondary","surface-tertiary","surface-elevated","surface-glass","text-primary","text-secondary","text-muted","accent-blue","accent-purple","accent-green","accent-red","accent-amber","accent-cyan","border-subtle","border-default","border-strong","border-glow"],l=t.backgroundColor,s=t.color,n=t.borderColor;for(let i of a){let c=r.getPropertyValue(`--ds-${i}`).trim();c&&(l===c||s===c||n===c)&&o.push({token:`--ds-${i}`,value:c})}return o}var Br=({el:e})=>{let t=getComputedStyle(e),r={t:t.marginTop,r:t.marginRight,b:t.marginBottom,l:t.marginLeft},o={t:t.paddingTop,r:t.paddingRight,b:t.paddingBottom,l:t.paddingLeft},a=e.offsetWidth,l=e.offsetHeight;return f("div",{className:"flex justify-center py-3",children:f("div",{className:"relative text-[8px] font-mono select-none",children:k("div",{className:"border border-dashed border-accent-amber/40 bg-accent-amber/5 px-6 py-4 rounded",children:[f("span",{className:"absolute top-0.5 left-1 text-accent-amber/60",children:"margin"}),f("span",{className:"absolute top-1 left-1/2 -translate-x-1/2 text-accent-amber",children:r.t}),f("span",{className:"absolute bottom-1 left-1/2 -translate-x-1/2 text-accent-amber",children:r.b}),f("span",{className:"absolute left-1 top-1/2 -translate-y-1/2 text-accent-amber",children:r.l}),f("span",{className:"absolute right-1 top-1/2 -translate-y-1/2 text-accent-amber",children:r.r}),k("div",{className:"border border-dashed border-accent-green/40 bg-accent-green/5 px-6 py-4 rounded relative",children:[f("span",{className:"absolute top-0.5 left-1 text-accent-green/60",children:"padding"}),f("span",{className:"absolute top-1 left-1/2 -translate-x-1/2 text-accent-green",children:o.t}),f("span",{className:"absolute bottom-1 left-1/2 -translate-x-1/2 text-accent-green",children:o.b}),f("span",{className:"absolute left-1 top-1/2 -translate-y-1/2 text-accent-green",children:o.l}),f("span",{className:"absolute right-1 top-1/2 -translate-y-1/2 text-accent-green",children:o.r}),k("div",{className:"bg-accent-blue/10 border border-accent-blue/30 rounded px-4 py-2 text-center text-accent-blue",children:[a," \xD7 ",l]})]})]})})})},Ct=()=>{let[e,t]=q(null),[r,o]=q(null),[a,l]=q(!1),[s,n]=q("classes"),[i,c]=q(""),[m,y]=q(!1),[w,u]=q(""),[d,v]=q([]),b=Se(x=>x.setTheme),p=Se(x=>x.currentThemeId);kt(()=>{if(!a)return;let x=L=>{L.preventDefault(),L.stopPropagation();let G=L.target;G.closest("[data-debug-panel]")||(t(G),l(!1))},D=L=>{let G=L.target;G.closest("[data-debug-panel]")||o(G)};return document.addEventListener("click",x,!0),document.addEventListener("mousemove",D,!0),document.body.style.cursor="crosshair",()=>{document.removeEventListener("click",x,!0),document.removeEventListener("mousemove",D,!0),document.body.style.cursor=""}},[a]);let g=Me(()=>e?Array.from(e.classList).filter(x=>!i||x.includes(i)):[],[e,i]),E=Me(()=>{if(!e)return[];let x=getComputedStyle(e);return(m?Array.from({length:x.length},(L,G)=>x[G]):Dr).map(L=>({prop:L,value:x.getPropertyValue(L)})).filter(L=>L.value&&L.value!=="none"&&L.value!=="normal"&&L.value!=="auto"&&L.value!=="0px").filter(L=>!i||L.prop.includes(i)||L.value.includes(i))},[e,i,m]),W=Me(()=>e?Ir(e):[],[e]),J=Ae(x=>{e&&(e.classList.toggle(x),t(e),c(D=>D))},[e]),re=Ae(()=>{!e||!w.trim()||(e.classList.add(...w.trim().split(/\s+/)),u(""),c(x=>x))},[e,w]),Et=Ae(()=>{let x=document.getElementById("root");if(!x)return;let D=[];x.querySelectorAll("*").forEach(L=>{if(!(L instanceof HTMLElement))return;let G=getComputedStyle(L),pe=G.backgroundColor,ss=G.color;pe&&pe!=="rgba(0, 0, 0, 0)"&&pe!=="transparent"&&!Array.from(L.classList).some(ze=>ze.startsWith("bg-surface-")||ze.startsWith("bg-accent-"))&&Or(pe)&&D.push(L)}),v(D)},[]),Tt=[{id:"classes",label:"Classes",icon:zr},{id:"computed",label:"CSS",icon:St},{id:"tokens",label:"Tokens",icon:$r},{id:"box",label:"Box",icon:St}];return k("div",{className:"flex flex-col h-full text-text-primary","data-debug-panel":!0,children:[f(wt,{target:a?r:e,color:a?"#f59e0b":"#3b82f6"}),r&&!a&&r!==e&&f(wt,{target:r,color:"#22d3ee44"}),k("div",{className:"flex items-center gap-1 px-2 py-1.5 border-b border-border-subtle bg-surface-secondary/50 shrink-0",children:[k("button",{onClick:()=>l(!a),className:`flex items-center gap-1 px-2 py-1 rounded text-[10px] font-semibold transition-all ${a?"bg-accent-amber/20 text-accent-amber ring-1 ring-accent-amber/40":"text-text-muted hover:text-text-primary hover:bg-surface-glass"}`,title:"Pick Element",children:[a?f(ht,{size:11}):f(Lr,{size:11}),"Pick"]}),f("div",{className:"w-px h-4 bg-border-subtle mx-1"}),f("select",{value:p,onChange:x=>b(x.target.value),className:"bg-surface-tertiary text-text-primary text-[10px] font-mono rounded px-1.5 py-1 border border-border-subtle outline-none cursor-pointer",children:De.map(x=>f("option",{value:x.id,children:x.name},x.id))}),f("div",{className:"w-px h-4 bg-border-subtle mx-1"}),k("button",{onClick:Et,className:"flex items-center gap-1 px-2 py-1 rounded text-[10px] font-semibold text-text-muted hover:text-accent-red hover:bg-accent-red/10 transition-all",title:"Find elements with hardcoded colors",children:[f(Mr,{size:10}),"Audit",d.length>0&&f("span",{className:"text-[8px] bg-accent-red/20 text-accent-red px-1 rounded-full",children:d.length})]}),e&&k("div",{className:"ml-auto text-[9px] font-mono text-text-muted truncate max-w-[180px]",children:["<",e.tagName.toLowerCase(),e.id?`#${e.id}`:"",">",k("span",{className:"text-text-muted/50 ml-1",children:[e.offsetWidth,"\xD7",e.offsetHeight]})]})]}),e?k(Hr,{children:[k("div",{className:"flex items-center gap-0.5 px-2 py-1 border-b border-border-subtle shrink-0",children:[Tt.map(x=>f("button",{onClick:()=>n(x.id),className:`px-2 py-0.5 rounded text-[10px] font-semibold transition-all ${s===x.id?"bg-surface-glass text-text-primary":"text-text-muted hover:text-text-primary"}`,children:x.label},x.id)),k("div",{className:"ml-auto flex items-center gap-1 bg-surface-tertiary rounded px-1.5 py-0.5 border border-border-subtle",children:[f(Rr,{size:9,className:"text-text-muted"}),f("input",{value:i,onChange:x=>c(x.target.value),placeholder:"Filter...",className:"bg-transparent text-text-primary text-[10px] font-mono outline-none w-20"})]})]}),k("div",{className:"flex-1 overflow-auto scrollbar-thin",children:[s==="classes"&&k("div",{className:"p-2",children:[k("div",{className:"flex items-center gap-1 mb-2",children:[f("input",{value:w,onChange:x=>u(x.target.value),onKeyDown:x=>x.key==="Enter"&&re(),placeholder:"Add TW class...",className:"flex-1 bg-surface-tertiary text-text-primary text-[10px] font-mono px-2 py-1 rounded border border-border-subtle outline-none focus:border-accent-blue/50"}),f("button",{onClick:re,className:"p-1 rounded text-text-muted hover:text-accent-green hover:bg-accent-green/10",children:f(Ar,{size:11})})]}),k("div",{className:"flex flex-wrap gap-1",children:[g.map(x=>k("button",{onClick:()=>J(x),className:"group flex items-center gap-0.5 px-1.5 py-0.5 rounded text-[9px] font-mono bg-surface-glass border border-border-subtle text-text-secondary hover:text-text-primary hover:border-accent-blue/40 transition-all",children:[x,f(Pr,{size:8,className:"opacity-0 group-hover:opacity-100 text-accent-red"})]},x)),g.length===0&&f("span",{className:"text-[10px] text-text-muted italic",children:"No classes match filter"})]}),k("button",{onClick:()=>e&&navigator.clipboard.writeText(Array.from(e.classList).join(" ")),className:"mt-2 flex items-center gap-1 text-[9px] text-text-muted hover:text-accent-cyan transition-colors",children:[f(Nt,{size:9})," Copy all classes"]})]}),s==="computed"&&k("div",{children:[f("div",{className:"px-2 py-1 flex justify-end",children:f("button",{onClick:()=>y(!m),className:`text-[9px] font-mono px-1.5 py-0.5 rounded ${m?"bg-accent-purple/20 text-accent-purple":"text-text-muted hover:text-text-primary"}`,children:m?"ALL":"KEY"})}),E.map(({prop:x,value:D})=>k("div",{className:"flex items-center gap-1 px-2 py-0.5 text-[10px] font-mono hover:bg-surface-glass group",children:[k("span",{className:"text-accent-purple shrink-0 w-[110px] truncate",children:[x,":"]}),f("span",{className:"flex-1 text-text-secondary truncate",children:D}),(x.includes("color")||x==="background-color")&&D!=="transparent"&&D!=="rgba(0, 0, 0, 0)"&&f("span",{className:"w-3 h-3 rounded-sm border border-border-subtle shrink-0",style:{backgroundColor:D}}),f("button",{onClick:()=>navigator.clipboard.writeText(`${x}: ${D}`),className:"opacity-0 group-hover:opacity-100 text-text-muted hover:text-accent-cyan",children:f(Nt,{size:9})})]},x))]}),s==="tokens"&&k("div",{className:"p-2",children:[f("div",{className:"text-[9px] font-mono text-text-muted uppercase tracking-wider mb-2",children:"Active Design Tokens"}),W.length>0?W.map(({token:x,value:D})=>k("div",{className:"flex items-center gap-2 px-2 py-1 rounded hover:bg-surface-glass text-[10px] font-mono",children:[f("span",{className:"w-4 h-4 rounded border border-border-subtle shrink-0",style:{backgroundColor:D}}),f("span",{className:"text-accent-cyan",children:x}),f("span",{className:"text-text-muted ml-auto",children:D})]},x)):k("div",{className:"text-text-muted text-[10px] italic",children:["No `--ds-*` tokens detected on this element.",f("br",{}),"This might use hardcoded colors."]}),e?.style.cssText&&k("div",{className:"mt-3",children:[f("div",{className:"text-[9px] font-mono text-text-muted uppercase tracking-wider mb-1",children:"Inline Styles"}),f("div",{className:"text-[10px] font-mono text-accent-amber bg-surface-glass rounded p-2 break-all",children:e.style.cssText})]})]}),s==="box"&&e&&f(Br,{el:e})]})]}):k("div",{className:"flex-1 flex flex-col items-center justify-center text-text-muted text-xs gap-2 py-8",children:[f(ht,{size:24,className:"opacity-30"}),k("span",{children:["Click ",f("strong",{children:'"Pick"'})," to select an element"]}),k("span",{className:"text-[9px]",children:["or use ",f("strong",{children:'"Audit"'})," to find hardcoded colors"]})]}),d.length>0&&k("div",{className:"shrink-0 border-t border-border-subtle px-2 py-1 bg-accent-red/5",children:[k("div",{className:"text-[9px] font-mono text-accent-red mb-1",children:["\u26A0 ",d.length," elements with potential hardcoded colors"]}),f("div",{className:"flex flex-wrap gap-1 max-h-12 overflow-auto",children:d.slice(0,20).map((x,D)=>k("button",{onClick:()=>{t(x),n("computed")},className:"text-[8px] font-mono text-text-muted hover:text-accent-red bg-surface-glass rounded px-1 py-0.5",children:[x.tagName.toLowerCase(),x.className&&typeof x.className=="string"?`.${x.className.split(" ")[0]}`:""]},D))})]})]})};import{jsx as V,jsxs as Ne}from"react/jsx-runtime";var os=[{id:"logs",label:"Logs",icon:Wr,color:"text-green-400"},{id:"flow-health",label:"Health",icon:Gr,color:"text-cyan-400"},{id:"topology",label:"Topology",icon:Jr,color:"text-purple-400"},{id:"replay",label:"Replay",icon:qr,color:"text-amber-400"},{id:"stores",label:"Stores",icon:Vr,color:"text-emerald-400"},{id:"morph-stack",label:"Morph",icon:Kr,color:"text-violet-400"},{id:"network",label:"Network",icon:Xr,color:"text-cyan-400"},{id:"profiles",label:"Profiles",icon:Zr,color:"text-rose-400"},{id:"timeline",label:"Timeline",icon:Yr,color:"text-amber-400"},{id:"performance",label:"Perf",icon:Qr,color:"text-lime-400"},{id:"export",label:"Export",icon:es,color:"text-text-secondary"},{id:"css-inspector",label:"CSS",icon:ts,color:"text-indigo-400"}],rs={logs:Ue,"flow-health":Fe,topology:_e,replay:We,stores:Ge,"morph-stack":Ze,network:nt,profiles:ct,timeline:dt,performance:xt,export:yt,"css-inspector":Ct},En=jr.memo(function({className:t}){let r=O(i=>i.isOpen),o=O(i=>i.activeTab),a=O(i=>i.setActiveTab),l=O(i=>i.togglePanel),s=O(i=>i.errorCount);if(!r)return null;let n=rs[o];return V(Fr,{children:Ne(Ur.div,{initial:{height:0,opacity:0},animate:{height:"100%",opacity:1},exit:{height:0,opacity:0},transition:{duration:.15,ease:"easeOut"},className:`flex flex-col bg-surface-primary border-t border-border-default overflow-hidden ${t||""}`,children:[Ne("div",{className:"flex items-center justify-between px-2 py-1 border-b border-border-subtle shrink-0 bg-surface-primary/80",children:[V("div",{className:"flex items-center gap-0.5 overflow-x-auto flex-1 min-w-0",style:{scrollbarWidth:"none"},children:os.map(i=>{let c=i.icon,m=o===i.id;return Ne("button",{onClick:()=>a(i.id),className:`flex items-center gap-1 px-2 py-1 rounded-md text-[10px] font-semibold transition-all whitespace-nowrap shrink-0 ${m?"bg-surface-glass text-text-primary shadow-xs":"text-text-muted hover:text-text-primary hover:bg-surface-glass"}`,children:[V(c,{size:11,className:m?i.color:""}),i.label,i.id==="logs"&&s>0&&V("span",{className:"ml-0.5 px-1 py-0.5 rounded-full text-[8px] font-bold bg-red-500/20 text-red-400",children:s})]},i.id)})}),Ne("div",{className:"flex items-center gap-1 shrink-0 ml-1",children:[V("span",{className:"text-[9px] text-text-muted font-mono mr-1",children:"\u2303\u21E7D"}),V("button",{onClick:l,className:"p-1 rounded text-text-muted hover:text-text-primary hover:bg-surface-glass transition-colors",title:"Cerrar panel",children:V(_r,{size:14})})]})]}),V("div",{className:"flex-1 overflow-hidden",children:V(n,{})})]})})});export{En as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var g=Object.create;var f=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty;var m=(b,a)=>()=>(a||b((a={exports:{}}).exports,a),a.exports);var l=(b,a,c,e)=>{if(a&&typeof a=="object"||typeof a=="function")for(let d of i(a))!k.call(b,d)&&d!==c&&f(b,d,{get:()=>a[d],enumerable:!(e=h(a,d))||e.enumerable});return b};var n=(b,a,c)=>(c=b!=null?g(j(b)):{},l(a||!b||!b.__esModule?f(c,"default",{value:b,enumerable:!0}):c,b));export{m as a,n as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{create as f}from"zustand";var d=500,L=0,m=f((t,o)=>({isOpen:!1,activeTab:"logs",logEntries:[],logFilters:{levels:new Set(["info","warn","error","debug"]),categories:new Set},allCategories:new Set,errorCount:0,togglePanel:()=>t(e=>({isOpen:!e.isOpen})),setOpen:e=>t({isOpen:e}),setActiveTab:e=>t({activeTab:e}),addLogEntry:e=>{let n=++L,r={...e,id:n};t(i=>{let l=[...i.logEntries,r];l.length>d&&l.splice(0,l.length-d);let u=new Set(i.allCategories);return e.categories.forEach(y=>u.add(y)),{logEntries:l,allCategories:u,errorCount:e.level==="error"?i.errorCount+1:i.errorCount}})},clearLogs:()=>t({logEntries:[],errorCount:0}),toggleLevel:e=>t(n=>{let r=new Set(n.logFilters.levels);return r.has(e)?r.delete(e):r.add(e),{logFilters:{...n.logFilters,levels:r}}}),toggleCategory:e=>t(n=>{let r=new Set(n.logFilters.categories);return r.has(e)?r.delete(e):r.add(e),{logFilters:{...n.logFilters,categories:r}}}),resetFilters:()=>t({logFilters:{levels:new Set(["info","warn","error","debug"]),categories:new Set}})}));import{create as S}from"zustand";var v=200,b=0,p=S((t,o)=>({events:[],isPaused:!1,filter:"",addEvent:e=>{if(o().isPaused)return;let n=++b;t(r=>{let i=[...r.events,{...e,id:n}];return{events:i.length>v?i.slice(-v):i}})},clear:()=>t({events:[]}),togglePause:()=>t(e=>({isPaused:!e.isPaused})),setFilter:e=>t({filter:e})}));var a=0,c=null,E=50;function C(){let t=new Date;return`${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}:${String(t.getSeconds()).padStart(2,"0")}.${String(t.getMilliseconds()).padStart(3,"0")}`}function g(t,o,e,n){if(a>=E)return;a++,c||(c=setTimeout(()=>{a=0,c=null},1e3));let r=C();m.getState().addLogEntry({timestamp:r,level:t,categories:o,message:e,data:n});let i=o[0]||"system",l=e.split(" ")[0]||e;p.getState().addEvent({timestamp:r,storeName:i,actionName:l,data:n,level:t==="debug"?"info":t})}function s(t){return(o,e,n="info")=>{g(n,[t],o,e)}}var D={morph:s("morph"),chat:s("chat"),gemini:s("gemini"),network:s("network"),shell:s("shell"),engine:s("engine"),layout:s("layout"),store:s("store"),system:s("system"),info:(t,o,e)=>g("info",[t],o,e),warn:(t,o,e)=>g("warn",[t],o,e),error:(t,o,e)=>g("error",[t],o,e),debug:(t,o,e)=>g("debug",[t],o,e)};export{m as a,p as b,D as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as I}from"./chunk-YHFKY5MB.mjs";import{create as u}from"zustand";import{persist as h}from"zustand/middleware";var v=u()(h((c,i)=>({instances:new Map,activeInstanceId:null,historyByInstance:new Map,upsertInstance:t=>{I.store(`upsertInstance: ${t.id} (${t.shellType})`,{id:t.id,shellType:t.shellType,label:t.label}),c(n=>{let e=new Map(n.instances),s=e.get(t.id),a=new Map(n.historyByInstance);if(s?.data){let o=a.get(t.id)||{stack:[],index:-1},r=o.stack.slice(0,o.index+1);r.push({...s.data}),r.length>20&&r.shift(),a.set(t.id,{stack:r,index:r.length-1})}return e.set(t.id,{artifacts:[],activeArtifactIndex:0,createdAt:Date.now(),...s,...t}),{instances:e,activeInstanceId:t.id,historyByInstance:a}})},removeInstance:t=>{c(n=>{let e=new Map(n.instances);e.delete(t);let s=n.activeInstanceId===t?e.size>0?e.keys().next().value??null:null:n.activeInstanceId;return{instances:e,activeInstanceId:s}})},setActiveInstance:t=>c({activeInstanceId:t}),pushArtifact:(t,n)=>{c(e=>{let s=new Map(e.instances),a=s.get(t);if(!a)return e;let o={...n,updatedAt:Date.now()},r=[...a.artifacts,o];return s.set(t,{...a,artifacts:r,activeArtifactIndex:r.length-1}),{instances:s}})},updateArtifact:(t,n,e)=>{c(s=>{let a=new Map(s.instances),o=a.get(t);if(!o)return s;let r=o.artifacts.map(d=>d.id===n?{...d,data:{...d.data,...e},updatedAt:Date.now()}:d);return a.set(t,{...o,artifacts:r}),{instances:a}})},setActiveArtifact:(t,n)=>{c(e=>{let s=new Map(e.instances),a=s.get(t);return a?(s.set(t,{...a,activeArtifactIndex:Math.max(0,Math.min(n,a.artifacts.length-1))}),{instances:s}):e})},removeArtifact:(t,n)=>{c(e=>{let s=new Map(e.instances),a=s.get(t);if(!a)return e;let o=a.artifacts.filter(r=>r.id!==n);return s.set(t,{...a,artifacts:o,activeArtifactIndex:Math.min(a.activeArtifactIndex,Math.max(0,o.length-1))}),{instances:s}})},getInstance:t=>i().instances.get(t),getInstances:()=>Array.from(i().instances.values()),getActiveInstance:()=>{let{instances:t,activeInstanceId:n}=i();return n?t.get(n):void 0},undo:t=>{let n=t||i().activeInstanceId;n&&c(e=>{let s=e.historyByInstance.get(n);if(!s||s.index<0)return e;let a=new Map(e.instances),o=a.get(n);if(!o)return e;let r=new Map(e.historyByInstance),d=s.stack[s.index];return I.store(`undo: ${n} \u2192 version ${s.index}/${s.stack.length}`,{instanceId:n}),a.set(n,{...o,data:{...d}}),r.set(n,{...s,index:s.index-1}),{instances:a,historyByInstance:r}})},redo:t=>{let n=t||i().activeInstanceId;n&&c(e=>{let s=e.historyByInstance.get(n);if(!s||s.index>=s.stack.length-1)return e;let a=new Map(e.instances),o=a.get(n);if(!o)return e;let r=new Map(e.historyByInstance),d=s.index+1,f=s.stack[d];return I.store(`redo: ${n} \u2192 version ${d+1}/${s.stack.length}`,{instanceId:n}),a.set(n,{...o,data:{...f}}),r.set(n,{...s,index:d}),{instances:a,historyByInstance:r}})},canUndo:t=>{let n=t||i().activeInstanceId;if(!n)return!1;let e=i().historyByInstance.get(n);return!!e&&e.index>=0},canRedo:t=>{let n=t||i().activeInstanceId;if(!n)return!1;let e=i().historyByInstance.get(n);return!!e&&e.index<e.stack.length-1},getHistoryInfo:t=>{let n=t||i().activeInstanceId;if(!n)return{current:0,total:0};let e=i().historyByInstance.get(n);return e?{current:e.index+2,total:e.stack.length+1}:{current:0,total:0}}}),{name:"decido-morph-instances",storage:{getItem:c=>{let i=localStorage.getItem(c);if(!i)return null;let t=JSON.parse(i);return t.state?.instances&&(t.state.instances=new Map(t.state.instances)),t},setItem:(c,i)=>{let t={...i,state:{...i.state,instances:Array.from(i.state.instances.entries())}};localStorage.setItem(c,JSON.stringify(t))},removeItem:c=>localStorage.removeItem(c)},partialize:c=>({instances:c.instances,activeInstanceId:c.activeInstanceId})}));export{v as a};
|