@memoarchitect/architect 0.7.2 → 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 (71) hide show
  1. package/README.md +1 -1
  2. package/dist/assets/{AiWorkspace-Bu9TlIWg.js → AiWorkspace-Z3BbnmaP.js} +1 -1
  3. package/dist/assets/{AnalysisWorkspace-CodmoI-v.js → AnalysisWorkspace-DjaUOo7U.js} +1 -1
  4. package/dist/assets/{ComplianceWizard-CTihkUi-.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-UJDHcAUF.js → DiagramEditor-puQuE8gB.js} +2 -2
  11. package/dist/assets/DiagramToolbarControls-XMGLx08e.js +1 -0
  12. package/dist/assets/{ElementDetailView-10U0rr33.js → ElementDetailView-D5XvAL_i.js} +1 -1
  13. package/dist/assets/ExplorerTreeRow-DUmcEsqf.js +3 -0
  14. package/dist/assets/{ImportView-D8svP04Q.js → ImportView-9y1nhQS4.js} +1 -1
  15. package/dist/assets/{LayerGrid-DEe0Ryz-.js → LayerGrid-bhFpOIbe.js} +1 -1
  16. package/dist/assets/{LayerTable-CN_b2rDr.js → LayerTable-RuswZVUI.js} +1 -1
  17. package/dist/assets/{MaxGraphCanvas-bo8oPBct.js → MaxGraphCanvas-D3BXQK2y.js} +1 -1
  18. package/dist/assets/{ModelDiff-xe95oVua.js → ModelDiff-Cl2dhlk3.js} +1 -1
  19. package/dist/assets/{OntologyDecompositionDiagram-BL9R8bdB.js → OntologyDecompositionDiagram-aONGngg4.js} +1 -1
  20. package/dist/assets/{OntologyViewer-CtqNkkCn.js → OntologyViewer-VOrKTRuQ.js} +2 -2
  21. package/dist/assets/{RelationshipOverlay-DL0N8Vmk.js → RelationshipOverlay-B3AN-bM-.js} +1 -1
  22. package/dist/assets/{RelationshipsSection-BoJ0aUXe.js → RelationshipsSection-DggeGBKP.js} +1 -1
  23. package/dist/assets/{ReviewDashboard-DeTge2oC.js → ReviewDashboard--LMXZ3F4.js} +1 -1
  24. package/dist/assets/{ScenarioEditor-FAEYTHgP.js → ScenarioEditor-bB4iBbgO.js} +1 -1
  25. package/dist/assets/{StatisticsDashboard-BAZRqIPN.js → StatisticsDashboard-iXimfU20.js} +1 -1
  26. package/dist/assets/{SysmlCodeEditor-BBfup_Ni.js → SysmlCodeEditor-i0BHj3of.js} +117 -117
  27. package/dist/assets/{TabularView-I4LjHhoH.js → TabularView-DnIfq-TB.js} +1 -1
  28. package/dist/assets/TraceabilityMatrix-eilGn6Sr.js +3 -0
  29. package/dist/assets/UiScreensWorkspace-Cs1ivqzc.js +1 -0
  30. package/dist/assets/{WorkflowWizard-VwpEHt3R.js → WorkflowWizard-C7jI6C59.js} +1 -1
  31. package/dist/assets/index-CG-gfw-s.js +4067 -0
  32. package/dist/assets/index-DXB4CKwW.css +1 -0
  33. package/dist/assets/{index.es-ClbJxlAQ.js → index.es-DABt8CUc.js} +1 -1
  34. package/dist/assets/{jspdf.es.min-DZ68BGxk.js → jspdf.es.min-G-Vwo9yG.js} +3 -3
  35. package/dist/assets/{layout-providers-Dr743WlP.js → layout-providers-BSDYNZu0.js} +1 -1
  36. package/dist/assets/notation-scene-DLZms6VR.js +1 -0
  37. package/dist/assets/{reactflow-s7jmJtXx.js → reactflow-C9OlmOYw.js} +1 -1
  38. package/dist/assets/xlsx-CkFp8p6R.js +105 -0
  39. package/dist/index.html +3 -3
  40. package/dist-standalone/index.html +5504 -0
  41. package/lib/__tests__/standalone-distribution.test.d.ts +2 -0
  42. package/lib/__tests__/standalone-distribution.test.d.ts.map +1 -0
  43. package/lib/__tests__/standalone-distribution.test.js +51 -0
  44. package/lib/__tests__/standalone-distribution.test.js.map +1 -0
  45. package/lib/__tests__/supervised-child-args.test.js +21 -1
  46. package/lib/__tests__/supervised-child-args.test.js.map +1 -1
  47. package/lib/commands/build.d.ts.map +1 -1
  48. package/lib/commands/build.js +15 -18
  49. package/lib/commands/build.js.map +1 -1
  50. package/lib/commands/dev.d.ts +14 -0
  51. package/lib/commands/dev.d.ts.map +1 -1
  52. package/lib/commands/dev.js +40 -1
  53. package/lib/commands/dev.js.map +1 -1
  54. package/lib/feature-grants.d.ts.map +1 -1
  55. package/lib/feature-grants.js +3 -1
  56. package/lib/feature-grants.js.map +1 -1
  57. package/package.json +10 -6
  58. package/dist/assets/DSMView-BiC845df.js +0 -1
  59. package/dist/assets/Dashboard-CgnNLhKq.js +0 -1
  60. package/dist/assets/DhfDashboard-w-dJoJHU.js +0 -1
  61. package/dist/assets/DhfWorkbench-o6B_MT-0.js +0 -69
  62. package/dist/assets/DiagramCanvas-CqGqDbgT.js +0 -3
  63. package/dist/assets/DiagramToolbarControls-B2gZFJlg.js +0 -1
  64. package/dist/assets/ExplorerTreeRow-DqhF_qoO.js +0 -3
  65. package/dist/assets/TraceabilityMatrix-DbrvjqLN.js +0 -3
  66. package/dist/assets/UiScreensWorkspace-DDD_PyJs.js +0 -1
  67. package/dist/assets/editor.worker-DyuDvpVp.js +0 -26
  68. package/dist/assets/element-options-B7AgTB8R.js +0 -3
  69. package/dist/assets/index-BWMNo4wW.css +0 -1
  70. package/dist/assets/index-Bij8Q4Kg.js +0 -45
  71. package/dist/assets/notation-scene-DT8LpWVK.js +0 -1
