@memoarchitect/architect 0.6.6 → 0.8.26

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 (93) hide show
  1. package/README.md +26 -4
  2. package/dist/assets/AiWorkspace-Z3BbnmaP.js +7 -0
  3. package/dist/assets/AnalysisWorkspace-DjaUOo7U.js +39 -0
  4. package/dist/assets/{ComplianceWizard-k98NZ2ec.js → ComplianceWizard-DKxZ1z25.js} +1 -1
  5. package/dist/assets/DSMView-DJhmrXYm.js +5 -0
  6. package/dist/assets/Dashboard-CYT7KjqU.js +1 -0
  7. package/dist/assets/DhfDashboard-DacdOtkU.js +1 -0
  8. package/dist/assets/DhfWorkbench-CIhopT8J.js +69 -0
  9. package/dist/assets/DiagramCanvas-CLE_nv7Y.js +4 -0
  10. package/dist/assets/DiagramEditor-puQuE8gB.js +4 -0
  11. package/dist/assets/DiagramToolbarControls-XMGLx08e.js +1 -0
  12. package/dist/assets/ElementDetailView-D5XvAL_i.js +2 -0
  13. package/dist/assets/ExplorerTreeRow-DUmcEsqf.js +3 -0
  14. package/dist/assets/{ImportView-CyMm-tSP.js → ImportView-9y1nhQS4.js} +1 -1
  15. package/dist/assets/{LayerGrid-DNPZYTsD.js → LayerGrid-bhFpOIbe.js} +1 -1
  16. package/dist/assets/{LayerTable-DhOq1DHo.js → LayerTable-RuswZVUI.js} +2 -2
  17. package/dist/assets/{MaxGraphCanvas-DqKU1PTY.js → MaxGraphCanvas-D3BXQK2y.js} +6 -6
  18. package/dist/assets/{ModelDiff-BbqIoesG.js → ModelDiff-Cl2dhlk3.js} +1 -1
  19. package/dist/assets/OntologyDecompositionDiagram-aONGngg4.js +1 -0
  20. package/dist/assets/{OntologyViewer-BIpJC66j.js → OntologyViewer-VOrKTRuQ.js} +2 -2
  21. package/dist/assets/{RelationshipOverlay-B9bqt4zl.js → RelationshipOverlay-B3AN-bM-.js} +1 -1
  22. package/dist/assets/{RelationshipsSection-DttMvF2i.js → RelationshipsSection-DggeGBKP.js} +1 -1
  23. package/dist/assets/{ReviewDashboard-DKoExM8K.js → ReviewDashboard--LMXZ3F4.js} +1 -1
  24. package/dist/assets/ScenarioEditor-bB4iBbgO.js +3 -0
  25. package/dist/assets/{StatisticsDashboard-B8BduIDz.js → StatisticsDashboard-iXimfU20.js} +1 -1
  26. package/dist/assets/{SysmlCodeEditor-Die2RUsz.js → SysmlCodeEditor-i0BHj3of.js} +117 -117
  27. package/dist/assets/TabularView-DnIfq-TB.js +1 -0
  28. package/dist/assets/TraceabilityMatrix-eilGn6Sr.js +3 -0
  29. package/dist/assets/UiScreensWorkspace-Cs1ivqzc.js +1 -0
  30. package/dist/assets/{WorkflowWizard-7--f9OH2.js → WorkflowWizard-C7jI6C59.js} +1 -1
  31. package/dist/assets/html2canvas.esm-QH1iLAAe.js +22 -0
  32. package/dist/assets/index-CG-gfw-s.js +4067 -0
  33. package/dist/assets/index-DXB4CKwW.css +1 -0
  34. package/dist/assets/index.es-DABt8CUc.js +18 -0
  35. package/dist/assets/jspdf.es.min-G-Vwo9yG.js +170 -0
  36. package/dist/assets/{layout-providers-Dr743WlP.js → layout-providers-BSDYNZu0.js} +1 -1
  37. package/dist/assets/notation-scene-DLZms6VR.js +1 -0
  38. package/dist/assets/purify.es-DP5U8-sc.js +3 -0
  39. package/dist/assets/{reactflow-CsCqNKB-.js → reactflow-C9OlmOYw.js} +5 -5
  40. package/dist/assets/xlsx-CkFp8p6R.js +105 -0
  41. package/dist/index.html +3 -3
  42. package/dist-standalone/index.html +5504 -0
  43. package/lib/__tests__/compiler-bundling.test.d.ts +2 -0
  44. package/lib/__tests__/compiler-bundling.test.d.ts.map +1 -0
  45. package/lib/__tests__/compiler-bundling.test.js +32 -0
  46. package/lib/__tests__/compiler-bundling.test.js.map +1 -0
  47. package/lib/__tests__/standalone-distribution.test.d.ts +2 -0
  48. package/lib/__tests__/standalone-distribution.test.d.ts.map +1 -0
  49. package/lib/__tests__/standalone-distribution.test.js +51 -0
  50. package/lib/__tests__/standalone-distribution.test.js.map +1 -0
  51. package/lib/__tests__/standard-sysml-diagrams-smoke.test.d.ts +2 -0
  52. package/lib/__tests__/standard-sysml-diagrams-smoke.test.d.ts.map +1 -0
  53. package/lib/__tests__/standard-sysml-diagrams-smoke.test.js +22 -0
  54. package/lib/__tests__/standard-sysml-diagrams-smoke.test.js.map +1 -0
  55. package/lib/__tests__/supervised-child-args.test.d.ts +2 -0
  56. package/lib/__tests__/supervised-child-args.test.d.ts.map +1 -0
  57. package/lib/__tests__/supervised-child-args.test.js +55 -0
  58. package/lib/__tests__/supervised-child-args.test.js.map +1 -0
  59. package/lib/bin/memo-architect.js +30 -4
  60. package/lib/bin/memo-architect.js.map +1 -1
  61. package/lib/commands/build.d.ts.map +1 -1
  62. package/lib/commands/build.js +15 -18
  63. package/lib/commands/build.js.map +1 -1
  64. package/lib/commands/dev.d.ts +32 -2
  65. package/lib/commands/dev.d.ts.map +1 -1
  66. package/lib/commands/dev.js +95 -8
  67. package/lib/commands/dev.js.map +1 -1
  68. package/lib/commands/example.d.ts +1 -0
  69. package/lib/commands/example.d.ts.map +1 -1
  70. package/lib/commands/example.js +2 -0
  71. package/lib/commands/example.js.map +1 -1
  72. package/lib/feature-grants.d.ts.map +1 -1
  73. package/lib/feature-grants.js +3 -1
  74. package/lib/feature-grants.js.map +1 -1
  75. package/package.json +16 -6
  76. package/dist/assets/AiWorkspace-DS79vBOT.js +0 -3
  77. package/dist/assets/AnalysisWorkspace-D_u4shRY.js +0 -39
  78. package/dist/assets/DSMView-DGheBwZ0.js +0 -1
  79. package/dist/assets/Dashboard-BRUQvUFK.js +0 -1
  80. package/dist/assets/DhfDashboard-B9V_n7kg.js +0 -1
  81. package/dist/assets/DhfSettingsPanel-B8aLsWn6.js +0 -1
  82. package/dist/assets/DhfWorkbench-TOnZkdUU.js +0 -69
  83. package/dist/assets/DiagramCanvas-B9d4aLKt.js +0 -1
  84. package/dist/assets/DiagramEditor-CJ7OG2IC.js +0 -4
  85. package/dist/assets/ElementDetailView-CDcm1rvf.js +0 -2
  86. package/dist/assets/OntologyDecompositionDiagram-DkxTe2C_.js +0 -1
  87. package/dist/assets/ScenarioEditor-JQ3huCnz.js +0 -3
  88. package/dist/assets/TabularView-BXfFSluC.js +0 -1
  89. package/dist/assets/TraceabilityMatrix-CHZHFucA.js +0 -1
  90. package/dist/assets/editor.worker-DyuDvpVp.js +0 -26
  91. package/dist/assets/index-CVW92JY7.js +0 -3280
  92. package/dist/assets/index-Y1UZTZg-.css +0 -1
  93. package/dist/assets/layout-selection-ClQ295Xc.js +0 -1
