@eventcatalogtest/studio
Version:
A drag and drop UI for distributed systems that keeps your diagrams where they belong – in your repo
26 lines (20 loc) • 105 kB
JavaScript
exports.id=7563,exports.ids=[7563],exports.modules={2518:(a,b,c)=>{"use strict";c.d(b,{A:()=>A});var d=c(16112),e=c(26961),f=c(8622),g=c(27160),h=c(79444),i=c(46157),j=c(68750),k=c(60864),l=c(70293),m=c(53509),n=c(3292),o=c(69281),p=c(75687);let q=JSON.parse('{"rE":"0.1.12","h_":"A drag and drop UI for distributed systems that keeps your diagrams where they belong – in your repo","Jk":{"O":"https://github.com/event-catalog/studio.git"}}'),r=({isOpen:a,onClose:b})=>(0,d.jsx)(g.bL,{open:a,onOpenChange:b,children:(0,d.jsxs)(g.ZL,{children:[(0,d.jsx)(g.hJ,{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-50"}),(0,d.jsxs)(g.UC,{className:"fixed left-1/2 top-1/2 w-full max-w-md -translate-x-1/2 -translate-y-1/2 transform rounded-xl bg-white shadow-2xl z-50 border border-gray-200 overflow-hidden",children:[(0,d.jsx)("div",{className:"bg-gradient-to-r from-blue-600 to-purple-600 px-6 py-4 text-white",children:(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"flex items-center space-x-3",children:[(0,d.jsx)("div",{className:"w-10 h-10 bg-white/20 rounded-lg flex items-center justify-center backdrop-blur-sm",children:(0,d.jsx)(h.A,{className:"w-5 h-5 text-white"})}),(0,d.jsxs)("div",{children:[(0,d.jsx)(g.hE,{className:"text-lg font-semibold",children:"EventCatalog Studio"}),(0,d.jsxs)("p",{className:"text-sm text-blue-100",children:["Version ",q.rE]})]})]}),(0,d.jsx)(g.bm,{asChild:!0,children:(0,d.jsx)("button",{className:"rounded-full p-1 hover:bg-white/20 transition-colors",onClick:b,children:(0,d.jsx)(o.A,{className:"h-4 w-4 text-white"})})})]})}),(0,d.jsxs)("div",{className:"p-6 space-y-5",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between p-3 bg-gray-50 rounded-lg",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-medium text-gray-900",children:"Community Edition"}),(0,d.jsx)("p",{className:"text-xs text-gray-500",children:"Free for personal use"})]}),(0,d.jsxs)("a",{href:"https://eventcatalog.dev/pricing",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center space-x-1 text-xs bg-gradient-to-r from-blue-600 to-purple-600 text-white px-3 py-1.5 rounded-full hover:shadow-lg transition-all transform hover:scale-105",children:[(0,d.jsx)("span",{children:"Upgrade"}),(0,d.jsx)(p.A,{className:"w-3 h-3"})]})]}),(0,d.jsx)("div",{children:(0,d.jsx)("p",{className:"text-sm text-gray-600 leading-relaxed",children:q.h_})})]}),(0,d.jsx)("div",{className:"px-6 py-4 bg-gray-50 border-t border-gray-200",children:(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsxs)("p",{className:"text-xs text-gray-500",children:["\xa9 ",new Date().getFullYear()," EventCatalog"]}),(0,d.jsxs)("div",{className:"flex space-x-3",children:[(0,d.jsxs)("a",{href:q.Jk.O,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center space-x-1 text-xs text-gray-500 hover:text-blue-600 transition-colors",children:[(0,d.jsx)("span",{children:"GitHub"}),(0,d.jsx)(p.A,{className:"w-3 h-3"})]}),(0,d.jsx)("button",{onClick:b,className:"text-xs bg-gray-900 text-white px-3 py-1.5 rounded-md hover:bg-gray-800 transition-colors",children:"Close"})]})]})})]})]})});var s=c(80941),t=c(34308),u=c(84298);let v=({isOpen:a,onClose:b,prompt:c,title:f="Architecture Prompt"})=>{let[h,i]=(0,e.useState)(!1),j=async()=>{try{await navigator.clipboard.writeText(c),i(!0),setTimeout(()=>i(!1),2e3)}catch(b){console.error("Failed to copy to clipboard:",b);let a=document.createElement("textarea");a.value=c,document.body.appendChild(a),a.select(),document.execCommand("copy"),document.body.removeChild(a),i(!0),setTimeout(()=>i(!1),2e3)}};return(0,d.jsx)(g.bL,{open:a,onOpenChange:b,children:(0,d.jsxs)(g.ZL,{children:[(0,d.jsx)(g.hJ,{className:"fixed inset-0 bg-black/50 z-50"}),(0,d.jsxs)(g.UC,{className:"fixed left-1/2 top-1/2 w-[90vw] max-w-4xl h-[80vh] -translate-x-1/2 -translate-y-1/2 transform rounded-lg bg-white shadow-xl z-50 flex flex-col",children:[(0,d.jsx)("div",{className:"p-6 border-b border-gray-200",children:(0,d.jsxs)("div",{className:"flex items-start justify-between mb-3",children:[(0,d.jsxs)("div",{className:"flex-1 pr-4",children:[(0,d.jsx)(g.hE,{className:"text-xl font-semibold text-gray-900 mb-2",children:f}),(0,d.jsx)("p",{className:"text-sm text-gray-600 leading-relaxed",children:"Copy this prompt and paste it into any LLM (ChatGPT, Claude, etc.) to get architecture analysis, code generation, and implementation guidance."})]}),(0,d.jsxs)("div",{className:"flex items-center space-x-2 flex-shrink-0",children:[(0,d.jsx)("button",{onClick:j,className:`flex items-center px-4 py-2 text-sm font-medium rounded-md transition-colors ${h?"bg-green-100 text-green-700 hover:bg-green-200":"bg-blue-100 text-blue-700 hover:bg-blue-200"}`,children:h?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(s.A,{className:"h-4 w-4 mr-2"}),"Copied!"]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(t.A,{className:"h-4 w-4 mr-2"}),"Copy Prompt"]})}),(0,d.jsx)(g.bm,{asChild:!0,children:(0,d.jsx)("button",{className:"p-2 rounded-md hover:bg-gray-100 transition-colors","aria-label":"Close",children:(0,d.jsx)(o.A,{className:"h-5 w-5 text-gray-500"})})})]})]})}),(0,d.jsx)("div",{className:"flex-1 p-4",children:(0,d.jsx)("div",{className:"h-full border border-gray-200 rounded-md overflow-hidden",children:(0,d.jsx)(u.Ay,{height:"100%",defaultLanguage:"markdown",value:c,options:{readOnly:!0,minimap:{enabled:!1},scrollBeyondLastLine:!1,wordWrap:"on",lineNumbers:"on",folding:!1,glyphMargin:!1,lineDecorationsWidth:8,lineNumbersMinChars:3,renderLineHighlight:"none",padding:{top:16,bottom:16},scrollbar:{vertical:"auto",horizontal:"auto",useShadows:!1,verticalHasArrows:!1,horizontalHasArrows:!1,verticalScrollbarSize:10,horizontalScrollbarSize:10},fontSize:14,fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Monaco, Menlo, Consolas, "Liberation Mono", "Courier New", monospace',theme:"vs-dark"},loading:(0,d.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,d.jsx)("div",{className:"text-sm text-gray-500",children:"Loading editor..."})})})})}),(0,d.jsxs)("div",{className:"flex items-center justify-between p-4 border-t border-gray-200 bg-gray-50",children:[(0,d.jsx)("div",{className:"text-sm text-gray-600",children:"This prompt contains your architecture diagram and component details"}),(0,d.jsx)("button",{onClick:b,className:"px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 transition-colors",children:"Close"})]})]})]})})};var w=c(86742),x=c(28348);let y=({isOpen:a,onClose:b,onSave:c})=>{let[f,h]=(0,e.useState)(""),[i,j]=(0,e.useState)(""),[k,l]=(0,e.useState)(""),[m,n]=(0,e.useState)([]),[p,q]=(0,e.useState)({}),r=()=>{let a=k.trim();a&&!m.includes(a)&&(n([...m,a]),l(""))},s=()=>{h(""),j(""),l(""),n([]),q({}),b()};return(0,d.jsx)(g.bL,{open:a,onOpenChange:s,children:(0,d.jsxs)(g.ZL,{children:[(0,d.jsx)(g.hJ,{className:"fixed inset-0 bg-black/50 z-50"}),(0,d.jsxs)(g.UC,{className:"fixed left-1/2 top-1/2 w-full max-w-lg -translate-x-1/2 -translate-y-1/2 transform rounded-lg bg-white shadow-xl z-50",children:[(0,d.jsx)("div",{className:"p-6 border-b border-gray-200",children:(0,d.jsxs)("div",{className:"flex items-start justify-between",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)(g.hE,{className:"text-xl font-semibold text-gray-900 mb-2",children:"Save as Template"}),(0,d.jsx)("p",{className:"text-sm text-gray-600",children:"Create a reusable template from your current design"})]}),(0,d.jsx)(g.bm,{asChild:!0,children:(0,d.jsx)("button",{className:"p-2 rounded-md hover:bg-gray-100 transition-colors","aria-label":"Close",children:(0,d.jsx)(o.A,{className:"h-5 w-5 text-gray-500"})})})]})}),(0,d.jsxs)("div",{className:"p-6 space-y-4",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"title",className:"block text-sm font-medium text-gray-700 mb-1",children:"Title *"}),(0,d.jsx)("input",{id:"title",type:"text",value:f,onChange:a=>h(a.target.value),placeholder:"e.g., E-commerce Order Flow",className:`w-full px-3 py-2 border rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent ${p.title?"border-red-300":"border-gray-300"}`}),p.title&&(0,d.jsxs)("div",{className:"flex items-center mt-1 text-sm text-red-600",children:[(0,d.jsx)(w.A,{className:"h-4 w-4 mr-1"}),p.title]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"description",className:"block text-sm font-medium text-gray-700 mb-1",children:"Description *"}),(0,d.jsx)("textarea",{id:"description",value:i,onChange:a=>j(a.target.value),placeholder:"Describe what this template demonstrates and when to use it...",rows:3,className:`w-full px-3 py-2 border rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent resize-none ${p.description?"border-red-300":"border-gray-300"}`}),p.description&&(0,d.jsxs)("div",{className:"flex items-center mt-1 text-sm text-red-600",children:[(0,d.jsx)(w.A,{className:"h-4 w-4 mr-1"}),p.description]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"tags",className:"block text-sm font-medium text-gray-700 mb-1",children:"Tags"}),(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsxs)("div",{className:"flex",children:[(0,d.jsx)("input",{id:"tags",type:"text",value:k,onChange:a=>l(a.target.value),onKeyPress:a=>{"Enter"===a.key&&(a.preventDefault(),r())},placeholder:"Add a tag...",className:"flex-1 px-3 py-2 border border-gray-300 rounded-l-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent"}),(0,d.jsx)("button",{type:"button",onClick:r,disabled:!k.trim(),className:"px-4 py-2 bg-blue-600 text-white rounded-r-md hover:bg-blue-700 disabled:bg-gray-300 disabled:cursor-not-allowed transition-colors",children:"Add"})]}),m.length>0&&(0,d.jsx)("div",{className:"flex flex-wrap gap-2",children:m.map(a=>(0,d.jsxs)("span",{className:"inline-flex items-center px-2 py-1 bg-blue-100 text-blue-800 text-xs font-medium rounded-full",children:[a,(0,d.jsx)("button",{type:"button",onClick:()=>{n(m.filter(b=>b!==a))},className:"ml-1 hover:text-blue-600",children:"\xd7"})]},a))})]})]})]}),(0,d.jsxs)("div",{className:"flex items-center justify-end space-x-3 p-6 border-t border-gray-200 bg-gray-50",children:[(0,d.jsx)("button",{onClick:s,className:"px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 transition-colors",children:"Cancel"}),(0,d.jsxs)("button",{onClick:()=>{(()=>{let a={};return f.trim()||(a.title="Title is required"),i.trim()||(a.description="Description is required"),q(a),0===Object.keys(a).length})()&&(c({title:f.trim(),description:i.trim(),tags:m}),s())},className:"flex items-center px-4 py-2 text-sm font-medium text-white bg-blue-600 border border-transparent rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 transition-colors",children:[(0,d.jsx)(x.A,{className:"h-4 w-4 mr-2"}),"Save Template"]})]})]})]})})},z=a=>{if(!a?.nodes||0===a.nodes.length)return"flowchart TD\n A[No nodes available]";let{nodes:b,edges:c}=a,d="flowchart TD\n",e={};return b.forEach(a=>{let b=(a=>a.data?.message?.name||a.data?.service?.name||a.data?.query?.name||a.data?.command?.name||a.data?.data?.name||a.data?.name||`${a.type||"unknown"}_${a.id.slice(-4)}`)(a).replace(/[^a-zA-Z0-9]/g,"_");e[a.id]=b,d+=` ${((a,b)=>{switch(a){case"service":case"channel":case"view":case"actor":default:return`${b}[${b}]`;case"event":return`${b}((${b}))`;case"command":return`${b}>${b}]`;case"query":return`${b}{${b}}`;case"domain":return`${b}[/${b}/]`;case"external-system":return`${b}[[${b}]]`;case"data":return`${b}[(${b})]`}})(a.type||"unknown",b)}
`}),c.forEach(a=>{let b=e[a.source],c=e[a.target],f=a.data,g=f?.message?.collection||a.label||"";b&&c&&(g?d+=` ${b} -->|${g}| ${c}
`:d+=` ${b} --> ${c}
`)}),d+="\n %% Styling\n classDef service fill:#ff9999\n classDef event fill:#99ccff\n classDef command fill:#99ff99\n classDef query fill:#ffcc99\n classDef domain fill:#e6ccff\n classDef external fill:#ffff99\n classDef data fill:#ccffcc\n",b.forEach(a=>{let b=e[a.id];if(b)switch(a.type){case"service":d+=` class ${b} service
`;break;case"event":d+=` class ${b} event
`;break;case"command":d+=` class ${b} command
`;break;case"query":d+=` class ${b} query
`;break;case"domain":d+=` class ${b} domain
`;break;case"external-system":d+=` class ${b} external
`;break;case"data":d+=` class ${b} data
`}}),d},A=()=>{let[a,b]=(0,e.useState)(!1),[c,o]=(0,e.useState)(""),[p,q]=(0,e.useState)(!1),[s,t]=(0,e.useState)(!1),[u,w]=(0,e.useState)(!1),[x,A]=(0,e.useState)(!1),[B,C]=(0,e.useState)(""),D=(0,e.useRef)(null),{reset:E,exportFlow:F,importFlow:G,autoLayout:H,undo:I,redo:J,canUndo:K,canRedo:L,onNodesChange:M}=(0,k.useFlowStoreActions)(),{setShowTemplateSelector:N,hasTemplates:O}=(0,l.H)(),{currentDesign:P,updateDesignName:Q,createNewDesign:R,setCurrentDesign:S}=(0,m.useDesignStore)(),{showMinimap:T,toggleMinimap:U,showComments:V,toggleComments:W,toggleFeedbackPanel:X}=(0,n.P)(),{nodes:Y}=(0,k.default)(),Z=()=>{P&&c.trim()&&c!==P.name&&Q(P.id,c.trim()),b(!1)};return(0,e.useEffect)(()=>{a&&D.current&&(D.current.focus(),D.current.select())},[a]),(0,d.jsxs)("div",{className:"bg-white px-3 py-2 flex items-center justify-between w-full border-b border-gray-200",children:[(0,d.jsxs)("div",{className:"flex items-center",children:[(0,d.jsx)(h.A,{className:"h-5 w-5 text-gray-700 flex-shrink-0 mr-1"}),(0,d.jsxs)(f.bL,{children:[(0,d.jsx)(f.l9,{asChild:!0,children:(0,d.jsx)("button",{className:"p-1 rounded hover:bg-gray-100 transition-colors flex-shrink-0",children:(0,d.jsx)(i.A,{className:"h-5 w-5 text-gray-700"})})}),(0,d.jsx)(f.ZL,{children:(0,d.jsxs)(f.UC,{className:"bg-white rounded-lg shadow-lg border border-gray-200 p-1 w-48 z-50 ml-12",align:"end",sideOffset:5,children:[(0,d.jsxs)(f.q7,{onClick:()=>{if(O())N(!0);else{let a={id:Math.random().toString(36).substring(2,15),type:"design",name:"Untitled Design",description:"",data:{nodes:[],edges:[],viewport:{x:0,y:0,zoom:1}},createdAt:new Date,updatedAt:new Date,lastModified:"now"};R(a),S(a)}},className:"flex items-center justify-between px-3 py-2 text-sm rounded hover:bg-gray-100 cursor-default outline-none",children:[(0,d.jsx)("span",{children:"New Design"}),(0,d.jsx)("span",{className:"text-xs text-gray-500",children:"^ N"})]}),(0,d.jsxs)(f.q7,{onClick:()=>(()=>{let a=document.createElement("input");a.type="file",a.accept=".ecstudio",a.onchange=a=>{let b=a.target,c=b?.files?.[0];if(c){let a=new FileReader;a.onload=a=>{try{let b=JSON.parse(a.target?.result);G(b);let d=b.name||b.metadata?.name||c.name.replace(".ecstudio","");P?.id&&Q(P.id,d)}catch(a){console.error("Error parsing file:",a),alert("Error: Invalid file format. Please select a valid .ecstudio file.")}},a.readAsText(c)}},a.click()})(),className:"flex items-center justify-between px-3 py-2 text-sm rounded hover:bg-gray-100 cursor-default outline-none",children:[(0,d.jsx)("span",{children:"Open"}),(0,d.jsx)("span",{className:"text-xs text-gray-500",children:"⌘ O"})]}),(0,d.jsxs)(f.q7,{onClick:()=>(()=>{let a=F();if("showSaveFilePicker"in window)(async()=>{try{let b=await window.showSaveFilePicker({suggestedName:`${P?.name||"design"}.ecstudio`,types:[{description:"EventCatalog Studio files",accept:{"application/json":[".ecstudio"]}}]}),c=await b.createWritable();await c.write(JSON.stringify(a,null,2)),await c.close()}catch(a){a instanceof Error&&"AbortError"!==a.name&&console.error("Error saving file:",a)}})();else{let b=new Blob([JSON.stringify(a,null,2)],{type:"application/json"}),c=URL.createObjectURL(b),d=document.createElement("a");d.href=c,d.download=`${P?.name||"design"}.ecstudio`,d.click(),URL.revokeObjectURL(c)}})(),className:"flex items-center justify-between px-3 py-2 text-sm rounded hover:bg-gray-100 cursor-default outline-none",children:[(0,d.jsx)("span",{children:"Save"}),(0,d.jsx)("span",{className:"text-xs text-gray-500",children:"⌘ S"})]}),(0,d.jsx)(f.wv,{className:"h-px bg-gray-200 my-1"}),(0,d.jsxs)(f.Pb,{children:[(0,d.jsxs)(f.ZP,{className:"flex items-center justify-between px-3 py-2 text-sm rounded hover:bg-gray-100 cursor-default outline-none",children:[(0,d.jsx)("span",{children:"Export"}),(0,d.jsx)("span",{className:"text-xs text-gray-500",children:"›"})]}),(0,d.jsx)(f.ZL,{children:(0,d.jsxs)(f.G5,{className:"bg-white rounded-lg shadow-lg border border-gray-200 p-1 w-56 z-50",sideOffset:5,children:[(0,d.jsx)(f.q7,{onClick:()=>{try{let a=(()=>{let a=F(),b=P?.name||"Untitled Design";if(!a)throw Error("Unable to export flow data");return(({flowData:a,designName:b})=>{if(!a?.nodes||0===a.nodes.length)throw Error("No design data available. Please add some nodes to your canvas first.");let{nodes:c}=a,d=z(a),e="\n## Components\n\n";return c.forEach(a=>{let b=(a=>a.data?.message?.name||a.data?.service?.name||a.data?.query?.name||a.data?.command?.name||a.data?.data?.name||a.data?.name||`${a.type||"unknown"}_${a.id.slice(-4)}`)(a),c=a.data,d=c?.message?.summary||c?.service?.summary||c?.query?.summary||c?.command?.summary||c?.data?.summary||c?.summary||"",f=c?.message?.version||c?.service?.version||c?.query?.version||c?.command?.version||c?.version||"";e+=`### ${b} (${a.type||"unknown"})
`,f&&(e+=`**Version:** ${f}
`),d&&(e+=`**Description:** ${d}
`),e+="---\n\n"}),`# Architecture Design: ${b}
This is a design created using EventCatalog Studio.
## Architecture Diagram
\`\`\`mermaid
${d}
\`\`\`
${e}`})({flowData:a,designName:b})})();a&&(C(a),w(!0))}catch(a){console.error("Error generating prompt:",a),alert(a instanceof Error?a.message:"Error generating prompt. Please try again.")}},className:"flex items-center px-3 py-2 text-sm rounded hover:bg-gray-100 cursor-default outline-none whitespace-nowrap",children:(0,d.jsx)("span",{children:"as LLM prompt"})}),(0,d.jsx)(f.q7,{onClick:()=>A(!0),className:"flex items-center px-3 py-2 text-sm rounded hover:bg-gray-100 cursor-default outline-none whitespace-nowrap",children:(0,d.jsx)("span",{children:"as Template"})})]})})]}),(0,d.jsx)(f.wv,{className:"h-px bg-gray-200 my-1"}),(0,d.jsxs)(f.q7,{onClick:I,disabled:!K(),className:`flex items-center justify-between px-3 py-2 text-sm rounded outline-none cursor-default ${K()?"hover:bg-gray-100":"text-gray-400 cursor-not-allowed"}`,children:[(0,d.jsx)("span",{children:"Undo"}),(0,d.jsx)("span",{className:"text-xs text-gray-500",children:"⌘Z"})]}),(0,d.jsxs)(f.q7,{onClick:J,disabled:!L(),className:`flex items-center justify-between px-3 py-2 text-sm rounded outline-none cursor-default ${L()?"hover:bg-gray-100":"text-gray-400 cursor-not-allowed"}`,children:[(0,d.jsx)("span",{children:"Redo"}),(0,d.jsx)("span",{className:"text-xs text-gray-500",children:"⇧⌘Z"})]}),(0,d.jsxs)(f.q7,{onClick:()=>{M(Y.map(a=>({id:a.id,type:"select",selected:!0})))},className:"flex items-center justify-between px-3 py-2 text-sm rounded hover:bg-gray-100 cursor-default outline-none",children:[(0,d.jsx)("span",{children:"Select All"}),(0,d.jsx)("span",{className:"text-xs text-gray-500",children:"⌘A"})]}),(0,d.jsx)(f.wv,{className:"h-px bg-gray-200 my-1"}),(0,d.jsxs)(f.H_,{checked:T,onCheckedChange:U,className:"flex items-center justify-between px-3 py-2 text-sm rounded hover:bg-gray-100 cursor-default outline-none",children:[(0,d.jsx)("span",{children:"Show Minimap"}),T&&(0,d.jsx)("span",{className:"text-blue-600",children:"✓"})]}),(0,d.jsxs)(f.H_,{checked:V,onCheckedChange:W,className:"flex items-center justify-between px-3 py-2 text-sm rounded hover:bg-gray-100 cursor-default outline-none",children:[(0,d.jsx)("span",{children:"Show Comments"}),V&&(0,d.jsx)("span",{className:"text-blue-600",children:"✓"})]}),(0,d.jsx)(f.q7,{onClick:H,className:"flex items-center px-3 py-2 text-sm rounded hover:bg-gray-100 cursor-default outline-none",children:"Auto Layout"}),(0,d.jsx)(f.wv,{className:"h-px bg-gray-200 my-1"}),(0,d.jsx)(f.q7,{onClick:()=>t(!0),className:"flex items-center px-3 py-2 text-sm rounded hover:bg-gray-100 cursor-default outline-none",children:"About Studio"}),(0,d.jsx)(f.wv,{className:"h-px bg-gray-200 my-1"}),(0,d.jsx)(f.q7,{onClick:()=>{q(!0)},className:"px-3 py-2 text-sm rounded hover:bg-gray-100 cursor-default outline-none text-red-600",children:"Reset Canvas"})]})})]})]}),(0,d.jsx)("div",{className:"flex-1 flex justify-center",children:a?(0,d.jsx)("input",{ref:D,type:"text",value:c,onChange:a=>o(a.target.value),onBlur:Z,onKeyDown:a=>{"Enter"===a.key?Z():"Escape"===a.key&&(o(""),b(!1))},className:"font-medium text-gray-800 bg-transparent border-0 text-center focus:outline-none focus:ring-0 text-sm max-w-xs"}):(0,d.jsx)("button",{onClick:()=>{o(P?.name||""),b(!0)},className:"font-medium text-gray-800 hover:text-gray-600 transition-colors text-sm",title:"Click to edit design name",children:P?.name||"Untitled Design"})}),(0,d.jsx)("div",{className:"flex items-center gap-2",children:(0,d.jsx)("button",{className:"px-3 py-1 text-sm border border-gray-300 rounded hover:bg-gray-100 text-gray-700",children:"Sign In"})}),(0,d.jsx)(r,{isOpen:s,onClose:()=>t(!1)}),(0,d.jsx)(v,{isOpen:u,onClose:()=>w(!1),prompt:B,title:`Architecture Prompt: ${P?.name||"Untitled Design"}`}),(0,d.jsx)(y,{isOpen:x,onClose:()=>A(!1),onSave:a=>{let b=F();if(!b)return void alert("Unable to export flow data. Please try again.");let c=z(b),d=new Blob([JSON.stringify({title:a.title,description:a.description,type:"custom",data:b,usecase:a.description,mermaid:c,tags:a.tags},null,2)],{type:"application/json"}),e=URL.createObjectURL(d),f=document.createElement("a");f.href=e,f.download=`${a.title.toLowerCase().replace(/[^a-z0-9]/g,"-")}.ectemplate`,f.click(),URL.revokeObjectURL(e)}}),(0,d.jsx)(g.bL,{open:p,onOpenChange:q,children:(0,d.jsxs)(g.ZL,{children:[(0,d.jsx)(g.hJ,{className:"fixed inset-0 bg-black/30 z-50"}),(0,d.jsx)(g.UC,{className:"fixed left-1/2 top-1/2 w-full max-w-md -translate-x-1/2 -translate-y-1/2 transform rounded-lg bg-white p-6 shadow-xl z-50",children:(0,d.jsxs)("div",{className:"flex items-start space-x-3",children:[(0,d.jsx)("div",{className:"flex-shrink-0",children:(0,d.jsx)(j.A,{className:"h-6 w-6 text-red-500"})}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)(g.hE,{className:"text-lg font-semibold text-gray-900 mb-2",children:"Reset Canvas"}),(0,d.jsx)(g.VY,{className:"text-sm text-gray-600 mb-4",children:"This will remove all nodes and connections from the canvas. This action cannot be undone."}),(0,d.jsxs)("div",{className:"flex justify-end space-x-3",children:[(0,d.jsx)("button",{onClick:()=>{q(!1)},className:"px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 transition-colors",children:"Cancel"}),(0,d.jsx)("button",{onClick:()=>{E(),q(!1)},className:"px-4 py-2 text-sm font-medium text-white bg-red-600 border border-transparent rounded-md hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-2 transition-colors",children:"Reset Canvas"})]})]})]})})]})})]})}},3292:(a,b,c)=>{"use strict";c.d(b,{P:()=>f});var d=c(18087),e=c(24810);let f=(0,d.v)()((0,e.Zr)(a=>({isOpen:!0,activeTab:"components",showMinimap:!0,showComments:!0,showFeedbackPanel:!1,dontWarnOnDelete:!1,floatingPanels:{components:!1,canvas:!1,catalog:!1},selectedComponent:null,toggleSidebar:()=>a(a=>({isOpen:!a.isOpen})),setSidebarOpen:b=>a({isOpen:b}),setActiveTab:b=>a({activeTab:b}),toggleMinimap:()=>a(a=>({showMinimap:!a.showMinimap})),setMinimapOpen:b=>a({showMinimap:b}),toggleComments:()=>a(a=>({showComments:!a.showComments})),setCommentsVisible:b=>a({showComments:b}),toggleFeedbackPanel:()=>a(a=>({showFeedbackPanel:!a.showFeedbackPanel})),setFeedbackPanelOpen:b=>a({showFeedbackPanel:b}),setDontWarnOnDelete:b=>a({dontWarnOnDelete:b}),toggleFloatingPanel:b=>a(a=>a.floatingPanels[b]?{floatingPanels:{...a.floatingPanels,[b]:!1}}:{floatingPanels:{components:!1,canvas:!1,catalog:!1,[b]:!0}}),setFloatingPanelOpen:(b,c)=>a(a=>c?{floatingPanels:{components:!1,canvas:!1,catalog:!1,[b]:!0}}:{floatingPanels:{...a.floatingPanels,[b]:!1}}),setSelectedComponent:b=>a({selectedComponent:b})}),{name:"sidebar-storage",storage:(0,e.KU)(()=>localStorage)}))},6701:(a,b,c)=>{"use strict";c.d(b,{C:()=>f});var d=c(18087),e=c(24810);let f=(0,d.v)()((0,e.Zr)(a=>({isOpen:!1,activeTab:"config",eventCatalogPath:"",toggleModal:()=>a(a=>({isOpen:!a.isOpen})),setModalOpen:b=>a({isOpen:b}),setActiveTab:b=>a({activeTab:b}),setEventCatalogPath:b=>a({eventCatalogPath:b})}),{name:"settings-storage",storage:(0,e.KU)(()=>localStorage)}))},22404:(a,b,c)=>{"use strict";c.d(b,{ResourceProvider:()=>i});var d=c(16112);c(26961);var e=c(58728),f=c(60864),g=c(53509),h=c(6701);function i({resources:a,children:b,studioFilesFromEventCatalogDirectory:c,defaultDesign:i,eventCatalogPath:j,templates:k}){(0,e.h)(a=>a.setResources),(0,e.h)(a=>a.setStudioFilesFromEventCatalogDirectory),(0,e.h)(a=>a.setTemplates);let{importFlow:l}=(0,f.useFlowStoreActions)(),{updateDesignName:m}=(0,g.useDesignStore)(),{setEventCatalogPath:n}=(0,h.C)();return(0,d.jsx)(d.Fragment,{children:b})}},24687:(a,b,c)=>{"use strict";c.d(b,{Xq:()=>v,o0:()=>t,q:()=>x,s:()=>u,zM:()=>w});var d=c(23465),e=c.n(d),f=c(79748),g=c.n(f),h=c(87042),i=c.n(h),j=c(94857),k=c(33873),l=c.n(k);let m=j.Ik({content:j.Yj(),backgroundColor:j.Yj(),textColor:j.Yj(),icon:j.Yj().optional()}),n=j.KC([j.Yj(),j.Ik({id:j.Yj(),collection:j.k5(["users","teams"])})]).transform(a=>({id:"string"==typeof a?a:a.id})),o=j.Ik({id:j.Yj(),version:j.Yj().optional().default("latest"),type:j.k5(["service","event","command","query","flow","channel","domain","user","team"])}),p=j.Ik({id:j.Yj(),version:j.Yj().optional().default("latest")}),q=j.Ik({id:j.Yj(),name:j.Yj(),summary:j.Yj().optional(),version:j.Yj(),draft:j.KC([j.zM(),j.Ik({title:j.Yj().optional(),message:j.Yj()})]).optional(),badges:j.YO(m).optional(),owners:j.YO(n).optional(),schemaPath:j.Yj().optional(),sidebar:j.Ik({label:j.Yj().optional(),badge:j.Yj().optional()}).optional(),repository:j.Ik({language:j.Yj().optional(),url:j.Yj().optional()}).optional(),specifications:j.KC([j.Ik({openapiPath:j.Yj().optional(),asyncapiPath:j.Yj().optional()}),j.YO(j.Ik({type:j.k5(["openapi","asyncapi"]),path:j.Yj(),name:j.Yj().optional()}))]).optional(),hidden:j.zM().optional(),editUrl:j.Yj().optional(),resourceGroups:j.YO(j.Ik({id:j.Yj().optional(),title:j.Yj().optional(),items:j.YO(o),limit:j.ai().optional().default(10),sidebar:j.zM().optional().default(!0)})).optional(),styles:j.Ik({icon:j.Yj().optional(),node:j.Ik({color:j.Yj().optional(),label:j.Yj().optional()}).optional()}).optional(),deprecated:j.KC([j.Ik({message:j.Yj().optional(),date:j.KC([j.Yj(),j.p6()]).optional()}),j.zM().optional()]).optional(),visualiser:j.zM().optional(),versions:j.YO(j.Yj()).optional(),latestVersion:j.Yj().optional(),catalog:j.Ik({path:j.Yj(),filePath:j.Yj(),astroContentFilePath:j.Yj(),publicPath:j.Yj(),type:j.Yj()}).optional()});q.extend({services:j.YO(p).optional(),domains:j.YO(p).optional(),entities:j.YO(p).optional()});let r=q.extend({}),s=q.extend({sends:j.YO(p).optional(),receives:j.YO(p).optional(),entities:j.YO(p).optional()});async function t(){let a=await w(),b=await e()(["**/events/*/index.(md|mdx)","**/events/*/versioned/*/index.(md|mdx)"],{cwd:a,absolute:!0}).then(a=>a.map(a=>({path:a,collection:"events",schema:r,editor:{type:"event"}}))),c=await e()(["**/commands/*/index.(md|mdx)","**/commands/*/versioned/*/index.(md|mdx)"],{cwd:a,absolute:!0}).then(a=>a.map(a=>({path:a,collection:"commands",schema:r,editor:{type:"command"}}))),d=[...b,...c,...await e()(["**/queries/*/index.(md|mdx)","**/queries/*/versioned/*/index.(md|mdx)"],{cwd:a,absolute:!0}).then(a=>a.map(a=>({path:a,collection:"queries",schema:r,editor:{type:"query"}}))),...await e()(["domains/*/services/*/index.(md|mdx)","domains/*/services/*/versioned/*/index.(md|mdx)","domains/*/subdomains/*/services/*/index.(md|mdx)","domains/*/subdomains/*/services/*/versioned/*/index.(md|mdx)","services/*/index.(md|mdx)","services/*/versioned/*/index.(md|mdx)"],{cwd:a,absolute:!0}).then(a=>a.map(a=>({path:a,collection:"services",schema:s,editor:{type:"service"}})))];return await Promise.all(d.map(async({path:a,collection:b,schema:c,editor:d})=>{let e=await g().readFile(a,"utf-8"),{data:f,content:h}=i()(e),j=c.safeParse(f);if(!j.success)throw Error(`Invalid frontmatter in ${a}`);return{id:j.data.id,data:{...j.data},editor:d,collection:b,filePath:a}}))}async function u(){let a=await w(),b=await e()(["**/*/*.ecstudio"],{cwd:a,absolute:!0});return(await Promise.all(b.map(async a=>{try{let b=await g().readFile(a,"utf-8"),c=JSON.parse(b);return{id:c.id,creationDate:c.creationDate}}catch(b){return console.error(`Error parsing ${a}:`,b),null}}))).filter(Boolean)}async function v(a){let b=await w(),c=await e()(["**/*/*.ecstudio"],{cwd:b,absolute:!0}),d=(await Promise.all(c.map(async a=>{try{let b=await g().readFile(a,"utf-8");return JSON.parse(b)}catch(b){return console.error(`Error parsing ${a}:`,b),null}}))).find(b=>b.id===a);return d||null}async function w(){return process.env.EVENTCATALOG_DIR||l().join(process.cwd(),"eventcatalog")}async function x(){let a=process.env.TEMPLATE_DIR||process.cwd();try{let b=await e()(["**/*/*.ectemplate"],{cwd:a,absolute:!0});return(await Promise.all(b.map(async a=>{try{let b=await g().readFile(a,"utf-8"),c=JSON.parse(b);return{id:l().basename(a,".ectemplate"),...c,filePath:a}}catch(b){return console.error(`Error parsing template ${a}:`,b),null}}))).filter(Boolean)}catch(a){return console.error("Error loading templates:",a),[]}}},29430:(a,b,c)=>{Promise.resolve().then(c.bind(c,22404))},32764:(a,b,c)=>{"use strict";c.d(b,{A:()=>r});var d=c(16112),e=c(26961),f=c(10587),g=c(4261),h=c(21837),i=c(24375),j=c(36874),k=c(34308),l=c(51532),m=c(37748),n=c(60864),o=c(15363),p=c(8254);let q=a=>{if(a.data?.label&&"string"==typeof a.data.label)return a.data.label;let b=a.type||"default";if(a.data&&"object"==typeof a.data&&a.data[b]&&"object"==typeof a.data[b]&&a.data[b].name&&"string"==typeof a.data[b].name)return a.data[b].name;for(let b of["service","message","channel","event","command","query","domain"])if(a.data&&"object"==typeof a.data&&a.data[b]&&"object"==typeof a.data[b]&&a.data[b].name&&"string"==typeof a.data[b].name)return a.data[b].name;return a.data?.name&&"string"==typeof a.data.name?a.data.name:`${b} ${a.id.slice(-4)}`},r=()=>{let{nodes:a,reactFlowInstance:b}=(0,n.default)(),{deleteNode:c,duplicateNode:r}=(0,n.useFlowStoreActions)(),{nodes:s}=(0,o.m)(),{setSelectedNode:t}=(0,p.U)(),[u,v]=(0,e.useState)(""),[w,x]=(0,e.useState)(null),y=(0,e.useCallback)(c=>{b&&a.find(a=>a.id===c)&&(b.fitView({nodes:[{id:c}],duration:800,padding:.3}),b.setNodes(a=>a.map(a=>({...a,selected:a.id===c}))))},[a,b]),z=(0,e.useCallback)((a,b)=>{b.stopPropagation(),c(a)},[c]),A=(0,e.useCallback)((a,b)=>{b.stopPropagation(),r(a)},[r]),B=(0,e.useCallback)(a=>{x(a)},[]),C=(0,e.useCallback)(()=>{x(null)},[]),D=(0,e.useCallback)((b,c)=>{c.stopPropagation();let d=a.find(a=>a.id===b);d&&t(d)},[a,t]),E=(0,e.useMemo)(()=>{if(!a||!Array.isArray(a)||!s)return[];let b=s.reduce((a,b)=>(a[b.type]={icon:b.configuration?.icon||g.A,color:b.configuration?.color||"gray"},a),{});return Object.entries(a.reduce((a,c)=>{let d=c.type||"default",e=b[d]||{icon:g.A,color:"gray"},f={...c,iconComponent:e.icon,iconColor:e.color};return a[d]||(a[d]=[]),a[d].push(f),a},{})).map(([a,b])=>({type:a.charAt(0).toUpperCase()+a.slice(1),items:b}))},[a,s]),F=(0,e.useMemo)(()=>E&&Array.isArray(E)&&0!==E.length?""===u.trim()?E:E.map(a=>{if(a.type.toLowerCase().includes(u.toLowerCase()))return a;let b=a.items.filter(a=>q(a).toLowerCase().includes(u.toLowerCase())||(a.type||"").toLowerCase().includes(u.toLowerCase()));return b.length>0?{...a,items:b}:null}).filter(a=>null!==a):[],[u,E]);return(0,d.jsxs)("div",{className:"bg-white text-gray-800 w-full h-full flex flex-col",children:[(0,d.jsx)("div",{className:"px-3 py-2 border-b border-gray-200",children:(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsx)(h.A,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400",size:14}),(0,d.jsx)("input",{type:"text",placeholder:"Search nodes",className:"pl-8 pr-3 py-1.5 w-full border border-gray-300 rounded text-xs bg-gray-50 focus:outline-none focus:ring-1 focus:ring-blue-500 focus:border-blue-500",onChange:a=>v(a.target.value),value:u})]})}),(0,d.jsx)("div",{className:"flex-grow overflow-y-auto px-3 pb-3 space-y-1",children:0===E.length?(0,d.jsx)("p",{className:"p-4 text-center text-gray-500",children:"No nodes on canvas."}):0===F.length&&""!==u.trim()?(0,d.jsx)("p",{className:"p-4 text-center text-gray-500",children:"No results found."}):(0,d.jsx)(f.bL,{type:"multiple",defaultValue:F.map(a=>a.type),children:F.map(a=>(0,d.jsxs)(f.q7,{value:a.type,className:"border-0",children:[(0,d.jsx)(f.Y9,{children:(0,d.jsxs)(f.l9,{className:"flex items-center w-full py-4 pb-2 text-left group text-xs font-medium text-gray-900 focus:outline-none",children:[(0,d.jsx)("span",{className:"flex-1",children:a.type}),(0,d.jsx)(i.A,{className:"h-4 w-4 text-gray-500 transition-transform duration-200 group-data-[state=open]:rotate-180","aria-hidden":!0})]})}),(0,d.jsx)(f.UC,{className:"overflow-hidden text-sm transition-all data-[state=open]:animate-accordion-down data-[state=closed]:animate-accordion-up",children:(0,d.jsx)("div",{className:"pt-1 pb-2 space-y-1.5",children:a.items.map(a=>{let b=a.iconComponent||g.A,c={red:"text-red-600",blue:"text-blue-600",green:"text-green-600",yellow:"text-yellow-600",purple:"text-purple-600",pink:"text-pink-600",indigo:"text-indigo-600",orange:"text-orange-600",teal:"text-teal-600",cyan:"text-cyan-600",gray:"text-gray-600",grey:"text-gray-600"}[a.iconColor||"gray"]||"text-gray-600",e=w===a.id;return(0,d.jsxs)("div",{className:"group/item flex items-center justify-between px-2.5 py-2 rounded-md cursor-pointer relative border transition-all bg-gray-50 border-gray-200 hover:bg-gray-100",onClick:()=>y(a.id),onMouseEnter:()=>B(a.id),onMouseLeave:C,children:[(0,d.jsxs)("div",{className:"flex items-center space-x-2 flex-grow min-w-0",children:[(0,d.jsx)(b,{size:16,className:`${c} flex-shrink-0`}),(0,d.jsx)("span",{className:"text-xs font-medium text-gray-700 truncate",children:q(a)})]}),(0,d.jsxs)("div",{className:"flex items-center space-x-1",children:[(0,d.jsx)("button",{onClick:b=>D(a.id,b),className:`p-1 hover:bg-gray-200 rounded text-gray-500 hover:text-blue-500 transition-all ${e?"opacity-100":"opacity-0"}`,title:"Edit node",children:(0,d.jsx)(j.A,{size:12})}),(0,d.jsx)("button",{onClick:b=>A(a.id,b),className:`p-1 hover:bg-gray-200 rounded text-gray-500 hover:text-blue-500 transition-all ${e?"opacity-100":"opacity-0"}`,title:"Duplicate node",children:(0,d.jsx)(k.A,{size:12})}),(0,d.jsx)("button",{onClick:b=>z(a.id,b),className:`p-1 hover:bg-gray-200 rounded text-gray-500 hover:text-blue-500 transition-all ${e?"opacity-100":"opacity-0"}`,title:"Delete node",children:(0,d.jsx)(l.A,{size:12})}),(0,d.jsx)(m.A,{size:14,className:"text-gray-400 hover:text-gray-600 flex-shrink-0"})]})]},a.id)})})})]},a.type))})})]})}},40888:(a,b,c)=>{"use strict";c.d(b,{A:()=>S});var d=c(16112),e=c(26961),f=c.n(e),g=c(4410);c(84896);var h=c(41337),i=c(15363),j=c(60864),k=c(8254),l=c(53509),m=c(3292),n=c(70293),o=c(60858),p=c(39485),q=c(34128);let r=({id:a,source:b,target:c,sourceX:f,sourceY:h,targetX:i,targetY:k,sourcePosition:l,targetPosition:m,data:n,label:o="",markerEnd:p})=>{let[r,s,t]=(0,q.Fp)({sourceX:f,sourceY:h,sourcePosition:l,targetX:i,targetY:k,targetPosition:m}),{deleteEdge:u,updateEdge:v}=(0,j.useFlowStoreActions)(),[w,x]=(0,e.useState)(!1),[y,z]=(0,e.useState)(o||""),A=(0,e.useRef)(null);(0,e.useEffect)(()=>{w&&A.current&&(A.current.focus(),A.current.select())},[w]);let B=b=>{b.stopPropagation(),u(a)},C=a=>{a.stopPropagation(),x(!0),z(o||"")},D=()=>{x(!1),y!==o&&v({id:a,source:b,target:c,sourceHandle:null,targetHandle:null,type:"animatedMessage",animated:!0,label:y,data:n,markerEnd:p})},E=n?.opacity??1,F=(0,e.useMemo)(()=>a=>{switch(a){case"event":return"orange";case"command":return"blue";case"query":return"green";default:return"gray"}},[]),G=(0,e.useMemo)(()=>+Math.random(),[]);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(g.tE,{id:a,path:r,markerEnd:p}),(0,d.jsx)("g",{className:`z-30 ${1===E?"opacity-100":"opacity-10"}`,children:(0,d.jsx)("circle",{cx:"0",cy:"0",r:"7",fill:F(n?.source),children:(0,d.jsx)("animateMotion",{dur:"2s",repeatCount:"indefinite",path:r,rotate:"auto",begin:`${G}s`,children:(0,d.jsx)("mpath",{href:`#${a}`})})})}),(0,d.jsxs)("g",{children:[(0,d.jsx)("rect",{x:s-3*(y||o||"").length,y:t-15,width:Math.max(6*(y||o||"").length,40),height:20,fill:"white",opacity:.8,rx:"4",style:{cursor:w?"text":"pointer"},onDoubleClick:C}),w?(0,d.jsx)("foreignObject",{x:s-3*(y||o||"").length,y:t-15,width:Math.max(6*(y||o||"").length,40),height:20,children:(0,d.jsx)("input",{ref:A,type:"text",value:y,onChange:a=>{z(a.target.value)},onKeyDown:a=>{"Enter"===a.key?D():"Escape"===a.key&&(x(!1),z(o||""))},onBlur:()=>{D()},style:{width:"100%",height:"100%",border:"none",outline:"none",background:"transparent",textAlign:"center",fontSize:"10px",fontFamily:"inherit"}})}):(0,d.jsx)("text",{x:s,y:t,fill:"black",fontSize:"10",textAnchor:"middle",dy:"-2",style:{cursor:"pointer",userSelect:"none"},onDoubleClick:C,children:o||"Double-click to edit"})]}),(0,d.jsxs)("g",{children:[(0,d.jsx)("circle",{cx:s+3*o.length+15,cy:t-5,r:"8",fill:"red",opacity:.9,style:{cursor:"pointer"},onClick:B}),(0,d.jsx)("text",{x:s+3*o.length+15,y:t-5,fill:"white",fontSize:"10",textAnchor:"middle",dy:"3",style:{cursor:"pointer",userSelect:"none"},onClick:B,children:"\xd7"})]})]})};var s=c(58834),t=c(47817),u=c(88340),v=c(19917),w=c(99744),x=c(79444),y=c(33347),z=c(77883),A=c(16320),B=c(10467),C=c(10445),D=c(31291);let E=({className:a="",size:b=16})=>(0,d.jsxs)("svg",{width:b,height:b,viewBox:"0 0 16 16",fill:"none",className:a,children:[(0,d.jsxs)("defs",{children:[(0,d.jsxs)("linearGradient",{id:"stickyGradient",x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[(0,d.jsx)("stop",{offset:"0%",stopColor:"#FEF3C7"}),(0,d.jsx)("stop",{offset:"100%",stopColor:"#FDE047"})]}),(0,d.jsx)("filter",{id:"shadow",x:"-20%",y:"-20%",width:"140%",height:"140%",children:(0,d.jsx)("feDropShadow",{dx:"0",dy:"1",stdDeviation:"0.5",floodColor:"#D97706",floodOpacity:"0.3"})})]}),(0,d.jsx)("rect",{x:"2",y:"2",width:"12",height:"12",rx:"1",fill:"url(#stickyGradient)",stroke:"#F59E0B",strokeWidth:"0.5",filter:"url(#shadow)"}),(0,d.jsx)("path",{d:"M11.5 2.5L14 2L14 4.5L11.5 2.5Z",fill:"#F59E0B",opacity:"0.4"}),(0,d.jsx)("line",{x1:"4",y1:"5",x2:"10",y2:"5",stroke:"#D97706",strokeWidth:"0.4",opacity:"0.6"}),(0,d.jsx)("line",{x1:"4",y1:"7",x2:"11",y2:"7",stroke:"#D97706",strokeWidth:"0.4",opacity:"0.6"}),(0,d.jsx)("line",{x1:"4",y1:"9",x2:"9",y2:"9",stroke:"#D97706",strokeWidth:"0.4",opacity:"0.6"}),(0,d.jsx)("line",{x1:"4",y1:"11",x2:"8",y2:"11",stroke:"#D97706",strokeWidth:"0.4",opacity:"0.6"})]}),F=({className:a=""})=>{let b=(0,g.VH)(),{undo:c,redo:h,canUndo:i,canRedo:k,addNode:l}=(0,j.useFlowStoreActions)(),{showComments:n,toggleComments:p,floatingPanels:q,toggleFloatingPanel:r}=(0,m.P)(),{nodes:F}=(0,j.default)(),[G,H]=(0,e.useState)(100),[I,J]=(0,e.useState)("select"),K=f().useMemo(()=>F.filter(a=>"commentThread"===a.type).length,[F]);f().useEffect(()=>{let a=()=>{let a=b?.getViewport();a&&H(Math.round(100*a.zoom))};a();let c=setInterval(a,100);return()=>clearInterval(c)},[b]);let L=a=>{J(a)};return(0,d.jsx)(o.Kq,{children:(0,d.jsx)("div",{className:a,children:(0,d.jsx)("div",{className:"absolute bottom-4 left-1/2 transform -translate-x-1/2 z-10",children:(0,d.jsxs)("div",{className:"bg-white rounded-full px-4 py-2 shadow-lg border border-gray-200 flex items-center space-x-1",children:[(0,d.jsxs)(o.bL,{children:[(0,d.jsx)(o.l9,{asChild:!0,children:(0,d.jsx)("button",{onClick:()=>L("select"),className:`p-2 rounded-full transition-colors ${"select"===I?"bg-blue-100 text-blue-600":"hover:bg-gray-100 text-gray-600"}`,children:(0,d.jsx)(t.A,{className:"h-4 w-4"})})}),(0,d.jsx)(o.ZL,{children:(0,d.jsxs)(o.UC,{className:"bg-gray-900 text-white px-2 py-1 rounded text-sm z-50",sideOffset:5,children:["Select Tool",(0,d.jsx)(o.i3,{className:"fill-gray-900"})]})})]}),(0,d.jsxs)(o.bL,{children:[(0,d.jsx)(o.l9,{asChild:!0,children:(0,d.jsx)("button",{onClick:()=>L("pan"),className:`p-2 rounded-full transition-colors ${"pan"===I?"bg-blue-100 text-blue-600":"hover:bg-gray-100 text-gray-600"}`,children:(0,d.jsx)(u.A,{className:"h-4 w-4"})})}),(0,d.jsx)(o.ZL,{children:(0,d.jsxs)(o.UC,{className:"bg-gray-900 text-white px-2 py-1 rounded text-sm z-50",sideOffset:5,children:["Pan Tool",(0,d.jsx)(o.i3,{className:"fill-gray-900"})]})})]}),(0,d.jsx)("div",{className:"w-px h-6 bg-gray-300 mx-1"}),(0,d.jsxs)(o.bL,{children:[(0,d.jsx)(o.l9,{asChild:!0,children:(0,d.jsx)("button",{onClick:()=>r("components"),className:`p-2 rounded-full transition-colors ${q.components?"bg-blue-100 text-blue-600":"hover:bg-gray-100 text-gray-600"}`,children:(0,d.jsx)(v.A,{className:"h-4 w-4"})})}),(0,d.jsx)(o.ZL,{children:(0,d.jsxs)(o.UC,{className:"bg-gray-900 text-white px-2 py-1 rounded text-sm z-50",sideOffset:5,children:["Components",(0,d.jsx)(o.i3,{className:"fill-gray-900"})]})})]}),(0,d.jsxs)(o.bL,{children:[(0,d.jsx)(o.l9,{asChild:!0,children:(0,d.jsx)("button",{onClick:()=>r("canvas"),className:`p-2 rounded-full transition-colors ${q.canvas?"bg-blue-100 text-blue-600":"hover:bg-gray-100 text-gray-600"}`,children:(0,d.jsx)(w.A,{className:"h-4 w-4"})})}),(0,d.jsx)(o.ZL,{children:(0,d.jsxs)(o.UC,{className:"bg-gray-900 text-white px-2 py-1 rounded text-sm z-50",sideOffset:5,children:["Canvas",(0,d.jsx)(o.i3,{className:"fill-gray-900"})]})})]}),(0,d.jsxs)(o.bL,{children:[(0,d.jsx)(o.l9,{asChild:!0,children:(0,d.jsx)("button",{onClick:()=>r("catalog"),className:`p-2 rounded-full transition-colors ${q.catalog?"bg-blue-100 text-blue-600":"hover:bg-gray-100 text-gray-600"}`,children:(0,d.jsx)(x.A,{className:"h-4 w-4"})})}),(0,d.jsx)(o.ZL,{children:(0,d.jsxs)(o.UC,{className:"bg-gray-900 text-white px-2 py-1 rounded text-sm z-50",sideOffset:5,children:["EventCatalog Resources",(0,d.jsx)(o.i3,{className:"fill-gray-900"})]})})]}),(0,d.jsx)("div",{className:"w-px h-6 bg-gray-300 mx-1"}),(0,d.jsxs)(o.bL,{children:[(0,d.jsx)(o.l9,{asChild:!0,children:(0,d.jsx)("button",{onClick:()=>b?.fitView({duration:500}),className:"p-2 hover:bg-gray-100 rounded-full transition-colors",children:(0,d.jsx)(y.A,{className:"h-4 w-4 text-gray-600"})})}),(0,d.jsx)(o.ZL,{children:(0,d.jsxs)(o.UC,{className:"bg-gray-900 text-white px-2 py-1 rounded text-sm z-50",sideOffset:5,children:["Fit View",(0,d.jsx)(o.i3,{className:"fill-gray-900"})]})})]}),(0,d.jsxs)(o.bL,{children:[(0,d.jsx)(o.l9,{asChild:!0,children:(0,d.jsx)("button",{onClick:()=>b?.zoomOut({duration:200}),className:"p-2 hover:bg-gray-100 rounded-full transition-colors",children:(0,d.jsx)(z.A,{className:"h-4 w-4 text-gray-600"})})}),(0,d.jsx)(o.ZL,{children:(0,d.jsxs)(o.UC,{className:"bg-gray-900 text-white px-2 py-1 rounded text-sm z-50",sideOffset:5,children:["Zoom Out",(0,d.jsx)(o.i3,{className:"fill-gray-900"})]})})]}),(0,d.jsxs)(o.bL,{children:[(0,d.jsx)(o.l9,{asChild:!0,children:(0,d.jsxs)("div",{className:"px-2 text-sm text-gray-600 font-medium cursor-default",children:[G,"%"]})}),(0,d.jsx)(o.ZL,{children:(0,d.jsxs)(o.UC,{className:"bg-gray-900 text-white px-2 py-1 rounded text-sm z-50",sideOffset:5,children:["Current Zoom Level",(0,d.jsx)(o.i3,{className:"fill-gray-900"})]})})]}),(0,d.jsxs)(o.bL,{children:[(0,d.jsx)(o.l9,{asChild:!0,children:(0,d.jsx)("button",{onClick:()=>b?.zoomIn({duration:200}),className:"p-2 hover:bg-gray-100 rounded-full transition-colors",children:(0,d.jsx)(A.A,{className:"h-4 w-4 text-gray-600"})})}),(0,d.jsx)(o.ZL,{children:(0,d.jsxs)(o.UC,{className:"bg-gray-900 text-white px-2 py-1 rounded text-sm z-50",sideOffset:5,children:["Zoom In",(0,d.jsx)(o.i3,{className:"fill-gray-900"})]})})]}),(0,d.jsx)("div",{className:"w-px h-6 bg-gray-300 mx-1"}),(0,d.jsxs)(o.bL,{children:[(0,d.jsx)(o.l9,{asChild:!0,children:(0,d.jsx)("button",{onClick:c,disabled:!i(),className:`p-2 rounded-full transition-colors ${i()?"hover:bg-gray-100 text-gray-600":"opacity-50 cursor-not-allowed text-gray-400"}`,children:(0,d.jsx)(B.A,{className:"h-4 w-4"})})}),(0,d.jsx)(o.ZL,{children:(0,d.jsxs)(o.UC,{className:"bg-gray-900 text-white px-2 py-1 rounded text-sm z-50",sideOffset:5,children:["Undo",(0,d.jsx)(o.i3,{className:"fill-gray-900"})]})})]}),(0,d.jsxs)(o.bL,{children:[(0,d.jsx)(o.l9,{asChild:!0,children:(0,d.jsx)("button",{onClick:h,disabled:!k(),className:`p-2 rounded-full transition-colors ${k()?"hover:bg-gray-100 text-gray-600":"opacity-50 cursor-not-allowed text-gray-400"}`,children:(0,d.jsx)(C.A,{className:"h-4 w-4"})})}),(0,d.jsx)(o.ZL,{children:(0,d.jsxs)(o.UC,{className:"bg-gray-900 text-white px-2 py-1 rounded text-sm z-50",sideOffset:5,children:["Redo",(0,d.jsx)(o.i3,{className:"fill-gray-900"})]})})]}),(0,d.jsx)("div",{className:"w-px h-6 bg-gray-300 mx-1"}),(0,d.jsxs)(o.bL,{children:[(0,d.jsx)(o.l9,{asChild:!0,children:(0,d.jsxs)("button",{onClick:p,className:`p-2 rounded-full transition-colors relative ${n?"bg-orange-100 text-orange-600 hover:bg-orange-200":"hover:bg-gray-100 text-gray-400"}`,children:[(0,d.jsx)(D.A,{className:"h-4 w-4"}),K>0&&(0,d.jsx)("span",{className:"absolute -top-1 -right-1 bg-orange-500 text-white text-xs font-bold px-1.5 py-0.5 rounded-full min-w-[18px] h-[18px] flex items-center justify-center",children:K})]})}),(0,d.jsx)(o.ZL,{children:(0,d.jsxs)(o.UC,{className:"bg-gray-900 text-white px-2 py-1 rounded text-sm z-50",sideOffset:5,children:[n?"Hide Comments":"Show Comments",(0,d.jsx)(o.i3,{className:"fill-gray-900"})]})})]}),(0,d.jsxs)(o.bL,{children:[(0,d.jsx)(o.l9,{asChild:!0,children:(0,d.jsx)("button",{onClick:()=>{let a=b?.getViewport(),c={x:(window.innerWidth/2-(a?.x||0))/(a?.zoom||1)-100,y:(window.innerHeight/2-(a?.y||0))/(a?.zoom||1)-100};l({id:(0,s.Y)("note"),type:"note",position:c,data:{text:"Double-click to edit...",color:"yellow"}})},className:"p-2 hover:bg-yellow-100 rounded-full transition-colors",children:(0,d.jsx)(E,{size:16})})}),(0,d.jsx)(o.ZL,{children:(0,d.jsxs)(o.UC,{className:"bg-gray-900 text-white px-2 py-1 rounded text-sm z-50",sideOffset:5,children:["Add Sticky Note",(0,d.jsx)(o.i3,{className:"fill-gray-900"})]})})]})]})})})})};var G=c(27160),H=c(69281),I=c(18572);c(46832),c(35776),c(21759),c(51968),c(35524);var J=c(51376);let K=({chart:a,className:b=""})=>{let c=(0,e.useRef)(null);return(0,e.useEffect)(()=>{J.A.initialize({startOnLoad:!0,theme:"base",themeVariables:{primaryColor:"#3b82f6",primaryTextColor:"#1f2937",primaryBorderColor:"#6b7280",lineColor:"#6b7280",secondaryColor:"#e5e7eb",tertiaryColor:"#f9fafb",background:"#ffffff",mainBkg:"#ffffff",secondBkg:"#f9fafb",tertiaryBkg:"#f3f4f6",nodeBkg:"#f8fafc",clusterBkg:"#f1f5f9",edgeLabelBackground:"#ffffff"},flowchart:{nodeSpacing:20,rankSpacing:20,curve:"basis",padding:10},fontFamily:"ui-sans-serif, system-ui, sans-serif",fontSize:"12px"})},[]),(0,e.useEffect)(()=>{if(c.current&&a){c.current.innerHTML="";let b=`mermaid-${Math.random().toString(36).substr(2,9)}`;try{J.A.render(b,a).then(({svg:a})=>{if(c.current){let b=a.replace(/width="[^"]*"/,"").replace(/height="[^"]*"/,"");c.current.innerHTML=b;let d=c.current.querySelector("svg");d&&(d.setAttribute("width","100%"),d.setAttribute("height","100%"),d.style.maxWidth="100%",d.style.maxHeight="100%")}}).catch(a=>{console.error("Mermaid rendering error:",a),c.current&&(c.current.innerHTML='<div class="flex items-center justify-center h-full text-gray-400 text-xs">Preview unavailable</div>')})}catch(a){console.error("Mermaid parsing error:",a),c.current&&(c.current.innerHTML='<div class="flex items-center justify-center h-full text-gray-400 text-xs">Preview unavailable</div>')}}},[a]),(0,d.jsx)("div",{ref:c,className:`mermaid-container ${b}`})},L=()=>{let{getTemplates:a,showTemplateSelector:b,setShowTemplateSelector:c}=(0,n.H)(),f=a(),{designs:g,setCurrentDesign:h,createNewDesign:i}=(0,l.useDesignStore)(),[j,k]=(0,e.useState)([]),m=(0,e.useMemo)(()=>{let a=new Set;return f.forEach(b=>{b.tags?.forEach(b=>a.add(b))}),Array.from(a).sort()},[f]),o=(0,e.useMemo)(()=>0===j.length?f:f.filter(a=>j.some(b=>a.tags?.includes(b))),[f,j]);return b?(0,d.jsx)(G.bL,{open:b,onOpenChange:c,children:(0,d.jsxs)(G.ZL,{children:[(0,d.jsx)(G.hJ,{className:"fixed inset-0 bg-black/30 z-10"}),(0,d.jsxs)(G.UC,{className:"fixed left-1/2 top-1/2 w-full h-full max-h-[80vh] z-20 max-w-6xl -translate-x-1/2 -translate-y-1/2 transform rounded-lg bg-white text-gray-900 shadow-2xl",children:[(0,d.jsxs)("div",{className:"h-full overflow-y-auto p-8",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-8",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)(G.hE,{className:"text-2xl font-semibold text-gray-900",children:"Choose a template"}),(0,d.jsx)(G.VY,{className:"mt-1 text-sm text-gray-600",children:"Start with architecture pattern templates or create from scratch."})]}),(0,d.jsx)("button",{onClick:()=>{c(!1);let a={id:Math.random().toString(36).substring(2,15),name:`New Design ${g.length+1}`,description:"New design",type:"blank",data:{nodes:[],edges:[],viewport:{x:0,y:0,zoom:1}},createdAt:new Date,updatedAt:new Date,lastModified:"now"};i(a),h(a)},className:"inline-flex items-center rounded-md border border-transparent bg-green-600 px-4 py-2 text-sm font-medium text-white shadow-sm hover:bg-green-700 focus:outline-none focus:ring-2 focus:ring-green-500 focus:ring-offset-2",children:"+ Blank Design"})]}),(0,d.jsxs)("div",{cla