@memoarchitect/architect 0.7.2 → 0.8.27
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/README.md +1 -1
- package/dist/assets/{AiWorkspace-Bu9TlIWg.js → AiWorkspace-Dp5oBDww.js} +1 -1
- package/dist/assets/{AnalysisWorkspace-CodmoI-v.js → AnalysisWorkspace-CNHTkSRD.js} +1 -1
- package/dist/assets/{ComplianceWizard-CTihkUi-.js → ComplianceWizard-CAJDtLdv.js} +1 -1
- package/dist/assets/DSMView-Bv9j1Vk_.js +5 -0
- package/dist/assets/Dashboard-BnOwnA1R.js +1 -0
- package/dist/assets/DhfDashboard-CQpiYHtW.js +1 -0
- package/dist/assets/DhfWorkbench-DHxWuiiL.js +69 -0
- package/dist/assets/DiagramCanvas-DtLlTvJf.js +4 -0
- package/dist/assets/{DiagramEditor-UJDHcAUF.js → DiagramEditor-DP_PiI7K.js} +2 -2
- package/dist/assets/DiagramToolbarControls-XMGLx08e.js +1 -0
- package/dist/assets/{ElementDetailView-10U0rr33.js → ElementDetailView-BQsWfbPD.js} +1 -1
- package/dist/assets/ExplorerTreeRow-CmGPHRI8.js +3 -0
- package/dist/assets/{ImportView-D8svP04Q.js → ImportView-YFBlvgF_.js} +1 -1
- package/dist/assets/{LayerGrid-DEe0Ryz-.js → LayerGrid-KXyuibWY.js} +1 -1
- package/dist/assets/{LayerTable-CN_b2rDr.js → LayerTable-CGsFJsKs.js} +1 -1
- package/dist/assets/{MaxGraphCanvas-bo8oPBct.js → MaxGraphCanvas-BNn0Jxr6.js} +1 -1
- package/dist/assets/{ModelDiff-xe95oVua.js → ModelDiff-CJCXuz_h.js} +1 -1
- package/dist/assets/{OntologyDecompositionDiagram-BL9R8bdB.js → OntologyDecompositionDiagram-5JWUI_PB.js} +1 -1
- package/dist/assets/{OntologyViewer-CtqNkkCn.js → OntologyViewer-DxIWCcJM.js} +2 -2
- package/dist/assets/{RelationshipOverlay-DL0N8Vmk.js → RelationshipOverlay-B3AN-bM-.js} +1 -1
- package/dist/assets/{RelationshipsSection-BoJ0aUXe.js → RelationshipsSection-DggeGBKP.js} +1 -1
- package/dist/assets/{ReviewDashboard-DeTge2oC.js → ReviewDashboard-Qyj8RRFp.js} +1 -1
- package/dist/assets/{ScenarioEditor-FAEYTHgP.js → ScenarioEditor-BIAh6tLX.js} +1 -1
- package/dist/assets/{StatisticsDashboard-BAZRqIPN.js → StatisticsDashboard-CtI1hlfO.js} +1 -1
- package/dist/assets/{SysmlCodeEditor-BBfup_Ni.js → SysmlCodeEditor-i0BHj3of.js} +117 -117
- package/dist/assets/{TabularView-I4LjHhoH.js → TabularView-DXxpRshk.js} +1 -1
- package/dist/assets/TraceabilityMatrix-qEKmDy8z.js +3 -0
- package/dist/assets/UiScreensWorkspace-BHhs5tcY.js +1 -0
- package/dist/assets/{WorkflowWizard-VwpEHt3R.js → WorkflowWizard-BjtGPRsS.js} +1 -1
- package/dist/assets/index-Cdkjp-H4.css +1 -0
- package/dist/assets/index-a2rpMs5Y.js +4067 -0
- package/dist/assets/{index.es-ClbJxlAQ.js → index.es-BwDQ0kmQ.js} +1 -1
- package/dist/assets/{jspdf.es.min-DZ68BGxk.js → jspdf.es.min-KfOikWO5.js} +3 -3
- package/dist/assets/{layout-providers-Dr743WlP.js → layout-providers-BSDYNZu0.js} +1 -1
- package/dist/assets/notation-scene-CxT28i2i.js +1 -0
- package/dist/assets/{reactflow-s7jmJtXx.js → reactflow-C9OlmOYw.js} +1 -1
- package/dist/assets/xlsx-CkFp8p6R.js +105 -0
- package/dist/index.html +3 -3
- package/dist-standalone/index.html +5504 -0
- package/lib/__tests__/standalone-distribution.test.d.ts +2 -0
- package/lib/__tests__/standalone-distribution.test.d.ts.map +1 -0
- package/lib/__tests__/standalone-distribution.test.js +51 -0
- package/lib/__tests__/standalone-distribution.test.js.map +1 -0
- package/lib/__tests__/supervised-child-args.test.js +21 -1
- package/lib/__tests__/supervised-child-args.test.js.map +1 -1
- package/lib/bin/memo-architect.js +15 -6
- package/lib/bin/memo-architect.js.map +1 -1
- package/lib/commands/build.d.ts.map +1 -1
- package/lib/commands/build.js +15 -18
- package/lib/commands/build.js.map +1 -1
- package/lib/commands/dev.d.ts +14 -0
- package/lib/commands/dev.d.ts.map +1 -1
- package/lib/commands/dev.js +40 -1
- package/lib/commands/dev.js.map +1 -1
- package/lib/feature-grants.d.ts.map +1 -1
- package/lib/feature-grants.js +3 -1
- package/lib/feature-grants.js.map +1 -1
- package/package.json +10 -6
- package/dist/assets/DSMView-BiC845df.js +0 -1
- package/dist/assets/Dashboard-CgnNLhKq.js +0 -1
- package/dist/assets/DhfDashboard-w-dJoJHU.js +0 -1
- package/dist/assets/DhfWorkbench-o6B_MT-0.js +0 -69
- package/dist/assets/DiagramCanvas-CqGqDbgT.js +0 -3
- package/dist/assets/DiagramToolbarControls-B2gZFJlg.js +0 -1
- package/dist/assets/ExplorerTreeRow-DqhF_qoO.js +0 -3
- package/dist/assets/TraceabilityMatrix-DbrvjqLN.js +0 -3
- package/dist/assets/UiScreensWorkspace-DDD_PyJs.js +0 -1
- package/dist/assets/editor.worker-DyuDvpVp.js +0 -26
- package/dist/assets/element-options-B7AgTB8R.js +0 -3
- package/dist/assets/index-BWMNo4wW.css +0 -1
- package/dist/assets/index-Bij8Q4Kg.js +0 -45
- package/dist/assets/notation-scene-DT8LpWVK.js +0 -1
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/jspdf.es.min-KfOikWO5.js","assets/index-a2rpMs5Y.js","assets/reactflow-C9OlmOYw.js","assets/zustand-CrhqMOHB.js","assets/index-Cdkjp-H4.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
var da=Object.defineProperty;var ua=(e,t,s)=>t in e?da(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;var cn=(e,t,s)=>ua(e,typeof t!="symbol"?t+"":t,s);import{j as o,u as vr,H as te,P as K,b as pa,N as xt,c as Sn,B as kr,E as yn,R as ha,d as ma,e as fa,f as ga,g as xa,h as ba,i as ya,k as wa,C as va,l as ka,m as Fa,n as So,M as Ca}from"./reactflow-C9OlmOYw.js";import{b as Sa,a as u}from"./zustand-CrhqMOHB.js";/* empty css */import{F as X,S as rt,u as ne,i as Fr,h as wn,_ as ja,g as Ea,D as Ia,J as $e,m as Hs,K as Aa,N as Ra,O as Vs,C as Gs}from"./index-a2rpMs5Y.js";import{c as za,a as Ma,b as Ta,d as Da,e as Na,f as La,g as Ba,h as Pa,i as $a,j as Oa,k as Wa,I as gt,N as Cr,P as _a,l as Ha,m as Va,n as No,o as Ga,s as Ua,u as Xa,p as Ka,G as dn,q as Ya,r as qa,C as Lo,t as Za,v as Ja,w as un,A as Qa,x as el,y as tl,z as ol,B as nl,D as sl,E as Us,F as rl,H as il,J as al,K as ll,L as cl,M as dl,R as ul,O as pl,Q as hl,S as ml,T as fl,U as gl}from"./notation-scene-CxT28i2i.js";import{S as xl}from"./ExplorerTreeRow-CmGPHRI8.js";import{I as G,a as ke,c as Ge,b as Oe,S as Xs}from"./DiagramToolbarControls-XMGLx08e.js";import"./layout-providers-BSDYNZu0.js";import"./elk-6l8mIQnQ.js";function bl(e,t,s="both",r=10){const i=e.elements[t];if(!i)return{rootId:t,rootName:"(unknown)",rootKind:"",nodes:[],edges:[]};const c=new Map,a=new Map;for(const F of e.relationships)c.has(F.sourceId)||c.set(F.sourceId,[]),c.get(F.sourceId).push(F),a.has(F.targetId)||a.set(F.targetId,[]),a.get(F.targetId).push(F);const p=new Set;p.add(t);const b=[],m=[],j=[[t,0]];for(;j.length>0;){const[F,O]=j.shift();if(O>=r)continue;const T=O+1;if(s==="downstream"||s==="both")for(const N of c.get(F)||[]){const L=N.targetId;if(m.push({fromId:F,toId:L,relType:N.type,relId:N.id}),!p.has(L)){p.add(L);const f=e.elements[L];f&&(b.push({elementId:L,name:f.name,kind:f.kind,layer:f.layer,depth:T,viaRelType:N.type,direction:"downstream"}),j.push([L,T]))}}if(s==="upstream"||s==="both")for(const N of a.get(F)||[]){const L=N.sourceId;if(m.push({fromId:L,toId:F,relType:N.type,relId:N.id}),!p.has(L)){p.add(L);const f=e.elements[L];f&&(b.push({elementId:L,name:f.name,kind:f.kind,layer:f.layer,depth:T,viaRelType:N.type,direction:"upstream"}),j.push([L,T]))}}}return b.sort((F,O)=>F.depth-O.depth||F.name.localeCompare(O.name)),{rootId:t,rootName:i.name,rootKind:i.kind,nodes:b,edges:m}}function yl(e,t=[]){let r=e.replace(/[^A-Za-z0-9]+/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").trim().split(/\s+/).filter(Boolean).map((a,p)=>p===0?a.charAt(0).toLowerCase()+a.slice(1):a.charAt(0).toUpperCase()+a.slice(1)).join("");r||(r="element"),/^[0-9]/.test(r)&&(r=`n${r}`);const i=new Set(t);if(!i.has(r))return r;let c=2;for(;i.has(`${r}${c}`);)c++;return`${r}${c}`}function wl(e){return e&&e.replace(/\s+(def|usage)$/,"").trim()||"part"}const vl=[{value:"",label:"Default"},{value:"#FEF3C7",label:"Amber"},{value:"#DCFCE7",label:"Green"},{value:"#DBEAFE",label:"Blue"},{value:"#FCE7F3",label:"Pink"},{value:"#E5E7EB",label:"Grey"}],St={display:"flex",alignItems:"center",gap:2},jt={width:1,height:18,background:"#E2E8F0",margin:"0 4px",flexShrink:0};function Ee({title:e,label:t,onClick:s}){return o.jsx("button",{title:e,"aria-label":e,onClick:s,style:{minWidth:26,height:26,padding:"0 5px",borderRadius:5,border:"1px solid #E2E8F0",background:"#FFFFFF",color:"#374151",fontSize:13,lineHeight:1,cursor:"pointer",fontWeight:600},children:t})}function kl({count:e,onClose:t,onAlign:s,onMatchSize:r,onDistribute:i,onFill:c,onOpacity:a,onTextStyle:p,opacity:b}){return o.jsxs("div",{className:"nodrag nopan",style:{position:"absolute",top:10,left:"50%",transform:"translateX(-50%)",zIndex:25,display:"flex",alignItems:"center",gap:4,padding:"6px 8px",borderRadius:9,background:"#FFFFFF",border:"1px solid #E2E8F0",boxShadow:"0 6px 20px rgba(15,23,42,0.14)",flexWrap:"wrap",maxWidth:"calc(100% - 24px)"},children:[o.jsxs("span",{style:{fontSize:X.xs,color:"#6B7280",fontWeight:700,paddingRight:2},children:[e," selected"]}),o.jsx("button",{type:"button",title:"Close selection tools (Esc)","aria-label":"Close selection tools",onClick:t,style:{width:24,height:24,padding:0,borderRadius:5,border:"1px solid #E2E8F0",background:"#FFFFFF",color:"#475569",cursor:"pointer",fontSize:17,lineHeight:1},children:"×"}),o.jsx("span",{style:jt}),o.jsxs("div",{style:St,children:[o.jsx(Ee,{title:"Align left edges",label:"⇤",onClick:()=>s("left")}),o.jsx(Ee,{title:"Align horizontal centres",label:"⇹",onClick:()=>s("centerX")}),o.jsx(Ee,{title:"Align right edges",label:"⇥",onClick:()=>s("right")}),o.jsx(Ee,{title:"Align top edges",label:"⤒",onClick:()=>s("top")}),o.jsx(Ee,{title:"Align vertical centres",label:"⇳",onClick:()=>s("centerY")}),o.jsx(Ee,{title:"Align bottom edges",label:"⤓",onClick:()=>s("bottom")})]}),o.jsx("span",{style:jt}),o.jsxs("div",{style:St,children:[o.jsx(Ee,{title:"Match width to the widest",label:"↔",onClick:()=>r("width")}),o.jsx(Ee,{title:"Match height to the tallest",label:"↕",onClick:()=>r("height")}),o.jsx(Ee,{title:"Match width and height",label:"⤢",onClick:()=>r("both")})]}),o.jsx("span",{style:jt}),o.jsxs("div",{style:St,children:[o.jsx(Ee,{title:e>=3?"Even horizontal gaps":"Even horizontal gaps (needs 3 blocks)",label:"⇿",onClick:()=>i("horizontal")}),o.jsx(Ee,{title:e>=3?"Even vertical gaps":"Even vertical gaps (needs 3 blocks)",label:"⇕",onClick:()=>i("vertical")})]}),o.jsx("span",{style:jt}),o.jsx("div",{style:St,children:vl.map(m=>o.jsx("button",{title:`Fill: ${m.label}`,"aria-label":`Fill ${m.label}`,onClick:()=>c(m.value),style:{width:20,height:20,padding:0,borderRadius:4,cursor:"pointer",border:"1px solid #CBD5E1",background:m.value||"#FFFFFF",color:"#94A3B8",fontSize:11,lineHeight:1,fontWeight:700},children:m.value?"":"⌫"},m.label))}),o.jsx("span",{style:jt}),o.jsxs("div",{style:St,"aria-label":"Text styling",children:[o.jsx(Ee,{title:"Align text left",label:"≡",onClick:()=>p({textAlign:"left"})}),o.jsx(Ee,{title:"Align text centre",label:"≣",onClick:()=>p({textAlign:"center"})}),o.jsx(Ee,{title:"Align text right",label:"☷",onClick:()=>p({textAlign:"right"})}),o.jsx(Ee,{title:"Align text at top",label:"⤒",onClick:()=>p({verticalAlign:"top"})}),o.jsx(Ee,{title:"Align text vertically centred",label:"↕",onClick:()=>p({verticalAlign:"middle"})}),o.jsx(Ee,{title:"Align text at bottom",label:"⤓",onClick:()=>p({verticalAlign:"bottom"})}),o.jsxs("select",{"aria-label":"Text size",title:"Text size",defaultValue:"",onChange:m=>m.target.value&&p({fontSize:Number(m.target.value)}),style:{height:26,border:"1px solid #CBD5E1",borderRadius:4,color:"#475569",fontSize:11},children:[o.jsx("option",{value:"",children:"Auto size"}),[10,12,14,16,18,20].map(m=>o.jsxs("option",{value:m,children:[m,"px"]},m))]}),o.jsx(Ee,{title:"Bold text",label:"B",onClick:()=>p({fontWeight:700})}),o.jsx("label",{title:"Text colour",style:{display:"flex",alignItems:"center"},children:o.jsx("input",{"aria-label":"Text colour",type:"color",onChange:m=>p({textColor:m.target.value}),style:{width:24,height:24,padding:1}})}),o.jsx("label",{title:"Border colour",style:{display:"flex",alignItems:"center"},children:o.jsx("input",{"aria-label":"Border colour",type:"color",onChange:m=>p({borderColor:m.target.value}),style:{width:24,height:24,padding:1}})})]}),o.jsx("span",{style:jt}),o.jsxs("label",{title:"Fill opacity",style:{display:"flex",alignItems:"center",gap:5,fontSize:X.xs,color:"#6B7280"},children:[o.jsx("span",{style:{fontWeight:700},children:"Opacity"}),o.jsx("input",{type:"range",min:20,max:100,step:5,value:Math.round(b*100),onChange:m=>a(Number(m.target.value)/100),style:{width:72,accentColor:"#2DD4A8"}}),o.jsxs("span",{style:{width:30,textAlign:"right",fontVariantNumeric:"tabular-nums"},children:[Math.round(b*100),"%"]})]}),o.jsx("div",{style:St,"aria-label":"Opacity presets",children:[1,.75,.5].map(m=>o.jsx("button",{"aria-label":`Set opacity to ${Math.round(m*100)}%`,title:`Set opacity to ${Math.round(m*100)}%`,onClick:()=>a(m),style:{height:22,minWidth:30,padding:"0 4px",borderRadius:4,border:"1px solid #CBD5E1",background:"#FFFFFF",color:"#475569",cursor:"pointer",fontSize:10,fontWeight:700},children:Math.round(m*100)},m))})]})}function Fl(e,t){if(e.length===0)return;const s=r=>e.reduce((i,c)=>r(c,i)?c:i);switch(t){case"left":return s((r,i)=>r.x<i.x);case"right":return s((r,i)=>r.x+r.width>i.x+i.width);case"top":return s((r,i)=>r.y<i.y);case"bottom":return s((r,i)=>r.y+r.height>i.y+i.height);case"centerX":return s((r,i)=>r.width>i.width);case"centerY":return s((r,i)=>r.height>i.height)}}function Cl(e,t){const s=new Map,r=Fl(e,t);if(!r||e.length<2)return s;for(const i of e){let c;switch(t){case"left":c=r.x;break;case"right":c=r.x+r.width-i.width;break;case"centerX":c=r.x+r.width/2-i.width/2;break;case"top":c=r.y;break;case"bottom":c=r.y+r.height-i.height;break;case"centerY":c=r.y+r.height/2-i.height/2;break}const a=t==="left"||t==="right"||t==="centerX",p=a?i.x:i.y;Math.abs(p-c)<.5||s.set(i.id,a?{x:c}:{y:c})}return s}function Sl(e,t){const s=new Map;if(e.length<2)return s;const r=Math.max(...e.map(c=>c.width)),i=Math.max(...e.map(c=>c.height));for(const c of e){const a={};t!=="height"&&Math.abs(c.width-r)>=.5&&(a.width=r),t!=="width"&&Math.abs(c.height-i)>=.5&&(a.height=i),Object.keys(a).length>0&&s.set(c.id,a)}return s}function jl(e,t){const s=new Map;if(e.length<3)return s;const r=t==="horizontal",i=T=>r?T.x:T.y,c=T=>r?T.width:T.height,a=[...e].sort((T,N)=>i(T)-i(N)),p=a[0],b=a[a.length-1],m=i(b)+c(b)-i(p),j=a.reduce((T,N)=>T+c(N),0),F=(m-j)/(a.length-1);if(!Number.isFinite(F)||F<0)return s;let O=i(p)+c(p)+F;for(const T of a.slice(1,-1))Math.abs(i(T)-O)>=.5&&s.set(T.id,r?{x:O}:{y:O}),O+=c(T)+F;return s}const Yt=Sa(e=>({subject:null,publish:t=>e({subject:t})})),Kt=e=>Yt.getState().publish(e),Sr=e=>{var t,s;return[e.source,e.target,(t=e.data)==null?void 0:t.sourcePortId,(s=e.data)==null?void 0:s.targetPortId].filter(r=>!!r)},El=(e,t)=>e.edgeId===t.id||Sr(t).some(s=>e.endpointIds.includes(s)),jn=()=>Yt(e=>e.subject!==null),Il=e=>Yt(t=>{var s;return((s=t.subject)==null?void 0:s.endpointIds.includes(e))??!1}),jr=(e,t)=>Yt(s=>{const r=s.subject;return r?r.edgeId===e||t.some(i=>i!==void 0&&r.endpointIds.includes(i)):!1}),Al=e=>`.react-flow__edge[data-id="${CSS.escape(e)}"]`;function Rl(){const e=Yt(r=>r.subject),t=vr(r=>e?r.edges.filter(i=>El(e,i)).map(i=>i.id).join("\0"):"");if(!e)return null;const s=t?t.split("\0").map(Al).join(","):"";return o.jsxs("style",{children:[".react-flow__edge{opacity:0.22;transition:opacity 120ms ease}",s?`${s}{opacity:1}`:""]})}class zl{constructor(){cn(this,"providers",[]);cn(this,"byId",new Map)}register(t,s){const r=this.byId.get(t.descriptor.id);if(r&&r!==t)throw new Error(`Template provider already registered: ${t.descriptor.id}`);if(r)return;this.byId.set(t.descriptor.id,t);const i=s?this.providers.findIndex(c=>c.descriptor.id===s):-1;i>=0?this.providers.splice(i,0,t):this.providers.push(t)}unregister(t){const s=this.byId.get(t);return s?(this.byId.delete(t),this.providers.splice(this.providers.indexOf(s),1),!0):!1}get(t){return this.byId.get(t)}has(t){return this.byId.has(t)}list(){return this.providers.map(t=>t.descriptor)}select(t){const s=this.providers.find(r=>r.matches(t));if(!s)throw new Error("No diagram template matches this view — register a catch-all provider");return s}}const Er=new zl,Ml=[{descriptor:{id:"memo.template.fbs",name:"Functional Breakdown",label:"FBS",contractVersion:"1",interactive:!0,description:"Functional breakdown structure — functions per realising component."},matches:e=>e.isFBSDiagram,compute:(e,t)=>za(e,t.fbs)},{descriptor:{id:"memo.template.decomposition",name:"Decomposition Tree",label:"Decomposition",contractVersion:"1",interactive:!0,description:"Expandable decomposition tree over composition relationships."},matches:e=>e.isDecompDiagram&&e.layoutStyle==="decomposition",compute:(e,t)=>Ma(e,t.decomposition)},{descriptor:{id:"memo.template.containment",name:"Containment Blocks",label:"Containment",contractVersion:"1",interactive:!0,description:"Nested containment blocks over composition relationships."},matches:e=>e.isDecompDiagram,compute:(e,t)=>Ta(e,t.containment)},{descriptor:{id:"memo.template.usecase",name:"Use Case",label:"Use case",contractVersion:"1",interactive:!1,description:"Actors outside a system boundary, use cases inside (KK-7)."},matches:e=>e.diagramType==="ucd",compute:(e,t)=>Da(e,t.useCase)},{descriptor:{id:"memo.template.context",name:"System Context",label:"Context",contractVersion:"1",interactive:!1,description:"Black-box system of interest with external actors and peer systems."},matches:e=>e.diagramType==="context",compute:(e,t)=>Na(e,t.context.systemName,t.context)},{descriptor:{id:"memo.template.interconnection",name:"Interconnection",label:"Interconnection",contractVersion:"1",interactive:!1,description:"IBD — parts with boundary ports, typed connectors, nested containment (KK-3)."},matches:e=>e.viewKind==="interconnection",compute:(e,t)=>La(e,t.interconnection)},{descriptor:{id:"memo.template.actionflow",name:"Action Flow",label:"Action flow",contractVersion:"1",interactive:!1,description:"Actions with parameter ports, item flows, successions, optional swimlanes (KK-4)."},matches:e=>e.viewKind==="actionflow",compute:(e,t)=>Ba(e,t.actionflow)},{descriptor:{id:"memo.template.statetransition",name:"State Transition",label:"State transition",contractVersion:"1",interactive:!1,description:"Nested states with routed transition edges and trigger [guard] labels (KK-5)."},matches:e=>e.viewKind==="statetransition",compute:(e,t)=>Pa(e,t.statetransition)},{descriptor:{id:"memo.template.sequence",name:"Sequence",label:"Sequence",contractVersion:"1",interactive:!1,description:"Lifelines with chronological messages (KK-6)."},matches:e=>e.viewKind==="sequence",compute:(e,t)=>$a(e,t.sequence)},{descriptor:{id:"memo.template.general",name:"General (structured)",label:"General",contractVersion:"1",interactive:!0,description:"General template tree/containment modes (KK-2)."},matches:e=>e.isGeneralTemplate&&e.generalMode!=="graph",compute:(e,t)=>Oa(e,t.general)},{descriptor:{id:"memo.template.standard",name:"Standard Graph",label:"Standard",contractVersion:"1",interactive:!0,description:"Relationship graph with optional compartments — the catch-all."},matches:()=>!0,compute:(e,t)=>Wa(e,t.standard)}];for(const e of Ml)Er.register(e);const Ir="context-child-v1";function Tl(e){var t;return((t=e==null?void 0:e.canvas)==null?void 0:t.coordinateSpace)===Ir}function Dl(e){return{...e,canvas:{...e.canvas,coordinateSpace:Ir}}}function Nl(e,t){return{x:e.x-t.x,y:e.y-t.y}}function qt({color:e="#334155",size:t=38}){const s=Math.round(t*1.42);return o.jsxs("svg",{width:t,height:s,viewBox:"0 0 38 54","aria-hidden":"true",fill:"none",stroke:e,strokeWidth:"2",children:[o.jsx("circle",{cx:"19",cy:"8",r:"6",fill:"#FFFFFF"}),o.jsx("path",{d:"M19 14v18M6 23h26M19 32L8 49M19 32l11 17",strokeLinecap:"round"})]})}const En=e=>e==="Actor"||e==="User";function Ll({data:e}){const t=e,{element:s,layerColor:r,isExpanded:i,hasChildren:c,childCount:a,direction:p,onToggleExpand:b,onToggleDirection:m,showDirectionButton:j,depthBgColor:F,isContainer:O}=t,T=p==="vertical"?"V":"H",N=O&&i;return o.jsxs("div",{style:{background:N?F||"#FAFAF9":"#FFFFFF",borderLeft:N?`2px solid ${r}40`:`3px solid ${r}`,borderTop:`1px solid ${N?r+"30":"#E5E5E0"}`,borderRight:`1px solid ${N?r+"30":"#E5E5E0"}`,borderBottom:`1px solid ${N?r+"30":"#E5E5E0"}`,borderRadius:3,padding:N?"0":"8px 12px",minWidth:N?void 0:"200px",boxShadow:"none",width:"100%",height:"100%",boxSizing:"border-box"},children:[o.jsx(te,{type:"target",position:K.Top,id:"top",style:jo}),o.jsx(te,{type:"source",position:K.Bottom,id:"bottom",style:jo}),o.jsx(te,{type:"target",position:K.Left,id:"left",style:jo}),o.jsx(te,{type:"source",position:K.Right,id:"right",style:jo}),o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px",padding:N?"8px 12px":"0"},children:[En(s.kind)&&o.jsx(qt,{size:24,color:r}),c&&o.jsx("button",{onClick:L=>{L.stopPropagation(),b()},style:{width:"20px",height:"20px",borderRadius:2,border:`1px solid ${r}`,background:i?r+"12":"#FFFFFF",color:r,fontSize:X.md,fontWeight:700,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",lineHeight:1,padding:0,flexShrink:0,transition:"background 200ms ease, color 200ms ease"},title:i?"Collapse":"Expand",children:i?"−":"+"}),c&&j&&o.jsx("button",{onClick:L=>{L.stopPropagation(),m()},style:{width:"20px",height:"20px",borderRadius:"4px",border:"1.5px solid #10b981",background:"transparent",color:"#10b981",fontSize:"9px",fontWeight:700,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",padding:0,flexShrink:0,transition:"background 200ms ease"},title:`Direction: ${p}. Click to toggle`,children:T}),o.jsx("span",{style:{fontSize:X.md,fontWeight:600,color:N?r:"#1a1a1a",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:s.name})]}),!N&&o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px",marginTop:"3px",paddingLeft:c?"26px":"14px"},children:[o.jsx("span",{style:{fontSize:X.badge,color:"#9CA3AF"},children:s.kind}),c&&o.jsxs("span",{style:{fontSize:"9px",color:"#6B7280",background:"#F0F0ED",padding:"1px 5px",borderRadius:2,fontWeight:600},children:[a," parts",i?"":" (collapsed)"]})]})]})}const jo={width:"8px",height:"8px",background:"#2DD4A8",border:"1.5px solid #FFFFFF",opacity:0},Bl=u.memo(Ll);function Ar(e){var t,s,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(s=Ar(e[t]))&&(r&&(r+=" "),r+=s)}else for(s in e)e[s]&&(r&&(r+=" "),r+=s);return r}function Pl(){for(var e,t,s=0,r="",i=arguments.length;s<i;s++)(e=arguments[s])&&(t=Ar(e))&&(r&&(r+=" "),r+=t);return r}const $l=(e,t)=>{const s=new Array(e.length+t.length);for(let r=0;r<e.length;r++)s[r]=e[r];for(let r=0;r<t.length;r++)s[e.length+r]=t[r];return s},Ol=(e,t)=>({classGroupId:e,validator:t}),Rr=(e=new Map,t=null,s)=>({nextPart:e,validators:t,classGroupId:s}),Po="-",Ks=[],Wl="arbitrary..",_l=e=>{const t=Vl(e),{conflictingClassGroups:s,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:a=>{if(a.startsWith("[")&&a.endsWith("]"))return Hl(a);const p=a.split(Po),b=p[0]===""&&p.length>1?1:0;return zr(p,b,t)},getConflictingClassGroupIds:(a,p)=>{if(p){const b=r[a],m=s[a];return b?m?$l(m,b):b:m||Ks}return s[a]||Ks}}},zr=(e,t,s)=>{if(e.length-t===0)return s.classGroupId;const i=e[t],c=s.nextPart.get(i);if(c){const m=zr(e,t+1,c);if(m)return m}const a=s.validators;if(a===null)return;const p=t===0?e.join(Po):e.slice(t).join(Po),b=a.length;for(let m=0;m<b;m++){const j=a[m];if(j.validator(p))return j.classGroupId}},Hl=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),s=t.indexOf(":"),r=t.slice(0,s);return r?Wl+r:void 0})(),Vl=e=>{const{theme:t,classGroups:s}=e;return Gl(s,t)},Gl=(e,t)=>{const s=Rr();for(const r in e){const i=e[r];In(i,s,r,t)}return s},In=(e,t,s,r)=>{const i=e.length;for(let c=0;c<i;c++){const a=e[c];Ul(a,t,s,r)}},Ul=(e,t,s,r)=>{if(typeof e=="string"){Xl(e,t,s);return}if(typeof e=="function"){Kl(e,t,s,r);return}Yl(e,t,s,r)},Xl=(e,t,s)=>{const r=e===""?t:Mr(t,e);r.classGroupId=s},Kl=(e,t,s,r)=>{if(ql(e)){In(e(r),t,s,r);return}t.validators===null&&(t.validators=[]),t.validators.push(Ol(s,e))},Yl=(e,t,s,r)=>{const i=Object.entries(e),c=i.length;for(let a=0;a<c;a++){const[p,b]=i[a];In(b,Mr(t,p),s,r)}},Mr=(e,t)=>{let s=e;const r=t.split(Po),i=r.length;for(let c=0;c<i;c++){const a=r[c];let p=s.nextPart.get(a);p||(p=Rr(),s.nextPart.set(a,p)),s=p}return s},ql=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,Zl=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,s=Object.create(null),r=Object.create(null);const i=(c,a)=>{s[c]=a,t++,t>e&&(t=0,r=s,s=Object.create(null))};return{get(c){let a=s[c];if(a!==void 0)return a;if((a=r[c])!==void 0)return i(c,a),a},set(c,a){c in s?s[c]=a:i(c,a)}}},vn="!",Ys=":",Jl=[],qs=(e,t,s,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:s,maybePostfixModifierPosition:r,isExternal:i}),Ql=e=>{const{prefix:t,experimentalParseClassName:s}=e;let r=i=>{const c=[];let a=0,p=0,b=0,m;const j=i.length;for(let L=0;L<j;L++){const f=i[L];if(a===0&&p===0){if(f===Ys){c.push(i.slice(b,L)),b=L+1;continue}if(f==="/"){m=L;continue}}f==="["?a++:f==="]"?a--:f==="("?p++:f===")"&&p--}const F=c.length===0?i:i.slice(b);let O=F,T=!1;F.endsWith(vn)?(O=F.slice(0,-1),T=!0):F.startsWith(vn)&&(O=F.slice(1),T=!0);const N=m&&m>b?m-b:void 0;return qs(c,T,O,N)};if(t){const i=t+Ys,c=r;r=a=>a.startsWith(i)?c(a.slice(i.length)):qs(Jl,!1,a,void 0,!0)}if(s){const i=r;r=c=>s({className:c,parseClassName:i})}return r},ec=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((s,r)=>{t.set(s,1e6+r)}),s=>{const r=[];let i=[];for(let c=0;c<s.length;c++){const a=s[c],p=a[0]==="[",b=t.has(a);p||b?(i.length>0&&(i.sort(),r.push(...i),i=[]),r.push(a)):i.push(a)}return i.length>0&&(i.sort(),r.push(...i)),r}},tc=e=>({cache:Zl(e.cacheSize),parseClassName:Ql(e),sortModifiers:ec(e),postfixLookupClassGroupIds:oc(e),..._l(e)}),oc=e=>{const t=Object.create(null),s=e.postfixLookupClassGroups;if(s)for(let r=0;r<s.length;r++)t[s[r]]=!0;return t},nc=/\s+/,sc=(e,t)=>{const{parseClassName:s,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:c,postfixLookupClassGroupIds:a}=t,p=[],b=e.trim().split(nc);let m="";for(let j=b.length-1;j>=0;j-=1){const F=b[j],{isExternal:O,modifiers:T,hasImportantModifier:N,baseClassName:L,maybePostfixModifierPosition:f}=s(F);if(O){m=F+(m.length>0?" "+m:m);continue}let S=!!f,w;if(S){const Y=L.substring(0,f);w=r(Y);const v=w&&a[w]?r(L):void 0;v&&v!==w&&(w=v,S=!1)}else w=r(L);if(!w){if(!S){m=F+(m.length>0?" "+m:m);continue}if(w=r(L),!w){m=F+(m.length>0?" "+m:m);continue}S=!1}const W=T.length===0?"":T.length===1?T[0]:c(T).join(":"),A=N?W+vn:W,_=A+w;if(p.indexOf(_)>-1)continue;p.push(_);const D=i(w,S);for(let Y=0;Y<D.length;++Y){const v=D[Y];p.push(A+v)}m=F+(m.length>0?" "+m:m)}return m},rc=(...e)=>{let t=0,s,r,i="";for(;t<e.length;)(s=e[t++])&&(r=Tr(s))&&(i&&(i+=" "),i+=r);return i},Tr=e=>{if(typeof e=="string")return e;let t,s="";for(let r=0;r<e.length;r++)e[r]&&(t=Tr(e[r]))&&(s&&(s+=" "),s+=t);return s},ic=(e,...t)=>{let s,r,i,c;const a=b=>{const m=t.reduce((j,F)=>F(j),e());return s=tc(m),r=s.cache.get,i=s.cache.set,c=p,p(b)},p=b=>{const m=r(b);if(m)return m;const j=sc(b,s);return i(b,j),j};return c=a,(...b)=>c(rc(...b))},ac=[],Se=e=>{const t=s=>s[e]||ac;return t.isThemeGetter=!0,t},Dr=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Nr=/^\((?:(\w[\w-]*):)?(.+)\)$/i,lc=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,cc=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,dc=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,uc=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,pc=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,hc=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,st=e=>lc.test(e),ee=e=>!!e&&!Number.isNaN(Number(e)),Ve=e=>!!e&&Number.isInteger(Number(e)),pn=e=>e.endsWith("%")&&ee(e.slice(0,-1)),Ye=e=>cc.test(e),Lr=()=>!0,mc=e=>dc.test(e)&&!uc.test(e),An=()=>!1,fc=e=>pc.test(e),gc=e=>hc.test(e),xc=e=>!R(e)&&!z(e),bc=e=>e.startsWith("@container")&&(e[10]==="/"&&e[11]!==void 0||e[11]==="s"&&e[16]!==void 0&&e.startsWith("-size/",10)||e[11]==="n"&&e[18]!==void 0&&e.startsWith("-normal/",10)),yc=e=>at(e,$r,An),R=e=>Dr.test(e),ft=e=>at(e,Or,mc),Zs=e=>at(e,Ec,ee),wc=e=>at(e,_r,Lr),vc=e=>at(e,Wr,An),Js=e=>at(e,Br,An),kc=e=>at(e,Pr,gc),Eo=e=>at(e,Hr,fc),z=e=>Nr.test(e),Xt=e=>bt(e,Or),Fc=e=>bt(e,Wr),Qs=e=>bt(e,Br),Cc=e=>bt(e,$r),Sc=e=>bt(e,Pr),Io=e=>bt(e,Hr,!0),jc=e=>bt(e,_r,!0),at=(e,t,s)=>{const r=Dr.exec(e);return r?r[1]?t(r[1]):s(r[2]):!1},bt=(e,t,s=!1)=>{const r=Nr.exec(e);return r?r[1]?t(r[1]):s:!1},Br=e=>e==="position"||e==="percentage",Pr=e=>e==="image"||e==="url",$r=e=>e==="length"||e==="size"||e==="bg-size",Or=e=>e==="length",Ec=e=>e==="number",Wr=e=>e==="family-name",_r=e=>e==="number"||e==="weight",Hr=e=>e==="shadow",Ic=()=>{const e=Se("color"),t=Se("font"),s=Se("text"),r=Se("font-weight"),i=Se("tracking"),c=Se("leading"),a=Se("breakpoint"),p=Se("container"),b=Se("spacing"),m=Se("radius"),j=Se("shadow"),F=Se("inset-shadow"),O=Se("text-shadow"),T=Se("drop-shadow"),N=Se("blur"),L=Se("perspective"),f=Se("aspect"),S=Se("ease"),w=Se("animate"),W=()=>["auto","avoid","all","avoid-page","page","left","right","column"],A=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],_=()=>[...A(),z,R],D=()=>["auto","hidden","clip","visible","scroll"],Y=()=>["auto","contain","none"],v=()=>[z,R,b],M=()=>[st,"full","auto",...v()],ge=()=>[Ve,"none","subgrid",z,R],H=()=>["auto",{span:["full",Ve,z,R]},Ve,z,R],he=()=>[Ve,"auto",z,R],se=()=>["auto","min","max","fr",z,R],ce=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],xe=()=>["start","end","center","stretch","center-safe","end-safe"],$=()=>["auto",...v()],B=()=>[st,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...v()],ae=()=>[st,"screen","full","dvw","lvw","svw","min","max","fit",...v()],we=()=>[st,"screen","full","lh","dvh","lvh","svh","min","max","fit",...v()],E=()=>[e,z,R],Q=()=>[...A(),Qs,Js,{position:[z,R]}],be=()=>["no-repeat",{repeat:["","x","y","space","round"]}],ye=()=>["auto","cover","contain",Cc,yc,{size:[z,R]}],pe=()=>[pn,Xt,ft],le=()=>["","none","full",m,z,R],de=()=>["",ee,Xt,ft],ve=()=>["solid","dashed","dotted","double"],Ae=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ue=()=>[ee,pn,Qs,Js],Ne=()=>["","none",N,z,R],qe=()=>["none",ee,z,R],lt=()=>["none",ee,z,R],Ie=()=>[ee,z,R],ct=()=>[st,"full",...v()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Ye],breakpoint:[Ye],color:[Lr],container:[Ye],"drop-shadow":[Ye],ease:["in","out","in-out"],font:[xc],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Ye],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Ye],shadow:[Ye],spacing:["px",ee],text:[Ye],"text-shadow":[Ye],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",st,R,z,f]}],container:["container"],"container-type":[{"@container":["","normal","size",z,R]}],"container-named":[bc],columns:[{columns:[ee,R,z,p]}],"break-after":[{"break-after":W()}],"break-before":[{"break-before":W()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:_()}],overflow:[{overflow:D()}],"overflow-x":[{"overflow-x":D()}],"overflow-y":[{"overflow-y":D()}],overscroll:[{overscroll:Y()}],"overscroll-x":[{"overscroll-x":Y()}],"overscroll-y":[{"overscroll-y":Y()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:M()}],"inset-x":[{"inset-x":M()}],"inset-y":[{"inset-y":M()}],start:[{"inset-s":M(),start:M()}],end:[{"inset-e":M(),end:M()}],"inset-bs":[{"inset-bs":M()}],"inset-be":[{"inset-be":M()}],top:[{top:M()}],right:[{right:M()}],bottom:[{bottom:M()}],left:[{left:M()}],visibility:["visible","invisible","collapse"],z:[{z:[Ve,"auto",z,R]}],basis:[{basis:[st,"full","auto",p,...v()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ee,st,"auto","initial","none",R]}],grow:[{grow:["",ee,z,R]}],shrink:[{shrink:["",ee,z,R]}],order:[{order:[Ve,"first","last","none",z,R]}],"grid-cols":[{"grid-cols":ge()}],"col-start-end":[{col:H()}],"col-start":[{"col-start":he()}],"col-end":[{"col-end":he()}],"grid-rows":[{"grid-rows":ge()}],"row-start-end":[{row:H()}],"row-start":[{"row-start":he()}],"row-end":[{"row-end":he()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":se()}],"auto-rows":[{"auto-rows":se()}],gap:[{gap:v()}],"gap-x":[{"gap-x":v()}],"gap-y":[{"gap-y":v()}],"justify-content":[{justify:[...ce(),"normal"]}],"justify-items":[{"justify-items":[...xe(),"normal"]}],"justify-self":[{"justify-self":["auto",...xe()]}],"align-content":[{content:["normal",...ce()]}],"align-items":[{items:[...xe(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...xe(),{baseline:["","last"]}]}],"place-content":[{"place-content":ce()}],"place-items":[{"place-items":[...xe(),"baseline"]}],"place-self":[{"place-self":["auto",...xe()]}],p:[{p:v()}],px:[{px:v()}],py:[{py:v()}],ps:[{ps:v()}],pe:[{pe:v()}],pbs:[{pbs:v()}],pbe:[{pbe:v()}],pt:[{pt:v()}],pr:[{pr:v()}],pb:[{pb:v()}],pl:[{pl:v()}],m:[{m:$()}],mx:[{mx:$()}],my:[{my:$()}],ms:[{ms:$()}],me:[{me:$()}],mbs:[{mbs:$()}],mbe:[{mbe:$()}],mt:[{mt:$()}],mr:[{mr:$()}],mb:[{mb:$()}],ml:[{ml:$()}],"space-x":[{"space-x":v()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":v()}],"space-y-reverse":["space-y-reverse"],size:[{size:B()}],"inline-size":[{inline:["auto",...ae()]}],"min-inline-size":[{"min-inline":["auto",...ae()]}],"max-inline-size":[{"max-inline":["none",...ae()]}],"block-size":[{block:["auto",...we()]}],"min-block-size":[{"min-block":["auto",...we()]}],"max-block-size":[{"max-block":["none",...we()]}],w:[{w:[p,"screen",...B()]}],"min-w":[{"min-w":[p,"screen","none",...B()]}],"max-w":[{"max-w":[p,"screen","none","prose",{screen:[a]},...B()]}],h:[{h:["screen","lh",...B()]}],"min-h":[{"min-h":["screen","lh","none",...B()]}],"max-h":[{"max-h":["screen","lh",...B()]}],"font-size":[{text:["base",s,Xt,ft]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,jc,wc]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",pn,R]}],"font-family":[{font:[Fc,vc,t]}],"font-features":[{"font-features":[R]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[i,z,R]}],"line-clamp":[{"line-clamp":[ee,"none",z,Zs]}],leading:[{leading:[c,...v()]}],"list-image":[{"list-image":["none",z,R]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",z,R]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:E()}],"text-color":[{text:E()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ve(),"wavy"]}],"text-decoration-thickness":[{decoration:[ee,"from-font","auto",z,ft]}],"text-decoration-color":[{decoration:E()}],"underline-offset":[{"underline-offset":[ee,"auto",z,R]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:v()}],"tab-size":[{tab:[Ve,z,R]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",z,R]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",z,R]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Q()}],"bg-repeat":[{bg:be()}],"bg-size":[{bg:ye()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Ve,z,R],radial:["",z,R],conic:[Ve,z,R]},Sc,kc]}],"bg-color":[{bg:E()}],"gradient-from-pos":[{from:pe()}],"gradient-via-pos":[{via:pe()}],"gradient-to-pos":[{to:pe()}],"gradient-from":[{from:E()}],"gradient-via":[{via:E()}],"gradient-to":[{to:E()}],rounded:[{rounded:le()}],"rounded-s":[{"rounded-s":le()}],"rounded-e":[{"rounded-e":le()}],"rounded-t":[{"rounded-t":le()}],"rounded-r":[{"rounded-r":le()}],"rounded-b":[{"rounded-b":le()}],"rounded-l":[{"rounded-l":le()}],"rounded-ss":[{"rounded-ss":le()}],"rounded-se":[{"rounded-se":le()}],"rounded-ee":[{"rounded-ee":le()}],"rounded-es":[{"rounded-es":le()}],"rounded-tl":[{"rounded-tl":le()}],"rounded-tr":[{"rounded-tr":le()}],"rounded-br":[{"rounded-br":le()}],"rounded-bl":[{"rounded-bl":le()}],"border-w":[{border:de()}],"border-w-x":[{"border-x":de()}],"border-w-y":[{"border-y":de()}],"border-w-s":[{"border-s":de()}],"border-w-e":[{"border-e":de()}],"border-w-bs":[{"border-bs":de()}],"border-w-be":[{"border-be":de()}],"border-w-t":[{"border-t":de()}],"border-w-r":[{"border-r":de()}],"border-w-b":[{"border-b":de()}],"border-w-l":[{"border-l":de()}],"divide-x":[{"divide-x":de()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":de()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ve(),"hidden","none"]}],"divide-style":[{divide:[...ve(),"hidden","none"]}],"border-color":[{border:E()}],"border-color-x":[{"border-x":E()}],"border-color-y":[{"border-y":E()}],"border-color-s":[{"border-s":E()}],"border-color-e":[{"border-e":E()}],"border-color-bs":[{"border-bs":E()}],"border-color-be":[{"border-be":E()}],"border-color-t":[{"border-t":E()}],"border-color-r":[{"border-r":E()}],"border-color-b":[{"border-b":E()}],"border-color-l":[{"border-l":E()}],"divide-color":[{divide:E()}],"outline-style":[{outline:[...ve(),"none","hidden"]}],"outline-offset":[{"outline-offset":[ee,z,R]}],"outline-w":[{outline:["",ee,Xt,ft]}],"outline-color":[{outline:E()}],shadow:[{shadow:["","none",j,Io,Eo]}],"shadow-color":[{shadow:E()}],"inset-shadow":[{"inset-shadow":["none",F,Io,Eo]}],"inset-shadow-color":[{"inset-shadow":E()}],"ring-w":[{ring:de()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:E()}],"ring-offset-w":[{"ring-offset":[ee,ft]}],"ring-offset-color":[{"ring-offset":E()}],"inset-ring-w":[{"inset-ring":de()}],"inset-ring-color":[{"inset-ring":E()}],"text-shadow":[{"text-shadow":["none",O,Io,Eo]}],"text-shadow-color":[{"text-shadow":E()}],opacity:[{opacity:[ee,z,R]}],"mix-blend":[{"mix-blend":[...Ae(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Ae()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[ee]}],"mask-image-linear-from-pos":[{"mask-linear-from":ue()}],"mask-image-linear-to-pos":[{"mask-linear-to":ue()}],"mask-image-linear-from-color":[{"mask-linear-from":E()}],"mask-image-linear-to-color":[{"mask-linear-to":E()}],"mask-image-t-from-pos":[{"mask-t-from":ue()}],"mask-image-t-to-pos":[{"mask-t-to":ue()}],"mask-image-t-from-color":[{"mask-t-from":E()}],"mask-image-t-to-color":[{"mask-t-to":E()}],"mask-image-r-from-pos":[{"mask-r-from":ue()}],"mask-image-r-to-pos":[{"mask-r-to":ue()}],"mask-image-r-from-color":[{"mask-r-from":E()}],"mask-image-r-to-color":[{"mask-r-to":E()}],"mask-image-b-from-pos":[{"mask-b-from":ue()}],"mask-image-b-to-pos":[{"mask-b-to":ue()}],"mask-image-b-from-color":[{"mask-b-from":E()}],"mask-image-b-to-color":[{"mask-b-to":E()}],"mask-image-l-from-pos":[{"mask-l-from":ue()}],"mask-image-l-to-pos":[{"mask-l-to":ue()}],"mask-image-l-from-color":[{"mask-l-from":E()}],"mask-image-l-to-color":[{"mask-l-to":E()}],"mask-image-x-from-pos":[{"mask-x-from":ue()}],"mask-image-x-to-pos":[{"mask-x-to":ue()}],"mask-image-x-from-color":[{"mask-x-from":E()}],"mask-image-x-to-color":[{"mask-x-to":E()}],"mask-image-y-from-pos":[{"mask-y-from":ue()}],"mask-image-y-to-pos":[{"mask-y-to":ue()}],"mask-image-y-from-color":[{"mask-y-from":E()}],"mask-image-y-to-color":[{"mask-y-to":E()}],"mask-image-radial":[{"mask-radial":[z,R]}],"mask-image-radial-from-pos":[{"mask-radial-from":ue()}],"mask-image-radial-to-pos":[{"mask-radial-to":ue()}],"mask-image-radial-from-color":[{"mask-radial-from":E()}],"mask-image-radial-to-color":[{"mask-radial-to":E()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":A()}],"mask-image-conic-pos":[{"mask-conic":[ee]}],"mask-image-conic-from-pos":[{"mask-conic-from":ue()}],"mask-image-conic-to-pos":[{"mask-conic-to":ue()}],"mask-image-conic-from-color":[{"mask-conic-from":E()}],"mask-image-conic-to-color":[{"mask-conic-to":E()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Q()}],"mask-repeat":[{mask:be()}],"mask-size":[{mask:ye()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",z,R]}],filter:[{filter:["","none",z,R]}],blur:[{blur:Ne()}],brightness:[{brightness:[ee,z,R]}],contrast:[{contrast:[ee,z,R]}],"drop-shadow":[{"drop-shadow":["","none",T,Io,Eo]}],"drop-shadow-color":[{"drop-shadow":E()}],grayscale:[{grayscale:["",ee,z,R]}],"hue-rotate":[{"hue-rotate":[ee,z,R]}],invert:[{invert:["",ee,z,R]}],saturate:[{saturate:[ee,z,R]}],sepia:[{sepia:["",ee,z,R]}],"backdrop-filter":[{"backdrop-filter":["","none",z,R]}],"backdrop-blur":[{"backdrop-blur":Ne()}],"backdrop-brightness":[{"backdrop-brightness":[ee,z,R]}],"backdrop-contrast":[{"backdrop-contrast":[ee,z,R]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ee,z,R]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ee,z,R]}],"backdrop-invert":[{"backdrop-invert":["",ee,z,R]}],"backdrop-opacity":[{"backdrop-opacity":[ee,z,R]}],"backdrop-saturate":[{"backdrop-saturate":[ee,z,R]}],"backdrop-sepia":[{"backdrop-sepia":["",ee,z,R]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":v()}],"border-spacing-x":[{"border-spacing-x":v()}],"border-spacing-y":[{"border-spacing-y":v()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",z,R]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ee,"initial",z,R]}],ease:[{ease:["linear","initial",S,z,R]}],delay:[{delay:[ee,z,R]}],animate:[{animate:["none",w,z,R]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[L,z,R]}],"perspective-origin":[{"perspective-origin":_()}],rotate:[{rotate:qe()}],"rotate-x":[{"rotate-x":qe()}],"rotate-y":[{"rotate-y":qe()}],"rotate-z":[{"rotate-z":qe()}],scale:[{scale:lt()}],"scale-x":[{"scale-x":lt()}],"scale-y":[{"scale-y":lt()}],"scale-z":[{"scale-z":lt()}],"scale-3d":["scale-3d"],skew:[{skew:Ie()}],"skew-x":[{"skew-x":Ie()}],"skew-y":[{"skew-y":Ie()}],transform:[{transform:[z,R,"","none","gpu","cpu"]}],"transform-origin":[{origin:_()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ct()}],"translate-x":[{"translate-x":ct()}],"translate-y":[{"translate-y":ct()}],"translate-z":[{"translate-z":ct()}],"translate-none":["translate-none"],zoom:[{zoom:[Ve,z,R]}],accent:[{accent:E()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:E()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",z,R]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":E()}],"scrollbar-track-color":[{"scrollbar-track":E()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":v()}],"scroll-mx":[{"scroll-mx":v()}],"scroll-my":[{"scroll-my":v()}],"scroll-ms":[{"scroll-ms":v()}],"scroll-me":[{"scroll-me":v()}],"scroll-mbs":[{"scroll-mbs":v()}],"scroll-mbe":[{"scroll-mbe":v()}],"scroll-mt":[{"scroll-mt":v()}],"scroll-mr":[{"scroll-mr":v()}],"scroll-mb":[{"scroll-mb":v()}],"scroll-ml":[{"scroll-ml":v()}],"scroll-p":[{"scroll-p":v()}],"scroll-px":[{"scroll-px":v()}],"scroll-py":[{"scroll-py":v()}],"scroll-ps":[{"scroll-ps":v()}],"scroll-pe":[{"scroll-pe":v()}],"scroll-pbs":[{"scroll-pbs":v()}],"scroll-pbe":[{"scroll-pbe":v()}],"scroll-pt":[{"scroll-pt":v()}],"scroll-pr":[{"scroll-pr":v()}],"scroll-pb":[{"scroll-pb":v()}],"scroll-pl":[{"scroll-pl":v()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",z,R]}],fill:[{fill:["none",...E()]}],"stroke-w":[{stroke:[ee,Xt,ft,Zs]}],stroke:[{stroke:["none",...E()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},Ac=ic(Ic);function Rc(...e){return Ac(Pl(e))}function er({className:e,children:t,...s}){return o.jsx(te,{...s,className:Rc("dark:border-secondary dark:bg-secondary h-[11px] w-[11px] rounded-full border border-slate-300 bg-slate-100 transition",e),children:t})}const tr={top:K.Top,bottom:K.Bottom,left:K.Left,right:K.Right},zc={top:"bottom",bottom:"top",left:"right",right:"left"},Mc="#6B7280",Vr=e=>e?No[e]:Mc;function Gr(e,t){if(e==="inout")return"⇄";if(!e)return"";const s=e==="in";switch(t){case"left":return s?"→":"←";case"right":return s?"←":"→";case"top":return s?"↓":"↑";default:return s?"↑":"↓"}}const or=40,Ur=e=>({opacity:0,width:e,height:e,top:"50%",left:"50%",transform:"translate(-50%, -50%)",border:"none",background:"transparent",pointerEvents:"none"}),Tc=e=>({...Ur(e),pointerEvents:"auto",cursor:"pointer",zIndex:12}),Ao=7;function Dc({port:e}){const t=e.size??gt,s=e.side==="left"||e.side==="right",r=s?e.y:e.x,c=r+t/2+Cr*(e.nestedCount??0)+t/2-r+Ao*2,a=t+Ao*2;return o.jsx("div",{"aria-hidden":!0,style:{position:"absolute",left:e.x-Ao,top:e.y-Ao,width:s?a:c,height:s?c:a,background:"rgba(148,163,184,0.30)",border:"1px solid rgba(100,116,139,0.45)",borderRadius:9,pointerEvents:"none",zIndex:0}})}function Nc({port:e,onMove:t,onResize:s,onSelect:r,showText:i=!0}){const{getZoom:c}=Sn(),a=vr(D=>D.transform[2]),p=Il(e.id),b=ne(D=>D.selectedElementId===e.id),m=u.useRef(!1),j=jn()&&!p,F=e.size??gt,O=F+Ga,T=Vr(e.direction),N=t?D=>{D.preventDefault(),D.stopPropagation();const Y=D.clientY,v=e.y;let M;const ge=he=>{M=he,!(Math.hypot(he.clientX-D.clientX,he.clientY-D.clientY)<=2)&&(m.current=!0,t(v+(he.clientY-Y)/c()))},H=()=>{if(M){const he=M.clientX-D.clientX,se=M.clientY-D.clientY;if(Math.hypot(he,se)>18){const ce=Math.abs(he)>Math.abs(se)?he<0?"left":"right":se<0?"top":"bottom";t(v+se/c(),ce)}}window.removeEventListener("pointermove",ge),window.removeEventListener("pointerup",H),window.setTimeout(()=>{m.current=!1},0)};window.addEventListener("pointermove",ge),window.addEventListener("pointerup",H,{once:!0})}:void 0,L=D=>{D.stopPropagation(),!m.current&&(r==null||r(e.id))},f=D=>{const Y=D.clientX,v=D.clientY;m.current=!1;const M=H=>{Math.hypot(H.clientX-Y,H.clientY-v)>2&&(m.current=!0)},ge=()=>{window.removeEventListener("pointermove",M),window.removeEventListener("pointerup",ge),window.setTimeout(()=>{m.current=!1},0)};window.addEventListener("pointermove",M),window.addEventListener("pointerup",ge,{once:!0})},S=D=>Y=>{if(!s)return;Y.preventDefault(),Y.stopPropagation();const v=Y.clientX,M=Y.clientY,ge=F;m.current=!0;const H=se=>{const ce=(se.clientX-v)/c(),xe=(se.clientY-M)/c(),$=D.includes("e")?ce:D.includes("w")?-ce:void 0,B=D.includes("s")?xe:D.includes("n")?-xe:void 0,ae=$!==void 0&&B!==void 0?($+B)/2:$??B??0;s(Math.min(48,Math.max(10,ge+ae)),D)},he=()=>{window.removeEventListener("pointermove",H),window.removeEventListener("pointerup",he),window.setTimeout(()=>{m.current=!1},0)};window.addEventListener("pointermove",H),window.addEventListener("pointerup",he,{once:!0})},w=e.side==="left"||e.side==="right",W={position:"absolute",fontSize:e.nested?"9.5px":"10.5px",fontWeight:p||b?750:e.nested?600:650,color:p||b?"#0F172A":e.nested?"#6B7280":"#374151",opacity:j?.45:1,transition:"color 120ms ease, opacity 120ms ease",whiteSpace:"normal",pointerEvents:t?"auto":"none",cursor:r?"pointer":"default",touchAction:"none",overflow:"hidden",display:"flex",flexDirection:"column",width:w?e.labelWidth??_a:Ha,background:"rgba(255,255,255,0.94)",padding:"1px 3px",borderRadius:4,lineHeight:1.12,...e.side==="left"?{left:O,bottom:"50%",marginBottom:2}:e.side==="right"?{right:O,bottom:"50%",marginBottom:2,textAlign:"right"}:{bottom:O,left:"50%",transform:"translateX(-50%)",textAlign:"center"}},A={overflow:"hidden",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:e.connectorType?1:2},_={fontSize:e.nested?"8.5px":"9px",fontWeight:500,color:p?"#475569":"#94A3B8",letterSpacing:"0.01em",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"};return o.jsxs("div",{className:"nodrag nopan",style:{position:"absolute",left:e.x,top:e.y,width:F,height:F,zIndex:e.nested?11:10},children:[o.jsx("div",{onPointerEnter:()=>Kt({endpointIds:[e.id]}),onPointerLeave:()=>Kt(null),onPointerDown:N,onClick:L,title:`${e.name}${e.direction?` (${e.direction})`:""}${e.connectorType?`
|
|
3
|
+
${e.connectorType}`:""}`,style:{position:"absolute",left:"50%",top:"50%",width:or,height:or,transform:`translate(-50%, -50%) scale(${1/Math.max(a,.1)})`,cursor:r?"pointer":"default",touchAction:"none"}}),o.jsxs("div",{style:{position:"absolute",inset:0,boxSizing:"border-box",background:"#FFFFFF",border:`2px solid ${T}`,borderRadius:5,boxShadow:b?"0 0 0 3px #2563EB, 0 2px 8px rgba(15,23,42,0.24)":p?`0 0 0 4px ${T}33, 0 2px 8px rgba(15,23,42,0.24)`:"0 1px 3px rgba(15,23,42,0.18)",opacity:j?.5:1,display:"flex",alignItems:"center",justifyContent:"center",color:T,fontSize:e.nested?"10px":"12px",fontWeight:800,lineHeight:1,pointerEvents:"none",transition:"box-shadow 120ms ease, opacity 120ms ease"},children:[Gr(e.direction,e.side),i&&o.jsxs("span",{onPointerDown:N,onClick:L,style:W,children:[o.jsx("span",{style:A,children:e.name.replace(/([a-z0-9])([A-Z])/g,"$1$2")}),e.connectorType&&o.jsx("span",{style:_,children:e.connectorType})]}),[{suffix:"",pos:tr[e.side],connectable:!0},{suffix:Va,pos:tr[zc[e.side]],connectable:!1}].flatMap(D=>{const Y=D.connectable?"ibd-port-connect":"ibd-port-anchor",v=D.connectable?Tc(F):Ur(F);return[o.jsx(er,{className:Y,type:"source",id:`${e.id}${D.suffix}`,position:D.pos,style:v,isConnectable:D.connectable,onPointerDownCapture:D.connectable?f:void 0,onClick:D.connectable?L:void 0},`s${D.suffix}`),o.jsx(er,{className:Y,type:"target",id:`${e.id}${D.suffix}`,position:D.pos,style:v,isConnectable:D.connectable,onPointerDownCapture:D.connectable?f:void 0,onClick:D.connectable?L:void 0},`t${D.suffix}`)]})]}),s&&[["n",{top:-5,left:5,right:5,height:10,cursor:"ns-resize"}],["e",{top:5,right:-5,bottom:5,width:10,cursor:"ew-resize"}],["s",{bottom:-5,left:5,right:5,height:10,cursor:"ns-resize"}],["w",{top:5,left:-5,bottom:5,width:10,cursor:"ew-resize"}],["nw",{top:-5,left:-5,width:10,height:10,cursor:"nwse-resize"}],["ne",{top:-5,right:-5,width:10,height:10,cursor:"nesw-resize"}],["se",{bottom:-5,right:-5,width:10,height:10,cursor:"nwse-resize"}],["sw",{bottom:-5,left:-5,width:10,height:10,cursor:"nesw-resize"}]].map(([D,Y])=>o.jsx("div",{className:`ibd-port-resize-handle ibd-port-resize-handle--${D}`,onPointerDown:S(D),style:{position:"absolute",zIndex:20,touchAction:"none",...Y}},D))]})}function nr({side:e,direction:t}){const s=Vr(t),r=gt;return o.jsx("div",{"aria-label":`implicit ${t} port`,title:`Implicit ${t} port — relationship targets the part directly`,style:{position:"absolute",top:"50%",left:e==="left"?-r/2:void 0,right:e==="right"?-r/2:void 0,transform:"translateY(-50%)",width:r,height:r,boxSizing:"border-box",background:"#FFFFFF",border:`2px solid ${s}`,borderRadius:4,boxShadow:"0 1px 3px rgba(15,23,42,0.18)",display:"flex",alignItems:"center",justifyContent:"center",color:s,fontSize:11,fontWeight:800,lineHeight:1,zIndex:4,pointerEvents:"none"},children:Gr(t,e)})}function sr({name:e,kind:t,nameColor:s,typeColor:r,frame:i=!1,style:c}){const a=(c==null?void 0:c.textAlign)??"left";return o.jsxs("span",{title:`${e} : ${t}`,style:{display:"flex",flexDirection:i?"row":"column",alignItems:a==="right"?"flex-end":a==="center"?"center":i?"baseline":"flex-start",gap:i?6:1,minWidth:0,overflow:"hidden",flex:1,textAlign:a},children:[o.jsx("span",{style:{display:i?"block":"-webkit-box",width:"100%",minWidth:0,fontSize:(c==null?void 0:c.fontSize)??(i?X.md:X.sm),lineHeight:1.2,fontWeight:(c==null?void 0:c.fontWeight)??700,color:(c==null?void 0:c.textColor)??s,whiteSpace:i?"nowrap":"normal",overflow:"hidden",textOverflow:"ellipsis",WebkitBoxOrient:"vertical",WebkitLineClamp:i?void 0:2,overflowWrap:"anywhere"},children:e}),o.jsx("span",{style:{display:"block",maxWidth:"100%",fontSize:"9px",lineHeight:1.15,fontWeight:650,letterSpacing:"0.055em",textTransform:"uppercase",color:(c==null?void 0:c.textColor)??r,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:i?`: ${t}`:`«${t}»`})]})}function Lc({label:e,onDrillIn:t,color:s,onColor:r}){return o.jsx("button",{"aria-label":`Drill into ${e}`,title:`Open ${e} as its own internal block diagram`,className:"nodrag",onClick:i=>{i.stopPropagation(),t()},onDoubleClick:i=>i.stopPropagation(),style:{width:18,height:18,padding:0,borderRadius:3,flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",border:r?"1px solid rgba(255,255,255,0.7)":`1px solid ${s}88`,background:r?"rgba(255,255,255,0.18)":"#FFFFFF",color:r?"#FFFFFF":s,fontSize:11,lineHeight:1,cursor:"pointer",fontWeight:700},children:"↳"})}function rr({label:e,isCollapsed:t,onToggle:s,color:r,onColor:i}){return o.jsx("button",{"aria-label":t?`Expand ${e}`:`Collapse ${e}`,onClick:c=>{c.stopPropagation(),s()},style:{marginLeft:"auto",width:18,height:18,padding:0,borderRadius:3,border:i?"1px solid rgba(255,255,255,0.7)":`1px solid ${r}88`,background:i?"rgba(255,255,255,0.18)":"#FFFFFF",color:i?"#FFFFFF":r,fontSize:13,lineHeight:"15px",cursor:"pointer",fontWeight:700,flexShrink:0},children:t?"+":"−"})}function Bc({id:e,data:t,selected:s,height:r}){const i=pa(),c=t,{label:a,kind:p,color:b,isContainer:m,isFrame:j,ports:F,implicitIn:O,implicitOut:T,onPortMove:N,onPortResize:L,onPortSelect:f,showPortText:S,hasChildren:w,isCollapsed:W,onToggleCollapse:A,onDrillIn:_,minWidth:D,minHeight:Y,bgColor:v,fillOpacity:M,borderColor:ge,textColor:H,fontSize:he,fontWeight:se,textAlign:ce,verticalAlign:xe}=c,[$,B]=u.useState(!1),ae=s?rt.selected:j?"none":$?"0 8px 20px rgba(15,23,42,0.12)":m?"0 1px 2px rgba(15,23,42,0.05)":"0 2px 8px rgba(15,23,42,0.08)",we=(E,Q)=>{const be=i.getState().nodeLookup.get(e);if(!be)return!0;const ye=4;return[...i.getState().nodeLookup.values()].every(pe=>{if(pe.id===e||pe.parentId!==be.parentId||pe.hidden)return!0;const le=pe.measured.width??pe.width??0,de=pe.measured.height??pe.height??0;if(le<=0||de<=0)return!0;const ve=pe.internals.positionAbsolute;return Q.x+Q.width+ye<=ve.x||ve.x+le+ye<=Q.x||Q.y+Q.height+ye<=ve.y||ve.y+de+ye<=Q.y})};return o.jsxs("div",{onMouseEnter:()=>B(!0),onMouseLeave:()=>B(!1),style:{width:"100%",height:"100%",boxSizing:"border-box",background:v||"#FFFFFF",opacity:M??1,border:j?`1.5px solid ${ge??"#94A3B8"}`:`1px solid ${ge??($?b+"9A":"#CBD5E1")}`,...j?{}:{borderTop:`3px solid ${ge??b}`},borderRadius:j?10:8,boxShadow:ae,transition:"box-shadow 150ms ease, border-color 150ms ease",position:"relative"},children:[o.jsx(xt,{nodeId:e,isVisible:s||$,minWidth:D??180,minHeight:Y??100,color:"#2563EB",lineStyle:{borderWidth:1},handleStyle:{width:10,height:10,borderRadius:2},shouldResize:we}),j?o.jsxs("div",{style:{position:"absolute",top:0,left:0,right:0,height:38,display:"flex",alignItems:xe==="top"?"flex-start":xe==="bottom"?"flex-end":"center",gap:8,padding:"0 10px",background:"#F8FAFC",borderBottom:"1px solid #E2E8F0",borderRadius:"9px 9px 0 0"},children:[o.jsx("span",{style:{padding:"2px 6px",borderRadius:4,background:b,color:"#FFFFFF",fontSize:9,fontWeight:800,letterSpacing:"0.08em"},children:"IBD"}),o.jsx(sr,{name:a,kind:p,nameColor:"#0F172A",typeColor:"#64748B",frame:!0,style:{textColor:H,fontSize:he,fontWeight:se,textAlign:ce}}),w&&A&&o.jsx(rr,{label:a,isCollapsed:W,onToggle:A,color:b})]}):o.jsxs("div",{style:{display:"flex",alignItems:xe==="top"?"flex-start":xe==="bottom"?"flex-end":"center",gap:6,minHeight:58,padding:"7px 10px 6px",background:"#FFFFFF",borderBottom:w?"1px solid #E2E8F0":"none",borderRadius:"7px 7px 0 0",overflow:"hidden"},children:[En(p)&&o.jsx(qt,{size:24,color:b}),o.jsx(sr,{name:a,kind:p,nameColor:"#0F172A",typeColor:m?b:"#64748B",style:{textColor:H,fontSize:he,fontWeight:se,textAlign:ce}}),w&&_&&o.jsx(Lc,{label:a,onDrillIn:_,color:b}),w&&A&&o.jsx(rr,{label:a,isCollapsed:W,onToggle:A,color:b})]}),F.filter(E=>E.nestedCount).map(E=>o.jsx(Dc,{port:E},`${E.id}__group`)),F.map(E=>o.jsx(Nc,{port:E,onMove:N?(Q,be)=>{const ye=E.size??gt,pe=(j||m?70:62)-ye/2,le=Math.max(pe,(r??pe+ye+18)-ye-18);N(E.id,Math.min(Math.max(Q,pe),le),be)}:void 0,onResize:L?(Q,be)=>L(E.id,Q,be):void 0,onSelect:f,showText:S},E.id)),O&&o.jsx(nr,{side:"left",direction:"in"}),T&&o.jsx(nr,{side:"right",direction:"out"})]})}const Pc=u.memo(Bc);function ir(e,t){const s=e.map(i=>({...i}));let r=t;for(;s.length>=2&&r>0;){const i=s[0],c=s[1],a=Math.hypot(c.x-i.x,c.y-i.y);if(a<=r)r-=a,s.shift();else{const p=r/a;s[0]={x:i.x+(c.x-i.x)*p,y:i.y+(c.y-i.y)*p},r=0}}return s}function $c(e,t){const s=ir(e,t);return ir([...s].reverse(),t).reverse()}const Oc=e=>e.slice(1).reduce((t,s,r)=>t+Math.hypot(s.x-e[r].x,s.y-e[r].y),0);function Ro(e,t=7){if(e.length<2)return"";let s=`M ${e[0].x},${e[0].y}`;for(let i=1;i<e.length-1;i++){const c=e[i-1],a=e[i],p=e[i+1],b=Math.hypot(a.x-c.x,a.y-c.y),m=Math.hypot(p.x-a.x,p.y-a.y),j=Math.min(t,b/2,m/2),F=a.x-Math.sign(a.x-c.x)*j,O=a.y-Math.sign(a.y-c.y)*j,T=a.x+Math.sign(p.x-a.x)*j,N=a.y+Math.sign(p.y-a.y)*j;s+=` L ${F},${O} Q ${a.x},${a.y} ${T},${N}`}const r=e[e.length-1];return`${s} L ${r.x},${r.y}`}function Wc(e){let t=0,s=-1;for(let a=1;a<e.length;a++){const p=Math.abs(e[a].x-e[a-1].x)+Math.abs(e[a].y-e[a-1].y);p>s&&(s=p,t=a)}const r=e[t-1],i=e[t],c=Math.abs(i.x-r.x)>=Math.abs(i.y-r.y)?{x:0,y:-14}:{x:14,y:0};return{x:(r.x+i.x)/2+c.x,y:(r.y+i.y)/2+c.y}}function _c(e){var W,A,_,D,Y,v,M,ge,H,he,se,ce,xe;const{getZoom:t,screenToFlowPosition:s}=Sn(),r=jr(e.id,[e.source,e.target,(W=e.data)==null?void 0:W.sourcePortId,(A=e.data)==null?void 0:A.targetPortId]),i=jn()&&!r,c=((_=e.data)==null?void 0:_.points)??[];if(c.length<2)return null;const a=String(((D=e.style)==null?void 0:D.stroke)??"#2563EB"),p=Number(((Y=e.style)==null?void 0:Y.strokeWidth)??2),b=r?{...e.style,strokeWidth:p+1.4}:e.style,m=((v=e.data)==null?void 0:v.labelPoint)??Wc(c),j=Math.min(28/Math.max(t(),.1),Oc(c)*.3),F=$c(c,j),O=(M=e.data)==null?void 0:M.onRouteChange,T=(ge=e.data)==null?void 0:ge.onRouteChangeComplete,N=(H=e.data)==null?void 0:H.onSelect,L=!!((he=e.data)!=null&&he.flowAnimation),f=c.length===2?[{index:1,a:c[0],b:c[1],straight:!0}]:c.slice(1).map(($,B)=>({index:B+1,a:c[B],b:$,straight:!1})).filter($=>$.index>=2&&$.index<=c.length-2),S=($,B)=>{if(!O)return;$.preventDefault(),$.stopPropagation();const ae=c.map(pe=>({...pe})),we=$.clientX,E=$.clientY;let Q=ae;const be=pe=>{const le=(pe.clientX-we)/t(),de=(pe.clientY-E)/t();if(B.straight)if(Math.abs(de)>=Math.abs(le)){const ve=B.a.y+de;Q=[B.a,{x:B.a.x,y:ve},{x:B.b.x,y:ve},B.b]}else{const ve=(B.a.x+B.b.x)/2+le;Q=[B.a,{x:ve,y:B.a.y},{x:ve,y:B.b.y},B.b]}else Q=c.map(ve=>({...ve})),B.a.y===B.b.y?(Q[B.index-1].y=B.a.y+de,Q[B.index].y=B.b.y+de):(Q[B.index-1].x=B.a.x+le,Q[B.index].x=B.b.x+le);O(Q)},ye=()=>{window.removeEventListener("pointermove",be),T==null||T(ae,Q)};window.addEventListener("pointermove",be),window.addEventListener("pointerup",ye,{once:!0})},w=$=>{const B=ae=>{const we=ae.b.x-ae.a.x,E=ae.b.y-ae.a.y,Q=we*we+E*E,be=Q===0?0:Math.max(0,Math.min(1,(($.x-ae.a.x)*we+($.y-ae.a.y)*E)/Q)),ye=ae.a.x+be*we,pe=ae.a.y+be*E;return($.x-ye)**2+($.y-pe)**2};return f.reduce((ae,we)=>!ae||B(we)<B(ae)?we:ae,void 0)};return o.jsxs(o.Fragment,{children:[r&&o.jsx("path",{d:Ro(c),fill:"none",stroke:a,strokeOpacity:.22,strokeWidth:p+9,strokeLinecap:"round",pointerEvents:"none"}),o.jsx(kr,{id:e.id,path:Ro(c),style:b,markerEnd:e.markerEnd}),L&&o.jsx("path",{d:Ro(c),fill:"none",stroke:String(((se=e.style)==null?void 0:se.stroke)??"#2563EB"),strokeWidth:Math.max(2,Number(((ce=e.style)==null?void 0:ce.strokeWidth)??2)),className:"memo-ibd-flow"}),F.length>=2&&o.jsx("path",{d:Ro(F),fill:"none",stroke:"transparent",strokeWidth:18/Math.max(t(),.1),pointerEvents:"stroke",cursor:"pointer",onClick:$=>N==null?void 0:N($),onPointerDown:$=>{if(!e.selected||!O||f.length===0)return;const B=w(s({x:$.clientX,y:$.clientY}));B&&S($,B)}}),e.label&&((xe=e.data)==null?void 0:xe.showLabel)!==!1?o.jsx(yn,{children:o.jsx("div",{style:{position:"absolute",transform:`translate(-50%, -50%) translate(${m.x}px, ${m.y}px)`,fontSize:X.badge,fontWeight:r?700:600,color:r?"#0F172A":"#475569",background:"rgba(255,255,255,0.96)",border:`1px solid ${r?a:"#E2E8F0"}`,opacity:i?.25:1,padding:"1px 4px",borderRadius:4,pointerEvents:"none"},children:e.label})}):null,e.selected&&O?f.map($=>{const B=($.a.x+$.b.x)/2,ae=($.a.y+$.b.y)/2;return o.jsx(yn,{children:o.jsx("div",{className:"nodrag nopan",title:"Drag connector segment",onPointerDown:we=>S(we,$),style:{position:"absolute",transform:`translate(-50%, -50%) translate(${B}px, ${ae}px)`,width:12,height:12,borderRadius:3,background:"#FFFFFF",border:"2px solid #2563EB",boxShadow:"0 1px 4px rgba(15,23,42,0.22)",cursor:$.a.y===$.b.y?"ns-resize":"ew-resize",pointerEvents:"all",touchAction:"none",zIndex:20}})},`route-${$.index}`)}):null]})}const Hc=u.memo(_c);function ar({onDrillIn:e,color:t,label:s}){return o.jsx("button",{onClick:r=>{r.stopPropagation(),e()},onDoubleClick:r=>r.stopPropagation(),className:"nodrag",title:`Open ${s} as its own diagram`,"aria-label":`Drill into ${s}`,style:{width:16,height:16,flexShrink:0,padding:0,display:"flex",alignItems:"center",justifyContent:"center",border:`1px solid ${t}66`,borderRadius:4,background:"#FFFFFF",color:t,fontSize:10,fontWeight:700,lineHeight:1,cursor:"pointer"},children:"↳"})}function lr({collapsed:e,onToggle:t,color:s}){return o.jsx("button",{onClick:r=>{r.stopPropagation(),t()},onDoubleClick:r=>r.stopPropagation(),className:"nodrag",title:e?"Show substates":"Hide substates","aria-label":e?"Show substates":"Hide substates",style:{width:16,height:16,flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",border:`1px solid ${s}66`,borderRadius:4,background:"#FFFFFF",color:s,fontSize:11,fontWeight:700,lineHeight:1,cursor:"pointer"},children:e?"+":"−"})}const zo={width:8,height:8,border:"none",background:"transparent",opacity:0};function hn(){return o.jsxs(o.Fragment,{children:[o.jsx(te,{type:"target",position:K.Top,id:"top",style:zo}),o.jsx(te,{type:"source",position:K.Bottom,id:"bottom",style:zo}),o.jsx(te,{type:"target",position:K.Left,id:"left",style:zo}),o.jsx(te,{type:"source",position:K.Right,id:"right",style:zo})]})}function Vc({data:e,selected:t}){const s=e,[r,i]=u.useState(!1);if(s.isNote)return o.jsxs("div",{style:{width:"100%",height:"100%",boxSizing:"border-box",background:"#FFFDF5",border:`1px solid ${s.color}66`,borderRadius:4,padding:"6px 10px",boxShadow:rt.sm,display:"flex",flexDirection:"column",justifyContent:"center"},title:s.kind,children:[o.jsx(hn,{}),o.jsx("span",{style:{fontSize:X.xs,fontWeight:600,color:"#374151",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:s.label}),o.jsx("span",{style:{fontSize:"8px",fontWeight:700,color:s.color,textTransform:"uppercase",letterSpacing:"0.05em"},children:s.kind})]});if(s.isContainer)return o.jsxs("div",{style:{width:"100%",height:"100%",boxSizing:"border-box",background:s.isMachine?"transparent":`${s.color}06`,borderTop:s.isMachine?"1.5px dashed #CBD5E1":`1.5px solid ${s.color}55`,borderRight:s.isMachine?"1.5px dashed #CBD5E1":`1.5px solid ${s.color}55`,borderBottom:s.isMachine?"1.5px dashed #CBD5E1":`1.5px solid ${s.color}55`,borderLeft:s.isMachine?"1.5px dashed #CBD5E1":`1.5px solid ${s.color}55`,borderRadius:14,boxShadow:t?rt.selected:"none",position:"relative"},children:[o.jsx(hn,{}),o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"10px 14px 0"},children:[s.onToggleCollapse&&!s.isMachine&&o.jsx(lr,{collapsed:!1,onToggle:s.onToggleCollapse,color:s.color}),s.onDrillIn&&!s.isMachine&&o.jsx(ar,{onDrillIn:s.onDrillIn,color:s.color,label:s.label}),o.jsx("span",{style:{fontSize:X.md,fontWeight:700,color:s.isMachine?"#334155":s.color,whiteSpace:"nowrap"},children:s.label}),o.jsx("span",{style:{fontSize:"8px",fontWeight:700,color:s.isMachine?"#94A3B8":`${s.color}AA`,textTransform:"uppercase",letterSpacing:"0.06em"},children:s.kind})]})]});const c=!!s.hasChildren;return o.jsxs("div",{onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),title:c?`${s.hiddenCount??0} substate${s.hiddenCount===1?"":"s"} hidden — double-click to drill in`:void 0,style:{width:"100%",height:"100%",boxSizing:"border-box",background:"#FFFFFF",borderTop:`3px solid ${s.color}`,borderRight:`1px solid ${r?`${s.color}9A`:"#CBD5E1"}`,borderBottom:`1px solid ${r?`${s.color}9A`:"#CBD5E1"}`,borderLeft:`1px solid ${r?`${s.color}9A`:"#CBD5E1"}`,borderRadius:12,boxShadow:t?rt.selected:r?"0 8px 20px rgba(15,23,42,0.12)":rt.md,transition:"box-shadow 150ms ease, border-color 150ms ease",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:2,padding:"4px 12px"},children:[o.jsx(hn,{}),o.jsx("span",{style:{fontSize:X.md,fontWeight:600,color:"#1a1a1a",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:"100%"},children:s.label}),s.subtitle&&o.jsx("span",{style:{fontSize:"8px",fontWeight:600,color:"#9CA3AF",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:"100%"},children:s.subtitle}),c&&o.jsxs("span",{style:{display:"flex",alignItems:"center",gap:5},children:[s.onToggleCollapse&&o.jsx(lr,{collapsed:!0,onToggle:s.onToggleCollapse,color:s.color}),s.onDrillIn&&o.jsx(ar,{onDrillIn:s.onDrillIn,color:s.color,label:s.label}),o.jsxs("span",{style:{fontSize:"8px",fontWeight:700,color:s.color,letterSpacing:"0.05em"},children:["⊞ ",s.hiddenCount??0]})]})]})}const Gc=u.memo(Vc),kn="#3498DB";function Uc({data:e}){const t=e;return o.jsxs("div",{style:{width:"100%",height:"100%",position:"relative",pointerEvents:"none"},children:[o.jsx("div",{style:{position:"absolute",top:0,left:"50%",transform:"translateX(-50%)",minWidth:140,maxWidth:"90%",padding:"10px 16px",background:"#FFFFFF",border:`1.5px solid ${kn}`,borderRadius:8,boxShadow:rt.md,textAlign:"center",fontSize:X.md,fontWeight:600,color:"#1a1a1a",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:t.label}),o.jsx("div",{style:{position:"absolute",top:44,bottom:0,left:"50%",borderLeft:`1.5px dashed ${kn}66`}})]})}const Xc=u.memo(Uc);function Kc({data:e}){const t=e;return o.jsx("div",{style:{width:"100%",height:"100%",boxSizing:"border-box",background:"#1B3A4B06",border:"1px solid #1B3A4B22",borderRadius:10,pointerEvents:"none"},children:o.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:8,padding:"8px 14px"},children:[o.jsx("span",{style:{fontSize:X.sm,fontWeight:700,color:"#1B3A4B"},children:t.label}),t.scenario&&o.jsxs("span",{style:{fontSize:X.xs,color:"#6B7280"},children:["realizes ",t.scenario]})]})})}const Yc=u.memo(Kc),Mo={width:6,height:6,border:"none",background:"transparent",opacity:0};function qc({data:e,selected:t}){const s=e;return o.jsxs("div",{style:{width:14,height:14,borderRadius:"50%",background:"#FFFFFF",border:`3px solid ${kn}`,boxShadow:t?rt.selected:rt.sm,position:"relative"},title:s.kind,children:[o.jsx(te,{type:"source",id:"right",position:K.Right,style:Mo}),o.jsx(te,{type:"target",id:"right",position:K.Right,style:Mo}),o.jsx(te,{type:"source",id:"left",position:K.Left,style:Mo}),o.jsx(te,{type:"target",id:"left",position:K.Left,style:Mo}),o.jsx("span",{style:{position:"absolute",top:-20,left:"50%",transform:"translateX(-50%)",fontSize:"9px",fontWeight:600,color:"#374151",whiteSpace:"nowrap",background:"#FFFFFFCC",padding:"1px 5px",borderRadius:4},children:s.label})]})}const Zc=u.memo(qc),$o={opacity:0,width:1,height:1},Jc=u.memo(function({data:t}){const s=t;return o.jsxs("div",{style:{width:"100%",height:"100%",display:"grid",placeItems:"center",textAlign:"center",padding:"12px 22px",border:`2px solid ${s.color??"#E67E22"}`,borderRadius:"50%",background:"#FFF9F2",color:"#2D3748",fontSize:13,fontWeight:600,lineHeight:1.25},children:[s.label,o.jsx(te,{type:"target",position:K.Left,style:$o}),o.jsx(te,{type:"source",position:K.Right,style:$o})]})}),Qc=u.memo(function({data:t}){const s=t,r=s.side==="right"?K.Left:K.Right;return o.jsxs("div",{style:{width:"100%",height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",color:"#334155",fontSize:12,fontWeight:600,textAlign:"center",gap:3},children:[o.jsx(qt,{color:s.color??"#334155"}),o.jsx("span",{children:s.label}),o.jsx(te,{type:"source",position:r,style:$o}),o.jsx(te,{type:"target",position:r,style:$o})]})}),ed=u.memo(function({data:t}){const s=t;return o.jsx("div",{style:{width:"100%",height:"100%",boxSizing:"border-box",border:"1.5px solid #64748B",background:"rgba(255,255,255,0.32)",padding:"10px 14px",color:"#475569",fontSize:12,fontWeight:700},children:s.label})});u.memo(function({data:t}){const s=t;return o.jsx("div",{style:{width:"100%",textAlign:"center",color:"#64748B",fontSize:11,fontWeight:700,letterSpacing:".03em"},children:s.label})});function td(e,t=0){if(e.length<2)return"";if(t===0||e.length===2)return`M ${e.map(i=>`${i.x},${i.y}`).join(" L ")}`;let s=`M ${e[0].x},${e[0].y}`;for(let i=1;i<e.length-1;i++){const c=e[i-1],a=e[i],p=e[i+1],b=Math.min(t,Math.abs(a.x-c.x)/2+Math.abs(a.y-c.y)/2),m=Math.min(t,Math.abs(p.x-a.x)/2+Math.abs(p.y-a.y)/2),j={x:a.x+Math.sign(c.x-a.x)*b,y:a.y+Math.sign(c.y-a.y)*b},F={x:a.x+Math.sign(p.x-a.x)*m,y:a.y+Math.sign(p.y-a.y)*m};s+=` L ${j.x},${j.y} Q ${a.x},${a.y} ${F.x},${F.y}`}const r=e[e.length-1];return`${s} L ${r.x},${r.y}`}const od=u.memo(function(t){var O,T,N,L,f;const s=jr(t.id,[t.source,t.target]),r=jn()&&!s,i=((O=t.data)==null?void 0:O.routing)??"rounded",c=Array.isArray((T=t.data)==null?void 0:T.points)?t.data.points:[],a=c.length>=2?c:[{x:t.sourceX,y:t.sourceY},{x:t.targetX,y:t.targetY}],b=i==="straight"?`M ${t.sourceX},${t.sourceY} L ${t.targetX},${t.targetY}`:td(a,i==="elbow"?0:i==="rounded"?16:i==="curved"?30:42),m=((N=t.data)==null?void 0:N.labelPoint)??a[Math.floor(a.length/2)]??{x:(t.sourceX+t.targetX)/2,y:(t.sourceY+t.targetY)/2},j=String(((L=t.style)==null?void 0:L.stroke)??"#64748B"),F=Number(((f=t.style)==null?void 0:f.strokeWidth)??1.5);return o.jsxs(o.Fragment,{children:[s&&o.jsx("path",{d:b,fill:"none",stroke:j,strokeOpacity:.22,strokeWidth:F+9,strokeLinecap:"round",pointerEvents:"none"}),o.jsx(kr,{path:b,style:s?{...t.style,strokeWidth:F+1.4}:t.style}),t.label&&o.jsx(yn,{children:o.jsx("div",{className:"nodrag nopan",style:{position:"absolute",transform:`translate(-50%, -50%) translate(${m.x}px,${m.y}px)`,background:"#FFFFFF",padding:"2px 5px",borderRadius:3,color:s?"#0F172A":"#334155",fontSize:12,pointerEvents:"all",fontWeight:s?700:void 0,opacity:r?.25:1},children:t.label})})]})}),To={opacity:0,width:1,height:1};function Xr({nodeId:e,selected:t,data:s}){return o.jsx(xt,{nodeId:e,isVisible:t,minWidth:s.minWidth??140,minHeight:s.minHeight??64,color:"#0F766E",lineStyle:{borderWidth:1},handleStyle:{width:10,height:10,borderRadius:2}})}function Kr(){return o.jsxs(o.Fragment,{children:[o.jsx(te,{type:"target",position:K.Left,style:To}),o.jsx(te,{type:"source",position:K.Right,style:To}),o.jsx(te,{type:"target",position:K.Top,style:To}),o.jsx(te,{type:"source",position:K.Bottom,style:To})]})}const nd=u.memo(function({id:t,data:s,selected:r}){const i=s;return o.jsxs("div",{style:{width:"100%",height:"100%",boxSizing:"border-box",display:"grid",placeItems:"center",padding:"14px 18px",textAlign:"center",border:"2px solid #0F766E",borderRadius:8,background:"#F0FDFA",color:"#134E4A",fontSize:15,fontWeight:700,lineHeight:1.25,boxShadow:"0 2px 7px rgba(15, 118, 110, 0.16)"},children:[o.jsx(Xr,{nodeId:t,selected:!!r,data:i}),o.jsxs("span",{children:[o.jsx("small",{style:{display:"block",marginBottom:5,color:"#0F766E",fontSize:10,letterSpacing:".08em"},children:"SYSTEM OF INTEREST"}),i.label]}),o.jsx(Kr,{})]})}),sd=u.memo(function({id:t,data:s,selected:r}){const i=s,c=i.category==="environment"?{border:"#7C3AED",fill:"#F5F3FF",text:"#4C1D95",tag:"ENVIRONMENT"}:i.category==="person"?{border:"#2563EB",fill:"#EFF6FF",text:"#1E3A8A",tag:"ACTOR"}:{border:"#64748B",fill:"#F8FAFC",text:"#334155",tag:"EXTERNAL SYSTEM"};return o.jsxs("div",{style:{width:"100%",height:"100%",boxSizing:"border-box",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:3,padding:"10px 14px",textAlign:"center",border:`1.5px solid ${c.border}`,borderRadius:7,background:c.fill,color:c.text,fontSize:13,fontWeight:650,lineHeight:1.25},children:[o.jsx(Xr,{nodeId:t,selected:!!r,data:i}),i.category==="person"&&o.jsx(qt,{size:26,color:c.border}),o.jsxs("span",{children:[o.jsx("small",{style:{display:"block",marginBottom:4,color:c.border,fontSize:9,letterSpacing:".07em"},children:c.tag}),i.label]}),o.jsx(Kr,{})]})}),rd=u.memo(function({id:t,data:s,selected:r}){const i=s;return o.jsxs("div",{style:{width:"100%",height:"100%",boxSizing:"border-box",border:"2px solid #0F766E",borderRadius:12,background:"rgba(240, 253, 250, 0.34)",padding:"12px 16px",color:"#0F766E",fontSize:12,fontWeight:750,letterSpacing:".04em"},children:[o.jsx(xt,{nodeId:t,isVisible:!!r,minWidth:i.minWidth??240,minHeight:i.minHeight??140,color:"#0F766E",lineStyle:{borderWidth:1},handleStyle:{width:10,height:10,borderRadius:2}}),i.label]})}),id=u.memo(function({id:t,data:s,selected:r}){var W;const i=s,[c,a]=u.useState(!1),[p,b]=u.useState(""),[m,j]=u.useState(!1),F=u.useRef(null),O=u.useCallback(()=>{b(i.label),a(!0),setTimeout(()=>{var A;(A=F.current)==null||A.select()},10)},[i.label]),T=u.useCallback(()=>{var _;a(!1);const A=p.trim();A&&A!==i.label&&((_=i.onInlineEdit)==null||_.call(i,t,A))},[p,i,t]),N=u.useCallback(A=>{A.key==="Enter"&&(A.preventDefault(),T()),A.key==="Escape"&&a(!1)},[T]),L=u.useCallback(A=>{var _;A.preventDefault(),(_=i.onContextMenu)==null||_.call(i,A,t)},[i,t]),f=i.bgColor??"#FFFFFF",S=i.color,w={background:S,border:"2px solid #FFFFFF",width:10,height:10,opacity:m||r?1:0,transition:"opacity 0.15s"};return o.jsxs("div",{onMouseEnter:()=>j(!0),onMouseLeave:()=>j(!1),onContextMenu:L,onDoubleClick:O,style:{minWidth:120,minHeight:40,background:f,borderLeft:`3px solid ${S}`,borderRadius:8,boxShadow:r?`0 0 0 2px ${S}, 0 4px 12px ${S}44`:m?"0 4px 16px rgba(0,0,0,0.14)":"0 1px 4px rgba(0,0,0,0.08)",cursor:c?"text":"default",position:"relative",transition:"box-shadow 0.15s",opacity:i.isNew?.7:1},children:[r&&o.jsx(xt,{minWidth:80,minHeight:36,maxWidth:600,maxHeight:400,color:S,lineStyle:{borderColor:S},handleStyle:{background:S,border:"2px solid #fff",width:10,height:10,borderRadius:2}}),o.jsxs("div",{style:{padding:"8px 12px",userSelect:"none",display:"flex",gap:8,alignItems:"center"},children:[En(i.kind)&&o.jsx(qt,{size:26,color:S}),o.jsxs("div",{style:{minWidth:0,flex:1},children:[o.jsx("div",{style:{fontSize:"9px",fontWeight:700,color:S,textTransform:"uppercase",letterSpacing:"0.06em",marginBottom:2},children:i.kind}),c?o.jsx("input",{ref:F,value:p,onChange:A=>b(A.target.value),onBlur:T,onKeyDown:N,onClick:A=>A.stopPropagation(),autoFocus:!0,style:{fontSize:X.sm,fontWeight:500,color:"#1a1a1a",background:"transparent",border:"none",outline:"none",width:"100%",padding:0}}):o.jsx("div",{style:{fontSize:X.sm,fontWeight:500,color:"#1a1a1a",lineHeight:1.3,wordBreak:"break-word"},children:i.label||i.kind}),i.isNew&&o.jsx("div",{style:{fontSize:"9px",color:"#9CA3AF",marginTop:2},children:"saving…"})]})]}),!!((W=i.compartments)!=null&&W.length)&&o.jsx("div",{style:{borderTop:"1px solid #EDEDEA",padding:"5px 12px 7px",userSelect:"none"},children:i.compartments.map(A=>o.jsxs("div",{style:{display:"flex",gap:6,alignItems:"baseline",fontSize:"10px",lineHeight:"15px",whiteSpace:"nowrap",overflow:"hidden"},children:[o.jsx("span",{style:{color:"#9CA3AF"},children:A.key}),o.jsx("span",{style:{color:"#4B5563",fontWeight:500,overflow:"hidden",textOverflow:"ellipsis"},children:A.value})]},A.key))}),o.jsx(te,{type:"target",position:K.Top,style:{...w,top:-5}}),o.jsx(te,{type:"source",position:K.Bottom,style:{...w,bottom:-5},id:"bottom"}),o.jsx(te,{type:"source",position:K.Right,style:{...w,right:-5},id:"right"}),o.jsx(te,{type:"target",position:K.Left,style:{...w,left:-5}})]})}),Yr="application/memo-kind";function mn({collapsed:e,onToggleCollapse:t,elementIds:s=[],eligibleKinds:r}){const i=ne(f=>f.model),c=ne(f=>f.selectedElementId),a=ne(f=>f.inspectElement),[p,b]=u.useState(""),[m,j]=u.useState(new Set),[F,O]=u.useState(!0),T=u.useMemo(()=>{if(!(r!=null&&r.size))return[];const f=p.trim().toLowerCase();return Fr(i).kinds.filter(S=>r.has(S.name)&&!S.isAbstract).filter(S=>!f||S.name.toLowerCase().includes(f)||(S.label??"").toLowerCase().includes(f)).map(S=>({name:S.name,label:S.label||S.name,layer:S.layer??"",construct:wl(S.construct)})).sort((S,w)=>S.label.localeCompare(w.label))},[i,r,p]),N=u.useMemo(()=>{var W;if(!i)return[];const f=p.trim().toLowerCase(),S=new Map,w=new Set(s);for(const A of s){const _=(W=i.elements[A])==null?void 0:W.allocatedTo;_&&w.add(_)}for(const A of w){const _=i.elements[A];_&&(f&&!_.name.toLowerCase().includes(f)&&!_.kind.toLowerCase().includes(f)||(S.has(_.kind)||S.set(_.kind,[]),S.get(_.kind).push(_)))}return[...S.entries()].map(([A,_])=>({kind:A,elements:_.sort((D,Y)=>D.name.localeCompare(Y.name))})).sort((A,_)=>A.kind.localeCompare(_.kind))},[i,s,p]),L=f=>j(S=>{const w=new Set(S);return w.has(f)?w.delete(f):w.add(f),w});return e?null:o.jsxs("div",{className:"flex flex-col overflow-hidden",style:{width:240,borderRight:"1px solid #E5E5E0",background:"#FAFAF8",flexShrink:0},children:[o.jsxs("div",{className:"flex items-center justify-between px-3 py-2",style:{background:"#F0F0ED",borderBottom:"1px solid #E5E5E0",flexShrink:0},children:[o.jsx("span",{style:{fontSize:X.xs,fontWeight:600,color:"#374151"},children:"Diagram Elements"}),o.jsx("button",{onClick:t,title:"Hide Diagram Elements","aria-label":"Hide Diagram Elements",style:{width:28,height:28,display:"flex",alignItems:"center",justifyContent:"center",background:"#FFFFFF",border:"1px solid #E5E5E0",borderRadius:5,cursor:"pointer",color:"#6B7280",fontSize:20,lineHeight:1},children:"×"})]}),o.jsx("div",{className:"px-2 pt-2 pb-1",style:{flexShrink:0},children:o.jsx("input",{value:p,onChange:f=>b(f.target.value),placeholder:"Search elements…",className:"w-full px-2 py-1 rounded focus:outline-none",style:{fontSize:X.xs,background:"#F0F0ED",border:"1px solid #E5E5E0",color:"#374151"}})}),o.jsxs("div",{className:"flex-1 overflow-y-auto py-1",children:[T.length>0&&o.jsxs("div",{style:{borderBottom:"1px solid #E5E5E0",paddingBottom:4,marginBottom:4},children:[o.jsxs("button",{onClick:()=>O(f=>!f),className:"w-full flex items-center gap-1.5 px-2 py-1",style:{background:"none",border:"none",cursor:"pointer",textAlign:"left"},children:[o.jsx("span",{style:{fontSize:10,color:"#6B7280"},children:F?"▼":"▶"}),o.jsx("span",{style:{fontSize:10,color:"#374151",fontWeight:700,letterSpacing:"0.04em"},children:"SHAPES"}),o.jsx("span",{style:{fontSize:9,color:"#9CA3AF",marginLeft:"auto"},children:T.length})]}),F&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"px-3 pb-1",style:{fontSize:9,color:"#9CA3AF"},children:"Drag onto the canvas to create"}),T.map(f=>{const S=wn[f.layer]??"#6B7280";return o.jsxs("div",{draggable:!0,onDragStart:w=>{w.dataTransfer.setData(Yr,JSON.stringify({kind:f.name,layer:f.layer,construct:f.construct})),w.dataTransfer.effectAllowed="copy"},title:`Drag to create a ${f.label} (${f.construct})`,className:"flex items-center gap-2 px-3 py-1.5",style:{cursor:"grab",fontSize:X.xs,color:"#374151"},children:[o.jsx("span",{style:{width:12,height:12,flexShrink:0,borderRadius:f.construct==="port"?2:3,border:`2px solid ${S}`,background:f.construct==="port"?"#FFFFFF":`${S}22`}}),o.jsx("span",{className:"truncate flex-1",children:f.label})]},f.name)})]})]}),N.map(f=>{var W;const S=m.has(f.kind),w=wn[(W=f.elements[0])==null?void 0:W.layer]??"#6B7280";return o.jsxs("div",{children:[o.jsxs("button",{onClick:()=>L(f.kind),className:"w-full flex items-center gap-1.5 px-2 py-1",style:{background:"none",border:"none",cursor:"pointer",textAlign:"left"},children:[o.jsx("span",{style:{fontSize:10,color:w},children:S?"▶":"▼"}),o.jsx("span",{className:"truncate",style:{fontSize:10,color:w,fontWeight:700},children:f.kind}),o.jsx("span",{style:{fontSize:9,color:"#9CA3AF",marginLeft:"auto"},children:f.elements.length})]}),!S&&f.elements.map(A=>{const _=c===A.id;return o.jsxs("button",{onClick:()=>a(A.id),className:"w-full flex items-center gap-2 px-3 py-1.5 text-left",style:{border:"none",cursor:"pointer",fontSize:X.xs,background:_?"#DDF7EF":"transparent",color:_?"#116149":"#374151",fontWeight:_?600:400},title:`Highlight ${A.name} in diagram`,children:[o.jsx("span",{style:{width:8,height:8,borderRadius:2,background:w,flexShrink:0}}),o.jsx("span",{className:"truncate flex-1",children:A.name})]},A.id)})]},f.kind)}),N.length===0&&o.jsx("div",{className:"p-3 text-center",style:{color:"#9CA3AF",fontSize:X.xs},children:p?"No matching elements":"No elements in this diagram"})]})]})}function De({label:e,icon:t,danger:s,onClick:r}){return o.jsxs("button",{onClick:r,className:"w-full flex items-center gap-2 px-3 py-1.5 text-left",style:{background:"none",border:"none",cursor:"pointer",fontSize:X.xs},onMouseEnter:i=>{i.currentTarget.style.background=s?"#FEF2F2":"#F7F7F5"},onMouseLeave:i=>{i.currentTarget.style.background="none"},children:[t&&o.jsx("span",{style:{fontSize:"12px",width:16,textAlign:"center"},children:t}),o.jsx("span",{style:{color:s?"#DC2626":"#1a1a1a"},children:e})]})}function Bo(){return o.jsx("div",{style:{height:1,background:"#E5E5E0",margin:"2px 0"}})}function qr({x:e,y:t,onClose:s,children:r}){const i=u.useRef(null);u.useEffect(()=>{const b=j=>{i.current&&!i.current.contains(j.target)&&s()},m=j=>{j.key==="Escape"&&s()};return document.addEventListener("mousedown",b),document.addEventListener("keydown",m),()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",m)}},[s]);const c=210,a=Math.min(e,window.innerWidth-c-8),p=Math.min(t,window.innerHeight-200);return o.jsx("div",{ref:i,className:"fixed z-50 rounded-xl overflow-hidden py-1",style:{left:a,top:p,minWidth:c,background:"#FFFFFF",border:"1px solid #E5E5E0",boxShadow:"0 8px 32px rgba(0,0,0,0.14)"},children:r})}const ad=[{label:"Layer default",value:""},{label:"Mint",value:"#E8F5E9"},{label:"Sky",value:"#E3F2FD"},{label:"Amber",value:"#FFF8E1"},{label:"Rose",value:"#FFF0F0"},{label:"Lavender",value:"#F3E5F5"},{label:"Peach",value:"#FBE9E7"}];function ld({x:e,y:t,nodeId:s,nodeKind:r,onClose:i,onEditName:c,onChangeColor:a,onRemoveFromDiagram:p,onDeleteFromModel:b,onLinkRisk:m,onLinkRequirement:j,onShowProperties:F,onFocusElement:O,onShowInCatalog:T,onShowRelMatrix:N,onOpenSource:L,onViewKindInOntology:f}){const[S,w]=u.useState(!1);return o.jsxs(qr,{x:e,y:t,onClose:i,children:[o.jsxs("div",{className:"px-3 py-1.5",style:{borderBottom:"1px solid #E5E5E0"},children:[o.jsx("div",{style:{fontSize:"10px",fontWeight:600,color:"#9CA3AF"},children:r}),o.jsx("div",{style:{fontSize:"9px",color:"#D1D5DB",fontFamily:"monospace"},children:s})]}),F&&o.jsx(De,{label:"Show Properties",icon:"ℹ",onClick:()=>{i(),F()}}),T&&o.jsx(De,{label:"Show in Catalog",icon:"☰",onClick:()=>{i(),T()}}),O&&o.jsx(De,{label:"Focus on Element",icon:"◎",onClick:()=>{i(),O()}}),N&&o.jsx(De,{label:"Show Relationship Matrix",icon:"☷",onClick:()=>{i(),N()}}),f&&o.jsx(De,{label:"View Kind in Ontology",icon:"⬡",onClick:()=>{i(),f()}}),L&&o.jsx(De,{label:"Open Source File",icon:"⟨/⟩",onClick:()=>{i(),L()}}),(F||T||O||N||f||L)&&o.jsx(Bo,{}),o.jsx(De,{label:"Edit name",icon:"✏️",onClick:()=>{i(),c()}}),o.jsxs("div",{className:"relative",children:[o.jsxs("button",{className:"w-full flex items-center gap-2 px-3 py-1.5",style:{background:"none",border:"none",cursor:"pointer",fontSize:X.xs},onMouseEnter:W=>{w(!0),W.currentTarget.style.background="#F7F7F5"},onMouseLeave:W=>{W.currentTarget.style.background="none"},children:[o.jsx("span",{style:{fontSize:"12px",width:16,textAlign:"center"},children:"🎨"}),o.jsx("span",{style:{flex:1,textAlign:"left",color:"#1a1a1a"},children:"Change color"}),o.jsx("span",{style:{color:"#9CA3AF",fontSize:"10px"},children:"▶"})]}),S&&o.jsx("div",{className:"absolute left-full top-0 rounded-xl overflow-hidden py-1",style:{background:"#FFFFFF",border:"1px solid #E5E5E0",boxShadow:"0 4px 16px rgba(0,0,0,0.12)",minWidth:160},onMouseEnter:()=>w(!0),onMouseLeave:()=>w(!1),children:ad.map(W=>o.jsxs("button",{onClick:()=>{i(),a(W.value)},className:"w-full flex items-center gap-2.5 px-3 py-1.5",style:{background:"none",border:"none",cursor:"pointer"},onMouseEnter:A=>{A.currentTarget.style.background="#F7F7F5"},onMouseLeave:A=>{A.currentTarget.style.background="none"},children:[o.jsx("div",{style:{width:14,height:14,borderRadius:3,flexShrink:0,background:W.value||"#E5E5E0",border:"1px solid #D1D5DB"}}),o.jsx("span",{style:{fontSize:X.xs,color:"#374151"},children:W.label})]},W.value))})]}),o.jsx(Bo,{}),m&&o.jsx(De,{label:"Link Risk",icon:"⚠️",onClick:()=>{i(),m()}}),j&&o.jsx(De,{label:"Link Requirement",icon:"📋",onClick:()=>{i(),j()}}),(m||j)&&o.jsx(Bo,{}),o.jsx(De,{label:"Remove from diagram",icon:"↩️",onClick:()=>{i(),p()}}),o.jsx(De,{label:"Delete from model",icon:"🗑️",danger:!0,onClick:()=>{window.confirm(`Delete ${s} from the model? This cannot be undone.`)&&(i(),b())}})]})}const cd=[{label:"Auto",value:""},{label:"Red",value:"#EF4444"},{label:"Blue",value:"#3B82F6"},{label:"Green",value:"#10B981"},{label:"Orange",value:"#F59E0B"},{label:"Gray",value:"#6B7280"}];function dd({x:e,y:t,edgeId:s,relType:r,onClose:i,onChangeStyle:c,onChangeColor:a,onToggleLabel:p,onDelete:b}){return o.jsxs(qr,{x:e,y:t,onClose:i,children:[o.jsxs("div",{className:"px-3 py-1.5",style:{borderBottom:"1px solid #E5E5E0"},children:[o.jsx("div",{style:{fontSize:"10px",fontWeight:600,color:"#9CA3AF"},children:r}),o.jsx("div",{style:{fontSize:"9px",color:"#D1D5DB",fontFamily:"monospace"},children:s})]}),o.jsxs("div",{className:"px-3 py-1.5 flex items-center gap-2",children:[o.jsx("span",{style:{fontSize:"10px",color:"#9CA3AF",minWidth:40},children:"Style"}),["solid","dashed","dotted"].map(m=>o.jsx("button",{onClick:()=>{i(),c(m)},style:{fontSize:"10px",padding:"2px 8px",border:"1px solid #E5E5E0",borderRadius:4,cursor:"pointer",background:"#F7F7F5",color:"#374151"},children:m},m))]}),o.jsxs("div",{className:"px-3 py-1.5 flex items-center gap-1.5 flex-wrap",children:[o.jsx("span",{style:{fontSize:"10px",color:"#9CA3AF",minWidth:40,flexShrink:0},children:"Color"}),cd.map(m=>o.jsx("button",{onClick:()=>{i(),a(m.value)},title:m.label,style:{width:16,height:16,borderRadius:"50%",background:m.value||"#E5E5E0",border:"1px solid #D1D5DB",cursor:"pointer"}},m.value))]}),o.jsx(Bo,{}),o.jsx(De,{label:"Toggle label",icon:"🏷️",onClick:()=>{i(),p()}}),o.jsx(De,{label:"Delete edge",icon:"🗑️",danger:!0,onClick:()=>{i(),b()}})]})}const ud=u.memo(function({id:t,data:s,selected:r}){const i=s,c=i.color??i.layerColor??"#E67E22",a=80,p=u.useCallback(b=>{var m;b.preventDefault(),(m=i.onContextMenu)==null||m.call(i,b,t)},[i,t]);return o.jsxs("div",{style:{width:a,height:a,position:"relative"},onContextMenu:p,children:[r&&o.jsx(xt,{minWidth:60,minHeight:60}),o.jsx("svg",{width:a,height:a,style:{position:"absolute",top:0,left:0},children:o.jsx("polygon",{points:`${a/2},4 ${a-4},${a/2} ${a/2},${a-4} 4,${a/2}`,fill:i.color?i.color+"44":"#FFF8E1",stroke:c,strokeWidth:r?2.5:1.5})}),o.jsx("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",fontSize:"10px",fontWeight:600,color:"#374151",textAlign:"center",padding:"4px 8px",pointerEvents:"none"},children:i.condition||i.label||"?"}),o.jsx(te,{type:"target",position:K.Top,style:{background:c,border:"2px solid #fff"}}),o.jsx(te,{type:"source",position:K.Right,style:{background:c,border:"2px solid #fff"},id:"right"}),o.jsx(te,{type:"source",position:K.Bottom,style:{background:c,border:"2px solid #fff"},id:"bottom"}),o.jsx(te,{type:"target",position:K.Left,style:{background:c,border:"2px solid #fff"}})]})}),pd=u.memo(function({id:t,data:s,selected:r}){const i=s,c=(i.orientation??"horizontal")==="horizontal",a=c?120:8,p=c?8:60,b=u.useCallback(m=>{var j;m.preventDefault(),(j=i.onContextMenu)==null||j.call(i,m,t)},[i,t]);return o.jsxs("div",{style:{width:a,height:p,background:"#1a1a1a",borderRadius:4,position:"relative"},title:i.nodeType==="join"?"Join (synchronization)":"Fork (parallel)",onContextMenu:b,children:[r&&o.jsx(xt,{minWidth:40,minHeight:6}),c?o.jsxs(o.Fragment,{children:[o.jsx(te,{type:"target",position:K.Left,style:{background:"#2DD4A8",border:"2px solid #fff",left:-1}}),o.jsx(te,{type:"source",position:K.Top,style:{background:"#2DD4A8",border:"2px solid #fff",top:-1},id:"top"}),o.jsx(te,{type:"source",position:K.Bottom,style:{background:"#2DD4A8",border:"2px solid #fff",bottom:-1},id:"bottom"}),o.jsx(te,{type:"source",position:K.Right,style:{background:"#2DD4A8",border:"2px solid #fff",right:-1},id:"right"})]}):o.jsxs(o.Fragment,{children:[o.jsx(te,{type:"target",position:K.Top,style:{background:"#2DD4A8",border:"2px solid #fff",top:-1}}),o.jsx(te,{type:"source",position:K.Left,style:{background:"#2DD4A8",border:"2px solid #fff",left:-1},id:"left"}),o.jsx(te,{type:"source",position:K.Right,style:{background:"#2DD4A8",border:"2px solid #fff",right:-1},id:"right"}),o.jsx(te,{type:"source",position:K.Bottom,style:{background:"#2DD4A8",border:"2px solid #fff",bottom:-1},id:"bottom"})]})]})}),hd=u.memo(function({id:t,data:s}){const r=s,i=r.nodeType==="start",c=32,a=u.useCallback(p=>{var b;p.preventDefault(),(b=r.onContextMenu)==null||b.call(r,p,t)},[r,t]);return o.jsxs("div",{style:{width:c,height:c,position:"relative"},onContextMenu:a,children:[o.jsx("svg",{width:c,height:c,children:i?o.jsx("circle",{cx:c/2,cy:c/2,r:c/2-2,fill:"#1a1a1a"}):o.jsxs(o.Fragment,{children:[o.jsx("circle",{cx:c/2,cy:c/2,r:c/2-2,fill:"#1a1a1a"}),o.jsx("circle",{cx:c/2,cy:c/2,r:c/2-6,fill:"#FFFFFF"}),o.jsx("circle",{cx:c/2,cy:c/2,r:c/2-10,fill:"#1a1a1a"})]})}),i?o.jsx(te,{type:"source",position:K.Bottom,style:{background:"#1a1a1a",border:"2px solid #fff"}}):o.jsx(te,{type:"target",position:K.Top,style:{background:"#1a1a1a",border:"2px solid #fff"}})]})}),md=["grid","route","export","autoLayout"],fd={actionflow:["expandCollapse","flowSwimlanes","flowHierarchy","flowNesting","flowDirection","flowLegend","flowFilters"],interconnection:["expandCollapse","interconnectionPorts","interconnectionConnections"],statetransition:["expandCollapse"],general:["expandCollapse","generalMode","useCaseOptions"]};function gd(e){return new Set([...md,...e?fd[e]??[]:[]])}function xd(e,t){if(e.match(/^[a-z]+:\/\//i))return e;if(e.match(/^\/\//))return window.location.protocol+e;if(e.match(/^[a-z]+:/i))return e;const s=document.implementation.createHTMLDocument(),r=s.createElement("base"),i=s.createElement("a");return s.head.appendChild(r),s.body.appendChild(i),t&&(r.href=t),i.href=e,i.href}const bd=(()=>{let e=0;const t=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(e+=1,`u${t()}${e}`)})();function it(e){const t=[];for(let s=0,r=e.length;s<r;s++)t.push(e[s]);return t}let Et=null;function Zr(e={}){return Et||(e.includeStyleProperties?(Et=e.includeStyleProperties,Et):(Et=it(window.getComputedStyle(document.documentElement)),Et))}function Oo(e,t){const r=(e.ownerDocument.defaultView||window).getComputedStyle(e).getPropertyValue(t);return r?parseFloat(r.replace("px","")):0}function yd(e){const t=Oo(e,"border-left-width"),s=Oo(e,"border-right-width");return e.clientWidth+t+s}function wd(e){const t=Oo(e,"border-top-width"),s=Oo(e,"border-bottom-width");return e.clientHeight+t+s}function vd(e,t={}){const s=t.width||yd(e),r=t.height||wd(e);return{width:s,height:r}}function Fn(e){return new Promise((t,s)=>{const r=new Image;r.onload=()=>{r.decode().then(()=>{requestAnimationFrame(()=>t(r))})},r.onerror=s,r.crossOrigin="anonymous",r.decoding="async",r.src=e})}async function kd(e){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(e)).then(encodeURIComponent).then(t=>`data:image/svg+xml;charset=utf-8,${t}`)}async function Fd(e,t,s){const r="http://www.w3.org/2000/svg",i=document.createElementNS(r,"svg"),c=document.createElementNS(r,"foreignObject");return i.setAttribute("width",`${t}`),i.setAttribute("height",`${s}`),i.setAttribute("viewBox",`0 0 ${t} ${s}`),c.setAttribute("width","100%"),c.setAttribute("height","100%"),c.setAttribute("x","0"),c.setAttribute("y","0"),c.setAttribute("externalResourcesRequired","true"),i.appendChild(c),c.appendChild(e),kd(i)}const Te=(e,t)=>{if(e instanceof t)return!0;const s=Object.getPrototypeOf(e);return s===null?!1:s.constructor.name===t.name||Te(s,t)};function Cd(e){const t=e.getPropertyValue("content");return`${e.cssText} content: '${t.replace(/'|"/g,"")}';`}function Sd(e,t){return Zr(t).map(s=>{const r=e.getPropertyValue(s),i=e.getPropertyPriority(s);return`${s}: ${r}${i?" !important":""};`}).join(" ")}function jd(e,t,s,r){const i=`.${e}:${t}`,c=s.cssText?Cd(s):Sd(s,r);return document.createTextNode(`${i}{${c}}`)}function cr(e,t,s,r){const i=window.getComputedStyle(e,s),c=i.getPropertyValue("content");if(c===""||c==="none")return;const a=bd();try{t.className=`${t.className} ${a}`}catch{return}const p=document.createElement("style");p.appendChild(jd(a,s,i,r)),t.appendChild(p)}function Ed(e,t,s){cr(e,t,":before",s),cr(e,t,":after",s)}const dr="application/font-woff",ur="image/jpeg",Id={woff:dr,woff2:dr,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:ur,jpeg:ur,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function Ad(e){const t=/\.([^./]*?)$/g.exec(e);return t?t[1]:""}function Rn(e){const t=Ad(e).toLowerCase();return Id[t]||""}function Rd(e){return e.split(/,/)[1]}function Cn(e){return e.search(/^(data:)/)!==-1}function zd(e,t){return`data:${t};base64,${e}`}async function Jr(e,t,s){const r=await fetch(e,t);if(r.status===404)throw new Error(`Resource "${r.url}" not found`);const i=await r.blob();return new Promise((c,a)=>{const p=new FileReader;p.onerror=a,p.onloadend=()=>{try{c(s({res:r,result:p.result}))}catch(b){a(b)}},p.readAsDataURL(i)})}const fn={};function Md(e,t,s){let r=e.replace(/\?.*/,"");return s&&(r=e),/ttf|otf|eot|woff2?/i.test(r)&&(r=r.replace(/.*\//,"")),t?`[${t}]${r}`:r}async function zn(e,t,s){const r=Md(e,t,s.includeQueryParams);if(fn[r]!=null)return fn[r];s.cacheBust&&(e+=(/\?/.test(e)?"&":"?")+new Date().getTime());let i;try{const c=await Jr(e,s.fetchRequestInit,({res:a,result:p})=>(t||(t=a.headers.get("Content-Type")||""),Rd(p)));i=zd(c,t)}catch(c){i=s.imagePlaceholder||"";let a=`Failed to fetch resource: ${e}`;c&&(a=typeof c=="string"?c:c.message),a&&console.warn(a)}return fn[r]=i,i}async function Td(e){const t=e.toDataURL();return t==="data:,"?e.cloneNode(!1):Fn(t)}async function Dd(e,t){if(e.currentSrc){const c=document.createElement("canvas"),a=c.getContext("2d");c.width=e.clientWidth,c.height=e.clientHeight,a==null||a.drawImage(e,0,0,c.width,c.height);const p=c.toDataURL();return Fn(p)}const s=e.poster,r=Rn(s),i=await zn(s,r,t);return Fn(i)}async function Nd(e,t){var s;try{if(!((s=e==null?void 0:e.contentDocument)===null||s===void 0)&&s.body)return await Wo(e.contentDocument.body,t,!0)}catch{}return e.cloneNode(!1)}async function Ld(e,t){return Te(e,HTMLCanvasElement)?Td(e):Te(e,HTMLVideoElement)?Dd(e,t):Te(e,HTMLIFrameElement)?Nd(e,t):e.cloneNode(Qr(e))}const Bd=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SLOT",Qr=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SVG";async function Pd(e,t,s){var r,i;if(Qr(t))return t;let c=[];return Bd(e)&&e.assignedNodes?c=it(e.assignedNodes()):Te(e,HTMLIFrameElement)&&(!((r=e.contentDocument)===null||r===void 0)&&r.body)?c=it(e.contentDocument.body.childNodes):c=it(((i=e.shadowRoot)!==null&&i!==void 0?i:e).childNodes),c.length===0||Te(e,HTMLVideoElement)||await c.reduce((a,p)=>a.then(()=>Wo(p,s)).then(b=>{b&&t.appendChild(b)}),Promise.resolve()),t}function $d(e,t,s){const r=t.style;if(!r)return;const i=window.getComputedStyle(e);i.cssText?(r.cssText=i.cssText,r.transformOrigin=i.transformOrigin):Zr(s).forEach(c=>{let a=i.getPropertyValue(c);c==="font-size"&&a.endsWith("px")&&(a=`${Math.floor(parseFloat(a.substring(0,a.length-2)))-.1}px`),Te(e,HTMLIFrameElement)&&c==="display"&&a==="inline"&&(a="block"),c==="d"&&t.getAttribute("d")&&(a=`path(${t.getAttribute("d")})`),r.setProperty(c,a,i.getPropertyPriority(c))})}function Od(e,t){Te(e,HTMLTextAreaElement)&&(t.innerHTML=e.value),Te(e,HTMLInputElement)&&t.setAttribute("value",e.value)}function Wd(e,t){if(Te(e,HTMLSelectElement)){const r=Array.from(t.children).find(i=>e.value===i.getAttribute("value"));r&&r.setAttribute("selected","")}}function _d(e,t,s){return Te(t,Element)&&($d(e,t,s),Ed(e,t,s),Od(e,t),Wd(e,t)),t}async function Hd(e,t){const s=e.querySelectorAll?e.querySelectorAll("use"):[];if(s.length===0)return e;const r={};for(let c=0;c<s.length;c++){const p=s[c].getAttribute("xlink:href");if(p){const b=e.querySelector(p),m=document.querySelector(p);!b&&m&&!r[p]&&(r[p]=await Wo(m,t,!0))}}const i=Object.values(r);if(i.length){const c="http://www.w3.org/1999/xhtml",a=document.createElementNS(c,"svg");a.setAttribute("xmlns",c),a.style.position="absolute",a.style.width="0",a.style.height="0",a.style.overflow="hidden",a.style.display="none";const p=document.createElementNS(c,"defs");a.appendChild(p);for(let b=0;b<i.length;b++)p.appendChild(i[b]);e.appendChild(a)}return e}async function Wo(e,t,s){return!s&&t.filter&&!t.filter(e)?null:Promise.resolve(e).then(r=>Ld(r,t)).then(r=>Pd(e,r,t)).then(r=>_d(e,r,t)).then(r=>Hd(r,t))}const ei=/url\((['"]?)([^'"]+?)\1\)/g,Vd=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,Gd=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function Ud(e){const t=e.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,"g")}function Xd(e){const t=[];return e.replace(ei,(s,r,i)=>(t.push(i),s)),t.filter(s=>!Cn(s))}async function Kd(e,t,s,r,i){try{const c=s?xd(t,s):t,a=Rn(t);let p;return i||(p=await zn(c,a,r)),e.replace(Ud(t),`$1${p}$3`)}catch{}return e}function Yd(e,{preferredFontFormat:t}){return t?e.replace(Gd,s=>{for(;;){const[r,,i]=Vd.exec(s)||[];if(!i)return"";if(i===t)return`src: ${r};`}}):e}function ti(e){return e.search(ei)!==-1}async function oi(e,t,s){if(!ti(e))return e;const r=Yd(e,s);return Xd(r).reduce((c,a)=>c.then(p=>Kd(p,a,t,s)),Promise.resolve(r))}async function It(e,t,s){var r;const i=(r=t.style)===null||r===void 0?void 0:r.getPropertyValue(e);if(i){const c=await oi(i,null,s);return t.style.setProperty(e,c,t.style.getPropertyPriority(e)),!0}return!1}async function qd(e,t){await It("background",e,t)||await It("background-image",e,t),await It("mask",e,t)||await It("-webkit-mask",e,t)||await It("mask-image",e,t)||await It("-webkit-mask-image",e,t)}async function Zd(e,t){const s=Te(e,HTMLImageElement);if(!(s&&!Cn(e.src))&&!(Te(e,SVGImageElement)&&!Cn(e.href.baseVal)))return;const r=s?e.src:e.href.baseVal,i=await zn(r,Rn(r),t);await new Promise((c,a)=>{e.onload=c,e.onerror=t.onImageErrorHandler?(...b)=>{try{c(t.onImageErrorHandler(...b))}catch(m){a(m)}}:a;const p=e;p.decode&&(p.decode=c),p.loading==="lazy"&&(p.loading="eager"),s?(e.srcset="",e.src=i):e.href.baseVal=i})}async function Jd(e,t){const r=it(e.childNodes).map(i=>ni(i,t));await Promise.all(r).then(()=>e)}async function ni(e,t){Te(e,Element)&&(await qd(e,t),await Zd(e,t),await Jd(e,t))}function Qd(e,t){const{style:s}=e;t.backgroundColor&&(s.backgroundColor=t.backgroundColor),t.width&&(s.width=`${t.width}px`),t.height&&(s.height=`${t.height}px`);const r=t.style;return r!=null&&Object.keys(r).forEach(i=>{s[i]=r[i]}),e}const pr={};async function hr(e){let t=pr[e];if(t!=null)return t;const r=await(await fetch(e)).text();return t={url:e,cssText:r},pr[e]=t,t}async function mr(e,t){let s=e.cssText;const r=/url\(["']?([^"')]+)["']?\)/g,c=(s.match(/url\([^)]+\)/g)||[]).map(async a=>{let p=a.replace(r,"$1");return p.startsWith("https://")||(p=new URL(p,e.url).href),Jr(p,t.fetchRequestInit,({result:b})=>(s=s.replace(a,`url(${b})`),[a,b]))});return Promise.all(c).then(()=>s)}function fr(e){if(e==null)return[];const t=[],s=/(\/\*[\s\S]*?\*\/)/gi;let r=e.replace(s,"");const i=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})","gi");for(;;){const b=i.exec(r);if(b===null)break;t.push(b[0])}r=r.replace(i,"");const c=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,a="((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})",p=new RegExp(a,"gi");for(;;){let b=c.exec(r);if(b===null){if(b=p.exec(r),b===null)break;c.lastIndex=p.lastIndex}else p.lastIndex=c.lastIndex;t.push(b[0])}return t}async function eu(e,t){const s=[],r=[];return e.forEach(i=>{if("cssRules"in i)try{it(i.cssRules||[]).forEach((c,a)=>{if(c.type===CSSRule.IMPORT_RULE){let p=a+1;const b=c.href,m=hr(b).then(j=>mr(j,t)).then(j=>fr(j).forEach(F=>{try{i.insertRule(F,F.startsWith("@import")?p+=1:i.cssRules.length)}catch(O){console.error("Error inserting rule from remote css",{rule:F,error:O})}})).catch(j=>{console.error("Error loading remote css",j.toString())});r.push(m)}})}catch(c){const a=e.find(p=>p.href==null)||document.styleSheets[0];i.href!=null&&r.push(hr(i.href).then(p=>mr(p,t)).then(p=>fr(p).forEach(b=>{a.insertRule(b,a.cssRules.length)})).catch(p=>{console.error("Error loading remote stylesheet",p)})),console.error("Error inlining remote css file",c)}}),Promise.all(r).then(()=>(e.forEach(i=>{if("cssRules"in i)try{it(i.cssRules||[]).forEach(c=>{s.push(c)})}catch(c){console.error(`Error while reading CSS rules from ${i.href}`,c)}}),s))}function tu(e){return e.filter(t=>t.type===CSSRule.FONT_FACE_RULE).filter(t=>ti(t.style.getPropertyValue("src")))}async function ou(e,t){if(e.ownerDocument==null)throw new Error("Provided element is not within a Document");const s=it(e.ownerDocument.styleSheets),r=await eu(s,t);return tu(r)}function si(e){return e.trim().replace(/["']/g,"")}function nu(e){const t=new Set;function s(r){(r.style.fontFamily||getComputedStyle(r).fontFamily).split(",").forEach(c=>{t.add(si(c))}),Array.from(r.children).forEach(c=>{c instanceof HTMLElement&&s(c)})}return s(e),t}async function su(e,t){const s=await ou(e,t),r=nu(e);return(await Promise.all(s.filter(c=>r.has(si(c.style.fontFamily))).map(c=>{const a=c.parentStyleSheet?c.parentStyleSheet.href:null;return oi(c.cssText,a,t)}))).join(`
|
|
4
|
+
`)}async function ru(e,t){const s=t.fontEmbedCSS!=null?t.fontEmbedCSS:t.skipFonts?null:await su(e,t);if(s){const r=document.createElement("style"),i=document.createTextNode(s);r.appendChild(i),e.firstChild?e.insertBefore(r,e.firstChild):e.appendChild(r)}}async function iu(e,t={}){const{width:s,height:r}=vd(e,t),i=await Wo(e,t,!0);return await ru(i,t),await ni(i,t),Qd(i,t),await Fd(i,s,r)}const ri="#FFFFFF",Do=24,au=2;function lu(e){const t=/translate\(\s*(-?[\d.]+)px[,\s]+(-?[\d.]+)px/.exec(e.style.transform);return t?[Number(t[1]),Number(t[2])]:[0,0]}function cu(e){const t=[...e.querySelectorAll(".react-flow__node")];let s=1/0,r=1/0,i=-1/0,c=-1/0;for(const a of t){const[p,b]=lu(a);s=Math.min(s,p),r=Math.min(r,b),i=Math.max(i,p+a.offsetWidth),c=Math.max(c,b+a.offsetHeight)}return Number.isFinite(s)?{x:s,y:r,width:i-s,height:c-r}:{x:0,y:0,width:e.scrollWidth||1,height:e.scrollHeight||1}}async function du(e){const t=e.querySelector(".react-flow__viewport");if(!t)throw new Error("No diagram canvas to export");const s=cu(t),r=Math.max(1,Math.ceil(s.width)+Do*2),i=Math.max(1,Math.ceil(s.height)+Do*2);return{dataUrl:await iu(t,{width:r,height:i,backgroundColor:ri,skipFonts:!0,filter:a=>!(a instanceof Element&&(a.classList.contains("react-flow__controls")||a.classList.contains("react-flow__minimap")||a.classList.contains("react-flow__background")||a.classList.contains("react-flow__attribution"))),style:{width:`${r}px`,height:`${i}px`,transform:`translate(${Do-s.x}px, ${Do-s.y}px) scale(1)`}}),width:r,height:i}}async function uu(e,t,s,r){const i=new Image;i.src=e,await i.decode();const c=document.createElement("canvas");c.width=Math.max(1,Math.round(t*r)),c.height=Math.max(1,Math.round(s*r));const a=c.getContext("2d");if(!a)throw new Error("Canvas 2D context unavailable");return a.fillStyle=ri,a.fillRect(0,0,c.width,c.height),a.drawImage(i,0,0,c.width,c.height),c}function gr(e,t){const s=document.createElement("a");s.href=e,s.download=t,s.click()}function pu(e,t){return`${(e??"diagram").replace(/[^\p{L}\p{N}]+/gu,"-").replace(/^-+|-+$/g,"").toLowerCase()||"diagram"}.${t}`}async function hu(e,t,s){const r=pu(s,t),{dataUrl:i,width:c,height:a}=await du(e);if(t==="svg"){gr(i,r);return}const p=await uu(i,c,a,au);if(t==="png"){gr(p.toDataURL("image/png"),r);return}const{jsPDF:b}=await ja(async()=>{const{jsPDF:j}=await import("./jspdf.es.min-KfOikWO5.js").then(F=>F.j);return{jsPDF:j}},__vite__mapDeps([0,1,2,3,4])),m=new b({orientation:c>=a?"landscape":"portrait",unit:"px",format:[c,a],compress:!0});m.addImage(p.toDataURL("image/png"),"PNG",0,0,c,a),m.save(r)}const mu=1,xr="memo-layout-progress";if(typeof document<"u"&&!document.getElementById(xr)){const e=document.createElement("style");e.id=xr,e.textContent="@keyframes memo-layout-progress { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }",document.head.appendChild(e)}const br={background:"#F7F7F5"},fu={padding:.08,maxZoom:2},gu={background:"#FFFFFF"},xu={hideAttribution:!0},bu=[20,20],yu=50,yr=8e3,wu=90;function vu(e,t){return new Promise((s,r)=>{const i=window.setTimeout(()=>r(new Error(`${t} layout exceeded ${yr/1e3}s`)),yr);e.then(c=>{window.clearTimeout(i),s(c)},c=>{window.clearTimeout(i),r(c)})})}function ku({data:e,selected:t}){const s=e.kind,r=s==="note",i=s==="constraint";return o.jsxs("div",{style:{position:"relative",width:"100%",height:"100%",padding:r?"12px 14px":i?"10px 12px":"4px",background:r?String(e.color??"#FEF3C7"):i?"#FFFFFF":"transparent",border:i?"1.5px dashed #7C3AED":r?"1px solid #F59E0B":"1px solid transparent",borderRadius:r?3:i?5:0,boxShadow:r?"0 2px 6px rgba(0,0,0,.12)":"none",color:"#292524",fontSize:12,lineHeight:1.4},children:[o.jsx(xt,{isVisible:t,minWidth:100,minHeight:48,color:"#2563EB"}),o.jsx("button",{className:"nodrag","aria-label":"Delete annotation",title:"Delete annotation",onPointerDown:c=>{var a;c.preventDefault(),c.stopPropagation(),(a=e.onDelete)==null||a.call(e)},onClick:c=>{var a;c.stopPropagation(),(a=e.onDelete)==null||a.call(e)},style:{position:"absolute",top:3,right:5,border:0,background:"transparent",color:"#64748B",cursor:"pointer",fontSize:14,lineHeight:1,pointerEvents:"all",zIndex:30},children:"×"}),i&&o.jsx("div",{style:{fontSize:10,fontWeight:700,color:"#7C3AED",marginBottom:4},children:"constraint"}),o.jsx("div",{contentEditable:!0,suppressContentEditableWarning:!0,className:"nodrag",style:{outline:"none",whiteSpace:"pre-wrap",minHeight:20},onBlur:c=>{var a;return(a=e.onTextChange)==null?void 0:a.call(e,c.currentTarget.textContent??"")},children:String(e.text??"")})]})}function gn(e,t,s="direct"){const r=new Map(e.map(f=>[f.id,f])),i=new Map,c=f=>{const S=i.get(f);if(S)return S;const w=r.get(f),W=w.parentId?c(w.parentId):{x:0,y:0},A={x:W.x+w.position.x,y:W.y+w.position.y};return i.set(f,A),A},a=f=>{var S,w;return{width:Number(f.width??((S=f.style)==null?void 0:S.width)??0),height:Number(f.height??((w=f.style)==null?void 0:w.height)??0)}},p=t.flatMap(f=>{var D,Y,v,M,ge,H,he,se;const S=(ce,xe,$,B)=>{var ae,we;if(typeof xe=="string"){const E=(((we=(ae=r.get(ce))==null?void 0:ae.data)==null?void 0:we.ports)??[]).find(Q=>Q.id===xe);if(E){const Q=E.size??gt,be=E.x+Q/2,ye=E.y+Q/2+(E.nestedCount??0)*Cr/2;return B==="left"?{x:be-Q/2,y:ye}:B==="right"?{x:be+Q/2,y:ye}:B==="top"?{x:be,y:ye-Q/2}:B==="bottom"?{x:be,y:ye+Q/2}:{x:be,y:ye}}}return $},w=S(f.source,(D=f.data)==null?void 0:D.sourcePortId,(Y=f.data)==null?void 0:Y.sourceOffset,(v=f.data)==null?void 0:v.sourceSide),W=S(f.target,(M=f.data)==null?void 0:M.targetPortId,(ge=f.data)==null?void 0:ge.targetOffset,(H=f.data)==null?void 0:H.targetSide);if(!w||!W||!r.has(f.source)||!r.has(f.target))return[];const A=c(f.source),_=c(f.target);return[{id:f.id,source:{x:A.x+w.x,y:A.y+w.y},target:{x:_.x+W.x,y:_.y+W.y},sourceNodeId:f.source,targetNodeId:f.target,sourceSide:(he=f.data)==null?void 0:he.sourceSide,targetSide:(se=f.data)==null?void 0:se.targetSide}]});if(p.length===0)return t;const b=e.filter(f=>!f.data.isFrame).map(f=>({id:f.id,...c(f.id),...a(f)})),m=new Map(p.map(f=>[f.id,f])),j=new Set(t.filter(f=>{var S;return(S=f.data)==null?void 0:S.manualRoute}).map(f=>f.id)),F=p.filter(f=>!j.has(f.id)),O=s==="tidy"?pl(F,b):hl(F),T=(f,S)=>{const{labelPoint:w,...W}=f.data??{};return{...f,data:{...W,points:S}}},N=t.map(f=>{var W;const S=m.get(f.id);if(!S)return f;if((W=f.data)!=null&&W.manualRoute){const A=[...f.data.points??[]];if(A.length>=2)return A[0]=S.source,A[A.length-1]=S.target,T(f,A)}const w=O.get(f.id);return w?T(f,w):f});if(s!=="tidy")return N;const L=ml(N.flatMap(f=>{var W;const S=(W=f.data)==null?void 0:W.points,w=typeof f.label=="string"?f.label:"";return S&&S.length>=2&&w?[{id:f.id,points:S,width:w.length*6.2+16,height:18}]:[]}),b);return N.map(f=>L.has(f.id)?{...f,data:{...f.data,labelPoint:L.get(f.id)}}:f)}function Fu({x:e,y:t,onConfirm:s,onCancel:r}){const[i,c]=u.useState(""),a=u.useRef(null);u.useEffect(()=>{var m;(m=a.current)==null||m.focus()},[]),u.useEffect(()=>{const m=j=>{const F=document.getElementById("quick-create-popup");F&&!F.contains(j.target)&&r()};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[r]);const p=Math.min(e,window.innerWidth-220),b=Math.min(t,window.innerHeight-80);return o.jsxs("div",{id:"quick-create-popup",className:"fixed z-50 rounded-xl shadow-xl overflow-hidden",style:{left:p,top:b,width:200,background:"#FFFFFF",border:"1px solid #E5E5E0",boxShadow:"0 8px 32px rgba(0,0,0,0.14)"},children:[o.jsx("div",{className:"px-3 py-2",style:{borderBottom:"1px solid #E5E5E0",fontSize:X.xs,color:"#9CA3AF",fontWeight:600},children:"New Element"}),o.jsxs("div",{className:"px-2 py-2",children:[o.jsx("input",{ref:a,value:i,onChange:m=>c(m.target.value),placeholder:"Element name…",className:"w-full px-2 py-1.5 rounded focus:outline-none",style:{fontSize:X.xs,border:"1px solid #E5E5E0",background:"#F7F7F5",color:"#1a1a1a"},onKeyDown:m=>{m.key==="Enter"&&i.trim()&&(m.preventDefault(),s(i.trim())),m.key==="Escape"&&r()}}),o.jsxs("div",{className:"flex gap-2 mt-2",children:[o.jsx("button",{onClick:()=>i.trim()&&s(i.trim()),style:{flex:1,fontSize:X.xs,padding:"4px 8px",background:"#2DD4A8",color:"#FFFFFF",border:"none",borderRadius:6,cursor:"pointer",fontWeight:600},children:"Create"}),o.jsx("button",{onClick:r,style:{fontSize:X.xs,padding:"4px 8px",background:"#F7F7F5",color:"#6B7280",border:"1px solid #E5E5E0",borderRadius:6,cursor:"pointer"},children:"Cancel"})]})]})]})}function xn({color:e,glyph:t}){return o.jsx("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:13,height:13,borderRadius:2,background:e+"22",border:`1.5px solid ${e}`,color:e,fontSize:9,fontWeight:800,lineHeight:1},children:t})}function wr(e,t){if(!e||!t)return[];const s=new Map;for(const a of e.relationships)Lo.has(a.type)&&!s.has(a.targetId)&&s.set(a.targetId,a.sourceId);const r=[t],i=new Set(r);let c=t;for(;s.has(c);){const a=s.get(c);if(i.has(a))break;r.unshift(a),i.add(a),c=a}return r}function bn({path:e,nameOf:t,onFocus:s,rootLabel:r}){if(e.length===0)return null;const i=e.length>1?e[e.length-2]:null;return o.jsxs(o.Fragment,{children:[o.jsx(Ge,{}),o.jsx(ke,{icon:o.jsx(G.back,{}),label:"Parent",onClick:()=>s(i),title:i?`Back to ${t(i)}`:r}),o.jsx("button",{onClick:()=>s(null),className:"px-1.5 py-0.5 text-xs font-medium rounded",style:{background:"#F7F7F5",color:"#2563EB",border:"1px solid #E5E5E0"},title:r,children:"⌂ All"}),e.map((c,a)=>{const p=a===e.length-1;return o.jsxs("span",{className:"flex items-center gap-1",style:{color:"#9CA3AF"},children:[o.jsx("span",{children:"›"}),o.jsx("button",{onClick:()=>s(c),disabled:p,className:"text-xs font-medium",style:{color:p?"#1a1a1a":"#2563EB",fontWeight:p?700:500,cursor:p?"default":"pointer"},title:p?void 0:`Focus ${t(c)}`,children:t(c)})]},c)})]})}function Cu(){var ks,Fs,Cs,Ss,js,Es,Is,As,Rs,zs,Ms,Ts,Ds,Ns,Ls,Bs;const e=ma(),t=ne(n=>n.model),s=ne(n=>n.createRelationship),r=u.useMemo(()=>Fr(t),[t]),i=ne(n=>n.selectedElementId),c=ne(n=>n.selectedViewpointId),a=ne(n=>n.selectedDiagramId),p=ne(n=>n.hiddenLayers),b=ne(n=>n.selectElement),m=ne(n=>n.inspectElement),j=ne(n=>n.inspectRelationship),F=ne(n=>n.setActiveMode),O=ne(n=>n.setActiveView),T=ne(n=>n.setExplorerTab),N=ne(n=>n.availableOntologies),L=ne(n=>n.setSelectedOntologyKind),f=ne(n=>n.diagramLayouts),S=ne(n=>n.setNodeLayout),w=ne(n=>n.mergeDiagramLayouts),W=ne(n=>n.updateDiagramElementIds),{fitView:A,screenToFlowPosition:_,getViewport:D,setViewport:Y}=Sn(),[v,M]=fa([]),[ge,H,he]=ga([]),se=u.useRef([]),ce=u.useRef([]),xe=u.useRef(null),[$,B]=u.useState(!1),[ae,we]=u.useState(null),[E,Q]=u.useState(null),be=u.useRef(t),ye=u.useRef(a),pe=u.useRef(null),le=u.useRef(null),de=u.useRef(!1),ve=u.useRef(null),Ae=u.useRef(0);u.useEffect(()=>{le.current===null&&(se.current=v)},[v]),u.useEffect(()=>{ce.current=ge},[ge]);const ue=u.useCallback((n,l=!0)=>{se.current=n,de.current||(de.current=l),le.current===null&&(le.current=requestAnimationFrame(()=>{le.current=null;const d=se.current,h=de.current;if(de.current=!1,!h){M(d);return}const g=gn(d,ce.current);ce.current=g,M(d),H(g)}))},[M,H]),[Ne,qe]=u.useState(!1),[lt,Ie]=u.useState(0),[ct,Mn]=u.useState(null),[Zt,ii]=u.useState(0),[ai,Jt]=u.useState(0),[At,Qt]=u.useState(!0),[eo,_o]=u.useState(!1),[Ho,li]=u.useState(!1),Le="left",[ci,Tn]=u.useState(!0),[Vo,di]=u.useState(!0),[Ze,Dn]=u.useState(!0),[Je,ui]=u.useState("horizontal"),[Qe,pi]=u.useState(!0),[et,hi]=u.useState("overlay"),[to,Nn]=u.useState("allocation"),[Rt,Ln]=u.useState("all"),[Bn,Pn]=u.useState(!1),[$n,mi]=u.useState(!1),[tt,fi]=u.useState(new Set(["control","data","energy","material"]));u.useEffect(()=>{const n=()=>_o(d=>!d),l=()=>Qt(d=>!d);return window.addEventListener("memo:toggle-diagram-toolbar",n),window.addEventListener("memo:toggle-diagram-elements",l),()=>{window.removeEventListener("memo:toggle-diagram-toolbar",n),window.removeEventListener("memo:toggle-diagram-elements",l)}},[]),u.useEffect(()=>{const n=()=>{var d;const l=document.fullscreenElement;li(!!(l&&((d=xe.current)!=null&&d.contains(l))))};return document.addEventListener("fullscreenchange",n),()=>document.removeEventListener("fullscreenchange",n)},[]);const[Be,zt]=u.useState(null),[ot,oo]=u.useState(null),[Re,yt]=u.useState(null),[Ue,Mt]=u.useState(null),[Tt,On]=u.useState(null),[no,gi]=u.useState(2),[so,Wn]=u.useState(null),Dt=u.useRef([]),Go=u.useRef([]),ro=u.useCallback(n=>{Dt.current.push(n),Dt.current.length>yu&&Dt.current.shift(),Go.current=[]},[]),x=Ea(t,a),Uo=x?Ia[x.diagramType]:null,io=!!((ks=x==null?void 0:x.properties)!=null&&ks.layoutStyle),dt=((Fs=x==null?void 0:x.properties)==null?void 0:Fs.layoutStyle)==="fbs",re=a?f[a]:void 0,ut=Ua(re),Nt=((Cs=re==null?void 0:re.canvas)==null?void 0:Cs.autoLayout)!==!1,ao=((Ss=re==null?void 0:re.canvas)==null?void 0:Ss.flowAnimation)===!0,lo=((js=re==null?void 0:re.canvas)==null?void 0:js.showPortText)!==!1,co=((Es=re==null?void 0:re.canvas)==null?void 0:Es.showConnectionText)!==!1,_n=(Is=re==null?void 0:re.canvas)==null?void 0:Is.portWalls,Hn=u.useMemo(()=>{const n=Object.entries(_n??{}).flatMap(([l,d])=>{const h=fl(d);return h?[[l,h]]:[]});return n.length>0?new Map(n):void 0},[_n]),Lt=u.useMemo(()=>{var h,g;const n=(h=re==null?void 0:re.canvas)==null?void 0:h.legend;if(!(n!=null&&n.enum)||!n.attribute)return;const l=(g=t==null?void 0:t.enumerations)==null?void 0:g.find(C=>C.name===n.enum);if(!l)return;const d=new Map(l.literals.flatMap(C=>{var k;const y=(k=n.colors)==null?void 0:k[C];return y?[[C,y]]:[]}));return{attribute:n.attribute,colors:d,name:l.name}},[(As=re==null?void 0:re.canvas)==null?void 0:As.legend,t==null?void 0:t.enumerations]),Vn=u.useCallback((n,l)=>{var C;if(!a)return;const d=ne.getState().diagramLayouts[a]??{nodes:{},edges:{}},h=(C=d.annotations)==null?void 0:C[n];if(!h)return;const g={...d,annotations:{...d.annotations,[n]:{...h,text:l}}};w({[a]:g}),$e(a,g),M(y=>y.map(k=>k.id===n?{...k,data:{...k.data,text:l}}:k))},[a,w,M]),Gn=u.useCallback(n=>{if(!a)return;const l=ne.getState().diagramLayouts[a]??{nodes:{},edges:{}},d={...l.annotations};delete d[n];const h={...l,annotations:d};w({[a]:h}),$e(a,h),M(g=>g.filter(C=>C.id!==n))},[a,w,M]),uo=u.useCallback(n=>Object.entries((n==null?void 0:n.annotations)??{}).map(([l,d])=>({id:l,type:"annotationNode",zIndex:1e3,position:{x:d.x,y:d.y},style:{width:d.width??180,height:d.height??92},data:{kind:d.kind,text:d.text,color:d.color,onTextChange:h=>Vn(l,h),onDelete:()=>Gn(l)}})),[Vn,Gn]),xi=u.useCallback(n=>{if(!a)return;const l=`annotation-${Date.now().toString(36)}`,d=_({x:window.innerWidth/2,y:window.innerHeight/2}),h=n==="constraint"?"{constraint}":n==="note"?"Note":"Text",g=ne.getState().diagramLayouts[a]??{nodes:{},edges:{}},C={kind:n,x:d.x,y:d.y,width:180,height:n==="text"?56:92,text:h},y={...g,annotations:{...g.annotations,[l]:C}};w({[a]:y}),$e(a,y),M(k=>[...k,...uo(y).filter(I=>I.id===l)])},[a,_,w,M,uo]),Un=u.useCallback(()=>{if(!a)return;const n=ne.getState().diagramLayouts[a],l={nodes:{},edges:{},canvas:{...n==null?void 0:n.canvas,autoLayout:!0}};w({[a]:l}),$e(a,l),Jt(d=>d+1)},[a,w]),bi=u.useCallback(n=>{ui(n),requestAnimationFrame(()=>e(se.current.map(l=>l.id))),Un()},[Un,e]),Fe=u.useCallback(()=>{var l;if(!a)return;const n=ne.getState().diagramLayouts[a]??{nodes:{},edges:{}};((l=n.canvas)==null?void 0:l.autoLayout)!==!1&&w({[a]:{...n,canvas:{...n.canvas,autoLayout:!1}}})},[a,w]);u.useEffect(()=>{if(!a||Nt||Ne||v.length===0||lt===0)return;const n=window.setTimeout(()=>{const l=ne.getState().diagramLayouts[a]??{nodes:{},edges:{}},d=D(),h=Dl({nodes:Object.fromEntries(v.filter(g=>g.type!=="annotationNode").map(g=>[g.id,{...l.nodes[g.id]??{},x:g.position.x,y:g.position.y,...g.width?{width:g.width}:{},...g.height?{height:g.height}:{},ports:Object.fromEntries((g.data.ports??[]).map(C=>[C.id,{x:C.x,y:C.y,side:C.side,...C.size?{size:C.size}:{}}]))}])),edges:Object.fromEntries(ge.map(g=>{var C,y,k,I,q,Z;return[g.id,{...(()=>{var oe;const{points:ie,...me}=((oe=l.edges)==null?void 0:oe[g.id])??{};return me})(),...(C=g.data)!=null&&C.manualRoute&&((k=(y=g.data)==null?void 0:y.points)!=null&&k.length)?{points:(I=g.data)==null?void 0:I.points,source:g.source,target:g.target,sourcePortId:(q=g.data)==null?void 0:q.sourcePortId,targetPortId:(Z=g.data)==null?void 0:Z.targetPortId}:{}}]})),annotations:Object.fromEntries(v.filter(g=>g.type==="annotationNode").map(g=>{var C,y;return[g.id,{kind:g.data.kind,text:String(g.data.text??""),color:g.data.color,x:g.position.x,y:g.position.y,width:Number(g.width??((C=g.style)==null?void 0:C.width)??180),height:Number(g.height??((y=g.style)==null?void 0:y.height)??92)}]})),canvas:{...l.canvas,zoom:d.zoom,pan:{x:d.x,y:d.y},autoLayout:!1}});w({[a]:h}),$e(a,h),Ie(0)},350);return()=>window.clearTimeout(n)},[a,Nt,Ne,lt,v,ge,D,w]);const U=x?x.viewKind??(Uo==null?void 0:Uo.viewKind)??"general":void 0,Xn=u.useMemo(()=>gd(U),[U]),Ce=u.useCallback(n=>Xn.has(n),[Xn]),po=U==="interconnection"?.72:.8,Xe=u.useCallback((n=0)=>{const l=xe.current,d=se.current.filter(oe=>!oe.hidden);if(!l||d.length===0)return;const{width:h,height:g}=l.getBoundingClientRect(),C=U==="actionflow"&&Qe&&et==="above"?112:0,y=h,k=g-C,I=xa(d);if(y<=0||k<=0||I.width<=0||I.height<=0)return;if(U==="actionflow"&&Ze){if(Je==="horizontal"){const oe=Math.max(.1,Math.min(2,k*.72/I.height));Y({x:y*.05-I.x*oe,y:(k-I.height*oe)/2-I.y*oe,zoom:oe},{duration:n})}else{const oe=Math.max(.1,Math.min(2,y*.78/I.width));Y({x:(y-I.width*oe)/2-I.x*oe,y:k*.06-I.y*oe,zoom:oe},{duration:n})}return}const q=.08,Z=.08;if(Math.min(y*(1-q*2)/I.width,k*(1-Z*2)/I.height,2)>=po){A({padding:q,minZoom:po,maxZoom:2,duration:n});return}const me=Math.max(.1,Math.min(2,y*(1-q*2)/I.width));Y({x:y*q-I.x*me,y:k*Z-I.y*me,zoom:me},{duration:n})},[Je,Qe,et,Le,po,A,Ho,Y,Ze,eo,U]),wt=U==="general"&&!io&&!dt,Kn=(x==null?void 0:x.diagramType)==="ucd",[pt,Yn]=u.useState("graph"),[Xo,qn]=u.useState("all"),[Ko,Zn]=u.useState("straight"),[Bt,Jn]=u.useState(new Set),yi=u.useMemo(()=>t?Xa(t):0,[t]),Qn=u.useMemo(()=>t?Ka(t):[],[t]),Yo=(Rs=x==null?void 0:x.properties)==null?void 0:Rs.modes,wi=u.useMemo(()=>{if(!Yo)return dn;const n=new Set(Yo.split(",").map(d=>d.trim())),l=dn.filter(d=>n.has(d));return l.length?l:dn},[Yo]),es=u.useMemo(()=>{if(!t||!x)return[];const n=new Set(x.elementIds),l=Object.values(t.elements).filter(d=>n.has(d.id)&&d.allocatedTo).map(d=>d.allocatedTo);return Ya(l,t)},[t,x]),vi=u.useMemo(()=>{if(!t||!x)return!1;const n=new Set(x.elementIds);return Object.values(t.elements).some(l=>n.has(l.id)&&!!(l.attributes.stage||l.attributes.phase))},[t,x]),ho=u.useMemo(()=>{if(!t||!x||U!=="actionflow")return[];const n=(x.elementIds??[]).map(l=>t.elements[l]).filter(l=>!!l&&l.construct==="action");return qa(n,t)},[t,x,U]),[Pt,ki]=u.useState("containment"),[$t,mo]=u.useState(new Set),[ts,Ot]=u.useState(new Set),[fo,qo]=u.useState(null),[We,Zo]=u.useState("all"),[nt,Jo]=u.useState("summary"),[os,ns]=u.useState(!1),[ss,Wt]=u.useState(new Set),go=u.useCallback(n=>{if(!a)return;const l=ne.getState().diagramLayouts[a]??{nodes:{},edges:{}},d={...l,canvas:{...l.canvas,...n}};w({[a]:d}),$e(a,d)},[a,w]),[vt,Qo]=u.useState(null),[_t,rs]=u.useState("flat"),[is,Ht]=u.useState(new Set),[xo,en]=u.useState(null),[bo,Fi]=u.useState(new Map),_e=u.useRef(new Map),Ci=u.useMemo(()=>wr(t,fo),[t,fo]),Si=u.useMemo(()=>wr(t,xo),[t,xo]),ji=u.useMemo(()=>{var h;if(!t||!vt)return[];const n=[vt],l=new Set(n);let d=vt;for(;d;){const g=(h=t.elements[d])==null?void 0:h.parentAction;if(!g||l.has(g)||!t.elements[g])break;n.unshift(g),l.add(g),d=g}return n},[t,vt]),yo=u.useMemo(()=>{if(!t||U!=="statetransition")return[];const n=new Set;for(const l of t.relationships){if(!Lo.has(l.type))continue;const d=t.elements[l.sourceId];!d||!t.elements[l.targetId]||!Za(d)||d.kind.endsWith("Machine")||n.add(d.id)}return[...n]},[t,U]),Ei=u.useMemo(()=>t?[...new Set(t.relationships.filter(n=>Lo.has(n.type)).map(n=>n.sourceId))]:[],[t]);u.useEffect(()=>{var l,d,h,g;Ie(0),Yn(Ja(x==null?void 0:x.properties)),qn(un(x==null?void 0:x.properties).level??"all"),Zn(un(x==null?void 0:x.properties).edgeStyle??"straight"),Jn(new Set),Dn(!0),Nn("allocation"),Ln("all");const n=(d=(l=x==null?void 0:x.properties)==null?void 0:l.styleHint)!=null&&d.startsWith("expanded:")?x.properties.styleHint.slice(9).split(",").map(C=>C.trim()).filter(Boolean):[];mo(new Set(n)),qo(null),Zo(((h=re==null?void 0:re.canvas)==null?void 0:h.portDisplay)??"all"),Jo(((g=re==null?void 0:re.canvas)==null?void 0:g.connectionDisplay)??"summary"),ns(!1),Wt(new Set),Qo(null),rs("flat"),en(null),_e.current.clear()},[a,(zs=x==null?void 0:x.properties)==null?void 0:zs.layoutHint,(Ms=x==null?void 0:x.properties)==null?void 0:Ms.styleHint,(Ts=re==null?void 0:re.canvas)==null?void 0:Ts.portDisplay,(Ds=re==null?void 0:re.canvas)==null?void 0:Ds.connectionDisplay]);const Ii=u.useMemo(()=>({decompositionNode:Bl,interconnectionNode:Pc,actionFlowNode:tl,actionFlowLane:el,actionFlowLaneLabel:Qa,stateNode:Gc,seqLifeline:Xc,seqSection:Yc,seqOccurrence:Zc,useCase:Jc,useCaseActor:Qc,useCaseBoundary:ed,contextSystem:nd,contextExternal:sd,contextBoundary:rd,diagramNode:id,annotationNode:ku,decisionNode:ud,forkNode:pd,startEndNode:hd}),[]),Ai=u.useMemo(()=>({interconnectionEdge:Hc,useCaseEdge:od}),[]),Ri=u.useCallback(n=>{var l,d;return((l=n.data)==null?void 0:l.color)||((d=n.data)==null?void 0:d.layerColor)||"#ccc"},[]),je=u.useMemo(()=>{var k;const n=(x==null?void 0:x.viewpointId)==="__model"?null:(x==null?void 0:x.viewpointId)||c,l=n&&(t==null?void 0:t.viewpoints),d=p.size>0,h=(k=x==null?void 0:x.elementIds)!=null&&k.length?new Set(x.elementIds):void 0;if(!l&&!d&&!h)return;const g=l?t.viewpoints.find(I=>I.id===n):void 0,C=g?new Set(g.visibleKinds):void 0,y=g?new Set(g.visibleLayers):void 0;return I=>p.has(I.layer)?!1:h?h.has(I.id):((C==null?void 0:C.size)??0)>0||((y==null?void 0:y.size)??0)>0?!!(C!=null&&C.has(I.kind))||!!(y!=null&&y.has(I.layer)):!0},[c,x,t==null?void 0:t.viewpoints,p]),as=u.useMemo(()=>{if(!t||U!=="interconnection")return[];const n=Object.values(t.elements),l=je?n.filter(je):n;return ol(nl(l,t.relationships),mu)},[t,U,je]),ls=u.useRef(null);u.useEffect(()=>{if(!t)return;const n=`${a??""}|${U??""}`;if(ls.current!==n){if(U==="statetransition"){if(yo.length===0)return;Ht(new Set(yo))}else U==="interconnection"&&Ot(new Set(as));ls.current=n}},[t,a,U,yo,as]);const wo=u.useMemo(()=>{if(!t||!x||x.diagramType!=="bdd")return null;const n=x.relationshipTypes??[];return n.length===0||n.every(d=>Lo.has(d.charAt(0).toLowerCase()+d.slice(1)))?sl(Us(t,je,x.relationshipTypes)):null},[t,x,je]),cs=u.useCallback(()=>{if(t)return dt?rl(t):wt?Us(t,je,x==null?void 0:x.relationshipTypes):il(t)},[t,dt,wt,je,x==null?void 0:x.relationshipTypes]),tn=u.useCallback(n=>{mo(l=>{const d=new Set(l);return d.has(n)?d.delete(n):d.add(n),d})},[]),ds=u.useCallback(n=>{Ot(l=>{const d=new Set(l);return d.has(n)?d.delete(n):d.add(n),d})},[]),us=u.useCallback(n=>{Wt(l=>{const d=new Set(l);return d.has(n)?d.delete(n):d.add(n),d})},[]),vo=u.useCallback(n=>{en(n),Ht(new Set),m(null)},[m]),ko=u.useCallback(n=>{Qo(n),Wt(new Set),m(null)},[m]),Fo=u.useCallback(n=>{qo(n),Ot(new Set),m(null)},[m]),ps=u.useCallback(n=>{Ht(l=>{const d=new Set(l);return d.has(n)?d.delete(n):d.add(n),d})},[]),hs=u.useCallback(n=>{_e.current.clear(),Fi(l=>{const d=new Map(l),h=d.get(n)||"vertical";return d.set(n,h==="vertical"?"horizontal":"vertical"),d})},[]),on=u.useCallback(()=>{const n=cs();if(!n)return;const l=new Set,d=h=>{l.add(h);for(const g of n.childrenMap.get(h)||[])n.elements.has(g)&&d(g)};for(const h of n.roots)n.elements.has(h)&&d(h);mo(l)},[cs]),nn=u.useCallback(()=>mo(new Set),[]),sn=u.useCallback(()=>{_e.current.clear(),Jt(n=>n+1)},[]),zi=u.useCallback(()=>{if(!a)return;const n=ne.getState().diagramLayouts[a]??{},{pan:l,zoom:d,...h}=n.canvas??{},g={nodes:{},edges:{},canvas:{...h,autoLayout:!0}};pe.current=null,w({[a]:g}),$e(a,g),_e.current.clear(),Jt(C=>C+1),window.setTimeout(()=>Xe(300),250)},[a,w,Xe]),ms=u.useCallback(n=>n.map(l=>{if(l.type!=="diagramNode")return l;const d=t==null?void 0:t.elements[l.id];return{...l,data:{...l.data,onContextMenu:(h,g)=>{yt({x:h.clientX,y:h.clientY,nodeId:g,nodeKind:l.data.kind??""})},onInlineEdit:(h,g)=>{if(!d)return;const C={...d,name:g};Hs(C)}}}}),[t]),fs=u.useCallback((n,l)=>{const d=!Tl(l),h=new Map(n.map(P=>[P.id,P])),g=n.map(P=>{const V=l.nodes[P.id];if(!V)return P;const Me=P.parentId?h.get(P.parentId):void 0,Pe=d&&P.type==="contextSystem"&&(Me==null?void 0:Me.type)==="contextBoundary"?Nl(V,Me.position):{x:V.x,y:V.y};return{...P,position:Pe,...V.width?{width:V.width}:{},...V.height?{height:V.height}:{},...V.width||V.height?{style:{...P.style,...V.width?{width:V.width}:{},...V.height?{height:V.height}:{}}}:{},data:{...P.data,bgColor:V.color||void 0,...V.opacity!==void 0?{fillOpacity:V.opacity}:{},...V.borderColor!==void 0?{borderColor:V.borderColor||void 0}:{},...V.textColor!==void 0?{textColor:V.textColor||void 0}:{},...V.fontSize!==void 0?{fontSize:V.fontSize||void 0}:{},...V.fontWeight!==void 0?{fontWeight:V.fontWeight||void 0}:{},...V.textAlign!==void 0?{textAlign:V.textAlign}:{},...V.verticalAlign!==void 0?{verticalAlign:V.verticalAlign}:{},...V.ports?{ports:(P.data.ports??[]).map(J=>{var fe;return{...J,...((fe=V.ports)==null?void 0:fe[J.id])??{}}})}:{}}}}),C=new Map(g.map(P=>[P.id,P])),y=g.filter(P=>P.type==="actionFlowLane"),k=P=>(P.data.memberIds??[]).map(V=>C.get(V)).filter(Boolean),I=P=>P.position.x,q=P=>P.position.y,Z=P=>{var V;return P.position.x+Number(P.width??((V=P.style)==null?void 0:V.width)??180)},ie=P=>{var V;return P.position.y+Number(P.height??((V=P.style)==null?void 0:V.height)??96)},me=y.flatMap(k),oe=me.length>0?{x:Math.min(...me.map(I)),y:Math.min(...me.map(q))}:void 0,ze=me.length>0?{x:Math.max(...me.map(Z)),y:Math.max(...me.map(ie))}:void 0,Vt=new Map;return g.map(P=>{if(P.type!=="actionFlowLane")return P;const V=P.data,Me=k(P);if(Me.length===0||!oe||!ze)return P;const Pe=V.orientation==="column",J=Pe?Math.min(...Me.map(I)):oe.x,fe=Pe?Math.max(...Me.map(Z)):ze.x,ht=Pe?oe.y:Math.min(...Me.map(q)),$s=Pe?ze.y:Math.max(...Me.map(ie)),Ke={position:{x:Pe?J-36:J-120,y:Pe?ht-32:ht-36},width:fe-J+(Pe?72:156),height:$s-ht+(Pe?68:72)};return Vt.set(P.id,Ke),{...P,position:Ke.position,style:{...P.style,width:Ke.width,height:Ke.height}}}).map(P=>{if(P.type!=="actionFlowLaneLabel")return P;const V=Vt.get(P.id.replace("__lane_label_","__lane_"));return V?{...P,position:V.position,style:{...P.style,width:V.width,height:V.height}}:P})},[]),gs=u.useCallback((n,l,d,h)=>{var y;Ae.current=Date.now()+250,Fe(),Ie(k=>k+1);const g=ce.current.map(k=>{var me,oe;if(!(((me=k.data)==null?void 0:me.sourcePortId)===l||((oe=k.data)==null?void 0:oe.targetPortId)===l))return k;const{points:q,manualRoute:Z,...ie}=k.data??{};return{...k,data:ie}});if(ce.current=g,h&&a){const k=ne.getState().diagramLayouts[a]??{nodes:{},edges:{}};w({[a]:{...k,canvas:{...k.canvas,autoLayout:!1,portWalls:{...(y=k.canvas)==null?void 0:y.portWalls,[l]:h}}}})}const C=se.current.map(k=>k.id!==n?k:{...k,data:{...k.data,ports:(k.data.ports??[]).map(I=>I.id===l?{...I,y:d}:I)}});ue(C)},[ue,Fe,a,w]),xs=u.useCallback((n,l,d,h)=>{Ae.current=Date.now()+250,Fe(),Ie(C=>C+1);const g=se.current.map(C=>{if(C.id!==n)return C;const y=C.data.ports??[],k=y.find(oe=>oe.id===l);if(!k)return C;const I=k.size??gt,q=d-I,Z={...k,x:k.x+(h.includes("w")?-q:h.includes("e")?0:-q/2),y:k.y+(h.includes("n")?-q:h.includes("s")?0:-q/2),size:d},ie=2;return y.some(oe=>{if(oe.id===l)return!1;const ze=oe.size??gt;return Z.x<oe.x+ze+ie&&Z.x+d+ie>oe.x&&Z.y<oe.y+ze+ie&&Z.y+d+ie>oe.y})?C:{...C,data:{...C.data,ports:y.map(oe=>oe.id===l?Z:oe)}}});ue(g)},[ue,Fe]),bs=u.useCallback((n,l)=>{Ae.current=Date.now()+250,Fe(),Ie(d=>d+1),H(d=>{const h=d.map(g=>g.id===n?{...g,data:{...g.data,points:l,manualRoute:!0}}:g);return ce.current=h,h})},[Fe,H]),ys=u.useCallback((n,l,d,h)=>{if(JSON.stringify(l)===JSON.stringify(d))return;const g=(C,y)=>{Fe(),Ie(k=>k+1),H(k=>{const I=k.map(q=>{if(q.id!==n)return q;if(y)return{...q,data:{...q.data,points:C,manualRoute:!0}};const{points:Z,manualRoute:ie,...me}=q.data??{};return{...q,data:me}});return ce.current=I,I}),ue(se.current)};ro({do:()=>g(d,!0),undo:()=>g(l,h)})},[Fe,ro,ue,H]),Mi=u.useCallback(async n=>{const l=xe.current;if(l){B(!1),Q(null),we(n);try{await hu(l,n,x==null?void 0:x.name)}catch(d){Q(d instanceof Error?d.message:String(d))}finally{we(null)}}},[x==null?void 0:x.name]),Ti=u.useCallback(()=>{if(ce.current.some(d=>{var h;return(h=d.data)==null?void 0:h.manualRoute})&&!window.confirm("Re-route connectors? This replaces the hand-drawn bends on this diagram. Node positions will be kept."))return;Fe(),Ie(d=>d+1);const n=ce.current.map(d=>{var y;if(!((y=d.data)!=null&&y.manualRoute))return d;const{points:h,manualRoute:g,...C}=d.data;return{...d,data:C}}),l=gn(se.current,n,"tidy");ce.current=l,H(l)},[Fe,H]);u.useEffect(()=>{if(!t)return;const n=be.current!==t&&ye.current===a;if(pe.current=n?D():null,be.current=t,ye.current=a,U==="grid"||U==="browser"||U==="geometry")return;let l=!1;const d=({nodes:k,edges:I},q=!0)=>{if(l)return;const Z=gl(k,I),ie=new Map(Z.nodes.map(J=>[J.id,J])),me=new Map(Z.edges.map(J=>[J.id,J])),oe=k.map(J=>{const fe=ie.get(J.id);return fe?{...J,position:{x:fe.x,y:fe.y},style:{...J.style,width:fe.width,height:fe.height},parentId:fe.parentId,...fe.parentId?{extent:"parent"}:{}}:J}),ze=I.filter(J=>me.has(J.id)).map(J=>{const fe=me.get(J.id);return{...J,source:fe.sourceId,target:fe.targetId,label:fe.label??J.label}}),Vt=oe,Ps=ze,P=a?ne.getState().diagramLayouts[a]:void 0,Me=[...P&&Object.keys(P.nodes).length>0?fs(Vt,P):Vt,...uo(P)],Pe=Ps.map(J=>{var Os,Ws,_s;const fe=(Os=P==null?void 0:P.edges)==null?void 0:Os[J.id],ht=t.relationships.find(mt=>mt.id===J.id),Ke=!(fe!=null&&fe.source)||fe.source===J.source&&fe.target===J.target&&fe.sourcePortId===((Ws=J.data)==null?void 0:Ws.sourcePortId)&&fe.targetPortId===((_s=J.data)==null?void 0:_s.targetPortId)?fe==null?void 0:fe.points:void 0;return{...J,reconnectable:!!(ht!=null&&ht.sourceRange),data:{...J.data,...Ke!=null&&Ke.length?{points:Ke,manualRoute:!0}:{},flowAnimation:ao,onRouteChange:mt=>bs(J.id,mt),onRouteChangeComplete:(mt,Gt)=>{var Ut;return ys(J.id,mt,Gt,!!((Ut=J.data)!=null&&Ut.manualRoute))},onSelect:mt=>{mt.stopPropagation(),!(Date.now()<Ae.current)&&(H(Gt=>Gt.map(Ut=>({...Ut,selected:Ut.id===J.id}))),t.relationships.some(Gt=>Gt.id===J.id)&&j(J.id))}}}});M(q?ms(Me):Me),H(gn(Me,Pe)),qe(!1),ii(J=>J+1)},h=k=>I=>{l||(console.error(`${k} layout error:`,I),qe(!1),Mn(`${k} layout could not be completed. Try resetting the layout or reducing the visible hierarchy.`))},g=(k,I,q=!0)=>{qe(!0),Mn(null),vu(I,k).then(Z=>d(Z,q)).catch(h(k))},C=()=>{const k=Er.select({viewKind:U,diagramType:x==null?void 0:x.diagramType,isFBSDiagram:dt,isDecompDiagram:io,isGeneralTemplate:wt,generalMode:pt,layoutStyle:Pt}),I={onToggleExpand:tn,onToggleDirection:hs},q={fbs:{expandedNodes:$t,nodeDirections:bo,callbacks:I,layoutProviderId:ut},decomposition:{expandedNodes:$t,nodeDirections:bo,callbacks:I,positionCache:_e.current},containment:{expandedNodes:$t,callbacks:{onToggleExpand:tn}},useCase:{viewpointFilter:void 0,systemName:x==null?void 0:x.name,...x?un(x.properties):{},level:Xo,edgeStyle:Ko,hiddenActorIds:Bt},context:{systemName:x==null?void 0:x.name,viewpointFilter:je,relationshipTypes:x==null?void 0:x.relationshipTypes},interconnection:{viewpointFilter:je,relationshipTypes:x==null?void 0:x.relationshipTypes,collapsedNodes:ts,onDrillIn:Fo,onToggleCollapse:ds,focusId:fo??void 0,portDisplay:We,connectionDisplay:nt,showPortText:lo,showConnectionText:co,portWalls:Hn,legend:Lt,onPortMove:gs,onPortResize:xs,onPortSelect:ie=>{j(null),m(ie)},layoutProviderId:ut},actionflow:{viewpointFilter:je,swimlanes:Ze,laneGrouping:to,displayLevel:Rt,expandedActionIds:ss,onToggleAction:us,onDrillInAction:ko,focusActionId:vt??void 0,visibleFlowKinds:tt,direction:Je,nesting:_t,layoutProviderId:ut},statetransition:{viewpointFilter:je,collapsedStateIds:is,onToggleCollapse:ps,onDrillIn:vo,focusStateId:xo??void 0,layoutProviderId:ut},sequence:{viewpointFilter:je},general:{mode:pt,viewpointFilter:je,expandedNodes:$t,nodeDirections:bo,callbacks:I,positionCache:_e.current,hierarchyRelationshipTypes:x==null?void 0:x.relationshipTypes,layoutProviderId:ut},standard:{viewpointFilter:je,relationshipTypes:x==null?void 0:x.relationshipTypes,compartments:wt,layoutProviderId:ut}},Z=k.compute(t,q);Z instanceof Promise?g(k.descriptor.label,Z,k.descriptor.interactive):d(Z,k.descriptor.interactive)},y=window.setTimeout(C,wu);return()=>{l=!0,window.clearTimeout(y)}},[t,je,io,dt,Pt,U,wt,pt,Ze,ai,x==null?void 0:x.relationshipTypes,x==null?void 0:x.diagramType,x==null?void 0:x.name,Xo,Ko,Bt,ut,$t,ts,fo,We,nt,lo,co,Hn,Lt,ss,vt,tt,Je,to,Rt,_t,bo,is,xo,ps,vo,ko,tn,ds,us,hs,a,Fo,fs,ms,uo,gs,xs,bs,ys,m,j,D]),u.useEffect(()=>{if(Zt===0)return;const n=setTimeout(()=>{var h;const l=pe.current;if(pe.current=null,l){Y(l);return}const d=a?(h=ne.getState().diagramLayouts[a])==null?void 0:h.canvas:void 0;U!=="actionflow"&&(d==null?void 0:d.zoom)!==void 0&&d.pan?Y({x:d.pan.x,y:d.pan.y,zoom:d.zoom},{duration:300}):Xe(500)},200);return()=>clearTimeout(n)},[Zt,a,Xe,Y,U]),u.useEffect(()=>{if(U!=="actionflow"||Zt===0)return;const n=requestAnimationFrame(()=>Xe(180));return()=>cancelAnimationFrame(n)},[Qe,et,Le,Xe,Ho,Zt,eo,U]),u.useEffect(()=>{M(n=>n.map(l=>{const d=l.type==="actionFlowLane"?l.data.inspectElementId:void 0,h=!!i&&(l.id===i||d===i);return{...l,selected:h,style:{...l.style,boxShadow:h?"0 0 0 2px #2DD4A8, 0 4px 12px rgba(45, 212, 168, 0.3)":void 0,opacity:i?h?1:.5:1}}}))},[i,M]),u.useEffect(()=>{if(!Tt||!t)return;const n=bl(t,Tt,"both",no),l=new Set(n.nodes.map(d=>d.elementId));l.add(Tt),M(d=>d.map(h=>({...h,style:{...h.style,opacity:l.has(h.id)?1:.08,pointerEvents:l.has(h.id)?"all":"none"}}))),H(d=>d.map(h=>({...h,style:{...h.style,opacity:l.has(h.source)&&l.has(h.target)?1:.05}})))},[Tt,no,t,M,H]),u.useEffect(()=>{if(!so)return;const n=setTimeout(()=>Wn(null),2500);return()=>clearTimeout(n)},[so]);const Co=u.useCallback(()=>{b(null),j(null),yt(null),Mt(null),M(n=>n.map(l=>({...l,selected:!1,style:{...l.style,opacity:1,boxShadow:void 0}}))),H(n=>n.map(l=>({...l,selected:!1})))},[b,j,M,H]),rn=u.useCallback(()=>{const n=Dt.current.pop();n&&(n.undo(),Go.current.push(n))},[]),an=u.useCallback(()=>{const n=Go.current.pop();n&&(n.do(),Dt.current.push(n))},[]);u.useEffect(()=>{const n=l=>{const d=l.target;d.tagName==="INPUT"||d.tagName==="TEXTAREA"||((l.metaKey||l.ctrlKey)&&l.key==="z"&&!l.shiftKey&&(l.preventDefault(),rn()),(l.metaKey||l.ctrlKey)&&(l.key==="Z"||l.key==="z"&&l.shiftKey)&&(l.preventDefault(),an()),l.key==="Escape"&&Co(),l.key==="g"&&(l.metaKey||l.ctrlKey)&&l.shiftKey&&(l.preventDefault(),Tn(h=>!h)),l.key==="0"&&(l.metaKey||l.ctrlKey)&&(l.preventDefault(),Xe(400)))};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[Xe,Co,rn,an]);const Di=u.useCallback(n=>{n.preventDefault(),n.dataTransfer.dropEffect="copy"},[]),Ni=u.useCallback(n=>{n.preventDefault();const l=n.dataTransfer.getData(Yr);if(l)try{const d=JSON.parse(l),h=_({x:n.clientX,y:n.clientY});zt({x:n.clientX,y:n.clientY,flowX:h.x,flowY:h.y,kind:d.kind,layer:d.layer,construct:d.construct})}catch{}},[_]),Li=u.useCallback(n=>{const l=_({x:n.clientX,y:n.clientY});zt({x:n.clientX,y:n.clientY,flowX:l.x,flowY:l.y})},[_]),Bi=u.useCallback(n=>{if(!Be||!a){zt(null);return}const l=Be.kind??"Part",d=Be.layer??"logical",h=Be.construct??"part",g=wn[d]??"#6B7280",C=yl(n,Object.keys((t==null?void 0:t.elements)??{})),y={id:C,type:"diagramNode",position:{x:Be.flowX,y:Be.flowY},data:{label:n,kind:l,layer:d,construct:h,color:g,isNew:!0,onContextMenu:(Z,ie)=>{yt({x:Z.clientX,y:Z.clientY,nodeId:ie,nodeKind:l})},onInlineEdit:(Z,ie)=>{Hs({id:C,name:ie,kind:l,construct:h,layer:d})}}};M(Z=>[...Z,y]),Aa({id:C,name:n,kind:l,construct:h,layer:d,attributes:{_layer:d}});const k=(x==null?void 0:x.elementIds)??[];W(a,[...k,C]);const I=a,q={nodes:{...(f[I]??{}).nodes??{},[C]:{x:Be.flowX,y:Be.flowY}},edges:(f[I]??{}).edges??{}};w({[I]:q}),$e(I,q),zt(null)},[Be,a,x,f,w,W,M]),Pi=u.useCallback(()=>{yt(null),Mt(null)},[]),$i=u.useCallback((n,l)=>{l!=null&&l.isValid},[]),kt=u.useCallback((n,l)=>{const d=al(l);return(d?t==null?void 0:t.elements[d]:void 0)??(t==null?void 0:t.elements[n])},[t]),Oi=u.useCallback(n=>{const{source:l,target:d,sourceHandle:h,targetHandle:g}=n;if(!l||!d)return;const C=kt(l,h),y=kt(d,g);!C||!y||C.id!==y.id&&oo({x:window.innerWidth/2-130,y:window.innerHeight/2-160,sourceElement:C,targetElement:y})},[kt]),Wi=u.useCallback(async(n,l)=>{Ae.current=Date.now()+500;const d=t==null?void 0:t.relationships.find(y=>y.id===n.id);if(!(d!=null&&d.sourceRange)||!l.source||!l.target)return;const h=kt(l.source,l.sourceHandle),g=kt(l.target,l.targetHandle);if(!h||!g||h.id===g.id||h.id===d.sourceId&&g.id===d.targetId)return;const C=await Ra({relationshipId:d.id,sourceId:h.id,targetId:g.id,diagramId:a??void 0});C.success||console.warn(`[MEMO] Connector endpoint update rejected: ${C.error}`)},[t,kt,a]),_i=u.useCallback(()=>{Ae.current=Date.now()+500,yt(null),Mt(null)},[]),Hi=u.useCallback(()=>{Ae.current=Date.now()+250},[]),Vi=u.useCallback(async n=>{if(!ot||!a){oo(null);return}const l=ot.sourceElement.id;oo(null);const d=await s({type:n.type,sourceId:n.sourceId,targetId:n.targetId,direction:n.direction,flowItem:n.flowItem,selectedElementId:l,diagramId:a});if(!d.success){console.warn(`[MEMO] Relationship rejected: ${d.error}`);return}if(!(se.current.some(y=>y.id===n.sourceId)&&se.current.some(y=>y.id===n.targetId)))return;const g=Vs[n.type]??"#6B7280",C={id:d.relationshipId??`e_${n.sourceId}_${n.targetId}_${n.type}`,source:n.sourceId,target:n.targetId,label:n.type,type:"default",style:{stroke:g,strokeWidth:2},labelStyle:{fontSize:"10px",fill:"#374151"},labelBgStyle:{fill:"#FFFFFF",fillOpacity:.9},labelBgPadding:[4,2],labelBgBorderRadius:4,markerEnd:{type:"arrowclosed",color:g}};H(y=>ba(C,y))},[ot,a,H,s]),Gi=u.useCallback((n,l)=>{ve.current={id:l.id,x:l.position.x,y:l.position.y}},[]),Ui=u.useCallback((n,l)=>{const d=ve.current;if(ve.current=null,!((d==null?void 0:d.id)===l.id&&Math.hypot(l.position.x-d.x,l.position.y-d.y)>2)||(Ae.current=Date.now()+250,Ie(I=>I+1),!a))return;const{x:g,y:C}=l.position;if(l.type==="annotationNode")return;Fe();const y=ce.current.map(I=>{var me;if(!((me=I.data)!=null&&me.manualRoute)||I.source!==l.id&&I.target!==l.id)return I;const{points:q,manualRoute:Z,...ie}=I.data;return{...I,data:ie}});ce.current=y,ue(se.current);const k=_e.current.get(l.id);if(_e.current.set(l.id,{x:g,y:C}),S(a,l.id,{x:g,y:C}),k){const I=l.id,q=a;ro({do:()=>S(q,I,{x:g,y:C}),undo:()=>{S(q,I,k),M(Z=>Z.map(ie=>ie.id===I?{...ie,position:k}:ie))}})}},[a,S,ro,M,Fe,ue]),Xi=u.useCallback(n=>{const l=y=>{var k;return"id"in y&&((k=se.current.find(I=>I.id===y.id))==null?void 0:k.type)==="annotationNode"};n.some(y=>y.type==="position"&&y.dragging&&!l(y))&&Fe();const d=n.some(y=>y.type==="dimensions"&&y.resizing),h=n.some(y=>y.type==="dimensions"&&y.setAttributes);(d||h)&&(Ae.current=Date.now()+250),d&&n.some(y=>y.type==="dimensions"&&y.resizing&&!l(y))&&Fe(),h&&Ie(y=>y+1);const g=new Map(n.flatMap(y=>y.type==="dimensions"&&y.dimensions?[[y.id,y.dimensions]]:[])),C=ya(n,se.current).map(y=>{var me,oe;const k=g.get(y.id);if(!k)return y;const I=Number(y.width??((me=y.style)==null?void 0:me.width)??k.width),q=Number(y.height??((oe=y.style)==null?void 0:oe.height)??k.height),Z=y.data.ports,ie=Z==null?void 0:Z.map(ze=>({...ze,...ze.side==="right"?{x:ze.x+k.width-I}:{},...ze.side==="bottom"?{y:ze.y+k.height-q}:{}}));return{...y,style:{...y.style,width:k.width,height:k.height},...ie?{data:{...y.data,ports:ie}}:{}}});ue(C,!d||h)},[ue,Fe]),Ki=u.useCallback((n,l)=>{},[]),Yi=u.useCallback((n,l)=>{n.preventDefault(),Mt({x:n.clientX,y:n.clientY,edgeId:l.id,relType:String(l.label??"edge")})},[]),qi=u.useCallback((n,l)=>{var g,C,y,k,I,q;if(Date.now()<Ae.current)return;if((n==null?void 0:n.shiftKey)||(n==null?void 0:n.metaKey)||(n==null?void 0:n.ctrlKey)||((g=n==null?void 0:n.nativeEvent)==null?void 0:g.shiftKey)||((C=n==null?void 0:n.nativeEvent)==null?void 0:C.metaKey)||((y=n==null?void 0:n.nativeEvent)==null?void 0:y.ctrlKey)||((k=n==null?void 0:n.getModifierState)==null?void 0:k.call(n,"Shift"))||((I=n==null?void 0:n.getModifierState)==null?void 0:I.call(n,"Meta"))||((q=n==null?void 0:n.getModifierState)==null?void 0:q.call(n,"Control"))){window.setTimeout(()=>M(Z=>Z.map(ie=>({...ie,selected:ie.selected||ie.id===i||ie.id===l.id}))),0);return}if(l.type==="annotationNode")return;const h=l.type==="actionFlowLane"?l.data.inspectElementId:void 0;!h&&(l.id.startsWith("__")||l.id.includes("__start")||l.id.includes("__done"))||(m(h??l.id),a&&O({type:"diagram",diagramId:a}))},[m,a,O,i,M]),Zi=u.useCallback((n,l)=>{var d;if((d=n==null?void 0:n.stopPropagation)==null||d.call(n),U==="actionflow"){if(!Object.values((t==null?void 0:t.elements)??{}).some(g=>g.parentAction===l.id))return;ko(l.id);return}if(U==="statetransition"){const h=l.data;if(!h.hasChildren||h.isMachine){m(l.id);return}vo(l.id);return}if(U==="interconnection"){const h=l.data;if(!h.isContainer&&!h.hasChildren){m(l.id);return}Fo(l.id)}},[U,t==null?void 0:t.elements,m,ko,vo,Fo]),Ji=Co,Qi=u.useCallback((n,l)=>{var d;(d=n==null?void 0:n.stopPropagation)==null||d.call(n),!(Date.now()<Ae.current)&&(H(h=>h.map(g=>({...g,selected:g.id===l.id}))),t!=null&&t.relationships.some(h=>h.id===l.id)?j(l.id):t!=null&&t.elements[l.id]&&m(l.id))},[t,m,j,H]),ea=u.useCallback((n,l)=>{Kt({endpointIds:[l.id]})},[]),ta=u.useCallback((n,l)=>{Kt({edgeId:l.id,endpointIds:Sr(l)})},[]),ws=u.useCallback(()=>Kt(null),[]),oa=u.useCallback((n,l)=>{var d;a&&(S(a,n,{...((d=f[a])==null?void 0:d.nodes[n])??{x:0,y:0},color:l||void 0}),M(h=>h.map(g=>g.id===n?{...g,data:{...g.data,bgColor:l||void 0}}:g)))},[a,f,S,M]),He=u.useMemo(()=>v.filter(n=>n.selected&&n.type!=="actionFlowLane"&&!n.id.startsWith("__")),[v]),Ft=u.useCallback(()=>He.map(n=>{var l,d,h,g;return{id:n.id,x:n.position.x,y:n.position.y,width:Number(n.width??((l=n.measured)==null?void 0:l.width)??((d=n.style)==null?void 0:d.width)??180),height:Number(n.height??((h=n.measured)==null?void 0:h.height)??((g=n.style)==null?void 0:g.height)??96)}}),[He]),Ct=u.useCallback(n=>{n.size!==0&&(Fe(),M(l=>l.map(d=>{const h=n.get(d.id);return h?{...d,position:{x:h.x??d.position.x,y:h.y??d.position.y},...h.width!==void 0?{width:h.width}:{},...h.height!==void 0?{height:h.height}:{},...h.width!==void 0||h.height!==void 0?{style:{...d.style,...h.width!==void 0?{width:h.width}:{},...h.height!==void 0?{height:h.height}:{}}}:{}}:d})),Ie(l=>l+1))},[Fe,M]),na=u.useCallback(n=>{Ct(Cl(Ft(),n))},[Ct,Ft]),sa=u.useCallback(n=>{Ct(Sl(Ft(),n))},[Ct,Ft]),ra=u.useCallback(n=>{Ct(jl(Ft(),n))},[Ct,Ft]),ln=u.useCallback(n=>{if(!a||He.length===0)return;Fe();const l=ne.getState().diagramLayouts[a];for(const h of He){const g=(l==null?void 0:l.nodes[h.id])??{x:h.position.x,y:h.position.y};S(a,h.id,{...g,...n.color!==void 0?{color:n.color||void 0}:{},...n.opacity!==void 0?{opacity:n.opacity}:{},...n.borderColor!==void 0?{borderColor:n.borderColor||void 0}:{},...n.textColor!==void 0?{textColor:n.textColor||void 0}:{},...n.fontSize!==void 0?{fontSize:n.fontSize||void 0}:{},...n.fontWeight!==void 0?{fontWeight:n.fontWeight||void 0}:{},...n.textAlign!==void 0?{textAlign:n.textAlign}:{},...n.verticalAlign!==void 0?{verticalAlign:n.verticalAlign}:{}})}const d=new Set(He.map(h=>h.id));M(h=>h.map(g=>d.has(g.id)?{...g,data:{...g.data,...n.color!==void 0?{bgColor:n.color||void 0}:{},...n.opacity!==void 0?{fillOpacity:n.opacity}:{},...n.borderColor!==void 0?{borderColor:n.borderColor||void 0}:{},...n.textColor!==void 0?{textColor:n.textColor||void 0}:{},...n.fontSize!==void 0?{fontSize:n.fontSize||void 0}:{},...n.fontWeight!==void 0?{fontWeight:n.fontWeight||void 0}:{},...n.textAlign!==void 0?{textAlign:n.textAlign}:{},...n.verticalAlign!==void 0?{verticalAlign:n.verticalAlign}:{}}}:g)),Ie(h=>h+1)},[a,He,Fe,S,M]),ia=u.useMemo(()=>{const n=He.map(l=>Number(l.data.fillOpacity??1));return n.length===0?1:n.every(l=>l===n[0])?n[0]:1},[He]),vs=u.useCallback(n=>{if(!a||!x)return;const l=(x.elementIds??[]).filter(d=>d!==n);W(a,l),M(d=>d.filter(h=>h.id!==n))},[a,x,W,M]),aa=u.useCallback((n,l)=>{const d=l==="dashed"?"6 3":l==="dotted"?"2 3":void 0;H(h=>h.map(g=>g.id===n?{...g,style:{...g.style,strokeDasharray:d}}:g))},[H]),la=u.useCallback((n,l)=>{H(d=>d.map(h=>h.id===n?{...h,style:{...h.style,stroke:l||(Vs[String(h.label??"")]??"#6B7280")}}:h))},[H]),ca=u.useCallback(n=>{H(l=>l.map(d=>d.id===n?{...d,label:d.label?"":n.split("_")[3]??""}:d))},[H]);return x&&t&&U==="grid"?o.jsx(ll,{diagram:x,model:t,viewpointFilter:je}):x&&t&&U==="browser"?o.jsx(cl,{diagram:x,model:t,viewpointFilter:je}):x&&t&&U==="geometry"?o.jsx(xl,{diagram:x,model:t,viewpointFilter:je}):!x&&v.length===0&&!Ne?o.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[!At&&o.jsx(mn,{collapsed:At,onToggleCollapse:()=>Qt(!0)}),At&&o.jsx(mn,{collapsed:!0,onToggleCollapse:()=>Qt(!1)}),o.jsx("div",{className:"flex-1 flex items-center justify-center",style:{background:"#F7F7F5"},children:o.jsxs("div",{className:"text-center",style:{maxWidth:"320px"},children:[o.jsx("div",{style:{fontSize:"40px",marginBottom:"16px",opacity:.4},children:"📊"}),o.jsx("h3",{style:{fontSize:X.lg,fontWeight:600,color:"#374151",marginBottom:"8px"},children:"Select a Diagram"}),o.jsx("p",{style:{fontSize:X.md,color:"#9CA3AF",lineHeight:1.6},children:"Choose a diagram from the sidebar or drag elements from the palette."})]})})]}):o.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[o.jsx(mn,{collapsed:At,onToggleCollapse:()=>Qt(!At),elementIds:x==null?void 0:x.elementIds,eligibleKinds:(Ns=x==null?void 0:x.elementKinds)!=null&&Ns.length?new Set(x.elementKinds):x!=null&&x.viewpointId&&(t!=null&&t.viewpoints)?new Set(((Ls=t.viewpoints.find(n=>n.id===x.viewpointId))==null?void 0:Ls.visibleKinds)??[]):void 0}),o.jsxs("div",{className:"flex-1 flex min-w-0",children:[!eo&&o.jsxs("aside",{"aria-label":"Diagram tools",className:"flex shrink-0 flex-col border-r",style:{width:126,background:"#FAFAF8",borderColor:"#E5E5E0"},children:[o.jsxs("div",{className:"flex items-center justify-between px-3 py-2",style:{background:"#F0F0ED",borderBottom:"1px solid #E5E5E0"},children:[o.jsx("span",{style:{fontSize:X.xs,fontWeight:600,color:"#374151"},children:"Toolbar"}),o.jsx("button",{type:"button",onClick:()=>_o(!0),title:"Hide Toolbar","aria-label":"Hide Toolbar",style:{width:28,height:28,display:"flex",alignItems:"center",justifyContent:"center",background:"#FFFFFF",border:"1px solid #E5E5E0",borderRadius:5,cursor:"pointer",color:"#6B7280",fontSize:20,lineHeight:1},children:"×"})]}),x&&!Ho&&(eo?o.jsx("button",{type:"button",className:"m-3 flex items-center justify-center rounded-lg",onClick:()=>_o(!1),title:"Show diagram tools","aria-label":"Show diagram tools",style:{width:36,height:36,background:"#FFFFFF",color:"#1B3A4B",border:"1px solid #D8E0E4",boxShadow:"0 1px 4px rgba(0,0,0,0.10)"},children:o.jsx(G.lanes,{})}):o.jsxs("div",{className:"memo-diagram-tools memo-diagram-tools--left m-3 grid content-start items-stretch justify-items-stretch rounded-lg text-xs",style:{width:94,padding:6,gap:6,overflow:"visible",gridTemplateColumns:"repeat(2, 38px)",gridAutoRows:"min-content",gridAutoFlow:"row dense",background:"#FFFFFF",border:"1px solid #E5E5E0",boxShadow:"0 1px 4px rgba(0,0,0,0.08)"},children:[Ce("grid")&&o.jsx(ke,{icon:Vo?o.jsx(G.grid,{}):o.jsx(G.gridOff,{}),active:Vo,onClick:()=>{di(n=>{const l=!n;return Tn(l),l})},title:"Show or hide the canvas grid and snapping (⌘⇧G)"}),Ce("export")&&o.jsxs("div",{className:"memo-diagram-tools__document-action",style:{position:"relative"},children:[o.jsx(ke,{icon:o.jsx(G.download,{}),active:$,onClick:()=>{Q(null),B(n=>!n)},title:"Download this diagram as an image"}),$&&o.jsx("div",{role:"menu","aria-label":"Export diagram",className:"absolute z-20 rounded-lg overflow-hidden",style:{top:"calc(100% + 6px)",left:0,minWidth:128,background:"#FFFFFF",border:"1px solid #E2E1DB",boxShadow:"0 4px 14px rgba(0,0,0,0.12)"},children:["png","svg","pdf"].map(n=>o.jsx("button",{role:"menuitem",onClick:()=>{Mi(n)},disabled:ae!==null,className:"w-full text-left px-3 py-1.5 text-xs font-medium",style:{background:"#FFFFFF",color:"#374151",border:0,cursor:ae?"default":"pointer"},children:n.toUpperCase()},n))}),E&&o.jsxs("div",{role:"alert",className:"absolute z-20 rounded-lg px-3 py-1.5 text-xs",style:{top:"calc(100% + 6px)",left:0,minWidth:200,background:"#FEF2F2",color:"#B91C1C",border:"1px solid #FECACA"},children:["Export failed: ",E]})]}),o.jsx("div",{className:"memo-diagram-tools__layout-divider memo-diagram-tools__document-actions-divider","aria-hidden":"true"}),Ce("route")&&o.jsx("div",{className:U==="interconnection"?"memo-diagram-tools__layout-reset":void 0,style:{display:"contents"},children:o.jsx(ke,{icon:o.jsx(G.tidy,{}),active:!1,onClick:Ti,title:"Layout: re-route connectors. Warns before replacing hand-drawn bends."})}),a&&Ce("autoLayout")&&o.jsx("div",{className:U==="interconnection"?"memo-diagram-tools__layout-reset":void 0,style:{display:"contents"},children:o.jsx(ke,{icon:o.jsx(G.arrange,{}),active:Nt,onClick:()=>{if(Nt)Fe();else{if(!window.confirm("Recalculate the layout? This replaces saved manual positions and hand-routed connectors for this diagram."))return;const n=ne.getState().diagramLayouts[a],l={nodes:{},edges:{},canvas:{...n==null?void 0:n.canvas,autoLayout:!0}};w({[a]:l}),$e(a,l),Jt(d=>d+1)}},title:Nt?"Auto layout is on. Drag an item to preserve a manual layout.":"Layout: recalculate. Replaces saved manual positions after confirmation."})}),dt&&Ce("expandCollapse")&&o.jsxs(o.Fragment,{children:[o.jsx(Ge,{hidden:Le==="left"}),o.jsx(Oe,{icon:o.jsx(G.expand,{}),onClick:on,title:"Expand all nodes",ariaLabel:"Expand all"}),o.jsx(Oe,{icon:o.jsx(G.collapse,{}),onClick:nn,title:"Collapse all nodes",ariaLabel:"Collapse all"})]}),U==="actionflow"&&Ce("flowSwimlanes")&&o.jsxs(o.Fragment,{children:[o.jsx(ke,{icon:Ze?o.jsx(G.lanes,{}):o.jsx(G.lanesOff,{}),active:Ze,onClick:()=>Dn(n=>!n),title:"Toggle allocation swimlanes"}),Ce("flowSwimlanes")&&Ze&&vi&&o.jsx(ke,{icon:o.jsx(G.lanes,{}),label:void 0,active:to==="stage",onClick:()=>Nn(n=>n==="stage"?"allocation":"stage"),title:"Group this flow by its modeled stages"}),Ce("flowHierarchy")&&Ze&&to==="allocation"&&es.length>0&&o.jsxs("div",{style:{position:"relative"},children:[o.jsx(ke,{icon:o.jsx(G.library,{}),active:Bn,onClick:()=>Pn(n=>!n),title:`Responsibility hierarchy level: ${Rt==="all"?"all levels":`level ${Rt}`}`}),Bn&&o.jsx("div",{className:"absolute z-30 rounded-lg p-1",style:{top:"calc(100% + 5px)",left:0,width:112,background:"#FFFFFF",border:"1px solid #D1D5DB",boxShadow:"0 4px 14px rgba(0,0,0,0.12)"},children:["all",...es].map(n=>{const l=Rt===n;return o.jsx("button",{type:"button",className:"w-full rounded px-2 py-1 text-left text-xs font-semibold",style:{background:l?"#E8FBF5":"transparent",color:l?"#0F766E":"#475569"},onClick:()=>{Ln(n),Pn(!1)},children:n==="all"?"All levels":`Level ${n}`},String(n))})})]}),o.jsx(Ge,{hidden:Le==="left"}),Ce("flowNesting")&&o.jsx(ke,{icon:_t==="flat"?o.jsx(G.split,{}):o.jsx(G.rectangle,{}),active:_t==="nested",onClick:()=>rs(n=>n==="flat"?"nested":"flat"),title:_t==="flat"?"Steps: inline. Click to show nested steps.":"Steps: nested. Click to show inline steps."}),o.jsx(Ge,{hidden:Le==="left"}),Ce("flowDirection")&&o.jsx(ke,{icon:Je==="horizontal"?o.jsx(G.arrowRight,{}):o.jsx(G.arrowDown,{}),active:Je==="vertical",onClick:()=>bi(Je==="horizontal"?"vertical":"horizontal"),title:Je==="horizontal"?"Flow direction: left to right. Click for top to bottom.":"Flow direction: top to bottom. Click for left to right."}),o.jsx(Ge,{hidden:Le==="left"}),Ce("flowLegend")&&o.jsx(ke,{icon:o.jsx(G.lanes,{}),active:Qe,onClick:()=>pi(n=>!n),title:Qe?"Hide flow legend":"Show flow legend"}),Ce("flowLegend")&&Qe&&o.jsx(ke,{icon:et==="overlay"?o.jsx(G.overlay,{}):o.jsx(G.arrowUp,{}),active:et==="above",onClick:()=>hi(n=>n==="overlay"?"above":"overlay"),title:et==="overlay"?"Legend over diagram. Click to place it above.":"Legend above diagram. Click to overlay it."}),o.jsx(Ge,{hidden:Le==="left"}),o.jsx(ke,{icon:o.jsx(G.expand,{}),title:"Expand all sub-actions",onClick:()=>Wt(new Set(Object.values((t==null?void 0:t.elements)??{}).map(n=>n.parentAction).filter(n=>!!n)))}),o.jsx(ke,{icon:o.jsx(G.collapse,{}),title:"Collapse all sub-actions",onClick:()=>Wt(new Set)}),o.jsx(Ge,{hidden:Le==="left"}),Ce("flowFilters")&&o.jsxs("div",{style:{position:"relative"},children:[o.jsx(ke,{icon:o.jsx(G.filter,{}),active:$n,badge:`${tt.size}/4`,fullWidth:!1,onClick:()=>mi(n=>!n),title:"Choose which modeled connection categories are visible"}),$n&&o.jsxs("div",{className:"absolute p-3 rounded-lg",style:{width:264,top:0,left:"calc(100% + 8px)",background:"#FFFFFF",border:"1px solid #D1D5DB",boxShadow:"0 8px 24px rgba(0,0,0,0.14)",zIndex:30},children:[o.jsx("div",{style:{color:"#1F2937",fontWeight:700,fontSize:X.xs},children:"Show connection categories"}),o.jsx("div",{style:{color:"#6B7280",fontSize:X.xs,lineHeight:1.4,marginTop:3,marginBottom:8},children:"Changes this diagram view only; the SysML model is not modified."}),["control","data","energy","material"].map(n=>{const l=tt.has(n),d=n==="control"?"#4B5563":n==="data"?"#3498DB":n==="energy"?"#D97706":"#16A34A";return o.jsxs("button",{role:"switch","aria-checked":l,onClick:()=>fi(h=>{const g=new Set(h);return g.has(n)?g.delete(n):g.add(n),g}),className:"w-full flex items-center justify-between px-1 py-1.5 rounded",style:{color:"#374151",textTransform:"capitalize"},title:`${l?"Hide":"Show"} ${n} connections`,children:[o.jsxs("span",{className:"flex items-center gap-2",children:[o.jsx("span",{style:{width:9,height:9,borderRadius:"50%",background:d}}),n]}),o.jsx("span",{"aria-hidden":"true",style:{width:32,height:18,borderRadius:9,background:l?"#2563EB":"#D1D5DB",padding:2,transition:"background 160ms ease"},children:o.jsx("span",{style:{display:"block",width:14,height:14,borderRadius:"50%",background:"#FFFFFF",boxShadow:"0 1px 2px rgba(0,0,0,0.22)",transform:l?"translateX(14px)":"translateX(0)",transition:"transform 160ms ease"}})})]},n)})]})]}),o.jsx(bn,{path:ji,nameOf:n=>{var l;return((l=t==null?void 0:t.elements[n])==null?void 0:l.name)??n},onFocus:Qo,rootLabel:"Back to the whole action flow"})]}),U==="interconnection"&&Ce("expandCollapse")&&o.jsxs(o.Fragment,{children:[o.jsx(Ge,{hidden:Le==="left"}),o.jsxs("div",{className:"memo-diagram-tools__layout-reset",style:{display:"contents"},children:[o.jsx(Oe,{icon:o.jsx(G.expand,{}),onClick:()=>Ot(new Set),title:"Expand all parts",ariaLabel:"Expand all"}),o.jsx(Oe,{icon:o.jsx(G.collapse,{}),onClick:()=>Ot(new Set(Ei)),title:"Collapse all parts",ariaLabel:"Collapse all"})]}),o.jsx("div",{className:"memo-diagram-tools__layout-divider memo-diagram-tools__layout-reset-divider","aria-hidden":"true"}),Ce("interconnectionPorts")&&Ce("interconnectionConnections")&&Le==="left"?o.jsxs(o.Fragment,{children:[o.jsx(ke,{icon:We==="all"?o.jsx(G.library,{}):We==="ports"?o.jsx(G.rectangle,{}):o.jsx(G.minus,{}),active:We!=="none",onClick:()=>Zo(n=>{const l=n==="all"?"ports":n==="ports"?"none":"all";return go({portDisplay:l}),l}),title:We==="all"?"Ports: nested. Click for top-level ports.":We==="ports"?"Ports: top-level only. Click to hide ports.":"Ports: hidden. Click to show nested ports."}),o.jsx(ke,{icon:nt==="summary"?o.jsx(G.tidy,{}):nt==="all"?o.jsx(G.lanes,{}):o.jsx(G.minus,{}),active:nt!=="none",onClick:()=>Jo(n=>{const l=n==="summary"?"all":n==="all"?"none":"summary";return go({connectionDisplay:l}),l}),title:nt==="summary"?"Connections: summary. Click to show all.":nt==="all"?"Connections: all. Click to hide them.":"Connections: hidden. Click for summary."})]}):o.jsxs(o.Fragment,{children:[o.jsx("span",{style:{color:"#9CA3AF",fontSize:X.xs,fontWeight:600},children:"Ports"}),o.jsx(Xs,{value:We,onChange:n=>{Zo(n),go({portDisplay:n})},options:[{value:"all",label:"Nested",title:"Show ports and their nested ports"},{value:"ports",label:"Top",title:"Show top-level ports only (nested connectors lift to the parent port)"},{value:"none",label:"Off",title:"Hide ports; connectors run part to part"}]}),o.jsx("span",{style:{color:"#9CA3AF",fontSize:X.xs,fontWeight:600},children:"Connections"}),o.jsx(Xs,{value:nt,onChange:n=>{Jo(n),go({connectionDisplay:n})},options:[{value:"summary",label:"Summary",title:"Show focused-subsystem boundary flows and bundle repeated rendered endpoint pairs"},{value:"all",label:"All",title:"Show every model connector"},{value:"none",label:"Off",title:"Hide connectors while inspecting block structure"}]})]}),o.jsx(bn,{path:Ci,nameOf:n=>{var l;return((l=t==null?void 0:t.elements[n])==null?void 0:l.name)??n},onFocus:qo,rootLabel:"Back to the whole diagram"})]}),U==="statetransition"&&Ce("expandCollapse")&&o.jsxs(o.Fragment,{children:[o.jsx(Ge,{}),o.jsx(Oe,{icon:o.jsx(G.expand,{}),onClick:()=>Ht(new Set),title:"Show all substates",ariaLabel:"Expand all substates"}),o.jsx(Oe,{icon:o.jsx(G.collapse,{}),onClick:()=>Ht(new Set(yo)),title:"Fold every composite state",ariaLabel:"Collapse all substates"}),o.jsx(bn,{path:Si,nameOf:n=>{var l;return((l=t==null?void 0:t.elements[n])==null?void 0:l.name)??n},onFocus:en,rootLabel:"Back to the whole machine"})]}),Kn&&Ce("useCaseOptions")&&o.jsxs(o.Fragment,{children:[o.jsx("span",{style:{color:"#E5E5E0"},children:"|"}),o.jsxs("label",{className:"flex items-center gap-1 text-xs font-semibold",style:{color:"#475569"},children:["Level",o.jsxs("select",{"aria-label":"Use case hierarchy level",value:Xo,onChange:n=>qn(n.target.value==="all"?"all":Number(n.target.value)),className:"px-1.5 py-0.5 text-xs font-medium rounded",style:{color:"#374151",background:"#FFFFFF",border:"1px solid #D1D5DB"},children:[o.jsx("option",{value:"all",children:"All levels"}),Array.from({length:yi+1},(n,l)=>o.jsxs("option",{value:l,children:["L",l]},l))]})]}),o.jsxs("label",{className:"flex items-center gap-1 text-xs font-semibold",style:{color:"#475569"},children:["Routing",o.jsxs("select",{"aria-label":"Use case connector routing",value:Ko,onChange:n=>Zn(n.target.value),className:"px-1.5 py-0.5 text-xs font-medium rounded",style:{color:"#374151",background:"#FFFFFF",border:"1px solid #D1D5DB"},children:[o.jsx("option",{value:"straight",children:"Straight"}),o.jsx("option",{value:"elbow",children:"Elbow"}),o.jsx("option",{value:"rounded",children:"Rounded"}),o.jsx("option",{value:"curved",children:"Curved"}),o.jsx("option",{value:"arc",children:"Arc"})]})]}),o.jsx("button",{onClick:zi,className:"px-2 py-0.5 text-xs font-semibold rounded",style:{color:"#047857",background:"#ECFDF5",border:"1px solid #A7F3D0"},title:"Reapply the constrained hierarchy layout and obstacle-aware routes",children:"Auto arrange"}),Qn.length>0&&o.jsxs("details",{className:"relative",children:[o.jsxs("summary",{className:"px-2 py-0.5 text-xs font-semibold rounded cursor-pointer",style:{color:"#374151",background:"#FFFFFF",border:"1px solid #D1D5DB"},children:["Actors",Bt.size?`: ${Bt.size} hidden`:""]}),o.jsxs("div",{className:"absolute top-7 left-0 z-30 min-w-48 p-2 rounded shadow-lg",style:{background:"#FFFFFF",border:"1px solid #D1D5DB"},children:[o.jsx("div",{className:"mb-1 text-xs",style:{color:"#64748B"},children:"Hide related use cases"}),Qn.map(n=>o.jsxs("label",{className:"flex items-center gap-2 py-1 text-xs",style:{color:"#374151"},children:[o.jsx("input",{type:"checkbox",checked:Bt.has(n.id),onChange:()=>Jn(l=>{const d=new Set(l);return d.has(n.id)?d.delete(n.id):d.add(n.id),d})}),n.name]},n.id))]})]})]}),wt&&!Kn&&Ce("generalMode")&&o.jsxs(o.Fragment,{children:[o.jsx("span",{style:{color:"#E5E5E0"},children:"|"}),o.jsx("div",{className:"flex rounded overflow-hidden",style:{border:"1px solid #E5E5E0"},children:wi.map(n=>o.jsx("button",{onClick:()=>{Yn(n),_e.current.clear()},className:"px-2 py-0.5 text-xs font-medium capitalize",style:{background:pt===n?"#1B3A4B":"#FFFFFF",color:pt===n?"#FFFFFF":"#6B7280"},title:n==="graph"?"Relationship graph with compartments":n==="tree"?"Decomposition tree with expand/collapse":"Nested containment blocks",children:n==="graph"?o.jsx(G.tidy,{}):n==="tree"?o.jsx(G.library,{}):o.jsx(G.rectangle,{})},n))}),pt!=="graph"&&o.jsxs(o.Fragment,{children:[o.jsx(Oe,{icon:o.jsx(G.expand,{}),onClick:on,title:"Expand all nodes",ariaLabel:"Expand all"}),o.jsx(Oe,{icon:o.jsx(G.collapse,{}),onClick:nn,title:"Collapse all nodes",ariaLabel:"Collapse all"}),pt==="tree"&&o.jsx("button",{onClick:sn,className:"px-2 py-0.5 text-xs font-medium rounded",style:{background:"#F7F7F5",color:"#374151",border:"1px solid #E5E5E0"},title:"Re-layout the tree from scratch",children:"↻ Reset"})]})]}),io&&!dt&&Ce("expandCollapse")&&o.jsxs(o.Fragment,{children:[o.jsx("span",{style:{color:"#E5E5E0"},children:"|"}),o.jsx("div",{className:"flex rounded overflow-hidden",style:{border:"1px solid #E5E5E0"},children:["containment","decomposition"].map(n=>o.jsx("button",{onClick:()=>{ki(n),_e.current.clear()},className:"px-2 py-0.5 text-xs font-medium",style:{background:Pt===n?"#1B3A4B":"#FFFFFF",color:Pt===n?"#FFFFFF":"#6B7280"},children:n==="containment"?o.jsx(G.rectangle,{}):o.jsx(G.library,{})},n))}),o.jsx(Ge,{}),o.jsx(Oe,{icon:o.jsx(G.expand,{}),onClick:on,title:"Expand all nodes",ariaLabel:"Expand all"}),o.jsx(Oe,{icon:o.jsx(G.collapse,{}),onClick:nn,title:"Collapse all nodes",ariaLabel:"Collapse all"}),Pt==="decomposition"&&o.jsx("button",{onClick:sn,className:"px-2 py-0.5 text-xs font-medium rounded",style:{background:"#F7F7F5",color:"#374151",border:"1px solid #E5E5E0"},title:"Re-layout the tree from scratch",children:"↻ Reset"})]}),a&&o.jsxs(o.Fragment,{children:[U!=="actionflow"&&Le!=="left",o.jsx("div",{id:"memo-diagram-editor-controls","data-compact-diagram-tools":"true",style:{display:"contents"}})]}),a&&U==="interconnection"&&o.jsxs(o.Fragment,{children:[Le!=="left",o.jsx(Oe,{icon:o.jsx(G.plus,{}),onClick:()=>xi("note"),title:"Add an editable note",ariaLabel:"Add note"}),o.jsx(ke,{icon:o.jsx(G.arrowRight,{}),active:ao,onClick:()=>{const n=ne.getState().diagramLayouts[a]??{nodes:{},edges:{}},l={...n,canvas:{...n.canvas,flowAnimation:!ao}};w({[a]:l}),$e(a,l),H(d=>d.map(h=>({...h,data:{...h.data,flowAnimation:!ao}})))},title:"Toggle animated source-to-target flow"}),o.jsx(ke,{icon:o.jsx(G.library,{}),active:os,onClick:()=>ns(n=>!n),title:"Show or hide the IBD notation legend"}),o.jsx(ke,{icon:o.jsx(G.elements,{}),active:lo,onClick:()=>{const n=ne.getState().diagramLayouts[a]??{nodes:{},edges:{}},l={...n,canvas:{...n.canvas,showPortText:!lo}};w({[a]:l}),$e(a,l)},title:"Show or hide port captions"}),o.jsx(ke,{icon:o.jsx(G.code,{}),active:co,onClick:()=>{const n=ne.getState().diagramLayouts[a]??{nodes:{},edges:{}},l={...n,canvas:{...n.canvas,showConnectionText:!co}};w({[a]:l}),$e(a,l)},title:"Show or hide connector labels"})]})]}))]}),o.jsxs("div",{ref:xe,className:"flex-1 relative min-h-0",onDragOver:Di,onDrop:Ni,onDoubleClick:Li,children:[Tt&&o.jsxs("div",{className:"absolute top-3 right-3 z-10 flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs",style:{background:"#1B3A4B",color:"#FFFFFF",boxShadow:"0 2px 8px rgba(0,0,0,0.18)"},children:[o.jsx("span",{style:{color:"#2DD4A8",fontWeight:700},children:"◎ Focus"}),o.jsx("span",{style:{color:"rgba(255,255,255,0.5)"},children:"Depth"}),[1,2,3].map(n=>o.jsx("button",{onClick:()=>gi(n),style:{width:20,height:20,borderRadius:4,cursor:"pointer",background:no===n?"#2DD4A8":"rgba(255,255,255,0.15)",color:no===n?"#1B3A4B":"#FFFFFF",fontWeight:700,fontSize:"11px",border:"none"},children:n},n)),o.jsx("button",{onClick:()=>{On(null),M(n=>n.map(l=>({...l,style:{...l.style,opacity:1,pointerEvents:"all"}}))),H(n=>n.map(l=>({...l,style:{...l.style,opacity:1}})))},style:{marginLeft:4,padding:"2px 8px",borderRadius:4,cursor:"pointer",background:"rgba(255,255,255,0.15)",color:"#FFFFFF",fontSize:"11px",border:"none"},children:"Exit Focus"})]}),so&&o.jsxs("div",{className:"absolute bottom-12 left-1/2 -translate-x-1/2 z-50 px-4 py-2 rounded-lg text-xs font-mono",style:{background:"#1B3A4B",color:"#2DD4A8",boxShadow:"0 4px 16px rgba(0,0,0,0.2)",whiteSpace:"nowrap"},children:["Copied: ",so]}),Ne&&o.jsx("div",{className:"absolute top-3 left-1/2 -translate-x-1/2 z-10 px-4 py-1.5 rounded-full text-xs font-medium",style:{background:"#FFFFFF",color:"#6B7280",border:"1px solid #E5E5E0",boxShadow:"0 1px 4px rgba(0,0,0,0.06)"},children:"Computing layout…"}),ct&&!Ne&&o.jsxs("div",{role:"alert",className:"absolute top-3 left-1/2 -translate-x-1/2 z-20 flex items-center gap-3 px-3 py-2",style:{maxWidth:620,background:"#FFFDF7",color:"#5F4300",border:"1px solid #E7C35A",borderRadius:4,boxShadow:"0 2px 8px rgba(31,41,55,0.10)",fontSize:X.xs},children:[o.jsx("span",{children:ct}),o.jsx("button",{onClick:sn,style:{border:"1px solid #B58A12",borderRadius:3,background:"#FFFFFF",color:"#5F4300",padding:"3px 8px",fontWeight:700,whiteSpace:"nowrap"},children:"Retry"})]}),ho.length>0&&!Ne&&o.jsxs("div",{role:"alert",className:"absolute top-16 left-1/2 -translate-x-1/2 z-20 px-3 py-2",style:{maxWidth:720,background:"#FEF2F2",color:"#991B1B",border:"1px solid #FCA5A5",borderRadius:4,boxShadow:"0 2px 8px rgba(31,41,55,0.10)",fontSize:X.xs},children:[o.jsx("span",{style:{fontWeight:700},children:"Diagram error:"})," ",ho.length," floating ",ho.length===1?"action has":"actions have"," no flow or succession connection:"," ",ho.map((n,l)=>o.jsxs("span",{children:[l>0&&", ",o.jsx("button",{onClick:()=>m(n.id),style:{color:"#991B1B",textDecoration:"underline",fontWeight:700},children:n.name})]},n.id))]}),wo&&!Ne&&o.jsxs("div",{role:"alert",className:"absolute top-16 left-1/2 -translate-x-1/2 z-20 px-3 py-2",style:{maxWidth:720,background:"#FEF2F2",color:"#991B1B",border:"1px solid #FCA5A5",borderRadius:4,boxShadow:"0 2px 8px rgba(31,41,55,0.10)",fontSize:X.xs},children:[o.jsx("span",{style:{fontWeight:700},children:"BDD error:"})," ","expected one connected hierarchy, but found ",wo.rootIds.length," roots",wo.disconnectedIds.length>0&&o.jsxs(o.Fragment,{children:[" and ",wo.disconnectedIds.length," disconnected/floating elements"]}),"."]}),U==="actionflow"&&Qe&&o.jsxs("div",{"aria-label":"Action flow legend",className:"absolute z-10 flex flex-col gap-2 px-3 py-2.5",style:{top:et==="above"?8:12,right:12,minWidth:154,background:"rgba(255,255,255,0.96)",border:"1px solid #D1D5DB",borderRadius:12,color:"#374151",fontSize:X.xs,boxShadow:"0 2px 8px rgba(31,41,55,0.10)"},children:[o.jsx("div",{className:"flex items-center gap-4",children:o.jsx("span",{style:{fontWeight:700},children:"Flow legend"})}),tt.has("control")&&o.jsxs("span",{className:"flex items-center gap-2",children:[o.jsx("span",{style:{width:24,height:0,borderTop:"2px solid #4B5563"}}),"Control flow"]}),tt.has("data")&&o.jsxs("span",{className:"flex items-center gap-2",children:[o.jsx("span",{style:{width:24,height:0,borderTop:"2.5px solid #3498DB"}}),"Object flow"]}),tt.has("energy")&&o.jsxs("span",{className:"flex items-center gap-2",children:[o.jsx("span",{style:{width:24,height:0,borderTop:"2.5px solid #D97706"}}),"Energy flow"]}),tt.has("material")&&o.jsxs("span",{className:"flex items-center gap-2",children:[o.jsx("span",{style:{width:24,height:0,borderTop:"2.5px solid #16A34A"}}),"Material flow"]})]}),U==="interconnection"&&v.length>0&&os&&o.jsxs("div",{"aria-label":"Interconnection legend",className:"absolute right-3 bottom-3 z-10 flex flex-col gap-1.5 px-3 py-2",style:{background:"rgba(255,255,255,0.96)",border:"1px solid #D1D5DB",borderRadius:4,color:"#374151",fontSize:X.xs},children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("span",{style:{fontWeight:700},children:"Ports"}),We!=="none"?o.jsxs(o.Fragment,{children:[o.jsxs("span",{className:"flex items-center gap-1",children:[o.jsx(xn,{color:No.in,glyph:"→"})," in"]}),o.jsxs("span",{className:"flex items-center gap-1",children:[o.jsx(xn,{color:No.out,glyph:"→"})," out"]}),o.jsxs("span",{className:"flex items-center gap-1",children:[o.jsx(xn,{color:No.inout,glyph:"⇄"})," inout"]}),We==="all"&&o.jsxs("span",{className:"flex items-center gap-1",children:[o.jsx("span",{style:{width:9,height:9,borderRadius:2,flexShrink:0,background:"#6B728022",border:"1.5px solid #6B7280"}}),"nested"]})]}):o.jsx("span",{style:{color:"#9CA3AF"},children:"hidden"})]}),o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("span",{style:{fontWeight:700},children:"Flow"}),["data","energy","material"].map(n=>o.jsxs("span",{className:"flex items-center gap-1.5",children:[o.jsx("span",{style:{width:20,height:0,borderTop:`2.5px solid ${dl[n]}`}}),n]},n))]}),Lt&&o.jsxs("div",{className:"flex flex-col gap-1",children:[o.jsx("span",{style:{fontWeight:700},children:Lt.name}),o.jsx("div",{className:"flex flex-wrap gap-x-3 gap-y-1",children:[...Lt.colors.entries()].map(([n,l])=>o.jsxs("span",{className:"flex items-center gap-1",children:[o.jsx("span",{style:{width:11,height:11,borderRadius:2,background:l,border:"1px solid rgba(15,23,42,0.25)"}}),n]},n))})]})]}),!Ne&&v.length===0&&x&&o.jsx("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none",style:{zIndex:1},children:x.auto&&((Bs=x.elementIds)==null?void 0:Bs.length)===0?o.jsxs("div",{className:"text-center",style:{maxWidth:420},children:[o.jsx("div",{style:{fontSize:"32px",marginBottom:8},children:"🔍"}),o.jsx("div",{style:{fontSize:X.sm,color:"#374151",fontWeight:600,marginBottom:4},children:"This view selects no elements"}),o.jsx("div",{style:{fontSize:X.xs,color:"#6B7280",lineHeight:1.6},children:"The view is auto-populated from its selectionQuery in the model. Add includeElementKinds / includeLayers to its SysML definition, or add an `expose` member for the elements you want visible."})]}):o.jsxs("div",{className:"text-center",style:{opacity:.4},children:[o.jsx("div",{style:{fontSize:"32px",marginBottom:8},children:"🖱️"}),o.jsx("div",{style:{fontSize:X.sm,color:"#6B7280"},children:"Drag from palette or double-click to create elements"})]})}),He.length>=1&&o.jsx(kl,{count:He.length,onClose:Co,opacity:ia,onAlign:na,onMatchSize:sa,onDistribute:ra,onFill:n=>ln({color:n}),onOpacity:n=>ln({opacity:n}),onTextStyle:ln}),Ne&&o.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",zIndex:20,background:`linear-gradient(90deg, ${Gs.accent} 0%, ${Gs.accent}80 50%, transparent 100%)`,backgroundSize:"200% 100%",animation:"memo-layout-progress 1.2s linear infinite"}}),o.jsxs(wa,{className:"memo-diagram-canvas",nodes:v,edges:ge,nodeTypes:Ii,edgeTypes:Ai,onNodesChange:Xi,onEdgesChange:he,onNodeClick:qi,onNodeDoubleClick:Zi,onEdgeClick:Qi,onPaneClick:Ji,onNodeDragStart:Gi,onNodeDragStop:Ui,onNodeContextMenu:Ki,onEdgeContextMenu:Yi,onNodeMouseEnter:ea,onNodeMouseLeave:ws,onEdgeMouseEnter:ta,onEdgeMouseLeave:ws,onConnect:Oi,onConnectStart:Pi,onConnectEnd:$i,onReconnect:Wi,onReconnectStart:_i,onReconnectEnd:Hi,reconnectRadius:10,connectionMode:va.Loose,defaultEdgeOptions:{interactionWidth:24},snapToGrid:ci,snapGrid:bu,fitView:U!=="actionflow",fitViewOptions:{...fu,minZoom:po},minZoom:.1,maxZoom:3,zoomOnScroll:!0,panOnScroll:!0,panOnScrollMode:"free",selectionOnDrag:!0,panOnDrag:[1,2],multiSelectionKeyCode:["Shift","Meta","Control"],selectionKeyCode:null,proOptions:xu,style:U==="actionflow"?{...br,position:"absolute",left:0,top:Qe&&et==="above"?112:0,right:0,bottom:0,width:"auto",height:"auto"}:br,children:[Vo&&o.jsx(ka,{color:"#C5C7C2",gap:20,size:1.5}),o.jsx(Rl,{}),o.jsxs(Fa,{position:"bottom-right",showFitView:!1,style:{marginBottom:82},children:[o.jsx(So,{title:"Undo last diagram edit (⌘Z)","aria-label":"Undo last diagram edit",onClick:rn,children:"↶"}),o.jsx(So,{title:"Redo last diagram edit (⌘⇧Z)","aria-label":"Redo last diagram edit",onClick:an,children:"↷"}),o.jsx(So,{title:"Fit diagram to view","aria-label":"Fit diagram to view",onClick:()=>Xe(250),children:o.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("path",{d:"M8 3H3v5M16 3h5v5M21 16v5h-5M3 16v5h5"}),o.jsx("path",{d:"M3 8l5-5M21 8l-5-5M21 16l-5 5M3 16l5 5"})]})}),o.jsx(So,{title:"Toggle fullscreen canvas","aria-label":"Toggle fullscreen canvas",onClick:n=>{var d;const l=n.currentTarget.closest(".react-flow");l&&(document.fullscreenElement?document.exitFullscreen():(d=l.requestFullscreen)==null||d.call(l))},children:"⛶"})]}),v.length>20&&o.jsx(Ca,{style:gu,nodeColor:Ri,maskColor:"rgba(247, 247, 245, 0.7)"})]})]})]}),Be&&o.jsx(Fu,{x:Be.x,y:Be.y,onConfirm:Bi,onCancel:()=>zt(null)}),ot&&o.jsx(ul,{x:ot.x,y:ot.y,sourceElement:ot.sourceElement,targetElement:ot.targetElement,registries:r,allowedTypes:x==null?void 0:x.relationshipTypes,onSelect:Vi,onCancel:()=>oo(null)}),Re&&o.jsx(ld,{x:Re.x,y:Re.y,nodeId:Re.nodeId,nodeKind:Re.nodeKind,onClose:()=>yt(null),onEditName:()=>{M(n=>n.map(l=>l.id===Re.nodeId?{...l,data:{...l.data,_triggerEdit:!0}}:l))},onChangeColor:n=>oa(Re.nodeId,n),onRemoveFromDiagram:()=>vs(Re.nodeId),onDeleteFromModel:()=>{vs(Re.nodeId)},onShowProperties:()=>{b(Re.nodeId)},onShowInCatalog:()=>{b(Re.nodeId),F("catalog")},onFocusElement:()=>{On(Re.nodeId)},onShowRelMatrix:()=>{O({type:"traceability"})},onOpenSource:()=>{const n=t==null?void 0:t.elements[Re.nodeId];n!=null&&n.file&&(navigator.clipboard.writeText(n.file).catch(()=>{}),Wn(n.file))},onViewKindInOntology:()=>{const n=Re.nodeKind;let l=null,d=null;for(const h of N){for(const g of h.layers)if(g.kinds.some(C=>C.name===n)){l=h.name,d=g.id;break}if(l)break}l&&(L(n),T("ontologies"),F("ontology"),O({type:"ontology-detail",packageName:l,layerId:d??void 0}))}}),Ue&&o.jsx(dd,{x:Ue.x,y:Ue.y,edgeId:Ue.edgeId,relType:Ue.relType,onClose:()=>Mt(null),onChangeStyle:n=>aa(Ue.edgeId,n),onChangeColor:n=>la(Ue.edgeId,n),onToggleLabel:()=>ca(Ue.edgeId),onDelete:()=>H(n=>n.filter(l=>l.id!==Ue.edgeId))})]})}function Nu(){return o.jsx(ha,{children:o.jsx(Cu,{})})}export{Nu as DiagramCanvas};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/DiagramCanvas-
|
|
2
|
-
var Fe=Object.defineProperty;var Se=(t,r,l)=>r in t?Fe(t,r,{enumerable:!0,configurable:!0,writable:!0,value:l}):t[r]=l;var U=(t,r,l)=>Se(t,typeof r!="symbol"?r+"":r,l);import{_ as G,u as _,g as Ee,a as je,l as we,s as Ce,b as Re,c as ke,F as u,C as n,d as De,e as Ae,L as _e,f as Te,h as Le}from"./index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/DiagramCanvas-DtLlTvJf.js","assets/reactflow-C9OlmOYw.js","assets/zustand-CrhqMOHB.js","assets/index-a2rpMs5Y.js","assets/index-Cdkjp-H4.css","assets/notation-scene-CxT28i2i.js","assets/layout-providers-BSDYNZu0.js","assets/elk-6l8mIQnQ.js","assets/ExplorerTreeRow-CmGPHRI8.js","assets/DiagramToolbarControls-XMGLx08e.js","assets/style-BZV40eAE.css","assets/MaxGraphCanvas-BNn0Jxr6.js","assets/SysmlCodeEditor-i0BHj3of.js","assets/SysmlCodeEditor-BwKcXIZw.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
var Fe=Object.defineProperty;var Se=(t,r,l)=>r in t?Fe(t,r,{enumerable:!0,configurable:!0,writable:!0,value:l}):t[r]=l;var U=(t,r,l)=>Se(t,typeof r!="symbol"?r+"":r,l);import{_ as G,u as _,g as Ee,a as je,l as we,s as Ce,b as Re,c as ke,F as u,C as n,d as De,e as Ae,L as _e,f as Te,h as Le}from"./index-a2rpMs5Y.js";import{j as e,a as Me}from"./reactflow-C9OlmOYw.js";import{a as s}from"./zustand-CrhqMOHB.js";import{I as y}from"./DiagramToolbarControls-XMGLx08e.js";const Y="memo.renderer.reactflow";class Ne{constructor(){U(this,"providers",new Map);U(this,"components",new Map)}register(r){const l=this.providers.get(r.descriptor.id);if(l&&l!==r)throw new Error(`Renderer provider already registered: ${r.descriptor.id}`);this.providers.set(r.descriptor.id,r)}unregister(r){return this.components.delete(r),this.providers.delete(r)}get(r){return this.providers.get(r)}has(r){return this.providers.has(r)}list(r=[]){return[...this.providers.values()].map(l=>l.descriptor).filter(l=>r.every(i=>l.capabilities.includes(i))).sort((l,i)=>l.name.localeCompare(i.name))}loadComponent(r){const l=this.providers.get(r)??this.providers.get(Y);if(!l)throw new Error(`Renderer provider not found: ${r} (no default registered)`);const i=l.descriptor.id;let a=this.components.get(i);return a||(a=l.loadComponent(),this.components.set(i,a)),a}}const $e={descriptor:{id:"memo.renderer.reactflow",name:"ReactFlow",engine:"ReactFlow (@xyflow/react 12)",version:"12",contractVersion:"1",license:"MIT",description:"Default authoring canvas — React node components, palette, full editing.",capabilities:["interactive-editing","all-view-kinds","manual-layout","undo-redo","minimap","orthogonal-routes"]},loadComponent:()=>G(()=>import("./DiagramCanvas-DtLlTvJf.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])).then(t=>t.DiagramCanvas)},ze={descriptor:{id:"memo.renderer.maxgraph",name:"maxGraph",engine:"maxGraph (@maxgraph/core — draw.io rendering engine lineage)",version:"0.x",contractVersion:"1",license:"Apache-2.0",description:"draw.io-style retained-mode canvas — SVG cells, rubberband selection, image export.",capabilities:["all-view-kinds","manual-layout","export-image"]},loadComponent:()=>G(()=>import("./MaxGraphCanvas-BNn0Jxr6.js"),__vite__mapDeps([11,1,2,3,4,5,6,7,8])).then(t=>t.MaxGraphCanvas)},B=new Ne;B.register($e);B.register(ze);const Ie={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},Be="memo.diagram.renderer.v3",Oe="renderer",Pe="memo.renderer.",ae=new Set;function q(t){const r=t==null?void 0:t.trim();if(r)return r.includes(".")?r:`${Pe}${r}`}function Ve(){if(!(typeof window>"u"))try{return q(new URLSearchParams(window.location.search).get(Oe))}catch{return}}function Ue(){if(!(typeof window>"u"))try{return q(window.localStorage.getItem(Be))}catch{return}}function Ge(){try{const t=Ie;return q(t==null?void 0:t.VITE_MEMO_DIAGRAM_RENDERER)}catch{return}}function ce(){return Ve()??Ue()??Ge()??Y}function Ye(t){return ae.add(t),()=>ae.delete(t)}function qe(){return e.jsx("div",{className:"flex-1 flex items-center justify-center",style:{background:"#F7F7F5",color:"#9CA3AF",fontSize:13},children:"Loading renderer…"})}function We(){const t=s.useSyncExternalStore(Ye,ce,ce),r=B.has(t)?t:Y,l=s.useMemo(()=>s.lazy(()=>B.loadComponent(r).then(i=>({default:i}))),[r]);return e.jsx("div",{className:"relative flex flex-1 overflow-hidden",children:e.jsx(s.Suspense,{fallback:e.jsx(qe,{}),children:e.jsx(l,{})})})}const He=s.lazy(()=>G(()=>import("./SysmlCodeEditor-i0BHj3of.js"),__vite__mapDeps([12,1,2,13])).then(t=>({default:t.SysmlCodeEditor})));function Ke(t,r){const l=(t.elementIds??[]).map(i=>r[i]).filter(Boolean).map(i=>` ${i.construct??"part"} ${i.id} : ${i.kind};`).join(`
|
|
3
3
|
`);return[`package '${t.name}' {`,` // Diagram: ${t.diagramType.toUpperCase()} | Viewpoint: ${t.viewpointId}`,l||" // No elements selected","}"].join(`
|
|
4
4
|
`)}function Qe({diagram:t}){const r=_(c=>c.model),l=_(c=>c.updateDiagramElementIds),[i,a]=s.useState(""),f=s.useMemo(()=>Ae(r),[r]),S=s.useCallback(c=>{const m=new Set(t.elementIds??[]);m.has(c)?m.delete(c):m.add(c),l(t.id,[...m])},[t.id,t.elementIds,l]),R=s.useMemo(()=>new Set(t.elementIds??[]),[t.elementIds]),E=_e.filter(c=>f.has(c));return e.jsxs("div",{className:"flex flex-col h-full overflow-hidden",style:{width:"220px",borderLeft:`1px solid ${n.border}`,background:"#FAFAF8",flexShrink:0},children:[e.jsxs("div",{className:"px-2 py-1.5",style:{borderBottom:`1px solid ${n.border}`},children:[e.jsxs("div",{className:"font-semibold mb-1",style:{color:n.primary,fontSize:u.xs},children:["Elements (",R.size," selected)"]}),e.jsx("input",{value:i,onChange:c=>a(c.target.value),placeholder:"Filter…",className:"w-full px-2 py-1 rounded focus:outline-none",style:{background:"#F0F0ED",border:`1px solid ${n.border}`,color:n.primary,fontSize:u.xs}})]}),e.jsx("div",{className:"flex-1 overflow-y-auto py-1",children:E.map(c=>{const m=(f.get(c)??[]).filter(p=>!i||p.name.toLowerCase().includes(i.toLowerCase())||p.id.toLowerCase().includes(i.toLowerCase()));if(m.length===0)return null;const O=Le[c]??n.muted;return e.jsxs("div",{children:[e.jsx("div",{className:"px-2 py-1 font-semibold",style:{color:O,fontSize:u.badge},children:Te[c]??c}),m.map(p=>e.jsxs("label",{className:"flex items-center gap-2 px-3 py-0.5 cursor-pointer",style:{fontSize:u.xs},onMouseEnter:x=>x.currentTarget.style.background="#F0F0ED",onMouseLeave:x=>x.currentTarget.style.background="transparent",children:[e.jsx("input",{type:"checkbox",checked:R.has(p.id),onChange:()=>S(p.id),style:{accentColor:n.accent}}),e.jsx("span",{className:"truncate",style:{color:n.primary},title:p.id,children:p.name||p.id})]},p.id))]},c)})})]})}function de({tone:t,message:r,actions:l}){const i=t==="conflict";return e.jsxs("div",{role:"alert",className:"flex items-center gap-2 px-3 py-1.5 flex-wrap",style:{background:i?"#FEF2F2":"#FFFBEB",borderBottom:`1px solid ${i?"#FECACA":"#FDE68A"}`,color:i?"#B91C1C":"#92400E",fontSize:u.xs,flexShrink:0},children:[e.jsx("span",{className:"flex-1",style:{minWidth:180},children:r}),l.map(a=>e.jsx("button",{onClick:a.onClick,title:a.hint,style:{fontSize:u.xs,padding:"2px 8px",borderRadius:5,cursor:"pointer",background:"#FFFFFF",border:`1px solid ${i?"#FECACA":"#FDE68A"}`,color:"inherit",fontWeight:600,whiteSpace:"nowrap"},children:a.label},a.label))]})}const Xe=4e3;function Je({at:t}){const[r,l]=s.useState(!1);return s.useEffect(()=>{if(!t)return;l(!0);const i=setTimeout(()=>l(!1),Xe);return()=>clearTimeout(i)},[t]),r?e.jsx("span",{title:"A source file this view depends on changed; the view was rebuilt",style:{fontSize:u.badge,padding:"1px 6px",borderRadius:999,background:"#ECFDF5",color:"#047857",border:"1px solid #A7F3D0",whiteSpace:"nowrap"},children:"↻ Refreshed from source"}):null}const Ze=[];function nt({diagramId:t}){const r=_(o=>o.model),l=_(o=>o.diagramParseErrors[t]??Ze),i=_(o=>o.lastSourceChange),a=Ee(r,t),[f,S]=s.useState("visual"),[R,E]=s.useState(""),[c,m]=s.useState(!1),[O,p]=s.useState(!1),[x,W]=s.useState(!1),[h,T]=s.useState(!1),[k,F]=s.useState(null),[ue,H]=s.useState(null),[L,D]=s.useState(null),[M,N]=s.useState(null),[fe,he]=s.useState(null),[K,Q]=s.useState([]),[g,X]=s.useState(()=>localStorage.getItem("memo.diagramEditor.autoSave")==="true"),[j,pe]=s.useState(null),w=s.useRef(),b=s.useRef(""),J=s.useRef(0),A=s.useRef(void 0),$=s.useRef(0),Z=s.useRef(!1);s.useEffect(()=>{Z.current=h},[h]),s.useEffect(()=>{const o=()=>pe(document.getElementById("memo-diagram-editor-controls"));o();const v=new MutationObserver(o);return v.observe(document.body,{childList:!0,subtree:!0}),()=>v.disconnect()},[]);const ee=s.useMemo(()=>je(r,t),[r,t]),z=s.useCallback(async()=>{const o=++$.current,v=t;m(!0);try{const d=await we(v);if($.current!==o)return!1;const le=d.text??"";return b.current=le,A.current=d.revision,E(le),p(!0),T(!1),F(null),N(null),D(null),!0}catch(d){return $.current===o&&F(d instanceof Error?d.message:String(d)),!1}finally{$.current===o&&m(!1)}},[t]);s.useEffect(()=>{if(clearTimeout(w.current),F(null),H(null),T(!1),D(null),N(null),Q([]),A.current=void 0,!(!a||!r)){if(!a.sourceFile||window.__MEMO_DATA__){const o=Ke(a,r.elements);b.current=o,E(o),m(!1),p(!1);return}E(""),b.current="",p(!1),z()}},[t,a==null?void 0:a.sourceFile]),s.useEffect(()=>{if(!i||!(a!=null&&a.sourceFile)||window.__MEMO_DATA__||!Ce(i,ee))return;he(i.at);const o=i.files.includes(a.sourceFile);if(o){if(Z.current){D({files:i.files.filter(v=>ee.includes(v)),at:i.at,touchesOwnSource:o});return}z()}},[i==null?void 0:i.seq]);const xe=o=>{b.current=o,E(o),T(!0),F(null)},I=s.useCallback(async o=>{if(!a)return;const v=++J.current;W(!0),F(null);try{if(a.sourceFile){if(!A.current)throw new Error("Reload the source before saving this edit.");const d=await Re(t,o,A.current);if(d.conflict){N({theirs:d.text??"",revision:d.revision,at:Date.now()}),F(d.error??"The file changed on disk since this edit began.");return}A.current=d.revision,N(null),D(null),Q(d.parseErrors??[])}else ke(t,o);b.current===o&&T(!1),H(Date.now())}catch(d){F(d instanceof Error?d.message:String(d))}finally{J.current===v&&W(!1)}},[a,t]),te=s.useCallback(()=>{clearTimeout(w.current),z()},[z]),me=s.useCallback(()=>{navigator.clipboard.writeText(b.current)},[]),ge=s.useCallback(()=>{const o=new Blob([b.current],{type:"text/plain;charset=utf-8"}),v=URL.createObjectURL(o),d=document.createElement("a");d.href=v,d.download=`${t}-rejected.sysml`,d.click(),URL.revokeObjectURL(v)},[t]);s.useEffect(()=>(localStorage.setItem("memo.diagramEditor.autoSave",String(g)),clearTimeout(w.current),g&&h&&!c&&!M&&(w.current=setTimeout(()=>void I(b.current),800)),()=>clearTimeout(w.current)),[g,h,c,R,I,M]);const P=s.useCallback(()=>{clearTimeout(w.current),I(b.current)},[I]),ve=s.useMemo(()=>Object.values((r==null?void 0:r.elements)??{}).map(o=>({id:o.id,name:o.name,kind:o.kind})),[r==null?void 0:r.elements]);if(!a)return e.jsx("div",{className:"flex-1 flex items-center justify-center",style:{color:n.faint,fontSize:u.sm},children:"Diagram not found"});const re=a.auto,C=!re||!!a.sourceFile&&O,se=e.jsxs("div",{className:"flex flex-col h-full flex-1 overflow-hidden",children:[M&&e.jsx(de,{tone:"conflict",message:`${a.sourceFile} changed on disk. Your rejected edit remains in this buffer and was not written.`,actions:[{label:"Copy draft",onClick:me,hint:"Copy the rejected SysML edit"},{label:"Download rejected edit",onClick:ge,hint:"Export the rejected SysML edit"},{label:"Reveal file",onClick:()=>De(a.sourceFile),hint:"Open the changed source file"},{label:"Reload from disk",onClick:te,hint:"Discard the draft and load current disk content"}]}),!M&&L&&e.jsx(de,{tone:"notice",message:L.files.length>1?`${L.files.length} source files changed on disk. Your unsaved edits are untouched.`:`${L.files[0]} changed on disk. Your unsaved edits are untouched.`,actions:[{label:"Reload from disk",onClick:te,hint:"Discards your unsaved edits"},{label:"Keep editing",onClick:()=>D(null),hint:"Dismiss until the next change"}]}),e.jsx("div",{className:"flex-1 overflow-hidden",style:{background:"#1E1E1E"},children:e.jsx(s.Suspense,{fallback:e.jsx("div",{className:"h-full flex items-center justify-center",style:{color:"#9CA3AF",fontSize:u.xs},children:"Loading SysML editor…"}),children:e.jsx(He,{value:R,sourceFile:a.sourceFile,readOnly:!C||c,symbols:ve,onChange:xe,onSave:()=>{C&&h&&P()}})})}),K.length>0&&e.jsx("div",{className:"px-3 py-1.5 text-xs",style:{background:"#1C1407",color:"#FCD34D",borderTop:"1px solid #3B2A0A",fontFamily:"monospace"},title:"Saved, but the file does not parse — the model keeps its last good state for this file",children:K.join(" · ")}),l.length>0&&e.jsx("div",{className:"px-3 py-1.5 text-xs",style:{background:"#1C0A0A",color:"#F87171",borderTop:"1px solid #3B0A0A",fontFamily:"monospace"},children:l.join(" · ")}),k&&e.jsx("div",{className:"px-3 py-1.5 text-xs",style:{background:"#1C0A0A",color:"#FCA5A5",borderTop:"1px solid #3B0A0A"},children:k}),!C&&e.jsx("div",{className:"px-3 py-1.5 text-xs",style:{background:"#F9F9F8",color:n.faint,borderTop:`1px solid ${n.border}`},children:a.sourceFile&&window.__MEMO_DATA__?"Static build — run memo-architect dev to edit the SysML source":a.sourceFile?"The SysML source could not be loaded":"Generated model view — no editable SysML source file"})]}),oe=e.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[e.jsx("div",{className:"flex-1 flex flex-col overflow-hidden",children:e.jsx(We,{})}),!re&&e.jsx(Qe,{diagram:a})]}),ne=(j==null?void 0:j.dataset.compactDiagramTools)==="true",ie={visual:"split",split:"text",text:"visual"},V={visual:"Visual",split:"Both",text:"Text"},be=f==="visual"?e.jsx(y.eye,{}):f==="split"?e.jsx(y.split,{}):e.jsx(y.code,{}),ye=j?e.jsxs(e.Fragment,{children:[C&&e.jsx("button",{type:"button","aria-label":`Auto-save ${g?"on":"off"}`,"aria-pressed":g,onClick:()=>X(o=>!o),title:`Auto-save ${g?"on":"off"}. Click to turn it ${g?"off":"on"}.`,style:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",padding:0,borderRadius:5,border:`1px solid ${g?"#A7F3D0":n.border}`,cursor:"pointer",background:g?"#ECFDF5":"#FFFFFF",color:g?"#047857":n.secondary},children:e.jsx(y.clock,{})}),C&&e.jsx("button",{"aria-label":"Save SysML",onClick:P,disabled:!h||x||c,title:"Save SysML (Ctrl/Cmd+S)",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",padding:0,borderRadius:5,border:`1px solid ${n.border}`,cursor:!h||x||c?"default":"pointer",background:h?n.accent:"#F0F0ED",color:h?"#FFFFFF":n.faint},children:e.jsx(y.save,{})}),ne?e.jsx("button",{type:"button","aria-label":`Editor mode: ${V[f]}`,title:`Editor mode: ${V[f]}. Click to switch to ${V[ie[f]]}.`,onClick:()=>S(ie[f]),style:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",borderRadius:5,border:"1px solid #1B3A4B",cursor:"pointer",background:"#1B3A4B",color:"#FFFFFF"},children:be}):e.jsxs("select",{"aria-label":"Diagram editor view",title:"Choose editor view",value:f,onChange:o=>S(o.target.value),style:{fontSize:u.xs,height:28,padding:"0 6px",borderRadius:5,border:`1px solid ${n.border}`,background:"#FFFFFF",color:n.primary},children:[e.jsx("option",{value:"visual",children:"Visual"}),e.jsx("option",{value:"split",children:"Both"}),e.jsx("option",{value:"text",children:"Text"})]})]}):e.jsxs(e.Fragment,{children:[e.jsx(Je,{at:fe}),c&&e.jsx("span",{style:{color:n.faint,fontSize:u.xs},children:"Loading source…"}),x&&e.jsx("span",{style:{color:n.faint,fontSize:u.xs},children:"Saving…"}),!x&&k&&e.jsx("span",{title:k,style:{color:"#EF4444",fontSize:u.xs},children:"Save failed"}),!x&&!k&&h&&e.jsx("span",{style:{color:"#B45309",fontSize:u.xs},children:"Unsaved"}),!x&&!h&&ue&&e.jsx("span",{style:{color:"#15803D",fontSize:u.xs},children:"Saved"}),!x&&l.length>0&&e.jsxs("span",{style:{color:"#EF4444",fontSize:u.xs},children:[l.length," error",l.length>1?"s":""]}),C&&e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"flex items-center gap-1",style:{color:n.secondary,fontSize:u.xs},title:"Save changes 800ms after typing",children:[e.jsx("input",{type:"checkbox",checked:g,onChange:o=>X(o.target.checked),style:{accentColor:n.accent}}),"Auto-save"]}),e.jsx("button",{onClick:P,disabled:!h||x||c,title:"Save SysML (Ctrl/Cmd+S)",style:{fontSize:u.xs,padding:"3px 10px",borderRadius:"5px",border:`1px solid ${n.border}`,cursor:!h||x||c?"default":"pointer",background:h?n.accent:"#F0F0ED",color:h?"#FFFFFF":n.faint,fontWeight:600},children:"Save"})]}),e.jsxs("label",{className:"flex items-center gap-1",style:{color:n.secondary,fontSize:u.xs},children:["View",e.jsxs("select",{"aria-label":"Diagram editor view",value:f,onChange:o=>S(o.target.value),style:{fontSize:u.xs,padding:"3px 8px",borderRadius:"5px",border:`1px solid ${n.border}`,background:"#FFFFFF",color:n.primary},children:[e.jsx("option",{value:"visual",children:"Visual"}),e.jsx("option",{value:"split",children:"Both"}),e.jsx("option",{value:"text",children:"Text"})]})]})]});return e.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[e.jsxs("div",{className:"relative flex items-center justify-center px-3 py-2",style:{borderBottom:`1px solid ${n.border}`,background:"#FAFAF8",flexShrink:0},children:[f!=="visual"&&e.jsxs("button",{type:"button",onClick:()=>S("visual"),title:"Return to the visual diagram",className:"absolute left-3 flex items-center gap-1.5 rounded-md px-2 py-1 text-xs font-semibold",style:{border:`1px solid ${n.border}`,background:"#FFFFFF",color:n.primary},children:[e.jsx(y.eye,{}),"Return to diagram"]}),e.jsx("span",{className:"truncate",style:{color:n.primary,fontSize:u.md,fontWeight:700},children:a.name}),f==="visual"&&e.jsxs("div",{className:"absolute right-3 flex items-center gap-1",children:[e.jsx("button",{type:"button",onClick:()=>window.dispatchEvent(new Event("memo:toggle-diagram-elements")),title:"Show or hide Diagram Elements","aria-label":"Show or hide Diagram Elements",style:{width:28,height:28,display:"flex",alignItems:"center",justifyContent:"center",border:`1px solid ${n.border}`,borderRadius:5,background:"#FFFFFF",color:n.secondary,cursor:"pointer"},children:e.jsx(y.elements,{size:18})}),e.jsx("button",{type:"button",onClick:()=>window.dispatchEvent(new Event("memo:toggle-diagram-toolbar")),title:"Show or hide Toolbar","aria-label":"Show or hide Toolbar",style:{width:28,height:28,display:"flex",alignItems:"center",justifyContent:"center",border:`1px solid ${n.border}`,borderRadius:5,background:"#FFFFFF",color:n.secondary,cursor:"pointer"},children:e.jsx(y.tools,{size:18})})]})]}),e.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[f==="visual"&&oe,f==="text"&&se,f==="split"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{width:"50%",borderRight:`1px solid ${n.border}`,display:"flex",flexDirection:"column",overflow:"hidden"},children:se}),e.jsx("div",{style:{width:"50%",display:"flex",overflow:"hidden"},children:oe})]})]}),j&&Me.createPortal(e.jsx("div",{className:ne?"contents":"flex flex-wrap items-center gap-2",children:ye}),j)]})}export{nt as DiagramEditor};
|