@@ -1 +1 @@
1
- import{j as e}from"./reactflow-CsCqNKB-.js";import{a as y}from"./zustand-CrhqMOHB.js";import{u as F,f as j}from"./index-CVW92JY7.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-CG-gfw-s.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};
@@ -0,0 +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,Z as P,$ as M,d as z}from"./index-CG-gfw-s.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:i}){const s=i,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:i}){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:i,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:i,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(i){const s=new Map(i.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:i.map(t=>({id:t.name,width:Y,height:V})),edges:i.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=i.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 i)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(i,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([i]),n=[i];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 Z(){const i=h(a=>a.availableOntologies),s=h(a=>a.setActiveView),l=h(a=>a.hiddenEdgeTypes),d=h(a=>a.toggleHiddenEdgeType),[n,c]=p.useState(!1),[r,g]=p.useState({nodes:[],edges:[]}),[t,x]=p.useState(null),{fitView:o}=S();p.useEffect(()=>{let a=!1;return K(i).then(u=>{a||g(u)}).catch(u=>{console.error("[OntologyDiagram] ELK layout failed:",u)}),()=>{a=!0}},[i]);const F=p.useCallback(a=>{s({type:"ontology-detail",packageName:a})},[s]),E=p.useCallback(a=>{const u=G(a,i),m=r.nodes.filter(y=>u.has(y.id));m.length!==0&&o({nodes:m.map(y=>({id:y.id})),duration:400,padding:.2})},[i,r.nodes,o]),v=p.useCallback((a,u)=>{a.preventDefault(),x({x:a.clientX,y:a.clientY,packageName:u})},[]);p.useEffect(()=>{const a=u=>{if(u.key==="Escape"){if(t){x(null);return}o({padding:.1,duration:300})}};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[t,o]);const{nodes:N,edges:B}=p.useMemo(()=>{const a=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:a,edges:u}},[r,E,F,v,l]),f=p.useRef(null);p.useEffect(()=>{if(!t)return;const a=u=>{f.current&&!f.current.contains(u.target)&&x(null)};return window.addEventListener("mousedown",a),()=>window.removeEventListener("mousedown",a)},[t]);const b=l.has("extends");return i.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:[i.length," package",i.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(U,{menuRef:f,state:t,onClose:()=>x(null),packages:i})]})}const U=({state:i,onClose:s,packages:l,menuRef:d})=>{const n=l.find(r=>r.name===i.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:i.y,left:i.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:i.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(Z,{})})}export{oe as OntologyDecompositionDiagram,oe as default};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/LayerGrid-DNPZYTsD.js","assets/reactflow-CsCqNKB-.js","assets/zustand-CrhqMOHB.js","assets/index-CVW92JY7.js","assets/index-Y1UZTZg-.css","assets/LayerTable-DhOq1DHo.js","assets/RelationshipsSection-DttMvF2i.js","assets/sysml-edge-styles-ByJeCWqa.js","assets/RelationshipOverlay-B9bqt4zl.js","assets/OntologyDecompositionDiagram-DkxTe2C_.js","assets/layout-providers-Dr743WlP.js","assets/elk-6l8mIQnQ.js","assets/style-BZV40eAE.css"])))=>i.map(i=>d[i]);
2
- import{f as _,u as y,_ as O,L as X}from"./index-CVW92JY7.js";import{j as e}from"./reactflow-CsCqNKB-.js";import{a}from"./zustand-CrhqMOHB.js";function G({ontology:s}){const i=s.layers.reduce((r,f)=>r+f.kinds.reduce((d,l)=>d+l.instanceCount,0),0);return e.jsxs("div",{className:"rounded-xl p-5 mb-5",style:{background:"#FFFFFF",border:"1px solid #E5E5E0",boxShadow:"0 1px 3px rgba(0,0,0,0.04)"},children:[e.jsx("div",{className:"flex items-start justify-between gap-3 mb-3",children:e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"px-2 py-0.5 text-xs rounded-full font-medium",style:{background:"#EFF6FF",color:"#2563EB",border:"1px solid #BFDBFE"},children:s.type}),s.extends&&e.jsxs("span",{className:"text-xs",style:{color:"#9CA3AF"},children:["extends ",s.extends]})]}),e.jsx("h2",{className:"text-base font-semibold truncate",style:{color:"#1a1a1a"},children:s.name}),e.jsxs("div",{className:"text-xs mt-0.5",style:{color:"#9CA3AF"},children:["v",s.version]})]})}),s.description&&e.jsx("p",{className:"text-sm mb-4",style:{color:"#6B7280",lineHeight:"1.5"},children:s.description}),e.jsxs("div",{className:"flex gap-5 text-xs",style:{color:"#6B7280"},children:[e.jsxs("div",{children:[e.jsx("span",{className:"font-semibold text-sm",style:{color:"#1B3A4B"},children:s.kindCount})," ","kinds"]}),e.jsxs("div",{children:[e.jsx("span",{className:"font-semibold text-sm",style:{color:"#1B3A4B"},children:s.layers.length})," ","layers"]}),i>0&&e.jsxs("div",{children:[e.jsx("span",{className:"font-semibold text-sm",style:{color:"#1B3A4B"},children:i})," ","model instances"]})]})]})}function J({kind:s,layers:i,onKindClick:r,onClose:f,allOntologies:d,onNavigate:l}){const o=_[s.layer]??"#6B7280",c=i.flatMap(t=>t.kinds),m=s.derivesFrom?c.find(t=>t.name===s.derivesFrom):null;function p(t){if(i.some(x=>x.kinds.some(h=>h.name===t)))return null;for(const x of d??[])if(x.layers.some(h=>h.kinds.some(N=>N.name===t)))return x.name;return null}function v(t){const x=p(t);x&&l?l(x,t):r(t)}return e.jsxs("div",{className:"flex flex-col border-l overflow-y-auto",style:{width:320,minWidth:320,background:"#FFFFFF",borderColor:"#E5E5E0"},children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b",style:{borderColor:"#E5E5E0"},children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("span",{className:"w-3 h-3 rounded flex-shrink-0",style:{backgroundColor:o}}),e.jsx("h3",{className:"text-sm font-semibold truncate",style:{color:"#1a1a1a"},children:s.label})]}),e.jsx("button",{onClick:f,className:"text-sm px-1.5 rounded hover:bg-gray-100",style:{color:"#9CA3AF"},children:"✕"})]}),e.jsxs("div",{className:"p-4 space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"px-2 py-0.5 text-xs rounded font-mono",style:{background:"#F3F4F6",color:"#4B5563",border:"1px solid #E5E7EB"},children:s.construct}),e.jsx("span",{className:"px-2 py-0.5 text-xs rounded font-medium",style:{background:`${o}15`,color:o,border:`1px solid ${o}30`},children:s.layer})]}),s.description&&e.jsx(S,{title:"Description",children:e.jsx("p",{className:"text-xs leading-relaxed",style:{color:"#6B7280"},children:s.description})}),s.derivesFrom&&e.jsx(S,{title:"Derives From",children:e.jsx(I,{name:s.derivesFrom,layer:m==null?void 0:m.layer,crossOntology:p(s.derivesFrom)!==null,onClick:()=>v(s.derivesFrom)})}),s.derivedBy&&s.derivedBy.length>0&&e.jsx(S,{title:`Derived By (${s.derivedBy.length})`,children:e.jsx("div",{className:"flex flex-wrap gap-1.5",children:s.derivedBy.map(t=>{const x=c.find(h=>h.name===t);return e.jsx(I,{name:t,layer:x==null?void 0:x.layer,crossOntology:p(t)!==null,onClick:()=>v(t)},t)})})}),s.relationships&&s.relationships.length>0&&e.jsx(S,{title:`Relationships (${s.relationships.length})`,children:e.jsx("div",{className:"space-y-1",children:s.relationships.map((t,x)=>e.jsxs("div",{className:"flex items-center gap-1.5 text-xs",style:{color:"#6B7280"},children:[e.jsx("span",{style:{color:t.direction==="outgoing"?"#10B981":"#8B5CF6"},children:t.direction==="outgoing"?"→":"←"}),e.jsx("span",{className:"font-medium",style:{color:"#374151"},children:t.type}),e.jsx("button",{className:"hover:underline",style:{color:"#2563EB"},onClick:()=>v(t.targetKind),children:t.targetKind})]},x))})}),e.jsxs(S,{title:"Usage",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(V,{label:"Instances",value:s.instanceCount}),e.jsx(V,{label:"Viewpoints",value:s.viewpoints.length})]}),s.viewpoints.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1 mt-2",children:s.viewpoints.map(t=>e.jsx("span",{className:"px-1.5 py-0.5 text-xs rounded",style:{background:"#F3F4F6",color:"#6B7280"},children:t},t))})]})]})]})}function S({title:s,children:i}){return e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs font-medium mb-1.5",style:{color:"#9CA3AF",textTransform:"uppercase",letterSpacing:"0.05em"},children:s}),i]})}function I({name:s,layer:i,crossOntology:r,onClick:f}){const d=i?_[i]??"#6B7280":"#6B7280";return e.jsxs("button",{onClick:f,className:"inline-flex items-center gap-1.5 px-2 py-1 text-xs rounded-md hover:bg-gray-50",style:{border:"1px solid #E5E7EB",color:"#374151"},title:r?"Navigate to this kind in another ontology package":void 0,children:[e.jsx("span",{className:"w-2 h-2 rounded-full flex-shrink-0",style:{backgroundColor:d}}),s.replace(/([A-Z])/g," $1").trim(),r&&e.jsx("span",{style:{color:"#9CA3AF",fontSize:"9px"},children:"↗"})]})}function V({label:s,value:i}){return e.jsxs("div",{className:"rounded-lg p-2",style:{background:"#F9FAFB",border:"1px solid #F3F4F6"},children:[e.jsx("div",{className:"text-sm font-semibold",style:{color:"#1B3A4B"},children:i}),e.jsx("div",{className:"text-xs",style:{color:"#9CA3AF"},children:s})]})}const P={"part def":{label:"Part Definition",shorthand:"pd",description:"Defines a structural classifier (composite part)"},"connection def":{label:"Connection Definition",shorthand:"cd",description:"Defines a connector type between parts"},"attribute def":{label:"Attribute Definition",shorthand:"ad",description:"Defines a typed value property"},"item def":{label:"Item Definition",shorthand:"id",description:"Defines a flow item type"},"action def":{label:"Action Definition",shorthand:"acd",description:"Defines a behavioral action"},"state def":{label:"State Definition",shorthand:"sd",description:"Defines a state machine type"},"requirement def":{label:"Requirement Definition",shorthand:"rd",description:"Defines a requirement type"},"use case def":{label:"Use Case Definition",shorthand:"ucd",description:"Defines a use case type"},"occurrence def":{label:"Occurrence Definition",shorthand:"od",description:"Defines an occurrence (event or snapshot)"},"interface def":{label:"Interface Definition",shorthand:"ifd",description:"Defines a port interface type"},"port def":{label:"Port Definition",shorthand:"ptd",description:"Defines a port type for system interfaces"},"metadata def":{label:"Metadata Definition",shorthand:"md",description:"Defines a metadata annotation type"}},Q={purpose:"#cce5ff",business:"#cce5ff",operational:"#cce5ff",requirements:"#dae8fc",functional:"#d5e8d4",behavior:"#d5e8d4",logical:"#d5e8d4",physical:"#ffe6cc",software:"#d5e8d4",interfaces:"#d5e8d4",ui:"#d5e8d4",risk:"#f8cecc",safety:"#f8cecc",cybersecurity:"#f8cecc",verification:"#e1d5e7",analysis:"#e1d5e7","design-control":"#fff2cc",qms:"#fff2cc","software-lifecycle":"#fff2cc",operations:"#fff2cc",clinical:"#fff2cc",privacy:"#fff2cc"};function ee({layers:s}){const i=[],r=new Map;for(const l of s)for(const o of l.kinds){const c=o.construct||"part def";r.has(c)||r.set(c,[]),r.get(c).push({kindName:o.name,layer:l.id,layerLabel:l.label,layerColor:Q[l.id]??"#f3f4f6",derivesFrom:o.derivesFrom,description:o.description})}const f=Object.keys(P),d=[...r.keys()].sort((l,o)=>{const c=f.indexOf(l),m=f.indexOf(o);return c===-1&&m===-1?l.localeCompare(o):c===-1?1:m===-1?-1:c-m});for(const l of d){const o=r.get(l).sort((m,p)=>m.kindName.localeCompare(p.kindName)),c=P[l];i.push({construct:l,label:(c==null?void 0:c.label)??l,shorthand:(c==null?void 0:c.shorthand)??l,description:(c==null?void 0:c.description)??"",kinds:o})}return i.length===0?e.jsx("div",{className:"py-8 text-center text-sm",style:{color:"#9CA3AF"},children:"No kinds found in the selected viewpoint."}):e.jsxs("div",{style:{fontFamily:"inherit"},children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("h3",{className:"text-sm font-semibold mb-1",style:{color:"#1a1a1a"},children:"SysML v2 Construct Mapping"}),e.jsx("p",{className:"text-xs",style:{color:"#9CA3AF"},children:"Each SysML v2 construct keyword and the MEMO kinds that use it. Shorthand codes appear on kind cards throughout the viewer."})]}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"16px"},children:i.map(l=>e.jsx(se,{group:l},l.construct))})]})}function se({group:s}){return e.jsxs("div",{style:{border:"1px solid #E5E5E0",borderRadius:"10px",overflow:"hidden"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"8px 12px",background:"#F7F7F5",borderBottom:"1px solid #E5E5E0"},children:[e.jsx("code",{style:{fontSize:"11px",fontFamily:"monospace",background:"#1B3A4B",color:"#2DD4A8",padding:"2px 6px",borderRadius:"4px",letterSpacing:"0.02em"},children:s.construct}),e.jsx("span",{className:"text-sm font-semibold",style:{color:"#1a1a1a"},children:s.label}),e.jsx("span",{style:{fontSize:"10px",color:"#6B7280",fontFamily:"monospace",background:"#EBEBEB",padding:"1px 5px",borderRadius:"3px"},children:s.shorthand}),s.description&&e.jsxs("span",{className:"text-xs ml-1",style:{color:"#9CA3AF"},children:["— ",s.description]}),e.jsxs("span",{className:"ml-auto text-xs",style:{color:"#9CA3AF"},children:[s.kinds.length," kind",s.kinds.length!==1?"s":""]})]}),e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px",padding:"10px 12px"},children:s.kinds.map(i=>e.jsx(te,{kind:i},i.kindName))})]})}function te({kind:s}){return e.jsxs("div",{title:s.description??s.kindName,style:{display:"inline-flex",alignItems:"center",gap:"5px",padding:"3px 8px",background:s.layerColor,borderRadius:"5px",fontSize:"11px",fontWeight:500,color:"#1a1a1a",border:"1px solid rgba(0,0,0,0.06)",whiteSpace:"nowrap"},children:[e.jsx("span",{style:{fontWeight:600},children:s.kindName}),e.jsx("span",{style:{fontSize:"9px",color:"#6B7280",background:"rgba(255,255,255,0.55)",padding:"1px 4px",borderRadius:"3px"},children:s.layerLabel}),s.derivesFrom&&e.jsxs("span",{style:{fontSize:"9px",color:"#9CA3AF",fontStyle:"italic"},title:`Specializes ${s.derivesFrom}`,children:[":> ",s.derivesFrom]})]})}const ne=a.lazy(()=>O(()=>import("./LayerGrid-DNPZYTsD.js"),__vite__mapDeps([0,1,2,3,4])).then(s=>({default:s.LayerGrid}))),ie=a.lazy(()=>O(()=>import("./LayerTable-DhOq1DHo.js"),__vite__mapDeps([5,1,2,3,4])).then(s=>({default:s.LayerTable}))),K=a.lazy(()=>O(()=>import("./RelationshipsSection-DttMvF2i.js"),__vite__mapDeps([6,1,2,7])).then(s=>({default:s.RelationshipsSection}))),le=a.lazy(()=>O(()=>import("./RelationshipOverlay-B9bqt4zl.js"),__vite__mapDeps([8,1,2,7])).then(s=>({default:s.RelationshipOverlay}))),L=[{id:"all",label:"All Layers",layerIds:null,description:"All architecture layers in swimlane view"},{id:"software",label:"Software Views",layerIds:["functional","behavior","logical","software","interfaces","ui"],description:"Software architecture: Logical/Service, Runtime, Module/Code, Deployment"},{id:"hardware",label:"Hardware Views",layerIds:["logical","physical","interfaces"],description:"Hardware architecture: Logical, Physical/Embodiment, Compute/Electronics, Cross-domain"},{id:"risk",label:"Risk Chain",layerIds:["requirements","risk","safety","cybersecurity","verification","analysis"],description:"Risk trace chain: Hazard → HazardousSituation → Harm → RiskControlMeasure → verification"},{id:"traceability",label:"Traceability",layerIds:["purpose","business","operational","requirements","risk","safety","functional","software","software-lifecycle","verification","analysis"],description:"Full trace: clinical, risk, software, and hardware chains"},{id:"sysml-mapping",label:"SysML Mapping",layerIds:null,type:"sysml-mapping",description:"SysML v2 construct → MEMO kind reference table"}],ae=.3,oe=2.5,R=.15;function re({children:s}){const[i,r]=a.useState(1),[f,d]=a.useState({x:0,y:0}),l=a.useRef(!1),o=a.useRef({x:0,y:0}),c=a.useRef(null),m=u=>Math.max(ae,Math.min(oe,u)),p=a.useCallback(u=>{u.preventDefault();const F=u.deltaY<0?R:-R;r(C=>m(C+F))},[]),v=a.useCallback(u=>{u.target.closest("button, input, a")||(l.current=!0,o.current={x:u.clientX,y:u.clientY},u.currentTarget.setAttribute("data-panning","true"))},[]),t=a.useCallback(u=>{if(!l.current)return;const F=u.clientX-o.current.x,C=u.clientY-o.current.y;o.current={x:u.clientX,y:u.clientY},d(k=>({x:k.x+F,y:k.y+C}))},[]),x=a.useCallback(u=>{l.current=!1,u.currentTarget.removeAttribute("data-panning")},[]),h=a.useCallback(u=>{l.current=!1,u.currentTarget.removeAttribute("data-panning")},[]);function N(){r(1),d({x:0,y:0})}return e.jsxs("div",{style:{position:"relative",width:"100%",height:"100%"},children:[e.jsxs("div",{style:{position:"absolute",top:"10px",right:"10px",zIndex:10,display:"flex",gap:"4px",background:"rgba(255,255,255,0.92)",border:"1px solid #E5E5E0",borderRadius:"8px",padding:"4px",boxShadow:"0 2px 8px rgba(0,0,0,0.08)"},children:[e.jsx(T,{title:"Zoom in",onClick:()=>r(u=>m(u+R)),children:"+"}),e.jsxs("span",{style:{fontSize:"10px",color:"#6B7280",lineHeight:"26px",minWidth:"34px",textAlign:"center"},children:[Math.round(i*100),"%"]}),e.jsx(T,{title:"Zoom out",onClick:()=>r(u=>m(u-R)),children:"−"}),e.jsx("div",{style:{width:"1px",background:"#E5E5E0",margin:"2px 0"}}),e.jsx(T,{title:"Fit to view",onClick:N,children:"⊡"})]}),e.jsx("div",{ref:c,onWheel:p,onMouseDown:v,onMouseMove:t,onMouseUp:x,onMouseLeave:h,style:{width:"100%",height:"100%",overflow:"hidden",cursor:l.current?"grabbing":"grab",userSelect:"none"},children:e.jsx("div",{style:{transform:`translate(${f.x}px, ${f.y}px) scale(${i})`,transformOrigin:"0 0",willChange:"transform",padding:"16px"},children:s})})]})}function T({onClick:s,title:i,children:r}){return e.jsx("button",{onClick:s,title:i,style:{width:"26px",height:"26px",border:"none",borderRadius:"5px",background:"transparent",cursor:"pointer",fontSize:"14px",color:"#374151",display:"flex",alignItems:"center",justifyContent:"center",lineHeight:1},onMouseEnter:f=>{f.currentTarget.style.background="#F0F0ED"},onMouseLeave:f=>{f.currentTarget.style.background="transparent"},children:r})}function ce({ontology:s,onBack:i}){const r=y(n=>n.ontologyViewMode),f=y(n=>n.setOntologyViewMode),d=y(n=>n.selectedOntologyKind),l=y(n=>n.setSelectedOntologyKind),o=y(n=>n.showOntologyRelationships),c=y(n=>n.toggleOntologyRelationships),m=y(n=>n.model),p=y(n=>n.activeView),v=y(n=>n.setActiveView),t=y(n=>n.availableOntologies),x=a.useRef(null),[h,N]=a.useState(new Set),[u,F]=a.useState("all"),[C,k]=a.useState(!1),[H,W]=a.useState(null),[Z,Y]=a.useState(0);a.useEffect(()=>{d&&(k(!0),W(d),Y(n=>n+1))},[d]);const g=a.useMemo(()=>({...s,layers:s.layers.map(n=>({...n,kinds:n.kinds.map(b=>{var M;return{...b,instanceCount:m?Object.values(m.elements).filter(A=>A.kind===b.name).length:0,viewpoints:((M=m==null?void 0:m.viewpoints)==null?void 0:M.filter(A=>A.visibleKinds.includes(b.name)).map(A=>A.id))??[]}})}))}),[s,m]),E=L.find(n=>n.id===u)??L[0],j=a.useMemo(()=>{if(!E.layerIds)return g.layers;const n=new Set(E.layerIds);return g.layers.filter(b=>n.has(b.id))},[g.layers,E.layerIds]),w=a.useMemo(()=>{if(!d)return null;for(const n of g.layers){const b=n.kinds.find(M=>M.name===d);if(b)return{kind:b,layerInfo:n}}return null},[d,g]);function q(n,b){l(b),v({type:"ontology-detail",packageName:n})}function U(n){v({type:"ontology-detail",packageName:s.name,layerId:n})}const B={background:"#1B3A4B",color:"#2DD4A8",border:"1px solid transparent"},D={background:"#F0F0ED",color:"#6B7280",border:"1px solid transparent"};return e.jsxs("div",{className:"flex flex-1 overflow-hidden",style:{background:"#F7F7F5"},children:[e.jsxs("div",{className:"flex-1 overflow-y-auto",children:[e.jsxs("div",{className:"px-6 pt-5 pb-3",style:{borderBottom:"1px solid #E5E5E0"},children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-3 text-xs flex-wrap",style:{color:"#9CA3AF"},children:[i&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:i,className:"hover:underline",style:{color:"#2563EB"},children:"Ontology Library"}),e.jsx("span",{children:"/"})]}),e.jsx("button",{onClick:()=>l(null),className:"hover:underline",style:{color:w?"#2563EB":"#374151",fontWeight:w?400:500},children:s.name}),w&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"/"}),e.jsx("button",{onClick:()=>U(w.layerInfo.id),className:"hover:underline",style:{color:"#2563EB"},children:w.layerInfo.label}),e.jsx("span",{children:"/"}),e.jsx("span",{style:{color:"#1a1a1a",fontWeight:600},children:d})]})]}),e.jsx(G,{ontology:g}),e.jsxs("div",{className:"flex items-center gap-2 mt-3",children:[e.jsx("span",{className:"text-xs",style:{color:"#9CA3AF"},children:"Layers:"}),e.jsx("button",{onClick:()=>f("visual"),className:"px-2.5 py-1 text-xs rounded-md font-medium",style:r==="visual"?B:D,children:"Visual"}),e.jsx("button",{onClick:()=>f("table"),className:"px-2.5 py-1 text-xs rounded-md font-medium",style:r==="table"?B:D,children:"Table"}),e.jsx("span",{style:{width:"1px",height:"16px",background:"#E5E5E0",margin:"0 4px"}}),e.jsxs("button",{onClick:c,className:"px-2.5 py-1 text-xs rounded-md font-medium",style:o?B:D,children:[o?"Hide":"Show"," Relationships"]})]}),e.jsxs("div",{className:"flex items-center gap-0 mt-3 -mx-6 px-6",style:{borderTop:"1px solid #E5E5E0",paddingTop:"10px"},children:[e.jsx("span",{className:"text-xs mr-2",style:{color:"#9CA3AF",whiteSpace:"nowrap"},children:"View:"}),e.jsx("div",{className:"flex items-center gap-1 flex-wrap",children:L.map(n=>{const b=u===n.id;return e.jsx("button",{onClick:()=>F(n.id),title:n.description,className:"px-2.5 py-1 text-xs rounded-md font-medium transition-all",style:b?B:D,children:n.label},n.id)})}),j.length!==g.layers.length&&E.type!=="sysml-mapping"&&e.jsxs("span",{className:"ml-auto text-xs",style:{color:"#9CA3AF",whiteSpace:"nowrap"},children:[j.length," of ",g.layers.length," layers"]})]})]}),E.type==="sysml-mapping"?e.jsx("div",{className:"px-6 py-4",children:e.jsx(ee,{layers:g.layers})}):r==="visual"?e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{height:"280px",position:"relative",borderBottom:"1px solid #E5E5E0"},children:e.jsx(re,{children:e.jsxs("div",{ref:x,style:{position:"relative"},children:[e.jsx(a.Suspense,{fallback:e.jsx(z,{layers:j}),children:e.jsx(ne,{layers:j,selectedKind:d,onKindClick:l,activeLayerId:p.layerId??null,flashKindName:H,flashTick:Z})}),o&&e.jsx(a.Suspense,{fallback:null,children:e.jsx(le,{containerRef:x,ontology:{...g,layers:j},activeTypes:h})})]})})}),o&&e.jsx("div",{className:"px-6 py-4",children:e.jsx(a.Suspense,{fallback:null,children:e.jsx(K,{ontology:{...g,layers:j},activeTypes:h,onActiveTypesChange:N})})})]}):e.jsxs("div",{className:"px-6 py-4",children:[e.jsx(a.Suspense,{fallback:e.jsx(z,{layers:j}),children:e.jsx(ie,{layers:j,selectedKind:d,onKindClick:l})}),o&&e.jsx(a.Suspense,{fallback:null,children:e.jsx(K,{ontology:{...g,layers:j},activeTypes:h,onActiveTypesChange:N})})]})]}),C&&w&&e.jsx(J,{kind:w.kind,layers:g.layers,allOntologies:t,onKindClick:l,onNavigate:q,onClose:()=>{l(null),k(!1)}})]})}function z({layers:s}){return e.jsx("div",{className:"grid gap-3 mb-6",style:{gridTemplateColumns:"repeat(auto-fill, minmax(220px, 1fr))"},children:s.map(i=>{const r=_[i.id]??i.color??"#6B7280";return e.jsxs("div",{className:"rounded-xl p-4",style:{background:"#FFFFFF",border:`2px solid ${r}30`},children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("span",{className:"w-3 h-3 rounded",style:{backgroundColor:r}}),e.jsx("span",{className:"text-sm font-medium",style:{color:"#1a1a1a"},children:i.label})]}),e.jsxs("div",{className:"text-xs",style:{color:"#9CA3AF"},children:[i.kindCount," kinds"]})]},i.id)})})}const de=a.lazy(()=>O(()=>import("./OntologyDecompositionDiagram-DkxTe2C_.js"),__vite__mapDeps([9,1,2,10,11,3,4,12]))),$=Object.fromEntries(X.map((s,i)=>[s,i]));function me(){const s=y(p=>p.activeView),i=y(p=>p.availableOntologies),r=y(p=>p.setActiveView),f=y(p=>p.model),d=s.type==="ontology-detail",l=d?s.packageName:null,o=l?i.find(p=>p.name===l):null,c=a.useMemo(()=>{if(o||!d||!f)return null;const p=new Map;for(const t of Object.values(f.elements))p.has(t.layer)||p.set(t.layer,[]),p.get(t.layer).includes(t.kind)||p.get(t.layer).push(t.kind);const v=[...p.entries()].sort(([t],[x])=>($[t]??99)-($[x]??99)).map(([t,x])=>({id:t,label:t.charAt(0).toUpperCase()+t.slice(1),color:"#6B7280",kindCount:x.length,kinds:x.map(h=>({name:h,label:h.replace(/([A-Z])/g," $1").trim(),construct:"part def",layer:t,instanceCount:0,viewpoints:[]}))}));return{name:"@memo/model (inferred)",version:"–",type:"ontology",description:"Ontology inferred from loaded model elements.",layers:v,kindCount:v.reduce((t,x)=>t+x.kindCount,0),relationshipCount:0,relationshipTypes:[],selected:!0}},[o,d,f]),m=o??c;return d&&m?e.jsx(ce,{ontology:m,onBack:()=>r({type:"ontology"})}):e.jsx(a.Suspense,{fallback:e.jsx("div",{className:"flex-1 flex items-center justify-center",style:{background:"#F7F7F5"},children:e.jsx("span",{className:"text-sm",style:{color:"#9CA3AF"},children:"Loading ontology library..."})}),children:e.jsx(de,{})})}export{me as OntologyViewer,me as default};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/LayerGrid-bhFpOIbe.js","assets/reactflow-C9OlmOYw.js","assets/zustand-CrhqMOHB.js","assets/index-CG-gfw-s.js","assets/index-DXB4CKwW.css","assets/LayerTable-RuswZVUI.js","assets/RelationshipsSection-DggeGBKP.js","assets/sysml-edge-styles-ByJeCWqa.js","assets/RelationshipOverlay-B3AN-bM-.js","assets/OntologyDecompositionDiagram-aONGngg4.js","assets/layout-providers-BSDYNZu0.js","assets/elk-6l8mIQnQ.js","assets/style-BZV40eAE.css"])))=>i.map(i=>d[i]);
2
+ import{h as _,u as y,_ as O,L as X}from"./index-CG-gfw-s.js";import{j as e}from"./reactflow-C9OlmOYw.js";import{a}from"./zustand-CrhqMOHB.js";function G({ontology:s}){const i=s.layers.reduce((r,f)=>r+f.kinds.reduce((d,l)=>d+l.instanceCount,0),0);return e.jsxs("div",{className:"rounded-xl p-5 mb-5",style:{background:"#FFFFFF",border:"1px solid #E5E5E0",boxShadow:"0 1px 3px rgba(0,0,0,0.04)"},children:[e.jsx("div",{className:"flex items-start justify-between gap-3 mb-3",children:e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"px-2 py-0.5 text-xs rounded-full font-medium",style:{background:"#EFF6FF",color:"#2563EB",border:"1px solid #BFDBFE"},children:s.type}),s.extends&&e.jsxs("span",{className:"text-xs",style:{color:"#9CA3AF"},children:["extends ",s.extends]})]}),e.jsx("h2",{className:"text-base font-semibold truncate",style:{color:"#1a1a1a"},children:s.name}),e.jsxs("div",{className:"text-xs mt-0.5",style:{color:"#9CA3AF"},children:["v",s.version]})]})}),s.description&&e.jsx("p",{className:"text-sm mb-4",style:{color:"#6B7280",lineHeight:"1.5"},children:s.description}),e.jsxs("div",{className:"flex gap-5 text-xs",style:{color:"#6B7280"},children:[e.jsxs("div",{children:[e.jsx("span",{className:"font-semibold text-sm",style:{color:"#1B3A4B"},children:s.kindCount})," ","kinds"]}),e.jsxs("div",{children:[e.jsx("span",{className:"font-semibold text-sm",style:{color:"#1B3A4B"},children:s.layers.length})," ","layers"]}),i>0&&e.jsxs("div",{children:[e.jsx("span",{className:"font-semibold text-sm",style:{color:"#1B3A4B"},children:i})," ","model instances"]})]})]})}function J({kind:s,layers:i,onKindClick:r,onClose:f,allOntologies:d,onNavigate:l}){const o=_[s.layer]??"#6B7280",c=i.flatMap(t=>t.kinds),m=s.derivesFrom?c.find(t=>t.name===s.derivesFrom):null;function p(t){if(i.some(x=>x.kinds.some(h=>h.name===t)))return null;for(const x of d??[])if(x.layers.some(h=>h.kinds.some(N=>N.name===t)))return x.name;return null}function v(t){const x=p(t);x&&l?l(x,t):r(t)}return e.jsxs("div",{className:"flex flex-col border-l overflow-y-auto",style:{width:320,minWidth:320,background:"#FFFFFF",borderColor:"#E5E5E0"},children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b",style:{borderColor:"#E5E5E0"},children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("span",{className:"w-3 h-3 rounded flex-shrink-0",style:{backgroundColor:o}}),e.jsx("h3",{className:"text-sm font-semibold truncate",style:{color:"#1a1a1a"},children:s.label})]}),e.jsx("button",{onClick:f,className:"text-sm px-1.5 rounded hover:bg-gray-100",style:{color:"#9CA3AF"},children:"✕"})]}),e.jsxs("div",{className:"p-4 space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"px-2 py-0.5 text-xs rounded font-mono",style:{background:"#F3F4F6",color:"#4B5563",border:"1px solid #E5E7EB"},children:s.construct}),e.jsx("span",{className:"px-2 py-0.5 text-xs rounded font-medium",style:{background:`${o}15`,color:o,border:`1px solid ${o}30`},children:s.layer})]}),s.description&&e.jsx(S,{title:"Description",children:e.jsx("p",{className:"text-xs leading-relaxed",style:{color:"#6B7280"},children:s.description})}),s.derivesFrom&&e.jsx(S,{title:"Derives From",children:e.jsx(I,{name:s.derivesFrom,layer:m==null?void 0:m.layer,crossOntology:p(s.derivesFrom)!==null,onClick:()=>v(s.derivesFrom)})}),s.derivedBy&&s.derivedBy.length>0&&e.jsx(S,{title:`Derived By (${s.derivedBy.length})`,children:e.jsx("div",{className:"flex flex-wrap gap-1.5",children:s.derivedBy.map(t=>{const x=c.find(h=>h.name===t);return e.jsx(I,{name:t,layer:x==null?void 0:x.layer,crossOntology:p(t)!==null,onClick:()=>v(t)},t)})})}),s.relationships&&s.relationships.length>0&&e.jsx(S,{title:`Relationships (${s.relationships.length})`,children:e.jsx("div",{className:"space-y-1",children:s.relationships.map((t,x)=>e.jsxs("div",{className:"flex items-center gap-1.5 text-xs",style:{color:"#6B7280"},children:[e.jsx("span",{style:{color:t.direction==="outgoing"?"#10B981":"#8B5CF6"},children:t.direction==="outgoing"?"→":"←"}),e.jsx("span",{className:"font-medium",style:{color:"#374151"},children:t.type}),e.jsx("button",{className:"hover:underline",style:{color:"#2563EB"},onClick:()=>v(t.targetKind),children:t.targetKind})]},x))})}),e.jsxs(S,{title:"Usage",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(V,{label:"Instances",value:s.instanceCount}),e.jsx(V,{label:"Viewpoints",value:s.viewpoints.length})]}),s.viewpoints.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1 mt-2",children:s.viewpoints.map(t=>e.jsx("span",{className:"px-1.5 py-0.5 text-xs rounded",style:{background:"#F3F4F6",color:"#6B7280"},children:t},t))})]})]})]})}function S({title:s,children:i}){return e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs font-medium mb-1.5",style:{color:"#9CA3AF",textTransform:"uppercase",letterSpacing:"0.05em"},children:s}),i]})}function I({name:s,layer:i,crossOntology:r,onClick:f}){const d=i?_[i]??"#6B7280":"#6B7280";return e.jsxs("button",{onClick:f,className:"inline-flex items-center gap-1.5 px-2 py-1 text-xs rounded-md hover:bg-gray-50",style:{border:"1px solid #E5E7EB",color:"#374151"},title:r?"Navigate to this kind in another ontology package":void 0,children:[e.jsx("span",{className:"w-2 h-2 rounded-full flex-shrink-0",style:{backgroundColor:d}}),s.replace(/([A-Z])/g," $1").trim(),r&&e.jsx("span",{style:{color:"#9CA3AF",fontSize:"9px"},children:"↗"})]})}function V({label:s,value:i}){return e.jsxs("div",{className:"rounded-lg p-2",style:{background:"#F9FAFB",border:"1px solid #F3F4F6"},children:[e.jsx("div",{className:"text-sm font-semibold",style:{color:"#1B3A4B"},children:i}),e.jsx("div",{className:"text-xs",style:{color:"#9CA3AF"},children:s})]})}const P={"part def":{label:"Part Definition",shorthand:"pd",description:"Defines a structural classifier (composite part)"},"connection def":{label:"Connection Definition",shorthand:"cd",description:"Defines a connector type between parts"},"attribute def":{label:"Attribute Definition",shorthand:"ad",description:"Defines a typed value property"},"item def":{label:"Item Definition",shorthand:"id",description:"Defines a flow item type"},"action def":{label:"Action Definition",shorthand:"acd",description:"Defines a behavioral action"},"state def":{label:"State Definition",shorthand:"sd",description:"Defines a state machine type"},"requirement def":{label:"Requirement Definition",shorthand:"rd",description:"Defines a requirement type"},"use case def":{label:"Use Case Definition",shorthand:"ucd",description:"Defines a use case type"},"occurrence def":{label:"Occurrence Definition",shorthand:"od",description:"Defines an occurrence (event or snapshot)"},"interface def":{label:"Interface Definition",shorthand:"ifd",description:"Defines a port interface type"},"port def":{label:"Port Definition",shorthand:"ptd",description:"Defines a port type for system interfaces"},"metadata def":{label:"Metadata Definition",shorthand:"md",description:"Defines a metadata annotation type"}},Q={purpose:"#cce5ff",business:"#cce5ff",operational:"#cce5ff",requirements:"#dae8fc",functional:"#d5e8d4",behavior:"#d5e8d4",logical:"#d5e8d4",physical:"#ffe6cc",software:"#d5e8d4",interfaces:"#d5e8d4",ui:"#d5e8d4",risk:"#f8cecc",safety:"#f8cecc",cybersecurity:"#f8cecc",verification:"#e1d5e7",analysis:"#e1d5e7","design-control":"#fff2cc",qms:"#fff2cc","software-lifecycle":"#fff2cc",operations:"#fff2cc",clinical:"#fff2cc",privacy:"#fff2cc"};function ee({layers:s}){const i=[],r=new Map;for(const l of s)for(const o of l.kinds){const c=o.construct||"part def";r.has(c)||r.set(c,[]),r.get(c).push({kindName:o.name,layer:l.id,layerLabel:l.label,layerColor:Q[l.id]??"#f3f4f6",derivesFrom:o.derivesFrom,description:o.description})}const f=Object.keys(P),d=[...r.keys()].sort((l,o)=>{const c=f.indexOf(l),m=f.indexOf(o);return c===-1&&m===-1?l.localeCompare(o):c===-1?1:m===-1?-1:c-m});for(const l of d){const o=r.get(l).sort((m,p)=>m.kindName.localeCompare(p.kindName)),c=P[l];i.push({construct:l,label:(c==null?void 0:c.label)??l,shorthand:(c==null?void 0:c.shorthand)??l,description:(c==null?void 0:c.description)??"",kinds:o})}return i.length===0?e.jsx("div",{className:"py-8 text-center text-sm",style:{color:"#9CA3AF"},children:"No kinds found in the selected viewpoint."}):e.jsxs("div",{style:{fontFamily:"inherit"},children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("h3",{className:"text-sm font-semibold mb-1",style:{color:"#1a1a1a"},children:"SysML v2 Construct Mapping"}),e.jsx("p",{className:"text-xs",style:{color:"#9CA3AF"},children:"Each SysML v2 construct keyword and the MEMO kinds that use it. Shorthand codes appear on kind cards throughout the viewer."})]}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"16px"},children:i.map(l=>e.jsx(se,{group:l},l.construct))})]})}function se({group:s}){return e.jsxs("div",{style:{border:"1px solid #E5E5E0",borderRadius:"10px",overflow:"hidden"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"8px 12px",background:"#F7F7F5",borderBottom:"1px solid #E5E5E0"},children:[e.jsx("code",{style:{fontSize:"11px",fontFamily:"monospace",background:"#1B3A4B",color:"#2DD4A8",padding:"2px 6px",borderRadius:"4px",letterSpacing:"0.02em"},children:s.construct}),e.jsx("span",{className:"text-sm font-semibold",style:{color:"#1a1a1a"},children:s.label}),e.jsx("span",{style:{fontSize:"10px",color:"#6B7280",fontFamily:"monospace",background:"#EBEBEB",padding:"1px 5px",borderRadius:"3px"},children:s.shorthand}),s.description&&e.jsxs("span",{className:"text-xs ml-1",style:{color:"#9CA3AF"},children:["— ",s.description]}),e.jsxs("span",{className:"ml-auto text-xs",style:{color:"#9CA3AF"},children:[s.kinds.length," kind",s.kinds.length!==1?"s":""]})]}),e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px",padding:"10px 12px"},children:s.kinds.map(i=>e.jsx(te,{kind:i},i.kindName))})]})}function te({kind:s}){return e.jsxs("div",{title:s.description??s.kindName,style:{display:"inline-flex",alignItems:"center",gap:"5px",padding:"3px 8px",background:s.layerColor,borderRadius:"5px",fontSize:"11px",fontWeight:500,color:"#1a1a1a",border:"1px solid rgba(0,0,0,0.06)",whiteSpace:"nowrap"},children:[e.jsx("span",{style:{fontWeight:600},children:s.kindName}),e.jsx("span",{style:{fontSize:"9px",color:"#6B7280",background:"rgba(255,255,255,0.55)",padding:"1px 4px",borderRadius:"3px"},children:s.layerLabel}),s.derivesFrom&&e.jsxs("span",{style:{fontSize:"9px",color:"#9CA3AF",fontStyle:"italic"},title:`Specializes ${s.derivesFrom}`,children:[":> ",s.derivesFrom]})]})}const ne=a.lazy(()=>O(()=>import("./LayerGrid-bhFpOIbe.js"),__vite__mapDeps([0,1,2,3,4])).then(s=>({default:s.LayerGrid}))),ie=a.lazy(()=>O(()=>import("./LayerTable-RuswZVUI.js"),__vite__mapDeps([5,1,2,3,4])).then(s=>({default:s.LayerTable}))),K=a.lazy(()=>O(()=>import("./RelationshipsSection-DggeGBKP.js"),__vite__mapDeps([6,1,2,7])).then(s=>({default:s.RelationshipsSection}))),le=a.lazy(()=>O(()=>import("./RelationshipOverlay-B3AN-bM-.js"),__vite__mapDeps([8,1,2,7])).then(s=>({default:s.RelationshipOverlay}))),L=[{id:"all",label:"All Layers",layerIds:null,description:"All architecture layers in swimlane view"},{id:"software",label:"Software Views",layerIds:["functional","behavior","logical","software","interfaces","ui"],description:"Software architecture: Logical/Service, Runtime, Module/Code, Deployment"},{id:"hardware",label:"Hardware Views",layerIds:["logical","physical","interfaces"],description:"Hardware architecture: Logical, Physical/Embodiment, Compute/Electronics, Cross-domain"},{id:"risk",label:"Risk Chain",layerIds:["requirements","risk","safety","cybersecurity","verification","analysis"],description:"Risk trace chain: Hazard → HazardousSituation → Harm → RiskControlMeasure → verification"},{id:"traceability",label:"Traceability",layerIds:["purpose","business","operational","requirements","risk","safety","functional","software","software-lifecycle","verification","analysis"],description:"Full trace: clinical, risk, software, and hardware chains"},{id:"sysml-mapping",label:"SysML Mapping",layerIds:null,type:"sysml-mapping",description:"SysML v2 construct → MEMO kind reference table"}],ae=.3,oe=2.5,R=.15;function re({children:s}){const[i,r]=a.useState(1),[f,d]=a.useState({x:0,y:0}),l=a.useRef(!1),o=a.useRef({x:0,y:0}),c=a.useRef(null),m=u=>Math.max(ae,Math.min(oe,u)),p=a.useCallback(u=>{u.preventDefault();const F=u.deltaY<0?R:-R;r(C=>m(C+F))},[]),v=a.useCallback(u=>{u.target.closest("button, input, a")||(l.current=!0,o.current={x:u.clientX,y:u.clientY},u.currentTarget.setAttribute("data-panning","true"))},[]),t=a.useCallback(u=>{if(!l.current)return;const F=u.clientX-o.current.x,C=u.clientY-o.current.y;o.current={x:u.clientX,y:u.clientY},d(k=>({x:k.x+F,y:k.y+C}))},[]),x=a.useCallback(u=>{l.current=!1,u.currentTarget.removeAttribute("data-panning")},[]),h=a.useCallback(u=>{l.current=!1,u.currentTarget.removeAttribute("data-panning")},[]);function N(){r(1),d({x:0,y:0})}return e.jsxs("div",{style:{position:"relative",width:"100%",height:"100%"},children:[e.jsxs("div",{style:{position:"absolute",top:"10px",right:"10px",zIndex:10,display:"flex",gap:"4px",background:"rgba(255,255,255,0.92)",border:"1px solid #E5E5E0",borderRadius:"8px",padding:"4px",boxShadow:"0 2px 8px rgba(0,0,0,0.08)"},children:[e.jsx(T,{title:"Zoom in",onClick:()=>r(u=>m(u+R)),children:"+"}),e.jsxs("span",{style:{fontSize:"10px",color:"#6B7280",lineHeight:"26px",minWidth:"34px",textAlign:"center"},children:[Math.round(i*100),"%"]}),e.jsx(T,{title:"Zoom out",onClick:()=>r(u=>m(u-R)),children:"−"}),e.jsx("div",{style:{width:"1px",background:"#E5E5E0",margin:"2px 0"}}),e.jsx(T,{title:"Fit to view",onClick:N,children:"⊡"})]}),e.jsx("div",{ref:c,onWheel:p,onMouseDown:v,onMouseMove:t,onMouseUp:x,onMouseLeave:h,style:{width:"100%",height:"100%",overflow:"hidden",cursor:l.current?"grabbing":"grab",userSelect:"none"},children:e.jsx("div",{style:{transform:`translate(${f.x}px, ${f.y}px) scale(${i})`,transformOrigin:"0 0",willChange:"transform",padding:"16px"},children:s})})]})}function T({onClick:s,title:i,children:r}){return e.jsx("button",{onClick:s,title:i,style:{width:"26px",height:"26px",border:"none",borderRadius:"5px",background:"transparent",cursor:"pointer",fontSize:"14px",color:"#374151",display:"flex",alignItems:"center",justifyContent:"center",lineHeight:1},onMouseEnter:f=>{f.currentTarget.style.background="#F0F0ED"},onMouseLeave:f=>{f.currentTarget.style.background="transparent"},children:r})}function ce({ontology:s,onBack:i}){const r=y(n=>n.ontologyViewMode),f=y(n=>n.setOntologyViewMode),d=y(n=>n.selectedOntologyKind),l=y(n=>n.setSelectedOntologyKind),o=y(n=>n.showOntologyRelationships),c=y(n=>n.toggleOntologyRelationships),m=y(n=>n.model),p=y(n=>n.activeView),v=y(n=>n.setActiveView),t=y(n=>n.availableOntologies),x=a.useRef(null),[h,N]=a.useState(new Set),[u,F]=a.useState("all"),[C,k]=a.useState(!1),[H,W]=a.useState(null),[Z,Y]=a.useState(0);a.useEffect(()=>{d&&(k(!0),W(d),Y(n=>n+1))},[d]);const g=a.useMemo(()=>({...s,layers:s.layers.map(n=>({...n,kinds:n.kinds.map(b=>{var M;return{...b,instanceCount:m?Object.values(m.elements).filter(A=>A.kind===b.name).length:0,viewpoints:((M=m==null?void 0:m.viewpoints)==null?void 0:M.filter(A=>A.visibleKinds.includes(b.name)).map(A=>A.id))??[]}})}))}),[s,m]),E=L.find(n=>n.id===u)??L[0],j=a.useMemo(()=>{if(!E.layerIds)return g.layers;const n=new Set(E.layerIds);return g.layers.filter(b=>n.has(b.id))},[g.layers,E.layerIds]),w=a.useMemo(()=>{if(!d)return null;for(const n of g.layers){const b=n.kinds.find(M=>M.name===d);if(b)return{kind:b,layerInfo:n}}return null},[d,g]);function q(n,b){l(b),v({type:"ontology-detail",packageName:n})}function U(n){v({type:"ontology-detail",packageName:s.name,layerId:n})}const B={background:"#1B3A4B",color:"#2DD4A8",border:"1px solid transparent"},D={background:"#F0F0ED",color:"#6B7280",border:"1px solid transparent"};return e.jsxs("div",{className:"flex flex-1 overflow-hidden",style:{background:"#F7F7F5"},children:[e.jsxs("div",{className:"flex-1 overflow-y-auto",children:[e.jsxs("div",{className:"px-6 pt-5 pb-3",style:{borderBottom:"1px solid #E5E5E0"},children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-3 text-xs flex-wrap",style:{color:"#9CA3AF"},children:[i&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:i,className:"hover:underline",style:{color:"#2563EB"},children:"Ontology Library"}),e.jsx("span",{children:"/"})]}),e.jsx("button",{onClick:()=>l(null),className:"hover:underline",style:{color:w?"#2563EB":"#374151",fontWeight:w?400:500},children:s.name}),w&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"/"}),e.jsx("button",{onClick:()=>U(w.layerInfo.id),className:"hover:underline",style:{color:"#2563EB"},children:w.layerInfo.label}),e.jsx("span",{children:"/"}),e.jsx("span",{style:{color:"#1a1a1a",fontWeight:600},children:d})]})]}),e.jsx(G,{ontology:g}),e.jsxs("div",{className:"flex items-center gap-2 mt-3",children:[e.jsx("span",{className:"text-xs",style:{color:"#9CA3AF"},children:"Layers:"}),e.jsx("button",{onClick:()=>f("visual"),className:"px-2.5 py-1 text-xs rounded-md font-medium",style:r==="visual"?B:D,children:"Visual"}),e.jsx("button",{onClick:()=>f("table"),className:"px-2.5 py-1 text-xs rounded-md font-medium",style:r==="table"?B:D,children:"Table"}),e.jsx("span",{style:{width:"1px",height:"16px",background:"#E5E5E0",margin:"0 4px"}}),e.jsxs("button",{onClick:c,className:"px-2.5 py-1 text-xs rounded-md font-medium",style:o?B:D,children:[o?"Hide":"Show"," Relationships"]})]}),e.jsxs("div",{className:"flex items-center gap-0 mt-3 -mx-6 px-6",style:{borderTop:"1px solid #E5E5E0",paddingTop:"10px"},children:[e.jsx("span",{className:"text-xs mr-2",style:{color:"#9CA3AF",whiteSpace:"nowrap"},children:"View:"}),e.jsx("div",{className:"flex items-center gap-1 flex-wrap",children:L.map(n=>{const b=u===n.id;return e.jsx("button",{onClick:()=>F(n.id),title:n.description,className:"px-2.5 py-1 text-xs rounded-md font-medium transition-all",style:b?B:D,children:n.label},n.id)})}),j.length!==g.layers.length&&E.type!=="sysml-mapping"&&e.jsxs("span",{className:"ml-auto text-xs",style:{color:"#9CA3AF",whiteSpace:"nowrap"},children:[j.length," of ",g.layers.length," layers"]})]})]}),E.type==="sysml-mapping"?e.jsx("div",{className:"px-6 py-4",children:e.jsx(ee,{layers:g.layers})}):r==="visual"?e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{height:"280px",position:"relative",borderBottom:"1px solid #E5E5E0"},children:e.jsx(re,{children:e.jsxs("div",{ref:x,style:{position:"relative"},children:[e.jsx(a.Suspense,{fallback:e.jsx(z,{layers:j}),children:e.jsx(ne,{layers:j,selectedKind:d,onKindClick:l,activeLayerId:p.layerId??null,flashKindName:H,flashTick:Z})}),o&&e.jsx(a.Suspense,{fallback:null,children:e.jsx(le,{containerRef:x,ontology:{...g,layers:j},activeTypes:h})})]})})}),o&&e.jsx("div",{className:"px-6 py-4",children:e.jsx(a.Suspense,{fallback:null,children:e.jsx(K,{ontology:{...g,layers:j},activeTypes:h,onActiveTypesChange:N})})})]}):e.jsxs("div",{className:"px-6 py-4",children:[e.jsx(a.Suspense,{fallback:e.jsx(z,{layers:j}),children:e.jsx(ie,{layers:j,selectedKind:d,onKindClick:l})}),o&&e.jsx(a.Suspense,{fallback:null,children:e.jsx(K,{ontology:{...g,layers:j},activeTypes:h,onActiveTypesChange:N})})]})]}),C&&w&&e.jsx(J,{kind:w.kind,layers:g.layers,allOntologies:t,onKindClick:l,onNavigate:q,onClose:()=>{l(null),k(!1)}})]})}function z({layers:s}){return e.jsx("div",{className:"grid gap-3 mb-6",style:{gridTemplateColumns:"repeat(auto-fill, minmax(220px, 1fr))"},children:s.map(i=>{const r=_[i.id]??i.color??"#6B7280";return e.jsxs("div",{className:"rounded-xl p-4",style:{background:"#FFFFFF",border:`2px solid ${r}30`},children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("span",{className:"w-3 h-3 rounded",style:{backgroundColor:r}}),e.jsx("span",{className:"text-sm font-medium",style:{color:"#1a1a1a"},children:i.label})]}),e.jsxs("div",{className:"text-xs",style:{color:"#9CA3AF"},children:[i.kindCount," kinds"]})]},i.id)})})}const de=a.lazy(()=>O(()=>import("./OntologyDecompositionDiagram-aONGngg4.js"),__vite__mapDeps([9,1,2,10,11,3,4,12]))),$=Object.fromEntries(X.map((s,i)=>[s,i]));function me(){const s=y(p=>p.activeView),i=y(p=>p.availableOntologies),r=y(p=>p.setActiveView),f=y(p=>p.model),d=s.type==="ontology-detail",l=d?s.packageName:null,o=l?i.find(p=>p.name===l):null,c=a.useMemo(()=>{if(o||!d||!f)return null;const p=new Map;for(const t of Object.values(f.elements))p.has(t.layer)||p.set(t.layer,[]),p.get(t.layer).includes(t.kind)||p.get(t.layer).push(t.kind);const v=[...p.entries()].sort(([t],[x])=>($[t]??99)-($[x]??99)).map(([t,x])=>({id:t,label:t.charAt(0).toUpperCase()+t.slice(1),color:"#6B7280",kindCount:x.length,kinds:x.map(h=>({name:h,label:h.replace(/([A-Z])/g," $1").trim(),construct:"part def",layer:t,instanceCount:0,viewpoints:[]}))}));return{name:"@memo/model (inferred)",version:"–",type:"ontology",description:"Ontology inferred from loaded model elements.",layers:v,kindCount:v.reduce((t,x)=>t+x.kindCount,0),relationshipCount:0,relationshipTypes:[],selected:!0}},[o,d,f]),m=o??c;return d&&m?e.jsx(ce,{ontology:m,onBack:()=>r({type:"ontology"})}):e.jsx(a.Suspense,{fallback:e.jsx("div",{className:"flex-1 flex items-center justify-center",style:{background:"#F7F7F5"},children:e.jsx("span",{className:"text-sm",style:{color:"#9CA3AF"},children:"Loading ontology library..."})}),children:e.jsx(de,{})})}export{me as OntologyViewer,me as default};
@@ -1,4 +1,4 @@
1
- import{j as d}from"./reactflow-CsCqNKB-.js";import{a as k}from"./zustand-CrhqMOHB.js";import{g as W}from"./sysml-edge-styles-ByJeCWqa.js";const x="memo-sysml-edge-defs";function $(){if(document.getElementById(x))return;const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.id=x,e.setAttribute("style","position:absolute;width:0;height:0;overflow:hidden"),e.setAttribute("aria-hidden","true"),e.innerHTML=`
1
+ import{j as d}from"./reactflow-C9OlmOYw.js";import{a as k}from"./zustand-CrhqMOHB.js";import{g as W}from"./sysml-edge-styles-ByJeCWqa.js";const x="memo-sysml-edge-defs";function $(){if(document.getElementById(x))return;const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.id=x,e.setAttribute("style","position:absolute;width:0;height:0;overflow:hidden"),e.setAttribute("aria-hidden","true"),e.innerHTML=`
2
2
  <defs>
3
3
  <!-- Open arrowhead -->
4
4
  <marker id="sysml-arrow" viewBox="0 0 10 10" refX="9" refY="5"
@@ -1 +1 @@
1
- import{j as e}from"./reactflow-CsCqNKB-.js";import{a as g}from"./zustand-CrhqMOHB.js";import{D as h,g as y}from"./sysml-edge-styles-ByJeCWqa.js";function m({style:o}){const r=o.color,i=o.lineStyle==="dashed"?"4,3":void 0,x=o.sourceMarker==="diamond-open"?e.jsx("polygon",{points:"0,7 5,3 10,7 5,11",fill:"white",stroke:r,strokeWidth:1.2}):o.sourceMarker==="diamond-filled"?e.jsx("polygon",{points:"0,7 5,3 10,7 5,11",fill:r,stroke:r,strokeWidth:1}):null,d=o.sourceMarker!=="none"?10:2,c=o.targetMarker!=="none"?27:34,t=o.targetMarker==="arrow"?e.jsx("polyline",{points:`${c},3 34,7 ${c},11`,fill:"none",stroke:r,strokeWidth:1.2}):o.targetMarker==="filled-arrow"?e.jsx("polygon",{points:`${c},3 34,7 ${c},11`,fill:r,stroke:"none"}):o.targetMarker==="triangle-open"?e.jsx("polygon",{points:`${c},2 34,7 ${c},12`,fill:"white",stroke:r,strokeWidth:1.2}):o.targetMarker==="circle"?e.jsx("circle",{cx:31,cy:7,r:3.5,fill:"white",stroke:r,strokeWidth:1.2}):null;return e.jsxs("svg",{width:36,height:14,style:{display:"inline-block",flexShrink:0,verticalAlign:"middle"},"aria-hidden":"true",children:[x,e.jsx("line",{x1:d,y1:7,x2:c,y2:7,stroke:r,strokeWidth:1.5,strokeDasharray:i}),t]})}function u({name:o,active:n,onClick:p}){const s=y(o),r=s.color;return e.jsxs("button",{onClick:p,title:s.stereotype?`«${s.stereotype}»`:o,style:{display:"inline-flex",alignItems:"center",gap:"5px",padding:"3px 7px 3px 5px",borderRadius:"6px",border:`1px solid ${n?r:`${r}30`}`,background:n?`${r}18`:"transparent",cursor:"pointer",fontSize:"10px",color:n?r:"#6B7280",fontWeight:n?600:400,transition:"all 0.15s ease",whiteSpace:"nowrap"},onMouseEnter:i=>{n||(i.currentTarget.style.background=`${r}08`)},onMouseLeave:i=>{n||(i.currentTarget.style.background="transparent")},children:[e.jsx(m,{style:s}),e.jsx("span",{children:o}),s.stereotype&&e.jsxs("span",{style:{fontSize:"9px",opacity:.7},children:["«",s.stereotype,"»"]})]})}function k({group:o,presentTypes:n,activeTypes:p,onToggleType:s,onToggleGroup:r}){const[i,x]=g.useState(!1);if(n.length===0)return null;const d=n.every(t=>p.has(t)),c=n.some(t=>p.has(t));return e.jsxs("div",{style:{marginBottom:"8px"},children:[e.jsxs("div",{className:"flex items-center gap-2 cursor-pointer select-none",style:{padding:"4px 8px",borderRadius:"6px",background:o.color.bg,marginBottom:i?0:"5px"},onClick:()=>x(t=>!t),children:[e.jsx("svg",{width:"8",height:"8",viewBox:"0 0 16 16",fill:"none",style:{transition:"transform 150ms",transform:i?"rotate(-90deg)":"rotate(0deg)",flexShrink:0},children:e.jsx("path",{d:"M4 6L8 10L12 6",stroke:o.color.text,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),e.jsx("span",{style:{fontSize:"10px",fontWeight:700,color:o.color.text,textTransform:"uppercase",letterSpacing:"0.06em",flex:1},children:o.label}),e.jsxs("span",{style:{fontSize:"9px",color:o.color.text,opacity:.7},children:[n.length," types"]}),e.jsx("button",{onClick:t=>{t.stopPropagation(),r(n)},style:{fontSize:"9px",color:o.color.text,opacity:d?1:c?.7:.5,fontWeight:d?700:400,border:"none",background:"transparent",cursor:"pointer",padding:"0 2px"},title:d?"Deselect all":"Select all in group",children:d?"✓ all":"all"})]}),!i&&e.jsx("div",{className:"flex flex-wrap gap-1.5",style:{paddingLeft:"8px"},children:n.map(t=>e.jsx(u,{name:t,active:p.has(t),onClick:()=>s(t)},t))})]})}function w({ontology:o,activeTypes:n,onActiveTypesChange:p}){const s=g.useMemo(()=>{const t=new Set;for(const a of o.relationshipTypes??[])t.add(a.name);return t},[o.relationshipTypes]);if(s.size===0)return null;const r=s.size,i=n.size;function x(t){const a=new Set(n);a.has(t)?a.delete(t):a.add(t),p(a)}function d(t){const a=t.every(f=>n.has(f)),l=new Set(n);if(a)for(const f of t)l.delete(f);else for(const f of t)l.add(f);p(l)}function c(){p(new Set)}return e.jsxs("div",{className:"mt-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx("span",{style:{fontSize:"12px",fontWeight:600,color:"#374151",letterSpacing:"0.04em",textTransform:"uppercase"},children:"Relationships"}),e.jsxs("span",{style:{fontSize:"11px",color:"#9CA3AF"},children:[r," types"]}),i>0&&e.jsxs(e.Fragment,{children:[e.jsxs("span",{style:{fontSize:"10px",fontWeight:600,color:"#2563EB",background:"#EFF6FF",border:"1px solid #BFDBFE",borderRadius:"8px",padding:"1px 7px"},children:[i," active"]}),e.jsx("button",{onClick:c,style:{fontSize:"10px",color:"#6B7280",border:"none",background:"transparent",cursor:"pointer",padding:"0 2px"},children:"Clear"})]}),i===0&&e.jsx("span",{style:{fontSize:"10px",color:"#9CA3AF",fontStyle:"italic"},children:"click a type or group to filter edges"})]}),h.map(t=>{const a=t.types.filter(l=>s.has(l));return e.jsx(k,{group:t,presentTypes:a,activeTypes:n,onToggleType:x,onToggleGroup:d},t.id)}),(()=>{const t=new Set(h.flatMap(l=>l.types)),a=[...s].filter(l=>!t.has(l));return a.length===0?null:e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:"10px",fontWeight:700,color:"#6B7280",textTransform:"uppercase",letterSpacing:"0.06em",marginBottom:"5px"},children:"Other"}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:a.map(l=>e.jsx(u,{name:l,active:n.has(l),onClick:()=>x(l)},l))})]})})()]})}export{w as RelationshipsSection};
1
+ import{j as e}from"./reactflow-C9OlmOYw.js";import{a as g}from"./zustand-CrhqMOHB.js";import{D as h,g as y}from"./sysml-edge-styles-ByJeCWqa.js";function m({style:o}){const r=o.color,i=o.lineStyle==="dashed"?"4,3":void 0,x=o.sourceMarker==="diamond-open"?e.jsx("polygon",{points:"0,7 5,3 10,7 5,11",fill:"white",stroke:r,strokeWidth:1.2}):o.sourceMarker==="diamond-filled"?e.jsx("polygon",{points:"0,7 5,3 10,7 5,11",fill:r,stroke:r,strokeWidth:1}):null,d=o.sourceMarker!=="none"?10:2,c=o.targetMarker!=="none"?27:34,t=o.targetMarker==="arrow"?e.jsx("polyline",{points:`${c},3 34,7 ${c},11`,fill:"none",stroke:r,strokeWidth:1.2}):o.targetMarker==="filled-arrow"?e.jsx("polygon",{points:`${c},3 34,7 ${c},11`,fill:r,stroke:"none"}):o.targetMarker==="triangle-open"?e.jsx("polygon",{points:`${c},2 34,7 ${c},12`,fill:"white",stroke:r,strokeWidth:1.2}):o.targetMarker==="circle"?e.jsx("circle",{cx:31,cy:7,r:3.5,fill:"white",stroke:r,strokeWidth:1.2}):null;return e.jsxs("svg",{width:36,height:14,style:{display:"inline-block",flexShrink:0,verticalAlign:"middle"},"aria-hidden":"true",children:[x,e.jsx("line",{x1:d,y1:7,x2:c,y2:7,stroke:r,strokeWidth:1.5,strokeDasharray:i}),t]})}function u({name:o,active:n,onClick:p}){const s=y(o),r=s.color;return e.jsxs("button",{onClick:p,title:s.stereotype?`«${s.stereotype}»`:o,style:{display:"inline-flex",alignItems:"center",gap:"5px",padding:"3px 7px 3px 5px",borderRadius:"6px",border:`1px solid ${n?r:`${r}30`}`,background:n?`${r}18`:"transparent",cursor:"pointer",fontSize:"10px",color:n?r:"#6B7280",fontWeight:n?600:400,transition:"all 0.15s ease",whiteSpace:"nowrap"},onMouseEnter:i=>{n||(i.currentTarget.style.background=`${r}08`)},onMouseLeave:i=>{n||(i.currentTarget.style.background="transparent")},children:[e.jsx(m,{style:s}),e.jsx("span",{children:o}),s.stereotype&&e.jsxs("span",{style:{fontSize:"9px",opacity:.7},children:["«",s.stereotype,"»"]})]})}function k({group:o,presentTypes:n,activeTypes:p,onToggleType:s,onToggleGroup:r}){const[i,x]=g.useState(!1);if(n.length===0)return null;const d=n.every(t=>p.has(t)),c=n.some(t=>p.has(t));return e.jsxs("div",{style:{marginBottom:"8px"},children:[e.jsxs("div",{className:"flex items-center gap-2 cursor-pointer select-none",style:{padding:"4px 8px",borderRadius:"6px",background:o.color.bg,marginBottom:i?0:"5px"},onClick:()=>x(t=>!t),children:[e.jsx("svg",{width:"8",height:"8",viewBox:"0 0 16 16",fill:"none",style:{transition:"transform 150ms",transform:i?"rotate(-90deg)":"rotate(0deg)",flexShrink:0},children:e.jsx("path",{d:"M4 6L8 10L12 6",stroke:o.color.text,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),e.jsx("span",{style:{fontSize:"10px",fontWeight:700,color:o.color.text,textTransform:"uppercase",letterSpacing:"0.06em",flex:1},children:o.label}),e.jsxs("span",{style:{fontSize:"9px",color:o.color.text,opacity:.7},children:[n.length," types"]}),e.jsx("button",{onClick:t=>{t.stopPropagation(),r(n)},style:{fontSize:"9px",color:o.color.text,opacity:d?1:c?.7:.5,fontWeight:d?700:400,border:"none",background:"transparent",cursor:"pointer",padding:"0 2px"},title:d?"Deselect all":"Select all in group",children:d?"✓ all":"all"})]}),!i&&e.jsx("div",{className:"flex flex-wrap gap-1.5",style:{paddingLeft:"8px"},children:n.map(t=>e.jsx(u,{name:t,active:p.has(t),onClick:()=>s(t)},t))})]})}function w({ontology:o,activeTypes:n,onActiveTypesChange:p}){const s=g.useMemo(()=>{const t=new Set;for(const a of o.relationshipTypes??[])t.add(a.name);return t},[o.relationshipTypes]);if(s.size===0)return null;const r=s.size,i=n.size;function x(t){const a=new Set(n);a.has(t)?a.delete(t):a.add(t),p(a)}function d(t){const a=t.every(f=>n.has(f)),l=new Set(n);if(a)for(const f of t)l.delete(f);else for(const f of t)l.add(f);p(l)}function c(){p(new Set)}return e.jsxs("div",{className:"mt-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx("span",{style:{fontSize:"12px",fontWeight:600,color:"#374151",letterSpacing:"0.04em",textTransform:"uppercase"},children:"Relationships"}),e.jsxs("span",{style:{fontSize:"11px",color:"#9CA3AF"},children:[r," types"]}),i>0&&e.jsxs(e.Fragment,{children:[e.jsxs("span",{style:{fontSize:"10px",fontWeight:600,color:"#2563EB",background:"#EFF6FF",border:"1px solid #BFDBFE",borderRadius:"8px",padding:"1px 7px"},children:[i," active"]}),e.jsx("button",{onClick:c,style:{fontSize:"10px",color:"#6B7280",border:"none",background:"transparent",cursor:"pointer",padding:"0 2px"},children:"Clear"})]}),i===0&&e.jsx("span",{style:{fontSize:"10px",color:"#9CA3AF",fontStyle:"italic"},children:"click a type or group to filter edges"})]}),h.map(t=>{const a=t.types.filter(l=>s.has(l));return e.jsx(k,{group:t,presentTypes:a,activeTypes:n,onToggleType:x,onToggleGroup:d},t.id)}),(()=>{const t=new Set(h.flatMap(l=>l.types)),a=[...s].filter(l=>!t.has(l));return a.length===0?null:e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:"10px",fontWeight:700,color:"#6B7280",textTransform:"uppercase",letterSpacing:"0.06em",marginBottom:"5px"},children:"Other"}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:a.map(l=>e.jsx(u,{name:l,active:n.has(l),onClick:()=>x(l)},l))})]})})()]})}export{w as RelationshipsSection};
@@ -1 +1 @@
1
- import{j as e}from"./reactflow-CsCqNKB-.js";import{a as j}from"./zustand-CrhqMOHB.js";import{u as g,f as F}from"./index-CVW92JY7.js";function z({model:n}){const i=g(t=>t.setActiveView),s=g(t=>t.setExplorerTab),l=j.useMemo(()=>Object.values(n.elements).filter(t=>["system","subsystem","logicalcomponent","softwarecomponent","physicalcomponent"].includes(t.kind.toLowerCase())).slice(0,8),[n]),a=j.useMemo(()=>{const t={};for(const o of Object.values(n.elements))t[o.layer]=(t[o.layer]||0)+1;return t},[n]),x=Object.entries(a).sort((t,o)=>o[1]-t[1]).slice(0,5),p=Object.keys(n.elements).length;return e.jsxs("div",{style:w,children:[e.jsx(k,{icon:"🏗️",title:"System Architecture",badge:`${p} elements`,onExpand:()=>{s("model")}}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"12px"},children:[e.jsxs("div",{children:[e.jsx("div",{style:E,children:"Layer distribution"}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"6px"},children:x.map(([t,o])=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx("div",{style:{width:"8px",height:"8px",borderRadius:"50%",background:F[t]||"#95A5A6",flexShrink:0}}),e.jsx("span",{style:{fontSize:"12px",color:"#374151",flex:1,textTransform:"capitalize"},children:t}),e.jsx("span",{style:{fontSize:"12px",fontWeight:600,color:"#6B7280"},children:o}),e.jsx("div",{style:{width:"60px",height:"4px",background:"#F3F4F6",borderRadius:"2px"},children:e.jsx("div",{style:{height:"100%",borderRadius:"2px",background:F[t]||"#95A5A6",width:`${Math.round(o/p*100)}%`}})})]},t))})]}),e.jsxs("div",{children:[e.jsx("div",{style:E,children:"Key components"}),l.length>0?e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:l.map(t=>e.jsxs("button",{onClick:()=>i({type:"element-detail",elementId:t.id}),style:{textAlign:"left",background:"none",border:"none",cursor:"pointer",padding:"3px 0",display:"flex",alignItems:"center",gap:"6px"},children:[e.jsx("span",{style:{fontSize:"10px",color:"#9CA3AF",fontFamily:"monospace"},children:t.kind}),e.jsx("span",{style:{fontSize:"12px",color:"#374151",fontWeight:500},children:t.name})]},t.id))}):e.jsx(C,{text:"No System or Subsystem elements yet"})]})]}),n.diagrams&&n.diagrams.length>0&&e.jsxs("div",{style:{marginTop:"12px",display:"flex",gap:"8px",flexWrap:"wrap"},children:[n.diagrams.slice(0,4).map(t=>e.jsxs("button",{onClick:()=>i({type:"diagram",diagramId:t.id}),style:q,onMouseEnter:o=>o.currentTarget.style.background="#E5E5E0",onMouseLeave:o=>o.currentTarget.style.background="#F3F4F6",children:["⊟ ",t.name]},t.id)),n.diagrams.length>4&&e.jsxs("span",{style:{fontSize:"11px",color:"#9CA3AF",alignSelf:"center"},children:["+",n.diagrams.length-4," more"]})]})]})}function R({model:n}){const i=g(t=>t.setActiveView),{reqs:s,withTestLink:l,withArchLink:a}=j.useMemo(()=>{const t=Object.values(n.elements),o=t.filter(d=>["systemrequirement","requirement","userneed"].includes(d.kind.toLowerCase())),f=new Set;for(const d of n.relationships)f.add(d.sourceId),f.add(d.targetId);const u=new Set(["test","verification","validationtest"]),y=new Set(["system","subsystem","logicalcomponent","softwarecomponent"]),c=new Set(t.filter(d=>u.has(d.kind.toLowerCase())).map(d=>d.id)),b=new Set(t.filter(d=>y.has(d.kind.toLowerCase())).map(d=>d.id));let r=0,S=0;for(const d of o){const A=n.relationships.filter(h=>h.sourceId===d.id||h.targetId===d.id).flatMap(h=>[h.sourceId,h.targetId]);A.some(h=>c.has(h))&&r++,A.some(h=>b.has(h))&&S++}return{reqs:o,withTestLink:r,withArchLink:S}},[n]),x=s.length>0?Math.round(l/s.length*100):0,p=s.length>0?Math.round(a/s.length*100):0;return e.jsxs("div",{style:w,children:[e.jsx(k,{icon:"📋",title:"Requirements",badge:`${s.length} total`,onExpand:()=>i({type:"traceability"})}),s.length===0?e.jsx(C,{text:"No requirements found. Add Requirement elements to your model."}):e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"10px"},children:[e.jsx(v,{label:"Verified by tests",percent:x,count:l,total:s.length,color:"#2DD4A8"}),e.jsx(v,{label:"Linked to architecture",percent:p,count:a,total:s.length,color:"#4A90D9"})]})]})}function I({model:n}){const i=g(t=>t.setActiveView),{hazards:s,riskControls:l,mitigatesCount:a,residualRiskCount:x}=j.useMemo(()=>{const t=Object.values(n.elements),o=t.filter(r=>r.kind.toLowerCase()==="hazard"),f=t.filter(r=>r.kind.toLowerCase()==="riskcontrol"),u=n.relationships.filter(r=>r.type.toLowerCase()==="mitigates"),y=u.length,c=new Set(u.map(r=>r.targetId)),b=o.filter(r=>!c.has(r.id)).length;return{hazards:o,riskControls:f,mitigatesCount:y,residualRiskCount:b}},[n]),p=s.length>0?Math.round((s.length-x)/s.length*100):0;return e.jsxs("div",{style:w,children:[e.jsx(k,{icon:"⚠️",title:"Risk Chain (ISO 14971)",badge:`${s.length} hazards`,onExpand:()=>i({type:"traceability"}),badgeColor:x>0?"#E74C3C":"#2ECC71"}),s.length===0?e.jsx(C,{text:"No hazards found. Add Hazard elements to start your ISO 14971 risk analysis."}):e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"10px"},children:[e.jsx(v,{label:"Hazards mitigated",percent:p,count:s.length-x,total:s.length,color:"#2ECC71",warningThreshold:80}),e.jsxs("div",{style:{display:"flex",gap:"16px"},children:[e.jsx(m,{label:"Risk controls",value:l.length}),e.jsx(m,{label:"Mitigates links",value:a}),x>0&&e.jsx(m,{label:"Unmitigated hazards",value:x,alert:!0})]})]})]})}function L({model:n}){const i=g(p=>p.setActiveView),{tests:s,passing:l,withReqLink:a}=j.useMemo(()=>{const p=Object.values(n.elements),t=p.filter(c=>c.kind.toLowerCase()==="test"),o=p.filter(c=>["systemrequirement","requirement"].includes(c.kind.toLowerCase())),f=new Set(o.map(c=>c.id));let u=0;for(const c of t)n.relationships.filter(r=>r.sourceId===c.id||r.targetId===c.id).flatMap(r=>[r.sourceId,r.targetId]).some(r=>f.has(r))&&u++;const y=t.filter(c=>(c.attributes.status||"").toLowerCase()==="pass").length;return{tests:t,passing:y,withReqLink:u}},[n]),x=s.length>0?Math.round(a/s.length*100):0;return e.jsxs("div",{style:w,children:[e.jsx(k,{icon:"🧪",title:"Verification",badge:`${s.length} tests`,onExpand:()=>i({type:"traceability"})}),s.length===0?e.jsx(C,{text:"No tests found. Add Test elements and link them to requirements."}):e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"10px"},children:[e.jsx(v,{label:"Tests linked to requirements",percent:x,count:a,total:s.length,color:"#2DD4A8"}),e.jsxs("div",{style:{display:"flex",gap:"16px"},children:[e.jsx(m,{label:"Tests",value:s.length}),l>0&&e.jsx(m,{label:"Passing",value:l}),s.length-l>0&&e.jsx(m,{label:"Unverified",value:s.length-l,alert:s.length-l>0&&l>0})]})]})]})}function k({icon:n,title:i,badge:s,onExpand:l,badgeColor:a}){return e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"14px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx("span",{style:{fontSize:"16px"},children:n}),e.jsx("span",{style:{fontSize:"14px",fontWeight:700,color:"#1B3A4B"},children:i}),e.jsx("span",{style:{fontSize:"11px",fontWeight:600,padding:"2px 8px",borderRadius:"999px",background:a?a+"20":"#F3F4F6",color:a||"#6B7280"},children:s})]}),e.jsx("button",{onClick:l,style:{fontSize:"11px",color:"#4A90D9",background:"none",border:"none",cursor:"pointer",fontWeight:600},children:"Expand →"})]})}function v({label:n,percent:i,count:s,total:l,color:a,warningThreshold:x=100}){const p=i>=x?a:i>=50?"#F39C12":"#E74C3C";return e.jsxs("div",{children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"4px"},children:[e.jsx("span",{style:{fontSize:"12px",color:"#374151"},children:n}),e.jsxs("span",{style:{fontSize:"12px",fontWeight:600,color:i>=80?"#2ECC71":"#374151"},children:[s,"/",l," (",i,"%)"]})]}),e.jsx("div",{style:{height:"6px",background:"#F3F4F6",borderRadius:"3px"},children:e.jsx("div",{style:{height:"100%",borderRadius:"3px",background:p,width:`${i}%`,transition:"width 0.4s ease"}})})]})}function m({label:n,value:i,alert:s}){return e.jsxs("div",{style:{display:"flex",gap:"4px",alignItems:"baseline"},children:[e.jsx("span",{style:{fontSize:"16px",fontWeight:700,color:s?"#E74C3C":"#1B3A4B"},children:i}),e.jsx("span",{style:{fontSize:"11px",color:"#9CA3AF"},children:n})]})}function C({text:n}){return e.jsx("div",{style:{fontSize:"12px",color:"#9CA3AF",fontStyle:"italic",padding:"8px 0"},children:n})}const w={background:"#FFFFFF",border:"1px solid #E5E5E0",borderRadius:"12px",padding:"20px"},E={fontSize:"11px",fontWeight:700,textTransform:"uppercase",letterSpacing:"0.06em",color:"#9CA3AF",marginBottom:"8px"},q={fontSize:"11px",color:"#374151",background:"#F3F4F6",border:"1px solid #E5E5E0",borderRadius:"6px",padding:"4px 10px",cursor:"pointer",transition:"background 0.1s",fontWeight:500};function D(){const n=g(s=>s.model),i=g(s=>s.setActiveView);return n?e.jsx("div",{style:{flex:1,overflowY:"auto",background:"#F7F7F5",padding:"28px 40px"},children:e.jsxs("div",{style:{maxWidth:"960px",margin:"0 auto"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",marginBottom:"24px"},children:[e.jsxs("div",{children:[e.jsx("h1",{style:{fontSize:"20px",fontWeight:800,color:"#1B3A4B",margin:"0 0 4px 0"},children:"Design Review Dashboard"}),e.jsx("p",{style:{fontSize:"12px",color:"#6B7280",margin:0},children:"Architecture · Requirements · Risk · Verification — in one view"})]}),e.jsx("button",{onClick:()=>i({type:"dashboard"}),style:{fontSize:"12px",color:"#6B7280",background:"#F3F4F6",border:"1px solid #E5E5E0",borderRadius:"6px",padding:"6px 12px",cursor:"pointer",fontWeight:500},children:"← Back to Dashboard"})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"16px"},children:[e.jsx(z,{model:n}),e.jsx(R,{model:n}),e.jsx(I,{model:n}),e.jsx(L,{model:n})]})]})}):e.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",background:"#F7F7F5"},children:e.jsx("div",{style:{fontSize:"13px",color:"#9CA3AF"},children:"No model data"})})}export{D as ReviewDashboard};
1
+ import{j as e}from"./reactflow-C9OlmOYw.js";import{a as j}from"./zustand-CrhqMOHB.js";import{u as g,h as F}from"./index-CG-gfw-s.js";function z({model:n}){const i=g(t=>t.setActiveView),s=g(t=>t.setExplorerTab),l=j.useMemo(()=>Object.values(n.elements).filter(t=>["system","subsystem","logicalcomponent","softwarecomponent","physicalcomponent"].includes(t.kind.toLowerCase())).slice(0,8),[n]),a=j.useMemo(()=>{const t={};for(const o of Object.values(n.elements))t[o.layer]=(t[o.layer]||0)+1;return t},[n]),x=Object.entries(a).sort((t,o)=>o[1]-t[1]).slice(0,5),p=Object.keys(n.elements).length;return e.jsxs("div",{style:w,children:[e.jsx(k,{icon:"🏗️",title:"System Architecture",badge:`${p} elements`,onExpand:()=>{s("model")}}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"12px"},children:[e.jsxs("div",{children:[e.jsx("div",{style:E,children:"Layer distribution"}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"6px"},children:x.map(([t,o])=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx("div",{style:{width:"8px",height:"8px",borderRadius:"50%",background:F[t]||"#95A5A6",flexShrink:0}}),e.jsx("span",{style:{fontSize:"12px",color:"#374151",flex:1,textTransform:"capitalize"},children:t}),e.jsx("span",{style:{fontSize:"12px",fontWeight:600,color:"#6B7280"},children:o}),e.jsx("div",{style:{width:"60px",height:"4px",background:"#F3F4F6",borderRadius:"2px"},children:e.jsx("div",{style:{height:"100%",borderRadius:"2px",background:F[t]||"#95A5A6",width:`${Math.round(o/p*100)}%`}})})]},t))})]}),e.jsxs("div",{children:[e.jsx("div",{style:E,children:"Key components"}),l.length>0?e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:l.map(t=>e.jsxs("button",{onClick:()=>i({type:"element-detail",elementId:t.id}),style:{textAlign:"left",background:"none",border:"none",cursor:"pointer",padding:"3px 0",display:"flex",alignItems:"center",gap:"6px"},children:[e.jsx("span",{style:{fontSize:"10px",color:"#9CA3AF",fontFamily:"monospace"},children:t.kind}),e.jsx("span",{style:{fontSize:"12px",color:"#374151",fontWeight:500},children:t.name})]},t.id))}):e.jsx(C,{text:"No System or Subsystem elements yet"})]})]}),n.diagrams&&n.diagrams.length>0&&e.jsxs("div",{style:{marginTop:"12px",display:"flex",gap:"8px",flexWrap:"wrap"},children:[n.diagrams.slice(0,4).map(t=>e.jsxs("button",{onClick:()=>i({type:"diagram",diagramId:t.id}),style:q,onMouseEnter:o=>o.currentTarget.style.background="#E5E5E0",onMouseLeave:o=>o.currentTarget.style.background="#F3F4F6",children:["⊟ ",t.name]},t.id)),n.diagrams.length>4&&e.jsxs("span",{style:{fontSize:"11px",color:"#9CA3AF",alignSelf:"center"},children:["+",n.diagrams.length-4," more"]})]})]})}function R({model:n}){const i=g(t=>t.setActiveView),{reqs:s,withTestLink:l,withArchLink:a}=j.useMemo(()=>{const t=Object.values(n.elements),o=t.filter(d=>["systemrequirement","requirement","userneed"].includes(d.kind.toLowerCase())),f=new Set;for(const d of n.relationships)f.add(d.sourceId),f.add(d.targetId);const u=new Set(["test","verification","validationtest"]),y=new Set(["system","subsystem","logicalcomponent","softwarecomponent"]),c=new Set(t.filter(d=>u.has(d.kind.toLowerCase())).map(d=>d.id)),b=new Set(t.filter(d=>y.has(d.kind.toLowerCase())).map(d=>d.id));let r=0,S=0;for(const d of o){const A=n.relationships.filter(h=>h.sourceId===d.id||h.targetId===d.id).flatMap(h=>[h.sourceId,h.targetId]);A.some(h=>c.has(h))&&r++,A.some(h=>b.has(h))&&S++}return{reqs:o,withTestLink:r,withArchLink:S}},[n]),x=s.length>0?Math.round(l/s.length*100):0,p=s.length>0?Math.round(a/s.length*100):0;return e.jsxs("div",{style:w,children:[e.jsx(k,{icon:"📋",title:"Requirements",badge:`${s.length} total`,onExpand:()=>i({type:"traceability"})}),s.length===0?e.jsx(C,{text:"No requirements found. Add Requirement elements to your model."}):e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"10px"},children:[e.jsx(v,{label:"Verified by tests",percent:x,count:l,total:s.length,color:"#2DD4A8"}),e.jsx(v,{label:"Linked to architecture",percent:p,count:a,total:s.length,color:"#4A90D9"})]})]})}function I({model:n}){const i=g(t=>t.setActiveView),{hazards:s,riskControls:l,mitigatesCount:a,residualRiskCount:x}=j.useMemo(()=>{const t=Object.values(n.elements),o=t.filter(r=>r.kind.toLowerCase()==="hazard"),f=t.filter(r=>r.kind.toLowerCase()==="riskcontrol"),u=n.relationships.filter(r=>r.type.toLowerCase()==="mitigates"),y=u.length,c=new Set(u.map(r=>r.targetId)),b=o.filter(r=>!c.has(r.id)).length;return{hazards:o,riskControls:f,mitigatesCount:y,residualRiskCount:b}},[n]),p=s.length>0?Math.round((s.length-x)/s.length*100):0;return e.jsxs("div",{style:w,children:[e.jsx(k,{icon:"⚠️",title:"Risk Chain (ISO 14971)",badge:`${s.length} hazards`,onExpand:()=>i({type:"traceability"}),badgeColor:x>0?"#E74C3C":"#2ECC71"}),s.length===0?e.jsx(C,{text:"No hazards found. Add Hazard elements to start your ISO 14971 risk analysis."}):e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"10px"},children:[e.jsx(v,{label:"Hazards mitigated",percent:p,count:s.length-x,total:s.length,color:"#2ECC71",warningThreshold:80}),e.jsxs("div",{style:{display:"flex",gap:"16px"},children:[e.jsx(m,{label:"Risk controls",value:l.length}),e.jsx(m,{label:"Mitigates links",value:a}),x>0&&e.jsx(m,{label:"Unmitigated hazards",value:x,alert:!0})]})]})]})}function L({model:n}){const i=g(p=>p.setActiveView),{tests:s,passing:l,withReqLink:a}=j.useMemo(()=>{const p=Object.values(n.elements),t=p.filter(c=>c.kind.toLowerCase()==="test"),o=p.filter(c=>["systemrequirement","requirement"].includes(c.kind.toLowerCase())),f=new Set(o.map(c=>c.id));let u=0;for(const c of t)n.relationships.filter(r=>r.sourceId===c.id||r.targetId===c.id).flatMap(r=>[r.sourceId,r.targetId]).some(r=>f.has(r))&&u++;const y=t.filter(c=>(c.attributes.status||"").toLowerCase()==="pass").length;return{tests:t,passing:y,withReqLink:u}},[n]),x=s.length>0?Math.round(a/s.length*100):0;return e.jsxs("div",{style:w,children:[e.jsx(k,{icon:"🧪",title:"Verification",badge:`${s.length} tests`,onExpand:()=>i({type:"traceability"})}),s.length===0?e.jsx(C,{text:"No tests found. Add Test elements and link them to requirements."}):e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"10px"},children:[e.jsx(v,{label:"Tests linked to requirements",percent:x,count:a,total:s.length,color:"#2DD4A8"}),e.jsxs("div",{style:{display:"flex",gap:"16px"},children:[e.jsx(m,{label:"Tests",value:s.length}),l>0&&e.jsx(m,{label:"Passing",value:l}),s.length-l>0&&e.jsx(m,{label:"Unverified",value:s.length-l,alert:s.length-l>0&&l>0})]})]})]})}function k({icon:n,title:i,badge:s,onExpand:l,badgeColor:a}){return e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"14px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx("span",{style:{fontSize:"16px"},children:n}),e.jsx("span",{style:{fontSize:"14px",fontWeight:700,color:"#1B3A4B"},children:i}),e.jsx("span",{style:{fontSize:"11px",fontWeight:600,padding:"2px 8px",borderRadius:"999px",background:a?a+"20":"#F3F4F6",color:a||"#6B7280"},children:s})]}),e.jsx("button",{onClick:l,style:{fontSize:"11px",color:"#4A90D9",background:"none",border:"none",cursor:"pointer",fontWeight:600},children:"Expand →"})]})}function v({label:n,percent:i,count:s,total:l,color:a,warningThreshold:x=100}){const p=i>=x?a:i>=50?"#F39C12":"#E74C3C";return e.jsxs("div",{children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"4px"},children:[e.jsx("span",{style:{fontSize:"12px",color:"#374151"},children:n}),e.jsxs("span",{style:{fontSize:"12px",fontWeight:600,color:i>=80?"#2ECC71":"#374151"},children:[s,"/",l," (",i,"%)"]})]}),e.jsx("div",{style:{height:"6px",background:"#F3F4F6",borderRadius:"3px"},children:e.jsx("div",{style:{height:"100%",borderRadius:"3px",background:p,width:`${i}%`,transition:"width 0.4s ease"}})})]})}function m({label:n,value:i,alert:s}){return e.jsxs("div",{style:{display:"flex",gap:"4px",alignItems:"baseline"},children:[e.jsx("span",{style:{fontSize:"16px",fontWeight:700,color:s?"#E74C3C":"#1B3A4B"},children:i}),e.jsx("span",{style:{fontSize:"11px",color:"#9CA3AF"},children:n})]})}function C({text:n}){return e.jsx("div",{style:{fontSize:"12px",color:"#9CA3AF",fontStyle:"italic",padding:"8px 0"},children:n})}const w={background:"#FFFFFF",border:"1px solid #E5E5E0",borderRadius:"12px",padding:"20px"},E={fontSize:"11px",fontWeight:700,textTransform:"uppercase",letterSpacing:"0.06em",color:"#9CA3AF",marginBottom:"8px"},q={fontSize:"11px",color:"#374151",background:"#F3F4F6",border:"1px solid #E5E5E0",borderRadius:"6px",padding:"4px 10px",cursor:"pointer",transition:"background 0.1s",fontWeight:500};function D(){const n=g(s=>s.model),i=g(s=>s.setActiveView);return n?e.jsx("div",{style:{flex:1,overflowY:"auto",background:"#F7F7F5",padding:"28px 40px"},children:e.jsxs("div",{style:{maxWidth:"960px",margin:"0 auto"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",marginBottom:"24px"},children:[e.jsxs("div",{children:[e.jsx("h1",{style:{fontSize:"20px",fontWeight:800,color:"#1B3A4B",margin:"0 0 4px 0"},children:"Design Review Dashboard"}),e.jsx("p",{style:{fontSize:"12px",color:"#6B7280",margin:0},children:"Architecture · Requirements · Risk · Verification — in one view"})]}),e.jsx("button",{onClick:()=>i({type:"dashboard"}),style:{fontSize:"12px",color:"#6B7280",background:"#F3F4F6",border:"1px solid #E5E5E0",borderRadius:"6px",padding:"6px 12px",cursor:"pointer",fontWeight:500},children:"← Back to Dashboard"})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"16px"},children:[e.jsx(z,{model:n}),e.jsx(R,{model:n}),e.jsx(I,{model:n}),e.jsx(L,{model:n})]})]})}):e.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",background:"#F7F7F5"},children:e.jsx("div",{style:{fontSize:"13px",color:"#9CA3AF"},children:"No model data"})})}export{D as ReviewDashboard};
@@ -0,0 +1,3 @@
1
+ import{j as e}from"./reactflow-C9OlmOYw.js";import{a as x}from"./zustand-CrhqMOHB.js";import{u as A,k as he,m as fe,C as f,F as C,h as E,E as O,n as Z,M as ge,o as ye,D as je}from"./index-CG-gfw-s.js";function ke(d){const r=d.diagramType.toLowerCase(),b=["afd","ofd","ffd"].includes(r)?ye(d):r;return je[b]}function ee({expanded:d,color:r=f.muted}){return e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",style:{transform:d?"rotate(90deg)":void 0,transition:"transform 150ms ease",flexShrink:0},children:e.jsx("path",{d:"M6 4L10 8L6 12",stroke:r,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function te({open:d,color:r}){return e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",style:{flexShrink:0},children:[e.jsx("path",{d:"M1.5 3.5h4.8l1.2 1.5H14.5v8H1.5z",fill:r,opacity:"0.15",stroke:r,strokeWidth:"1",strokeLinejoin:"round"}),d&&e.jsx("path",{d:"M1.5 5h13v8H1.5z",fill:r,opacity:"0.08"})]})}function be({color:d}){return e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",style:{flexShrink:0},children:[e.jsx("rect",{x:"2",y:"1.5",width:"12",height:"13",rx:"1.5",fill:d,opacity:"0.1",stroke:d,strokeWidth:"1"}),e.jsx("line",{x1:"5",y1:"5.5",x2:"11",y2:"5.5",stroke:d,strokeWidth:"0.8",opacity:"0.5"}),e.jsx("line",{x1:"5",y1:"8",x2:"11",y2:"8",stroke:d,strokeWidth:"0.8",opacity:"0.5"})]})}function se(d){return d?d.split(`
2
+ `).filter(b=>b.trim()).map((b,W)=>{const I=b.match(/^\d+\.\s*(.*)/);return{index:W,text:I?I[1]:b}}):[]}function ve(d){return d.map((r,b)=>`${b+1}. ${r.text}`).join(`
3
+ `)}function Ce({explorerOnly:d=!1}){const r=A(t=>t.model),b=A(t=>t.createRelationship),W=A(t=>t.inspectElement),I=A(t=>t.setActiveView),G=A(t=>t.setActiveMode),S=A(t=>t.selectedElementId),[D,ne]=x.useState(""),[i,F]=x.useState(null),[L,P]=x.useState(""),[z,_]=x.useState(null),[T,H]=x.useState(""),R=x.useMemo(()=>{if(!r)return[];const t=Object.values(r.elements),n=r.elements,o=(...s)=>{const y=new Set(s.map(j=>j.toLowerCase()));return r.relationships.filter(j=>y.has(j.type.toLowerCase()))},c=(s,y)=>{var j;return typeof s=="string"&&((j=s.split("::").at(-1))==null?void 0:j.trim())===y},h=t.filter(s=>s.kind.endsWith("UseCase")),w=new Set(h.map(s=>s.id)),u=new Map,a=new Set;for(const s of o("Includes")){if(!w.has(s.sourceId)||!w.has(s.targetId))continue;const y=u.get(s.sourceId)??[];y.push(s.targetId),u.set(s.sourceId,y),a.add(s.targetId)}const v=new Map,g=[],m=(s,y)=>{if(!v.has(s)){v.set(s,y),g.push(s);for(const j of u.get(s)??[])m(j,y+1)}};for(const s of h)a.has(s.id)||m(s.id,0);for(const s of h)m(s.id,0);const M=g.map(s=>n[s]).filter(s=>!!s),$=s=>!D||s.name.toLowerCase().includes(D.toLowerCase())||s.kind.toLowerCase().includes(D.toLowerCase());return M.map(s=>{var Q;const y=o("Supports","supportsUseCase").filter(l=>l.targetId===s.id).map(l=>n[l.sourceId]).filter(l=>!!l&&l.kind==="OperationalWorkflow"),j=t.filter(l=>l.kind.endsWith("Scenario")).filter(l=>c(l.attributes.parentUseCase,s.id)||o("Realizes","scenarioRealizesUseCase").some(N=>N.sourceId===l.id&&N.targetId===s.id)),U=j.map(l=>t.find(N=>c(l.attributes.parentWorkflow,N.id))).filter(l=>!!l),pe=[...new Map([...y,...U].map(l=>[l.id,l])).values()],ue=j.map(l=>{const N=(r.diagrams??[]).filter(me=>{var X;return(X=me.scenarioIds)==null?void 0:X.includes(l.id)});return{scenario:l,views:N}}),xe=pe.map(l=>({workflow:l,scenarios:ue.filter(({scenario:N})=>c(N.attributes.parentWorkflow,l.id))}));return{useCase:s,workflows:xe,depth:v.get(s.id)??0,hasChildren:(((Q=u.get(s.id))==null?void 0:Q.length)??0)>0}}).filter(s=>$(s.useCase)||s.workflows.some(({workflow:y,scenarios:j})=>$(y)||j.some(({scenario:U})=>$(U))))},[r,D]),p=S&&r?r.elements[S]:null,K=x.useMemo(()=>he(r,S||""),[r,S]),k=x.useMemo(()=>i||(p?se(p.doc||""):[]),[p,i]),oe=x.useCallback(()=>{p&&F(se(p.doc||""))},[p]),re=x.useCallback(()=>{if(!p||!i)return;const t=ve(i);fe({...p,doc:t}),F(null)},[p,i]),V=x.useCallback(()=>{if(!L.trim())return;const t=[...i||k,{index:k.length,text:L.trim()}];F(t),P("")},[L,i,k]),le=x.useCallback(t=>{const n=(i||k).filter((o,c)=>c!==t);F(n)},[i,k]),Y=x.useCallback((t,n)=>{const o=[...i||k],c=t+n;c<0||c>=o.length||([o[t],o[c]]=[o[c],o[t]],F(o))},[i,k]),ae=x.useCallback((t,n)=>{const o=[...i||k];o[t]={...o[t],text:n},F(o)},[i,k]),ce=x.useMemo(()=>{if(!r||!T)return[];const t=T.toLowerCase();return Object.values(r.elements).filter(n=>n.id!==S&&n.name.toLowerCase().includes(t)).slice(0,10)},[r,T,S]),[q,ie]=x.useState(new Set),J=t=>{ie(n=>{const o=new Set(n);return o.has(t)?o.delete(t):o.add(t),o})},B=t=>{F(null),G("scenario"),W(t),I({type:"element-detail",elementId:t})},de=({workflow:t,scenarios:n})=>{const o=`workflow:${t.id}`,c=q.has(o),h=()=>J(o),w=a=>{G("scenario"),I({type:"diagram",diagramId:a.id})},u=(a,v)=>{const g=S===a.id;return e.jsxs("button",{type:"button",onClick:()=>B(a.id),className:"flex w-full items-center gap-1.5 px-2 py-1 text-left",style:{borderRadius:"4px",margin:"0 4px",marginLeft:`${v+4}px`,width:`calc(100% - ${v+8}px)`,background:g?`${f.accent}18`:"transparent"},onMouseEnter:m=>{g||(m.currentTarget.style.background="#F0F0ED")},onMouseLeave:m=>{m.currentTarget.style.background=g?`${f.accent}18`:"transparent"},children:[e.jsx(be,{color:E[a.layer]||f.muted}),e.jsx(O,{element:a,selected:g})]},a.id)};return e.jsxs("div",{className:"mb-0.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1 cursor-pointer select-none",style:{borderRadius:"4px",margin:"0 4px"},onMouseEnter:a=>a.currentTarget.style.background="#F0F0ED",onMouseLeave:a=>a.currentTarget.style.background="transparent",onClick:()=>B(t.id),children:[e.jsx("button",{type:"button","aria-label":`${c?"Collapse":"Expand"} ${t.name}`,onClick:a=>{a.stopPropagation(),h()},children:e.jsx(ee,{expanded:c,color:f.muted})}),e.jsx(te,{open:c,color:E.operational}),e.jsx(O,{element:t,fontSize:C.explorer.kind,fontWeight:600}),e.jsx(Z,{count:n.length,color:E.operational,title:`${n.length} scenarios`})]}),c&&n.map(({scenario:a,views:v})=>e.jsxs("div",{style:{marginLeft:"16px"},children:[u(a,0),e.jsx("div",{style:{marginLeft:"20px"},children:v.length>0&&e.jsx("div",{className:"pt-1",children:v.map(g=>{const m=ke(g);return e.jsxs("button",{type:"button",onClick:()=>w(g),className:"flex w-full items-center gap-2 px-2 py-1 text-left",style:{borderRadius:"4px",margin:"0 4px",width:"calc(100% - 8px)"},onMouseEnter:M=>M.currentTarget.style.background="#F0F0ED",onMouseLeave:M=>M.currentTarget.style.background="transparent",title:m==null?void 0:m.fullName,children:[m&&e.jsx("span",{className:"px-1.5 py-0.5 rounded font-semibold",style:{background:m.color+"20",color:m.color,fontSize:C.badge},children:m.code}),e.jsxs("span",{className:"flex-1",style:{minWidth:0},children:[e.jsx("span",{className:"truncate block",style:{color:f.primary,fontSize:C.explorer.item},children:g.name}),e.jsx("span",{className:"truncate block font-mono",style:{color:f.faint,fontSize:"9px",marginTop:1},children:g.id})]})]},g.id)})})})]},a.id)),c&&n.length===0&&e.jsx("div",{className:"px-2 py-1",style:{color:f.faint,fontSize:C.explorer.count,marginLeft:"20px"},children:"No scenarios"})]})};return e.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[d&&e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",style:{background:f.surface},children:[e.jsx("div",{className:"px-3 py-2",style:{borderBottom:"1px solid #E5E5E0"},children:e.jsx("input",{type:"text",placeholder:"Search "+R.length+" use cases...",value:D,onChange:t=>ne(t.target.value),className:"w-full px-3 py-2 rounded-lg focus:outline-none",style:{background:f.surfaceAlt,border:`1px solid ${f.border}`,color:f.primary,fontSize:C.explorer.search}})}),e.jsxs("div",{className:"flex-1 overflow-y-auto py-1",style:{fontSize:C.explorer.item},children:[R.map(({useCase:t,workflows:n,depth:o})=>{const c="use-case:"+t.id,h=q.has(c),w=n.reduce((u,{scenarios:a})=>u+a.length,0);return e.jsxs("div",{className:"mb-0.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1.5 cursor-pointer select-none",style:{borderRadius:"4px",margin:"0 4px",marginLeft:4+o*16},onMouseEnter:u=>u.currentTarget.style.background="#F0F0ED",onMouseLeave:u=>u.currentTarget.style.background="transparent",onClick:()=>B(t.id),children:[e.jsx("button",{type:"button","aria-label":`${h?"Collapse":"Expand"} ${t.name}`,onClick:u=>{u.stopPropagation(),J(c)},children:e.jsx(ee,{expanded:h,color:E.functional})}),e.jsx(te,{open:h,color:E.functional}),e.jsx(O,{element:t,fontSize:C.explorer.group,fontWeight:600}),e.jsx(Z,{count:w,color:E.functional,title:`${w} scenarios`})]}),h&&e.jsxs("div",{style:{marginLeft:16+o*16},children:[n.map(({workflow:u,scenarios:a})=>e.jsx(de,{workflow:u,scenarios:a},u.id)),n.length===0&&e.jsx("div",{className:"px-2 py-1",style:{color:f.faint,fontSize:C.explorer.kind},children:"No workflows"})]})]},t.id)}),R.length===0&&e.jsx("div",{className:"px-4 py-8 text-center",style:{color:f.faint},children:"No use-case scenario chains found."})]})]}),!d&&e.jsx("div",{className:"flex-1 overflow-y-auto p-6",style:{background:"#F7F7F5"},children:e.jsxs(e.Fragment,{children:[!p&&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:{display:"flex",justifyContent:"center",marginBottom:2},children:e.jsx(ge,{size:180})}),e.jsx("div",{className:"text-sm",children:"Select a scenario to edit steps and link elements"})]})}),p&&e.jsxs("div",{className:"max-w-2xl",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx("h2",{className:"text-lg font-semibold",style:{color:"#1a1a1a"},children:p.name}),e.jsx("span",{className:"px-2 py-0.5 text-xs rounded-md font-medium",style:{background:"#E67E2218",color:"#E67E22"},children:p.kind})]}),e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"#6B7280"},children:"Steps"}),!i&&e.jsx("button",{onClick:oe,className:"px-2 py-0.5 text-xs rounded",style:{background:"#2DD4A815",color:"#1B3A4B",border:"1px solid #2DD4A840"},children:"Edit"}),i&&e.jsxs("div",{className:"flex gap-1",children:[e.jsx("button",{onClick:re,className:"px-2 py-0.5 text-xs rounded font-medium",style:{background:"#2DD4A8",color:"#FFFFFF"},children:"Save"}),e.jsx("button",{onClick:()=>F(null),className:"px-2 py-0.5 text-xs rounded",style:{background:"#F3F4F6",color:"#6B7280"},children:"Cancel"})]})]}),e.jsx("div",{className:"space-y-1",children:k.map((t,n)=>e.jsxs("div",{className:"flex items-start gap-2 p-2 rounded-lg",style:{background:"#FFFFFF",border:"1px solid #E5E5E0"},children:[e.jsx("span",{className:"flex-shrink-0 w-6 h-6 rounded-full flex items-center justify-center text-xs font-medium",style:{background:"#2DD4A815",color:"#1B3A4B"},children:n+1}),i?e.jsx("input",{type:"text",value:t.text,onChange:o=>ae(n,o.target.value),className:"flex-1 text-sm px-2 py-1 rounded focus:outline-none",style:{border:"1px solid #E5E5E0",color:"#374151"}}):e.jsx("span",{className:"flex-1 text-sm",style:{color:"#374151"},children:t.text}),i&&e.jsxs("div",{className:"flex gap-0.5",children:[e.jsx("button",{onClick:()=>Y(n,-1),className:"px-1 text-xs",style:{color:"#9CA3AF"},title:"Move up",children:"▲"}),e.jsx("button",{onClick:()=>Y(n,1),className:"px-1 text-xs",style:{color:"#9CA3AF"},title:"Move down",children:"▼"}),e.jsx("button",{onClick:()=>le(n),className:"px-1 text-xs",style:{color:"#E74C3C"},title:"Remove",children:"✕"})]})]},n))}),i&&e.jsxs("div",{className:"flex gap-2 mt-2",children:[e.jsx("input",{type:"text",value:L,onChange:t=>P(t.target.value),onKeyDown:t=>t.key==="Enter"&&V(),placeholder:"Add a step...",className:"flex-1 text-sm px-3 py-2 rounded-lg focus:outline-none",style:{background:"#FFFFFF",border:"1px solid #E5E5E0",color:"#374151"}}),e.jsx("button",{onClick:V,className:"px-3 py-2 text-xs rounded-lg font-medium",style:{background:"#2DD4A815",color:"#1B3A4B",border:"1px solid #2DD4A840"},children:"+ Add"})]}),k.length===0&&!i&&e.jsx("div",{className:"text-xs p-3 rounded-lg",style:{background:"#F3F4F6",color:"#9CA3AF"},children:"No steps defined. Click Edit to add scenario steps."})]}),e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsxs("h3",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"#6B7280"},children:["Linked Elements (",K.length,")"]}),e.jsx("button",{onClick:()=>_(z===null?0:null),className:"px-2 py-0.5 text-xs rounded",style:{background:"#4A90D915",color:"#4A90D9",border:"1px solid #4A90D940"},children:z!==null?"Done":"+ Link"})]}),z!==null&&e.jsxs("div",{className:"mb-2 p-2 rounded-lg",style:{background:"#FFFFFF",border:"1px solid #4A90D940"},children:[e.jsx("input",{type:"text",value:T,onChange:t=>H(t.target.value),placeholder:"Search elements to link...",className:"w-full text-sm px-2 py-1 rounded focus:outline-none mb-1",style:{border:"1px solid #E5E5E0",color:"#374151"}}),ce.map(t=>e.jsxs("div",{className:"flex items-center gap-2 px-2 py-1 text-xs rounded cursor-pointer",onMouseEnter:n=>n.currentTarget.style.background="#F0F0ED",onMouseLeave:n=>n.currentTarget.style.background="transparent",onClick:()=>{b({type:"traceTo",sourceId:p.id,targetId:t.id,direction:"outgoing",selectedElementId:p.id}),H(""),_(null)},children:[e.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:E[t.layer]||"#95A5A6"}}),e.jsx("span",{style:{color:"#374151"},children:t.name}),e.jsx("span",{style:{color:"#9CA3AF"},children:t.kind})]},t.id))]}),e.jsx("div",{className:"space-y-1",children:K.map(t=>{const n=t.sourceId===p.id?t.targetId:t.sourceId,o=r.elements[n],c=t.sourceId===p.id?"→":"←";return e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 text-xs rounded-lg cursor-pointer",style:{background:"#FFFFFF",border:"1px solid #E5E5E0"},onMouseEnter:h=>h.currentTarget.style.background="#F0F0ED",onMouseLeave:h=>h.currentTarget.style.background="#FFFFFF",onClick:()=>B(n),children:[e.jsx("span",{style:{color:"#9CA3AF"},children:c}),e.jsx("span",{className:"font-medium",style:{color:"#2563EB"},children:t.type}),e.jsx("span",{style:{color:"#374151"},children:(o==null?void 0:o.name)||n}),o&&e.jsx("span",{className:"ml-auto px-1.5 py-0.5 rounded text-xs",style:{background:(E[o.layer]||"#95A5A6")+"18",color:E[o.layer]||"#95A5A6"},children:o.kind})]},t.id)})})]}),e.jsx("div",{className:"text-xs",style:{color:"#D1D5DB"},children:p.file})]})]})})]})}export{Ce as ScenarioEditor};
@@ -1 +1 @@
1
- import{j as e}from"./reactflow-CsCqNKB-.js";import{a as A}from"./zustand-CrhqMOHB.js";import{u as f,L as y,f as u,e as b}from"./index-CVW92JY7.js";function w(a){var F;const c=Object.values(a.elements),n=c.length,t=a.relationships.length,i=((F=a.diagrams)==null?void 0:F.length)??0,d=new Map;for(const s of c){const o=d.get(s.layer)||{count:0,kinds:new Map};o.count++,o.kinds.set(s.kind,(o.kinds.get(s.kind)||0)+1),d.set(s.layer,o)}const m=y.filter(s=>d.has(s)).map(s=>({layer:s,label:b[s]||s,color:u[s]||"#95A5A6",count:d.get(s).count,kinds:d.get(s).kinds}));for(const[s,o]of d)y.includes(s)||m.push({layer:s,label:b[s]||s,color:u[s]||"#95A5A6",count:o.count,kinds:o.kinds});const l=new Map;for(const s of c){const o=l.get(s.kind)||{count:0,layer:s.layer};o.count++,l.set(s.kind,o)}const r=[...l.entries()].map(([s,{count:o,layer:C}])=>({kind:s,count:o,layer:C})).sort((s,o)=>o.count-s.count).slice(0,15),x=new Map;for(const s of a.relationships)x.set(s.type,(x.get(s.type)||0)+1);const j=[...x.entries()].map(([s,o])=>({type:s,count:o})).sort((s,o)=>o.count-s.count),p=new Set;for(const s of a.relationships)p.add(s.sourceId),p.add(s.targetId);const N=c.filter(s=>!p.has(s.id)).length;Math.max(...m.map(s=>s.count),1);const v=m.map(s=>({layer:s.layer,label:s.label,color:s.color,percent:Math.round(s.count/n*100)})),E=n>0?t/n:0,k=n>0?t/n:0;return{totalElements:n,totalRelationships:t,totalDiagrams:i,layers:m,topKinds:r,relTypes:j,avgRelsPerElement:Math.round(k*10)/10,orphanCount:N,coverage:v,density:Math.round(E*100)/100}}function B(){var d,m;const a=f(l=>l.model),c=f(l=>l.validation),n=f(l=>l.completeness),t=A.useMemo(()=>a?w(a):null,[a]);if(!t)return e.jsx("div",{className:"flex-1 flex items-center justify-center",style:{background:"#F7F7F5",color:"#9CA3AF"},children:e.jsx("div",{className:"text-sm",children:"No model data"})});const i=((d=c==null?void 0:c.violations)==null?void 0:d.length)??0;return e.jsx("div",{className:"flex-1 overflow-y-auto p-6",style:{background:"#F7F7F5"},children:e.jsxs("div",{className:"max-w-5xl mx-auto",children:[e.jsx("h2",{className:"text-lg font-semibold mb-1",style:{color:"#374151"},children:"Model Statistics"}),e.jsx("p",{className:"text-xs mb-6",style:{color:"#9CA3AF"},children:"Quick health check for your model"}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3 mb-6",children:[e.jsx(h,{label:"Elements",value:t.totalElements,color:"#1B3A4B"}),e.jsx(h,{label:"Relationships",value:t.totalRelationships,color:"#4A90D9"}),e.jsx(h,{label:"Diagrams",value:t.totalDiagrams,color:"#7B68EE"}),e.jsx(h,{label:"Violations",value:i,color:i>0?"#E74C3C":"#2ECC71"})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3 mb-6",children:[e.jsx(g,{label:"Rel. Density",value:`${t.avgRelsPerElement}`,unit:"per element",status:t.avgRelsPerElement>=1.5?"good":t.avgRelsPerElement>=.5?"ok":"low"}),e.jsx(g,{label:"Orphans",value:`${t.orphanCount}`,unit:"unlinked",status:t.orphanCount===0?"good":t.orphanCount<=5?"ok":"low"}),e.jsx(g,{label:"Layers Used",value:`${t.layers.length}`,unit:`of ${y.length}`,status:t.layers.length>=6?"good":t.layers.length>=3?"ok":"low"}),e.jsx(g,{label:"Kinds Used",value:`${t.topKinds.length}`,unit:"types",status:t.topKinds.length>=8?"good":t.topKinds.length>=4?"ok":"low"})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"p-4 rounded-lg",style:{background:"#FFFFFF",border:"1px solid #E5E5E0"},children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider mb-3",style:{color:"#6B7280"},children:"Elements by Layer"}),e.jsx("div",{className:"space-y-2",children:t.layers.map((l,r)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"w-20 text-xs truncate",style:{color:"#374151"},children:l.label}),e.jsx("div",{className:"flex-1 h-4 rounded-full overflow-hidden",style:{background:"#F3F4F6"},children:e.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${Math.max(l.count/t.totalElements*100,2)}%`,background:l.color,opacity:.8}})}),e.jsx("span",{className:"w-8 text-right text-xs font-medium",style:{color:"#374151"},children:l.count})]},`${l.layer}-${r}`))})]}),e.jsxs("div",{className:"p-4 rounded-lg",style:{background:"#FFFFFF",border:"1px solid #E5E5E0"},children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider mb-3",style:{color:"#6B7280"},children:"Layer Coverage"}),e.jsx("div",{className:"grid grid-cols-3 gap-2",children:y.map(l=>{const r=t.coverage.find(p=>p.layer===l),x=(r==null?void 0:r.percent)??0,j=x>0?Math.max(.15,x/100):.05;return e.jsxs("div",{className:"p-2 rounded-lg text-center",style:{background:`${u[l]||"#95A5A6"}${Math.round(j*255).toString(16).padStart(2,"0")}`,border:`1px solid ${u[l]||"#95A5A6"}30`},children:[e.jsx("div",{className:"text-xs font-medium truncate",style:{color:"#374151"},children:b[l]||l}),e.jsxs("div",{className:"text-lg font-bold",style:{color:u[l]||"#95A5A6"},children:[x,"%"]})]},l)})})]}),e.jsxs("div",{className:"p-4 rounded-lg",style:{background:"#FFFFFF",border:"1px solid #E5E5E0"},children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider mb-3",style:{color:"#6B7280"},children:"Top Element Types"}),e.jsx("div",{className:"space-y-1",children:t.topKinds.map((l,r)=>e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:u[l.layer]||"#95A5A6"}}),e.jsx("span",{className:"flex-1 truncate",style:{color:"#374151"},children:l.kind}),e.jsx("span",{className:"font-medium",style:{color:"#6B7280"},children:l.count})]},`${l.kind}-${r}`))})]}),e.jsxs("div",{className:"p-4 rounded-lg",style:{background:"#FFFFFF",border:"1px solid #E5E5E0"},children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider mb-3",style:{color:"#6B7280"},children:"Relationship Types"}),e.jsxs("div",{className:"space-y-1",children:[t.relTypes.map((l,r)=>e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:"#4A90D9"}}),e.jsx("span",{className:"flex-1 truncate",style:{color:"#374151"},children:l.type}),e.jsx("span",{className:"font-medium",style:{color:"#6B7280"},children:l.count})]},`${l.type}-${r}`)),t.relTypes.length===0&&e.jsx("div",{className:"text-xs",style:{color:"#9CA3AF"},children:"No relationships"})]})]})]}),n&&e.jsxs("div",{className:"mt-4 p-4 rounded-lg",style:{background:"#FFFFFF",border:"1px solid #E5E5E0"},children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider mb-3",style:{color:"#6B7280"},children:"Completeness by Layer"}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2",children:(m=n.layers)==null?void 0:m.map((l,r)=>e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:u[l.layer]||"#95A5A6"}}),e.jsx("span",{className:"flex-1 truncate",style:{color:"#374151"},children:l.layer}),e.jsxs("span",{className:"font-medium",style:{color:l.completeness>=80?"#2ECC71":l.completeness>=50?"#F39C12":"#E74C3C"},children:[Math.round(l.completeness),"%"]})]},`${l.layer}-${r}`))})]})]})})}function h({label:a,value:c,color:n}){return e.jsxs("div",{className:"p-4 rounded-lg",style:{background:"#FFFFFF",border:"1px solid #E5E5E0"},children:[e.jsx("div",{className:"text-2xl font-bold",style:{color:n},children:c.toLocaleString()}),e.jsx("div",{className:"text-xs mt-0.5",style:{color:"#9CA3AF"},children:a})]})}function g({label:a,value:c,unit:n,status:t}){const i=t==="good"?"#2ECC71":t==="ok"?"#F39C12":"#E74C3C";return e.jsxs("div",{className:"p-4 rounded-lg",style:{background:"#FFFFFF",border:`1px solid ${i}30`},children:[e.jsxs("div",{className:"flex items-baseline gap-1",children:[e.jsx("span",{className:"text-lg font-bold",style:{color:i},children:c}),e.jsx("span",{className:"text-xs",style:{color:"#9CA3AF"},children:n})]}),e.jsx("div",{className:"text-xs mt-0.5",style:{color:"#6B7280"},children:a})]})}export{B as StatisticsDashboard};
1
+ import{j as e}from"./reactflow-C9OlmOYw.js";import{a as A}from"./zustand-CrhqMOHB.js";import{u as f,L as y,h as u,f as b}from"./index-CG-gfw-s.js";function w(a){var F;const c=Object.values(a.elements),n=c.length,t=a.relationships.length,i=((F=a.diagrams)==null?void 0:F.length)??0,d=new Map;for(const s of c){const o=d.get(s.layer)||{count:0,kinds:new Map};o.count++,o.kinds.set(s.kind,(o.kinds.get(s.kind)||0)+1),d.set(s.layer,o)}const m=y.filter(s=>d.has(s)).map(s=>({layer:s,label:b[s]||s,color:u[s]||"#95A5A6",count:d.get(s).count,kinds:d.get(s).kinds}));for(const[s,o]of d)y.includes(s)||m.push({layer:s,label:b[s]||s,color:u[s]||"#95A5A6",count:o.count,kinds:o.kinds});const l=new Map;for(const s of c){const o=l.get(s.kind)||{count:0,layer:s.layer};o.count++,l.set(s.kind,o)}const r=[...l.entries()].map(([s,{count:o,layer:C}])=>({kind:s,count:o,layer:C})).sort((s,o)=>o.count-s.count).slice(0,15),x=new Map;for(const s of a.relationships)x.set(s.type,(x.get(s.type)||0)+1);const j=[...x.entries()].map(([s,o])=>({type:s,count:o})).sort((s,o)=>o.count-s.count),p=new Set;for(const s of a.relationships)p.add(s.sourceId),p.add(s.targetId);const N=c.filter(s=>!p.has(s.id)).length;Math.max(...m.map(s=>s.count),1);const v=m.map(s=>({layer:s.layer,label:s.label,color:s.color,percent:Math.round(s.count/n*100)})),E=n>0?t/n:0,k=n>0?t/n:0;return{totalElements:n,totalRelationships:t,totalDiagrams:i,layers:m,topKinds:r,relTypes:j,avgRelsPerElement:Math.round(k*10)/10,orphanCount:N,coverage:v,density:Math.round(E*100)/100}}function B(){var d,m;const a=f(l=>l.model),c=f(l=>l.validation),n=f(l=>l.completeness),t=A.useMemo(()=>a?w(a):null,[a]);if(!t)return e.jsx("div",{className:"flex-1 flex items-center justify-center",style:{background:"#F7F7F5",color:"#9CA3AF"},children:e.jsx("div",{className:"text-sm",children:"No model data"})});const i=((d=c==null?void 0:c.violations)==null?void 0:d.length)??0;return e.jsx("div",{className:"flex-1 overflow-y-auto p-6",style:{background:"#F7F7F5"},children:e.jsxs("div",{className:"max-w-5xl mx-auto",children:[e.jsx("h2",{className:"text-lg font-semibold mb-1",style:{color:"#374151"},children:"Model Statistics"}),e.jsx("p",{className:"text-xs mb-6",style:{color:"#9CA3AF"},children:"Quick health check for your model"}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3 mb-6",children:[e.jsx(h,{label:"Elements",value:t.totalElements,color:"#1B3A4B"}),e.jsx(h,{label:"Relationships",value:t.totalRelationships,color:"#4A90D9"}),e.jsx(h,{label:"Diagrams",value:t.totalDiagrams,color:"#7B68EE"}),e.jsx(h,{label:"Violations",value:i,color:i>0?"#E74C3C":"#2ECC71"})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3 mb-6",children:[e.jsx(g,{label:"Rel. Density",value:`${t.avgRelsPerElement}`,unit:"per element",status:t.avgRelsPerElement>=1.5?"good":t.avgRelsPerElement>=.5?"ok":"low"}),e.jsx(g,{label:"Orphans",value:`${t.orphanCount}`,unit:"unlinked",status:t.orphanCount===0?"good":t.orphanCount<=5?"ok":"low"}),e.jsx(g,{label:"Layers Used",value:`${t.layers.length}`,unit:`of ${y.length}`,status:t.layers.length>=6?"good":t.layers.length>=3?"ok":"low"}),e.jsx(g,{label:"Kinds Used",value:`${t.topKinds.length}`,unit:"types",status:t.topKinds.length>=8?"good":t.topKinds.length>=4?"ok":"low"})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"p-4 rounded-lg",style:{background:"#FFFFFF",border:"1px solid #E5E5E0"},children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider mb-3",style:{color:"#6B7280"},children:"Elements by Layer"}),e.jsx("div",{className:"space-y-2",children:t.layers.map((l,r)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"w-20 text-xs truncate",style:{color:"#374151"},children:l.label}),e.jsx("div",{className:"flex-1 h-4 rounded-full overflow-hidden",style:{background:"#F3F4F6"},children:e.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${Math.max(l.count/t.totalElements*100,2)}%`,background:l.color,opacity:.8}})}),e.jsx("span",{className:"w-8 text-right text-xs font-medium",style:{color:"#374151"},children:l.count})]},`${l.layer}-${r}`))})]}),e.jsxs("div",{className:"p-4 rounded-lg",style:{background:"#FFFFFF",border:"1px solid #E5E5E0"},children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider mb-3",style:{color:"#6B7280"},children:"Layer Coverage"}),e.jsx("div",{className:"grid grid-cols-3 gap-2",children:y.map(l=>{const r=t.coverage.find(p=>p.layer===l),x=(r==null?void 0:r.percent)??0,j=x>0?Math.max(.15,x/100):.05;return e.jsxs("div",{className:"p-2 rounded-lg text-center",style:{background:`${u[l]||"#95A5A6"}${Math.round(j*255).toString(16).padStart(2,"0")}`,border:`1px solid ${u[l]||"#95A5A6"}30`},children:[e.jsx("div",{className:"text-xs font-medium truncate",style:{color:"#374151"},children:b[l]||l}),e.jsxs("div",{className:"text-lg font-bold",style:{color:u[l]||"#95A5A6"},children:[x,"%"]})]},l)})})]}),e.jsxs("div",{className:"p-4 rounded-lg",style:{background:"#FFFFFF",border:"1px solid #E5E5E0"},children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider mb-3",style:{color:"#6B7280"},children:"Top Element Types"}),e.jsx("div",{className:"space-y-1",children:t.topKinds.map((l,r)=>e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:u[l.layer]||"#95A5A6"}}),e.jsx("span",{className:"flex-1 truncate",style:{color:"#374151"},children:l.kind}),e.jsx("span",{className:"font-medium",style:{color:"#6B7280"},children:l.count})]},`${l.kind}-${r}`))})]}),e.jsxs("div",{className:"p-4 rounded-lg",style:{background:"#FFFFFF",border:"1px solid #E5E5E0"},children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider mb-3",style:{color:"#6B7280"},children:"Relationship Types"}),e.jsxs("div",{className:"space-y-1",children:[t.relTypes.map((l,r)=>e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:"#4A90D9"}}),e.jsx("span",{className:"flex-1 truncate",style:{color:"#374151"},children:l.type}),e.jsx("span",{className:"font-medium",style:{color:"#6B7280"},children:l.count})]},`${l.type}-${r}`)),t.relTypes.length===0&&e.jsx("div",{className:"text-xs",style:{color:"#9CA3AF"},children:"No relationships"})]})]})]}),n&&e.jsxs("div",{className:"mt-4 p-4 rounded-lg",style:{background:"#FFFFFF",border:"1px solid #E5E5E0"},children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider mb-3",style:{color:"#6B7280"},children:"Completeness by Layer"}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2",children:(m=n.layers)==null?void 0:m.map((l,r)=>e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:u[l.layer]||"#95A5A6"}}),e.jsx("span",{className:"flex-1 truncate",style:{color:"#374151"},children:l.layer}),e.jsxs("span",{className:"font-medium",style:{color:l.completeness>=80?"#2ECC71":l.completeness>=50?"#F39C12":"#E74C3C"},children:[Math.round(l.completeness),"%"]})]},`${l.layer}-${r}`))})]})]})})}function h({label:a,value:c,color:n}){return e.jsxs("div",{className:"p-4 rounded-lg",style:{background:"#FFFFFF",border:"1px solid #E5E5E0"},children:[e.jsx("div",{className:"text-2xl font-bold",style:{color:n},children:c.toLocaleString()}),e.jsx("div",{className:"text-xs mt-0.5",style:{color:"#9CA3AF"},children:a})]})}function g({label:a,value:c,unit:n,status:t}){const i=t==="good"?"#2ECC71":t==="ok"?"#F39C12":"#E74C3C";return e.jsxs("div",{className:"p-4 rounded-lg",style:{background:"#FFFFFF",border:`1px solid ${i}30`},children:[e.jsxs("div",{className:"flex items-baseline gap-1",children:[e.jsx("span",{className:"text-lg font-bold",style:{color:i},children:c}),e.jsx("span",{className:"text-xs",style:{color:"#9CA3AF"},children:n})]}),e.jsx("div",{className:"text-xs mt-0.5",style:{color:"#6B7280"},children:a})]})}export{B as StatisticsDashboard};