@memoarchitect/architect 0.10.5 → 0.11.2

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.
Files changed (36) hide show
  1. package/README.md +1 -1
  2. package/dist/assets/{AiWorkspace-DABn1bcB.js → AiWorkspace-GFHs046m.js} +1 -1
  3. package/dist/assets/{AnalysisWorkspace-B8CYPLNe.js → AnalysisWorkspace-BfZ4GYza.js} +1 -1
  4. package/dist/assets/{ComplianceWizard-DqeyOz4M.js → ComplianceWizard-CYBizPbC.js} +1 -1
  5. package/dist/assets/{DSMView-V3iNMXFW.js → DSMView-BsjhUbpW.js} +1 -1
  6. package/dist/assets/{Dashboard-BQj09cZH.js → Dashboard-rdbfFJYx.js} +1 -1
  7. package/dist/assets/{DhfDashboard-K1p89I1a.js → DhfDashboard-BdhBA4OL.js} +1 -1
  8. package/dist/assets/{DhfWorkbench-BqS0Z41-.js → DhfWorkbench-tnIpEFmu.js} +3 -3
  9. package/dist/assets/{DiagramCanvas-BkKlNUeI.js → DiagramCanvas-BmVByLcM.js} +4 -4
  10. package/dist/assets/{DiagramEditor-D6CT8dNm.js → DiagramEditor-icnDwdxM.js} +2 -2
  11. package/dist/assets/{ElementDetailView-D1ydy4ml.js → ElementDetailView-Crpltlrz.js} +1 -1
  12. package/dist/assets/ExplorerTreeRow-DG8T31JS.js +3 -0
  13. package/dist/assets/{ImportView-RFKKNv71.js → ImportView-1vrZ1CGB.js} +1 -1
  14. package/dist/assets/{LayerGrid-D0ulV2Rw.js → LayerGrid-DnP2smgG.js} +1 -1
  15. package/dist/assets/{LayerTable-CZR1_QVc.js → LayerTable-97qPfMD3.js} +1 -1
  16. package/dist/assets/{MaxGraphCanvas-iQCvQs_L.js → MaxGraphCanvas-BJss9LYp.js} +1 -1
  17. package/dist/assets/{ModelDiff-CNpUtYV1.js → ModelDiff-H5nxOavB.js} +1 -1
  18. package/dist/assets/{OntologyDecompositionDiagram-DsCM8X-l.js → OntologyDecompositionDiagram-D0G3A7-R.js} +1 -1
  19. package/dist/assets/{OntologyViewer-Cx5WU_uI.js → OntologyViewer-0BJ2jMZ8.js} +2 -2
  20. package/dist/assets/{ReviewDashboard-B6tw6wBJ.js → ReviewDashboard-Dl-YTC4_.js} +1 -1
  21. package/dist/assets/{ScenarioEditor-B_M819qh.js → ScenarioEditor-CiHaTvVY.js} +1 -1
  22. package/dist/assets/{StatisticsDashboard-DDsFeIAZ.js → StatisticsDashboard-w2dtCD94.js} +1 -1
  23. package/dist/assets/{TabularView-kcWhQVcI.js → TabularView-CFy0PK1L.js} +1 -1
  24. package/dist/assets/{TraceabilityMatrix-DGny6KvJ.js → TraceabilityMatrix-DDoHYsCP.js} +1 -1
  25. package/dist/assets/UiScreensWorkspace-DOxjCMG9.js +1 -0
  26. package/dist/assets/{WorkflowWizard-D9NwvOlw.js → WorkflowWizard-Br1zPSLC.js} +1 -1
  27. package/dist/assets/{index-BFvU1nLo.js → index-DEVvBtNh.js} +67 -67
  28. package/dist/assets/{index.es-BxzJo0aw.js → index.es-D0WykKwq.js} +1 -1
  29. package/dist/assets/{jspdf.es.min-B7Dh4CBm.js → jspdf.es.min-DZ4wvU_9.js} +3 -3
  30. package/dist/assets/notation-scene-HbscVJH5.js +1 -0
  31. package/dist/index.html +1 -1
  32. package/dist-standalone/index.html +185 -185
  33. package/package.json +3 -3
  34. package/dist/assets/ExplorerTreeRow-DNlv-JxW.js +0 -3
  35. package/dist/assets/UiScreensWorkspace-BpIx67i-.js +0 -1
  36. package/dist/assets/notation-scene-BB2meNb3.js +0 -1
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/DiagramCanvas-BkKlNUeI.js","assets/reactflow-C9OlmOYw.js","assets/zustand-CrhqMOHB.js","assets/index-BFvU1nLo.js","assets/index-BVySIRo1.css","assets/notation-scene-BB2meNb3.js","assets/layout-providers-BSDYNZu0.js","assets/elk-6l8mIQnQ.js","assets/ExplorerTreeRow-DNlv-JxW.js","assets/DiagramToolbarControls-XMGLx08e.js","assets/style-BZV40eAE.css","assets/MaxGraphCanvas-iQCvQs_L.js","assets/SysmlCodeEditor-i0BHj3of.js","assets/SysmlCodeEditor-BwKcXIZw.css"])))=>i.map(i=>d[i]);
2
- var Se=Object.defineProperty;var Ee=(t,r,a)=>r in t?Se(t,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[r]=a;var U=(t,r,a)=>Ee(t,typeof r!="symbol"?r+"":r,a);import{_ as G,u as _,g as we,a as je,l as Re,s as Ce,b as ke,c as De,F as u,C as l,d as Ae,e as _e,L as Le,f as Te,h as $e}from"./index-BFvU1nLo.js";import{j as e,a as Me}from"./reactflow-C9OlmOYw.js";import{a as o}from"./zustand-CrhqMOHB.js";import{I as E}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 a=this.providers.get(r.descriptor.id);if(a&&a!==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(a=>a.descriptor).filter(a=>r.every(s=>a.capabilities.includes(s))).sort((a,s)=>a.name.localeCompare(s.name))}loadComponent(r){const a=this.providers.get(r)??this.providers.get(Y);if(!a)throw new Error(`Renderer provider not found: ${r} (no default registered)`);const s=a.descriptor.id;let i=this.components.get(s);return i||(i=a.loadComponent(),this.components.set(s,i)),i}}const ze={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-BkKlNUeI.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])).then(t=>t.DiagramCanvas)},Ie={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-iQCvQs_L.js"),__vite__mapDeps([11,1,2,3,4,5,6,7,8])).then(t=>t.MaxGraphCanvas)},B=new Ne;B.register(ze);B.register(Ie);const Be={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},Oe="memo.diagram.renderer.v3",Pe="renderer",Ve="memo.renderer.",le=new Set;function W(t){const r=t==null?void 0:t.trim();if(r)return r.includes(".")?r:`${Ve}${r}`}function Ue(){if(!(typeof window>"u"))try{return W(new URLSearchParams(window.location.search).get(Pe))}catch{return}}function Ge(){if(!(typeof window>"u"))try{return W(window.localStorage.getItem(Oe))}catch{return}}function Ye(){try{const t=Be;return W(t==null?void 0:t.VITE_MEMO_DIAGRAM_RENDERER)}catch{return}}function ae(){return Ue()??Ge()??Ye()??Y}function We(t){return le.add(t),()=>le.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 He(){const t=o.useSyncExternalStore(We,ae,ae),r=B.has(t)?t:Y,a=o.useMemo(()=>o.lazy(()=>B.loadComponent(r).then(s=>({default:s}))),[r]);return e.jsx("div",{className:"relative flex flex-1 overflow-hidden",children:e.jsx(o.Suspense,{fallback:e.jsx(qe,{}),children:e.jsx(a,{})})})}const Ke={error:{badge:"#7F1D1D",border:"#EF4444",text:"#FEE2E2",mark:"#FCA5A5"},warning:{badge:"#78350F",border:"#F59E0B",text:"#FEF3C7",mark:"#FCD34D"}};function ce({messages:t,severity:r="error",title:a}){const[s,i]=o.useState(!1),f=o.useRef(null),h=Ke[r];if(o.useEffect(()=>{if(!s)return;const p=c=>{var m;(m=f.current)!=null&&m.contains(c.target)||i(!1)};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[s]),t.length===0)return null;const S=`${t.length} ${r}${t.length===1?"":"s"} — click for detail`;return e.jsxs("div",{ref:f,style:{position:"relative",display:"flex",alignItems:"center"},children:[e.jsxs("button",{type:"button",role:"status","aria-live":"polite","aria-expanded":s,"aria-label":S,title:S,onClick:()=>i(p=>!p),style:{display:"flex",alignItems:"center",gap:5,background:h.badge,border:`1px solid ${h.border}`,borderRadius:999,padding:"2px 9px",color:h.text,cursor:"pointer",fontSize:"11px",fontWeight:700,lineHeight:1.6},children:[e.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[e.jsx("circle",{cx:"12",cy:"12",r:"9",stroke:h.mark,strokeWidth:"2"}),e.jsx("path",{d:"M12 7v6",stroke:h.mark,strokeWidth:"2",strokeLinecap:"round"}),e.jsx("circle",{cx:"12",cy:"16.5",r:"1.1",fill:h.mark})]}),t.length]}),s&&e.jsxs("div",{role:"dialog","aria-label":a,style:{position:"absolute",bottom:"calc(100% + 8px)",right:0,zIndex:9100,width:"min(560px, calc(100vw - 48px))",maxHeight:"40vh",overflowY:"auto",background:"#1E293B",border:`1px solid ${h.border}`,borderRadius:10,padding:"11px 14px",boxShadow:"0 12px 32px rgba(0,0,0,0.35)"},children:[e.jsx("div",{style:{fontSize:"0.8rem",fontWeight:600,color:h.mark,marginBottom:6},children:a}),t.map((p,c)=>e.jsx("div",{style:{fontSize:"0.7rem",color:"#CBD5E1",fontFamily:"monospace",lineHeight:1.55},children:p},`${c}:${p}`))]})]})}const Qe=o.lazy(()=>G(()=>import("./SysmlCodeEditor-i0BHj3of.js"),__vite__mapDeps([12,1,2,13])).then(t=>({default:t.SysmlCodeEditor})));function Xe(t,r){const a=(t.elementIds??[]).map(s=>r[s]).filter(Boolean).map(s=>` ${s.construct??"part"} ${s.id} : ${s.kind};`).join(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/DiagramCanvas-BmVByLcM.js","assets/reactflow-C9OlmOYw.js","assets/zustand-CrhqMOHB.js","assets/index-DEVvBtNh.js","assets/index-BVySIRo1.css","assets/notation-scene-HbscVJH5.js","assets/layout-providers-BSDYNZu0.js","assets/elk-6l8mIQnQ.js","assets/ExplorerTreeRow-DG8T31JS.js","assets/DiagramToolbarControls-XMGLx08e.js","assets/style-BZV40eAE.css","assets/MaxGraphCanvas-BJss9LYp.js","assets/SysmlCodeEditor-i0BHj3of.js","assets/SysmlCodeEditor-BwKcXIZw.css"])))=>i.map(i=>d[i]);
2
+ var Se=Object.defineProperty;var Ee=(t,r,a)=>r in t?Se(t,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[r]=a;var U=(t,r,a)=>Ee(t,typeof r!="symbol"?r+"":r,a);import{_ as G,u as _,g as we,a as je,l as Re,s as Ce,b as ke,c as De,F as u,C as l,d as Ae,e as _e,L as Le,f as Te,h as $e}from"./index-DEVvBtNh.js";import{j as e,a as Me}from"./reactflow-C9OlmOYw.js";import{a as o}from"./zustand-CrhqMOHB.js";import{I as E}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 a=this.providers.get(r.descriptor.id);if(a&&a!==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(a=>a.descriptor).filter(a=>r.every(s=>a.capabilities.includes(s))).sort((a,s)=>a.name.localeCompare(s.name))}loadComponent(r){const a=this.providers.get(r)??this.providers.get(Y);if(!a)throw new Error(`Renderer provider not found: ${r} (no default registered)`);const s=a.descriptor.id;let i=this.components.get(s);return i||(i=a.loadComponent(),this.components.set(s,i)),i}}const ze={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-BmVByLcM.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])).then(t=>t.DiagramCanvas)},Ie={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-BJss9LYp.js"),__vite__mapDeps([11,1,2,3,4,5,6,7,8])).then(t=>t.MaxGraphCanvas)},B=new Ne;B.register(ze);B.register(Ie);const Be={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},Oe="memo.diagram.renderer.v3",Pe="renderer",Ve="memo.renderer.",le=new Set;function W(t){const r=t==null?void 0:t.trim();if(r)return r.includes(".")?r:`${Ve}${r}`}function Ue(){if(!(typeof window>"u"))try{return W(new URLSearchParams(window.location.search).get(Pe))}catch{return}}function Ge(){if(!(typeof window>"u"))try{return W(window.localStorage.getItem(Oe))}catch{return}}function Ye(){try{const t=Be;return W(t==null?void 0:t.VITE_MEMO_DIAGRAM_RENDERER)}catch{return}}function ae(){return Ue()??Ge()??Ye()??Y}function We(t){return le.add(t),()=>le.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 He(){const t=o.useSyncExternalStore(We,ae,ae),r=B.has(t)?t:Y,a=o.useMemo(()=>o.lazy(()=>B.loadComponent(r).then(s=>({default:s}))),[r]);return e.jsx("div",{className:"relative flex flex-1 overflow-hidden",children:e.jsx(o.Suspense,{fallback:e.jsx(qe,{}),children:e.jsx(a,{})})})}const Ke={error:{badge:"#7F1D1D",border:"#EF4444",text:"#FEE2E2",mark:"#FCA5A5"},warning:{badge:"#78350F",border:"#F59E0B",text:"#FEF3C7",mark:"#FCD34D"}};function ce({messages:t,severity:r="error",title:a}){const[s,i]=o.useState(!1),f=o.useRef(null),h=Ke[r];if(o.useEffect(()=>{if(!s)return;const p=c=>{var m;(m=f.current)!=null&&m.contains(c.target)||i(!1)};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[s]),t.length===0)return null;const S=`${t.length} ${r}${t.length===1?"":"s"} — click for detail`;return e.jsxs("div",{ref:f,style:{position:"relative",display:"flex",alignItems:"center"},children:[e.jsxs("button",{type:"button",role:"status","aria-live":"polite","aria-expanded":s,"aria-label":S,title:S,onClick:()=>i(p=>!p),style:{display:"flex",alignItems:"center",gap:5,background:h.badge,border:`1px solid ${h.border}`,borderRadius:999,padding:"2px 9px",color:h.text,cursor:"pointer",fontSize:"11px",fontWeight:700,lineHeight:1.6},children:[e.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[e.jsx("circle",{cx:"12",cy:"12",r:"9",stroke:h.mark,strokeWidth:"2"}),e.jsx("path",{d:"M12 7v6",stroke:h.mark,strokeWidth:"2",strokeLinecap:"round"}),e.jsx("circle",{cx:"12",cy:"16.5",r:"1.1",fill:h.mark})]}),t.length]}),s&&e.jsxs("div",{role:"dialog","aria-label":a,style:{position:"absolute",bottom:"calc(100% + 8px)",right:0,zIndex:9100,width:"min(560px, calc(100vw - 48px))",maxHeight:"40vh",overflowY:"auto",background:"#1E293B",border:`1px solid ${h.border}`,borderRadius:10,padding:"11px 14px",boxShadow:"0 12px 32px rgba(0,0,0,0.35)"},children:[e.jsx("div",{style:{fontSize:"0.8rem",fontWeight:600,color:h.mark,marginBottom:6},children:a}),t.map((p,c)=>e.jsx("div",{style:{fontSize:"0.7rem",color:"#CBD5E1",fontFamily:"monospace",lineHeight:1.55},children:p},`${c}:${p}`))]})]})}const Qe=o.lazy(()=>G(()=>import("./SysmlCodeEditor-i0BHj3of.js"),__vite__mapDeps([12,1,2,13])).then(t=>({default:t.SysmlCodeEditor})));function Xe(t,r){const a=(t.elementIds??[]).map(s=>r[s]).filter(Boolean).map(s=>` ${s.construct??"part"} ${s.id} : ${s.kind};`).join(`
3
3
  `);return[`package '${t.name}' {`,` // Diagram: ${t.diagramType.toUpperCase()} | Viewpoint: ${t.viewpointId}`,a||" // No elements selected","}"].join(`
4
4
  `)}function Je({diagram:t}){const r=_(c=>c.model),a=_(c=>c.updateDiagramElementIds),[s,i]=o.useState(""),f=o.useMemo(()=>_e(r),[r]),h=o.useCallback(c=>{const m=new Set(t.elementIds??[]);m.has(c)?m.delete(c):m.add(c),a(t.id,[...m])},[t.id,t.elementIds,a]),S=o.useMemo(()=>new Set(t.elementIds??[]),[t.elementIds]),p=Le.filter(c=>f.has(c));return e.jsxs("div",{className:"flex flex-col h-full overflow-hidden",style:{width:"220px",borderLeft:`1px solid ${l.border}`,background:"#FAFAF8",flexShrink:0},children:[e.jsxs("div",{className:"px-2 py-1.5",style:{borderBottom:`1px solid ${l.border}`},children:[e.jsxs("div",{className:"font-semibold mb-1",style:{color:l.primary,fontSize:u.xs},children:["Elements (",S.size," selected)"]}),e.jsx("input",{value:s,onChange:c=>i(c.target.value),placeholder:"Filter…",className:"w-full px-2 py-1 rounded focus:outline-none",style:{background:"#F0F0ED",border:`1px solid ${l.border}`,color:l.primary,fontSize:u.xs}})]}),e.jsx("div",{className:"flex-1 overflow-y-auto py-1",children:p.map(c=>{const m=(f.get(c)??[]).filter(g=>!s||g.name.toLowerCase().includes(s.toLowerCase())||g.id.toLowerCase().includes(s.toLowerCase()));if(m.length===0)return null;const O=$e[c]??l.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(g=>e.jsxs("label",{className:"flex items-center gap-2 px-3 py-0.5 cursor-pointer",style:{fontSize:u.xs},onMouseEnter:b=>b.currentTarget.style.background="#F0F0ED",onMouseLeave:b=>b.currentTarget.style.background="transparent",children:[e.jsx("input",{type:"checkbox",checked:S.has(g.id),onChange:()=>h(g.id),style:{accentColor:l.accent}}),e.jsx("span",{className:"truncate",style:{color:l.primary},title:g.id,children:g.name||g.id})]},g.id))]},c)})})]})}function de({tone:t,message:r,actions:a}){const s=t==="conflict";return e.jsxs("div",{role:"alert",className:"flex items-center gap-2 px-3 py-1.5 flex-wrap",style:{background:s?"#FEF2F2":"#FFFBEB",borderBottom:`1px solid ${s?"#FECACA":"#FDE68A"}`,color:s?"#B91C1C":"#92400E",fontSize:u.xs,flexShrink:0},children:[e.jsx("span",{className:"flex-1",style:{minWidth:180},children:r}),a.map(i=>e.jsx("button",{onClick:i.onClick,title:i.hint,style:{fontSize:u.xs,padding:"2px 8px",borderRadius:5,cursor:"pointer",background:"#FFFFFF",border:`1px solid ${s?"#FECACA":"#FDE68A"}`,color:"inherit",fontWeight:600,whiteSpace:"nowrap"},children:i.label},i.label))]})}const Ze=4e3;function et({at:t}){const[r,a]=o.useState(!1);return o.useEffect(()=>{if(!t)return;a(!0);const s=setTimeout(()=>a(!1),Ze);return()=>clearTimeout(s)},[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 tt=[];function lt({diagramId:t}){const r=_(n=>n.model),a=_(n=>n.diagramParseErrors[t]??tt),s=_(n=>n.lastSourceChange),i=we(r,t),[f,h]=o.useState("visual"),[S,p]=o.useState(""),[c,m]=o.useState(!1),[O,g]=o.useState(!1),[b,q]=o.useState(!1),[x,L]=o.useState(!1),[k,w]=o.useState(null),[ue,H]=o.useState(null),[T,D]=o.useState(null),[$,M]=o.useState(null),[fe,he]=o.useState(null),[xe,K]=o.useState([]),[v,Q]=o.useState(()=>localStorage.getItem("memo.diagramEditor.autoSave")==="true"),[j,pe]=o.useState(null),R=o.useRef(),F=o.useRef(""),X=o.useRef(0),A=o.useRef(void 0),N=o.useRef(0),J=o.useRef(!1);o.useEffect(()=>{J.current=x},[x]),o.useEffect(()=>{const n=()=>pe(document.getElementById("memo-diagram-editor-controls"));n();const y=new MutationObserver(n);return y.observe(document.body,{childList:!0,subtree:!0}),()=>y.disconnect()},[]);const Z=o.useMemo(()=>je(r,t),[r,t]),z=o.useCallback(async()=>{const n=++N.current,y=t;m(!0);try{const d=await Re(y);if(N.current!==n)return!1;const ie=d.text??"";return F.current=ie,A.current=d.revision,p(ie),g(!0),L(!1),w(null),M(null),D(null),!0}catch(d){return N.current===n&&w(d instanceof Error?d.message:String(d)),!1}finally{N.current===n&&m(!1)}},[t]);o.useEffect(()=>{if(clearTimeout(R.current),w(null),H(null),L(!1),D(null),M(null),K([]),A.current=void 0,!(!i||!r)){if(!i.sourceFile||window.__MEMO_DATA__){const n=Xe(i,r.elements);F.current=n,p(n),m(!1),g(!1);return}p(""),F.current="",g(!1),z()}},[t,i==null?void 0:i.sourceFile]),o.useEffect(()=>{if(!s||!(i!=null&&i.sourceFile)||window.__MEMO_DATA__||!Ce(s,Z))return;he(s.at);const n=s.files.includes(i.sourceFile);if(n){if(J.current){D({files:s.files.filter(y=>Z.includes(y)),at:s.at,touchesOwnSource:n});return}z()}},[s==null?void 0:s.seq]);const me=n=>{F.current=n,p(n),L(!0),w(null)},I=o.useCallback(async n=>{if(!i)return;const y=++X.current;q(!0),w(null);try{if(i.sourceFile){if(!A.current)throw new Error("Reload the source before saving this edit.");const d=await ke(t,n,A.current);if(d.conflict){M({theirs:d.text??"",revision:d.revision,at:Date.now()}),w(d.error??"The file changed on disk since this edit began.");return}A.current=d.revision,M(null),D(null),K(d.parseErrors??[])}else De(t,n);F.current===n&&L(!1),H(Date.now())}catch(d){w(d instanceof Error?d.message:String(d))}finally{X.current===y&&q(!1)}},[i,t]),ee=o.useCallback(()=>{clearTimeout(R.current),z()},[z]),ge=o.useCallback(()=>{navigator.clipboard.writeText(F.current)},[]),be=o.useCallback(()=>{const n=new Blob([F.current],{type:"text/plain;charset=utf-8"}),y=URL.createObjectURL(n),d=document.createElement("a");d.href=y,d.download=`${t}-rejected.sysml`,d.click(),URL.revokeObjectURL(y)},[t]);o.useEffect(()=>(localStorage.setItem("memo.diagramEditor.autoSave",String(v)),clearTimeout(R.current),v&&x&&!c&&!$&&(R.current=setTimeout(()=>void I(F.current),800)),()=>clearTimeout(R.current)),[v,x,c,S,I,$]);const P=o.useCallback(()=>{clearTimeout(R.current),I(F.current)},[I]),ve=o.useMemo(()=>Object.values((r==null?void 0:r.elements)??{}).map(n=>({id:n.id,name:n.name,kind:n.kind})),[r==null?void 0:r.elements]);if(!i)return e.jsx("div",{className:"flex-1 flex items-center justify-center",style:{color:l.faint,fontSize:u.sm},children:"Diagram not found"});const te=i.auto,C=!te||!!i.sourceFile&&O,re=e.jsxs("div",{className:"flex flex-col h-full flex-1 overflow-hidden",children:[$&&e.jsx(de,{tone:"conflict",message:`${i.sourceFile} changed on disk. Your rejected edit remains in this buffer and was not written.`,actions:[{label:"Copy draft",onClick:ge,hint:"Copy the rejected SysML edit"},{label:"Download rejected edit",onClick:be,hint:"Export the rejected SysML edit"},{label:"Reveal file",onClick:()=>Ae(i.sourceFile),hint:"Open the changed source file"},{label:"Reload from disk",onClick:ee,hint:"Discard the draft and load current disk content"}]}),!$&&T&&e.jsx(de,{tone:"notice",message:T.files.length>1?`${T.files.length} source files changed on disk. Your unsaved edits are untouched.`:`${T.files[0]} changed on disk. Your unsaved edits are untouched.`,actions:[{label:"Reload from disk",onClick:ee,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(o.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(Qe,{value:S,sourceFile:i.sourceFile,readOnly:!C||c,symbols:ve,onChange:me,onSave:()=>{C&&x&&P()}})})}),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:l.faint,borderTop:`1px solid ${l.border}`},children:i.sourceFile&&window.__MEMO_DATA__?"Static build — run memo-architect dev to edit the SysML source":i.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(He,{})}),!te&&e.jsx(Je,{diagram:i})]}),se=(j==null?void 0:j.dataset.compactDiagramTools)==="true",ne={visual:"split",split:"text",text:"visual"},V={visual:"Visual",split:"Both",text:"Text"},ye=f==="visual"?e.jsx(E.eye,{}):f==="split"?e.jsx(E.split,{}):e.jsx(E.code,{}),Fe=j?e.jsxs(e.Fragment,{children:[C&&e.jsx("button",{type:"button","aria-label":`Auto-save ${v?"on":"off"}`,"aria-pressed":v,onClick:()=>Q(n=>!n),title:`Auto-save ${v?"on":"off"}. Click to turn it ${v?"off":"on"}.`,style:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",padding:0,borderRadius:5,border:`1px solid ${v?"#A7F3D0":l.border}`,cursor:"pointer",background:v?"#ECFDF5":"#FFFFFF",color:v?"#047857":l.secondary},children:e.jsx(E.clock,{})}),C&&e.jsx("button",{"aria-label":"Save SysML",onClick:P,disabled:!x||b||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 ${l.border}`,cursor:!x||b||c?"default":"pointer",background:x?l.accent:"#F0F0ED",color:x?"#FFFFFF":l.faint},children:e.jsx(E.save,{})}),se?e.jsx("button",{type:"button","aria-label":`Editor mode: ${V[f]}`,title:`Editor mode: ${V[f]}. Click to switch to ${V[ne[f]]}.`,onClick:()=>h(ne[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:ye}):e.jsxs("select",{"aria-label":"Diagram editor view",title:"Choose editor view",value:f,onChange:n=>h(n.target.value),style:{fontSize:u.xs,height:28,padding:"0 6px",borderRadius:5,border:`1px solid ${l.border}`,background:"#FFFFFF",color:l.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(et,{at:fe}),c&&e.jsx("span",{style:{color:l.faint,fontSize:u.xs},children:"Loading source…"}),b&&e.jsx("span",{style:{color:l.faint,fontSize:u.xs},children:"Saving…"}),!b&&k&&e.jsx("span",{title:k,style:{color:"#EF4444",fontSize:u.xs},children:"Save failed"}),!b&&!k&&x&&e.jsx("span",{style:{color:"#B45309",fontSize:u.xs},children:"Unsaved"}),!b&&!x&&ue&&e.jsx("span",{style:{color:"#15803D",fontSize:u.xs},children:"Saved"}),!b&&e.jsx(ce,{messages:a,title:"This diagram's source does not parse"}),e.jsx(ce,{messages:xe,severity:"warning",title:"Saved, but the file does not parse — the model keeps its last good state for this file"}),C&&e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"flex items-center gap-1",style:{color:l.secondary,fontSize:u.xs},title:"Save changes 800ms after typing",children:[e.jsx("input",{type:"checkbox",checked:v,onChange:n=>Q(n.target.checked),style:{accentColor:l.accent}}),"Auto-save"]}),e.jsx("button",{onClick:P,disabled:!x||b||c,title:"Save SysML (Ctrl/Cmd+S)",style:{fontSize:u.xs,padding:"3px 10px",borderRadius:"5px",border:`1px solid ${l.border}`,cursor:!x||b||c?"default":"pointer",background:x?l.accent:"#F0F0ED",color:x?"#FFFFFF":l.faint,fontWeight:600},children:"Save"})]}),e.jsxs("label",{className:"flex items-center gap-1",style:{color:l.secondary,fontSize:u.xs},children:["View",e.jsxs("select",{"aria-label":"Diagram editor view",value:f,onChange:n=>h(n.target.value),style:{fontSize:u.xs,padding:"3px 8px",borderRadius:"5px",border:`1px solid ${l.border}`,background:"#FFFFFF",color:l.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 ${l.border}`,background:"#FAFAF8",flexShrink:0},children:[f!=="visual"&&e.jsxs("button",{type:"button",onClick:()=>h("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 ${l.border}`,background:"#FFFFFF",color:l.primary},children:[e.jsx(E.eye,{}),"Return to diagram"]}),e.jsx("span",{className:"truncate",style:{color:l.primary,fontSize:u.md,fontWeight:700},children:i.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 ${l.border}`,borderRadius:5,background:"#FFFFFF",color:l.secondary,cursor:"pointer"},children:e.jsx(E.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 ${l.border}`,borderRadius:5,background:"#FFFFFF",color:l.secondary,cursor:"pointer"},children:e.jsx(E.tools,{size:18})})]})]}),e.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[f==="visual"&&oe,f==="text"&&re,f==="split"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{width:"50%",borderRight:`1px solid ${l.border}`,display:"flex",flexDirection:"column",overflow:"hidden"},children:re}),e.jsx("div",{style:{width:"50%",display:"flex",overflow:"hidden"},children:oe})]})]}),j&&Me.createPortal(e.jsx("div",{className:se?"contents":"flex flex-wrap items-center gap-2",children:Fe}),j)]})}export{lt as DiagramEditor};