@@ -1 +1 @@
1
- import{j as t}from"./reactflow-s7jmJtXx.js";import{a as x}from"./zustand-CrhqMOHB.js";import{u as w,F as j,f as L,h as T}from"./index-Bij8Q4Kg.js";function R({element:l}){var f;const i=!!((f=l.attributes.description)!=null&&f.trim()),d=Object.keys(l.attributes).length,S=i&&d>=1,v=i||d>=1,p=S?"#2DD4A8":v?"#F39C12":"#E5E5E0",A=S?"Complete":v?"Partial":"Empty";return t.jsx("span",{className:"inline-block rounded-full flex-shrink-0",style:{width:8,height:8,backgroundColor:p,cursor:"default"},title:A})}function Y({col:l,sortKey:i,sortDir:d}){return l!==i?t.jsx("span",{style:{color:"#D1D5DB",fontSize:"10px",marginLeft:3},children:"⇅"}):t.jsx("span",{style:{color:"#1B3A4B",fontSize:"10px",marginLeft:3},children:d==="asc"?"↑":"↓"})}function P(){const l=w(e=>e.model),i=w(e=>e.activeView),d=w(e=>e.selectedViewpointId),S=w(e=>e.selectElement),v=w(e=>e.selectedElementId),[p,A]=x.useState("name"),[f,C]=x.useState("asc"),[E,B]=x.useState(""),[b,I]=x.useState(""),[g,M]=x.useState(""),h=x.useMemo(()=>{var n,s,o,c,r;if(!l)return[];const e=Object.values(l.elements);if(i.type==="tabular"&&i.diagramId){const a=(n=l.diagrams)==null?void 0:n.find(u=>u.id===i.diagramId);if((s=a==null?void 0:a.elementIds)!=null&&s.length){const u=new Set(a.elementIds);return e.filter(m=>u.has(m.id))}}if(d){const a=(o=l.viewpoints)==null?void 0:o.find(u=>u.id===d);if(a){const u=(c=a.visibleLayers)!=null&&c.length?new Set(a.visibleLayers):null,m=(r=a.visibleKinds)!=null&&r.length?new Set(a.visibleKinds):null;return e.filter(F=>(!u||u.has(F.layer))&&(!m||m.has(F.kind)))}}return e},[l,i,d]),k=x.useMemo(()=>{const e=new Map;for(const s of h)for(const o of Object.keys(s.attributes))o==="description"||o==="shortDescription"||e.set(o,(e.get(o)??0)+1);const n=Math.max(1,h.length*.1);return[...e.entries()].filter(([,s])=>s>=n).sort((s,o)=>o[1]-s[1]).slice(0,4).map(([s])=>s)},[h]),O=x.useMemo(()=>[...new Set(h.map(e=>e.layer))].sort(),[h]),V=x.useMemo(()=>[...new Set(h.map(e=>e.kind))].sort(),[h]),N=x.useMemo(()=>{const e=E.toLowerCase();let n=h.filter(s=>!(e&&!s.name.toLowerCase().includes(e)&&!s.kind.toLowerCase().includes(e)||b&&s.layer!==b||g&&s.kind!==g));return n.sort((s,o)=>{let c="",r="";if(p==="name")c=s.name,r=o.name;else if(p==="kind")c=s.kind,r=o.kind;else if(p==="layer")c=s.layer,r=o.layer;else if(p==="status"){const u=m=>{var z;const F=!!((z=m.attributes.description)!=null&&z.trim()),D=Object.keys(m.attributes).length>=1;return F&&D?2:F||D?1:0};c=String(u(s)),r=String(u(o))}else c=s.attributes[p]??"",r=o.attributes[p]??"";const a=c.localeCompare(r,void 0,{numeric:!0});return f==="asc"?a:-a}),n},[h,E,b,g,p,f]);function K(e){p===e?C(n=>n==="asc"?"desc":"asc"):(A(e),C("asc"))}const W=x.useMemo(()=>{var e,n;if(!l)return"";if(i.type==="tabular"&&i.diagramId){const s=(e=l.diagrams)==null?void 0:e.find(o=>o.id===i.diagramId);return s?`Diagram: ${s.name}`:"Diagram"}if(d){const s=(n=l.viewpoints)==null?void 0:n.find(o=>o.id===d);return s?`Viewpoint: ${s.label}`:"Viewpoint"}return"All Elements"},[l,i,d]),y=({col:e,label:n,width:s})=>t.jsxs("th",{onClick:()=>K(e),className:"px-3 py-2 text-left cursor-pointer select-none",style:{fontSize:"11px",fontWeight:600,color:"#374151",background:"#F7F7F5",borderBottom:"1px solid #E5E5E0",whiteSpace:"nowrap",width:s,position:"sticky",top:0,zIndex:1},children:[n,t.jsx(Y,{col:e,sortKey:p,sortDir:f})]});return t.jsxs("div",{className:"flex flex-col h-full overflow-hidden",style:{background:"#FFFFFF"},children:[t.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 flex-shrink-0",style:{borderBottom:"1px solid #E5E5E0",background:"#FAFAF8"},children:[t.jsxs("div",{children:[t.jsx("div",{style:{fontSize:"13px",fontWeight:700,color:"#1B3A4B"},children:"Tabular View"}),t.jsx("div",{style:{fontSize:"11px",color:"#9CA3AF"},children:W})]}),t.jsx("div",{className:"flex-1"}),t.jsx("input",{type:"text",placeholder:"Search elements…",value:E,onChange:e=>B(e.target.value),className:"px-3 py-1.5 rounded-lg focus:outline-none",style:{width:220,fontSize:j.xs,color:"#1a1a1a",border:"1px solid #E5E5E0",background:"#FFFFFF"}}),t.jsxs("select",{value:b,onChange:e=>I(e.target.value),className:"px-2 py-1.5 rounded-lg focus:outline-none",style:{fontSize:j.xs,color:"#374151",border:"1px solid #E5E5E0",background:"#FFFFFF",cursor:"pointer"},children:[t.jsx("option",{value:"",children:"All layers"}),O.map(e=>t.jsx("option",{value:e,children:L[e]??e},e))]}),t.jsxs("select",{value:g,onChange:e=>M(e.target.value),className:"px-2 py-1.5 rounded-lg focus:outline-none",style:{fontSize:j.xs,color:"#374151",border:"1px solid #E5E5E0",background:"#FFFFFF",cursor:"pointer"},children:[t.jsx("option",{value:"",children:"All kinds"}),V.map(e=>t.jsx("option",{value:e,children:e},e))]}),t.jsxs("div",{style:{fontSize:"11px",color:"#9CA3AF",whiteSpace:"nowrap"},children:[N.length," / ",h.length," elements"]})]}),t.jsx("div",{className:"flex-1 overflow-auto",children:t.jsxs("table",{className:"w-full border-collapse",style:{tableLayout:"fixed"},children:[t.jsxs("colgroup",{children:[t.jsx("col",{style:{width:28}}),t.jsx("col",{style:{width:"30%"}}),t.jsx("col",{style:{width:"13%"}}),t.jsx("col",{style:{width:"13%"}}),t.jsx("col",{style:{width:40}}),t.jsx("col",{style:{width:"20%"}}),k.map(e=>t.jsx("col",{style:{width:"10%"}},e))]}),t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx("th",{style:{background:"#F7F7F5",borderBottom:"1px solid #E5E5E0",position:"sticky",top:0,zIndex:1}}),t.jsx(y,{col:"name",label:"Name"}),t.jsx(y,{col:"kind",label:"Kind"}),t.jsx(y,{col:"layer",label:"Layer"}),t.jsx(y,{col:"status",label:"",width:40}),t.jsx(y,{col:"shortDescription",label:"Short description"}),k.map(e=>t.jsx(y,{col:e,label:e},e))]})}),t.jsxs("tbody",{children:[N.length===0&&t.jsx("tr",{children:t.jsx("td",{colSpan:6+k.length,className:"py-16 text-center",style:{fontSize:"13px",color:"#9CA3AF"},children:E||b||g?"No elements match the current filters":"No elements in scope"})}),N.map(e=>{var c;const n=e.id===v,s=T[e.layer]??"#9CA3AF",o=((c=e.attributes.shortDescription)==null?void 0:c.trim())??"";return t.jsxs("tr",{onClick:()=>S(e.id),className:"cursor-pointer",style:{background:n?"#2DD4A812":"transparent",borderBottom:"1px solid #F0F0ED"},onMouseEnter:r=>{n||(r.currentTarget.style.background="#F7F7F5")},onMouseLeave:r=>{n||(r.currentTarget.style.background="transparent")},children:[t.jsx("td",{className:"px-2",children:n&&t.jsx("span",{style:{color:"#2DD4A8",fontSize:"10px"},children:"▶"})}),t.jsxs("td",{className:"px-3 py-2",children:[t.jsx("div",{style:{fontSize:j.xs,fontWeight:500,color:"#1B3A4B",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:e.name}),e.shortId&&t.jsx("div",{style:{fontSize:"10px",color:"#9CA3AF",fontFamily:"monospace"},children:e.shortId})]}),t.jsx("td",{className:"px-3 py-2",children:t.jsx("span",{style:{fontSize:"10px",fontWeight:600,color:"#374151"},children:e.kind})}),t.jsx("td",{className:"px-3 py-2",children:t.jsx("span",{className:"px-1.5 py-0.5 rounded",style:{fontSize:"10px",fontWeight:600,background:s+"1A",color:s,whiteSpace:"nowrap"},children:L[e.layer]??e.layer})}),t.jsx("td",{className:"px-3 py-2 text-center",children:t.jsx(R,{element:e})}),t.jsx("td",{className:"px-3 py-2",children:t.jsx("span",{style:{fontSize:j.xs,color:"#6B7280",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},children:o})}),k.map(r=>t.jsx("td",{className:"px-3 py-2",children:t.jsx("span",{style:{fontSize:j.xs,color:"#374151",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",display:"block"},children:e.attributes[r]??""})},r))]},e.id)})]})]})})]})}export{P as TabularView};
1
+ import{j as t}from"./reactflow-C9OlmOYw.js";import{a as x}from"./zustand-CrhqMOHB.js";import{u as w,F as j,f as L,h as T}from"./index-CG-gfw-s.js";function R({element:l}){var f;const i=!!((f=l.attributes.description)!=null&&f.trim()),d=Object.keys(l.attributes).length,S=i&&d>=1,v=i||d>=1,p=S?"#2DD4A8":v?"#F39C12":"#E5E5E0",A=S?"Complete":v?"Partial":"Empty";return t.jsx("span",{className:"inline-block rounded-full flex-shrink-0",style:{width:8,height:8,backgroundColor:p,cursor:"default"},title:A})}function Y({col:l,sortKey:i,sortDir:d}){return l!==i?t.jsx("span",{style:{color:"#D1D5DB",fontSize:"10px",marginLeft:3},children:"⇅"}):t.jsx("span",{style:{color:"#1B3A4B",fontSize:"10px",marginLeft:3},children:d==="asc"?"↑":"↓"})}function P(){const l=w(e=>e.model),i=w(e=>e.activeView),d=w(e=>e.selectedViewpointId),S=w(e=>e.selectElement),v=w(e=>e.selectedElementId),[p,A]=x.useState("name"),[f,C]=x.useState("asc"),[E,B]=x.useState(""),[b,I]=x.useState(""),[g,M]=x.useState(""),h=x.useMemo(()=>{var n,s,o,c,r;if(!l)return[];const e=Object.values(l.elements);if(i.type==="tabular"&&i.diagramId){const a=(n=l.diagrams)==null?void 0:n.find(u=>u.id===i.diagramId);if((s=a==null?void 0:a.elementIds)!=null&&s.length){const u=new Set(a.elementIds);return e.filter(m=>u.has(m.id))}}if(d){const a=(o=l.viewpoints)==null?void 0:o.find(u=>u.id===d);if(a){const u=(c=a.visibleLayers)!=null&&c.length?new Set(a.visibleLayers):null,m=(r=a.visibleKinds)!=null&&r.length?new Set(a.visibleKinds):null;return e.filter(F=>(!u||u.has(F.layer))&&(!m||m.has(F.kind)))}}return e},[l,i,d]),k=x.useMemo(()=>{const e=new Map;for(const s of h)for(const o of Object.keys(s.attributes))o==="description"||o==="shortDescription"||e.set(o,(e.get(o)??0)+1);const n=Math.max(1,h.length*.1);return[...e.entries()].filter(([,s])=>s>=n).sort((s,o)=>o[1]-s[1]).slice(0,4).map(([s])=>s)},[h]),O=x.useMemo(()=>[...new Set(h.map(e=>e.layer))].sort(),[h]),V=x.useMemo(()=>[...new Set(h.map(e=>e.kind))].sort(),[h]),N=x.useMemo(()=>{const e=E.toLowerCase();let n=h.filter(s=>!(e&&!s.name.toLowerCase().includes(e)&&!s.kind.toLowerCase().includes(e)||b&&s.layer!==b||g&&s.kind!==g));return n.sort((s,o)=>{let c="",r="";if(p==="name")c=s.name,r=o.name;else if(p==="kind")c=s.kind,r=o.kind;else if(p==="layer")c=s.layer,r=o.layer;else if(p==="status"){const u=m=>{var z;const F=!!((z=m.attributes.description)!=null&&z.trim()),D=Object.keys(m.attributes).length>=1;return F&&D?2:F||D?1:0};c=String(u(s)),r=String(u(o))}else c=s.attributes[p]??"",r=o.attributes[p]??"";const a=c.localeCompare(r,void 0,{numeric:!0});return f==="asc"?a:-a}),n},[h,E,b,g,p,f]);function K(e){p===e?C(n=>n==="asc"?"desc":"asc"):(A(e),C("asc"))}const W=x.useMemo(()=>{var e,n;if(!l)return"";if(i.type==="tabular"&&i.diagramId){const s=(e=l.diagrams)==null?void 0:e.find(o=>o.id===i.diagramId);return s?`Diagram: ${s.name}`:"Diagram"}if(d){const s=(n=l.viewpoints)==null?void 0:n.find(o=>o.id===d);return s?`Viewpoint: ${s.label}`:"Viewpoint"}return"All Elements"},[l,i,d]),y=({col:e,label:n,width:s})=>t.jsxs("th",{onClick:()=>K(e),className:"px-3 py-2 text-left cursor-pointer select-none",style:{fontSize:"11px",fontWeight:600,color:"#374151",background:"#F7F7F5",borderBottom:"1px solid #E5E5E0",whiteSpace:"nowrap",width:s,position:"sticky",top:0,zIndex:1},children:[n,t.jsx(Y,{col:e,sortKey:p,sortDir:f})]});return t.jsxs("div",{className:"flex flex-col h-full overflow-hidden",style:{background:"#FFFFFF"},children:[t.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 flex-shrink-0",style:{borderBottom:"1px solid #E5E5E0",background:"#FAFAF8"},children:[t.jsxs("div",{children:[t.jsx("div",{style:{fontSize:"13px",fontWeight:700,color:"#1B3A4B"},children:"Tabular View"}),t.jsx("div",{style:{fontSize:"11px",color:"#9CA3AF"},children:W})]}),t.jsx("div",{className:"flex-1"}),t.jsx("input",{type:"text",placeholder:"Search elements…",value:E,onChange:e=>B(e.target.value),className:"px-3 py-1.5 rounded-lg focus:outline-none",style:{width:220,fontSize:j.xs,color:"#1a1a1a",border:"1px solid #E5E5E0",background:"#FFFFFF"}}),t.jsxs("select",{value:b,onChange:e=>I(e.target.value),className:"px-2 py-1.5 rounded-lg focus:outline-none",style:{fontSize:j.xs,color:"#374151",border:"1px solid #E5E5E0",background:"#FFFFFF",cursor:"pointer"},children:[t.jsx("option",{value:"",children:"All layers"}),O.map(e=>t.jsx("option",{value:e,children:L[e]??e},e))]}),t.jsxs("select",{value:g,onChange:e=>M(e.target.value),className:"px-2 py-1.5 rounded-lg focus:outline-none",style:{fontSize:j.xs,color:"#374151",border:"1px solid #E5E5E0",background:"#FFFFFF",cursor:"pointer"},children:[t.jsx("option",{value:"",children:"All kinds"}),V.map(e=>t.jsx("option",{value:e,children:e},e))]}),t.jsxs("div",{style:{fontSize:"11px",color:"#9CA3AF",whiteSpace:"nowrap"},children:[N.length," / ",h.length," elements"]})]}),t.jsx("div",{className:"flex-1 overflow-auto",children:t.jsxs("table",{className:"w-full border-collapse",style:{tableLayout:"fixed"},children:[t.jsxs("colgroup",{children:[t.jsx("col",{style:{width:28}}),t.jsx("col",{style:{width:"30%"}}),t.jsx("col",{style:{width:"13%"}}),t.jsx("col",{style:{width:"13%"}}),t.jsx("col",{style:{width:40}}),t.jsx("col",{style:{width:"20%"}}),k.map(e=>t.jsx("col",{style:{width:"10%"}},e))]}),t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx("th",{style:{background:"#F7F7F5",borderBottom:"1px solid #E5E5E0",position:"sticky",top:0,zIndex:1}}),t.jsx(y,{col:"name",label:"Name"}),t.jsx(y,{col:"kind",label:"Kind"}),t.jsx(y,{col:"layer",label:"Layer"}),t.jsx(y,{col:"status",label:"",width:40}),t.jsx(y,{col:"shortDescription",label:"Short description"}),k.map(e=>t.jsx(y,{col:e,label:e},e))]})}),t.jsxs("tbody",{children:[N.length===0&&t.jsx("tr",{children:t.jsx("td",{colSpan:6+k.length,className:"py-16 text-center",style:{fontSize:"13px",color:"#9CA3AF"},children:E||b||g?"No elements match the current filters":"No elements in scope"})}),N.map(e=>{var c;const n=e.id===v,s=T[e.layer]??"#9CA3AF",o=((c=e.attributes.shortDescription)==null?void 0:c.trim())??"";return t.jsxs("tr",{onClick:()=>S(e.id),className:"cursor-pointer",style:{background:n?"#2DD4A812":"transparent",borderBottom:"1px solid #F0F0ED"},onMouseEnter:r=>{n||(r.currentTarget.style.background="#F7F7F5")},onMouseLeave:r=>{n||(r.currentTarget.style.background="transparent")},children:[t.jsx("td",{className:"px-2",children:n&&t.jsx("span",{style:{color:"#2DD4A8",fontSize:"10px"},children:"▶"})}),t.jsxs("td",{className:"px-3 py-2",children:[t.jsx("div",{style:{fontSize:j.xs,fontWeight:500,color:"#1B3A4B",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:e.name}),e.shortId&&t.jsx("div",{style:{fontSize:"10px",color:"#9CA3AF",fontFamily:"monospace"},children:e.shortId})]}),t.jsx("td",{className:"px-3 py-2",children:t.jsx("span",{style:{fontSize:"10px",fontWeight:600,color:"#374151"},children:e.kind})}),t.jsx("td",{className:"px-3 py-2",children:t.jsx("span",{className:"px-1.5 py-0.5 rounded",style:{fontSize:"10px",fontWeight:600,background:s+"1A",color:s,whiteSpace:"nowrap"},children:L[e.layer]??e.layer})}),t.jsx("td",{className:"px-3 py-2 text-center",children:t.jsx(R,{element:e})}),t.jsx("td",{className:"px-3 py-2",children:t.jsx("span",{style:{fontSize:j.xs,color:"#6B7280",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},children:o})}),k.map(r=>t.jsx("td",{className:"px-3 py-2",children:t.jsx("span",{style:{fontSize:j.xs,color:"#374151",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",display:"block"},children:e.attributes[r]??""})},r))]},e.id)})]})]})})]})}export{P as TabularView};
@@ -0,0 +1,3 @@
1
+ import{j as o}from"./reactflow-C9OlmOYw.js";import{a as i}from"./zustand-CrhqMOHB.js";import{u as k,i as Ne,j as _,r as ye,F as T,C as r,T as Ke}from"./index-CG-gfw-s.js";import{l as Be,e as be,c as qe,s as We,a as we,r as He,A as Se,T as ke,H as Pe}from"./DSMView-DJhmrXYm.js";import{a as Ge,I as ee}from"./DiagramToolbarControls-XMGLx08e.js";const Qe=[{id:"risk-control",label:"ISO 14971: Risk → Control",description:"Hazards and hazardous situations traced to risk controls",rowKinds:["Hazard","HazardousSituation"],columnKinds:["RiskControlMeasure","SafetyGoal"],linkTypes:["mitigates","tracesRisk","causes","leadsTo"]},{id:"req-test",label:"IEC 62304: Requirement → Test",description:"Software requirements traced to verification tests",rowKinds:["Requirement","SoftwareRequirement","SystemRequirement"],columnKinds:["Test","TestCase","VerificationCase","VerificationActivity"],linkTypes:["verifiedBy","satisfiedBy","validates"]},{id:"req-function",label:"Requirement → Function",description:"Requirements traced to the functions that satisfy them",rowKinds:["Requirement","SystemRequirement"],columnKinds:["Function","SystemFunction","ComponentFunction"],linkTypes:["satisfiedBy","derivesFrom"]},{id:"function-component",label:"Function → Component",description:"Functions allocated to logical and physical components",rowKinds:["Function","SystemFunction","ComponentFunction"],columnKinds:["LogicalComponent","SoftwareModule","MechanicalPart","Component"],linkTypes:["allocatedTo","realizes"]},{id:"everything",label:"Everything",description:"Every element against every element, every relationship",rowKinds:[],columnKinds:[],linkTypes:[]}];function _e(){var ge;const s=k(e=>e.model),f=k(e=>e.connected),C=k(e=>e.selectElement),ve=k(e=>e.selectedElementId),te=k(e=>e.selectedDiagramId),ne=k(e=>e.createRelationship),oe=k(e=>e.deleteRelationship),[g,M]=i.useState({}),[y,O]=i.useState({}),[R,B]=i.useState([]),[E,q]=i.useState([]),[x,W]=i.useState([]),[H,je]=i.useState("natural"),[P,Te]=i.useState("natural"),[se,ie]=i.useState(null),[Re,Ee]=i.useState("top"),[h,Fe]=i.useState(!1),[re,Ie]=i.useState(39),[Me,Ue]=i.useState(!0),[ae,G]=i.useState(new Set),[le,Q]=i.useState(new Set),[l,z]=i.useState(null),[$,v]=i.useState(null),[A,de]=i.useState(""),[L,D]=i.useState(!1),b=i.useMemo(()=>Ne(s),[s]),ce=i.useMemo(()=>s?Be(s):[],[s]),U=i.useMemo(()=>be(s,g),[s,g]),V=i.useMemo(()=>be(s,y),[s,y]),Y=i.useMemo(()=>{if(!s||!b)return[];const e=(a,u,w)=>(!u.layer||a.layer===u.layer)&&(!u.kind||a.kind===u.kind)&&(w.length===0||w.includes(a.id)),t=Object.values(s.elements).filter(a=>e(a,g,R)),n=Object.values(s.elements).filter(a=>e(a,y,E)),d=new Set;for(const a of t)for(const u of n)if(a.id!==u.id)for(const w of _(a,u,b))d.add(w.definition.name);const p=new Map;for(const a of s.relationships)p.set(a.type,(p.get(a.type)??0)+1);return[...d].sort().map(a=>({value:a,hint:String(p.get(a)??0),color:ye(a)}))},[s,b,g,y,R,E]);i.useEffect(()=>{const e=new Set(U.map(t=>t.value));B(t=>t.every(n=>e.has(n))?t:t.filter(n=>e.has(n)))},[U]),i.useEffect(()=>{const e=new Set(V.map(t=>t.value));q(t=>t.every(n=>e.has(n))?t:t.filter(n=>e.has(n)))},[V]),i.useEffect(()=>{const e=new Set(Y.map(t=>t.value));W(t=>t.every(n=>e.has(n))?t:t.filter(n=>e.has(n)))},[Y]);const c=i.useMemo(()=>s?qe(s,{rows:{layer:g.layer,kinds:g.kind?[g.kind]:[],elementIds:R,expanded:ae,ordering:H},columns:{layer:y.layer,kinds:y.kind?[y.kind]:[],elementIds:E,expanded:le,ordering:P},dependencyTypes:x,symmetric:!0}):null,[s,g,y,R,E,x,H,P,ae,le]),[N,Oe]=i.useState(!1);i.useEffect(()=>{if(N||!s)return;const e=We(s);e.rows&&(M({layer:e.rows}),O({layer:e.columns}),Oe(!0))},[s,N]);const[pe,ze]=i.useState(!1);i.useEffect(()=>{if(pe||!N||!c)return;const e=c.rowRoots.filter(n=>n.children.length>0).map(n=>n.id),t=c.columnRoots.filter(n=>n.children.length>0).map(n=>n.id);e.length===0&&t.length===0||(G(new Set(e)),Q(new Set(t)),ze(!0))},[c,N,pe]);const j=i.useCallback((e,t)=>{e==="rows"?G(t):Q(t)},[]),ue=i.useCallback(e=>{c&&j(e,new Set(we(e==="rows"?c.rowRoots:c.columnRoots)))},[c,j]),me=i.useCallback(e=>j(e,new Set),[j]),fe=i.useCallback((e,t)=>{c&&j(e,new Set(we(e==="rows"?c.rowRoots:c.columnRoots,t)))},[c,j]),Z=i.useCallback(e=>{if(!s)return null;for(const t of e){const n=Object.values(s.elements).find(d=>d.kind===t);if(n)return{layer:n.layer,kind:t}}return null},[s]),$e=i.useCallback(e=>{const t=new Set(s?He(s):[]),n=Z(e.rowKinds),d=Z(e.columnKinds);e.id==="everything"?(M({}),O({})):(n&&M(n),d&&O(d)),W(e.linkTypes.filter(p=>t.has(p))),B([]),q([]),z(null)},[s,Z]),xe=i.useMemo(()=>{var p;if(!s||!l)return[];const e=l.row.node.id,t=l.column.node.id;if(l.row.node.children.length===0&&l.column.node.children.length===0){const a=new Set(x);return s.relationships.filter(u=>(a.size===0||a.has(u.type))&&(u.sourceId===e&&u.targetId===t||u.sourceId===t&&u.targetId===e))}const d=new Set(((p=l.cell)==null?void 0:p.relationshipIds)??[]);return s.relationships.filter(a=>d.has(a.id))},[s,l,x]),F=i.useMemo(()=>{if(!s||!l||!b)return[];const e=s.elements[l.row.node.id],t=s.elements[l.column.node.id];return!e||!t||e.id===t.id?[]:_(e,t,b)},[s,l,b]),K=i.useMemo(()=>{const e=new Set;for(const t of x)e.add(t),e.add(t.charAt(0).toUpperCase()+t.slice(1));return e},[x]),he=i.useMemo(()=>{const e=A.trim().toLowerCase();return F.filter(t=>!e||t.definition.name.toLowerCase().includes(e)).sort((t,n)=>{const d=Number(K.has(n.definition.name))-Number(K.has(t.definition.name));return d!==0?d:t.definition.name.localeCompare(n.definition.name)})},[F,A,K]),Ae=!!(l&&l.row.node.isElement&&l.column.node.isElement&&!l.row.expanded&&!l.column.expanded&&l.row.node.children.length===0&&l.column.node.children.length===0),J=i.useCallback(async e=>{D(!0),v(null);const t=await ne({type:e.definition.name,sourceId:e.sourceId,targetId:e.targetId,direction:e.direction,diagramId:te??void 0});D(!1),v(t.success?{kind:"ok",message:`Trace written to ${t.sourceFile??"the model"}.`}:{kind:"error",message:t.error??"The trace could not be created."})},[ne,te]),X=i.useCallback(async e=>{D(!0),v(null);const t=await oe(e);D(!1),v(t.success?{kind:"ok",message:`Trace removed from ${t.sourceFile??"the model"}.`}:{kind:"error",message:t.error??"The trace could not be removed."})},[oe]),Le=i.useCallback(async(e,t,n)=>{if(!h||!f||!s||!b||!e.node.isElement||!t.node.isElement||e.node.children.length>0||t.node.children.length>0||e.node.id===t.node.id||x.length!==1)return;const d=x[0],p=s.relationships.find(S=>S.type===d&&(S.sourceId===e.node.id&&S.targetId===t.node.id||S.sourceId===t.node.id&&S.targetId===e.node.id));if(p){if(p.named===!1){v({kind:"error",message:"This trace has no declared name, so it cannot be removed until it is named in SysML."});return}await X(p.id);return}const a=s.elements[e.node.id],u=s.elements[t.node.id];if(!a||!u)return;const w=_(a,u,b).find(S=>S.definition.name===d);if(!w){v({kind:"error",message:`${d} is not legal between these element types.`});return}await J(w)},[h,f,s,b,x,J,X]),De=i.useCallback((e,t,n)=>{if(e!=null&&e.diagonal)return{};if(e){const p="#65A30D",a=Math.min(.14+e.strength*.13,.55);return{text:e.strength===1?"✓":String(e.strength),color:p,background:`${p}${Math.round(a*255).toString(16).padStart(2,"0")}`,title:`${t.node.name} ↔ ${n.node.name}
2
+ ${e.types.join(", ")}${h?`
3
+ Click to inspect or remove`:""}`}}return h?t.node.isElement&&n.node.isElement&&t.node.children.length===0&&n.node.children.length===0&&t.node.id!==n.node.id?{actionable:!0,title:`Click to trace ${t.node.name} → ${n.node.name}`}:{}:{}},[h]),I=i.useMemo(()=>{if(!c)return{traced:0,total:0};const e=c.rows.filter(n=>n.node.children.length===0);return{traced:e.filter(n=>{const d=c.rows.indexOf(n);return c.matrix[d].some(p=>p&&!p.diagonal)}).length,total:e.length}},[c]);if(!s||!c)return o.jsx("div",{className:"flex-1 flex items-center justify-center",style:{color:r.faint,fontSize:T.sm},children:"No model loaded"});const m=Re==="left";return o.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",style:{background:"#FAFAF8",position:"relative"},children:[o.jsxs("div",{style:m?{position:"absolute",inset:"0 auto 0 0",width:"250px",zIndex:30,overflow:"auto",borderRight:`1px solid ${r.border}`,background:r.surface}:{borderBottom:`1px solid ${r.border}`,background:r.surface,position:"relative"},children:[o.jsxs("div",{className:"flex items-center gap-3 px-4 py-2",style:m?{flexDirection:"column",alignItems:"stretch",position:"relative",paddingTop:"54px"}:{flexWrap:"wrap",position:"relative",paddingRight:"52px"},children:[o.jsx("span",{style:{position:"absolute",top:"9px",right:"12px"},children:o.jsx(Ge,{icon:m?o.jsx(ee.arrowUp,{}):o.jsx(ee.panelCollapse,{}),onClick:()=>Ee(e=>e==="top"?"left":"top"),title:m?"Move toolbar to top":"Move toolbar to left"})}),o.jsx(Se,{axis:"rows",layers:ce,scope:g,onScopeChange:M,elements:R,onElementsChange:B,elementOptions:U,ordering:H,onOrderingChange:je,onExpandAll:ue,onCollapseAll:me,onExpandToDepth:fe,leftDock:m,filterOpen:se==="rows",onFilterOpenChange:e=>ie(e?"rows":null),parentOf:new Map}),o.jsx(Se,{axis:"columns",layers:ce,scope:y,onScopeChange:O,elements:E,onElementsChange:q,elementOptions:V,ordering:P,onOrderingChange:Te,onExpandAll:ue,onCollapseAll:me,onExpandToDepth:fe,leftDock:m,filterOpen:se==="columns",onFilterOpenChange:e=>ie(e?"columns":null),parentOf:new Map}),o.jsxs("div",{style:{display:"grid",gridTemplateColumns:m?"1fr":"max-content max-content max-content",gridTemplateRows:"auto auto",alignItems:"center",columnGap:"10px",rowGap:"5px",padding:"6px 8px",border:`1px solid ${r.border}`,borderRadius:"9px",background:"#FAFBFC"},children:[o.jsx(ke,{label:o.jsxs(o.Fragment,{children:[o.jsx(ee.filter,{})," Relations"]}),ariaLabel:"Filter trace relationships",title:"Relationships counted as trace",width:m?210:260,fullWidth:m,children:o.jsx(Ke,{label:"Trace relationships",allLabel:"Any relationship",options:Y,selected:x,onChange:W,title:"Relationships counted as trace"})}),o.jsx(ke,{label:"Presets",ariaLabel:"Traceability presets",title:"Choose a traceability starting point",width:m?210:270,fullWidth:m,children:Qe.map(e=>o.jsx("button",{onClick:()=>$e(e),title:e.description,style:{padding:"6px 7px",border:"none",borderRadius:"5px",background:"transparent",cursor:"pointer",fontSize:T.xs,color:r.primary,textAlign:"left"},children:e.label},e.id))}),o.jsxs("label",{title:f?"Click cells to add or remove trace links. Only leaf-to-leaf cells can be edited.":"The dev server is unreachable, so nothing can be written to the model.",style:{display:"flex",alignItems:"center",gap:"6px",fontSize:T.xs,width:m?"100%":void 0,boxSizing:"border-box",padding:"3px 9px",borderRadius:"5px",border:`1px solid ${h?r.accent:r.border}`,background:h?"#E8F8F3":r.surface,color:f?r.primary:r.faint,cursor:f?"pointer":"not-allowed",fontWeight:600},children:[o.jsx("input",{type:"checkbox",checked:h,disabled:!f,onChange:e=>{Fe(e.target.checked),z(null)},style:{accentColor:r.accent}}),"Edit trace"]}),o.jsxs("label",{style:{gridColumn:"1 / -1",display:"flex",alignItems:"center",gap:"5px",fontSize:T.xs,color:r.muted,justifyContent:m?"center":void 0},title:"Cell size",children:["Zoom",o.jsx("input",{type:"range",min:14,max:44,step:2,value:re,onChange:e=>Ie(Number(e.target.value)),style:{width:"80px",accentColor:r.accent}})]})]})]}),$&&o.jsx("div",{style:{padding:"5px 16px",fontSize:"11px",color:$.kind==="ok"?"#0F766E":"#B91C1C",background:$.kind==="ok"?"#ECFDF5":"#FEF2F2",borderTop:`1px solid ${r.borderLight}`},children:$.message})]}),o.jsx("div",{style:{display:"flex",flex:1,minHeight:0,minWidth:0,marginLeft:m?"250px":0,width:m?"calc(100% - 250px)":void 0},children:o.jsx(Pe,{result:c,onToggleRow:e=>G(t=>Ce(t,e)),onToggleColumn:e=>Q(t=>Ce(t,e)),onSelectElement:C,selectedElementId:ve,renderCell:De,onCellClick:(e,t,n)=>{z({row:e,column:t,cell:n}),de("")},onCellDoubleClick:(e,t,n)=>{Le(e,t,n)},cellSize:re,showColumnNames:Me,cornerHeader:o.jsxs("div",{style:{display:"flex",flexDirection:"column",justifyContent:"flex-end",height:"100%"},children:[o.jsx("span",{style:{fontSize:T.sm,fontWeight:600,color:r.primary},children:"Traceability Matrix"}),o.jsxs("span",{style:{fontSize:"11px",color:r.faint,marginTop:"2px"},children:[c.totalDependencies," link",c.totalDependencies===1?"":"s"," shown",I.total>0&&` · ${I.traced}/${I.total} rows traced (${Math.round(I.traced/I.total*100)}%)`]})]})})}),l&&o.jsxs("div",{style:{position:"fixed",bottom:"76px",right:"20px",zIndex:100,width:"330px",maxHeight:"52vh",overflowY:"auto",padding:"12px 14px",borderRadius:"9px",background:r.surface,border:`1px solid ${r.border}`,boxShadow:"0 6px 22px rgba(0,0,0,0.14)",fontSize:T.xs},children:[o.jsxs("div",{className:"flex items-start justify-between gap-2",children:[o.jsxs("div",{style:{fontWeight:600,color:r.primary},children:[l.row.node.name," ","↔"," ",l.column.node.name]}),o.jsx("button",{onClick:()=>z(null),style:{color:r.faint,background:"none",border:"none",cursor:"pointer"},children:"✕"})]}),xe.length>0?o.jsx("div",{style:{marginTop:"9px",display:"flex",flexDirection:"column",gap:"5px"},children:xe.map(e=>{var t,n;return o.jsxs("div",{className:"flex items-center justify-between gap-2",style:{padding:"4px 6px",borderRadius:"5px",background:r.surfaceAlt},children:[o.jsx("span",{style:{color:ye(e.type),fontWeight:500},children:e.type}),o.jsxs("span",{style:{flex:1,color:r.faint,fontSize:"10px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[((t=s.elements[e.sourceId])==null?void 0:t.name)??e.sourceId," ","→"," ",((n=s.elements[e.targetId])==null?void 0:n.name)??e.targetId]}),h&&o.jsx("button",{disabled:L||e.named===!1,onClick:()=>void X(e.id),title:e.named===!1?"This connection has no declared name, so it cannot be addressed for deletion. Name it in the source first.":"Remove this trace link",style:{fontSize:"10px",padding:"1px 6px",borderRadius:"4px",border:"1px solid #FCA5A5",background:"#FEF2F2",color:"#B91C1C",cursor:L||e.named===!1?"not-allowed":"pointer",opacity:e.named===!1?.5:1},children:"Remove"})]},e.id)})}):o.jsx("div",{style:{marginTop:"8px",color:r.muted},children:"No trace between these two."}),((ge=l.cell)==null?void 0:ge.aggregated)&&o.jsx("div",{style:{marginTop:"8px",fontSize:"11px",color:r.faint},children:"This mark sums a collapsed subsystem. Expand both sides to edit individual links."}),h&&o.jsxs("div",{style:{marginTop:"11px",borderTop:`1px solid ${r.borderLight}`,paddingTop:"9px"},children:[o.jsx("div",{style:{fontSize:"11px",color:r.muted,marginBottom:"6px"},children:"Add a trace link"}),Ae?F.length===0?o.jsxs("div",{style:{fontSize:"11px",color:r.faint},children:["The ontology allows no relationship between ",l.row.node.kind," and ",l.column.node.kind,"."]}):o.jsxs(o.Fragment,{children:[F.length>8&&o.jsx("input",{value:A,onChange:e=>de(e.target.value),placeholder:`Filter ${F.length} legal types…`,"aria-label":"Filter link types",style:{width:"100%",marginBottom:"7px",padding:"4px 7px",border:`1px solid ${r.border}`,borderRadius:"5px",fontSize:"11px",outline:"none",color:r.primary}}),o.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:"5px"},children:[he.map(e=>{var n,d;const t=K.has(e.definition.name);return o.jsxs("button",{disabled:L,onClick:()=>void J(e),title:`${((n=s.elements[e.sourceId])==null?void 0:n.name)??e.sourceId} → ${((d=s.elements[e.targetId])==null?void 0:d.name)??e.targetId}`,style:{fontSize:"11px",padding:"3px 8px",borderRadius:"5px",border:`1px solid ${t?r.accent:r.border}`,background:t?"#E8F8F3":r.surface,color:r.primary,cursor:L?"wait":"pointer",fontWeight:t?600:400},children:[e.definition.name,o.jsx("span",{style:{color:r.faint,marginLeft:"4px"},children:e.direction==="outgoing"?"→":"←"})]},`${e.definition.name}-${e.direction}`)}),he.length===0&&o.jsxs("span",{style:{fontSize:"11px",color:r.faint},children:["No legal type matches ","“",A,"”","."]})]})]}):o.jsx("div",{style:{fontSize:"11px",color:r.faint},children:"Both sides must be individual elements. Expand the subsystems first."})]})]})]})}function Ce(s,f){const C=new Set(s);return C.has(f)?C.delete(f):C.add(f),C}export{_e as TraceabilityMatrix};
@@ -0,0 +1 @@
1
+ import{j as n}from"./reactflow-C9OlmOYw.js";import{a as m}from"./zustand-CrhqMOHB.js";import{u as v,E as we,F as Ne,M as Re,I as Be}from"./index-CG-gfw-s.js";import{l as ze,c as _e,a as Fe,E as Se,S as $e,b as Le}from"./ExplorerTreeRow-DUmcEsqf.js";import{b as ie,I as D,T as Te,c as We,a as Ee}from"./DiagramToolbarControls-XMGLx08e.js";const Pe=(r,s,a=.006)=>s.x>=r.x-a&&s.y>=r.y-a&&s.x+s.width<=r.x+r.width+a&&s.y+s.height<=r.y+r.height+a;function Ke(r){const{data:s,width:a,height:d}=r;if(a<8||d<8||s.length<a*d*4)return[];const u=new Uint8Array(a*d);for(let h=0;h<u.length;h++){const g=h*4;u[h]=Math.round(s[g]*.299+s[g+1]*.587+s[g+2]*.114)}const l=new Uint8Array(a*d);for(let h=1;h<d-1;h++)for(let g=1;g<a-1;g++){const b=h*a+g,j=Math.abs(u[b+1]-u[b-1]),F=Math.abs(u[b+a]-u[b-a]);if(j+F>=42)for(let E=-1;E<=1;E++)for(let p=-1;p<=1;p++)l[b+E*a+p]=1}const y=new Uint8Array(a*d),R=[],k=[];for(let h=0;h<l.length;h++){if(!l[h]||y[h])continue;y[h]=1,k.push(h);let g=a,b=d,j=0,F=0,E=0;for(;k.length;){const z=k.pop(),A=z%a,_=Math.floor(z/a);g=Math.min(g,A),j=Math.max(j,A),b=Math.min(b,_),F=Math.max(F,_),E++;for(let N=-1;N<=1;N++)for(let K=-1;K<=1;K++){if(!K&&!N)continue;const C=A+K,G=_+N;if(C<0||G<0||C>=a||G>=d)continue;const M=G*a+C;l[M]&&!y[M]&&(y[M]=1,k.push(M))}}const p=j-g+1,Y=F-b+1,U={x:g/a,y:b/d,width:p/a,height:Y/d},P=U.width*U.height;if(U.width<.07||U.height<.035||P<.004||P>.93)continue;const V=Math.max(1,2*p+2*Y),Q=Math.max(.45,Math.min(.96,E/V));R.push({rect:U,confidence:Q})}const B=[];for(const h of R.sort((g,b)=>b.confidence-g.confidence||b.rect.width*b.rect.height-g.rect.width*g.rect.height))if(B.some(b=>{const j=Math.abs(b.rect.x-h.rect.x),F=Math.abs(b.rect.y-h.rect.y),E=Math.abs(b.rect.width-h.rect.width),p=Math.abs(b.rect.height-h.rect.height);return j+F+E+p<.035})||B.push(h),B.length>=24)break;const S=B.sort((h,g)=>g.rect.width*g.rect.height-h.rect.width*h.rect.height);return S.map((h,g)=>{let b,j=1/0;for(let F=0;F<S.length;F++){if(F===g||!Pe(S[F].rect,h.rect))continue;const E=S[F].rect.width*S[F].rect.height,p=h.rect.width*h.rect.height;E>p*1.08&&E<j&&(b=F,j=E)}return{bounds:h.rect,confidence:h.confidence,parentIndex:b}})}async function He(r){const s=new Image;s.decoding="async",s.src=r,await s.decode();const a=Math.min(1,640/Math.max(s.naturalWidth,s.naturalHeight)),d=Math.max(1,Math.round(s.naturalWidth*a)),u=Math.max(1,Math.round(s.naturalHeight*a)),l=document.createElement("canvas");l.width=d,l.height=u;const y=l.getContext("2d",{willReadFrequently:!0});return y?(y.drawImage(s,0,0,d,u),Ke(y.getImageData(0,0,d,u))):[]}const Ce="memo-uiscreens-width",se=250,oe=200,ae=600;function Oe(){if(typeof window>"u")return se;try{const r=Number.parseInt(localStorage.getItem(Ce)??"",10);return Number.isFinite(r)?Math.min(ae,Math.max(oe,r)):se}catch{return se}}const ve=r=>({"bounds.x":String(Number(r.x.toFixed(5))),"bounds.y":String(Number(r.y.toFixed(5))),"bounds.width":String(Number(r.width.toFixed(5))),"bounds.height":String(Number(r.height.toFixed(5)))}),Xe=(r,s)=>({x:(r.x-s.x)/s.width,y:(r.y-s.y)/s.height,width:r.width/s.width,height:r.height/s.height}),Ye=r=>r?r.startsWith("/")||/^[a-z][a-z0-9+.-]*:/i.test(r)?r:`/${r}`:"";function Ge(r){return new Promise((s,a)=>{const d=new FileReader;d.onerror=()=>a(d.error??new Error("Could not read the image.")),d.onload=()=>{const u=String(d.result),l=new Image;l.onerror=()=>a(new Error("The selected file is not a readable image.")),l.onload=()=>s({base64:u.slice(u.indexOf(",")+1),width:l.naturalWidth,height:l.naturalHeight}),l.src=u},d.readAsDataURL(r)})}function le(r){const s=r.reduce((a,d)=>{const u=[d.id,d.shortId,d.attributes.id].map(l=>/^UIE-(\d+)$/i.exec(l??"")).filter(l=>!!l).map(l=>Number(l[1]));return Math.max(a,...u)},0);return`UIE-${String(s+1).padStart(3,"0")}`}function qe(r){const s=r.reduce((a,d)=>{const u=[d.id,d.shortId,d.attributes.id].map(l=>/^UIA-(\d+)$/i.exec(l??"")).filter(l=>!!l).map(l=>Number(l[1]));return Math.max(a,...u)},0);return`UIA-${String(s+1).padStart(3,"0")}`}function ue(r,s,a){var R;const d=((R=r.match(/(\d+)$/))==null?void 0:R[1])??"1",u=`${s}${Number(d)}`,l=new Set(a.map(k=>k.id));if(!l.has(u))return u;let y=2;for(;l.has(`${u}_${y}`);)y++;return`${u}_${y}`}function je(r,s){const a=s.find(u=>u.id===r.id);if(a)return a;const d=r.name.toLowerCase().replace(/region layout|screen layout|[^a-z0-9]/g,"");return s.find(u=>{const l=u.name.toLowerCase().replace(/[^a-z0-9]/g,"");return l.length>0&&(d.includes(l)||l.includes(d))})}async function he(r,s){var d;const a=Date.now()+1e4;for(;Date.now()<a;){const u=(d=v.getState().model)==null?void 0:d.elements[r];if(u&&u!==s)return;await new Promise(l=>setTimeout(l,100))}throw new Error("The new element was saved, but the rebuilt model did not arrive.")}async function Je(r,s,a){var u;const d=Date.now()+1e4;for(;Date.now()<d;){if((u=v.getState().model)==null?void 0:u.relationships.find(y=>y.type.toLowerCase()===r.toLowerCase()&&y.sourceId===s&&y.targetId===a))return!0;await new Promise(y=>setTimeout(y,100))}return!1}const Ve=(r,s,a)=>{var d;return!!((d=v.getState().model)!=null&&d.relationships.some(u=>u.type.toLowerCase()===r.toLowerCase()&&u.sourceId===s&&u.targetId===a))};function rt(){const r=v(e=>e.model),s=v(e=>e.createModelElement),a=v(e=>e.persistElementAttributes),d=v(e=>e.createRelationship),u=v(e=>e.createDiagram),l=v(e=>e.inspectElement),y=v(e=>e.selectedElementId),R=v(e=>e.deleteModelElement),[k,B]=m.useState(),[S,h]=m.useState(),[g,b]=m.useState(!1),[j,F]=m.useState(""),[E,p]=m.useState(""),[Y,U]=m.useState(!1),[P,V]=m.useState("NewUIScreen"),[Q,z]=m.useState(!1),[A,_]=m.useState([]),[N,K]=m.useState(new Set),[C,G]=m.useState(Oe),M=m.useRef(null),L=m.useCallback(e=>{G(Math.max(oe,Math.min(ae,e)))},[]),Z=m.useCallback(()=>{var e;(e=M.current)==null||e.call(M),M.current=null},[]),Ie=m.useCallback(e=>{if(e.button!==0)return;e.preventDefault(),Z();const t=e.clientX,i=C,o=document.body.style.cursor,c=document.body.style.userSelect;document.body.style.cursor="col-resize",document.body.style.userSelect="none";const f=I=>{L(i+I.clientX-t)},x=()=>{window.removeEventListener("pointermove",f),window.removeEventListener("pointerup",x),window.removeEventListener("pointercancel",x),document.body.style.cursor=o,document.body.style.userSelect=c,M.current=null};M.current=x,window.addEventListener("pointermove",f),window.addEventListener("pointerup",x),window.addEventListener("pointercancel",x)},[L,C,Z]);m.useEffect(()=>{try{localStorage.setItem(Ce,String(Math.round(C)))}catch{}},[C]),m.useEffect(()=>()=>Z(),[Z]);const ee=m.useRef(new Map),de=m.useRef(null),H=m.useMemo(()=>((r==null?void 0:r.diagrams)??[]).filter(e=>e.viewKind==="geometry"),[r]),O=m.useMemo(()=>r?ze(r):[],[r]),te=m.useMemo(()=>r?Object.values(r.elements).filter(e=>{var t;return e.kind==="UIElement"&&((t=e.attributes.formKind)==null?void 0:t.endsWith("screen"))}):[],[r]),$=m.useMemo(()=>H.find(e=>e.id===k),[H,k]),ne=m.useMemo(()=>$?je($,te):void 0,[$,te]),re=m.useMemo(()=>{const e=new Map;for(const t of(r==null?void 0:r.relationships)??[])t.type.toLowerCase()==="capturesscreen"&&e.set(t.sourceId,t.targetId);return e},[r]),q=m.useMemo(()=>ne?O.filter(e=>re.get(e.id)===ne.id):[],[re,O,ne]);if(m.useEffect(()=>{var e;H.some(t=>t.id===k)||B((e=H[0])==null?void 0:e.id)},[H,k]),m.useEffect(()=>{var e;q.some(t=>t.id===S)||h(((e=q[0])==null?void 0:e.id)??"__none__")},[S,q]),m.useEffect(()=>{_([]),ee.current.clear()},[S]),!r)return null;const J=_e(r,{captureId:S}),T=Object.values(r.elements).filter(e=>e.kind==="UIElement"),w=ne??J.screen,ke=new Map(T.map(e=>[e.id,e])),W=new Map;for(const e of r.relationships){if(e.type.toLowerCase()!=="composes")continue;const t=ke.get(e.targetId);t&&W.set(e.sourceId,[...W.get(e.sourceId)??[],t])}const pe=(e,t,i)=>{B(e);const o=t&&i?Le(r,t.id,i.id):t?Fe(r,t.id):void 0;o&&h(o.id),i&&l(i.id)},me=e=>K(t=>{const i=new Set(t);return i.has(e)?i.delete(e):i.add(e),i}),ge=(e,t,i,o)=>n.jsxs("div",{role:"none",children:[n.jsx(Se,{id:`element:${e.id}`,label:n.jsx(we,{element:e}),depth:o,hasChildren:(W.get(e.id)??[]).length>0,expanded:!N.has(`element:${e.id}`),selected:e.id===y,badge:"UIE",badgeColor:"#0F766E",count:(W.get(e.id)??[]).length||void 0,title:`${e.name} · ${e.attributes.formKind??"UIElement"}`,onClick:()=>{(W.get(e.id)??[]).length&&me(`element:${e.id}`),pe(t,i,e)},onDelete:()=>R(e.id)}),!N.has(`element:${e.id}`)&&(W.get(e.id)??[]).map(c=>ge(c,t,i,o+1))]},e.id),ce=async(e,t,i)=>{let o="";for(let c=0;c<3;c++){if(Ve(e,t,i))return;const f=await d({type:e,sourceId:t,targetId:i,direction:"outgoing",selectedElementId:t});if(f.success&&await Je(e,t,i))return;o=f.success?"The relationship was written but did not appear in the rebuilt model.":f.error??"The relationship could not be created.",await new Promise(x=>setTimeout(x,250*(c+1)))}throw new Error(o||`Could not connect ${i} beneath ${t}.`)},fe=async()=>{var t,i,o;const e=P.trim();if(e){p("Creating UI screen…");try{const c=le(T),f=ue(c,"uiElement",T),x=s({id:f,name:e,kind:"UIElement",construct:"part",layer:"implementation",file:"model/generated.sysml",doc:"",attributes:{id:c,description:`Root user-interface screen ${e}.`,formKind:"UIElementFormKind::screen",disclosureKind:"UIDisclosureKind::inline",detectionMethod:"BoundsDetectionKind::manual","bounds.x":"0","bounds.y":"0","bounds.width":"1","bounds.height":"1"}});await he(x,(t=v.getState().model)==null?void 0:t.elements[x]);const I=((o=(i=r.viewpoints)==null?void 0:i.find(X=>X.label.toLowerCase().includes("ui layout")))==null?void 0:o.id)??"__model";u({id:c,name:`${e} — Region Layout`,diagramType:"bdd",viewKind:"geometry",viewpointId:I,elementIds:[f],activate:!1}),B(c),h("__none__"),l(f),U(!1),V("NewUIScreen"),p("UI screen created. Choose a capture asset or upload one.")}catch(c){p(c instanceof Error?c.message:String(c))}}},Me=async e=>{if(!w)return p("Create or select a UI screen first.");const t=re.get(e.id);if(t&&t!==w.id){const i=Object.values(r.elements).find(o=>o.id===t);return p(`“${e.name}” already depicts ${(i==null?void 0:i.name)??t}; duplicate the asset before reassigning it.`)}try{t||await ce("CapturesScreen",e.id,w.id),h(e.id),z(!1),p(`Using capture asset “${e.name}”.`)}catch(i){p(i instanceof Error?i.message:String(i))}},xe=async(e,t={})=>{var i,o;if(!w){p("Add or capture a screen before drawing regions.");return}p("Saving region…");try{const c=le(T),f=ue(c,"uiElement",T);return s({id:f,name:((i=t.name)==null?void 0:i.trim())||`Region ${c}`,kind:"UIElement",construct:"part",layer:w.layer,file:w.file||"model/generated.sysml",doc:"",attributes:{id:c,...ve(e),formKind:"UIElementFormKind::panel",disclosureKind:"UIDisclosureKind::inline",detectionMethod:t.automatic?"BoundsDetectionKind::automaticConfirmed":"BoundsDetectionKind::manual",...t.confidence!==void 0?{detectionConfidence:String(Number(t.confidence.toFixed(3)))}:{},...t.automatic?{confirmedBy:"currentReviewer",confirmedAt:new Date().toISOString()}:{},boundaryColor:"#14B8A6",boundaryOpacity:"0.12"}}),await he(f,(o=v.getState().model)==null?void 0:o.elements[f]),await ce("Composes",t.parentElementId??w.id,f),b(!1),p("Region saved."),f}catch(c){p(c instanceof Error?c.message:String(c));return}},De=async e=>{var t,i;if(!$||!w)return p("Choose a geometry view with a screen before uploading.");p("Saving capture…");try{const o=await Ge(e),c=e.name.toLowerCase().split(".").pop(),f=e.type||(c==="png"?"image/png":c==="webp"?"image/webp":c==="jpg"||c==="jpeg"?"image/jpeg":"");if(!f)throw new Error("Choose a PNG, JPEG, or WebP capture.");const x=await Be({viewName:$.name,fileName:e.name,base64:o.base64,mediaType:f});if(!x.success||!x.imageUri||!x.imageHash)throw new Error(x.error||"Capture upload failed.");const I=qe(O),X=s({id:ue(I,"uiAsset",O),name:`${w.name} capture`,kind:"ScreenCapture",construct:"part",layer:w.layer,file:w.file||"model/generated.sysml",doc:"",attributes:{id:I,imageUri:x.imageUri,imageHash:x.imageHash,pixelWidth:String(o.width),pixelHeight:String(o.height),capturedBuild:j.trim(),captureContext:$.name}});await he(X,(t=v.getState().model)==null?void 0:t.elements[X]),await ce("CapturesScreen",X,w.id);for(const ye of T)(i=ye.attributes.detectionMethod)!=null&&i.endsWith("automatic")&&a(ye.id,{confirmedBy:"",confirmedAt:""});h(X),p("Capture saved; automatic regions require confirmation.")}catch(o){p(o instanceof Error?o.message:String(o))}},Ae=async()=>{if(!J.imageUri)return p("Attach a screen-capture asset before detecting regions.");p("Detecting nested boundaries…");try{const t=(await He(J.imageUri)).map((i,o)=>({id:`proposal-${o+1}`,bounds:i.bounds,confidence:i.confidence,parentId:i.parentIndex!==void 0?`proposal-${i.parentIndex+1}`:void 0,status:"pending"}));ee.current.clear(),_(t),p(t.length?`${t.length} boundary proposal${t.length===1?"":"s"} found. Accept or reject each box.`:"No strong rectangular boundaries were detected; draw regions manually.")}catch(e){p(e instanceof Error?e.message:String(e))}},be=async e=>{const t=ee.current.get(e);if(t)return t;const i=A.find(x=>x.id===e);if(!i||i.status==="rejected")return;let o,c=i.bounds;if(i.parentId){const x=A.find(I=>I.id===i.parentId);x&&x.status!=="rejected"&&(o=await be(x.id),o&&(c=Xe(i.bounds,x.bounds)))}const f=await xe(c,{parentElementId:o,automatic:!0,confidence:i.confidence});return f&&(ee.current.set(e,f),_(x=>x.map(I=>I.id===e?{...I,status:"accepted"}:I))),f},Ue=e=>{const t=new Set([e]);let i=!0;for(;i;){i=!1;for(const o of A)o.parentId&&t.has(o.parentId)&&!t.has(o.id)&&(t.add(o.id),i=!0)}_(o=>o.map(c=>t.has(c.id)?{...c,status:"rejected"}:c)),p(`Rejected ${t.size} proposal${t.size===1?"":"s"}.`)};return n.jsxs("div",{className:"flex flex-1 min-h-0 relative",style:{background:"#F7F7F5"},children:[n.jsxs("aside",{style:{width:C,position:"relative",flexShrink:0,borderRight:"1px solid #E5E5E0",background:"#FFFFFF",padding:"16px 12px",overflowY:"auto"},children:[n.jsxs("div",{className:"flex items-center",style:{margin:"0 8px 4px"},children:[n.jsx("h1",{style:{margin:0,flex:1,color:"#1B3A4B",fontSize:18,fontWeight:700},children:"UI Screens"}),n.jsx(ie,{icon:n.jsx(D.plus,{}),ariaLabel:"Add UI element",title:"Create a root UIElement screen",onClick:()=>U(e=>!e),active:Y})]}),n.jsx("p",{style:{margin:"0 8px 16px",color:"#6B7280",fontSize:12},children:"Capture, mark up, and trace screen regions."}),Y&&n.jsxs("div",{style:{margin:"0 4px 12px",padding:10,background:"#F7F7F5",border:"1px solid #E5E5E0",borderRadius:8},children:[n.jsx("label",{style:{display:"block",color:"#6B7280",fontSize:10,fontWeight:600,marginBottom:4},children:"UI ELEMENT NAME"}),n.jsx("input",{"aria-label":"New UI screen name",value:P,onChange:e=>V(e.target.value),onKeyDown:e=>{e.key==="Enter"&&fe()},style:{width:"100%",border:"1px solid #D8D8D2",borderRadius:6,padding:"6px 8px",fontSize:12}}),n.jsxs("div",{className:"flex gap-2",style:{marginTop:8},children:[n.jsx("button",{onClick:()=>void fe(),disabled:!P.trim(),style:{flex:1,border:0,borderRadius:6,padding:"5px 8px",background:"#1B3A4B",color:"#FFFFFF",fontSize:11,cursor:"pointer"},children:"Create screen"}),n.jsx("button",{onClick:()=>U(!1),style:{border:"1px solid #D8D8D2",borderRadius:6,padding:"5px 8px",background:"#FFFFFF",color:"#4B5563",fontSize:11,cursor:"pointer"},children:"Cancel"})]})]}),n.jsx("div",{role:"tree","aria-label":"UI screen hierarchy",children:H.map(e=>{const t=je(e,te)??te.find(c=>{var f;return((f=Fe(r,c.id))==null?void 0:f.attributes.captureContext)===e.name});if(!t)return null;const i=`screen:${t.id}`,o=W.get(t.id)??[];return n.jsxs("div",{role:"none",style:{marginBottom:4},children:[n.jsx(Se,{id:i,label:n.jsx(we,{element:t}),depth:0,hasChildren:o.length>0,expanded:!N.has(i),selected:t.id===y,badge:"UIE",badgeColor:"#0F766E",title:"Root UIElement screen",onClick:()=>{o.length&&me(i),pe(e.id,t,t)},onDelete:()=>R(t.id)}),!N.has(i)&&n.jsx("div",{role:"group",children:o.map(c=>ge(c,e.id,t,1))})]},i)})}),n.jsx("div",{className:"memo-explorer-resizer",role:"separator","aria-label":"Resize UI Screens Explorer","aria-orientation":"vertical","aria-valuemin":oe,"aria-valuemax":ae,"aria-valuenow":Math.round(C),tabIndex:0,title:"Drag to resize · Double-click to reset",onPointerDown:Ie,onDoubleClick:()=>L(se),onKeyDown:e=>{e.key==="ArrowLeft"?(e.preventDefault(),L(C-20)):e.key==="ArrowRight"?(e.preventDefault(),L(C+20)):e.key==="Home"?(e.preventDefault(),L(oe)):e.key==="End"&&(e.preventDefault(),L(ae))}})]}),n.jsx("main",{className:"flex-1 flex flex-col min-w-0 relative",children:$?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"flex items-center px-3 py-2",style:{minHeight:48,background:"#F7F7F5",borderBottom:"1px solid #E5E5E0"},children:n.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-lg",style:{width:"fit-content",maxWidth:"100%",background:"#FFFFFF",border:"1px solid #E5E5E0",boxShadow:"0 1px 4px rgba(0,0,0,0.06)"},children:[n.jsx("span",{title:"Choose the independent capture asset used as the canvas backdrop",children:n.jsx(D.capture,{})}),n.jsxs("select",{"aria-label":"Attached screen capture",value:S??"__none__",onChange:e=>h(e.target.value),className:"text-xs font-semibold rounded-lg px-2 py-1",style:{color:"#5B6470",background:"#FFFFFF",border:"1px solid #E2E1DB",maxWidth:220},children:[q.length===0&&n.jsx("option",{value:"__none__",children:"No capture attached"}),q.map(e=>n.jsx("option",{value:e.id,children:e.name},e.id))]}),n.jsx(ie,{icon:n.jsx(D.info,{}),onClick:()=>J.capture&&l(J.capture.id),ariaLabel:"Inspect capture asset",title:"Open this ScreenCapture asset in Properties"}),n.jsx(ie,{icon:n.jsx(D.library,{}),label:"Assets",active:Q,onClick:()=>z(e=>!e),title:"Choose a ScreenCapture from the asset library"}),n.jsx("input",{"aria-label":"New capture asset build",value:j,onChange:e=>F(e.target.value),placeholder:"Asset build",title:"Software build that produced the new capture asset",className:"text-xs rounded-lg px-2 py-1",style:{width:112,color:"#5B6470",background:"#FFFFFF",border:"1px solid #E2E1DB"}}),n.jsx(Te,{children:n.jsx(ie,{icon:n.jsx(D.upload,{}),label:"Add capture",onClick:()=>{var e;return(e=de.current)==null?void 0:e.click()},title:"Create a ScreenCapture asset from a PNG, JPEG, or WebP image"})}),n.jsx("input",{ref:de,type:"file",accept:"image/png,image/jpeg,image/webp",hidden:!0,onChange:e=>{var t;return((t=e.target.files)==null?void 0:t[0])&&De(e.target.files[0])}}),n.jsx(We,{}),n.jsx(Ee,{icon:n.jsx(D.rectangle,{}),label:g?"Cancel drawing":"Add region",active:g,onClick:()=>b(e=>!e),title:"Drag a rectangle, then edit the region in Properties"}),n.jsx(Ee,{icon:n.jsx(D.detect,{}),label:"Detect",active:A.some(e=>e.status==="pending"),badge:A.filter(e=>e.status==="pending").length||void 0,onClick:()=>void Ae(),title:"Propose nested regions from detected image boundaries"}),E&&n.jsx("span",{role:"status",className:"truncate",style:{marginLeft:"auto",fontSize:Ne.xs,color:"#6B7280",maxWidth:180},children:E})]})}),S==="__none__"?n.jsx("div",{className:"flex-1 flex items-center justify-center p-8",style:{background:"#F7F7F5"},children:n.jsxs("div",{style:{width:"min(560px, 100%)",padding:28,textAlign:"center",background:"#FFFFFF",border:"1px solid #E5E5E0",borderRadius:14,boxShadow:"0 4px 18px rgba(15,23,42,0.06)"},children:[n.jsx("div",{style:{display:"inline-flex",padding:12,borderRadius:12,background:"#E1F5EE",color:"#0F766E"},children:n.jsx(D.capture,{size:28})}),n.jsxs("h2",{style:{margin:"14px 0 6px",color:"#1B3A4B",fontSize:18,fontWeight:700},children:["Add a visual asset to ",w==null?void 0:w.name]}),n.jsx("p",{style:{margin:"0 auto 18px",maxWidth:430,color:"#6B7280",fontSize:12,lineHeight:1.5},children:"Upload a new screen capture or link an existing ScreenCapture from the asset library. The asset remains independent and is connected through CapturesScreen."}),n.jsxs("div",{className:"flex justify-center gap-2",children:[n.jsxs("button",{onClick:()=>{var e;return(e=de.current)==null?void 0:e.click()},className:"flex items-center gap-2",style:{padding:"8px 13px",border:0,borderRadius:8,background:"#1B3A4B",color:"#FFFFFF",cursor:"pointer",fontSize:12,fontWeight:600},children:[n.jsx(D.upload,{})," Upload screen capture"]}),n.jsxs("button",{onClick:()=>z(!0),className:"flex items-center gap-2",style:{padding:"8px 13px",border:"1px solid #D8D8D2",borderRadius:8,background:"#FFFFFF",color:"#374151",cursor:"pointer",fontSize:12,fontWeight:600},children:[n.jsx(D.library,{})," Choose from asset library"]})]}),n.jsx("p",{style:{margin:"14px 0 0",color:"#9CA3AF",fontSize:10},children:"You can also create the CapturesScreen relationship later in Properties."})]})}):n.jsx($e,{diagram:$,model:r,captureId:S,editable:!0,drawMode:g,newElementDefaultName:`Region ${le(T)}`,proposals:A,onAcceptProposal:e=>void be(e),onRejectProposal:Ue,onCreateBounds:(e,t)=>void xe(e,{name:t}),onBoundsChange:(e,t)=>a(e,ve(t))}),Q&&n.jsx("div",{className:"absolute inset-0 flex items-start justify-center",onMouseDown:e=>{e.target===e.currentTarget&&z(!1)},style:{zIndex:50,paddingTop:70,background:"#0F172A33",backdropFilter:"blur(1px)"},children:n.jsxs("div",{role:"dialog","aria-label":"ScreenCapture asset library",style:{width:"min(720px, calc(100% - 40px))",maxHeight:"calc(100% - 100px)",overflowY:"auto",background:"#FFFFFF",border:"1px solid #D1D5DB",borderRadius:12,boxShadow:"0 18px 50px rgba(15,23,42,0.22)"},children:[n.jsxs("div",{className:"flex items-center",style:{position:"sticky",top:0,zIndex:2,padding:"12px 14px",background:"#FFFFFF",borderBottom:"1px solid #E5E5E0"},children:[n.jsxs("div",{style:{flex:1},children:[n.jsx("strong",{style:{color:"#1B3A4B",fontSize:14},children:"ScreenCapture asset library"}),n.jsx("div",{style:{color:"#6B7280",fontSize:10},children:"Choose an unassigned asset or one already linked to this screen."})]}),n.jsx("button",{"aria-label":"Close asset library",onClick:()=>z(!1),style:{width:28,height:28,border:0,borderRadius:6,background:"#F0F0ED",color:"#4B5563",cursor:"pointer"},children:"×"})]}),n.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(205px, 1fr))",gap:10,padding:12},children:[O.length===0&&n.jsx("div",{style:{gridColumn:"1 / -1",padding:28,textAlign:"center",color:"#9CA3AF",fontSize:12},children:"No capture assets yet. Upload the first capture."}),O.map(e=>{const t=re.get(e.id),i=t?Object.values(r.elements).find(c=>c.id===t):void 0,o=!t||t===(w==null?void 0:w.id);return n.jsxs("button",{disabled:!o,onClick:()=>void Me(e),style:{display:"block",minWidth:0,padding:0,overflow:"hidden",textAlign:"left",border:`1px solid ${e.id===S?"#2DD4A8":"#E5E5E0"}`,borderRadius:9,background:e.id===S?"#F0FDFA":"#FFFFFF",color:o?"#374151":"#9CA3AF",cursor:o?"pointer":"not-allowed",opacity:o?1:.58},children:[n.jsx("div",{style:{height:118,background:"#F3F4F6",borderBottom:"1px solid #E5E5E0"},children:e.attributes.imageUri?n.jsx("img",{src:Ye(e.attributes.imageUri),alt:"",style:{width:"100%",height:"100%",objectFit:"contain"}}):n.jsx("div",{className:"flex items-center justify-center h-full",children:n.jsx(D.capture,{size:28})})}),n.jsxs("div",{style:{padding:"8px 9px"},children:[n.jsx("div",{className:"truncate",style:{fontSize:11,fontWeight:650},children:e.name}),n.jsx("div",{className:"truncate",style:{fontSize:10,marginTop:3},children:i?`Depicts ${i.name}`:"Unassigned asset"}),e.attributes.capturedBuild&&n.jsx("div",{className:"truncate",style:{fontSize:9,color:"#9CA3AF",marginTop:2},children:e.attributes.capturedBuild})]})]},e.id)})]})]})})]}):n.jsx("div",{className:"flex-1 flex items-center justify-center",style:{color:"#6B7280",textAlign:"center"},children:n.jsxs("div",{children:[n.jsx("div",{style:{display:"flex",justifyContent:"center",marginBottom:4},children:n.jsx(Re,{size:190})}),n.jsx("h2",{style:{color:"#374151",fontSize:18},children:"No screen-layout views"}),n.jsx("p",{children:"Add a MemoScreenLayoutView to begin."})]})})})]})}export{rt as UiScreensWorkspace,qe as nextUiAssetId,le as nextUiElementId,ue as usageIdentifier};
@@ -1 +1 @@
1
- import{j as t}from"./reactflow-s7jmJtXx.js";import{a as x}from"./zustand-CrhqMOHB.js";import{u as p}from"./index-Bij8Q4Kg.js";const l=[{id:"setup",icon:"🎯",title:"Set Up Your Device",description:"Define who your device is for, what it does, and who uses it. Start with actors and intended use.",standard:"IEC 62366 · ISO 14971 §4",getCount:e=>Object.values(e.elements).filter(s=>["actor","stakeholder","usecase","goal"].includes(s.kind.toLowerCase())).length,getTarget:()=>3,actionLabel:"Browse Model",actionView:"model",getDetails:e=>{const s=Object.values(e.elements).filter(n=>n.kind.toLowerCase()==="actor").length,i=Object.values(e.elements).filter(n=>n.kind.toLowerCase()==="usecase").length;return`${s} actor(s) · ${i} use case(s)`}},{id:"requirements",icon:"📋",title:"Define Requirements",description:"Capture user needs and system requirements. These form the basis of your V&V plan.",standard:"IEC 62304 §5.2 · 21 CFR 820.30(c)",getCount:e=>Object.values(e.elements).filter(s=>["systemrequirement","requirement","userneed"].includes(s.kind.toLowerCase())).length,getTarget:()=>5,actionLabel:"View Catalog",actionView:"catalog",getDetails:e=>{const s=Object.values(e.elements).filter(n=>n.kind.toLowerCase()==="userneed").length,i=Object.values(e.elements).filter(n=>["systemrequirement","requirement"].includes(n.kind.toLowerCase())).length;return`${s} user need(s) · ${i} system requirement(s)`}},{id:"hazards",icon:"⚠️",title:"Identify Hazards",description:"List all hazards your device could cause. Add hazardous situations and potential harms.",standard:"ISO 14971 §5–6",getCount:e=>Object.values(e.elements).filter(s=>["hazard","hazardoussituation","harm"].includes(s.kind.toLowerCase())).length,getTarget:()=>3,actionLabel:"Browse Risk Layer",actionView:"model",getDetails:e=>{const s=Object.values(e.elements).filter(n=>n.kind.toLowerCase()==="hazard").length,i=Object.values(e.elements).filter(n=>n.kind.toLowerCase()==="harm").length;return`${s} hazard(s) · ${i} harm(s)`}},{id:"risk-controls",icon:"🔗",title:"Connect Risk Chain",description:"Add risk controls and connect them to hazards with Mitigates relationships. Verify the ISO 14971 chain.",standard:"ISO 14971 §7–8",getCount:e=>e.relationships.filter(s=>s.type.toLowerCase()==="mitigates").length,getTarget:()=>2,actionLabel:"Traceability Matrix",actionView:"traceability",getDetails:e=>{const s=Object.values(e.elements).filter(n=>n.kind.toLowerCase()==="riskcontrol").length,i=e.relationships.filter(n=>n.type.toLowerCase()==="mitigates").length;return`${s} risk control(s) · ${i} mitigates link(s)`}},{id:"architecture",icon:"🏗️",title:"Define Architecture",description:"Add system and subsystem elements. This grounds requirements to real components.",standard:"IEC 62304 §5.3 · ISO 14971 §9",getCount:e=>Object.values(e.elements).filter(s=>["system","subsystem","logicalcomponent","softwarecomponent"].includes(s.kind.toLowerCase())).length,getTarget:()=>3,actionLabel:"Browse Model",actionView:"model",getDetails:e=>{const s=Object.values(e.elements).filter(n=>["system","subsystem"].includes(n.kind.toLowerCase())).length,i=Object.values(e.elements).filter(n=>n.kind.toLowerCase()==="softwarecomponent").length;return`${s} system/subsystem · ${i} software component(s)`}},{id:"verification",icon:"🧪",title:"Link Verification",description:"Add tests and link them to requirements. This closes the V&V loop and prepares your design review package.",standard:"IEC 62304 §5.7–5.8 · 21 CFR 820.30(g)",getCount:e=>Object.values(e.elements).filter(s=>s.kind.toLowerCase()==="test").length,getTarget:()=>3,actionLabel:"Traceability Matrix",actionView:"traceability",getDetails:e=>{const s=Object.values(e.elements).filter(n=>n.kind.toLowerCase()==="test").length,i=e.relationships.filter(n=>["satisfies","refines","traces","verifies"].includes(n.type.toLowerCase())).length;return`${s} test(s) · ${i} traceability link(s)`}}];function m({step:e,index:s,isActive:i,model:n,onSelect:d,onAction:c}){const r=e.getCount(n),o=e.getTarget(),a=r>=o,u=Math.min(100,Math.round(r/o*100)),h=e.getDetails(n),g=a?"#2ECC71":r>0?"#F39C12":"#E5E5E0";return t.jsxs("button",{onClick:d,style:{textAlign:"left",background:i?"#FFFFFF":"transparent",border:`1px solid ${i?"#1B3A4B20":"transparent"}`,borderRadius:"10px",padding:"14px 16px",cursor:"pointer",width:"100%",transition:"all 0.15s",boxShadow:i?"0 2px 8px rgba(0,0,0,0.06)":"none"},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px"},children:[t.jsx("div",{style:{width:"28px",height:"28px",borderRadius:"50%",flexShrink:0,background:a?"#2ECC71":i?"#1B3A4B":"#F3F4F6",color:a||i?"#FFFFFF":"#6B7280",display:"flex",alignItems:"center",justifyContent:"center",fontSize:a?"14px":"12px",fontWeight:700},children:a?"✓":s+1}),t.jsxs("div",{style:{flex:1,minWidth:0},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px"},children:[t.jsxs("span",{style:{fontSize:"13px",fontWeight:700,color:i?"#1B3A4B":"#374151"},children:[e.icon," ",e.title]}),r>0&&t.jsx("span",{style:{fontSize:"10px",fontWeight:600,padding:"1px 6px",borderRadius:"999px",background:g+"20",color:g},children:r})]}),h&&t.jsx("div",{style:{fontSize:"11px",color:"#9CA3AF",marginTop:"2px"},children:h})]}),t.jsxs("div",{style:{width:"40px",textAlign:"right",fontSize:"10px",color:"#9CA3AF",flexShrink:0},children:[u,"%"]})]}),t.jsx("div",{style:{marginTop:"8px",height:"3px",background:"#F3F4F6",borderRadius:"2px",marginLeft:"38px"},children:t.jsx("div",{style:{height:"100%",borderRadius:"2px",background:g,width:`${u}%`,transition:"width 0.4s ease"}})})]})}function f({step:e,model:s,onAction:i}){const n=e.getCount(s),d=e.getTarget(),c=n>=d;return t.jsxs("div",{style:{background:"#FFFFFF",border:"1px solid #E5E5E0",borderRadius:"12px",padding:"24px"},children:[t.jsx("div",{style:{fontSize:"32px",marginBottom:"12px"},children:e.icon}),t.jsx("h2",{style:{fontSize:"18px",fontWeight:800,color:"#1B3A4B",margin:"0 0 6px 0"},children:e.title}),t.jsx("div",{style:{fontSize:"11px",fontWeight:600,color:"#9CA3AF",marginBottom:"12px",fontFamily:"monospace"},children:e.standard}),t.jsx("p",{style:{fontSize:"13px",color:"#4B6E80",lineHeight:"1.7",margin:"0 0 20px 0"},children:e.description}),t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",padding:"14px 16px",borderRadius:"8px",background:c?"#2ECC7110":n>0?"#F39C1210":"#F3F4F6",marginBottom:"20px"},children:[t.jsx("div",{style:{fontSize:"24px",fontWeight:800,color:c?"#2ECC71":n>0?"#F39C12":"#9CA3AF"},children:n}),t.jsxs("div",{children:[t.jsx("div",{style:{fontSize:"13px",fontWeight:600,color:"#374151"},children:c?`✓ Target reached (${d}+ recommended)`:`${d-n} more recommended`}),t.jsx("div",{style:{fontSize:"11px",color:"#9CA3AF"},children:e.getDetails(s)})]})]}),t.jsxs("button",{onClick:()=>i(e.actionView),style:{width:"100%",padding:"12px",borderRadius:"8px",background:"#1B3A4B",color:"#FFFFFF",border:"none",fontSize:"13px",fontWeight:600,cursor:"pointer",transition:"background 0.15s"},onMouseEnter:r=>r.currentTarget.style.background="#244D63",onMouseLeave:r=>r.currentTarget.style.background="#1B3A4B",children:[e.actionLabel," →"]})]})}function y({model:e}){const s=l.filter(n=>n.getCount(e)>=n.getTarget()).length,i=Math.round(s/l.length*100);return t.jsxs("div",{style:{padding:"16px 20px",background:"#FFFFFF",borderRadius:"12px",border:"1px solid #E5E5E0",marginBottom:"16px"},children:[t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"8px"},children:[t.jsx("span",{style:{fontSize:"13px",fontWeight:700,color:"#1B3A4B"},children:"Golden Path Progress"}),t.jsxs("span",{style:{fontSize:"13px",fontWeight:700,color:"#1B3A4B"},children:[s,"/",l.length," steps"]})]}),t.jsx("div",{style:{height:"6px",background:"#F3F4F6",borderRadius:"3px"},children:t.jsx("div",{style:{height:"100%",borderRadius:"3px",background:i>=100?"#2ECC71":"#2DD4A8",width:`${i}%`,transition:"width 0.4s ease"}})})]})}function j(){const e=p(o=>o.model),s=p(o=>o.setActiveView),i=p(o=>o.setExplorerTab),n=x.useMemo(()=>{if(!e)return 0;for(let o=0;o<l.length;o++)if(l[o].getCount(e)<l[o].getTarget())return o;return l.length-1},[e]),[d,c]=x.useState(n);if(!e)return t.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",background:"#F7F7F5"},children:t.jsx("div",{style:{fontSize:"13px",color:"#9CA3AF"},children:"No model data"})});function r(o){switch(o){case"model":i("model"),s({type:"dashboard"});break;case"traceability":s({type:"traceability"});break;case"statistics":s({type:"statistics"});break;case"catalog":i("model"),s({type:"dashboard"});break}}return t.jsx("div",{style:{flex:1,overflowY:"auto",background:"#F7F7F5",padding:"28px 40px"},children:t.jsxs("div",{style:{maxWidth:"960px",margin:"0 auto"},children:[t.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",marginBottom:"20px"},children:[t.jsxs("div",{children:[t.jsx("h1",{style:{fontSize:"20px",fontWeight:800,color:"#1B3A4B",margin:"0 0 4px 0"},children:"Workflow Wizard"}),t.jsx("p",{style:{fontSize:"12px",color:"#6B7280",margin:0},children:"Follow the golden path to a complete, review-ready device model"})]}),t.jsx("button",{onClick:()=>s({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"})]}),t.jsx(y,{model:e}),t.jsxs("div",{style:{display:"grid",gridTemplateColumns:"380px 1fr",gap:"16px"},children:[t.jsx("div",{style:{background:"#F9FAFB",border:"1px solid #E5E5E0",borderRadius:"12px",padding:"8px",display:"flex",flexDirection:"column",gap:"2px"},children:l.map((o,a)=>t.jsx(m,{step:o,index:a,isActive:a===d,model:e,onSelect:()=>c(a),onAction:r},o.id))}),t.jsx(f,{step:l[d],model:e,onAction:r})]})]})})}export{j as WorkflowWizard};
1
+ import{j as t}from"./reactflow-C9OlmOYw.js";import{a as x}from"./zustand-CrhqMOHB.js";import{u as p}from"./index-CG-gfw-s.js";const l=[{id:"setup",icon:"🎯",title:"Set Up Your Device",description:"Define who your device is for, what it does, and who uses it. Start with actors and intended use.",standard:"IEC 62366 · ISO 14971 §4",getCount:e=>Object.values(e.elements).filter(s=>["actor","stakeholder","usecase","goal"].includes(s.kind.toLowerCase())).length,getTarget:()=>3,actionLabel:"Browse Model",actionView:"model",getDetails:e=>{const s=Object.values(e.elements).filter(n=>n.kind.toLowerCase()==="actor").length,i=Object.values(e.elements).filter(n=>n.kind.toLowerCase()==="usecase").length;return`${s} actor(s) · ${i} use case(s)`}},{id:"requirements",icon:"📋",title:"Define Requirements",description:"Capture user needs and system requirements. These form the basis of your V&V plan.",standard:"IEC 62304 §5.2 · 21 CFR 820.30(c)",getCount:e=>Object.values(e.elements).filter(s=>["systemrequirement","requirement","userneed"].includes(s.kind.toLowerCase())).length,getTarget:()=>5,actionLabel:"View Catalog",actionView:"catalog",getDetails:e=>{const s=Object.values(e.elements).filter(n=>n.kind.toLowerCase()==="userneed").length,i=Object.values(e.elements).filter(n=>["systemrequirement","requirement"].includes(n.kind.toLowerCase())).length;return`${s} user need(s) · ${i} system requirement(s)`}},{id:"hazards",icon:"⚠️",title:"Identify Hazards",description:"List all hazards your device could cause. Add hazardous situations and potential harms.",standard:"ISO 14971 §5–6",getCount:e=>Object.values(e.elements).filter(s=>["hazard","hazardoussituation","harm"].includes(s.kind.toLowerCase())).length,getTarget:()=>3,actionLabel:"Browse Risk Layer",actionView:"model",getDetails:e=>{const s=Object.values(e.elements).filter(n=>n.kind.toLowerCase()==="hazard").length,i=Object.values(e.elements).filter(n=>n.kind.toLowerCase()==="harm").length;return`${s} hazard(s) · ${i} harm(s)`}},{id:"risk-controls",icon:"🔗",title:"Connect Risk Chain",description:"Add risk controls and connect them to hazards with Mitigates relationships. Verify the ISO 14971 chain.",standard:"ISO 14971 §7–8",getCount:e=>e.relationships.filter(s=>s.type.toLowerCase()==="mitigates").length,getTarget:()=>2,actionLabel:"Traceability Matrix",actionView:"traceability",getDetails:e=>{const s=Object.values(e.elements).filter(n=>n.kind.toLowerCase()==="riskcontrol").length,i=e.relationships.filter(n=>n.type.toLowerCase()==="mitigates").length;return`${s} risk control(s) · ${i} mitigates link(s)`}},{id:"architecture",icon:"🏗️",title:"Define Architecture",description:"Add system and subsystem elements. This grounds requirements to real components.",standard:"IEC 62304 §5.3 · ISO 14971 §9",getCount:e=>Object.values(e.elements).filter(s=>["system","subsystem","logicalcomponent","softwarecomponent"].includes(s.kind.toLowerCase())).length,getTarget:()=>3,actionLabel:"Browse Model",actionView:"model",getDetails:e=>{const s=Object.values(e.elements).filter(n=>["system","subsystem"].includes(n.kind.toLowerCase())).length,i=Object.values(e.elements).filter(n=>n.kind.toLowerCase()==="softwarecomponent").length;return`${s} system/subsystem · ${i} software component(s)`}},{id:"verification",icon:"🧪",title:"Link Verification",description:"Add tests and link them to requirements. This closes the V&V loop and prepares your design review package.",standard:"IEC 62304 §5.7–5.8 · 21 CFR 820.30(g)",getCount:e=>Object.values(e.elements).filter(s=>s.kind.toLowerCase()==="test").length,getTarget:()=>3,actionLabel:"Traceability Matrix",actionView:"traceability",getDetails:e=>{const s=Object.values(e.elements).filter(n=>n.kind.toLowerCase()==="test").length,i=e.relationships.filter(n=>["satisfies","refines","traces","verifies"].includes(n.type.toLowerCase())).length;return`${s} test(s) · ${i} traceability link(s)`}}];function m({step:e,index:s,isActive:i,model:n,onSelect:d,onAction:c}){const r=e.getCount(n),o=e.getTarget(),a=r>=o,u=Math.min(100,Math.round(r/o*100)),h=e.getDetails(n),g=a?"#2ECC71":r>0?"#F39C12":"#E5E5E0";return t.jsxs("button",{onClick:d,style:{textAlign:"left",background:i?"#FFFFFF":"transparent",border:`1px solid ${i?"#1B3A4B20":"transparent"}`,borderRadius:"10px",padding:"14px 16px",cursor:"pointer",width:"100%",transition:"all 0.15s",boxShadow:i?"0 2px 8px rgba(0,0,0,0.06)":"none"},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px"},children:[t.jsx("div",{style:{width:"28px",height:"28px",borderRadius:"50%",flexShrink:0,background:a?"#2ECC71":i?"#1B3A4B":"#F3F4F6",color:a||i?"#FFFFFF":"#6B7280",display:"flex",alignItems:"center",justifyContent:"center",fontSize:a?"14px":"12px",fontWeight:700},children:a?"✓":s+1}),t.jsxs("div",{style:{flex:1,minWidth:0},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px"},children:[t.jsxs("span",{style:{fontSize:"13px",fontWeight:700,color:i?"#1B3A4B":"#374151"},children:[e.icon," ",e.title]}),r>0&&t.jsx("span",{style:{fontSize:"10px",fontWeight:600,padding:"1px 6px",borderRadius:"999px",background:g+"20",color:g},children:r})]}),h&&t.jsx("div",{style:{fontSize:"11px",color:"#9CA3AF",marginTop:"2px"},children:h})]}),t.jsxs("div",{style:{width:"40px",textAlign:"right",fontSize:"10px",color:"#9CA3AF",flexShrink:0},children:[u,"%"]})]}),t.jsx("div",{style:{marginTop:"8px",height:"3px",background:"#F3F4F6",borderRadius:"2px",marginLeft:"38px"},children:t.jsx("div",{style:{height:"100%",borderRadius:"2px",background:g,width:`${u}%`,transition:"width 0.4s ease"}})})]})}function f({step:e,model:s,onAction:i}){const n=e.getCount(s),d=e.getTarget(),c=n>=d;return t.jsxs("div",{style:{background:"#FFFFFF",border:"1px solid #E5E5E0",borderRadius:"12px",padding:"24px"},children:[t.jsx("div",{style:{fontSize:"32px",marginBottom:"12px"},children:e.icon}),t.jsx("h2",{style:{fontSize:"18px",fontWeight:800,color:"#1B3A4B",margin:"0 0 6px 0"},children:e.title}),t.jsx("div",{style:{fontSize:"11px",fontWeight:600,color:"#9CA3AF",marginBottom:"12px",fontFamily:"monospace"},children:e.standard}),t.jsx("p",{style:{fontSize:"13px",color:"#4B6E80",lineHeight:"1.7",margin:"0 0 20px 0"},children:e.description}),t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",padding:"14px 16px",borderRadius:"8px",background:c?"#2ECC7110":n>0?"#F39C1210":"#F3F4F6",marginBottom:"20px"},children:[t.jsx("div",{style:{fontSize:"24px",fontWeight:800,color:c?"#2ECC71":n>0?"#F39C12":"#9CA3AF"},children:n}),t.jsxs("div",{children:[t.jsx("div",{style:{fontSize:"13px",fontWeight:600,color:"#374151"},children:c?`✓ Target reached (${d}+ recommended)`:`${d-n} more recommended`}),t.jsx("div",{style:{fontSize:"11px",color:"#9CA3AF"},children:e.getDetails(s)})]})]}),t.jsxs("button",{onClick:()=>i(e.actionView),style:{width:"100%",padding:"12px",borderRadius:"8px",background:"#1B3A4B",color:"#FFFFFF",border:"none",fontSize:"13px",fontWeight:600,cursor:"pointer",transition:"background 0.15s"},onMouseEnter:r=>r.currentTarget.style.background="#244D63",onMouseLeave:r=>r.currentTarget.style.background="#1B3A4B",children:[e.actionLabel," →"]})]})}function y({model:e}){const s=l.filter(n=>n.getCount(e)>=n.getTarget()).length,i=Math.round(s/l.length*100);return t.jsxs("div",{style:{padding:"16px 20px",background:"#FFFFFF",borderRadius:"12px",border:"1px solid #E5E5E0",marginBottom:"16px"},children:[t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"8px"},children:[t.jsx("span",{style:{fontSize:"13px",fontWeight:700,color:"#1B3A4B"},children:"Golden Path Progress"}),t.jsxs("span",{style:{fontSize:"13px",fontWeight:700,color:"#1B3A4B"},children:[s,"/",l.length," steps"]})]}),t.jsx("div",{style:{height:"6px",background:"#F3F4F6",borderRadius:"3px"},children:t.jsx("div",{style:{height:"100%",borderRadius:"3px",background:i>=100?"#2ECC71":"#2DD4A8",width:`${i}%`,transition:"width 0.4s ease"}})})]})}function j(){const e=p(o=>o.model),s=p(o=>o.setActiveView),i=p(o=>o.setExplorerTab),n=x.useMemo(()=>{if(!e)return 0;for(let o=0;o<l.length;o++)if(l[o].getCount(e)<l[o].getTarget())return o;return l.length-1},[e]),[d,c]=x.useState(n);if(!e)return t.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",background:"#F7F7F5"},children:t.jsx("div",{style:{fontSize:"13px",color:"#9CA3AF"},children:"No model data"})});function r(o){switch(o){case"model":i("model"),s({type:"dashboard"});break;case"traceability":s({type:"traceability"});break;case"statistics":s({type:"statistics"});break;case"catalog":i("model"),s({type:"dashboard"});break}}return t.jsx("div",{style:{flex:1,overflowY:"auto",background:"#F7F7F5",padding:"28px 40px"},children:t.jsxs("div",{style:{maxWidth:"960px",margin:"0 auto"},children:[t.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",marginBottom:"20px"},children:[t.jsxs("div",{children:[t.jsx("h1",{style:{fontSize:"20px",fontWeight:800,color:"#1B3A4B",margin:"0 0 4px 0"},children:"Workflow Wizard"}),t.jsx("p",{style:{fontSize:"12px",color:"#6B7280",margin:0},children:"Follow the golden path to a complete, review-ready device model"})]}),t.jsx("button",{onClick:()=>s({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"})]}),t.jsx(y,{model:e}),t.jsxs("div",{style:{display:"grid",gridTemplateColumns:"380px 1fr",gap:"16px"},children:[t.jsx("div",{style:{background:"#F9FAFB",border:"1px solid #E5E5E0",borderRadius:"12px",padding:"8px",display:"flex",flexDirection:"column",gap:"2px"},children:l.map((o,a)=>t.jsx(m,{step:o,index:a,isActive:a===d,model:e,onSelect:()=>c(a),onAction:r},o.id))}),t.jsx(f,{step:l[d],model:e,onAction:r})]})]})})}export{j as WorkflowWizard};