@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,45 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ScenarioEditor-FAEYTHgP.js","assets/reactflow-s7jmJtXx.js","assets/zustand-CrhqMOHB.js","assets/DiagramEditor-UJDHcAUF.js","assets/DiagramToolbarControls-B2gZFJlg.js","assets/DSMView-BiC845df.js","assets/element-options-B7AgTB8R.js","assets/OntologyViewer-CtqNkkCn.js","assets/TraceabilityMatrix-DbrvjqLN.js","assets/ModelDiff-xe95oVua.js","assets/ComplianceWizard-CTihkUi-.js","assets/StatisticsDashboard-BAZRqIPN.js","assets/DhfDashboard-w-dJoJHU.js","assets/DhfWorkbench-o6B_MT-0.js","assets/AiWorkspace-Bu9TlIWg.js","assets/ElementDetailView-10U0rr33.js","assets/Dashboard-CgnNLhKq.js","assets/ReviewDashboard-DeTge2oC.js","assets/WorkflowWizard-VwpEHt3R.js","assets/TabularView-I4LjHhoH.js","assets/ImportView-D8svP04Q.js","assets/AnalysisWorkspace-CodmoI-v.js","assets/UiScreensWorkspace-DDD_PyJs.js","assets/ExplorerTreeRow-DqhF_qoO.js"])))=>i.map(i=>d[i]);
2
- import{r as fo,j as t}from"./reactflow-s7jmJtXx.js";import{a as p,b as xr,W as yo}from"./zustand-CrhqMOHB.js";(function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))o(a);new MutationObserver(a=>{for(const i of a)if(i.type==="childList")for(const l of i.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&o(l)}).observe(document,{childList:!0,subtree:!0});function n(a){const i={};return a.integrity&&(i.integrity=a.integrity),a.referrerPolicy&&(i.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?i.credentials="include":a.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function o(a){if(a.ep)return;a.ep=!0;const i=n(a);fetch(a.href,i)}})();var ut={},Rn;function go(){if(Rn)return ut;Rn=1;var e=fo();return ut.createRoot=e.createRoot,ut.hydrateRoot=e.hydrateRoot,ut}var ho=go();/**
3
- * react-router v7.13.2
4
- *
5
- * Copyright (c) Remix Software Inc.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE.md file in the root directory of this source tree.
9
- *
10
- * @license MIT
11
- */var Mn="popstate";function In(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function xo(e={}){function r(o,a){var d;let i=(d=a.state)==null?void 0:d.masked,{pathname:l,search:s,hash:c}=i||o.location;return tn("",{pathname:l,search:s,hash:c},a.state&&a.state.usr||null,a.state&&a.state.key||"default",i?{pathname:o.location.pathname,search:o.location.search,hash:o.location.hash}:void 0)}function n(o,a){return typeof a=="string"?a:ot(a)}return vo(r,n,null,e)}function Q(e,r){if(e===!1||e===null||typeof e>"u")throw new Error(r)}function ve(e,r){if(!e){typeof console<"u"&&console.warn(r);try{throw new Error(r)}catch{}}}function bo(){return Math.random().toString(36).substring(2,10)}function Pn(e,r){return{usr:e.state,key:e.key,idx:r,masked:e.unstable_mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function tn(e,r,n=null,o,a){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof r=="string"?qe(r):r,state:n,key:r&&r.key||o||bo(),unstable_mask:a}}function ot({pathname:e="/",search:r="",hash:n=""}){return r&&r!=="?"&&(e+=r.charAt(0)==="?"?r:"?"+r),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function qe(e){let r={};if(e){let n=e.indexOf("#");n>=0&&(r.hash=e.substring(n),e=e.substring(0,n));let o=e.indexOf("?");o>=0&&(r.search=e.substring(o),e=e.substring(0,o)),e&&(r.pathname=e)}return r}function vo(e,r,n,o={}){let{window:a=document.defaultView,v5Compat:i=!1}=o,l=a.history,s="POP",c=null,d=u();d==null&&(d=0,l.replaceState({...l.state,idx:d},""));function u(){return(l.state||{idx:null}).idx}function y(){s="POP";let h=u(),m=h==null?null:h-d;d=h,c&&c({action:s,location:f.location,delta:m})}function b(h,m){s="PUSH";let D=In(h)?h:tn(f.location,h,m);d=u()+1;let N=Pn(D,d),j=f.createHref(D.unstable_mask||D);try{l.pushState(N,"",j)}catch(C){if(C instanceof DOMException&&C.name==="DataCloneError")throw C;a.location.assign(j)}i&&c&&c({action:s,location:f.location,delta:1})}function x(h,m){s="REPLACE";let D=In(h)?h:tn(f.location,h,m);d=u();let N=Pn(D,d),j=f.createHref(D.unstable_mask||D);l.replaceState(N,"",j),i&&c&&c({action:s,location:f.location,delta:0})}function w(h){return wo(h)}let f={get action(){return s},get location(){return e(a,l)},listen(h){if(c)throw new Error("A history only accepts one active listener");return a.addEventListener(Mn,y),c=h,()=>{a.removeEventListener(Mn,y),c=null}},createHref(h){return r(a,h)},createURL:w,encodeLocation(h){let m=w(h);return{pathname:m.pathname,search:m.search,hash:m.hash}},push:b,replace:x,go(h){return l.go(h)}};return f}function wo(e,r=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),Q(n,"No window.location.(origin|href) available to create URL");let o=typeof e=="string"?e:ot(e);return o=o.replace(/ $/,"%20"),!r&&o.startsWith("//")&&(o=n+o),new URL(o,n)}function br(e,r,n="/"){return ko(e,r,n,!1)}function ko(e,r,n,o){let a=typeof r=="string"?qe(r):r,i=je(a.pathname||"/",n);if(i==null)return null;let l=vr(e);Eo(l);let s=null;for(let c=0;s==null&&c<l.length;++c){let d=Mo(i);s=To(l[c],d,o)}return s}function vr(e,r=[],n=[],o="",a=!1){let i=(l,s,c=a,d)=>{let u={relativePath:d===void 0?l.path||"":d,caseSensitive:l.caseSensitive===!0,childrenIndex:s,route:l};if(u.relativePath.startsWith("/")){if(!u.relativePath.startsWith(o)&&c)return;Q(u.relativePath.startsWith(o),`Absolute route path "${u.relativePath}" nested under path "${o}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),u.relativePath=u.relativePath.slice(o.length)}let y=be([o,u.relativePath]),b=n.concat(u);l.children&&l.children.length>0&&(Q(l.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${y}".`),vr(l.children,r,b,y,c)),!(l.path==null&&!l.index)&&r.push({path:y,score:No(y,l.index),routesMeta:b})};return e.forEach((l,s)=>{var c;if(l.path===""||!((c=l.path)!=null&&c.includes("?")))i(l,s);else for(let d of wr(l.path))i(l,s,!0,d)}),r}function wr(e){let r=e.split("/");if(r.length===0)return[];let[n,...o]=r,a=n.endsWith("?"),i=n.replace(/\?$/,"");if(o.length===0)return a?[i,""]:[i];let l=wr(o.join("/")),s=[];return s.push(...l.map(c=>c===""?i:[i,c].join("/"))),a&&s.push(...l),s.map(c=>e.startsWith("/")&&c===""?"/":c)}function Eo(e){e.sort((r,n)=>r.score!==n.score?n.score-r.score:Ao(r.routesMeta.map(o=>o.childrenIndex),n.routesMeta.map(o=>o.childrenIndex)))}var So=/^:[\w-]+$/,Bo=3,jo=2,Co=1,Do=10,Fo=-2,Ln=e=>e==="*";function No(e,r){let n=e.split("/"),o=n.length;return n.some(Ln)&&(o+=Fo),r&&(o+=jo),n.filter(a=>!Ln(a)).reduce((a,i)=>a+(So.test(i)?Bo:i===""?Co:Do),o)}function Ao(e,r){return e.length===r.length&&e.slice(0,-1).every((o,a)=>o===r[a])?e[e.length-1]-r[r.length-1]:0}function To(e,r,n=!1){let{routesMeta:o}=e,a={},i="/",l=[];for(let s=0;s<o.length;++s){let c=o[s],d=s===o.length-1,u=i==="/"?r:r.slice(i.length)||"/",y=Dt({path:c.relativePath,caseSensitive:c.caseSensitive,end:d},u),b=c.route;if(!y&&d&&n&&!o[o.length-1].route.index&&(y=Dt({path:c.relativePath,caseSensitive:c.caseSensitive,end:!1},u)),!y)return null;Object.assign(a,y.params),l.push({params:a,pathname:be([i,y.pathname]),pathnameBase:Uo(be([i,y.pathnameBase])),route:b}),y.pathnameBase!=="/"&&(i=be([i,y.pathnameBase]))}return l}function Dt(e,r){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,o]=Ro(e.path,e.caseSensitive,e.end),a=r.match(n);if(!a)return null;let i=a[0],l=i.replace(/(.)\/+$/,"$1"),s=a.slice(1);return{params:o.reduce((d,{paramName:u,isOptional:y},b)=>{if(u==="*"){let w=s[b]||"";l=i.slice(0,i.length-w.length).replace(/(.)\/+$/,"$1")}const x=s[b];return y&&!x?d[u]=void 0:d[u]=(x||"").replace(/%2F/g,"/"),d},{}),pathname:i,pathnameBase:l,pattern:e}}function Ro(e,r=!1,n=!0){ve(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let o=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(l,s,c,d,u)=>{if(o.push({paramName:s,isOptional:c!=null}),c){let y=u.charAt(d+l.length);return y&&y!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(o.push({paramName:"*"}),a+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?a+="\\/*$":e!==""&&e!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,r?void 0:"i"),o]}function Mo(e){try{return e.split("/").map(r=>decodeURIComponent(r).replace(/\//g,"%2F")).join("/")}catch(r){return ve(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${r}).`),e}}function je(e,r){if(r==="/")return e;if(!e.toLowerCase().startsWith(r.toLowerCase()))return null;let n=r.endsWith("/")?r.length-1:r.length,o=e.charAt(n);return o&&o!=="/"?null:e.slice(n)||"/"}var Io=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function Po(e,r="/"){let{pathname:n,search:o="",hash:a=""}=typeof e=="string"?qe(e):e,i;return n?(n=n.replace(/\/\/+/g,"/"),n.startsWith("/")?i=Un(n.substring(1),"/"):i=Un(n,r)):i=r,{pathname:i,search:zo(o),hash:Oo(a)}}function Un(e,r){let n=r.replace(/\/+$/,"").split("/");return e.split("/").forEach(a=>{a===".."?n.length>1&&n.pop():a!=="."&&n.push(a)}),n.length>1?n.join("/"):"/"}function Mt(e,r,n,o){return`Cannot include a '${e}' character in a manually specified \`to.${r}\` field [${JSON.stringify(o)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function Lo(e){return e.filter((r,n)=>n===0||r.route.path&&r.route.path.length>0)}function kr(e){let r=Lo(e);return r.map((n,o)=>o===r.length-1?n.pathname:n.pathnameBase)}function yn(e,r,n,o=!1){let a;typeof e=="string"?a=qe(e):(a={...e},Q(!a.pathname||!a.pathname.includes("?"),Mt("?","pathname","search",a)),Q(!a.pathname||!a.pathname.includes("#"),Mt("#","pathname","hash",a)),Q(!a.search||!a.search.includes("#"),Mt("#","search","hash",a)));let i=e===""||a.pathname==="",l=i?"/":a.pathname,s;if(l==null)s=n;else{let y=r.length-1;if(!o&&l.startsWith("..")){let b=l.split("/");for(;b[0]==="..";)b.shift(),y-=1;a.pathname=b.join("/")}s=y>=0?r[y]:"/"}let c=Po(a,s),d=l&&l!=="/"&&l.endsWith("/"),u=(i||l===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(d||u)&&(c.pathname+="/"),c}var be=e=>e.join("/").replace(/\/\/+/g,"/"),Uo=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),zo=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Oo=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,Vo=class{constructor(e,r,n,o=!1){this.status=e,this.statusText=r||"",this.internal=o,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function $o(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function Wo(e){return e.map(r=>r.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var Er=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Sr(e,r){let n=e;if(typeof n!="string"||!Io.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let o=n,a=!1;if(Er)try{let i=new URL(window.location.href),l=n.startsWith("//")?new URL(i.protocol+n):new URL(n),s=je(l.pathname,r);l.origin===i.origin&&s!=null?n=s+l.search+l.hash:a=!0}catch{ve(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:o,isExternal:a,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var Br=["POST","PUT","PATCH","DELETE"];new Set(Br);var _o=["GET",...Br];new Set(_o);var He=p.createContext(null);He.displayName="DataRouter";var At=p.createContext(null);At.displayName="DataRouterState";var qo=p.createContext(!1),jr=p.createContext({isTransitioning:!1});jr.displayName="ViewTransition";var Ho=p.createContext(new Map);Ho.displayName="Fetchers";var Ko=p.createContext(null);Ko.displayName="Await";var me=p.createContext(null);me.displayName="Navigation";var Ke=p.createContext(null);Ke.displayName="Location";var we=p.createContext({outlet:null,matches:[],isDataRoute:!1});we.displayName="Route";var gn=p.createContext(null);gn.displayName="RouteError";var Cr="REACT_ROUTER_ERROR",Go="REDIRECT",Yo="ROUTE_ERROR_RESPONSE";function Jo(e){if(e.startsWith(`${Cr}:${Go}:{`))try{let r=JSON.parse(e.slice(28));if(typeof r=="object"&&r&&typeof r.status=="number"&&typeof r.statusText=="string"&&typeof r.location=="string"&&typeof r.reloadDocument=="boolean"&&typeof r.replace=="boolean")return r}catch{}}function Xo(e){if(e.startsWith(`${Cr}:${Yo}:{`))try{let r=JSON.parse(e.slice(40));if(typeof r=="object"&&r&&typeof r.status=="number"&&typeof r.statusText=="string")return new Vo(r.status,r.statusText,r.data)}catch{}}function Qo(e,{relative:r}={}){Q(dt(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:o}=p.useContext(me),{hash:a,pathname:i,search:l}=ct(e,{relative:r}),s=i;return n!=="/"&&(s=i==="/"?n:be([n,i])),o.createHref({pathname:s,search:l,hash:a})}function dt(){return p.useContext(Ke)!=null}function ke(){return Q(dt(),"useLocation() may be used only in the context of a <Router> component."),p.useContext(Ke).location}function Zo(){return p.useContext(Ke).navigationType}var Dr="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Fr(e){p.useContext(me).static||p.useLayoutEffect(e)}function Ce(){let{isDataRoute:e}=p.useContext(we);return e?pa():ea()}function ea(){Q(dt(),"useNavigate() may be used only in the context of a <Router> component.");let e=p.useContext(He),{basename:r,navigator:n}=p.useContext(me),{matches:o}=p.useContext(we),{pathname:a}=ke(),i=JSON.stringify(kr(o)),l=p.useRef(!1);return Fr(()=>{l.current=!0}),p.useCallback((c,d={})=>{if(ve(l.current,Dr),!l.current)return;if(typeof c=="number"){n.go(c);return}let u=yn(c,JSON.parse(i),a,d.relative==="path");e==null&&r!=="/"&&(u.pathname=u.pathname==="/"?r:be([r,u.pathname])),(d.replace?n.replace:n.push)(u,d.state,d)},[r,n,i,a,e])}p.createContext(null);function hn(){let{matches:e}=p.useContext(we),r=e[e.length-1];return r?r.params:{}}function ct(e,{relative:r}={}){let{matches:n}=p.useContext(we),{pathname:o}=ke(),a=JSON.stringify(kr(n));return p.useMemo(()=>yn(e,JSON.parse(a),o,r==="path"),[e,a,o,r])}function ta(e,r){return Nr(e,r)}function Nr(e,r,n){var h;Q(dt(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:o}=p.useContext(me),{matches:a}=p.useContext(we),i=a[a.length-1],l=i?i.params:{},s=i?i.pathname:"/",c=i?i.pathnameBase:"/",d=i&&i.route;{let m=d&&d.path||"";Tr(s,!d||m.endsWith("*")||m.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${s}" (under <Route path="${m}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
12
-
13
- Please change the parent <Route path="${m}"> to <Route path="${m==="/"?"*":`${m}/*`}">.`)}let u=ke(),y;if(r){let m=typeof r=="string"?qe(r):r;Q(c==="/"||((h=m.pathname)==null?void 0:h.startsWith(c)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${c}" but pathname "${m.pathname}" was given in the \`location\` prop.`),y=m}else y=u;let b=y.pathname||"/",x=b;if(c!=="/"){let m=c.replace(/^\//,"").split("/");x="/"+b.replace(/^\//,"").split("/").slice(m.length).join("/")}let w=br(e,{pathname:x});ve(d||w!=null,`No routes matched location "${y.pathname}${y.search}${y.hash}" `),ve(w==null||w[w.length-1].route.element!==void 0||w[w.length-1].route.Component!==void 0||w[w.length-1].route.lazy!==void 0,`Matched leaf route at location "${y.pathname}${y.search}${y.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let f=ia(w&&w.map(m=>Object.assign({},m,{params:Object.assign({},l,m.params),pathname:be([c,o.encodeLocation?o.encodeLocation(m.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:m.pathname]),pathnameBase:m.pathnameBase==="/"?c:be([c,o.encodeLocation?o.encodeLocation(m.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:m.pathnameBase])})),a,n);return r&&f?p.createElement(Ke.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...y},navigationType:"POP"}},f):f}function na(){let e=ua(),r=$o(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,o="rgba(200,200,200, 0.5)",a={padding:"0.5rem",backgroundColor:o},i={padding:"2px 4px",backgroundColor:o},l=null;return console.error("Error handled by React Router default ErrorBoundary:",e),l=p.createElement(p.Fragment,null,p.createElement("p",null,"💿 Hey developer 👋"),p.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",p.createElement("code",{style:i},"ErrorBoundary")," or"," ",p.createElement("code",{style:i},"errorElement")," prop on your route.")),p.createElement(p.Fragment,null,p.createElement("h2",null,"Unexpected Application Error!"),p.createElement("h3",{style:{fontStyle:"italic"}},r),n?p.createElement("pre",{style:a},n):null,l)}var ra=p.createElement(na,null),Ar=class extends p.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,r){return r.location!==e.location||r.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:r.error,location:r.location,revalidation:e.revalidation||r.revalidation}}componentDidCatch(e,r){this.props.onError?this.props.onError(e,r):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const n=Xo(e.digest);n&&(e=n)}let r=e!==void 0?p.createElement(we.Provider,{value:this.props.routeContext},p.createElement(gn.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?p.createElement(oa,{error:e},r):r}};Ar.contextType=qo;var It=new WeakMap;function oa({children:e,error:r}){let{basename:n}=p.useContext(me);if(typeof r=="object"&&r&&"digest"in r&&typeof r.digest=="string"){let o=Jo(r.digest);if(o){let a=It.get(r);if(a)throw a;let i=Sr(o.location,n);if(Er&&!It.get(r))if(i.isExternal||o.reloadDocument)window.location.href=i.absoluteURL||i.to;else{const l=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:o.replace}));throw It.set(r,l),l}return p.createElement("meta",{httpEquiv:"refresh",content:`0;url=${i.absoluteURL||i.to}`})}}return e}function aa({routeContext:e,match:r,children:n}){let o=p.useContext(He);return o&&o.static&&o.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=r.route.id),p.createElement(we.Provider,{value:e},n)}function ia(e,r=[],n){let o=n==null?void 0:n.state;if(e==null){if(!o)return null;if(o.errors)e=o.matches;else if(r.length===0&&!o.initialized&&o.matches.length>0)e=o.matches;else return null}let a=e,i=o==null?void 0:o.errors;if(i!=null){let u=a.findIndex(y=>y.route.id&&(i==null?void 0:i[y.route.id])!==void 0);Q(u>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(i).join(",")}`),a=a.slice(0,Math.min(a.length,u+1))}let l=!1,s=-1;if(n&&o){l=o.renderFallback;for(let u=0;u<a.length;u++){let y=a[u];if((y.route.HydrateFallback||y.route.hydrateFallbackElement)&&(s=u),y.route.id){let{loaderData:b,errors:x}=o,w=y.route.loader&&!b.hasOwnProperty(y.route.id)&&(!x||x[y.route.id]===void 0);if(y.route.lazy||w){n.isStatic&&(l=!0),s>=0?a=a.slice(0,s+1):a=[a[0]];break}}}}let c=n==null?void 0:n.onError,d=o&&c?(u,y)=>{var b,x;c(u,{location:o.location,params:((x=(b=o.matches)==null?void 0:b[0])==null?void 0:x.params)??{},unstable_pattern:Wo(o.matches),errorInfo:y})}:void 0;return a.reduceRight((u,y,b)=>{let x,w=!1,f=null,h=null;o&&(x=i&&y.route.id?i[y.route.id]:void 0,f=y.route.errorElement||ra,l&&(s<0&&b===0?(Tr("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),w=!0,h=null):s===b&&(w=!0,h=y.route.hydrateFallbackElement||null)));let m=r.concat(a.slice(0,b+1)),D=()=>{let N;return x?N=f:w?N=h:y.route.Component?N=p.createElement(y.route.Component,null):y.route.element?N=y.route.element:N=u,p.createElement(aa,{match:y,routeContext:{outlet:u,matches:m,isDataRoute:o!=null},children:N})};return o&&(y.route.ErrorBoundary||y.route.errorElement||b===0)?p.createElement(Ar,{location:o.location,revalidation:o.revalidation,component:f,error:x,children:D(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:d}):D()},null)}function xn(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function sa(e){let r=p.useContext(He);return Q(r,xn(e)),r}function la(e){let r=p.useContext(At);return Q(r,xn(e)),r}function da(e){let r=p.useContext(we);return Q(r,xn(e)),r}function bn(e){let r=da(e),n=r.matches[r.matches.length-1];return Q(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function ca(){return bn("useRouteId")}function ua(){var o;let e=p.useContext(gn),r=la("useRouteError"),n=bn("useRouteError");return e!==void 0?e:(o=r.errors)==null?void 0:o[n]}function pa(){let{router:e}=sa("useNavigate"),r=bn("useNavigate"),n=p.useRef(!1);return Fr(()=>{n.current=!0}),p.useCallback(async(a,i={})=>{ve(n.current,Dr),n.current&&(typeof a=="number"?await e.navigate(a):await e.navigate(a,{fromRouteId:r,...i}))},[e,r])}var zn={};function Tr(e,r,n){!r&&!zn[e]&&(zn[e]=!0,ve(!1,n))}p.memo(ma);function ma({routes:e,future:r,state:n,isStatic:o,onError:a}){return Nr(e,void 0,{state:n,isStatic:o,onError:a})}function ge(e){Q(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function fa({basename:e="/",children:r=null,location:n,navigationType:o="POP",navigator:a,static:i=!1,unstable_useTransitions:l}){Q(!dt(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let s=e.replace(/^\/*/,"/"),c=p.useMemo(()=>({basename:s,navigator:a,static:i,unstable_useTransitions:l,future:{}}),[s,a,i,l]);typeof n=="string"&&(n=qe(n));let{pathname:d="/",search:u="",hash:y="",state:b=null,key:x="default",unstable_mask:w}=n,f=p.useMemo(()=>{let h=je(d,s);return h==null?null:{location:{pathname:h,search:u,hash:y,state:b,key:x,unstable_mask:w},navigationType:o}},[s,d,u,y,b,x,o,w]);return ve(f!=null,`<Router basename="${s}"> is not able to match the URL "${d}${u}${y}" because it does not start with the basename, so the <Router> won't render anything.`),f==null?null:p.createElement(me.Provider,{value:c},p.createElement(Ke.Provider,{children:r,value:f}))}function ya({children:e,location:r}){return ta(nn(e),r)}function nn(e,r=[]){let n=[];return p.Children.forEach(e,(o,a)=>{if(!p.isValidElement(o))return;let i=[...r,a];if(o.type===p.Fragment){n.push.apply(n,nn(o.props.children,i));return}Q(o.type===ge,`[${typeof o.type=="string"?o.type:o.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Q(!o.props.index||!o.props.children,"An index route cannot have child routes.");let l={id:o.props.id||i.join("-"),caseSensitive:o.props.caseSensitive,element:o.props.element,Component:o.props.Component,index:o.props.index,path:o.props.path,middleware:o.props.middleware,loader:o.props.loader,action:o.props.action,hydrateFallbackElement:o.props.hydrateFallbackElement,HydrateFallback:o.props.HydrateFallback,errorElement:o.props.errorElement,ErrorBoundary:o.props.ErrorBoundary,hasErrorBoundary:o.props.hasErrorBoundary===!0||o.props.ErrorBoundary!=null||o.props.errorElement!=null,shouldRevalidate:o.props.shouldRevalidate,handle:o.props.handle,lazy:o.props.lazy};o.props.children&&(l.children=nn(o.props.children,i)),n.push(l)}),n}var St="get",Bt="application/x-www-form-urlencoded";function Tt(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function ga(e){return Tt(e)&&e.tagName.toLowerCase()==="button"}function ha(e){return Tt(e)&&e.tagName.toLowerCase()==="form"}function xa(e){return Tt(e)&&e.tagName.toLowerCase()==="input"}function ba(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function va(e,r){return e.button===0&&(!r||r==="_self")&&!ba(e)}var pt=null;function wa(){if(pt===null)try{new FormData(document.createElement("form"),0),pt=!1}catch{pt=!0}return pt}var ka=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Pt(e){return e!=null&&!ka.has(e)?(ve(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Bt}"`),null):e}function Ea(e,r){let n,o,a,i,l;if(ha(e)){let s=e.getAttribute("action");o=s?je(s,r):null,n=e.getAttribute("method")||St,a=Pt(e.getAttribute("enctype"))||Bt,i=new FormData(e)}else if(ga(e)||xa(e)&&(e.type==="submit"||e.type==="image")){let s=e.form;if(s==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let c=e.getAttribute("formaction")||s.getAttribute("action");if(o=c?je(c,r):null,n=e.getAttribute("formmethod")||s.getAttribute("method")||St,a=Pt(e.getAttribute("formenctype"))||Pt(s.getAttribute("enctype"))||Bt,i=new FormData(s,e),!wa()){let{name:d,type:u,value:y}=e;if(u==="image"){let b=d?`${d}.`:"";i.append(`${b}x`,"0"),i.append(`${b}y`,"0")}else d&&i.append(d,y)}}else{if(Tt(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=St,o=null,a=Bt,l=e}return i&&a==="text/plain"&&(l=i,i=void 0),{action:o,method:n.toLowerCase(),encType:a,formData:i,body:l}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function vn(e,r){if(e===!1||e===null||typeof e>"u")throw new Error(r)}function Sa(e,r,n,o){let a=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?a.pathname.endsWith("/")?a.pathname=`${a.pathname}_.${o}`:a.pathname=`${a.pathname}.${o}`:a.pathname==="/"?a.pathname=`_root.${o}`:r&&je(a.pathname,r)==="/"?a.pathname=`${r.replace(/\/$/,"")}/_root.${o}`:a.pathname=`${a.pathname.replace(/\/$/,"")}.${o}`,a}async function Ba(e,r){if(e.id in r)return r[e.id];try{let n=await import(e.module);return r[e.id]=n,n}catch(n){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function ja(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function Ca(e,r,n){let o=await Promise.all(e.map(async a=>{let i=r.routes[a.route.id];if(i){let l=await Ba(i,n);return l.links?l.links():[]}return[]}));return Aa(o.flat(1).filter(ja).filter(a=>a.rel==="stylesheet"||a.rel==="preload").map(a=>a.rel==="stylesheet"?{...a,rel:"prefetch",as:"style"}:{...a,rel:"prefetch"}))}function On(e,r,n,o,a,i){let l=(c,d)=>n[d]?c.route.id!==n[d].route.id:!0,s=(c,d)=>{var u;return n[d].pathname!==c.pathname||((u=n[d].route.path)==null?void 0:u.endsWith("*"))&&n[d].params["*"]!==c.params["*"]};return i==="assets"?r.filter((c,d)=>l(c,d)||s(c,d)):i==="data"?r.filter((c,d)=>{var y;let u=o.routes[c.route.id];if(!u||!u.hasLoader)return!1;if(l(c,d)||s(c,d))return!0;if(c.route.shouldRevalidate){let b=c.route.shouldRevalidate({currentUrl:new URL(a.pathname+a.search+a.hash,window.origin),currentParams:((y=n[0])==null?void 0:y.params)||{},nextUrl:new URL(e,window.origin),nextParams:c.params,defaultShouldRevalidate:!0});if(typeof b=="boolean")return b}return!0}):[]}function Da(e,r,{includeHydrateFallback:n}={}){return Fa(e.map(o=>{let a=r.routes[o.route.id];if(!a)return[];let i=[a.module];return a.clientActionModule&&(i=i.concat(a.clientActionModule)),a.clientLoaderModule&&(i=i.concat(a.clientLoaderModule)),n&&a.hydrateFallbackModule&&(i=i.concat(a.hydrateFallbackModule)),a.imports&&(i=i.concat(a.imports)),i}).flat(1))}function Fa(e){return[...new Set(e)]}function Na(e){let r={},n=Object.keys(e).sort();for(let o of n)r[o]=e[o];return r}function Aa(e,r){let n=new Set;return new Set(r),e.reduce((o,a)=>{let i=JSON.stringify(Na(a));return n.has(i)||(n.add(i),o.push({key:i,link:a})),o},[])}function Rr(){let e=p.useContext(He);return vn(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function Ta(){let e=p.useContext(At);return vn(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var wn=p.createContext(void 0);wn.displayName="FrameworkContext";function Mr(){let e=p.useContext(wn);return vn(e,"You must render this element inside a <HydratedRouter> element"),e}function Ra(e,r){let n=p.useContext(wn),[o,a]=p.useState(!1),[i,l]=p.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:d,onMouseLeave:u,onTouchStart:y}=r,b=p.useRef(null);p.useEffect(()=>{if(e==="render"&&l(!0),e==="viewport"){let f=m=>{m.forEach(D=>{l(D.isIntersecting)})},h=new IntersectionObserver(f,{threshold:.5});return b.current&&h.observe(b.current),()=>{h.disconnect()}}},[e]),p.useEffect(()=>{if(o){let f=setTimeout(()=>{l(!0)},100);return()=>{clearTimeout(f)}}},[o]);let x=()=>{a(!0)},w=()=>{a(!1),l(!1)};return n?e!=="intent"?[i,b,{}]:[i,b,{onFocus:Ge(s,x),onBlur:Ge(c,w),onMouseEnter:Ge(d,x),onMouseLeave:Ge(u,w),onTouchStart:Ge(y,x)}]:[!1,b,{}]}function Ge(e,r){return n=>{e&&e(n),n.defaultPrevented||r(n)}}function Ma({page:e,...r}){let{router:n}=Rr(),o=p.useMemo(()=>br(n.routes,e,n.basename),[n.routes,e,n.basename]);return o?p.createElement(Pa,{page:e,matches:o,...r}):null}function Ia(e){let{manifest:r,routeModules:n}=Mr(),[o,a]=p.useState([]);return p.useEffect(()=>{let i=!1;return Ca(e,r,n).then(l=>{i||a(l)}),()=>{i=!0}},[e,r,n]),o}function Pa({page:e,matches:r,...n}){let o=ke(),{future:a,manifest:i,routeModules:l}=Mr(),{basename:s}=Rr(),{loaderData:c,matches:d}=Ta(),u=p.useMemo(()=>On(e,r,d,i,o,"data"),[e,r,d,i,o]),y=p.useMemo(()=>On(e,r,d,i,o,"assets"),[e,r,d,i,o]),b=p.useMemo(()=>{if(e===o.pathname+o.search+o.hash)return[];let f=new Set,h=!1;if(r.forEach(D=>{var j;let N=i.routes[D.route.id];!N||!N.hasLoader||(!u.some(C=>C.route.id===D.route.id)&&D.route.id in c&&((j=l[D.route.id])!=null&&j.shouldRevalidate)||N.hasClientLoader?h=!0:f.add(D.route.id))}),f.size===0)return[];let m=Sa(e,s,a.unstable_trailingSlashAwareDataRequests,"data");return h&&f.size>0&&m.searchParams.set("_routes",r.filter(D=>f.has(D.route.id)).map(D=>D.route.id).join(",")),[m.pathname+m.search]},[s,a.unstable_trailingSlashAwareDataRequests,c,o,i,u,r,e,l]),x=p.useMemo(()=>Da(y,i),[y,i]),w=Ia(y);return p.createElement(p.Fragment,null,b.map(f=>p.createElement("link",{key:f,rel:"prefetch",as:"fetch",href:f,...n})),x.map(f=>p.createElement("link",{key:f,rel:"modulepreload",href:f,...n})),w.map(({key:f,link:h})=>p.createElement("link",{key:f,nonce:n.nonce,...h,crossOrigin:h.crossOrigin??n.crossOrigin})))}function La(...e){return r=>{e.forEach(n=>{typeof n=="function"?n(r):n!=null&&(n.current=r)})}}var Ua=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{Ua&&(window.__reactRouterVersion="7.13.2")}catch{}function za({basename:e,children:r,unstable_useTransitions:n,window:o}){let a=p.useRef();a.current==null&&(a.current=xo({window:o,v5Compat:!0}));let i=a.current,[l,s]=p.useState({action:i.action,location:i.location}),c=p.useCallback(d=>{n===!1?s(d):p.startTransition(()=>s(d))},[n]);return p.useLayoutEffect(()=>i.listen(c),[i,c]),p.createElement(fa,{basename:e,children:r,location:l.location,navigationType:l.action,navigator:i,unstable_useTransitions:n})}var Ir=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Pr=p.forwardRef(function({onClick:r,discover:n="render",prefetch:o="none",relative:a,reloadDocument:i,replace:l,unstable_mask:s,state:c,target:d,to:u,preventScrollReset:y,viewTransition:b,unstable_defaultShouldRevalidate:x,...w},f){let{basename:h,navigator:m,unstable_useTransitions:D}=p.useContext(me),N=typeof u=="string"&&Ir.test(u),j=Sr(u,h);u=j.to;let C=Qo(u,{relative:a}),S=ke(),I=null;if(s){let q=yn(s,[],S.unstable_mask?S.unstable_mask.pathname:"/",!0);h!=="/"&&(q.pathname=q.pathname==="/"?h:be([h,q.pathname])),I=m.createHref(q)}let[v,L,W]=Ra(o,w),U=Wa(u,{replace:l,unstable_mask:s,state:c,target:d,preventScrollReset:y,relative:a,viewTransition:b,unstable_defaultShouldRevalidate:x,unstable_useTransitions:D});function T(q){r&&r(q),q.defaultPrevented||U(q)}let K=!(j.isExternal||i),P=p.createElement("a",{...w,...W,href:(K?I:void 0)||j.absoluteURL||C,onClick:K?T:r,ref:La(f,L),target:d,"data-discover":!N&&n==="render"?"true":void 0});return v&&!N?p.createElement(p.Fragment,null,P,p.createElement(Ma,{page:C})):P});Pr.displayName="Link";var Oa=p.forwardRef(function({"aria-current":r="page",caseSensitive:n=!1,className:o="",end:a=!1,style:i,to:l,viewTransition:s,children:c,...d},u){let y=ct(l,{relative:d.relative}),b=ke(),x=p.useContext(At),{navigator:w,basename:f}=p.useContext(me),h=x!=null&&Ga(y)&&s===!0,m=w.encodeLocation?w.encodeLocation(y).pathname:y.pathname,D=b.pathname,N=x&&x.navigation&&x.navigation.location?x.navigation.location.pathname:null;n||(D=D.toLowerCase(),N=N?N.toLowerCase():null,m=m.toLowerCase()),N&&f&&(N=je(N,f)||N);const j=m!=="/"&&m.endsWith("/")?m.length-1:m.length;let C=D===m||!a&&D.startsWith(m)&&D.charAt(j)==="/",S=N!=null&&(N===m||!a&&N.startsWith(m)&&N.charAt(m.length)==="/"),I={isActive:C,isPending:S,isTransitioning:h},v=C?r:void 0,L;typeof o=="function"?L=o(I):L=[o,C?"active":null,S?"pending":null,h?"transitioning":null].filter(Boolean).join(" ");let W=typeof i=="function"?i(I):i;return p.createElement(Pr,{...d,"aria-current":v,className:L,ref:u,style:W,to:l,viewTransition:s},typeof c=="function"?c(I):c)});Oa.displayName="NavLink";var Va=p.forwardRef(({discover:e="render",fetcherKey:r,navigate:n,reloadDocument:o,replace:a,state:i,method:l=St,action:s,onSubmit:c,relative:d,preventScrollReset:u,viewTransition:y,unstable_defaultShouldRevalidate:b,...x},w)=>{let{unstable_useTransitions:f}=p.useContext(me),h=Ha(),m=Ka(s,{relative:d}),D=l.toLowerCase()==="get"?"get":"post",N=typeof s=="string"&&Ir.test(s),j=C=>{if(c&&c(C),C.defaultPrevented)return;C.preventDefault();let S=C.nativeEvent.submitter,I=(S==null?void 0:S.getAttribute("formmethod"))||l,v=()=>h(S||C.currentTarget,{fetcherKey:r,method:I,navigate:n,replace:a,state:i,relative:d,preventScrollReset:u,viewTransition:y,unstable_defaultShouldRevalidate:b});f&&n!==!1?p.startTransition(()=>v()):v()};return p.createElement("form",{ref:w,method:D,action:m,onSubmit:o?c:j,...x,"data-discover":!N&&e==="render"?"true":void 0})});Va.displayName="Form";function $a(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Lr(e){let r=p.useContext(He);return Q(r,$a(e)),r}function Wa(e,{target:r,replace:n,unstable_mask:o,state:a,preventScrollReset:i,relative:l,viewTransition:s,unstable_defaultShouldRevalidate:c,unstable_useTransitions:d}={}){let u=Ce(),y=ke(),b=ct(e,{relative:l});return p.useCallback(x=>{if(va(x,r)){x.preventDefault();let w=n!==void 0?n:ot(y)===ot(b),f=()=>u(e,{replace:w,unstable_mask:o,state:a,preventScrollReset:i,relative:l,viewTransition:s,unstable_defaultShouldRevalidate:c});d?p.startTransition(()=>f()):f()}},[y,u,b,n,o,a,r,e,i,l,s,c,d])}var _a=0,qa=()=>`__${String(++_a)}__`;function Ha(){let{router:e}=Lr("useSubmit"),{basename:r}=p.useContext(me),n=ca(),o=e.fetch,a=e.navigate;return p.useCallback(async(i,l={})=>{let{action:s,method:c,encType:d,formData:u,body:y}=Ea(i,r);if(l.navigate===!1){let b=l.fetcherKey||qa();await o(b,n,l.action||s,{unstable_defaultShouldRevalidate:l.unstable_defaultShouldRevalidate,preventScrollReset:l.preventScrollReset,formData:u,body:y,formMethod:l.method||c,formEncType:l.encType||d,flushSync:l.flushSync})}else await a(l.action||s,{unstable_defaultShouldRevalidate:l.unstable_defaultShouldRevalidate,preventScrollReset:l.preventScrollReset,formData:u,body:y,formMethod:l.method||c,formEncType:l.encType||d,replace:l.replace,state:l.state,fromRouteId:n,flushSync:l.flushSync,viewTransition:l.viewTransition})},[o,a,r,n])}function Ka(e,{relative:r}={}){let{basename:n}=p.useContext(me),o=p.useContext(we);Q(o,"useFormAction must be used inside a RouteContext");let[a]=o.matches.slice(-1),i={...ct(e||".",{relative:r})},l=ke();if(e==null){i.search=l.search;let s=new URLSearchParams(i.search),c=s.getAll("index");if(c.some(u=>u==="")){s.delete("index"),c.filter(y=>y).forEach(y=>s.append("index",y));let u=s.toString();i.search=u?`?${u}`:""}}return(!e||e===".")&&a.route.index&&(i.search=i.search?i.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(i.pathname=i.pathname==="/"?n:be([n,i.pathname])),ot(i)}function Ga(e,{relative:r}={}){let n=p.useContext(jr);Q(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:o}=Lr("useViewTransitionState"),a=ct(e,{relative:r});if(!n.isTransitioning)return!1;let i=je(n.currentLocation.pathname,o)||n.currentLocation.pathname,l=je(n.nextLocation.pathname,o)||n.nextLocation.pathname;return Dt(a.pathname,l)!=null||Dt(a.pathname,i)!=null}const Ya="modulepreload",Ja=function(e){return"/"+e},Vn={},te=function(r,n,o){let a=Promise.resolve();if(n&&n.length>0){let l=function(d){return Promise.all(d.map(u=>Promise.resolve(u).then(y=>({status:"fulfilled",value:y}),y=>({status:"rejected",reason:y}))))};document.getElementsByTagName("link");const s=document.querySelector("meta[property=csp-nonce]"),c=(s==null?void 0:s.nonce)||(s==null?void 0:s.getAttribute("nonce"));a=l(n.map(d=>{if(d=Ja(d),d in Vn)return;Vn[d]=!0;const u=d.endsWith(".css"),y=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${y}`))return;const b=document.createElement("link");if(b.rel=u?"stylesheet":Ya,u||(b.as="script"),b.crossOrigin="",b.href=d,c&&b.setAttribute("nonce",c),document.head.appendChild(b),u)return new Promise((x,w)=>{b.addEventListener("load",x),b.addEventListener("error",()=>w(new Error(`Unable to preload CSS for ${d}`)))})}))}function i(l){const s=new Event("vite:preloadError",{cancelable:!0});if(s.payload=l,window.dispatchEvent(s),!s.defaultPrevented)throw l}return a.then(l=>{for(const s of l||[])s.status==="rejected"&&i(s.reason);return r().catch(i)})},Xa={dependsOn:{}};function Qa(e,r){return new Set([e,...(r??Xa).dependsOn[e]??[]])}function Za(e,r){const n=r instanceof Set?r:new Set(r);return n.size===0?!1:e.some(o=>n.has(o))}function rn(e){return(e.sourceEnd.type?1:0)+(e.targetEnd.type?1:0)}function ei(e){return rn(e)===0}function ti(e,r){return rn(r)-rn(e)||e.label.localeCompare(r.label)}function Ur(e){return new Map(e.map(r=>[r.name,r]))}function kn(e,r){if(e)return r.relationships.find(n=>n.name===e||n.sysmlName===e)}function mt(e,r,n){var l;if(!r)return!0;if(!e)return!1;if(e===r)return!0;const o=Array.isArray(n)?Ur(n):n;let a=e;const i=new Set;for(;a&&!i.has(a);){if(a===r)return!0;i.add(a),a=(l=o.get(a))==null?void 0:l.superType}return!1}function zr(e,r,n){const o=Ur(n.kinds),a=[];for(const i of n.relationships)i.isAbstract||(mt(e.kind,i.sourceEnd.type,o)&&mt(r.kind,i.targetEnd.type,o)&&a.push({definition:i,direction:"outgoing",sourceId:e.id,targetId:r.id}),mt(r.kind,i.sourceEnd.type,o)&&mt(e.kind,i.targetEnd.type,o)&&a.push({definition:i,direction:"incoming",sourceId:r.id,targetId:e.id}));return a.sort((i,l)=>ti(i.definition,l.definition))}const on={AcceptActionUsage:{name:"AcceptActionUsage",abstract:!1,superTypes:["ActionUsage"],features:{payloadArgument:{name:"payloadArgument",ecoreName:"payloadArgument",kind:"reference",type:"Expression",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,hasDerivation:!0},payloadParameter:{name:"payloadParameter",ecoreName:"payloadParameter",kind:"reference",type:"ReferenceUsage",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,subsets:["Usage/nestedReference","Step/parameter"],hasDerivation:!0},receiverArgument:{name:"receiverArgument",ecoreName:"receiverArgument",kind:"reference",type:"Expression",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,hasDerivation:!0}},operations:[{name:"isTriggerAction",type:"boolean",lowerBound:1,upperBound:1,parameters:[],hasBody:!0}]},ActionDefinition:{name:"ActionDefinition",abstract:!1,superTypes:["OccurrenceDefinition","Behavior"],features:{action:{name:"action",ecoreName:"action",kind:"reference",type:"ActionUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Behavior/step","Definition/usage"],hasDerivation:!0}},operations:[]},ActionUsage:{name:"ActionUsage",abstract:!1,superTypes:["OccurrenceUsage","Step"],features:{actionDefinition:{name:"actionDefinition",ecoreName:"actionDefinition",kind:"reference",type:"Behavior",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,redefines:["Step/behavior","OccurrenceUsage/occurrenceDefinition"]}},operations:[{name:"argument",type:"Expression",lowerBound:0,upperBound:1,parameters:[{name:"i",type:"number",many:!1}],hasBody:!0},{name:"inputParameter",type:"Feature",lowerBound:0,upperBound:1,parameters:[{name:"i",type:"number",many:!1}],hasBody:!0},{name:"inputParameters",type:"Feature",lowerBound:0,upperBound:-1,parameters:[],hasBody:!0},{name:"isSubactionUsage",type:"boolean",lowerBound:1,upperBound:1,parameters:[],hasBody:!0}]},ActorMembership:{name:"ActorMembership",abstract:!1,superTypes:["ParameterMembership"],features:{ownedActorParameter:{name:"ownedActorParameter",ecoreName:"ownedActorParameter",kind:"reference",type:"PartUsage",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,redefines:["ParameterMembership/ownedMemberParameter"]}},operations:[]},AllocationDefinition:{name:"AllocationDefinition",abstract:!1,superTypes:["ConnectionDefinition"],features:{allocation:{name:"allocation",ecoreName:"allocation",kind:"reference",type:"AllocationUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Definition/usage"],hasDerivation:!0}},operations:[]},AllocationUsage:{name:"AllocationUsage",abstract:!1,superTypes:["ConnectionUsage"],features:{allocationDefinition:{name:"allocationDefinition",ecoreName:"allocationDefinition",kind:"reference",type:"AllocationDefinition",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,redefines:["ConnectionUsage/connectionDefinition"]}},operations:[]},AnalysisCaseDefinition:{name:"AnalysisCaseDefinition",abstract:!1,superTypes:["CaseDefinition"],features:{resultExpression:{name:"resultExpression",ecoreName:"resultExpression",kind:"reference",type:"Expression",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,subsets:["Function/expression","Type/ownedFeature"],hasDerivation:!0}},operations:[]},AnalysisCaseUsage:{name:"AnalysisCaseUsage",abstract:!1,superTypes:["CaseUsage"],features:{analysisCaseDefinition:{name:"analysisCaseDefinition",ecoreName:"analysisCaseDefinition",kind:"reference",type:"AnalysisCaseDefinition",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,redefines:["CaseUsage/caseDefinition"]},resultExpression:{name:"resultExpression",ecoreName:"resultExpression",kind:"reference",type:"Expression",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,subsets:["Type/ownedFeature"],hasDerivation:!0}},operations:[]},AnnotatingElement:{name:"AnnotatingElement",abstract:!1,superTypes:["Element"],features:{annotatedElement:{name:"annotatedElement",ecoreName:"annotatedElement",kind:"reference",type:"Element",lowerBound:1,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,hasDerivation:!0},annotation:{name:"annotation",ecoreName:"annotation",kind:"reference",type:"Annotation",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,opposite:"Annotation/annotatingElement",hasDerivation:!0},ownedAnnotatingRelationship:{name:"ownedAnnotatingRelationship",ecoreName:"ownedAnnotatingRelationship",kind:"reference",type:"Annotation",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,opposite:"Annotation/owningAnnotatingElement",subsets:["AnnotatingElement/annotation","Element/ownedRelationship"],hasDerivation:!0},owningAnnotatingRelationship:{name:"owningAnnotatingRelationship",ecoreName:"owningAnnotatingRelationship",kind:"reference",type:"Annotation",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,opposite:"Annotation/ownedAnnotatingElement",subsets:["Element/owningRelationship","AnnotatingElement/annotation"]}},operations:[]},Annotation:{name:"Annotation",abstract:!1,superTypes:["Relationship"],features:{annotatedElement:{name:"annotatedElement",ecoreName:"annotatedElement",kind:"reference",type:"Element",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1,redefines:["Relationship/target"]},annotatingElement:{name:"annotatingElement",ecoreName:"annotatingElement",kind:"reference",type:"AnnotatingElement",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,opposite:"AnnotatingElement/annotation",redefines:["Relationship/source"],hasDerivation:!0},ownedAnnotatingElement:{name:"ownedAnnotatingElement",ecoreName:"ownedAnnotatingElement",kind:"reference",type:"AnnotatingElement",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,opposite:"AnnotatingElement/owningAnnotatingRelationship",subsets:["Annotation/annotatingElement","Relationship/ownedRelatedElement"],hasDerivation:!0},owningAnnotatedElement:{name:"owningAnnotatedElement",ecoreName:"owningAnnotatedElement",kind:"reference",type:"Element",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,opposite:"Element/ownedAnnotation",subsets:["Annotation/annotatedElement","Relationship/owningRelatedElement"]},owningAnnotatingElement:{name:"owningAnnotatingElement",ecoreName:"owningAnnotatingElement",kind:"reference",type:"AnnotatingElement",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,opposite:"AnnotatingElement/ownedAnnotatingRelationship",subsets:["Annotation/annotatingElement","Relationship/owningRelatedElement"]}},operations:[]},AssertConstraintUsage:{name:"AssertConstraintUsage",abstract:!1,superTypes:["ConstraintUsage","Invariant"],features:{assertedConstraint:{name:"assertedConstraint",ecoreName:"assertedConstraint",kind:"reference",type:"ConstraintUsage",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,hasDerivation:!0}},operations:[]},AssignmentActionUsage:{name:"AssignmentActionUsage",abstract:!1,superTypes:["ActionUsage"],features:{referent:{name:"referent",ecoreName:"referent",kind:"reference",type:"Feature",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,subsets:["Namespace/member"],hasDerivation:!0},targetArgument:{name:"targetArgument",ecoreName:"targetArgument",kind:"reference",type:"Expression",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,hasDerivation:!0},valueExpression:{name:"valueExpression",ecoreName:"valueExpression",kind:"reference",type:"Expression",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,hasDerivation:!0}},operations:[]},Association:{name:"Association",abstract:!1,superTypes:["Classifier","Relationship"],features:{associationEnd:{name:"associationEnd",ecoreName:"associationEnd",kind:"reference",type:"Feature",lowerBound:0,upperBound:-1,many:!0,ordered:!1,containment:!1,derived:!0,volatile:!0,redefines:["Type/endFeature"]},relatedType:{name:"relatedType",ecoreName:"relatedType",kind:"reference",type:"Type",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,redefines:["Relationship/relatedElement"],hasDerivation:!0},sourceType:{name:"sourceType",ecoreName:"sourceType",kind:"reference",type:"Type",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,subsets:["Association/relatedType"],redefines:["Relationship/source"],hasDerivation:!0},targetType:{name:"targetType",ecoreName:"targetType",kind:"reference",type:"Type",lowerBound:0,upperBound:-1,many:!0,ordered:!1,containment:!1,derived:!0,volatile:!0,subsets:["Association/relatedType"],redefines:["Relationship/target"],hasDerivation:!0}},operations:[]},AssociationStructure:{name:"AssociationStructure",abstract:!1,superTypes:["Association","Structure"],features:{},operations:[]},AttributeDefinition:{name:"AttributeDefinition",abstract:!1,superTypes:["Definition","DataType"],features:{},operations:[]},AttributeUsage:{name:"AttributeUsage",abstract:!1,superTypes:["Usage"],features:{attributeDefinition:{name:"attributeDefinition",ecoreName:"attributeDefinition",kind:"reference",type:"DataType",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,redefines:["Usage/definition"]}},operations:[]},Behavior:{name:"Behavior",abstract:!1,superTypes:["Class"],features:{parameter:{name:"parameter",ecoreName:"parameter",kind:"reference",type:"Feature",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,redefines:["Type/directedFeature"]},step:{name:"step",ecoreName:"step",kind:"reference",type:"Step",lowerBound:0,upperBound:-1,many:!0,ordered:!1,containment:!1,derived:!0,volatile:!0,subsets:["Type/feature"],hasDerivation:!0}},operations:[]},BindingConnector:{name:"BindingConnector",abstract:!1,superTypes:["Connector"],features:{},operations:[]},BindingConnectorAsUsage:{name:"BindingConnectorAsUsage",abstract:!1,superTypes:["ConnectorAsUsage","BindingConnector"],features:{},operations:[]},BooleanExpression:{name:"BooleanExpression",abstract:!1,superTypes:["Expression"],features:{predicate:{name:"predicate",ecoreName:"predicate",kind:"reference",type:"Predicate",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,redefines:["Expression/function"]}},operations:[]},CalculationDefinition:{name:"CalculationDefinition",abstract:!1,superTypes:["ActionDefinition","Function"],features:{calculation:{name:"calculation",ecoreName:"calculation",kind:"reference",type:"CalculationUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["ActionDefinition/action","Function/expression"],hasDerivation:!0}},operations:[]},CalculationUsage:{name:"CalculationUsage",abstract:!1,superTypes:["ActionUsage","Expression"],features:{calculationDefinition:{name:"calculationDefinition",ecoreName:"calculationDefinition",kind:"reference",type:"Function",lowerBound:0,upperBound:1,many:!1,ordered:!0,containment:!1,derived:!0,volatile:!0,redefines:["Expression/function","ActionUsage/actionDefinition"]}},operations:[]},CaseDefinition:{name:"CaseDefinition",abstract:!1,superTypes:["CalculationDefinition"],features:{actorParameter:{name:"actorParameter",ecoreName:"actorParameter",kind:"reference",type:"PartUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Behavior/parameter","Definition/usage"],hasDerivation:!0},objectiveRequirement:{name:"objectiveRequirement",ecoreName:"objectiveRequirement",kind:"reference",type:"RequirementUsage",lowerBound:0,upperBound:1,many:!1,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Definition/usage"],hasDerivation:!0},subjectParameter:{name:"subjectParameter",ecoreName:"subjectParameter",kind:"reference",type:"Usage",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,subsets:["Behavior/parameter","Definition/usage"],hasDerivation:!0}},operations:[]},CaseUsage:{name:"CaseUsage",abstract:!1,superTypes:["CalculationUsage"],features:{actorParameter:{name:"actorParameter",ecoreName:"actorParameter",kind:"reference",type:"PartUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Step/parameter","Usage/usage"],hasDerivation:!0},caseDefinition:{name:"caseDefinition",ecoreName:"caseDefinition",kind:"reference",type:"CaseDefinition",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,redefines:["CalculationUsage/calculationDefinition"]},objectiveRequirement:{name:"objectiveRequirement",ecoreName:"objectiveRequirement",kind:"reference",type:"RequirementUsage",lowerBound:0,upperBound:1,many:!1,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Usage/usage"],hasDerivation:!0},subjectParameter:{name:"subjectParameter",ecoreName:"subjectParameter",kind:"reference",type:"Usage",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,subsets:["Step/parameter","Usage/usage"],hasDerivation:!0}},operations:[]},Class:{name:"Class",abstract:!1,superTypes:["Classifier"],features:{},operations:[]},Classifier:{name:"Classifier",abstract:!1,superTypes:["Type"],features:{ownedSubclassification:{name:"ownedSubclassification",ecoreName:"ownedSubclassification",kind:"reference",type:"Subclassification",lowerBound:0,upperBound:-1,many:!0,ordered:!1,containment:!1,derived:!0,volatile:!0,opposite:"Subclassification/owningClassifier",subsets:["Type/ownedSpecialization"],hasDerivation:!0}},operations:[]},CollectExpression:{name:"CollectExpression",abstract:!1,superTypes:["OperatorExpression"],features:{},operations:[]},Comment:{name:"Comment",abstract:!1,superTypes:["AnnotatingElement"],features:{body:{name:"body",ecoreName:"body",kind:"attribute",type:"EString",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1},locale:{name:"locale",ecoreName:"locale",kind:"attribute",type:"EString",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1}},operations:[]},ConcernDefinition:{name:"ConcernDefinition",abstract:!1,superTypes:["RequirementDefinition"],features:{},operations:[]},ConcernUsage:{name:"ConcernUsage",abstract:!1,superTypes:["RequirementUsage"],features:{concernDefinition:{name:"concernDefinition",ecoreName:"concernDefinition",kind:"reference",type:"ConcernDefinition",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,redefines:["RequirementUsage/requirementDefinition"]}},operations:[]},ConjugatedPortDefinition:{name:"ConjugatedPortDefinition",abstract:!1,superTypes:["PortDefinition"],features:{originalPortDefinition:{name:"originalPortDefinition",ecoreName:"originalPortDefinition",kind:"reference",type:"PortDefinition",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,opposite:"PortDefinition/conjugatedPortDefinition",redefines:["Element/owningNamespace"]},ownedPortConjugator:{name:"ownedPortConjugator",ecoreName:"ownedPortConjugator",kind:"reference",type:"PortConjugation",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,opposite:"PortConjugation/conjugatedPortDefinition",redefines:["Type/ownedConjugator"]}},operations:[]},ConjugatedPortTyping:{name:"ConjugatedPortTyping",abstract:!1,superTypes:["FeatureTyping"],features:{conjugatedPortDefinition:{name:"conjugatedPortDefinition",ecoreName:"conjugatedPortDefinition",kind:"reference",type:"ConjugatedPortDefinition",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1,redefines:["FeatureTyping/type"]},portDefinition:{name:"portDefinition",ecoreName:"portDefinition",kind:"reference",type:"PortDefinition",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,hasDerivation:!0}},operations:[]},Conjugation:{name:"Conjugation",abstract:!1,superTypes:["Relationship"],features:{conjugatedType:{name:"conjugatedType",ecoreName:"conjugatedType",kind:"reference",type:"Type",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1,redefines:["Relationship/source"]},originalType:{name:"originalType",ecoreName:"originalType",kind:"reference",type:"Type",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1,redefines:["Relationship/target"]},owningType:{name:"owningType",ecoreName:"owningType",kind:"reference",type:"Type",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,opposite:"Type/ownedConjugator",subsets:["Conjugation/conjugatedType","Relationship/owningRelatedElement"]}},operations:[]},ConnectionDefinition:{name:"ConnectionDefinition",abstract:!1,superTypes:["PartDefinition","AssociationStructure"],features:{connectionEnd:{name:"connectionEnd",ecoreName:"connectionEnd",kind:"reference",type:"Usage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,redefines:["Association/associationEnd"]}},operations:[]},ConnectionUsage:{name:"ConnectionUsage",abstract:!1,superTypes:["ConnectorAsUsage","PartUsage"],features:{connectionDefinition:{name:"connectionDefinition",ecoreName:"connectionDefinition",kind:"reference",type:"AssociationStructure",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["ItemUsage/itemDefinition"],redefines:["Connector/association"]}},operations:[]},Connector:{name:"Connector",abstract:!1,superTypes:["Feature","Relationship"],features:{association:{name:"association",ecoreName:"association",kind:"reference",type:"Association",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,redefines:["Feature/type"]},connectorEnd:{name:"connectorEnd",ecoreName:"connectorEnd",kind:"reference",type:"Feature",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,redefines:["Type/endFeature"]},defaultFeaturingType:{name:"defaultFeaturingType",ecoreName:"defaultFeaturingType",kind:"reference",type:"Type",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0},relatedFeature:{name:"relatedFeature",ecoreName:"relatedFeature",kind:"reference",type:"Feature",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,redefines:["Relationship/relatedElement"],hasDerivation:!0},sourceFeature:{name:"sourceFeature",ecoreName:"sourceFeature",kind:"reference",type:"Feature",lowerBound:0,upperBound:1,many:!1,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Connector/relatedFeature"],redefines:["Relationship/source"],hasDerivation:!0},targetFeature:{name:"targetFeature",ecoreName:"targetFeature",kind:"reference",type:"Feature",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Connector/relatedFeature"],redefines:["Relationship/target"],hasDerivation:!0}},operations:[]},ConnectorAsUsage:{name:"ConnectorAsUsage",abstract:!0,superTypes:["Usage","Connector"],features:{},operations:[]},ConstraintDefinition:{name:"ConstraintDefinition",abstract:!1,superTypes:["OccurrenceDefinition","Predicate"],features:{},operations:[]},ConstraintUsage:{name:"ConstraintUsage",abstract:!1,superTypes:["OccurrenceUsage","BooleanExpression"],features:{constraintDefinition:{name:"constraintDefinition",ecoreName:"constraintDefinition",kind:"reference",type:"Predicate",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,redefines:["BooleanExpression/predicate"]}},operations:[]},ConstructorExpression:{name:"ConstructorExpression",abstract:!1,superTypes:["InstantiationExpression"],features:{},operations:[]},ControlNode:{name:"ControlNode",abstract:!0,superTypes:["ActionUsage"],features:{},operations:[{name:"multiplicityHasBounds",type:"boolean",lowerBound:1,upperBound:1,parameters:[{name:"mult",type:"Multiplicity",many:!1},{name:"lower",type:"number",many:!1},{name:"upper",type:"number",many:!1}],hasBody:!0}]},CrossSubsetting:{name:"CrossSubsetting",abstract:!1,superTypes:["Subsetting"],features:{crossedFeature:{name:"crossedFeature",ecoreName:"crossedFeature",kind:"reference",type:"Feature",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1,redefines:["Subsetting/subsettedFeature"]},crossingFeature:{name:"crossingFeature",ecoreName:"crossingFeature",kind:"reference",type:"Feature",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,opposite:"Feature/ownedCrossSubsetting",redefines:["Subsetting/owningFeature","Subsetting/subsettingFeature"]}},operations:[]},DataType:{name:"DataType",abstract:!1,superTypes:["Classifier"],features:{},operations:[]},DecisionNode:{name:"DecisionNode",abstract:!1,superTypes:["ControlNode"],features:{},operations:[]},Definition:{name:"Definition",abstract:!1,superTypes:["Classifier"],features:{directedUsage:{name:"directedUsage",ecoreName:"directedUsage",kind:"reference",type:"Usage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Type/directedFeature","Definition/usage"],hasDerivation:!0},isVariation:{name:"isVariation",ecoreName:"isVariation",kind:"attribute",type:"EBoolean",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1},ownedAction:{name:"ownedAction",ecoreName:"ownedAction",kind:"reference",type:"ActionUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Definition/ownedOccurrence"],hasDerivation:!0},ownedAllocation:{name:"ownedAllocation",ecoreName:"ownedAllocation",kind:"reference",type:"AllocationUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Definition/ownedConnection"],hasDerivation:!0},ownedAnalysisCase:{name:"ownedAnalysisCase",ecoreName:"ownedAnalysisCase",kind:"reference",type:"AnalysisCaseUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Definition/ownedCase"],hasDerivation:!0},ownedAttribute:{name:"ownedAttribute",ecoreName:"ownedAttribute",kind:"reference",type:"AttributeUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Definition/ownedUsage"],hasDerivation:!0},ownedCalculation:{name:"ownedCalculation",ecoreName:"ownedCalculation",kind:"reference",type:"CalculationUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Definition/ownedAction"],hasDerivation:!0},ownedCase:{name:"ownedCase",ecoreName:"ownedCase",kind:"reference",type:"CaseUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Definition/ownedCalculation"],hasDerivation:!0},ownedConcern:{name:"ownedConcern",ecoreName:"ownedConcern",kind:"reference",type:"ConcernUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!1,containment:!1,derived:!0,volatile:!0,subsets:["Definition/ownedRequirement"],hasDerivation:!0},ownedConnection:{name:"ownedConnection",ecoreName:"ownedConnection",kind:"reference",type:"ConnectorAsUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Definition/ownedUsage"],hasDerivation:!0},ownedConstraint:{name:"ownedConstraint",ecoreName:"ownedConstraint",kind:"reference",type:"ConstraintUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Definition/ownedOccurrence"],hasDerivation:!0},ownedEnumeration:{name:"ownedEnumeration",ecoreName:"ownedEnumeration",kind:"reference",type:"EnumerationUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Definition/ownedAttribute"],hasDerivation:!0},ownedFlow:{name:"ownedFlow",ecoreName:"ownedFlow",kind:"reference",type:"FlowUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!1,containment:!1,derived:!0,volatile:!0,subsets:["Definition/ownedConnection"],hasDerivation:!0},ownedInterface:{name:"ownedInterface",ecoreName:"ownedInterface",kind:"reference",type:"InterfaceUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Definition/ownedConnection"],hasDerivation:!0},ownedItem:{name:"ownedItem",ecoreName:"ownedItem",kind:"reference",type:"ItemUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Definition/ownedOccurrence"],hasDerivation:!0},ownedMetadata:{name:"ownedMetadata",ecoreName:"ownedMetadata",kind:"reference",type:"MetadataUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Definition/ownedItem"],hasDerivation:!0},ownedOccurrence:{name:"ownedOccurrence",ecoreName:"ownedOccurrence",kind:"reference",type:"OccurrenceUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Definition/ownedUsage"],hasDerivation:!0},ownedPart:{name:"ownedPart",ecoreName:"ownedPart",kind:"reference",type:"PartUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Definition/ownedItem"],hasDerivation:!0},ownedPort:{name:"ownedPort",ecoreName:"ownedPort",kind:"reference",type:"PortUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Definition/ownedUsage"],hasDerivation:!0},ownedReference:{name:"ownedReference",ecoreName:"ownedReference",kind:"reference",type:"ReferenceUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Definition/ownedUsage"],hasDerivation:!0},ownedRendering:{name:"ownedRendering",ecoreName:"ownedRendering",kind:"reference",type:"RenderingUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Definition/ownedPart"],hasDerivation:!0},ownedRequirement:{name:"ownedRequirement",ecoreName:"ownedRequirement",kind:"reference",type:"RequirementUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Definition/ownedConstraint"],hasDerivation:!0},ownedState:{name:"ownedState",ecoreName:"ownedState",kind:"reference",type:"StateUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Definition/ownedAction"],hasDerivation:!0},ownedTransition:{name:"ownedTransition",ecoreName:"ownedTransition",kind:"reference",type:"TransitionUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!1,containment:!1,derived:!0,volatile:!0,subsets:["Definition/ownedUsage"],hasDerivation:!0},ownedUsage:{name:"ownedUsage",ecoreName:"ownedUsage",kind:"reference",type:"Usage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,opposite:"Usage/owningDefinition",subsets:["Type/ownedFeature","Definition/usage"],hasDerivation:!0},ownedUseCase:{name:"ownedUseCase",ecoreName:"ownedUseCase",kind:"reference",type:"UseCaseUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Definition/ownedCase"],hasDerivation:!0},ownedVerificationCase:{name:"ownedVerificationCase",ecoreName:"ownedVerificationCase",kind:"reference",type:"VerificationCaseUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Definition/ownedCase"],hasDerivation:!0},ownedView:{name:"ownedView",ecoreName:"ownedView",kind:"reference",type:"ViewUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Definition/ownedPart"],hasDerivation:!0},ownedViewpoint:{name:"ownedViewpoint",ecoreName:"ownedViewpoint",kind:"reference",type:"ViewpointUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Definition/ownedRequirement"],hasDerivation:!0},usage:{name:"usage",ecoreName:"usage",kind:"reference",type:"Usage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Type/feature"],hasDerivation:!0},variant:{name:"variant",ecoreName:"variant",kind:"reference",type:"Usage",lowerBound:0,upperBound:-1,many:!0,ordered:!1,containment:!1,derived:!0,volatile:!0,subsets:["Namespace/ownedMember"],hasDerivation:!0},variantMembership:{name:"variantMembership",ecoreName:"variantMembership",kind:"reference",type:"VariantMembership",lowerBound:0,upperBound:-1,many:!0,ordered:!1,containment:!1,derived:!0,volatile:!0,subsets:["Namespace/ownedMembership"],hasDerivation:!0}},operations:[]},Dependency:{name:"Dependency",abstract:!1,superTypes:["Relationship"],features:{client:{name:"client",ecoreName:"client",kind:"reference",type:"Element",lowerBound:1,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!1,volatile:!1,redefines:["Relationship/source"]},supplier:{name:"supplier",ecoreName:"supplier",kind:"reference",type:"Element",lowerBound:1,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!1,volatile:!1,redefines:["Relationship/target"]}},operations:[]},Differencing:{name:"Differencing",abstract:!1,superTypes:["Relationship"],features:{differencingType:{name:"differencingType",ecoreName:"differencingType",kind:"reference",type:"Type",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1,redefines:["Relationship/target"]},typeDifferenced:{name:"typeDifferenced",ecoreName:"typeDifferenced",kind:"reference",type:"Type",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,opposite:"Type/ownedDifferencing",subsets:["Relationship/owningRelatedElement"],redefines:["Relationship/source"]}},operations:[]},Disjoining:{name:"Disjoining",abstract:!1,superTypes:["Relationship"],features:{disjoiningType:{name:"disjoiningType",ecoreName:"disjoiningType",kind:"reference",type:"Type",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1,redefines:["Relationship/target"]},owningType:{name:"owningType",ecoreName:"owningType",kind:"reference",type:"Type",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,opposite:"Type/ownedDisjoining",subsets:["Relationship/owningRelatedElement","Disjoining/typeDisjoined"]},typeDisjoined:{name:"typeDisjoined",ecoreName:"typeDisjoined",kind:"reference",type:"Type",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1,redefines:["Relationship/source"]}},operations:[]},Documentation:{name:"Documentation",abstract:!1,superTypes:["Comment"],features:{documentedElement:{name:"documentedElement",ecoreName:"documentedElement",kind:"reference",type:"Element",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,opposite:"Element/documentation",subsets:["Element/owner"],redefines:["AnnotatingElement/annotatedElement"]}},operations:[]},Element:{name:"Element",abstract:!0,superTypes:[],features:{aliasIds:{name:"aliasIds",ecoreName:"aliasIds",kind:"attribute",type:"EString",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!1,volatile:!1},declaredName:{name:"declaredName",ecoreName:"declaredName",kind:"attribute",type:"EString",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1},declaredShortName:{name:"declaredShortName",ecoreName:"declaredShortName",kind:"attribute",type:"EString",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1},documentation:{name:"documentation",ecoreName:"documentation",kind:"reference",type:"Documentation",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,opposite:"Documentation/documentedElement",subsets:["Element/ownedElement"],hasDerivation:!0},elementId:{name:"elementId",ecoreName:"elementId",kind:"attribute",type:"EString",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1},isImpliedIncluded:{name:"isImpliedIncluded",ecoreName:"isImpliedIncluded",kind:"attribute",type:"EBoolean",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1},isLibraryElement:{name:"isLibraryElement",ecoreName:"isLibraryElement",kind:"attribute",type:"EBoolean",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,hasDerivation:!0},name:{name:"name",ecoreName:"name",kind:"attribute",type:"EString",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,hasDerivation:!0},ownedAnnotation:{name:"ownedAnnotation",ecoreName:"ownedAnnotation",kind:"reference",type:"Annotation",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,opposite:"Annotation/owningAnnotatedElement",subsets:["Element/ownedRelationship"],hasDerivation:!0},ownedElement:{name:"ownedElement",ecoreName:"ownedElement",kind:"reference",type:"Element",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,opposite:"Element/owner",hasDerivation:!0},ownedRelationship:{name:"ownedRelationship",ecoreName:"ownedRelationship",kind:"reference",type:"Relationship",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!0,derived:!1,volatile:!1,opposite:"Relationship/owningRelatedElement"},owner:{name:"owner",ecoreName:"owner",kind:"reference",type:"Element",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,opposite:"Element/ownedElement",hasDerivation:!0},owningMembership:{name:"owningMembership",ecoreName:"owningMembership",kind:"reference",type:"OwningMembership",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,opposite:"OwningMembership/ownedMemberElement",subsets:["Element/owningRelationship"]},owningNamespace:{name:"owningNamespace",ecoreName:"owningNamespace",kind:"reference",type:"Namespace",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,opposite:"Namespace/ownedMember",hasDerivation:!0},owningRelationship:{name:"owningRelationship",ecoreName:"owningRelationship",kind:"reference",type:"Relationship",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1,opposite:"Relationship/ownedRelatedElement"},qualifiedName:{name:"qualifiedName",ecoreName:"qualifiedName",kind:"attribute",type:"EString",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,hasDerivation:!0},shortName:{name:"shortName",ecoreName:"shortName",kind:"attribute",type:"EString",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,hasDerivation:!0},textualRepresentation:{name:"textualRepresentation",ecoreName:"textualRepresentation",kind:"reference",type:"TextualRepresentation",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,opposite:"TextualRepresentation/representedElement",subsets:["Element/ownedElement"],hasDerivation:!0}},operations:[{name:"effectiveName",type:"string",lowerBound:0,upperBound:1,parameters:[],hasBody:!0},{name:"effectiveShortName",type:"string",lowerBound:0,upperBound:1,parameters:[],hasBody:!0},{name:"escapedName",type:"string",lowerBound:0,upperBound:1,parameters:[]},{name:"libraryNamespace",type:"Namespace",lowerBound:0,upperBound:1,parameters:[],hasBody:!0},{name:"path",type:"string",lowerBound:1,upperBound:1,parameters:[],hasBody:!0}]},ElementFilterMembership:{name:"ElementFilterMembership",abstract:!1,superTypes:["OwningMembership"],features:{condition:{name:"condition",ecoreName:"condition",kind:"reference",type:"Expression",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,redefines:["OwningMembership/ownedMemberElement"]}},operations:[]},EndFeatureMembership:{name:"EndFeatureMembership",abstract:!1,superTypes:["FeatureMembership"],features:{},operations:[]},EnumerationDefinition:{name:"EnumerationDefinition",abstract:!1,superTypes:["AttributeDefinition"],features:{enumeratedValue:{name:"enumeratedValue",ecoreName:"enumeratedValue",kind:"reference",type:"EnumerationUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,redefines:["Definition/variant"]}},operations:[]},EnumerationUsage:{name:"EnumerationUsage",abstract:!1,superTypes:["AttributeUsage"],features:{enumerationDefinition:{name:"enumerationDefinition",ecoreName:"enumerationDefinition",kind:"reference",type:"EnumerationDefinition",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,redefines:["AttributeUsage/attributeDefinition"]}},operations:[]},EventOccurrenceUsage:{name:"EventOccurrenceUsage",abstract:!1,superTypes:["OccurrenceUsage"],features:{eventOccurrence:{name:"eventOccurrence",ecoreName:"eventOccurrence",kind:"reference",type:"OccurrenceUsage",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,hasDerivation:!0}},operations:[]},ExhibitStateUsage:{name:"ExhibitStateUsage",abstract:!1,superTypes:["StateUsage","PerformActionUsage"],features:{exhibitedState:{name:"exhibitedState",ecoreName:"exhibitedState",kind:"reference",type:"StateUsage",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,redefines:["PerformActionUsage/performedAction"]}},operations:[]},Expose:{name:"Expose",abstract:!0,superTypes:["Import"],features:{},operations:[]},Expression:{name:"Expression",abstract:!1,superTypes:["Step"],features:{function:{name:"function",ecoreName:"function",kind:"reference",type:"Function",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,redefines:["Step/behavior"]},isModelLevelEvaluable:{name:"isModelLevelEvaluable",ecoreName:"isModelLevelEvaluable",kind:"attribute",type:"EBoolean",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,hasDerivation:!0},result:{name:"result",ecoreName:"result",kind:"reference",type:"Feature",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,subsets:["Type/output","Step/parameter"],hasDerivation:!0}},operations:[{name:"checkCondition",type:"boolean",lowerBound:1,upperBound:1,parameters:[{name:"target",type:"Element",many:!1}],hasBody:!0},{name:"evaluate",type:"Element",lowerBound:0,upperBound:-1,parameters:[{name:"target",type:"Element",many:!1}],hasBody:!0},{name:"modelLevelEvaluable",type:"boolean",lowerBound:1,upperBound:1,parameters:[{name:"visited",type:"Feature",many:!0}],hasBody:!0}]},Feature:{name:"Feature",abstract:!1,superTypes:["Type"],features:{chainingFeature:{name:"chainingFeature",ecoreName:"chainingFeature",kind:"reference",type:"Feature",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,hasDerivation:!0},crossFeature:{name:"crossFeature",ecoreName:"crossFeature",kind:"reference",type:"Feature",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,hasDerivation:!0},direction:{name:"direction",ecoreName:"direction",kind:"attribute",type:"FeatureDirectionKind",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1},endOwningType:{name:"endOwningType",ecoreName:"endOwningType",kind:"reference",type:"Type",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,opposite:"Type/ownedEndFeature",subsets:["Feature/owningType"]},featureTarget:{name:"featureTarget",ecoreName:"featureTarget",kind:"reference",type:"Feature",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,hasDerivation:!0},featuringType:{name:"featuringType",ecoreName:"featuringType",kind:"reference",type:"Type",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,hasDerivation:!0},isComposite:{name:"isComposite",ecoreName:"isComposite",kind:"attribute",type:"EBoolean",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1},isConstant:{name:"isConstant",ecoreName:"isConstant",kind:"attribute",type:"EBoolean",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1},isDerived:{name:"isDerived",ecoreName:"isDerived",kind:"attribute",type:"EBoolean",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1},isEnd:{name:"isEnd",ecoreName:"isEnd",kind:"attribute",type:"EBoolean",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1},isOrdered:{name:"isOrdered",ecoreName:"isOrdered",kind:"attribute",type:"EBoolean",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1},isPortion:{name:"isPortion",ecoreName:"isPortion",kind:"attribute",type:"EBoolean",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1},isUnique:{name:"isUnique",ecoreName:"isUnique",kind:"attribute",type:"EBoolean",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1},isVariable:{name:"isVariable",ecoreName:"isVariable",kind:"attribute",type:"EBoolean",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1},ownedCrossSubsetting:{name:"ownedCrossSubsetting",ecoreName:"ownedCrossSubsetting",kind:"reference",type:"CrossSubsetting",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,opposite:"CrossSubsetting/crossingFeature",subsets:["Feature/ownedSubsetting"],hasDerivation:!0},ownedFeatureChaining:{name:"ownedFeatureChaining",ecoreName:"ownedFeatureChaining",kind:"reference",type:"FeatureChaining",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,opposite:"FeatureChaining/featureChained",subsets:["Element/ownedRelationship"],hasDerivation:!0},ownedFeatureInverting:{name:"ownedFeatureInverting",ecoreName:"ownedFeatureInverting",kind:"reference",type:"FeatureInverting",lowerBound:0,upperBound:-1,many:!0,ordered:!1,containment:!1,derived:!0,volatile:!0,opposite:"FeatureInverting/owningFeature",subsets:["Element/ownedRelationship"],hasDerivation:!0},ownedRedefinition:{name:"ownedRedefinition",ecoreName:"ownedRedefinition",kind:"reference",type:"Redefinition",lowerBound:0,upperBound:-1,many:!0,ordered:!1,containment:!1,derived:!0,volatile:!0,subsets:["Feature/ownedSubsetting"],hasDerivation:!0},ownedReferenceSubsetting:{name:"ownedReferenceSubsetting",ecoreName:"ownedReferenceSubsetting",kind:"reference",type:"ReferenceSubsetting",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,opposite:"ReferenceSubsetting/referencingFeature",subsets:["Feature/ownedSubsetting"],hasDerivation:!0},ownedSubsetting:{name:"ownedSubsetting",ecoreName:"ownedSubsetting",kind:"reference",type:"Subsetting",lowerBound:0,upperBound:-1,many:!0,ordered:!1,containment:!1,derived:!0,volatile:!0,opposite:"Subsetting/owningFeature",subsets:["Type/ownedSpecialization"],hasDerivation:!0},ownedTypeFeaturing:{name:"ownedTypeFeaturing",ecoreName:"ownedTypeFeaturing",kind:"reference",type:"TypeFeaturing",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,opposite:"TypeFeaturing/owningFeatureOfType",subsets:["Element/ownedRelationship"],hasDerivation:!0},ownedTyping:{name:"ownedTyping",ecoreName:"ownedTyping",kind:"reference",type:"FeatureTyping",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,opposite:"FeatureTyping/owningFeature",subsets:["Type/ownedSpecialization"],hasDerivation:!0},owningFeatureMembership:{name:"owningFeatureMembership",ecoreName:"owningFeatureMembership",kind:"reference",type:"FeatureMembership",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,opposite:"FeatureMembership/ownedMemberFeature",subsets:["Element/owningMembership"]},owningType:{name:"owningType",ecoreName:"owningType",kind:"reference",type:"Type",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,opposite:"Type/ownedFeature",subsets:["Element/owningNamespace","Feature/featuringType"]},type:{name:"type",ecoreName:"type",kind:"reference",type:"Type",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,hasDerivation:!0}},operations:[{name:"allRedefinedFeatures",type:"Feature",lowerBound:0,upperBound:-1,parameters:[],hasBody:!0},{name:"asCartesianProduct",type:"Type",lowerBound:0,upperBound:-1,parameters:[],hasBody:!0},{name:"canAccess",type:"boolean",lowerBound:1,upperBound:1,parameters:[{name:"feature",type:"Feature",many:!1}],hasBody:!0},{name:"directionFor",type:"FeatureDirectionKind",lowerBound:0,upperBound:1,parameters:[{name:"type",type:"Type",many:!1}],hasBody:!0},{name:"isCartesianProduct",type:"boolean",lowerBound:1,upperBound:1,parameters:[],hasBody:!0},{name:"isFeaturedWithin",type:"boolean",lowerBound:1,upperBound:1,parameters:[{name:"type",type:"Type",many:!1}],hasBody:!0},{name:"isFeaturingType",type:"boolean",lowerBound:1,upperBound:1,parameters:[{name:"type",type:"Type",many:!1}],hasBody:!0},{name:"isOwnedCrossFeature",type:"boolean",lowerBound:1,upperBound:1,parameters:[],hasBody:!0},{name:"namingFeature",type:"Feature",lowerBound:0,upperBound:1,parameters:[],hasBody:!0},{name:"ownedCrossFeature",type:"Feature",lowerBound:0,upperBound:1,parameters:[],hasBody:!0},{name:"redefines",type:"boolean",lowerBound:1,upperBound:1,parameters:[{name:"redefinedFeature",type:"Feature",many:!1}],hasBody:!0},{name:"redefinesFromLibrary",type:"boolean",lowerBound:1,upperBound:1,parameters:[{name:"libraryFeatureName",type:"string",many:!1}],hasBody:!0},{name:"subsetsChain",type:"boolean",lowerBound:1,upperBound:1,parameters:[{name:"first",type:"Feature",many:!1},{name:"second",type:"Feature",many:!1}],hasBody:!0},{name:"typingFeatures",type:"Feature",lowerBound:0,upperBound:-1,parameters:[],hasBody:!0}]},FeatureChainExpression:{name:"FeatureChainExpression",abstract:!1,superTypes:["OperatorExpression"],features:{targetFeature:{name:"targetFeature",ecoreName:"targetFeature",kind:"reference",type:"Feature",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,subsets:["Namespace/member"],hasDerivation:!0}},operations:[{name:"sourceTargetFeature",type:"Feature",lowerBound:0,upperBound:1,parameters:[],hasBody:!0}]},FeatureChaining:{name:"FeatureChaining",abstract:!1,superTypes:["Relationship"],features:{chainingFeature:{name:"chainingFeature",ecoreName:"chainingFeature",kind:"reference",type:"Feature",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1,redefines:["Relationship/target"]},featureChained:{name:"featureChained",ecoreName:"featureChained",kind:"reference",type:"Feature",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,opposite:"Feature/ownedFeatureChaining",subsets:["Relationship/owningRelatedElement"],redefines:["Relationship/source"]}},operations:[]},FeatureInverting:{name:"FeatureInverting",abstract:!1,superTypes:["Relationship"],features:{featureInverted:{name:"featureInverted",ecoreName:"featureInverted",kind:"reference",type:"Feature",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1,redefines:["Relationship/source"]},invertingFeature:{name:"invertingFeature",ecoreName:"invertingFeature",kind:"reference",type:"Feature",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1,redefines:["Relationship/target"]},owningFeature:{name:"owningFeature",ecoreName:"owningFeature",kind:"reference",type:"Feature",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,opposite:"Feature/ownedFeatureInverting",subsets:["FeatureInverting/featureInverted","Relationship/owningRelatedElement"]}},operations:[]},FeatureMembership:{name:"FeatureMembership",abstract:!1,superTypes:["OwningMembership"],features:{ownedMemberFeature:{name:"ownedMemberFeature",ecoreName:"ownedMemberFeature",kind:"reference",type:"Feature",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,opposite:"Feature/owningFeatureMembership",redefines:["OwningMembership/ownedMemberElement"]},owningType:{name:"owningType",ecoreName:"owningType",kind:"reference",type:"Type",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,opposite:"Type/ownedFeatureMembership",redefines:["Membership/membershipOwningNamespace"]}},operations:[]},FeatureReferenceExpression:{name:"FeatureReferenceExpression",abstract:!1,superTypes:["Expression"],features:{referent:{name:"referent",ecoreName:"referent",kind:"reference",type:"Feature",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,subsets:["Namespace/member"],hasDerivation:!0}},operations:[]},FeatureTyping:{name:"FeatureTyping",abstract:!1,superTypes:["Specialization"],features:{owningFeature:{name:"owningFeature",ecoreName:"owningFeature",kind:"reference",type:"Feature",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,opposite:"Feature/ownedTyping",subsets:["FeatureTyping/typedFeature"],redefines:["Specialization/owningType"]},type:{name:"type",ecoreName:"type",kind:"reference",type:"Type",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1,redefines:["Specialization/general"]},typedFeature:{name:"typedFeature",ecoreName:"typedFeature",kind:"reference",type:"Feature",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1,redefines:["Specialization/specific"]}},operations:[]},FeatureValue:{name:"FeatureValue",abstract:!1,superTypes:["OwningMembership"],features:{featureWithValue:{name:"featureWithValue",ecoreName:"featureWithValue",kind:"reference",type:"Feature",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,subsets:["Membership/membershipOwningNamespace"]},isDefault:{name:"isDefault",ecoreName:"isDefault",kind:"attribute",type:"EBoolean",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1},isInitial:{name:"isInitial",ecoreName:"isInitial",kind:"attribute",type:"EBoolean",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1},value:{name:"value",ecoreName:"value",kind:"reference",type:"Expression",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,redefines:["OwningMembership/ownedMemberElement"]}},operations:[]},Flow:{name:"Flow",abstract:!1,superTypes:["Connector","Step"],features:{flowEnd:{name:"flowEnd",ecoreName:"flowEnd",kind:"reference",type:"FlowEnd",lowerBound:0,upperBound:2,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Connector/connectorEnd"],hasDerivation:!0},interaction:{name:"interaction",ecoreName:"interaction",kind:"reference",type:"Interaction",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,redefines:["Connector/association","Step/behavior"]},payloadFeature:{name:"payloadFeature",ecoreName:"payloadFeature",kind:"reference",type:"PayloadFeature",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,subsets:["Type/ownedFeature"],hasDerivation:!0},payloadType:{name:"payloadType",ecoreName:"payloadType",kind:"reference",type:"Classifier",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,hasDerivation:!0},sourceOutputFeature:{name:"sourceOutputFeature",ecoreName:"sourceOutputFeature",kind:"reference",type:"Feature",lowerBound:0,upperBound:1,many:!1,ordered:!0,containment:!1,derived:!0,volatile:!0,hasDerivation:!0},targetInputFeature:{name:"targetInputFeature",ecoreName:"targetInputFeature",kind:"reference",type:"Feature",lowerBound:0,upperBound:1,many:!1,ordered:!0,containment:!1,derived:!0,volatile:!0,hasDerivation:!0}},operations:[]},FlowDefinition:{name:"FlowDefinition",abstract:!1,superTypes:["ActionDefinition","Interaction"],features:{flowEnd:{name:"flowEnd",ecoreName:"flowEnd",kind:"reference",type:"Usage",lowerBound:0,upperBound:-1,many:!0,ordered:!1,containment:!1,derived:!0,volatile:!0,redefines:["Association/associationEnd"]}},operations:[]},FlowEnd:{name:"FlowEnd",abstract:!1,superTypes:["Feature"],features:{},operations:[]},FlowUsage:{name:"FlowUsage",abstract:!1,superTypes:["ConnectorAsUsage","ActionUsage","Flow"],features:{flowDefinition:{name:"flowDefinition",ecoreName:"flowDefinition",kind:"reference",type:"Interaction",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,redefines:["ActionUsage/actionDefinition","Flow/interaction"]}},operations:[]},ForLoopActionUsage:{name:"ForLoopActionUsage",abstract:!1,superTypes:["LoopActionUsage"],features:{loopVariable:{name:"loopVariable",ecoreName:"loopVariable",kind:"reference",type:"ReferenceUsage",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,hasDerivation:!0},seqArgument:{name:"seqArgument",ecoreName:"seqArgument",kind:"reference",type:"Expression",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,hasDerivation:!0}},operations:[]},ForkNode:{name:"ForkNode",abstract:!1,superTypes:["ControlNode"],features:{},operations:[]},FramedConcernMembership:{name:"FramedConcernMembership",abstract:!1,superTypes:["RequirementConstraintMembership"],features:{ownedConcern:{name:"ownedConcern",ecoreName:"ownedConcern",kind:"reference",type:"ConcernUsage",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,redefines:["RequirementConstraintMembership/ownedConstraint"]},referencedConcern:{name:"referencedConcern",ecoreName:"referencedConcern",kind:"reference",type:"ConcernUsage",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,redefines:["RequirementConstraintMembership/referencedConstraint"]}},operations:[]},Function:{name:"Function",abstract:!1,superTypes:["Behavior"],features:{expression:{name:"expression",ecoreName:"expression",kind:"reference",type:"Expression",lowerBound:0,upperBound:-1,many:!0,ordered:!1,containment:!1,derived:!0,volatile:!0,subsets:["Behavior/step"]},isModelLevelEvaluable:{name:"isModelLevelEvaluable",ecoreName:"isModelLevelEvaluable",kind:"attribute",type:"EBoolean",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0},result:{name:"result",ecoreName:"result",kind:"reference",type:"Feature",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,subsets:["Type/output","Behavior/parameter"],hasDerivation:!0}},operations:[]},IfActionUsage:{name:"IfActionUsage",abstract:!1,superTypes:["ActionUsage"],features:{elseAction:{name:"elseAction",ecoreName:"elseAction",kind:"reference",type:"ActionUsage",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,hasDerivation:!0},ifArgument:{name:"ifArgument",ecoreName:"ifArgument",kind:"reference",type:"Expression",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,hasDerivation:!0},thenAction:{name:"thenAction",ecoreName:"thenAction",kind:"reference",type:"ActionUsage",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,hasDerivation:!0}},operations:[]},Import:{name:"Import",abstract:!0,superTypes:["Relationship"],features:{importOwningNamespace:{name:"importOwningNamespace",ecoreName:"importOwningNamespace",kind:"reference",type:"Namespace",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,opposite:"Namespace/ownedImport",subsets:["Relationship/owningRelatedElement"],redefines:["Relationship/source"]},importedElement:{name:"importedElement",ecoreName:"importedElement",kind:"reference",type:"Element",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0},isImportAll:{name:"isImportAll",ecoreName:"isImportAll",kind:"attribute",type:"EBoolean",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1},isRecursive:{name:"isRecursive",ecoreName:"isRecursive",kind:"attribute",type:"EBoolean",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1},visibility:{name:"visibility",ecoreName:"visibility",kind:"attribute",type:"VisibilityKind",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1}},operations:[{name:"importedMemberships",type:"Membership",lowerBound:0,upperBound:-1,parameters:[{name:"excluded",type:"Namespace",many:!0}]}]},IncludeUseCaseUsage:{name:"IncludeUseCaseUsage",abstract:!1,superTypes:["UseCaseUsage","PerformActionUsage"],features:{useCaseIncluded:{name:"useCaseIncluded",ecoreName:"useCaseIncluded",kind:"reference",type:"UseCaseUsage",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,redefines:["PerformActionUsage/performedAction"]}},operations:[]},IndexExpression:{name:"IndexExpression",abstract:!1,superTypes:["OperatorExpression"],features:{},operations:[]},InstantiationExpression:{name:"InstantiationExpression",abstract:!0,superTypes:["Expression"],features:{argument:{name:"argument",ecoreName:"argument",kind:"reference",type:"Expression",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0},instantiatedType:{name:"instantiatedType",ecoreName:"instantiatedType",kind:"reference",type:"Type",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,subsets:["Namespace/member"],hasDerivation:!0}},operations:[{name:"instantiatedType",type:"Type",lowerBound:0,upperBound:1,parameters:[],hasBody:!0}]},Interaction:{name:"Interaction",abstract:!1,superTypes:["Association","Behavior"],features:{},operations:[]},InterfaceDefinition:{name:"InterfaceDefinition",abstract:!1,superTypes:["ConnectionDefinition"],features:{interfaceEnd:{name:"interfaceEnd",ecoreName:"interfaceEnd",kind:"reference",type:"PortUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,redefines:["ConnectionDefinition/connectionEnd"]}},operations:[]},InterfaceUsage:{name:"InterfaceUsage",abstract:!1,superTypes:["ConnectionUsage"],features:{interfaceDefinition:{name:"interfaceDefinition",ecoreName:"interfaceDefinition",kind:"reference",type:"InterfaceDefinition",lowerBound:0,upperBound:-1,many:!0,ordered:!1,containment:!1,derived:!0,volatile:!0,redefines:["ConnectionUsage/connectionDefinition"]}},operations:[]},Intersecting:{name:"Intersecting",abstract:!1,superTypes:["Relationship"],features:{intersectingType:{name:"intersectingType",ecoreName:"intersectingType",kind:"reference",type:"Type",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1,redefines:["Relationship/target"]},typeIntersected:{name:"typeIntersected",ecoreName:"typeIntersected",kind:"reference",type:"Type",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,opposite:"Type/ownedIntersecting",subsets:["Relationship/owningRelatedElement"],redefines:["Relationship/source"]}},operations:[]},Invariant:{name:"Invariant",abstract:!1,superTypes:["BooleanExpression"],features:{isNegated:{name:"isNegated",ecoreName:"isNegated",kind:"attribute",type:"EBoolean",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1}},operations:[]},InvocationExpression:{name:"InvocationExpression",abstract:!1,superTypes:["InstantiationExpression"],features:{operand:{name:"operand",ecoreName:"operand",kind:"reference",type:"Expression",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!0,derived:!0,volatile:!0}},operations:[]},ItemDefinition:{name:"ItemDefinition",abstract:!1,superTypes:["OccurrenceDefinition","Structure"],features:{},operations:[]},ItemUsage:{name:"ItemUsage",abstract:!1,superTypes:["OccurrenceUsage"],features:{itemDefinition:{name:"itemDefinition",ecoreName:"itemDefinition",kind:"reference",type:"Structure",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["OccurrenceUsage/occurrenceDefinition"],hasDerivation:!0}},operations:[]},JoinNode:{name:"JoinNode",abstract:!1,superTypes:["ControlNode"],features:{},operations:[]},LibraryPackage:{name:"LibraryPackage",abstract:!1,superTypes:["Package"],features:{isStandard:{name:"isStandard",ecoreName:"isStandard",kind:"attribute",type:"EBoolean",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1}},operations:[]},LiteralBoolean:{name:"LiteralBoolean",abstract:!1,superTypes:["LiteralExpression"],features:{value:{name:"value",ecoreName:"value",kind:"attribute",type:"EBoolean",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1}},operations:[]},LiteralExpression:{name:"LiteralExpression",abstract:!1,superTypes:["Expression"],features:{},operations:[]},LiteralInfinity:{name:"LiteralInfinity",abstract:!1,superTypes:["LiteralExpression"],features:{},operations:[]},LiteralInteger:{name:"LiteralInteger",abstract:!1,superTypes:["LiteralExpression"],features:{value:{name:"value",ecoreName:"value",kind:"attribute",type:"EInt",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1}},operations:[]},LiteralRational:{name:"LiteralRational",abstract:!1,superTypes:["LiteralExpression"],features:{value:{name:"value",ecoreName:"value",kind:"attribute",type:"EDouble",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1}},operations:[]},LiteralString:{name:"LiteralString",abstract:!1,superTypes:["LiteralExpression"],features:{value:{name:"value",ecoreName:"value",kind:"attribute",type:"EString",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1}},operations:[]},LoopActionUsage:{name:"LoopActionUsage",abstract:!0,superTypes:["ActionUsage"],features:{bodyAction:{name:"bodyAction",ecoreName:"bodyAction",kind:"reference",type:"ActionUsage",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,hasDerivation:!0}},operations:[]},Membership:{name:"Membership",abstract:!1,superTypes:["Relationship"],features:{memberElement:{name:"memberElement",ecoreName:"memberElement",kind:"reference",type:"Element",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1,redefines:["Relationship/target"]},memberElementId:{name:"memberElementId",ecoreName:"memberElementId",kind:"attribute",type:"EString",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,hasDerivation:!0},memberName:{name:"memberName",ecoreName:"memberName",kind:"attribute",type:"EString",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1},memberShortName:{name:"memberShortName",ecoreName:"memberShortName",kind:"attribute",type:"EString",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1},membershipOwningNamespace:{name:"membershipOwningNamespace",ecoreName:"membershipOwningNamespace",kind:"reference",type:"Namespace",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,opposite:"Namespace/ownedMembership",subsets:["Relationship/owningRelatedElement"],redefines:["Relationship/source"]},visibility:{name:"visibility",ecoreName:"visibility",kind:"attribute",type:"VisibilityKind",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1}},operations:[{name:"isDistinguishableFrom",type:"boolean",lowerBound:1,upperBound:1,parameters:[{name:"other",type:"Membership",many:!1}],hasBody:!0}]},MembershipExpose:{name:"MembershipExpose",abstract:!1,superTypes:["MembershipImport","Expose"],features:{},operations:[]},MembershipImport:{name:"MembershipImport",abstract:!1,superTypes:["Import"],features:{importedMembership:{name:"importedMembership",ecoreName:"importedMembership",kind:"reference",type:"Membership",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1,redefines:["Relationship/target"]}},operations:[]},MergeNode:{name:"MergeNode",abstract:!1,superTypes:["ControlNode"],features:{},operations:[]},Metaclass:{name:"Metaclass",abstract:!1,superTypes:["Structure"],features:{},operations:[]},MetadataAccessExpression:{name:"MetadataAccessExpression",abstract:!1,superTypes:["Expression"],features:{referencedElement:{name:"referencedElement",ecoreName:"referencedElement",kind:"reference",type:"Element",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,subsets:["Namespace/member"],hasDerivation:!0}},operations:[{name:"metaclassFeature",type:"MetadataFeature",lowerBound:1,upperBound:1,parameters:[]}]},MetadataDefinition:{name:"MetadataDefinition",abstract:!1,superTypes:["ItemDefinition","Metaclass"],features:{},operations:[]},MetadataFeature:{name:"MetadataFeature",abstract:!1,superTypes:["Feature","AnnotatingElement"],features:{metaclass:{name:"metaclass",ecoreName:"metaclass",kind:"reference",type:"Metaclass",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,subsets:["Feature/type"],hasDerivation:!0}},operations:[{name:"evaluateFeature",type:"Element",lowerBound:0,upperBound:-1,parameters:[{name:"baseFeature",type:"Feature",many:!1}],hasBody:!0},{name:"isSemantic",type:"boolean",lowerBound:1,upperBound:1,parameters:[],hasBody:!0},{name:"isSyntactic",type:"boolean",lowerBound:1,upperBound:1,parameters:[],hasBody:!0},{name:"syntaxElement",type:"Element",lowerBound:0,upperBound:1,parameters:[]}]},MetadataUsage:{name:"MetadataUsage",abstract:!1,superTypes:["ItemUsage","MetadataFeature"],features:{metadataDefinition:{name:"metadataDefinition",ecoreName:"metadataDefinition",kind:"reference",type:"Metaclass",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,redefines:["ItemUsage/itemDefinition","MetadataFeature/metaclass"]}},operations:[]},Multiplicity:{name:"Multiplicity",abstract:!1,superTypes:["Feature"],features:{},operations:[]},MultiplicityRange:{name:"MultiplicityRange",abstract:!1,superTypes:["Multiplicity"],features:{bound:{name:"bound",ecoreName:"bound",kind:"reference",type:"Expression",lowerBound:1,upperBound:2,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Namespace/ownedMember"],hasDerivation:!0},lowerBound:{name:"lowerBound",ecoreName:"lowerBound",kind:"reference",type:"Expression",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,subsets:["MultiplicityRange/bound"],hasDerivation:!0},upperBound:{name:"upperBound",ecoreName:"upperBound",kind:"reference",type:"Expression",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,subsets:["MultiplicityRange/bound"],hasDerivation:!0}},operations:[{name:"hasBounds",type:"boolean",lowerBound:1,upperBound:1,parameters:[{name:"lower",type:"number",many:!1},{name:"upper",type:"number",many:!1}],hasBody:!0},{name:"valueOf",type:"number",lowerBound:0,upperBound:1,parameters:[{name:"bound",type:"Expression",many:!1}],hasBody:!0}]},Namespace:{name:"Namespace",abstract:!1,superTypes:["Element"],features:{importedMembership:{name:"importedMembership",ecoreName:"importedMembership",kind:"reference",type:"Membership",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Namespace/membership"],hasDerivation:!0},member:{name:"member",ecoreName:"member",kind:"reference",type:"Element",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,hasDerivation:!0},membership:{name:"membership",ecoreName:"membership",kind:"reference",type:"Membership",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,union:!0},ownedImport:{name:"ownedImport",ecoreName:"ownedImport",kind:"reference",type:"Import",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,opposite:"Import/importOwningNamespace",subsets:["Element/ownedRelationship"],hasDerivation:!0},ownedMember:{name:"ownedMember",ecoreName:"ownedMember",kind:"reference",type:"Element",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,opposite:"Element/owningNamespace",subsets:["Namespace/member"],hasDerivation:!0},ownedMembership:{name:"ownedMembership",ecoreName:"ownedMembership",kind:"reference",type:"Membership",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,opposite:"Membership/membershipOwningNamespace",subsets:["Namespace/membership","Element/ownedRelationship"],hasDerivation:!0}},operations:[{name:"importedMemberships",type:"Membership",lowerBound:0,upperBound:-1,parameters:[{name:"excluded",type:"Namespace",many:!0}],hasBody:!0},{name:"membershipsOfVisibility",type:"Membership",lowerBound:0,upperBound:-1,parameters:[{name:"visibility",type:"VisibilityKind",many:!1},{name:"excluded",type:"Namespace",many:!0}],hasBody:!0},{name:"namesOf",type:"string",lowerBound:0,upperBound:-1,parameters:[{name:"element",type:"Element",many:!1}],hasBody:!0},{name:"qualificationOf",type:"string",lowerBound:0,upperBound:1,parameters:[{name:"qualifiedName",type:"string",many:!1}]},{name:"resolve",type:"Membership",lowerBound:0,upperBound:1,parameters:[{name:"qualifiedName",type:"string",many:!1}],hasBody:!0},{name:"resolveGlobal",type:"Membership",lowerBound:0,upperBound:1,parameters:[{name:"qualifiedName",type:"string",many:!1}]},{name:"resolveLocal",type:"Membership",lowerBound:0,upperBound:1,parameters:[{name:"name",type:"string",many:!1}],hasBody:!0},{name:"resolveVisible",type:"Membership",lowerBound:0,upperBound:1,parameters:[{name:"name",type:"string",many:!1}],hasBody:!0},{name:"unqualifiedNameOf",type:"string",lowerBound:1,upperBound:1,parameters:[{name:"qualifiedName",type:"string",many:!1}]},{name:"visibilityOf",type:"VisibilityKind",lowerBound:1,upperBound:1,parameters:[{name:"mem",type:"Membership",many:!1}],hasBody:!0},{name:"visibleMemberships",type:"Membership",lowerBound:0,upperBound:-1,parameters:[{name:"excluded",type:"Namespace",many:!0},{name:"isRecursive",type:"boolean",many:!1},{name:"includeAll",type:"boolean",many:!1}],hasBody:!0}]},NamespaceExpose:{name:"NamespaceExpose",abstract:!1,superTypes:["NamespaceImport","Expose"],features:{},operations:[]},NamespaceImport:{name:"NamespaceImport",abstract:!1,superTypes:["Import"],features:{importedNamespace:{name:"importedNamespace",ecoreName:"importedNamespace",kind:"reference",type:"Namespace",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1,redefines:["Relationship/target"]}},operations:[]},NullExpression:{name:"NullExpression",abstract:!1,superTypes:["Expression"],features:{},operations:[]},ObjectiveMembership:{name:"ObjectiveMembership",abstract:!1,superTypes:["FeatureMembership"],features:{ownedObjectiveRequirement:{name:"ownedObjectiveRequirement",ecoreName:"ownedObjectiveRequirement",kind:"reference",type:"RequirementUsage",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,redefines:["FeatureMembership/ownedMemberFeature"]}},operations:[]},OccurrenceDefinition:{name:"OccurrenceDefinition",abstract:!1,superTypes:["Definition","Class"],features:{isIndividual:{name:"isIndividual",ecoreName:"isIndividual",kind:"attribute",type:"EBoolean",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1}},operations:[]},OccurrenceUsage:{name:"OccurrenceUsage",abstract:!1,superTypes:["Usage"],features:{individualDefinition:{name:"individualDefinition",ecoreName:"individualDefinition",kind:"reference",type:"OccurrenceDefinition",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,subsets:["OccurrenceUsage/occurrenceDefinition"],hasDerivation:!0},isIndividual:{name:"isIndividual",ecoreName:"isIndividual",kind:"attribute",type:"EBoolean",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1},occurrenceDefinition:{name:"occurrenceDefinition",ecoreName:"occurrenceDefinition",kind:"reference",type:"Class",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,redefines:["Usage/definition"]},portionKind:{name:"portionKind",ecoreName:"portionKind",kind:"attribute",type:"PortionKind",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1}},operations:[]},OperatorExpression:{name:"OperatorExpression",abstract:!1,superTypes:["InvocationExpression"],features:{operator:{name:"operator",ecoreName:"operator",kind:"attribute",type:"EString",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1}},operations:[]},OwningMembership:{name:"OwningMembership",abstract:!1,superTypes:["Membership"],features:{ownedMemberElement:{name:"ownedMemberElement",ecoreName:"ownedMemberElement",kind:"reference",type:"Element",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,opposite:"Element/owningMembership",subsets:["Relationship/ownedRelatedElement"],redefines:["Membership/memberElement"]},ownedMemberElementId:{name:"ownedMemberElementId",ecoreName:"ownedMemberElementId",kind:"attribute",type:"EString",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,redefines:["Membership/memberElementId"]},ownedMemberName:{name:"ownedMemberName",ecoreName:"ownedMemberName",kind:"attribute",type:"EString",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,redefines:["Membership/memberName"],hasDerivation:!0},ownedMemberShortName:{name:"ownedMemberShortName",ecoreName:"ownedMemberShortName",kind:"attribute",type:"EString",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,redefines:["Membership/memberShortName"],hasDerivation:!0}},operations:[]},Package:{name:"Package",abstract:!1,superTypes:["Namespace"],features:{filterCondition:{name:"filterCondition",ecoreName:"filterCondition",kind:"reference",type:"Expression",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Namespace/ownedMember"],hasDerivation:!0}},operations:[{name:"includeAsMember",type:"boolean",lowerBound:1,upperBound:1,parameters:[{name:"element",type:"Element",many:!1}],hasBody:!0}]},ParameterMembership:{name:"ParameterMembership",abstract:!1,superTypes:["FeatureMembership"],features:{ownedMemberParameter:{name:"ownedMemberParameter",ecoreName:"ownedMemberParameter",kind:"reference",type:"Feature",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,redefines:["FeatureMembership/ownedMemberFeature"]}},operations:[{name:"parameterDirection",type:"FeatureDirectionKind",lowerBound:1,upperBound:1,parameters:[],hasBody:!0}]},PartDefinition:{name:"PartDefinition",abstract:!1,superTypes:["ItemDefinition"],features:{},operations:[]},PartUsage:{name:"PartUsage",abstract:!1,superTypes:["ItemUsage"],features:{partDefinition:{name:"partDefinition",ecoreName:"partDefinition",kind:"reference",type:"PartDefinition",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["ItemUsage/itemDefinition"]}},operations:[]},PayloadFeature:{name:"PayloadFeature",abstract:!1,superTypes:["Feature"],features:{},operations:[]},PerformActionUsage:{name:"PerformActionUsage",abstract:!1,superTypes:["ActionUsage","EventOccurrenceUsage"],features:{performedAction:{name:"performedAction",ecoreName:"performedAction",kind:"reference",type:"ActionUsage",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,redefines:["EventOccurrenceUsage/eventOccurrence"]}},operations:[]},PortConjugation:{name:"PortConjugation",abstract:!1,superTypes:["Conjugation"],features:{conjugatedPortDefinition:{name:"conjugatedPortDefinition",ecoreName:"conjugatedPortDefinition",kind:"reference",type:"ConjugatedPortDefinition",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,opposite:"ConjugatedPortDefinition/ownedPortConjugator",redefines:["Conjugation/owningType"]},originalPortDefinition:{name:"originalPortDefinition",ecoreName:"originalPortDefinition",kind:"reference",type:"PortDefinition",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1,redefines:["Conjugation/originalType"]}},operations:[]},PortDefinition:{name:"PortDefinition",abstract:!1,superTypes:["OccurrenceDefinition","Structure"],features:{conjugatedPortDefinition:{name:"conjugatedPortDefinition",ecoreName:"conjugatedPortDefinition",kind:"reference",type:"ConjugatedPortDefinition",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,opposite:"ConjugatedPortDefinition/originalPortDefinition",subsets:["Namespace/ownedMember"],hasDerivation:!0}},operations:[]},PortUsage:{name:"PortUsage",abstract:!1,superTypes:["OccurrenceUsage"],features:{portDefinition:{name:"portDefinition",ecoreName:"portDefinition",kind:"reference",type:"PortDefinition",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,redefines:["OccurrenceUsage/occurrenceDefinition"]}},operations:[]},Predicate:{name:"Predicate",abstract:!1,superTypes:["Function"],features:{},operations:[]},Redefinition:{name:"Redefinition",abstract:!1,superTypes:["Subsetting"],features:{redefinedFeature:{name:"redefinedFeature",ecoreName:"redefinedFeature",kind:"reference",type:"Feature",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1,redefines:["Subsetting/subsettedFeature"]},redefiningFeature:{name:"redefiningFeature",ecoreName:"redefiningFeature",kind:"reference",type:"Feature",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1,redefines:["Subsetting/subsettingFeature"]}},operations:[]},ReferenceSubsetting:{name:"ReferenceSubsetting",abstract:!1,superTypes:["Subsetting"],features:{referencedFeature:{name:"referencedFeature",ecoreName:"referencedFeature",kind:"reference",type:"Feature",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1,redefines:["Subsetting/subsettedFeature"]},referencingFeature:{name:"referencingFeature",ecoreName:"referencingFeature",kind:"reference",type:"Feature",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,opposite:"Feature/ownedReferenceSubsetting",redefines:["Subsetting/owningFeature","Subsetting/subsettingFeature"]}},operations:[]},ReferenceUsage:{name:"ReferenceUsage",abstract:!1,superTypes:["Usage"],features:{},operations:[]},Relationship:{name:"Relationship",abstract:!0,superTypes:["Element"],features:{isImplied:{name:"isImplied",ecoreName:"isImplied",kind:"attribute",type:"EBoolean",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1},ownedRelatedElement:{name:"ownedRelatedElement",ecoreName:"ownedRelatedElement",kind:"reference",type:"Element",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!0,derived:!1,volatile:!1,opposite:"Element/owningRelationship",subsets:["Relationship/relatedElement"]},owningRelatedElement:{name:"owningRelatedElement",ecoreName:"owningRelatedElement",kind:"reference",type:"Element",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1,opposite:"Element/ownedRelationship",subsets:["Relationship/relatedElement"]},relatedElement:{name:"relatedElement",ecoreName:"relatedElement",kind:"reference",type:"Element",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,hasDerivation:!0},source:{name:"source",ecoreName:"source",kind:"reference",type:"Element",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!1,volatile:!1,subsets:["Relationship/relatedElement"]},target:{name:"target",ecoreName:"target",kind:"reference",type:"Element",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!1,volatile:!1,subsets:["Relationship/relatedElement"]}},operations:[]},RenderingDefinition:{name:"RenderingDefinition",abstract:!1,superTypes:["PartDefinition"],features:{rendering:{name:"rendering",ecoreName:"rendering",kind:"reference",type:"RenderingUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Definition/usage"],hasDerivation:!0}},operations:[]},RenderingUsage:{name:"RenderingUsage",abstract:!1,superTypes:["PartUsage"],features:{renderingDefinition:{name:"renderingDefinition",ecoreName:"renderingDefinition",kind:"reference",type:"RenderingDefinition",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,redefines:["PartUsage/partDefinition"]}},operations:[]},RequirementConstraintMembership:{name:"RequirementConstraintMembership",abstract:!1,superTypes:["FeatureMembership"],features:{kind:{name:"kind",ecoreName:"kind",kind:"attribute",type:"RequirementConstraintKind",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1},ownedConstraint:{name:"ownedConstraint",ecoreName:"ownedConstraint",kind:"reference",type:"ConstraintUsage",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,redefines:["FeatureMembership/ownedMemberFeature"]},referencedConstraint:{name:"referencedConstraint",ecoreName:"referencedConstraint",kind:"reference",type:"ConstraintUsage",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,hasDerivation:!0}},operations:[]},RequirementDefinition:{name:"RequirementDefinition",abstract:!1,superTypes:["ConstraintDefinition"],features:{actorParameter:{name:"actorParameter",ecoreName:"actorParameter",kind:"reference",type:"PartUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Behavior/parameter","Definition/usage"],hasDerivation:!0},assumedConstraint:{name:"assumedConstraint",ecoreName:"assumedConstraint",kind:"reference",type:"ConstraintUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Type/ownedFeature"],hasDerivation:!0},framedConcern:{name:"framedConcern",ecoreName:"framedConcern",kind:"reference",type:"ConcernUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["RequirementDefinition/requiredConstraint"],hasDerivation:!0},reqId:{name:"reqId",ecoreName:"reqId",kind:"attribute",type:"EString",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1,redefines:["Element/declaredShortName"]},requiredConstraint:{name:"requiredConstraint",ecoreName:"requiredConstraint",kind:"reference",type:"ConstraintUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Type/ownedFeature"],hasDerivation:!0},stakeholderParameter:{name:"stakeholderParameter",ecoreName:"stakeholderParameter",kind:"reference",type:"PartUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Behavior/parameter","Definition/usage"],hasDerivation:!0},subjectParameter:{name:"subjectParameter",ecoreName:"subjectParameter",kind:"reference",type:"Usage",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,subsets:["Behavior/parameter","Definition/usage"],hasDerivation:!0},text:{name:"text",ecoreName:"text",kind:"attribute",type:"EString",lowerBound:0,upperBound:-1,many:!0,ordered:!1,containment:!1,derived:!0,volatile:!0,hasDerivation:!0}},operations:[]},RequirementUsage:{name:"RequirementUsage",abstract:!1,superTypes:["ConstraintUsage"],features:{actorParameter:{name:"actorParameter",ecoreName:"actorParameter",kind:"reference",type:"PartUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Step/parameter","Usage/usage"],hasDerivation:!0},assumedConstraint:{name:"assumedConstraint",ecoreName:"assumedConstraint",kind:"reference",type:"ConstraintUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Type/ownedFeature"],hasDerivation:!0},framedConcern:{name:"framedConcern",ecoreName:"framedConcern",kind:"reference",type:"ConcernUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["RequirementUsage/requiredConstraint"],hasDerivation:!0},reqId:{name:"reqId",ecoreName:"reqId",kind:"attribute",type:"EString",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1,redefines:["Element/declaredShortName"]},requiredConstraint:{name:"requiredConstraint",ecoreName:"requiredConstraint",kind:"reference",type:"ConstraintUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Type/ownedFeature"],hasDerivation:!0},requirementDefinition:{name:"requirementDefinition",ecoreName:"requirementDefinition",kind:"reference",type:"RequirementDefinition",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,redefines:["ConstraintUsage/constraintDefinition"]},stakeholderParameter:{name:"stakeholderParameter",ecoreName:"stakeholderParameter",kind:"reference",type:"PartUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Step/parameter","Usage/usage"],hasDerivation:!0},subjectParameter:{name:"subjectParameter",ecoreName:"subjectParameter",kind:"reference",type:"Usage",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,subsets:["Step/parameter","Usage/usage"],hasDerivation:!0},text:{name:"text",ecoreName:"text",kind:"attribute",type:"EString",lowerBound:0,upperBound:-1,many:!0,ordered:!1,containment:!1,derived:!0,volatile:!0,hasDerivation:!0}},operations:[]},RequirementVerificationMembership:{name:"RequirementVerificationMembership",abstract:!1,superTypes:["RequirementConstraintMembership"],features:{ownedRequirement:{name:"ownedRequirement",ecoreName:"ownedRequirement",kind:"reference",type:"RequirementUsage",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,redefines:["RequirementConstraintMembership/ownedConstraint"]},verifiedRequirement:{name:"verifiedRequirement",ecoreName:"verifiedRequirement",kind:"reference",type:"RequirementUsage",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,redefines:["RequirementConstraintMembership/referencedConstraint"]}},operations:[]},ResultExpressionMembership:{name:"ResultExpressionMembership",abstract:!1,superTypes:["FeatureMembership"],features:{ownedResultExpression:{name:"ownedResultExpression",ecoreName:"ownedResultExpression",kind:"reference",type:"Expression",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,redefines:["FeatureMembership/ownedMemberFeature"]}},operations:[]},ReturnParameterMembership:{name:"ReturnParameterMembership",abstract:!1,superTypes:["ParameterMembership"],features:{},operations:[]},SatisfyRequirementUsage:{name:"SatisfyRequirementUsage",abstract:!1,superTypes:["RequirementUsage","AssertConstraintUsage"],features:{satisfiedRequirement:{name:"satisfiedRequirement",ecoreName:"satisfiedRequirement",kind:"reference",type:"RequirementUsage",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,redefines:["AssertConstraintUsage/assertedConstraint"]},satisfyingFeature:{name:"satisfyingFeature",ecoreName:"satisfyingFeature",kind:"reference",type:"Feature",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,hasDerivation:!0}},operations:[]},SelectExpression:{name:"SelectExpression",abstract:!1,superTypes:["OperatorExpression"],features:{},operations:[]},SendActionUsage:{name:"SendActionUsage",abstract:!1,superTypes:["ActionUsage"],features:{payloadArgument:{name:"payloadArgument",ecoreName:"payloadArgument",kind:"reference",type:"Expression",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,hasDerivation:!0},receiverArgument:{name:"receiverArgument",ecoreName:"receiverArgument",kind:"reference",type:"Expression",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,hasDerivation:!0},senderArgument:{name:"senderArgument",ecoreName:"senderArgument",kind:"reference",type:"Expression",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,hasDerivation:!0}},operations:[]},Specialization:{name:"Specialization",abstract:!1,superTypes:["Relationship"],features:{general:{name:"general",ecoreName:"general",kind:"reference",type:"Type",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1,redefines:["Relationship/target"]},owningType:{name:"owningType",ecoreName:"owningType",kind:"reference",type:"Type",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,opposite:"Type/ownedSpecialization",subsets:["Relationship/owningRelatedElement","Specialization/specific"]},specific:{name:"specific",ecoreName:"specific",kind:"reference",type:"Type",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1,redefines:["Relationship/source"]}},operations:[]},StakeholderMembership:{name:"StakeholderMembership",abstract:!1,superTypes:["ParameterMembership"],features:{ownedStakeholderParameter:{name:"ownedStakeholderParameter",ecoreName:"ownedStakeholderParameter",kind:"reference",type:"PartUsage",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,redefines:["ParameterMembership/ownedMemberParameter"]}},operations:[]},StateDefinition:{name:"StateDefinition",abstract:!1,superTypes:["ActionDefinition"],features:{doAction:{name:"doAction",ecoreName:"doAction",kind:"reference",type:"ActionUsage",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,hasDerivation:!0},entryAction:{name:"entryAction",ecoreName:"entryAction",kind:"reference",type:"ActionUsage",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,hasDerivation:!0},exitAction:{name:"exitAction",ecoreName:"exitAction",kind:"reference",type:"ActionUsage",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,hasDerivation:!0},isParallel:{name:"isParallel",ecoreName:"isParallel",kind:"attribute",type:"EBoolean",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1},state:{name:"state",ecoreName:"state",kind:"reference",type:"StateUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["ActionDefinition/action"],hasDerivation:!0}},operations:[]},StateSubactionMembership:{name:"StateSubactionMembership",abstract:!1,superTypes:["FeatureMembership"],features:{action:{name:"action",ecoreName:"action",kind:"reference",type:"ActionUsage",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,redefines:["FeatureMembership/ownedMemberFeature"]},kind:{name:"kind",ecoreName:"kind",kind:"attribute",type:"StateSubactionKind",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1}},operations:[]},StateUsage:{name:"StateUsage",abstract:!1,superTypes:["ActionUsage"],features:{doAction:{name:"doAction",ecoreName:"doAction",kind:"reference",type:"ActionUsage",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,hasDerivation:!0},entryAction:{name:"entryAction",ecoreName:"entryAction",kind:"reference",type:"ActionUsage",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,hasDerivation:!0},exitAction:{name:"exitAction",ecoreName:"exitAction",kind:"reference",type:"ActionUsage",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,hasDerivation:!0},isParallel:{name:"isParallel",ecoreName:"isParallel",kind:"attribute",type:"EBoolean",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1},stateDefinition:{name:"stateDefinition",ecoreName:"stateDefinition",kind:"reference",type:"Behavior",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,redefines:["ActionUsage/actionDefinition"]}},operations:[{name:"isSubstateUsage",type:"boolean",lowerBound:1,upperBound:1,parameters:[{name:"isParallel",type:"boolean",many:!1}],hasBody:!0}]},Step:{name:"Step",abstract:!1,superTypes:["Feature"],features:{behavior:{name:"behavior",ecoreName:"behavior",kind:"reference",type:"Behavior",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Feature/type"],hasDerivation:!0},parameter:{name:"parameter",ecoreName:"parameter",kind:"reference",type:"Feature",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,redefines:["Type/directedFeature"]}},operations:[]},Structure:{name:"Structure",abstract:!1,superTypes:["Class"],features:{},operations:[]},Subclassification:{name:"Subclassification",abstract:!1,superTypes:["Specialization"],features:{owningClassifier:{name:"owningClassifier",ecoreName:"owningClassifier",kind:"reference",type:"Classifier",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,opposite:"Classifier/ownedSubclassification",redefines:["Specialization/owningType"]},subclassifier:{name:"subclassifier",ecoreName:"subclassifier",kind:"reference",type:"Classifier",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1,redefines:["Specialization/specific"]},superclassifier:{name:"superclassifier",ecoreName:"superclassifier",kind:"reference",type:"Classifier",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1,redefines:["Specialization/general"]}},operations:[]},SubjectMembership:{name:"SubjectMembership",abstract:!1,superTypes:["ParameterMembership"],features:{ownedSubjectParameter:{name:"ownedSubjectParameter",ecoreName:"ownedSubjectParameter",kind:"reference",type:"Usage",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,redefines:["ParameterMembership/ownedMemberParameter"]}},operations:[]},Subsetting:{name:"Subsetting",abstract:!1,superTypes:["Specialization"],features:{owningFeature:{name:"owningFeature",ecoreName:"owningFeature",kind:"reference",type:"Feature",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,opposite:"Feature/ownedSubsetting",subsets:["Subsetting/subsettingFeature"],redefines:["Specialization/owningType"]},subsettedFeature:{name:"subsettedFeature",ecoreName:"subsettedFeature",kind:"reference",type:"Feature",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1,redefines:["Specialization/general"]},subsettingFeature:{name:"subsettingFeature",ecoreName:"subsettingFeature",kind:"reference",type:"Feature",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1,redefines:["Specialization/specific"]}},operations:[]},Succession:{name:"Succession",abstract:!1,superTypes:["Connector"],features:{},operations:[]},SuccessionAsUsage:{name:"SuccessionAsUsage",abstract:!1,superTypes:["ConnectorAsUsage","Succession"],features:{},operations:[]},SuccessionFlow:{name:"SuccessionFlow",abstract:!1,superTypes:["Flow","Succession"],features:{},operations:[]},SuccessionFlowUsage:{name:"SuccessionFlowUsage",abstract:!1,superTypes:["FlowUsage","SuccessionFlow"],features:{},operations:[]},TerminateActionUsage:{name:"TerminateActionUsage",abstract:!1,superTypes:["ActionUsage"],features:{terminatedOccurrenceArgument:{name:"terminatedOccurrenceArgument",ecoreName:"terminatedOccurrenceArgument",kind:"reference",type:"Expression",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,hasDerivation:!0}},operations:[]},TextualRepresentation:{name:"TextualRepresentation",abstract:!1,superTypes:["AnnotatingElement"],features:{body:{name:"body",ecoreName:"body",kind:"attribute",type:"EString",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1},language:{name:"language",ecoreName:"language",kind:"attribute",type:"EString",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1},representedElement:{name:"representedElement",ecoreName:"representedElement",kind:"reference",type:"Element",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,opposite:"Element/textualRepresentation",subsets:["Element/owner"],redefines:["AnnotatingElement/annotatedElement"]}},operations:[]},TransitionFeatureMembership:{name:"TransitionFeatureMembership",abstract:!1,superTypes:["FeatureMembership"],features:{kind:{name:"kind",ecoreName:"kind",kind:"attribute",type:"TransitionFeatureKind",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1},transitionFeature:{name:"transitionFeature",ecoreName:"transitionFeature",kind:"reference",type:"Step",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,redefines:["FeatureMembership/ownedMemberFeature"]}},operations:[]},TransitionUsage:{name:"TransitionUsage",abstract:!1,superTypes:["ActionUsage"],features:{effectAction:{name:"effectAction",ecoreName:"effectAction",kind:"reference",type:"ActionUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!1,containment:!1,derived:!0,volatile:!0,subsets:["Type/feature"]},guardExpression:{name:"guardExpression",ecoreName:"guardExpression",kind:"reference",type:"Expression",lowerBound:0,upperBound:-1,many:!0,ordered:!1,containment:!1,derived:!0,volatile:!0,subsets:["Type/ownedFeature"],hasDerivation:!0},source:{name:"source",ecoreName:"source",kind:"reference",type:"ActionUsage",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,hasDerivation:!0},succession:{name:"succession",ecoreName:"succession",kind:"reference",type:"Succession",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,subsets:["Namespace/ownedMember"],hasDerivation:!0},target:{name:"target",ecoreName:"target",kind:"reference",type:"ActionUsage",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,hasDerivation:!0},triggerAction:{name:"triggerAction",ecoreName:"triggerAction",kind:"reference",type:"AcceptActionUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!1,containment:!1,derived:!0,volatile:!0,subsets:["Type/ownedFeature"],hasDerivation:!0}},operations:[{name:"sourceFeature",type:"Feature",lowerBound:0,upperBound:1,parameters:[],hasBody:!0},{name:"triggerPayloadParameter",type:"ReferenceUsage",lowerBound:0,upperBound:1,parameters:[],hasBody:!0}]},TriggerInvocationExpression:{name:"TriggerInvocationExpression",abstract:!1,superTypes:["InvocationExpression"],features:{kind:{name:"kind",ecoreName:"kind",kind:"attribute",type:"TriggerKind",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1}},operations:[]},Type:{name:"Type",abstract:!1,superTypes:["Namespace"],features:{differencingType:{name:"differencingType",ecoreName:"differencingType",kind:"reference",type:"Type",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,hasDerivation:!0},directedFeature:{name:"directedFeature",ecoreName:"directedFeature",kind:"reference",type:"Feature",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Type/feature"],hasDerivation:!0},endFeature:{name:"endFeature",ecoreName:"endFeature",kind:"reference",type:"Feature",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Type/feature"],hasDerivation:!0},feature:{name:"feature",ecoreName:"feature",kind:"reference",type:"Feature",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Namespace/member"],hasDerivation:!0},featureMembership:{name:"featureMembership",ecoreName:"featureMembership",kind:"reference",type:"FeatureMembership",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,hasDerivation:!0},inheritedFeature:{name:"inheritedFeature",ecoreName:"inheritedFeature",kind:"reference",type:"Feature",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Type/feature"],hasDerivation:!0},inheritedMembership:{name:"inheritedMembership",ecoreName:"inheritedMembership",kind:"reference",type:"Membership",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Namespace/membership"],hasDerivation:!0},input:{name:"input",ecoreName:"input",kind:"reference",type:"Feature",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Type/directedFeature"],hasDerivation:!0},intersectingType:{name:"intersectingType",ecoreName:"intersectingType",kind:"reference",type:"Type",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,hasDerivation:!0},isAbstract:{name:"isAbstract",ecoreName:"isAbstract",kind:"attribute",type:"EBoolean",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1},isConjugated:{name:"isConjugated",ecoreName:"isConjugated",kind:"attribute",type:"EBoolean",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0},isSufficient:{name:"isSufficient",ecoreName:"isSufficient",kind:"attribute",type:"EBoolean",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1},multiplicity:{name:"multiplicity",ecoreName:"multiplicity",kind:"reference",type:"Multiplicity",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,subsets:["Namespace/ownedMember"],hasDerivation:!0},output:{name:"output",ecoreName:"output",kind:"reference",type:"Feature",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Type/directedFeature"],hasDerivation:!0},ownedConjugator:{name:"ownedConjugator",ecoreName:"ownedConjugator",kind:"reference",type:"Conjugation",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,opposite:"Conjugation/owningType",subsets:["Element/ownedRelationship"],hasDerivation:!0},ownedDifferencing:{name:"ownedDifferencing",ecoreName:"ownedDifferencing",kind:"reference",type:"Differencing",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,opposite:"Differencing/typeDifferenced",subsets:["Element/ownedRelationship"],hasDerivation:!0},ownedDisjoining:{name:"ownedDisjoining",ecoreName:"ownedDisjoining",kind:"reference",type:"Disjoining",lowerBound:0,upperBound:-1,many:!0,ordered:!1,containment:!1,derived:!0,volatile:!0,opposite:"Disjoining/owningType",subsets:["Element/ownedRelationship"],hasDerivation:!0},ownedEndFeature:{name:"ownedEndFeature",ecoreName:"ownedEndFeature",kind:"reference",type:"Feature",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,opposite:"Feature/endOwningType",subsets:["Type/endFeature","Type/ownedFeature"],hasDerivation:!0},ownedFeature:{name:"ownedFeature",ecoreName:"ownedFeature",kind:"reference",type:"Feature",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,opposite:"Feature/owningType",subsets:["Namespace/ownedMember"],hasDerivation:!0},ownedFeatureMembership:{name:"ownedFeatureMembership",ecoreName:"ownedFeatureMembership",kind:"reference",type:"FeatureMembership",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,opposite:"FeatureMembership/owningType",subsets:["Namespace/ownedMembership","Type/featureMembership"],hasDerivation:!0},ownedIntersecting:{name:"ownedIntersecting",ecoreName:"ownedIntersecting",kind:"reference",type:"Intersecting",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,opposite:"Intersecting/typeIntersected",subsets:["Element/ownedRelationship"]},ownedSpecialization:{name:"ownedSpecialization",ecoreName:"ownedSpecialization",kind:"reference",type:"Specialization",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,opposite:"Specialization/owningType",subsets:["Element/ownedRelationship"],hasDerivation:!0},ownedUnioning:{name:"ownedUnioning",ecoreName:"ownedUnioning",kind:"reference",type:"Unioning",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,opposite:"Unioning/typeUnioned",subsets:["Element/ownedRelationship"],hasDerivation:!0},unioningType:{name:"unioningType",ecoreName:"unioningType",kind:"reference",type:"Type",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,hasDerivation:!0}},operations:[{name:"allRedefinedFeaturesOf",type:"Feature",lowerBound:0,upperBound:-1,parameters:[{name:"membership",type:"Membership",many:!1}],hasBody:!0},{name:"allSupertypes",type:"Type",lowerBound:0,upperBound:-1,parameters:[],hasBody:!0},{name:"directionOf",type:"FeatureDirectionKind",lowerBound:0,upperBound:1,parameters:[{name:"feature",type:"Feature",many:!1}],hasBody:!0},{name:"directionOfExcluding",type:"FeatureDirectionKind",lowerBound:0,upperBound:1,parameters:[{name:"feature",type:"Feature",many:!1},{name:"excluded",type:"Type",many:!0}],hasBody:!0},{name:"inheritableMemberships",type:"Membership",lowerBound:0,upperBound:-1,parameters:[{name:"excludedNamespaces",type:"Namespace",many:!0},{name:"excludedTypes",type:"Type",many:!0},{name:"excludeImplied",type:"boolean",many:!1}],hasBody:!0},{name:"inheritedMemberships",type:"Membership",lowerBound:0,upperBound:-1,parameters:[{name:"excludedNamespaces",type:"Namespace",many:!0},{name:"excludedTypes",type:"Type",many:!0},{name:"excludeImplied",type:"boolean",many:!1}],hasBody:!0},{name:"isCompatibleWith",type:"boolean",lowerBound:1,upperBound:1,parameters:[{name:"otherType",type:"Type",many:!1}],hasBody:!0},{name:"multiplicities",type:"Multiplicity",lowerBound:0,upperBound:-1,parameters:[],hasBody:!0},{name:"nonPrivateMemberships",type:"Membership",lowerBound:0,upperBound:-1,parameters:[{name:"excludedNamespaces",type:"Namespace",many:!0},{name:"excludedTypes",type:"Type",many:!0},{name:"excludeImplied",type:"boolean",many:!1}],hasBody:!0},{name:"removeRedefinedFeatures",type:"Membership",lowerBound:0,upperBound:-1,parameters:[{name:"memberships",type:"Membership",many:!0}],hasBody:!0},{name:"specializes",type:"boolean",lowerBound:1,upperBound:1,parameters:[{name:"supertype",type:"Type",many:!1}],hasBody:!0},{name:"specializesFromLibrary",type:"boolean",lowerBound:1,upperBound:1,parameters:[{name:"libraryTypeName",type:"string",many:!1}],hasBody:!0},{name:"supertypes",type:"Type",lowerBound:0,upperBound:-1,parameters:[{name:"excludeImplied",type:"boolean",many:!1}],hasBody:!0}]},TypeFeaturing:{name:"TypeFeaturing",abstract:!1,superTypes:["Relationship"],features:{featureOfType:{name:"featureOfType",ecoreName:"featureOfType",kind:"reference",type:"Feature",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1,redefines:["Relationship/source"]},featuringType:{name:"featuringType",ecoreName:"featuringType",kind:"reference",type:"Type",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1,redefines:["Relationship/target"]},owningFeatureOfType:{name:"owningFeatureOfType",ecoreName:"owningFeatureOfType",kind:"reference",type:"Feature",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,opposite:"Feature/ownedTypeFeaturing",subsets:["Relationship/owningRelatedElement","TypeFeaturing/featureOfType"]}},operations:[]},Unioning:{name:"Unioning",abstract:!1,superTypes:["Relationship"],features:{typeUnioned:{name:"typeUnioned",ecoreName:"typeUnioned",kind:"reference",type:"Type",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,opposite:"Type/ownedUnioning",subsets:["Relationship/owningRelatedElement"],redefines:["Relationship/source"]},unioningType:{name:"unioningType",ecoreName:"unioningType",kind:"reference",type:"Type",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1,redefines:["Relationship/target"]}},operations:[]},Usage:{name:"Usage",abstract:!1,superTypes:["Feature"],features:{definition:{name:"definition",ecoreName:"definition",kind:"reference",type:"Classifier",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,redefines:["Feature/type"]},directedUsage:{name:"directedUsage",ecoreName:"directedUsage",kind:"reference",type:"Usage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Type/directedFeature","Usage/usage"],hasDerivation:!0},isReference:{name:"isReference",ecoreName:"isReference",kind:"attribute",type:"EBoolean",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,hasDerivation:!0},isVariation:{name:"isVariation",ecoreName:"isVariation",kind:"attribute",type:"EBoolean",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!1,volatile:!1},mayTimeVary:{name:"mayTimeVary",ecoreName:"mayTimeVary",kind:"attribute",type:"EBoolean",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,redefines:["Feature/isVariable"],hasDerivation:!0},nestedAction:{name:"nestedAction",ecoreName:"nestedAction",kind:"reference",type:"ActionUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Usage/nestedOccurrence"],hasDerivation:!0},nestedAllocation:{name:"nestedAllocation",ecoreName:"nestedAllocation",kind:"reference",type:"AllocationUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Usage/nestedConnection"],hasDerivation:!0},nestedAnalysisCase:{name:"nestedAnalysisCase",ecoreName:"nestedAnalysisCase",kind:"reference",type:"AnalysisCaseUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Usage/nestedCase"],hasDerivation:!0},nestedAttribute:{name:"nestedAttribute",ecoreName:"nestedAttribute",kind:"reference",type:"AttributeUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Usage/nestedUsage"],hasDerivation:!0},nestedCalculation:{name:"nestedCalculation",ecoreName:"nestedCalculation",kind:"reference",type:"CalculationUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Usage/nestedAction"],hasDerivation:!0},nestedCase:{name:"nestedCase",ecoreName:"nestedCase",kind:"reference",type:"CaseUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Usage/nestedCalculation"],hasDerivation:!0},nestedConcern:{name:"nestedConcern",ecoreName:"nestedConcern",kind:"reference",type:"ConcernUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!1,containment:!1,derived:!0,volatile:!0,subsets:["Usage/nestedRequirement"],hasDerivation:!0},nestedConnection:{name:"nestedConnection",ecoreName:"nestedConnection",kind:"reference",type:"ConnectorAsUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Usage/nestedUsage"],hasDerivation:!0},nestedConstraint:{name:"nestedConstraint",ecoreName:"nestedConstraint",kind:"reference",type:"ConstraintUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Usage/nestedOccurrence"],hasDerivation:!0},nestedEnumeration:{name:"nestedEnumeration",ecoreName:"nestedEnumeration",kind:"reference",type:"EnumerationUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Usage/nestedAttribute"]},nestedFlow:{name:"nestedFlow",ecoreName:"nestedFlow",kind:"reference",type:"FlowUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!1,containment:!1,derived:!0,volatile:!0,subsets:["Usage/nestedConnection"],hasDerivation:!0},nestedInterface:{name:"nestedInterface",ecoreName:"nestedInterface",kind:"reference",type:"InterfaceUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Usage/nestedConnection"],hasDerivation:!0},nestedItem:{name:"nestedItem",ecoreName:"nestedItem",kind:"reference",type:"ItemUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Usage/nestedOccurrence"],hasDerivation:!0},nestedMetadata:{name:"nestedMetadata",ecoreName:"nestedMetadata",kind:"reference",type:"MetadataUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Usage/nestedItem"],hasDerivation:!0},nestedOccurrence:{name:"nestedOccurrence",ecoreName:"nestedOccurrence",kind:"reference",type:"OccurrenceUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Usage/nestedUsage"],hasDerivation:!0},nestedPart:{name:"nestedPart",ecoreName:"nestedPart",kind:"reference",type:"PartUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Usage/nestedItem"],hasDerivation:!0},nestedPort:{name:"nestedPort",ecoreName:"nestedPort",kind:"reference",type:"PortUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Usage/nestedUsage"],hasDerivation:!0},nestedReference:{name:"nestedReference",ecoreName:"nestedReference",kind:"reference",type:"ReferenceUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Usage/nestedUsage"],hasDerivation:!0},nestedRendering:{name:"nestedRendering",ecoreName:"nestedRendering",kind:"reference",type:"RenderingUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Usage/nestedPart"],hasDerivation:!0},nestedRequirement:{name:"nestedRequirement",ecoreName:"nestedRequirement",kind:"reference",type:"RequirementUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Usage/nestedConstraint"],hasDerivation:!0},nestedState:{name:"nestedState",ecoreName:"nestedState",kind:"reference",type:"StateUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Usage/nestedAction"],hasDerivation:!0},nestedTransition:{name:"nestedTransition",ecoreName:"nestedTransition",kind:"reference",type:"TransitionUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!1,containment:!1,derived:!0,volatile:!0,subsets:["Usage/nestedUsage"],hasDerivation:!0},nestedUsage:{name:"nestedUsage",ecoreName:"nestedUsage",kind:"reference",type:"Usage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,opposite:"Usage/owningUsage",subsets:["Type/ownedFeature","Usage/usage"],hasDerivation:!0},nestedUseCase:{name:"nestedUseCase",ecoreName:"nestedUseCase",kind:"reference",type:"UseCaseUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Usage/nestedCase"],hasDerivation:!0},nestedVerificationCase:{name:"nestedVerificationCase",ecoreName:"nestedVerificationCase",kind:"reference",type:"VerificationCaseUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Usage/nestedCase"],hasDerivation:!0},nestedView:{name:"nestedView",ecoreName:"nestedView",kind:"reference",type:"ViewUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Usage/nestedPart"],hasDerivation:!0},nestedViewpoint:{name:"nestedViewpoint",ecoreName:"nestedViewpoint",kind:"reference",type:"ViewpointUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Usage/nestedRequirement"],hasDerivation:!0},owningDefinition:{name:"owningDefinition",ecoreName:"owningDefinition",kind:"reference",type:"Definition",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,opposite:"Definition/ownedUsage",subsets:["Feature/owningType"]},owningUsage:{name:"owningUsage",ecoreName:"owningUsage",kind:"reference",type:"Usage",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,opposite:"Usage/nestedUsage",subsets:["Feature/owningType"]},usage:{name:"usage",ecoreName:"usage",kind:"reference",type:"Usage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Type/feature"],hasDerivation:!0},variant:{name:"variant",ecoreName:"variant",kind:"reference",type:"Usage",lowerBound:0,upperBound:-1,many:!0,ordered:!1,containment:!1,derived:!0,volatile:!0,subsets:["Namespace/ownedMember"],hasDerivation:!0},variantMembership:{name:"variantMembership",ecoreName:"variantMembership",kind:"reference",type:"VariantMembership",lowerBound:0,upperBound:-1,many:!0,ordered:!1,containment:!1,derived:!0,volatile:!0,subsets:["Namespace/ownedMembership"],hasDerivation:!0}},operations:[{name:"referencedFeatureTarget",type:"Feature",lowerBound:1,upperBound:1,parameters:[],hasBody:!0}]},UseCaseDefinition:{name:"UseCaseDefinition",abstract:!1,superTypes:["CaseDefinition"],features:{includedUseCase:{name:"includedUseCase",ecoreName:"includedUseCase",kind:"reference",type:"UseCaseUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,hasDerivation:!0}},operations:[]},UseCaseUsage:{name:"UseCaseUsage",abstract:!1,superTypes:["CaseUsage"],features:{includedUseCase:{name:"includedUseCase",ecoreName:"includedUseCase",kind:"reference",type:"UseCaseUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,hasDerivation:!0},useCaseDefinition:{name:"useCaseDefinition",ecoreName:"useCaseDefinition",kind:"reference",type:"UseCaseDefinition",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,redefines:["CaseUsage/caseDefinition"]}},operations:[]},VariantMembership:{name:"VariantMembership",abstract:!1,superTypes:["OwningMembership"],features:{ownedVariantUsage:{name:"ownedVariantUsage",ecoreName:"ownedVariantUsage",kind:"reference",type:"Usage",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,redefines:["OwningMembership/ownedMemberElement"]}},operations:[]},VerificationCaseDefinition:{name:"VerificationCaseDefinition",abstract:!1,superTypes:["CaseDefinition"],features:{verifiedRequirement:{name:"verifiedRequirement",ecoreName:"verifiedRequirement",kind:"reference",type:"RequirementUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,hasDerivation:!0}},operations:[]},VerificationCaseUsage:{name:"VerificationCaseUsage",abstract:!1,superTypes:["CaseUsage"],features:{verificationCaseDefinition:{name:"verificationCaseDefinition",ecoreName:"verificationCaseDefinition",kind:"reference",type:"VerificationCaseDefinition",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,subsets:["CaseUsage/caseDefinition"]},verifiedRequirement:{name:"verifiedRequirement",ecoreName:"verifiedRequirement",kind:"reference",type:"RequirementUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,hasDerivation:!0}},operations:[]},ViewDefinition:{name:"ViewDefinition",abstract:!1,superTypes:["PartDefinition"],features:{satisfiedViewpoint:{name:"satisfiedViewpoint",ecoreName:"satisfiedViewpoint",kind:"reference",type:"ViewpointUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Definition/ownedRequirement"],hasDerivation:!0},view:{name:"view",ecoreName:"view",kind:"reference",type:"ViewUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Definition/usage"],hasDerivation:!0},viewCondition:{name:"viewCondition",ecoreName:"viewCondition",kind:"reference",type:"Expression",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Namespace/ownedMember"],hasDerivation:!0},viewRendering:{name:"viewRendering",ecoreName:"viewRendering",kind:"reference",type:"RenderingUsage",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,hasDerivation:!0}},operations:[]},ViewRenderingMembership:{name:"ViewRenderingMembership",abstract:!1,superTypes:["FeatureMembership"],features:{ownedRendering:{name:"ownedRendering",ecoreName:"ownedRendering",kind:"reference",type:"RenderingUsage",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,redefines:["FeatureMembership/ownedMemberFeature"]},referencedRendering:{name:"referencedRendering",ecoreName:"referencedRendering",kind:"reference",type:"RenderingUsage",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,hasDerivation:!0}},operations:[]},ViewUsage:{name:"ViewUsage",abstract:!1,superTypes:["PartUsage"],features:{exposedElement:{name:"exposedElement",ecoreName:"exposedElement",kind:"reference",type:"Element",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Namespace/member"],hasDerivation:!0},satisfiedViewpoint:{name:"satisfiedViewpoint",ecoreName:"satisfiedViewpoint",kind:"reference",type:"ViewpointUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Usage/nestedRequirement"],hasDerivation:!0},viewCondition:{name:"viewCondition",ecoreName:"viewCondition",kind:"reference",type:"Expression",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,subsets:["Namespace/ownedMember"],hasDerivation:!0},viewDefinition:{name:"viewDefinition",ecoreName:"viewDefinition",kind:"reference",type:"ViewDefinition",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,redefines:["PartUsage/partDefinition"]},viewRendering:{name:"viewRendering",ecoreName:"viewRendering",kind:"reference",type:"RenderingUsage",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,hasDerivation:!0}},operations:[{name:"includeAsExposed",type:"boolean",lowerBound:1,upperBound:1,parameters:[{name:"element",type:"Element",many:!1}],hasBody:!0}]},ViewpointDefinition:{name:"ViewpointDefinition",abstract:!1,superTypes:["RequirementDefinition"],features:{viewpointStakeholder:{name:"viewpointStakeholder",ecoreName:"viewpointStakeholder",kind:"reference",type:"PartUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,hasDerivation:!0}},operations:[]},ViewpointUsage:{name:"ViewpointUsage",abstract:!1,superTypes:["RequirementUsage"],features:{viewpointDefinition:{name:"viewpointDefinition",ecoreName:"viewpointDefinition",kind:"reference",type:"ViewpointDefinition",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,redefines:["RequirementUsage/requirementDefinition"]},viewpointStakeholder:{name:"viewpointStakeholder",ecoreName:"viewpointStakeholder",kind:"reference",type:"PartUsage",lowerBound:0,upperBound:-1,many:!0,ordered:!0,containment:!1,derived:!0,volatile:!0,hasDerivation:!0}},operations:[]},WhileLoopActionUsage:{name:"WhileLoopActionUsage",abstract:!1,superTypes:["LoopActionUsage"],features:{untilArgument:{name:"untilArgument",ecoreName:"untilArgument",kind:"reference",type:"Expression",lowerBound:0,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,hasDerivation:!0},whileArgument:{name:"whileArgument",ecoreName:"whileArgument",kind:"reference",type:"Expression",lowerBound:1,upperBound:1,many:!1,ordered:!1,containment:!1,derived:!0,volatile:!0,hasDerivation:!0}},operations:[]}};function an(e){var o,a;const r=[],n=[...((o=on[e])==null?void 0:o.superTypes)??[]];for(;n.length>0;){const i=n.shift();r.includes(i)||(r.push(i),n.push(...((a=on[i])==null?void 0:a.superTypes)??[]))}return r}function Or(e,r){return e===r||an(e).includes(r)}const Vr=[{role:"fork",metaclass:"ForkNode",bnfProduction:"fork-node"},{role:"join",metaclass:"JoinNode",bnfProduction:"join-node"},{role:"decision",metaclass:"DecisionNode",bnfProduction:"decision-node"},{role:"merge",metaclass:"MergeNode",bnfProduction:"merge-node"},{role:"send",metaclass:"SendActionUsage",bnfProduction:"send-action-node"},{role:"accept",metaclass:"AcceptActionUsage",bnfProduction:"accept-action-node"},{role:"activityFinal",metaclass:"TerminateActionUsage"},{role:"action",metaclass:"ActionUsage",bnfProduction:"action-node"},{role:"action",metaclass:"ActionDefinition",bnfProduction:"action-node"}],ni={activityfinalnode:"activityFinal",activityfinalnodeusage:"activityFinal",flowfinalnode:"flowFinal",flowfinalnodeusage:"flowFinal"},ri={fork:"ForkNode",join:"JoinNode",decide:"DecisionNode",merge:"MergeNode"};function oi(){return[...Vr].sort((e,r)=>an(r.metaclass).length-an(e.metaclass).length)}function ai(e){if(!e)return[];const r=e.replace(/[ _-]/g,""),n=r.charAt(0).toUpperCase()+r.slice(1);return[n,`${n}Usage`,`${n}Node`,`${n}ActionUsage`,n.replace(/Usage$/,""),n.replace(/Definition$/,"")]}function ii(e){for(const r of ai(e??""))if(r in on)return r}function si(e,r){var i;const n=new Map((r??[]).map(l=>[l.name,l])),o=[];let a=e;for(;a&&!o.includes(a);)o.push(a),a=(i=n.get(a))==null?void 0:i.superType;return o}function $r(e,r){var l,s;const n=(s=(l=e.attributes)==null?void 0:l.controlKind)==null?void 0:s.toLowerCase(),o=n?ri[n]:void 0,a=[...o?[o]:[],...si(e.kind,r==null?void 0:r.kinds),e.kind,e.construct],i=oi();for(const c of a){const d=ni[(c??"").replace(/[ _-]/g,"").toLowerCase()];if(d)return d;const u=ii(c);if(!u)continue;const y=i.find(b=>Or(u,b.metaclass));if(y)return y.role}}function Sd(e,r){const n=$r(e,r);if(n==="activityFinal"||n==="flowFinal")return!0;const o=Vr.find(a=>a.role===n);return o!==void 0&&Or(o.metaclass,"ControlNode")}const li=["general","interconnection","actionflow","statetransition","sequence","grid","browser","geometry"];new Set(li);const di={id:"requirements-matrix",name:"Requirements Matrix",description:"Standard requirements spreadsheet with ID, title, description, priority columns. Typical export from DOORS, Jama, or a simple Excel requirements log.",defaultKind:"Requirement",columnMappings:[{sourceColumn:"req id",targetAttribute:"id",transform:"sanitize-id",required:!0},{sourceColumn:"requirement id",targetAttribute:"id",transform:"sanitize-id",required:!0},{sourceColumn:"id",targetAttribute:"id",transform:"sanitize-id",required:!0},{sourceColumn:"req #",targetAttribute:"id",transform:"sanitize-id"},{sourceColumn:"number",targetAttribute:"id",transform:"sanitize-id"},{sourceColumn:"title",targetAttribute:"name",required:!0},{sourceColumn:"requirement title",targetAttribute:"name",required:!0},{sourceColumn:"name",targetAttribute:"name",required:!0},{sourceColumn:"summary",targetAttribute:"name"},{sourceColumn:"description",targetAttribute:"doc"},{sourceColumn:"text",targetAttribute:"doc"},{sourceColumn:"statement",targetAttribute:"doc"},{sourceColumn:"requirement text",targetAttribute:"doc"},{sourceColumn:"kind",targetAttribute:"kind"},{sourceColumn:"type",targetAttribute:"kind"},{sourceColumn:"category",targetAttribute:"category"},{sourceColumn:"priority",targetAttribute:"priority"},{sourceColumn:"rationale",targetAttribute:"rationale"},{sourceColumn:"verification method",targetAttribute:"verificationMethod"},{sourceColumn:"status",targetAttribute:"status"}]},ci={id:"hazard-log",name:"Hazard Log",description:"ISO 14971 hazard analysis spreadsheet with hazard ID, description, severity, probability and risk level columns.",defaultKind:"Hazard",columnMappings:[{sourceColumn:"hazard id",targetAttribute:"id",transform:"sanitize-id",required:!0},{sourceColumn:"haz id",targetAttribute:"id",transform:"sanitize-id"},{sourceColumn:"id",targetAttribute:"id",transform:"sanitize-id",required:!0},{sourceColumn:"hazard",targetAttribute:"name",required:!0},{sourceColumn:"hazard description",targetAttribute:"name",required:!0},{sourceColumn:"name",targetAttribute:"name",required:!0},{sourceColumn:"description",targetAttribute:"doc"},{sourceColumn:"hazardous situation",targetAttribute:"doc"},{sourceColumn:"kind",targetAttribute:"kind"},{sourceColumn:"severity",targetAttribute:"severity"},{sourceColumn:"probability",targetAttribute:"probability"},{sourceColumn:"risk level",targetAttribute:"riskLevel"},{sourceColumn:"risk",targetAttribute:"riskLevel"},{sourceColumn:"harm",targetAttribute:"harm"},{sourceColumn:"foreseeable misuse",targetAttribute:"foreseeableMisuse"},{sourceColumn:"mitigation",targetAttribute:"mitigation"},{sourceColumn:"residual risk",targetAttribute:"residualRisk"},{sourceColumn:"status",targetAttribute:"status"}]},ui={id:"fmea-worksheet",name:"FMEA Worksheet",description:"Failure Mode and Effects Analysis spreadsheet. Maps component failure modes to MEMO Failure kind with FMEA attributes (severity, occurrence, detection, RPN).",defaultKind:"Failure",columnMappings:[{sourceColumn:"id",targetAttribute:"id",transform:"sanitize-id",required:!0},{sourceColumn:"fmea id",targetAttribute:"id",transform:"sanitize-id"},{sourceColumn:"failure mode",targetAttribute:"name",required:!0},{sourceColumn:"failure mode description",targetAttribute:"name"},{sourceColumn:"name",targetAttribute:"name",required:!0},{sourceColumn:"description",targetAttribute:"doc"},{sourceColumn:"effect",targetAttribute:"doc"},{sourceColumn:"effect of failure",targetAttribute:"effect"},{sourceColumn:"kind",targetAttribute:"kind"},{sourceColumn:"component",targetAttribute:"component"},{sourceColumn:"function",targetAttribute:"function"},{sourceColumn:"severity",targetAttribute:"severity"},{sourceColumn:"s",targetAttribute:"severity"},{sourceColumn:"occurrence",targetAttribute:"occurrence"},{sourceColumn:"o",targetAttribute:"occurrence"},{sourceColumn:"detection",targetAttribute:"detection"},{sourceColumn:"d",targetAttribute:"detection"},{sourceColumn:"rpn",targetAttribute:"rpn"},{sourceColumn:"risk priority number",targetAttribute:"rpn"},{sourceColumn:"cause",targetAttribute:"cause"},{sourceColumn:"controls",targetAttribute:"controls"},{sourceColumn:"action",targetAttribute:"action"}]},pi={id:"verification-table",name:"Verification Table",description:"Verification and validation traceability matrix mapping requirements to test methods and results.",defaultKind:"VerificationTest",columnMappings:[{sourceColumn:"test id",targetAttribute:"id",transform:"sanitize-id",required:!0},{sourceColumn:"verification id",targetAttribute:"id",transform:"sanitize-id"},{sourceColumn:"id",targetAttribute:"id",transform:"sanitize-id",required:!0},{sourceColumn:"test name",targetAttribute:"name",required:!0},{sourceColumn:"name",targetAttribute:"name",required:!0},{sourceColumn:"title",targetAttribute:"name"},{sourceColumn:"description",targetAttribute:"doc"},{sourceColumn:"objective",targetAttribute:"doc"},{sourceColumn:"kind",targetAttribute:"kind"},{sourceColumn:"requirement id",targetAttribute:"requirementId"},{sourceColumn:"req id",targetAttribute:"requirementId"},{sourceColumn:"method",targetAttribute:"method"},{sourceColumn:"test method",targetAttribute:"method"},{sourceColumn:"verification method",targetAttribute:"method"},{sourceColumn:"result",targetAttribute:"result"},{sourceColumn:"pass/fail",targetAttribute:"result"},{sourceColumn:"status",targetAttribute:"status"},{sourceColumn:"evidence",targetAttribute:"evidence"},{sourceColumn:"notes",targetAttribute:"notes"}]},$n=[di,ci,ui,pi];function mi(e,r){return e.map(n=>{const o=n.trim().toLowerCase();if(r){const l=r.columnMappings.find(s=>s.sourceColumn.toLowerCase()===o);if(l)return{...l,sourceColumn:n}}const a=fi.find(l=>l.sourceColumn.toLowerCase()===o);if(a)return{...a,sourceColumn:n};const i=xi(n);return{sourceColumn:n,targetAttribute:i}})}const fi=[{sourceColumn:"id",targetAttribute:"id",transform:"sanitize-id"},{sourceColumn:"identifier",targetAttribute:"id",transform:"sanitize-id"},{sourceColumn:"uid",targetAttribute:"id",transform:"sanitize-id"},{sourceColumn:"name",targetAttribute:"name"},{sourceColumn:"title",targetAttribute:"name"},{sourceColumn:"label",targetAttribute:"name"},{sourceColumn:"description",targetAttribute:"doc"},{sourceColumn:"text",targetAttribute:"doc"},{sourceColumn:"notes",targetAttribute:"doc"},{sourceColumn:"kind",targetAttribute:"kind"},{sourceColumn:"type",targetAttribute:"kind"},{sourceColumn:"category",targetAttribute:"kind"},{sourceColumn:"construct",targetAttribute:"construct"}];function yi(e,r,n,o){const a=[],i=[],l=new Set,s=[];for(const f of r){if(!f.targetAttribute){i.push(f.sourceColumn);continue}l.has(f.targetAttribute)||(l.add(f.targetAttribute),s.push(f))}const c=l.has("id"),d=l.has("name"),u=l.has("kind");c||a.push("No column mapped to 'id' — id will be auto-generated from row number"),d||a.push("No column mapped to 'name'"),!u&&!o&&a.push("No column mapped to 'kind' and no defaultKind set");const y=["id","name","kind","construct","doc"],b=Array.from(l).filter(f=>!y.includes(f)),x=[...y.filter(f=>l.has(f)),...b];for(const f of["id","name","kind"])x.includes(f)||x.unshift(f);const w=[x.map(Wn).join(",")];return e.forEach((f,h)=>{const m={};for(const j of s){const C=f[j.sourceColumn]??"";m[j.targetAttribute]=gi(C,j.transform)}(!m.id||m.id.trim()==="")&&(m.id=`row_${h+1}`),(!m.kind||m.kind.trim()==="")&&o&&(m.kind=o);const D=m.kind;D&&Object.keys(n.kinds).length>0&&!n.kinds[D]&&a.push(`Row ${h+2}: unknown kind '${D}' (not declared by the resolved ontology)`);const N=x.map(j=>Wn(m[j]??""));w.push(N.join(","))}),{csv:w.join(`
14
- `)+`
15
- `,skippedColumns:i,warnings:a}}function gi(e,r){if(!r)return e;switch(r){case"sanitize-id":return hi(e);case"upper":return e.toUpperCase();case"lower":return e.toLowerCase();default:return e}}function hi(e){let r=e.trim().replace(/[\s\-]+/g,"_").replace(/[^a-zA-Z0-9_]/g,"").toLowerCase();return/^\d/.test(r)&&(r="e_"+r),r}function xi(e){return e.trim().replace(/[^a-zA-Z0-9 _-]/g,"").split(/[\s_-]+/).map((r,n)=>n===0?r.toLowerCase():r.charAt(0).toUpperCase()+r.slice(1).toLowerCase()).join("")}function Wn(e){return e.includes(",")||e.includes('"')||e.includes(`
16
- `)?`"${e.replace(/"/g,'""')}"`:e}let M=null,ft=null,Lt=0;const bi=1e4;let Be=!1,jt=null,Pe=null,he=null,Xe=!1;const We=new Map;function vi(e){const r=We.get(e.requestId);r&&(clearTimeout(r.timer),We.delete(e.requestId),e.success||e.conflict?r.resolve(e):r.reject(new Error(e.error||`Could not ${e.operation} diagram source.`)))}function wi(e){for(const r of We.values())clearTimeout(r.timer),r.reject(new Error(e));We.clear()}function Ut(e){return e?e.snapshot?(Pe=e.workspaceSessionId,he=e.revision,Xe=!1,!0):Xe?!1:Pe!==e.workspaceSessionId||he===null?(Xe=!0,Hn(),!1):e.revision===he?!0:e.baseRevision===he&&e.revision===he+1?(he=e.revision,!0):(Xe=!0,Hn(),!1):!0}const En=new Map,Sn=new Map,Bn=new Map,at=new Map,it=new Map,st=new Map,Ft=new Map;function Re(e,r){const n=r.get(e.requestId);n&&(clearTimeout(n.timer),r.delete(e.requestId),n.resolve(e))}function ki(e){for(const r of[En,Sn,Bn,Ft]){for(const n of r.values())clearTimeout(n.timer),n.reject(new Error(e));r.clear()}for(const r of at.values())clearTimeout(r.timer),r.reject(new Error(e));at.clear();for(const r of st.values())clearTimeout(r.timer),r.reject(new Error("The development server disconnected."));st.clear();for(const r of it.values())clearTimeout(r.timer),r.reject(new Error(e));it.clear()}function jn(e,r,n){if(!M||M.readyState!==WebSocket.OPEN)return Promise.reject(new Error("The development server is not connected."));const o=`${e}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`;return new Promise((a,i)=>{const l=setTimeout(()=>{n.delete(o),i(new Error("The server did not answer the relationship request."))},15e3);n.set(o,{resolve:a,reject:i,timer:l}),M.send(JSON.stringify({type:e,payload:{...r,requestId:o}}))})}function sn(e){var r,n;return(n=(r=E.getState().model)==null?void 0:r.irIdentities)==null?void 0:n[e]}function Cn(e,r){var o;const n=E.getState().model;if(!(!Pe||he===null||!n))return{workspaceSessionId:Pe,baseRevision:he,sourceFile:e,expectedSourceHash:((o=n.sourceHashes)==null?void 0:o[e])??"",targetElementIds:r}}function Ei(){const e=window.__MEMO_DATA__;if(!e)return!1;const r=E.getState();return r.setConnected(!0),e.model&&r.setModel(e.model),e.validation&&r.setValidation(e.validation),e.completeness&&r.setCompleteness(e.completeness),!0}function Wr(e){if(window.__MEMO_DATA__)return;ji();const r=`ws://${window.location.host}`;if(M&&(M.readyState===WebSocket.OPEN||M.readyState===WebSocket.CONNECTING))return;M=new WebSocket(r);const n=E.getState();M.onopen=()=>{n.setConnected(!0),Lt=0,jt=null,Be=!1,Pe=null,he=null,Xe=!1,n.setRestartRequired(null),ft&&(clearTimeout(ft),ft=null)},M.onmessage=o=>{try{const a=JSON.parse(o.data);Si(a)}catch{}},M.onclose=()=>{n.setConnected(!1),wi("The development server disconnected."),ki("The development server disconnected."),M=null,Lt++;const o=Math.min(2e3*Math.pow(2,Lt-1),bi);ft=setTimeout(()=>Wr(),o)},M.onerror=()=>{}}function Si(e){var n;const r=E.getState();switch(e.type){case"app:restart-required":Be=!0,r.setRestartRequired(e);return;case"app:edit-conflict":r.setEditConflict(e.payload);return;case"model:update":if(Be||!Ut(e.revision))return;if((n=e.revision)!=null&&n.modelDelta&&!e.revision.snapshot&&r.model){const o={...r.model.elements,...e.revision.modelDelta.upsertElements};for(const a of e.revision.modelDelta.removeElementIds)delete o[a];r.setModel({...r.model,...e.revision.modelDelta.patch,elements:o})}else r.setModel(e.payload);break;case"source:coherence":r.setSourceCoherence(e.payload);break;case"source:changed":if(Be)return;r.applySourceChange(e.payload);break;case"validation:update":if(Be||!Ut(e.revision))return;r.setValidation(e.payload);break;case"completeness:update":if(Be||!Ut(e.revision))return;r.setCompleteness(e.payload);break;case"methodology:update":if(Be)return;r.setMethodology(e.payload);break;case"rules:update":if(Be)return;r.setEffectiveRules(e.payload.rules,e.payload.diagnostics);break;case"rule:policy:write:result":Re(e.payload,st);break;case"error":console.error("[MEMO] Server error:",e.payload.message);break;case"diagram:parse:result":r.applyDiagramParseResult(e.payload.diagramId,e.payload.elementIds,e.payload.errors);break;case"diagram:source:result":vi(e.payload);break;case"relationship:create:result":Re(e.payload,En);break;case"relationship:delete:result":Re(e.payload,Sn);break;case"element:delete:result":Re(e.payload,Bn);break;case"element:mutation:result":Re(e.payload,at);break;case"methodology:source:result":Re(e.payload,it);break;case"screen-capture:upload:result":Re(e.payload,Ft);break;case"ontology:packages":{const o=e.payload.ontologyHash;if(o){if(jt===null)jt=o;else if(jt!==o){Be=!0,r.setRestartRequired({type:"app:restart-required",reason:"ontology-source-changed",changedFile:"(server restarted with different ontology)",instruction:"Reload the page to connect to the new server."});return}}r.setAvailableOntologies(e.payload.packages);break}case"ontology:install:result":r.setOntologyInstallStatus({installing:!1,lastInstalled:e.payload.success?e.payload.packageName:void 0,error:e.payload.error});break;case"ontology:remove:result":r.setOntologyInstallStatus({installing:!1});break;case"diagram:layout":r.mergeDiagramLayouts(e.payload.layouts);break;case"import:result":r.setImportResult(e.payload);break;case"llm:status":r.setLlmStatus(e.payload.available,e.payload.provider,e.payload.model);break;case"llm:settings":r.setLlmSettings(e.payload.settings);break;case"llm:ask:result":e.payload.error?r.rejectLlmRequest(e.payload.requestId,e.payload.error):r.resolveLlmRequest(e.payload.requestId,e.payload.answer);break;case"llm:chat:result":e.payload.error?r.rejectLlmRequest(e.payload.requestId,e.payload.error):r.resolveLlmRequest(e.payload.requestId,{answer:e.payload.answer,proposedChanges:e.payload.proposedChanges??[],messages:e.payload.messages??[],truncated:e.payload.truncated});break;case"llm:chat:apply:result":e.payload.error?r.rejectLlmRequest(e.payload.requestId,e.payload.error):r.resolveLlmRequest(e.payload.requestId,{applied:e.payload.applied??[],failed:e.payload.failed??[]});break;case"llm:settings:save:result":e.payload.error?r.rejectLlmRequest(e.payload.requestId,e.payload.error):r.resolveLlmRequest(e.payload.requestId,e.payload.settings);break;case"llm:generate:result":if(e.payload.error)r.rejectLlmRequest(e.payload.requestId,e.payload.error);else{const o=e.payload;r.resolveLlmRequest(o.requestId,{sysml:o.sysml,initialSysml:o.initialSysml,explanation:o.explanation,suggestedFile:o.suggestedFile,attempts:o.attempts,diagnostics:o.diagnostics??[],changeRecord:o.changeRecord})}break;case"llm:draft:result":e.payload.error?r.rejectLlmRequest(e.payload.requestId,e.payload.error):r.resolveLlmRequest(e.payload.requestId,{markdown:e.payload.markdown,summary:e.payload.summary});break;case"llm:suggest:result":e.payload.error?r.rejectLlmRequest(e.payload.requestId,e.payload.error):r.resolveLlmRequest(e.payload.requestId,e.payload.suggestions);break;case"dhf:docs":_n(()=>r.setDhfDocuments(e.payload.docs));break;case"dhf:settings":_n(()=>r.hydrateDhfSettings(e.payload.settings));break;case"dhf:templates:result":r.resolveLlmRequest(e.payload.requestId,e.payload.templates);break;case"dhf:template:content":e.payload.error?r.rejectLlmRequest(e.payload.requestId,e.payload.error):r.resolveLlmRequest(e.payload.requestId,e.payload.content);break;case"dhf:template:save:result":e.payload.error?r.rejectLlmRequest(e.payload.requestId,e.payload.error):r.resolveLlmRequest(e.payload.requestId,{path:e.payload.path});break}}let ln=!1;const _r=600,et=new Map;let yt=null;function _n(e){ln=!0;try{e()}finally{ln=!1}}function _e(e){M&&M.readyState===WebSocket.OPEN&&M.send(JSON.stringify(e))}function Bi(e){const r=et.get(e.id);r&&clearTimeout(r),et.set(e.id,setTimeout(()=>{et.delete(e.id);const n=E.getState().dhfDocuments.find(o=>o.id===e.id);n&&_e({type:"dhf:doc:save",payload:{doc:n}})},_r))}let qn=!1;function ji(){qn||(qn=!0,E.subscribe((e,r)=>{if(!ln){if(e.dhfDocuments!==r.dhfDocuments){const n=new Map(r.dhfDocuments.map(o=>[o.id,o]));for(const o of e.dhfDocuments)n.get(o.id)!==o&&Bi(o),n.delete(o.id);for(const o of n.keys()){const a=et.get(o);a&&(clearTimeout(a),et.delete(o)),_e({type:"dhf:doc:delete",payload:{docId:o}})}}e.dhfSettings!==r.dhfSettings&&(yt&&clearTimeout(yt),yt=setTimeout(()=>{yt=null,_e({type:"dhf:settings:save",payload:{settings:E.getState().dhfSettings}})},_r))}}))}function Ci(e){_e({type:"dhf:templates:list",payload:{requestId:e}})}function Di(e,r){_e({type:"dhf:template:read",payload:{requestId:e,path:r}})}function Fi(e,r,n){_e({type:"dhf:template:save",payload:{requestId:e,title:r,content:n}})}function Hn(){M&&M.readyState===WebSocket.OPEN&&M.send(JSON.stringify({type:"request:refresh"}))}function Me(e){return qr("element:update",e)}function zt(e){return qr("element:create",e)}function qr(e,r){var s;if(!M||M.readyState!==WebSocket.OPEN)return Promise.reject(new Error("The development server is not connected."));const n=`${e}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`,o=E.getState().model,a=r.file??"model/catalog/project.sysml",i=((s=o==null?void 0:o.sourceHashes)==null?void 0:s[a])??"",l=Pe&&he!==null?{workspaceSessionId:Pe,baseRevision:he,sourceFile:a,expectedSourceHash:i,targetElementIds:[r.id]}:void 0;return new Promise((c,d)=>{const u=setTimeout(()=>{at.delete(n),d(new Error("The server did not answer the element mutation."))},15e3);at.set(n,{resolve:c,reject:d,timer:u}),M.send(JSON.stringify({type:e,payload:{...r,file:a,requestId:n,precondition:l,...e==="element:update"?{irIdentity:sn(r.id)}:{}}}))})}function Ni(e){const r=e.owningFile??"model/catalog/relationships.sysml";return jn("relationship:create",{...e,owningFile:r,sourceIdentity:sn(e.sourceId),targetIdentity:sn(e.targetId),precondition:Cn(r,[e.sourceId,e.targetId])},En)}function Ai(e){var o;const r=(o=E.getState().model)==null?void 0:o.relationships.find(a=>a.id===e.relationshipId),n=(r==null?void 0:r.file)??e.sourceFile;return jn("relationship:delete",{...e,precondition:n?Cn(n,[r==null?void 0:r.sourceId,r==null?void 0:r.targetId].filter(Boolean)):void 0},Sn)}function Ti(e){var n;const r=(n=E.getState().model)==null?void 0:n.elements[e];return jn("element:delete",{elementId:e,precondition:r!=null&&r.file?Cn(r.file,[e]):void 0},Bn)}function Bd(e){if(!M||M.readyState!==WebSocket.OPEN)return Promise.reject(new Error("The development server is not connected."));const r=`screen-capture-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`;return new Promise((n,o)=>{const a=setTimeout(()=>{Ft.delete(r),o(new Error("The server did not answer the screen-capture upload request."))},3e4);Ft.set(r,{resolve:n,reject:o,timer:a}),M.send(JSON.stringify({type:"screen-capture:upload",payload:{...e,requestId:r}}))})}function Ri(e){M&&M.readyState===WebSocket.OPEN&&M.send(JSON.stringify({type:"diagram:create",payload:e}))}function Kn(e){M&&M.readyState===WebSocket.OPEN&&M.send(JSON.stringify({type:"diagram:update",payload:e}))}function Mi(e){if(M&&M.readyState===WebSocket.OPEN){const r={id:e};M.send(JSON.stringify({type:"diagram:delete",payload:r}))}}function jd(e,r){if(M&&M.readyState===WebSocket.OPEN){const n={diagramId:e,text:r};M.send(JSON.stringify({type:"diagram:parse",payload:n}))}}function Hr(e,r,n){if(!M||M.readyState!==WebSocket.OPEN)return Promise.reject(new Error("The development server is not connected."));const o=`diagram-source-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`;return new Promise((a,i)=>{const l=setTimeout(()=>{We.delete(o),i(new Error(`Timed out while trying to ${e} the SysML source.`))},1e4);We.set(o,{resolve:a,reject:i,timer:l}),M.send(JSON.stringify({type:e==="load"?"diagram:source:request":"diagram:source:save",payload:{requestId:o,diagramId:r,...e==="save"?n:{}}}))})}function Cd(e){return Hr("load",e)}function Dd(e,r,n){return Hr("save",e,{text:r,baseRevision:n})}function dn(e,r,n){if(!M||M.readyState!==WebSocket.OPEN)return Promise.reject(new Error("The development server is not connected."));const o=`methodology-${e}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`;return new Promise((a,i)=>{const l=setTimeout(()=>{it.delete(o),i(new Error(`Timed out while trying to ${e} methodology source.`))},15e3);it.set(o,{resolve:a,reject:i,timer:l}),M.send(JSON.stringify({type:`methodology:source:${e==="load"?"request":"save"}`,payload:{requestId:o,sourceFile:r,...n}}))})}function Ii(e){M&&M.readyState===WebSocket.OPEN&&M.send(JSON.stringify({type:"element:remap-kinds",payload:{mappings:e}}))}function Ot(e){M&&M.readyState===WebSocket.OPEN&&M.send(JSON.stringify({type:"ontology:save-selection",payload:{selected:e}}))}function Fd(e){M&&M.readyState===WebSocket.OPEN&&M.send(JSON.stringify({type:"ontology:install",payload:{source:e}}))}function Pi(e){M&&M.readyState===WebSocket.OPEN&&M.send(JSON.stringify({type:"open-file",payload:{path:e}}))}function Nd(e){M&&M.readyState===WebSocket.OPEN&&M.send(JSON.stringify({type:"ontology:remove",payload:{packageName:e}}))}function Ad(e,r){M&&M.readyState===WebSocket.OPEN&&M.send(JSON.stringify({type:"diagram:layout:update",payload:{diagramId:e,layout:r}}))}function Li(e){M&&M.readyState===WebSocket.OPEN&&M.send(JSON.stringify({type:"csv:import",payload:e}))}function Td(e,r,n,o){M&&M.readyState===WebSocket.OPEN&&M.send(JSON.stringify({type:"llm:chat",payload:{requestId:e,question:r,history:n,allowEdits:o}}))}function Rd(e,r){M&&M.readyState===WebSocket.OPEN&&M.send(JSON.stringify({type:"llm:chat:apply",payload:{requestId:e,changes:r}}))}function Md(e,r){M&&M.readyState===WebSocket.OPEN&&M.send(JSON.stringify({type:"llm:settings:save",payload:{requestId:e,...r}}))}function Id(e,r){M&&M.readyState===WebSocket.OPEN&&M.send(JSON.stringify({type:"llm:generate",payload:{requestId:e,description:r}}))}function Pd(e,r,n){M&&M.readyState===WebSocket.OPEN&&M.send(JSON.stringify({type:"llm:draft",payload:{requestId:e,documentTypeId:r,targetSections:n}}))}function Ui(e){if(!M||M.readyState!==WebSocket.OPEN)return Promise.reject(new Error("The development server is not connected."));const r=`rule-policy-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`;return new Promise((n,o)=>{const a=setTimeout(()=>{st.delete(r),o(new Error("Timed out while writing the rule policy."))},15e3);st.set(r,{resolve:n,reject:o,timer:a}),M.send(JSON.stringify({type:"rule:policy:write",payload:{requestId:r,...e}}))})}const Gn="memo:userViewpoints",cn="memo:activeView";function zi(){try{const e=JSON.parse(sessionStorage.getItem(cn)??"null");if((e==null?void 0:e.type)==="diagram"&&typeof e.diagramId=="string")return e}catch{}return{type:"welcome"}}function Yn(e){try{e.type==="diagram"?sessionStorage.setItem(cn,JSON.stringify(e)):sessionStorage.removeItem(cn)}catch{}}function Oi(){try{const e=localStorage.getItem(Gn);if(e){const r=JSON.parse(e);return localStorage.removeItem(Gn),r.length>0&&console.warn(`[MEMO] Migrated ${r.length} user viewpoint(s) from localStorage. Save them to memo.viewpoints.yaml to persist across sessions.`),r}}catch{}return[]}const Ae="_folder",gt=zi(),E=xr((e,r)=>({model:null,validation:null,completeness:null,connected:!1,restartRequired:null,sourceCoherence:null,editConflict:null,methodology:null,effectiveRules:[],ruleDiagnostics:[],lastSourceChange:null,activeMode:gt.type==="diagram"?"diagram":"catalog",activeView:gt,explorerTab:"model",selectedElementId:null,selectedRelationshipId:null,selectedElementIds:new Set,recentlyVisited:[],selectedViewpointId:null,selectedDiagramId:gt.type==="diagram"?gt.diagramId:null,searchTerm:"",sidebarCollapsed:!1,propertiesPanelCollapsed:!0,hiddenLayers:new Set,ontologyGroupBy:"layer",collapsedGroups:new Set,availableOntologies:[],selectedOntologies:new Set,focusedOntologyId:null,selectedOntologyKind:null,ontologyViewMode:"visual",showOntologyRelationships:!1,highlightedRelationshipType:null,hiddenEdgeTypes:new Set(["extends"]),ontologyInstallStatus:{installing:!1},gapBarExpanded:!1,gapBarHeight:160,catalogGroupBy:"semantic",catalogCollapsed:new Set,contextMenu:null,attributeFilter:null,labelFilter:null,tagFilters:[],userViewpoints:Oi(),diagramLayouts:{},mergeDiagramLayouts:n=>e(o=>({diagramLayouts:{...o.diagramLayouts,...n}})),setNodeLayout:(n,o,a)=>e(i=>{const l=i.diagramLayouts[n]??{nodes:{},edges:{}};return{diagramLayouts:{...i.diagramLayouts,[n]:{...l,nodes:{...l.nodes,[o]:{...l.nodes[o]??{},...a}}}}}}),diagramParseErrors:{},dhfDocuments:[],dhfSettings:{company:"",product:"",deviceType:"",version:"0.1",phase:"",logoUrl:"",compactLogoUrl:"",primaryColor:"#1B3A4B",compactMode:!1,headerTemplate:"**{{project.product}}** | {{id}} | Rev {{project.version}}",footerTemplate:"Confidential — {{project.company}} | Page {{page}}",documentNumberingPrefix:"DOC"},bulkImportOpen:!1,importResult:null,llmAvailable:!1,llmProvider:void 0,llmModel:void 0,llmPending:new Map,llmSettings:null,setLlmSettings:n=>e({llmSettings:n,llmAvailable:n.configured,llmProvider:n.provider,llmModel:n.model}),setLlmStatus:(n,o,a)=>e({llmAvailable:n,llmProvider:o,llmModel:a}),registerLlmRequest:(n,o,a)=>e(i=>{const l=new Map(i.llmPending);return l.set(n,{resolve:o,reject:a}),{llmPending:l}}),resolveLlmRequest:(n,o)=>e(a=>{const i=a.llmPending.get(n);if(i){i.resolve(o);const l=new Map(a.llmPending);return l.delete(n),{llmPending:l}}return{}}),rejectLlmRequest:(n,o)=>e(a=>{const i=a.llmPending.get(n);if(i){i.reject(new Error(o));const l=new Map(a.llmPending);return l.delete(n),{llmPending:l}}return{}}),analysisIssues:[],editingElementId:null,pendingEdits:new Map,pendingRelationships:[],createRelationship:async n=>{const o=`pending-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`,a=$i(r().model,n.type);e(l=>({pendingRelationships:[...l.pendingRelationships,{pendingId:o,type:n.type,label:(a==null?void 0:a.label)??n.type,sourceId:n.sourceId,targetId:n.targetId,direction:n.direction,status:"saving"}]}));const i=(l,s)=>(e(c=>({pendingRelationships:c.pendingRelationships.map(d=>d.pendingId===o?{...d,status:"failed",error:l}:d)})),{success:!1,error:l,diagnostics:s});try{const l=await Ni(n);return l.success?(e(s=>({pendingRelationships:s.pendingRelationships.filter(c=>c.pendingId!==o)})),{success:!0,relationshipId:l.relationshipId,sourceFile:l.sourceFile,diagnostics:l.diagnostics}):i(l.error??"The relationship could not be created.",l.diagnostics)}catch(l){return i(l instanceof Error?l.message:String(l))}},deleteRelationship:async n=>{try{const o=await Ai({relationshipId:n});return o.success?(e(a=>a.model?{model:{...a.model,relationships:a.model.relationships.filter(i=>i.id!==n)},selectedRelationshipId:a.selectedRelationshipId===n?null:a.selectedRelationshipId}:{}),{success:!0,sourceFile:o.sourceFile}):{success:!1,error:o.error??"The relationship could not be deleted."}}catch(o){return{success:!1,error:o instanceof Error?o.message:String(o)}}},deleteModelElement:async n=>{try{const o=await Ti(n);return o.success?(e(a=>{if(!a.model)return{};const i={...a.model.elements};return delete i[n],{model:{...a.model,elements:i,relationships:a.model.relationships.filter(l=>l.sourceId!==n&&l.targetId!==n),diagrams:(a.model.diagrams??[]).map(l=>{var s;return{...l,elementIds:(s=l.elementIds)==null?void 0:s.filter(c=>c!==n)}})},selectedElementId:a.selectedElementId===n?null:a.selectedElementId,selectedElementIds:new Set([...a.selectedElementIds].filter(l=>l!==n))}}),{success:!0}):{success:!1,error:o.error??"The element could not be deleted."}}catch(o){return{success:!1,error:o instanceof Error?o.message:String(o)}}},dismissPendingRelationship:n=>e(o=>({pendingRelationships:o.pendingRelationships.filter(a=>a.pendingId!==n)})),setRestartRequired:n=>e({restartRequired:n}),setSourceCoherence:n=>e({sourceCoherence:n.coherent?null:n}),setEditConflict:n=>e({editConflict:n}),applySourceChange:n=>e(o=>{var a;return{lastSourceChange:{...n,seq:(((a=o.lastSourceChange)==null?void 0:a.seq)??0)+1}}}),setMethodology:n=>e({methodology:n}),setEffectiveRules:(n,o)=>e({effectiveRules:n??[],ruleDiagnostics:o??[]}),setModel:n=>e(o=>{var s,c,d,u;let a=o.activeView,i=o.selectedDiagramId,l=o.selectedViewpointId;if(a.type==="diagram"){const y=a.diagramId,b=(s=n.diagrams)==null?void 0:s.find(f=>f.id===y),x=(d=(c=o.model)==null?void 0:c.diagrams)==null?void 0:d.find(f=>f.id===y),w=b??(x!=null&&x.sourceFile?(u=n.diagrams)==null?void 0:u.find(f=>f.sourceFile===x.sourceFile):void 0);w&&(w.id!==y&&(a={type:"diagram",diagramId:w.id},Yn(a)),i=w.id,l=w.viewpointId==="__model"?null:w.viewpointId)}else(a.type==="welcome"||a.type==="dashboard")&&Object.keys(n.elements).length>0&&(a={type:"dashboard"});return{model:n,activeView:a,selectedDiagramId:i,selectedViewpointId:l}}),setValidation:n=>e({validation:n}),setCompleteness:n=>e({completeness:n}),setConnected:n=>e({connected:n}),setAnalysisIssues:n=>e({analysisIssues:n}),setActiveMode:n=>e({activeMode:n}),setActiveView:n=>{Yn(n),e({activeView:n})},setExplorerTab:n=>e({explorerTab:n}),selectElement:n=>{e(n?o=>{const a=[n,...o.recentlyVisited.filter(i=>i!==n)].slice(0,20);return{selectedElementId:n,activeView:{type:"element-detail",elementId:n},recentlyVisited:a}}:{selectedElementId:n})},inspectElement:n=>e(o=>({selectedElementId:n,selectedRelationshipId:null,propertiesPanelCollapsed:n?!1:o.propertiesPanelCollapsed,recentlyVisited:n?[n,...o.recentlyVisited.filter(a=>a!==n)].slice(0,20):o.recentlyVisited})),inspectRelationship:n=>e({selectedRelationshipId:n,selectedElementId:null,propertiesPanelCollapsed:n?!1:r().propertiesPanelCollapsed}),toggleElementSelection:n=>e(o=>{const a=new Set(o.selectedElementIds);return a.has(n)?a.delete(n):a.add(n),{selectedElementIds:a}}),selectAllElements:n=>e({selectedElementIds:new Set(n)}),clearElementSelection:()=>e({selectedElementIds:new Set}),updateElementKind:(n,o)=>{const{model:a}=r();if(!a)return;const i=a.elements[n];if(!i)return;const l={...i,kind:o};e(s=>({model:s.model?{...s.model,elements:{...s.model.elements,[n]:l}}:null})),Me(l)},bulkUpdateAttributes:(n,o)=>{const{model:a}=r();if(!a)return;const i={...a.elements};for(const l of n){const s=i[l];if(!s)continue;const c={...s,attributes:{...s.attributes,...o}};i[l]=c,Me(c)}e(l=>({model:l.model?{...l.model,elements:i}:null}))},selectViewpoint:n=>e({selectedViewpointId:n,selectedDiagramId:null}),selectDiagram:n=>{var i;if(!n){e({selectedDiagramId:null});return}const{model:o}=r(),a=(i=o==null?void 0:o.diagrams)==null?void 0:i.find(l=>l.id===n);e(a?{selectedDiagramId:n,selectedViewpointId:a.viewpointId==="__model"?null:a.viewpointId}:{selectedDiagramId:n})},setSearchTerm:n=>e({searchTerm:n}),toggleSidebar:()=>e(n=>({sidebarCollapsed:!n.sidebarCollapsed})),togglePropertiesPanel:()=>e(n=>({propertiesPanelCollapsed:!n.propertiesPanelCollapsed})),toggleLayerVisibility:n=>e(o=>{const a=new Set(o.hiddenLayers);return a.has(n)?a.delete(n):a.add(n),{hiddenLayers:a}}),setOntologyGroupBy:n=>e({ontologyGroupBy:n,collapsedGroups:new Set}),toggleGroupCollapsed:n=>e(o=>{const a=new Set(o.collapsedGroups);return a.has(n)?a.delete(n):a.add(n),{collapsedGroups:a}}),setAvailableOntologies:n=>e(o=>{let a=new Set(n.filter(s=>s.selected).map(s=>s.name));const i=["@memoarchitect/ontology"];for(const s of n)i.includes(s.name)&&a.add(s.name);a.size===0&&n.length>0&&(a=new Set(n.map(s=>s.name)));const l=o.focusedOntologyId??(a.size>0?[...a][0]:null);return{availableOntologies:n,selectedOntologies:a,focusedOntologyId:l}}),toggleOntologySelection:n=>e(o=>{const a=new Set(o.selectedOntologies);return a.has(n)?a.delete(n):a.add(n),{selectedOntologies:a}}),setFocusedOntology:n=>e({focusedOntologyId:n}),setSelectedOntologyKind:n=>e({selectedOntologyKind:n}),setOntologyViewMode:n=>e({ontologyViewMode:n}),toggleOntologyRelationships:()=>e(n=>({showOntologyRelationships:!n.showOntologyRelationships})),setHighlightedRelationshipType:n=>e(o=>({highlightedRelationshipType:o.highlightedRelationshipType===n?null:n})),toggleHiddenEdgeType:n=>e(o=>{const a=new Set(o.hiddenEdgeTypes);return a.has(n)?a.delete(n):a.add(n),{hiddenEdgeTypes:a}}),saveOntologySelection:()=>{const{model:n,availableOntologies:o,selectedOntologies:a}=r();if(!n)return{success:!0};const i=o.filter(c=>!a.has(c.name)),l=new Set;for(const c of i)for(const d of c.layers)for(const u of d.kinds)l.add(u.name);const s=[];if(l.size>0){for(const c of Object.values(n.elements))if(l.has(c.kind)){const d=i.find(u=>u.layers.some(y=>y.kinds.some(b=>b.name===c.kind)));s.push({elementId:c.id,elementName:c.name,kind:c.kind,fromOntology:(d==null?void 0:d.name)??"unknown"})}}return{success:!0,orphanedElements:s}},setOntologyInstallStatus:n=>e({ontologyInstallStatus:n}),toggleGapBar:()=>e(n=>({gapBarExpanded:!n.gapBarExpanded})),setGapBarHeight:n=>e({gapBarHeight:Math.max(80,Math.min(400,n))}),setCatalogGroupBy:n=>e({catalogGroupBy:n,catalogCollapsed:new Set}),toggleCatalogCollapsed:n=>e(o=>{const a=new Set(o.catalogCollapsed);return a.has(n)?a.delete(n):a.add(n),{catalogCollapsed:a}}),setCatalogCollapsedAll:n=>e(o=>n?{catalogCollapsed:new Set(["__ALL__"])}:{catalogCollapsed:new Set}),setContextMenu:n=>e({contextMenu:n}),setAttributeFilter:n=>e({attributeFilter:n}),setLabelFilter:n=>e({labelFilter:n}),toggleTagFilter:n=>e(o=>({tagFilters:o.tagFilters.includes(n)?o.tagFilters.filter(i=>i!==n):[...o.tagFilters,n]})),clearTagFilters:()=>e({tagFilters:[]}),setEditingElement:n=>e({editingElementId:n}),updateElementField:(n,o,a)=>e(i=>{const l=new Map(i.pendingEdits),s=l.get(n)||{};return l.set(n,{...s,[o]:a}),{pendingEdits:l}}),updateElementAttribute:(n,o,a)=>e(i=>{const l=new Map(i.pendingEdits),s=l.get(n)||{},c={...s.attributes||{},[o]:a};return l.set(n,{...s,attributes:c}),{pendingEdits:l}}),updateElementFolder:(n,o)=>{var l;const a=(l=r().model)==null?void 0:l.elements[n];if(!a)return;const i={...a,attributes:{...a.attributes,[Ae]:o}};e(s=>({model:s.model?{...s.model,elements:{...s.model.elements,[n]:i}}:null})),Me(i)},moveFolder:(n,o,a)=>{const i=r();if(!i.model)return;const l={...i.model.elements},s=[];for(const[c,d]of Object.entries(l))if(d.kind===n){const u=d.attributes[Ae]||"";if(u===o||u.startsWith(o+"/")){const y=u.slice(o.length),b=(a+y).replace("//","/"),x={...d,attributes:{...d.attributes,[Ae]:b}};l[c]=x,s.push(c)}}if(s.length!==0){e(c=>({model:c.model?{...c.model,elements:l}:null}));for(const c of s)Me(l[c])}},addElement:(n,o,a)=>{const i=r();if(!i.model)return;const l=`${n.toLowerCase().replace(/\s+/g,"_")}_${Math.random().toString(36).substr(2,5)}`,s=Object.values(i.model.elements).find(d=>d.kind===n),c={id:l,name:o,kind:n,construct:(s==null?void 0:s.construct)||"part",layer:(s==null?void 0:s.layer)||"Other",doc:"",attributes:{[Ae]:a},file:(s==null?void 0:s.file)||"model/generated.sysml"};e(d=>({model:d.model?{...d.model,elements:{...d.model.elements,[l]:c}}:null,selectedElementId:l,activeView:{type:"element-detail",elementId:l}})),zt(c)},createModelElement:n=>{const o=n.id??`${n.kind.toLowerCase().replace(/\W+/g,"_")}_${Math.random().toString(36).slice(2,8)}`,a={...n,id:o};return e(i=>({model:i.model?{...i.model,elements:{...i.model.elements,[o]:a}}:null,selectedElementId:o})),zt(a),o},persistElementAttributes:(n,o)=>{var l;const a=(l=r().model)==null?void 0:l.elements[n];if(!a)return;const i={...a,attributes:{...a.attributes,...o}};e(s=>({model:s.model?{...s.model,elements:{...s.model.elements,[n]:i}}:null})),Me(i)},deleteFolder:(n,o)=>{const a=r();if(!a.model)return;const i={...a.model.elements},l=o.includes("/")?o.split("/").slice(0,-1).join("/"):"",s=[];for(const[c,d]of Object.entries(i))if(d.kind===n){const u=d.attributes[Ae]||"";if(u===o||u.startsWith(o+"/")){const y=u.replace(o,l).replace("//","/"),b={...d,attributes:{...d.attributes,[Ae]:y}};i[c]=b,s.push(c)}}if(s.length!==0){e(c=>({model:c.model?{...c.model,elements:i}:null}));for(const c of s)Me(i[c])}},addUserViewpoint:n=>e(o=>({userViewpoints:[...o.userViewpoints,n]})),updateUserViewpoint:n=>e(o=>({userViewpoints:o.userViewpoints.map(a=>a.id===n.id?n:a)})),deleteUserViewpoint:n=>e(o=>({userViewpoints:o.userViewpoints.filter(a=>a.id!==n),selectedViewpointId:o.selectedViewpointId===n?null:o.selectedViewpointId})),createDiagram:({id:n,name:o,diagramType:a,viewKind:i,viewpointId:l,elementIds:s=[],activate:c=!0})=>{const d=n??`diag_${Math.random().toString(36).substr(2,9)}`,u={id:d,name:o,diagramType:a,viewKind:i,viewpointId:l,auto:!1,elementIds:s};return e(y=>({model:y.model?{...y.model,diagrams:[...y.model.diagrams??[],u]}:null,selectedDiagramId:c?d:y.selectedDiagramId,activeView:c?{type:"diagram",diagramId:d}:y.activeView})),Ri({id:d,name:o,diagramType:a,viewKind:i,viewpointId:l,elementIds:s}),d},addElementToDiagram:(n,o)=>{var s;const{model:a}=r(),i=(s=a==null?void 0:a.diagrams)==null?void 0:s.find(c=>c.id===n);if(!i)return;const l=i.elementIds??[];l.includes(o)||r().updateDiagramElementIds(n,[...l,o])},updateDiagramElementIds:(n,o)=>{const{model:a}=r();if(!(a!=null&&a.diagrams))return;const i=a.diagrams.findIndex(c=>c.id===n);if(i<0)return;const l={...a.diagrams[i],elementIds:o},s=[...a.diagrams];s[i]=l,e(c=>({model:c.model?{...c.model,diagrams:s}:null})),Kn({id:n,elementIds:o})},deleteDiagram:n=>{e(o=>({model:o.model?{...o.model,diagrams:(o.model.diagrams??[]).filter(a=>a.id!==n)}:null,selectedDiagramId:o.selectedDiagramId===n?null:o.selectedDiagramId,activeView:o.activeView.type==="diagram"&&o.activeView.diagramId===n?{type:"welcome"}:o.activeView})),Mi(n)},applyDiagramParseResult:(n,o,a)=>{const{model:i}=r();if(!(i!=null&&i.diagrams))return;const l=i.diagrams.findIndex(s=>s.id===n);if(l>=0){const s={...i.diagrams[l],elementIds:o},c=[...i.diagrams];c[l]=s,e(d=>({model:d.model?{...d.model,diagrams:c}:null,diagramParseErrors:{...d.diagramParseErrors,[n]:a}})),Kn({id:n,elementIds:o})}else e(s=>({diagramParseErrors:{...s.diagramParseErrors,[n]:a}}))},addDhfDocument:n=>e(o=>({dhfDocuments:[...o.dhfDocuments,n]})),setDhfDocuments:n=>e({dhfDocuments:n}),hydrateDhfSettings:n=>e(o=>({dhfSettings:{...o.dhfSettings,...n}})),updateDhfSettings:n=>e(o=>({dhfSettings:{...o.dhfSettings,...n}})),updateDhfDocumentMeta:(n,o)=>e(a=>({dhfDocuments:a.dhfDocuments.map(i=>i.id===n?{...i,...o}:i)})),updateDhfDocumentContent:(n,o)=>e(a=>({dhfDocuments:a.dhfDocuments.map(i=>i.id===n?{...i,content:o}:i)})),removeDhfDocument:n=>e(o=>({dhfDocuments:o.dhfDocuments.filter(a=>a.id!==n),activeView:o.activeView.type==="dhf-document"&&o.activeView.docId===n?{type:"dhf-dashboard"}:o.activeView})),setBulkImportOpen:n=>e({bulkImportOpen:n}),setImportResult:n=>e({importResult:n}),clearImportResult:()=>e({importResult:null}),cancelEdit:n=>e(o=>{const a=new Map(o.pendingEdits);return a.delete(n),{pendingEdits:a}}),applyEdit:async n=>{const{pendingEdits:o,model:a}=r(),i=o.get(n);if(!i||!a)return;const l=a.elements[n];if(!l)return;const s={...l};if(i.name!==void 0&&(s.name=i.name),i.doc!==void 0&&(s.doc=i.doc),i.attributes&&(s.attributes={...l.attributes,...i.attributes}),!(n.startsWith("new_")?await zt(s):await Me(s)).success)return;const d={...a,elements:{...a.elements,[n]:s}},u=new Map(o);u.delete(n),e({model:d,pendingEdits:u})}})),Vi={relationships:[],kinds:[]};function Kr(e){return(e==null?void 0:e.registries)??Vi}function $i(e,r){return kn(r,Kr(e))}function Ld(e){const r=new Map;if(!e)return r;for(const n of Object.values(e.elements))r.has(n.layer)||r.set(n.layer,[]),r.get(n.layer).push(n);return r}function Wi(e,r){return e?e.relationships.filter(n=>n.sourceId===r||n.targetId===r):[]}function Rt(e,r){return!e||!r||!e.diagrams?null:e.diagrams.find(n=>n.id===r)??null}function Ud(e,r){const n=Rt(e,r);return n?n.sourceFiles&&n.sourceFiles.length>0?n.sourceFiles:n.sourceFile?[n.sourceFile]:[]:[]}function _i(e,r){var o;const n=r?(o=e==null?void 0:e.elements[r])==null?void 0:o.file:void 0;return n?[...Qa(n,e==null?void 0:e.sourceGraph)]:[]}function qi(e,r){return e?Za(e.files,r):!1}function Gr(e,r){return e!=null&&e.diagrams?e.diagrams.filter(n=>{var o;return n.viewpointId===r||((o=n.viewpointIds)==null?void 0:o.includes(r))}):[]}const Dn={dashboard:"/",dsm:"/dsm",ontology:"/ontology",traceability:"/traceability","scenario-editor":"/use-cases","model-diff":"/diff","compliance-wizard":"/compliance",statistics:"/statistics","dhf-dashboard":"/dhf","dhf-dashboard-legacy":"/dhf/legacy",ai:"/ai",ask:"/ask","sysml-generator":"/generate","review-dashboard":"/review","workflow-wizard":"/workflow",import:"/import",analysis:"/analysis","ui-screens":"/ui-screens"},Yr={"/dashboard":"dashboard","/scenarios":"scenario-editor"},Hi={...Object.fromEntries(Object.entries(Dn).map(([e,r])=>[r,e])),...Yr};function Ki(e){return e.toLowerCase().replace(/\s+/g,"-")}function Gi(e){switch(e.type){case"welcome":return"/";case"ontology-detail":return e.layerId?`/ontology/${encodeURIComponent(e.packageName)}/${encodeURIComponent(e.layerId)}`:`/ontology/${encodeURIComponent(e.packageName)}`;case"dhf-document":return`/dhf/${encodeURIComponent(e.docId)}`;case"tabular":{const r=new URLSearchParams;e.viewpointId&&r.set("viewpoint",e.viewpointId),e.diagramId&&r.set("diagram",e.diagramId);const n=r.toString();return n?`/table?${n}`:"/table"}case"element-detail":case"diagram":return null;default:return Dn[e.type]??null}}function Yi(e,r=""){const n=e.length>1?e.replace(/\/+$/,""):e,o=Hi[n];if(o)return{type:o};if(n==="/table"){const i=new URLSearchParams(r);return{type:"tabular",viewpointId:i.get("viewpoint")??void 0,diagramId:i.get("diagram")??void 0}}const a=n.split("/").filter(Boolean);return a[0]==="dhf"&&a.length===2?{type:"dhf-document",docId:decodeURIComponent(a[1])}:a[0]==="ontology"&&a.length>=2?{type:"ontology-detail",packageName:decodeURIComponent(a[1]),layerId:a[2]?decodeURIComponent(a[2]):void 0}:null}function Ji(e){const r=e.split("/").filter(Boolean);return r[0]==="catalog"&&r.length===3||r[0]==="diagrams"&&r.length===3}function Xi(){return[...Object.values(Dn),...Object.keys(Yr)].filter(e=>e!=="/")}const Qi=[{id:"ai-tools",label:"AI Tools",description:"Model Assistant (model Q&A and proposed edits) and SysML Generator (natural language → SysML v2). Generated content is unreviewed and carries no design-control provenance, so the surface stays off by default.",stage:"experimental"},{id:"ontology",label:"Ontology Explorer",description:"Direct ontology browsing is an advanced workbench surface and stays off in the default regulated workspace.",stage:"experimental"},{id:"import",label:"Import",description:"Model import is an advanced transformation surface and stays off in the default regulated workspace.",stage:"experimental"},{id:"model-tools",label:"Model Tools",description:"Matrices, diagnostics, review, and workflow tools are available together only in the experimental workbench.",stage:"experimental"},{id:"analysis",label:"Analysis & Jupyter",description:"Analysis provides direct access to the user’s live local JupyterLab notebook workspace.",stage:"stable"}];function Zi(){return typeof window>"u"?{}:window.__MEMO_FLAGS__??{}}function ae(e){const r=Qi.find(n=>n.id===e);return r?r.stage==="stable"?!0:Zi().experimental===!0:!1}function ht(){const e=E(l=>l.model),r=E(l=>l.setActiveView),n=E(l=>l.setActiveMode),o=Ce(),a=e==null?void 0:e.metadata;function i(){n("dashboard"),r({type:"dashboard"}),o("/")}return t.jsxs("div",{className:"flex items-center gap-3 px-4 py-2",style:{background:"#0B1E2D",borderBottom:"1px solid rgba(255,255,255,0.06)",position:"relative",zIndex:10},children:[t.jsx("button",{onClick:()=>window.dispatchEvent(new Event("memo:toggle-navigation")),title:"Open navigation",style:{width:"40px",height:"40px",borderRadius:"8px",background:"none",border:"none",cursor:"pointer",color:"#2DD4A8",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"24px",flexShrink:0,transition:"color 150ms"},onMouseEnter:l=>{l.currentTarget.style.background="rgba(45,212,168,0.12)"},onMouseLeave:l=>{l.currentTarget.style.background="none"},children:"☰"}),t.jsx("button",{onClick:i,className:"text-sm font-bold transition-opacity",style:{color:"#2DD4A8",letterSpacing:"0.04em",background:"none",border:"none",cursor:"pointer",padding:0},onMouseEnter:l=>l.currentTarget.style.opacity="0.75",onMouseLeave:l=>l.currentTarget.style.opacity="1",title:"Go to home",children:"MEMO Architect"}),t.jsx("div",{className:"flex-1"}),((a==null?void 0:a.projectName)||(a==null?void 0:a.gitUser))&&t.jsxs("span",{title:"Current project and Git revision",style:{color:"rgba(255,255,255,0.62)",fontSize:"12px",whiteSpace:"nowrap"},children:[(a==null?void 0:a.projectName)&&t.jsx("span",{style:{color:"rgba(255,255,255,0.8)",fontWeight:600},children:a.projectName}),(a==null?void 0:a.projectName)&&(a==null?void 0:a.gitUser)&&t.jsx("span",{style:{margin:"0 8px",color:"rgba(255,255,255,0.32)"},children:"|"}),(a==null?void 0:a.gitUser)&&t.jsxs(t.Fragment,{children:["@",a.gitUser,a.gitBranch&&t.jsxs(t.Fragment,{children:[" · ",a.gitBranch]}),a.gitCommitShort&&t.jsxs("span",{style:{marginLeft:4,fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace"},children:[a.gitCommitShort,a.gitDirty?"*":""]})]})]}),t.jsx("img",{src:"/logo.png",alt:"MEMO",style:{height:40,opacity:.9,cursor:"pointer"},onClick:i,title:"Go to home"})]})}const Jr="memo-working-sets",Xr="memo-quick-slots";function es(){return`ws-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}function xt(e){try{localStorage.setItem(Jr,JSON.stringify(e))}catch{}}function ts(){try{const e=localStorage.getItem(Jr);return e?JSON.parse(e):[]}catch{return[]}}function Jn(){try{const e=localStorage.getItem(Xr);return e?JSON.parse(e):[null,null,null,null]}catch{return[null,null,null,null]}}function Xn(e){try{localStorage.setItem(Xr,JSON.stringify(e))}catch{}}const Vt=xr((e,r)=>({workingSets:[],activeWorkingSetId:null,quickSlots:Jn(),loadFromStorage:()=>{const n=ts(),o=Jn();e({workingSets:n,quickSlots:o})},saveWorkingSet:(n,o)=>{const a=es(),i=Date.now(),l={id:a,name:n,createdAt:i,updatedAt:i,state:o},s=[...r().workingSets,l];return e({workingSets:s,activeWorkingSetId:a}),xt(s),a},updateWorkingSet:(n,o)=>{const a=r().workingSets.map(i=>i.id===n?{...i,state:o,updatedAt:Date.now()}:i);e({workingSets:a}),xt(a)},renameWorkingSet:(n,o)=>{const a=r().workingSets.map(i=>i.id===n?{...i,name:o,updatedAt:Date.now()}:i);e({workingSets:a}),xt(a)},deleteWorkingSet:n=>{const o=r().workingSets.filter(i=>i.id!==n),a=r().activeWorkingSetId===n?null:r().activeWorkingSetId;e({workingSets:o,activeWorkingSetId:a}),xt(o)},setActiveWorkingSet:n=>e({activeWorkingSetId:n}),saveQuickSlot:(n,o,a)=>{const i=["Last Session","Slot 1","Slot 2","Slot 3"],l=[...r().quickSlots];for(;l.length<4;)l.push(null);l[n]={name:a??i[n],state:o,savedAt:Date.now()},Xn(l),e({quickSlots:l})},clearQuickSlot:n=>{const o=[...r().quickSlots];o[n]=null,Xn(o),e({quickSlots:o})}})),F={badge:"12px",xs:"12px",sm:"13px",md:"14px",lg:"15px",explorer:{group:"13px",kind:"12px",item:"13px",element:"13px",count:"12px",search:"13px"}},g={primary:"#082744",secondary:"#324E67",muted:"#5C7188",faint:"#8CA0B1",surface:"#FFFFFF",surfaceAlt:"#EEF4F7",border:"#D8E2E9",borderLight:"#E6EDF2",accent:"#2DD4A8",accentDark:"#0B1E2D"},zd={sm:"0 1px 3px rgba(0,0,0,0.08)",md:"0 2px 8px rgba(0,0,0,0.1)",lg:"0 4px 16px rgba(0,0,0,0.12)",selected:"0 0 0 2px #2DD4A8, 0 4px 12px rgba(45, 212, 168, 0.3)"},Od={md:"10px"},Vd={defaultWidth:2,flowWidth:2.5,arrowSize:16,labelBgPadding:[6,4],labelBgRadius:6,labelBgStyle:{fill:"#FFFFFF",fillOpacity:.92,stroke:"#E5E5E0",strokeWidth:.5}};function $t(){const e=E.getState();return{activeView:e.activeView,explorerTab:e.explorerTab,selectedElementId:e.selectedElementId,selectedViewpointId:e.selectedViewpointId,selectedDiagramId:e.selectedDiagramId,sidebarCollapsed:e.sidebarCollapsed,propertiesPanelCollapsed:e.propertiesPanelCollapsed,hiddenLayers:Array.from(e.hiddenLayers)}}function Wt(e){const r=E.getState();r.setActiveView(e.activeView),r.setExplorerTab(e.explorerTab),r.selectElement(e.selectedElementId),e.selectedDiagramId&&r.selectDiagram(e.selectedDiagramId),e.selectedViewpointId&&r.selectViewpoint(e.selectedViewpointId)}function ns(){const[e,r]=p.useState(!1),n=p.useRef(null),o=Vt(s=>s.quickSlots),a=Vt(s=>s.saveQuickSlot),i=Vt(s=>s.clearQuickSlot);p.useEffect(()=>{if(!e)return;const s=c=>{n.current&&!n.current.contains(c.target)&&r(!1)};return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[e]),p.useEffect(()=>{const s=()=>{a(0,$t(),"Last Session")};return window.addEventListener("beforeunload",s),()=>window.removeEventListener("beforeunload",s)},[a]),p.useEffect(()=>{const s=c=>{if(!(c.ctrlKey||c.metaKey))return;const d=c.key==="1"?1:c.key==="2"?2:c.key==="3"?3:null;if(d)if(c.preventDefault(),c.shiftKey)a(d,$t());else{const u=o[d];u&&Wt(u.state)}};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[o,a]);const l=["Last Session","Slot 1","Slot 2","Slot 3"];return t.jsxs("div",{ref:n,style:{position:"relative"},children:[t.jsxs("button",{onClick:()=>r(s=>!s),className:"flex items-center gap-1 px-3 py-1.5 text-sm font-medium rounded-md transition-all",style:e?{background:"rgba(45,212,168,0.15)",color:"#2DD4A8"}:{background:"transparent",color:"rgba(255,255,255,0.5)"},title:"Workspaces (Ctrl+1/2/3 to restore, Ctrl+Shift+1/2/3 to save)",children:[t.jsx("span",{children:"⊟"}),t.jsx("span",{style:{fontSize:"10px",marginLeft:"2px",opacity:.7},children:"▾"})]}),e&&t.jsxs("div",{style:{position:"absolute",top:"calc(100% + 6px)",right:0,zIndex:100,background:"#132D3E",border:"1px solid rgba(45,212,168,0.2)",borderRadius:"8px",minWidth:"240px",boxShadow:"0 8px 24px rgba(0,0,0,0.4)",overflow:"hidden"},children:[t.jsx("div",{className:"px-3 py-2",style:{borderBottom:"1px solid rgba(255,255,255,0.08)",fontSize:F.xs,color:"rgba(255,255,255,0.4)",fontWeight:600},children:"WORKSPACES"}),t.jsxs("div",{className:"px-3 py-2",style:{borderBottom:"1px solid rgba(255,255,255,0.06)"},children:[t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsx("span",{style:{fontSize:F.xs,color:"rgba(255,255,255,0.5)",fontWeight:600},children:"Last Session"}),o[0]?t.jsx("button",{onClick:()=>{Wt(o[0].state),r(!1)},className:"px-2 py-0.5 rounded text-xs",style:{background:"rgba(45,212,168,0.15)",color:"#2DD4A8",border:"none",cursor:"pointer"},children:"Restore"}):t.jsx("span",{style:{fontSize:"10px",color:"rgba(255,255,255,0.25)"},children:"— none saved —"})]}),o[0]&&t.jsx("div",{style:{fontSize:"10px",color:"rgba(255,255,255,0.3)",marginTop:2},children:new Date(o[0].savedAt).toLocaleString()})]}),[1,2,3].map(s=>{const c=o[s];return t.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",style:{borderBottom:"1px solid rgba(255,255,255,0.04)"},children:[t.jsxs("span",{style:{fontSize:"10px",fontWeight:700,color:"rgba(255,255,255,0.3)",minWidth:"16px"},children:["⌃",s]}),t.jsx("div",{className:"flex-1 min-w-0",children:c?t.jsxs(t.Fragment,{children:[t.jsx("div",{style:{fontSize:F.xs,color:"rgba(255,255,255,0.7)",fontWeight:500},children:c.name}),t.jsx("div",{style:{fontSize:"10px",color:"rgba(255,255,255,0.3)"},children:new Date(c.savedAt).toLocaleTimeString()})]}):t.jsx("span",{style:{fontSize:F.xs,color:"rgba(255,255,255,0.25)",fontStyle:"italic"},children:"empty"})}),t.jsxs("div",{className:"flex gap-1",children:[c&&t.jsx("button",{onClick:()=>{Wt(c.state),r(!1)},style:{fontSize:"10px",padding:"2px 6px",borderRadius:3,background:"rgba(45,212,168,0.15)",color:"#2DD4A8",border:"none",cursor:"pointer"},children:"Restore"}),t.jsx("button",{onClick:()=>a(s,$t(),l[s]),style:{fontSize:"10px",padding:"2px 6px",borderRadius:3,background:"rgba(255,255,255,0.1)",color:"rgba(255,255,255,0.6)",border:"none",cursor:"pointer"},title:`Save current view to Slot ${s} (⌃⇧${s})`,children:"Save"}),c&&t.jsx("button",{onClick:()=>i(s),style:{fontSize:"10px",padding:"2px 4px",borderRadius:3,background:"transparent",color:"rgba(255,255,255,0.3)",border:"none",cursor:"pointer"},title:"Clear slot",children:"✕"})]})]},s)})]})]})}const rs=[{value:"",label:"— Select phase —"},{value:"concept",label:"Concept"},{value:"design",label:"Design & Development"},{value:"verification",label:"Verification & Validation"},{value:"production",label:"Production"}],fe={width:"100%",padding:"7px 10px",border:"1px solid #D1D5DB",borderRadius:"6px",fontSize:"13px",color:"#1B3A4B",background:"#fff",boxSizing:"border-box",outline:"none",fontFamily:"inherit"},pe={fontSize:"11px",fontWeight:600,color:"#6B7280",textTransform:"uppercase",letterSpacing:"0.04em",display:"block",marginBottom:"4px"},_t={fontSize:"12px",fontWeight:700,color:"#1B3A4B",paddingBottom:"6px",borderBottom:"1px solid #E5E7EB",marginBottom:"12px",marginTop:"4px"},os={display:"grid",gridTemplateColumns:"1fr 1fr",gap:"12px"};function Qr({onClose:e}){const r=E(d=>d.dhfSettings),n=E(d=>d.updateDhfSettings),[o,a]=p.useState({...r}),[i,l]=p.useState("identity");function s(d,u){a(y=>({...y,[d]:u}))}function c(){n(o),e()}return t.jsx("div",{style:{position:"fixed",inset:0,zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(0,0,0,0.45)"},onClick:d=>{d.target===d.currentTarget&&e()},children:t.jsxs("div",{style:{background:"#fff",borderRadius:"12px",width:"560px",maxHeight:"86vh",display:"flex",flexDirection:"column",boxShadow:"0 24px 60px rgba(0,0,0,0.22)",overflow:"hidden"},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"16px 20px",borderBottom:"1px solid #E5E7EB",flexShrink:0},children:[t.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"#6B7280",strokeWidth:"2",children:[t.jsx("circle",{cx:"12",cy:"12",r:"3"}),t.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"})]}),t.jsx("span",{style:{fontSize:"15px",fontWeight:700,color:"#1B3A4B",flex:1},children:"DHF Global Settings"}),t.jsx("button",{onClick:e,style:{background:"none",border:"none",cursor:"pointer",color:"#9CA3AF",fontSize:"20px",lineHeight:1,padding:"0 2px"},children:"×"})]}),t.jsx("div",{style:{display:"flex",borderBottom:"1px solid #E5E7EB",flexShrink:0,padding:"0 20px"},children:["identity","branding","layout"].map(d=>t.jsx("button",{onClick:()=>l(d),style:{padding:"10px 14px",border:"none",background:"none",fontSize:"12px",fontWeight:600,cursor:"pointer",color:i===d?"#1B3A4B":"#9CA3AF",borderBottom:`2px solid ${i===d?"#2DD4A8":"transparent"}`,marginBottom:"-1px",textTransform:"capitalize"},children:d==="identity"?"Project":d==="branding"?"Branding":"Layout"},d))}),t.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"20px"},children:[i==="identity"&&t.jsxs("div",{children:[t.jsx("p",{style:_t,children:"Project Identity"}),t.jsxs("p",{style:{fontSize:"12px",color:"#6B7280",marginBottom:"16px",lineHeight:"1.5"},children:["These values resolve ",t.jsx("code",{style:{background:"#F3F4F6",padding:"1px 4px",borderRadius:"3px"},children:"{{project.*}}"})," directives in all templates and the AI drafting context."]}),t.jsxs("div",{style:os,children:[t.jsxs("div",{children:[t.jsx("label",{style:pe,children:"Company / Manufacturer"}),t.jsx("input",{style:fe,value:o.company,onChange:d=>s("company",d.target.value),placeholder:"Acme Medical Devices Inc."})]}),t.jsxs("div",{children:[t.jsx("label",{style:pe,children:"Product / Device Name"}),t.jsx("input",{style:fe,value:o.product,onChange:d=>s("product",d.target.value),placeholder:"InfuSafe IV Pump"})]}),t.jsxs("div",{children:[t.jsx("label",{style:pe,children:"Device Type"}),t.jsx("input",{style:fe,value:o.deviceType,onChange:d=>s("deviceType",d.target.value),placeholder:"Class II active implantable"})]}),t.jsxs("div",{children:[t.jsx("label",{style:pe,children:"Document Version"}),t.jsx("input",{style:fe,value:o.version,onChange:d=>s("version",d.target.value),placeholder:"1.0.0"})]}),t.jsxs("div",{style:{gridColumn:"1 / -1"},children:[t.jsx("label",{style:pe,children:"Development Phase"}),t.jsx("select",{style:fe,value:o.phase,onChange:d=>s("phase",d.target.value),children:rs.map(d=>t.jsx("option",{value:d.value,children:d.label},d.value))})]}),t.jsxs("div",{style:{gridColumn:"1 / -1"},children:[t.jsx("label",{style:pe,children:"Document ID Prefix"}),t.jsx("input",{style:{...fe,fontFamily:"monospace"},value:o.documentNumberingPrefix,onChange:d=>s("documentNumberingPrefix",d.target.value),placeholder:"DOC"}),t.jsxs("p",{style:{fontSize:"11px",color:"#9CA3AF",marginTop:"4px"},children:["Used in document IDs, e.g. ",t.jsxs("code",{children:[o.documentNumberingPrefix||"DOC","-RMP-001"]})]})]})]})]}),i==="branding"&&t.jsxs("div",{children:[t.jsx("p",{style:_t,children:"Branding"}),t.jsx("p",{style:{fontSize:"12px",color:"#6B7280",marginBottom:"16px",lineHeight:"1.5"},children:"Branding applied to exported HTML and DOCX documents. Per-document overrides can be set in the document's frontmatter."}),t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"14px"},children:[t.jsxs("div",{children:[t.jsx("label",{style:pe,children:"Full Logo URL"}),t.jsx("input",{style:fe,value:o.logoUrl,onChange:d=>s("logoUrl",d.target.value),placeholder:"https://... or data:image/png;base64,..."}),t.jsx("p",{style:{fontSize:"11px",color:"#9CA3AF",marginTop:"4px"},children:"Shown in document cover pages and report headers."}),o.logoUrl&&t.jsx("img",{src:o.logoUrl,alt:"Logo preview",style:{maxHeight:"48px",maxWidth:"200px",marginTop:"8px",border:"1px solid #E5E7EB",borderRadius:"4px",padding:"4px"}})]}),t.jsxs("div",{children:[t.jsx("label",{style:pe,children:"Compact Logo URL"}),t.jsx("input",{style:fe,value:o.compactLogoUrl,onChange:d=>s("compactLogoUrl",d.target.value),placeholder:"https://... or data:image/png;base64,..."}),t.jsx("p",{style:{fontSize:"11px",color:"#9CA3AF",marginTop:"4px"},children:"Shown in page headers (small). Falls back to Full Logo if empty."}),o.compactLogoUrl&&t.jsx("img",{src:o.compactLogoUrl,alt:"Compact logo preview",style:{maxHeight:"28px",maxWidth:"120px",marginTop:"8px",border:"1px solid #E5E7EB",borderRadius:"4px",padding:"4px"}})]}),t.jsxs("div",{children:[t.jsx("label",{style:pe,children:"Primary Color"}),t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px"},children:[t.jsx("input",{type:"color",value:o.primaryColor,onChange:d=>s("primaryColor",d.target.value),style:{width:"40px",height:"32px",padding:"2px",border:"1px solid #D1D5DB",borderRadius:"6px",cursor:"pointer"}}),t.jsx("input",{style:{...fe,flex:1,fontFamily:"monospace"},value:o.primaryColor,onChange:d=>s("primaryColor",d.target.value),placeholder:"#1B3A4B"})]}),t.jsx("p",{style:{fontSize:"11px",color:"#9CA3AF",marginTop:"4px"},children:"Used for headings, table headers, and badges in exported documents."})]})]})]}),i==="layout"&&t.jsxs("div",{children:[t.jsx("p",{style:_t,children:"Document Layout"}),t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"16px"},children:[t.jsxs("div",{children:[t.jsxs("label",{style:{...pe,display:"flex",alignItems:"center",gap:"8px",textTransform:"none",fontSize:"13px",fontWeight:600,color:"#1B3A4B",marginBottom:0},children:[t.jsx("input",{type:"checkbox",checked:o.compactMode,onChange:d=>s("compactMode",d.target.checked),style:{accentColor:"#2DD4A8"}}),"Compact mode"]}),t.jsx("p",{style:{fontSize:"12px",color:"#6B7280",marginTop:"4px",marginLeft:"20px"},children:"Tighter line spacing and smaller heading sizes. Useful for regulatory submissions."})]}),t.jsxs("div",{children:[t.jsx("label",{style:pe,children:"Page Header Template"}),t.jsx("input",{style:{...fe,fontFamily:"monospace",fontSize:"12px"},value:o.headerTemplate,onChange:d=>s("headerTemplate",d.target.value)}),t.jsxs("p",{style:{fontSize:"11px",color:"#9CA3AF",marginTop:"4px"},children:["Tokens: ",t.jsx("code",{children:"{{id}}"}),", ",t.jsx("code",{children:"{{title}}"}),", ",t.jsx("code",{children:"{{project.product}}"}),", ",t.jsx("code",{children:"{{project.version}}"}),", ",t.jsx("code",{children:"{{date}}"})]})]}),t.jsxs("div",{children:[t.jsx("label",{style:pe,children:"Page Footer Template"}),t.jsx("input",{style:{...fe,fontFamily:"monospace",fontSize:"12px"},value:o.footerTemplate,onChange:d=>s("footerTemplate",d.target.value)}),t.jsxs("p",{style:{fontSize:"11px",color:"#9CA3AF",marginTop:"4px"},children:["Tokens: same as header, plus ",t.jsx("code",{children:"{{page}}"})," and ",t.jsx("code",{children:"{{pages}}"})]})]})]})]})]}),t.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"8px",padding:"14px 20px",borderTop:"1px solid #E5E7EB",flexShrink:0,background:"#FAFAFA"},children:[t.jsx("button",{onClick:e,style:{padding:"8px 16px",borderRadius:"6px",border:"1px solid #D1D5DB",background:"#fff",fontSize:"13px",cursor:"pointer",color:"#374151"},children:"Cancel"}),t.jsx("button",{onClick:c,style:{padding:"8px 20px",borderRadius:"6px",border:"none",background:"#2DD4A8",fontSize:"13px",fontWeight:600,cursor:"pointer",color:"#065F46"},children:"Save Settings"})]})]})})}const $d=Object.freeze(Object.defineProperty({__proto__:null,DhfSettingsPanel:Qr},Symbol.toStringTag,{value:"Module"})),as="/help/",is="http://127.0.0.1:8888/lab/tree/",ss=[{id:"dashboard",label:"Dashboard",icon:"⌂"},{id:"catalog",label:"Model Explorer",icon:"☰"},{id:"diagram",label:"Viewpoints",icon:"⊟"},{id:"ui-screens",label:"UI Screens",icon:"▣"},{id:"dhf",label:"Documents",icon:"⊞"},{id:"scenario",label:"Use Cases",icon:"▶"},{id:"ai",label:"AI Tools",icon:"✦",feature:"ai-tools"}],ls=new Set(["dsm","traceability","statistics","compliance-wizard","model-diff","review-dashboard","workflow-wizard","ontology","ontology-detail","import"]),Qn=[{id:"ontology",label:"Ontology Explorer",icon:"◉",view:{type:"ontology"}},{id:"import",label:"Import Model",icon:"↓",view:{type:"import"}},{id:"traceability",label:"Traceability Matrix",icon:"☷",view:{type:"traceability"}},{id:"statistics",label:"Statistics Dashboard",icon:"⊠",view:{type:"statistics"}},{id:"compliance-wizard",label:"Compliance Wizard",icon:"☑",view:{type:"compliance-wizard"}},{id:"model-diff",label:"Model Diff",icon:"↔",view:{type:"model-diff"}},{id:"review-dashboard",label:"Design Review Dashboard",icon:"📋",view:{type:"review-dashboard"}},{id:"workflow-wizard",label:"Workflow Wizard",icon:"🧙",view:{type:"workflow-wizard"}}];function ds({activeViewType:e}){const r=E(s=>s.setActiveView);E(s=>s.setActiveMode);const[n,o]=p.useState(!1),a=p.useRef(null),l=Qn.map(s=>s.id).includes(e);return p.useEffect(()=>{function s(c){a.current&&!a.current.contains(c.target)&&o(!1)}return n&&document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[n]),t.jsxs("div",{ref:a,style:{position:"relative"},children:[t.jsxs("button",{onClick:()=>o(s=>!s),className:"flex items-center gap-1 px-4 py-1.5 text-sm font-medium rounded-md transition-all",style:l||n?{background:"rgba(45, 212, 168, 0.15)",color:"#2DD4A8"}:{background:"transparent",color:"rgba(255,255,255,0.5)"},children:[t.jsx("span",{className:"mr-0.5",children:"⚙"}),"Tools",t.jsx("span",{style:{fontSize:"10px",marginLeft:"2px",opacity:.7},children:"▾"})]}),n&&t.jsx("div",{style:{position:"absolute",top:"calc(100% + 6px)",left:0,zIndex:100,background:"#132D3E",border:"1px solid rgba(45,212,168,0.2)",borderRadius:"8px",minWidth:"220px",boxShadow:"0 8px 24px rgba(0,0,0,0.4)",overflow:"hidden"},children:Qn.filter(s=>(s.id!=="ontology"||ae("ontology"))&&(s.id!=="import"||ae("import"))).map((s,c)=>{const d=e===s.view.type;return t.jsxs("button",{onClick:()=>{r(d?{type:"welcome"}:s.view),o(!1)},className:"w-full flex items-center gap-3 px-4 py-2.5 text-left transition-colors",style:{fontSize:"13px",color:d?"#2DD4A8":"rgba(255,255,255,0.75)",background:d?"rgba(45,212,168,0.1)":"transparent",borderTop:c>0?"1px solid rgba(255,255,255,0.05)":"none"},onMouseEnter:u=>{d||(u.currentTarget.style.background="rgba(255,255,255,0.06)")},onMouseLeave:u=>{d||(u.currentTarget.style.background="transparent")},children:[t.jsx("span",{style:{width:"18px",textAlign:"center",opacity:.7},children:s.icon}),s.label]},s.id)})})]})}function cs(){const e=E(m=>m.activeMode),r=E(m=>m.setActiveMode),n=E(m=>m.activeView),o=E(m=>m.setActiveView),a=E(m=>m.setExplorerTab),i=E(m=>m.sidebarCollapsed),l=E(m=>m.toggleSidebar),s=Ce(),[c,d]=p.useState(!1),[u,y]=p.useState(!1),[b,x]=p.useState(!1);p.useEffect(()=>{const m=()=>d(D=>!D);return window.addEventListener("memo:toggle-navigation",m),()=>window.removeEventListener("memo:toggle-navigation",m)},[]);const w=["catalog","diagram","dhf","scenario"],f=ls.has(n.type)?"":e==="dhf"||n.type==="dhf-dashboard"?"dhf":n.type==="scenario-editor"||e==="scenario"&&n.type==="diagram"?"scenario":n.type==="analysis"?"analysis":n.type==="ui-screens"||e==="ui-screens"?"ui-screens":n.type==="ai"||n.type==="ask"||n.type==="sysml-generator"?"ai":n.type==="diagram"||e==="diagram"?"diagram":e==="catalog"?"catalog":n.type==="dashboard"?"dashboard":e;function h(m){if(m===f&&w.includes(m)){l();return}switch(w.includes(m)&&i&&l(),r(m),m){case"dashboard":o({type:"dashboard"});break;case"catalog":o({type:"welcome"}),s("/catalog");break;case"diagram":a("views"),o({type:"welcome"}),s("/diagrams");break;case"ui-screens":o({type:"ui-screens"}),s("/ui-screens");break;case"dhf":o({type:"dhf-dashboard"});break;case"scenario":o({type:"scenario-editor"});break;case"ai":o({type:"ai"});break}}return c?t.jsxs(t.Fragment,{children:[t.jsx("div",{onClick:()=>d(!1),style:{position:"fixed",inset:0,zIndex:80,background:"rgba(4, 18, 28, 0.35)"}}),t.jsxs("aside",{"aria-label":"Main navigation",style:{position:"fixed",left:0,top:0,bottom:0,width:296,zIndex:81,background:"#0B1E2D",borderRight:"1px solid rgba(45,212,168,0.28)",boxShadow:"12px 0 32px rgba(0,0,0,0.32)",padding:"18px 12px",overflowY:"auto"},children:[t.jsxs("div",{className:"flex items-center justify-between",style:{marginBottom:18},children:[t.jsx("button",{onClick:()=>{d(!1),h("dashboard")},style:{color:"#2DD4A8",fontWeight:700,fontSize:18,letterSpacing:"0.04em",border:"none",background:"none",cursor:"pointer"},children:"MEMO Architect"}),t.jsx("button",{"aria-label":"Close navigation",onClick:()=>d(!1),style:{width:36,height:36,color:"#2DD4A8",fontSize:24,border:"none",background:"transparent",cursor:"pointer"},children:"×"})]}),t.jsxs("div",{style:{borderTop:"1px solid rgba(255,255,255,0.09)",paddingTop:8},children:[ss.filter(m=>!("feature"in m)||ae(m.feature)).map(m=>t.jsxs("button",{onClick:()=>{h(m.id),d(!1)},className:"flex w-full items-center gap-3 rounded-md px-3 py-3 text-left",style:{border:"none",cursor:"pointer",fontSize:15,background:f===m.id?"rgba(45,212,168,0.15)":"transparent",color:f===m.id?"#2DD4A8":"rgba(255,255,255,0.78)"},children:[t.jsx("span",{style:{width:20,textAlign:"center"},children:m.icon}),m.label]},m.id)),ae("analysis")&&t.jsxs(t.Fragment,{children:[t.jsxs("button",{onClick:()=>y(m=>!m),"aria-expanded":u,className:"flex w-full items-center gap-3 rounded-md px-3 py-3 text-left",style:{border:"none",cursor:"pointer",fontSize:15,background:u?"rgba(45,212,168,0.10)":"transparent",color:"rgba(255,255,255,0.78)"},children:[t.jsx("span",{style:{width:20,textAlign:"center"},children:"◫"}),"Analysis",t.jsx("span",{style:{marginLeft:"auto",fontSize:11},children:u?"▾":"▸"})]}),u&&t.jsxs("div",{style:{margin:"0 0 4px 36px",borderLeft:"1px solid rgba(45,212,168,0.25)"},children:[t.jsxs("button",{onClick:()=>{o({type:"analysis"}),d(!1)},className:"flex w-full items-center gap-2 px-3 py-2 text-left",style:{border:"none",cursor:"pointer",background:"transparent",color:"rgba(255,255,255,0.68)",fontSize:14},children:[t.jsx("span",{children:"◫"}),"Analysis workspace"]}),t.jsxs("button",{onClick:()=>{o({type:"dsm"}),d(!1)},className:"flex w-full items-center gap-2 px-3 py-2 text-left",style:{border:"none",cursor:"pointer",background:"transparent",color:"rgba(255,255,255,0.68)",fontSize:14},children:[t.jsx("span",{children:"▤"}),"Design Structure Matrix"]}),ae("model-tools")&&t.jsxs("button",{onClick:()=>{o({type:"traceability"}),d(!1)},className:"flex w-full items-center gap-2 px-3 py-2 text-left",style:{border:"none",cursor:"pointer",background:"transparent",color:"rgba(255,255,255,0.68)",fontSize:14},children:[t.jsx("span",{children:"☷"}),"Traceability Matrix"]}),t.jsxs("a",{href:is,target:"_blank",rel:"noopener noreferrer",onClick:()=>d(!1),className:"flex w-full items-center gap-2 px-3 py-2",style:{color:"rgba(255,255,255,0.68)",textDecoration:"none",fontSize:14},children:[t.jsx("span",{children:"⌁"}),"Jupyter Notebooks"]})]})]})]}),t.jsx("div",{style:{height:1,background:"rgba(255,255,255,0.1)",margin:"14px 4px"}}),t.jsxs("div",{className:"flex items-center justify-between px-3 py-2",style:{color:"rgba(255,255,255,0.62)"},children:[t.jsx("span",{children:"Workspaces"}),t.jsx(ns,{})]}),ae("model-tools")&&t.jsx("div",{className:"px-2 py-1",children:t.jsx(ds,{activeViewType:n.type})}),t.jsxs("button",{onClick:()=>x(!0),className:"flex w-full items-center gap-3 rounded-md px-3 py-3 text-left",style:{color:"rgba(255,255,255,0.72)",border:"none",background:"transparent",cursor:"pointer",fontSize:15},children:[t.jsx("span",{style:{width:20,textAlign:"center"},children:"⚙"}),"Project Settings"]}),t.jsxs("a",{href:as,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-3 rounded-md px-3 py-3",style:{color:"rgba(255,255,255,0.72)",textDecoration:"none",fontSize:15},children:[t.jsx("span",{style:{width:20,textAlign:"center"},children:"?"}),"Help"]})]}),b&&t.jsx(Qr,{onClose:()=>x(!1)})]}):null}const se={operational:"#0F766E",business:"#8E44AD",requirements:"#4A90D9",risk:"#E74C3C",functional:"#E67E22",behavior:"#FF6B6B",logical:"#7B68EE",physical:"#95A5A6",software:"#F39C12",interfaces:"#1ABC9C",verification:"#2ECC71",ui:"#3498DB"},lt={operational:"Operational Analysis",business:"Business Analysis",requirements:"Requirements",risk:"Risk Management",functional:"Functional Analysis",behavior:"Behavior",logical:"Logical Architecture",physical:"Physical Architecture",software:"Software Architecture",interfaces:"Interfaces & Ports",verification:"Verification",ui:"UI Wireframe"},Qe=["operational","business","requirements","risk","functional","behavior","logical","physical","software","interfaces","verification","ui"],us={mitigates:"#E74C3C",causes:"#C0392B",leadsTo:"#E74C3C",identifies:"#D35400",traceTo:"#4A90D9",satisfy:"#2ECC71",verify:"#27AE60",allocateTo:"#E67E22",aggregation:"#7B68EE",composedOf:"#8E44AD",decomposedBy:"#D35400",flow:"#3498DB",succession:"#95A5A6"},Zn=["#2563EB","#0891B2","#7C3AED","#DB2777","#EA580C","#0D9488","#65A30D","#9333EA","#C2410C","#1D4ED8"];function Wd(e){const r=us[e];if(r)return r;let n=0;for(let o=0;o<e.length;o++)n=n*31+e.charCodeAt(o)>>>0;return Zn[n%Zn.length]}const Fn={general:{label:"GEN",fullName:"General View",color:"#7B68EE"},interconnection:{label:"INT",fullName:"Interconnection View",color:"#1ABC9C"},actionflow:{label:"ACT",fullName:"Action Flow View",color:"#F39C12"},statetransition:{label:"STM",fullName:"State Transition View",color:"#FF6B6B"},sequence:{label:"SEQ",fullName:"Sequence View",color:"#3498DB"},grid:{label:"GRID",fullName:"Grid View",color:"#2ECC71"},browser:{label:"BRW",fullName:"Browser View",color:"#95A5A6"},geometry:{label:"GEO",fullName:"Geometry View",color:"#8E44AD"}},Le={bdd:{code:"BDD",label:"BDD",fullName:"Block Definition Diagram",color:"#7B68EE",viewKind:"general"},ibd:{code:"IBD",label:"IBD",fullName:"Internal Block Diagram",color:"#1ABC9C",viewKind:"interconnection"},req:{code:"REQ",label:"REQ",fullName:"Requirements Diagram",color:"#4A90D9",viewKind:"general"},ucd:{code:"UCD",label:"UCD",fullName:"Use Case Diagram",color:"#E67E22",viewKind:"general"},context:{code:"CTX",label:"CTX",fullName:"System Context Diagram",color:"#5DADE2",viewKind:"general"},act:{code:"ACT",label:"ACT",fullName:"Activity Diagram",color:"#F39C12",viewKind:"actionflow"},afd:{code:"AFD",label:"AFD",fullName:"Action Flow Diagram",color:"#FF6B6B",viewKind:"actionflow"},ofd:{code:"OFD",label:"OFD",fullName:"Operational Flow Diagram",color:"#F39C12",viewKind:"actionflow"},ffd:{code:"FFD",label:"FFD",fullName:"Functional Flow Diagram",color:"#F39C12",viewKind:"actionflow"},pkg:{code:"PKG",label:"PKG",fullName:"Package Diagram",color:"#95A5A6",viewKind:"general"},par:{code:"PAR",label:"PAR",fullName:"Parametric Diagram",color:"#2ECC71",viewKind:"interconnection"},risk:{code:"RISK",label:"RISK",fullName:"Risk Diagram",color:"#E74C3C",viewKind:"general"},stm:{code:"STM",label:"STM",fullName:"State Transition Diagram",color:"#FF6B6B",viewKind:"statetransition"},seq:{code:"SEQ",label:"SEQ",fullName:"Sequence Diagram",color:"#3498DB",viewKind:"sequence"},fmea:{code:"FMEA",label:"FMEA",fullName:"FMEA Matrix",color:"#E74C3C",viewKind:"grid"},alloc:{code:"ALLOC",label:"ALLOC",fullName:"Allocation Matrix",color:"#E67E22",viewKind:"grid"},"threat-model":{code:"THREAT",label:"THREAT",fullName:"Threat Model Diagram",color:"#C0392B",viewKind:"general"}};function ps(e){const r=e.diagramType.trim().toLowerCase();return r==="ofd"||r==="ffd"?r:"afd"}const _d=["#FFFFFF","#f8fafc","#f0f9ff","#fdf2f8","#f0fdf4"];function Ne({label:e,onClick:r,icon:n}){return t.jsxs("button",{className:"w-full flex items-center gap-2 px-3 py-1.5 text-left text-xs",style:{color:"#374151",background:"transparent",border:"none",cursor:"pointer",whiteSpace:"nowrap"},onMouseEnter:o=>o.currentTarget.style.background="#F0F0ED",onMouseLeave:o=>o.currentTarget.style.background="transparent",onClick:o=>{o.stopPropagation(),r()},children:[n&&t.jsx("span",{style:{fontSize:"12px",width:"14px",flexShrink:0},children:n}),e]})}function ms(){return t.jsx("div",{style:{height:"1px",background:"#E5E5E0",margin:"3px 0"}})}function fs({x:e,y:r,target:n,onViewVisual:o,onViewTable:a,onToggleSelection:i,onViewProperties:l,onClose:s}){const c=p.useRef(null);p.useEffect(()=>{if(!c.current)return;const u=c.current,{innerWidth:y,innerHeight:b}=window,x=u.getBoundingClientRect();x.right>y&&(u.style.left=`${e-x.width}px`),x.bottom>b&&(u.style.top=`${r-x.height}px`)},[e,r]);const d={position:"fixed",top:r,left:e,background:"#FFFFFF",border:"1px solid #E5E5E0",borderRadius:"6px",boxShadow:"0 4px 12px rgba(0,0,0,0.12)",zIndex:9999,minWidth:"180px",padding:"4px 0"};return n.type==="package"?t.jsxs("div",{ref:c,style:d,onMouseDown:u=>u.stopPropagation(),children:[t.jsx(Ne,{icon:"⬜",label:"View Visual Layout",onClick:()=>{o(n.pkgName),s()}}),t.jsx(Ne,{icon:"☰",label:"View as Table",onClick:()=>{a(n.pkgName),s()}}),t.jsx(ms,{}),t.jsx(Ne,{icon:n.isSelected?"☑":"☐",label:n.isSelected?"Deselect for Project":"Select for Project",onClick:()=>i(n.pkgName)})]}):n.type==="layer"?t.jsxs("div",{ref:c,style:d,onMouseDown:u=>u.stopPropagation(),children:[t.jsx(Ne,{icon:"⬜",label:"View Visual Layout",onClick:()=>{o(n.pkgName),s()}}),t.jsx(Ne,{icon:"☰",label:"View as Table",onClick:()=>a(n.pkgName,n.layerId)})]}):t.jsxs("div",{ref:c,style:d,onMouseDown:u=>u.stopPropagation(),children:[t.jsx(Ne,{icon:"🔍",label:"View Properties",onClick:()=>l(n.kindName,n.pkgName)}),t.jsx(Ne,{icon:"☰",label:"View as Table",onClick:()=>a(n.pkgName,n.layerId)}),t.jsx(Ne,{icon:"⬜",label:"Show in Visual Layout",onClick:()=>{o(n.pkgName),s()}})]})}function ys({kindsToRemap:e,onConfirm:r,onCancel:n}){const o=E(u=>u.availableOntologies),a=E(u=>u.selectedOntologies),i=o.filter(u=>a.has(u.name)).flatMap(u=>u.layers.flatMap(y=>y.kinds.map(b=>b.name))).filter((u,y,b)=>b.indexOf(u)===y).sort(),[l,s]=p.useState(Object.fromEntries(e.map(u=>[u,""])));function c(u,y){s(b=>({...b,[u]:y}))}const d=e.every(u=>l[u]);return t.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-50",style:{background:"rgba(0,0,0,0.4)"},children:t.jsxs("div",{className:"rounded-xl shadow-2xl max-w-lg w-full mx-4 overflow-hidden",style:{background:"#FFFFFF",border:"1px solid #E5E5E0"},children:[t.jsxs("div",{className:"px-6 py-4",style:{borderBottom:"1px solid #E5E5E0"},children:[t.jsx("h2",{className:"text-sm font-semibold",style:{color:"#1a1a1a"},children:"Remap Orphaned Kinds"}),t.jsx("p",{className:"text-xs mt-1",style:{color:"#6B7280"},children:"Map each orphaned kind to a kind in the selected ontologies. Model elements will be updated to use the new kind."})]}),t.jsx("div",{className:"px-6 py-4 space-y-3 max-h-64 overflow-y-auto",children:e.map(u=>t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"flex-1 px-2 py-1 rounded text-xs font-medium",style:{background:"#FEF2F2",color:"#EF4444",border:"1px solid #FCA5A5"},children:u}),t.jsx("span",{style:{color:"#9CA3AF"},children:"→"}),t.jsxs("select",{value:l[u],onChange:y=>c(u,y.target.value),className:"flex-1 text-xs rounded-md px-2 py-1 focus:outline-none",style:{border:"1px solid #E5E5E0",color:"#1a1a1a",background:"#FFFFFF"},children:[t.jsx("option",{value:"",children:"Select target kind…"}),i.map(y=>t.jsx("option",{value:y,children:y},y))]})]},u))}),t.jsxs("div",{className:"px-6 py-4 flex gap-2 justify-end",style:{borderTop:"1px solid #E5E5E0"},children:[t.jsx("button",{onClick:n,className:"px-3 py-1.5 text-xs rounded-md",style:{background:"#F0F0ED",color:"#374151"},children:"Back"}),t.jsx("button",{onClick:()=>r(l),disabled:!d,className:"px-3 py-1.5 text-xs rounded-md font-medium",style:{background:d?"#1B3A4B":"#E5E5E0",color:d?"#FFFFFF":"#9CA3AF",cursor:d?"pointer":"not-allowed"},children:"Apply Remapping"})]})]})})}function gs({orphans:e,onKeep:r,onRemap:n,onCancel:o}){const[a,i]=p.useState(!1),l=new Map;for(const s of e)l.has(s.kind)||l.set(s.kind,[]),l.get(s.kind).push(s);return a?t.jsx(ys,{kindsToRemap:[...l.keys()],onConfirm:n,onCancel:()=>i(!1)}):t.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-50",style:{background:"rgba(0,0,0,0.4)"},onClick:s=>{s.target===s.currentTarget&&o()},children:t.jsxs("div",{className:"rounded-xl shadow-2xl max-w-md w-full mx-4 overflow-hidden",style:{background:"#FFFFFF",border:"1px solid #E5E5E0"},children:[t.jsxs("div",{className:"px-6 py-4",style:{borderBottom:"1px solid #E5E5E0",background:"#FEF2F2"},children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-red-500 text-lg",children:"⚠"}),t.jsx("h2",{className:"text-sm font-semibold",style:{color:"#1a1a1a"},children:"Orphaned Elements"})]}),t.jsxs("p",{className:"text-xs mt-1",style:{color:"#6B7280"},children:[e.length," element",e.length!==1?"s":""," use kinds from the deselected ontology."]})]}),t.jsx("div",{className:"px-6 py-4 max-h-48 overflow-y-auto",children:[...l.entries()].map(([s,c])=>t.jsxs("div",{className:"mb-3",children:[t.jsxs("div",{className:"text-xs font-semibold mb-1",style:{color:"#374151"},children:[s,t.jsxs("span",{className:"ml-1 font-normal",style:{color:"#9CA3AF"},children:["(",c.length," element",c.length!==1?"s":"",")"]})]}),t.jsxs("div",{className:"flex flex-wrap gap-1",children:[c.slice(0,5).map(d=>t.jsx("span",{className:"px-1.5 py-0.5 text-xs rounded",style:{background:"#FEF2F2",color:"#EF4444",border:"1px solid #FCA5A5"},children:d.elementName},d.elementId)),c.length>5&&t.jsxs("span",{className:"text-xs",style:{color:"#9CA3AF"},children:["+",c.length-5," more"]})]})]},s))}),t.jsxs("div",{className:"px-6 py-4 flex gap-2 justify-end",style:{borderTop:"1px solid #E5E5E0"},children:[t.jsx("button",{onClick:o,className:"px-3 py-1.5 text-xs rounded-md",style:{background:"#F0F0ED",color:"#374151"},children:"Cancel"}),t.jsx("button",{onClick:r,className:"px-3 py-1.5 text-xs rounded-md",style:{background:"#FEF2F2",color:"#EF4444",border:"1px solid #FCA5A5"},children:"Keep (mark orphaned)"}),t.jsx("button",{onClick:()=>i(!0),className:"px-3 py-1.5 text-xs rounded-md font-medium",style:{background:"#1B3A4B",color:"#FFFFFF"},children:"Remap kinds →"})]})]})})}function hs(){const e=E(w=>w.methodology),r=p.useMemo(()=>[...new Set(((e==null?void 0:e.folders)??[]).flatMap(w=>w.sourceFiles))].sort(),[e]),[n,o]=p.useState(""),[a,i]=p.useState(""),[l,s]=p.useState(""),[c,d]=p.useState(!1),[u,y]=p.useState(""),b=async w=>{if(!w)return;const f=await dn("load",w);o(w),i(f.text??""),s(f.revision??""),d(!1),y(f.success?"":f.error??"Could not load source.")},x=async()=>{if(!n||!l)return;const w=await dn("save",n,{text:a,baseRevision:l});w.success?(s(w.revision??l),d(!1),y("Saved. The reusable semantic runtime is restarting.")):y(w.error??"Save rejected; the draft remains in the editor.")};return r.length===0?null:t.jsxs("section",{style:{borderBottom:`1px solid ${g.border}`},children:[t.jsx("div",{className:"px-3 py-2 font-semibold",style:{fontSize:F.xs,color:g.primary},children:"Methodology & Rule Policies"}),t.jsxs("select",{value:n,onChange:w=>void b(w.target.value),className:"mx-3 mb-2",style:{width:"calc(100% - 24px)",fontSize:F.xs},children:[t.jsx("option",{value:"",children:"Select resolved SysML source…"}),r.map(w=>t.jsx("option",{value:w,children:w},w))]}),n&&t.jsxs(t.Fragment,{children:[t.jsx("textarea",{value:a,onChange:w=>{i(w.target.value),d(!0)},"aria-label":"Methodology SysML source",style:{width:"calc(100% - 24px)",height:220,margin:"0 12px",padding:8,fontFamily:"monospace",fontSize:11,color:"#E2E8F0",background:"#1E293B"}}),t.jsxs("div",{className:"flex gap-2 px-3 py-2",children:[t.jsx("button",{disabled:!c,onClick:()=>void x(),children:"Save SysML"}),t.jsx("button",{onClick:()=>void navigator.clipboard.writeText(a),children:"Copy draft"}),t.jsx("button",{onClick:()=>void b(n),children:"Reload"})]}),u&&t.jsx("div",{className:"px-3 pb-2",role:"status",style:{fontSize:11,color:"#B45309"},children:u})]})]})}function xs(){var K;const e=E(P=>P.effectiveRules),r=E(P=>P.ruleDiagnostics),n=E(P=>P.methodology),o=p.useMemo(()=>[...new Set(((n==null?void 0:n.folders)??[]).flatMap(P=>P.sourceFiles))].sort(),[n]),[a,i]=p.useState(""),[l,s]=p.useState("disabled"),[c,d]=p.useState(""),[u,y]=p.useState(""),[b,x]=p.useState(""),[w,f]=p.useState(""),[h,m]=p.useState(""),[D,N]=p.useState(""),[j,C]=p.useState(""),[S,I]=p.useState(!1),v=e.find(P=>P.sourceRuleType===a),L=(v==null?void 0:v.tailoring)==="invariant",W=!a||!D||L&&l!=="enabled"||l!=="enabled"&&!b.trim()||l==="replaced"&&!u.trim(),U=async()=>{I(!0),C("");try{const P=await dn("load",D);if(!P.success||!P.revision){C(P.error??"Could not read the methodology source.");return}const q=await Ui({targetRuleType:a,disposition:l,severityOverride:c||void 0,replacementRuleType:l==="replaced"?u.trim():void 0,rationaleText:b.trim(),authority:w.trim()||void 0,approvalReference:h.trim()||void 0,sourceFile:D,baseRevision:P.revision});C(q.success?"Policy written. The reusable semantic runtime is restarting.":q.error??"The policy was rejected; nothing was written."),q.success&&(x(""),m(""))}catch(P){C(P instanceof Error?P.message:String(P))}finally{I(!1)}};if(e.length===0)return null;const T={width:"calc(100% - 24px)",margin:"0 12px 6px",fontSize:F.xs};return t.jsxs("section",{style:{borderBottom:`1px solid ${g.border}`},children:[t.jsxs("div",{className:"px-3 py-2 font-semibold",style:{fontSize:F.xs,color:g.primary},children:["Rule Tailoring",t.jsxs("span",{style:{fontWeight:400,color:g.muted},children:[" — ",e.length," rules in the effective set"]})]}),t.jsxs("select",{"aria-label":"Rule",value:a,style:T,onChange:P=>i(P.target.value),children:[t.jsx("option",{value:"",children:"Select a rule…"}),e.map(P=>t.jsxs("option",{value:P.sourceRuleType,children:[P.sourceRuleId," — ",P.sourceRuleType,P.tailoring==="invariant"?" (invariant)":"",P.disposition!=="enabled"?` [${P.disposition}]`:""]},P.sourceRuleType))]}),v&&t.jsxs("div",{className:"px-3 pb-1",style:{fontSize:11,color:g.muted},children:["Currently ",v.disposition," at ",v.effectiveSeverity,v.effectiveSeverity!==v.declaredSeverity&&` (declared ${v.declaredSeverity})`,((K=v.policyChain)==null?void 0:K.length)>0&&` · ${v.policyChain.length} policy in chain`]}),L&&t.jsx("div",{className:"px-3 pb-2",role:"status",style:{fontSize:11,color:"#B45309"},children:"This rule is an invariant. It cannot be disabled or replaced by a methodology; changing it requires an ontology release."}),t.jsxs("select",{"aria-label":"Disposition",value:l,style:T,onChange:P=>s(P.target.value),children:[t.jsx("option",{value:"disabled",children:"Disable"}),t.jsx("option",{value:"replaced",children:"Replace"}),t.jsx("option",{value:"enabled",children:"Enable (severity override only)"})]}),t.jsxs("select",{"aria-label":"Severity override",value:c,style:T,onChange:P=>d(P.target.value),children:[t.jsx("option",{value:"",children:"No severity override"}),t.jsx("option",{value:"error",children:"error"}),t.jsx("option",{value:"warning",children:"warning"}),t.jsx("option",{value:"info",children:"info"})]}),l==="replaced"&&t.jsx("input",{"aria-label":"Replacement rule",value:u,style:T,placeholder:"Replacement constraint def name",onChange:P=>y(P.target.value)}),t.jsx("textarea",{"aria-label":"Rationale",value:b,placeholder:"Rationale — required to disable or replace a rule",style:{...T,height:54,fontFamily:"inherit"},onChange:P=>x(P.target.value)}),t.jsx("input",{"aria-label":"Authority",value:w,style:T,placeholder:"Authority (optional)",onChange:P=>f(P.target.value)}),t.jsx("input",{"aria-label":"Approval reference",value:h,style:T,placeholder:"Approval reference (optional)",onChange:P=>m(P.target.value)}),t.jsxs("select",{"aria-label":"Target methodology file",value:D,style:T,onChange:P=>N(P.target.value),children:[t.jsx("option",{value:"",children:"Write the policy into…"}),o.map(P=>t.jsx("option",{value:P,children:P},P))]}),t.jsx("div",{className:"flex gap-2 px-3 py-2",children:t.jsx("button",{disabled:W||S,onClick:()=>void U(),children:S?"Writing…":"Write policy"})}),j&&t.jsx("div",{className:"px-3 pb-2",role:"status",style:{fontSize:11,color:"#B45309"},children:j}),r.length>0&&t.jsx("div",{className:"px-3 pb-2",style:{fontSize:11,color:"#B91C1C"},children:r.map((P,q)=>t.jsxs("div",{children:["[",P.code,"] ",P.message]},q))})]})}const er={ontology:"📦",profile:"🔧",extension:"🧩"};function bs(e){const r=new Map(e.map(s=>[s.name,s])),n=new Map;function o(s){if(n.has(s))return n.get(s);const c=r.get(s);if(!c||!c.derivesFrom||!r.has(c.derivesFrom))return n.set(s,0),0;const d=o(c.derivesFrom)+1;return n.set(s,d),d}for(const s of e)o(s.name);const a=new Map;for(const s of e){const c=n.get(s.name)??0,d=a.get(c)??[];d.push(s),a.set(c,d)}const i=Math.max(...a.keys()),l=[];for(let s=0;s<=i;s++){const c=a.get(s)??[];l.push(...c.sort((d,u)=>d.name.localeCompare(u.name)))}return l}function vs(e){const r=new Map(e.map(s=>[s.name,s])),n=new Map;function o(s){if(n.has(s))return n.get(s);const c=r.get(s);if(!c||!c.extends||!r.has(c.extends))return n.set(s,0),0;const d=o(c.extends)+1;return n.set(s,d),d}for(const s of e)o(s.name);const a=new Map;for(const s of e){const c=n.get(s.name)??0,d=a.get(c)??[];d.push(s),a.set(c,d)}const i=a.size>0?Math.max(...a.keys()):0,l=[];for(let s=0;s<=i;s++){const c=a.get(s)??[];l.push(...c.sort((d,u)=>d.name.localeCompare(u.name)))}return l}function ws({pkgName:e,onCancel:r,onConfirm:n}){const o=e.replace(/^@memo(?:architect)?\//,"");return t.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{background:"rgba(0,0,0,0.45)"},onMouseDown:a=>{a.target===a.currentTarget&&r()},children:t.jsxs("div",{className:"rounded-xl p-5 shadow-2xl",style:{background:"#FFFFFF",maxWidth:"340px",width:"90vw"},children:[t.jsx("div",{className:"font-semibold mb-1.5",style:{fontSize:F.sm,color:g.primary},children:"Remove ontology?"}),t.jsxs("div",{className:"mb-4",style:{fontSize:F.xs,color:g.secondary,lineHeight:1.5},children:["Removing ",t.jsx("strong",{children:o})," will affect all model elements that depend on its kinds. Those elements will become orphaned until you add a compatible ontology."]}),t.jsxs("div",{className:"flex gap-2 justify-end",children:[t.jsx("button",{onClick:r,className:"px-3 py-1.5 rounded-md font-medium",style:{fontSize:F.xs,background:g.surfaceAlt,color:g.secondary,border:`1px solid ${g.border}`,cursor:"pointer"},children:"Cancel"}),t.jsx("button",{onClick:n,className:"px-3 py-1.5 rounded-md font-medium",style:{fontSize:F.xs,background:"#DC2626",color:"#FFFFFF",border:"none",cursor:"pointer"},children:"Remove"})]})]})})}function ks(){const e=E(k=>k.availableOntologies),r=E(k=>k.selectedOntologies),n=E(k=>k.toggleOntologySelection),o=E(k=>k.saveOntologySelection),a=E(k=>k.selectedOntologyKind),i=E(k=>k.setSelectedOntologyKind),l=E(k=>k.setActiveView),s=E(k=>k.setOntologyViewMode),c=E(k=>k.activeView),[d,u]=p.useState(""),[y,b]=p.useState(()=>new Set(e.filter(k=>k.selected).map(k=>k.name))),[x,w]=p.useState(new Set),[f,h]=p.useState(()=>new Set(e.filter(k=>k.selected).map(k=>k.name))),m=p.useMemo(()=>{if(r.size!==f.size)return!0;for(const k of r)if(!f.has(k))return!0;return!1},[r,f]),[D,N]=p.useState(null),[j,C]=p.useState(null),[S,I]=p.useState(null),v=p.useRef(new Map),L=p.useMemo(()=>{const k=d.trim()?e.map(B=>({...B,layers:B.layers.map(A=>({...A,kinds:A.kinds.filter(V=>V.name.toLowerCase().includes(d.toLowerCase())||V.label.toLowerCase().includes(d.toLowerCase())||V.layer.toLowerCase().includes(d.toLowerCase()))})).filter(A=>A.kinds.length>0)})).filter(B=>B.layers.length>0||B.name.toLowerCase().includes(d.toLowerCase())):e;return vs(k)},[e,d]);p.useEffect(()=>{d.trim()&&(b(new Set(L.map(k=>k.name))),w(new Set(L.flatMap(k=>k.layers.map(B=>`${k.name}:${B.id}`)))))},[d,L]),p.useEffect(()=>{if(a&&v.current.has(a)){for(const k of e)for(const B of k.layers)if(B.kinds.find(A=>A.name===a)){b(A=>new Set([...A,k.name])),w(A=>new Set([...A,`${k.name}:${B.id}`]));break}setTimeout(()=>{var k;(k=v.current.get(a))==null||k.scrollIntoView({behavior:"smooth",block:"nearest"})},80)}},[a,e]);function W(k){l({type:"ontology-detail",packageName:k})}function U(k,B){l({type:"ontology-detail",packageName:k,layerId:B})}function T(k,B){i(a===k?null:k),l({type:"ontology-detail",packageName:B})}function K(k){b(B=>{const A=new Set(B);return A.has(k)?A.delete(k):A.add(k),A})}function P(k){w(B=>{const A=new Set(B);return A.has(k)?A.delete(k):A.add(k),A})}function q(k,B,A){k.stopPropagation(),A?C(B):n(B)}function re(){const k=o();k.orphanedElements&&k.orphanedElements.length>0?N(k.orphanedElements):(Ot([...r]),h(new Set(r)))}function ce(){Ot([...r]),h(new Set(r)),N(null)}function R(k){Ii(k),Ot([...r]),h(new Set(r)),N(null)}function O(k,B){k.preventDefault(),k.stopPropagation(),I({x:k.clientX,y:k.clientY,target:B})}function _(k,B){s("table"),l({type:"ontology-detail",packageName:k,layerId:B}),I(null)}function $(k){s("visual"),l({type:"ontology-detail",packageName:k}),I(null)}function J(k){r.has(k)?C(k):n(k),I(null)}function ee(k,B){i(k),l({type:"ontology-detail",packageName:B}),I(null)}if(p.useEffect(()=>{function k(B){B.key==="Escape"&&(i(null),I(null),C(null))}return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[i]),p.useEffect(()=>{if(!S)return;function k(){I(null)}return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[S]),e.length===0)return t.jsx("div",{className:"flex-1 flex items-center justify-center p-4",children:t.jsxs("div",{className:"text-center",style:{color:g.faint},children:[t.jsx("div",{className:"text-xl mb-2",children:"◉"}),t.jsx("div",{style:{fontSize:F.xs},children:"No ontology packages"}),t.jsx("div",{style:{fontSize:F.xs,opacity:.7,marginTop:"4px"},children:"Start memo-architect dev to load"})]})});const de=c.type==="ontology-detail"?c.packageName:null;return t.jsxs("div",{className:"flex flex-col flex-1 overflow-hidden",style:{fontSize:F.explorer.item},children:[t.jsx(xs,{}),t.jsx(hs,{}),t.jsx("div",{className:"px-3 py-2 sticky top-0 z-10",style:{background:g.surface,borderBottom:`1px solid ${g.border}`},children:t.jsx("input",{type:"text",placeholder:"Search kinds...",value:d,onChange:k=>u(k.target.value),className:"w-full px-2.5 py-1.5 rounded-lg focus:outline-none",style:{fontSize:F.explorer.search,border:`1px solid ${g.border}`,background:g.surfaceAlt,color:g.primary},onFocus:k=>k.currentTarget.style.borderColor="#2563EB",onBlur:k=>k.currentTarget.style.borderColor=g.border})}),t.jsx("div",{className:"flex-1 overflow-y-auto py-1",children:L.map(k=>{const B=r.has(k.name),A=de===k.name,V=y.has(k.name),G=k.name.replace(/^@memo(?:architect)?\//,""),X=er[k.type]??er.ontology;return t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1.5 cursor-pointer",style:{borderRadius:"6px",margin:"0 4px",background:A?`${g.accent}18`:"transparent",borderLeft:A?`3px solid ${g.accentDark}`:"3px solid transparent",opacity:B?1:.55},onMouseEnter:z=>{A||(z.currentTarget.style.background="#F0F0ED")},onMouseLeave:z=>{z.currentTarget.style.background=A?`${g.accent}18`:"transparent"},onClick:z=>{z.stopPropagation(),K(k.name)},onDoubleClick:()=>W(k.name),onContextMenu:z=>O(z,{type:"package",pkgName:k.name,isSelected:B}),children:[t.jsx("input",{type:"checkbox",checked:B,onChange:z=>q(z,k.name,B),onClick:z=>z.stopPropagation(),style:{cursor:"pointer",accentColor:"#2563EB",flexShrink:0},title:B?"Deselect for project":"Select for project"}),t.jsx("span",{style:{color:g.muted,fontSize:"10px"},children:V?"▾":"▸"}),t.jsx("span",{children:X}),t.jsx("span",{className:"font-semibold truncate flex-1",style:{color:g.primary,fontSize:F.explorer.group},children:G}),t.jsx("span",{style:{color:g.faint},children:k.kindCount})]}),V&&k.layers.map(z=>{const ne=se[z.id]??z.color??g.muted,Ee=`${k.name}:${z.id}`,ue=x.has(Ee),Se=bs(z.kinds);return t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-2 px-3 py-1 cursor-pointer",style:{borderRadius:"4px",margin:"0 4px 0 20px"},onMouseEnter:le=>le.currentTarget.style.background="#F0F0ED",onMouseLeave:le=>le.currentTarget.style.background="transparent",onClick:le=>{le.stopPropagation(),P(Ee)},onDoubleClick:()=>U(k.name,z.id),onContextMenu:le=>O(le,{type:"layer",pkgName:k.name,layerId:z.id,layerLabel:z.label}),children:[t.jsx("span",{style:{color:g.faint,fontSize:"9px"},children:ue?"▾":"▸"}),t.jsx("span",{className:"w-2 h-2 rounded flex-shrink-0",style:{backgroundColor:ne}}),t.jsx("span",{className:"flex-1 truncate capitalize",style:{color:g.muted,fontSize:F.explorer.kind},children:z.label}),t.jsx("span",{style:{color:g.faint},children:z.kindCount})]}),ue&&(()=>{const le=new Map;for(const H of Se){const oe=H.derivesFrom?le.get(H.derivesFrom)??0:0;le.set(H.name,H.derivesFrom?oe+1:0)}const De=H=>{const oe=a===H.name,An=le.get(H.name)??0,Tn=An===0,mo=36+An*12;return t.jsxs("div",{ref:Fe=>{Fe&&v.current.set(H.name,Fe)},className:"flex items-center gap-1.5 px-3 py-0.5 cursor-pointer",style:{borderRadius:"4px",margin:`0 4px 0 ${mo}px`,background:oe?`${g.accent}18`:"transparent",borderLeft:oe?`2px solid ${ne}`:"2px solid transparent",transition:"background 150ms ease"},onMouseEnter:Fe=>{oe||(Fe.currentTarget.style.background="#F0F0ED")},onMouseLeave:Fe=>{Fe.currentTarget.style.background=oe?`${g.accent}18`:"transparent"},onClick:()=>T(H.name,k.name),onContextMenu:Fe=>O(Fe,{type:"kind",kindName:H.name,pkgName:k.name,layerId:z.id}),children:[!Tn&&t.jsx("span",{style:{color:g.faint,fontSize:"9px",flexShrink:0},children:"↳"}),t.jsx("span",{className:"truncate",style:{color:oe?g.accentDark:g.primary,fontWeight:Tn?500:400,fontSize:F.explorer.item},children:H.name}),H.instanceCount>0&&t.jsxs("span",{style:{color:g.faint,fontSize:"10px"},children:["·",H.instanceCount]})]},H.name)},Y=[],Z=new Map;for(const H of Se){const oe=H.group??"";Z.has(oe)||(Z.set(oe,[]),Y.push(oe)),Z.get(oe).push(H)}return Y.filter(H=>H!=="").length<=1?Se.map(De):Y.map(H=>t.jsxs("div",{children:[H&&t.jsxs("div",{className:"px-3 py-0.5 flex items-center gap-1.5",style:{margin:"0 4px 0 30px"},children:[t.jsx("span",{className:"capitalize truncate",style:{color:g.faint,fontSize:F.explorer.kind,letterSpacing:"0.02em"},children:H.replace(/_/g," ")}),t.jsx("span",{style:{color:g.faint,fontSize:"10px"},children:Z.get(H).length})]}),Z.get(H).map(De)]},`grp:${Ee}:${H||"_root"}`))})()]},Ee)})]},k.name)})}),m&&t.jsx("div",{className:"px-3 py-2 flex-shrink-0",style:{borderTop:`1px solid ${g.border}`,background:g.surfaceAlt},children:t.jsx("button",{onClick:re,className:"w-full py-1.5 rounded-md font-medium",style:{fontSize:F.xs,background:"#2563EB",color:"#FFFFFF",border:"none",cursor:"pointer"},children:"Save Selection"})}),j&&t.jsx(ws,{pkgName:j,onCancel:()=>C(null),onConfirm:()=>{n(j),C(null)}}),D&&t.jsx(gs,{orphans:D,onKeep:ce,onRemap:R,onCancel:()=>N(null)}),S&&t.jsx(fs,{x:S.x,y:S.y,target:S.target,onViewVisual:$,onViewTable:_,onToggleSelection:J,onViewProperties:ee,onClose:()=>I(null)})]})}function Es(){const e=E(s=>s.model),r=E(s=>s.recentlyVisited),n=E(s=>s.selectElement),o=p.useMemo(()=>e?r.map(s=>e.elements[s]).filter(Boolean):[],[r,e]),a=o,i="Recently visited",l=o.length>0?`${o.length} item${o.length===1?"":"s"} this session`:"Items you inspect appear here";return t.jsxs("div",{className:"flex flex-col flex-1 overflow-hidden",children:[t.jsxs("div",{className:"px-3 py-3",style:{borderBottom:`1px solid ${g.border}`},children:[t.jsx("div",{style:{fontSize:"10px",fontWeight:700,textTransform:"uppercase",letterSpacing:"0.08em",color:g.muted,marginBottom:"2px"},children:i}),t.jsx("div",{style:{fontSize:"11px",color:g.muted,opacity:.8},children:l})]}),t.jsx("div",{className:"flex-1 overflow-y-auto",style:{padding:"4px 0"},children:a.length===0?t.jsx("div",{style:{padding:"24px 16px",textAlign:"center",fontSize:"12px",color:g.muted,lineHeight:"1.6"},children:"Nothing visited yet. Use Model Explorer or Viewpoints to begin."}):a.map(s=>{const c=se[s.layer]||g.muted;return t.jsx("button",{onClick:()=>n(s.id),style:{display:"flex",alignItems:"flex-start",gap:"8px",width:"100%",padding:"8px 12px",background:"transparent",border:"none",borderLeft:`3px solid ${c}`,cursor:"pointer",textAlign:"left",transition:"background 0.1s"},onMouseEnter:d=>d.currentTarget.style.background=g.surfaceAlt,onMouseLeave:d=>d.currentTarget.style.background="transparent",children:t.jsxs("div",{style:{flex:1,minWidth:0},children:[t.jsx("div",{style:{fontSize:F.explorer.item,fontWeight:500,color:g.primary,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:s.name}),t.jsxs("div",{style:{fontSize:"10px",color:g.muted,marginTop:"2px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:[t.jsx("span",{style:{color:c,fontWeight:600},children:s.kind}),s.shortId&&t.jsx("span",{style:{marginLeft:"6px",fontFamily:"monospace",opacity:.7},children:s.shortId})]})]})},s.id)})})]})}function Ss({element:e,selected:r=!1,fontSize:n=F.explorer.item,fontWeight:o}){const a=e.shortId??"ID-PENDING";return t.jsxs("span",{className:"truncate flex-1",style:{color:r?g.accentDark:g.primary,fontSize:n,fontWeight:o??(r?500:400)},title:`${a} ${e.name}`,children:[t.jsxs("span",{style:{color:g.muted,fontWeight:500,marginRight:"4px"},children:["[",a,"]"]}),e.name]})}function un({count:e,color:r,title:n}){return t.jsx("span",{className:"px-1.5 py-0.5 rounded-full",style:{background:r+"25",color:r,fontSize:F.explorer.count,fontWeight:600,minWidth:"20px",textAlign:"center"},title:n,children:e})}const Bs=Object.assign({}),Nn={};for(const[e,r]of Object.entries(Bs)){const n=e.match(/dhf-templates\/(.+)\.md$/);n&&(Nn[n[1]]=r)}function js(e){return e.replace(/^---[\s\S]*?---\n?/,"")}function Zr(e){return e.replace(/\{\{include:([^}]+)\}\}/g,(r,n)=>{const o=n.replace(/\.md$/,""),a=Nn[o];return a?Zr(js(a)):`<!-- [include: ${n} — not found] -->`})}function Cs(e){const r=Nn[e];return r?Zr(r):null}const Ve=[{id:"risk",label:"Risk Management",color:"#dc2626",templates:[{id:"iso-14971/rmp",title:"Risk Management Plan",prefix:"RMP"},{id:"iso-14971/har",title:"Hazard Analysis Report",prefix:"HAR"},{id:"iso-14971/fmea",title:"FMEA",prefix:"FMEA"},{id:"iso-14971/fta",title:"Fault Tree Analysis",prefix:"FTA"},{id:"iso-14971/risk-benefit",title:"Risk-Benefit Analysis",prefix:"RBA"},{id:"iso-14971/rmr",title:"Risk Management Report",prefix:"RMR"}]},{id:"software",label:"Software",color:"#2563eb",templates:[{id:"iec-62304/sdp",title:"Software Development Plan",prefix:"SDP"},{id:"iec-62304/srs",title:"Software Requirements Spec",prefix:"SRS"},{id:"iec-62304/sad",title:"Software Architecture Description",prefix:"SAD"},{id:"iec-62304/detailed-design",title:"Software Detailed Design",prefix:"DDS"},{id:"iec-62304/integration-test",title:"Integration Test Plan",prefix:"ITP"},{id:"iec-62304/system-test",title:"System Test Plan",prefix:"STP"},{id:"iec-62304/soup",title:"SOUP List",prefix:"SOUP"},{id:"iec-62304/sbom",title:"Software Bill of Materials",prefix:"SBOM"},{id:"iec-62304/sw-traceability",title:"SW Traceability Matrix",prefix:"STM"},{id:"iec-62304/change-control",title:"Change Control Log",prefix:"CCL"}]},{id:"usability",label:"Usability",color:"#7c3aed",templates:[{id:"iec-62366/ue-plan",title:"Usability Engineering Plan",prefix:"UEP"},{id:"iec-62366/use-spec",title:"Intended Use Specification",prefix:"USE"},{id:"iec-62366/ui-spec",title:"User Interface Specification",prefix:"UIS"},{id:"iec-62366/task-analysis",title:"Task Analysis",prefix:"TA"},{id:"iec-62366/urra",title:"Use-Related Risk Analysis",prefix:"URRA"},{id:"iec-62366/formative-eval",title:"Formative Evaluation",prefix:"FE"},{id:"iec-62366/summative-eval",title:"Summative Evaluation",prefix:"SE"}]},{id:"requirements",label:"Requirements",color:"#0891b2",templates:[{id:"21cfr820/user-needs",title:"User Needs",prefix:"UN"},{id:"21cfr820/design-input",title:"Design Input Specification",prefix:"DIS"},{id:"21cfr820/design-output",title:"Design Output Specification",prefix:"DOS"}]},{id:"vv",label:"Verification & Validation",color:"#0d9488",templates:[{id:"21cfr820/vv-plan",title:"V&V Plan",prefix:"VVP"},{id:"21cfr820/vv-report",title:"V&V Report",prefix:"VVR"},{id:"21cfr820/design-verification",title:"Design Verification Report",prefix:"DVR"},{id:"21cfr820/design-validation",title:"Design Validation Report",prefix:"DVAR"},{id:"21cfr820/design-review",title:"Design Review Record",prefix:"DRR"}]},{id:"release",label:"Release & Change",color:"#4f46e5",templates:[{id:"21cfr820/transfer-plan",title:"Design Transfer Plan",prefix:"DTP"},{id:"21cfr820/change-record",title:"Design Change Record",prefix:"DCR"},{id:"21cfr820/dhf-index",title:"DHF Index",prefix:"DHF"}]},{id:"system",label:"System",color:"#059669",templates:[{id:"system/srs",title:"System Requirements Specification",prefix:"SRS"},{id:"system/sad",title:"System Architecture Description",prefix:"SyAD"},{id:"system/sds",title:"System Design Specification",prefix:"SDS"},{id:"system/icd",title:"Interface Control Document",prefix:"ICD"},{id:"system/svvp",title:"System V&V Plan",prefix:"SVVP"},{id:"system/svvr",title:"System V&V Report",prefix:"SVVR"}]},{id:"hardware",label:"Hardware",color:"#b45309",templates:[{id:"hardware/hdp",title:"Hardware Development Plan",prefix:"HDP"},{id:"hardware/hds",title:"Hardware Design Specification",prefix:"HDS"},{id:"hardware/hvp",title:"Hardware Verification Plan",prefix:"HVP"},{id:"hardware/hvr",title:"Hardware Verification Report",prefix:"HVR"},{id:"hardware/hbom",title:"Hardware Bill of Materials",prefix:"HBOM"},{id:"hardware/haz",title:"Hardware Hazard Analysis",prefix:"HHA"}]},{id:"cybersecurity",label:"Cybersecurity",color:"#d97706",templates:[{id:"fda-cybersecurity/threat-model",title:"Threat Model",prefix:"TM"},{id:"fda-cybersecurity/security-arch",title:"Security Architecture",prefix:"SA"},{id:"fda-cybersecurity/vuln-assessment",title:"Vulnerability Assessment",prefix:"VA"},{id:"fda-cybersecurity/postmarket-surveillance",title:"Post-Market Surveillance",prefix:"PMS"},{id:"fda-cybersecurity/incident-response",title:"Incident Response Plan",prefix:"IRP"}]}],pn="#6B7280";function Ds(e){var r;return((r=Ve.find(n=>n.label===e))==null?void 0:r.color)??pn}function bt(e){const r=e.split(/[^a-zA-Z0-9]+/).filter(Boolean);return r.length>=2?r.slice(0,4).map(n=>n[0].toUpperCase()).join(""):r.length===1?r[0].slice(0,3).toUpperCase():"DOC"}const Fs={position:"fixed",inset:0,zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(0,0,0,0.4)"},Ns={background:"#fff",borderRadius:"12px",padding:"20px",width:"460px",maxHeight:"560px",display:"flex",flexDirection:"column",boxShadow:"0 20px 60px rgba(0,0,0,0.2)"},tr=["Category","Template","Confirm"];function qt(e,r=1e4){const{registerLlmRequest:n}=E.getState(),o=`dhf-${Date.now()}-${Math.random().toString(36).slice(2)}`;return new Promise((a,i)=>{n(o,a,i),e(o),setTimeout(()=>i(new Error("Request timed out.")),r)})}function As({initialGroupId:e,existingDocs:r,numberingPrefix:n,onCreate:o,onClose:a}){const i=E(B=>B.connected),l=Ve.find(B=>B.id===e)??null,[s,c]=p.useState(l?1:0),[d,u]=p.useState(l),[y,b]=p.useState(""),[x,w]=p.useState({builtIn:new Set,repo:new Set,blank:!1}),[f,h]=p.useState("Untitled Document"),[m,D]=p.useState(null),[N,j]=p.useState(null),[C,S]=p.useState(!1),[I,v]=p.useState(""),[L,W]=p.useState(""),[U,T]=p.useState({}),[K,P]=p.useState(!1),[q,re]=p.useState(null),R=d===null&&s>0?y.trim()||"Other":(d==null?void 0:d.label)??"",O=(d==null?void 0:d.color)??pn;p.useEffect(()=>{s!==1||m!==null||!i||qt(B=>Ci(B)).then(D).catch(B=>j((B==null?void 0:B.message)??"Could not list repository files."))},[s,m,i]);const _=p.useMemo(()=>{const B=[];for(const A of(d==null?void 0:d.templates)??[])x.builtIn.has(A.id)&&B.push({key:A.id,defaultTitle:A.title,prefix:A.prefix,templateId:A.id});for(const A of x.repo){const V=m==null?void 0:m.find(X=>X.path===A),G=(V==null?void 0:V.title)??A.split("/").pop().replace(/\.md$/,"");B.push({key:`repo:${A}`,defaultTitle:G,prefix:bt(G),templateId:`repo:${A}`})}if(x.blank&&B.push({key:"blank",defaultTitle:f.trim()||"Untitled Document",prefix:bt(f),templateId:"blank"}),C&&I.trim()){const A=I.trim();B.push({key:"new-template",defaultTitle:A,prefix:bt(A),templateId:"new-template"})}return B},[x,d,m,f,C,I]),$=B=>U[B.key]??B.defaultTitle,J=B=>B.templateId==="blank"||B.templateId==="new-template"||B.templateId.startsWith("repo:")?bt($(B)):B.prefix,ee=p.useMemo(()=>{const B=new Map;return _.map(A=>{const V=`${n}-${J(A)}-`,G=r.filter(z=>z.id.startsWith(V)).length,X=B.get(V)??0;return B.set(V,X+1),`${V}${String(G+X+1).padStart(3,"0")}`})},[_,U,r,n]);async function de(){P(!0),re(null);try{const B=[];for(const A of _){let V=null;if(A.templateId.startsWith("repo:"))V=await qt(G=>Di(G,A.templateId.slice(5)));else if(A.templateId==="new-template"){const G=L.trim()||`# ${$(A)}
17
-
18
- _[TODO: Add template content]_
19
- `,X=await qt(z=>Fi(z,$(A),G));B.push({title:$(A),prefix:J(A),templateId:`repo:${X.path}`,groupLabel:R,content:G});continue}else A.templateId==="blank"&&(V=`# ${$(A)}
20
-
21
- _[TODO: Add content]_
22
- `);B.push({title:$(A),prefix:J(A),templateId:A.templateId,groupLabel:R,content:V})}o(B)}catch(B){re((B==null?void 0:B.message)??"Could not read template."),P(!1)}}const k=s===0?!0:s===1?_.length>0:_.length>0&&!K;return t.jsx("div",{style:Fs,onClick:B=>{B.target===B.currentTarget&&a()},children:t.jsxs("div",{style:Ns,children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"4px"},children:[t.jsx("span",{style:{fontSize:"14px",fontWeight:700,color:"#1B3A4B",flex:1},children:"New Document"}),t.jsx("button",{onClick:a,style:{background:"none",border:"none",cursor:"pointer",color:"#9CA3AF",fontSize:"18px",lineHeight:1},children:"×"})]}),t.jsx("div",{style:{display:"flex",gap:"6px",marginBottom:"14px"},children:tr.map((B,A)=>t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"5px",fontSize:"11px",fontWeight:A===s?700:500,color:A===s?"#1B3A4B":A<s?"#059669":"#9CA3AF"},children:[t.jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:"9px",fontWeight:700,color:"#fff",background:A===s?"#1B3A4B":A<s?"#059669":"#D1D5DB"},children:A<s?"✓":A+1}),B,A<tr.length-1&&t.jsx("span",{style:{color:"#D1D5DB"},children:"—"})]},B))}),s===0&&t.jsxs("div",{style:{flex:1,overflowY:"auto",display:"flex",flexDirection:"column",gap:"4px"},children:[Ve.map(B=>t.jsx(nr,{label:B.label,color:B.color,detail:`${B.templates.length} meMO templates`,selected:(d==null?void 0:d.id)===B.id,onClick:()=>{u(B),w({builtIn:new Set,repo:new Set,blank:!1})}},B.id)),t.jsx(nr,{label:"Other",color:pn,detail:"Custom category — blank or repository template",selected:d===null&&y!=="",onClick:()=>{u(null),b(y||"Other"),w({builtIn:new Set,repo:new Set,blank:!1})}}),d===null&&y!==""&&t.jsx("input",{value:y,onChange:B=>b(B.target.value),placeholder:"Category name, e.g. Clinical",autoFocus:!0,style:{margin:"2px 0 0 26px",padding:"6px 8px",border:"1px solid #D1D5DB",borderRadius:"5px",fontSize:"12px",color:"#1B3A4B",outline:"none"}})]}),s===1&&t.jsxs("div",{style:{flex:1,overflowY:"auto",display:"flex",flexDirection:"column",gap:"10px"},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px",fontSize:"12px",color:"#6B7280"},children:[t.jsx("span",{style:{width:"9px",height:"9px",borderRadius:"50%",background:O,display:"inline-block"}}),t.jsx("strong",{style:{color:"#1B3A4B"},children:R}),t.jsx("span",{children:"— pick one or more sources"})]}),d&&d.templates.length>0&&t.jsx(Ht,{title:"meMO templates",hint:"Prefilled sections and model queries",children:d.templates.map(B=>t.jsx(vt,{label:B.title,sub:B.id,color:O,checked:x.builtIn.has(B.id),onToggle:()=>w(A=>{const V=new Set(A.builtIn);return V.has(B.id)?V.delete(B.id):V.add(B.id),{...A,builtIn:V}})},B.id))}),t.jsx(Ht,{title:"Blank document",hint:"Start from an empty page",children:t.jsx(vt,{label:x.blank?"":"Blank document",color:O,checked:x.blank,onToggle:()=>w(B=>({...B,blank:!B.blank})),children:x.blank&&t.jsx("input",{value:f,onChange:B=>h(B.target.value),onClick:B=>B.stopPropagation(),style:{flex:1,padding:"4px 8px",border:"1px solid #D1D5DB",borderRadius:"5px",fontSize:"12px",color:"#1B3A4B",outline:"none"}})})}),t.jsxs(Ht,{title:"Project templates",hint:"Reusable templates in dhf/templates/",children:[!i&&t.jsx(Ye,{text:"Dev server not connected — project templates unavailable."}),i&&N&&t.jsx(Ye,{text:N,error:!0}),i&&!N&&m===null&&t.jsx(Ye,{text:"Loading project templates…"}),i&&(m==null?void 0:m.length)===0&&t.jsx(Ye,{text:"No project templates yet."}),i&&(m==null?void 0:m.map(B=>t.jsx(vt,{label:B.title,sub:B.path,color:O,checked:x.repo.has(B.path),onToggle:()=>w(A=>{const V=new Set(A.repo);return V.has(B.path)?V.delete(B.path):V.add(B.path),{...A,repo:V}})},B.path))),t.jsx(vt,{label:"Add new template",sub:"Save and reuse in this project",color:O,checked:C,disabled:!i,disabledNote:i?void 0:"server unavailable",onToggle:()=>S(B=>!B)}),C&&t.jsxs("div",{style:{marginLeft:"22px",display:"flex",flexDirection:"column",gap:"6px"},children:[t.jsx("input",{value:I,onChange:B=>v(B.target.value),placeholder:"Template title",style:{padding:"6px 8px",border:"1px solid #D1D5DB",borderRadius:"5px",fontSize:"12px",color:"#1B3A4B",outline:"none"}}),t.jsx("textarea",{value:L,onChange:B=>W(B.target.value),placeholder:"Template Markdown (headings, instructions, and model queries)",rows:4,style:{padding:"6px 8px",border:"1px solid #D1D5DB",borderRadius:"5px",fontSize:"11px",fontFamily:"monospace",color:"#1B3A4B",outline:"none",resize:"vertical"}})]})]})]}),s===2&&t.jsxs("div",{style:{flex:1,overflowY:"auto",display:"flex",flexDirection:"column",gap:"6px"},children:[t.jsxs("div",{style:{fontSize:"12px",color:"#6B7280",marginBottom:"4px"},children:[_.length," document",_.length===1?"":"s"," will be created in",t.jsxs("strong",{style:{color:"#1B3A4B"},children:[" ",R]})," and saved to ",t.jsx("code",{style:{background:"#F3F4F6",padding:"0 4px",borderRadius:"3px",fontSize:"11px"},children:"dhf/documents/"}),":"]}),_.map((B,A)=>t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"7px 10px",border:"1px solid #E5E7EB",borderRadius:"6px"},children:[t.jsx("span",{style:{fontSize:"11px",fontFamily:"monospace",fontWeight:700,color:O,whiteSpace:"nowrap"},children:ee[A]}),t.jsx("input",{value:$(B),onChange:V=>T(G=>({...G,[B.key]:V.target.value})),style:{flex:1,padding:"4px 8px",border:"1px solid #E5E7EB",borderRadius:"5px",fontSize:"12px",color:"#1B3A4B",outline:"none"}}),t.jsx("span",{style:{fontSize:"10px",color:"#9CA3AF",whiteSpace:"nowrap"},children:B.templateId==="blank"?"blank":B.templateId==="new-template"?"new template":B.templateId.startsWith("repo:")?"project":"meMO"})]},B.key)),q&&t.jsx(Ye,{text:q,error:!0})]}),t.jsxs("div",{style:{display:"flex",gap:"8px",justifyContent:"flex-end",marginTop:"16px"},children:[s>0&&t.jsx("button",{onClick:()=>c(B=>B-1),disabled:K,style:{padding:"7px 14px",borderRadius:"6px",border:"1px solid #E5E7EB",background:"#fff",fontSize:"13px",cursor:"pointer",color:"#374151",marginRight:"auto"},children:"← Back"}),t.jsx("button",{onClick:a,style:{padding:"7px 14px",borderRadius:"6px",border:"1px solid #E5E7EB",background:"#fff",fontSize:"13px",cursor:"pointer",color:"#374151"},children:"Cancel"}),s<2?t.jsx("button",{onClick:()=>c(B=>B+1),disabled:!k,style:{padding:"7px 16px",borderRadius:"6px",border:"none",background:k?"#1B3A4B":"#E5E7EB",color:k?"#fff":"#9CA3AF",fontSize:"13px",fontWeight:600,cursor:k?"pointer":"default"},children:"Next →"}):t.jsx("button",{onClick:de,disabled:!k,style:{padding:"7px 16px",borderRadius:"6px",border:"none",background:k?O:"#E5E7EB",color:k?"#fff":"#9CA3AF",fontSize:"13px",fontWeight:600,cursor:k?"pointer":"default"},children:K?"Creating…":`Create ${_.length>0?`(${_.length})`:""}`})]})]})})}function nr({label:e,color:r,detail:n,selected:o,onClick:a}){return t.jsxs("button",{onClick:a,style:{display:"flex",alignItems:"center",gap:"10px",padding:"9px 10px",borderRadius:"6px",border:`1px solid ${o?r:"#E5E7EB"}`,background:o?`${r}10`:"#fff",cursor:"pointer",textAlign:"left"},children:[t.jsx("span",{style:{width:"10px",height:"10px",borderRadius:"50%",background:r,flexShrink:0}}),t.jsx("span",{style:{flex:1,fontSize:"13px",fontWeight:600,color:"#1B3A4B"},children:e}),t.jsx("span",{style:{fontSize:"11px",color:"#9CA3AF"},children:n})]})}function Ht({title:e,hint:r,children:n}){return t.jsxs("div",{children:[t.jsxs("div",{style:{fontSize:"10px",fontWeight:700,color:"#6B7280",textTransform:"uppercase",letterSpacing:"0.05em",marginBottom:"2px"},children:[e," ",t.jsxs("span",{style:{fontWeight:400,textTransform:"none",letterSpacing:0,color:"#9CA3AF"},children:["— ",r]})]}),t.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"2px"},children:n})]})}function vt({label:e,sub:r,color:n,checked:o,disabled:a,disabledNote:i,onToggle:l,children:s}){return t.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"6px 8px",borderRadius:"6px",cursor:a?"not-allowed":"pointer",background:o?`${n}10`:"transparent",opacity:a?.45:1},children:[t.jsx("input",{type:"checkbox",checked:o,disabled:a,onChange:()=>!a&&l(),style:{accentColor:n}}),e&&t.jsx("span",{style:{fontSize:"13px",color:"#1B3A4B"},children:e}),s,r&&t.jsx("span",{style:{marginLeft:"auto",fontSize:"10px",fontFamily:"monospace",color:"#9CA3AF",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"180px"},children:r}),a&&i&&t.jsx("span",{style:{fontSize:"10px",color:"#9CA3AF"},children:i})]})}function Ye({text:e,error:r}){return t.jsx("div",{style:{fontSize:"11px",color:r?"#DC2626":"#9CA3AF",fontStyle:"italic",padding:"4px 8px"},children:e})}const Ts=p.lazy(()=>te(()=>import("./ScenarioEditor-FAEYTHgP.js"),__vite__mapDeps([0,1,2])).then(e=>({default:e.ScenarioEditor})));function Te({expanded:e,size:r=14,color:n=g.muted}){return t.jsx("svg",{width:r,height:r,viewBox:"0 0 16 16",fill:"none",style:{transition:"transform 150ms ease",transform:e?"rotate(90deg)":"rotate(0deg)",flexShrink:0},children:t.jsx("path",{d:"M6 4L10 8L6 12",stroke:n,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function rr(){return t.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[t.jsx("path",{d:"M3 3h4v4M13 3H9v4M3 13h4V9M13 13H9V9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),t.jsx("path",{d:"M7 7 4 4M9 7l3-3M7 9l-3 3M9 9l3 3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}function $e({open:e,color:r=g.muted}){return e?t.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",style:{flexShrink:0},children:[t.jsx("path",{d:"M1.5 3.5h4.8l1.2 1.5H14.5v8H1.5z",fill:r,opacity:"0.15",stroke:r,strokeWidth:"1",strokeLinejoin:"round"}),t.jsx("path",{d:"M1.5 5h13v8H1.5z",fill:r,opacity:"0.08"})]}):t.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",style:{flexShrink:0},children:t.jsx("path",{d:"M1.5 3.5h4.8l1.2 1.5H14.5v8H1.5z",fill:r,opacity:"0.15",stroke:r,strokeWidth:"1",strokeLinejoin:"round"})})}function mn({color:e=g.muted}){return t.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",style:{flexShrink:0},children:[t.jsx("rect",{x:"2",y:"1.5",width:"12",height:"13",rx:"1.5",fill:e,opacity:"0.1",stroke:e,strokeWidth:"1"}),t.jsx("line",{x1:"5",y1:"5.5",x2:"11",y2:"5.5",stroke:e,strokeWidth:"0.8",opacity:"0.5"}),t.jsx("line",{x1:"5",y1:"8",x2:"11",y2:"8",stroke:e,strokeWidth:"0.8",opacity:"0.5"}),t.jsx("line",{x1:"5",y1:"10.5",x2:"9",y2:"10.5",stroke:e,strokeWidth:"0.8",opacity:"0.5"})]})}function Rs({elementId:e,currentKind:r,onClose:n}){const o=E(d=>d.updateElementKind),a=E(d=>d.model),[i,l]=p.useState(r),s=p.useRef(null),c=p.useMemo(()=>{var d;return(((d=a==null?void 0:a.registries)==null?void 0:d.kinds)??[]).filter(u=>!u.isAbstract).map(u=>u.name).sort((u,y)=>u.localeCompare(y))},[a]);return p.useEffect(()=>{const d=u=>{s.current&&!s.current.contains(u.target)&&n()};return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[n]),t.jsxs("div",{ref:s,className:"fixed z-50 rounded-lg overflow-hidden py-3 px-4",style:{top:"50%",left:"50%",transform:"translate(-50%, -50%)",background:"#FFFFFF",border:"1px solid #E5E7EB",boxShadow:"0 8px 32px rgba(0,0,0,0.16)",minWidth:"320px"},children:[t.jsx("div",{className:"font-semibold mb-3",style:{color:"#1B3A4B",fontSize:"13px"},children:"Change Element Type"}),t.jsxs("div",{className:"text-xs mb-1",style:{color:"#6B7280"},children:["Current: ",t.jsx("span",{style:{color:"#DC2626",fontWeight:600},children:r})," (not in ontology)"]}),t.jsx("select",{value:i,onChange:d=>l(d.target.value),className:"w-full px-3 py-2 rounded-lg mb-3 focus:outline-none",style:{background:"#F9F9F8",border:"1px solid #E5E7EB",color:"#1B3A4B",fontSize:"13px"},children:c.map(d=>t.jsx("option",{value:d,children:d},d))}),t.jsxs("div",{className:"flex gap-2 justify-end",children:[t.jsx("button",{onClick:n,className:"px-3 py-1.5 rounded",style:{fontSize:"12px",color:"#6B7280",background:"#F0F0ED"},children:"Cancel"}),t.jsx("button",{onClick:()=>{o(e,i),n()},className:"px-3 py-1.5 rounded font-medium",style:{fontSize:"12px",color:"#FFFFFF",background:"#2DD4A8"},children:"Apply"})]})]})}function Ms({menu:e,onClose:r}){var w;const n=E(f=>f.model),o=E(f=>f.selectElement),a=E(f=>f.addElement),i=E(f=>f.updateElementFolder),l=E(f=>f.moveFolder),s=E(f=>f.deleteFolder),c=E(f=>f.deleteModelElement),[d,u]=p.useState(null),y=p.useRef(null);if(p.useEffect(()=>{const f=h=>{y.current&&!y.current.contains(h.target)&&r()};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[r]),!n)return null;let b="",x=[];if(e.type==="element"&&e.elementId){const f=n.elements[e.elementId];if(!f)return null;b=f.name;const h=!(((w=n.registries)==null?void 0:w.kinds)??[]).some(m=>m.name===f.kind);x=[{label:"View details",action:()=>o(f.id)},{label:"Move to folder...",action:()=>{const m=window.prompt("Enter new folder path (e.g., Manufacturers/Hardware):",f.attributes[Ae]||"");m!==null&&i(f.id,m)}},{label:"Copy ID",action:()=>{var m;return(m=navigator.clipboard)==null?void 0:m.writeText(f.id)}},{label:"Delete element…",danger:!0,action:()=>{window.confirm(`Delete “${f.name}”?
23
-
24
- All incoming and outgoing relationships will also be deleted. This cannot be undone.`)&&c(f.id).then(m=>{m.success||window.alert(m.error??"The element could not be deleted.")})}},...h?[{label:"⚠ Change Type…",action:()=>u({elementId:f.id,currentKind:f.kind})}]:[]]}else e.type==="folder"&&e.folderId&&e.kind?(b=`Folder: ${e.folderId.split("/").pop()}`,x=[{label:"Add Element here",action:()=>{const f=window.prompt("Enter element name:");f&&a(e.kind,f,e.folderId)}},{label:"Add Sub-group",action:()=>{const f=window.prompt("Enter group name:");if(f){const h=e.folderId?`${e.folderId}/${f}`:f;a(e.kind,`(new ${f} element)`,h)}}},{label:"Move Folder...",action:()=>{const f=window.prompt("Enter new folder path:",e.folderId);f&&f!==e.folderId&&l(e.kind,e.folderId,f)}},{label:"Delete Folder (Move items up)",danger:!0,action:()=>{window.confirm(`Move all elements in "${e.folderId}" to its parent group?`)&&s(e.kind,e.folderId)}}]):e.type==="kind"&&e.kind&&(b=`Category: ${e.kind}`,x=[{label:"Add Element",action:()=>{const f=window.prompt("Enter element name:");f&&a(e.kind,f,"")}},{label:"New Group",action:()=>{const f=window.prompt("Enter group name:");f&&a(e.kind,`(new ${f} element)`,f)}}]);return x.length?t.jsxs(t.Fragment,{children:[t.jsxs("div",{ref:y,className:"fixed z-50 rounded-lg overflow-hidden py-1",style:{left:e.x,top:e.y,background:g.surface,border:`1px solid ${g.border}`,boxShadow:"0 4px 16px rgba(0,0,0,0.12)",minWidth:"220px"},children:[t.jsx("div",{className:"px-3 py-1.5 font-bold truncate bg-slate-50",style:{color:g.primary,fontSize:F.xs,borderBottom:`1px solid ${g.border}`},children:b.toUpperCase()}),x.map((f,h)=>t.jsx("div",{className:"px-3 py-2 cursor-pointer transition-colors",style:{color:f.danger?"#DC2626":g.secondary,fontSize:F.explorer.item},onMouseEnter:m=>m.currentTarget.style.background="#F0F0ED",onMouseLeave:m=>m.currentTarget.style.background="transparent",onClick:()=>{f.action(),d||r()},children:f.label},h))]}),d&&t.jsx(Rs,{elementId:d.elementId,currentKind:d.currentKind,onClose:()=>{u(null),r()}})]}):null}function or(e){const r=[],n=[...e].sort((a,i)=>a.name.localeCompare(i.name));for(const a of n){const l=(a.attributes[Ae]||"").split("/").filter(Boolean);let s=r,c="";for(const d of l){c=c?`${c}/${d}`:d;const u=`f:${c}`;let y=s.find(b=>b.id===u);y||(y={id:u,name:d,type:"folder",children:[]},s.push(y)),s=y.children}s.push({id:a.id,name:a.name,type:"element",children:[],element:a})}const o=a=>{a.sort((i,l)=>i.type!==l.type?i.type==="folder"?-1:1:i.name.localeCompare(l.name));for(const i of a)i.children.length>0&&o(i.children)};return o(r),r}function eo({nodes:e,level:r,expanded:n,toggleExpand:o,selectedElementId:a,selectElement:i,selectedElementIds:l,toggleElementSelection:s,violationCounts:c,baseColor:d,onContextMenu:u,onDragStart:y,onDrop:b,isUndefined:x}){return t.jsx(t.Fragment,{children:e.map(w=>{if(w.type==="folder"){const f=n.has(w.id);return t.jsxs("div",{style:{marginLeft:r>0?"16px":"0"},draggable:!0,onDragStart:h=>y(h,w),onDragOver:h=>h.preventDefault(),onDrop:h=>b(h,w.id.replace("f:","")),children:[t.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1 cursor-pointer select-none",style:{borderRadius:"4px",margin:"0 4px"},onMouseEnter:h=>h.currentTarget.style.background="#F0F0ED",onMouseLeave:h=>h.currentTarget.style.background="transparent",onClick:()=>o(w.id),onContextMenu:h=>u(h,"folder",w.id),children:[t.jsx(Te,{expanded:f,size:12,color:g.muted}),t.jsx($e,{open:f,color:d}),t.jsx("span",{className:"font-medium flex-1 truncate",style:{color:g.secondary,fontSize:F.explorer.kind},children:w.name})]}),f&&t.jsx(eo,{nodes:w.children,level:r+1,expanded:n,toggleExpand:o,selectedElementId:a,selectElement:i,selectedElementIds:l,toggleElementSelection:s,violationCounts:c,baseColor:d,onContextMenu:u,onDragStart:y,onDrop:b,isUndefined:x})]},w.id)}else{const f=w.element,h=a===f.id,m=l.has(f.id),D=c.get(f.id)||0,N=se[f.layer]||d;return t.jsxs("div",{className:"group flex items-center gap-1.5 px-2 py-1 cursor-pointer",style:{borderRadius:"4px",margin:"0 4px",marginLeft:(r>0?16:0)+20+"px",background:m?"#FFF3CD":h?g.accent+"18":"transparent",fontWeight:h||m?500:400},draggable:!0,onDragStart:j=>y(j,{type:"element",element:f,id:f.id,name:f.name,children:[]}),onMouseEnter:j=>{!h&&!m&&(j.currentTarget.style.background="#F0F0ED")},onMouseLeave:j=>{j.currentTarget.style.background=m?"#FFF3CD":h?g.accent+"18":"transparent"},onClick:j=>{j.metaKey||j.ctrlKey||j.shiftKey?(j.preventDefault(),s(f.id)):i(f.id)},onContextMenu:j=>u(j,"element",f.id),children:[t.jsx("input",{type:"checkbox",checked:m,onChange:j=>{j.stopPropagation(),s(f.id)},onClick:j=>j.stopPropagation(),className:"flex-shrink-0",style:{width:"12px",height:"12px",cursor:"pointer",opacity:m?1:0,transition:"opacity 120ms",accentColor:"#2DD4A8"},onMouseEnter:j=>{j.currentTarget.style.opacity="1"},onMouseLeave:j=>{j.currentTarget.style.opacity=m?"1":"0"}}),t.jsx(mn,{color:x?"#F59E0B":N}),t.jsx(Ss,{element:f,selected:h}),x&&t.jsx("span",{title:`Kind "${f.kind}" is not defined in the ontology`,style:{color:"#F59E0B",fontSize:"12px",flexShrink:0},children:"⚠"}),D>0&&t.jsx("span",{className:"px-1 py-0.5 rounded-full",style:{background:"#FEF2F2",color:"#DC2626",fontSize:F.explorer.count,fontWeight:600,minWidth:"16px",textAlign:"center"},children:D})]},f.id)}})})}function Is(e,r,n){return e.endsWith("View")||r==="viewpoints"||r==="views"||n==="viewpoints"||n==="views"}function Kt(e,r,n){return Is(e,r,n)||e==="ItemDefinition"}function ar(e,r,n){return!n.has(e.kind)&&$r(e,{kinds:r})!==void 0}function Ps(e,r){var a;const n=new Map,o=new Map;for(const i of r)for(const l of i.layers)o.has(l.id)||o.set(l.id,l);for(const i of e){const l=((a=i.namespace)==null?void 0:a[0])??i.layer;if(!l||l==="unknown")continue;let s=n.get(l);if(!s){const c=o.get(l);s={id:l,label:(c==null?void 0:c.label)??to(l),color:(c==null?void 0:c.color)??se[l]??"#6B7280",kinds:[]},n.set(l,s)}s.kinds.includes(i.name)||s.kinds.push(i.name)}return[...n.values()]}function Ls(e){var n;const r={};for(const o of e)r[o.name]=((n=o.namespace)==null?void 0:n[0])??o.layer;return r}function Us(e){var n;const r={};for(const o of e)r[o.name]=(n=o.namespace)==null?void 0:n[1];return r}function zs(e){const r={},n=new Set;for(const o of e)o.isAbstract&&n.add(o.name),r[o.name]=o.superType;for(const[o,a]of Object.entries(r))a&&n.has(a)&&(r[o]=void 0);return r}function to(e){return e.split(/[_-]/).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join(" ")}function Os(e,r){const n={StateMachine:"State Machine",ModeState:"Mode State",BehaviorProperty:"Behavioral Constraint",AssumeProperty:"Assumption",GuaranteeProperty:"Guarantee"};if(n[e])return r===1?n[e]:n[e]+"s";const o=e.replace(/([a-z0-9])([A-Z])/g,"$1 $2");return r===1||/(?:ss|Data|Status)$/i.test(o)||o.endsWith("s")?o:o+"s"}const ir=["documents","assets","templates","analyses","adrs","reviews"];function Vs(e,r){const n=`${e} ${r??""}`.toLowerCase();return/(review|approval)/.test(n)?"reviews":/(adr|decision)/.test(n)?"adrs":/(template|pattern)/.test(n)?"templates":/(analysis|notebook|worksheet|matrix)/.test(n)?"analyses":/(asset|capture|image|media|file)/.test(n)?"assets":"documents"}function $s(e,r,n,o){const a=r.toLowerCase(),i=new Set(["views","viewpoints","manifest"]),l=Ls(n),s=Us(n),c=zs(n),d=new Set(n.map(h=>h.name)),u=Ps(n,o).filter(h=>!i.has(h.id)),y=new Set(u.map(h=>h.id)),b=(h,m,D)=>{var j;const N=new Map;for(const[C,S]of h.entries()){const I=D==="artifacts"?Vs(C,(j=n.find(U=>U.name===C))==null?void 0:j.superType):s[C]??"",v=c[C]??C;N.has(I)||N.set(I,new Map);const L=N.get(I),W=L.get(v)??[];L.set(v,[...W,...or(S)])}return[...N.entries()].sort(([C],[S])=>D==="artifacts"?ir.indexOf(C)-ir.indexOf(S):C.localeCompare(S)).map(([C,S])=>({id:C,label:C?to(C):"",color:C?se[C]??m:m,kinds:S}))},x=[];for(const h of u){const m=new Map;for(const D of e){const N=l[D.kind]??D.layer,j=s[D.kind];if(Kt(D.kind,N,j))continue;const C=l[D.kind];C&&C===h.id&&(a&&!D.name.toLowerCase().includes(a)&&!D.kind.toLowerCase().includes(a)||(m.has(D.kind)||m.set(D.kind,[]),m.get(D.kind).push(D)))}m.size>0&&x.push({group:h,subGroups:b(m,h.color,h.id)})}const w=new Map,f=new Map;for(const h of e){const m=l[h.kind]??h.layer,D=s[h.kind];Kt(h.kind,m,D)||ar(h,n,d)&&(a&&!h.name.toLowerCase().includes(a)&&!h.kind.toLowerCase().includes(a)||(w.has(h.kind)||w.set(h.kind,[]),w.get(h.kind).push(h)))}if(w.size>0){const h="#64748B";x.push({group:{id:"standard-sysml-diagram-elements",label:"Other — SysML Diagram Elements",color:h,kinds:[]},subGroups:[{id:"diagram-elements",label:"Diagram Elements",color:h,kinds:new Map([...w.entries()].map(([m,D])=>[m,or(D)]))}]})}for(const h of e){const m=l[h.kind]??h.layer,D=s[h.kind];if(Kt(h.kind,m,D))continue;const N=l[h.kind];N&&y.has(N)||N&&i.has(N)||ar(h,n,d)||a&&!h.name.toLowerCase().includes(a)&&!h.kind.toLowerCase().includes(a)||(f.has(h.kind)||f.set(h.kind,[]),f.get(h.kind).push(h))}if(f.size>0){const h="#F59E0B";x.push({group:{id:"undefined",label:"Undefined — Not in Ontology",color:h,kinds:[]},subGroups:b(f,h)})}return x}function sr({searchTerm:e}){var ce;const r=E(R=>R.model),n=E(R=>R.selectedElementId),o=E(R=>R.selectElement),a=E(R=>R.setActiveView),i=E(R=>R.selectedElementIds),l=E(R=>R.toggleElementSelection),s=E(R=>R.selectAllElements),c=E(R=>R.clearElementSelection),d=E(R=>R.updateElementFolder),u=E(R=>R.moveFolder),y=E(R=>R.validation),b=E(R=>R.availableOntologies),x=E(R=>R.setExplorerTab),w=E(R=>R.setActiveMode),f=E(R=>R.setSelectedOntologyKind),h=((ce=r==null?void 0:r.registries)==null?void 0:ce.kinds)??[],m=p.useCallback(R=>{o(R),a({type:"element-detail",elementId:R})},[o,a]),[D,N]=p.useState(new Set),[j,C]=p.useState(null),[S,I]=p.useState(null),v=p.useCallback((R,O)=>{O==null||O.stopPropagation(),N(_=>{const $=new Set(_);return $.has(R)?$.delete(R):$.add(R),$})},[]),L=p.useCallback((R,O,_,$)=>{R.preventDefault(),C({x:R.clientX,y:R.clientY,type:O,elementId:O==="element"?_:void 0,folderId:O==="folder"?_.replace("f:",""):void 0,kind:$||(O==="kind"?_.replace("k:","").split(":").pop():void 0)})},[]),W=p.useMemo(()=>{var R;return r?$s(Object.values(r.elements),e,((R=r.registries)==null?void 0:R.kinds)??[],b):[]},[r,e,b]);p.useEffect(()=>{const R=()=>{if(!e.trim())return;const _=new Set;for(const{group:$,subGroups:J}of W){_.add(`g:${$.id}`);for(const ee of J){ee.id&&_.add(`sg:${$.id}:${ee.id}`);for(const de of ee.kinds.keys())_.add(`k:${$.id}:${ee.id?`${ee.id}:`:""}${de}`)}}N(_)},O=()=>N(new Set);return window.addEventListener("memo:expand-explorer-search",R),window.addEventListener("memo:collapse-explorer-tree",O),()=>{window.removeEventListener("memo:expand-explorer-search",R),window.removeEventListener("memo:collapse-explorer-tree",O)}},[W,e]);const U=p.useCallback((R,O,_)=>{var $;I({id:O.id,kind:_}),R.dataTransfer.setData("application/memo-node",JSON.stringify({id:O.id,type:O.type,kind:_,name:O.name,elementId:($=O.element)==null?void 0:$.id,folderPath:O.type==="folder"?O.id.replace("f:",""):void 0})),R.dataTransfer.effectAllowed="move"},[]),T=p.useCallback((R,O)=>{(S==null?void 0:S.kind)===O&&(R.preventDefault(),R.dataTransfer.dropEffect="move")},[S]),K=p.useCallback((R,O,_)=>{R.preventDefault(),I(null);try{const $=JSON.parse(R.dataTransfer.getData("application/memo-node"));if($.kind!==_)return;if($.type==="element")d($.elementId,O);else if($.type==="folder"){if(O===$.folderPath||O.startsWith($.folderPath+"/"))return;const J=$.folderPath.includes("/")?$.folderPath.slice($.folderPath.lastIndexOf("/")+1):$.folderPath,ee=O?O+"/"+J:J;u($.kind,$.folderPath,ee)}}catch($){console.error("Drop error:",$)}},[d,u]),P=p.useMemo(()=>{const R=new Map;if(y)for(const O of y.violations)R.set(O.elementId,(R.get(O.elementId)||0)+1);return R},[y]),q=p.useMemo(()=>{const R=[],O=_=>{for(const $ of _)$.type==="element"&&$.element?R.push($.element.id):O($.children)};for(const{subGroups:_}of W)for(const $ of _)for(const J of $.kinds.values())O(J);return R},[W]),re=i.size;return t.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[re>0&&t.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 flex-shrink-0",style:{background:"#FFFBEB",borderBottom:"1px solid #FDE68A",fontSize:"12px"},children:[t.jsxs("span",{style:{color:"#92400E",fontWeight:600},children:[re," selected"]}),t.jsx("span",{style:{color:"#B45309"},children:"— Cmd/Ctrl+click to multi-select"}),t.jsx("button",{onClick:c,className:"ml-auto px-2 py-0.5 rounded",style:{color:"#92400E",background:"#FDE68A",fontSize:"12px",fontWeight:500},children:"Clear"})]}),e&&q.length>0&&t.jsxs("div",{className:"flex items-center gap-2 px-3 py-1",style:{background:"#F0F9FF",borderBottom:"1px solid #BAE6FD",fontSize:"12px"},children:[t.jsxs("span",{style:{color:"#0369A1"},children:[q.length," matching"]}),t.jsx("button",{onClick:()=>s(q),className:"ml-auto px-2 py-0.5 rounded",style:{color:"#0369A1",background:"#BAE6FD",fontSize:"12px",fontWeight:500},children:"Select All"})]}),t.jsxs("div",{className:"flex-1 overflow-y-auto py-1",style:{fontSize:F.explorer.item},children:[W.map(({group:R,subGroups:O})=>{const _=`g:${R.id}`,$=D.has(_),J=R.id==="undefined",ee=B=>B.reduce((A,V)=>A+(V.type==="element"?1:ee(V.children)),0),de=B=>Array.from(B.kinds.values()).reduce((A,V)=>A+ee(V),0),k=O.reduce((B,A)=>B+de(A),0);return t.jsxs("div",{className:"mb-0.5",children:[t.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1.5 cursor-pointer select-none",style:{margin:"0 4px",borderRadius:"4px",...J?{background:"#FFF3CD"}:{}},onMouseEnter:B=>B.currentTarget.style.background=J?"#FDE68A":"#F0F0ED",onMouseLeave:B=>B.currentTarget.style.background=J?"#FFF3CD":"transparent",onClick:()=>v(_),onContextMenu:B=>L(B,"group",_),children:[t.jsx(Te,{expanded:$,size:14,color:R.color}),J?t.jsx("span",{style:{fontSize:"14px",lineHeight:1,flexShrink:0},children:"⚠"}):t.jsx($e,{open:$,color:R.color}),t.jsx("span",{className:"font-semibold flex-1 truncate",style:{color:J?"#92400E":g.primary,fontSize:F.explorer.group},children:R.label}),t.jsx("span",{className:"px-1.5 py-0.5 rounded-full",style:{background:R.color+"25",color:R.color,fontSize:F.explorer.count,fontWeight:600,minWidth:"20px",textAlign:"center"},children:k})]}),(()=>{const B=(A,V,G)=>{const X=`k:${R.id}:${G?G+":":""}${A}`,z=D.has(X),ne=Y=>{var Z;for(const H of Y){if(H.type==="element")return(Z=H.element)==null?void 0:Z.layer;const oe=ne(H.children);if(oe)return oe}},Ee=ne(V),ue=J?"#F59E0B":Ee&&se[Ee]||R.color,Se=h.some(Y=>Y.name===A),le=Y=>Y.flatMap(Z=>Z.type==="element"&&Z.element?[Z.element.id]:le(Z.children)),De=le(V);return t.jsxs("div",{style:{marginLeft:"16px"},onDragOver:Y=>T(Y,A),onDrop:Y=>K(Y,"",A),children:[t.jsxs("div",{className:"group flex items-center gap-1.5 px-2 py-1 cursor-pointer select-none",style:{borderRadius:"4px",margin:"0 4px"},onMouseEnter:Y=>Y.currentTarget.style.background="#F0F0ED",onMouseLeave:Y=>Y.currentTarget.style.background="transparent",onClick:()=>v(X),onContextMenu:Y=>L(Y,"kind",X,A),children:[t.jsx(Te,{expanded:z,size:12,color:g.muted}),t.jsx($e,{open:z,color:ue}),t.jsxs("span",{className:"font-medium flex-1 truncate",style:{color:J?"#B45309":g.secondary,fontSize:F.explorer.kind},children:[Os(A,De.length),J&&t.jsx("span",{style:{color:"#F59E0B",marginLeft:"4px"},children:"·"})]}),t.jsxs("div",{className:"flex max-w-0 items-center gap-1 overflow-hidden opacity-0 invisible pointer-events-none transition-all duration-150 group-hover:max-w-[4.5rem] group-hover:opacity-100 group-hover:visible group-hover:pointer-events-auto",children:[t.jsx("button",{onClick:Y=>{Y.stopPropagation(),s(De)},title:"Select all elements of this type","aria-label":"Select all elements of this type",className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-md hover:bg-slate-100",style:{color:g.faint,fontSize:"17px"},children:"☑"}),Se&&ae("ontology")&&t.jsx("button",{onClick:Y=>{Y.stopPropagation();for(const Z of b)for(const H of Z.layers)if(H.kinds.some(oe=>oe.name===A)){f(A),x("ontologies"),w("ontology"),a({type:"ontology-detail",packageName:Z.name,layerId:H.id});return}},title:"View type in Ontology","aria-label":"View type in Ontology",className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-md hover:bg-slate-100",style:{color:g.faint,fontSize:"17px"},children:"⬡"})]}),t.jsx(un,{count:De.length,color:ue,title:`${De.length} ${De.length===1?"element":"elements"}`})]}),z&&t.jsx(eo,{nodes:V,level:0,expanded:D,toggleExpand:v,selectedElementId:n,selectElement:m,selectedElementIds:i,toggleElementSelection:l,violationCounts:P,baseColor:ue,onContextMenu:(Y,Z,H)=>L(Y,Z,H,A),onDragStart:(Y,Z)=>U(Y,Z,A),onDrop:(Y,Z)=>K(Y,Z,A),isUndefined:J})]},A)};return $?O.map(A=>{if(!A.id)return t.jsx("div",{children:Array.from(A.kinds.entries()).map(([z,ne])=>B(z,ne,""))},"__root");const V=`sg:${R.id}:${A.id}`,G=D.has(V),X=de(A);return t.jsxs("div",{style:{marginLeft:"16px"},children:[t.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1 cursor-pointer select-none",style:{borderRadius:"4px",margin:"0 4px"},onMouseEnter:z=>z.currentTarget.style.background="#F0F0ED",onMouseLeave:z=>z.currentTarget.style.background="transparent",onClick:()=>v(V),children:[t.jsx(Te,{expanded:G,size:13,color:A.color}),t.jsx($e,{open:G,color:A.color}),t.jsx("span",{className:"font-semibold flex-1 truncate",style:{color:g.primary,fontSize:F.explorer.kind},children:A.label}),t.jsx("span",{className:"px-1.5 py-0.5 rounded-full",style:{background:A.color+"25",color:A.color,fontSize:F.explorer.count,fontWeight:600,minWidth:"20px",textAlign:"center"},children:X})]}),G&&Array.from(A.kinds.entries()).map(([z,ne])=>B(z,ne,A.id))]},A.id)}):null})()]},R.id)}),j&&t.jsx(Ms,{menu:j,onClose:()=>C(null)})]})]})}function Ws({diagram:e}){const r=e.viewKind?Fn[e.viewKind]:void 0;if(r)return t.jsx("span",{className:"px-1.5 py-0.5 rounded font-semibold",style:{background:r.color+"20",color:r.color,fontSize:F.badge},title:r.fullName,children:r.label});const n=["afd","ofd","ffd"].includes(e.diagramType.toLowerCase())?ps(e):e.diagramType,o=Le[n];return o?t.jsx("span",{className:"px-1.5 py-0.5 rounded font-semibold",style:{background:o.color+"20",color:o.color,fontSize:F.badge},title:o.fullName,children:o.code}):null}function _s({viewpointId:e,onClose:r}){const n=E(d=>d.createDiagram),[o,a]=p.useState("Untitled"),[i,l]=p.useState("bdd"),s=p.useRef(null);p.useEffect(()=>{const d=u=>{s.current&&!s.current.contains(u.target)&&r()};return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[r]);const c=()=>{o.trim()&&(n({name:o.trim(),diagramType:i,viewpointId:e}),r())};return t.jsxs("div",{ref:s,className:"fixed z-50 rounded-lg overflow-hidden py-3 px-4",style:{top:"50%",left:"50%",transform:"translate(-50%, -50%)",background:"#FFFFFF",border:"1px solid #E5E7EB",boxShadow:"0 8px 32px rgba(0,0,0,0.16)",minWidth:"300px"},children:[t.jsx("div",{className:"font-semibold mb-3",style:{color:g.primary,fontSize:"13px"},children:"New Model View"}),t.jsx("label",{className:"block mb-1",style:{fontSize:F.xs,color:g.secondary},children:"Name"}),t.jsx("input",{autoFocus:!0,value:o,onChange:d=>a(d.target.value),onKeyDown:d=>{d.key==="Enter"&&c(),d.key==="Escape"&&r()},className:"w-full px-3 py-2 rounded-lg mb-3 focus:outline-none",style:{background:"#F9F9F8",border:"1px solid #E5E7EB",color:g.primary,fontSize:"13px"}}),t.jsx("label",{className:"block mb-1",style:{fontSize:F.xs,color:g.secondary},children:"Type"}),t.jsx("select",{value:i,onChange:d=>l(d.target.value),className:"w-full px-3 py-2 rounded-lg mb-4 focus:outline-none",style:{background:"#F9F9F8",border:"1px solid #E5E7EB",color:g.primary,fontSize:"13px"},children:Object.entries(Le).map(([d,u])=>t.jsxs("option",{value:d,children:[u.fullName," (",u.code,")"]},d))}),t.jsxs("div",{className:"flex gap-2 justify-end",children:[t.jsx("button",{onClick:r,className:"px-3 py-1.5 rounded",style:{fontSize:"12px",color:g.secondary,background:"#F0F0ED"},children:"Cancel"}),t.jsx("button",{onClick:c,className:"px-3 py-1.5 rounded font-medium",style:{fontSize:"12px",color:"#FFFFFF",background:g.accent},children:"Create"})]})]})}const qs=new Set(["__unassigned","__model"]),xe="__uncategorized";function no(e){const r=n=>n.explorerLane==="architecture"?0:n.explorerLane==="assurance"?1:2;return e.slice().sort((n,o)=>{const a=r(n)-r(o);if(a!==0)return a;if(r(n)<2){const i=(n.explorerOrder??Number.MAX_SAFE_INTEGER)-(o.explorerOrder??Number.MAX_SAFE_INTEGER);if(i!==0)return i}return n.label.localeCompare(o.label)})}function ro(e){if(e.length<2)return e;const r=e[0].split(" ");if(r.length<2)return e;const n=r[0];return e.every(a=>{const i=a.split(" ");return i.length>1&&i[0]===n})?e.map(a=>a.slice(n.length+1)):e}function Hs(e){const r=no(((e==null?void 0:e.viewpoints)??[]).filter(o=>!qs.has(o.id))),n=new Set;for(const o of r)for(const a of Gr(e,o.id))n.add(a.id);return{viewpoints:r,uncategorized:((e==null?void 0:e.diagrams)??[]).filter(o=>!n.has(o.id))}}function Ks({searchTerm:e}){const r=E(j=>j.model),n=E(j=>j.activeView),o=E(j=>j.setActiveView),a=E(j=>j.selectViewpoint),i=E(j=>j.deleteDiagram),[l,s]=p.useState(new Set),[c,d]=p.useState(null),u=j=>{s(C=>{const S=new Set(C);return S.has(j)?S.delete(j):S.add(j),S})},{viewpoints:y,uncategorized:b}=p.useMemo(()=>Hs(r),[r]),x=p.useMemo(()=>ro(y.map(j=>j.label)),[y]),w=j=>{if(!e)return j;const C=e.toLowerCase();return j.filter(S=>S.name.toLowerCase().includes(C)||S.diagramType.toLowerCase().includes(C))},f=n.type==="diagram"?n.diagramId:null,h=w(b.filter(j=>!j.id.startsWith("diag-layer-"))),m=p.useMemo(()=>{const j=new Map;for(const C of h){const I=[...(C.elementIds??[]).map(v=>{var L;return(L=r==null?void 0:r.elements[v])==null?void 0:L.layer}).filter(v=>!!v)].sort((v,L)=>{const W=Qe.indexOf(v),U=Qe.indexOf(L);return(W<0?Number.MAX_SAFE_INTEGER:W)-(U<0?Number.MAX_SAFE_INTEGER:U)})[0]??"other";j.set(I,[...j.get(I)??[],C])}return[...j.entries()].sort(([C],[S])=>{const I=Qe.indexOf(C),v=Qe.indexOf(S);return(I<0?Number.MAX_SAFE_INTEGER:I)-(v<0?Number.MAX_SAFE_INTEGER:v)})},[h,r==null?void 0:r.elements]),D=(j,C)=>j.map(S=>t.jsx(Gs,{diag:S,isSelected:f===S.id,onSelect:()=>{o({type:"diagram",diagramId:S.id}),a(C==="__model"?null:C)},onDelete:S.auto?void 0:()=>i(S.id)},S.id)),N=(j,C)=>{const S=v=>v.group;if(!j.some(v=>S(v)))return D(j,C);const I=new Map;for(const v of j){const L=S(v)||"Other";I.set(L,[...I.get(L)??[],v])}return[...I.entries()].sort(([v],[L])=>v.localeCompare(L)).map(([v,L])=>t.jsxs("div",{style:{margin:"5px 4px 2px"},children:[t.jsx("div",{className:"px-2 py-1 font-semibold",style:{color:g.muted,fontSize:F.xs},children:v}),t.jsx("div",{style:{marginLeft:"8px"},children:D(L,C)})]},v))};return t.jsxs("div",{className:"flex-1 overflow-y-auto py-1",style:{fontSize:F.explorer.item},children:[y.map((j,C)=>{var W;const S=l.has(j.id),I=(W=j.visibleLayers)!=null&&W[0]&&se[j.visibleLayers[0]]||g.muted,v=Gr(r,j.id),L=w(v.filter(U=>!U.id.startsWith("diag-layer-")));return t.jsxs("div",{className:"mb-0.5",children:[t.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1.5 cursor-pointer select-none",style:{borderRadius:"4px",margin:"0 4px"},onMouseEnter:U=>U.currentTarget.style.background="#F0F0ED",onMouseLeave:U=>U.currentTarget.style.background="transparent",onClick:()=>{a(j.id),u(j.id)},children:[t.jsx(Te,{expanded:S,size:14,color:I}),t.jsx($e,{open:S,color:I}),t.jsx("span",{className:"font-semibold flex-1 truncate",style:{color:g.primary,fontSize:F.explorer.group},children:x[C]}),t.jsx(un,{count:v.length,color:I,title:`${v.length} views`})]}),S&&t.jsxs("div",{style:{marginLeft:"16px"},children:[N(L,j.id),t.jsxs("button",{className:"flex items-center gap-1 px-2 py-1 w-full text-left",style:{borderRadius:"4px",margin:"2px 4px",color:g.accent,fontSize:F.xs,background:"transparent"},onMouseEnter:U=>U.currentTarget.style.background=g.accent+"12",onMouseLeave:U=>U.currentTarget.style.background="transparent",onClick:()=>d(j.id),children:[t.jsx("span",{style:{fontSize:"14px",lineHeight:1},children:"+"})," New View"]})]})]},j.id)}),h.length>0&&t.jsxs("div",{className:"mb-0.5",children:[t.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1.5 cursor-pointer select-none",style:{borderRadius:"4px",margin:"0 4px"},onMouseEnter:j=>j.currentTarget.style.background="#F0F0ED",onMouseLeave:j=>j.currentTarget.style.background="transparent",onClick:()=>{a(null),u(xe)},children:[t.jsx(Te,{expanded:l.has(xe),size:14,color:g.muted}),t.jsx($e,{open:l.has(xe),color:g.muted}),t.jsx("span",{className:"font-semibold flex-1",style:{color:g.primary,fontSize:F.explorer.group},children:"Uncategorized"}),t.jsx("span",{title:"These views conform to no viewpoint. Bind one with viewpointDefinition to file them.",style:{color:g.faint,fontSize:F.badge},children:"no viewpoint"}),t.jsx(un,{count:h.length,color:g.muted,title:`${h.length} views`})]}),l.has(xe)&&t.jsxs("div",{style:{marginLeft:"16px"},children:[h.some(j=>j.group)?N(h,xe):m.map(([j,C])=>t.jsxs("div",{style:{margin:"5px 4px 2px"},children:[t.jsx("div",{className:"px-2 py-1 font-semibold",style:{color:se[j]??g.muted,fontSize:F.xs,borderLeft:`3px solid ${se[j]??g.border}`},children:lt[j]??`${j.charAt(0).toUpperCase()}${j.slice(1)}`}),t.jsx("div",{style:{marginLeft:"8px"},children:D(C,xe)})]},j)),t.jsxs("button",{className:"flex items-center gap-1 px-2 py-1 w-full text-left",style:{borderRadius:"4px",margin:"2px 4px",color:g.accent,fontSize:F.xs,background:"transparent"},onMouseEnter:j=>j.currentTarget.style.background=g.accent+"12",onMouseLeave:j=>j.currentTarget.style.background="transparent",onClick:()=>d("__model"),children:[t.jsx("span",{style:{fontSize:"14px",lineHeight:1},children:"+"})," New View"]})]})]}),c!==null&&t.jsx(_s,{viewpointId:c,onClose:()=>d(null)})]})}function Gs({diag:e,isSelected:r,onSelect:n,onDelete:o}){var s;const[a,i]=p.useState(!1);Le[e.diagramType];const l=((s=e.elementIds)==null?void 0:s.length)??0;return t.jsxs("div",{className:"flex items-center gap-2 px-2 py-1 cursor-pointer group",style:{borderRadius:"4px",margin:"0 4px",background:r?g.accent+"18":a?"#F0F0ED":"transparent",fontSize:F.explorer.item},onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),onClick:n,title:e.description,children:[t.jsx(Ws,{diagram:e}),e.auto&&!e.sourceFile&&t.jsx("span",{className:"px-1 py-0.5 rounded",style:{background:"#F0F0ED",color:g.faint,fontSize:F.badge,fontWeight:600},children:"AUTO"}),t.jsx("span",{className:"flex-1",style:{minWidth:0},children:t.jsxs("span",{className:"truncate block",style:{color:r?g.accentDark:g.primary},children:[t.jsxs("span",{style:{color:g.muted},children:["[",e.shortId??e.id,"] "]}),e.name]})}),l>0&&t.jsx("span",{className:"px-1.5 py-0.5 rounded-full",style:{background:"#F0F0ED",color:g.muted,fontSize:F.explorer.count,fontWeight:600,minWidth:"18px",textAlign:"center"},children:l}),o&&a&&t.jsx("button",{onClick:c=>{c.stopPropagation(),o()},title:"Delete diagram",style:{background:"none",border:"none",cursor:"pointer",color:"#DC2626",fontSize:"12px",padding:"0 2px",lineHeight:1},children:"×"})]})}function Ys(){const e=E(m=>m.setActiveView),r=E(m=>m.activeView),n=E(m=>m.dhfDocuments),o=E(m=>m.addDhfDocument),a=E(m=>m.removeDhfDocument),i=E(m=>m.dhfSettings),[l,s]=p.useState(new Set(Ve.map(m=>m.id))),[c,d]=p.useState(null),[u,y]=p.useState(null),b=r.type==="dhf-document"?r.docId:null,x=p.useMemo(()=>{const m=new Set(Ve.map(D=>D.label));return[...new Set(n.map(D=>D.group))].filter(D=>D&&!m.has(D)).sort()},[n]);function w(m){s(D=>{const N=new Set(D);return N.has(m)?N.delete(m):N.add(m),N})}function f(m,D){m.preventDefault(),m.stopPropagation(),y({x:m.clientX,y:m.clientY,groupId:D})}function h(m){const D=i.documentNumberingPrefix||"DOC",N=[];for(const j of m){const C=`${D}-${j.prefix}-`,S=[...n,...N].filter(T=>T.id.startsWith(C)),I=`${C}${String(S.length+1).padStart(3,"0")}`,v=T=>T.replace(/^---[\s\S]*?---\n?/,""),L=j.content!==null?v(j.content):(()=>{const T=Cs(j.templateId);return T?v(T):`# ${j.title}
25
-
26
- _[TODO: Add content]_
27
- `})(),W=`---
28
- id: ${I}
29
- title: ${j.title}
30
- template: ${j.templateId}
31
- ---
32
-
33
- ${L}`,U={id:I,title:j.title,group:j.groupLabel,templateId:j.templateId,content:W,createdAt:Date.now(),authors:"",approvers:""};o(U),N.push(U),N.length===1&&e({type:"dhf-document",docId:U.id})}d(null)}return p.useEffect(()=>{if(!u)return;function m(){y(null)}return window.addEventListener("click",m),()=>window.removeEventListener("click",m)},[u]),t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex-1 overflow-y-auto py-1",children:[t.jsx("div",{style:{padding:"4px 10px 8px"},children:t.jsxs("button",{onClick:()=>d({}),style:{width:"100%",padding:"7px 10px",borderRadius:"6px",border:"none",background:g.accentDark,fontSize:F.explorer.item,fontWeight:600,color:"#fff",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",gap:"6px"},onMouseEnter:m=>{m.currentTarget.style.background="#254B60"},onMouseLeave:m=>{m.currentTarget.style.background=g.accentDark},children:[t.jsx("span",{style:{fontSize:"14px",lineHeight:1},children:"+"})," New Document"]})}),Ve.filter(m=>n.some(D=>D.group===m.label)).map(m=>{const D=l.has(m.id),N=n.filter(j=>j.group===m.label);return t.jsxs("div",{children:[t.jsxs("button",{onClick:()=>w(m.id),onContextMenu:j=>f(j,m.id),className:"w-full flex items-center gap-2 px-3 py-2 text-left",style:{fontSize:F.xs,fontWeight:600,color:g.secondary,borderRadius:"4px"},onMouseEnter:j=>j.currentTarget.style.background=g.surfaceAlt,onMouseLeave:j=>j.currentTarget.style.background="transparent",title:"Right-click to add documents",children:[t.jsx("span",{style:{display:"inline-block",width:"7px",height:"7px",borderRadius:"50%",background:m.color,flexShrink:0}}),t.jsx("span",{className:"flex-1 uppercase tracking-wide",style:{fontSize:"10px"},children:m.label}),N.length>0&&t.jsx("span",{style:{fontSize:"10px",color:m.color,fontWeight:700},children:N.length}),t.jsx(Te,{expanded:D,size:11})]}),D&&N.map(j=>{const C=b===j.id;return t.jsxs("div",{style:{display:"flex",alignItems:"center",paddingLeft:"28px",paddingRight:"4px",background:C?`${m.color}18`:"transparent",borderLeft:C?`2px solid ${m.color}`:"2px solid transparent",cursor:"pointer"},onMouseEnter:S=>{C||(S.currentTarget.style.background=g.surfaceAlt)},onMouseLeave:S=>{S.currentTarget.style.background=C?`${m.color}18`:"transparent"},children:[t.jsxs("button",{onClick:()=>e({type:"dhf-document",docId:j.id}),style:{flex:1,display:"flex",alignItems:"center",gap:"6px",background:"none",border:"none",padding:"5px 0",fontSize:F.explorer.element,color:C?m.color:g.primary,fontWeight:C?600:400,cursor:"pointer",textAlign:"left"},children:[t.jsx(mn,{color:m.color}),t.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:j.id})]}),t.jsx("button",{onClick:S=>{S.stopPropagation(),a(j.id)},title:"Remove document",style:{background:"none",border:"none",cursor:"pointer",color:"#9CA3AF",padding:"2px 4px",borderRadius:"3px",fontSize:"12px",opacity:0,transition:"opacity 0.1s"},onMouseEnter:S=>{S.currentTarget.style.opacity="1",S.currentTarget.style.color="#ef4444"},onMouseLeave:S=>{S.currentTarget.style.opacity="0",S.currentTarget.style.color="#9CA3AF"},children:"×"})]},j.id)})]},m.id)}),x.map(m=>{const D=`custom:${m}`,N=l.has(D),j=Ds(m),C=n.filter(S=>S.group===m);return t.jsxs("div",{children:[t.jsxs("button",{onClick:()=>w(D),className:"w-full flex items-center gap-2 px-3 py-2 text-left",style:{fontSize:F.xs,fontWeight:600,color:g.secondary,borderRadius:"4px"},onMouseEnter:S=>S.currentTarget.style.background=g.surfaceAlt,onMouseLeave:S=>S.currentTarget.style.background="transparent",children:[t.jsx("span",{style:{display:"inline-block",width:"7px",height:"7px",borderRadius:"50%",background:j,flexShrink:0}}),t.jsx("span",{className:"flex-1 uppercase tracking-wide",style:{fontSize:"10px"},children:m}),t.jsx("span",{style:{fontSize:"10px",color:j,fontWeight:700},children:C.length}),t.jsx(Te,{expanded:N,size:11})]}),N&&C.map(S=>{const I=b===S.id;return t.jsxs("div",{style:{display:"flex",alignItems:"center",paddingLeft:"28px",paddingRight:"4px",background:I?`${j}18`:"transparent",borderLeft:I?`2px solid ${j}`:"2px solid transparent",cursor:"pointer"},onMouseEnter:v=>{I||(v.currentTarget.style.background=g.surfaceAlt)},onMouseLeave:v=>{v.currentTarget.style.background=I?`${j}18`:"transparent"},children:[t.jsxs("button",{onClick:()=>e({type:"dhf-document",docId:S.id}),style:{flex:1,display:"flex",alignItems:"center",gap:"6px",background:"none",border:"none",padding:"5px 0",fontSize:F.explorer.element,color:I?j:g.primary,fontWeight:I?600:400,cursor:"pointer",textAlign:"left"},children:[t.jsx(mn,{color:j}),t.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:S.id})]}),t.jsx("button",{onClick:v=>{v.stopPropagation(),a(S.id)},title:"Remove document",style:{background:"none",border:"none",cursor:"pointer",color:"#9CA3AF",padding:"2px 4px",borderRadius:"3px",fontSize:"12px",opacity:0,transition:"opacity 0.1s"},onMouseEnter:v=>{v.currentTarget.style.opacity="1",v.currentTarget.style.color="#ef4444"},onMouseLeave:v=>{v.currentTarget.style.opacity="0",v.currentTarget.style.color="#9CA3AF"},children:"×"})]},S.id)})]},D)}),n.length===0&&t.jsxs("div",{style:{padding:"16px 14px",fontSize:"11px",color:"#9CA3AF",lineHeight:"1.6"},children:["No documents yet. Use ",t.jsx("strong",{children:"+ New Document"})," to create one from a meMO template, a reusable project template, a new template, or a blank page."]})]}),u&&t.jsx("div",{style:{position:"fixed",zIndex:9998,left:u.x,top:u.y,background:"#fff",borderRadius:"8px",border:"1px solid #E5E7EB",boxShadow:"0 8px 24px rgba(0,0,0,0.12)",padding:"4px 0",minWidth:"160px"},onClick:m=>m.stopPropagation(),children:t.jsx("button",{onClick:()=>{d({initialGroupId:u.groupId}),y(null)},style:{display:"block",width:"100%",padding:"8px 14px",background:"none",border:"none",textAlign:"left",fontSize:"13px",color:"#1B3A4B",cursor:"pointer"},onMouseEnter:m=>m.currentTarget.style.background="#F3F4F6",onMouseLeave:m=>m.currentTarget.style.background="none",children:"Add document…"})}),c&&t.jsx(As,{initialGroupId:c.initialGroupId,existingDocs:n,numberingPrefix:i.documentNumberingPrefix||"DOC",onCreate:h,onClose:()=>d(null)})]})}const oo="memo-explorer-width",tt=300,nt=240,fn=720,Js=320;function Gt(){return typeof window>"u"||!window.innerWidth?fn:Math.max(nt,Math.min(fn,window.innerWidth-Js))}function Xs(e){return Number.isFinite(e)?Math.min(fn,Math.max(nt,e)):tt}function Qs(){if(typeof window>"u")return tt;try{const e=Number.parseInt(localStorage.getItem(oo)??"",10);return Number.isFinite(e)?Xs(e):tt}catch{return tt}}function Zs(){var N,j,C;const e=E(S=>S.sidebarCollapsed),r=E(S=>S.toggleSidebar);E(S=>S.explorerTab);const n=E(S=>S.setExplorerTab),o=E(S=>S.searchTerm),a=E(S=>S.setSearchTerm),i=E(S=>S.model),l=E(S=>S.activeMode),s=E(S=>S.activeView),c=s.type==="diagram"&&((j=(N=i==null?void 0:i.diagrams)==null?void 0:N.find(S=>S.id===s.diagramId))==null?void 0:j.viewpointId)&&((C=i.diagrams.find(S=>S.id===s.diagramId))==null?void 0:C.viewpointId)!=="__model",d=c||l==="diagram"?"Viewpoints":"Model Explorer",[u,y]=p.useState(Qs),[b,x]=p.useState(Gt),w=Math.min(u,b),f=p.useRef(null),h=p.useCallback(S=>{y(Math.max(nt,Math.min(Gt(),S)))},[]),m=p.useCallback(()=>{var S;(S=f.current)==null||S.call(f),f.current=null},[]),D=p.useCallback(S=>{if(S.button!==0)return;S.preventDefault(),m();const I=S.clientX,v=w,L=document.body.style.cursor,W=document.body.style.userSelect;document.body.style.cursor="col-resize",document.body.style.userSelect="none";const U=K=>{h(v+K.clientX-I)},T=()=>{window.removeEventListener("pointermove",U),window.removeEventListener("pointerup",T),window.removeEventListener("pointercancel",T),document.body.style.cursor=L,document.body.style.userSelect=W,f.current=null};f.current=T,window.addEventListener("pointermove",U),window.addEventListener("pointerup",T),window.addEventListener("pointercancel",T)},[h,w,m]);return p.useEffect(()=>{try{localStorage.setItem(oo,String(Math.round(u)))}catch{}},[u]),p.useEffect(()=>{const S=()=>x(Gt());return window.addEventListener("resize",S),()=>{window.removeEventListener("resize",S),m()}},[m]),p.useEffect(()=>{(s.type==="ontology"||s.type==="ontology-detail")&&n("ontologies")},[s.type]),e?t.jsxs("button",{type:"button",className:"flex flex-col items-center py-2 gap-1 flex-shrink-0",onClick:r,title:`Expand ${d}`,"aria-label":`Expand ${d}`,style:{width:36,background:"#FAFAF8",border:"none",borderRight:`1px solid ${g.border}`,cursor:"pointer"},children:[t.jsx("span",{style:{color:g.muted,fontSize:18,lineHeight:1},children:"›"}),t.jsx("span",{style:{color:g.muted,fontSize:10,writingMode:"vertical-rl"},children:d})]}):t.jsxs("div",{className:"flex flex-col overflow-hidden flex-shrink-0",style:{position:"relative",width:`${w}px`,background:g.surface,borderRight:`1px solid ${g.border}`},children:[t.jsxs("div",{className:"flex items-center justify-between px-3 py-2",style:{background:g.surfaceAlt,borderBottom:`1px solid ${g.border}`,flexShrink:0},children:[t.jsx("span",{style:{fontSize:F.xs,fontWeight:600,color:"#374151"},children:d}),t.jsx("button",{type:"button",onClick:r,title:`Collapse ${d}`,"aria-label":`Collapse ${d}`,style:{width:28,height:28,border:`1px solid ${g.border}`,borderRadius:5,background:"#FFFFFF",color:g.muted,cursor:"pointer",fontSize:18,lineHeight:1},children:"‹"})]}),s.type==="diagram"&&!c?t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"px-3 py-2",style:{borderBottom:`1px solid ${g.border}`},children:t.jsxs("div",{className:"flex gap-1",children:[t.jsx("input",{type:"text",placeholder:"Search elements...",value:o,onChange:S=>a(S.target.value),onKeyDown:S=>{S.key==="Enter"&&window.dispatchEvent(new Event("memo:expand-explorer-search"))},className:"flex-1 min-w-0 px-3 py-2 rounded-lg focus:outline-none",style:{background:g.surfaceAlt,border:`1px solid ${g.border}`,color:g.primary,fontSize:F.explorer.search}}),t.jsx("button",{onClick:()=>window.dispatchEvent(new Event("memo:collapse-explorer-tree")),title:"Collapse all Explorer groups","aria-label":"Collapse all Explorer groups",className:"rounded-lg flex items-center justify-center flex-shrink-0",style:{width:28,background:g.surfaceAlt,border:`1px solid ${g.border}`,color:g.secondary,cursor:"pointer"},children:t.jsx(rr,{})})]})}),t.jsx(sr,{searchTerm:o})]}):l==="dashboard"?t.jsx(Es,{}):l==="dhf"?t.jsx(Ys,{}):l==="diagram"||c?t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"px-3 py-2",style:{borderBottom:`1px solid ${g.border}`},children:t.jsx("input",{type:"text",placeholder:"Search viewpoints and views...",value:o,onChange:S=>a(S.target.value),className:"w-full px-3 py-2 rounded-lg focus:outline-none",style:{background:g.surfaceAlt,border:`1px solid ${g.border}`,color:g.primary,fontSize:F.explorer.search}})}),t.jsx(Ks,{searchTerm:o})]}):l==="ontology"?t.jsx(ks,{}):l==="scenario"?t.jsx(p.Suspense,{fallback:t.jsx("div",{className:"p-3",style:{color:g.faint,fontSize:F.explorer.item},children:"Loading use cases…"}),children:t.jsx(Ts,{explorerOnly:!0})}):t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"px-3 py-2",style:{borderBottom:`1px solid ${g.border}`},children:t.jsxs("div",{className:"flex gap-1",children:[t.jsx("input",{type:"text",placeholder:"Search elements...",value:o,onChange:S=>a(S.target.value),onKeyDown:S=>{S.key==="Enter"&&window.dispatchEvent(new Event("memo:expand-explorer-search"))},className:"flex-1 min-w-0 px-3 py-2 rounded-lg focus:outline-none",style:{background:g.surfaceAlt,border:`1px solid ${g.border}`,color:g.primary,fontSize:F.explorer.search}}),t.jsx("button",{onClick:()=>window.dispatchEvent(new Event("memo:collapse-explorer-tree")),title:"Collapse all Explorer groups","aria-label":"Collapse all Explorer groups",className:"rounded-lg flex items-center justify-center flex-shrink-0",style:{width:28,background:g.surfaceAlt,border:`1px solid ${g.border}`,color:g.secondary,cursor:"pointer"},children:t.jsx(rr,{})})]})}),t.jsx(sr,{searchTerm:o})]}),t.jsx("div",{className:"memo-explorer-resizer",role:"separator","aria-label":"Resize Model Explorer","aria-orientation":"vertical","aria-valuemin":nt,"aria-valuemax":b,"aria-valuenow":Math.round(w),tabIndex:0,title:"Drag to resize · Double-click to reset",onPointerDown:D,onDoubleClick:()=>h(tt),onKeyDown:S=>{S.key==="ArrowLeft"?(S.preventDefault(),h(w-20)):S.key==="ArrowRight"?(S.preventDefault(),h(w+20)):S.key==="Home"?(S.preventDefault(),h(nt)):S.key==="End"&&(S.preventDefault(),h(b))}})]})}const lr="#E5E5E0",Yt="#2DD4A8",Nt=40;function dr(e,r){var i;const n=e.id.toLowerCase(),o=((i=e.shortId)==null?void 0:i.toLowerCase())??"",a=e.name.toLowerCase();return n===r||o===r?0:n.startsWith(r)||o.startsWith(r)?1:a.startsWith(r)?2:n.includes(r)||a.includes(r)?3:4}function el(e,r){const n=r.query.trim().toLowerCase();return n?Object.values(e).filter(o=>o.id!==r.excludeId).filter(o=>[o.id,o.shortId,o.name,o.kind].filter(Boolean).join(" ").toLowerCase().includes(n)).sort((o,a)=>dr(o,n)-dr(a,n)||o.name.localeCompare(a.name)).slice(0,r.limit??Nt):[]}function tl(e){const r=new Map;for(const n of e){let o=r.get(n.kind);o||(o={kind:n.kind,layer:n.layer,elements:[]},r.set(n.kind,o)),o.elements.push(n)}return[...r.values()]}function nl(e,r){return el(e,{query:r.query,excludeId:r.source.id,limit:Object.keys(e).length}).filter(n=>zr(r.source,n,r.registries).length>0).slice(0,r.limit??Nt)}function rl({element:e,model:r,registries:n,enabled:o,onCreate:a}){var W;const[i,l]=p.useState(""),[s,c]=p.useState(!1),[d,u]=p.useState(0),[y,b]=p.useState(null),[x,w]=p.useState(null),f=p.useRef(null),h=p.useRef(null);p.useEffect(()=>{l(""),b(null),w(null),c(!1),u(0)},[e.id]);const m=p.useMemo(()=>nl(r.elements,{query:i,source:e,registries:n}),[r.elements,e,i,n]),D=p.useMemo(()=>tl(m),[m]),N=p.useMemo(()=>D.flatMap(U=>U.elements),[D]);p.useEffect(()=>{u(0)},[i]),p.useEffect(()=>{var U,T;s&&((T=(U=h.current)==null?void 0:U.querySelector('[data-active="true"]'))==null||T.scrollIntoView({block:"nearest"}))},[d,s]);const j=p.useCallback(U=>{b(U),l(U.name||U.id),c(!1),w(null)},[]),C=p.useCallback(()=>{l(""),b(null),w(null),c(!1)},[]),S=p.useMemo(()=>y?zr(e,y,n):[],[e,y,n]);p.useEffect(()=>{w(S.length===1?S[0]:null)},[S]);const I=p.useMemo(()=>!x||!y?null:{type:x.definition.name,sourceId:x.sourceId,targetId:x.targetId,direction:x.direction},[x,y]),v=p.useCallback(U=>{if(U.key==="Escape"){if(s){c(!1);return}C();return}if(!s||N.length===0){U.key==="ArrowDown"&&N.length>0&&(U.preventDefault(),c(!0));return}if(U.key==="ArrowDown")U.preventDefault(),u(T=>(T+1)%N.length);else if(U.key==="ArrowUp")U.preventDefault(),u(T=>(T-1+N.length)%N.length);else if(U.key==="Enter"){U.preventDefault();const T=N[d];T&&j(T)}},[s,N,d,j,C]),L=(W=N[d])==null?void 0:W.id;return t.jsxs("div",{className:"mt-1.5",style:{opacity:o?1:.6},children:[t.jsx("div",{className:"relative",children:y?t.jsxs("div",{className:"flex items-center gap-1.5",style:{width:"fit-content",maxWidth:"100%",minHeight:28,padding:"3px 5px 3px 8px",borderRadius:14,background:"#E1F5EE",border:`1px solid ${Yt}`,color:"#0F766E"},children:[t.jsx("span",{className:"truncate",style:{fontSize:F.xs,fontWeight:650},children:y.name}),t.jsx("span",{style:{fontSize:9,color:"#6B7280"},children:y.kind}),t.jsx("button",{type:"button","aria-label":`Remove ${y.name} from new relationship`,onClick:C,style:{width:18,height:18,border:0,borderRadius:9,background:"#FFFFFFAA",color:"#0F766E",cursor:"pointer",lineHeight:1},children:"×"})]}):t.jsxs(t.Fragment,{children:[t.jsx("input",{ref:f,value:i,disabled:!o,onChange:U=>{l(U.target.value),b(null),w(null),c(!0)},onFocus:()=>{i.trim()&&!y&&c(!0)},onBlur:()=>{window.setTimeout(()=>c(!1),120)},onKeyDown:v,placeholder:o?"Link to… type an element ID or name":"Connect to the dev server to author relationships","aria-label":"Link this element to another","aria-expanded":s,"aria-controls":"memo-quick-add-matches","aria-activedescendant":s&&L?`memo-quick-add-${L}`:void 0,role:"combobox",autoComplete:"off",className:"w-full px-2 py-1 rounded focus:outline-none",style:{fontSize:F.xs,background:"#FFFFFF",border:`1px solid ${y?Yt:lr}`,color:"#374151"}}),s&&i.trim()&&t.jsxs("div",{id:"memo-quick-add-matches",ref:h,role:"listbox",className:"absolute left-0 right-0 z-20 mt-1 rounded overflow-y-auto",style:{maxHeight:240,background:"#FFFFFF",border:`1px solid ${lr}`,boxShadow:"0 8px 24px rgba(15,23,42,0.14)"},children:[N.length===0?t.jsxs("div",{className:"px-2 py-2",style:{fontSize:F.xs,color:"#9CA3AF"},children:["No MEMO-legal trace target matches “",i.trim(),"”."]}):D.map(U=>t.jsxs("div",{children:[t.jsx(al,{kind:U.kind,layer:U.layer,count:U.elements.length}),U.elements.map(T=>t.jsx(il,{element:T,active:T.id===L,onSelect:()=>j(T)},T.id))]},U.kind)),m.length===Nt&&t.jsxs("div",{className:"px-2 py-1",style:{fontSize:"10px",color:"#9CA3AF"},children:["Showing the first ",Nt," matches — keep typing to narrow."]})]})]})}),y&&t.jsx(ol,{element:e,target:y,options:S,selected:x,registries:n,onSelect:w}),y&&t.jsxs("div",{className:"flex items-center gap-1.5 mt-1.5",children:[t.jsx("button",{onClick:()=>{I&&(a(I),C())},disabled:!I||!o,className:"px-2 py-0.5 rounded",style:{fontSize:F.xs,fontWeight:600,border:"none",background:I&&o?Yt:"#E5E5E0",color:I&&o?"#FFFFFF":"#9CA3AF",cursor:I&&o?"pointer":"not-allowed"},children:"Create link"}),t.jsx("button",{onClick:C,className:"px-2 py-0.5 rounded",style:{fontSize:F.xs,background:"#F0F0ED",color:"#374151",border:"none",cursor:"pointer"},children:"Cancel"})]})]})}function ol({element:e,target:r,options:n,selected:o,registries:a,onSelect:i}){const l=a.relationships.filter(s=>!s.isAbstract&&!n.some(c=>c.definition.name===s.name)).length;return n.length===0?t.jsx("div",{className:"mt-1.5 px-2 py-1.5 rounded",style:{background:"#FFFBEB",border:"1px solid #FDE68A"},children:t.jsxs("div",{style:{fontSize:F.xs,color:"#92400E"},children:["The ontology defines no relationship between a ",e.kind," and a ",r.kind,"."]})}):t.jsxs("div",{className:"mt-1.5",children:[t.jsx("div",{className:"mb-1",style:{fontSize:"10px",fontWeight:600,color:"#6B7280",textTransform:"uppercase",letterSpacing:"0.04em"},children:"Relationship"}),t.jsx("div",{style:{maxHeight:160,overflowY:"auto"},children:n.map(s=>{const c=(o==null?void 0:o.definition.name)===s.definition.name&&(o==null?void 0:o.direction)===s.direction,d=ei(s.definition);return t.jsxs("button",{onClick:()=>i(s),className:"w-full text-left px-2 py-1 rounded",style:{background:c?"#2DD4A818":"transparent",border:"none",cursor:"pointer",display:"block"},onMouseEnter:u=>{c||(u.currentTarget.style.background="#F7F7F5")},onMouseLeave:u=>{c||(u.currentTarget.style.background="transparent")},children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("span",{style:{fontSize:F.xs,fontWeight:500,color:"#1a1a1a"},children:s.definition.label}),d&&t.jsx("span",{className:"px-1 rounded",style:{fontSize:"9px",background:"#FEF3C7",color:"#92400E"},title:"Joins any two elements. Prefer a relation that carries the meaning.",children:"fallback"})]}),t.jsx("div",{className:"truncate",style:{fontSize:"10px",color:"#9CA3AF"},children:s.direction==="outgoing"?`${e.name} → ${r.name}`:`${r.name} → ${e.name}`})]},`${s.definition.name}-${s.direction}`)})}),l>0&&t.jsxs("div",{className:"mt-0.5",style:{fontSize:"10px",color:"#9CA3AF"},children:[l," other relationship type",l>1?"s are":" is"," defined but cannot join a ",e.kind," and a ",r.kind,"."]})]})}function al({kind:e,layer:r,count:n}){const o=se[r]||"#666";return t.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1",style:{background:"#FAFAF8",borderBottom:"1px solid #F0F0ED",position:"sticky",top:0},children:[t.jsx("span",{className:"w-2 h-2 flex-shrink-0",style:{background:o,borderRadius:2}}),t.jsx("span",{style:{fontSize:"10px",fontWeight:600,color:"#6B7280"},children:e}),t.jsx("span",{className:"ml-auto",style:{fontSize:"10px",color:"#D1D5DB"},children:n})]})}function il({element:e,active:r,onSelect:n}){return t.jsxs("div",{id:`memo-quick-add-${e.id}`,role:"option","aria-selected":r,"data-active":r,onMouseDown:o=>{o.preventDefault(),n()},className:"flex items-center gap-1.5 px-2 py-1 cursor-pointer",style:{background:r?"#2DD4A818":"transparent"},children:[t.jsx("span",{className:"truncate",style:{fontSize:F.xs,color:"#1a1a1a"},children:e.name||e.id}),t.jsx("span",{className:"ml-auto flex-shrink-0 font-mono truncate",style:{fontSize:"10px",color:"#9CA3AF",maxWidth:110},title:e.id,children:e.shortId??e.id})]})}const sl={text:"14px",heading:"13px",meta:"12px",valuePadding:"9px 12px",fieldGap:"10px",sectionPadding:"0 0 18px 0",radius:"10px",twoColumnAttributes:!0},ll={text:"12px",heading:"12px",meta:"11px",valuePadding:"4px 7px",fieldGap:"5px",sectionPadding:"0 0 10px 0",radius:"7px",twoColumnAttributes:!1};function Ue(e){return e==="page"?sl:ll}const ao={kind:"editable"},dl={id:"The model identifier. It is referenced by relationships and views, so it is not editable here.",name:"The element name in SysML. Renaming touches every reference, so do it in the source file."};function cl(e){const r=dl[e];return r?{kind:"identity",reason:r}:ao}function qd(e){return e==="doc"?ao:{kind:"derived",reason:`"${e}" is derived from the SysML source when the model is built.`}}function io(e){return e.kind==="editable"}function so(e){switch(e.kind){case"editable":return"Click to edit";case"identity":return"Identifier — not editable here";case"derived":return"Derived from source — not editable"}}function ul({title:e,count:r,actions:n,density:o,defaultOpen:a=!0,collapsible:i=!0,children:l}){const[s,c]=p.useState(a),d=Ue(o),u=o==="page",y=i?s:!0;return t.jsxs("section",{style:{padding:u?"16px 18px":d.sectionPadding,border:u?"1px solid rgba(60,60,67,0.12)":"none",borderBottom:u?"1px solid rgba(60,60,67,0.12)":`1px solid ${g.borderLight}`,borderRadius:u?14:0,background:u?g.surface:"transparent",boxShadow:u?"0 1px 2px rgba(15,23,42,0.04)":"none",marginBottom:u?14:0},children:[t.jsxs("header",{className:"flex items-center gap-2",style:{cursor:i?"pointer":"default",padding:u?"0 0 10px 0":"6px 10px",borderRadius:u?0:"6px",margin:u?0:"2px 4px"},onClick:i?()=>c(b=>!b):void 0,onMouseEnter:b=>{!u&&i&&(b.currentTarget.style.background=g.surfaceAlt)},onMouseLeave:b=>{u||(b.currentTarget.style.background="transparent")},children:[t.jsx("h3",{style:{flex:1,margin:0,fontSize:d.heading,fontWeight:u?700:500,color:u?g.primary:"#374151",letterSpacing:0,textTransform:"none"},children:e}),typeof r=="number"&&t.jsx("span",{style:{fontSize:d.meta,color:g.faint},children:r}),n&&t.jsx("span",{onClick:b=>b.stopPropagation(),children:n}),i&&t.jsx("span",{style:{color:"#D1D5DB",fontSize:d.meta},children:y?"▾":"▸"})]}),y&&t.jsx("div",{style:{padding:u?0:"0 14px 8px"},children:l})]})}function pl({value:e,editability:r,density:n,mono:o}){const a=Ue(n),i=r.kind==="editable"?"":r.reason;return t.jsxs("div",{title:i||so(r),style:{display:"flex",alignItems:"center",gap:6,padding:a.valuePadding,borderRadius:a.radius,background:g.surfaceAlt,border:"1px solid transparent",color:g.muted,fontSize:a.text,fontFamily:o?"ui-monospace, SFMono-Regular, Menlo, monospace":"inherit",cursor:"default",minWidth:0},children:[t.jsx("span",{className:"truncate",style:{flex:1},children:e||t.jsx("span",{style:{color:g.faint,fontStyle:"italic"},children:"none"})}),t.jsx("span",{"aria-hidden":!0,style:{fontSize:a.meta,color:"#C7CBD1",flexShrink:0},children:"🔒"})]})}function rt({value:e,onSave:r,density:n,multiline:o,placeholder:a,autoFocus:i,compact:l=!1}){const[s,c]=p.useState(!1),[d,u]=p.useState(!1),[y,b]=p.useState(e),x=Ue(n),w=p.useRef(!1);p.useEffect(()=>{b(e)},[e]);const f=p.useCallback(()=>{w.current||(w.current=!0,c(!1),y!==e&&r(y))},[y,e,r]),h=p.useCallback(D=>{D.key==="Enter"&&!o&&(D.preventDefault(),f()),D.key==="Escape"&&(w.current=!0,b(e),c(!1))},[f,o,e]),m=()=>{w.current=!1,b(e),c(!0)};if(s){const D={value:y,autoFocus:!0,onChange:N=>b(N.target.value),onBlur:f,onKeyDown:h,placeholder:a,style:{width:"100%",padding:l?"5px 8px":x.valuePadding,borderRadius:l?"6px":x.radius,border:`1px solid ${g.accent}`,boxShadow:`0 0 0 3px ${g.accent}25`,background:g.surface,color:g.primary,fontSize:x.text,fontFamily:"inherit",outline:"none",...o?{minHeight:n==="page"?"110px":"54px",resize:"vertical",lineHeight:1.6}:{}}};return o?t.jsx("textarea",{...D}):t.jsx("input",{type:"text",...D})}return t.jsxs("div",{role:"button",tabIndex:0,title:"Click to edit",onClick:m,onFocus:()=>u(!0),onBlur:()=>u(!1),onKeyDown:D=>{(D.key==="Enter"||D.key===" ")&&(D.preventDefault(),m())},onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),style:{display:"flex",alignItems:"flex-start",gap:6,padding:l?"5px 8px":x.valuePadding,borderRadius:l?"6px":x.radius,background:l?d?"#F0FDF9":g.surfaceAlt:g.surface,border:l?`1px solid ${d?g.accent:"transparent"}`:`1px solid ${d?g.accent:g.border}`,boxShadow:d&&!l?`0 0 0 3px ${g.accent}20`:"none",color:e?g.primary:g.faint,fontSize:x.text,cursor:"text",transition:"border-color 150ms ease, box-shadow 150ms ease",lineHeight:o?1.6:1.4,whiteSpace:o?"pre-wrap":"nowrap",overflow:"hidden",minWidth:0},children:[t.jsx("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis"},children:e||(a??"Click to add…")}),t.jsx("span",{"aria-hidden":!0,style:{flexShrink:0,fontSize:x.meta,color:d?g.accent:"#C7CBD1",transition:"color 150ms ease"},children:"✎"})]})}function Hd({label:e,editability:r,density:n,children:o}){const a=Ue(n);return t.jsxs("div",{style:{minWidth:0},children:[t.jsxs("div",{className:"flex items-center gap-1.5",style:{marginBottom:4,fontSize:a.meta,color:g.muted},children:[t.jsx("span",{style:{fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace"},children:e}),t.jsx("span",{className:"sr-only",children:so(r)}),!io(r)&&t.jsx("span",{title:r.kind==="editable"?"":r.reason,style:{fontSize:"10px",padding:"0 4px",borderRadius:4,background:g.surfaceAlt,color:g.faint,border:`1px solid ${g.border}`},children:r.kind==="identity"?"identifier":"derived"})]}),o]})}function Kd({density:e}){const r=Ue(e);return t.jsxs("div",{className:"flex items-center gap-4 flex-wrap",style:{fontSize:r.meta,color:g.faint},children:[t.jsxs("span",{className:"flex items-center gap-1.5",children:[t.jsx("span",{style:{color:g.accent},children:"✎"})," editable here"]}),t.jsx("span",{children:"Identity and source metadata are read-only"})]})}function ml(e,r,n,o){var c;const a=new Map,i=(d,u)=>{var x;const y=u==="outgoing"?d.targetId:d.sourceId,b=a.get(y)??{id:y,element:n.elements[y],links:[]};b.links.push({relationship:d,direction:u,label:((x=kn(d.type,o))==null?void 0:x.label)??d.type}),a.set(y,b)};e.forEach(d=>i(d,"outgoing")),r.forEach(d=>i(d,"incoming"));const l=new Map;for(const d of a.values()){const u=((c=d.element)==null?void 0:c.layer)||"other";l.set(u,[...l.get(u)??[],d])}const s=d=>{const u=Qe.indexOf(d);return u<0?Number.MAX_SAFE_INTEGER:u};return[...l.entries()].map(([d,u])=>({layer:d,elements:u.sort((y,b)=>{var x,w;return(((x=y.element)==null?void 0:x.name)??y.id).localeCompare(((w=b.element)==null?void 0:w.name)??b.id)})})).sort((d,u)=>s(d.layer)-s(u.layer)||d.layer.localeCompare(u.layer))}function fl({element:e,model:r,registries:n,outgoing:o,incoming:a,density:i,onNavigate:l}){const[s,c]=p.useState(""),d=p.useMemo(()=>ml(o,a,r,n),[o,a,r,n]),u=s.trim().toLowerCase(),y=p.useMemo(()=>d.map(x=>({...x,elements:x.elements.filter(w=>{var f,h,m;return!u||[(f=w.element)==null?void 0:f.name,(h=w.element)==null?void 0:h.kind,(m=w.element)==null?void 0:m.shortId,w.id,x.layer,...w.links.map(D=>D.label)].filter(Boolean).join(" ").toLowerCase().includes(u)})})).filter(x=>x.elements.length>0),[d,u]),b=d.reduce((x,w)=>x+w.elements.length,0);return t.jsxs("div",{style:{border:i==="page"?"none":`1px solid ${g.border}`,borderRadius:12,background:i==="page"?"transparent":g.surfaceAlt,padding:i==="page"?0:10},children:[t.jsxs("div",{className:"flex items-center gap-3 flex-wrap",style:{marginBottom:14},children:[t.jsxs("div",{children:[t.jsx("div",{style:{color:g.primary,fontSize:13,fontWeight:700},children:"Linked elements"}),t.jsxs("div",{style:{color:g.muted,fontSize:11},children:[b," element",b===1?"":"s"," across ",d.length," layer",d.length===1?"":"s"]})]}),b>6&&t.jsx("input",{value:s,onChange:x=>c(x.target.value),placeholder:"Filter linked elements…","aria-label":"Filter linked elements",style:{marginLeft:"auto",width:240,padding:"6px 9px",borderRadius:7,border:`1px solid ${g.border}`,background:g.surface,color:g.primary,fontSize:12,outline:"none"}})]}),b===0&&t.jsx("div",{style:{color:g.faint,fontSize:12},children:"No linked elements."}),t.jsx("div",{style:{display:"flex",flexDirection:"column",gap:14},children:y.map(x=>{const w=se[x.layer]||g.muted;return t.jsxs("section",{style:{padding:i==="page"?"11px 12px":8,background:w+"0D",border:`1px solid ${w}25`,borderRadius:i==="page"?11:8},children:[t.jsxs("div",{className:"flex items-center gap-2",style:{marginBottom:8},children:[t.jsx("span",{style:{width:9,height:9,borderRadius:3,background:w}}),t.jsx("strong",{style:{color:g.primary,fontSize:12},children:lt[x.layer]??x.layer}),t.jsx("span",{style:{color:g.faint,fontSize:11},children:x.elements.length})]}),t.jsx("div",{style:{display:"grid",gridTemplateColumns:i==="page"?"repeat(auto-fill, 264px)":"1fr",justifyContent:"start",gap:7},children:x.elements.map(f=>t.jsx(yl,{linked:f,color:w,onNavigate:l},f.id))})]},x.layer)})})]})}function yl({linked:e,color:r,onNavigate:n}){var i,l,s;const[o,a]=p.useState(!1);return t.jsx("button",{onClick:()=>n(e.id),onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),className:"text-left",title:`Open ${((i=e.element)==null?void 0:i.name)??e.id}`,style:{padding:"10px 11px",borderRadius:10,background:g.surface,border:`1px solid ${o?r+"90":"rgba(60,60,67,0.12)"}`,cursor:"pointer",minWidth:0,width:"100%",maxWidth:264,boxShadow:o?"0 2px 8px rgba(15,23,42,0.08)":"none"},children:t.jsxs("div",{style:{minWidth:0},children:[e.links.map(c=>t.jsxs("div",{style:{color:c.direction==="outgoing"?"#2563EB":"#059669",fontSize:10,fontWeight:600,marginBottom:2},children:[c.label," ",c.direction==="outgoing"?"to":"from"]},c.relationship.id)),t.jsx("strong",{className:"truncate",style:{display:"block",color:g.primary,fontSize:13},children:((l=e.element)==null?void 0:l.name)??e.id}),t.jsx("div",{style:{color:g.muted,fontSize:10,marginTop:2},children:((s=e.element)==null?void 0:s.kind)??"Unknown element type"})]})})}function gl({element:e,outgoing:r,incoming:n,density:o}){const a=E(v=>v.model),i=E(v=>v.connected),l=E(v=>v.selectElement),s=E(v=>v.selectedDiagramId),c=E(v=>v.pendingRelationships),d=E(v=>v.createRelationship),u=E(v=>v.deleteRelationship),y=E(v=>v.dismissPendingRelationship),b=E(v=>v.addElementToDiagram),[x,w]=p.useState(!1),[f,h]=p.useState(null),[m,D]=p.useState(null),N=p.useMemo(()=>Kr(a),[a]);p.useEffect(()=>{h(null),D(null),w(!1)},[e.id]);const j=c.filter(v=>v.sourceId===e.id||v.targetId===e.id),C=r.length+n.length,S=p.useCallback(async v=>{var P;h(null);const L=await d({...v,selectedElementId:e.id,diagramId:s??void 0});if(!L.success){h({kind:"error",message:L.error??"The relationship could not be created."});return}const W=v.sourceId===e.id?v.targetId:v.sourceId,U=Rt(a,s),T=(P=L.diagnostics)==null?void 0:P.find(q=>q.code==="REL-005"),K=!!U&&!!U.elementIds&&U.elementIds.length>0&&!U.elementIds.includes(W);h({kind:"success",message:`Relationship created in ${L.sourceFile??"the model"}.`,profileMessage:T==null?void 0:T.message,offerAddToView:K&&!T&&s?{elementId:W,diagramId:s}:void 0})},[d,e.id,s,a]),I=p.useCallback(async v=>{D(null);const L=await u(v);h(L.success?{kind:"success",message:`Relationship removed from ${L.sourceFile??"the model"}.`}:{kind:"error",message:L.error??"The relationship could not be deleted."})},[u]);return a?t.jsx(t.Fragment,{children:t.jsxs(ul,{title:"Relationships",count:C,density:o,collapsible:o==="panel",actions:C>0?t.jsx("button",{onClick:()=>w(v=>!v),style:{padding:"2px 9px",borderRadius:"6px",background:x?g.accent:g.surfaceAlt,color:x?"#FFFFFF":"#374151",border:`1px solid ${x?g.accent:g.border}`,cursor:"pointer",fontSize:F.xs,fontWeight:500},title:x?"Collapse the expanded relationship view":"Show every relationship, grouped by direction and type",children:x?"▴ Collapse":"⤢ Expand"}):void 0,children:[t.jsx("div",{style:{marginBottom:o==="page"?14:8,maxWidth:o==="page"?720:void 0},children:t.jsx(rl,{element:e,model:a,registries:N,enabled:i,onCreate:S})}),x?t.jsx("div",{style:{marginBottom:12},children:t.jsx(fl,{element:e,model:a,registries:N,outgoing:r,incoming:n,density:o,onNavigate:l})}):t.jsxs(t.Fragment,{children:[C===0&&j.length===0&&t.jsx("div",{style:{fontSize:Ue(o).meta,color:g.faint,padding:"2px 0 6px"},children:"No relationships yet — add the first one below."}),t.jsxs("div",{style:{display:"grid",gridTemplateColumns:o==="page"?"repeat(auto-fill, 280px)":"1fr",justifyContent:"start",gap:8},children:[r.map(v=>t.jsx(cr,{relationship:v,direction:"outgoing",model:a,registries:N,density:o,confirming:m===v.id,onNavigate:()=>l(v.targetId),onRequestDelete:()=>D(v.id),onCancelDelete:()=>D(null),onConfirmDelete:()=>I(v.id),deletable:i},v.id)),n.map(v=>t.jsx(cr,{relationship:v,direction:"incoming",model:a,registries:N,density:o,confirming:m===v.id,onNavigate:()=>l(v.sourceId),onRequestDelete:()=>D(v.id),onCancelDelete:()=>D(null),onConfirmDelete:()=>I(v.id),deletable:i},v.id))]}),j.map(v=>t.jsx(xl,{pending:v,model:a,onDismiss:()=>y(v.pendingId)},v.pendingId))]}),f&&t.jsx(hl,{status:f,onAddToView:()=>{f.offerAddToView&&(b(f.offerAddToView.diagramId,f.offerAddToView.elementId),h({kind:"success",message:"Element added to this view."}))},onDismiss:()=>h(null),model:a})]})}):null}function hl({status:e,onAddToView:r,onDismiss:n,model:o}){var l;const a=e.kind==="success",i=e.offerAddToView?((l=o.elements[e.offerAddToView.elementId])==null?void 0:l.name)??e.offerAddToView.elementId:null;return t.jsxs("div",{className:"text-xs p-2 rounded-lg mt-2",style:{background:a?"#F0FDF4":"#FEF2F2",border:`1px solid ${a?"#BBF7D0":"#FECACA"}`,color:a?"#166534":"#DC2626"},children:[t.jsxs("div",{className:"flex items-start gap-1.5",children:[t.jsx("span",{className:"flex-1",children:e.message}),t.jsx("button",{onClick:n,style:{background:"none",border:"none",cursor:"pointer",color:"inherit",lineHeight:1},"aria-label":"Dismiss",children:"×"})]}),e.profileMessage&&t.jsx("div",{className:"mt-1",style:{color:"#92400E"},children:"Relationship created in the model, but this view profile does not display this relationship type."}),e.offerAddToView&&t.jsxs("button",{onClick:r,className:"mt-1.5 px-2 py-0.5 rounded",style:{background:"#FFFFFF",border:"1px solid #BBF7D0",color:"#166534",cursor:"pointer",fontSize:F.xs},children:["Relationship created. Add ",i," to this view?"]})]})}function cr({relationship:e,direction:r,model:n,registries:o,deletable:a,density:i,confirming:l,onNavigate:s,onRequestDelete:c,onCancelDelete:d,onConfirmDelete:u}){const y=r==="outgoing"?e.targetId:e.sourceId,b=n.elements[y],x=b&&se[b.layer]||"#666",w=b?lt[b.layer]??b.layer.replace(/_/g," "):"Unknown layer",f=kn(e.type,o),[h,m]=p.useState(!1),D=Ue(i),N=a&&e.named===!0;return t.jsxs("div",{style:{border:`1px solid ${x}35`,borderRadius:i==="page"?8:6,background:x+"0D",overflow:"hidden",width:"100%",maxWidth:i==="page"?280:void 0},children:[t.jsxs("div",{className:"flex items-start gap-2",style:{padding:i==="page"?"9px 10px":"7px 8px",fontSize:D.text},children:[t.jsxs("button",{onClick:s,className:"text-left",style:{display:"block",flex:1,minWidth:0,background:"none",border:"none",cursor:"pointer",padding:0},title:`Go to ${(b==null?void 0:b.name)??y}`,children:[t.jsx("div",{style:{color:x,fontSize:10,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.04em"},children:w}),t.jsxs("div",{style:{color:r==="outgoing"?"#2563EB":"#059669",fontSize:D.meta,fontWeight:600,marginTop:4},children:[(f==null?void 0:f.label)??e.type," ",r==="outgoing"?"to":"from"]}),t.jsx("strong",{className:"truncate",style:{display:"block",color:g.primary,fontSize:D.text,fontWeight:650,marginTop:2},children:(b==null?void 0:b.name)??y}),(b==null?void 0:b.kind)&&t.jsx("div",{style:{color:g.muted,fontSize:"10px",marginTop:2},children:b.kind})]}),t.jsx("button",{onClick:()=>m(j=>!j),style:{background:"none",border:"none",cursor:"pointer",color:g.faint,padding:2},"aria-label":h?"Hide relationship details":"Show relationship details",children:h?"▾":"▸"}),N&&!l&&t.jsx("button",{onClick:()=>{m(!0),c()},"aria-label":`Remove ${(f==null?void 0:f.label)??e.type} relationship to ${(b==null?void 0:b.name)??y}`,title:"Remove relationship",style:{width:20,height:20,padding:0,border:0,borderRadius:10,background:"#FFFFFFAA",color:"#9CA3AF",cursor:"pointer",lineHeight:1},children:"×"})]}),h&&t.jsxs("div",{className:"px-3 pb-2 space-y-1",style:{fontSize:"10px",color:"#6B7280",borderTop:`1px solid ${g.borderLight}`,paddingTop:7},children:[t.jsx(wt,{label:"Kind",value:(b==null?void 0:b.kind)??"—",valueColor:x}),t.jsx(wt,{label:"Roles",value:`${e.sourceEnd||(f==null?void 0:f.sourceEnd.name)||"source"} → ${e.targetEnd||(f==null?void 0:f.targetEnd.name)||"target"}`}),t.jsx(wt,{label:"ID",value:e.id,mono:!0}),t.jsx(wt,{label:"Source",value:e.file||"—",mono:!0}),!e.named&&t.jsx("div",{style:{color:"#D97706"},children:"Anonymous connection — name it in SysML to allow deletion from here."}),N&&!l&&t.jsx("button",{onClick:c,className:"px-1.5 py-0.5 rounded",style:{background:"#FEF2F2",color:"#DC2626",border:"1px solid #FECACA",cursor:"pointer",fontSize:"10px"},children:"Remove relationship"}),l&&t.jsxs("div",{className:"p-1.5 rounded",style:{background:"#FEF2F2",border:"1px solid #FECACA"},children:[t.jsxs("div",{style:{color:"#DC2626"},children:["Remove ",(f==null?void 0:f.label)??e.type," to ",(b==null?void 0:b.name)??y,"? Both elements are kept."]}),t.jsxs("div",{className:"flex gap-1 mt-1",children:[t.jsx("button",{onClick:u,className:"px-1.5 py-0.5 rounded",style:{background:"#DC2626",color:"#FFFFFF",border:"none",cursor:"pointer",fontSize:"10px"},children:"Remove"}),t.jsx("button",{onClick:d,className:"px-1.5 py-0.5 rounded",style:{background:"#FFFFFF",color:"#374151",border:"1px solid #E5E5E0",cursor:"pointer",fontSize:"10px"},children:"Cancel"})]})]})]})]})}function wt({label:e,value:r,mono:n,valueColor:o}){return t.jsxs("div",{className:"flex gap-1.5",children:[t.jsx("span",{style:{minWidth:48,color:"#9CA3AF"},children:e}),t.jsx("span",{className:`truncate ${n?"font-mono":""}`,style:{color:o??"#374151"},title:r,children:r})]})}function xl({pending:e,model:r,onDismiss:n}){const o=e.direction==="outgoing"?e.targetId:e.sourceId,a=r.elements[o],i=e.status==="failed";return t.jsxs("div",{className:"flex items-center gap-1.5 ml-2 rounded",style:{padding:"4px 8px",fontSize:F.xs,background:i?"#FEF2F2":"#F9FAFB",color:i?"#DC2626":"#6B7280",fontStyle:i?"normal":"italic"},children:[t.jsx("span",{children:e.direction==="outgoing"?"→":"←"}),t.jsx("span",{className:"px-1 py-0.5 rounded flex-shrink-0",style:{background:"#E5E7EB",color:"#6B7280",fontSize:F.xs},children:e.label}),t.jsx("span",{className:"truncate flex-1",children:(a==null?void 0:a.name)??o}),i?t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"truncate",style:{fontSize:"10px",maxWidth:90},title:e.error,children:e.error}),t.jsx("button",{onClick:n,style:{background:"none",border:"none",cursor:"pointer",color:"inherit"},"aria-label":"Dismiss failed relationship",children:"×"})]}):t.jsx("span",{style:{fontSize:"10px"},children:"saving…"})]})}function lo({identifier:e}){return t.jsxs("p",{"data-testid":"rename-scope-note",style:{fontSize:11,lineHeight:1.5,color:"#6B7280",margin:"4px 0 0"},children:["Renaming is a text edit. It changes this declaration",e?t.jsxs(t.Fragment,{children:[" (",t.jsx("code",{style:{fontFamily:"ui-monospace, monospace"},children:e}),")"]}):null," ","only — MEMO cannot update references to it elsewhere in the project yet, so any that exist keep pointing at the old name until you edit them."]})}const Ie="panel";function ie({title:e,count:r,defaultOpen:n=!0,actions:o,children:a}){const[i,l]=p.useState(n);return t.jsxs("div",{style:{borderBottom:"1px solid #EDEDEA"},children:[t.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 cursor-pointer transition-colors",style:{borderRadius:"6px",margin:"2px 4px"},onMouseEnter:s=>s.currentTarget.style.background="#F0F0ED",onMouseLeave:s=>s.currentTarget.style.background="transparent",onClick:()=>l(s=>!s),children:[t.jsx("span",{className:"font-medium flex-1 text-xs",style:{color:"#374151"},children:e}),o&&t.jsx("span",{onClick:s=>s.stopPropagation(),children:o}),typeof r=="number"&&t.jsx("span",{className:"text-xs",style:{color:"#9CA3AF"},children:r}),t.jsx("span",{style:{color:"#D1D5DB"},children:i?"▾":"▸"})]}),i&&t.jsx("div",{className:"px-4 pb-3",children:a})]})}function bl({label:e,kind:r,kindColor:n,onClick:o,arrow:a,typeBadge:i,typeColor:l,selected:s}){return t.jsxs("div",{className:"flex items-center gap-1.5 cursor-pointer transition-colors ml-2",style:{borderRadius:"6px",padding:"4px 8px",background:s?"#2DD4A818":"transparent",color:s?"#1B3A4B":"#374151",fontWeight:s?500:400,fontSize:F.xs},onMouseEnter:c=>{s||(c.currentTarget.style.background="#F0F0ED")},onMouseLeave:c=>{s||(c.currentTarget.style.background="transparent")},onClick:o,children:[a&&t.jsx("span",{style:{color:"#9CA3AF"},children:a}),i&&t.jsx("span",{className:"px-1 py-0.5 rounded",style:{background:(l||"#2563EB")+"18",color:l||"#2563EB",fontSize:F.xs},children:i}),t.jsx("span",{className:"truncate",children:e}),r&&t.jsx("span",{className:"ml-auto flex-shrink-0 px-1 py-0.5 rounded",style:{background:(n||"#666")+"15",color:n||"#666",fontSize:F.badge},children:r})]})}function vl({element:e,onNameSave:r,onAttributeSave:n}){const o=e.attributes.boundaryColor||"#14B8A6",a=/^#[0-9a-f]{6}$/i.test(o)?o:"#14B8A6",i=Number(e.attributes.boundaryOpacity??"0.12"),l=Number.isFinite(i)?Math.max(0,Math.min(1,i)):.12;return t.jsx(ie,{title:"Region",defaultOpen:!0,children:t.jsxs("div",{className:"space-y-2 text-xs",children:[t.jsxs("label",{style:{display:"block",color:"#6B7280"},children:[t.jsx("span",{style:{display:"block",marginBottom:3},children:"Name"}),t.jsx(rt,{value:e.name,onSave:r,density:Ie,placeholder:"Region name"}),t.jsx(lo,{identifier:e.id})]}),t.jsxs("label",{style:{display:"block",color:"#6B7280"},children:[t.jsx("span",{style:{display:"block",marginBottom:3},children:"Description"}),t.jsx(rt,{value:e.attributes.description||"",onSave:s=>n("description",s),density:Ie,multiline:!0,placeholder:"Describe this region…"})]}),t.jsxs("div",{children:[t.jsx("span",{style:{display:"block",marginBottom:3,color:"#6B7280"},children:"Boundary color"}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("input",{"aria-label":"Region boundary color",type:"color",value:a,onChange:s=>n("boundaryColor",s.target.value),style:{width:34,height:28,padding:2,border:"1px solid #D8D8D2",borderRadius:6,background:"#FFFFFF"}}),t.jsx(rt,{value:o,onSave:s=>n("boundaryColor",s),density:Ie,placeholder:"#14B8A6",compact:!0})]})]}),t.jsxs("label",{style:{display:"block",color:"#6B7280"},children:[t.jsxs("span",{className:"flex justify-between",style:{marginBottom:3},children:[t.jsx("span",{children:"Fill opacity"}),t.jsxs("span",{children:[Math.round(l*100),"%"]})]}),t.jsx("input",{"aria-label":"Region fill opacity",type:"range",min:"0",max:"1",step:"0.01",value:l,onChange:s=>n("boundaryOpacity",s.target.value),style:{width:"100%"}})]})]})})}function wl(){const e=E(l=>l.model),r=E(l=>l.activeView),n=r.type==="diagram"?r.diagramId:null,o=Rt(e,n);if(!o)return null;const a=Le[o.diagramType],i={borderBottom:"1px solid #EDEDEA"};return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"p-4",style:{...i,borderLeft:`3px solid ${(a==null?void 0:a.color)||"#6B7280"}`},children:[t.jsx("div",{className:"text-sm font-semibold truncate",style:{color:"#1a1a1a"},children:o.name}),t.jsxs("div",{className:"flex items-center gap-2 text-xs mt-1.5",children:[a&&t.jsx("span",{className:"px-2 py-0.5 rounded-md font-medium",style:{background:a.color+"18",color:a.color},children:a.code}),t.jsx("span",{style:{color:"#6B7280"},children:(a==null?void 0:a.fullName)||o.diagramType})]}),o.auto&&t.jsx("div",{className:"text-xs mt-1",style:{color:"#6B7280"},children:"Auto-generated"})]}),t.jsxs("div",{className:"flex-1 overflow-y-auto",children:[o.description&&t.jsx(ie,{title:"Description",defaultOpen:!0,children:t.jsx("div",{className:"text-xs leading-relaxed",style:{color:"#374151"},children:o.description})}),t.jsx(ie,{title:"Details",defaultOpen:!0,children:t.jsxs("div",{className:"space-y-1.5",children:[t.jsxs("div",{className:"flex text-xs",children:[t.jsx("span",{className:"min-w-[80px]",style:{color:"#6B7280"},children:"ID"}),t.jsx("span",{className:"truncate font-mono",style:{color:"#1a1a1a",fontSize:F.xs},children:o.shortId??o.id})]}),t.jsxs("div",{className:"flex text-xs",children:[t.jsx("span",{className:"min-w-[80px]",style:{color:"#6B7280"},children:"Viewpoint"}),t.jsx("span",{style:{color:"#1a1a1a"},children:o.viewpointId})]}),t.jsxs("div",{className:"flex text-xs",children:[t.jsx("span",{className:"min-w-[80px]",style:{color:"#6B7280"},children:"Type"}),t.jsx("span",{style:{color:"#1a1a1a"},children:o.diagramType})]}),o.sourceFile&&t.jsxs("div",{className:"flex text-xs",children:[t.jsx("span",{className:"min-w-[80px]",style:{color:"#6B7280"},children:"Source file"}),t.jsx("span",{className:"truncate font-mono",title:o.sourceFile,style:{color:"#1a1a1a",fontSize:F.xs},children:o.sourceFile})]})]})}),o.properties&&Object.keys(o.properties).length>0&&t.jsx(ie,{title:"Properties",count:Object.keys(o.properties).length,children:t.jsx("div",{className:"space-y-1.5",children:Object.entries(o.properties).map(([l,s])=>t.jsxs("div",{className:"flex text-xs",children:[t.jsx("span",{className:"min-w-[80px]",style:{color:"#6B7280"},children:l}),t.jsx("span",{className:"truncate",style:{color:"#1a1a1a"},children:s})]},l))})}),o.elementIds&&o.elementIds.length>0&&t.jsx(ie,{title:"Scoped Elements",count:o.elementIds.length,defaultOpen:!1,children:t.jsx("div",{className:"text-xs",style:{color:"#6B7280"},children:o.elementIds.join(", ")})}),o.relationshipTypes&&o.relationshipTypes.length>0&&t.jsx(ie,{title:"Relationship Types",count:o.relationshipTypes.length,children:t.jsx("div",{className:"flex flex-wrap gap-1",children:o.relationshipTypes.map(l=>t.jsx("span",{className:"px-1.5 py-0.5 rounded text-xs",style:{background:"#EFF6FF",color:"#2563EB",fontSize:F.xs},children:l},l))})})]})]})}const kl=4e3;function El({elementId:e}){const r=E(l=>l.model),n=E(l=>l.lastSourceChange),[o,a]=p.useState(null),i=p.useMemo(()=>_i(r,e),[r,e]);return p.useEffect(()=>{if(!qi(n,i))return;a(n.at);const l=setTimeout(()=>a(null),kl);return()=>clearTimeout(l)},[n==null?void 0:n.seq]),p.useEffect(()=>{a(null)},[e]),o?t.jsx("span",{title:"A source file this element depends on changed; the model was rebuilt",className:"px-1.5 rounded",style:{fontSize:F.badge,background:"#ECFDF5",color:"#047857",border:"1px solid #A7F3D0"},children:"↻ Updated"}):null}function Sl(){var N,j;const e=E(C=>C.model),r=E(C=>C.selectedElementId),n=E(C=>C.validation),o=E(C=>C.selectElement),a=E(C=>C.updateElementField),i=E(C=>C.updateElementAttribute),l=E(C=>C.applyEdit),[s,c]=p.useState(!1);p.useEffect(()=>{c(!1)},[r]),p.useEffect(()=>{if(!r)return;const C=S=>{(S.metaKey||S.ctrlKey)&&S.key==="s"&&(S.preventDefault(),l(r),c(!1))};return window.addEventListener("keydown",C),()=>window.removeEventListener("keydown",C)},[r,l]);const d=p.useMemo(()=>r&&e?Wi(e,r):[],[e,r]);if(!r||!e)return null;const u=e.elements[r];if(!u)return null;const y=d.filter(C=>C.sourceId===r),b=d.filter(C=>C.targetId===r),x=se[u.layer]||"#666",w=(n==null?void 0:n.violations.filter(C=>C.elementId===r))||[],f=new Set(["description","boundaryColor","boundaryOpacity"]),h=Object.entries(u.attributes).filter(([C])=>C!=="name"&&C!=="id"&&!(u.kind==="UIElement"&&f.has(C))&&!(u.kind!=="UIElement"&&C==="description")),m=(C,S)=>{i(r,C,S),l(r)},D=C=>{const S=C.trim();!S||S===u.name||(a(r,"name",S),l(r))};return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"p-4",style:{borderBottom:"1px solid #EDEDEA",borderLeft:`3px solid ${x}`},children:[t.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[t.jsx("span",{className:"w-2.5 h-2.5 flex-shrink-0",style:{background:x,borderRadius:"3px"}}),t.jsx("span",{className:"text-sm font-semibold truncate",style:{color:"#1a1a1a"},children:u.name})]}),t.jsx("div",{className:"flex items-center gap-2 text-xs",children:t.jsx("span",{className:"px-2 py-0.5 rounded-md font-medium",style:{background:x+"18",color:x},children:u.kind})}),t.jsxs("div",{className:"text-xs mt-1.5 capitalize",style:{color:"#6B7280"},children:[u.layer," layer"]})]}),t.jsxs("div",{className:"flex-1 overflow-y-auto",children:[u.kind==="UIElement"&&t.jsx(vl,{element:u,onNameSave:D,onAttributeSave:m}),t.jsx(ie,{title:"Identity",children:t.jsxs("div",{className:"text-xs",style:{color:"#374151"},children:[t.jsx("code",{style:{fontFamily:"ui-monospace, monospace"},children:u.id}),t.jsx(lo,{})]})}),u.kind!=="UIElement"&&t.jsx(ie,{title:"Description",defaultOpen:!0,children:t.jsx("div",{className:"text-xs leading-relaxed",children:t.jsx(rt,{value:u.attributes.description||"",onSave:C=>m("description",C),density:Ie,multiline:!0,placeholder:"Click to add a description…"})})}),u.parameters&&u.parameters.length>0&&t.jsx(ie,{title:"Parameters",count:u.parameters.length,children:t.jsx("div",{className:"space-y-1.5",children:u.parameters.map(C=>t.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[t.jsx("span",{className:"px-1.5 py-0.5 rounded font-mono",style:{fontSize:"10px",background:C.direction==="in"?"#EFF6FF":C.direction==="out"?"#FFF7ED":"#F0FDF4",color:C.direction==="in"?"#2563EB":C.direction==="out"?"#EA580C":"#16A34A"},children:C.direction}),t.jsx("span",{style:{color:"#374151",fontWeight:500},children:C.name}),t.jsx("span",{style:{color:"#6B7280"},children:":"}),t.jsx("span",{style:{color:"#6B7280"},children:C.type})]},C.name))})}),u.allocatedTo&&t.jsx(ie,{title:"Allocated To",defaultOpen:!0,children:t.jsx(bl,{label:((N=e.elements[u.allocatedTo])==null?void 0:N.name)||u.allocatedTo,kind:(j=e.elements[u.allocatedTo])==null?void 0:j.kind,kindColor:"#E67E22",arrow:"→",onClick:()=>o(u.allocatedTo)})}),h.length>0&&t.jsx(ie,{title:"Attributes",count:h.length,defaultOpen:!0,children:t.jsx("div",{className:"space-y-1.5",children:h.map(([C,S])=>{const I=cl(C);return t.jsxs("div",{className:"flex text-xs items-start gap-1.5",children:[t.jsx("span",{className:"min-w-[80px] pt-0.5",style:{color:"#6B7280"},children:C}),t.jsx("div",{style:{flex:1,minWidth:0},children:io(I)?t.jsx(rt,{value:String(S??""),onSave:v=>m(C,v),density:Ie,placeholder:"Click to set…"}):t.jsx(pl,{value:String(S??""),editability:I,density:Ie,mono:!0})})]},C)})})}),t.jsx(gl,{element:u,outgoing:y,incoming:b,density:Ie}),t.jsx(Bl,{subject:u}),w.length>0&&t.jsx(ie,{title:"Guidance",count:w.length,defaultOpen:!0,children:t.jsx("div",{className:"space-y-2",children:w.map((C,S)=>t.jsxs("div",{className:"text-xs p-2.5 rounded-lg",style:{background:C.severity==="error"?"#FEF2F2":C.severity==="warning"?"#FFFBEB":"#EFF6FF",border:`1px solid ${C.severity==="error"?"#FECACA":C.severity==="warning"?"#FDE68A":"#BFDBFE"}`},children:[t.jsx("div",{style:{color:C.severity==="error"?"#DC2626":C.severity==="warning"?"#D97706":"#2563EB"},children:C.description}),t.jsxs("div",{className:"mt-0.5",style:{color:"#6B7280"},children:["[",C.ruleId,"]"]})]},`${C.ruleId}-${S}`))})}),w.length===0&&t.jsx("div",{className:"p-4",children:t.jsxs("div",{className:"text-xs flex items-center gap-1",style:{color:"#10B981"},children:[t.jsx("span",{children:"✓"})," All rules satisfied"]})}),u.file&&t.jsx(ie,{title:"Source",defaultOpen:!1,actions:t.jsx(El,{elementId:r}),children:t.jsxs("button",{className:"flex items-center gap-1.5 text-xs w-full text-left rounded px-1 py-0.5 transition-colors",style:{color:"#2563EB",background:"transparent",border:"none",cursor:"pointer",wordBreak:"break-all"},onMouseEnter:C=>{C.currentTarget.style.background="#EFF6FF"},onMouseLeave:C=>{C.currentTarget.style.background="transparent"},onClick:()=>{navigator.clipboard.writeText(u.file).catch(()=>{})},title:"Click to copy path",children:[t.jsx("span",{style:{flexShrink:0},children:"⟨/⟩"}),t.jsx("span",{className:"font-mono truncate",children:u.file}),t.jsx("span",{style:{flexShrink:0,color:"#9CA3AF",fontSize:"9px"},children:"copy"})]})})]})]})}const kt={comment:{kind:"ModelComment",relation:"CommentsOn",label:"comment",placeholder:"Comment"},rationale:{kind:"ModelRationale",relation:"RationaleFor",label:"rationale",placeholder:"Engineering rationale"},note:{kind:"ModelNote",relation:"NotesOn",label:"note",placeholder:"Note"}};function Bl({subject:e}){var L,W,U;const r=E(T=>T.model),n=E(T=>T.createModelElement),o=E(T=>T.createRelationship),a=E(T=>T.persistElementAttributes),[i,l]=p.useState(""),[s,c]=p.useState(""),[d,u]=p.useState(""),[y,b]=p.useState("comment"),[x,w]=p.useState(""),[f,h]=p.useState(null),[m,D]=p.useState("");if(!r)return null;const N=new Set(Object.values(kt).map(T=>T.relation.toLowerCase())),C=[...new Set(r.relationships.filter(T=>N.has(T.type.toLowerCase())&&T.targetId===e.id).map(T=>T.sourceId))].map(T=>r.elements[T]).filter(T=>!!T),S=new Map;for(const T of r.relationships.filter(K=>K.type.toLowerCase()==="composes"))((L=r.elements[T.sourceId])==null?void 0:L.kind)!=="ModelComment"||((W=r.elements[T.targetId])==null?void 0:W.kind)!=="ModelComment"||S.set(T.sourceId,[...S.get(T.sourceId)??[],r.elements[T.targetId]]);const I=async()=>{var re,ce,R;if(!s.trim())return;D("Saving…");const T=f?"comment":y,K=kt[T],P=i.trim()||`Model ${K.label}`,q=n({name:P,kind:K.kind,construct:"part",layer:e.layer,file:e.file||"model/generated.sysml",doc:"",attributes:{shortDescription:P,body:s.trim(),author:d.trim()||"currentReviewer",createdAt:new Date().toISOString(),...T==="comment"?{commentStatus:"CommentStatusKind::open"}:{},...T==="rationale"&&x.trim()?{basis:x.trim()}:{},...T==="note"&&x.trim()?{noteKind:x.trim()}:{}}});try{const O=(re=E.getState().model)==null?void 0:re.elements[q],_=Date.now()+1e4;for(;((ce=E.getState().model)==null?void 0:ce.elements[q])===O&&Date.now()<_;)await new Promise(ee=>setTimeout(ee,100));const $=(R=E.getState().model)==null?void 0:R.elements[q];if(!$||$===O)throw new Error("The saved annotation did not appear in the rebuilt model.");const J=await o({type:f?"Composes":K.relation,sourceId:f??q,targetId:f?q:e.id,direction:"outgoing",selectedElementId:f??q});if(!J.success)throw new Error(J.error);l(""),c(""),w(""),h(null),D("Saved.")}catch(O){D(O instanceof Error?O.message:String(O))}},v=(T,K=!1)=>{var re;const P=T.kind==="ModelRationale"?"rationale":T.kind==="ModelNote"?"note":"comment",q=P==="rationale"?"#7C3AED":P==="note"?"#2563EB":"#2DD4A8";return t.jsxs("div",{style:{marginLeft:K?14:0,borderLeft:`2px solid ${K?"#D1D5DB":q}`,padding:"5px 7px",marginBottom:6},children:[t.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[t.jsx("span",{style:{color:q,fontSize:9,fontWeight:700,textTransform:"uppercase"},children:P}),t.jsx("strong",{style:{color:"#374151"},children:T.attributes.author||"Unknown"}),t.jsx("span",{style:{color:"#9CA3AF"},children:T.attributes.createdAt||""})]}),t.jsx("div",{style:{fontSize:11,fontWeight:600,color:"#374151"},children:T.attributes.shortDescription||T.name}),t.jsx("div",{style:{fontSize:11,color:"#4B5563",whiteSpace:"pre-wrap"},children:T.attributes.body}),P==="rationale"&&T.attributes.basis&&t.jsxs("div",{style:{fontSize:10,color:"#7C3AED"},children:["Basis: ",T.attributes.basis]}),P==="note"&&T.attributes.noteKind&&t.jsxs("div",{style:{fontSize:10,color:"#2563EB"},children:["Kind: ",T.attributes.noteKind]}),P==="comment"&&t.jsxs("div",{className:"flex gap-2",style:{marginTop:3},children:[!K&&t.jsx("button",{onClick:()=>{h(T.id),b("comment")},style:{border:0,background:"transparent",color:"#2563EB",fontSize:10,cursor:"pointer"},children:"Reply"}),!((re=T.attributes.commentStatus)!=null&&re.endsWith("resolved"))&&t.jsx("button",{onClick:()=>a(T.id,{commentStatus:"CommentStatusKind::resolved",resolvedBy:d.trim()||"currentReviewer",resolvedAt:new Date().toISOString(),resolution:"Resolved in model review."}),style:{border:0,background:"transparent",color:"#0F766E",fontSize:10,cursor:"pointer"},children:"Resolve"})]}),(S.get(T.id)??[]).map(ce=>v(ce,!0))]},T.id)};return t.jsxs(ie,{title:"Annotations",count:C.length,defaultOpen:!0,children:[C.map(T=>v(T)),f&&t.jsxs("div",{style:{fontSize:10,color:"#0F766E",marginBottom:4},children:["Replying to ",(U=r.elements[f])==null?void 0:U.name," ",t.jsx("button",{onClick:()=>h(null),children:"cancel"})]}),!f&&t.jsxs("select",{value:y,onChange:T=>b(T.target.value),"aria-label":"Annotation type",style:{width:"100%",marginBottom:4,fontSize:11},children:[t.jsx("option",{value:"comment",children:"Comment"}),t.jsx("option",{value:"rationale",children:"Rationale"}),t.jsx("option",{value:"note",children:"Note"})]}),t.jsx("input",{value:d,onChange:T=>u(T.target.value),placeholder:"Author",style:{width:"100%",marginBottom:4,fontSize:11}}),t.jsx("input",{value:i,onChange:T=>l(T.target.value),placeholder:"Short summary",style:{width:"100%",marginBottom:4,fontSize:11}}),!f&&y!=="comment"&&t.jsx("input",{value:x,onChange:T=>w(T.target.value),placeholder:y==="rationale"?"Basis / evidence (optional)":"Note kind (optional)",style:{width:"100%",marginBottom:4,fontSize:11}}),t.jsx("textarea",{value:s,onChange:T=>c(T.target.value),placeholder:f?"Reply":kt[y].placeholder,rows:3,style:{width:"100%",fontSize:11}}),t.jsxs("button",{onClick:I,disabled:!s.trim(),style:{marginTop:4,fontSize:11},children:["Add ",f?"reply":kt[y].label]}),m&&t.jsx("div",{style:{fontSize:10,color:"#6B7280",marginTop:4},children:m})]})}function jl(){const e=E(d=>d.model),r=E(d=>d.selectedRelationshipId);if(!e||!r)return null;const n=e.relationships.find(d=>d.id===r);if(!n)return null;const o=e.elements[n.sourceId],a=e.elements[n.targetId],i=n.type==="flow",l=n.flowItem,s=l&&/energy|power|voltage|current/i.test(l)?"Energy":l&&/material|fluid|gas|batch/i.test(l)?"Material":i?"Data":"Control",c=s==="Energy"?"#D97706":s==="Material"?"#16A34A":s==="Data"?"#3498DB":"#4B5563";return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"p-4",style:{borderBottom:"1px solid #EDEDEA",borderLeft:`3px solid ${c}`},children:[t.jsx("div",{className:"text-sm font-semibold",style:{color:"#1a1a1a"},children:"Connection"}),t.jsxs("div",{className:"mt-1 text-xs",style:{color:"#6B7280"},children:[(o==null?void 0:o.name)??n.sourceId," → ",(a==null?void 0:a.name)??n.targetId]}),t.jsxs("div",{className:"mt-2 flex gap-2",children:[t.jsxs("span",{className:"px-2 py-0.5 rounded-md text-xs font-medium",style:{background:c+"18",color:c},children:[s," flow"]}),t.jsx("span",{className:"px-2 py-0.5 rounded-md text-xs font-medium",style:{background:"#F3F4F6",color:"#374151"},children:n.type})]})]}),t.jsxs("div",{className:"flex-1 overflow-y-auto",children:[t.jsx(ie,{title:"Involved item",defaultOpen:!0,children:t.jsx("div",{className:"text-xs",style:{color:"#374151"},children:l??"No transported item is modeled for this connection."})}),t.jsx(ie,{title:"Endpoints",defaultOpen:!0,children:t.jsxs("div",{className:"space-y-2 text-xs",children:[t.jsxs("div",{children:[t.jsx("span",{style:{color:"#6B7280"},children:"Source"}),t.jsx("div",{style:{color:"#1a1a1a",fontWeight:500},children:(o==null?void 0:o.name)??n.sourceId})]}),t.jsxs("div",{children:[t.jsx("span",{style:{color:"#6B7280"},children:"Target"}),t.jsx("div",{style:{color:"#1a1a1a",fontWeight:500},children:(a==null?void 0:a.name)??n.targetId})]})]})}),t.jsx(ie,{title:"Traceability",defaultOpen:!1,children:t.jsx("div",{className:"text-xs",style:{color:"#6B7280"},children:n.file||"Model relationship"})})]})]})}function Cl(){const e=E(s=>s.selectedElementId),r=E(s=>s.activeView),n=E(s=>s.selectedRelationshipId),o=E(s=>s.propertiesPanelCollapsed),a=E(s=>s.togglePropertiesPanel);if(o)return t.jsxs("div",{className:"flex flex-col items-center flex-shrink-0 cursor-pointer",style:{width:"40px",background:"#FAFAF8",borderLeft:"1px solid #E5E5E0"},onClick:a,title:"Expand properties",children:[t.jsx("div",{className:"flex items-center justify-center mt-2",style:{color:"#6B7280",fontSize:"18px",width:"32px",height:"32px",borderRadius:"6px"},children:"‹"}),t.jsx("div",{style:{writingMode:"vertical-rl",textOrientation:"mixed",color:"#6B7280",fontSize:"10px",fontWeight:400},children:"Properties"})]});const i=r.type==="diagram"&&!e&&!n,l=!!e;return t.jsxs("div",{className:"flex flex-col overflow-hidden flex-shrink-0",style:{width:"300px",background:"#FAFAF8",borderLeft:"1px solid #E5E5E0"},children:[t.jsxs("div",{className:"flex items-center justify-between px-3 py-2",style:{background:"#F0F0ED",borderBottom:"1px solid #E5E5E0",flexShrink:0},children:[t.jsx("span",{style:{fontSize:12,fontWeight:600,color:"#374151"},children:"Properties"}),t.jsx("button",{onClick:a,className:"flex items-center justify-center",style:{color:"#6B7280",fontSize:"18px",lineHeight:1,width:"28px",height:"28px",borderRadius:"5px",background:"#FFFFFF",border:"1px solid #E5E5E0"},onMouseEnter:s=>s.currentTarget.style.color="#374151",onMouseLeave:s=>s.currentTarget.style.color="#6B7280",title:"Collapse properties","aria-label":"Collapse properties",children:"›"})]}),n?t.jsx(jl,{}):l?t.jsx(Sl,{}):i?t.jsx(wl,{}):t.jsx("div",{className:"flex-1 flex items-center justify-center p-4",children:t.jsx("span",{className:"text-xs text-center",style:{color:"#6B7280"},children:"Select an element or diagram to view properties"})})]})}function Jt(e=g.border){return{borderTop:`1px solid ${e}`}}function Dl({placeholder:e,value:r,onChange:n}){return t.jsx("input",{type:"text",value:r,placeholder:e,onChange:o=>n(o.target.value),className:"flex-1 px-2 py-1 rounded focus:outline-none",style:{background:"#F7F7F5",border:"1px solid #E5E5E0",color:g.primary,fontSize:F.xs,minWidth:0}})}function Fl({values:e}){const r=[...new Set(e.filter(Boolean))];return r.length===0?t.jsx("span",{style:{color:g.faint,fontSize:"12px"},children:"—"}):r.length===1?t.jsx("span",{style:{color:g.muted,fontSize:"12px"},children:r[0]}):t.jsxs("span",{style:{color:"#F59E0B",fontSize:"12px"},children:[r.length," different values"]})}function Nl(){const e=E(f=>f.model),r=E(f=>f.selectedElementIds),n=E(f=>f.clearElementSelection),o=E(f=>f.bulkUpdateAttributes),a=p.useMemo(()=>[...r],[r]),i=p.useMemo(()=>a.map(f=>e==null?void 0:e.elements[f]).filter(Boolean),[a,e]),l=p.useMemo(()=>{if(i.length===0)return[];const f="_",h=i.map(D=>new Set(Object.keys(D.attributes).filter(N=>!N.startsWith(f))));return[...h[0]].filter(D=>h.every(N=>N.has(D))).sort()},[i]),s=p.useMemo(()=>{const f={};for(const h of l)f[h]=i.map(m=>m.attributes[h]??"");return f},[i,l]),c=p.useMemo(()=>[...new Set(i.map(f=>f.kind))].sort(),[i]),[d,u]=p.useState({}),y=p.useCallback((f,h)=>{u(m=>({...m,[f]:h}))},[]),b=Object.values(d).some(f=>f!==""),x=p.useCallback(()=>{const f=Object.fromEntries(Object.entries(d).filter(([,h])=>h!==""));Object.keys(f).length!==0&&(o(a,f),u({}))},[d,a,o]),w=p.useCallback(()=>{u({})},[]);return i.length<2?null:t.jsxs("div",{className:"flex flex-col overflow-hidden",style:{width:"280px",background:g.surface,borderLeft:`1px solid ${g.border}`,fontSize:F.xs},children:[t.jsxs("div",{className:"flex items-center justify-between px-4 py-3 flex-shrink-0",style:{borderBottom:`1px solid ${g.border}`},children:[t.jsxs("div",{children:[t.jsx("div",{className:"font-semibold",style:{color:g.primary,fontSize:F.sm},children:"Bulk Edit"}),t.jsxs("div",{style:{color:g.muted,fontSize:"12px",marginTop:"2px"},children:[a.length," elements selected"]})]}),t.jsx("button",{onClick:n,className:"px-2 py-1 rounded",style:{color:g.muted,background:"#F0F0ED",fontSize:"12px"},title:"Clear selection",children:"✕ Clear"})]}),t.jsxs("div",{className:"px-4 py-3 flex-shrink-0",style:Jt(),children:[t.jsx("div",{style:{color:g.muted,fontSize:"12px",fontWeight:600,marginBottom:"6px",textTransform:"uppercase",letterSpacing:"0.5px"},children:"Selection"}),t.jsx("div",{className:"flex flex-wrap gap-1",children:c.map(f=>t.jsx("span",{className:"px-2 py-0.5 rounded-full",style:{background:"#EEF2FF",color:"#4F46E5",fontSize:"12px",fontWeight:500},children:f},f))}),t.jsxs("div",{style:{color:g.faint,fontSize:"12px",marginTop:"6px"},children:[i.map(f=>f.name).slice(0,5).join(", "),i.length>5&&` +${i.length-5} more`]})]}),t.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-3",style:Jt(),children:[t.jsxs("div",{style:{color:g.muted,fontSize:"12px",fontWeight:600,marginBottom:"8px",textTransform:"uppercase",letterSpacing:"0.5px"},children:["Common Attributes",l.length>0&&t.jsxs("span",{style:{color:g.faint,fontWeight:400,marginLeft:"4px"},children:["(",l.length,")"]})]}),l.length===0?t.jsx("div",{style:{color:g.faint,fontSize:"12px"},children:"No common attributes across selected elements."}):t.jsx("div",{className:"space-y-3",children:l.map(f=>t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between mb-1",children:[t.jsx("span",{style:{color:g.secondary,fontSize:"12px",fontWeight:500},children:f}),t.jsx(Fl,{values:s[f]})]}),t.jsx(Dl,{placeholder:`Set for all ${a.length} elements…`,value:d[f]??"",onChange:h=>y(f,h)})]},f))})]}),l.length>0&&t.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 flex-shrink-0",style:Jt(),children:[t.jsx("button",{onClick:w,disabled:!b,className:"flex-1 py-1.5 rounded",style:{fontSize:F.xs,fontWeight:500,color:b?g.secondary:g.faint,background:b?"#F0F0ED":"#F7F7F5",cursor:b?"pointer":"default"},children:"Reset"}),t.jsxs("button",{onClick:x,disabled:!b,className:"flex-1 py-1.5 rounded font-semibold",style:{fontSize:F.xs,color:"#FFFFFF",background:b?"#2DD4A8":"#A7F3D0",cursor:b?"pointer":"default"},children:["Apply to ",a.length]})]})]})}const ur="memo-gapbar-pulse";if(typeof document<"u"&&!document.getElementById(ur)){const e=document.createElement("style");e.id=ur,e.textContent=`
34
- @keyframes memo-pulse-red {
35
- 0%, 100% { opacity: 1; }
36
- 50% { opacity: 0.35; }
37
- }
38
- `,document.head.appendChild(e)}const Et={error:{color:"#DC2626",bg:"#FEF2F2",icon:"✖"},warning:{color:"#D97706",bg:"#FFFBEB",icon:"⚠"},info:{color:"#2563EB",bg:"#EFF6FF",icon:"ℹ"}};function Al(){const e=E(v=>v.validation),r=E(v=>v.analysisIssues),n=E(v=>v.selectElement),o=E(v=>v.model),a=E(v=>v.completeness),i=E(v=>v.gapBarExpanded),l=E(v=>v.toggleGapBar),s=E(v=>v.gapBarHeight),c=E(v=>v.setGapBarHeight),[d,u]=p.useState("problems"),y=p.useRef(!1),b=p.useRef(0),x=p.useRef(0),w=o?Object.keys(o.elements).length:0,f=(e==null?void 0:e.violations.filter(v=>v.severity==="error"))??[],h=(e==null?void 0:e.violations.filter(v=>v.severity==="warning"))??[],m=(e==null?void 0:e.violations.length)??0,D=r.filter(v=>v.severity==="warning").length,N=m>0||r.length>0,j=!!a,C=N&&j,S=(a==null?void 0:a.layers.filter(v=>v.totalElements>0))??[],I=p.useCallback(v=>{v.preventDefault(),y.current=!0,b.current=v.clientY,x.current=s;const L=U=>{if(!y.current)return;const T=b.current-U.clientY;c(x.current+T)},W=()=>{y.current=!1,document.removeEventListener("mousemove",L),document.removeEventListener("mouseup",W)};document.addEventListener("mousemove",L),document.addEventListener("mouseup",W)},[s,c]);return t.jsxs("div",{style:{background:g.surface,borderTop:`1px solid ${g.border}`,flexShrink:0},children:[i&&t.jsx("div",{style:{height:"4px",cursor:"row-resize",background:"transparent",flexShrink:0},onMouseDown:I,onMouseEnter:v=>{v.currentTarget.style.background=g.accent+"40"},onMouseLeave:v=>{v.currentTarget.style.background="transparent"}}),t.jsxs("div",{className:"flex items-center px-4 gap-3 cursor-pointer select-none",style:{height:"32px",fontSize:F.sm},onClick:l,children:[t.jsx("span",{style:{color:g.faint,fontSize:"10px",transition:"transform 150ms ease",transform:i?"rotate(0deg)":"rotate(-90deg)",display:"inline-block"},children:"▼"}),t.jsx("span",{style:{color:g.secondary,fontWeight:600,fontSize:F.xs},children:"Problems"}),f.length>0&&t.jsxs("span",{className:"flex items-center gap-1",style:{color:"#DC2626",fontSize:F.xs},children:[t.jsx("span",{style:{fontSize:"10px"},children:"✖"})," ",f.length]}),h.length>0&&t.jsxs("span",{className:"flex items-center gap-1",style:{color:"#D97706",fontSize:F.xs},children:[t.jsx("span",{style:{fontSize:"10px"},children:"⚠"})," ",h.length]}),D>0&&t.jsxs("span",{className:"flex items-center gap-1",style:{color:"#D97706",fontSize:F.xs},children:[t.jsx("span",{style:{fontSize:"9px",opacity:.7},children:"DSM"}),t.jsx("span",{style:{fontSize:"10px"},children:"⚠"})," ",D]}),!N&&e&&t.jsx("span",{style:{color:"#10B981",fontSize:F.xs},children:"✓ No problems"}),!e&&t.jsx("span",{style:{color:g.faint,fontSize:F.xs},children:"Waiting for validation…"}),j&&t.jsxs(t.Fragment,{children:[t.jsx("div",{style:{width:"1px",height:"14px",background:g.border,flexShrink:0}}),t.jsx("span",{style:{color:g.secondary,fontWeight:600,fontSize:F.xs},children:"Completeness"}),t.jsxs("span",{style:{color:a.overall>=80?"#10B981":a.overall>=50?"#D97706":"#DC2626",fontSize:F.xs,fontWeight:600},children:[a.overall,"%"]}),t.jsx("div",{className:"flex items-center gap-0.5",children:S.map(v=>{const L=v.percentage<40;return t.jsx("div",{title:`${lt[v.layerId]||v.layerLabel}: ${v.percentage}%`,style:{width:8,height:8,borderRadius:"2px",background:v.layerColor,opacity:Math.max(v.percentage/100,.12),flexShrink:0,animation:L?"memo-pulse-red 1.4s ease-in-out infinite":"none",cursor:"default"}},v.layerId)})})]}),t.jsxs("span",{className:"ml-auto flex items-center gap-1",style:{fontSize:F.xs},children:[e&&t.jsxs("span",{style:{color:g.faint},children:[e.rulesEvaluated," rules | ",e.rulesPassed," passed |"," "]}),t.jsxs("strong",{style:{color:g.secondary,fontWeight:700},children:[w," elements"]}),o&&t.jsxs(t.Fragment,{children:[t.jsx("span",{style:{color:g.faint},children:" · "}),t.jsxs("strong",{style:{color:g.secondary,fontWeight:700},children:[o.relationships.length," rels"]})]})]})]}),i&&t.jsxs("div",{style:{borderTop:`1px solid ${g.borderLight}`},children:[C&&t.jsx("div",{className:"flex",style:{borderBottom:`1px solid ${g.border}`,background:"#FAFAF8"},children:["problems","completeness"].map(v=>t.jsx("button",{onClick:L=>{L.stopPropagation(),u(v)},className:"px-4 py-1.5 font-medium transition-colors",style:{fontSize:F.xs,borderBottom:d===v?`2px solid ${g.accent}`:"2px solid transparent",color:d===v?g.accentDark:g.faint,background:"transparent"},children:v==="problems"?`Problems (${m+r.length})`:`Completeness ${a.overall}%`},v))}),(d==="problems"||!C)&&t.jsx("div",{className:"overflow-y-auto",style:{maxHeight:`${s}px`},children:N?t.jsxs(t.Fragment,{children:[m>0&&(e==null?void 0:e.violations.map((v,L)=>{const W=Et[v.severity]||Et.info;return t.jsxs("div",{className:"flex items-center gap-2 px-4 py-1.5 cursor-pointer transition-colors",style:{color:W.color,fontSize:F.xs},onMouseEnter:U=>U.currentTarget.style.background=W.bg,onMouseLeave:U=>U.currentTarget.style.background="transparent",onClick:()=>n(v.elementId),children:[t.jsx("span",{children:W.icon}),t.jsxs("span",{style:{color:g.faint},children:["[",v.ruleId,"]"]}),t.jsxs("span",{className:"font-medium",children:[v.elementKind,"/",v.elementName]}),t.jsx("span",{className:"truncate flex-1",style:{color:g.muted},children:v.description})]},`${v.ruleId}-${v.elementId}-${L}`)})),r.length>0&&t.jsxs(t.Fragment,{children:[m>0&&t.jsx("div",{style:{padding:"4px 16px",fontSize:"10px",fontWeight:600,color:g.faint,background:g.surfaceAlt,borderTop:`1px solid ${g.border}`,textTransform:"uppercase",letterSpacing:"0.06em"},children:"DSM Analysis"}),r.map(v=>{const L=Et[v.severity]||Et.info;return t.jsxs("div",{className:"flex items-center gap-2 px-4 py-1.5 cursor-pointer transition-colors",style:{color:L.color,fontSize:F.xs},onMouseEnter:W=>W.currentTarget.style.background=L.bg,onMouseLeave:W=>W.currentTarget.style.background="transparent",onClick:()=>n(v.elementId),children:[t.jsx("span",{children:L.icon}),t.jsxs("span",{style:{color:g.faint},children:["[",v.source,"]"]}),t.jsx("span",{className:"font-medium",children:v.elementName}),t.jsx("span",{className:"truncate flex-1",style:{color:g.muted},children:v.message}),v.tag&&t.jsx("span",{style:{flexShrink:0,fontSize:"9px",padding:"1px 5px",borderRadius:"4px",background:"#E5E7EB",color:"#374151"},children:v.tag})]},v.id)})]})]}):t.jsx("div",{className:"px-4 py-3",style:{color:g.faint,fontSize:F.xs},children:e?"✓ No problems found":"Waiting for validation…"})}),(d==="completeness"||!C)&&j&&t.jsxs("div",{className:"overflow-y-auto",style:{maxHeight:`${s}px`},children:[t.jsxs("div",{className:"px-4 py-2 flex items-center gap-3",style:{borderBottom:`1px solid ${g.borderLight}`},children:[t.jsxs("span",{style:{fontWeight:700,fontSize:"18px",color:a.overall>=80?"#10B981":a.overall>=50?"#D97706":"#DC2626"},children:[a.overall,"%"]}),t.jsx("div",{className:"flex-1 flex items-center gap-0.5",style:{height:"8px"},children:S.map(v=>{const L=Math.max(v.totalElements/a.totalElements*100,2);return t.jsx("div",{style:{width:`${L}%`,height:"100%",background:v.layerColor+"30",borderRadius:"4px",overflow:"hidden"},children:t.jsx("div",{style:{width:`${v.percentage}%`,height:"100%",background:v.layerColor,borderRadius:"4px"}})},v.layerId)})}),t.jsxs("span",{style:{color:g.faint,fontSize:F.xs},children:[a.completeElements,"/",a.totalElements]})]}),t.jsx("div",{className:"px-4 py-2 grid gap-1.5",style:{gridTemplateColumns:"repeat(auto-fill, minmax(220px, 1fr))"},children:S.map(v=>t.jsxs("div",{className:"flex items-center gap-2",style:{fontSize:F.xs},children:[t.jsx("span",{className:"w-2.5 h-2.5 rounded flex-shrink-0",style:{backgroundColor:v.layerColor}}),t.jsx("span",{className:"flex-1 truncate",style:{color:"#374151"},children:lt[v.layerId]||v.layerLabel}),t.jsxs("span",{style:{color:"#6B7280"},children:[v.percentage,"%"]}),t.jsxs("span",{style:{color:"#9CA3AF"},children:["(",v.completeElements,"/",v.totalElements,")"]})]},v.layerId))})]})]})]})}function Tl(){const[e,r]=p.useState(!1),[n,o]=p.useState(""),[a,i]=p.useState(0),l=p.useRef(null),s=E(h=>h.model),c=E(h=>h.selectElement),d=E(h=>h.setActiveView),u=E(h=>h.selectViewpoint),y=E(h=>h.setExplorerTab);p.useEffect(()=>{const h=m=>{(m.metaKey||m.ctrlKey)&&m.key==="k"&&(m.preventDefault(),r(D=>!D),o(""),i(0)),m.key==="Escape"&&e&&r(!1)};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[e]),p.useEffect(()=>{e&&setTimeout(()=>{var h;return(h=l.current)==null?void 0:h.focus()},50)},[e]);const b=p.useMemo(()=>{const h=[];if(h.push({id:"tool:dsm",label:"DSM",sublabel:"Design Structure Matrix",kind:"tool",action:()=>d({type:"dsm"})},{id:"tool:traceability",label:"Traceability Matrix",sublabel:"N×N trace matrix with presets",kind:"tool",action:()=>d({type:"traceability"})},{id:"tool:ontology",label:"Ontology",sublabel:"Ontology Viewer",kind:"tool",action:()=>d({type:"ontology"})}),!s)return h;for(const m of s.diagrams??[]){const D=Le[m.diagramType];h.push({id:`diag:${m.id}`,label:m.name,sublabel:(D==null?void 0:D.fullName)||m.diagramType,kind:"diagram",color:D==null?void 0:D.color,action:()=>{d({type:"diagram",diagramId:m.id}),u(m.viewpointId==="__model"?null:m.viewpointId),y("views")}})}for(const m of s.viewpoints??[])h.push({id:`vp:${m.id}`,label:m.label,sublabel:"Viewpoint",kind:"viewpoint",action:()=>{u(m.id),y("views")}});for(const m of Object.values(s.elements))h.push({id:`el:${m.id}`,label:m.name,sublabel:`${m.kind} · ${m.layer}`,kind:"element",color:se[m.layer],action:()=>{c(m.id),y("model")}});return h},[s,d,c,u,y]),x=p.useMemo(()=>{if(!n)return b.slice(0,20);const h=n.toLowerCase();return b.filter(m=>{var D;return m.label.toLowerCase().includes(h)||((D=m.sublabel)==null?void 0:D.toLowerCase().includes(h))}).slice(0,20)},[b,n]);p.useEffect(()=>{i(0)},[x]);const w=p.useCallback(h=>{h.key==="ArrowDown"&&(h.preventDefault(),i(m=>Math.min(m+1,x.length-1))),h.key==="ArrowUp"&&(h.preventDefault(),i(m=>Math.max(m-1,0))),h.key==="Enter"&&x[a]&&(x[a].action(),r(!1))},[x,a]);if(!e)return null;const f={element:"○",diagram:"▦",tool:"⚙",viewpoint:"◉"};return t.jsx("div",{className:"fixed inset-0 z-50 flex items-start justify-center pt-24",style:{background:"rgba(0,0,0,0.4)"},onClick:()=>r(!1),children:t.jsxs("div",{className:"rounded-xl overflow-hidden",style:{width:"520px",maxHeight:"400px",background:"#FFFFFF",boxShadow:"0 16px 48px rgba(0,0,0,0.2)"},onClick:h=>h.stopPropagation(),children:[t.jsxs("div",{className:"flex items-center gap-2 px-4 py-3",style:{borderBottom:"1px solid #E5E5E0"},children:[t.jsx("span",{style:{color:"#9CA3AF",fontSize:"14px"},children:"⌕"}),t.jsx("input",{ref:l,type:"text",placeholder:"Search elements, diagrams, tools...",value:n,onChange:h=>o(h.target.value),onKeyDown:w,className:"flex-1 text-sm focus:outline-none",style:{color:"#1a1a1a",background:"transparent"}}),t.jsx("kbd",{className:"px-1.5 py-0.5 rounded text-xs",style:{background:"#F0F0ED",color:"#9CA3AF",fontSize:"10px"},children:"ESC"})]}),t.jsxs("div",{className:"overflow-y-auto",style:{maxHeight:"340px"},children:[x.length===0&&t.jsx("div",{className:"px-4 py-6 text-center text-xs",style:{color:"#9CA3AF"},children:"No results found"}),x.map((h,m)=>t.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 cursor-pointer",style:{background:m===a?"#F0F0ED":"transparent"},onMouseEnter:()=>i(m),onClick:()=>{h.action(),r(!1)},children:[t.jsx("span",{style:{color:h.color||"#9CA3AF",fontSize:"12px"},children:f[h.kind]||"○"}),t.jsx("span",{className:"text-sm truncate",style:{color:"#1a1a1a"},children:h.label}),h.sublabel&&t.jsx("span",{className:"text-xs truncate ml-auto",style:{color:"#9CA3AF"},children:h.sublabel})]},h.id))]}),t.jsx("div",{className:"px-4 py-2 flex items-center gap-3",style:{borderTop:"1px solid #E5E5E0",background:"#FAFAF8"},children:t.jsxs("span",{className:"text-xs",style:{color:"#9CA3AF"},children:["↑↓"," navigate · ","↵"," select · esc close"]})})]})})}function Rl(e){const r=e.trim().split(/\r?\n/).filter(Boolean);if(r.length<2)return{headers:[],rows:[]};const o=r[0].includes(" ")?" ":",",a=s=>s.split(o).map(c=>c.replace(/^"(.*)"$/,"$1").replace(/""/g,'"').trim()),i=a(r[0]),l=r.slice(1).map(s=>{const c=a(s),d={};return i.forEach((u,y)=>{d[u]=c[y]??""}),d});return{headers:i,rows:l}}const pr=["id","name","kind","construct","doc","— skip —"];function Ml(){const e=E(k=>k.bulkImportOpen),r=E(k=>k.setBulkImportOpen),n=E(k=>k.importResult),o=E(k=>k.clearImportResult),a=E(k=>k.model),i=p.useRef(null),[l,s]=p.useState("input"),[c,d]=p.useState(""),[u,y]=p.useState(null),[b,x]=p.useState("bulk_import"),[w,f]=p.useState(""),[h,m]=p.useState([]),[D,N]=p.useState([]),[j,C]=p.useState([]),[S,I]=p.useState([]),[v,L]=p.useState([]),[W,U]=p.useState([]),[T,K]=p.useState(""),[P,q]=p.useState(!1);yo.useMemo(()=>a?Array.from(new Set(Object.values(a.elements).map(k=>k.kind))).sort():[],[a]),p.useEffect(()=>{e||(s("input"),d(""),y(null),x("bulk_import"),f(""),m([]),N([]),C([]),I([]),L([]),U([]),K(""),q(!1),o())},[e,o]),p.useEffect(()=>{n&&q(!1)},[n]);const re=p.useCallback(()=>{r(!1)},[r]),ce=p.useCallback(k=>{var V;const B=(V=k.target.files)==null?void 0:V[0];if(!B)return;const A=new FileReader;A.onload=G=>{var ne;const X=(ne=G.target)==null?void 0:ne.result;d(X),f("");const z=B.name.replace(/\.[^.]+$/,"").replace(/[^a-zA-Z0-9_]/g,"_");z&&x(z)},A.readAsText(B)},[]),R=p.useCallback(()=>{if(!c.trim()){f("Paste CSV data or upload a file first.");return}const{headers:k,rows:B}=Rl(c);if(k.length===0){f("Could not parse headers. Make sure the first row contains column names.");return}if(B.length===0){f("No data rows found after the header row.");return}m(k),N(B),C(mi(k,u??void 0)),f(""),s("mapping")},[c,u]),O=p.useCallback(()=>{const k=u==null?void 0:u.defaultKind,B=yi(D,j,{},k);K(B.csv),U(B.warnings);const A=B.csv.trim().split(`
39
- `);if(A.length<2){L(["No rows to preview after applying mappings."]),I([]),s("preview");return}const V=A[0].split(",").map(z=>z.replace(/^"|"$/g,"").trim()),G=[],X=[];A.slice(1,21).forEach((z,ne)=>{const Ee=z.split(",").map(Se=>Se.replace(/^"|"$/g,"").trim()),ue={rowIndex:ne+1,id:"",name:"",kind:"",doc:""};V.forEach((Se,le)=>{ue[Se]=Ee[le]??""}),ue.id||X.push(`Row ${ne+2}: missing id`),ue.name||X.push(`Row ${ne+2}: missing name`),ue.kind||X.push(`Row ${ne+2}: missing kind`),G.push(ue)}),I(G),L(X),s("preview")},[D,j,u]),_=p.useCallback(()=>{T&&(q(!0),o(),Li({elementsCsv:T,packageName:b||"bulk_import"}))},[T,b,o]),$=p.useCallback((k,B)=>{C(A=>A.map((V,G)=>G===k?{...V,targetAttribute:B}:V))},[]);if(!e)return null;const J={input:"1 · Input",mapping:"2 · Map columns",preview:"3 · Preview & Import"},ee=["input","mapping","preview"],de=ee.indexOf(l);return t.jsx("div",{ref:i,className:"fixed inset-0 z-50 flex items-center justify-center",style:{background:"rgba(0,0,0,0.35)"},onMouseDown:k=>{k.target===i.current&&re()},children:t.jsxs("div",{className:"flex flex-col rounded-2xl overflow-hidden",style:{width:680,maxHeight:"90vh",background:"#FFFFFF",boxShadow:"0 24px 64px rgba(0,0,0,0.18)",border:"1px solid #E5E5E0"},children:[t.jsxs("div",{className:"flex items-center justify-between px-6 py-4",style:{background:"linear-gradient(135deg, #1B3A4B, #2D6A7A)",flexShrink:0},children:[t.jsxs("div",{children:[t.jsx("h2",{style:{fontSize:"15px",fontWeight:700,color:"#2DD4A8",margin:0},children:"Bulk Import Elements"}),t.jsx("p",{style:{fontSize:"12px",color:"rgba(255,255,255,0.6)",margin:"2px 0 0"},children:"Import from CSV, Excel paste, or requirements spreadsheet"})]}),t.jsx("button",{onClick:re,style:Il,children:"✕"})]}),t.jsx("div",{className:"flex",style:{borderBottom:"1px solid #F0F0EC",background:"#FAFAF8",flexShrink:0},children:ee.map((k,B)=>t.jsx("div",{className:"flex-1 flex items-center justify-center py-2.5",style:{fontSize:F.xs,fontWeight:B===de?700:400,color:B===de?"#1B3A4B":B<de?"#2D6A7A":"#9CA3AF",borderBottom:B===de?"2px solid #2D6A7A":"2px solid transparent"},children:J[k]},k))}),t.jsxs("div",{className:"flex-1 overflow-y-auto px-6 py-5",style:{minHeight:0},children:[l==="input"&&t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{style:Xt,children:"Artifact type (recipe preset)"}),t.jsxs("select",{value:(u==null?void 0:u.id)??"",onChange:k=>{const B=$n.find(A=>A.id===k.target.value)??null;y(B)},style:Qt,children:[t.jsx("option",{value:"",children:"— Custom / no preset —"}),$n.map(k=>t.jsx("option",{value:k.id,children:k.name},k.id))]}),u&&t.jsx("p",{style:{fontSize:F.xs,color:"#6B7280",marginTop:4},children:u.description})]}),t.jsxs("div",{children:[t.jsxs("label",{style:Xt,children:["Package name ",t.jsx("span",{style:{color:"#9CA3AF",fontWeight:400},children:"(for the generated .sysml file)"})]}),t.jsx("input",{type:"text",value:b,onChange:k=>x(k.target.value.replace(/[^a-zA-Z0-9_]/g,"_")),style:Qt,placeholder:"bulk_import"})]}),t.jsxs("div",{children:[t.jsxs("label",{style:Xt,children:["CSV data ",t.jsx("span",{style:{color:"#E74C3C"},children:"*"})]}),t.jsx("textarea",{value:c,onChange:k=>{d(k.target.value),f("")},placeholder:`Paste CSV or tab-separated data here.
40
- First row must be the header.
41
-
42
- Example:
43
- id,name,kind,doc
44
- req_001,System shall be safe,Requirement,Safety requirement`,rows:10,style:{...Qt,resize:"vertical",fontFamily:"monospace",fontSize:"12px",lineHeight:"1.5"}}),w&&t.jsx("p",{style:{fontSize:F.xs,color:"#E74C3C",marginTop:4},children:w})]}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("span",{style:{fontSize:F.xs,color:"#6B7280"},children:"or upload a file:"}),t.jsxs("label",{style:{cursor:"pointer",padding:"4px 12px",borderRadius:6,background:"#F3F4F6",border:"1px solid #E5E5E0",fontSize:F.xs,color:"#374151"},children:["Browse…",t.jsx("input",{type:"file",accept:".csv,.tsv,.txt",style:{display:"none"},onChange:ce})]}),c&&t.jsxs("span",{style:{fontSize:F.xs,color:"#6B7280"},children:[c.split(`
45
- `).length," line(s) loaded"]})]})]}),l==="mapping"&&t.jsxs("div",{className:"flex flex-col gap-3",children:[t.jsxs("p",{style:{fontSize:F.xs,color:"#6B7280",margin:0},children:["Map each source column to a MEMO attribute. ",t.jsx("strong",{children:"id"}),", ",t.jsx("strong",{children:"name"}),", and ",t.jsx("strong",{children:"kind"})," are required. Unrecognised columns are passed through as dynamic attributes."]}),t.jsxs("div",{style:{border:"1px solid #E5E5E0",borderRadius:8,overflow:"hidden"},children:[t.jsxs("div",{className:"flex",style:{background:"#F8F8F5",padding:"8px 12px",borderBottom:"1px solid #E5E5E0"},children:[t.jsx("span",{style:{flex:1,fontSize:F.xs,fontWeight:600,color:"#374151"},children:"Source column"}),t.jsx("span",{style:{flex:1,fontSize:F.xs,fontWeight:600,color:"#374151"},children:"Maps to"}),t.jsx("span",{style:{width:80,fontSize:F.xs,fontWeight:600,color:"#374151"},children:"Transform"})]}),j.map((k,B)=>{const A=["id","name","kind"].includes(k.targetAttribute),V=!k.targetAttribute,G=j.filter((z,ne)=>ne!==B&&["id","name","kind","doc","construct"].includes(z.targetAttribute)).map(z=>z.targetAttribute),X=pr.filter(z=>z==="— skip —"||!G.includes(z)||z===k.targetAttribute);return t.jsxs("div",{className:"flex items-center",style:{padding:"6px 12px",borderBottom:B<j.length-1?"1px solid #F0F0EC":"none",background:A?"#F0FDF4":"transparent"},children:[t.jsx("div",{style:{flex:1,fontSize:F.xs,color:"#374151",fontFamily:"monospace"},children:k.sourceColumn}),t.jsx("div",{style:{flex:1,paddingRight:8},children:t.jsxs("select",{value:k.targetAttribute||"",onChange:z=>$(B,z.target.value==="— skip —"?"":z.target.value),style:{width:"100%",fontSize:F.xs,padding:"3px 6px",borderRadius:5,border:`1px solid ${V?"#E5E5E0":A?"#22C55E":"#E5E5E0"}`,background:V?"#F9FAFB":"#FFFFFF",color:V?"#9CA3AF":"#1a1a1a"},children:[X.map(z=>t.jsx("option",{value:z,children:z},z)),k.targetAttribute&&!pr.includes(k.targetAttribute)&&t.jsx("option",{value:k.targetAttribute,children:k.targetAttribute})]})}),t.jsx("div",{style:{width:80,fontSize:"10px",color:"#9CA3AF"},children:k.transform??"—"})]},B)})]}),D.length>0&&t.jsxs("details",{children:[t.jsxs("summary",{style:{fontSize:F.xs,color:"#6B7280",cursor:"pointer",marginTop:4},children:["Show raw data sample (",Math.min(D.length,3)," of ",D.length," rows)"]}),t.jsx("div",{style:{marginTop:6,overflowX:"auto"},children:t.jsxs("table",{style:{fontSize:"10px",borderCollapse:"collapse",width:"100%"},children:[t.jsx("thead",{children:t.jsx("tr",{children:h.map(k=>t.jsx("th",{style:ze,children:k},k))})}),t.jsx("tbody",{children:D.slice(0,3).map((k,B)=>t.jsx("tr",{children:h.map(A=>t.jsx("td",{style:Ze,children:k[A]??""},A))},B))})]})})]})]}),l==="preview"&&t.jsxs("div",{className:"flex flex-col gap-4",children:[v.length>0&&t.jsxs("div",{style:{background:"#FEF2F2",border:"1px solid #FECACA",borderRadius:8,padding:"10px 14px"},children:[t.jsxs("p",{style:{fontSize:F.xs,fontWeight:700,color:"#DC2626",margin:"0 0 4px"},children:[v.length," validation error(s) — rows with missing required fields will be skipped"]}),v.slice(0,5).map((k,B)=>t.jsx("p",{style:{fontSize:"11px",color:"#DC2626",margin:"1px 0"},children:k},B)),v.length>5&&t.jsxs("p",{style:{fontSize:"11px",color:"#DC2626",margin:"2px 0 0"},children:["+",v.length-5," more…"]})]}),W.length>0&&t.jsxs("div",{style:{background:"#FFFBEB",border:"1px solid #FDE68A",borderRadius:8,padding:"10px 14px"},children:[t.jsxs("p",{style:{fontSize:F.xs,fontWeight:700,color:"#D97706",margin:"0 0 4px"},children:[W.length," warning(s)"]}),W.slice(0,3).map((k,B)=>t.jsx("p",{style:{fontSize:"11px",color:"#D97706",margin:"1px 0"},children:k},B))]}),n&&t.jsxs("div",{style:{background:n.success?"#F0FDF4":"#FEF2F2",border:`1px solid ${n.success?"#86EFAC":"#FECACA"}`,borderRadius:8,padding:"12px 14px"},children:[t.jsx("p",{style:{fontSize:F.xs,fontWeight:700,margin:"0 0 4px",color:n.success?"#16A34A":"#DC2626"},children:n.success?`Import complete — ${n.elementsImported} element(s) written to ${n.generatedFile??"model"}`:"Import failed"}),n.errors.map((k,B)=>t.jsx("p",{style:{fontSize:"11px",color:"#DC2626",margin:"1px 0"},children:k},B)),n.warnings.slice(0,3).map((k,B)=>t.jsx("p",{style:{fontSize:"11px",color:"#D97706",margin:"1px 0"},children:k},B))]}),S.length>0&&t.jsxs(t.Fragment,{children:[t.jsxs("p",{style:{fontSize:F.xs,color:"#6B7280",margin:0},children:["Showing first ",S.length," of ",D.length," row(s)",D.length>S.length&&` (+${D.length-S.length} more will be imported)`]}),t.jsx("div",{style:{overflowX:"auto",borderRadius:8,border:"1px solid #E5E5E0"},children:t.jsxs("table",{style:{fontSize:"11px",borderCollapse:"collapse",width:"100%"},children:[t.jsx("thead",{children:t.jsxs("tr",{style:{background:"#F8F8F5"},children:[t.jsx("th",{style:ze,children:"#"}),t.jsx("th",{style:ze,children:"id"}),t.jsx("th",{style:ze,children:"name"}),t.jsx("th",{style:ze,children:"kind"}),t.jsx("th",{style:ze,children:"doc"})]})}),t.jsx("tbody",{children:S.map(k=>{const B=!k.id||!k.name||!k.kind;return t.jsxs("tr",{style:{background:B?"#FEF9F9":"transparent"},children:[t.jsx("td",{style:fr,children:k.rowIndex}),t.jsx("td",{style:{...fr,color:k.id?"#1a1a1a":"#DC2626"},children:k.id||"⚠ missing"}),t.jsx("td",{style:{...Ze,maxWidth:160,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:String(k.name||"—")}),t.jsx("td",{style:{...Ze,color:k.kind?"#1B3A4B":"#DC2626"},children:k.kind||"⚠ missing"}),t.jsx("td",{style:{...Ze,maxWidth:180,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:"#6B7280"},children:String(k.doc||"—")})]},k.rowIndex)})})]})})]}),S.length===0&&v.length===0&&t.jsx("p",{style:{fontSize:F.xs,color:"#9CA3AF",textAlign:"center",padding:"24px 0"},children:"No rows to preview."})]})]}),t.jsxs("div",{className:"flex items-center justify-between px-6 py-4",style:{borderTop:"1px solid #F0F0EC",background:"#FAFAF8",flexShrink:0},children:[t.jsx("div",{className:"flex gap-2",children:l!=="input"&&!n&&t.jsx("button",{onClick:()=>s(ee[de-1]),style:mr,children:"← Back"})}),t.jsxs("div",{className:"flex gap-2 items-center",children:[t.jsx("button",{onClick:re,style:mr,children:n!=null&&n.success?"Done":"Cancel"}),!n&&t.jsxs(t.Fragment,{children:[l==="input"&&t.jsx("button",{onClick:R,style:Zt,children:"Next →"}),l==="mapping"&&t.jsx("button",{onClick:O,style:Zt,children:"Preview →"}),l==="preview"&&t.jsx("button",{onClick:_,disabled:P||S.length===0,style:{...Zt,opacity:P||S.length===0?.5:1,cursor:P||S.length===0?"not-allowed":"pointer"},children:P?"Importing…":`Import ${D.length} element(s)`})]})]})]})]})})}const Xt={display:"block",fontSize:F.xs,fontWeight:600,color:"#374151",marginBottom:6},Qt={width:"100%",padding:"7px 10px",borderRadius:8,border:"1px solid #E5E5E0",fontSize:F.sm,color:"#1a1a1a",background:"#FAFAF8",boxSizing:"border-box"},Il={background:"rgba(255,255,255,0.12)",border:"none",borderRadius:8,color:"rgba(255,255,255,0.8)",cursor:"pointer",padding:"6px 10px",fontSize:"14px"},Zt={padding:"7px 18px",borderRadius:8,background:"#1B3A4B",border:"none",color:"#FFFFFF",fontSize:F.xs,fontWeight:600,cursor:"pointer"},mr={padding:"7px 14px",borderRadius:8,background:"transparent",border:"1px solid #E5E5E0",color:"#374151",fontSize:F.xs,cursor:"pointer"},ze={padding:"5px 8px",textAlign:"left",fontWeight:600,fontSize:"10px",color:"#6B7280",borderBottom:"1px solid #E5E5E0",whiteSpace:"nowrap"},Ze={padding:"4px 8px",fontSize:"11px",color:"#1a1a1a",borderBottom:"1px solid #F5F5F2"},fr={...Ze,fontFamily:"monospace",fontSize:"10px",color:"#6B7280"};function Pl(){var u,y,b;const e=E(x=>x.activeView),r=E(x=>x.model),n=E(x=>x.selectedElementId),o=E(x=>x.activeMode),a=E(x=>x.setActiveMode),i=E(x=>x.selectElement),l=E(x=>x.setActiveView),s=Ce(),c=[],d=(()=>{switch(e.type){case"diagram":return;case"element-detail":return{label:"Model Explorer",icon:"☰",onClick:()=>{a("catalog"),l({type:"welcome"}),s("/catalog")}};case"dsm":return{label:"DSM Analysis",icon:"▦",onClick:()=>{l({type:"dsm"}),s("/dsm")}};case"traceability":return{label:"Traceability Matrix",icon:"☷",onClick:()=>{l({type:"traceability"}),s("/traceability")}};case"ontology":case"ontology-detail":return{label:"Ontology Explorer",icon:"◉",onClick:()=>{l({type:"ontology"}),s("/ontology")}};case"scenario-editor":return{label:"Use Cases",icon:"▶",onClick:()=>{a("scenario"),l({type:"scenario-editor"}),s("/use-cases")}};case"dhf-dashboard":case"dhf-dashboard-legacy":case"dhf-document":return{label:"Documents",icon:"⊞",onClick:()=>{a("dhf"),l({type:"dhf-dashboard"}),s("/dhf")}};case"welcome":return o==="diagram"?{label:"Viewpoints",icon:"⊟",onClick:()=>s("/diagrams")}:o==="catalog"?{label:"Model Explorer",icon:"☰",onClick:()=>s("/catalog")}:void 0;default:return}})();switch(e.type){case"diagram":{const x=Rt(r,e.diagramId);if(x){const w=x.viewpointId==="__model"?"Unassigned Views":((y=(u=r==null?void 0:r.viewpoints)==null?void 0:u.find(N=>N.id===x.viewpointId))==null?void 0:y.label)||x.viewpointId,f=(b=r==null?void 0:r.viewpoints)==null?void 0:b.find(N=>N.id===x.viewpointId);c.push({label:f?`${f.id} · ${w}`:w});const h=x.viewKind?Fn[x.viewKind]:void 0,m=Le[x.diagramType],D=(h==null?void 0:h.label)??(m==null?void 0:m.code)??x.diagramType;c.push({label:`${x.shortId??x.id} · ${D}: ${x.name}`})}break}case"element-detail":{const x=e.elementId,w=r==null?void 0:r.elements[x];if(w){const f=w.shortId??w.id,h=f.split("-")[0];c.push({label:"Catalog",onClick:()=>s("/catalog")}),c.push({label:h,onClick:()=>s(`/catalog/${h}`)}),c.push({label:`${f} ${w.name}`})}break}}if(n&&r&&e.type!=="element-detail"){const x=r.elements[n];x&&c.push({label:x.name,onClick:()=>i(x.id)})}return!d&&c.length===0?null:t.jsxs("div",{className:"flex items-center gap-1 px-4 py-1.5",style:{background:"#FAFAF8",borderBottom:"1px solid #E5E5E0"},children:[d&&t.jsxs("button",{type:"button",onClick:d.onClick,className:"flex items-center gap-1 rounded-md",title:`Active workspace: ${d.label}`,style:{padding:"4px 8px",background:"#E8FBF5",border:"1px solid #A7F3D0",color:"#0F766E",fontSize:"11px",fontWeight:700,letterSpacing:"0.01em",cursor:"pointer"},children:[t.jsx("span",{"aria-hidden":"true",style:{fontSize:"13px",lineHeight:1},children:d.icon}),d.label]}),c.map((x,w)=>t.jsxs("span",{className:"flex items-center gap-1",children:[(d||w>0)&&t.jsx("span",{className:"text-xs",style:{color:"#D1D5DB"},children:"/"}),x.onClick?t.jsx("button",{className:"text-xs px-1 py-0.5 rounded transition-colors",style:{color:"#374151"},onMouseEnter:f=>f.currentTarget.style.background="#F0F0ED",onMouseLeave:f=>f.currentTarget.style.background="transparent",onClick:x.onClick,children:x.label}):t.jsx("span",{className:"text-xs",style:{color:w===c.length-1?"#374151":"#9CA3AF"},children:x.label})]},w)),t.jsx("div",{className:"flex-1"}),t.jsxs("kbd",{className:"px-1.5 py-0.5 rounded text-xs",style:{background:"#F0F0ED",color:"#9CA3AF",fontSize:"9px"},children:["⌘","K"]})]})}const yr="memo-onboarding-completed",Je=[{title:"Welcome to MEMO Architect",description:"MEMO is a model-based systems engineering tool for medical devices. You'll land on the Dashboard — it shows your model health and suggests the next action. Let's take a quick tour.",target:"center",position:"center"},{title:"Model Explorer",description:"Browse your model elements organized by architecture layer. Switch to Views tab to see diagrams grouped by viewpoint.",target:"left panel",position:"left"},{title:"Unified Canvas",description:"The center area renders your selected view — diagrams, action flows, DSM matrices, and more.",target:"center canvas",position:"center"},{title:"Properties Panel",description:"View and edit element properties, relationships, and attributes. Select any element to see its details.",target:"right panel",position:"right"},{title:"Tools Menu",description:"Access analysis tools from the toolbar: DSM, Trace Matrix, Action Flow, Ontology, Scenarios, Diff, Compliance, and Stats.",target:"toolbar",position:"center"},{title:"Command Palette",description:"Press Cmd+K (or Ctrl+K) to quickly search elements, diagrams, viewpoints, and tools.",target:"keyboard shortcut",position:"center"},{title:"Working Sets",description:"Save and restore your workspace layout using the Sets tab in the Explorer panel. Great for switching between review contexts.",target:"explorer sets tab",position:"left"},{title:"You're all set!",description:"Start from the Dashboard — it shows your model status and suggests the next step. Use the Workflow Wizard (Tools menu) for a guided path through requirements, risk, and verification.",target:"center",position:"center"}];function Ll(){const[e,r]=p.useState(!1),[n,o]=p.useState(0);p.useEffect(()=>{try{if(!localStorage.getItem(yr)){const b=setTimeout(()=>r(!0),800);return()=>clearTimeout(b)}}catch{}},[]);const a=p.useCallback(()=>{r(!1);try{localStorage.setItem(yr,"true")}catch{}},[]),i=p.useCallback(()=>{n>=Je.length-1?a():o(n+1)},[n,a]),l=p.useCallback(()=>{n>0&&o(n-1)},[n]);if(!e)return null;const s=Je[n],c=n===Je.length-1,d=n===0,u=()=>{switch(s.position){case"left":return{left:"300px",top:"50%",transform:"translateY(-50%)"};case"right":return{right:"300px",top:"50%",transform:"translateY(-50%)"};case"bottom":return{left:"50%",bottom:"80px",transform:"translateX(-50%)"};case"center":default:return{left:"50%",top:"50%",transform:"translate(-50%, -50%)"}}};return t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"fixed inset-0 z-50",style:{background:"rgba(0,0,0,0.4)",backdropFilter:"blur(2px)"},onClick:a}),t.jsxs("div",{className:"fixed z-50 rounded-xl p-5 max-w-sm",style:{...u(),background:"#FFFFFF",boxShadow:"0 8px 32px rgba(0,0,0,0.2)",border:"1px solid #E5E5E0"},onClick:y=>y.stopPropagation(),children:[t.jsx("div",{className:"flex items-center gap-1 mb-3",children:Je.map((y,b)=>t.jsx("div",{className:"h-1 rounded-full transition-all",style:{width:b===n?"20px":"8px",background:b===n?"#2DD4A8":b<n?"#2DD4A880":"#E5E5E0"}},b))}),t.jsx("h3",{className:"text-sm font-semibold mb-1.5",style:{color:"#1B3A4B"},children:s.title}),t.jsx("p",{className:"text-xs leading-relaxed mb-4",style:{color:"#6B7280"},children:s.description}),t.jsxs("div",{className:"flex items-center gap-2",children:[!d&&t.jsx("button",{onClick:l,className:"px-3 py-1.5 text-xs rounded-lg",style:{background:"#F3F4F6",color:"#6B7280"},children:"Back"}),t.jsx("div",{className:"flex-1"}),t.jsx("button",{onClick:a,className:"px-3 py-1.5 text-xs rounded-lg",style:{color:"#9CA3AF"},children:"Skip tour"}),t.jsx("button",{onClick:i,className:"px-4 py-1.5 text-xs font-medium rounded-lg",style:{background:"#2DD4A8",color:"#FFFFFF"},children:c?"Get started":"Next"})]}),t.jsxs("div",{className:"text-center mt-2",style:{color:"#D1D5DB",fontSize:"10px"},children:[n+1," of ",Je.length]})]})]})}function Ul(){const e=E(a=>a.restartRequired);if(!e)return null;const r=e.reason==="dependency-closure-uncomputable",n=e.reason==="transaction-independence-uncomputable",o=r?"Dependency closure could not be rebuilt":n?"Concurrent writes could not be distinguished":e.reason==="ontology-selection-changed"?"Ontology selection changed":"Ontology source changed";return t.jsx("div",{style:{position:"fixed",inset:0,zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(15, 23, 42, 0.85)",backdropFilter:"blur(4px)"},children:t.jsxs("div",{style:{background:"#1E293B",border:"1px solid #F59E0B",borderRadius:"12px",padding:"32px 40px",maxWidth:"480px",width:"90%",textAlign:"center",color:"#F8FAFC",boxShadow:"0 25px 50px rgba(0,0,0,0.5)"},children:[t.jsx("div",{style:{fontSize:"2rem",marginBottom:"12px"},children:"⚠️"}),t.jsx("div",{style:{fontSize:"1.1rem",fontWeight:600,marginBottom:"8px",color:"#F59E0B"},children:"Restart Required"}),t.jsx("div",{style:{fontSize:"0.875rem",color:"#CBD5E1",marginBottom:"4px"},children:o}),t.jsx("div",{style:{fontSize:"0.75rem",color:"#94A3B8",marginBottom:"24px",fontFamily:"monospace"},children:e.changedFile}),t.jsx("div",{style:{fontSize:"0.875rem",color:"#E2E8F0",marginBottom:"24px",lineHeight:1.6},children:e.instruction}),t.jsx("div",{style:{fontSize:"0.8rem",color:"#FBBF24"},role:"status",children:r?"Model mutations are locked — Relaunch Memo Architect after fixing the source.":"Reconnecting to the rebuilt runtime…"})]})})}function zl(){const e=E(i=>i.editConflict),r=E(i=>i.setEditConflict);if(!e)return null;const n=e.reason==="stale-identity",o=JSON.stringify(e.rejectedDraft,null,2),a=()=>{const i=URL.createObjectURL(new Blob([o],{type:"application/json"})),l=document.createElement("a");l.href=i,l.download=`rejected-edit-${e.rejectedCommandId}.json`,l.click(),URL.revokeObjectURL(i)};return t.jsxs("aside",{role:"alert",style:{position:"fixed",right:20,bottom:20,zIndex:9e3,maxWidth:520,padding:16,borderRadius:10,border:"1px solid #FCA5A5",background:"#FEF2F2",color:"#7F1D1D",boxShadow:"0 12px 30px rgba(0,0,0,.18)"},children:[t.jsx("strong",{children:n?"Edit rejected — it targeted an older model revision":"Edit rejected — file changed externally"}),t.jsx("div",{style:{marginTop:6,fontFamily:"monospace",fontSize:12},children:e.sourceFile}),t.jsx("div",{style:{marginTop:6,fontSize:13},children:n?"No source was overwritten. The element this edit addressed is not in the current revision, so applying it could have changed the wrong declaration. Reopen the element and repeat the edit.":"No source was overwritten. The disk version was reloaded; edits to other files remain available."}),e.detail&&t.jsx("div",{style:{marginTop:6,fontSize:12,color:"#9F1239"},children:e.detail}),t.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap",marginTop:12},children:[t.jsx("button",{onClick:()=>void navigator.clipboard.writeText(o),children:"Copy draft"}),t.jsx("button",{onClick:a,children:"Download rejected edit"}),t.jsx("button",{onClick:()=>Pi(e.sourceFile),children:"Reveal file"}),t.jsx("button",{onClick:()=>r(null),children:"Dismiss"})]})]})}const Ol=4;function Vl(){const e=E(l=>l.sourceCoherence);if(!e)return null;const{files:r,diagnostics:n,lastGoodRevision:o}=e,a=n.slice(0,Ol),i=n.length-a.length;return t.jsxs("div",{role:"status","aria-live":"polite",style:{position:"fixed",bottom:16,left:"50%",transform:"translateX(-50%)",zIndex:9e3,maxWidth:620,width:"calc(100% - 32px)",background:"#1E293B",border:"1px solid #F59E0B",borderRadius:10,padding:"12px 16px",color:"#F8FAFC",boxShadow:"0 12px 32px rgba(0,0,0,0.35)"},children:[t.jsx("div",{style:{fontSize:"0.85rem",fontWeight:600,color:"#FBBF24",marginBottom:4},children:o>0?`Showing the last model that compiled (revision ${o})`:"Showing everything that parsed"}),t.jsxs("div",{style:{fontSize:"0.75rem",color:"#CBD5E1",marginBottom:a.length?8:0},children:[r.length===1?r[0]:`${r.length} files`," did not parse. Edits are held until the source compiles again — no restart needed."]}),a.map((l,s)=>t.jsxs("div",{style:{fontSize:"0.7rem",color:"#94A3B8",fontFamily:"monospace",lineHeight:1.5},children:[l.file,l.line!==void 0?`:${l.line}`:"",l.column!==void 0?`:${l.column}`:""," — ",l.message]},`${l.file}:${l.line??0}:${s}`)),i>0&&t.jsxs("div",{style:{fontSize:"0.7rem",color:"#64748B",marginTop:4},children:["and ",i," more"]})]})}const gr={Hazard:"HZD",HazardousEvent:"HZD-EVT",HazardousSituation:"HZD-SIT",Risk:"RISK",RiskControlMeasure:"RISK-CTL",MitigationMeasure:"MIT",ResidualRisk:"RRISK",StakeholderRequirement:"STK-REQ",Requirement:"REQ",SoftwareSpecification:"SW-SPEC",InterfaceRequirement:"REQ",PerformanceRequirement:"PERF-REQ",SafetyRequirement:"SAF-REQ",RegulatoryRequirement:"REG-REQ",FunctionalRequirement:"REQ",NonFunctionalRequirement:"NFR",SystemComponent:"SYS-COMP",SoftwareComponent:"SW-COMP",HardwareComponent:"HW-COMP",Subsystem:"SUBSYS",Module:"MOD",Interface:"IF",Port:"PORT",Action:"ACT",ActionDefinition:"ACT-DEF",UseCase:"UC",Stakeholder:"STK",OperationalScenario:"OPS",Mission:"MSNS",Capability:"CAP",DesignInput:"DI",DesignOutput:"DO",VerificationActivity:"VER",ValidationActivity:"VAL",TestCase:"TC",Item:"ITM",Part:"PART"};function $l(e){return e.length<=3?e.toUpperCase():(e[0]+e.slice(1).replace(/[aeiouAEIOU]/g,"")).slice(0,3).toUpperCase()}function Wl(e){if(gr[e])return gr[e];const r=e.replace(/([A-Z])/g," $1").trim().split(" ").filter(Boolean);return r.length===0?"EL":r.map($l).join("-")}function _l(e){return e.split("-")[0]}function ql(e){return`/catalog/${e.split("-")[0]}/${e}`}function Hl(e){return`/catalog/${e}`}function Kl(e,r){return`/diagrams/${e.toLowerCase().replace(/\s+/g,"-")}/${encodeURIComponent(r)}`}function co({size:e=150,opacity:r=.55}){return t.jsxs("div",{"aria-label":"MEMO Architect",title:"MEMO Architect",style:{position:"relative",width:e,height:Math.round(e*.62),overflow:"hidden",flexShrink:0,opacity:r},children:[t.jsx("img",{src:"/logo.png",alt:"","aria-hidden":"true",style:{display:"block",width:e,height:e,objectFit:"contain",transform:`translateY(-${Math.round(e*.12)}px)`,mixBlendMode:"multiply"}}),t.jsx("span",{style:{position:"absolute",left:"59%",top:Math.round(e*.47),color:"#8B949E",fontSize:Math.max(12,Math.round(e*.09)),fontWeight:600,letterSpacing:"0.02em",whiteSpace:"nowrap"},children:"Architect"})]})}function Gl(){const e=E(a=>a.model),r=Ce(),n=p.useMemo(()=>{if(!e)return[];const a={};for(const i of Object.values(e.elements)){const l=Wl(i.kind),s=_l(l);a[s]||(a[s]={count:0,kinds:new Set,layer:i.layer}),a[s].count++,a[s].kinds.add(i.kind)}return Object.entries(a).sort((i,l)=>l[1].count-i[1].count)},[e]);if(!e)return t.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",background:"#F7F7F5"},children:t.jsx("p",{style:{color:g.muted,fontSize:F.sm},children:"Loading…"})});const o=Object.keys(e.elements).length;return t.jsxs("div",{style:{flex:1,overflow:"auto",background:"#F7F7F5",padding:"32px 40px"},children:[t.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",marginBottom:"24px"},children:[t.jsxs("div",{children:[t.jsx("h1",{style:{fontSize:"20px",fontWeight:700,color:g.primary,margin:"0 0 4px"},children:"Catalog"}),t.jsxs("p",{style:{color:g.muted,fontSize:F.sm,margin:0},children:[o," elements across ",n.length," families"]})]}),t.jsx(co,{size:132})]}),t.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(200px, 1fr))",gap:"12px"},children:n.map(([a,i])=>{const l=se[i.layer]??"#9CA3AF";return t.jsx(Yl,{family:a,count:i.count,kinds:i.kinds,color:l,onClick:()=>r(Hl(a))},a)})})]})}function Yl({family:e,count:r,kinds:n,color:o,onClick:a}){return t.jsxs("div",{onClick:a,style:{background:g.surface,border:`1px solid ${g.border}`,borderRadius:"10px",padding:"16px",cursor:"pointer",transition:"box-shadow 0.15s, border-color 0.15s",borderTop:`3px solid ${o}`},onMouseEnter:i=>{i.currentTarget.style.boxShadow="0 4px 12px rgba(0,0,0,0.08)",i.currentTarget.style.borderTopColor=o},onMouseLeave:i=>{i.currentTarget.style.boxShadow="none"},children:[t.jsx("div",{style:{fontWeight:700,fontSize:"15px",color:g.primary,marginBottom:"4px"},children:e}),t.jsx("div",{style:{fontSize:"22px",fontWeight:800,color:o,lineHeight:1,marginBottom:"6px"},children:r}),t.jsxs("div",{style:{fontSize:"11px",color:g.muted,lineHeight:"1.5"},children:[Array.from(n).slice(0,3).join(", "),n.size>3&&` +${n.size-3} more`]})]})}function Jl(){var a;const e=E(i=>i.model),r=Ce(),n=p.useMemo(()=>{var b;const i=(e==null?void 0:e.diagrams)??[],l=new Map,s=new Map(((e==null?void 0:e.viewpoints)??[]).map(x=>[x.id,x]));for(const x of i){const w=x.viewpointIds;for(const f of w!=null&&w.length?w:[x.viewpointId]){const h=(b=e==null?void 0:e.viewpoints)==null?void 0:b.find(N=>N.id===f),m=h?f:xe,D=l.get(m);D?D.items.push(x):l.set(m,{id:m,label:(h==null?void 0:h.label)??"Uncategorized",items:[x]})}}const c=no([...l.values()].filter(x=>x.id!==xe).map(x=>({...x,...s.get(x.id)}))),d=ro(c.map(x=>x.label)),u=c.map((x,w)=>({...x,label:d[w],items:[...x.items].sort((f,h)=>f.name.localeCompare(h.name))})),y=l.get(xe);return y?[...u,{...y,items:[...y.items].sort((x,w)=>x.name.localeCompare(w.name))}]:u},[e]);if(!e)return t.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",background:"#F7F7F5"},children:t.jsx("p",{style:{color:g.muted,fontSize:F.sm},children:"Loading…"})});const o=((a=e.diagrams)==null?void 0:a.length)??0;return t.jsxs("div",{style:{flex:1,overflow:"auto",background:"#F7F7F5",padding:"32px 40px"},children:[t.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",marginBottom:"24px"},children:[t.jsxs("div",{children:[t.jsx("h1",{style:{fontSize:"20px",fontWeight:700,color:g.primary,margin:"0 0 4px"},children:"Viewpoints"}),t.jsxs("p",{style:{color:g.muted,fontSize:F.sm,margin:0},children:[o," model ",o===1?"view":"views"," across ",n.length," ",n.length===1?"viewpoint":"viewpoints"]})]}),t.jsx(co,{size:132})]}),o===0&&t.jsx("p",{style:{color:g.muted,fontSize:F.sm},children:"This model defines no model views yet."}),n.map(i=>t.jsxs("section",{style:{marginBottom:"28px"},children:[t.jsxs("h2",{style:{fontSize:"11px",fontWeight:700,color:g.muted,textTransform:"uppercase",letterSpacing:"0.06em",margin:"0 0 10px 0"},children:[i.label,t.jsx("code",{style:{marginLeft:8,color:g.faint,textTransform:"none"},children:i.id===xe?"no viewpoint":i.id}),t.jsx("span",{style:{marginLeft:8,fontWeight:400},children:i.items.length})]}),t.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(220px, 1fr))",gap:"12px"},children:i.items.map(l=>t.jsx(Xl,{diagram:l,onClick:()=>r(Kl(l.diagramType,l.shortId??l.id))},l.id))})]},i.id))]})}function Xl({diagram:e,onClick:r}){var c;const n=e.viewKind?Fn[e.viewKind]:void 0,o=Le[e.diagramType],a=n??o,i=(n==null?void 0:n.label)??(o==null?void 0:o.code),l=(a==null?void 0:a.color)??"#6B7280",s=((c=e.elementIds)==null?void 0:c.length)??0;return t.jsxs("div",{onClick:r,role:"button",tabIndex:0,onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),r())},style:{background:g.surface,border:`1px solid ${g.border}`,borderRadius:"10px",padding:"14px 16px",cursor:"pointer",transition:"box-shadow 0.15s",borderTop:`3px solid ${l}`},onMouseEnter:d=>{d.currentTarget.style.boxShadow="0 4px 12px rgba(0,0,0,0.08)"},onMouseLeave:d=>{d.currentTarget.style.boxShadow="none"},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:6},children:[a&&t.jsx("span",{style:{background:l+"18",color:l,borderRadius:4,padding:"1px 5px",fontSize:"10px",fontWeight:700},children:i}),e.auto&&t.jsx("span",{style:{fontSize:"10px",color:g.muted},children:"auto"})]}),t.jsx("div",{style:{fontWeight:600,fontSize:"14px",color:g.primary,marginBottom:4},children:e.name}),t.jsx("div",{style:{fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",fontSize:"10px",color:g.faint,marginBottom:4},children:e.shortId??e.id}),t.jsxs("div",{style:{fontSize:"11px",color:g.muted,lineHeight:1.5},children:[(a==null?void 0:a.fullName)??e.diagramType,s>0&&` · ${s} element${s===1?"":"s"}`]})]})}function Ql({family:e}){const r=E(c=>c.model),n=Ce(),[o,a]=p.useState(""),i=p.useMemo(()=>r?Object.values(r.elements).filter(c=>{const d=c.shortId??"";return d.startsWith(e+"-")||d.startsWith(e+" ")}):[],[r,e]),l=p.useMemo(()=>{if(!o.trim())return i;const c=o.toLowerCase();return i.filter(d=>d.name.toLowerCase().includes(c)||(d.shortId??"").toLowerCase().includes(c)||d.kind.toLowerCase().includes(c))},[i,o]),s=p.useMemo(()=>{const c={};for(const d of i)c[d.kind]=(c[d.kind]??0)+1;return c},[i]);return r?i.length===0?t.jsx(en,{family:e,children:t.jsxs("p",{style:{color:g.muted,fontSize:F.sm},children:["No elements found with family prefix ",t.jsx("code",{children:e}),"."]})}):t.jsxs(en,{family:e,children:[t.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px",marginBottom:"16px"},children:Object.entries(s).map(([c,d])=>{const u=se[c]??"#9CA3AF";return t.jsxs("span",{style:{fontSize:F.xs,padding:"2px 8px",borderRadius:"12px",background:u+"20",color:u,border:`1px solid ${u}40`,fontWeight:500},children:[c," · ",d]},c)})}),t.jsx("input",{type:"search",placeholder:`Search ${i.length} elements…`,value:o,onChange:c=>a(c.target.value),style:{width:"100%",boxSizing:"border-box",padding:"7px 12px",fontSize:F.sm,border:`1px solid ${g.border}`,borderRadius:"6px",background:g.surface,color:g.primary,outline:"none",marginBottom:"12px"}}),t.jsxs("div",{style:{background:g.surface,border:`1px solid ${g.border}`,borderRadius:"8px",overflow:"hidden"},children:[t.jsxs("div",{style:{display:"grid",gridTemplateColumns:"140px 1fr 120px 120px",padding:"8px 16px",background:g.surfaceAlt,borderBottom:`1px solid ${g.border}`,fontSize:F.xs,fontWeight:600,color:g.muted,gap:"12px"},children:[t.jsx("span",{children:"ID"}),t.jsx("span",{children:"Name"}),t.jsx("span",{children:"Kind"}),t.jsx("span",{children:"Layer"})]}),l.length===0?t.jsxs("div",{style:{padding:"24px 16px",color:g.muted,fontSize:F.sm,textAlign:"center"},children:['No results for "',o,'"']}):l.map((c,d)=>t.jsx(Zl,{element:c,zebra:d%2===1,onClick:()=>n(ql(c.shortId??c.id))},c.id))]}),t.jsxs("p",{style:{color:g.faint,fontSize:"11px",marginTop:"8px"},children:[l.length," of ",i.length," elements shown"]})]}):t.jsx(en,{family:e,children:t.jsx("p",{style:{color:g.muted,fontSize:F.sm},children:"Loading model…"})})}function Zl({element:e,zebra:r,onClick:n}){const o=se[e.layer]??"#9CA3AF";return t.jsxs("div",{onClick:n,style:{display:"grid",gridTemplateColumns:"140px 1fr 120px 120px",padding:"10px 16px",gap:"12px",background:r?"#FAFAF8":g.surface,cursor:"pointer",borderBottom:`1px solid ${g.borderLight}`,alignItems:"center",transition:"background 0.1s"},onMouseEnter:a=>a.currentTarget.style.background="#F0FDF4",onMouseLeave:a=>a.currentTarget.style.background=r?"#FAFAF8":g.surface,children:[t.jsx("code",{style:{fontSize:"11px",color:"#2DD4A8",fontWeight:600,fontFamily:"monospace"},children:e.shortId??e.id}),t.jsx("span",{style:{fontSize:F.sm,color:g.primary,fontWeight:500,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.name}),t.jsx("span",{style:{fontSize:F.xs,color:g.secondary},children:e.kind}),t.jsx("span",{style:{fontSize:"11px",color:o,fontWeight:500,background:o+"15",padding:"2px 6px",borderRadius:"4px",width:"fit-content"},children:e.layer})]})}function en({family:e,children:r}){const n=Ce();return t.jsxs("div",{style:{flex:1,overflow:"auto",background:"#F7F7F5",padding:"32px 40px"},children:[t.jsxs("nav",{style:{fontSize:F.xs,color:g.muted,marginBottom:"20px"},children:[t.jsx("button",{onClick:()=>n("/catalog"),style:{background:"none",border:"none",color:"#2DD4A8",cursor:"pointer",padding:0,fontSize:F.xs},children:"Catalog"})," / ",t.jsx("span",{style:{color:g.primary,fontWeight:600},children:e})]}),t.jsx("h1",{style:{fontSize:"20px",fontWeight:700,color:g.primary,marginBottom:"6px",marginTop:0},children:e}),r]})}const ed=p.lazy(()=>te(()=>import("./DiagramEditor-UJDHcAUF.js"),__vite__mapDeps([3,1,2,4])).then(e=>({default:e.DiagramEditor}))),td=p.lazy(()=>te(()=>import("./DSMView-BiC845df.js"),__vite__mapDeps([5,1,2,6])).then(e=>({default:e.DSMView}))),nd=p.lazy(()=>te(()=>import("./OntologyViewer-CtqNkkCn.js"),__vite__mapDeps([7,1,2])).then(e=>({default:e.OntologyViewer}))),rd=p.lazy(()=>te(()=>import("./TraceabilityMatrix-DbrvjqLN.js"),__vite__mapDeps([8,1,2,6])).then(e=>({default:e.TraceabilityMatrix}))),od=p.lazy(()=>te(()=>import("./ScenarioEditor-FAEYTHgP.js"),__vite__mapDeps([0,1,2])).then(e=>({default:e.ScenarioEditor}))),ad=p.lazy(()=>te(()=>import("./ModelDiff-xe95oVua.js"),__vite__mapDeps([9,1,2])).then(e=>({default:e.ModelDiff}))),id=p.lazy(()=>te(()=>import("./ComplianceWizard-CTihkUi-.js"),__vite__mapDeps([10,1,2])).then(e=>({default:e.ComplianceWizard}))),sd=p.lazy(()=>te(()=>import("./StatisticsDashboard-BAZRqIPN.js"),__vite__mapDeps([11,1,2])).then(e=>({default:e.StatisticsDashboard}))),ld=p.lazy(()=>te(()=>import("./DhfDashboard-w-dJoJHU.js"),__vite__mapDeps([12,1,2])).then(e=>({default:e.DhfDashboard}))),dd=p.lazy(()=>te(()=>import("./DhfWorkbench-o6B_MT-0.js"),__vite__mapDeps([13,1,2])).then(e=>({default:e.DhfWorkbench}))),cd=p.lazy(()=>te(()=>import("./AiWorkspace-Bu9TlIWg.js"),__vite__mapDeps([14,1,2])).then(e=>({default:e.AiWorkspace}))),uo=p.lazy(()=>te(()=>import("./ElementDetailView-10U0rr33.js"),__vite__mapDeps([15,1,2])).then(e=>({default:e.ElementDetailView}))),ye=p.lazy(()=>te(()=>import("./Dashboard-CgnNLhKq.js"),__vite__mapDeps([16,1,2])).then(e=>({default:e.Dashboard}))),ud=p.lazy(()=>te(()=>import("./ReviewDashboard-DeTge2oC.js"),__vite__mapDeps([17,1,2])).then(e=>({default:e.ReviewDashboard}))),pd=p.lazy(()=>te(()=>import("./WorkflowWizard-VwpEHt3R.js"),__vite__mapDeps([18,1,2])).then(e=>({default:e.WorkflowWizard}))),md=p.lazy(()=>te(()=>import("./TabularView-I4LjHhoH.js"),__vite__mapDeps([19,1,2])).then(e=>({default:e.TabularView}))),fd=p.lazy(()=>te(()=>import("./ImportView-D8svP04Q.js"),__vite__mapDeps([20,1,2])).then(e=>({default:e.ImportView}))),yd=p.lazy(()=>te(()=>import("./AnalysisWorkspace-CodmoI-v.js"),__vite__mapDeps([21,1,2])).then(e=>({default:e.AnalysisWorkspace}))),gd=p.lazy(()=>te(()=>import("./UiScreensWorkspace-DDD_PyJs.js"),__vite__mapDeps([22,1,2,23,4])).then(e=>({default:e.UiScreensWorkspace})));function Oe(){const e=E(c=>c.activeView),r=E(c=>c.model),n=E(c=>c.activeMode);E(c=>c.selectedViewpointId);const o=E(c=>c.selectedDiagramId),a=E(c=>c.selectDiagram),i=E(c=>c.setActiveMode),l=E(c=>c.setExplorerTab);p.useEffect(()=>{var c;if(e.type==="diagram"){o!==e.diagramId&&a(e.diagramId);const d=(c=r==null?void 0:r.diagrams)==null?void 0:c.find(u=>u.id===e.diagramId);d!=null&&d.viewpointId&&d.viewpointId!=="__model"&&n!=="scenario"&&(n!=="diagram"&&i("diagram"),l("views"))}},[e,n,r,o,a,i,l]);const s=()=>{switch(e.type){case"diagram":return t.jsx(ed,{diagramId:e.diagramId});case"dsm":return t.jsx(td,{});case"traceability":return ae("model-tools")?t.jsx(rd,{}):t.jsx(ye,{});case"tabular":return t.jsx(md,{});case"ontology":case"ontology-detail":return ae("ontology")?t.jsx(nd,{}):t.jsx(ye,{});case"scenario-editor":return t.jsx(od,{});case"model-diff":return ae("model-tools")?t.jsx(ad,{}):t.jsx(ye,{});case"compliance-wizard":return ae("model-tools")?t.jsx(id,{}):t.jsx(ye,{});case"statistics":return ae("model-tools")?t.jsx(sd,{}):t.jsx(ye,{});case"dhf-dashboard":case"dhf-document":return t.jsx(dd,{});case"dhf-dashboard-legacy":return t.jsx(ld,{});case"ai":case"ask":case"sysml-generator":return ae("ai-tools")?t.jsx(cd,{}):t.jsx(ye,{});case"element-detail":return t.jsx(uo,{});case"dashboard":return t.jsx(ye,{});case"review-dashboard":return ae("model-tools")?t.jsx(ud,{}):t.jsx(ye,{});case"workflow-wizard":return ae("model-tools")?t.jsx(pd,{}):t.jsx(ye,{});case"import":return ae("import")?t.jsx(fd,{}):t.jsx(ye,{});case"analysis":return ae("analysis")?t.jsx(yd,{}):t.jsx(ye,{});case"ui-screens":return t.jsx(gd,{});case"welcome":default:return t.jsx(hr,{})}};return(e.type==="welcome"||e.type==="dashboard")&&e.type==="welcome"?t.jsx(hr,{}):t.jsx(p.Suspense,{fallback:t.jsx(po,{}),children:s()})}function po(){return t.jsx("div",{className:"flex-1 flex items-center justify-center",style:{background:"#F7F7F5"},children:t.jsxs("div",{className:"text-center",style:{color:"#9CA3AF"},children:[t.jsx("img",{src:"/logo.png",alt:"MEMO Logo",style:{width:"180px",marginBottom:"24px",opacity:.4,filter:"grayscale(1)"},className:"animate-pulse"}),t.jsx("div",{className:"text-xs mt-2",children:"Loading view..."})]})})}const Ct="linear-gradient(135deg, #EEF7F3 0%, #EAF2F8 55%, #F2EEF8 100%)";function hr(){var c;const e=E(d=>d.model),r=E(d=>d.setActiveView),n=E(d=>d.selectElement),o=E(d=>d.setExplorerTab),a=((c=e==null?void 0:e.diagrams)==null?void 0:c.length)??0,i=e?Object.keys(e.elements).length:0,l=p.useMemo(()=>{if(!e)return[];const d=new Map;for(const u of Object.values(e.elements))d.has(u.kind)||d.set(u.kind,u);return Array.from(d.values()).slice(0,8)},[e]);function s(d){n(d),r({type:"element-detail",elementId:d})}return t.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center overflow-auto",style:{background:Ct,padding:"48px 40px"},children:[t.jsx("img",{src:"/logo.png",alt:"MEMO Logo",style:{width:"520px",maxWidth:"80vw",maxHeight:"40vh",objectFit:"contain",marginBottom:"-36px",opacity:.97}}),t.jsx("h2",{style:{fontSize:"18px",fontWeight:700,color:"#1B3A4B",marginBottom:"6px",marginTop:0},children:"MEMO Architect"}),t.jsx("p",{style:{fontSize:"14px",color:"#4B6E80",marginTop:0,marginBottom:"24px",maxWidth:"480px",textAlign:"center",lineHeight:"1.6"},children:"SysML-based medical device architecture tool, aligned with ISO 14971 and IEC 62304."}),i>0&&t.jsxs("div",{className:"flex items-center gap-4 mb-6",style:{fontSize:"13px",color:"#4B6E80"},children:[t.jsxs("span",{children:[t.jsx("strong",{style:{color:"#1B3A4B"},children:i})," elements"]}),t.jsx("span",{style:{color:"#CBD5DB"},children:"·"}),t.jsxs("span",{children:[t.jsx("strong",{style:{color:"#1B3A4B"},children:a})," diagrams"]}),(e==null?void 0:e.relationships)&&t.jsxs(t.Fragment,{children:[t.jsx("span",{style:{color:"#CBD5DB"},children:"·"}),t.jsxs("span",{children:[t.jsx("strong",{style:{color:"#1B3A4B"},children:e.relationships.length})," relationships"]})]})]}),t.jsxs("div",{className:"flex gap-3 mb-8",children:[t.jsx("button",{onClick:()=>o("model"),className:"px-5 py-2.5 text-sm font-semibold rounded-lg transition-all",style:{background:"#1B3A4B",color:"#FFFFFF",border:"none",cursor:"pointer"},onMouseEnter:d=>d.currentTarget.style.background="#244D63",onMouseLeave:d=>d.currentTarget.style.background="#1B3A4B",children:"Browse Model"}),a>0&&t.jsxs("button",{onClick:()=>o("views"),className:"px-5 py-2.5 text-sm font-semibold rounded-lg transition-all",style:{background:"#2DD4A815",color:"#1B3A4B",border:"1px solid #2DD4A840",cursor:"pointer"},onMouseEnter:d=>d.currentTarget.style.background="#2DD4A830",onMouseLeave:d=>d.currentTarget.style.background="#2DD4A815",children:["View Diagrams (",a,")"]})]}),l.length>0&&t.jsxs("div",{style:{width:"100%",maxWidth:"680px"},children:[t.jsx("div",{style:{fontSize:"11px",fontWeight:600,color:"#7A9BAA",textTransform:"uppercase",letterSpacing:"0.08em",marginBottom:"10px"},children:"Quick Browse"}),t.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(180px, 1fr))",gap:"8px"},children:l.map(d=>t.jsxs("button",{onClick:()=>s(d.id),style:{textAlign:"left",background:"rgba(255,255,255,0.7)",border:"1px solid rgba(255,255,255,0.9)",borderRadius:"8px",padding:"10px 12px",cursor:"pointer",transition:"all 0.15s",backdropFilter:"blur(4px)"},onMouseEnter:u=>{u.currentTarget.style.background="rgba(255,255,255,0.95)",u.currentTarget.style.boxShadow="0 2px 8px rgba(0,0,0,0.08)",u.currentTarget.style.transform="translateY(-1px)"},onMouseLeave:u=>{u.currentTarget.style.background="rgba(255,255,255,0.7)",u.currentTarget.style.boxShadow="none",u.currentTarget.style.transform="none"},children:[t.jsx("div",{style:{fontSize:"10px",color:"#7A9BAA",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em",marginBottom:"3px"},children:d.kind}),t.jsx("div",{style:{fontSize:"13px",color:"#1B3A4B",fontWeight:500,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:d.name}),d.shortId&&t.jsx("div",{style:{fontSize:"10px",color:"#9CB8C5",marginTop:"2px",fontFamily:"monospace"},children:d.shortId})]},d.id))})]})]})}function hd(){const e=E(u=>u.connected),r=E(u=>u.model),n=E(u=>u.activeView),o=E(u=>u.selectedElementIds),{pathname:a}=ke(),i=a.startsWith("/catalog"),l=E(u=>u.activeMode),s=E(u=>u.toggleGapBar);p.useEffect(()=>{const u=y=>{(y.metaKey||y.ctrlKey)&&y.shiftKey&&y.key==="P"&&(y.preventDefault(),s())};return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[s]);const c=n.type!=="dsm"&&n.type!=="dashboard"&&n.type!=="ai"&&n.type!=="ask"&&n.type!=="sysml-generator"&&n.type!=="analysis"&&n.type!=="ui-screens";p.useEffect(()=>{Ei()||Wr()},[]);const d=r?Object.keys(r.elements).length:0;return e?r?d===0?t.jsxs("div",{className:"flex flex-col h-screen",style:{background:Ct,color:"#1a1a1a"},children:[t.jsx(ht,{}),t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsxs("div",{className:"text-center max-w-lg",style:{lineHeight:"1.7"},children:[t.jsx("img",{src:"/logo.png",alt:"MEMO Logo",style:{width:"380px",maxWidth:"80vw",display:"block",margin:"0 auto -20px auto",opacity:.35,filter:"grayscale(1)"}}),t.jsx("h2",{style:{fontSize:"20px",fontWeight:700,color:"#1B3A4B",marginBottom:"8px"},children:"Your model is empty"}),t.jsxs("p",{style:{fontSize:"14px",color:"#4B6E80",marginBottom:"20px"},children:["Connected successfully — but no ",t.jsx("code",{children:".sysml"})," elements found yet."]}),t.jsxs("div",{style:{textAlign:"left",background:"rgba(255,255,255,0.65)",borderRadius:"10px",padding:"16px 20px",fontSize:"13px",border:"1px solid rgba(255,255,255,0.9)"},children:[t.jsx("p",{style:{fontWeight:600,marginBottom:"8px",color:"#1B3A4B"},children:"Get started:"}),t.jsxs("ol",{style:{paddingLeft:"18px",margin:0,color:"#4B6E80"},children:[t.jsxs("li",{style:{marginBottom:"6px"},children:["Create a ",t.jsx("code",{children:".sysml"})," file in your ",t.jsx("code",{children:"model/"})," directory"]}),t.jsxs("li",{style:{marginBottom:"6px"},children:["Import from CSV: ",t.jsx("code",{children:"pnpm memo import template elements"})]}),t.jsxs("li",{children:["Scaffold a new project: ",t.jsx("code",{children:"pnpm memo init my-device"})]})]})]})]})})]}):t.jsxs("div",{className:"flex flex-col h-screen",style:{background:"#F7F7F5",color:"#1a1a1a"},children:[t.jsx(wd,{}),t.jsx(ht,{}),t.jsx(cs,{}),t.jsx(Pl,{}),t.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[c&&t.jsx(Zs,{}),t.jsx("div",{className:"flex-1 flex flex-col",style:{minWidth:0},children:t.jsxs(ya,{children:[t.jsx(ge,{path:"/catalog",element:t.jsx(Gl,{})}),t.jsx(ge,{path:"/catalog/:family",element:t.jsx(xd,{})}),t.jsx(ge,{path:"/catalog/:family/:shortId",element:t.jsx(bd,{})}),t.jsx(ge,{path:"/diagrams",element:t.jsx(Jl,{})}),t.jsx(ge,{path:"/diagrams/:diagramType/:diagramId",element:t.jsx(vd,{})}),Xi().map(u=>t.jsx(ge,{path:u,element:t.jsx(Oe,{})},u)),t.jsx(ge,{path:"/ontology/:packageName",element:t.jsx(Oe,{})}),t.jsx(ge,{path:"/ontology/:packageName/:layerId",element:t.jsx(Oe,{})}),t.jsx(ge,{path:"/dhf/:docId",element:t.jsx(Oe,{})}),t.jsx(ge,{path:"*",element:t.jsx(Oe,{})})]})}),n.type!=="element-detail"&&n.type!=="scenario-editor"&&n.type!=="ontology"&&n.type!=="ontology-detail"&&n.type!=="ai"&&n.type!=="ask"&&n.type!=="sysml-generator"&&n.type!=="analysis"&&!i&&l!=="dhf"&&l!=="ontology"&&(o.size>=2?t.jsx(Nl,{}):t.jsx(Cl,{}))]}),t.jsx(Al,{}),t.jsx(Tl,{}),t.jsx(Ml,{}),t.jsx(Ll,{}),t.jsx(Ul,{}),t.jsx(Vl,{}),t.jsx(zl,{})]}):t.jsxs("div",{className:"flex flex-col h-screen",style:{background:Ct,color:"#1a1a1a"},children:[t.jsx(ht,{}),t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsxs("div",{className:"text-center",children:[t.jsx("img",{src:"/logo.png",alt:"MEMO Logo",style:{width:"360px",maxWidth:"80vw",display:"block",margin:"0 auto -20px auto",opacity:.45,filter:"grayscale(1)"},className:"animate-pulse"}),t.jsx("h2",{style:{fontSize:"18px",fontWeight:700,color:"#1B3A4B",marginBottom:"6px"},children:"MEMO Architect"}),t.jsx("p",{style:{color:"#6B7280",fontSize:"14px"},children:"Loading model data…"})]})})]}):t.jsxs("div",{className:"flex flex-col h-screen",style:{background:Ct,color:"#1a1a1a"},children:[t.jsx(ht,{}),t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsxs("div",{className:"text-center max-w-md",children:[t.jsx("img",{src:"/logo.png",alt:"MEMO Logo",style:{width:"360px",maxWidth:"80vw",display:"block",margin:"0 auto -20px auto",opacity:.45,filter:"grayscale(1)"},className:"animate-pulse"}),t.jsx("h2",{style:{fontSize:"18px",fontWeight:700,color:"#1B3A4B",marginBottom:"8px"},children:"MEMO Architect"}),t.jsx("p",{style:{color:"#6B7280",fontSize:"14px",marginBottom:"20px"},children:"Connecting to dev server…"}),t.jsxs("div",{style:{color:"#6B7280",fontSize:"13px",lineHeight:"1.6",textAlign:"left",background:"rgba(255,255,255,0.6)",borderRadius:"10px",padding:"16px 20px",border:"1px solid rgba(255,255,255,0.9)"},children:[t.jsx("p",{style:{fontWeight:600,color:"#374151",marginBottom:"8px"},children:"Start the MEMO dev server:"}),t.jsx("code",{style:{display:"block",margin:"0 0 12px",padding:"8px 14px",background:"#1B3A4B",color:"#2DD4A8",borderRadius:"6px",fontFamily:"monospace",fontSize:"13px"},children:"pnpm architect -- dev --port 3000"}),t.jsx("p",{style:{color:"#9CA3AF",marginBottom:"8px"},children:"Or try the example project:"}),t.jsx("code",{style:{display:"block",padding:"8px 14px",background:"#1B3A4B",color:"#2DD4A8",borderRadius:"6px",fontFamily:"monospace",fontSize:"13px"},children:"pnpm example:dev"})]})]})})]})}function xd(){const{family:e=""}=hn();return t.jsx(Ql,{family:e.toUpperCase()})}function bd(){const{shortId:e=""}=hn(),r=E(a=>a.model),n=E(a=>a.setActiveView),o=E(a=>a.selectElement);return p.useEffect(()=>{if(!r)return;const a=Object.values(r.elements).find(i=>(i.shortId??i.id)===e);a&&(o(a.id),n({type:"element-detail",elementId:a.id}))},[e,r,n,o]),t.jsx(p.Suspense,{fallback:t.jsx(po,{}),children:t.jsx(uo,{})})}function vd(){const{diagramId:e=""}=hn(),r=E(a=>a.model),n=E(a=>a.selectDiagram),o=E(a=>a.setActiveView);return p.useEffect(()=>{var i;if(!r)return;const a=(i=r.diagrams)==null?void 0:i.find(l=>{var s;return l.id===e||l.id.toLowerCase()===e.toLowerCase()||((s=l.shortId)==null?void 0:s.toLowerCase())===e.toLowerCase()});a&&(n(a.id),o({type:"diagram",diagramId:a.id}))},[e,r,n,o]),t.jsx(Oe,{})}function wd(){const e=E(d=>d.activeView),r=E(d=>d.model),n=E(d=>d.setActiveView),o=E(d=>d.setActiveMode),a=Ce(),i=ke(),l=Zo(),s=p.useRef(!1),c=p.useRef(!1);return p.useEffect(()=>{const d=!s.current;if(s.current=!0,!d&&l!=="POP")return;const u=Yi(i.pathname,i.search);(u==null?void 0:u.type)==="scenario-editor"&&o("scenario"),u&&JSON.stringify(u)!==JSON.stringify(e)&&(c.current=!0,n(u))},[i.pathname,i.search,l]),p.useEffect(()=>{var u;if(!s.current)return;if(c.current){c.current=!1;return}if(e.type==="welcome"&&i.pathname!=="/"||Ji(i.pathname)&&!(e.type==="diagram"||e.type==="element-detail"))return;let d=null;if(e.type==="element-detail"&&r){const y=r.elements[e.elementId];if(y){const b=y.shortId??y.id;d=`/catalog/${b.split("-")[0]}/${b}`}}else if(e.type==="diagram"&&r){const y=(u=r.diagrams)==null?void 0:u.find(b=>b.id===e.diagramId);y&&(d=`/diagrams/${Ki(y.diagramType)}/${encodeURIComponent(y.shortId??y.id)}`)}else d=Gi(e);d&&i.pathname+i.search!==d&&a(d,{replace:!1})},[e,r]),null}ho.createRoot(document.getElementById("root")).render(t.jsx(p.StrictMode,{children:t.jsx(za,{children:t.jsx(hd,{})})}));export{Bl as A,Hd as B,g as C,Le as D,Ss as E,F,qd as G,Bd as H,Ad as I,zt as J,us as K,Qe as L,co as M,Vd as N,_d as O,ul as P,Od as Q,pl as R,zd as S,Sd as T,$r as U,Fn as V,Fd as W,Nd as X,$d as Y,te as _,Ud as a,Dd as b,jd as c,Pi as d,Ld as e,lt as f,Rt as g,se as h,Kr as i,zr as j,Wi as k,Cd as l,Me as m,un as n,ps as o,Pd as p,Md as q,Wd as r,qi as s,Td as t,E as u,Rd as v,Id as w,Kd as x,rt as y,gl as z};