@@ -1,2 +1,2 @@
1
- import{j as e}from"./reactflow-C9OlmOYw.js";import{a as E}from"./zustand-CrhqMOHB.js";import{u as h,p as C,C as i,F as a,h as V,B as D,P as F,G as R,R as f,H as P,I as U,J as S,K as u}from"./index-BFvU1nLo.js";const r="page",H=new Set(["Scenario","UseCase","UserActivity"]);function _(p){return p?p.split(`
1
+ import{j as e}from"./reactflow-C9OlmOYw.js";import{a as E}from"./zustand-CrhqMOHB.js";import{u as h,p as C,C as i,F as a,h as V,B as D,P as F,G as R,R as f,H as P,I as U,J as S,K as u}from"./index-DEVvBtNh.js";const r="page",H=new Set(["Scenario","UseCase","UserActivity"]);function _(p){return p?p.split(`
2
2
  `).filter(o=>o.trim()).map((o,d)=>{const m=o.match(/^\d+\.\s*(.*)/);return{index:d,text:m?m[1].trim():o.trim()}}):[]}function K({element:p,layerColor:o,onSave:d}){const m=E.useMemo(()=>_(p.doc||""),[p.doc]),[w,y]=E.useState(!1);return w||m.length===0?e.jsxs("div",{children:[e.jsxs("p",{style:{fontSize:a.xs,color:i.faint,marginBottom:6,marginTop:0},children:["One step per line, numbered: ",e.jsx("code",{children:"1. User does something"})]}),e.jsx(R,{value:p.doc||"",onSave:x=>{d(x),y(!1)},density:r,multiline:!0,placeholder:"Click to add scenario steps…"})]}):e.jsxs("div",{style:{position:"relative"},children:[e.jsx("button",{onClick:()=>y(!0),style:{position:"absolute",top:0,right:0,fontSize:a.xs,color:i.muted,padding:"2px 9px",border:`1px solid ${i.border}`,borderRadius:"6px",background:i.surface,cursor:"pointer"},onMouseEnter:x=>{x.currentTarget.style.borderColor=i.accent},onMouseLeave:x=>{x.currentTarget.style.borderColor=i.border},children:"✎ Edit steps"}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",paddingTop:4},children:[e.jsx("div",{style:{padding:"6px 20px",borderRadius:"999px",fontSize:a.xs,fontWeight:700,background:o,color:"#fff",letterSpacing:"0.06em",textTransform:"uppercase"},children:"Start"}),m.map((x,s)=>e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",width:"100%"},children:[e.jsx(M,{color:o}),e.jsxs("div",{style:{width:"100%",maxWidth:"560px",display:"flex",alignItems:"flex-start",gap:"12px",background:i.surface,border:`1px solid ${o}30`,borderRadius:"8px",padding:"10px 14px",boxShadow:"0 1px 3px rgba(0,0,0,0.05)"},children:[e.jsx("span",{style:{flexShrink:0,width:"24px",height:"24px",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:o+"18",color:o,fontSize:a.xs,fontWeight:700},children:s+1}),e.jsx("span",{style:{fontSize:a.sm,color:i.primary,lineHeight:1.5,paddingTop:"3px"},children:x.text})]})]},s)),e.jsx(M,{color:o}),e.jsx("div",{style:{padding:"6px 20px",borderRadius:"999px",fontSize:a.xs,fontWeight:700,background:o+"20",color:o,letterSpacing:"0.06em",textTransform:"uppercase",border:`1px solid ${o}40`},children:"End"})]})]})}function M({color:p}){return e.jsx("div",{style:{width:"2px",height:"20px",background:p+"50",position:"relative"},children:e.jsx("div",{style:{position:"absolute",bottom:-5,left:"50%",transform:"translateX(-50%)",width:0,height:0,borderLeft:"5px solid transparent",borderRight:"5px solid transparent",borderTop:`6px solid ${p}80`}})})}function X({elementId:p}={}){var A,$,B,L;const o=h(t=>t.activeView),d=h(t=>t.model),m=h(t=>t.validation),w=h(t=>t.updateElementField),y=h(t=>t.updateElementAttribute),x=h(t=>t.applyEdit),s=p??(o.type==="element-detail"?o.elementId:null),n=s&&d?d.elements[s]:null,T=E.useMemo(()=>{if(!d||!s)return{incoming:[],outgoing:[]};const t=C(d,s);return{incoming:t.filter(c=>c.targetId===s),outgoing:t.filter(c=>c.sourceId===s)}},[d,s]),b=E.useMemo(()=>!m||!s?[]:m.violations.filter(t=>t.elementId===s),[m,s]);if(!n||!s)return e.jsx("div",{className:"flex-1 flex items-center justify-center",style:{background:i.surfaceAlt},children:e.jsxs("div",{className:"text-center",style:{color:i.faint,marginTop:"-48px"},children:[e.jsxs("div",{style:{position:"relative",width:"280px",maxWidth:"60vw",margin:"0 auto -32px"},children:[e.jsx("img",{src:"/logo.png",alt:"MEMO",style:{width:"100%",display:"block",opacity:.5,mixBlendMode:"multiply"}}),e.jsx("span",{style:{position:"absolute",left:"59%",top:"60%",color:"#8B949E",fontSize:"19px",fontWeight:600,letterSpacing:"0.02em",whiteSpace:"nowrap"},children:"Architect"})]}),e.jsx("p",{style:{fontSize:a.md,margin:0},children:"Select an element to view details"})]})});const j=V[n.layer]||i.muted,l=(A=n.provenance)==null?void 0:A.declaration,k=(l==null?void 0:l.writable)!==!1,g=($=d==null?void 0:d.registries)==null?void 0:$.kinds.find(t=>t.name===n.kind),z=((B=g==null?void 0:g.namespace)==null?void 0:B[1])??((L=g==null?void 0:g.namespace)==null?void 0:L[0]),O=(t,c)=>{w(s,t,c),x(s)},I=(t,c)=>{y(s,t,c),x(s)},v=Object.entries(n.attributes).filter(([t])=>t!=="id"&&t!=="name"),N=H.has(n.kind);return e.jsx("div",{className:"flex-1 overflow-y-auto",style:{background:"#EEF4F7"},children:e.jsxs("div",{style:{maxWidth:"1040px",margin:"0 auto",padding:"20px 28px 48px"},children:[e.jsxs("header",{style:{background:i.surface,border:"1px solid rgba(60,60,67,0.12)",borderLeft:`4px solid ${j}`,borderRadius:"16px",padding:"14px 18px",marginBottom:16,boxShadow:"0 1px 3px rgba(15,23,42,0.05)"},children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",style:{marginBottom:8},children:[e.jsx("span",{className:"px-2 py-0.5 rounded-md font-semibold",style:{background:j+"18",color:j,fontSize:a.xs},children:n.kind}),e.jsx("span",{className:"px-2 py-0.5 rounded-md",style:{background:i.surfaceAlt,color:i.muted,fontSize:a.xs},children:n.layer}),z&&e.jsx("span",{style:{color:i.faint,fontSize:a.xs},children:z.replace(/[_-]/g," ").replace(/\b\w/g,t=>t.toUpperCase())}),n.shortId&&e.jsx("span",{style:{marginLeft:"auto",color:i.faint,fontSize:a.xs,fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace"},children:n.shortId})]}),e.jsx("h1",{style:{fontSize:"24px",fontWeight:700,color:i.primary,lineHeight:1.2,margin:0},children:n.name}),e.jsx("div",{style:{marginTop:9,paddingTop:8,borderTop:`1px solid ${i.borderLight}`},children:e.jsx(D,{density:r})})]}),b.length>0&&e.jsxs("div",{className:"rounded-xl overflow-hidden",style:{border:"1px solid #FEE2E2",background:"#FEF2F2",marginBottom:20},children:[e.jsxs("div",{className:"px-4 py-2 font-semibold",style:{color:"#DC2626",fontSize:a.sm,borderBottom:"1px solid #FEE2E2"},children:[b.length," violation",b.length!==1?"s":""]}),b.map((t,c)=>e.jsxs("div",{className:"px-4 py-2 flex items-center gap-2",style:{fontSize:a.xs},children:[e.jsx("span",{style:{color:"#DC2626"},children:"✖"}),e.jsxs("span",{style:{color:i.faint},children:["[",t.ruleId,"]"]}),e.jsx("span",{style:{color:"#991B1B"},children:t.description})]},c))]}),e.jsx(F,{title:N?"Flow":"Description",density:r,collapsible:!1,children:N&&k?e.jsx(K,{element:n,layerColor:j,onSave:t=>O("doc",t)}):k?e.jsx(R,{value:n.attributes.description||"",onSave:t=>I("description",t),density:r,multiline:!0,placeholder:"Click to add a description…"}):e.jsx(f,{value:n.attributes.description||n.doc||"",editability:{kind:"derived",reason:`This ${(l==null?void 0:l.origin)??"library"} declaration is read-only.`},density:r})}),e.jsxs(F,{title:"Attributes",count:v.length,density:r,collapsible:!1,children:[v.length===0&&e.jsx("p",{style:{fontSize:a.sm,color:i.faint,margin:0},children:"This element defines no attributes."}),v.length>0&&e.jsx("div",{style:{borderTop:`1px solid ${i.border}`,maxWidth:900},children:v.map(([t,c])=>e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(150px, 24%) minmax(0, 1fr)",gap:16,alignItems:"center",padding:"7px 0",borderBottom:`1px solid ${i.borderLight}`},children:[e.jsxs("div",{style:{minWidth:0},children:[e.jsx("div",{style:{color:i.secondary,fontSize:a.sm,fontWeight:600},children:t}),e.jsx("div",{style:{color:i.faint,fontSize:"10px"},children:"Editable"})]}),k?e.jsx(R,{value:String(c??""),onSave:W=>I(t,W),density:r,placeholder:"Add value…",compact:!0}):e.jsx(f,{value:String(c??""),editability:{kind:"derived",reason:`This ${(l==null?void 0:l.origin)??"library"} declaration is read-only.`},density:r})]},t))})]}),e.jsx(P,{element:n,outgoing:T.outgoing,incoming:T.incoming,density:r}),e.jsx("div",{style:{background:i.surface,borderRadius:12,marginBottom:16},children:e.jsx(U,{subject:n})}),e.jsx(F,{title:"Origin",density:r,collapsible:!1,children:e.jsxs("div",{style:{maxWidth:720},children:[e.jsx(S,{label:"SysML source file",editability:u("file"),density:r,children:e.jsx(f,{value:n.file??"—",editability:u("file"),density:r,mono:!0})}),l&&e.jsxs(e.Fragment,{children:[e.jsx(S,{label:"Origin",editability:u("origin"),density:r,children:e.jsx(f,{value:l.origin,editability:u("origin"),density:r})}),e.jsx(S,{label:"Package",editability:u("package"),density:r,children:e.jsx(f,{value:`${l.packageName}${l.packageVersion?` v${l.packageVersion}`:""}`,editability:u("package"),density:r})}),e.jsx(S,{label:"Access",editability:u("access"),density:r,children:e.jsx(f,{value:l.writable?"Editable project content":"Read-only reusable content",editability:u("access"),density:r})})]})]})})]})})}export{X as ElementDetailView};
@@ -0,0 +1,3 @@
1
+ import{j as a}from"./reactflow-C9OlmOYw.js";import{a as F}from"./zustand-CrhqMOHB.js";import{u as ne,F as W}from"./index-DEVvBtNh.js";const ce=new Set(["overlay","transient"]);function V(t){if(!t)return"";const o=t.lastIndexOf("::");return o>=0?t.slice(o+2):t}function $(t){if(t===void 0||t==="")return;const o=Number(t);return Number.isFinite(o)?o:void 0}function ie(t){const o=t.attributes??{},g=$(o["bounds.x"]),c=$(o["bounds.y"]),l=$(o["bounds.width"]),d=$(o["bounds.height"]);if(!(g===void 0||c===void 0||l===void 0||d===void 0))return{x:g,y:c,width:l,height:d}}function le(t,o){return{x:t.x+o.x*t.width,y:t.y+o.y*t.height,width:o.width*t.width,height:o.height*t.height}}function G(t,o){const g=new Map;for(const c of t){if(c.type.toLowerCase()!==o)continue;const l=g.get(c.sourceId)??[];l.push(c.targetId),g.set(c.sourceId,l)}return g}function ue(t,o={}){var b,s,y;const g=Object.values(t.elements??{}),c=new Map(g.map(f=>[f.id,f])),l=t.relationships??[],d=g.filter(f=>f.kind==="ScreenCapture"),u=o.captureId?d.find(f=>f.id===o.captureId):d[0];if(!u)return{nodes:[],emptyReason:"No ScreenCapture in this view."};const E=G(l,"capturesscreen"),S=(E.get(u.id)??[])[0],C=S?c.get(S):void 0;if(!C)return{capture:u,nodes:[],emptyReason:`"${u.name}" is not linked to a screen by CapturesScreen.`};const z=G(l,"composes"),w=G(l,"navigatesto"),I={x:0,y:0,width:1,height:1},k=[],v=new Set,j=new Set([...E.values()].flat()),r=(f,M,D,P)=>{if(v.has(f.id))return;v.add(f.id);const p=f.attributes??{},N=V(p.detectionMethod),L=(z.get(f.id)??[]).filter(U=>{const x=c.get(U);return!!x&&x.kind==="UIElement"&&!!ie(x)});if(k.push({element:f,rect:M,depth:D,childIds:L,parentId:P,formKind:V(p.formKind),disclosureKind:V(p.disclosureKind)||"inline",boundaryColor:p.boundaryColor||void 0,boundaryWidth:$(p.boundaryWidth),unconfirmed:N==="automatic"&&!(p.confirmedBy??"").trim(),detectionConfidence:$(p.detectionConfidence),navigatesToId:(w.get(f.id)??[])[0]}),!(f.id!==C.id&&j.has(f.id)))for(const U of L){const x=c.get(U);r(x,le(M,ie(x)),D+1,f.id)}};return r(C,I,0),{capture:u,screen:C,imageUri:pe((b=u.attributes)==null?void 0:b.imageUri),pixelWidth:$((s=u.attributes)==null?void 0:s.pixelWidth),pixelHeight:$((y=u.attributes)==null?void 0:y.pixelHeight),nodes:k}}function pe(t){if(t)return t.startsWith("/")||/^[a-z][a-z0-9+.-]*:/i.test(t)?t:`/${t}`}function xe(t){return Object.values(t.elements??{}).filter(o=>o.kind==="ScreenCapture")}function K(t,o){const c=(t.relationships??[]).find(l=>l.type.toLowerCase()==="capturesscreen"&&l.targetId===o);if(c)return(t.elements??{})[c.sourceId]??Object.values(t.elements??{}).find(l=>l.id===c.sourceId)}function ye(t,o,g){const c=new Map((t.relationships??[]).filter(u=>u.type.toLowerCase()==="composes").map(u=>[u.targetId,u.sourceId])),l=new Set;let d=c.get(g);for(;d&&d!==o&&!l.has(d);){l.add(d);const u=K(t,d);if(u)return u;d=c.get(d)}return K(t,o)}function _(t){return ce.has(t.disclosureKind)}const he={screen:"#1B3A4B",panel:"#2DD4A8",dialog:"#A855F7",field:"#E4572E",button:"#A855F7",selector:"#F59E0B",table:"#3B82F6",chart:"#3B82F6",decoration:"#9CA3AF"},ge=t=>t.boundaryColor||he[t.formKind]||"#6B7280",X=(t,o=0,g=1)=>Math.max(o,Math.min(g,t));function Fe({diagram:t,model:o,captureId:g,viewpointFilter:c,editable:l=!1,drawMode:d=!1,newElementDefaultName:u="New UIElement",onCreateBounds:E,onBoundsChange:S,proposals:C=[],onAcceptProposal:z,onRejectProposal:w}){var Z;const I=ne(e=>e.inspectElement),k=ne(e=>e.selectedElementId),[v,j]=F.useState([]),[r,b]=F.useState(null),[s,y]=F.useState(null),[f,M]=F.useState(null),D=F.useRef(null),P=v[v.length-1]??g;F.useEffect(()=>j([]),[g]),F.useEffect(()=>{d||y(e=>(e==null?void 0:e.kind)==="create"?null:e)},[d]);const p=F.useMemo(()=>ue(o,{captureId:P}),[o,P]),N=F.useMemo(()=>c?p.nodes.filter(e=>c(e.element)):p.nodes,[p.nodes,c]),L=N.find(e=>e.element.id===k),x=N.find(e=>e.element.id===f)??L,oe=new Set((x==null?void 0:x.childIds)??[]),q=F.useCallback(e=>{const i=e.navigatesToId??e.element.id,n=K(o,i);(n==null?void 0:n.id)!==P&&n&&j(m=>[...m,n.id])},[o,P]);if(!p.nodes.length)return a.jsx("div",{className:"flex-1 flex items-center justify-center",style:{background:"#F7F7F5"},children:a.jsxs("div",{className:"text-center",style:{maxWidth:420},children:[a.jsx("h3",{style:{fontSize:W.lg,fontWeight:600,color:"#374151",marginBottom:8},children:t.name}),a.jsx("p",{style:{fontSize:W.md,color:"#9CA3AF",lineHeight:1.6},children:p.emptyReason??"Nothing to lay out in this view."})]})});const re=[...N].sort((e,i)=>{const n=_(e)?1:0,m=_(i)?1:0;return n-m||e.depth-i.depth}),se=p.pixelWidth&&p.pixelHeight?p.pixelHeight/p.pixelWidth:.625,O=(e,i)=>{var m;const n=(m=D.current)==null?void 0:m.getBoundingClientRect();return n?{x:X((e-n.left)/n.width),y:X((i-n.top)/n.height)}:{x:0,y:0}},B=e=>{if(e.kind==="draw")return{x:Math.min(e.startX,e.currentX),y:Math.min(e.startY,e.currentY),width:Math.abs(e.currentX-e.startX),height:Math.abs(e.currentY-e.startY)};const i=e.currentX-e.startX,n=e.currentY-e.startY;return e.kind==="move"?{...e.baseRect,x:X(e.baseRect.x+i,0,1-e.baseRect.width),y:X(e.baseRect.y+n,0,1-e.baseRect.height)}:{...e.baseRect,width:X(e.baseRect.width+i,.01,1-e.baseRect.x),height:X(e.baseRect.height+n,.01,1-e.baseRect.y)}},ae=(e,i)=>{var m;const n=e.parentId?(m=p.nodes.find(Y=>Y.element.id===e.parentId))==null?void 0:m.rect:void 0;return n?{x:(i.x-n.x)/n.width,y:(i.y-n.y)/n.height,width:i.width/n.width,height:i.height/n.height}:i},de=()=>{if(!r)return;const e=B(r);r.kind==="draw"?e.width>=.01&&e.height>=.01&&y({kind:"create",rect:e,name:u}):(Math.abs(r.currentX-r.startX)>=.002||Math.abs(r.currentY-r.startY)>=.002)&&y(r.node?{kind:"edit",node:r.node,rect:e}:{kind:"create",rect:e,name:(s==null?void 0:s.kind)==="create"?s.name:u}),b(null)},J=(e,i,n)=>{var Y;e.stopPropagation();const m=O(e.clientX,e.clientY);(Y=D.current)==null||Y.setPointerCapture(e.pointerId),b({kind:i,node:n.kind==="edit"?n.node:void 0,baseRect:n.rect,startX:m.x,startY:m.y,currentX:m.x,currentY:m.y})},Q=()=>{if(s){if(s.kind==="create"){const e=s.name.trim();if(!e)return;E==null||E(s.rect,e)}else S==null||S(s.node.element.id,ae(s.node,s.rect));y(null)}};return a.jsxs("div",{className:"flex-1 flex flex-col overflow-auto",style:{background:"#F7F7F5"},children:[a.jsxs("div",{className:"flex items-center gap-2 px-4 py-2",style:{borderBottom:"1px solid #E5E5E0"},children:[a.jsx("span",{style:{fontSize:W.sm,fontWeight:600,color:"#374151"},children:(Z=p.screen)==null?void 0:Z.name}),v.length>0&&a.jsx("button",{onClick:()=>j(e=>e.slice(0,-1)),style:{fontSize:W.xs,padding:"2px 8px",marginLeft:"auto",border:"1px solid #E5E5E0",borderRadius:6,background:"#FFFFFF",color:"#374151",cursor:"pointer"},children:"← Back"})]}),a.jsx("div",{className:"p-4",children:a.jsxs("div",{ref:D,role:"application","aria-label":"Screen region canvas",onPointerDown:e=>{if(!l||!d||s||e.target!==e.currentTarget)return;const i=O(e.clientX,e.clientY);e.currentTarget.setPointerCapture(e.pointerId),b({kind:"draw",startX:i.x,startY:i.y,currentX:i.x,currentY:i.y})},onPointerMove:e=>{if(!r)return;const i=O(e.clientX,e.clientY);b(n=>n?{...n,currentX:i.x,currentY:i.y}:null)},onPointerUp:de,onPointerCancel:()=>b(null),style:{position:"relative",width:"100%",maxWidth:900,paddingBottom:`${se*100}%`,margin:"0 auto",background:"#FFFFFF",border:"1px solid #E5E5E0",borderRadius:8,backgroundImage:p.imageUri?`url(${p.imageUri})`:void 0,backgroundSize:"contain",backgroundRepeat:"no-repeat",cursor:d&&!s?"crosshair":"default"},children:[!p.imageUri&&a.jsx("div",{className:"absolute inset-0 flex items-center justify-center",style:{fontSize:W.xs,color:"#9CA3AF"},children:"No image at this capture’s imageUri — boxes shown without a backdrop"}),!d&&re.map(e=>{const i=e.element.id===k,n=e.element.id===f,m=e.element.id===(x==null?void 0:x.element.id),Y=oe.has(e.element.id),H=!!x&&!m&&!Y,A=ge(e),ee=K(o,e.navigatesToId??e.element.id),te=!!ee&&ee.id!==P;return a.jsxs("div",{id:`screen-node-${e.element.id}`,onClick:h=>{h.stopPropagation(),I(e.element.id)},onDoubleClick:h=>{h.stopPropagation(),q(e)},onMouseEnter:()=>M(e.element.id),onMouseLeave:()=>M(h=>h===e.element.id?null:h),onPointerDown:h=>{var T;if(!l||d||s||e.depth===0)return;h.stopPropagation(),I(e.element.id);const R=O(h.clientX,h.clientY);(T=D.current)==null||T.setPointerCapture(h.pointerId),b({kind:"move",node:e,baseRect:e.rect,startX:R.x,startY:R.y,currentX:R.x,currentY:R.y})},title:`${e.element.name} · ${e.formKind}${te?" · double-click to open":""}`,style:{position:"absolute",left:`${e.rect.x*100}%`,top:`${e.rect.y*100}%`,width:`${e.rect.width*100}%`,height:`${e.rect.height*100}%`,border:`${e.boundaryWidth??(i||n?2:1)}px ${e.unconfirmed?"dashed":"solid"} ${H?"#9CA3AF":A}`,borderRadius:3,background:H?"#6B728012":n?`color-mix(in srgb, ${A} 12%, transparent)`:i?`color-mix(in srgb, ${A} 6%, transparent)`:"transparent",boxShadow:_(e)?"0 2px 10px rgba(0,0,0,0.18)":void 0,opacity:H?.18:1,pointerEvents:d?"none":"auto",cursor:l&&i?"move":"pointer",transition:"opacity 120ms ease, border-width 120ms ease"},children:[(i||!L)&&e.depth>0&&a.jsxs("span",{style:{position:"absolute",top:-2,left:2,transform:"translateY(-100%)",fontSize:9,fontWeight:600,color:A,background:"#FFFFFFDD",padding:"0 3px",borderRadius:2,whiteSpace:"nowrap",pointerEvents:"none"},children:[e.element.name,e.unconfirmed&&e.detectionConfidence!==void 0&&` · ${Math.round(e.detectionConfidence*100)}%?`]}),te&&a.jsx("button",{type:"button","aria-label":`Open ${e.element.name}`,onPointerDown:h=>h.stopPropagation(),onClick:h=>{h.stopPropagation(),q(e)},style:{position:"absolute",top:3,right:3,zIndex:3,width:22,height:22,borderRadius:5,border:`1px solid ${A}`,background:"#FFFFFFE8",color:A,fontSize:13,lineHeight:"18px",cursor:"pointer",opacity:H?.25:1},title:`Open nested region ${e.element.name}`,children:"↗"}),l&&i&&e.depth>0&&a.jsx("span",{onPointerDown:h=>{var T;h.stopPropagation();const R=O(h.clientX,h.clientY);(T=D.current)==null||T.setPointerCapture(h.pointerId),b({kind:"resize",node:e,baseRect:e.rect,startX:R.x,startY:R.y,currentX:R.x,currentY:R.y})},title:"Drag to resize",style:{position:"absolute",width:10,height:10,right:-5,bottom:-5,borderRadius:2,background:A,border:"1px solid #FFFFFF",cursor:"nwse-resize"}})]},e.element.id)}),!d&&C.filter(e=>e.status==="pending").map((e,i)=>a.jsx("div",{title:`Detected boundary · ${Math.round(e.confidence*100)}% confidence`,style:{position:"absolute",zIndex:20+i,left:`${e.bounds.x*100}%`,top:`${e.bounds.y*100}%`,width:`${e.bounds.width*100}%`,height:`${e.bounds.height*100}%`,border:"2px dashed #2563EB",borderRadius:3,background:"#2563EB12",pointerEvents:"none"},children:a.jsxs("span",{style:{position:"absolute",top:2,right:2,display:"inline-flex",gap:3,pointerEvents:"auto",background:"#FFFFFFEE",padding:2,borderRadius:5,boxShadow:"0 1px 4px rgba(0,0,0,0.16)"},children:[a.jsx("button",{type:"button","aria-label":`Accept detected region ${e.id}`,onPointerDown:n=>n.stopPropagation(),onClick:n=>{n.stopPropagation(),z==null||z(e.id)},title:"Accept region",style:{width:22,height:20,border:0,borderRadius:4,background:"#DCFCE7",color:"#15803D",cursor:"pointer"},children:"✓"}),a.jsx("button",{type:"button","aria-label":`Reject detected region ${e.id}`,onPointerDown:n=>n.stopPropagation(),onClick:n=>{n.stopPropagation(),w==null||w(e.id)},title:"Reject region",style:{width:22,height:20,border:0,borderRadius:4,background:"#FEE2E2",color:"#DC2626",cursor:"pointer"},children:"×"})]})},e.id)),r&&a.jsx("div",{style:{position:"absolute",left:`${B(r).x*100}%`,top:`${B(r).y*100}%`,width:`${B(r).width*100}%`,height:`${B(r).height*100}%`,border:"2px dashed #0F766E",background:"#2DD4A81A",pointerEvents:"none"}}),s&&!r&&a.jsxs("div",{"aria-label":s.kind==="create"?"New region boundary draft":"Edited region boundary draft",onPointerDown:e=>J(e,"move",s),style:{position:"absolute",zIndex:80,left:`${s.rect.x*100}%`,top:`${s.rect.y*100}%`,width:`${s.rect.width*100}%`,height:`${s.rect.height*100}%`,border:"2px dashed #0F766E",borderRadius:3,background:"#2DD4A824",cursor:"move",boxShadow:"0 0 0 1px #FFFFFF99"},children:[a.jsxs("span",{style:{position:"absolute",top:4,left:4,display:"flex",gap:4,padding:3,borderRadius:6,background:"#FFFFFFF2",boxShadow:"0 1px 5px rgba(15,23,42,0.18)"},children:[s.kind==="create"&&a.jsx("input",{autoFocus:!0,"aria-label":"New UIElement name",placeholder:"UIElement name",value:s.name,onPointerDown:e=>e.stopPropagation(),onFocus:e=>e.currentTarget.select(),onChange:e=>y(i=>(i==null?void 0:i.kind)==="create"?{...i,name:e.target.value}:i),onKeyDown:e=>{e.key==="Enter"&&Q(),e.key==="Escape"&&y(null)},style:{width:150,border:"1px solid #CBD5E1",borderRadius:4,padding:"3px 6px",color:"#1F2937",fontSize:10}}),a.jsx("button",{type:"button",disabled:s.kind==="create"&&!s.name.trim(),onPointerDown:e=>e.stopPropagation(),onClick:e=>{e.stopPropagation(),Q()},"aria-label":"Confirm region boundary",title:"Save this boundary",style:{border:0,borderRadius:4,padding:"3px 7px",background:"#DCFCE7",color:"#15803D",cursor:s.kind==="create"&&!s.name.trim()?"not-allowed":"pointer",opacity:s.kind==="create"&&!s.name.trim()?.5:1,fontSize:10,fontWeight:700},children:"✓ Confirm"}),a.jsx("button",{type:"button",onPointerDown:e=>e.stopPropagation(),onClick:e=>{e.stopPropagation(),y(null)},"aria-label":"Cancel region boundary",title:"Discard this boundary change",style:{border:0,borderRadius:4,padding:"3px 7px",background:"#FEE2E2",color:"#DC2626",cursor:"pointer",fontSize:10,fontWeight:700},children:"× Cancel"})]}),a.jsx("span",{"aria-label":"Resize region boundary draft",onPointerDown:e=>J(e,"resize",s),title:"Drag to resize before confirming",style:{position:"absolute",width:12,height:12,right:-6,bottom:-6,borderRadius:2,background:"#0F766E",border:"2px solid #FFFFFF",cursor:"nwse-resize"}})]}),d&&!r&&!s&&a.jsx("div",{style:{position:"absolute",zIndex:70,left:8,top:8,padding:"5px 8px",borderRadius:6,pointerEvents:"none",background:"#0F766EEB",color:"#FFFFFF",fontSize:10,fontWeight:650},children:"Click and drag to define a region"})]})})]})}function ve({id:t,label:o,depth:g,hasChildren:c,expanded:l,selected:d,badge:u,badgeColor:E="#0F766E",count:S,title:C,onClick:z,onDelete:w,actions:I=[]}){const[k,v]=F.useState(null),j=F.useRef(null);return F.useEffect(()=>{if(!k)return;const r=s=>{var y;(y=j.current)!=null&&y.contains(s.target)||v(null)},b=s=>{s.key==="Escape"&&v(null)};return document.addEventListener("mousedown",r),document.addEventListener("keydown",b),()=>{document.removeEventListener("mousedown",r),document.removeEventListener("keydown",b)}},[k]),a.jsxs("div",{role:"none",children:[a.jsxs("button",{type:"button",role:"treeitem","aria-selected":d,"aria-expanded":c?l:void 0,"data-tree-id":t,onClick:z,onContextMenu:w||I.length?r=>{r.preventDefault(),r.stopPropagation(),v({x:r.clientX,y:r.clientY})}:void 0,title:C,className:"flex items-center gap-1.5 w-full text-left",style:{minHeight:28,padding:"4px 8px",paddingLeft:8+g*18,border:0,borderRadius:6,cursor:"pointer",background:d?"#2DD4A818":"transparent",color:d?"#0F766E":"#374151"},onMouseEnter:r=>{d||(r.currentTarget.style.background="#F0F0ED")},onMouseLeave:r=>{r.currentTarget.style.background=d?"#2DD4A818":"transparent"},children:[a.jsx("span",{"aria-hidden":!0,style:{width:12,textAlign:"center",flexShrink:0,fontSize:9,color:"#9CA3AF",transform:l?"rotate(90deg)":"none",transition:"transform 120ms ease",visibility:c?"visible":"hidden"},children:"▶"}),u&&a.jsx("span",{style:{minWidth:27,height:17,padding:"0 4px",borderRadius:4,flexShrink:0,display:"inline-flex",alignItems:"center",justifyContent:"center",background:`${E}18`,color:E,fontSize:9,fontWeight:800},children:u}),a.jsx("span",{className:"truncate",style:{flex:1,fontSize:W.xs,fontWeight:c?650:500},children:o}),S!==void 0&&a.jsx("span",{style:{color:"#9CA3AF",fontSize:9},children:S})]}),k&&(w||I.length>0)&&a.jsxs("div",{ref:j,role:"menu",className:"fixed z-50 rounded-lg overflow-hidden py-1",style:{left:k.x,top:k.y,minWidth:180,background:"#FFFFFF",border:"1px solid #E5E7EB",boxShadow:"0 8px 24px rgba(0,0,0,0.16)"},children:[I.map(r=>a.jsx("button",{type:"button",role:"menuitem",onClick:()=>{v(null),r.onSelect()},style:{width:"100%",border:0,padding:"8px 12px",textAlign:"left",cursor:"pointer",background:"#FFFFFF",color:"#374151",fontSize:12,fontWeight:600},children:r.label},r.label)),w&&a.jsx("button",{type:"button",role:"menuitem",onClick:async()=>{v(null);const r=typeof o=="string"?o:C??"this element";if(!window.confirm(`Delete “${r}”?
2
+
3
+ All incoming and outgoing relationships will also be deleted. This cannot be undone.`))return;const b=await w();b.success||window.alert(b.error??"The element could not be deleted.")},style:{width:"100%",border:0,padding:"8px 12px",textAlign:"left",cursor:"pointer",background:"#FFFFFF",color:"#DC2626",fontSize:12,fontWeight:600},children:"Delete element…"})]})]})}export{ve as E,Fe as S,K as a,ye as b,ue as c,xe as l};
@@ -1 +1 @@
1
- import{j as e}from"./reactflow-C9OlmOYw.js";import{u as n}from"./index-BFvU1nLo.js";import"./zustand-CrhqMOHB.js";function p(){const i=n(t=>t.setBulkImportOpen),s=n(t=>t.connected),a=[{icon:"📄",title:"Import Elements from CSV",description:"Import model elements from a CSV or tab-separated file. Supports column mapping, artifact type presets, and batch preview before committing.",action:()=>i(!0),requiresConnection:!0}];return e.jsx("div",{style:{flex:1,overflow:"auto",padding:"40px 48px",background:"linear-gradient(135deg, #F0F4F7 0%, #E8EFF3 100%)",minHeight:0},children:e.jsxs("div",{style:{maxWidth:720,margin:"0 auto"},children:[e.jsx("h1",{style:{fontSize:"22px",fontWeight:700,color:"#1B3A4B",marginBottom:6},children:"Import"}),e.jsx("p",{style:{fontSize:"14px",color:"#6B7280",marginBottom:36},children:"Bring data into your model from external sources."}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:16},children:a.map(t=>{const r=t.requiresConnection&&!s;return e.jsxs("button",{onClick:r?void 0:t.action,disabled:r,style:{display:"flex",alignItems:"flex-start",gap:20,padding:"20px 24px",borderRadius:12,textAlign:"left",background:r?"rgba(255,255,255,0.4)":"rgba(255,255,255,0.75)",border:`1px solid ${r?"rgba(255,255,255,0.6)":"rgba(255,255,255,0.95)"}`,boxShadow:r?"none":"0 2px 8px rgba(0,0,0,0.06)",cursor:r?"not-allowed":"pointer",transition:"all 0.15s",opacity:r?.55:1},onMouseEnter:o=>{r||(o.currentTarget.style.background="rgba(255,255,255,0.95)",o.currentTarget.style.boxShadow="0 4px 16px rgba(0,0,0,0.1)",o.currentTarget.style.transform="translateY(-1px)")},onMouseLeave:o=>{r||(o.currentTarget.style.background="rgba(255,255,255,0.75)",o.currentTarget.style.boxShadow="0 2px 8px rgba(0,0,0,0.06)",o.currentTarget.style.transform="none")},children:[e.jsx("div",{style:{fontSize:28,lineHeight:1,flexShrink:0,marginTop:2},children:t.icon}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:"15px",fontWeight:600,color:"#1B3A4B",marginBottom:4},children:t.title}),e.jsx("div",{style:{fontSize:"13px",color:"#6B7280",lineHeight:1.55},children:t.description}),r&&e.jsx("div",{style:{fontSize:"11px",color:"#9CA3AF",marginTop:8},children:"Connect to the dev server to use this import."})]})]},t.title)})})]})})}export{p as ImportView};
1
+ import{j as e}from"./reactflow-C9OlmOYw.js";import{u as n}from"./index-DEVvBtNh.js";import"./zustand-CrhqMOHB.js";function p(){const i=n(t=>t.setBulkImportOpen),s=n(t=>t.connected),a=[{icon:"📄",title:"Import Elements from CSV",description:"Import model elements from a CSV or tab-separated file. Supports column mapping, artifact type presets, and batch preview before committing.",action:()=>i(!0),requiresConnection:!0}];return e.jsx("div",{style:{flex:1,overflow:"auto",padding:"40px 48px",background:"linear-gradient(135deg, #F0F4F7 0%, #E8EFF3 100%)",minHeight:0},children:e.jsxs("div",{style:{maxWidth:720,margin:"0 auto"},children:[e.jsx("h1",{style:{fontSize:"22px",fontWeight:700,color:"#1B3A4B",marginBottom:6},children:"Import"}),e.jsx("p",{style:{fontSize:"14px",color:"#6B7280",marginBottom:36},children:"Bring data into your model from external sources."}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:16},children:a.map(t=>{const r=t.requiresConnection&&!s;return e.jsxs("button",{onClick:r?void 0:t.action,disabled:r,style:{display:"flex",alignItems:"flex-start",gap:20,padding:"20px 24px",borderRadius:12,textAlign:"left",background:r?"rgba(255,255,255,0.4)":"rgba(255,255,255,0.75)",border:`1px solid ${r?"rgba(255,255,255,0.6)":"rgba(255,255,255,0.95)"}`,boxShadow:r?"none":"0 2px 8px rgba(0,0,0,0.06)",cursor:r?"not-allowed":"pointer",transition:"all 0.15s",opacity:r?.55:1},onMouseEnter:o=>{r||(o.currentTarget.style.background="rgba(255,255,255,0.95)",o.currentTarget.style.boxShadow="0 4px 16px rgba(0,0,0,0.1)",o.currentTarget.style.transform="translateY(-1px)")},onMouseLeave:o=>{r||(o.currentTarget.style.background="rgba(255,255,255,0.75)",o.currentTarget.style.boxShadow="0 2px 8px rgba(0,0,0,0.06)",o.currentTarget.style.transform="none")},children:[e.jsx("div",{style:{fontSize:28,lineHeight:1,flexShrink:0,marginTop:2},children:t.icon}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:"15px",fontWeight:600,color:"#1B3A4B",marginBottom:4},children:t.title}),e.jsx("div",{style:{fontSize:"13px",color:"#6B7280",lineHeight:1.55},children:t.description}),r&&e.jsx("div",{style:{fontSize:"11px",color:"#9CA3AF",marginTop:8},children:"Connect to the dev server to use this import."})]})]},t.title)})})]})})}export{p as ImportView};
@@ -1 +1 @@
1
- import{j as t}from"./reactflow-C9OlmOYw.js";import{a as f}from"./zustand-CrhqMOHB.js";import{L as M}from"./index-BFvU1nLo.js";const $={"purpose-operational":{bg:"#f0f7ff",header:"#cce5ff",text:"#1e40af",border:"#93c5fd"},requirements:{bg:"#f0f6ff",header:"#dae8fc",text:"#1d4ed8",border:"#93c5fd"},architecture:{bg:"#f0faf0",header:"#d5e8d4",text:"#166534",border:"#86efac"},risk:{bg:"#fff5f5",header:"#f8cecc",text:"#991b1b",border:"#fca5a5"},"vv-evidence":{bg:"#faf5ff",header:"#e1d5e7",text:"#6b21a8",border:"#c4b5fd"},"dhf-outputs":{bg:"#fffbeb",header:"#fff2cc",text:"#92400e",border:"#fcd34d"},other:{bg:"#f9fafb",header:"#f3f4f6",text:"#374151",border:"#d1d5db"}},F=[{id:"purpose-operational",label:"Purpose & Operational",abbr:"PUR",layerIds:["purpose","business","operational"]},{id:"requirements",label:"Requirements",abbr:"REQ",layerIds:["requirements"]},{id:"architecture",label:"Architecture",abbr:"ARCH",layerIds:["functional","behavior","logical","physical","software","interfaces","ui"],subGroups:[{label:"Functional",layerIds:["functional","behavior"]},{label:"Logical",layerIds:["logical"]},{label:"Physical",layerIds:["physical"]},{label:"Software",layerIds:["software"]},{label:"Interfaces",layerIds:["interfaces","ui"]}]},{id:"risk",label:"Risk",abbr:"RISK",layerIds:["risk","safety","cybersecurity"]},{id:"vv-evidence",label:"V&V & Evidence",abbr:"V&V",layerIds:["verification","analysis"]},{id:"dhf-outputs",label:"DHF Outputs",abbr:"DHF",layerIds:["design-control","qms","software-lifecycle","operations","clinical","privacy"]}],A=Object.fromEntries(M.map((n,r)=>[n,r]));function O(n){return[...n].sort((r,d)=>(A[r.id]??99)-(A[d.id]??99))}function T(n){return[...n].sort((r,d)=>{const a=r.derivesFrom?1:0,x=d.derivesFrom?1:0;return a!==x?a-x:r.name.localeCompare(d.name)})}function B({kind:n,layerColor:r,domainBg:d,selected:a,onClick:x,onContextMenu:N,isFlashing:p,flashTick:R}){const[b,g]=f.useState(!1),[v,j]=f.useState(!1);f.useEffect(()=>{if(!p)return;j(!0);const w=setTimeout(()=>j(!1),700);return()=>clearTimeout(w)},[p,R]);const m=a?`${r}18`:b?`${r}0C`:"#ffffff",I=a?r:"transparent",k=r;return t.jsxs("button",{"data-kind":n.name,onClick:x,onContextMenu:N,onMouseEnter:()=>g(!0),onMouseLeave:()=>g(!1),className:"text-left transition-all",style:{width:"130px",minHeight:"55px",background:m,border:`1px solid ${I}`,borderLeft:`3px solid ${k}`,borderRadius:"6px",padding:"6px 8px",cursor:"pointer",transform:v?"scale(1.04)":"scale(1)",boxShadow:v?`0 0 0 2px ${r}, 0 0 12px ${r}60`:a?`0 0 0 1px ${r}40`:b?"0 1px 3px rgba(0,0,0,0.08)":"none",flexShrink:0},children:[t.jsxs("div",{className:"flex items-center justify-between mb-1",children:[t.jsx("span",{style:{fontSize:"9px",fontFamily:"monospace",color:r,opacity:.8,textTransform:"uppercase",letterSpacing:"0.02em",lineHeight:1},children:n.construct.replace("part def","pd").replace("connection def","cd").replace("attribute def","ad")}),n.instanceCount>0&&t.jsx("span",{style:{fontSize:"9px",color:"#6B7280",background:`${r}15`,borderRadius:"8px",padding:"0 4px",lineHeight:"14px"},children:n.instanceCount})]}),t.jsx("div",{style:{fontSize:"11px",fontWeight:n.derivesFrom?400:600,color:a?r:"#1F2937",lineHeight:1.3,wordBreak:"break-word"},children:n.name}),n.derivesFrom&&t.jsxs("div",{style:{fontSize:"9px",color:"#9CA3AF",marginTop:"2px",lineHeight:1},children:["↳ ",n.derivesFrom]})]})}function z({layers:n,selectedKind:r,onKindClick:d,activeLayerId:a,flashKindName:x,flashTick:N}){const p=f.useRef({}),[R,b]=f.useState(null),[g,v]=f.useState(()=>new Set(F.map(e=>e.id).concat(["other"])));if(f.useEffect(()=>{if(!a)return;const e=p.current[a];if(e){e.scrollIntoView({behavior:"smooth",block:"start"}),b(a);const o=setTimeout(()=>b(null),1200);return()=>clearTimeout(o)}},[a]),n.length===0)return t.jsx("div",{className:"flex items-center justify-center py-12",style:{color:"#9CA3AF"},children:t.jsxs("div",{className:"text-center",children:[t.jsx("div",{className:"text-2xl mb-2",children:"⬡"}),t.jsx("div",{className:"text-xs",children:"No layers found in this ontology"})]})});const j=new Set(F.flatMap(e=>e.layerIds)),m=O(n.filter(e=>!j.has(e.id)));function I(e,o){e.preventDefault()}function k(e){v(o=>{const s=new Set(o);return s.has(e)?s.delete(e):s.add(e),s})}const w=(e,o,s)=>T(e).map(l=>t.jsx(B,{kind:l,layerColor:o,domainBg:s,selected:r===l.name,onClick:()=>d(r===l.name?null:l.name),onContextMenu:u=>I(u,l.name),isFlashing:x===l.name,flashTick:N},l.name)),C=(e,o)=>{const s=$[e.id]??$.other,L=o.reduce((i,c)=>i+c.kindCount,0),l=L===0,u=g.has(e.id),E=O(o);return t.jsxs("div",{ref:i=>{p.current[e.id]=i},className:"rounded-xl overflow-hidden transition-all",style:{border:`1px solid ${s.border}`,background:s.bg,outline:R===e.id?`2px solid ${s.border}`:"none",outlineOffset:"2px"},children:[t.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 cursor-pointer select-none",style:{background:s.header,borderBottom:u?"none":`1px solid ${s.border}`},onClick:()=>k(e.id),title:u?"Expand":"Collapse",children:[t.jsx("svg",{width:"10",height:"10",viewBox:"0 0 16 16",fill:"none",style:{transition:"transform 150ms ease",transform:u?"rotate(-90deg)":"rotate(0deg)",flexShrink:0},children:t.jsx("path",{d:"M4 6L8 10L12 6",stroke:s.text,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),t.jsx("span",{style:{fontSize:"10px",fontWeight:700,color:s.text,letterSpacing:"0.08em",textTransform:"uppercase",minWidth:"32px",textAlign:"center"},children:e.abbr}),t.jsx("span",{style:{width:"1px",height:"14px",background:`${s.border}`,opacity:.5}}),t.jsx("span",{className:"text-xs font-semibold flex-1",style:{color:s.text},children:e.label}),t.jsx("span",{className:"text-xs",style:{color:s.text,opacity:.7},children:l?"no kinds":`${L} kinds`})]}),!u&&(l?t.jsx("div",{className:"px-4 py-1.5 text-xs italic",style:{color:s.text,opacity:.4},children:"(no elements)"}):t.jsx("div",{className:"p-3 space-y-3",children:e.subGroups?e.subGroups.map(i=>{const c=E.filter(y=>i.layerIds.includes(y.id));if(c.length===0)return null;const h=c.flatMap(y=>y.kinds);if(h.length===0)return null;const S=c[0].color??s.text;return t.jsxs("div",{children:[t.jsxs("div",{className:"text-xs font-medium mb-1.5 flex items-center gap-1.5",style:{color:s.text,opacity:.75},ref:y=>{c.forEach(H=>{p.current[H.id]=y})},children:[t.jsx("span",{className:"inline-block w-2 h-2 rounded-sm flex-shrink-0",style:{background:S}}),i.label]}),t.jsx("div",{className:"flex flex-wrap gap-2",children:w(h,S,s.bg)})]},i.label)}):(()=>{var h;const i=E.flatMap(S=>S.kinds),c=((h=E[0])==null?void 0:h.color)??s.text;return t.jsx("div",{className:"flex flex-wrap gap-2",children:w(i,c,s.bg)})})()}))]},e.id)};return t.jsxs("div",{className:"space-y-3 mb-6",children:[F.map(e=>{const o=n.filter(s=>e.layerIds.includes(s.id));return o.length===0?null:C(e,o)}),m.length>0&&C({id:"other",label:"Other",abbr:"EXT",layerIds:m.map(e=>e.id)},m)]})}export{z as LayerGrid};
1
+ import{j as t}from"./reactflow-C9OlmOYw.js";import{a as f}from"./zustand-CrhqMOHB.js";import{L as M}from"./index-DEVvBtNh.js";const $={"purpose-operational":{bg:"#f0f7ff",header:"#cce5ff",text:"#1e40af",border:"#93c5fd"},requirements:{bg:"#f0f6ff",header:"#dae8fc",text:"#1d4ed8",border:"#93c5fd"},architecture:{bg:"#f0faf0",header:"#d5e8d4",text:"#166534",border:"#86efac"},risk:{bg:"#fff5f5",header:"#f8cecc",text:"#991b1b",border:"#fca5a5"},"vv-evidence":{bg:"#faf5ff",header:"#e1d5e7",text:"#6b21a8",border:"#c4b5fd"},"dhf-outputs":{bg:"#fffbeb",header:"#fff2cc",text:"#92400e",border:"#fcd34d"},other:{bg:"#f9fafb",header:"#f3f4f6",text:"#374151",border:"#d1d5db"}},F=[{id:"purpose-operational",label:"Purpose & Operational",abbr:"PUR",layerIds:["purpose","business","operational"]},{id:"requirements",label:"Requirements",abbr:"REQ",layerIds:["requirements"]},{id:"architecture",label:"Architecture",abbr:"ARCH",layerIds:["functional","behavior","logical","physical","software","interfaces","ui"],subGroups:[{label:"Functional",layerIds:["functional","behavior"]},{label:"Logical",layerIds:["logical"]},{label:"Physical",layerIds:["physical"]},{label:"Software",layerIds:["software"]},{label:"Interfaces",layerIds:["interfaces","ui"]}]},{id:"risk",label:"Risk",abbr:"RISK",layerIds:["risk","safety","cybersecurity"]},{id:"vv-evidence",label:"V&V & Evidence",abbr:"V&V",layerIds:["verification","analysis"]},{id:"dhf-outputs",label:"DHF Outputs",abbr:"DHF",layerIds:["design-control","qms","software-lifecycle","operations","clinical","privacy"]}],A=Object.fromEntries(M.map((n,r)=>[n,r]));function O(n){return[...n].sort((r,d)=>(A[r.id]??99)-(A[d.id]??99))}function T(n){return[...n].sort((r,d)=>{const a=r.derivesFrom?1:0,x=d.derivesFrom?1:0;return a!==x?a-x:r.name.localeCompare(d.name)})}function B({kind:n,layerColor:r,domainBg:d,selected:a,onClick:x,onContextMenu:N,isFlashing:p,flashTick:R}){const[b,g]=f.useState(!1),[v,j]=f.useState(!1);f.useEffect(()=>{if(!p)return;j(!0);const w=setTimeout(()=>j(!1),700);return()=>clearTimeout(w)},[p,R]);const m=a?`${r}18`:b?`${r}0C`:"#ffffff",I=a?r:"transparent",k=r;return t.jsxs("button",{"data-kind":n.name,onClick:x,onContextMenu:N,onMouseEnter:()=>g(!0),onMouseLeave:()=>g(!1),className:"text-left transition-all",style:{width:"130px",minHeight:"55px",background:m,border:`1px solid ${I}`,borderLeft:`3px solid ${k}`,borderRadius:"6px",padding:"6px 8px",cursor:"pointer",transform:v?"scale(1.04)":"scale(1)",boxShadow:v?`0 0 0 2px ${r}, 0 0 12px ${r}60`:a?`0 0 0 1px ${r}40`:b?"0 1px 3px rgba(0,0,0,0.08)":"none",flexShrink:0},children:[t.jsxs("div",{className:"flex items-center justify-between mb-1",children:[t.jsx("span",{style:{fontSize:"9px",fontFamily:"monospace",color:r,opacity:.8,textTransform:"uppercase",letterSpacing:"0.02em",lineHeight:1},children:n.construct.replace("part def","pd").replace("connection def","cd").replace("attribute def","ad")}),n.instanceCount>0&&t.jsx("span",{style:{fontSize:"9px",color:"#6B7280",background:`${r}15`,borderRadius:"8px",padding:"0 4px",lineHeight:"14px"},children:n.instanceCount})]}),t.jsx("div",{style:{fontSize:"11px",fontWeight:n.derivesFrom?400:600,color:a?r:"#1F2937",lineHeight:1.3,wordBreak:"break-word"},children:n.name}),n.derivesFrom&&t.jsxs("div",{style:{fontSize:"9px",color:"#9CA3AF",marginTop:"2px",lineHeight:1},children:["↳ ",n.derivesFrom]})]})}function z({layers:n,selectedKind:r,onKindClick:d,activeLayerId:a,flashKindName:x,flashTick:N}){const p=f.useRef({}),[R,b]=f.useState(null),[g,v]=f.useState(()=>new Set(F.map(e=>e.id).concat(["other"])));if(f.useEffect(()=>{if(!a)return;const e=p.current[a];if(e){e.scrollIntoView({behavior:"smooth",block:"start"}),b(a);const o=setTimeout(()=>b(null),1200);return()=>clearTimeout(o)}},[a]),n.length===0)return t.jsx("div",{className:"flex items-center justify-center py-12",style:{color:"#9CA3AF"},children:t.jsxs("div",{className:"text-center",children:[t.jsx("div",{className:"text-2xl mb-2",children:"⬡"}),t.jsx("div",{className:"text-xs",children:"No layers found in this ontology"})]})});const j=new Set(F.flatMap(e=>e.layerIds)),m=O(n.filter(e=>!j.has(e.id)));function I(e,o){e.preventDefault()}function k(e){v(o=>{const s=new Set(o);return s.has(e)?s.delete(e):s.add(e),s})}const w=(e,o,s)=>T(e).map(l=>t.jsx(B,{kind:l,layerColor:o,domainBg:s,selected:r===l.name,onClick:()=>d(r===l.name?null:l.name),onContextMenu:u=>I(u,l.name),isFlashing:x===l.name,flashTick:N},l.name)),C=(e,o)=>{const s=$[e.id]??$.other,L=o.reduce((i,c)=>i+c.kindCount,0),l=L===0,u=g.has(e.id),E=O(o);return t.jsxs("div",{ref:i=>{p.current[e.id]=i},className:"rounded-xl overflow-hidden transition-all",style:{border:`1px solid ${s.border}`,background:s.bg,outline:R===e.id?`2px solid ${s.border}`:"none",outlineOffset:"2px"},children:[t.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 cursor-pointer select-none",style:{background:s.header,borderBottom:u?"none":`1px solid ${s.border}`},onClick:()=>k(e.id),title:u?"Expand":"Collapse",children:[t.jsx("svg",{width:"10",height:"10",viewBox:"0 0 16 16",fill:"none",style:{transition:"transform 150ms ease",transform:u?"rotate(-90deg)":"rotate(0deg)",flexShrink:0},children:t.jsx("path",{d:"M4 6L8 10L12 6",stroke:s.text,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),t.jsx("span",{style:{fontSize:"10px",fontWeight:700,color:s.text,letterSpacing:"0.08em",textTransform:"uppercase",minWidth:"32px",textAlign:"center"},children:e.abbr}),t.jsx("span",{style:{width:"1px",height:"14px",background:`${s.border}`,opacity:.5}}),t.jsx("span",{className:"text-xs font-semibold flex-1",style:{color:s.text},children:e.label}),t.jsx("span",{className:"text-xs",style:{color:s.text,opacity:.7},children:l?"no kinds":`${L} kinds`})]}),!u&&(l?t.jsx("div",{className:"px-4 py-1.5 text-xs italic",style:{color:s.text,opacity:.4},children:"(no elements)"}):t.jsx("div",{className:"p-3 space-y-3",children:e.subGroups?e.subGroups.map(i=>{const c=E.filter(y=>i.layerIds.includes(y.id));if(c.length===0)return null;const h=c.flatMap(y=>y.kinds);if(h.length===0)return null;const S=c[0].color??s.text;return t.jsxs("div",{children:[t.jsxs("div",{className:"text-xs font-medium mb-1.5 flex items-center gap-1.5",style:{color:s.text,opacity:.75},ref:y=>{c.forEach(H=>{p.current[H.id]=y})},children:[t.jsx("span",{className:"inline-block w-2 h-2 rounded-sm flex-shrink-0",style:{background:S}}),i.label]}),t.jsx("div",{className:"flex flex-wrap gap-2",children:w(h,S,s.bg)})]},i.label)}):(()=>{var h;const i=E.flatMap(S=>S.kinds),c=((h=E[0])==null?void 0:h.color)??s.text;return t.jsx("div",{className:"flex flex-wrap gap-2",children:w(i,c,s.bg)})})()}))]},e.id)};return t.jsxs("div",{className:"space-y-3 mb-6",children:[F.map(e=>{const o=n.filter(s=>e.layerIds.includes(s.id));return o.length===0?null:C(e,o)}),m.length>0&&C({id:"other",label:"Other",abbr:"EXT",layerIds:m.map(e=>e.id)},m)]})}export{z as LayerGrid};
@@ -1,2 +1,2 @@
1
- import{j as t}from"./reactflow-C9OlmOYw.js";import{a}from"./zustand-CrhqMOHB.js";import{h as A}from"./index-BFvU1nLo.js";function q({layers:p,selectedKind:L,onKindClick:S}){const[F,D]=a.useState("name"),[g,j]=a.useState("asc"),[h,M]=a.useState(""),[c,T]=a.useState(!1),[i,v]=a.useState("all"),[d,E]=a.useState("all"),[B,f]=a.useState(!1),[N,b]=a.useState(!1),y=a.useMemo(()=>p.flatMap(e=>e.kinds.map(s=>({...s,layerLabel:e.label,layerColor:A[e.id]??e.color??"#6B7280"}))),[p]),R=a.useMemo(()=>[...new Set(p.map(e=>e.id))],[p]),K=a.useMemo(()=>[...new Set(y.map(e=>e.construct))],[y]),C=a.useMemo(()=>{let e=y;if(h.trim()){const s=h.toLowerCase();e=e.filter(o=>{var l,r;return o.name.toLowerCase().includes(s)||o.label.toLowerCase().includes(s)||o.layer.toLowerCase().includes(s)||(((l=o.description)==null?void 0:l.toLowerCase().includes(s))??!1)||(((r=o.derivesFrom)==null?void 0:r.toLowerCase().includes(s))??!1)})}return i!=="all"&&(e=e.filter(s=>s.layer===i)),d!=="all"&&(e=e.filter(s=>s.construct===d)),e},[y,h,i,d]),x=a.useMemo(()=>[...C].sort((e,s)=>{var l,r;let o=0;switch(F){case"name":o=e.name.localeCompare(s.name);break;case"layer":o=e.layer.localeCompare(s.layer);break;case"construct":o=e.construct.localeCompare(s.construct);break;case"instanceCount":o=e.instanceCount-s.instanceCount;break;case"derivesFrom":o=(e.derivesFrom??"").localeCompare(s.derivesFrom??"");break;case"derivedByCount":o=(((l=e.derivedBy)==null?void 0:l.length)??0)-(((r=s.derivedBy)==null?void 0:r.length)??0);break}return g==="asc"?o:-o}),[C,F,g]),k=a.useMemo(()=>{if(c)return null;const e=new Map;for(const s of x)e.has(s.layer)||e.set(s.layer,[]),e.get(s.layer).push(s);return e},[x,c]);function u(e){F===e?j(s=>s==="asc"?"desc":"asc"):(D(e),j("asc"))}const z=a.useCallback(()=>{const e=[["Name","Layer","Construct","Instances","Derives From","Derived By","Description"]];for(const n of x)e.push([n.name,n.layer,n.construct,String(n.instanceCount),n.derivesFrom??"",(n.derivedBy??[]).join("; "),n.description??""]);const s=e.map(n=>n.map($=>`"${$.replace(/"/g,'""')}"`).join(",")).join(`
1
+ import{j as t}from"./reactflow-C9OlmOYw.js";import{a}from"./zustand-CrhqMOHB.js";import{h as A}from"./index-DEVvBtNh.js";function q({layers:p,selectedKind:L,onKindClick:S}){const[F,D]=a.useState("name"),[g,j]=a.useState("asc"),[h,M]=a.useState(""),[c,T]=a.useState(!1),[i,v]=a.useState("all"),[d,E]=a.useState("all"),[B,f]=a.useState(!1),[N,b]=a.useState(!1),y=a.useMemo(()=>p.flatMap(e=>e.kinds.map(s=>({...s,layerLabel:e.label,layerColor:A[e.id]??e.color??"#6B7280"}))),[p]),R=a.useMemo(()=>[...new Set(p.map(e=>e.id))],[p]),K=a.useMemo(()=>[...new Set(y.map(e=>e.construct))],[y]),C=a.useMemo(()=>{let e=y;if(h.trim()){const s=h.toLowerCase();e=e.filter(o=>{var l,r;return o.name.toLowerCase().includes(s)||o.label.toLowerCase().includes(s)||o.layer.toLowerCase().includes(s)||(((l=o.description)==null?void 0:l.toLowerCase().includes(s))??!1)||(((r=o.derivesFrom)==null?void 0:r.toLowerCase().includes(s))??!1)})}return i!=="all"&&(e=e.filter(s=>s.layer===i)),d!=="all"&&(e=e.filter(s=>s.construct===d)),e},[y,h,i,d]),x=a.useMemo(()=>[...C].sort((e,s)=>{var l,r;let o=0;switch(F){case"name":o=e.name.localeCompare(s.name);break;case"layer":o=e.layer.localeCompare(s.layer);break;case"construct":o=e.construct.localeCompare(s.construct);break;case"instanceCount":o=e.instanceCount-s.instanceCount;break;case"derivesFrom":o=(e.derivesFrom??"").localeCompare(s.derivesFrom??"");break;case"derivedByCount":o=(((l=e.derivedBy)==null?void 0:l.length)??0)-(((r=s.derivedBy)==null?void 0:r.length)??0);break}return g==="asc"?o:-o}),[C,F,g]),k=a.useMemo(()=>{if(c)return null;const e=new Map;for(const s of x)e.has(s.layer)||e.set(s.layer,[]),e.get(s.layer).push(s);return e},[x,c]);function u(e){F===e?j(s=>s==="asc"?"desc":"asc"):(D(e),j("asc"))}const z=a.useCallback(()=>{const e=[["Name","Layer","Construct","Instances","Derives From","Derived By","Description"]];for(const n of x)e.push([n.name,n.layer,n.construct,String(n.instanceCount),n.derivesFrom??"",(n.derivedBy??[]).join("; "),n.description??""]);const s=e.map(n=>n.map($=>`"${$.replace(/"/g,'""')}"`).join(",")).join(`
2
2
  `),o=new Blob([s],{type:"text/csv;charset=utf-8;"}),l=URL.createObjectURL(o),r=document.createElement("a");r.href=l,r.download="ontology-kinds.csv",r.click(),URL.revokeObjectURL(l)},[x]),m=({k:e})=>t.jsx("span",{style:{fontSize:"10px",color:F===e?"#1B3A4B":"#D1D5DB",marginLeft:"3px"},children:F===e?g==="asc"?"▲":"▼":"⇅"}),w=(e,s)=>{var l,r;const o=L===e.name;return t.jsxs("div",{className:"grid items-center cursor-pointer text-xs",style:{gridTemplateColumns:"1.5fr 100px 90px 60px 120px 60px",padding:"7px 16px",background:o?"#EFF6FF":s%2===0?"#FAFAF8":"#FFFFFF",borderLeft:o?`3px solid ${e.layerColor}`:"3px solid transparent",transition:"background 100ms ease"},onClick:()=>S(o?null:e.name),onMouseEnter:n=>{o||(n.currentTarget.style.background="#F0F7FF")},onMouseLeave:n=>{o||(n.currentTarget.style.background=o?"#EFF6FF":s%2===0?"#FAFAF8":"#FFFFFF")},children:[t.jsxs("div",{className:"flex items-center gap-2 truncate",children:[t.jsx("span",{className:"w-2 h-2 rounded flex-shrink-0",style:{backgroundColor:e.layerColor}}),t.jsx("span",{style:{color:"#1a1a1a",fontWeight:o?600:400},children:e.name})]}),t.jsx("span",{className:"capitalize",style:{color:"#6B7280"},children:e.layer}),t.jsx("span",{className:"font-mono",style:{color:"#9CA3AF"},children:e.construct}),t.jsx("span",{className:"text-right",style:{color:e.instanceCount>0?"#1B3A4B":"#D1D5DB"},children:e.instanceCount>0?e.instanceCount:"—"}),t.jsx("span",{className:"truncate",style:{color:e.derivesFrom?"#2563EB":"#D1D5DB"},children:e.derivesFrom??"—"}),t.jsx("span",{className:"text-right",style:{color:(((l=e.derivedBy)==null?void 0:l.length)??0)>0?"#374151":"#D1D5DB"},children:(((r=e.derivedBy)==null?void 0:r.length)??0)>0?e.derivedBy.length:"—"})]},`${e.layer}:${e.name}`)};return t.jsxs("div",{className:"mb-6",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-3 flex-wrap",children:[t.jsx("input",{type:"text",placeholder:"Search kinds...",value:h,onChange:e=>M(e.target.value),className:"px-2.5 py-1.5 text-xs rounded-md flex-1 min-w-[140px]",style:{border:"1px solid #E5E7EB",background:"#F9FAFB",color:"#374151",outline:"none",maxWidth:"240px"},onFocus:e=>e.currentTarget.style.borderColor="#2563EB",onBlur:e=>e.currentTarget.style.borderColor="#E5E7EB"}),t.jsxs("div",{className:"relative",children:[t.jsxs("button",{onClick:()=>{f(!B),b(!1)},className:"px-2.5 py-1.5 text-xs rounded-md",style:{border:"1px solid #E5E7EB",background:i!=="all"?"#EFF6FF":"#F9FAFB",color:"#374151"},children:["Layer: ",i==="all"?"All":i]}),B&&t.jsxs("div",{className:"absolute top-full left-0 mt-1 rounded-lg shadow-lg py-1 z-20",style:{background:"#FFFFFF",border:"1px solid #E5E7EB",minWidth:"120px"},children:[t.jsx("button",{className:"block w-full text-left px-3 py-1.5 text-xs hover:bg-gray-50",style:{color:"#374151"},onClick:()=>{v("all"),f(!1)},children:"All"}),R.map(e=>t.jsx("button",{className:"block w-full text-left px-3 py-1.5 text-xs hover:bg-gray-50 capitalize",style:{color:"#374151"},onClick:()=>{v(e),f(!1)},children:e},e))]})]}),t.jsxs("div",{className:"relative",children:[t.jsxs("button",{onClick:()=>{b(!N),f(!1)},className:"px-2.5 py-1.5 text-xs rounded-md",style:{border:"1px solid #E5E7EB",background:d!=="all"?"#EFF6FF":"#F9FAFB",color:"#374151"},children:["Construct: ",d==="all"?"All":d]}),N&&t.jsxs("div",{className:"absolute top-full left-0 mt-1 rounded-lg shadow-lg py-1 z-20",style:{background:"#FFFFFF",border:"1px solid #E5E7EB",minWidth:"140px"},children:[t.jsx("button",{className:"block w-full text-left px-3 py-1.5 text-xs hover:bg-gray-50",style:{color:"#374151"},onClick:()=>{E("all"),b(!1)},children:"All"}),K.map(e=>t.jsx("button",{className:"block w-full text-left px-3 py-1.5 text-xs hover:bg-gray-50 font-mono",style:{color:"#374151"},onClick:()=>{E(e),b(!1)},children:e},e))]})]}),t.jsx("button",{onClick:()=>T(!c),className:"px-2.5 py-1.5 text-xs rounded-md",style:{border:"1px solid #E5E7EB",background:c?"#1B3A4B":"#F9FAFB",color:c?"#2DD4A8":"#374151"},children:c?"Grouped":"Flatten"}),t.jsx("button",{onClick:z,className:"px-2.5 py-1.5 text-xs rounded-md ml-auto",style:{border:"1px solid #E5E7EB",background:"#F9FAFB",color:"#374151"},title:"Export as CSV",children:"Export CSV"}),t.jsxs("span",{className:"text-xs",style:{color:"#9CA3AF"},children:[C.length," / ",y.length," kinds"]})]}),t.jsxs("div",{className:"rounded-xl overflow-hidden",style:{border:"1px solid #E5E5E0"},children:[t.jsxs("div",{className:"grid text-xs font-medium",style:{gridTemplateColumns:"1.5fr 100px 90px 60px 120px 60px",background:"#F7F7F5",borderBottom:"1px solid #E5E5E0",padding:"8px 16px",color:"#6B7280",position:"sticky",top:0,zIndex:5},children:[t.jsxs("button",{className:"text-left flex items-center",onClick:()=>u("name"),children:["Kind ",t.jsx(m,{k:"name"})]}),t.jsxs("button",{className:"text-left flex items-center",onClick:()=>u("layer"),children:["Layer ",t.jsx(m,{k:"layer"})]}),t.jsxs("button",{className:"text-left flex items-center",onClick:()=>u("construct"),children:["Construct ",t.jsx(m,{k:"construct"})]}),t.jsxs("button",{className:"text-right flex items-center justify-end",onClick:()=>u("instanceCount"),children:["# ",t.jsx(m,{k:"instanceCount"})]}),t.jsxs("button",{className:"text-left flex items-center",onClick:()=>u("derivesFrom"),children:["Derives From ",t.jsx(m,{k:"derivesFrom"})]}),t.jsxs("button",{className:"text-right flex items-center justify-end",onClick:()=>u("derivedByCount"),children:["Subs ",t.jsx(m,{k:"derivedByCount"})]})]}),c?x.map((e,s)=>w(e,s)):k&&[...k.entries()].map(([e,s])=>{const o=p.find(r=>r.id===e),l=A[e]??"#6B7280";return t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 text-xs font-semibold",style:{background:`${l}08`,borderTop:"1px solid #E5E5E0",color:l},children:[t.jsx("span",{className:"w-2.5 h-2.5 rounded flex-shrink-0",style:{backgroundColor:l}}),(o==null?void 0:o.label)??e,t.jsxs("span",{className:"font-normal",style:{color:"#9CA3AF"},children:["(",s.length,")"]})]}),s.map((r,n)=>w(r,n))]},e)}),x.length===0&&t.jsx("div",{className:"py-8 text-center text-xs",style:{color:"#9CA3AF"},children:"No kinds match the current filters"})]})]})}export{q as LayerTable};
@@ -1,4 +1,4 @@
1
- import{j as jsxRuntimeExports}from"./reactflow-C9OlmOYw.js";import{a as reactExports}from"./zustand-CrhqMOHB.js";import{D as DIAGRAM_TYPE_META,u as useModelStore,g as getDiagram,Q as sendDiagramLayoutUpdate,F as FONT,i as getRegistries}from"./index-BFvU1nLo.js";import{c as computeFBSLayout,F as buildFunctionalTree,b as computeContainmentLayout,H as buildDecompositionTree,d as computeUseCaseViewLayout,w as useCaseViewOptions,e as computeContextViewLayout,f as computeInterconnectionLayout,g as computeActionFlowViewLayout,h as computeStateTransitionLayout,i as computeSequenceLayout,v as resolveGeneralMode,j as computeGeneralViewLayout,E as buildGeneralViewTree,k as computeLayout,U as projectLayoutToNotationScene,s as selectedLayoutProviderId,q as commonDisplayLevels,V as notationSceneToSvg,K as GridView,L as BrowserView,R as RelationshipPicker}from"./notation-scene-BB2meNb3.js";import{S as ScreenLayoutView}from"./ExplorerTreeRow-DNlv-JxW.js";import"./layout-providers-BSDYNZu0.js";import"./elk-6l8mIQnQ.js";class ImageBox{constructor(t,e,i){this.src=t,this.width=e,this.height=i}}class EventObject{constructor(t="",...e){if(this.consumed=!1,this.name=t,this.properties={},e[0]&&e[0].constructor===Object)for(const[i,s]of Object.entries(e[0]))this.properties[i]=s;else for(let i=0;i<e.length;i+=2)e[i+1]!==null&&(this.properties[e[i]]=e[i+1])}getName(){return this.name}getProperties(){return this.properties}getProperty(t){return this.properties[t]}isConsumed(){return this.consumed}consume(){this.consumed=!0}}class EventSource{constructor(t=null){this.eventListeners=[],this.eventsEnabled=!0,this.eventSource=null,this.eventSource=t}isEventsEnabled(){return this.eventsEnabled}setEventsEnabled(t){this.eventsEnabled=t}getEventSource(){return this.eventSource}setEventSource(t){this.eventSource=t}addListener(t,e){this.eventListeners.push({name:t,funct:e})}removeListener(t){let e=0;for(;e<this.eventListeners.length;)this.eventListeners[e].funct===t?this.eventListeners.splice(e,1):e+=1}fireEvent(t,e=null){if(this.isEventsEnabled()){t||(t=new EventObject("")),e||(e=this.getEventSource()),e||(e=this);for(const i of this.eventListeners)(i.name===null||i.name===t.getName())&&i.funct.apply(this,[e,t])}}destroy(){this.eventListeners.length=0}}const DEFAULT_HOTSPOT=.3,MIN_HOTSPOT_SIZE=8,MAX_HOTSPOT_SIZE=0,IDENTITY_FIELD_NAME="mxObjectId",NS_SVG="http://www.w3.org/2000/svg",NS_XLINK="http://www.w3.org/1999/xlink",SHADOWCOLOR="gray",SHADOW_OFFSET_X=2,SHADOW_OFFSET_Y=3,SHADOW_OPACITY=1,TOOLTIP_VERTICAL_OFFSET=16,DEFAULT_VALID_COLOR="#00FF00",DEFAULT_INVALID_COLOR="#FF0000",OUTLINE_HIGHLIGHT_COLOR="#00FF00",OUTLINE_HIGHLIGHT_STROKEWIDTH=5,HIGHLIGHT_STROKEWIDTH=3,HIGHLIGHT_SIZE=2,HIGHLIGHT_OPACITY=100,INVALID_CONNECT_TARGET_COLOR="#FF0000",DROP_TARGET_COLOR="#0000FF",VALID_COLOR="#00FF00",INVALID_COLOR="#FF0000",EDGE_SELECTION_COLOR="#00FF00",VERTEX_SELECTION_COLOR="#00FF00",VERTEX_SELECTION_STROKEWIDTH=1,EDGE_SELECTION_STROKEWIDTH=1,VERTEX_SELECTION_DASHED=!0,EDGE_SELECTION_DASHED=!0,GUIDE_COLOR="#FF0000",GUIDE_STROKEWIDTH=1,HANDLE_SIZE=6,LABEL_HANDLE_SIZE=4,HANDLE_FILLCOLOR="#00FF00",HANDLE_STROKECOLOR="black",LABEL_HANDLE_FILLCOLOR="yellow",CONNECT_HANDLE_FILLCOLOR="#0000FF",LOCKED_HANDLE_FILLCOLOR="#FF0000",DEFAULT_FONTFAMILY="Arial,Helvetica,sans-serif",DEFAULT_FONTSIZE=11,DEFAULT_TEXT_DIRECTION="",LINE_HEIGHT=1.2,WORD_WRAP="normal",DEFAULT_FONTSTYLE=0,DEFAULT_STARTSIZE=40,DEFAULT_MARKERSIZE=6,DEFAULT_IMAGESIZE=24,ENTITY_SEGMENT=30,RECTANGLE_ROUNDING_FACTOR=.15,LINE_ARCSIZE=20,ARROW_SPACING=0,ARROW_WIDTH=30,ARROW_SIZE=30,PAGE_FORMAT_A4_PORTRAIT=[0,0,827,1169],NONE="none",FONT_STYLE_MASK={BOLD:1,ITALIC:2,UNDERLINE:4,STRIKETHROUGH:8},DIRECTION_MASK={NONE:0,WEST:1,NORTH:2,SOUTH:4,EAST:8,ALL:15},NODE_TYPE={ELEMENT:1},isWindowObjectAvailable=()=>typeof window<"u",isUserAgentAvailable=()=>!!navigator.userAgent,isUserAgentIncludes=r=>navigator.userAgent.includes(r),isAppVersionAvailable=()=>!!navigator.appVersion,isAppVersionIncludes=r=>navigator.appVersion.includes(r);class Client{}Client.basePath=".";Client.setBasePath=r=>{typeof r<"u"&&r.length>0?(r.substring(r.length-1)==="/"&&(r=r.substring(0,r.length-1)),Client.basePath=r):Client.basePath="."};Client.imageBasePath=".";Client.setImageBasePath=r=>{typeof r<"u"&&r.length>0?(r.substring(r.length-1)==="/"&&(r=r.substring(0,r.length-1)),Client.imageBasePath=r):Client.imageBasePath=`${Client.basePath}/images`};Client.IS_EDGE=isWindowObjectAvailable()&&isUserAgentAvailable()&&!!navigator.userAgent.match(/Edge\//);Client.IS_NS=isWindowObjectAvailable()&&isUserAgentAvailable()&&isUserAgentIncludes("Mozilla/")&&!isUserAgentIncludes("MSIE")&&!isUserAgentIncludes("Edge/");Client.IS_SF=isWindowObjectAvailable()&&/Apple Computer, Inc/.test(navigator.vendor);Client.IS_ANDROID=isWindowObjectAvailable()&&isAppVersionAvailable()&&isAppVersionIncludes("Android");Client.IS_IOS=isWindowObjectAvailable()&&/iP(hone|od|ad)/.test(navigator.platform);Client.IS_GC=isWindowObjectAvailable()&&/Google Inc/.test(navigator.vendor);Client.IS_CHROMEAPP=isWindowObjectAvailable()&&window.chrome!=null&&chrome.app!=null&&chrome.app.runtime!=null;Client.IS_FF=isUserAgentAvailable()&&navigator.userAgent.toLowerCase().includes("firefox");Client.IS_MT=isWindowObjectAvailable()&&isUserAgentAvailable()&&(isUserAgentIncludes("Firefox/")&&!isUserAgentIncludes("Firefox/1.")&&!isUserAgentIncludes("Firefox/2.")||isUserAgentIncludes("Iceweasel/")&&!isUserAgentIncludes("Iceweasel/1.")&&!isUserAgentIncludes("Iceweasel/2.")||isUserAgentIncludes("SeaMonkey/")&&!isUserAgentIncludes("SeaMonkey/1.")||isUserAgentIncludes("Iceape/")&&!isUserAgentIncludes("Iceape/1."));var Mt;Client.IS_SVG=isWindowObjectAvailable()&&((Mt=navigator.appName)==null?void 0:Mt.toUpperCase())!=="MICROSOFT INTERNET EXPLORER";Client.NO_FO=isWindowObjectAvailable()&&(!document.createElementNS||document.createElementNS(NS_SVG,"foreignObject").toString()!=="[object SVGForeignObjectElement]"||isUserAgentIncludes("Opera/"));Client.IS_WIN=isWindowObjectAvailable()&&isAppVersionAvailable()&&isAppVersionIncludes("Win");Client.IS_MAC=isWindowObjectAvailable()&&isAppVersionAvailable()&&isAppVersionIncludes("Mac");Client.IS_CHROMEOS=isWindowObjectAvailable()&&/\bCrOS\b/.test(navigator.appVersion);Client.IS_TOUCH=isWindowObjectAvailable()&&"ontouchstart"in document.documentElement;Client.IS_POINTER=isWindowObjectAvailable()&&!!window.PointerEvent&&isAppVersionAvailable()&&!isAppVersionIncludes("Mac");Client.IS_LOCAL=isWindowObjectAvailable()&&!document.location.href.includes("http://")&&!document.location.href.includes("https://");const getMainEvent=r=>{let t=r;return(t.type==="touchstart"||t.type==="touchmove")&&t.touches&&t.touches[0]?t=t.touches[0]:t.type==="touchend"&&t.changedTouches&&t.changedTouches[0]&&(t=t.changedTouches[0]),t},getClientX=r=>getMainEvent(r).clientX,getClientY=r=>getMainEvent(r).clientY,getSource=r=>r.target,isConsumed=r=>{const t=r;return t.isConsumed!==void 0&&t.isConsumed},isTouchEvent=r=>{const t=r;return t.pointerType?t.pointerType==="touch"||t.pointerType===t.MSPOINTER_TYPE_TOUCH:t.mozInputSource!==void 0?t.mozInputSource===5:t.type.indexOf("touch")===0},isPenEvent=r=>{const t=r;return t.pointerType?t.pointerType=="pen"||t.pointerType===t.MSPOINTER_TYPE_PEN:t.mozInputSource!==void 0?t.mozInputSource===2:t.type.indexOf("pen")===0},isMultiTouchEvent=r=>{const t=r;return t.type&&t.type.indexOf("touch")==0&&t.touches!==void 0&&t.touches.length>1},isMouseEvent=r=>{const t=r;return t.pointerType?t.pointerType=="mouse"||t.pointerType===t.MSPOINTER_TYPE_MOUSE:t.mozInputSource!==void 0?t.mozInputSource===1:t.type.indexOf("mouse")===0},isLeftMouseButton=r=>"buttons"in r&&(r.type==="mousedown"||r.type==="mousemove")?r.buttons===1:r.which!==void 0?r.which===1:r.button===1,isRightMouseButton=r=>r.button===2,isPopupTrigger=r=>isRightMouseButton(r)||Client.IS_MAC&&isControlDown(r)&&!isShiftDown(r)&&!isMetaDown(r)&&!isAltDown(r),isShiftDown=r=>r.shiftKey,isAltDown=r=>r.altKey,isControlDown=r=>r.ctrlKey,isMetaDown=r=>r.metaKey;class NoOpLogger{debug(t){}enter(t){}error(t,...e){}info(t){}leave(t,e){}show(){}trace(t){}warn(t){}}const shallowCopy=(r,t)=>{for(const e in r)if(Object.prototype.hasOwnProperty.call(r,e)){const i=r[e];Array.isArray(i)?t[e]=[...i]:t[e]=i}};class NoOpI18n{isEnabled(){return!1}get(){return null}addResource(){}}const GlobalConfig={i18n:new NoOpI18n,logger:new NoOpLogger},StyleDefaultsConfig={fontFamily:DEFAULT_FONTFAMILY,fontSize:DEFAULT_FONTSIZE,imageSize:DEFAULT_IMAGESIZE,lineArcSize:LINE_ARCSIZE,markerSize:DEFAULT_MARKERSIZE,roundingFactor:RECTANGLE_ROUNDING_FACTOR,shadowColor:SHADOWCOLOR,shadowOffsetX:SHADOW_OFFSET_X,shadowOffsetY:SHADOW_OFFSET_Y,shadowOpacity:SHADOW_OPACITY,startSize:DEFAULT_STARTSIZE},doEval=expression=>eval(expression),isElement=r=>(r==null?void 0:r.nodeType)===NODE_TYPE.ELEMENT,isNullish=r=>r==null,log=()=>GlobalConfig.logger,mixInto=r=>t=>{const e=Reflect.ownKeys(t);try{for(const i of e)Object.defineProperty(r.prototype,i,{value:t[i],writable:!0})}catch(i){log().error("Error while mixing",i)}},matchBinaryMask=(r,t)=>(r&t)===t,blocks=new Set(["BLOCKQUOTE","DIV","H1","H2","H3","H4","H5","H6","OL","P","PRE","TABLE","UL"]),extractTextWithWhitespace=r=>{const t=[];function e(i){if(!(i.length==1&&(i[0].nodeName=="BR"||i[0].innerHTML==`
1
+ import{j as jsxRuntimeExports}from"./reactflow-C9OlmOYw.js";import{a as reactExports}from"./zustand-CrhqMOHB.js";import{D as DIAGRAM_TYPE_META,u as useModelStore,g as getDiagram,W as sendDiagramLayoutUpdate,F as FONT,i as getRegistries}from"./index-DEVvBtNh.js";import{c as computeFBSLayout,F as buildFunctionalTree,b as computeContainmentLayout,H as buildDecompositionTree,d as computeUseCaseViewLayout,w as useCaseViewOptions,e as computeContextViewLayout,f as computeInterconnectionLayout,g as computeActionFlowViewLayout,h as computeStateTransitionLayout,i as computeSequenceLayout,v as resolveGeneralMode,j as computeGeneralViewLayout,E as buildGeneralViewTree,k as computeLayout,U as projectLayoutToNotationScene,s as selectedLayoutProviderId,q as commonDisplayLevels,V as notationSceneToSvg,K as GridView,L as BrowserView,R as RelationshipPicker}from"./notation-scene-HbscVJH5.js";import{S as ScreenLayoutView}from"./ExplorerTreeRow-DG8T31JS.js";import"./layout-providers-BSDYNZu0.js";import"./elk-6l8mIQnQ.js";class ImageBox{constructor(t,e,i){this.src=t,this.width=e,this.height=i}}class EventObject{constructor(t="",...e){if(this.consumed=!1,this.name=t,this.properties={},e[0]&&e[0].constructor===Object)for(const[i,s]of Object.entries(e[0]))this.properties[i]=s;else for(let i=0;i<e.length;i+=2)e[i+1]!==null&&(this.properties[e[i]]=e[i+1])}getName(){return this.name}getProperties(){return this.properties}getProperty(t){return this.properties[t]}isConsumed(){return this.consumed}consume(){this.consumed=!0}}class EventSource{constructor(t=null){this.eventListeners=[],this.eventsEnabled=!0,this.eventSource=null,this.eventSource=t}isEventsEnabled(){return this.eventsEnabled}setEventsEnabled(t){this.eventsEnabled=t}getEventSource(){return this.eventSource}setEventSource(t){this.eventSource=t}addListener(t,e){this.eventListeners.push({name:t,funct:e})}removeListener(t){let e=0;for(;e<this.eventListeners.length;)this.eventListeners[e].funct===t?this.eventListeners.splice(e,1):e+=1}fireEvent(t,e=null){if(this.isEventsEnabled()){t||(t=new EventObject("")),e||(e=this.getEventSource()),e||(e=this);for(const i of this.eventListeners)(i.name===null||i.name===t.getName())&&i.funct.apply(this,[e,t])}}destroy(){this.eventListeners.length=0}}const DEFAULT_HOTSPOT=.3,MIN_HOTSPOT_SIZE=8,MAX_HOTSPOT_SIZE=0,IDENTITY_FIELD_NAME="mxObjectId",NS_SVG="http://www.w3.org/2000/svg",NS_XLINK="http://www.w3.org/1999/xlink",SHADOWCOLOR="gray",SHADOW_OFFSET_X=2,SHADOW_OFFSET_Y=3,SHADOW_OPACITY=1,TOOLTIP_VERTICAL_OFFSET=16,DEFAULT_VALID_COLOR="#00FF00",DEFAULT_INVALID_COLOR="#FF0000",OUTLINE_HIGHLIGHT_COLOR="#00FF00",OUTLINE_HIGHLIGHT_STROKEWIDTH=5,HIGHLIGHT_STROKEWIDTH=3,HIGHLIGHT_SIZE=2,HIGHLIGHT_OPACITY=100,INVALID_CONNECT_TARGET_COLOR="#FF0000",DROP_TARGET_COLOR="#0000FF",VALID_COLOR="#00FF00",INVALID_COLOR="#FF0000",EDGE_SELECTION_COLOR="#00FF00",VERTEX_SELECTION_COLOR="#00FF00",VERTEX_SELECTION_STROKEWIDTH=1,EDGE_SELECTION_STROKEWIDTH=1,VERTEX_SELECTION_DASHED=!0,EDGE_SELECTION_DASHED=!0,GUIDE_COLOR="#FF0000",GUIDE_STROKEWIDTH=1,HANDLE_SIZE=6,LABEL_HANDLE_SIZE=4,HANDLE_FILLCOLOR="#00FF00",HANDLE_STROKECOLOR="black",LABEL_HANDLE_FILLCOLOR="yellow",CONNECT_HANDLE_FILLCOLOR="#0000FF",LOCKED_HANDLE_FILLCOLOR="#FF0000",DEFAULT_FONTFAMILY="Arial,Helvetica,sans-serif",DEFAULT_FONTSIZE=11,DEFAULT_TEXT_DIRECTION="",LINE_HEIGHT=1.2,WORD_WRAP="normal",DEFAULT_FONTSTYLE=0,DEFAULT_STARTSIZE=40,DEFAULT_MARKERSIZE=6,DEFAULT_IMAGESIZE=24,ENTITY_SEGMENT=30,RECTANGLE_ROUNDING_FACTOR=.15,LINE_ARCSIZE=20,ARROW_SPACING=0,ARROW_WIDTH=30,ARROW_SIZE=30,PAGE_FORMAT_A4_PORTRAIT=[0,0,827,1169],NONE="none",FONT_STYLE_MASK={BOLD:1,ITALIC:2,UNDERLINE:4,STRIKETHROUGH:8},DIRECTION_MASK={NONE:0,WEST:1,NORTH:2,SOUTH:4,EAST:8,ALL:15},NODE_TYPE={ELEMENT:1},isWindowObjectAvailable=()=>typeof window<"u",isUserAgentAvailable=()=>!!navigator.userAgent,isUserAgentIncludes=r=>navigator.userAgent.includes(r),isAppVersionAvailable=()=>!!navigator.appVersion,isAppVersionIncludes=r=>navigator.appVersion.includes(r);class Client{}Client.basePath=".";Client.setBasePath=r=>{typeof r<"u"&&r.length>0?(r.substring(r.length-1)==="/"&&(r=r.substring(0,r.length-1)),Client.basePath=r):Client.basePath="."};Client.imageBasePath=".";Client.setImageBasePath=r=>{typeof r<"u"&&r.length>0?(r.substring(r.length-1)==="/"&&(r=r.substring(0,r.length-1)),Client.imageBasePath=r):Client.imageBasePath=`${Client.basePath}/images`};Client.IS_EDGE=isWindowObjectAvailable()&&isUserAgentAvailable()&&!!navigator.userAgent.match(/Edge\//);Client.IS_NS=isWindowObjectAvailable()&&isUserAgentAvailable()&&isUserAgentIncludes("Mozilla/")&&!isUserAgentIncludes("MSIE")&&!isUserAgentIncludes("Edge/");Client.IS_SF=isWindowObjectAvailable()&&/Apple Computer, Inc/.test(navigator.vendor);Client.IS_ANDROID=isWindowObjectAvailable()&&isAppVersionAvailable()&&isAppVersionIncludes("Android");Client.IS_IOS=isWindowObjectAvailable()&&/iP(hone|od|ad)/.test(navigator.platform);Client.IS_GC=isWindowObjectAvailable()&&/Google Inc/.test(navigator.vendor);Client.IS_CHROMEAPP=isWindowObjectAvailable()&&window.chrome!=null&&chrome.app!=null&&chrome.app.runtime!=null;Client.IS_FF=isUserAgentAvailable()&&navigator.userAgent.toLowerCase().includes("firefox");Client.IS_MT=isWindowObjectAvailable()&&isUserAgentAvailable()&&(isUserAgentIncludes("Firefox/")&&!isUserAgentIncludes("Firefox/1.")&&!isUserAgentIncludes("Firefox/2.")||isUserAgentIncludes("Iceweasel/")&&!isUserAgentIncludes("Iceweasel/1.")&&!isUserAgentIncludes("Iceweasel/2.")||isUserAgentIncludes("SeaMonkey/")&&!isUserAgentIncludes("SeaMonkey/1.")||isUserAgentIncludes("Iceape/")&&!isUserAgentIncludes("Iceape/1."));var Mt;Client.IS_SVG=isWindowObjectAvailable()&&((Mt=navigator.appName)==null?void 0:Mt.toUpperCase())!=="MICROSOFT INTERNET EXPLORER";Client.NO_FO=isWindowObjectAvailable()&&(!document.createElementNS||document.createElementNS(NS_SVG,"foreignObject").toString()!=="[object SVGForeignObjectElement]"||isUserAgentIncludes("Opera/"));Client.IS_WIN=isWindowObjectAvailable()&&isAppVersionAvailable()&&isAppVersionIncludes("Win");Client.IS_MAC=isWindowObjectAvailable()&&isAppVersionAvailable()&&isAppVersionIncludes("Mac");Client.IS_CHROMEOS=isWindowObjectAvailable()&&/\bCrOS\b/.test(navigator.appVersion);Client.IS_TOUCH=isWindowObjectAvailable()&&"ontouchstart"in document.documentElement;Client.IS_POINTER=isWindowObjectAvailable()&&!!window.PointerEvent&&isAppVersionAvailable()&&!isAppVersionIncludes("Mac");Client.IS_LOCAL=isWindowObjectAvailable()&&!document.location.href.includes("http://")&&!document.location.href.includes("https://");const getMainEvent=r=>{let t=r;return(t.type==="touchstart"||t.type==="touchmove")&&t.touches&&t.touches[0]?t=t.touches[0]:t.type==="touchend"&&t.changedTouches&&t.changedTouches[0]&&(t=t.changedTouches[0]),t},getClientX=r=>getMainEvent(r).clientX,getClientY=r=>getMainEvent(r).clientY,getSource=r=>r.target,isConsumed=r=>{const t=r;return t.isConsumed!==void 0&&t.isConsumed},isTouchEvent=r=>{const t=r;return t.pointerType?t.pointerType==="touch"||t.pointerType===t.MSPOINTER_TYPE_TOUCH:t.mozInputSource!==void 0?t.mozInputSource===5:t.type.indexOf("touch")===0},isPenEvent=r=>{const t=r;return t.pointerType?t.pointerType=="pen"||t.pointerType===t.MSPOINTER_TYPE_PEN:t.mozInputSource!==void 0?t.mozInputSource===2:t.type.indexOf("pen")===0},isMultiTouchEvent=r=>{const t=r;return t.type&&t.type.indexOf("touch")==0&&t.touches!==void 0&&t.touches.length>1},isMouseEvent=r=>{const t=r;return t.pointerType?t.pointerType=="mouse"||t.pointerType===t.MSPOINTER_TYPE_MOUSE:t.mozInputSource!==void 0?t.mozInputSource===1:t.type.indexOf("mouse")===0},isLeftMouseButton=r=>"buttons"in r&&(r.type==="mousedown"||r.type==="mousemove")?r.buttons===1:r.which!==void 0?r.which===1:r.button===1,isRightMouseButton=r=>r.button===2,isPopupTrigger=r=>isRightMouseButton(r)||Client.IS_MAC&&isControlDown(r)&&!isShiftDown(r)&&!isMetaDown(r)&&!isAltDown(r),isShiftDown=r=>r.shiftKey,isAltDown=r=>r.altKey,isControlDown=r=>r.ctrlKey,isMetaDown=r=>r.metaKey;class NoOpLogger{debug(t){}enter(t){}error(t,...e){}info(t){}leave(t,e){}show(){}trace(t){}warn(t){}}const shallowCopy=(r,t)=>{for(const e in r)if(Object.prototype.hasOwnProperty.call(r,e)){const i=r[e];Array.isArray(i)?t[e]=[...i]:t[e]=i}};class NoOpI18n{isEnabled(){return!1}get(){return null}addResource(){}}const GlobalConfig={i18n:new NoOpI18n,logger:new NoOpLogger},StyleDefaultsConfig={fontFamily:DEFAULT_FONTFAMILY,fontSize:DEFAULT_FONTSIZE,imageSize:DEFAULT_IMAGESIZE,lineArcSize:LINE_ARCSIZE,markerSize:DEFAULT_MARKERSIZE,roundingFactor:RECTANGLE_ROUNDING_FACTOR,shadowColor:SHADOWCOLOR,shadowOffsetX:SHADOW_OFFSET_X,shadowOffsetY:SHADOW_OFFSET_Y,shadowOpacity:SHADOW_OPACITY,startSize:DEFAULT_STARTSIZE},doEval=expression=>eval(expression),isElement=r=>(r==null?void 0:r.nodeType)===NODE_TYPE.ELEMENT,isNullish=r=>r==null,log=()=>GlobalConfig.logger,mixInto=r=>t=>{const e=Reflect.ownKeys(t);try{for(const i of e)Object.defineProperty(r.prototype,i,{value:t[i],writable:!0})}catch(i){log().error("Error while mixing",i)}},matchBinaryMask=(r,t)=>(r&t)===t,blocks=new Set(["BLOCKQUOTE","DIV","H1","H2","H3","H4","H5","H6","OL","P","PRE","TABLE","UL"]),extractTextWithWhitespace=r=>{const t=[];function e(i){if(!(i.length==1&&(i[0].nodeName=="BR"||i[0].innerHTML==`
2
2
  `)))for(let s=0;s<i.length;s+=1){const n=i[s];n.nodeName=="BR"||n.innerHTML==`
3
3
  `||(i.length==1||s==0)&&n.nodeName=="DIV"&&n.innerHTML.toLowerCase()=="<br>"?t.push(`
4
4
  `):(n.nodeType===3||n.nodeType===4?n.nodeValue&&n.nodeValue.length>0&&t.push(n.nodeValue):n.nodeType!==8&&n.childNodes.length>0&&e(Array.from(n.childNodes)),s<i.length-1&&blocks.has(i[s+1].nodeName)&&t.push(`
@@ -1 +1 @@
1
- import{j as e}from"./reactflow-C9OlmOYw.js";import{a as y}from"./zustand-CrhqMOHB.js";import{u as F,h as j}from"./index-BFvU1nLo.js";function N(l,u){const o=[],i=[],m=[],g=new Set(Object.keys(l.elements)),x=new Set(Object.keys(u.elements));for(const a of x)g.has(a)||o.push(u.elements[a]);for(const a of g)x.has(a)||i.push(l.elements[a]);for(const a of g){if(!x.has(a))continue;const p=l.elements[a],t=u.elements[a],c=[];p.name!==t.name&&c.push(`name: "${p.name}" → "${t.name}"`),p.kind!==t.kind&&c.push(`kind: ${p.kind} → ${t.kind}`),p.layer!==t.layer&&c.push(`layer: ${p.layer} → ${t.layer}`),p.doc!==t.doc&&c.push("doc changed");const s=JSON.stringify(p.attributes),n=JSON.stringify(t.attributes);s!==n&&c.push("attributes changed"),c.length>0&&m.push({element:t,changes:c})}const v=new Set(l.relationships.map(a=>a.id)),h=new Set(u.relationships.map(a=>a.id)),f=u.relationships.filter(a=>!v.has(a.id)),d=l.relationships.filter(a=>!h.has(a.id));return{added:o,removed:i,changed:m,addedRels:f,removedRels:d,summary:{added:o.length,removed:i.length,changed:m.length,addedRels:f.length,removedRels:d.length}}}function A(){const l=F(s=>s.model),u=F(s=>s.selectElement),[o,i]=y.useState(null),[m,g]=y.useState(""),[x,v]=y.useState([]),[h,f]=y.useState(null),[d,a]=y.useState("all"),p=y.useCallback(()=>{if(!l)return;const s=m.trim()||`Snapshot ${x.length+1}`;v(n=>[...n,{name:s,model:JSON.parse(JSON.stringify(l)),timestamp:Date.now()}]),g("")},[l,m,x.length]);y.useEffect(()=>{h!==null&&x[h]&&i(x[h].model)},[h,x]);const t=y.useMemo(()=>!o||!l?null:N(o,l),[o,l]),c=t?t.summary.added+t.summary.removed+t.summary.changed:0;return e.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[e.jsxs("div",{className:"w-64 flex flex-col overflow-hidden",style:{background:"#FFFFFF",borderRight:"1px solid #E5E5E0"},children:[e.jsxs("div",{className:"px-4 py-3",style:{background:"linear-gradient(135deg, #1B3A4B, #2D6A7A)"},children:[e.jsx("h2",{className:"text-sm font-bold tracking-wide",style:{color:"#2DD4A8"},children:"Model Diff"}),e.jsx("p",{className:"text-xs mt-0.5",style:{color:"rgba(255,255,255,0.6)"},children:"Compare model states"})]}),e.jsx("div",{className:"px-3 py-2.5",style:{borderBottom:"1px solid #E5E5E0"},children:e.jsxs("div",{className:"flex gap-1",children:[e.jsx("input",{type:"text",value:m,onChange:s=>g(s.target.value),placeholder:"Snapshot name...",className:"flex-1 text-xs px-2 py-1.5 rounded focus:outline-none",style:{background:"#F7F7F5",border:"1px solid #E5E5E0",color:"#1a1a1a"},onKeyDown:s=>s.key==="Enter"&&p()}),e.jsx("button",{onClick:p,className:"px-2 py-1.5 text-xs rounded font-medium",style:{background:"#2DD4A8",color:"#FFFFFF"},children:"Snap"})]})}),e.jsxs("div",{className:"flex-1 overflow-y-auto text-xs py-1",children:[x.length===0&&e.jsx("div",{className:"px-4 py-8 text-center",style:{color:"#9CA3AF"},children:"Take a snapshot to create a baseline for comparison."}),x.map((s,n)=>e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 cursor-pointer mx-1 rounded-lg",style:{background:h===n?"#2DD4A818":"transparent",fontWeight:h===n?500:400},onMouseEnter:r=>{h!==n&&(r.currentTarget.style.background="#F0F0ED")},onMouseLeave:r=>{h!==n&&(r.currentTarget.style.background=h===n?"#2DD4A818":"transparent")},onClick:()=>f(n),children:[e.jsx("span",{className:"w-2 h-2 rounded-full flex-shrink-0",style:{background:"#2DD4A8"}}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"truncate",style:{color:"#374151"},children:s.name}),e.jsxs("div",{style:{color:"#9CA3AF",fontSize:"10px"},children:[new Date(s.timestamp).toLocaleTimeString()," · ",Object.keys(s.model.elements).length," elements"]})]})]},n))]})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-6",style:{background:"#F7F7F5"},children:[!t&&e.jsx("div",{className:"flex items-center justify-center h-full",style:{color:"#9CA3AF"},children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{style:{fontSize:"32px",marginBottom:"8px",opacity:.5},children:"↔"}),e.jsx("div",{className:"text-sm",children:"Take a snapshot, then make changes to see the diff"}),e.jsx("div",{className:"text-xs mt-2",style:{color:"#D1D5DB"},children:"Snapshots capture the current model state for comparison"})]})}),t&&e.jsxs("div",{className:"max-w-3xl",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx("h2",{className:"text-sm font-semibold",style:{color:"#374151"},children:c===0?"No changes":`${c} element changes`}),t.summary.addedRels+t.summary.removedRels>0&&e.jsxs("span",{className:"text-xs",style:{color:"#9CA3AF"},children:["+ ",t.summary.addedRels+t.summary.removedRels," relationship changes"]})]}),e.jsx("div",{className:"flex gap-2 mb-4",children:[{key:"all",label:"All",count:c,color:"#6B7280"},{key:"added",label:"Added",count:t.summary.added,color:"#2ECC71"},{key:"removed",label:"Removed",count:t.summary.removed,color:"#E74C3C"},{key:"changed",label:"Changed",count:t.summary.changed,color:"#F39C12"}].map(s=>e.jsxs("button",{onClick:()=>a(s.key),className:"px-2.5 py-1 text-xs rounded-full font-medium",style:{background:d===s.key?s.color+"20":"#F3F4F6",color:d===s.key?s.color:"#9CA3AF",border:`1px solid ${d===s.key?s.color+"40":"#E5E5E0"}`},children:[s.label," (",s.count,")"]},s.key))}),(d==="all"||d==="added")&&t.added.length>0&&e.jsxs("div",{className:"mb-4",children:[e.jsxs("h3",{className:"text-xs font-semibold uppercase tracking-wider mb-2",style:{color:"#2ECC71"},children:["Added (",t.added.length,")"]}),e.jsx("div",{className:"space-y-1",children:t.added.map(s=>e.jsx(b,{element:s,type:"added",onClick:()=>u(s.id)},s.id))})]}),(d==="all"||d==="removed")&&t.removed.length>0&&e.jsxs("div",{className:"mb-4",children:[e.jsxs("h3",{className:"text-xs font-semibold uppercase tracking-wider mb-2",style:{color:"#E74C3C"},children:["Removed (",t.removed.length,")"]}),e.jsx("div",{className:"space-y-1",children:t.removed.map(s=>e.jsx(b,{element:s,type:"removed",onClick:()=>{}},s.id))})]}),(d==="all"||d==="changed")&&t.changed.length>0&&e.jsxs("div",{className:"mb-4",children:[e.jsxs("h3",{className:"text-xs font-semibold uppercase tracking-wider mb-2",style:{color:"#F39C12"},children:["Changed (",t.changed.length,")"]}),e.jsx("div",{className:"space-y-1",children:t.changed.map(({element:s,changes:n})=>e.jsxs("div",{className:"flex items-start gap-2 px-3 py-2 rounded-lg cursor-pointer",style:{background:"#FFFFFF",border:"1px solid #F39C1240"},onMouseEnter:r=>r.currentTarget.style.background="#FDF8F0",onMouseLeave:r=>r.currentTarget.style.background="#FFFFFF",onClick:()=>u(s.id),children:[e.jsx("span",{className:"text-xs mt-0.5",style:{color:"#F39C12"},children:"●"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs font-medium truncate",style:{color:"#374151"},children:s.name}),e.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded",style:{background:(j[s.layer]||"#95A5A6")+"18",color:j[s.layer]||"#95A5A6"},children:s.kind})]}),e.jsx("div",{className:"text-xs mt-0.5",style:{color:"#9CA3AF"},children:n.join(", ")})]})]},s.id))})]}),(t.addedRels.length>0||t.removedRels.length>0)&&e.jsxs("div",{className:"mb-4",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider mb-2",style:{color:"#6B7280"},children:"Relationship Changes"}),e.jsxs("div",{className:"space-y-1",children:[t.addedRels.map(s=>{var n,r;return e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 text-xs rounded-lg",style:{background:"#F0FDF4",border:"1px solid #BBF7D0"},children:[e.jsx("span",{style:{color:"#2ECC71"},children:"+"}),e.jsx("span",{style:{color:"#374151"},children:((n=l==null?void 0:l.elements[s.sourceId])==null?void 0:n.name)||s.sourceId}),e.jsx("span",{style:{color:"#2563EB"},children:s.type}),e.jsx("span",{style:{color:"#374151"},children:((r=l==null?void 0:l.elements[s.targetId])==null?void 0:r.name)||s.targetId})]},s.id)}),t.removedRels.map(s=>{var n,r;return e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 text-xs rounded-lg",style:{background:"#FEF2F2",border:"1px solid #FECACA"},children:[e.jsx("span",{style:{color:"#E74C3C"},children:"-"}),e.jsx("span",{style:{color:"#374151"},children:((n=o==null?void 0:o.elements[s.sourceId])==null?void 0:n.name)||s.sourceId}),e.jsx("span",{style:{color:"#2563EB"},children:s.type}),e.jsx("span",{style:{color:"#374151"},children:((r=o==null?void 0:o.elements[s.targetId])==null?void 0:r.name)||s.targetId})]},s.id)})]})]}),c===0&&t.addedRels.length===0&&t.removedRels.length===0&&e.jsxs("div",{className:"text-center py-8",style:{color:"#9CA3AF"},children:[e.jsx("div",{style:{fontSize:"24px",marginBottom:"8px"},children:"✓"}),e.jsx("div",{className:"text-sm",children:"No differences between snapshot and current model"})]})]})]})]})}function b({element:l,type:u,onClick:o}){const i=u==="added"?{bg:"#F0FDF4",border:"#BBF7D0",dot:"#2ECC71",hoverBg:"#DCFCE7"}:{bg:"#FEF2F2",border:"#FECACA",dot:"#E74C3C",hoverBg:"#FEE2E2"};return e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-lg cursor-pointer text-xs",style:{background:i.bg,border:`1px solid ${i.border}`},onMouseEnter:m=>m.currentTarget.style.background=i.hoverBg,onMouseLeave:m=>m.currentTarget.style.background=i.bg,onClick:o,children:[e.jsx("span",{style:{color:i.dot},children:"●"}),e.jsx("span",{className:"font-medium truncate",style:{color:"#374151"},children:l.name}),e.jsx("span",{className:"ml-auto px-1.5 py-0.5 rounded",style:{background:(j[l.layer]||"#95A5A6")+"18",color:j[l.layer]||"#95A5A6"},children:l.kind})]})}export{A as ModelDiff,N as computeModelDiff};
1
+ import{j as e}from"./reactflow-C9OlmOYw.js";import{a as y}from"./zustand-CrhqMOHB.js";import{u as F,h as j}from"./index-DEVvBtNh.js";function N(l,u){const o=[],i=[],m=[],g=new Set(Object.keys(l.elements)),x=new Set(Object.keys(u.elements));for(const a of x)g.has(a)||o.push(u.elements[a]);for(const a of g)x.has(a)||i.push(l.elements[a]);for(const a of g){if(!x.has(a))continue;const p=l.elements[a],t=u.elements[a],c=[];p.name!==t.name&&c.push(`name: "${p.name}" → "${t.name}"`),p.kind!==t.kind&&c.push(`kind: ${p.kind} → ${t.kind}`),p.layer!==t.layer&&c.push(`layer: ${p.layer} → ${t.layer}`),p.doc!==t.doc&&c.push("doc changed");const s=JSON.stringify(p.attributes),n=JSON.stringify(t.attributes);s!==n&&c.push("attributes changed"),c.length>0&&m.push({element:t,changes:c})}const v=new Set(l.relationships.map(a=>a.id)),h=new Set(u.relationships.map(a=>a.id)),f=u.relationships.filter(a=>!v.has(a.id)),d=l.relationships.filter(a=>!h.has(a.id));return{added:o,removed:i,changed:m,addedRels:f,removedRels:d,summary:{added:o.length,removed:i.length,changed:m.length,addedRels:f.length,removedRels:d.length}}}function A(){const l=F(s=>s.model),u=F(s=>s.selectElement),[o,i]=y.useState(null),[m,g]=y.useState(""),[x,v]=y.useState([]),[h,f]=y.useState(null),[d,a]=y.useState("all"),p=y.useCallback(()=>{if(!l)return;const s=m.trim()||`Snapshot ${x.length+1}`;v(n=>[...n,{name:s,model:JSON.parse(JSON.stringify(l)),timestamp:Date.now()}]),g("")},[l,m,x.length]);y.useEffect(()=>{h!==null&&x[h]&&i(x[h].model)},[h,x]);const t=y.useMemo(()=>!o||!l?null:N(o,l),[o,l]),c=t?t.summary.added+t.summary.removed+t.summary.changed:0;return e.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[e.jsxs("div",{className:"w-64 flex flex-col overflow-hidden",style:{background:"#FFFFFF",borderRight:"1px solid #E5E5E0"},children:[e.jsxs("div",{className:"px-4 py-3",style:{background:"linear-gradient(135deg, #1B3A4B, #2D6A7A)"},children:[e.jsx("h2",{className:"text-sm font-bold tracking-wide",style:{color:"#2DD4A8"},children:"Model Diff"}),e.jsx("p",{className:"text-xs mt-0.5",style:{color:"rgba(255,255,255,0.6)"},children:"Compare model states"})]}),e.jsx("div",{className:"px-3 py-2.5",style:{borderBottom:"1px solid #E5E5E0"},children:e.jsxs("div",{className:"flex gap-1",children:[e.jsx("input",{type:"text",value:m,onChange:s=>g(s.target.value),placeholder:"Snapshot name...",className:"flex-1 text-xs px-2 py-1.5 rounded focus:outline-none",style:{background:"#F7F7F5",border:"1px solid #E5E5E0",color:"#1a1a1a"},onKeyDown:s=>s.key==="Enter"&&p()}),e.jsx("button",{onClick:p,className:"px-2 py-1.5 text-xs rounded font-medium",style:{background:"#2DD4A8",color:"#FFFFFF"},children:"Snap"})]})}),e.jsxs("div",{className:"flex-1 overflow-y-auto text-xs py-1",children:[x.length===0&&e.jsx("div",{className:"px-4 py-8 text-center",style:{color:"#9CA3AF"},children:"Take a snapshot to create a baseline for comparison."}),x.map((s,n)=>e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 cursor-pointer mx-1 rounded-lg",style:{background:h===n?"#2DD4A818":"transparent",fontWeight:h===n?500:400},onMouseEnter:r=>{h!==n&&(r.currentTarget.style.background="#F0F0ED")},onMouseLeave:r=>{h!==n&&(r.currentTarget.style.background=h===n?"#2DD4A818":"transparent")},onClick:()=>f(n),children:[e.jsx("span",{className:"w-2 h-2 rounded-full flex-shrink-0",style:{background:"#2DD4A8"}}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"truncate",style:{color:"#374151"},children:s.name}),e.jsxs("div",{style:{color:"#9CA3AF",fontSize:"10px"},children:[new Date(s.timestamp).toLocaleTimeString()," · ",Object.keys(s.model.elements).length," elements"]})]})]},n))]})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-6",style:{background:"#F7F7F5"},children:[!t&&e.jsx("div",{className:"flex items-center justify-center h-full",style:{color:"#9CA3AF"},children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{style:{fontSize:"32px",marginBottom:"8px",opacity:.5},children:"↔"}),e.jsx("div",{className:"text-sm",children:"Take a snapshot, then make changes to see the diff"}),e.jsx("div",{className:"text-xs mt-2",style:{color:"#D1D5DB"},children:"Snapshots capture the current model state for comparison"})]})}),t&&e.jsxs("div",{className:"max-w-3xl",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx("h2",{className:"text-sm font-semibold",style:{color:"#374151"},children:c===0?"No changes":`${c} element changes`}),t.summary.addedRels+t.summary.removedRels>0&&e.jsxs("span",{className:"text-xs",style:{color:"#9CA3AF"},children:["+ ",t.summary.addedRels+t.summary.removedRels," relationship changes"]})]}),e.jsx("div",{className:"flex gap-2 mb-4",children:[{key:"all",label:"All",count:c,color:"#6B7280"},{key:"added",label:"Added",count:t.summary.added,color:"#2ECC71"},{key:"removed",label:"Removed",count:t.summary.removed,color:"#E74C3C"},{key:"changed",label:"Changed",count:t.summary.changed,color:"#F39C12"}].map(s=>e.jsxs("button",{onClick:()=>a(s.key),className:"px-2.5 py-1 text-xs rounded-full font-medium",style:{background:d===s.key?s.color+"20":"#F3F4F6",color:d===s.key?s.color:"#9CA3AF",border:`1px solid ${d===s.key?s.color+"40":"#E5E5E0"}`},children:[s.label," (",s.count,")"]},s.key))}),(d==="all"||d==="added")&&t.added.length>0&&e.jsxs("div",{className:"mb-4",children:[e.jsxs("h3",{className:"text-xs font-semibold uppercase tracking-wider mb-2",style:{color:"#2ECC71"},children:["Added (",t.added.length,")"]}),e.jsx("div",{className:"space-y-1",children:t.added.map(s=>e.jsx(b,{element:s,type:"added",onClick:()=>u(s.id)},s.id))})]}),(d==="all"||d==="removed")&&t.removed.length>0&&e.jsxs("div",{className:"mb-4",children:[e.jsxs("h3",{className:"text-xs font-semibold uppercase tracking-wider mb-2",style:{color:"#E74C3C"},children:["Removed (",t.removed.length,")"]}),e.jsx("div",{className:"space-y-1",children:t.removed.map(s=>e.jsx(b,{element:s,type:"removed",onClick:()=>{}},s.id))})]}),(d==="all"||d==="changed")&&t.changed.length>0&&e.jsxs("div",{className:"mb-4",children:[e.jsxs("h3",{className:"text-xs font-semibold uppercase tracking-wider mb-2",style:{color:"#F39C12"},children:["Changed (",t.changed.length,")"]}),e.jsx("div",{className:"space-y-1",children:t.changed.map(({element:s,changes:n})=>e.jsxs("div",{className:"flex items-start gap-2 px-3 py-2 rounded-lg cursor-pointer",style:{background:"#FFFFFF",border:"1px solid #F39C1240"},onMouseEnter:r=>r.currentTarget.style.background="#FDF8F0",onMouseLeave:r=>r.currentTarget.style.background="#FFFFFF",onClick:()=>u(s.id),children:[e.jsx("span",{className:"text-xs mt-0.5",style:{color:"#F39C12"},children:"●"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs font-medium truncate",style:{color:"#374151"},children:s.name}),e.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded",style:{background:(j[s.layer]||"#95A5A6")+"18",color:j[s.layer]||"#95A5A6"},children:s.kind})]}),e.jsx("div",{className:"text-xs mt-0.5",style:{color:"#9CA3AF"},children:n.join(", ")})]})]},s.id))})]}),(t.addedRels.length>0||t.removedRels.length>0)&&e.jsxs("div",{className:"mb-4",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider mb-2",style:{color:"#6B7280"},children:"Relationship Changes"}),e.jsxs("div",{className:"space-y-1",children:[t.addedRels.map(s=>{var n,r;return e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 text-xs rounded-lg",style:{background:"#F0FDF4",border:"1px solid #BBF7D0"},children:[e.jsx("span",{style:{color:"#2ECC71"},children:"+"}),e.jsx("span",{style:{color:"#374151"},children:((n=l==null?void 0:l.elements[s.sourceId])==null?void 0:n.name)||s.sourceId}),e.jsx("span",{style:{color:"#2563EB"},children:s.type}),e.jsx("span",{style:{color:"#374151"},children:((r=l==null?void 0:l.elements[s.targetId])==null?void 0:r.name)||s.targetId})]},s.id)}),t.removedRels.map(s=>{var n,r;return e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 text-xs rounded-lg",style:{background:"#FEF2F2",border:"1px solid #FECACA"},children:[e.jsx("span",{style:{color:"#E74C3C"},children:"-"}),e.jsx("span",{style:{color:"#374151"},children:((n=o==null?void 0:o.elements[s.sourceId])==null?void 0:n.name)||s.sourceId}),e.jsx("span",{style:{color:"#2563EB"},children:s.type}),e.jsx("span",{style:{color:"#374151"},children:((r=o==null?void 0:o.elements[s.targetId])==null?void 0:r.name)||s.targetId})]},s.id)})]})]}),c===0&&t.addedRels.length===0&&t.removedRels.length===0&&e.jsxs("div",{className:"text-center py-8",style:{color:"#9CA3AF"},children:[e.jsx("div",{style:{fontSize:"24px",marginBottom:"8px"},children:"✓"}),e.jsx("div",{className:"text-sm",children:"No differences between snapshot and current model"})]})]})]})]})}function b({element:l,type:u,onClick:o}){const i=u==="added"?{bg:"#F0FDF4",border:"#BBF7D0",dot:"#2ECC71",hoverBg:"#DCFCE7"}:{bg:"#FEF2F2",border:"#FECACA",dot:"#E74C3C",hoverBg:"#FEE2E2"};return e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-lg cursor-pointer text-xs",style:{background:i.bg,border:`1px solid ${i.border}`},onMouseEnter:m=>m.currentTarget.style.background=i.hoverBg,onMouseLeave:m=>m.currentTarget.style.background=i.bg,onClick:o,children:[e.jsx("span",{style:{color:i.dot},children:"●"}),e.jsx("span",{className:"font-medium truncate",style:{color:"#374151"},children:l.name}),e.jsx("span",{className:"ml-auto px-1.5 py-0.5 rounded",style:{background:(j[l.layer]||"#95A5A6")+"18",color:j[l.layer]||"#95A5A6"},children:l.kind})]})}export{A as ModelDiff,N as computeModelDiff};
@@ -1 +1 @@
1
- import{j as e,H as C,P as k,R as D,c as S,k as O,l as R,m as T}from"./reactflow-C9OlmOYw.js";import{a as p}from"./zustand-CrhqMOHB.js";/* empty css */import{r as I}from"./layout-providers-BSDYNZu0.js";import{h as L,u as h,a2 as P,a3 as M,d as z}from"./index-BFvU1nLo.js";import"./elk-6l8mIQnQ.js";const A={ontology:{bg:"#EFF6FF",fg:"#2563EB",border:"#BFDBFE"},profile:{bg:"#F0FDF4",fg:"#16A34A",border:"#BBF7D0"},extension:{bg:"#FFF7ED",fg:"#EA580C",border:"#FED7AA"}};function H({data:a}){const s=a,l=A[s.type]??A.ontology;return e.jsxs("div",{"data-testid":`ontology-package-node-${s.name}`,onClick:s.onClick,onDoubleClick:s.onDoubleClick,onContextMenu:s.onContextMenu,style:{background:"#FFFFFF",border:s.selected?"2px solid #2563EB":"1px solid #E5E5E0",borderRadius:"12px",padding:"16px",minWidth:"240px",maxWidth:"300px",cursor:"pointer",boxShadow:"0 1px 3px rgba(0,0,0,0.06)",transition:"box-shadow 200ms ease, transform 200ms ease"},children:[e.jsx(C,{type:"target",position:k.Top,id:"top",style:w}),e.jsx(C,{type:"source",position:k.Bottom,id:"bottom",style:w}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px",marginBottom:"8px"},children:[e.jsx("span",{style:{padding:"1px 8px",fontSize:"10px",borderRadius:"9999px",fontWeight:600,background:l.bg,color:l.fg,border:`1px solid ${l.border}`},children:s.type}),e.jsxs("span",{style:{fontSize:"10px",color:"#9CA3AF"},children:["v",s.version]})]}),e.jsx("div",{style:{fontSize:"13px",fontWeight:600,color:"#1a1a1a",marginBottom:"4px"},children:s.name}),s.description&&e.jsx("div",{style:{fontSize:"11px",color:"#9CA3AF",marginBottom:"10px",lineHeight:"1.4"},children:s.description.length>80?s.description.slice(0,80)+"…":s.description}),e.jsx("div",{style:{display:"flex",gap:"2px",marginBottom:"8px",height:"6px",borderRadius:"3px",overflow:"hidden"},children:s.layers.slice(0,12).map(d=>{const n=L[d.id]??d.color??"#6B7280";return e.jsx("div",{style:{flex:Math.max(d.kindCount,1),background:n,borderRadius:"1px"},title:`${d.label}: ${d.kindCount} kinds`},d.id)})}),e.jsxs("div",{style:{display:"flex",gap:"12px",fontSize:"11px",color:"#6B7280"},children:[e.jsxs("span",{children:[e.jsx("strong",{style:{color:"#1B3A4B"},children:s.kindCount})," kinds"]}),e.jsxs("span",{children:[e.jsx("strong",{style:{color:"#1B3A4B"},children:s.layerCount})," layers"]})]})]})}const w={width:"8px",height:"8px",background:"#2563EB",border:"2px solid #FFFFFF",opacity:0},W=p.memo(H);function $({onClose:a}){const s=h(o=>o.availableOntologies),l=h(o=>o.ontologyInstallStatus),d=h(o=>o.setOntologyInstallStatus),[n,c]=p.useState(""),[r,g]=p.useState(null);function t(){n.trim()&&(d({installing:!0}),P(n.trim()),c(""))}function x(o){M(o),g(null)}return e.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-50",style:{background:"rgba(0,0,0,0.4)"},onClick:a,children:e.jsxs("div",{className:"rounded-xl shadow-2xl overflow-hidden",style:{background:"#FFFFFF",width:"520px",maxHeight:"600px",border:"1px solid #E5E5E0"},onClick:o=>o.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between px-5 py-4",style:{borderBottom:"1px solid #E5E5E0"},children:[e.jsx("h2",{className:"text-sm font-semibold",style:{color:"#1a1a1a"},children:"Manage Ontology Library"}),e.jsx("button",{onClick:a,className:"text-sm px-2 py-0.5 rounded hover:bg-gray-100",style:{color:"#9CA3AF"},children:"x"})]}),e.jsxs("div",{className:"p-5 space-y-5 overflow-y-auto",style:{maxHeight:"480px"},children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium block mb-1.5",style:{color:"#374151"},children:"Add Ontology"}),e.jsx("p",{className:"text-xs mb-2",style:{color:"#9CA3AF"},children:"Enter a git URL (https://...git), npm package name (@memoarchitect/...), or local path."}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",placeholder:"https://gitlab.com/org/my-ontology.git",value:n,onChange:o=>c(o.target.value),onKeyDown:o=>o.key==="Enter"&&t(),className:"flex-1 px-3 py-2 text-xs rounded-lg",style:{border:"1px solid #E5E7EB",background:"#F9FAFB",color:"#374151",outline:"none"},onFocus:o=>o.currentTarget.style.borderColor="#2563EB",onBlur:o=>o.currentTarget.style.borderColor="#E5E7EB",disabled:l.installing}),e.jsx("button",{onClick:t,disabled:!n.trim()||l.installing,className:"px-4 py-2 text-xs rounded-lg font-medium",style:{background:l.installing?"#9CA3AF":"#1B3A4B",color:"#FFFFFF",opacity:!n.trim()||l.installing?.5:1,cursor:!n.trim()||l.installing?"not-allowed":"pointer"},children:l.installing?"Installing...":"Install"})]}),l.error&&e.jsx("div",{className:"mt-2 px-3 py-2 rounded-lg text-xs",style:{background:"#FEF2F2",color:"#DC2626",border:"1px solid #FECACA"},children:l.error}),l.lastInstalled&&!l.error&&e.jsxs("div",{className:"mt-2 px-3 py-2 rounded-lg text-xs",style:{background:"#F0FDF4",color:"#16A34A",border:"1px solid #BBF7D0"},children:["Installed ",l.lastInstalled]})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"text-xs font-medium block mb-2",style:{color:"#374151"},children:["Installed Packages (",s.length,")"]}),e.jsxs("div",{className:"space-y-1.5",children:[s.map(o=>e.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5 rounded-lg",style:{border:"1px solid #E5E5E0",background:"#FAFAF8"},children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs font-medium truncate",style:{color:"#1a1a1a"},children:o.name}),e.jsx("span",{className:"px-1.5 py-0.5 text-xs rounded",style:{background:o.type==="ontology"?"#EFF6FF":o.type==="profile"?"#F0FDF4":"#FFF7ED",color:o.type==="ontology"?"#2563EB":o.type==="profile"?"#16A34A":"#EA580C",fontSize:"10px"},children:o.type})]}),e.jsxs("div",{className:"text-xs mt-0.5",style:{color:"#9CA3AF"},children:["v",o.version," · ",o.kindCount," kinds · ",o.layers.length," layers"]})]}),r===o.name?e.jsxs("div",{className:"flex gap-1",children:[e.jsx("button",{onClick:()=>x(o.name),className:"px-2 py-1 text-xs rounded",style:{background:"#DC2626",color:"#FFFFFF"},children:"Confirm"}),e.jsx("button",{onClick:()=>g(null),className:"px-2 py-1 text-xs rounded",style:{background:"#F3F4F6",color:"#374151"},children:"Cancel"})]}):e.jsx("button",{onClick:()=>g(o.name),className:"text-xs px-2 py-1 rounded hover:bg-red-50",style:{color:"#DC2626",border:"1px solid #FECACA"},children:"Remove"})]},o.name)),s.length===0&&e.jsx("div",{className:"text-center py-6 text-xs",style:{color:"#9CA3AF"},children:"No ontology packages installed"})]})]})]})]})})}const _={ontologyPackage:W},Y=260,V=180;async function K(a){const s=new Map(a.map(t=>[t.name,t])),l={id:"root",layoutOptions:{"elk.algorithm":"layered","elk.direction":"RIGHT","elk.layered.nodePlacement.strategy":"BRANDES_KOEPF","elk.layered.spacing.nodeNodeBetweenLayers":"100","elk.spacing.nodeNode":"32","elk.layered.crossingMinimization.strategy":"LAYER_SWEEP","elk.padding":"[top=24, left=24, bottom=24, right=24]"},children:a.map(t=>({id:t.name,width:Y,height:V})),edges:a.filter(t=>t.extends&&s.has(t.extends)).map((t,x)=>({id:`e-${x}`,sources:[t.extends],targets:[t.name]}))},d=await I(l),n=new Map;for(const t of d.children??[])n.set(t.id,{x:t.x??0,y:t.y??0});const c={ontology:"#3B82F6",profile:"#10B981",extension:"#F59E0B"},r=a.map(t=>({id:t.name,type:"ontologyPackage",position:n.get(t.name)??{x:0,y:0},data:{name:t.name,type:t.type,version:t.version,description:t.description,kindCount:t.kindCount,layerCount:t.layers.length,layers:t.layers.map(x=>({id:x.id,label:x.label,color:x.color,kindCount:x.kindCount})),selected:t.selected,onClick:()=>{}}})),g=[];for(const t of a)if(t.extends&&s.has(t.extends)){const x=c[t.type]??"#94A3B8";g.push({id:`${t.extends}->${t.name}`,source:t.extends,target:t.name,type:"smoothstep",data:{edgeType:"extends"},style:{stroke:x,strokeWidth:2,strokeDasharray:"6 3"},animated:!1,label:"extends",labelStyle:{fontSize:9,fill:x,fontWeight:500},labelBgStyle:{fill:"#F7F7F5",fillOpacity:.9},labelBgPadding:[4,2],markerEnd:{type:"arrowclosed",color:x,width:14,height:14}})}return{nodes:r,edges:g}}function G(a,s){const l=new Map;for(const c of s)c.extends&&(l.has(c.extends)||l.set(c.extends,[]),l.get(c.extends).push(c.name));const d=new Set([a]),n=[a];for(;n.length;){const c=n.shift();for(const r of l.get(c)??[])d.has(r)||(d.add(r),n.push(r))}return d}function U(){const a=h(i=>i.availableOntologies),s=h(i=>i.setActiveView),l=h(i=>i.hiddenEdgeTypes),d=h(i=>i.toggleHiddenEdgeType),[n,c]=p.useState(!1),[r,g]=p.useState({nodes:[],edges:[]}),[t,x]=p.useState(null),{fitView:o}=S();p.useEffect(()=>{let i=!1;return K(a).then(u=>{i||g(u)}).catch(u=>{console.error("[OntologyDiagram] ELK layout failed:",u)}),()=>{i=!0}},[a]);const F=p.useCallback(i=>{s({type:"ontology-detail",packageName:i})},[s]),E=p.useCallback(i=>{const u=G(i,a),m=r.nodes.filter(y=>u.has(y.id));m.length!==0&&o({nodes:m.map(y=>({id:y.id})),duration:400,padding:.2})},[a,r.nodes,o]),v=p.useCallback((i,u)=>{i.preventDefault(),x({x:i.clientX,y:i.clientY,packageName:u})},[]);p.useEffect(()=>{const i=u=>{if(u.key==="Escape"){if(t){x(null);return}o({padding:.1,duration:300})}};return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[t,o]);const{nodes:N,edges:B}=p.useMemo(()=>{const i=r.nodes.map(m=>({...m,data:{...m.data,onClick:()=>E(m.id),onDoubleClick:()=>F(m.id),onContextMenu:y=>v(y,m.id)}})),u=r.edges.filter(m=>{var j;const y=(j=m.data)==null?void 0:j.edgeType;return!y||!l.has(y)});return{nodes:i,edges:u}},[r,E,F,v,l]),f=p.useRef(null);p.useEffect(()=>{if(!t)return;const i=u=>{f.current&&!f.current.contains(u.target)&&x(null)};return window.addEventListener("mousedown",i),()=>window.removeEventListener("mousedown",i)},[t]);const b=l.has("extends");return a.length===0?e.jsx("div",{className:"flex-1 flex items-center justify-center",style:{background:"#F7F7F5"},children:e.jsxs("div",{className:"text-center",style:{color:"#9CA3AF"},children:[e.jsx("div",{className:"text-3xl mb-3",children:"◉"}),e.jsx("div",{className:"text-sm font-medium mb-1",style:{color:"#374151"},children:"No ontology packages found"}),e.jsx("div",{className:"text-xs",children:"Start the dev server to load ontology packages"})]})}):e.jsxs("div",{className:"flex-1",style:{background:"#F7F7F5"},children:[e.jsxs("div",{className:"flex items-start justify-between px-6 pt-5 pb-3",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-semibold",style:{color:"#1a1a1a"},children:"Ontology Library"}),e.jsxs("p",{className:"text-xs mt-1",style:{color:"#9CA3AF"},children:[a.length," package",a.length!==1?"s":""," available. Click to zoom, double-click to open, right-click for source."]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{"data-testid":"toggle-tracing",onClick:()=>d("extends"),title:b?"Show extends tracing edges":"Hide extends tracing edges",className:"px-3 py-1.5 text-xs rounded-lg font-medium",style:b?{background:"#F0F0ED",color:"#6B7280",border:"1px solid #E5E5E0"}:{background:"#1B3A4B",color:"#2DD4A8",border:"1px solid transparent"},children:b?"Show Tracing":"Hide Tracing"}),e.jsx("button",{onClick:()=>c(!0),className:"px-3 py-1.5 text-xs rounded-lg font-medium",style:{background:"#1B3A4B",color:"#2DD4A8"},children:"+ Add Ontology"})]})]}),n&&e.jsx($,{onClose:()=>c(!1)}),e.jsx("div",{style:{flex:1,height:"calc(100% - 72px)"},children:e.jsxs(O,{nodes:N,edges:B,nodeTypes:_,fitView:!0,fitViewOptions:{padding:.1},nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,panOnScroll:!0,zoomOnDoubleClick:!1,minZoom:.2,maxZoom:2.5,proOptions:{hideAttribution:!0},children:[e.jsx(R,{color:"#E5E5E0",gap:24,size:1}),e.jsx(T,{showInteractive:!1})]})}),t&&e.jsx(Z,{menuRef:f,state:t,onClose:()=>x(null),packages:a})]})}const Z=({state:a,onClose:s,packages:l,menuRef:d})=>{const n=l.find(r=>r.name===a.packageName);function c(){if(!n)return;const r=n.rootDir?`${n.rootDir}/memo.package.yaml`:"";r?z(r):window.open(`vscode://file/${encodeURIComponent(n.name)}`),s()}return e.jsxs("div",{ref:d,style:{position:"fixed",top:a.y,left:a.x,zIndex:1e3,background:"#FFFFFF",border:"1px solid #E5E5E0",borderRadius:"8px",boxShadow:"0 6px 16px rgba(0,0,0,0.12)",padding:"4px",minWidth:"180px",fontSize:"12px"},children:[e.jsx("div",{style:{padding:"6px 10px",color:"#9CA3AF",fontSize:"10px",textTransform:"uppercase",letterSpacing:"0.4px"},children:a.packageName}),e.jsx("button",{onClick:c,disabled:!(n!=null&&n.rootDir),style:{display:"block",width:"100%",textAlign:"left",padding:"6px 10px",border:"none",background:"transparent",cursor:n!=null&&n.rootDir?"pointer":"not-allowed",color:n!=null&&n.rootDir?"#1a1a1a":"#9CA3AF",borderRadius:"4px"},onMouseEnter:r=>{n!=null&&n.rootDir&&(r.currentTarget.style.background="#F0F0ED")},onMouseLeave:r=>{r.currentTarget.style.background="transparent"},children:"Open source"})]})};function oe(){return e.jsx(D,{children:e.jsx(U,{})})}export{oe as OntologyDecompositionDiagram,oe as default};
1
+ import{j as e,H as C,P as k,R as D,c as S,k as O,l as R,m as T}from"./reactflow-C9OlmOYw.js";import{a as p}from"./zustand-CrhqMOHB.js";/* empty css */import{r as I}from"./layout-providers-BSDYNZu0.js";import{h as L,u as h,a5 as P,a6 as M,d as z}from"./index-DEVvBtNh.js";import"./elk-6l8mIQnQ.js";const A={ontology:{bg:"#EFF6FF",fg:"#2563EB",border:"#BFDBFE"},profile:{bg:"#F0FDF4",fg:"#16A34A",border:"#BBF7D0"},extension:{bg:"#FFF7ED",fg:"#EA580C",border:"#FED7AA"}};function H({data:a}){const s=a,l=A[s.type]??A.ontology;return e.jsxs("div",{"data-testid":`ontology-package-node-${s.name}`,onClick:s.onClick,onDoubleClick:s.onDoubleClick,onContextMenu:s.onContextMenu,style:{background:"#FFFFFF",border:s.selected?"2px solid #2563EB":"1px solid #E5E5E0",borderRadius:"12px",padding:"16px",minWidth:"240px",maxWidth:"300px",cursor:"pointer",boxShadow:"0 1px 3px rgba(0,0,0,0.06)",transition:"box-shadow 200ms ease, transform 200ms ease"},children:[e.jsx(C,{type:"target",position:k.Top,id:"top",style:w}),e.jsx(C,{type:"source",position:k.Bottom,id:"bottom",style:w}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px",marginBottom:"8px"},children:[e.jsx("span",{style:{padding:"1px 8px",fontSize:"10px",borderRadius:"9999px",fontWeight:600,background:l.bg,color:l.fg,border:`1px solid ${l.border}`},children:s.type}),e.jsxs("span",{style:{fontSize:"10px",color:"#9CA3AF"},children:["v",s.version]})]}),e.jsx("div",{style:{fontSize:"13px",fontWeight:600,color:"#1a1a1a",marginBottom:"4px"},children:s.name}),s.description&&e.jsx("div",{style:{fontSize:"11px",color:"#9CA3AF",marginBottom:"10px",lineHeight:"1.4"},children:s.description.length>80?s.description.slice(0,80)+"…":s.description}),e.jsx("div",{style:{display:"flex",gap:"2px",marginBottom:"8px",height:"6px",borderRadius:"3px",overflow:"hidden"},children:s.layers.slice(0,12).map(d=>{const n=L[d.id]??d.color??"#6B7280";return e.jsx("div",{style:{flex:Math.max(d.kindCount,1),background:n,borderRadius:"1px"},title:`${d.label}: ${d.kindCount} kinds`},d.id)})}),e.jsxs("div",{style:{display:"flex",gap:"12px",fontSize:"11px",color:"#6B7280"},children:[e.jsxs("span",{children:[e.jsx("strong",{style:{color:"#1B3A4B"},children:s.kindCount})," kinds"]}),e.jsxs("span",{children:[e.jsx("strong",{style:{color:"#1B3A4B"},children:s.layerCount})," layers"]})]})]})}const w={width:"8px",height:"8px",background:"#2563EB",border:"2px solid #FFFFFF",opacity:0},W=p.memo(H);function $({onClose:a}){const s=h(o=>o.availableOntologies),l=h(o=>o.ontologyInstallStatus),d=h(o=>o.setOntologyInstallStatus),[n,c]=p.useState(""),[r,g]=p.useState(null);function t(){n.trim()&&(d({installing:!0}),P(n.trim()),c(""))}function x(o){M(o),g(null)}return e.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-50",style:{background:"rgba(0,0,0,0.4)"},onClick:a,children:e.jsxs("div",{className:"rounded-xl shadow-2xl overflow-hidden",style:{background:"#FFFFFF",width:"520px",maxHeight:"600px",border:"1px solid #E5E5E0"},onClick:o=>o.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between px-5 py-4",style:{borderBottom:"1px solid #E5E5E0"},children:[e.jsx("h2",{className:"text-sm font-semibold",style:{color:"#1a1a1a"},children:"Manage Ontology Library"}),e.jsx("button",{onClick:a,className:"text-sm px-2 py-0.5 rounded hover:bg-gray-100",style:{color:"#9CA3AF"},children:"x"})]}),e.jsxs("div",{className:"p-5 space-y-5 overflow-y-auto",style:{maxHeight:"480px"},children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium block mb-1.5",style:{color:"#374151"},children:"Add Ontology"}),e.jsx("p",{className:"text-xs mb-2",style:{color:"#9CA3AF"},children:"Enter a git URL (https://...git), npm package name (@memoarchitect/...), or local path."}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",placeholder:"https://gitlab.com/org/my-ontology.git",value:n,onChange:o=>c(o.target.value),onKeyDown:o=>o.key==="Enter"&&t(),className:"flex-1 px-3 py-2 text-xs rounded-lg",style:{border:"1px solid #E5E7EB",background:"#F9FAFB",color:"#374151",outline:"none"},onFocus:o=>o.currentTarget.style.borderColor="#2563EB",onBlur:o=>o.currentTarget.style.borderColor="#E5E7EB",disabled:l.installing}),e.jsx("button",{onClick:t,disabled:!n.trim()||l.installing,className:"px-4 py-2 text-xs rounded-lg font-medium",style:{background:l.installing?"#9CA3AF":"#1B3A4B",color:"#FFFFFF",opacity:!n.trim()||l.installing?.5:1,cursor:!n.trim()||l.installing?"not-allowed":"pointer"},children:l.installing?"Installing...":"Install"})]}),l.error&&e.jsx("div",{className:"mt-2 px-3 py-2 rounded-lg text-xs",style:{background:"#FEF2F2",color:"#DC2626",border:"1px solid #FECACA"},children:l.error}),l.lastInstalled&&!l.error&&e.jsxs("div",{className:"mt-2 px-3 py-2 rounded-lg text-xs",style:{background:"#F0FDF4",color:"#16A34A",border:"1px solid #BBF7D0"},children:["Installed ",l.lastInstalled]})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"text-xs font-medium block mb-2",style:{color:"#374151"},children:["Installed Packages (",s.length,")"]}),e.jsxs("div",{className:"space-y-1.5",children:[s.map(o=>e.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5 rounded-lg",style:{border:"1px solid #E5E5E0",background:"#FAFAF8"},children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs font-medium truncate",style:{color:"#1a1a1a"},children:o.name}),e.jsx("span",{className:"px-1.5 py-0.5 text-xs rounded",style:{background:o.type==="ontology"?"#EFF6FF":o.type==="profile"?"#F0FDF4":"#FFF7ED",color:o.type==="ontology"?"#2563EB":o.type==="profile"?"#16A34A":"#EA580C",fontSize:"10px"},children:o.type})]}),e.jsxs("div",{className:"text-xs mt-0.5",style:{color:"#9CA3AF"},children:["v",o.version," · ",o.kindCount," kinds · ",o.layers.length," layers"]})]}),r===o.name?e.jsxs("div",{className:"flex gap-1",children:[e.jsx("button",{onClick:()=>x(o.name),className:"px-2 py-1 text-xs rounded",style:{background:"#DC2626",color:"#FFFFFF"},children:"Confirm"}),e.jsx("button",{onClick:()=>g(null),className:"px-2 py-1 text-xs rounded",style:{background:"#F3F4F6",color:"#374151"},children:"Cancel"})]}):e.jsx("button",{onClick:()=>g(o.name),className:"text-xs px-2 py-1 rounded hover:bg-red-50",style:{color:"#DC2626",border:"1px solid #FECACA"},children:"Remove"})]},o.name)),s.length===0&&e.jsx("div",{className:"text-center py-6 text-xs",style:{color:"#9CA3AF"},children:"No ontology packages installed"})]})]})]})]})})}const _={ontologyPackage:W},Y=260,V=180;async function K(a){const s=new Map(a.map(t=>[t.name,t])),l={id:"root",layoutOptions:{"elk.algorithm":"layered","elk.direction":"RIGHT","elk.layered.nodePlacement.strategy":"BRANDES_KOEPF","elk.layered.spacing.nodeNodeBetweenLayers":"100","elk.spacing.nodeNode":"32","elk.layered.crossingMinimization.strategy":"LAYER_SWEEP","elk.padding":"[top=24, left=24, bottom=24, right=24]"},children:a.map(t=>({id:t.name,width:Y,height:V})),edges:a.filter(t=>t.extends&&s.has(t.extends)).map((t,x)=>({id:`e-${x}`,sources:[t.extends],targets:[t.name]}))},d=await I(l),n=new Map;for(const t of d.children??[])n.set(t.id,{x:t.x??0,y:t.y??0});const c={ontology:"#3B82F6",profile:"#10B981",extension:"#F59E0B"},r=a.map(t=>({id:t.name,type:"ontologyPackage",position:n.get(t.name)??{x:0,y:0},data:{name:t.name,type:t.type,version:t.version,description:t.description,kindCount:t.kindCount,layerCount:t.layers.length,layers:t.layers.map(x=>({id:x.id,label:x.label,color:x.color,kindCount:x.kindCount})),selected:t.selected,onClick:()=>{}}})),g=[];for(const t of a)if(t.extends&&s.has(t.extends)){const x=c[t.type]??"#94A3B8";g.push({id:`${t.extends}->${t.name}`,source:t.extends,target:t.name,type:"smoothstep",data:{edgeType:"extends"},style:{stroke:x,strokeWidth:2,strokeDasharray:"6 3"},animated:!1,label:"extends",labelStyle:{fontSize:9,fill:x,fontWeight:500},labelBgStyle:{fill:"#F7F7F5",fillOpacity:.9},labelBgPadding:[4,2],markerEnd:{type:"arrowclosed",color:x,width:14,height:14}})}return{nodes:r,edges:g}}function G(a,s){const l=new Map;for(const c of s)c.extends&&(l.has(c.extends)||l.set(c.extends,[]),l.get(c.extends).push(c.name));const d=new Set([a]),n=[a];for(;n.length;){const c=n.shift();for(const r of l.get(c)??[])d.has(r)||(d.add(r),n.push(r))}return d}function U(){const a=h(i=>i.availableOntologies),s=h(i=>i.setActiveView),l=h(i=>i.hiddenEdgeTypes),d=h(i=>i.toggleHiddenEdgeType),[n,c]=p.useState(!1),[r,g]=p.useState({nodes:[],edges:[]}),[t,x]=p.useState(null),{fitView:o}=S();p.useEffect(()=>{let i=!1;return K(a).then(u=>{i||g(u)}).catch(u=>{console.error("[OntologyDiagram] ELK layout failed:",u)}),()=>{i=!0}},[a]);const F=p.useCallback(i=>{s({type:"ontology-detail",packageName:i})},[s]),E=p.useCallback(i=>{const u=G(i,a),m=r.nodes.filter(y=>u.has(y.id));m.length!==0&&o({nodes:m.map(y=>({id:y.id})),duration:400,padding:.2})},[a,r.nodes,o]),v=p.useCallback((i,u)=>{i.preventDefault(),x({x:i.clientX,y:i.clientY,packageName:u})},[]);p.useEffect(()=>{const i=u=>{if(u.key==="Escape"){if(t){x(null);return}o({padding:.1,duration:300})}};return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[t,o]);const{nodes:N,edges:B}=p.useMemo(()=>{const i=r.nodes.map(m=>({...m,data:{...m.data,onClick:()=>E(m.id),onDoubleClick:()=>F(m.id),onContextMenu:y=>v(y,m.id)}})),u=r.edges.filter(m=>{var j;const y=(j=m.data)==null?void 0:j.edgeType;return!y||!l.has(y)});return{nodes:i,edges:u}},[r,E,F,v,l]),f=p.useRef(null);p.useEffect(()=>{if(!t)return;const i=u=>{f.current&&!f.current.contains(u.target)&&x(null)};return window.addEventListener("mousedown",i),()=>window.removeEventListener("mousedown",i)},[t]);const b=l.has("extends");return a.length===0?e.jsx("div",{className:"flex-1 flex items-center justify-center",style:{background:"#F7F7F5"},children:e.jsxs("div",{className:"text-center",style:{color:"#9CA3AF"},children:[e.jsx("div",{className:"text-3xl mb-3",children:"◉"}),e.jsx("div",{className:"text-sm font-medium mb-1",style:{color:"#374151"},children:"No ontology packages found"}),e.jsx("div",{className:"text-xs",children:"Start the dev server to load ontology packages"})]})}):e.jsxs("div",{className:"flex-1",style:{background:"#F7F7F5"},children:[e.jsxs("div",{className:"flex items-start justify-between px-6 pt-5 pb-3",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-semibold",style:{color:"#1a1a1a"},children:"Ontology Library"}),e.jsxs("p",{className:"text-xs mt-1",style:{color:"#9CA3AF"},children:[a.length," package",a.length!==1?"s":""," available. Click to zoom, double-click to open, right-click for source."]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{"data-testid":"toggle-tracing",onClick:()=>d("extends"),title:b?"Show extends tracing edges":"Hide extends tracing edges",className:"px-3 py-1.5 text-xs rounded-lg font-medium",style:b?{background:"#F0F0ED",color:"#6B7280",border:"1px solid #E5E5E0"}:{background:"#1B3A4B",color:"#2DD4A8",border:"1px solid transparent"},children:b?"Show Tracing":"Hide Tracing"}),e.jsx("button",{onClick:()=>c(!0),className:"px-3 py-1.5 text-xs rounded-lg font-medium",style:{background:"#1B3A4B",color:"#2DD4A8"},children:"+ Add Ontology"})]})]}),n&&e.jsx($,{onClose:()=>c(!1)}),e.jsx("div",{style:{flex:1,height:"calc(100% - 72px)"},children:e.jsxs(O,{nodes:N,edges:B,nodeTypes:_,fitView:!0,fitViewOptions:{padding:.1},nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,panOnScroll:!0,zoomOnDoubleClick:!1,minZoom:.2,maxZoom:2.5,proOptions:{hideAttribution:!0},children:[e.jsx(R,{color:"#E5E5E0",gap:24,size:1}),e.jsx(T,{showInteractive:!1})]})}),t&&e.jsx(Z,{menuRef:f,state:t,onClose:()=>x(null),packages:a})]})}const Z=({state:a,onClose:s,packages:l,menuRef:d})=>{const n=l.find(r=>r.name===a.packageName);function c(){if(!n)return;const r=n.rootDir?`${n.rootDir}/memo.package.yaml`:"";r?z(r):window.open(`vscode://file/${encodeURIComponent(n.name)}`),s()}return e.jsxs("div",{ref:d,style:{position:"fixed",top:a.y,left:a.x,zIndex:1e3,background:"#FFFFFF",border:"1px solid #E5E5E0",borderRadius:"8px",boxShadow:"0 6px 16px rgba(0,0,0,0.12)",padding:"4px",minWidth:"180px",fontSize:"12px"},children:[e.jsx("div",{style:{padding:"6px 10px",color:"#9CA3AF",fontSize:"10px",textTransform:"uppercase",letterSpacing:"0.4px"},children:a.packageName}),e.jsx("button",{onClick:c,disabled:!(n!=null&&n.rootDir),style:{display:"block",width:"100%",textAlign:"left",padding:"6px 10px",border:"none",background:"transparent",cursor:n!=null&&n.rootDir?"pointer":"not-allowed",color:n!=null&&n.rootDir?"#1a1a1a":"#9CA3AF",borderRadius:"4px"},onMouseEnter:r=>{n!=null&&n.rootDir&&(r.currentTarget.style.background="#F0F0ED")},onMouseLeave:r=>{r.currentTarget.style.background="transparent"},children:"Open source"})]})};function oe(){return e.jsx(D,{children:e.jsx(U,{})})}export{oe as OntologyDecompositionDiagram,oe as default};