1import{b3 as J,u as L,r,s as p,f as d,j as e,Q as j,a3 as O,q as D,B as A,_ as z,ah as F,ai as R,X as G,aj as P,ak as H,al as $,am as K,an as Q,ao as V,ap as X,H as U,I as W,J as x,d1 as Y,c$ as Z,b6 as ee,K as u,k as ae}from"./index-BwaMfbd5.js";import{F as se,M as te}from"./MindMapBuilder-Pf2az-e5.js";import{B as re}from"./BrandDNAPanel-CvtKSAMl.js";import{B as ie}from"./BrandBoardsTab-ihkNO9jq.js";import"./mindmap-DQ8j_td7.js";import"./scroll-area-DokqGbPN.js";import"./ban-CpGPJ71k.js";import"./image-C5Jyz2ta.js";import"./lightbulb-Lt1y7v68.js";import"./star-CVksT-3A.js";import"./index-BH2u50av.js";import"./zoom-B5hfJite.js";import"./string-krCEEwQa.js";import"./value-C9lKiJzi.js";/* empty css */import"./v4-D2B3jvp-.js";import"./collapsible-Dzz_RMfm.js";import"./index-Cf4kKkZM.js";import"./parseICPProfiles-CAZE-I2g.js";import"./chevron-left-Dbex25-N.js";import"./mediaAssets-DmbuxhZf.js";import"./BoardAssetDrawer-DBbEUAiA.js";import"./checkbox-Cmcn3Vex.js";import"./images-BY1C6bb1.js";import"./format-BzJ9n0vD.js";import"./en-US-xHSDCZDo.js";import"./es-mB7MmlTZ.js";import"./popover-CmSlzXqW.js";import"./index-B6dmojrU.js";import"./calendar-B-4d77YK.js";import"./startOfMonth-C4fdzoWp.js";import"./endOfMonth-Dj-hEvVp.js";import"./subDays-BBRqfaoE.js";import"./arrow-right-left-BqhWoatz.js";import"./calendar-BSmI-3yV.js";import"./download-CIy4X3xv.js";import"./formatDistanceToNow-Q1M_WJaA.js";(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},c=new s.Error().stack;c&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[c]="caa9cac5-eff4-4c23-a0c0-dfc1b46d6f6f",s._sentryDebugIdIdentifier="sentry-dbid-caa9cac5-eff4-4c23-a0c0-dfc1b46d6f6f")}catch{}})();function Pe({canonicalId:s,onClose:c}){const{toast:h}=J(),{activeBrandId:b}=L(),[n,B]=r.useState(null),[_,N]=r.useState(!0),[v,y]=r.useState(!1),[w,S]=r.useState(null),[f,E]=r.useState([]),[l,g]=r.useState({name:"Mind Map",layout:"free",theme:"default"}),[C,M]=r.useState("map"),T=r.useRef(null),t=r.useMemo(()=>(n==null?void 0:n.project_id)??b??null,[n,b]);r.useEffect(()=>{let a=!1;return N(!0),(async()=>{try{const{data:i,error:o}=await p.from("mindmaps").select("*").eq("id",s).maybeSingle();if(o)throw o;if(a)return;const m=i;B(m),m&&(E(m.nodes??[]),g(m.mindmap_config??{name:m.name,layout:"free",theme:"default"}))}catch(i){d.error("Error al cargar mind map: "+i.message)}finally{a||N(!1)}})(),()=>{a=!0}},[s]);const k=async()=>{if(n){y(!0);try{const a={name:l.name,nodes:JSON.parse(JSON.stringify(f)),mindmap_config:JSON.parse(JSON.stringify(l))};t&&(a.project_id=t);const{error:i}=await p.from("mindmaps").update(a).eq("id",s);if(i)throw i;d.success("Mind Map guardado")}catch(a){d.error("Error al guardar: "+a.message)}finally{y(!1)}}},I=async()=>{try{const{error:a}=await p.from("mindmaps").delete().eq("id",s);if(a)throw a;d.success("Mind Map eliminado"),c==null||c()}catch(a){d.error("Error al eliminar: "+a.message)}},q=async(a,i)=>{if(!t){d.error("Necesitas una marca activa para exportar");return}S(a);try{const{error:o}=await p.functions.invoke("extract-mindmap-context",{body:{mindmap_id:s,target_tool:a,project_id:t}});if(o)throw o;h({title:`Contexto exportado a ${i}`,description:"PÃdele a Maasy en el chat que cree el siguiente paso."})}catch(o){h({title:"Error al exportar contexto",description:o.message??"No se pudo exportar",variant:"destructive"})}finally{S(null)}};return _&&!n?e.jsx("div",{className:"flex h-[60vh] items-center justify-center text-white/40",children:e.jsx(j,{className:"h-6 w-6 animate-spin"})}):n?e.jsxs("div",{className:"px-5 pb-8 pt-4",children:[e.jsxs("div",{className:"mb-4 flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx(O,{value:l.name,onChange:a=>g({...l,name:a.target.value}),className:"h-7 border-0 bg-transparent px-0 text-[13px] font-medium text-white/85 focus-visible:ring-0",placeholder:"Nombre del mind map"}),e.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-1.5",children:[e.jsxs(D,{variant:"outline",className:"h-5 px-1.5 text-[10px]",children:[f.length," nodos"]}),e.jsx(D,{variant:"outline",className:"h-5 px-1.5 text-[10px] capitalize",children:l.layout??"free"})]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsxs(A,{size:"sm",onClick:k,disabled:v,className:"h-7 px-2 text-[11px]",children:[v?e.jsx(j,{className:"mr-1 h-3.5 w-3.5 animate-spin"}):e.jsx(z,{className:"mr-1 h-3.5 w-3.5"}),"Guardar"]}),e.jsxs(F,{children:[e.jsx(R,{asChild:!0,children:e.jsxs(A,{variant:"ghost",size:"sm",className:"h-7 px-2 text-[11px] text-destructive hover:text-destructive/80",children:[e.jsx(G,{className:"mr-1 h-3.5 w-3.5"}),"Eliminar"]})}
1),e.jsxs(P,{children:[e.jsxs(H,{children:[e.jsx($,{children:"¿Eliminar mind map?"}),e.jsxs(K,{children:['Se eliminará "',l.name,'" y todos sus nodos. Esta acción no se puede deshacer.']})]}),e.jsxs(Q,{children:[e.jsx(V,{children:"Cancelar"}),e.jsx(X,{onClick:I,children:"Eliminar"})]})]})]})]})]}),e.jsxs(U,{value:C,onValueChange:a=>M(a),children:[e.jsxs(W,{className:"mb-4",children:[e.jsxs(x,{value:"map",className:"gap-1.5",children:[e.jsx(Y,{className:"h-3.5 w-3.5"}),"Mapa"]}),e.jsxs(x,{value:"export",className:"gap-1.5",children:[e.jsx(se,{className:"h-3.5 w-3.5"}),"Exportar"]}),e.jsxs(x,{value:"brand",className:"gap-1.5",children:[e.jsx(Z,{className:"h-3.5 w-3.5"}),"Brand DNA"]}),e.jsxs(x,{value:"boards",className:"gap-1.5",children:[e.jsx(ee,{className:"h-3.5 w-3.5"}),"Boards"]})]}),e.jsx(u,{value:"map",className:"mt-0",children:e.jsx("div",{className:"h-[70vh] overflow-hidden rounded-lg border border-border/40",children:e.jsx(te,{ref:T,nodes:f,onNodesChange:E,config:l,onConfigChange:g})})}),e.jsxs(u,{value:"export",className:"mt-0 space-y-2",children:[e.jsx("p",{className:"mb-3 text-[11px] text-white/45",children:"El mapa mental se analiza con IA y se convierte en contexto estructurado para la herramienta seleccionada. El resultado aparecerá como una card en el canvas."}),[{tool:"funnel_builder",icon:"ð",label:"Funnel Builder",desc:"Estructura de funnel desde el mapa"},{tool:"ads_studio",icon:"ð¯",label:"Ads Studio",desc:"Ãngulos, audiencias y propuestas de valor"},{tool:"social_content",icon:"ð±",label:"Social Content",desc:"Pilares de contenido y temas"}].map(a=>e.jsxs("button",{disabled:w!==null||!t,onClick:()=>q(a.tool,a.label),className:"flex w-full items-center gap-3 rounded-lg border border-border/40 p-3 text-left transition-colors hover:border-primary/30 hover:bg-accent/5 disabled:cursor-not-allowed disabled:opacity-50",children:[e.jsx("span",{className:"text-xl",children:a.icon}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm font-medium",children:a.label}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:a.desc})]}),w===a.tool?e.jsx(j,{className:"h-4 w-4 animate-spin text-muted-foreground"}):e.jsx(ae,{className:"h-4 w-4 text-muted-foreground/50"})]},a.tool)),!t&&e.jsx("p",{className:"mt-2 text-[10px] text-destructive/70",children:"Selecciona una marca activa para poder exportar contexto."})]}),e.jsx(u,{value:"brand",className:"mt-0",children:t?e.jsx(re,{projectId:t}):e.jsx("p",{className:"text-[11px] text-white/45",children:"Sin marca activa."})}),e.jsx(u,{value:"boards",className:"mt-0",children:t?e.jsx(ie,{projectId:t}):e.jsx("p",{className:"text-[11px] text-white/45",children:"Sin marca activa."})})]})]}):e.jsxs("div",{className:"flex h-[60vh] flex-col items-center justify-center gap-2 px-6 text-center text-white/45",children:[e.jsx("p",{className:"text-[13px]",children:"No se encontró el mind map."}),e.jsx("p",{className:"text-[11px] text-white/30",children:s.slice(0,8)})]})}export{Pe as default}; 2//# sourceMappingURL=MindmapSheet-DT2vtoCZ.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.