@memoarchitect/architect 0.10.5 → 0.11.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/assets/{AiWorkspace-DABn1bcB.js → AiWorkspace-GFHs046m.js} +1 -1
- package/dist/assets/{AnalysisWorkspace-B8CYPLNe.js → AnalysisWorkspace-BfZ4GYza.js} +1 -1
- package/dist/assets/{ComplianceWizard-DqeyOz4M.js → ComplianceWizard-CYBizPbC.js} +1 -1
- package/dist/assets/{DSMView-V3iNMXFW.js → DSMView-BsjhUbpW.js} +1 -1
- package/dist/assets/{Dashboard-BQj09cZH.js → Dashboard-rdbfFJYx.js} +1 -1
- package/dist/assets/{DhfDashboard-K1p89I1a.js → DhfDashboard-BdhBA4OL.js} +1 -1
- package/dist/assets/{DhfWorkbench-BqS0Z41-.js → DhfWorkbench-tnIpEFmu.js} +3 -3
- package/dist/assets/{DiagramCanvas-BkKlNUeI.js → DiagramCanvas-BmVByLcM.js} +4 -4
- package/dist/assets/{DiagramEditor-D6CT8dNm.js → DiagramEditor-icnDwdxM.js} +2 -2
- package/dist/assets/{ElementDetailView-D1ydy4ml.js → ElementDetailView-Crpltlrz.js} +1 -1
- package/dist/assets/ExplorerTreeRow-DG8T31JS.js +3 -0
- package/dist/assets/{ImportView-RFKKNv71.js → ImportView-1vrZ1CGB.js} +1 -1
- package/dist/assets/{LayerGrid-D0ulV2Rw.js → LayerGrid-DnP2smgG.js} +1 -1
- package/dist/assets/{LayerTable-CZR1_QVc.js → LayerTable-97qPfMD3.js} +1 -1
- package/dist/assets/{MaxGraphCanvas-iQCvQs_L.js → MaxGraphCanvas-BJss9LYp.js} +1 -1
- package/dist/assets/{ModelDiff-CNpUtYV1.js → ModelDiff-H5nxOavB.js} +1 -1
- package/dist/assets/{OntologyDecompositionDiagram-DsCM8X-l.js → OntologyDecompositionDiagram-D0G3A7-R.js} +1 -1
- package/dist/assets/{OntologyViewer-Cx5WU_uI.js → OntologyViewer-0BJ2jMZ8.js} +2 -2
- package/dist/assets/{ReviewDashboard-B6tw6wBJ.js → ReviewDashboard-Dl-YTC4_.js} +1 -1
- package/dist/assets/{ScenarioEditor-B_M819qh.js → ScenarioEditor-CiHaTvVY.js} +1 -1
- package/dist/assets/{StatisticsDashboard-DDsFeIAZ.js → StatisticsDashboard-w2dtCD94.js} +1 -1
- package/dist/assets/{TabularView-kcWhQVcI.js → TabularView-CFy0PK1L.js} +1 -1
- package/dist/assets/{TraceabilityMatrix-DGny6KvJ.js → TraceabilityMatrix-DDoHYsCP.js} +1 -1
- package/dist/assets/UiScreensWorkspace-DOxjCMG9.js +1 -0
- package/dist/assets/{WorkflowWizard-D9NwvOlw.js → WorkflowWizard-Br1zPSLC.js} +1 -1
- package/dist/assets/{index-BFvU1nLo.js → index-DEVvBtNh.js} +67 -67
- package/dist/assets/{index.es-BxzJo0aw.js → index.es-D0WykKwq.js} +1 -1
- package/dist/assets/{jspdf.es.min-B7Dh4CBm.js → jspdf.es.min-DZ4wvU_9.js} +3 -3
- package/dist/assets/notation-scene-HbscVJH5.js +1 -0
- package/dist/index.html +1 -1
- package/dist-standalone/index.html +185 -185
- package/package.json +3 -3
- package/dist/assets/ExplorerTreeRow-DNlv-JxW.js +0 -3
- package/dist/assets/UiScreensWorkspace-BpIx67i-.js +0 -1
- package/dist/assets/notation-scene-BB2meNb3.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ScenarioEditor-
|
|
2
|
-
import{r as
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ScenarioEditor-CiHaTvVY.js","assets/reactflow-C9OlmOYw.js","assets/zustand-CrhqMOHB.js","assets/DiagramEditor-icnDwdxM.js","assets/DiagramToolbarControls-XMGLx08e.js","assets/DSMView-BsjhUbpW.js","assets/OntologyViewer-0BJ2jMZ8.js","assets/TraceabilityMatrix-DDoHYsCP.js","assets/ModelDiff-H5nxOavB.js","assets/ComplianceWizard-CYBizPbC.js","assets/StatisticsDashboard-w2dtCD94.js","assets/DhfDashboard-BdhBA4OL.js","assets/DhfWorkbench-tnIpEFmu.js","assets/AiWorkspace-GFHs046m.js","assets/ElementDetailView-Crpltlrz.js","assets/Dashboard-rdbfFJYx.js","assets/ReviewDashboard-Dl-YTC4_.js","assets/WorkflowWizard-Br1zPSLC.js","assets/TabularView-CFy0PK1L.js","assets/ImportView-1vrZ1CGB.js","assets/AnalysisWorkspace-BfZ4GYza.js","assets/UiScreensWorkspace-DOxjCMG9.js","assets/ExplorerTreeRow-DG8T31JS.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as zo,j as t}from"./reactflow-C9OlmOYw.js";import{a as p,b as Lr,W as Uo}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 s of a)if(s.type==="childList")for(const i of s.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&o(i)}).observe(document,{childList:!0,subtree:!0});function n(a){const s={};return a.integrity&&(s.integrity=a.integrity),a.referrerPolicy&&(s.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?s.credentials="include":a.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function o(a){if(a.ep)return;a.ep=!0;const s=n(a);fetch(a.href,s)}})();var St={},Yn;function Lo(){if(Yn)return St;Yn=1;var e=zo();return St.createRoot=e.createRoot,St.hydrateRoot=e.hydrateRoot,St}var qo=Lo();/**
|
|
3
3
|
* react-router v7.13.2
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) Remix Software Inc.
|
|
@@ -8,12 +8,12 @@ import{r as Io,j as t}from"./reactflow-C9OlmOYw.js";import{a as p,b as _r,W as M
|
|
|
8
8
|
* LICENSE.md file in the root directory of this source tree.
|
|
9
9
|
*
|
|
10
10
|
* @license MIT
|
|
11
|
-
*/var Kn="popstate";function Gn(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function Oo(e={}){function r(o,a){var d;let s=(d=a.state)==null?void 0:d.masked,{pathname:i,search:l,hash:c}=s||o.location;return Ut("",{pathname:i,search:l,hash:c},a.state&&a.state.usr||null,a.state&&a.state.key||"default",s?{pathname:o.location.pathname,search:o.location.search,hash:o.location.hash}:void 0)}function n(o,a){return typeof a=="string"?a:Ke(a)}return Pr(r,n,null,e)}function zo(e={}){function r(a,s){let{pathname:i="/",search:l="",hash:c=""}=Le(a.location.hash.substring(1));return!i.startsWith("/")&&!i.startsWith(".")&&(i="/"+i),Ut("",{pathname:i,search:l,hash:c},s.state&&s.state.usr||null,s.state&&s.state.key||"default")}function n(a,s){let i=a.document.querySelector("base"),l="";if(i&&i.getAttribute("href")){let c=a.location.href,d=c.indexOf("#");l=d===-1?c:c.slice(0,d)}return l+"#"+(typeof s=="string"?s:Ke(s))}function o(a,s){we(a.pathname.charAt(0)==="/",`relative pathnames are not supported in hash history.push(${JSON.stringify(s)})`)}return Pr(r,n,o,e)}function oe(e,r){if(e===!1||e===null||typeof e>"u")throw new Error(r)}function we(e,r){if(!e){typeof console<"u"&&console.warn(r);try{throw new Error(r)}catch{}}}function Uo(){return Math.random().toString(36).substring(2,10)}function Yn(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 Ut(e,r,n=null,o,a){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof r=="string"?Le(r):r,state:n,key:r&&r.key||o||Uo(),unstable_mask:a}}function Ke({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 Le(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 Pr(e,r,n,o={}){let{window:a=document.defaultView,v5Compat:s=!1}=o,i=a.history,l="POP",c=null,d=u();d==null&&(d=0,i.replaceState({...i.state,idx:d},""));function u(){return(i.state||{idx:null}).idx}function m(){l="POP";let h=u(),y=h==null?null:h-d;d=h,c&&c({action:l,location:g.location,delta:y})}function b(h,y){l="PUSH";let B=Gn(h)?h:Ut(g.location,h,y);n&&n(B,h),d=u()+1;let O=Yn(B,d),D=g.createHref(B.unstable_mask||B);try{i.pushState(O,"",D)}catch(R){if(R instanceof DOMException&&R.name==="DataCloneError")throw R;a.location.assign(D)}s&&c&&c({action:l,location:g.location,delta:1})}function w(h,y){l="REPLACE";let B=Gn(h)?h:Ut(g.location,h,y);n&&n(B,h),d=u();let O=Yn(B,d),D=g.createHref(B.unstable_mask||B);i.replaceState(O,"",D),s&&c&&c({action:l,location:g.location,delta:0})}function S(h){return Lo(h)}let g={get action(){return l},get location(){return e(a,i)},listen(h){if(c)throw new Error("A history only accepts one active listener");return a.addEventListener(Kn,m),c=h,()=>{a.removeEventListener(Kn,m),c=null}},createHref(h){return r(a,h)},createURL:S,encodeLocation(h){let y=S(h);return{pathname:y.pathname,search:y.search,hash:y.hash}},push:b,replace:w,go(h){return i.go(h)}};return g}function Lo(e,r=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),oe(n,"No window.location.(origin|href) available to create URL");let o=typeof e=="string"?e:Ke(e);return o=o.replace(/ $/,"%20"),!r&&o.startsWith("//")&&(o=n+o),new URL(o,n)}function Or(e,r,n="/"){return qo(e,r,n,!1)}function qo(e,r,n,o){let a=typeof r=="string"?Le(r):r,s=Te(a.pathname||"/",n);if(s==null)return null;let i=zr(e);$o(i);let l=null;for(let c=0;l==null&&c<i.length;++c){let d=ea(s);l=Qo(i[c],d,o)}return l}function zr(e,r=[],n=[],o="",a=!1){let s=(i,l,c=a,d)=>{let u={relativePath:d===void 0?i.path||"":d,caseSensitive:i.caseSensitive===!0,childrenIndex:l,route:i};if(u.relativePath.startsWith("/")){if(!u.relativePath.startsWith(o)&&c)return;oe(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 m=Ce([o,u.relativePath]),b=n.concat(u);i.children&&i.children.length>0&&(oe(i.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${m}".`),zr(i.children,r,b,m,c)),!(i.path==null&&!i.index)&&r.push({path:m,score:Jo(m,i.index),routesMeta:b})};return e.forEach((i,l)=>{var c;if(i.path===""||!((c=i.path)!=null&&c.includes("?")))s(i,l);else for(let d of Ur(i.path))s(i,l,!0,d)}),r}function Ur(e){let r=e.split("/");if(r.length===0)return[];let[n,...o]=r,a=n.endsWith("?"),s=n.replace(/\?$/,"");if(o.length===0)return a?[s,""]:[s];let i=Ur(o.join("/")),l=[];return l.push(...i.map(c=>c===""?s:[s,c].join("/"))),a&&l.push(...i),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function $o(e){e.sort((r,n)=>r.score!==n.score?n.score-r.score:Xo(r.routesMeta.map(o=>o.childrenIndex),n.routesMeta.map(o=>o.childrenIndex)))}var Vo=/^:[\w-]+$/,Wo=3,Ho=2,Ko=1,Go=10,Yo=-2,Jn=e=>e==="*";function Jo(e,r){let n=e.split("/"),o=n.length;return n.some(Jn)&&(o+=Yo),r&&(o+=Ho),n.filter(a=>!Jn(a)).reduce((a,s)=>a+(Vo.test(s)?Wo:s===""?Ko:Go),o)}function Xo(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 Qo(e,r,n=!1){let{routesMeta:o}=e,a={},s="/",i=[];for(let l=0;l<o.length;++l){let c=o[l],d=l===o.length-1,u=s==="/"?r:r.slice(s.length)||"/",m=Lt({path:c.relativePath,caseSensitive:c.caseSensitive,end:d},u),b=c.route;if(!m&&d&&n&&!o[o.length-1].route.index&&(m=Lt({path:c.relativePath,caseSensitive:c.caseSensitive,end:!1},u)),!m)return null;Object.assign(a,m.params),i.push({params:a,pathname:Ce([s,m.pathname]),pathnameBase:oa(Ce([s,m.pathnameBase])),route:b}),m.pathnameBase!=="/"&&(s=Ce([s,m.pathnameBase]))}return i}function Lt(e,r){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,o]=Zo(e.path,e.caseSensitive,e.end),a=r.match(n);if(!a)return null;let s=a[0],i=s.replace(/(.)\/+$/,"$1"),l=a.slice(1);return{params:o.reduce((d,{paramName:u,isOptional:m},b)=>{if(u==="*"){let S=l[b]||"";i=s.slice(0,s.length-S.length).replace(/(.)\/+$/,"$1")}const w=l[b];return m&&!w?d[u]=void 0:d[u]=(w||"").replace(/%2F/g,"/"),d},{}),pathname:s,pathnameBase:i,pattern:e}}function Zo(e,r=!1,n=!0){we(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,(i,l,c,d,u)=>{if(o.push({paramName:l,isOptional:c!=null}),c){let m=u.charAt(d+i.length);return m&&m!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}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 ea(e){try{return e.split("/").map(r=>decodeURIComponent(r).replace(/\//g,"%2F")).join("/")}catch(r){return we(!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 Te(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 ta=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function na(e,r="/"){let{pathname:n,search:o="",hash:a=""}=typeof e=="string"?Le(e):e,s;return n?(n=n.replace(/\/\/+/g,"/"),n.startsWith("/")?s=Xn(n.substring(1),"/"):s=Xn(n,r)):s=r,{pathname:s,search:aa(o),hash:sa(a)}}function Xn(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 Xt(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 ra(e){return e.filter((r,n)=>n===0||r.route.path&&r.route.path.length>0)}function Lr(e){let r=ra(e);return r.map((n,o)=>o===r.length-1?n.pathname:n.pathnameBase)}function An(e,r,n,o=!1){let a;typeof e=="string"?a=Le(e):(a={...e},oe(!a.pathname||!a.pathname.includes("?"),Xt("?","pathname","search",a)),oe(!a.pathname||!a.pathname.includes("#"),Xt("#","pathname","hash",a)),oe(!a.search||!a.search.includes("#"),Xt("#","search","hash",a)));let s=e===""||a.pathname==="",i=s?"/":a.pathname,l;if(i==null)l=n;else{let m=r.length-1;if(!o&&i.startsWith("..")){let b=i.split("/");for(;b[0]==="..";)b.shift(),m-=1;a.pathname=b.join("/")}l=m>=0?r[m]:"/"}let c=na(a,l),d=i&&i!=="/"&&i.endsWith("/"),u=(s||i===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(d||u)&&(c.pathname+="/"),c}var Ce=e=>e.join("/").replace(/\/\/+/g,"/"),oa=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),aa=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,sa=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,ia=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 la(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function da(e){return e.map(r=>r.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var qr=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function $r(e,r){let n=e;if(typeof n!="string"||!ta.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let o=n,a=!1;if(qr)try{let s=new URL(window.location.href),i=n.startsWith("//")?new URL(s.protocol+n):new URL(n),l=Te(i.pathname,r);i.origin===s.origin&&l!=null?n=l+i.search+i.hash:a=!0}catch{we(!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 Vr=["POST","PUT","PATCH","DELETE"];new Set(Vr);var ca=["GET",...Vr];new Set(ca);var Qe=p.createContext(null);Qe.displayName="DataRouter";var Wt=p.createContext(null);Wt.displayName="DataRouterState";var ua=p.createContext(!1),Wr=p.createContext({isTransitioning:!1});Wr.displayName="ViewTransition";var pa=p.createContext(new Map);pa.displayName="Fetchers";var ma=p.createContext(null);ma.displayName="Await";var ye=p.createContext(null);ye.displayName="Navigation";var Ze=p.createContext(null);Ze.displayName="Location";var je=p.createContext({outlet:null,matches:[],isDataRoute:!1});je.displayName="Route";var Nn=p.createContext(null);Nn.displayName="RouteError";var Hr="REACT_ROUTER_ERROR",fa="REDIRECT",ha="ROUTE_ERROR_RESPONSE";function ya(e){if(e.startsWith(`${Hr}:${fa}:{`))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 ga(e){if(e.startsWith(`${Hr}:${ha}:{`))try{let r=JSON.parse(e.slice(40));if(typeof r=="object"&&r&&typeof r.status=="number"&&typeof r.statusText=="string")return new ia(r.status,r.statusText,r.data)}catch{}}function xa(e,{relative:r}={}){oe(xt(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:o}=p.useContext(ye),{hash:a,pathname:s,search:i}=bt(e,{relative:r}),l=s;return n!=="/"&&(l=s==="/"?n:Ce([n,s])),o.createHref({pathname:l,search:i,hash:a})}function xt(){return p.useContext(Ze)!=null}function De(){return oe(xt(),"useLocation() may be used only in the context of a <Router> component."),p.useContext(Ze).location}function ba(){return p.useContext(Ze).navigationType}var Kr="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Gr(e){p.useContext(ye).static||p.useLayoutEffect(e)}function ke(){let{isDataRoute:e}=p.useContext(je);return e?Ta():va()}function va(){oe(xt(),"useNavigate() may be used only in the context of a <Router> component.");let e=p.useContext(Qe),{basename:r,navigator:n}=p.useContext(ye),{matches:o}=p.useContext(je),{pathname:a}=De(),s=JSON.stringify(Lr(o)),i=p.useRef(!1);return Gr(()=>{i.current=!0}),p.useCallback((c,d={})=>{if(we(i.current,Kr),!i.current)return;if(typeof c=="number"){n.go(c);return}let u=An(c,JSON.parse(s),a,d.relative==="path");e==null&&r!=="/"&&(u.pathname=u.pathname==="/"?r:Ce([r,u.pathname])),(d.replace?n.replace:n.push)(u,d.state,d)},[r,n,s,a,e])}p.createContext(null);function Tn(){let{matches:e}=p.useContext(je),r=e[e.length-1];return r?r.params:{}}function bt(e,{relative:r}={}){let{matches:n}=p.useContext(je),{pathname:o}=De(),a=JSON.stringify(Lr(n));return p.useMemo(()=>An(e,JSON.parse(a),o,r==="path"),[e,a,o,r])}function wa(e,r){return Yr(e,r)}function Yr(e,r,n){var h;oe(xt(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:o}=p.useContext(ye),{matches:a}=p.useContext(je),s=a[a.length-1],i=s?s.params:{},l=s?s.pathname:"/",c=s?s.pathnameBase:"/",d=s&&s.route;{let y=d&&d.path||"";Xr(l,!d||y.endsWith("*")||y.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${l}" (under <Route path="${y}">) 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.
|
|
11
|
+
*/var Jn="popstate";function Xn(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function $o(e={}){function r(o,a){var d;let s=(d=a.state)==null?void 0:d.masked,{pathname:i,search:l,hash:c}=s||o.location;return qt("",{pathname:i,search:l,hash:c},a.state&&a.state.usr||null,a.state&&a.state.key||"default",s?{pathname:o.location.pathname,search:o.location.search,hash:o.location.hash}:void 0)}function n(o,a){return typeof a=="string"?a:Ge(a)}return qr(r,n,null,e)}function Vo(e={}){function r(a,s){let{pathname:i="/",search:l="",hash:c=""}=qe(a.location.hash.substring(1));return!i.startsWith("/")&&!i.startsWith(".")&&(i="/"+i),qt("",{pathname:i,search:l,hash:c},s.state&&s.state.usr||null,s.state&&s.state.key||"default")}function n(a,s){let i=a.document.querySelector("base"),l="";if(i&&i.getAttribute("href")){let c=a.location.href,d=c.indexOf("#");l=d===-1?c:c.slice(0,d)}return l+"#"+(typeof s=="string"?s:Ge(s))}function o(a,s){Se(a.pathname.charAt(0)==="/",`relative pathnames are not supported in hash history.push(${JSON.stringify(s)})`)}return qr(r,n,o,e)}function se(e,r){if(e===!1||e===null||typeof e>"u")throw new Error(r)}function Se(e,r){if(!e){typeof console<"u"&&console.warn(r);try{throw new Error(r)}catch{}}}function Wo(){return Math.random().toString(36).substring(2,10)}function Qn(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 qt(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||Wo(),unstable_mask:a}}function Ge({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 qr(e,r,n,o={}){let{window:a=document.defaultView,v5Compat:s=!1}=o,i=a.history,l="POP",c=null,d=u();d==null&&(d=0,i.replaceState({...i.state,idx:d},""));function u(){return(i.state||{idx:null}).idx}function m(){l="POP";let h=u(),y=h==null?null:h-d;d=h,c&&c({action:l,location:g.location,delta:y})}function b(h,y){l="PUSH";let B=Xn(h)?h:qt(g.location,h,y);n&&n(B,h),d=u()+1;let N=Qn(B,d),D=g.createHref(B.unstable_mask||B);try{i.pushState(N,"",D)}catch(A){if(A instanceof DOMException&&A.name==="DataCloneError")throw A;a.location.assign(D)}s&&c&&c({action:l,location:g.location,delta:1})}function v(h,y){l="REPLACE";let B=Xn(h)?h:qt(g.location,h,y);n&&n(B,h),d=u();let N=Qn(B,d),D=g.createHref(B.unstable_mask||B);i.replaceState(N,"",D),s&&c&&c({action:l,location:g.location,delta:0})}function w(h){return Ho(h)}let g={get action(){return l},get location(){return e(a,i)},listen(h){if(c)throw new Error("A history only accepts one active listener");return a.addEventListener(Jn,m),c=h,()=>{a.removeEventListener(Jn,m),c=null}},createHref(h){return r(a,h)},createURL:w,encodeLocation(h){let y=w(h);return{pathname:y.pathname,search:y.search,hash:y.hash}},push:b,replace:v,go(h){return i.go(h)}};return g}function Ho(e,r=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),se(n,"No window.location.(origin|href) available to create URL");let o=typeof e=="string"?e:Ge(e);return o=o.replace(/ $/,"%20"),!r&&o.startsWith("//")&&(o=n+o),new URL(o,n)}function $r(e,r,n="/"){return Ko(e,r,n,!1)}function Ko(e,r,n,o){let a=typeof r=="string"?qe(r):r,s=Ie(a.pathname||"/",n);if(s==null)return null;let i=Vr(e);Go(i);let l=null;for(let c=0;l==null&&c<i.length;++c){let d=aa(s);l=ra(i[c],d,o)}return l}function Vr(e,r=[],n=[],o="",a=!1){let s=(i,l,c=a,d)=>{let u={relativePath:d===void 0?i.path||"":d,caseSensitive:i.caseSensitive===!0,childrenIndex:l,route:i};if(u.relativePath.startsWith("/")){if(!u.relativePath.startsWith(o)&&c)return;se(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 m=je([o,u.relativePath]),b=n.concat(u);i.children&&i.children.length>0&&(se(i.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${m}".`),Vr(i.children,r,b,m,c)),!(i.path==null&&!i.index)&&r.push({path:m,score:ta(m,i.index),routesMeta:b})};return e.forEach((i,l)=>{var c;if(i.path===""||!((c=i.path)!=null&&c.includes("?")))s(i,l);else for(let d of Wr(i.path))s(i,l,!0,d)}),r}function Wr(e){let r=e.split("/");if(r.length===0)return[];let[n,...o]=r,a=n.endsWith("?"),s=n.replace(/\?$/,"");if(o.length===0)return a?[s,""]:[s];let i=Wr(o.join("/")),l=[];return l.push(...i.map(c=>c===""?s:[s,c].join("/"))),a&&l.push(...i),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function Go(e){e.sort((r,n)=>r.score!==n.score?n.score-r.score:na(r.routesMeta.map(o=>o.childrenIndex),n.routesMeta.map(o=>o.childrenIndex)))}var Yo=/^:[\w-]+$/,Jo=3,Xo=2,Qo=1,Zo=10,ea=-2,Zn=e=>e==="*";function ta(e,r){let n=e.split("/"),o=n.length;return n.some(Zn)&&(o+=ea),r&&(o+=Xo),n.filter(a=>!Zn(a)).reduce((a,s)=>a+(Yo.test(s)?Jo:s===""?Qo:Zo),o)}function na(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 ra(e,r,n=!1){let{routesMeta:o}=e,a={},s="/",i=[];for(let l=0;l<o.length;++l){let c=o[l],d=l===o.length-1,u=s==="/"?r:r.slice(s.length)||"/",m=$t({path:c.relativePath,caseSensitive:c.caseSensitive,end:d},u),b=c.route;if(!m&&d&&n&&!o[o.length-1].route.index&&(m=$t({path:c.relativePath,caseSensitive:c.caseSensitive,end:!1},u)),!m)return null;Object.assign(a,m.params),i.push({params:a,pathname:je([s,m.pathname]),pathnameBase:da(je([s,m.pathnameBase])),route:b}),m.pathnameBase!=="/"&&(s=je([s,m.pathnameBase]))}return i}function $t(e,r){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,o]=oa(e.path,e.caseSensitive,e.end),a=r.match(n);if(!a)return null;let s=a[0],i=s.replace(/(.)\/+$/,"$1"),l=a.slice(1);return{params:o.reduce((d,{paramName:u,isOptional:m},b)=>{if(u==="*"){let w=l[b]||"";i=s.slice(0,s.length-w.length).replace(/(.)\/+$/,"$1")}const v=l[b];return m&&!v?d[u]=void 0:d[u]=(v||"").replace(/%2F/g,"/"),d},{}),pathname:s,pathnameBase:i,pattern:e}}function oa(e,r=!1,n=!0){Se(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,(i,l,c,d,u)=>{if(o.push({paramName:l,isOptional:c!=null}),c){let m=u.charAt(d+i.length);return m&&m!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}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 aa(e){try{return e.split("/").map(r=>decodeURIComponent(r).replace(/\//g,"%2F")).join("/")}catch(r){return Se(!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 Ie(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 sa=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function ia(e,r="/"){let{pathname:n,search:o="",hash:a=""}=typeof e=="string"?qe(e):e,s;return n?(n=n.replace(/\/\/+/g,"/"),n.startsWith("/")?s=er(n.substring(1),"/"):s=er(n,r)):s=r,{pathname:s,search:ca(o),hash:ua(a)}}function er(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 en(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 la(e){return e.filter((r,n)=>n===0||r.route.path&&r.route.path.length>0)}function Hr(e){let r=la(e);return r.map((n,o)=>o===r.length-1?n.pathname:n.pathnameBase)}function Nn(e,r,n,o=!1){let a;typeof e=="string"?a=qe(e):(a={...e},se(!a.pathname||!a.pathname.includes("?"),en("?","pathname","search",a)),se(!a.pathname||!a.pathname.includes("#"),en("#","pathname","hash",a)),se(!a.search||!a.search.includes("#"),en("#","search","hash",a)));let s=e===""||a.pathname==="",i=s?"/":a.pathname,l;if(i==null)l=n;else{let m=r.length-1;if(!o&&i.startsWith("..")){let b=i.split("/");for(;b[0]==="..";)b.shift(),m-=1;a.pathname=b.join("/")}l=m>=0?r[m]:"/"}let c=ia(a,l),d=i&&i!=="/"&&i.endsWith("/"),u=(s||i===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(d||u)&&(c.pathname+="/"),c}var je=e=>e.join("/").replace(/\/\/+/g,"/"),da=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),ca=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,ua=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,pa=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 ma(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function fa(e){return e.map(r=>r.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var Kr=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Gr(e,r){let n=e;if(typeof n!="string"||!sa.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let o=n,a=!1;if(Kr)try{let s=new URL(window.location.href),i=n.startsWith("//")?new URL(s.protocol+n):new URL(n),l=Ie(i.pathname,r);i.origin===s.origin&&l!=null?n=l+i.search+i.hash:a=!0}catch{Se(!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 Yr=["POST","PUT","PATCH","DELETE"];new Set(Yr);var ha=["GET",...Yr];new Set(ha);var Qe=p.createContext(null);Qe.displayName="DataRouter";var Gt=p.createContext(null);Gt.displayName="DataRouterState";var ya=p.createContext(!1),Jr=p.createContext({isTransitioning:!1});Jr.displayName="ViewTransition";var ga=p.createContext(new Map);ga.displayName="Fetchers";var xa=p.createContext(null);xa.displayName="Await";var ye=p.createContext(null);ye.displayName="Navigation";var Ze=p.createContext(null);Ze.displayName="Location";var De=p.createContext({outlet:null,matches:[],isDataRoute:!1});De.displayName="Route";var Tn=p.createContext(null);Tn.displayName="RouteError";var Xr="REACT_ROUTER_ERROR",ba="REDIRECT",va="ROUTE_ERROR_RESPONSE";function wa(e){if(e.startsWith(`${Xr}:${ba}:{`))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 ka(e){if(e.startsWith(`${Xr}:${va}:{`))try{let r=JSON.parse(e.slice(40));if(typeof r=="object"&&r&&typeof r.status=="number"&&typeof r.statusText=="string")return new pa(r.status,r.statusText,r.data)}catch{}}function Sa(e,{relative:r}={}){se(bt(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:o}=p.useContext(ye),{hash:a,pathname:s,search:i}=vt(e,{relative:r}),l=s;return n!=="/"&&(l=s==="/"?n:je([n,s])),o.createHref({pathname:l,search:i,hash:a})}function bt(){return p.useContext(Ze)!=null}function Be(){return se(bt(),"useLocation() may be used only in the context of a <Router> component."),p.useContext(Ze).location}function Ca(){return p.useContext(Ze).navigationType}var Qr="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Zr(e){p.useContext(ye).static||p.useLayoutEffect(e)}function Ce(){let{isDataRoute:e}=p.useContext(De);return e?Pa():Ea()}function Ea(){se(bt(),"useNavigate() may be used only in the context of a <Router> component.");let e=p.useContext(Qe),{basename:r,navigator:n}=p.useContext(ye),{matches:o}=p.useContext(De),{pathname:a}=Be(),s=JSON.stringify(Hr(o)),i=p.useRef(!1);return Zr(()=>{i.current=!0}),p.useCallback((c,d={})=>{if(Se(i.current,Qr),!i.current)return;if(typeof c=="number"){n.go(c);return}let u=Nn(c,JSON.parse(s),a,d.relative==="path");e==null&&r!=="/"&&(u.pathname=u.pathname==="/"?r:je([r,u.pathname])),(d.replace?n.replace:n.push)(u,d.state,d)},[r,n,s,a,e])}p.createContext(null);function Rn(){let{matches:e}=p.useContext(De),r=e[e.length-1];return r?r.params:{}}function vt(e,{relative:r}={}){let{matches:n}=p.useContext(De),{pathname:o}=Be(),a=JSON.stringify(Hr(n));return p.useMemo(()=>Nn(e,JSON.parse(a),o,r==="path"),[e,a,o,r])}function ja(e,r){return eo(e,r)}function eo(e,r,n){var h;se(bt(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:o}=p.useContext(ye),{matches:a}=p.useContext(De),s=a[a.length-1],i=s?s.params:{},l=s?s.pathname:"/",c=s?s.pathnameBase:"/",d=s&&s.route;{let y=d&&d.path||"";no(l,!d||y.endsWith("*")||y.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${l}" (under <Route path="${y}">) 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
12
|
|
|
13
|
-
Please change the parent <Route path="${y}"> to <Route path="${y==="/"?"*":`${y}/*`}">.`)}let u=De(),m;if(r){let y=typeof r=="string"?Le(r):r;oe(c==="/"||((h=y.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 "${y.pathname}" was given in the \`location\` prop.`),m=y}else m=u;let b=m.pathname||"/",w=b;if(c!=="/"){let y=c.replace(/^\//,"").split("/");w="/"+b.replace(/^\//,"").split("/").slice(y.length).join("/")}let S=Or(e,{pathname:w});we(d||S!=null,`No routes matched location "${m.pathname}${m.search}${m.hash}" `),we(S==null||S[S.length-1].route.element!==void 0||S[S.length-1].route.Component!==void 0||S[S.length-1].route.lazy!==void 0,`Matched leaf route at location "${m.pathname}${m.search}${m.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 g=ja(S&&S.map(y=>Object.assign({},y,{params:Object.assign({},i,y.params),pathname:Ce([c,o.encodeLocation?o.encodeLocation(y.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:y.pathname]),pathnameBase:y.pathnameBase==="/"?c:Ce([c,o.encodeLocation?o.encodeLocation(y.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:y.pathnameBase])})),a,n);return r&&g?p.createElement(Ze.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...m},navigationType:"POP"}},g):g}function ka(){let e=Na(),r=la(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},s={padding:"2px 4px",backgroundColor:o},i=null;return console.error("Error handled by React Router default ErrorBoundary:",e),i=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:s},"ErrorBoundary")," or"," ",p.createElement("code",{style:s},"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,i)}var Sa=p.createElement(ka,null),Jr=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=ga(e.digest);n&&(e=n)}let r=e!==void 0?p.createElement(je.Provider,{value:this.props.routeContext},p.createElement(Nn.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?p.createElement(Ea,{error:e},r):r}};Jr.contextType=ua;var Qt=new WeakMap;function Ea({children:e,error:r}){let{basename:n}=p.useContext(ye);if(typeof r=="object"&&r&&"digest"in r&&typeof r.digest=="string"){let o=ya(r.digest);if(o){let a=Qt.get(r);if(a)throw a;let s=$r(o.location,n);if(qr&&!Qt.get(r))if(s.isExternal||o.reloadDocument)window.location.href=s.absoluteURL||s.to;else{const i=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(s.to,{replace:o.replace}));throw Qt.set(r,i),i}return p.createElement("meta",{httpEquiv:"refresh",content:`0;url=${s.absoluteURL||s.to}`})}}return e}function Ca({routeContext:e,match:r,children:n}){let o=p.useContext(Qe);return o&&o.static&&o.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=r.route.id),p.createElement(je.Provider,{value:e},n)}function ja(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,s=o==null?void 0:o.errors;if(s!=null){let u=a.findIndex(m=>m.route.id&&(s==null?void 0:s[m.route.id])!==void 0);oe(u>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(s).join(",")}`),a=a.slice(0,Math.min(a.length,u+1))}let i=!1,l=-1;if(n&&o){i=o.renderFallback;for(let u=0;u<a.length;u++){let m=a[u];if((m.route.HydrateFallback||m.route.hydrateFallbackElement)&&(l=u),m.route.id){let{loaderData:b,errors:w}=o,S=m.route.loader&&!b.hasOwnProperty(m.route.id)&&(!w||w[m.route.id]===void 0);if(m.route.lazy||S){n.isStatic&&(i=!0),l>=0?a=a.slice(0,l+1):a=[a[0]];break}}}}let c=n==null?void 0:n.onError,d=o&&c?(u,m)=>{var b,w;c(u,{location:o.location,params:((w=(b=o.matches)==null?void 0:b[0])==null?void 0:w.params)??{},unstable_pattern:da(o.matches),errorInfo:m})}:void 0;return a.reduceRight((u,m,b)=>{let w,S=!1,g=null,h=null;o&&(w=s&&m.route.id?s[m.route.id]:void 0,g=m.route.errorElement||Sa,i&&(l<0&&b===0?(Xr("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),S=!0,h=null):l===b&&(S=!0,h=m.route.hydrateFallbackElement||null)));let y=r.concat(a.slice(0,b+1)),B=()=>{let O;return w?O=g:S?O=h:m.route.Component?O=p.createElement(m.route.Component,null):m.route.element?O=m.route.element:O=u,p.createElement(Ca,{match:m,routeContext:{outlet:u,matches:y,isDataRoute:o!=null},children:O})};return o&&(m.route.ErrorBoundary||m.route.errorElement||b===0)?p.createElement(Jr,{location:o.location,revalidation:o.revalidation,component:g,error:w,children:B(),routeContext:{outlet:null,matches:y,isDataRoute:!0},onError:d}):B()},null)}function Rn(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Da(e){let r=p.useContext(Qe);return oe(r,Rn(e)),r}function Ba(e){let r=p.useContext(Wt);return oe(r,Rn(e)),r}function Fa(e){let r=p.useContext(je);return oe(r,Rn(e)),r}function In(e){let r=Fa(e),n=r.matches[r.matches.length-1];return oe(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function Aa(){return In("useRouteId")}function Na(){var o;let e=p.useContext(Nn),r=Ba("useRouteError"),n=In("useRouteError");return e!==void 0?e:(o=r.errors)==null?void 0:o[n]}function Ta(){let{router:e}=Da("useNavigate"),r=In("useNavigate"),n=p.useRef(!1);return Gr(()=>{n.current=!0}),p.useCallback(async(a,s={})=>{we(n.current,Kr),n.current&&(typeof a=="number"?await e.navigate(a):await e.navigate(a,{fromRouteId:r,...s}))},[e,r])}var Qn={};function Xr(e,r,n){!r&&!Qn[e]&&(Qn[e]=!0,we(!1,n))}p.memo(Ra);function Ra({routes:e,future:r,state:n,isStatic:o,onError:a}){return Yr(e,void 0,{state:n,isStatic:o,onError:a})}function be(e){oe(!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 Qr({basename:e="/",children:r=null,location:n,navigationType:o="POP",navigator:a,static:s=!1,unstable_useTransitions:i}){oe(!xt(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let l=e.replace(/^\/*/,"/"),c=p.useMemo(()=>({basename:l,navigator:a,static:s,unstable_useTransitions:i,future:{}}),[l,a,s,i]);typeof n=="string"&&(n=Le(n));let{pathname:d="/",search:u="",hash:m="",state:b=null,key:w="default",unstable_mask:S}=n,g=p.useMemo(()=>{let h=Te(d,l);return h==null?null:{location:{pathname:h,search:u,hash:m,state:b,key:w,unstable_mask:S},navigationType:o}},[l,d,u,m,b,w,o,S]);return we(g!=null,`<Router basename="${l}"> is not able to match the URL "${d}${u}${m}" because it does not start with the basename, so the <Router> won't render anything.`),g==null?null:p.createElement(ye.Provider,{value:c},p.createElement(Ze.Provider,{children:r,value:g}))}function Ia({children:e,location:r}){return wa(xn(e),r)}function xn(e,r=[]){let n=[];return p.Children.forEach(e,(o,a)=>{if(!p.isValidElement(o))return;let s=[...r,a];if(o.type===p.Fragment){n.push.apply(n,xn(o.props.children,s));return}oe(o.type===be,`[${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>`),oe(!o.props.index||!o.props.children,"An index route cannot have child routes.");let i={id:o.props.id||s.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&&(i.children=xn(o.props.children,s)),n.push(i)}),n}var Mt="get",_t="application/x-www-form-urlencoded";function Ht(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function Ma(e){return Ht(e)&&e.tagName.toLowerCase()==="button"}function _a(e){return Ht(e)&&e.tagName.toLowerCase()==="form"}function Pa(e){return Ht(e)&&e.tagName.toLowerCase()==="input"}function Oa(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function za(e,r){return e.button===0&&(!r||r==="_self")&&!Oa(e)}var St=null;function Ua(){if(St===null)try{new FormData(document.createElement("form"),0),St=!1}catch{St=!0}return St}var La=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Zt(e){return e!=null&&!La.has(e)?(we(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${_t}"`),null):e}function qa(e,r){let n,o,a,s,i;if(_a(e)){let l=e.getAttribute("action");o=l?Te(l,r):null,n=e.getAttribute("method")||Mt,a=Zt(e.getAttribute("enctype"))||_t,s=new FormData(e)}else if(Ma(e)||Pa(e)&&(e.type==="submit"||e.type==="image")){let l=e.form;if(l==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let c=e.getAttribute("formaction")||l.getAttribute("action");if(o=c?Te(c,r):null,n=e.getAttribute("formmethod")||l.getAttribute("method")||Mt,a=Zt(e.getAttribute("formenctype"))||Zt(l.getAttribute("enctype"))||_t,s=new FormData(l,e),!Ua()){let{name:d,type:u,value:m}=e;if(u==="image"){let b=d?`${d}.`:"";s.append(`${b}x`,"0"),s.append(`${b}y`,"0")}else d&&s.append(d,m)}}else{if(Ht(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Mt,o=null,a=_t,i=e}return s&&a==="text/plain"&&(i=s,s=void 0),{action:o,method:n.toLowerCase(),encType:a,formData:s,body:i}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Mn(e,r){if(e===!1||e===null||typeof e>"u")throw new Error(r)}function $a(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&&Te(a.pathname,r)==="/"?a.pathname=`${r.replace(/\/$/,"")}/_root.${o}`:a.pathname=`${a.pathname.replace(/\/$/,"")}.${o}`,a}async function Va(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 Wa(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 Ha(e,r,n){let o=await Promise.all(e.map(async a=>{let s=r.routes[a.route.id];if(s){let i=await Va(s,n);return i.links?i.links():[]}return[]}));return Ja(o.flat(1).filter(Wa).filter(a=>a.rel==="stylesheet"||a.rel==="preload").map(a=>a.rel==="stylesheet"?{...a,rel:"prefetch",as:"style"}:{...a,rel:"prefetch"}))}function Zn(e,r,n,o,a,s){let i=(c,d)=>n[d]?c.route.id!==n[d].route.id:!0,l=(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 s==="assets"?r.filter((c,d)=>i(c,d)||l(c,d)):s==="data"?r.filter((c,d)=>{var m;let u=o.routes[c.route.id];if(!u||!u.hasLoader)return!1;if(i(c,d)||l(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:((m=n[0])==null?void 0:m.params)||{},nextUrl:new URL(e,window.origin),nextParams:c.params,defaultShouldRevalidate:!0});if(typeof b=="boolean")return b}return!0}):[]}function Ka(e,r,{includeHydrateFallback:n}={}){return Ga(e.map(o=>{let a=r.routes[o.route.id];if(!a)return[];let s=[a.module];return a.clientActionModule&&(s=s.concat(a.clientActionModule)),a.clientLoaderModule&&(s=s.concat(a.clientLoaderModule)),n&&a.hydrateFallbackModule&&(s=s.concat(a.hydrateFallbackModule)),a.imports&&(s=s.concat(a.imports)),s}).flat(1))}function Ga(e){return[...new Set(e)]}function Ya(e){let r={},n=Object.keys(e).sort();for(let o of n)r[o]=e[o];return r}function Ja(e,r){let n=new Set;return new Set(r),e.reduce((o,a)=>{let s=JSON.stringify(Ya(a));return n.has(s)||(n.add(s),o.push({key:s,link:a})),o},[])}function Zr(){let e=p.useContext(Qe);return Mn(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function Xa(){let e=p.useContext(Wt);return Mn(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var _n=p.createContext(void 0);_n.displayName="FrameworkContext";function eo(){let e=p.useContext(_n);return Mn(e,"You must render this element inside a <HydratedRouter> element"),e}function Qa(e,r){let n=p.useContext(_n),[o,a]=p.useState(!1),[s,i]=p.useState(!1),{onFocus:l,onBlur:c,onMouseEnter:d,onMouseLeave:u,onTouchStart:m}=r,b=p.useRef(null);p.useEffect(()=>{if(e==="render"&&i(!0),e==="viewport"){let g=y=>{y.forEach(B=>{i(B.isIntersecting)})},h=new IntersectionObserver(g,{threshold:.5});return b.current&&h.observe(b.current),()=>{h.disconnect()}}},[e]),p.useEffect(()=>{if(o){let g=setTimeout(()=>{i(!0)},100);return()=>{clearTimeout(g)}}},[o]);let w=()=>{a(!0)},S=()=>{a(!1),i(!1)};return n?e!=="intent"?[s,b,{}]:[s,b,{onFocus:tt(l,w),onBlur:tt(c,S),onMouseEnter:tt(d,w),onMouseLeave:tt(u,S),onTouchStart:tt(m,w)}]:[!1,b,{}]}function tt(e,r){return n=>{e&&e(n),n.defaultPrevented||r(n)}}function Za({page:e,...r}){let{router:n}=Zr(),o=p.useMemo(()=>Or(n.routes,e,n.basename),[n.routes,e,n.basename]);return o?p.createElement(ts,{page:e,matches:o,...r}):null}function es(e){let{manifest:r,routeModules:n}=eo(),[o,a]=p.useState([]);return p.useEffect(()=>{let s=!1;return Ha(e,r,n).then(i=>{s||a(i)}),()=>{s=!0}},[e,r,n]),o}function ts({page:e,matches:r,...n}){let o=De(),{future:a,manifest:s,routeModules:i}=eo(),{basename:l}=Zr(),{loaderData:c,matches:d}=Xa(),u=p.useMemo(()=>Zn(e,r,d,s,o,"data"),[e,r,d,s,o]),m=p.useMemo(()=>Zn(e,r,d,s,o,"assets"),[e,r,d,s,o]),b=p.useMemo(()=>{if(e===o.pathname+o.search+o.hash)return[];let g=new Set,h=!1;if(r.forEach(B=>{var D;let O=s.routes[B.route.id];!O||!O.hasLoader||(!u.some(R=>R.route.id===B.route.id)&&B.route.id in c&&((D=i[B.route.id])!=null&&D.shouldRevalidate)||O.hasClientLoader?h=!0:g.add(B.route.id))}),g.size===0)return[];let y=$a(e,l,a.unstable_trailingSlashAwareDataRequests,"data");return h&&g.size>0&&y.searchParams.set("_routes",r.filter(B=>g.has(B.route.id)).map(B=>B.route.id).join(",")),[y.pathname+y.search]},[l,a.unstable_trailingSlashAwareDataRequests,c,o,s,u,r,e,i]),w=p.useMemo(()=>Ka(m,s),[m,s]),S=es(m);return p.createElement(p.Fragment,null,b.map(g=>p.createElement("link",{key:g,rel:"prefetch",as:"fetch",href:g,...n})),w.map(g=>p.createElement("link",{key:g,rel:"modulepreload",href:g,...n})),S.map(({key:g,link:h})=>p.createElement("link",{key:g,nonce:n.nonce,...h,crossOrigin:h.crossOrigin??n.crossOrigin})))}function ns(...e){return r=>{e.forEach(n=>{typeof n=="function"?n(r):n!=null&&(n.current=r)})}}var rs=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{rs&&(window.__reactRouterVersion="7.13.2")}catch{}function os({basename:e,children:r,unstable_useTransitions:n,window:o}){let a=p.useRef();a.current==null&&(a.current=Oo({window:o,v5Compat:!0}));let s=a.current,[i,l]=p.useState({action:s.action,location:s.location}),c=p.useCallback(d=>{n===!1?l(d):p.startTransition(()=>l(d))},[n]);return p.useLayoutEffect(()=>s.listen(c),[s,c]),p.createElement(Qr,{basename:e,children:r,location:i.location,navigationType:i.action,navigator:s,unstable_useTransitions:n})}function as({basename:e,children:r,unstable_useTransitions:n,window:o}){let a=p.useRef();a.current==null&&(a.current=zo({window:o,v5Compat:!0}));let s=a.current,[i,l]=p.useState({action:s.action,location:s.location}),c=p.useCallback(d=>{n===!1?l(d):p.startTransition(()=>l(d))},[n]);return p.useLayoutEffect(()=>s.listen(c),[s,c]),p.createElement(Qr,{basename:e,children:r,location:i.location,navigationType:i.action,navigator:s,unstable_useTransitions:n})}var to=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,no=p.forwardRef(function({onClick:r,discover:n="render",prefetch:o="none",relative:a,reloadDocument:s,replace:i,unstable_mask:l,state:c,target:d,to:u,preventScrollReset:m,viewTransition:b,unstable_defaultShouldRevalidate:w,...S},g){let{basename:h,navigator:y,unstable_useTransitions:B}=p.useContext(ye),O=typeof u=="string"&&to.test(u),D=$r(u,h);u=D.to;let R=xa(u,{relative:a}),A=De(),v=null;if(l){let z=An(l,[],A.unstable_mask?A.unstable_mask.pathname:"/",!0);h!=="/"&&(z.pathname=z.pathname==="/"?h:Ce([h,z.pathname])),v=y.createHref(z)}let[k,j,P]=Qa(o,S),N=ds(u,{replace:i,unstable_mask:l,state:c,target:d,preventScrollReset:m,relative:a,viewTransition:b,unstable_defaultShouldRevalidate:w,unstable_useTransitions:B});function M(z){r&&r(z),z.defaultPrevented||N(z)}let L=!(D.isExternal||s),C=p.createElement("a",{...S,...P,href:(L?v:void 0)||D.absoluteURL||R,onClick:L?M:r,ref:ns(g,j),target:d,"data-discover":!O&&n==="render"?"true":void 0});return k&&!O?p.createElement(p.Fragment,null,C,p.createElement(Za,{page:R})):C});no.displayName="Link";var ss=p.forwardRef(function({"aria-current":r="page",caseSensitive:n=!1,className:o="",end:a=!1,style:s,to:i,viewTransition:l,children:c,...d},u){let m=bt(i,{relative:d.relative}),b=De(),w=p.useContext(Wt),{navigator:S,basename:g}=p.useContext(ye),h=w!=null&&fs(m)&&l===!0,y=S.encodeLocation?S.encodeLocation(m).pathname:m.pathname,B=b.pathname,O=w&&w.navigation&&w.navigation.location?w.navigation.location.pathname:null;n||(B=B.toLowerCase(),O=O?O.toLowerCase():null,y=y.toLowerCase()),O&&g&&(O=Te(O,g)||O);const D=y!=="/"&&y.endsWith("/")?y.length-1:y.length;let R=B===y||!a&&B.startsWith(y)&&B.charAt(D)==="/",A=O!=null&&(O===y||!a&&O.startsWith(y)&&O.charAt(y.length)==="/"),v={isActive:R,isPending:A,isTransitioning:h},k=R?r:void 0,j;typeof o=="function"?j=o(v):j=[o,R?"active":null,A?"pending":null,h?"transitioning":null].filter(Boolean).join(" ");let P=typeof s=="function"?s(v):s;return p.createElement(no,{...d,"aria-current":k,className:j,ref:u,style:P,to:i,viewTransition:l},typeof c=="function"?c(v):c)});ss.displayName="NavLink";var is=p.forwardRef(({discover:e="render",fetcherKey:r,navigate:n,reloadDocument:o,replace:a,state:s,method:i=Mt,action:l,onSubmit:c,relative:d,preventScrollReset:u,viewTransition:m,unstable_defaultShouldRevalidate:b,...w},S)=>{let{unstable_useTransitions:g}=p.useContext(ye),h=ps(),y=ms(l,{relative:d}),B=i.toLowerCase()==="get"?"get":"post",O=typeof l=="string"&&to.test(l),D=R=>{if(c&&c(R),R.defaultPrevented)return;R.preventDefault();let A=R.nativeEvent.submitter,v=(A==null?void 0:A.getAttribute("formmethod"))||i,k=()=>h(A||R.currentTarget,{fetcherKey:r,method:v,navigate:n,replace:a,state:s,relative:d,preventScrollReset:u,viewTransition:m,unstable_defaultShouldRevalidate:b});g&&n!==!1?p.startTransition(()=>k()):k()};return p.createElement("form",{ref:S,method:B,action:y,onSubmit:o?c:D,...w,"data-discover":!O&&e==="render"?"true":void 0})});is.displayName="Form";function ls(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function ro(e){let r=p.useContext(Qe);return oe(r,ls(e)),r}function ds(e,{target:r,replace:n,unstable_mask:o,state:a,preventScrollReset:s,relative:i,viewTransition:l,unstable_defaultShouldRevalidate:c,unstable_useTransitions:d}={}){let u=ke(),m=De(),b=bt(e,{relative:i});return p.useCallback(w=>{if(za(w,r)){w.preventDefault();let S=n!==void 0?n:Ke(m)===Ke(b),g=()=>u(e,{replace:S,unstable_mask:o,state:a,preventScrollReset:s,relative:i,viewTransition:l,unstable_defaultShouldRevalidate:c});d?p.startTransition(()=>g()):g()}},[m,u,b,n,o,a,r,e,s,i,l,c,d])}var cs=0,us=()=>`__${String(++cs)}__`;function ps(){let{router:e}=ro("useSubmit"),{basename:r}=p.useContext(ye),n=Aa(),o=e.fetch,a=e.navigate;return p.useCallback(async(s,i={})=>{let{action:l,method:c,encType:d,formData:u,body:m}=qa(s,r);if(i.navigate===!1){let b=i.fetcherKey||us();await o(b,n,i.action||l,{unstable_defaultShouldRevalidate:i.unstable_defaultShouldRevalidate,preventScrollReset:i.preventScrollReset,formData:u,body:m,formMethod:i.method||c,formEncType:i.encType||d,flushSync:i.flushSync})}else await a(i.action||l,{unstable_defaultShouldRevalidate:i.unstable_defaultShouldRevalidate,preventScrollReset:i.preventScrollReset,formData:u,body:m,formMethod:i.method||c,formEncType:i.encType||d,replace:i.replace,state:i.state,fromRouteId:n,flushSync:i.flushSync,viewTransition:i.viewTransition})},[o,a,r,n])}function ms(e,{relative:r}={}){let{basename:n}=p.useContext(ye),o=p.useContext(je);oe(o,"useFormAction must be used inside a RouteContext");let[a]=o.matches.slice(-1),s={...bt(e||".",{relative:r})},i=De();if(e==null){s.search=i.search;let l=new URLSearchParams(s.search),c=l.getAll("index");if(c.some(u=>u==="")){l.delete("index"),c.filter(m=>m).forEach(m=>l.append("index",m));let u=l.toString();s.search=u?`?${u}`:""}}return(!e||e===".")&&a.route.index&&(s.search=s.search?s.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(s.pathname=s.pathname==="/"?n:Ce([n,s.pathname])),Ke(s)}function fs(e,{relative:r}={}){let n=p.useContext(Wr);oe(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:o}=ro("useViewTransitionState"),a=bt(e,{relative:r});if(!n.isTransitioning)return!1;let s=Te(n.currentLocation.pathname,o)||n.currentLocation.pathname,i=Te(n.nextLocation.pathname,o)||n.nextLocation.pathname;return Lt(a.pathname,i)!=null||Lt(a.pathname,s)!=null}const hs="modulepreload",ys=function(e){return"/"+e},er={},de=function(r,n,o){let a=Promise.resolve();if(n&&n.length>0){let i=function(d){return Promise.all(d.map(u=>Promise.resolve(u).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),c=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));a=i(n.map(d=>{if(d=ys(d),d in er)return;er[d]=!0;const u=d.endsWith(".css"),m=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${m}`))return;const b=document.createElement("link");if(b.rel=u?"stylesheet":hs,u||(b.as="script"),b.crossOrigin="",b.href=d,c&&b.setAttribute("nonce",c),document.head.appendChild(b),u)return new Promise((w,S)=>{b.addEventListener("load",w),b.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${d}`)))})}))}function s(i){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=i,window.dispatchEvent(l),!l.defaultPrevented)throw i}return a.then(i=>{for(const l of i||[])l.status==="rejected"&&s(l.reason);return r().catch(s)})},gs={dependsOn:{}};function xs(e,r){return new Set([e,...(r??gs).dependsOn[e]??[]])}function bs(e,r){const n=r instanceof Set?r:new Set(r);return n.size===0?!1:e.some(o=>n.has(o))}function tr(e){return(e.sourceEnd.type?1:0)+(e.targetEnd.type?1:0)}function vs(e,r){return tr(r)-tr(e)||e.label.localeCompare(r.label)}function oo(e){return new Map(e.map(r=>[r.name,r]))}function Pn(e,r){if(e)return r.relationships.find(n=>n.name===e||n.sysmlName===e)}function Et(e,r,n){var i;if(!r)return!0;if(!e)return!1;if(e===r)return!0;const o=Array.isArray(n)?oo(n):n;let a=e;const s=new Set;for(;a&&!s.has(a);){if(a===r)return!0;s.add(a),a=(i=o.get(a))==null?void 0:i.superType}return!1}function Ge(e,r,n){const o=oo(n.kinds),a=[];for(const s of n.relationships)s.isAbstract||(Et(e.kind,s.sourceEnd.type,o)&&Et(r.kind,s.targetEnd.type,o)&&a.push({definition:s,direction:"outgoing",sourceId:e.id,targetId:r.id}),Et(r.kind,s.sourceEnd.type,o)&&Et(e.kind,s.targetEnd.type,o)&&a.push({definition:s,direction:"incoming",sourceId:r.id,targetId:e.id}));return a.sort((s,i)=>vs(s.definition,i.definition))}const bn={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 vn(e){var o,a;const r=[],n=[...((o=bn[e])==null?void 0:o.superTypes)??[]];for(;n.length>0;){const s=n.shift();r.includes(s)||(r.push(s),n.push(...((a=bn[s])==null?void 0:a.superTypes)??[]))}return r}function ao(e,r){return e===r||vn(e).includes(r)}const so=[{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"}],ws={activityfinalnode:"activityFinal",activityfinalnodeusage:"activityFinal",flowfinalnode:"flowFinal",flowfinalnodeusage:"flowFinal"},ks={fork:"ForkNode",join:"JoinNode",decide:"DecisionNode",merge:"MergeNode"};function Ss(){return[...so].sort((e,r)=>vn(r.metaclass).length-vn(e.metaclass).length)}function Es(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 Cs(e){for(const r of Es(e??""))if(r in bn)return r}function js(e,r){var s;const n=new Map((r??[]).map(i=>[i.name,i])),o=[];let a=e;for(;a&&!o.includes(a);)o.push(a),a=(s=n.get(a))==null?void 0:s.superType;return o}function io(e,r){var i,l;const n=(l=(i=e.attributes)==null?void 0:i.controlKind)==null?void 0:l.toLowerCase(),o=n?ks[n]:void 0,a=[...o?[o]:[],...js(e.kind,r==null?void 0:r.kinds),e.kind,e.construct],s=Ss();for(const c of a){const d=ws[(c??"").replace(/[ _-]/g,"").toLowerCase()];if(d)return d;const u=Cs(c);if(!u)continue;const m=s.find(b=>ao(u,b.metaclass));if(m)return m.role}}function eu(e,r){const n=io(e,r);if(n==="activityFinal"||n==="flowFinal")return!0;const o=so.find(a=>a.role===n);return o!==void 0&&ao(o.metaclass,"ControlNode")}const Ds=["general","interconnection","actionflow","statetransition","sequence","grid","browser","geometry"];new Set(Ds);const Bs={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"}]},Fs={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"}]},As={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"}]},Ns={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"}]},nr=[Bs,Fs,As,Ns];function Ts(e,r){return e.map(n=>{const o=n.trim().toLowerCase();if(r){const i=r.columnMappings.find(l=>l.sourceColumn.toLowerCase()===o);if(i)return{...i,sourceColumn:n}}const a=Rs.find(i=>i.sourceColumn.toLowerCase()===o);if(a)return{...a,sourceColumn:n};const s=Ps(n);return{sourceColumn:n,targetAttribute:s}})}const Rs=[{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 Is(e,r,n,o){const a=[],s=[],i=new Set,l=[];for(const g of r){if(!g.targetAttribute){s.push(g.sourceColumn);continue}i.has(g.targetAttribute)||(i.add(g.targetAttribute),l.push(g))}const c=i.has("id"),d=i.has("name"),u=i.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 m=["id","name","kind","construct","doc"],b=Array.from(i).filter(g=>!m.includes(g)),w=[...m.filter(g=>i.has(g)),...b];for(const g of["id","name","kind"])w.includes(g)||w.unshift(g);const S=[w.map(rr).join(",")];return e.forEach((g,h)=>{const y={};for(const D of l){const R=g[D.sourceColumn]??"";y[D.targetAttribute]=Ms(R,D.transform)}(!y.id||y.id.trim()==="")&&(y.id=`row_${h+1}`),(!y.kind||y.kind.trim()==="")&&o&&(y.kind=o);const B=y.kind;B&&Object.keys(n.kinds).length>0&&!n.kinds[B]&&a.push(`Row ${h+2}: unknown kind '${B}' (not declared by the resolved ontology)`);const O=w.map(D=>rr(y[D]??""));S.push(O.join(","))}),{csv:S.join(`
|
|
13
|
+
Please change the parent <Route path="${y}"> to <Route path="${y==="/"?"*":`${y}/*`}">.`)}let u=Be(),m;if(r){let y=typeof r=="string"?qe(r):r;se(c==="/"||((h=y.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 "${y.pathname}" was given in the \`location\` prop.`),m=y}else m=u;let b=m.pathname||"/",v=b;if(c!=="/"){let y=c.replace(/^\//,"").split("/");v="/"+b.replace(/^\//,"").split("/").slice(y.length).join("/")}let w=$r(e,{pathname:v});Se(d||w!=null,`No routes matched location "${m.pathname}${m.search}${m.hash}" `),Se(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 "${m.pathname}${m.search}${m.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 g=Na(w&&w.map(y=>Object.assign({},y,{params:Object.assign({},i,y.params),pathname:je([c,o.encodeLocation?o.encodeLocation(y.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:y.pathname]),pathnameBase:y.pathnameBase==="/"?c:je([c,o.encodeLocation?o.encodeLocation(y.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:y.pathnameBase])})),a,n);return r&&g?p.createElement(Ze.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...m},navigationType:"POP"}},g):g}function Da(){let e=_a(),r=ma(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},s={padding:"2px 4px",backgroundColor:o},i=null;return console.error("Error handled by React Router default ErrorBoundary:",e),i=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:s},"ErrorBoundary")," or"," ",p.createElement("code",{style:s},"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,i)}var Ba=p.createElement(Da,null),to=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=ka(e.digest);n&&(e=n)}let r=e!==void 0?p.createElement(De.Provider,{value:this.props.routeContext},p.createElement(Tn.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?p.createElement(Fa,{error:e},r):r}};to.contextType=ya;var tn=new WeakMap;function Fa({children:e,error:r}){let{basename:n}=p.useContext(ye);if(typeof r=="object"&&r&&"digest"in r&&typeof r.digest=="string"){let o=wa(r.digest);if(o){let a=tn.get(r);if(a)throw a;let s=Gr(o.location,n);if(Kr&&!tn.get(r))if(s.isExternal||o.reloadDocument)window.location.href=s.absoluteURL||s.to;else{const i=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(s.to,{replace:o.replace}));throw tn.set(r,i),i}return p.createElement("meta",{httpEquiv:"refresh",content:`0;url=${s.absoluteURL||s.to}`})}}return e}function Aa({routeContext:e,match:r,children:n}){let o=p.useContext(Qe);return o&&o.static&&o.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=r.route.id),p.createElement(De.Provider,{value:e},n)}function Na(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,s=o==null?void 0:o.errors;if(s!=null){let u=a.findIndex(m=>m.route.id&&(s==null?void 0:s[m.route.id])!==void 0);se(u>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(s).join(",")}`),a=a.slice(0,Math.min(a.length,u+1))}let i=!1,l=-1;if(n&&o){i=o.renderFallback;for(let u=0;u<a.length;u++){let m=a[u];if((m.route.HydrateFallback||m.route.hydrateFallbackElement)&&(l=u),m.route.id){let{loaderData:b,errors:v}=o,w=m.route.loader&&!b.hasOwnProperty(m.route.id)&&(!v||v[m.route.id]===void 0);if(m.route.lazy||w){n.isStatic&&(i=!0),l>=0?a=a.slice(0,l+1):a=[a[0]];break}}}}let c=n==null?void 0:n.onError,d=o&&c?(u,m)=>{var b,v;c(u,{location:o.location,params:((v=(b=o.matches)==null?void 0:b[0])==null?void 0:v.params)??{},unstable_pattern:fa(o.matches),errorInfo:m})}:void 0;return a.reduceRight((u,m,b)=>{let v,w=!1,g=null,h=null;o&&(v=s&&m.route.id?s[m.route.id]:void 0,g=m.route.errorElement||Ba,i&&(l<0&&b===0?(no("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),w=!0,h=null):l===b&&(w=!0,h=m.route.hydrateFallbackElement||null)));let y=r.concat(a.slice(0,b+1)),B=()=>{let N;return v?N=g:w?N=h:m.route.Component?N=p.createElement(m.route.Component,null):m.route.element?N=m.route.element:N=u,p.createElement(Aa,{match:m,routeContext:{outlet:u,matches:y,isDataRoute:o!=null},children:N})};return o&&(m.route.ErrorBoundary||m.route.errorElement||b===0)?p.createElement(to,{location:o.location,revalidation:o.revalidation,component:g,error:v,children:B(),routeContext:{outlet:null,matches:y,isDataRoute:!0},onError:d}):B()},null)}function In(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Ta(e){let r=p.useContext(Qe);return se(r,In(e)),r}function Ra(e){let r=p.useContext(Gt);return se(r,In(e)),r}function Ia(e){let r=p.useContext(De);return se(r,In(e)),r}function Mn(e){let r=Ia(e),n=r.matches[r.matches.length-1];return se(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function Ma(){return Mn("useRouteId")}function _a(){var o;let e=p.useContext(Tn),r=Ra("useRouteError"),n=Mn("useRouteError");return e!==void 0?e:(o=r.errors)==null?void 0:o[n]}function Pa(){let{router:e}=Ta("useNavigate"),r=Mn("useNavigate"),n=p.useRef(!1);return Zr(()=>{n.current=!0}),p.useCallback(async(a,s={})=>{Se(n.current,Qr),n.current&&(typeof a=="number"?await e.navigate(a):await e.navigate(a,{fromRouteId:r,...s}))},[e,r])}var tr={};function no(e,r,n){!r&&!tr[e]&&(tr[e]=!0,Se(!1,n))}p.memo(Oa);function Oa({routes:e,future:r,state:n,isStatic:o,onError:a}){return eo(e,void 0,{state:n,isStatic:o,onError:a})}function be(e){se(!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 ro({basename:e="/",children:r=null,location:n,navigationType:o="POP",navigator:a,static:s=!1,unstable_useTransitions:i}){se(!bt(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let l=e.replace(/^\/*/,"/"),c=p.useMemo(()=>({basename:l,navigator:a,static:s,unstable_useTransitions:i,future:{}}),[l,a,s,i]);typeof n=="string"&&(n=qe(n));let{pathname:d="/",search:u="",hash:m="",state:b=null,key:v="default",unstable_mask:w}=n,g=p.useMemo(()=>{let h=Ie(d,l);return h==null?null:{location:{pathname:h,search:u,hash:m,state:b,key:v,unstable_mask:w},navigationType:o}},[l,d,u,m,b,v,o,w]);return Se(g!=null,`<Router basename="${l}"> is not able to match the URL "${d}${u}${m}" because it does not start with the basename, so the <Router> won't render anything.`),g==null?null:p.createElement(ye.Provider,{value:c},p.createElement(Ze.Provider,{children:r,value:g}))}function za({children:e,location:r}){return ja(wn(e),r)}function wn(e,r=[]){let n=[];return p.Children.forEach(e,(o,a)=>{if(!p.isValidElement(o))return;let s=[...r,a];if(o.type===p.Fragment){n.push.apply(n,wn(o.props.children,s));return}se(o.type===be,`[${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>`),se(!o.props.index||!o.props.children,"An index route cannot have child routes.");let i={id:o.props.id||s.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&&(i.children=wn(o.props.children,s)),n.push(i)}),n}var _t="get",Pt="application/x-www-form-urlencoded";function Yt(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function Ua(e){return Yt(e)&&e.tagName.toLowerCase()==="button"}function La(e){return Yt(e)&&e.tagName.toLowerCase()==="form"}function qa(e){return Yt(e)&&e.tagName.toLowerCase()==="input"}function $a(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Va(e,r){return e.button===0&&(!r||r==="_self")&&!$a(e)}var Ct=null;function Wa(){if(Ct===null)try{new FormData(document.createElement("form"),0),Ct=!1}catch{Ct=!0}return Ct}var Ha=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function nn(e){return e!=null&&!Ha.has(e)?(Se(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Pt}"`),null):e}function Ka(e,r){let n,o,a,s,i;if(La(e)){let l=e.getAttribute("action");o=l?Ie(l,r):null,n=e.getAttribute("method")||_t,a=nn(e.getAttribute("enctype"))||Pt,s=new FormData(e)}else if(Ua(e)||qa(e)&&(e.type==="submit"||e.type==="image")){let l=e.form;if(l==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let c=e.getAttribute("formaction")||l.getAttribute("action");if(o=c?Ie(c,r):null,n=e.getAttribute("formmethod")||l.getAttribute("method")||_t,a=nn(e.getAttribute("formenctype"))||nn(l.getAttribute("enctype"))||Pt,s=new FormData(l,e),!Wa()){let{name:d,type:u,value:m}=e;if(u==="image"){let b=d?`${d}.`:"";s.append(`${b}x`,"0"),s.append(`${b}y`,"0")}else d&&s.append(d,m)}}else{if(Yt(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=_t,o=null,a=Pt,i=e}return s&&a==="text/plain"&&(i=s,s=void 0),{action:o,method:n.toLowerCase(),encType:a,formData:s,body:i}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function _n(e,r){if(e===!1||e===null||typeof e>"u")throw new Error(r)}function Ga(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&&Ie(a.pathname,r)==="/"?a.pathname=`${r.replace(/\/$/,"")}/_root.${o}`:a.pathname=`${a.pathname.replace(/\/$/,"")}.${o}`,a}async function Ya(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 Xa(e,r,n){let o=await Promise.all(e.map(async a=>{let s=r.routes[a.route.id];if(s){let i=await Ya(s,n);return i.links?i.links():[]}return[]}));return ts(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 nr(e,r,n,o,a,s){let i=(c,d)=>n[d]?c.route.id!==n[d].route.id:!0,l=(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 s==="assets"?r.filter((c,d)=>i(c,d)||l(c,d)):s==="data"?r.filter((c,d)=>{var m;let u=o.routes[c.route.id];if(!u||!u.hasLoader)return!1;if(i(c,d)||l(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:((m=n[0])==null?void 0:m.params)||{},nextUrl:new URL(e,window.origin),nextParams:c.params,defaultShouldRevalidate:!0});if(typeof b=="boolean")return b}return!0}):[]}function Qa(e,r,{includeHydrateFallback:n}={}){return Za(e.map(o=>{let a=r.routes[o.route.id];if(!a)return[];let s=[a.module];return a.clientActionModule&&(s=s.concat(a.clientActionModule)),a.clientLoaderModule&&(s=s.concat(a.clientLoaderModule)),n&&a.hydrateFallbackModule&&(s=s.concat(a.hydrateFallbackModule)),a.imports&&(s=s.concat(a.imports)),s}).flat(1))}function Za(e){return[...new Set(e)]}function es(e){let r={},n=Object.keys(e).sort();for(let o of n)r[o]=e[o];return r}function ts(e,r){let n=new Set;return new Set(r),e.reduce((o,a)=>{let s=JSON.stringify(es(a));return n.has(s)||(n.add(s),o.push({key:s,link:a})),o},[])}function oo(){let e=p.useContext(Qe);return _n(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function ns(){let e=p.useContext(Gt);return _n(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Pn=p.createContext(void 0);Pn.displayName="FrameworkContext";function ao(){let e=p.useContext(Pn);return _n(e,"You must render this element inside a <HydratedRouter> element"),e}function rs(e,r){let n=p.useContext(Pn),[o,a]=p.useState(!1),[s,i]=p.useState(!1),{onFocus:l,onBlur:c,onMouseEnter:d,onMouseLeave:u,onTouchStart:m}=r,b=p.useRef(null);p.useEffect(()=>{if(e==="render"&&i(!0),e==="viewport"){let g=y=>{y.forEach(B=>{i(B.isIntersecting)})},h=new IntersectionObserver(g,{threshold:.5});return b.current&&h.observe(b.current),()=>{h.disconnect()}}},[e]),p.useEffect(()=>{if(o){let g=setTimeout(()=>{i(!0)},100);return()=>{clearTimeout(g)}}},[o]);let v=()=>{a(!0)},w=()=>{a(!1),i(!1)};return n?e!=="intent"?[s,b,{}]:[s,b,{onFocus:tt(l,v),onBlur:tt(c,w),onMouseEnter:tt(d,v),onMouseLeave:tt(u,w),onTouchStart:tt(m,v)}]:[!1,b,{}]}function tt(e,r){return n=>{e&&e(n),n.defaultPrevented||r(n)}}function os({page:e,...r}){let{router:n}=oo(),o=p.useMemo(()=>$r(n.routes,e,n.basename),[n.routes,e,n.basename]);return o?p.createElement(ss,{page:e,matches:o,...r}):null}function as(e){let{manifest:r,routeModules:n}=ao(),[o,a]=p.useState([]);return p.useEffect(()=>{let s=!1;return Xa(e,r,n).then(i=>{s||a(i)}),()=>{s=!0}},[e,r,n]),o}function ss({page:e,matches:r,...n}){let o=Be(),{future:a,manifest:s,routeModules:i}=ao(),{basename:l}=oo(),{loaderData:c,matches:d}=ns(),u=p.useMemo(()=>nr(e,r,d,s,o,"data"),[e,r,d,s,o]),m=p.useMemo(()=>nr(e,r,d,s,o,"assets"),[e,r,d,s,o]),b=p.useMemo(()=>{if(e===o.pathname+o.search+o.hash)return[];let g=new Set,h=!1;if(r.forEach(B=>{var D;let N=s.routes[B.route.id];!N||!N.hasLoader||(!u.some(A=>A.route.id===B.route.id)&&B.route.id in c&&((D=i[B.route.id])!=null&&D.shouldRevalidate)||N.hasClientLoader?h=!0:g.add(B.route.id))}),g.size===0)return[];let y=Ga(e,l,a.unstable_trailingSlashAwareDataRequests,"data");return h&&g.size>0&&y.searchParams.set("_routes",r.filter(B=>g.has(B.route.id)).map(B=>B.route.id).join(",")),[y.pathname+y.search]},[l,a.unstable_trailingSlashAwareDataRequests,c,o,s,u,r,e,i]),v=p.useMemo(()=>Qa(m,s),[m,s]),w=as(m);return p.createElement(p.Fragment,null,b.map(g=>p.createElement("link",{key:g,rel:"prefetch",as:"fetch",href:g,...n})),v.map(g=>p.createElement("link",{key:g,rel:"modulepreload",href:g,...n})),w.map(({key:g,link:h})=>p.createElement("link",{key:g,nonce:n.nonce,...h,crossOrigin:h.crossOrigin??n.crossOrigin})))}function is(...e){return r=>{e.forEach(n=>{typeof n=="function"?n(r):n!=null&&(n.current=r)})}}var ls=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{ls&&(window.__reactRouterVersion="7.13.2")}catch{}function ds({basename:e,children:r,unstable_useTransitions:n,window:o}){let a=p.useRef();a.current==null&&(a.current=$o({window:o,v5Compat:!0}));let s=a.current,[i,l]=p.useState({action:s.action,location:s.location}),c=p.useCallback(d=>{n===!1?l(d):p.startTransition(()=>l(d))},[n]);return p.useLayoutEffect(()=>s.listen(c),[s,c]),p.createElement(ro,{basename:e,children:r,location:i.location,navigationType:i.action,navigator:s,unstable_useTransitions:n})}function cs({basename:e,children:r,unstable_useTransitions:n,window:o}){let a=p.useRef();a.current==null&&(a.current=Vo({window:o,v5Compat:!0}));let s=a.current,[i,l]=p.useState({action:s.action,location:s.location}),c=p.useCallback(d=>{n===!1?l(d):p.startTransition(()=>l(d))},[n]);return p.useLayoutEffect(()=>s.listen(c),[s,c]),p.createElement(ro,{basename:e,children:r,location:i.location,navigationType:i.action,navigator:s,unstable_useTransitions:n})}var so=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,io=p.forwardRef(function({onClick:r,discover:n="render",prefetch:o="none",relative:a,reloadDocument:s,replace:i,unstable_mask:l,state:c,target:d,to:u,preventScrollReset:m,viewTransition:b,unstable_defaultShouldRevalidate:v,...w},g){let{basename:h,navigator:y,unstable_useTransitions:B}=p.useContext(ye),N=typeof u=="string"&&so.test(u),D=Gr(u,h);u=D.to;let A=Sa(u,{relative:a}),F=Be(),C=null;if(l){let O=Nn(l,[],F.unstable_mask?F.unstable_mask.pathname:"/",!0);h!=="/"&&(O.pathname=O.pathname==="/"?h:je([h,O.pathname])),C=y.createHref(O)}let[k,T,z]=rs(o,w),_=fs(u,{replace:i,unstable_mask:l,state:c,target:d,preventScrollReset:m,relative:a,viewTransition:b,unstable_defaultShouldRevalidate:v,unstable_useTransitions:B});function j(O){r&&r(O),O.defaultPrevented||_(O)}let L=!(D.isExternal||s),E=p.createElement("a",{...w,...z,href:(L?C:void 0)||D.absoluteURL||A,onClick:L?j:r,ref:is(g,T),target:d,"data-discover":!N&&n==="render"?"true":void 0});return k&&!N?p.createElement(p.Fragment,null,E,p.createElement(os,{page:A})):E});io.displayName="Link";var us=p.forwardRef(function({"aria-current":r="page",caseSensitive:n=!1,className:o="",end:a=!1,style:s,to:i,viewTransition:l,children:c,...d},u){let m=vt(i,{relative:d.relative}),b=Be(),v=p.useContext(Gt),{navigator:w,basename:g}=p.useContext(ye),h=v!=null&&bs(m)&&l===!0,y=w.encodeLocation?w.encodeLocation(m).pathname:m.pathname,B=b.pathname,N=v&&v.navigation&&v.navigation.location?v.navigation.location.pathname:null;n||(B=B.toLowerCase(),N=N?N.toLowerCase():null,y=y.toLowerCase()),N&&g&&(N=Ie(N,g)||N);const D=y!=="/"&&y.endsWith("/")?y.length-1:y.length;let A=B===y||!a&&B.startsWith(y)&&B.charAt(D)==="/",F=N!=null&&(N===y||!a&&N.startsWith(y)&&N.charAt(y.length)==="/"),C={isActive:A,isPending:F,isTransitioning:h},k=A?r:void 0,T;typeof o=="function"?T=o(C):T=[o,A?"active":null,F?"pending":null,h?"transitioning":null].filter(Boolean).join(" ");let z=typeof s=="function"?s(C):s;return p.createElement(io,{...d,"aria-current":k,className:T,ref:u,style:z,to:i,viewTransition:l},typeof c=="function"?c(C):c)});us.displayName="NavLink";var ps=p.forwardRef(({discover:e="render",fetcherKey:r,navigate:n,reloadDocument:o,replace:a,state:s,method:i=_t,action:l,onSubmit:c,relative:d,preventScrollReset:u,viewTransition:m,unstable_defaultShouldRevalidate:b,...v},w)=>{let{unstable_useTransitions:g}=p.useContext(ye),h=gs(),y=xs(l,{relative:d}),B=i.toLowerCase()==="get"?"get":"post",N=typeof l=="string"&&so.test(l),D=A=>{if(c&&c(A),A.defaultPrevented)return;A.preventDefault();let F=A.nativeEvent.submitter,C=(F==null?void 0:F.getAttribute("formmethod"))||i,k=()=>h(F||A.currentTarget,{fetcherKey:r,method:C,navigate:n,replace:a,state:s,relative:d,preventScrollReset:u,viewTransition:m,unstable_defaultShouldRevalidate:b});g&&n!==!1?p.startTransition(()=>k()):k()};return p.createElement("form",{ref:w,method:B,action:y,onSubmit:o?c:D,...v,"data-discover":!N&&e==="render"?"true":void 0})});ps.displayName="Form";function ms(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function lo(e){let r=p.useContext(Qe);return se(r,ms(e)),r}function fs(e,{target:r,replace:n,unstable_mask:o,state:a,preventScrollReset:s,relative:i,viewTransition:l,unstable_defaultShouldRevalidate:c,unstable_useTransitions:d}={}){let u=Ce(),m=Be(),b=vt(e,{relative:i});return p.useCallback(v=>{if(Va(v,r)){v.preventDefault();let w=n!==void 0?n:Ge(m)===Ge(b),g=()=>u(e,{replace:w,unstable_mask:o,state:a,preventScrollReset:s,relative:i,viewTransition:l,unstable_defaultShouldRevalidate:c});d?p.startTransition(()=>g()):g()}},[m,u,b,n,o,a,r,e,s,i,l,c,d])}var hs=0,ys=()=>`__${String(++hs)}__`;function gs(){let{router:e}=lo("useSubmit"),{basename:r}=p.useContext(ye),n=Ma(),o=e.fetch,a=e.navigate;return p.useCallback(async(s,i={})=>{let{action:l,method:c,encType:d,formData:u,body:m}=Ka(s,r);if(i.navigate===!1){let b=i.fetcherKey||ys();await o(b,n,i.action||l,{unstable_defaultShouldRevalidate:i.unstable_defaultShouldRevalidate,preventScrollReset:i.preventScrollReset,formData:u,body:m,formMethod:i.method||c,formEncType:i.encType||d,flushSync:i.flushSync})}else await a(i.action||l,{unstable_defaultShouldRevalidate:i.unstable_defaultShouldRevalidate,preventScrollReset:i.preventScrollReset,formData:u,body:m,formMethod:i.method||c,formEncType:i.encType||d,replace:i.replace,state:i.state,fromRouteId:n,flushSync:i.flushSync,viewTransition:i.viewTransition})},[o,a,r,n])}function xs(e,{relative:r}={}){let{basename:n}=p.useContext(ye),o=p.useContext(De);se(o,"useFormAction must be used inside a RouteContext");let[a]=o.matches.slice(-1),s={...vt(e||".",{relative:r})},i=Be();if(e==null){s.search=i.search;let l=new URLSearchParams(s.search),c=l.getAll("index");if(c.some(u=>u==="")){l.delete("index"),c.filter(m=>m).forEach(m=>l.append("index",m));let u=l.toString();s.search=u?`?${u}`:""}}return(!e||e===".")&&a.route.index&&(s.search=s.search?s.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(s.pathname=s.pathname==="/"?n:je([n,s.pathname])),Ge(s)}function bs(e,{relative:r}={}){let n=p.useContext(Jr);se(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:o}=lo("useViewTransitionState"),a=vt(e,{relative:r});if(!n.isTransitioning)return!1;let s=Ie(n.currentLocation.pathname,o)||n.currentLocation.pathname,i=Ie(n.nextLocation.pathname,o)||n.nextLocation.pathname;return $t(a.pathname,i)!=null||$t(a.pathname,s)!=null}const vs="modulepreload",ws=function(e){return"/"+e},rr={},de=function(r,n,o){let a=Promise.resolve();if(n&&n.length>0){let i=function(d){return Promise.all(d.map(u=>Promise.resolve(u).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),c=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));a=i(n.map(d=>{if(d=ws(d),d in rr)return;rr[d]=!0;const u=d.endsWith(".css"),m=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${m}`))return;const b=document.createElement("link");if(b.rel=u?"stylesheet":vs,u||(b.as="script"),b.crossOrigin="",b.href=d,c&&b.setAttribute("nonce",c),document.head.appendChild(b),u)return new Promise((v,w)=>{b.addEventListener("load",v),b.addEventListener("error",()=>w(new Error(`Unable to preload CSS for ${d}`)))})}))}function s(i){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=i,window.dispatchEvent(l),!l.defaultPrevented)throw i}return a.then(i=>{for(const l of i||[])l.status==="rejected"&&s(l.reason);return r().catch(s)})},ks={dependsOn:{}};function Ss(e,r){return new Set([e,...(r??ks).dependsOn[e]??[]])}function Cs(e,r){const n=r instanceof Set?r:new Set(r);return n.size===0?!1:e.some(o=>n.has(o))}function or(e){return(e.sourceEnd.type?1:0)+(e.targetEnd.type?1:0)}function Es(e,r){return or(r)-or(e)||e.label.localeCompare(r.label)}function co(e){return new Map(e.map(r=>[r.name,r]))}function On(e,r){if(e)return r.relationships.find(n=>n.name===e||n.sysmlName===e)}function Et(e,r,n){var i;if(!r)return!0;if(!e)return!1;if(e===r)return!0;const o=Array.isArray(n)?co(n):n;let a=e;const s=new Set;for(;a&&!s.has(a);){if(a===r)return!0;s.add(a),a=(i=o.get(a))==null?void 0:i.superType}return!1}function Ye(e,r,n){const o=co(n.kinds),a=[];for(const s of n.relationships)s.isAbstract||(Et(e.kind,s.sourceEnd.type,o)&&Et(r.kind,s.targetEnd.type,o)&&a.push({definition:s,direction:"outgoing",sourceId:e.id,targetId:r.id}),Et(r.kind,s.sourceEnd.type,o)&&Et(e.kind,s.targetEnd.type,o)&&a.push({definition:s,direction:"incoming",sourceId:r.id,targetId:e.id}));return a.sort((s,i)=>Es(s.definition,i.definition))}const kn={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 Sn(e){var o,a;const r=[],n=[...((o=kn[e])==null?void 0:o.superTypes)??[]];for(;n.length>0;){const s=n.shift();r.includes(s)||(r.push(s),n.push(...((a=kn[s])==null?void 0:a.superTypes)??[]))}return r}function uo(e,r){return e===r||Sn(e).includes(r)}const po=[{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"}],js={activityfinalnode:"activityFinal",activityfinalnodeusage:"activityFinal",flowfinalnode:"flowFinal",flowfinalnodeusage:"flowFinal"},Ds={fork:"ForkNode",join:"JoinNode",decide:"DecisionNode",merge:"MergeNode"};function Bs(){return[...po].sort((e,r)=>Sn(r.metaclass).length-Sn(e.metaclass).length)}function Fs(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 As(e){for(const r of Fs(e??""))if(r in kn)return r}function Ns(e,r){var s;const n=new Map((r??[]).map(i=>[i.name,i])),o=[];let a=e;for(;a&&!o.includes(a);)o.push(a),a=(s=n.get(a))==null?void 0:s.superType;return o}function mo(e,r){var i,l;const n=(l=(i=e.attributes)==null?void 0:i.controlKind)==null?void 0:l.toLowerCase(),o=n?Ds[n]:void 0,a=[...o?[o]:[],...Ns(e.kind,r==null?void 0:r.kinds),e.kind,e.construct],s=Bs();for(const c of a){const d=js[(c??"").replace(/[ _-]/g,"").toLowerCase()];if(d)return d;const u=As(c);if(!u)continue;const m=s.find(b=>uo(u,b.metaclass));if(m)return m.role}}function cu(e,r){const n=mo(e,r);if(n==="activityFinal"||n==="flowFinal")return!0;const o=po.find(a=>a.role===n);return o!==void 0&&uo(o.metaclass,"ControlNode")}const Ts=["general","interconnection","actionflow","statetransition","sequence","grid","browser","geometry"];new Set(Ts);const Rs={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"}]},Is={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"}]},Ms={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"}]},_s={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"}]},ar=[Rs,Is,Ms,_s];function Ps(e,r){return e.map(n=>{const o=n.trim().toLowerCase();if(r){const i=r.columnMappings.find(l=>l.sourceColumn.toLowerCase()===o);if(i)return{...i,sourceColumn:n}}const a=Os.find(i=>i.sourceColumn.toLowerCase()===o);if(a)return{...a,sourceColumn:n};const s=qs(n);return{sourceColumn:n,targetAttribute:s}})}const Os=[{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 zs(e,r,n,o){const a=[],s=[],i=new Set,l=[];for(const g of r){if(!g.targetAttribute){s.push(g.sourceColumn);continue}i.has(g.targetAttribute)||(i.add(g.targetAttribute),l.push(g))}const c=i.has("id"),d=i.has("name"),u=i.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 m=["id","name","kind","construct","doc"],b=Array.from(i).filter(g=>!m.includes(g)),v=[...m.filter(g=>i.has(g)),...b];for(const g of["id","name","kind"])v.includes(g)||v.unshift(g);const w=[v.map(sr).join(",")];return e.forEach((g,h)=>{const y={};for(const D of l){const A=g[D.sourceColumn]??"";y[D.targetAttribute]=Us(A,D.transform)}(!y.id||y.id.trim()==="")&&(y.id=`row_${h+1}`),(!y.kind||y.kind.trim()==="")&&o&&(y.kind=o);const B=y.kind;B&&Object.keys(n.kinds).length>0&&!n.kinds[B]&&a.push(`Row ${h+2}: unknown kind '${B}' (not declared by the resolved ontology)`);const N=v.map(D=>sr(y[D]??""));w.push(N.join(","))}),{csv:w.join(`
|
|
14
14
|
`)+`
|
|
15
|
-
`,skippedColumns:s,warnings:a}}function
|
|
16
|
-
`)?`"${e.replace(/"/g,'""')}"`:e}let V=null,Ct=null,en=0;const Os=1e4;let Fe=!1,Pt=null,Ue=null,ve=null,lt=!1;const Ye=new Map;function zs(e){const r=Ye.get(e.requestId);r&&(clearTimeout(r.timer),Ye.delete(e.requestId),e.success||e.conflict?r.resolve(e):r.reject(new Error(e.error||`Could not ${e.operation} diagram source.`)))}function Us(e){for(const r of Ye.values())clearTimeout(r.timer),r.reject(new Error(e));Ye.clear()}function tn(e){return e?e.snapshot?(Ue=e.workspaceSessionId,ve=e.revision,lt=!1,!0):lt?!1:Ue!==e.workspaceSessionId||ve===null?(lt=!0,sr(),!1):e.revision===ve?!0:e.baseRevision===ve&&e.revision===ve+1?(ve=e.revision,!0):(lt=!0,sr(),!1):!0}const On=new Map,zn=new Map,Un=new Map,Ln=new Map,ft=new Map,qt=new Map,ht=new Map,yt=new Map,$t=new Map;function Be(e,r){const n=r.get(e.requestId);n&&(clearTimeout(n.timer),r.delete(e.requestId),n.resolve(e))}function Ls(e){for(const r of[On,zn,Un,Ln,$t,qt]){for(const n of r.values())clearTimeout(n.timer),n.reject(new Error(e));r.clear()}for(const r of ft.values())clearTimeout(r.timer),r.reject(new Error(e));ft.clear();for(const r of yt.values())clearTimeout(r.timer),r.reject(new Error("The development server disconnected."));yt.clear();for(const r of ht.values())clearTimeout(r.timer),r.reject(new Error(e));ht.clear()}function Kt(e,r,n){if(!V||V.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,s)=>{const i=setTimeout(()=>{n.delete(o),s(new Error("The server did not answer the relationship request."))},15e3);n.set(o,{resolve:a,reject:s,timer:i}),V.send(JSON.stringify({type:e,payload:{...r,requestId:o}}))})}function gt(e){var r,n;return(n=(r=E.getState().model)==null?void 0:r.irIdentities)==null?void 0:n[e]}function Gt(e,r){var o;const n=E.getState().model;if(!(!Ue||ve===null||!n))return{workspaceSessionId:Ue,baseRevision:ve,sourceFile:e,expectedSourceHash:((o=n.sourceHashes)==null?void 0:o[e])??"",targetElementIds:r}}function qs(){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 lo(e){if(window.__MEMO_DATA__)return;Ws();const r=`ws://${window.location.host}`;if(V&&(V.readyState===WebSocket.OPEN||V.readyState===WebSocket.CONNECTING))return;V=new WebSocket(r);const n=E.getState();V.onopen=()=>{n.setConnected(!0),en=0,Pt=null,Fe=!1,Ue=null,ve=null,lt=!1,n.setRestartRequired(null),Ct&&(clearTimeout(Ct),Ct=null)},V.onmessage=o=>{try{const a=JSON.parse(o.data);$s(a)}catch{}},V.onclose=()=>{n.setConnected(!1),Us("The development server disconnected."),Ls("The development server disconnected."),V=null,en++;const o=Math.min(2e3*Math.pow(2,en-1),Os);Ct=setTimeout(()=>lo(),o)},V.onerror=()=>{}}function $s(e){var n;const r=E.getState();switch(e.type){case"app:restart-required":Fe=!0,r.setRestartRequired(e);return;case"app:edit-conflict":r.setEditConflict(e.payload);return;case"model:update":if(Fe||!tn(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(Fe)return;r.applySourceChange(e.payload);break;case"validation:update":if(Fe||!tn(e.revision))return;r.setValidation(e.payload);break;case"completeness:update":if(Fe||!tn(e.revision))return;r.setCompleteness(e.payload);break;case"methodology:update":if(Fe)return;r.setMethodology(e.payload);break;case"rules:update":if(Fe)return;r.setEffectiveRules(e.payload.rules,e.payload.diagnostics);break;case"rule:policy:write:result":Be(e.payload,yt);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":zs(e.payload);break;case"relationship:create:result":Be(e.payload,On);break;case"relationship:delete:result":Be(e.payload,zn);break;case"relationship:update:result":Be(e.payload,Un);break;case"element:delete:result":Be(e.payload,Ln);break;case"element:mutation:result":Be(e.payload,ft);break;case"package:mutation:result":Be(e.payload,qt);break;case"methodology:source:result":Be(e.payload,ht);break;case"screen-capture:upload:result":Be(e.payload,$t);break;case"ontology:packages":{const o=e.payload.ontologyHash;if(o){if(Pt===null)Pt=o;else if(Pt!==o){Fe=!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":or(()=>r.setDhfDocuments(e.payload.docs));break;case"dhf:settings":or(()=>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 wn=!1;const co=600,ut=new Map;let jt=null;function or(e){wn=!0;try{e()}finally{wn=!1}}function Je(e){V&&V.readyState===WebSocket.OPEN&&V.send(JSON.stringify(e))}function Vs(e){const r=ut.get(e.id);r&&clearTimeout(r),ut.set(e.id,setTimeout(()=>{ut.delete(e.id);const n=E.getState().dhfDocuments.find(o=>o.id===e.id);n&&Je({type:"dhf:doc:save",payload:{doc:n}})},co))}let ar=!1;function Ws(){ar||(ar=!0,E.subscribe((e,r)=>{if(!wn){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&&Vs(o),n.delete(o.id);for(const o of n.keys()){const a=ut.get(o);a&&(clearTimeout(a),ut.delete(o)),Je({type:"dhf:doc:delete",payload:{docId:o}})}}e.dhfSettings!==r.dhfSettings&&(jt&&clearTimeout(jt),jt=setTimeout(()=>{jt=null,Je({type:"dhf:settings:save",payload:{settings:E.getState().dhfSettings}})},co))}}))}function Hs(e){Je({type:"dhf:templates:list",payload:{requestId:e}})}function Ks(e,r){Je({type:"dhf:template:read",payload:{requestId:e,path:r}})}function Gs(e,r,n){Je({type:"dhf:template:save",payload:{requestId:e,title:r,content:n}})}function sr(){V&&V.readyState===WebSocket.OPEN&&V.send(JSON.stringify({type:"request:refresh"}))}function Dt(e){return uo("element:update",e)}function nn(e){return uo("element:create",e)}function uo(e,r){var l;if(!V||V.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",s=((l=o==null?void 0:o.sourceHashes)==null?void 0:l[a])??"",i=Ue&&ve!==null?{workspaceSessionId:Ue,baseRevision:ve,sourceFile:a,expectedSourceHash:s,targetElementIds:[r.id]}:void 0;return new Promise((c,d)=>{const u=setTimeout(()=>{ft.delete(n),d(new Error("The server did not answer the element mutation."))},15e3);ft.set(n,{resolve:c,reject:d,timer:u}),V.send(JSON.stringify({type:e,payload:{...r,file:a,requestId:n,precondition:i,...e==="element:update"?{irIdentity:gt(r.id)}:{}}}))})}function nt(e,r){if(!V||V.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)}`;return new Promise((o,a)=>{const s=setTimeout(()=>{qt.delete(n),a(new Error("The server did not answer the containment change."))},15e3);qt.set(n,{resolve:o,reject:a,timer:s}),V.send(JSON.stringify({type:e,payload:{...r,requestId:n}}))})}function Ys(e){const r=e.owningFile??"model/catalog/relationships.sysml";return Kt("relationship:create",{...e,owningFile:r,sourceIdentity:gt(e.sourceId),targetIdentity:gt(e.targetId),precondition:Gt(r,[e.sourceId,e.targetId])},On)}function Js(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 Kt("relationship:delete",{...e,precondition:n?Gt(n,[r==null?void 0:r.sourceId,r==null?void 0:r.targetId].filter(Boolean)):void 0},zn)}function tu(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;return Kt("relationship:update",{...e,sourceIdentity:gt(e.sourceId),targetIdentity:gt(e.targetId),precondition:n?Gt(n,[e.sourceId,e.targetId]):void 0},Un)}function Xs(e){var n;const r=(n=E.getState().model)==null?void 0:n.elements[e];return Kt("element:delete",{elementId:e,precondition:r!=null&&r.file?Gt(r.file,[e]):void 0},Ln)}function nu(e){if(!V||V.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(()=>{$t.delete(r),o(new Error("The server did not answer the screen-capture upload request."))},3e4);$t.set(r,{resolve:n,reject:o,timer:a}),V.send(JSON.stringify({type:"screen-capture:upload",payload:{...e,requestId:r}}))})}function Qs(e){V&&V.readyState===WebSocket.OPEN&&V.send(JSON.stringify({type:"diagram:create",payload:e}))}function ir(e){V&&V.readyState===WebSocket.OPEN&&V.send(JSON.stringify({type:"diagram:update",payload:e}))}function Zs(e){if(V&&V.readyState===WebSocket.OPEN){const r={id:e};V.send(JSON.stringify({type:"diagram:delete",payload:r}))}}function ru(e,r){if(V&&V.readyState===WebSocket.OPEN){const n={diagramId:e,text:r};V.send(JSON.stringify({type:"diagram:parse",payload:n}))}}function po(e,r,n){if(!V||V.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,s)=>{const i=setTimeout(()=>{Ye.delete(o),s(new Error(`Timed out while trying to ${e} the SysML source.`))},1e4);Ye.set(o,{resolve:a,reject:s,timer:i}),V.send(JSON.stringify({type:e==="load"?"diagram:source:request":"diagram:source:save",payload:{requestId:o,diagramId:r,...e==="save"?n:{}}}))})}function ou(e){return po("load",e)}function au(e,r,n){return po("save",e,{text:r,baseRevision:n})}function kn(e,r,n){if(!V||V.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,s)=>{const i=setTimeout(()=>{ht.delete(o),s(new Error(`Timed out while trying to ${e} methodology source.`))},15e3);ht.set(o,{resolve:a,reject:s,timer:i}),V.send(JSON.stringify({type:`methodology:source:${e==="load"?"request":"save"}`,payload:{requestId:o,sourceFile:r,...n}}))})}function ei(e){V&&V.readyState===WebSocket.OPEN&&V.send(JSON.stringify({type:"element:remap-kinds",payload:{mappings:e}}))}function rn(e){V&&V.readyState===WebSocket.OPEN&&V.send(JSON.stringify({type:"ontology:save-selection",payload:{selected:e}}))}function su(e){V&&V.readyState===WebSocket.OPEN&&V.send(JSON.stringify({type:"ontology:install",payload:{source:e}}))}function ti(e){V&&V.readyState===WebSocket.OPEN&&V.send(JSON.stringify({type:"open-file",payload:{path:e}}))}function iu(e){V&&V.readyState===WebSocket.OPEN&&V.send(JSON.stringify({type:"ontology:remove",payload:{packageName:e}}))}function lu(e,r){V&&V.readyState===WebSocket.OPEN&&V.send(JSON.stringify({type:"diagram:layout:update",payload:{diagramId:e,layout:r}}))}function ni(e){V&&V.readyState===WebSocket.OPEN&&V.send(JSON.stringify({type:"csv:import",payload:e}))}function du(e,r,n,o){V&&V.readyState===WebSocket.OPEN&&V.send(JSON.stringify({type:"llm:chat",payload:{requestId:e,question:r,history:n,allowEdits:o}}))}function cu(e,r){V&&V.readyState===WebSocket.OPEN&&V.send(JSON.stringify({type:"llm:chat:apply",payload:{requestId:e,changes:r}}))}function uu(e,r){V&&V.readyState===WebSocket.OPEN&&V.send(JSON.stringify({type:"llm:settings:save",payload:{requestId:e,...r}}))}function pu(e,r){V&&V.readyState===WebSocket.OPEN&&V.send(JSON.stringify({type:"llm:generate",payload:{requestId:e,description:r}}))}function mu(e,r,n){V&&V.readyState===WebSocket.OPEN&&V.send(JSON.stringify({type:"llm:draft",payload:{requestId:e,documentTypeId:r,targetSections:n}}))}function ri(e){if(!V||V.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(()=>{yt.delete(r),o(new Error("Timed out while writing the rule policy."))},15e3);yt.set(r,{resolve:n,reject:o,timer:a}),V.send(JSON.stringify({type:"rule:policy:write",payload:{requestId:r,...e}}))})}const lr="memo:userViewpoints",Sn="memo:activeView";function oi(){try{const e=JSON.parse(sessionStorage.getItem(Sn)??"null");if((e==null?void 0:e.type)==="diagram"&&typeof e.diagramId=="string")return e}catch{}return{type:"welcome"}}function dr(e){try{e.type==="diagram"?sessionStorage.setItem(Sn,JSON.stringify(e)):sessionStorage.removeItem(Sn)}catch{}}function ai(){try{const e=localStorage.getItem(lr);if(e){const r=JSON.parse(e);return localStorage.removeItem(lr),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 Bt=oi(),E=_r((e,r)=>({model:null,validation:null,completeness:null,connected:!1,restartRequired:null,sourceCoherence:null,editConflict:null,methodology:null,effectiveRules:[],ruleDiagnostics:[],lastSourceChange:null,activeMode:Bt.type==="diagram"?"diagram":"catalog",activeView:Bt,explorerTab:"model",selectedElementId:null,selectedRelationshipId:null,selectedElementIds:new Set,recentlyVisited:[],selectedViewpointId:null,selectedDiagramId:Bt.type==="diagram"?Bt.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:ai(),selectionStyle:null,setSelectionStyle:n=>e({selectionStyle:n}),diagramLayouts:{},mergeDiagramLayouts:n=>e(o=>({diagramLayouts:{...o.diagramLayouts,...n}})),setNodeLayout:(n,o,a)=>e(s=>{const i=s.diagramLayouts[n]??{nodes:{},edges:{}};return{diagramLayouts:{...s.diagramLayouts,[n]:{...i,nodes:{...i.nodes,[o]:{...i.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(s=>{const i=new Map(s.llmPending);return i.set(n,{resolve:o,reject:a}),{llmPending:i}}),resolveLlmRequest:(n,o)=>e(a=>{const s=a.llmPending.get(n);if(s){s.resolve(o);const i=new Map(a.llmPending);return i.delete(n),{llmPending:i}}return{}}),rejectLlmRequest:(n,o)=>e(a=>{const s=a.llmPending.get(n);if(s){s.reject(new Error(o));const i=new Map(a.llmPending);return i.delete(n),{llmPending:i}}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=ii(r().model,n.type);e(i=>({pendingRelationships:[...i.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 s=(i,l)=>(e(c=>({pendingRelationships:c.pendingRelationships.map(d=>d.pendingId===o?{...d,status:"failed",error:i}:d)})),{success:!1,error:i,diagnostics:l});try{const i=await Ys(n);return i.success?(e(l=>({pendingRelationships:l.pendingRelationships.filter(c=>c.pendingId!==o)})),{success:!0,relationshipId:i.relationshipId,sourceFile:i.sourceFile,diagnostics:i.diagnostics}):s(i.error??"The relationship could not be created.",i.diagnostics)}catch(i){return s(i instanceof Error?i.message:String(i))}},deleteRelationship:async n=>{try{const o=await Js({relationshipId:n});return o.success?(e(a=>a.model?{model:{...a.model,relationships:a.model.relationships.filter(s=>s.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 Xs(n);return o.success?(e(a=>{if(!a.model)return{};const s={...a.model.elements};return delete s[n],{model:{...a.model,elements:s,relationships:a.model.relationships.filter(i=>i.sourceId!==n&&i.targetId!==n),diagrams:(a.model.diagrams??[]).map(i=>{var l;return{...i,elementIds:(l=i.elementIds)==null?void 0:l.filter(c=>c!==n)}})},selectedElementId:a.selectedElementId===n?null:a.selectedElementId,selectedElementIds:new Set([...a.selectedElementIds].filter(i=>i!==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 l,c,d,u;let a=o.activeView,s=o.selectedDiagramId,i=o.selectedViewpointId;if(a.type==="diagram"){const m=a.diagramId,b=(l=n.diagrams)==null?void 0:l.find(g=>g.id===m),w=(d=(c=o.model)==null?void 0:c.diagrams)==null?void 0:d.find(g=>g.id===m),S=b??(w!=null&&w.sourceFile?(u=n.diagrams)==null?void 0:u.find(g=>g.sourceFile===w.sourceFile):void 0);S&&(S.id!==m&&(a={type:"diagram",diagramId:S.id},dr(a)),s=S.id,i=S.viewpointId==="__model"?null:S.viewpointId)}else(a.type==="welcome"||a.type==="dashboard")&&Object.keys(n.elements).length>0&&(a={type:"dashboard"});return{model:n,activeView:a,selectedDiagramId:s,selectedViewpointId:i}}),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=>{dr(n),e({activeView:n})},setExplorerTab:n=>e({explorerTab:n}),selectElement:n=>{e(n?o=>{const a=[n,...o.recentlyVisited.filter(s=>s!==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 s=a.elements[n];if(!s)return;const i={...s,kind:o};e(l=>({model:l.model?{...l.model,elements:{...l.model.elements,[n]:i}}:null})),Dt(i)},bulkUpdateAttributes:(n,o)=>{const{model:a}=r();if(!a)return;const s={...a.elements};for(const i of n){const l=s[i];if(!l)continue;const c={...l,attributes:{...l.attributes,...o}};s[i]=c,Dt(c)}e(i=>({model:i.model?{...i.model,elements:s}:null}))},selectViewpoint:n=>e({selectedViewpointId:n,selectedDiagramId:null}),selectDiagram:n=>{var s;if(!n){e({selectedDiagramId:null});return}const{model:o}=r(),a=(s=o==null?void 0:o.diagrams)==null?void 0:s.find(i=>i.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(l=>l.selected).map(l=>l.name));const s=["@memoarchitect/ontology"];for(const l of n)s.includes(l.name)&&a.add(l.name);a.size===0&&n.length>0&&(a=new Set(n.map(l=>l.name)));const i=o.focusedOntologyId??(a.size>0?[...a][0]:null);return{availableOntologies:n,selectedOntologies:a,focusedOntologyId:i}}),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 s=o.filter(c=>!a.has(c.name)),i=new Set;for(const c of s)for(const d of c.layers)for(const u of d.kinds)i.add(u.name);const l=[];if(i.size>0){for(const c of Object.values(n.elements))if(i.has(c.kind)){const d=s.find(u=>u.layers.some(m=>m.kinds.some(b=>b.name===c.kind)));l.push({elementId:c.id,elementName:c.name,kind:c.kind,fromOntology:(d==null?void 0:d.name)??"unknown"})}}return{success:!0,orphanedElements:l}},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(s=>s!==n):[...o.tagFilters,n]})),clearTagFilters:()=>e({tagFilters:[]}),setEditingElement:n=>e({editingElementId:n}),updateElementField:(n,o,a)=>e(s=>{const i=new Map(s.pendingEdits),l=i.get(n)||{};return i.set(n,{...l,[o]:a}),{pendingEdits:i}}),updateElementAttribute:(n,o,a)=>e(s=>{const i=new Map(s.pendingEdits),l=i.get(n)||{},c={...l.attributes||{},[o]:a};return i.set(n,{...l,attributes:c}),{pendingEdits:i}}),moveElementToPackage:(n,o)=>nt("element:move-package",{elementId:n,targetPackage:o}),createPackage:(n,o)=>nt("package:create",{name:n,...o?{parent:o}:{}}),renamePackage:(n,o)=>nt("package:rename",{qualifiedName:n,name:o}),movePackage:(n,o)=>nt("package:move",{qualifiedName:n,targetParent:o}),deletePackage:n=>nt("package:delete",{qualifiedName:n}),addElement:(n,o,a)=>{const s=r();if(!s.model)return;const i=`${n.toLowerCase().replace(/\s+/g,"_")}_${Math.random().toString(36).substr(2,5)}`,l=Object.values(s.model.elements).find(u=>u.kind===n),c=a?Object.values(s.model.elements).find(u=>u.package===a):void 0,d={id:i,name:o,kind:n,construct:(l==null?void 0:l.construct)||"part",layer:(l==null?void 0:l.layer)||"Other",doc:"",attributes:{},...a?{package:a}:{},file:(c==null?void 0:c.file)||(l==null?void 0:l.file)||"model/generated.sysml"};e(u=>({model:u.model?{...u.model,elements:{...u.model.elements,[i]:d}}:null,selectedElementId:i,activeView:{type:"element-detail",elementId:i}})),nn(d)},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(s=>({model:s.model?{...s.model,elements:{...s.model.elements,[o]:a}}:null,selectedElementId:o})),nn(a),o},persistElementAttributes:(n,o)=>{var i;const a=(i=r().model)==null?void 0:i.elements[n];if(!a)return;const s={...a,attributes:{...a.attributes,...o}};e(l=>({model:l.model?{...l.model,elements:{...l.model.elements,[n]:s}}:null})),Dt(s)},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:s,viewpointId:i,elementIds:l=[],activate:c=!0})=>{const d=n??`diag_${Math.random().toString(36).substr(2,9)}`,u={id:d,name:o,diagramType:a,viewKind:s,viewpointId:i,auto:!1,elementIds:l};return e(m=>({model:m.model?{...m.model,diagrams:[...m.model.diagrams??[],u]}:null,selectedDiagramId:c?d:m.selectedDiagramId,activeView:c?{type:"diagram",diagramId:d}:m.activeView})),Qs({id:d,name:o,diagramType:a,viewKind:s,viewpointId:i,elementIds:l}),d},addElementToDiagram:(n,o)=>{var l;const{model:a}=r(),s=(l=a==null?void 0:a.diagrams)==null?void 0:l.find(c=>c.id===n);if(!s)return;const i=s.elementIds??[];i.includes(o)||r().updateDiagramElementIds(n,[...i,o])},updateDiagramElementIds:(n,o)=>{const{model:a}=r();if(!(a!=null&&a.diagrams))return;const s=a.diagrams.findIndex(c=>c.id===n);if(s<0)return;const i={...a.diagrams[s],elementIds:o},l=[...a.diagrams];l[s]=i,e(c=>({model:c.model?{...c.model,diagrams:l}:null})),ir({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})),Zs(n)},applyDiagramParseResult:(n,o,a)=>{const{model:s}=r();if(!(s!=null&&s.diagrams))return;const i=s.diagrams.findIndex(l=>l.id===n);if(i>=0){const l={...s.diagrams[i],elementIds:o},c=[...s.diagrams];c[i]=l,e(d=>({model:d.model?{...d.model,diagrams:c}:null,diagramParseErrors:{...d.diagramParseErrors,[n]:a}})),ir({id:n,elementIds:o})}else e(l=>({diagramParseErrors:{...l.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(s=>s.id===n?{...s,...o}:s)})),updateDhfDocumentContent:(n,o)=>e(a=>({dhfDocuments:a.dhfDocuments.map(s=>s.id===n?{...s,content:o}:s)})),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(),s=o.get(n);if(!s||!a)return;const i=a.elements[n];if(!i)return;const l={...i};s.name!==void 0&&(l.name=s.name),s.doc!==void 0&&(l.doc=s.doc),s.attributes&&(l.attributes={...i.attributes,...s.attributes});const c={...a,elements:{...a.elements,[n]:l}};if(e({model:c}),!(n.startsWith("new_")?await nn(l):await Dt(l)).success){e({model:a});return}const u=new Map(r().pendingEdits);u.delete(n),e({pendingEdits:u})}})),si={relationships:[],kinds:[]};function mo(e){return(e==null?void 0:e.registries)??si}function ii(e,r){return Pn(r,mo(e))}function fu(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 li(e,r){return e?e.relationships.filter(n=>n.sourceId===r||n.targetId===r):[]}function Yt(e,r){return!e||!r||!e.diagrams?null:e.diagrams.find(n=>n.id===r)??null}function hu(e,r){const n=Yt(e,r);return n?n.sourceFiles&&n.sourceFiles.length>0?n.sourceFiles:n.sourceFile?[n.sourceFile]:[]:[]}function di(e,r){var o;const n=r?(o=e==null?void 0:e.elements[r])==null?void 0:o.file:void 0;return n?[...xs(n,e==null?void 0:e.sourceGraph)]:[]}function ci(e,r){return e?bs(e.files,r):!1}function En(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 qn={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"},fo={"/dashboard":"dashboard","/scenarios":"scenario-editor"},ui={...Object.fromEntries(Object.entries(qn).map(([e,r])=>[r,e])),...fo};function pi(e){return e.toLowerCase().replace(/\s+/g,"-")}function mi(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 qn[e.type]??null}}function fi(e,r=""){const n=e.length>1?e.replace(/\/+$/,""):e,o=ui[n];if(o)return{type:o};if(n==="/table"){const s=new URLSearchParams(r);return{type:"tabular",viewpointId:s.get("viewpoint")??void 0,diagramId:s.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 hi(e){const r=e.split("/").filter(Boolean);return r[0]==="catalog"&&r.length===3||r[0]==="diagrams"&&r.length===3}function yi(e){const r=e.split("/").filter(Boolean);return r[0]==="catalog"&&r.length<=2||r[0]==="diagrams"&&r.length===1}function gi(){return[...Object.values(qn),...Object.keys(fo)].filter(e=>e!=="/")}const xi=[{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 bi(){return typeof window>"u"?{}:window.__MEMO_FLAGS__??{}}function ue(e){const r=xi.find(n=>n.id===e);return r?r.stage==="stable"?!0:bi().experimental===!0:!1}function Ft(){const e=E(i=>i.model),r=E(i=>i.setActiveView),n=E(i=>i.setActiveMode),o=ke(),a=e==null?void 0:e.metadata;function s(){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:i=>{i.currentTarget.style.background="rgba(45,212,168,0.12)"},onMouseLeave:i=>{i.currentTarget.style.background="none"},children:"☰"}),t.jsx("button",{onClick:s,className:"text-sm font-bold transition-opacity",style:{color:"#2DD4A8",letterSpacing:"0.04em",background:"none",border:"none",cursor:"pointer",padding:0},onMouseEnter:i=>i.currentTarget.style.opacity="0.75",onMouseLeave:i=>i.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:s,title:"Go to home"})]})}const ho="memo-working-sets",yo="memo-quick-slots";function vi(){return`ws-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}function At(e){try{localStorage.setItem(ho,JSON.stringify(e))}catch{}}function wi(){try{const e=localStorage.getItem(ho);return e?JSON.parse(e):[]}catch{return[]}}function cr(){try{const e=localStorage.getItem(yo);return e?JSON.parse(e):[null,null,null,null]}catch{return[null,null,null,null]}}function ur(e){try{localStorage.setItem(yo,JSON.stringify(e))}catch{}}const on=_r((e,r)=>({workingSets:[],activeWorkingSetId:null,quickSlots:cr(),loadFromStorage:()=>{const n=wi(),o=cr();e({workingSets:n,quickSlots:o})},saveWorkingSet:(n,o)=>{const a=vi(),s=Date.now(),i={id:a,name:n,createdAt:s,updatedAt:s,state:o},l=[...r().workingSets,i];return e({workingSets:l,activeWorkingSetId:a}),At(l),a},updateWorkingSet:(n,o)=>{const a=r().workingSets.map(s=>s.id===n?{...s,state:o,updatedAt:Date.now()}:s);e({workingSets:a}),At(a)},renameWorkingSet:(n,o)=>{const a=r().workingSets.map(s=>s.id===n?{...s,name:o,updatedAt:Date.now()}:s);e({workingSets:a}),At(a)},deleteWorkingSet:n=>{const o=r().workingSets.filter(s=>s.id!==n),a=r().activeWorkingSetId===n?null:r().activeWorkingSetId;e({workingSets:o,activeWorkingSetId:a}),At(o)},setActiveWorkingSet:n=>e({activeWorkingSetId:n}),saveQuickSlot:(n,o,a)=>{const s=["Last Session","Slot 1","Slot 2","Slot 3"],i=[...r().quickSlots];for(;i.length<4;)i.push(null);i[n]={name:a??s[n],state:o,savedAt:Date.now()},ur(i),e({quickSlots:i})},clearQuickSlot:n=>{const o=[...r().quickSlots];o[n]=null,ur(o),e({quickSlots:o})}})),T={badge:"12px",xs:"12px",sm:"13px",md:"14px",lg:"15px",explorer:{group:"13px",kind:"12px",item:"13px",element:"13px",count:"12px",search:"13px"}},f={primary:"#082744",secondary:"#324E67",muted:"#5C7188",faint:"#8CA0B1",surface:"#FFFFFF",surfaceAlt:"#EEF4F7",border:"#D8E2E9",borderLight:"#E6EDF2",accent:"#2DD4A8",accentDark:"#0B1E2D"},ki={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)"},yu={md:"10px"},gu={defaultWidth:2,flowWidth:2.5,arrowSize:16,labelBgPadding:[6,4],labelBgRadius:6,labelBgStyle:{fill:"#FFFFFF",fillOpacity:.92,stroke:"#E5E5E0",strokeWidth:.5}};function an(){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 sn(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 Si(){const[e,r]=p.useState(!1),n=p.useRef(null),o=on(l=>l.quickSlots),a=on(l=>l.saveQuickSlot),s=on(l=>l.clearQuickSlot);p.useEffect(()=>{if(!e)return;const l=c=>{n.current&&!n.current.contains(c.target)&&r(!1)};return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[e]),p.useEffect(()=>{const l=()=>{a(0,an(),"Last Session")};return window.addEventListener("beforeunload",l),()=>window.removeEventListener("beforeunload",l)},[a]),p.useEffect(()=>{const l=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,an());else{const u=o[d];u&&sn(u.state)}};return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[o,a]);const i=["Last Session","Slot 1","Slot 2","Slot 3"];return t.jsxs("div",{ref:n,style:{position:"relative"},children:[t.jsxs("button",{onClick:()=>r(l=>!l),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:T.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:T.xs,color:"rgba(255,255,255,0.5)",fontWeight:600},children:"Last Session"}),o[0]?t.jsx("button",{onClick:()=>{sn(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(l=>{const c=o[l];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:["⌃",l]}),t.jsx("div",{className:"flex-1 min-w-0",children:c?t.jsxs(t.Fragment,{children:[t.jsx("div",{style:{fontSize:T.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:T.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:()=>{sn(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(l,an(),i[l]),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 ${l} (⌃⇧${l})`,children:"Save"}),c&&t.jsx("button",{onClick:()=>s(l),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:"✕"})]})]},l)})]})]})}const Ei=[{value:"",label:"— Select phase —"},{value:"concept",label:"Concept"},{value:"design",label:"Design & Development"},{value:"verification",label:"Verification & Validation"},{value:"production",label:"Production"}],ge={width:"100%",padding:"7px 10px",border:"1px solid #D1D5DB",borderRadius:"6px",fontSize:"13px",color:"#1B3A4B",background:"#fff",boxSizing:"border-box",outline:"none",fontFamily:"inherit"},he={fontSize:"11px",fontWeight:600,color:"#6B7280",textTransform:"uppercase",letterSpacing:"0.04em",display:"block",marginBottom:"4px"},ln={fontSize:"12px",fontWeight:700,color:"#1B3A4B",paddingBottom:"6px",borderBottom:"1px solid #E5E7EB",marginBottom:"12px",marginTop:"4px"},Ci={display:"grid",gridTemplateColumns:"1fr 1fr",gap:"12px"};function go({onClose:e}){const r=E(d=>d.dhfSettings),n=E(d=>d.updateDhfSettings),[o,a]=p.useState({...r}),[s,i]=p.useState("identity");function l(d,u){a(m=>({...m,[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:()=>i(d),style:{padding:"10px 14px",border:"none",background:"none",fontSize:"12px",fontWeight:600,cursor:"pointer",color:s===d?"#1B3A4B":"#9CA3AF",borderBottom:`2px solid ${s===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:[s==="identity"&&t.jsxs("div",{children:[t.jsx("p",{style:ln,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:Ci,children:[t.jsxs("div",{children:[t.jsx("label",{style:he,children:"Company / Manufacturer"}),t.jsx("input",{style:ge,value:o.company,onChange:d=>l("company",d.target.value),placeholder:"Acme Medical Devices Inc."})]}),t.jsxs("div",{children:[t.jsx("label",{style:he,children:"Product / Device Name"}),t.jsx("input",{style:ge,value:o.product,onChange:d=>l("product",d.target.value),placeholder:"InfuSafe IV Pump"})]}),t.jsxs("div",{children:[t.jsx("label",{style:he,children:"Device Type"}),t.jsx("input",{style:ge,value:o.deviceType,onChange:d=>l("deviceType",d.target.value),placeholder:"Class II active implantable"})]}),t.jsxs("div",{children:[t.jsx("label",{style:he,children:"Document Version"}),t.jsx("input",{style:ge,value:o.version,onChange:d=>l("version",d.target.value),placeholder:"1.0.0"})]}),t.jsxs("div",{style:{gridColumn:"1 / -1"},children:[t.jsx("label",{style:he,children:"Development Phase"}),t.jsx("select",{style:ge,value:o.phase,onChange:d=>l("phase",d.target.value),children:Ei.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:he,children:"Document ID Prefix"}),t.jsx("input",{style:{...ge,fontFamily:"monospace"},value:o.documentNumberingPrefix,onChange:d=>l("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"]})]})]})]})]}),s==="branding"&&t.jsxs("div",{children:[t.jsx("p",{style:ln,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:he,children:"Full Logo URL"}),t.jsx("input",{style:ge,value:o.logoUrl,onChange:d=>l("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:he,children:"Compact Logo URL"}),t.jsx("input",{style:ge,value:o.compactLogoUrl,onChange:d=>l("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:he,children:"Primary Color"}),t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px"},children:[t.jsx("input",{type:"color",value:o.primaryColor,onChange:d=>l("primaryColor",d.target.value),style:{width:"40px",height:"32px",padding:"2px",border:"1px solid #D1D5DB",borderRadius:"6px",cursor:"pointer"}}),t.jsx("input",{style:{...ge,flex:1,fontFamily:"monospace"},value:o.primaryColor,onChange:d=>l("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."})]})]})]}),s==="layout"&&t.jsxs("div",{children:[t.jsx("p",{style:ln,children:"Document Layout"}),t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"16px"},children:[t.jsxs("div",{children:[t.jsxs("label",{style:{...he,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=>l("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:he,children:"Page Header Template"}),t.jsx("input",{style:{...ge,fontFamily:"monospace",fontSize:"12px"},value:o.headerTemplate,onChange:d=>l("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:he,children:"Page Footer Template"}),t.jsx("input",{style:{...ge,fontFamily:"monospace",fontSize:"12px"},value:o.footerTemplate,onChange:d=>l("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 xu=Object.freeze(Object.defineProperty({__proto__:null,DhfSettingsPanel:go},Symbol.toStringTag,{value:"Module"})),ji="/help/",Di=[{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"}],Bi=new Set(["dsm","traceability","statistics","compliance-wizard","model-diff","review-dashboard","workflow-wizard","ontology","ontology-detail","import"]),pr=[{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 Fi({activeViewType:e}){const r=E(l=>l.setActiveView);E(l=>l.setActiveMode);const[n,o]=p.useState(!1),a=p.useRef(null),i=pr.map(l=>l.id).includes(e);return p.useEffect(()=>{function l(c){a.current&&!a.current.contains(c.target)&&o(!1)}return n&&document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[n]),t.jsxs("div",{ref:a,style:{position:"relative"},children:[t.jsxs("button",{onClick:()=>o(l=>!l),className:"flex items-center gap-1 px-4 py-1.5 text-sm font-medium rounded-md transition-all",style:i||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:pr.filter(l=>(l.id!=="ontology"||ue("ontology"))&&(l.id!=="import"||ue("import"))).map((l,c)=>{const d=e===l.view.type;return t.jsxs("button",{onClick:()=>{r(d?{type:"welcome"}:l.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:l.icon}),l.label]},l.id)})})]})}function Ai(){const e=E(y=>y.activeMode),r=E(y=>y.setActiveMode),n=E(y=>y.activeView),o=E(y=>y.setActiveView),a=E(y=>y.setExplorerTab),s=E(y=>y.sidebarCollapsed),i=E(y=>y.toggleSidebar),l=ke(),[c,d]=p.useState(!1),[u,m]=p.useState(!1),[b,w]=p.useState(!1);p.useEffect(()=>{const y=()=>d(B=>!B);return window.addEventListener("memo:toggle-navigation",y),()=>window.removeEventListener("memo:toggle-navigation",y)},[]);const S=["catalog","diagram","dhf","scenario"],g=Bi.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==="dashboard"?"dashboard":n.type==="diagram"||e==="diagram"?"diagram":e==="catalog"?"catalog":e;function h(y){if(y===g&&S.includes(y)){i();return}switch(S.includes(y)&&s&&i(),r(y),y){case"dashboard":o({type:"dashboard"});break;case"catalog":o({type:"welcome"}),l("/catalog");break;case"diagram":a("views"),o({type:"welcome"}),l("/diagrams");break;case"ui-screens":o({type:"ui-screens"}),l("/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:[Di.filter(y=>!("feature"in y)||ue(y.feature)).map(y=>t.jsxs("button",{onClick:()=>{h(y.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:g===y.id?"rgba(45,212,168,0.15)":"transparent",color:g===y.id?"#2DD4A8":"rgba(255,255,255,0.78)"},children:[t.jsx("span",{style:{width:20,textAlign:"center"},children:y.icon}),y.label]},y.id)),ue("analysis")&&t.jsxs(t.Fragment,{children:[t.jsxs("button",{onClick:()=>m(y=>!y),"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"]}),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("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:"⌁"}),"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(Si,{})]}),ue("model-tools")&&t.jsx("div",{className:"px-2 py-1",children:t.jsx(Fi,{activeViewType:n.type})}),t.jsxs("button",{onClick:()=>w(!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:ji,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(go,{onClose:()=>w(!1)})]}):null}const $n="Global",Ni=["System","SystemOfSystems"];function Ot(e,r,n=Ni){if(n.includes(e))return!0;for(let o=r.get(e);o;o=r.get(o))if(n.includes(o))return!0;return!1}function Ti(e,r,n,o){var l;const a=c=>{var d;return{systemId:c,label:((d=r.get(c))==null?void 0:d.name)||c}};if(Ot(e.kind,o))return a(e.id);const s=new Set([e.id]);for(let c=e.owner;c&&!s.has(c);c=(l=r.get(c))==null?void 0:l.owner){s.add(c);const d=r.get(c);if(d&&Ot(d.kind,o))return a(d.id)}const i=new Set;for(const c of n){const d=c.sourceId===e.id?c.targetId:c.targetId===e.id?c.sourceId:void 0;if(!d)continue;const u=r.get(d);u&&Ot(u.kind,o)&&i.add(u.id)}return i.size===1?a([...i][0]):{label:$n}}function xo(e,r){const n=new Map;for(const o of e){const a=r(o),s=a.systemId??$n;let i=n.get(s);i||(i={label:a.label,systemId:a.systemId,items:[]},n.set(s,i)),i.items.push(o)}return[...n.values()].sort((o,a)=>(o.systemId?0:1)-(a.systemId?0:1)||o.label.localeCompare(a.label))}const mr=(...e)=>r=>e.includes(r.construct),bo=[{id:"usecases",label:"Use cases",matches:mr("use case")},{id:"functions",label:"Functions",matches:mr("action")},{id:"logical",label:"Logical",matches:e=>e.layer==="logical"&&e.construct==="part"},{id:"physical",label:"Physical",matches:e=>e.layer==="realization"&&e.construct==="part"},{id:"software",label:"Software",matches:e=>e.layer==="implementation"&&e.construct==="part"},{id:"operational",label:"Operational",matches:e=>e.layer==="operational"&&e.construct==="part"}];function dn(e){var o,a;const r=new Map,n=[];for(const s of e){const i=(a=(o=s.element)==null?void 0:o.attributes)==null?void 0:a.elementPackage;if(!i){n.push(s);continue}let l=r.get(i);l||(l={id:`pkg:${i}`,name:i,kind:"ElementPackage",isGroup:!0,children:[]},r.set(i,l),n.push(l)),l.children.push(s)}return n}function Ri(e,r=bo,n=""){const o=new Map(e.map(m=>[m.id,m])),a=new Map;for(const m of e)/Definition$|Def$/.test(m.kind)&&a.set(m.name||m.id,m);const s=m=>{if(m.owner&&o.has(m.owner))return m.owner;const b=a.get(m.kind);if(b&&b.id!==m.id&&b.kind!==m.kind)return b.id},i=new Map;for(const m of e){const b=s(m);b&&(i.get(b)??i.set(b,[]).get(b)).push(m)}const l=new Set,c=(m,b)=>{b.add(m.id);const w=(i.get(m.id)??[]).filter(S=>!b.has(S.id)&&!l.has(S.id)).map(S=>c(S,b));return{id:m.id,name:m.name||m.id,kind:m.kind,element:m,children:dn(w)}},d=n.trim().toLowerCase(),u=m=>!d||m.name.toLowerCase().includes(d)||m.kind.toLowerCase().includes(d)||m.children.some(u);return r.map(m=>{const b=y=>{const B=s(y);return B?!!m.systemOf&&!m.matches(o.get(B)):!0},w=e.filter(y=>m.matches(y)).filter(b).filter(y=>!l.has(y.id));for(const y of w)l.add(y.id);const S=new Set,g=w.map(y=>c(y,S)),h=m.systemOf?xo(g,y=>m.systemOf(y.element)).map(y=>({id:`sys:${y.systemId??y.label}`,name:y.label,kind:y.systemId?"System":"Global",isGroup:!0,children:dn(y.items)})).filter(u):dn(g).filter(u);return{id:m.id,label:m.label,nodes:h}}).filter(m=>m.nodes.length>0)}function vo(e){const r=new Map;for(const n of e)for(const o of n.layers)for(const a of o.kinds)a.derivesFrom&&r.set(a.name,a.derivesFrom);return r}function bu(e,r){const n=new Map(e.map(c=>[c.kind,c.elementCount])),o=new Set(n.keys());for(;;){const c=[...o].filter(u=>!fr(u,r,o)),d=new Set;for(const u of c)for(let m=r.get(u);m&&!o.has(m);m=r.get(m))if(c.filter(b=>wo(m,b,r)).length>=2){d.add(m);break}if(d.size===0)break;for(const u of d)o.add(u),n.set(u,0)}const a=new Map;for(const c of o)a.set(c,{kind:c,elementCount:n.get(c)??0,totalCount:0,children:[]});const s=[];for(const c of a.values()){const d=fr(c.kind,r,o);(d?a.get(d).children:s).push(c)}const i=c=>(c.totalCount=c.elementCount+c.children.reduce((d,u)=>d+i(u),0),c.totalCount),l=c=>{c.children.sort(hr),c.children.forEach(l)};return s.forEach(i),s.forEach(l),s.sort(hr),s}function fr(e,r,n){for(let o=r.get(e);o;o=r.get(o))if(n.has(o))return o}function hr(e,r){return r.totalCount-e.totalCount||e.kind.localeCompare(r.kind)}function wo(e,r,n){for(let o=n.get(r);o;o=n.get(o))if(o===e)return!0;return!1}function vu(e,r,n){const o=[e];for(const a of n)a!==e&&wo(e,a,r)&&o.push(a);return o}function Ii(e,r=0){return e.flatMap(n=>[{node:n,depth:r},...Ii(n.children,r+1)])}const ce={operational:"#0F766E",business:"#8E44AD",requirements:"#4A90D9",risk:"#E74C3C",functional:"#E67E22",behavior:"#FF6B6B",logical:"#7B68EE",physical:"#95A5A6",software:"#F39C12",interfaces:"#1ABC9C",verification:"#2ECC71",ui:"#3498DB"},Xe={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"},Oe=["operational","business","requirements","risk","functional","behavior","logical","physical","software","interfaces","verification","ui"],Mi={mitigates:"#E74C3C",causes:"#C0392B",leadsTo:"#E74C3C",identifies:"#D35400",traceTo:"#4A90D9",satisfiedBy:"#2ECC71",verifiedBy:"#27AE60",allocatedTo:"#E67E22",aggregation:"#7B68EE",composedOf:"#8E44AD",decomposedBy:"#D35400",flow:"#3498DB",succession:"#95A5A6"},yr=["#2563EB","#0891B2","#7C3AED","#DB2777","#EA580C","#0D9488","#65A30D","#9333EA","#C2410C","#1D4ED8"];function wu(e){const r=Mi[e];if(r)return r;let n=0;for(let o=0;o<e.length;o++)n=n*31+e.charCodeAt(o)>>>0;return yr[n%yr.length]}const Vn={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"}},qe={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 _i(e){const r=e.diagramType.trim().toLowerCase();return r==="ofd"||r==="ffd"?r:"afd"}const ku=["#FFFFFF","#f8fafc","#f0f9ff","#fdf2f8","#f0fdf4"];function _e({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 Pi(){return t.jsx("div",{style:{height:"1px",background:"#E5E5E0",margin:"3px 0"}})}function Oi({x:e,y:r,target:n,onViewVisual:o,onViewTable:a,onToggleSelection:s,onViewProperties:i,onClose:l}){const c=p.useRef(null);p.useEffect(()=>{if(!c.current)return;const u=c.current,{innerWidth:m,innerHeight:b}=window,w=u.getBoundingClientRect();w.right>m&&(u.style.left=`${e-w.width}px`),w.bottom>b&&(u.style.top=`${r-w.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(_e,{icon:"⬜",label:"View Visual Layout",onClick:()=>{o(n.pkgName),l()}}),t.jsx(_e,{icon:"☰",label:"View as Table",onClick:()=>{a(n.pkgName),l()}}),t.jsx(Pi,{}),t.jsx(_e,{icon:n.isSelected?"☑":"☐",label:n.isSelected?"Deselect for Project":"Select for Project",onClick:()=>s(n.pkgName)})]}):n.type==="layer"?t.jsxs("div",{ref:c,style:d,onMouseDown:u=>u.stopPropagation(),children:[t.jsx(_e,{icon:"⬜",label:"View Visual Layout",onClick:()=>{o(n.pkgName),l()}}),t.jsx(_e,{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(_e,{icon:"🔍",label:"View Properties",onClick:()=>i(n.kindName,n.pkgName)}),t.jsx(_e,{icon:"☰",label:"View as Table",onClick:()=>a(n.pkgName,n.layerId)}),t.jsx(_e,{icon:"⬜",label:"Show in Visual Layout",onClick:()=>{o(n.pkgName),l()}})]})}function zi({kindsToRemap:e,onConfirm:r,onCancel:n}){const o=E(u=>u.availableOntologies),a=E(u=>u.selectedOntologies),s=o.filter(u=>a.has(u.name)).flatMap(u=>u.layers.flatMap(m=>m.kinds.map(b=>b.name))).filter((u,m,b)=>b.indexOf(u)===m).sort(),[i,l]=p.useState(Object.fromEntries(e.map(u=>[u,""])));function c(u,m){l(b=>({...b,[u]:m}))}const d=e.every(u=>i[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:i[u],onChange:m=>c(u,m.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…"}),s.map(m=>t.jsx("option",{value:m,children:m},m))]})]},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(i),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 Ui({orphans:e,onKeep:r,onRemap:n,onCancel:o}){const[a,s]=p.useState(!1),i=new Map;for(const l of e)i.has(l.kind)||i.set(l.kind,[]),i.get(l.kind).push(l);return a?t.jsx(zi,{kindsToRemap:[...i.keys()],onConfirm:n,onCancel:()=>s(!1)}):t.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-50",style:{background:"rgba(0,0,0,0.4)"},onClick:l=>{l.target===l.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:[...i.entries()].map(([l,c])=>t.jsxs("div",{className:"mb-3",children:[t.jsxs("div",{className:"text-xs font-semibold mb-1",style:{color:"#374151"},children:[l,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"]})]})]},l))}),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:()=>s(!0),className:"px-3 py-1.5 text-xs rounded-md font-medium",style:{background:"#1B3A4B",color:"#FFFFFF"},children:"Remap kinds →"})]})]})})}function Li(){const e=E(S=>S.methodology),r=p.useMemo(()=>[...new Set(((e==null?void 0:e.folders)??[]).flatMap(S=>S.sourceFiles))].sort(),[e]),[n,o]=p.useState(""),[a,s]=p.useState(""),[i,l]=p.useState(""),[c,d]=p.useState(!1),[u,m]=p.useState(""),b=async S=>{if(!S)return;const g=await kn("load",S);o(S),s(g.text??""),l(g.revision??""),d(!1),m(g.success?"":g.error??"Could not load source.")},w=async()=>{if(!n||!i)return;const S=await kn("save",n,{text:a,baseRevision:i});S.success?(l(S.revision??i),d(!1),m("Saved. The reusable semantic runtime is restarting.")):m(S.error??"Save rejected; the draft remains in the editor.")};return r.length===0?null:t.jsxs("section",{style:{borderBottom:`1px solid ${f.border}`},children:[t.jsx("div",{className:"px-3 py-2 font-semibold",style:{fontSize:T.xs,color:f.primary},children:"Methodology & Rule Policies"}),t.jsxs("select",{value:n,onChange:S=>void b(S.target.value),className:"mx-3 mb-2",style:{width:"calc(100% - 24px)",fontSize:T.xs},children:[t.jsx("option",{value:"",children:"Select resolved SysML source…"}),r.map(S=>t.jsx("option",{value:S,children:S},S))]}),n&&t.jsxs(t.Fragment,{children:[t.jsx("textarea",{value:a,onChange:S=>{s(S.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 w(),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 qi(){var L;const e=E(C=>C.effectiveRules),r=E(C=>C.ruleDiagnostics),n=E(C=>C.methodology),o=p.useMemo(()=>[...new Set(((n==null?void 0:n.folders)??[]).flatMap(C=>C.sourceFiles))].sort(),[n]),[a,s]=p.useState(""),[i,l]=p.useState("disabled"),[c,d]=p.useState(""),[u,m]=p.useState(""),[b,w]=p.useState(""),[S,g]=p.useState(""),[h,y]=p.useState(""),[B,O]=p.useState(""),[D,R]=p.useState(""),[A,v]=p.useState(!1),k=e.find(C=>C.sourceRuleType===a),j=(k==null?void 0:k.tailoring)==="invariant",P=!a||!B||j&&i!=="enabled"||i!=="enabled"&&!b.trim()||i==="replaced"&&!u.trim(),N=async()=>{v(!0),R("");try{const C=await kn("load",B);if(!C.success||!C.revision){R(C.error??"Could not read the methodology source.");return}const z=await ri({targetRuleType:a,disposition:i,severityOverride:c||void 0,replacementRuleType:i==="replaced"?u.trim():void 0,rationaleText:b.trim(),authority:S.trim()||void 0,approvalReference:h.trim()||void 0,sourceFile:B,baseRevision:C.revision});R(z.success?"Policy written. The reusable semantic runtime is restarting.":z.error??"The policy was rejected; nothing was written."),z.success&&(w(""),y(""))}catch(C){R(C instanceof Error?C.message:String(C))}finally{v(!1)}};if(e.length===0)return null;const M={width:"calc(100% - 24px)",margin:"0 12px 6px",fontSize:T.xs};return t.jsxs("section",{style:{borderBottom:`1px solid ${f.border}`},children:[t.jsxs("div",{className:"px-3 py-2 font-semibold",style:{fontSize:T.xs,color:f.primary},children:["Rule Tailoring",t.jsxs("span",{style:{fontWeight:400,color:f.muted},children:[" — ",e.length," rules in the effective set"]})]}),t.jsxs("select",{"aria-label":"Rule",value:a,style:M,onChange:C=>s(C.target.value),children:[t.jsx("option",{value:"",children:"Select a rule…"}),e.map(C=>t.jsxs("option",{value:C.sourceRuleType,children:[C.sourceRuleId," — ",C.sourceRuleType,C.tailoring==="invariant"?" (invariant)":"",C.disposition!=="enabled"?` [${C.disposition}]`:""]},C.sourceRuleType))]}),k&&t.jsxs("div",{className:"px-3 pb-1",style:{fontSize:11,color:f.muted},children:["Currently ",k.disposition," at ",k.effectiveSeverity,k.effectiveSeverity!==k.declaredSeverity&&` (declared ${k.declaredSeverity})`,((L=k.policyChain)==null?void 0:L.length)>0&&` · ${k.policyChain.length} policy in chain`]}),j&&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:i,style:M,onChange:C=>l(C.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:M,onChange:C=>d(C.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"})]}),i==="replaced"&&t.jsx("input",{"aria-label":"Replacement rule",value:u,style:M,placeholder:"Replacement constraint def name",onChange:C=>m(C.target.value)}),t.jsx("textarea",{"aria-label":"Rationale",value:b,placeholder:"Rationale — required to disable or replace a rule",style:{...M,height:54,fontFamily:"inherit"},onChange:C=>w(C.target.value)}),t.jsx("input",{"aria-label":"Authority",value:S,style:M,placeholder:"Authority (optional)",onChange:C=>g(C.target.value)}),t.jsx("input",{"aria-label":"Approval reference",value:h,style:M,placeholder:"Approval reference (optional)",onChange:C=>y(C.target.value)}),t.jsxs("select",{"aria-label":"Target methodology file",value:B,style:M,onChange:C=>O(C.target.value),children:[t.jsx("option",{value:"",children:"Write the policy into…"}),o.map(C=>t.jsx("option",{value:C,children:C},C))]}),t.jsx("div",{className:"flex gap-2 px-3 py-2",children:t.jsx("button",{disabled:P||A,onClick:()=>void N(),children:A?"Writing…":"Write policy"})}),D&&t.jsx("div",{className:"px-3 pb-2",role:"status",style:{fontSize:11,color:"#B45309"},children:D}),r.length>0&&t.jsx("div",{className:"px-3 pb-2",style:{fontSize:11,color:"#B91C1C"},children:r.map((C,z)=>t.jsxs("div",{children:["[",C.code,"] ",C.message]},z))})]})}const gr={ontology:"📦",profile:"🔧",extension:"🧩"};function $i(e){const r=new Map(e.map(l=>[l.name,l])),n=new Map;function o(l){if(n.has(l))return n.get(l);const c=r.get(l);if(!c||!c.derivesFrom||!r.has(c.derivesFrom))return n.set(l,0),0;const d=o(c.derivesFrom)+1;return n.set(l,d),d}for(const l of e)o(l.name);const a=new Map;for(const l of e){const c=n.get(l.name)??0,d=a.get(c)??[];d.push(l),a.set(c,d)}const s=Math.max(...a.keys()),i=[];for(let l=0;l<=s;l++){const c=a.get(l)??[];i.push(...c.sort((d,u)=>d.name.localeCompare(u.name)))}return i}function Vi(e){const r=new Map(e.map(l=>[l.name,l])),n=new Map;function o(l){if(n.has(l))return n.get(l);const c=r.get(l);if(!c||!c.extends||!r.has(c.extends))return n.set(l,0),0;const d=o(c.extends)+1;return n.set(l,d),d}for(const l of e)o(l.name);const a=new Map;for(const l of e){const c=n.get(l.name)??0,d=a.get(c)??[];d.push(l),a.set(c,d)}const s=a.size>0?Math.max(...a.keys()):0,i=[];for(let l=0;l<=s;l++){const c=a.get(l)??[];i.push(...c.sort((d,u)=>d.name.localeCompare(u.name)))}return i}function Wi({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:T.sm,color:f.primary},children:"Remove ontology?"}),t.jsxs("div",{className:"mb-4",style:{fontSize:T.xs,color:f.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:T.xs,background:f.surfaceAlt,color:f.secondary,border:`1px solid ${f.border}`,cursor:"pointer"},children:"Cancel"}),t.jsx("button",{onClick:n,className:"px-3 py-1.5 rounded-md font-medium",style:{fontSize:T.xs,background:"#DC2626",color:"#FFFFFF",border:"none",cursor:"pointer"},children:"Remove"})]})]})})}function Hi(){const e=E(x=>x.availableOntologies),r=E(x=>x.selectedOntologies),n=E(x=>x.toggleOntologySelection),o=E(x=>x.saveOntologySelection),a=E(x=>x.selectedOntologyKind),s=E(x=>x.setSelectedOntologyKind),i=E(x=>x.setActiveView),l=E(x=>x.setOntologyViewMode),c=E(x=>x.activeView),[d,u]=p.useState(""),[m,b]=p.useState(()=>new Set(e.filter(x=>x.selected).map(x=>x.name))),[w,S]=p.useState(new Set),[g,h]=p.useState(()=>new Set(e.filter(x=>x.selected).map(x=>x.name))),y=p.useMemo(()=>{if(r.size!==g.size)return!0;for(const x of r)if(!g.has(x))return!0;return!1},[r,g]),[B,O]=p.useState(null),[D,R]=p.useState(null),[A,v]=p.useState(null),k=p.useRef(new Map),j=p.useMemo(()=>{const x=d.trim()?e.map(_=>({..._,layers:_.layers.map(q=>({...q,kinds:q.kinds.filter(J=>J.name.toLowerCase().includes(d.toLowerCase())||J.label.toLowerCase().includes(d.toLowerCase())||J.layer.toLowerCase().includes(d.toLowerCase()))})).filter(q=>q.kinds.length>0)})).filter(_=>_.layers.length>0||_.name.toLowerCase().includes(d.toLowerCase())):e;return Vi(x)},[e,d]);p.useEffect(()=>{d.trim()&&(b(new Set(j.map(x=>x.name))),S(new Set(j.flatMap(x=>x.layers.map(_=>`${x.name}:${_.id}`)))))},[d,j]),p.useEffect(()=>{if(a&&k.current.has(a)){for(const x of e)for(const _ of x.layers)if(_.kinds.find(q=>q.name===a)){b(q=>new Set([...q,x.name])),S(q=>new Set([...q,`${x.name}:${_.id}`]));break}setTimeout(()=>{var x;(x=k.current.get(a))==null||x.scrollIntoView({behavior:"smooth",block:"nearest"})},80)}},[a,e]);function P(x){i({type:"ontology-detail",packageName:x})}function N(x,_){i({type:"ontology-detail",packageName:x,layerId:_})}function M(x,_){s(a===x?null:x),i({type:"ontology-detail",packageName:_})}function L(x){b(_=>{const q=new Set(_);return q.has(x)?q.delete(x):q.add(x),q})}function C(x){S(_=>{const q=new Set(_);return q.has(x)?q.delete(x):q.add(x),q})}function z(x,_,q){x.stopPropagation(),q?R(_):n(_)}function $(){const x=o();x.orphanedElements&&x.orphanedElements.length>0?O(x.orphanedElements):(rn([...r]),h(new Set(r)))}function U(){rn([...r]),h(new Set(r)),O(null)}function G(x){ei(x),rn([...r]),h(new Set(r)),O(null)}function H(x,_){x.preventDefault(),x.stopPropagation(),v({x:x.clientX,y:x.clientY,target:_})}function X(x,_){l("table"),i({type:"ontology-detail",packageName:x,layerId:_}),v(null)}function Y(x){l("visual"),i({type:"ontology-detail",packageName:x}),v(null)}function ae(x){r.has(x)?R(x):n(x),v(null)}function se(x,_){s(x),i({type:"ontology-detail",packageName:_}),v(null)}if(p.useEffect(()=>{function x(_){_.key==="Escape"&&(s(null),v(null),R(null))}return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[s]),p.useEffect(()=>{if(!A)return;function x(){v(null)}return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[A]),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:f.faint},children:[t.jsx("div",{className:"text-xl mb-2",children:"◉"}),t.jsx("div",{style:{fontSize:T.xs},children:"No ontology packages"}),t.jsx("div",{style:{fontSize:T.xs,opacity:.7,marginTop:"4px"},children:"Start memo-architect dev to load"})]})});const I=c.type==="ontology-detail"?c.packageName:null;return t.jsxs("div",{className:"flex flex-col flex-1 overflow-hidden",style:{fontSize:T.explorer.item},children:[t.jsx(qi,{}),t.jsx(Li,{}),t.jsx("div",{className:"px-3 py-2 sticky top-0 z-10",style:{background:f.surface,borderBottom:`1px solid ${f.border}`},children:t.jsx("input",{type:"text",placeholder:"Search kinds...",value:d,onChange:x=>u(x.target.value),className:"w-full px-2.5 py-1.5 rounded-lg focus:outline-none",style:{fontSize:T.explorer.search,border:`1px solid ${f.border}`,background:f.surfaceAlt,color:f.primary},onFocus:x=>x.currentTarget.style.borderColor="#2563EB",onBlur:x=>x.currentTarget.style.borderColor=f.border})}),t.jsx("div",{className:"flex-1 overflow-y-auto py-1",children:j.map(x=>{const _=r.has(x.name),q=I===x.name,J=m.has(x.name),ie=x.name.replace(/^@memo(?:architect)?\//,""),ne=gr[x.type]??gr.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:q?`${f.accent}18`:"transparent",borderLeft:q?`3px solid ${f.accentDark}`:"3px solid transparent",opacity:_?1:.55},onMouseEnter:F=>{q||(F.currentTarget.style.background="#F0F0ED")},onMouseLeave:F=>{F.currentTarget.style.background=q?`${f.accent}18`:"transparent"},onClick:F=>{F.stopPropagation(),L(x.name)},onDoubleClick:()=>P(x.name),onContextMenu:F=>H(F,{type:"package",pkgName:x.name,isSelected:_}),children:[t.jsx("input",{type:"checkbox",checked:_,onChange:F=>z(F,x.name,_),onClick:F=>F.stopPropagation(),style:{cursor:"pointer",accentColor:"#2563EB",flexShrink:0},title:_?"Deselect for project":"Select for project"}),t.jsx("span",{style:{color:f.muted,fontSize:"10px"},children:J?"▾":"▸"}),t.jsx("span",{children:ne}),t.jsx("span",{className:"font-semibold truncate flex-1",style:{color:f.primary,fontSize:T.explorer.group},children:ie}),t.jsx("span",{style:{color:f.faint},children:x.kindCount})]}),J&&x.layers.map(F=>{const W=ce[F.id]??F.color??f.muted,K=`${x.name}:${F.id}`,Q=w.has(K),le=$i(F.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:re=>re.currentTarget.style.background="#F0F0ED",onMouseLeave:re=>re.currentTarget.style.background="transparent",onClick:re=>{re.stopPropagation(),C(K)},onDoubleClick:()=>N(x.name,F.id),onContextMenu:re=>H(re,{type:"layer",pkgName:x.name,layerId:F.id,layerLabel:F.label}),children:[t.jsx("span",{style:{color:f.faint,fontSize:"9px"},children:Q?"▾":"▸"}),t.jsx("span",{className:"w-2 h-2 rounded flex-shrink-0",style:{backgroundColor:W}}),t.jsx("span",{className:"flex-1 truncate capitalize",style:{color:f.muted,fontSize:T.explorer.kind},children:F.label}),t.jsx("span",{style:{color:f.faint},children:F.kindCount})]}),Q&&(()=>{const re=new Map;for(const Z of le){const fe=Z.derivesFrom?re.get(Z.derivesFrom)??0:0;re.set(Z.name,Z.derivesFrom?fe+1:0)}const me=Z=>{const fe=a===Z.name,et=re.get(Z.name)??0,Ie=et===0,ee=36+et*12;return t.jsxs("div",{ref:te=>{te&&k.current.set(Z.name,te)},className:"flex items-center gap-1.5 px-3 py-0.5 cursor-pointer",style:{borderRadius:"4px",margin:`0 4px 0 ${ee}px`,background:fe?`${f.accent}18`:"transparent",borderLeft:fe?`2px solid ${W}`:"2px solid transparent",transition:"background 150ms ease"},onMouseEnter:te=>{fe||(te.currentTarget.style.background="#F0F0ED")},onMouseLeave:te=>{te.currentTarget.style.background=fe?`${f.accent}18`:"transparent"},onClick:()=>M(Z.name,x.name),onContextMenu:te=>H(te,{type:"kind",kindName:Z.name,pkgName:x.name,layerId:F.id}),children:[!Ie&&t.jsx("span",{style:{color:f.faint,fontSize:"9px",flexShrink:0},children:"↳"}),t.jsx("span",{className:"truncate",style:{color:fe?f.accentDark:f.primary,fontWeight:Ie?500:400,fontSize:T.explorer.item},children:Z.name}),Z.instanceCount>0&&t.jsxs("span",{style:{color:f.faint,fontSize:"10px"},children:["·",Z.instanceCount]})]},Z.name)},Se=[],Re=new Map;for(const Z of le){const fe=Z.group??"";Re.has(fe)||(Re.set(fe,[]),Se.push(fe)),Re.get(fe).push(Z)}return Se.filter(Z=>Z!=="").length<=1?le.map(me):Se.map(Z=>t.jsxs("div",{children:[Z&&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:f.faint,fontSize:T.explorer.kind,letterSpacing:"0.02em"},children:Z.replace(/_/g," ")}),t.jsx("span",{style:{color:f.faint,fontSize:"10px"},children:Re.get(Z).length})]}),Re.get(Z).map(me)]},`grp:${K}:${Z||"_root"}`))})()]},K)})]},x.name)})}),y&&t.jsx("div",{className:"px-3 py-2 flex-shrink-0",style:{borderTop:`1px solid ${f.border}`,background:f.surfaceAlt},children:t.jsx("button",{onClick:$,className:"w-full py-1.5 rounded-md font-medium",style:{fontSize:T.xs,background:"#2563EB",color:"#FFFFFF",border:"none",cursor:"pointer"},children:"Save Selection"})}),D&&t.jsx(Wi,{pkgName:D,onCancel:()=>R(null),onConfirm:()=>{n(D),R(null)}}),B&&t.jsx(Ui,{orphans:B,onKeep:U,onRemap:G,onCancel:()=>O(null)}),A&&t.jsx(Oi,{x:A.x,y:A.y,target:A.target,onViewVisual:Y,onViewTable:X,onToggleSelection:ae,onViewProperties:se,onClose:()=>v(null)})]})}function Ki(){const e=E(l=>l.model),r=E(l=>l.recentlyVisited),n=E(l=>l.selectElement),o=p.useMemo(()=>e?r.map(l=>e.elements[l]).filter(Boolean):[],[r,e]),a=o,s="Recently visited",i=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 ${f.border}`},children:[t.jsx("div",{style:{fontSize:"10px",fontWeight:700,textTransform:"uppercase",letterSpacing:"0.08em",color:f.muted,marginBottom:"2px"},children:s}),t.jsx("div",{style:{fontSize:"11px",color:f.muted,opacity:.8},children:i})]}),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:f.muted,lineHeight:"1.6"},children:"Nothing visited yet. Use Model Explorer or Viewpoints to begin."}):a.map(l=>{const c=ce[l.layer]||f.muted;return t.jsx("button",{onClick:()=>n(l.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=f.surfaceAlt,onMouseLeave:d=>d.currentTarget.style.background="transparent",children:t.jsxs("div",{style:{flex:1,minWidth:0},children:[t.jsx("div",{style:{fontSize:T.explorer.item,fontWeight:500,color:f.primary,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:l.name}),t.jsxs("div",{style:{fontSize:"10px",color:f.muted,marginTop:"2px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:[t.jsx("span",{style:{color:c,fontWeight:600},children:l.kind}),l.shortId&&t.jsx("span",{style:{marginLeft:"6px",fontFamily:"monospace",opacity:.7},children:l.shortId})]})]})},l.id)})})]})}function Gi({element:e,selected:r=!1,fontSize:n=T.explorer.item,fontWeight:o}){const a=e.shortId??"ID-PENDING";return t.jsxs("span",{className:"truncate flex-1",style:{color:r?f.accentDark:f.primary,fontSize:n,fontWeight:o??(r?500:400)},title:`${a} ${e.name}`,children:[t.jsxs("span",{style:{color:f.muted,fontWeight:500,marginRight:"4px"},children:["[",a,"]"]}),e.name]})}function Cn({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:T.explorer.count,fontWeight:600,minWidth:"20px",textAlign:"center"},title:n,children:e})}const Yi=`---
|
|
15
|
+
`,skippedColumns:s,warnings:a}}function Us(e,r){if(!r)return e;switch(r){case"sanitize-id":return Ls(e);case"upper":return e.toUpperCase();case"lower":return e.toLowerCase();default:return e}}function Ls(e){let r=e.trim().replace(/[\s\-]+/g,"_").replace(/[^a-zA-Z0-9_]/g,"").toLowerCase();return/^\d/.test(r)&&(r="e_"+r),r}function qs(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 sr(e){return e.includes(",")||e.includes('"')||e.includes(`
|
|
16
|
+
`)?`"${e.replace(/"/g,'""')}"`:e}let W=null,jt=null,rn=0;const $s=1e4;let Ae=!1,Ot=null,Ue=null,we=null,lt=!1;const Je=new Map;function Vs(e){const r=Je.get(e.requestId);r&&(clearTimeout(r.timer),Je.delete(e.requestId),e.success||e.conflict?r.resolve(e):r.reject(new Error(e.error||`Could not ${e.operation} diagram source.`)))}function Ws(e){for(const r of Je.values())clearTimeout(r.timer),r.reject(new Error(e));Je.clear()}function on(e){return e?e.snapshot?(Ue=e.workspaceSessionId,we=e.revision,lt=!1,!0):lt?!1:Ue!==e.workspaceSessionId||we===null?(lt=!0,dr(),!1):e.revision===we?!0:e.baseRevision===we&&e.revision===we+1?(we=e.revision,!0):(lt=!0,dr(),!1):!0}const zn=new Map,Un=new Map,Ln=new Map,qn=new Map,ft=new Map,Vt=new Map,ht=new Map,yt=new Map,Wt=new Map;function Fe(e,r){const n=r.get(e.requestId);n&&(clearTimeout(n.timer),r.delete(e.requestId),n.resolve(e))}function Hs(e){for(const r of[zn,Un,Ln,qn,Wt,Vt]){for(const n of r.values())clearTimeout(n.timer),n.reject(new Error(e));r.clear()}for(const r of ft.values())clearTimeout(r.timer),r.reject(new Error(e));ft.clear();for(const r of yt.values())clearTimeout(r.timer),r.reject(new Error("The development server disconnected."));yt.clear();for(const r of ht.values())clearTimeout(r.timer),r.reject(new Error(e));ht.clear()}function Jt(e,r,n){if(!W||W.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,s)=>{const i=setTimeout(()=>{n.delete(o),s(new Error("The server did not answer the relationship request."))},15e3);n.set(o,{resolve:a,reject:s,timer:i}),W.send(JSON.stringify({type:e,payload:{...r,requestId:o}}))})}function gt(e){var r,n;return(n=(r=S.getState().model)==null?void 0:r.irIdentities)==null?void 0:n[e]}function Xt(e,r){var o;const n=S.getState().model;if(!(!Ue||we===null||!n))return{workspaceSessionId:Ue,baseRevision:we,sourceFile:e,expectedSourceHash:((o=n.sourceHashes)==null?void 0:o[e])??"",targetElementIds:r}}function Ks(){const e=window.__MEMO_DATA__;if(!e)return!1;const r=S.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 fo(e){if(window.__MEMO_DATA__)return;Js();const r=`ws://${window.location.host}`;if(W&&(W.readyState===WebSocket.OPEN||W.readyState===WebSocket.CONNECTING))return;W=new WebSocket(r);const n=S.getState();W.onopen=()=>{n.setConnected(!0),rn=0,Ot=null,Ae=!1,Ue=null,we=null,lt=!1,n.setRestartRequired(null),jt&&(clearTimeout(jt),jt=null)},W.onmessage=o=>{try{const a=JSON.parse(o.data);Gs(a)}catch{}},W.onclose=()=>{n.setConnected(!1),Ws("The development server disconnected."),Hs("The development server disconnected."),W=null,rn++;const o=Math.min(2e3*Math.pow(2,rn-1),$s);jt=setTimeout(()=>fo(),o)},W.onerror=()=>{}}function Gs(e){var n;const r=S.getState();switch(e.type){case"app:restart-required":Ae=!0,r.setRestartRequired(e);return;case"app:edit-conflict":r.setEditConflict(e.payload);return;case"model:update":if(Ae||!on(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(Ae)return;r.applySourceChange(e.payload);break;case"validation:update":if(Ae||!on(e.revision))return;r.setValidation(e.payload);break;case"completeness:update":if(Ae||!on(e.revision))return;r.setCompleteness(e.payload);break;case"methodology:update":if(Ae)return;r.setMethodology(e.payload);break;case"rules:update":if(Ae)return;r.setEffectiveRules(e.payload.rules,e.payload.diagnostics);break;case"rule:policy:write:result":Fe(e.payload,yt);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":Vs(e.payload);break;case"relationship:create:result":Fe(e.payload,zn);break;case"relationship:delete:result":Fe(e.payload,Un);break;case"relationship:update:result":Fe(e.payload,Ln);break;case"element:delete:result":Fe(e.payload,qn);break;case"element:mutation:result":Fe(e.payload,ft);break;case"package:mutation:result":Fe(e.payload,Vt);break;case"methodology:source:result":Fe(e.payload,ht);break;case"screen-capture:upload:result":Fe(e.payload,Wt);break;case"ontology:packages":{const o=e.payload.ontologyHash;if(o){if(Ot===null)Ot=o;else if(Ot!==o){Ae=!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":ir(()=>r.setDhfDocuments(e.payload.docs));break;case"dhf:settings":ir(()=>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 Cn=!1;const ho=600,ut=new Map;let Dt=null;function ir(e){Cn=!0;try{e()}finally{Cn=!1}}function Xe(e){W&&W.readyState===WebSocket.OPEN&&W.send(JSON.stringify(e))}function Ys(e){const r=ut.get(e.id);r&&clearTimeout(r),ut.set(e.id,setTimeout(()=>{ut.delete(e.id);const n=S.getState().dhfDocuments.find(o=>o.id===e.id);n&&Xe({type:"dhf:doc:save",payload:{doc:n}})},ho))}let lr=!1;function Js(){lr||(lr=!0,S.subscribe((e,r)=>{if(!Cn){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&&Ys(o),n.delete(o.id);for(const o of n.keys()){const a=ut.get(o);a&&(clearTimeout(a),ut.delete(o)),Xe({type:"dhf:doc:delete",payload:{docId:o}})}}e.dhfSettings!==r.dhfSettings&&(Dt&&clearTimeout(Dt),Dt=setTimeout(()=>{Dt=null,Xe({type:"dhf:settings:save",payload:{settings:S.getState().dhfSettings}})},ho))}}))}function Xs(e){Xe({type:"dhf:templates:list",payload:{requestId:e}})}function Qs(e,r){Xe({type:"dhf:template:read",payload:{requestId:e,path:r}})}function Zs(e,r,n){Xe({type:"dhf:template:save",payload:{requestId:e,title:r,content:n}})}function dr(){W&&W.readyState===WebSocket.OPEN&&W.send(JSON.stringify({type:"request:refresh"}))}function Bt(e){return yo("element:update",e)}function an(e){return yo("element:create",e)}function yo(e,r){var l;if(!W||W.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=S.getState().model,a=r.file??"model/catalog/project.sysml",s=((l=o==null?void 0:o.sourceHashes)==null?void 0:l[a])??"",i=Ue&&we!==null?{workspaceSessionId:Ue,baseRevision:we,sourceFile:a,expectedSourceHash:s,targetElementIds:[r.id]}:void 0;return new Promise((c,d)=>{const u=setTimeout(()=>{ft.delete(n),d(new Error("The server did not answer the element mutation."))},15e3);ft.set(n,{resolve:c,reject:d,timer:u}),W.send(JSON.stringify({type:e,payload:{...r,file:a,requestId:n,precondition:i,...e==="element:update"?{irIdentity:gt(r.id)}:{}}}))})}function nt(e,r){if(!W||W.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)}`;return new Promise((o,a)=>{const s=setTimeout(()=>{Vt.delete(n),a(new Error("The server did not answer the containment change."))},15e3);Vt.set(n,{resolve:o,reject:a,timer:s}),W.send(JSON.stringify({type:e,payload:{...r,requestId:n}}))})}function ei(e){const r=e.owningFile??"model/catalog/relationships.sysml";return Jt("relationship:create",{...e,owningFile:r,sourceIdentity:gt(e.sourceId),targetIdentity:gt(e.targetId),precondition:Xt(r,[e.sourceId,e.targetId])},zn)}function ti(e){var o;const r=(o=S.getState().model)==null?void 0:o.relationships.find(a=>a.id===e.relationshipId),n=(r==null?void 0:r.file)??e.sourceFile;return Jt("relationship:delete",{...e,precondition:n?Xt(n,[r==null?void 0:r.sourceId,r==null?void 0:r.targetId].filter(Boolean)):void 0},Un)}function uu(e){var o;const r=(o=S.getState().model)==null?void 0:o.relationships.find(a=>a.id===e.relationshipId),n=r==null?void 0:r.file;return Jt("relationship:update",{...e,sourceIdentity:gt(e.sourceId),targetIdentity:gt(e.targetId),precondition:n?Xt(n,[e.sourceId,e.targetId]):void 0},Ln)}function ni(e){var n;const r=(n=S.getState().model)==null?void 0:n.elements[e];return Jt("element:delete",{elementId:e,precondition:r!=null&&r.file?Xt(r.file,[e]):void 0},qn)}function pu(e){if(!W||W.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(()=>{Wt.delete(r),o(new Error("The server did not answer the screen-capture upload request."))},3e4);Wt.set(r,{resolve:n,reject:o,timer:a}),W.send(JSON.stringify({type:"screen-capture:upload",payload:{...e,requestId:r}}))})}function ri(e){W&&W.readyState===WebSocket.OPEN&&W.send(JSON.stringify({type:"diagram:create",payload:e}))}function cr(e){W&&W.readyState===WebSocket.OPEN&&W.send(JSON.stringify({type:"diagram:update",payload:e}))}function oi(e){if(W&&W.readyState===WebSocket.OPEN){const r={id:e};W.send(JSON.stringify({type:"diagram:delete",payload:r}))}}function mu(e,r){if(W&&W.readyState===WebSocket.OPEN){const n={diagramId:e,text:r};W.send(JSON.stringify({type:"diagram:parse",payload:n}))}}function go(e,r,n){if(!W||W.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,s)=>{const i=setTimeout(()=>{Je.delete(o),s(new Error(`Timed out while trying to ${e} the SysML source.`))},1e4);Je.set(o,{resolve:a,reject:s,timer:i}),W.send(JSON.stringify({type:e==="load"?"diagram:source:request":"diagram:source:save",payload:{requestId:o,diagramId:r,...e==="save"?n:{}}}))})}function fu(e){return go("load",e)}function hu(e,r,n){return go("save",e,{text:r,baseRevision:n})}function En(e,r,n){if(!W||W.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,s)=>{const i=setTimeout(()=>{ht.delete(o),s(new Error(`Timed out while trying to ${e} methodology source.`))},15e3);ht.set(o,{resolve:a,reject:s,timer:i}),W.send(JSON.stringify({type:`methodology:source:${e==="load"?"request":"save"}`,payload:{requestId:o,sourceFile:r,...n}}))})}function ai(e){W&&W.readyState===WebSocket.OPEN&&W.send(JSON.stringify({type:"element:remap-kinds",payload:{mappings:e}}))}function sn(e){W&&W.readyState===WebSocket.OPEN&&W.send(JSON.stringify({type:"ontology:save-selection",payload:{selected:e}}))}function yu(e){W&&W.readyState===WebSocket.OPEN&&W.send(JSON.stringify({type:"ontology:install",payload:{source:e}}))}function si(e){W&&W.readyState===WebSocket.OPEN&&W.send(JSON.stringify({type:"open-file",payload:{path:e}}))}function gu(e){W&&W.readyState===WebSocket.OPEN&&W.send(JSON.stringify({type:"ontology:remove",payload:{packageName:e}}))}function xu(e,r){W&&W.readyState===WebSocket.OPEN&&W.send(JSON.stringify({type:"diagram:layout:update",payload:{diagramId:e,layout:r}}))}function ii(e){W&&W.readyState===WebSocket.OPEN&&W.send(JSON.stringify({type:"csv:import",payload:e}))}function bu(e,r,n,o){W&&W.readyState===WebSocket.OPEN&&W.send(JSON.stringify({type:"llm:chat",payload:{requestId:e,question:r,history:n,allowEdits:o}}))}function vu(e,r){W&&W.readyState===WebSocket.OPEN&&W.send(JSON.stringify({type:"llm:chat:apply",payload:{requestId:e,changes:r}}))}function wu(e,r){W&&W.readyState===WebSocket.OPEN&&W.send(JSON.stringify({type:"llm:settings:save",payload:{requestId:e,...r}}))}function ku(e,r){W&&W.readyState===WebSocket.OPEN&&W.send(JSON.stringify({type:"llm:generate",payload:{requestId:e,description:r}}))}function Su(e,r,n){W&&W.readyState===WebSocket.OPEN&&W.send(JSON.stringify({type:"llm:draft",payload:{requestId:e,documentTypeId:r,targetSections:n}}))}function li(e){if(!W||W.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(()=>{yt.delete(r),o(new Error("Timed out while writing the rule policy."))},15e3);yt.set(r,{resolve:n,reject:o,timer:a}),W.send(JSON.stringify({type:"rule:policy:write",payload:{requestId:r,...e}}))})}const ur="memo:userViewpoints",jn="memo:activeView";function di(){try{const e=JSON.parse(sessionStorage.getItem(jn)??"null");if((e==null?void 0:e.type)==="diagram"&&typeof e.diagramId=="string")return e}catch{}return{type:"welcome"}}function pr(e){try{e.type==="diagram"?sessionStorage.setItem(jn,JSON.stringify(e)):sessionStorage.removeItem(jn)}catch{}}function ci(){try{const e=localStorage.getItem(ur);if(e){const r=JSON.parse(e);return localStorage.removeItem(ur),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 Ft=di(),S=Lr((e,r)=>({model:null,validation:null,completeness:null,connected:!1,restartRequired:null,sourceCoherence:null,editConflict:null,methodology:null,effectiveRules:[],ruleDiagnostics:[],lastSourceChange:null,activeMode:Ft.type==="diagram"?"diagram":"catalog",activeView:Ft,explorerTab:"model",selectedElementId:null,selectedRelationshipId:null,selectedElementIds:new Set,recentlyVisited:[],selectedViewpointId:null,selectedDiagramId:Ft.type==="diagram"?Ft.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:ci(),selectionStyle:null,setSelectionStyle:n=>e({selectionStyle:n}),diagramLayouts:{},mergeDiagramLayouts:n=>e(o=>({diagramLayouts:{...o.diagramLayouts,...n}})),setNodeLayout:(n,o,a)=>e(s=>{const i=s.diagramLayouts[n]??{nodes:{},edges:{}};return{diagramLayouts:{...s.diagramLayouts,[n]:{...i,nodes:{...i.nodes,[o]:{...i.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(s=>{const i=new Map(s.llmPending);return i.set(n,{resolve:o,reject:a}),{llmPending:i}}),resolveLlmRequest:(n,o)=>e(a=>{const s=a.llmPending.get(n);if(s){s.resolve(o);const i=new Map(a.llmPending);return i.delete(n),{llmPending:i}}return{}}),rejectLlmRequest:(n,o)=>e(a=>{const s=a.llmPending.get(n);if(s){s.reject(new Error(o));const i=new Map(a.llmPending);return i.delete(n),{llmPending:i}}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=pi(r().model,n.type);e(i=>({pendingRelationships:[...i.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 s=(i,l)=>(e(c=>({pendingRelationships:c.pendingRelationships.map(d=>d.pendingId===o?{...d,status:"failed",error:i}:d)})),{success:!1,error:i,diagnostics:l});try{const i=await ei(n);return i.success?(e(l=>({pendingRelationships:l.pendingRelationships.filter(c=>c.pendingId!==o)})),{success:!0,relationshipId:i.relationshipId,sourceFile:i.sourceFile,diagnostics:i.diagnostics}):s(i.error??"The relationship could not be created.",i.diagnostics)}catch(i){return s(i instanceof Error?i.message:String(i))}},deleteRelationship:async n=>{try{const o=await ti({relationshipId:n});return o.success?(e(a=>a.model?{model:{...a.model,relationships:a.model.relationships.filter(s=>s.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 ni(n);return o.success?(e(a=>{if(!a.model)return{};const s={...a.model.elements};return delete s[n],{model:{...a.model,elements:s,relationships:a.model.relationships.filter(i=>i.sourceId!==n&&i.targetId!==n),diagrams:(a.model.diagrams??[]).map(i=>{var l;return{...i,elementIds:(l=i.elementIds)==null?void 0:l.filter(c=>c!==n)}})},selectedElementId:a.selectedElementId===n?null:a.selectedElementId,selectedElementIds:new Set([...a.selectedElementIds].filter(i=>i!==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 l,c,d,u;let a=o.activeView,s=o.selectedDiagramId,i=o.selectedViewpointId;if(a.type==="diagram"){const m=a.diagramId,b=(l=n.diagrams)==null?void 0:l.find(g=>g.id===m),v=(d=(c=o.model)==null?void 0:c.diagrams)==null?void 0:d.find(g=>g.id===m),w=b??(v!=null&&v.sourceFile?(u=n.diagrams)==null?void 0:u.find(g=>g.sourceFile===v.sourceFile):void 0);w&&(w.id!==m&&(a={type:"diagram",diagramId:w.id},pr(a)),s=w.id,i=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:s,selectedViewpointId:i}}),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=>{pr(n),e({activeView:n})},setExplorerTab:n=>e({explorerTab:n}),selectElement:n=>{e(n?o=>{const a=[n,...o.recentlyVisited.filter(s=>s!==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 s=a.elements[n];if(!s)return;const i={...s,kind:o};e(l=>({model:l.model?{...l.model,elements:{...l.model.elements,[n]:i}}:null})),Bt(i)},bulkUpdateAttributes:(n,o)=>{const{model:a}=r();if(!a)return;const s={...a.elements};for(const i of n){const l=s[i];if(!l)continue;const c={...l,attributes:{...l.attributes,...o}};s[i]=c,Bt(c)}e(i=>({model:i.model?{...i.model,elements:s}:null}))},selectViewpoint:n=>e({selectedViewpointId:n,selectedDiagramId:null}),selectDiagram:n=>{var s;if(!n){e({selectedDiagramId:null});return}const{model:o}=r(),a=(s=o==null?void 0:o.diagrams)==null?void 0:s.find(i=>i.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(l=>l.selected).map(l=>l.name));const s=["@memoarchitect/ontology"];for(const l of n)s.includes(l.name)&&a.add(l.name);a.size===0&&n.length>0&&(a=new Set(n.map(l=>l.name)));const i=o.focusedOntologyId??(a.size>0?[...a][0]:null);return{availableOntologies:n,selectedOntologies:a,focusedOntologyId:i}}),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 s=o.filter(c=>!a.has(c.name)),i=new Set;for(const c of s)for(const d of c.layers)for(const u of d.kinds)i.add(u.name);const l=[];if(i.size>0){for(const c of Object.values(n.elements))if(i.has(c.kind)){const d=s.find(u=>u.layers.some(m=>m.kinds.some(b=>b.name===c.kind)));l.push({elementId:c.id,elementName:c.name,kind:c.kind,fromOntology:(d==null?void 0:d.name)??"unknown"})}}return{success:!0,orphanedElements:l}},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(s=>s!==n):[...o.tagFilters,n]})),clearTagFilters:()=>e({tagFilters:[]}),setEditingElement:n=>e({editingElementId:n}),updateElementField:(n,o,a)=>e(s=>{const i=new Map(s.pendingEdits),l=i.get(n)||{};return i.set(n,{...l,[o]:a}),{pendingEdits:i}}),updateElementAttribute:(n,o,a)=>e(s=>{const i=new Map(s.pendingEdits),l=i.get(n)||{},c={...l.attributes||{},[o]:a};return i.set(n,{...l,attributes:c}),{pendingEdits:i}}),moveElementToPackage:(n,o)=>nt("element:move-package",{elementId:n,targetPackage:o}),createPackage:(n,o)=>nt("package:create",{name:n,...o?{parent:o}:{}}),renamePackage:(n,o)=>nt("package:rename",{qualifiedName:n,name:o}),movePackage:(n,o)=>nt("package:move",{qualifiedName:n,targetParent:o}),deletePackage:n=>nt("package:delete",{qualifiedName:n}),addElement:(n,o,a)=>{const s=r();if(!s.model)return;const i=`${n.toLowerCase().replace(/\s+/g,"_")}_${Math.random().toString(36).substr(2,5)}`,l=Object.values(s.model.elements).find(u=>u.kind===n),c=a?Object.values(s.model.elements).find(u=>u.package===a):void 0,d={id:i,name:o,kind:n,construct:(l==null?void 0:l.construct)||"part",layer:(l==null?void 0:l.layer)||"Other",doc:"",attributes:{},...a?{package:a}:{},file:(c==null?void 0:c.file)||(l==null?void 0:l.file)||"model/generated.sysml"};e(u=>({model:u.model?{...u.model,elements:{...u.model.elements,[i]:d}}:null,selectedElementId:i,activeView:{type:"element-detail",elementId:i}})),an(d)},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(s=>({model:s.model?{...s.model,elements:{...s.model.elements,[o]:a}}:null,selectedElementId:o})),an(a),o},persistElementAttributes:(n,o)=>{var i;const a=(i=r().model)==null?void 0:i.elements[n];if(!a)return;const s={...a,attributes:{...a.attributes,...o}};e(l=>({model:l.model?{...l.model,elements:{...l.model.elements,[n]:s}}:null})),Bt(s)},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:s,viewpointId:i,elementIds:l=[],activate:c=!0})=>{const d=n??`diag_${Math.random().toString(36).substr(2,9)}`,u={id:d,name:o,diagramType:a,viewKind:s,viewpointId:i,auto:!1,elementIds:l};return e(m=>({model:m.model?{...m.model,diagrams:[...m.model.diagrams??[],u]}:null,selectedDiagramId:c?d:m.selectedDiagramId,activeView:c?{type:"diagram",diagramId:d}:m.activeView})),ri({id:d,name:o,diagramType:a,viewKind:s,viewpointId:i,elementIds:l}),d},addElementToDiagram:(n,o)=>{var l;const{model:a}=r(),s=(l=a==null?void 0:a.diagrams)==null?void 0:l.find(c=>c.id===n);if(!s)return;const i=s.elementIds??[];i.includes(o)||r().updateDiagramElementIds(n,[...i,o])},updateDiagramElementIds:(n,o)=>{const{model:a}=r();if(!(a!=null&&a.diagrams))return;const s=a.diagrams.findIndex(c=>c.id===n);if(s<0)return;const i={...a.diagrams[s],elementIds:o},l=[...a.diagrams];l[s]=i,e(c=>({model:c.model?{...c.model,diagrams:l}:null})),cr({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})),oi(n)},applyDiagramParseResult:(n,o,a)=>{const{model:s}=r();if(!(s!=null&&s.diagrams))return;const i=s.diagrams.findIndex(l=>l.id===n);if(i>=0){const l={...s.diagrams[i],elementIds:o},c=[...s.diagrams];c[i]=l,e(d=>({model:d.model?{...d.model,diagrams:c}:null,diagramParseErrors:{...d.diagramParseErrors,[n]:a}})),cr({id:n,elementIds:o})}else e(l=>({diagramParseErrors:{...l.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(s=>s.id===n?{...s,...o}:s)})),updateDhfDocumentContent:(n,o)=>e(a=>({dhfDocuments:a.dhfDocuments.map(s=>s.id===n?{...s,content:o}:s)})),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(),s=o.get(n);if(!s||!a)return;const i=a.elements[n];if(!i)return;const l={...i};s.name!==void 0&&(l.name=s.name),s.doc!==void 0&&(l.doc=s.doc),s.attributes&&(l.attributes={...i.attributes,...s.attributes});const c={...a,elements:{...a.elements,[n]:l}};if(e({model:c}),!(n.startsWith("new_")?await an(l):await Bt(l)).success){e({model:a});return}const u=new Map(r().pendingEdits);u.delete(n),e({pendingEdits:u})}})),ui={relationships:[],kinds:[]};function xo(e){return(e==null?void 0:e.registries)??ui}function pi(e,r){return On(r,xo(e))}function Cu(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 mi(e,r){return e?e.relationships.filter(n=>n.sourceId===r||n.targetId===r):[]}function Qt(e,r){return!e||!r||!e.diagrams?null:e.diagrams.find(n=>n.id===r)??null}function Eu(e,r){const n=Qt(e,r);return n?n.sourceFiles&&n.sourceFiles.length>0?n.sourceFiles:n.sourceFile?[n.sourceFile]:[]:[]}function fi(e,r){var o;const n=r?(o=e==null?void 0:e.elements[r])==null?void 0:o.file:void 0;return n?[...Ss(n,e==null?void 0:e.sourceGraph)]:[]}function hi(e,r){return e?Cs(e.files,r):!1}function zt(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 $n={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"},bo={"/dashboard":"dashboard","/scenarios":"scenario-editor"},yi={...Object.fromEntries(Object.entries($n).map(([e,r])=>[r,e])),...bo};function gi(e){return e.toLowerCase().replace(/\s+/g,"-")}function xi(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 $n[e.type]??null}}function bi(e,r=""){const n=e.length>1?e.replace(/\/+$/,""):e,o=yi[n];if(o)return{type:o};if(n==="/table"){const s=new URLSearchParams(r);return{type:"tabular",viewpointId:s.get("viewpoint")??void 0,diagramId:s.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 vi(e){const r=e.split("/").filter(Boolean);return r[0]==="catalog"&&r.length===3||r[0]==="diagrams"&&r.length===3}function wi(e){const r=e.split("/").filter(Boolean);return r[0]==="catalog"&&r.length<=2||r[0]==="diagrams"&&r.length===1}function ki(){return[...Object.values($n),...Object.keys(bo)].filter(e=>e!=="/")}const Si=[{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 Ci(){return typeof window>"u"?{}:window.__MEMO_FLAGS__??{}}function ue(e){const r=Si.find(n=>n.id===e);return r?r.stage==="stable"?!0:Ci().experimental===!0:!1}function At(){const e=S(i=>i.model),r=S(i=>i.setActiveView),n=S(i=>i.setActiveMode),o=Ce(),a=e==null?void 0:e.metadata;function s(){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:i=>{i.currentTarget.style.background="rgba(45,212,168,0.12)"},onMouseLeave:i=>{i.currentTarget.style.background="none"},children:"☰"}),t.jsx("button",{onClick:s,className:"text-sm font-bold transition-opacity",style:{color:"#2DD4A8",letterSpacing:"0.04em",background:"none",border:"none",cursor:"pointer",padding:0},onMouseEnter:i=>i.currentTarget.style.opacity="0.75",onMouseLeave:i=>i.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:s,title:"Go to home"})]})}const vo="memo-working-sets",wo="memo-quick-slots";function Ei(){return`ws-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}function Nt(e){try{localStorage.setItem(vo,JSON.stringify(e))}catch{}}function ji(){try{const e=localStorage.getItem(vo);return e?JSON.parse(e):[]}catch{return[]}}function mr(){try{const e=localStorage.getItem(wo);return e?JSON.parse(e):[null,null,null,null]}catch{return[null,null,null,null]}}function fr(e){try{localStorage.setItem(wo,JSON.stringify(e))}catch{}}const ln=Lr((e,r)=>({workingSets:[],activeWorkingSetId:null,quickSlots:mr(),loadFromStorage:()=>{const n=ji(),o=mr();e({workingSets:n,quickSlots:o})},saveWorkingSet:(n,o)=>{const a=Ei(),s=Date.now(),i={id:a,name:n,createdAt:s,updatedAt:s,state:o},l=[...r().workingSets,i];return e({workingSets:l,activeWorkingSetId:a}),Nt(l),a},updateWorkingSet:(n,o)=>{const a=r().workingSets.map(s=>s.id===n?{...s,state:o,updatedAt:Date.now()}:s);e({workingSets:a}),Nt(a)},renameWorkingSet:(n,o)=>{const a=r().workingSets.map(s=>s.id===n?{...s,name:o,updatedAt:Date.now()}:s);e({workingSets:a}),Nt(a)},deleteWorkingSet:n=>{const o=r().workingSets.filter(s=>s.id!==n),a=r().activeWorkingSetId===n?null:r().activeWorkingSetId;e({workingSets:o,activeWorkingSetId:a}),Nt(o)},setActiveWorkingSet:n=>e({activeWorkingSetId:n}),saveQuickSlot:(n,o,a)=>{const s=["Last Session","Slot 1","Slot 2","Slot 3"],i=[...r().quickSlots];for(;i.length<4;)i.push(null);i[n]={name:a??s[n],state:o,savedAt:Date.now()},fr(i),e({quickSlots:i})},clearQuickSlot:n=>{const o=[...r().quickSlots];o[n]=null,fr(o),e({quickSlots:o})}})),I={badge:"12px",xs:"12px",sm:"13px",md:"14px",lg:"15px",explorer:{group:"13px",kind:"12px",item:"13px",element:"13px",count:"12px",search:"13px"}},f={primary:"#082744",secondary:"#324E67",muted:"#5C7188",faint:"#8CA0B1",surface:"#FFFFFF",surfaceAlt:"#EEF4F7",border:"#D8E2E9",borderLight:"#E6EDF2",accent:"#2DD4A8",accentDark:"#0B1E2D"},Di={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)"},ju={md:"10px"},Du={defaultWidth:2,flowWidth:2.5,arrowSize:16,labelBgPadding:[6,4],labelBgRadius:6,labelBgStyle:{fill:"#FFFFFF",fillOpacity:.92,stroke:"#E5E5E0",strokeWidth:.5}};function dn(){const e=S.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 cn(e){const r=S.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 Bi(){const[e,r]=p.useState(!1),n=p.useRef(null),o=ln(l=>l.quickSlots),a=ln(l=>l.saveQuickSlot),s=ln(l=>l.clearQuickSlot);p.useEffect(()=>{if(!e)return;const l=c=>{n.current&&!n.current.contains(c.target)&&r(!1)};return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[e]),p.useEffect(()=>{const l=()=>{a(0,dn(),"Last Session")};return window.addEventListener("beforeunload",l),()=>window.removeEventListener("beforeunload",l)},[a]),p.useEffect(()=>{const l=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,dn());else{const u=o[d];u&&cn(u.state)}};return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[o,a]);const i=["Last Session","Slot 1","Slot 2","Slot 3"];return t.jsxs("div",{ref:n,style:{position:"relative"},children:[t.jsxs("button",{onClick:()=>r(l=>!l),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:I.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:I.xs,color:"rgba(255,255,255,0.5)",fontWeight:600},children:"Last Session"}),o[0]?t.jsx("button",{onClick:()=>{cn(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(l=>{const c=o[l];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:["⌃",l]}),t.jsx("div",{className:"flex-1 min-w-0",children:c?t.jsxs(t.Fragment,{children:[t.jsx("div",{style:{fontSize:I.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:I.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:()=>{cn(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(l,dn(),i[l]),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 ${l} (⌃⇧${l})`,children:"Save"}),c&&t.jsx("button",{onClick:()=>s(l),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:"✕"})]})]},l)})]})]})}const Fi=[{value:"",label:"— Select phase —"},{value:"concept",label:"Concept"},{value:"design",label:"Design & Development"},{value:"verification",label:"Verification & Validation"},{value:"production",label:"Production"}],ge={width:"100%",padding:"7px 10px",border:"1px solid #D1D5DB",borderRadius:"6px",fontSize:"13px",color:"#1B3A4B",background:"#fff",boxSizing:"border-box",outline:"none",fontFamily:"inherit"},he={fontSize:"11px",fontWeight:600,color:"#6B7280",textTransform:"uppercase",letterSpacing:"0.04em",display:"block",marginBottom:"4px"},un={fontSize:"12px",fontWeight:700,color:"#1B3A4B",paddingBottom:"6px",borderBottom:"1px solid #E5E7EB",marginBottom:"12px",marginTop:"4px"},Ai={display:"grid",gridTemplateColumns:"1fr 1fr",gap:"12px"};function ko({onClose:e}){const r=S(d=>d.dhfSettings),n=S(d=>d.updateDhfSettings),[o,a]=p.useState({...r}),[s,i]=p.useState("identity");function l(d,u){a(m=>({...m,[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:()=>i(d),style:{padding:"10px 14px",border:"none",background:"none",fontSize:"12px",fontWeight:600,cursor:"pointer",color:s===d?"#1B3A4B":"#9CA3AF",borderBottom:`2px solid ${s===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:[s==="identity"&&t.jsxs("div",{children:[t.jsx("p",{style:un,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:Ai,children:[t.jsxs("div",{children:[t.jsx("label",{style:he,children:"Company / Manufacturer"}),t.jsx("input",{style:ge,value:o.company,onChange:d=>l("company",d.target.value),placeholder:"Acme Medical Devices Inc."})]}),t.jsxs("div",{children:[t.jsx("label",{style:he,children:"Product / Device Name"}),t.jsx("input",{style:ge,value:o.product,onChange:d=>l("product",d.target.value),placeholder:"InfuSafe IV Pump"})]}),t.jsxs("div",{children:[t.jsx("label",{style:he,children:"Device Type"}),t.jsx("input",{style:ge,value:o.deviceType,onChange:d=>l("deviceType",d.target.value),placeholder:"Class II active implantable"})]}),t.jsxs("div",{children:[t.jsx("label",{style:he,children:"Document Version"}),t.jsx("input",{style:ge,value:o.version,onChange:d=>l("version",d.target.value),placeholder:"1.0.0"})]}),t.jsxs("div",{style:{gridColumn:"1 / -1"},children:[t.jsx("label",{style:he,children:"Development Phase"}),t.jsx("select",{style:ge,value:o.phase,onChange:d=>l("phase",d.target.value),children:Fi.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:he,children:"Document ID Prefix"}),t.jsx("input",{style:{...ge,fontFamily:"monospace"},value:o.documentNumberingPrefix,onChange:d=>l("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"]})]})]})]})]}),s==="branding"&&t.jsxs("div",{children:[t.jsx("p",{style:un,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:he,children:"Full Logo URL"}),t.jsx("input",{style:ge,value:o.logoUrl,onChange:d=>l("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:he,children:"Compact Logo URL"}),t.jsx("input",{style:ge,value:o.compactLogoUrl,onChange:d=>l("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:he,children:"Primary Color"}),t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px"},children:[t.jsx("input",{type:"color",value:o.primaryColor,onChange:d=>l("primaryColor",d.target.value),style:{width:"40px",height:"32px",padding:"2px",border:"1px solid #D1D5DB",borderRadius:"6px",cursor:"pointer"}}),t.jsx("input",{style:{...ge,flex:1,fontFamily:"monospace"},value:o.primaryColor,onChange:d=>l("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."})]})]})]}),s==="layout"&&t.jsxs("div",{children:[t.jsx("p",{style:un,children:"Document Layout"}),t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"16px"},children:[t.jsxs("div",{children:[t.jsxs("label",{style:{...he,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=>l("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:he,children:"Page Header Template"}),t.jsx("input",{style:{...ge,fontFamily:"monospace",fontSize:"12px"},value:o.headerTemplate,onChange:d=>l("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:he,children:"Page Footer Template"}),t.jsx("input",{style:{...ge,fontFamily:"monospace",fontSize:"12px"},value:o.footerTemplate,onChange:d=>l("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 Bu=Object.freeze(Object.defineProperty({__proto__:null,DhfSettingsPanel:ko},Symbol.toStringTag,{value:"Module"})),Ni="/help/",Ti=[{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"}],Ri=new Set(["dsm","traceability","statistics","compliance-wizard","model-diff","review-dashboard","workflow-wizard","ontology","ontology-detail","import"]),hr=[{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 Ii({activeViewType:e}){const r=S(l=>l.setActiveView);S(l=>l.setActiveMode);const[n,o]=p.useState(!1),a=p.useRef(null),i=hr.map(l=>l.id).includes(e);return p.useEffect(()=>{function l(c){a.current&&!a.current.contains(c.target)&&o(!1)}return n&&document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[n]),t.jsxs("div",{ref:a,style:{position:"relative"},children:[t.jsxs("button",{onClick:()=>o(l=>!l),className:"flex items-center gap-1 px-4 py-1.5 text-sm font-medium rounded-md transition-all",style:i||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:hr.filter(l=>(l.id!=="ontology"||ue("ontology"))&&(l.id!=="import"||ue("import"))).map((l,c)=>{const d=e===l.view.type;return t.jsxs("button",{onClick:()=>{r(d?{type:"welcome"}:l.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:l.icon}),l.label]},l.id)})})]})}function Mi(){const e=S(y=>y.activeMode),r=S(y=>y.setActiveMode),n=S(y=>y.activeView),o=S(y=>y.setActiveView),a=S(y=>y.setExplorerTab),s=S(y=>y.sidebarCollapsed),i=S(y=>y.toggleSidebar),l=Ce(),[c,d]=p.useState(!1),[u,m]=p.useState(!1),[b,v]=p.useState(!1);p.useEffect(()=>{const y=()=>d(B=>!B);return window.addEventListener("memo:toggle-navigation",y),()=>window.removeEventListener("memo:toggle-navigation",y)},[]);const w=["catalog","diagram","dhf","scenario"],g=Ri.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==="dashboard"?"dashboard":n.type==="diagram"||e==="diagram"?"diagram":e==="catalog"?"catalog":e;function h(y){if(y===g&&w.includes(y)){i();return}switch(w.includes(y)&&s&&i(),r(y),y){case"dashboard":o({type:"dashboard"});break;case"catalog":o({type:"welcome"}),l("/catalog");break;case"diagram":a("views"),o({type:"welcome"}),l("/diagrams");break;case"ui-screens":o({type:"ui-screens"}),l("/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:[Ti.filter(y=>!("feature"in y)||ue(y.feature)).map(y=>t.jsxs("button",{onClick:()=>{h(y.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:g===y.id?"rgba(45,212,168,0.15)":"transparent",color:g===y.id?"#2DD4A8":"rgba(255,255,255,0.78)"},children:[t.jsx("span",{style:{width:20,textAlign:"center"},children:y.icon}),y.label]},y.id)),ue("analysis")&&t.jsxs(t.Fragment,{children:[t.jsxs("button",{onClick:()=>m(y=>!y),"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"]}),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("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:"⌁"}),"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(Bi,{})]}),ue("model-tools")&&t.jsx("div",{className:"px-2 py-1",children:t.jsx(Ii,{activeViewType:n.type})}),t.jsxs("button",{onClick:()=>v(!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:Ni,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(ko,{onClose:()=>v(!1)})]}):null}const Vn="Global",_i=["System","SystemOfSystems"];function Ut(e,r,n=_i){if(n.includes(e))return!0;for(let o=r.get(e);o;o=r.get(o))if(n.includes(o))return!0;return!1}function Pi(e,r,n,o){var l;const a=c=>{var d;return{systemId:c,label:((d=r.get(c))==null?void 0:d.name)||c}};if(Ut(e.kind,o))return a(e.id);const s=new Set([e.id]);for(let c=e.owner;c&&!s.has(c);c=(l=r.get(c))==null?void 0:l.owner){s.add(c);const d=r.get(c);if(d&&Ut(d.kind,o))return a(d.id)}const i=new Set;for(const c of n){const d=c.sourceId===e.id?c.targetId:c.targetId===e.id?c.sourceId:void 0;if(!d)continue;const u=r.get(d);u&&Ut(u.kind,o)&&i.add(u.id)}return i.size===1?a([...i][0]):{label:Vn}}function So(e,r){const n=new Map;for(const o of e){const a=r(o),s=a.systemId??Vn;let i=n.get(s);i||(i={label:a.label,systemId:a.systemId,items:[]},n.set(s,i)),i.items.push(o)}return[...n.values()].sort((o,a)=>(o.systemId?0:1)-(a.systemId?0:1)||o.label.localeCompare(a.label))}function Oi(e){return e.isDefinition??/Definition$|Def$/.test(e.kind)}function Wn(e){const r=new Map;for(const n of e)Oi(n)&&r.set(n.name||n.id,n);return r}function Hn(e,r){const n=r.get(e.kind);if(!n||n.id===e.id||n.kind===e.kind)return;const o=new Set([e.id]);for(let a=n;a;a=r.get(a.kind)){if(o.has(a.id))return;o.add(a.id)}return n}const yr=(...e)=>r=>e.includes(r.construct),Co=[{id:"usecases",label:"Use cases",matches:yr("use case")},{id:"functions",label:"Functions",matches:yr("action")},{id:"logical",label:"Logical",matches:e=>e.layer==="logical"&&e.construct==="part"},{id:"physical",label:"Physical",matches:e=>e.layer==="realization"&&e.construct==="part"},{id:"software",label:"Software",matches:e=>e.layer==="implementation"&&e.construct==="part"},{id:"operational",label:"Operational",matches:e=>e.layer==="operational"&&e.construct==="part"}];function pn(e){var o,a;const r=new Map,n=[];for(const s of e){const i=(a=(o=s.element)==null?void 0:o.attributes)==null?void 0:a.elementPackage;if(!i){n.push(s);continue}let l=r.get(i);l||(l={id:`pkg:${i}`,name:i,kind:"ElementPackage",isGroup:!0,children:[]},r.set(i,l),n.push(l)),l.children.push(s)}return n}function zi(e,r=Co,n=""){const o=new Map(e.map(m=>[m.id,m])),a=Wn(e),s=m=>{var b;return m.owner&&o.has(m.owner)?m.owner:(b=Hn(m,a))==null?void 0:b.id},i=new Map;for(const m of e){const b=s(m);b&&(i.get(b)??i.set(b,[]).get(b)).push(m)}const l=new Set,c=(m,b)=>{b.add(m.id);const v=(i.get(m.id)??[]).filter(w=>!b.has(w.id)&&!l.has(w.id)).map(w=>c(w,b));return{id:m.id,name:m.name||m.id,kind:m.kind,element:m,children:pn(v)}},d=n.trim().toLowerCase(),u=m=>!d||m.name.toLowerCase().includes(d)||m.kind.toLowerCase().includes(d)||m.children.some(u);return r.map(m=>{const b=y=>{const B=s(y);return B?!!m.systemOf&&!m.matches(o.get(B)):!0},v=e.filter(y=>m.matches(y)).filter(b).filter(y=>!l.has(y.id));for(const y of v)l.add(y.id);const w=new Set,g=v.map(y=>c(y,w)),h=m.systemOf?So(g,y=>m.systemOf(y.element)).map(y=>({id:`sys:${y.systemId??y.label}`,name:y.label,kind:y.systemId?"System":"Global",isGroup:!0,children:pn(y.items)})).filter(u):pn(g).filter(u);return{id:m.id,label:m.label,nodes:h}}).filter(m=>m.nodes.length>0)}function Ui(e,r){const n=[],o=new Set;let a=r;for(;a&&!o.has(a.id);)o.add(a.id),n.unshift(a.id),a=a.owner?e==null?void 0:e.elements[a.owner]:void 0;return[r.package,...n].filter(Boolean).join("::")}function gr(e,r){const n=r.owner?e==null?void 0:e.elements[r.owner]:void 0;return n?Ui(e,n):r.package||void 0}function xr(e,r){var o;const n=new Set;for(const a of Object.values((e==null?void 0:e.elements)??{})){if(a.owner!==r.owner)continue;const s=(o=a.attributes)==null?void 0:o.elementPackage;s&&n.add(s)}return[...n].sort()}async function Li(e,r=5e3){var a;const n=e.split("::").pop()??e,o=Date.now()+r;for(;Date.now()<o;){const s=S.getState().model;if((a=s==null?void 0:s.packages)!=null&&a.some(i=>i.qualifiedName===e)||s!=null&&s.elements[n])return!0;await new Promise(i=>setTimeout(i,120))}return!1}function Eo(e){const r=new Map;for(const n of e)for(const o of n.layers)for(const a of o.kinds)a.derivesFrom&&r.set(a.name,a.derivesFrom);return r}function Fu(e,r){const n=new Map(e.map(c=>[c.kind,c.elementCount])),o=new Set(n.keys());for(;;){const c=[...o].filter(u=>!br(u,r,o)),d=new Set;for(const u of c)for(let m=r.get(u);m&&!o.has(m);m=r.get(m))if(c.filter(b=>jo(m,b,r)).length>=2){d.add(m);break}if(d.size===0)break;for(const u of d)o.add(u),n.set(u,0)}const a=new Map;for(const c of o)a.set(c,{kind:c,elementCount:n.get(c)??0,totalCount:0,children:[]});const s=[];for(const c of a.values()){const d=br(c.kind,r,o);(d?a.get(d).children:s).push(c)}const i=c=>(c.totalCount=c.elementCount+c.children.reduce((d,u)=>d+i(u),0),c.totalCount),l=c=>{c.children.sort(vr),c.children.forEach(l)};return s.forEach(i),s.forEach(l),s.sort(vr),s}function br(e,r,n){for(let o=r.get(e);o;o=r.get(o))if(n.has(o))return o}function vr(e,r){return r.totalCount-e.totalCount||e.kind.localeCompare(r.kind)}function jo(e,r,n){for(let o=n.get(r);o;o=n.get(o))if(o===e)return!0;return!1}function Au(e,r,n){const o=[e];for(const a of n)a!==e&&jo(e,a,r)&&o.push(a);return o}function qi(e,r=0){return e.flatMap(n=>[{node:n,depth:r},...qi(n.children,r+1)])}const ce={operational:"#0F766E",business:"#8E44AD",requirements:"#4A90D9",risk:"#E74C3C",functional:"#E67E22",behavior:"#FF6B6B",logical:"#7B68EE",physical:"#95A5A6",software:"#F39C12",interfaces:"#1ABC9C",verification:"#2ECC71",ui:"#3498DB"},Le={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"},Te=["operational","business","requirements","risk","functional","behavior","logical","physical","software","interfaces","verification","ui"],$i={mitigates:"#E74C3C",causes:"#C0392B",leadsTo:"#E74C3C",identifies:"#D35400",traceTo:"#4A90D9",satisfiedBy:"#2ECC71",verifiedBy:"#27AE60",allocatedTo:"#E67E22",aggregation:"#7B68EE",composedOf:"#8E44AD",decomposedBy:"#D35400",flow:"#3498DB",succession:"#95A5A6"},wr=["#2563EB","#0891B2","#7C3AED","#DB2777","#EA580C","#0D9488","#65A30D","#9333EA","#C2410C","#1D4ED8"];function Nu(e){const r=$i[e];if(r)return r;let n=0;for(let o=0;o<e.length;o++)n=n*31+e.charCodeAt(o)>>>0;return wr[n%wr.length]}const Kn={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"}},$e={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 Vi(e){const r=e.diagramType.trim().toLowerCase();return r==="ofd"||r==="ffd"?r:"afd"}const Tu=["#FFFFFF","#f8fafc","#f0f9ff","#fdf2f8","#f0fdf4"];function Oe({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 Wi(){return t.jsx("div",{style:{height:"1px",background:"#E5E5E0",margin:"3px 0"}})}function Hi({x:e,y:r,target:n,onViewVisual:o,onViewTable:a,onToggleSelection:s,onViewProperties:i,onClose:l}){const c=p.useRef(null);p.useEffect(()=>{if(!c.current)return;const u=c.current,{innerWidth:m,innerHeight:b}=window,v=u.getBoundingClientRect();v.right>m&&(u.style.left=`${e-v.width}px`),v.bottom>b&&(u.style.top=`${r-v.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(Oe,{icon:"⬜",label:"View Visual Layout",onClick:()=>{o(n.pkgName),l()}}),t.jsx(Oe,{icon:"☰",label:"View as Table",onClick:()=>{a(n.pkgName),l()}}),t.jsx(Wi,{}),t.jsx(Oe,{icon:n.isSelected?"☑":"☐",label:n.isSelected?"Deselect for Project":"Select for Project",onClick:()=>s(n.pkgName)})]}):n.type==="layer"?t.jsxs("div",{ref:c,style:d,onMouseDown:u=>u.stopPropagation(),children:[t.jsx(Oe,{icon:"⬜",label:"View Visual Layout",onClick:()=>{o(n.pkgName),l()}}),t.jsx(Oe,{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(Oe,{icon:"🔍",label:"View Properties",onClick:()=>i(n.kindName,n.pkgName)}),t.jsx(Oe,{icon:"☰",label:"View as Table",onClick:()=>a(n.pkgName,n.layerId)}),t.jsx(Oe,{icon:"⬜",label:"Show in Visual Layout",onClick:()=>{o(n.pkgName),l()}})]})}function Ki({kindsToRemap:e,onConfirm:r,onCancel:n}){const o=S(u=>u.availableOntologies),a=S(u=>u.selectedOntologies),s=o.filter(u=>a.has(u.name)).flatMap(u=>u.layers.flatMap(m=>m.kinds.map(b=>b.name))).filter((u,m,b)=>b.indexOf(u)===m).sort(),[i,l]=p.useState(Object.fromEntries(e.map(u=>[u,""])));function c(u,m){l(b=>({...b,[u]:m}))}const d=e.every(u=>i[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:i[u],onChange:m=>c(u,m.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…"}),s.map(m=>t.jsx("option",{value:m,children:m},m))]})]},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(i),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 Gi({orphans:e,onKeep:r,onRemap:n,onCancel:o}){const[a,s]=p.useState(!1),i=new Map;for(const l of e)i.has(l.kind)||i.set(l.kind,[]),i.get(l.kind).push(l);return a?t.jsx(Ki,{kindsToRemap:[...i.keys()],onConfirm:n,onCancel:()=>s(!1)}):t.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-50",style:{background:"rgba(0,0,0,0.4)"},onClick:l=>{l.target===l.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:[...i.entries()].map(([l,c])=>t.jsxs("div",{className:"mb-3",children:[t.jsxs("div",{className:"text-xs font-semibold mb-1",style:{color:"#374151"},children:[l,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"]})]})]},l))}),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:()=>s(!0),className:"px-3 py-1.5 text-xs rounded-md font-medium",style:{background:"#1B3A4B",color:"#FFFFFF"},children:"Remap kinds →"})]})]})})}function Yi(){const e=S(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,s]=p.useState(""),[i,l]=p.useState(""),[c,d]=p.useState(!1),[u,m]=p.useState(""),b=async w=>{if(!w)return;const g=await En("load",w);o(w),s(g.text??""),l(g.revision??""),d(!1),m(g.success?"":g.error??"Could not load source.")},v=async()=>{if(!n||!i)return;const w=await En("save",n,{text:a,baseRevision:i});w.success?(l(w.revision??i),d(!1),m("Saved. The reusable semantic runtime is restarting.")):m(w.error??"Save rejected; the draft remains in the editor.")};return r.length===0?null:t.jsxs("section",{style:{borderBottom:`1px solid ${f.border}`},children:[t.jsx("div",{className:"px-3 py-2 font-semibold",style:{fontSize:I.xs,color:f.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:I.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=>{s(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 v(),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 Ji(){var L;const e=S(E=>E.effectiveRules),r=S(E=>E.ruleDiagnostics),n=S(E=>E.methodology),o=p.useMemo(()=>[...new Set(((n==null?void 0:n.folders)??[]).flatMap(E=>E.sourceFiles))].sort(),[n]),[a,s]=p.useState(""),[i,l]=p.useState("disabled"),[c,d]=p.useState(""),[u,m]=p.useState(""),[b,v]=p.useState(""),[w,g]=p.useState(""),[h,y]=p.useState(""),[B,N]=p.useState(""),[D,A]=p.useState(""),[F,C]=p.useState(!1),k=e.find(E=>E.sourceRuleType===a),T=(k==null?void 0:k.tailoring)==="invariant",z=!a||!B||T&&i!=="enabled"||i!=="enabled"&&!b.trim()||i==="replaced"&&!u.trim(),_=async()=>{C(!0),A("");try{const E=await En("load",B);if(!E.success||!E.revision){A(E.error??"Could not read the methodology source.");return}const O=await li({targetRuleType:a,disposition:i,severityOverride:c||void 0,replacementRuleType:i==="replaced"?u.trim():void 0,rationaleText:b.trim(),authority:w.trim()||void 0,approvalReference:h.trim()||void 0,sourceFile:B,baseRevision:E.revision});A(O.success?"Policy written. The reusable semantic runtime is restarting.":O.error??"The policy was rejected; nothing was written."),O.success&&(v(""),y(""))}catch(E){A(E instanceof Error?E.message:String(E))}finally{C(!1)}};if(e.length===0)return null;const j={width:"calc(100% - 24px)",margin:"0 12px 6px",fontSize:I.xs};return t.jsxs("section",{style:{borderBottom:`1px solid ${f.border}`},children:[t.jsxs("div",{className:"px-3 py-2 font-semibold",style:{fontSize:I.xs,color:f.primary},children:["Rule Tailoring",t.jsxs("span",{style:{fontWeight:400,color:f.muted},children:[" — ",e.length," rules in the effective set"]})]}),t.jsxs("select",{"aria-label":"Rule",value:a,style:j,onChange:E=>s(E.target.value),children:[t.jsx("option",{value:"",children:"Select a rule…"}),e.map(E=>t.jsxs("option",{value:E.sourceRuleType,children:[E.sourceRuleId," — ",E.sourceRuleType,E.tailoring==="invariant"?" (invariant)":"",E.disposition!=="enabled"?` [${E.disposition}]`:""]},E.sourceRuleType))]}),k&&t.jsxs("div",{className:"px-3 pb-1",style:{fontSize:11,color:f.muted},children:["Currently ",k.disposition," at ",k.effectiveSeverity,k.effectiveSeverity!==k.declaredSeverity&&` (declared ${k.declaredSeverity})`,((L=k.policyChain)==null?void 0:L.length)>0&&` · ${k.policyChain.length} policy in chain`]}),T&&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:i,style:j,onChange:E=>l(E.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:j,onChange:E=>d(E.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"})]}),i==="replaced"&&t.jsx("input",{"aria-label":"Replacement rule",value:u,style:j,placeholder:"Replacement constraint def name",onChange:E=>m(E.target.value)}),t.jsx("textarea",{"aria-label":"Rationale",value:b,placeholder:"Rationale — required to disable or replace a rule",style:{...j,height:54,fontFamily:"inherit"},onChange:E=>v(E.target.value)}),t.jsx("input",{"aria-label":"Authority",value:w,style:j,placeholder:"Authority (optional)",onChange:E=>g(E.target.value)}),t.jsx("input",{"aria-label":"Approval reference",value:h,style:j,placeholder:"Approval reference (optional)",onChange:E=>y(E.target.value)}),t.jsxs("select",{"aria-label":"Target methodology file",value:B,style:j,onChange:E=>N(E.target.value),children:[t.jsx("option",{value:"",children:"Write the policy into…"}),o.map(E=>t.jsx("option",{value:E,children:E},E))]}),t.jsx("div",{className:"flex gap-2 px-3 py-2",children:t.jsx("button",{disabled:z||F,onClick:()=>void _(),children:F?"Writing…":"Write policy"})}),D&&t.jsx("div",{className:"px-3 pb-2",role:"status",style:{fontSize:11,color:"#B45309"},children:D}),r.length>0&&t.jsx("div",{className:"px-3 pb-2",style:{fontSize:11,color:"#B91C1C"},children:r.map((E,O)=>t.jsxs("div",{children:["[",E.code,"] ",E.message]},O))})]})}const kr={ontology:"📦",profile:"🔧",extension:"🧩"};function Xi(e){const r=new Map(e.map(l=>[l.name,l])),n=new Map;function o(l){if(n.has(l))return n.get(l);const c=r.get(l);if(!c||!c.derivesFrom||!r.has(c.derivesFrom))return n.set(l,0),0;const d=o(c.derivesFrom)+1;return n.set(l,d),d}for(const l of e)o(l.name);const a=new Map;for(const l of e){const c=n.get(l.name)??0,d=a.get(c)??[];d.push(l),a.set(c,d)}const s=Math.max(...a.keys()),i=[];for(let l=0;l<=s;l++){const c=a.get(l)??[];i.push(...c.sort((d,u)=>d.name.localeCompare(u.name)))}return i}function Qi(e){const r=new Map(e.map(l=>[l.name,l])),n=new Map;function o(l){if(n.has(l))return n.get(l);const c=r.get(l);if(!c||!c.extends||!r.has(c.extends))return n.set(l,0),0;const d=o(c.extends)+1;return n.set(l,d),d}for(const l of e)o(l.name);const a=new Map;for(const l of e){const c=n.get(l.name)??0,d=a.get(c)??[];d.push(l),a.set(c,d)}const s=a.size>0?Math.max(...a.keys()):0,i=[];for(let l=0;l<=s;l++){const c=a.get(l)??[];i.push(...c.sort((d,u)=>d.name.localeCompare(u.name)))}return i}function Zi({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:I.sm,color:f.primary},children:"Remove ontology?"}),t.jsxs("div",{className:"mb-4",style:{fontSize:I.xs,color:f.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:I.xs,background:f.surfaceAlt,color:f.secondary,border:`1px solid ${f.border}`,cursor:"pointer"},children:"Cancel"}),t.jsx("button",{onClick:n,className:"px-3 py-1.5 rounded-md font-medium",style:{fontSize:I.xs,background:"#DC2626",color:"#FFFFFF",border:"none",cursor:"pointer"},children:"Remove"})]})]})})}function el(){const e=S(x=>x.availableOntologies),r=S(x=>x.selectedOntologies),n=S(x=>x.toggleOntologySelection),o=S(x=>x.saveOntologySelection),a=S(x=>x.selectedOntologyKind),s=S(x=>x.setSelectedOntologyKind),i=S(x=>x.setActiveView),l=S(x=>x.setOntologyViewMode),c=S(x=>x.activeView),[d,u]=p.useState(""),[m,b]=p.useState(()=>new Set(e.filter(x=>x.selected).map(x=>x.name))),[v,w]=p.useState(new Set),[g,h]=p.useState(()=>new Set(e.filter(x=>x.selected).map(x=>x.name))),y=p.useMemo(()=>{if(r.size!==g.size)return!0;for(const x of r)if(!g.has(x))return!0;return!1},[r,g]),[B,N]=p.useState(null),[D,A]=p.useState(null),[F,C]=p.useState(null),k=p.useRef(new Map),T=p.useMemo(()=>{const x=d.trim()?e.map(P=>({...P,layers:P.layers.map(q=>({...q,kinds:q.kinds.filter(X=>X.name.toLowerCase().includes(d.toLowerCase())||X.label.toLowerCase().includes(d.toLowerCase())||X.layer.toLowerCase().includes(d.toLowerCase()))})).filter(q=>q.kinds.length>0)})).filter(P=>P.layers.length>0||P.name.toLowerCase().includes(d.toLowerCase())):e;return Qi(x)},[e,d]);p.useEffect(()=>{d.trim()&&(b(new Set(T.map(x=>x.name))),w(new Set(T.flatMap(x=>x.layers.map(P=>`${x.name}:${P.id}`)))))},[d,T]),p.useEffect(()=>{if(a&&k.current.has(a)){for(const x of e)for(const P of x.layers)if(P.kinds.find(q=>q.name===a)){b(q=>new Set([...q,x.name])),w(q=>new Set([...q,`${x.name}:${P.id}`]));break}setTimeout(()=>{var x;(x=k.current.get(a))==null||x.scrollIntoView({behavior:"smooth",block:"nearest"})},80)}},[a,e]);function z(x){i({type:"ontology-detail",packageName:x})}function _(x,P){i({type:"ontology-detail",packageName:x,layerId:P})}function j(x,P){s(a===x?null:x),i({type:"ontology-detail",packageName:P})}function L(x){b(P=>{const q=new Set(P);return q.has(x)?q.delete(x):q.add(x),q})}function E(x){w(P=>{const q=new Set(P);return q.has(x)?q.delete(x):q.add(x),q})}function O(x,P,q){x.stopPropagation(),q?A(P):n(P)}function V(){const x=o();x.orphanedElements&&x.orphanedElements.length>0?N(x.orphanedElements):(sn([...r]),h(new Set(r)))}function U(){sn([...r]),h(new Set(r)),N(null)}function $(x){ai(x),sn([...r]),h(new Set(r)),N(null)}function K(x,P){x.preventDefault(),x.stopPropagation(),C({x:x.clientX,y:x.clientY,target:P})}function J(x,P){l("table"),i({type:"ontology-detail",packageName:x,layerId:P}),C(null)}function Y(x){l("visual"),i({type:"ontology-detail",packageName:x}),C(null)}function Q(x){r.has(x)?A(x):n(x),C(null)}function ee(x,P){s(x),i({type:"ontology-detail",packageName:P}),C(null)}if(p.useEffect(()=>{function x(P){P.key==="Escape"&&(s(null),C(null),A(null))}return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[s]),p.useEffect(()=>{if(!F)return;function x(){C(null)}return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[F]),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:f.faint},children:[t.jsx("div",{className:"text-xl mb-2",children:"◉"}),t.jsx("div",{style:{fontSize:I.xs},children:"No ontology packages"}),t.jsx("div",{style:{fontSize:I.xs,opacity:.7,marginTop:"4px"},children:"Start memo-architect dev to load"})]})});const M=c.type==="ontology-detail"?c.packageName:null;return t.jsxs("div",{className:"flex flex-col flex-1 overflow-hidden",style:{fontSize:I.explorer.item},children:[t.jsx(Ji,{}),t.jsx(Yi,{}),t.jsx("div",{className:"px-3 py-2 sticky top-0 z-10",style:{background:f.surface,borderBottom:`1px solid ${f.border}`},children:t.jsx("input",{type:"text",placeholder:"Search kinds...",value:d,onChange:x=>u(x.target.value),className:"w-full px-2.5 py-1.5 rounded-lg focus:outline-none",style:{fontSize:I.explorer.search,border:`1px solid ${f.border}`,background:f.surfaceAlt,color:f.primary},onFocus:x=>x.currentTarget.style.borderColor="#2563EB",onBlur:x=>x.currentTarget.style.borderColor=f.border})}),t.jsx("div",{className:"flex-1 overflow-y-auto py-1",children:T.map(x=>{const P=r.has(x.name),q=M===x.name,X=m.has(x.name),ie=x.name.replace(/^@memo(?:architect)?\//,""),oe=kr[x.type]??kr.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:q?`${f.accent}18`:"transparent",borderLeft:q?`3px solid ${f.accentDark}`:"3px solid transparent",opacity:P?1:.55},onMouseEnter:R=>{q||(R.currentTarget.style.background="#F0F0ED")},onMouseLeave:R=>{R.currentTarget.style.background=q?`${f.accent}18`:"transparent"},onClick:R=>{R.stopPropagation(),L(x.name)},onDoubleClick:()=>z(x.name),onContextMenu:R=>K(R,{type:"package",pkgName:x.name,isSelected:P}),children:[t.jsx("input",{type:"checkbox",checked:P,onChange:R=>O(R,x.name,P),onClick:R=>R.stopPropagation(),style:{cursor:"pointer",accentColor:"#2563EB",flexShrink:0},title:P?"Deselect for project":"Select for project"}),t.jsx("span",{style:{color:f.muted,fontSize:"10px"},children:X?"▾":"▸"}),t.jsx("span",{children:oe}),t.jsx("span",{className:"font-semibold truncate flex-1",style:{color:f.primary,fontSize:I.explorer.group},children:ie}),t.jsx("span",{style:{color:f.faint},children:x.kindCount})]}),X&&x.layers.map(R=>{const H=ce[R.id]??R.color??f.muted,G=`${x.name}:${R.id}`,Z=v.has(G),le=Xi(R.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:ae=>ae.currentTarget.style.background="#F0F0ED",onMouseLeave:ae=>ae.currentTarget.style.background="transparent",onClick:ae=>{ae.stopPropagation(),E(G)},onDoubleClick:()=>_(x.name,R.id),onContextMenu:ae=>K(ae,{type:"layer",pkgName:x.name,layerId:R.id,layerLabel:R.label}),children:[t.jsx("span",{style:{color:f.faint,fontSize:"9px"},children:Z?"▾":"▸"}),t.jsx("span",{className:"w-2 h-2 rounded flex-shrink-0",style:{backgroundColor:H}}),t.jsx("span",{className:"flex-1 truncate capitalize",style:{color:f.muted,fontSize:I.explorer.kind},children:R.label}),t.jsx("span",{style:{color:f.faint},children:R.kindCount})]}),Z&&(()=>{const ae=new Map;for(const te of le){const fe=te.derivesFrom?ae.get(te.derivesFrom)??0:0;ae.set(te.name,te.derivesFrom?fe+1:0)}const me=te=>{const fe=a===te.name,et=ae.get(te.name)??0,_e=et===0,ne=36+et*12;return t.jsxs("div",{ref:re=>{re&&k.current.set(te.name,re)},className:"flex items-center gap-1.5 px-3 py-0.5 cursor-pointer",style:{borderRadius:"4px",margin:`0 4px 0 ${ne}px`,background:fe?`${f.accent}18`:"transparent",borderLeft:fe?`2px solid ${H}`:"2px solid transparent",transition:"background 150ms ease"},onMouseEnter:re=>{fe||(re.currentTarget.style.background="#F0F0ED")},onMouseLeave:re=>{re.currentTarget.style.background=fe?`${f.accent}18`:"transparent"},onClick:()=>j(te.name,x.name),onContextMenu:re=>K(re,{type:"kind",kindName:te.name,pkgName:x.name,layerId:R.id}),children:[!_e&&t.jsx("span",{style:{color:f.faint,fontSize:"9px",flexShrink:0},children:"↳"}),t.jsx("span",{className:"truncate",style:{color:fe?f.accentDark:f.primary,fontWeight:_e?500:400,fontSize:I.explorer.item},children:te.name}),te.instanceCount>0&&t.jsxs("span",{style:{color:f.faint,fontSize:"10px"},children:["·",te.instanceCount]})]},te.name)},Ee=[],Me=new Map;for(const te of le){const fe=te.group??"";Me.has(fe)||(Me.set(fe,[]),Ee.push(fe)),Me.get(fe).push(te)}return Ee.filter(te=>te!=="").length<=1?le.map(me):Ee.map(te=>t.jsxs("div",{children:[te&&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:f.faint,fontSize:I.explorer.kind,letterSpacing:"0.02em"},children:te.replace(/_/g," ")}),t.jsx("span",{style:{color:f.faint,fontSize:"10px"},children:Me.get(te).length})]}),Me.get(te).map(me)]},`grp:${G}:${te||"_root"}`))})()]},G)})]},x.name)})}),y&&t.jsx("div",{className:"px-3 py-2 flex-shrink-0",style:{borderTop:`1px solid ${f.border}`,background:f.surfaceAlt},children:t.jsx("button",{onClick:V,className:"w-full py-1.5 rounded-md font-medium",style:{fontSize:I.xs,background:"#2563EB",color:"#FFFFFF",border:"none",cursor:"pointer"},children:"Save Selection"})}),D&&t.jsx(Zi,{pkgName:D,onCancel:()=>A(null),onConfirm:()=>{n(D),A(null)}}),B&&t.jsx(Gi,{orphans:B,onKeep:U,onRemap:$,onCancel:()=>N(null)}),F&&t.jsx(Hi,{x:F.x,y:F.y,target:F.target,onViewVisual:Y,onViewTable:J,onToggleSelection:Q,onViewProperties:ee,onClose:()=>C(null)})]})}function tl(){const e=S(l=>l.model),r=S(l=>l.recentlyVisited),n=S(l=>l.selectElement),o=p.useMemo(()=>e?r.map(l=>e.elements[l]).filter(Boolean):[],[r,e]),a=o,s="Recently visited",i=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 ${f.border}`},children:[t.jsx("div",{style:{fontSize:"10px",fontWeight:700,textTransform:"uppercase",letterSpacing:"0.08em",color:f.muted,marginBottom:"2px"},children:s}),t.jsx("div",{style:{fontSize:"11px",color:f.muted,opacity:.8},children:i})]}),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:f.muted,lineHeight:"1.6"},children:"Nothing visited yet. Use Model Explorer or Viewpoints to begin."}):a.map(l=>{const c=ce[l.layer]||f.muted;return t.jsx("button",{onClick:()=>n(l.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=f.surfaceAlt,onMouseLeave:d=>d.currentTarget.style.background="transparent",children:t.jsxs("div",{style:{flex:1,minWidth:0},children:[t.jsx("div",{style:{fontSize:I.explorer.item,fontWeight:500,color:f.primary,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:l.name}),t.jsxs("div",{style:{fontSize:"10px",color:f.muted,marginTop:"2px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:[t.jsx("span",{style:{color:c,fontWeight:600},children:l.kind}),l.shortId&&t.jsx("span",{style:{marginLeft:"6px",fontFamily:"monospace",opacity:.7},children:l.shortId})]})]})},l.id)})})]})}function nl({element:e,selected:r=!1,fontSize:n=I.explorer.item,fontWeight:o}){const a=e.shortId??"ID-PENDING";return t.jsxs("span",{className:"truncate flex-1",style:{color:r?f.accentDark:f.primary,fontSize:n,fontWeight:o??(r?500:400)},title:`${a} ${e.name}`,children:[t.jsxs("span",{style:{color:f.muted,fontWeight:500,marginRight:"4px"},children:["[",a,"]"]}),e.name,e.isDefinition&&t.jsx("span",{style:{color:f.muted,fontWeight:600,marginLeft:"5px",fontSize:"0.85em"},children:"def"})]})}function Ht({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:I.explorer.count,fontWeight:600,minWidth:"20px",textAlign:"center"},title:n,children:e})}const rl=`---
|
|
17
17
|
id: change-record
|
|
18
18
|
title: Design Change Record
|
|
19
19
|
standard: 21 CFR Part 820
|
|
@@ -58,7 +58,7 @@ _[TODO: Document risk management activity triggered by each significant change]_
|
|
|
58
58
|
---
|
|
59
59
|
|
|
60
60
|
{{include:shared/snippets/revision-history-table.md}}
|
|
61
|
-
`,
|
|
61
|
+
`,ol=`---
|
|
62
62
|
id: design-input
|
|
63
63
|
title: Design Input Plan
|
|
64
64
|
standard: 21 CFR Part 820
|
|
@@ -125,7 +125,7 @@ _[TODO: Document the design input review process and sign-off]_
|
|
|
125
125
|
{{include:shared/snippets/revision-history-table.md}}
|
|
126
126
|
|
|
127
127
|
{{include:shared/snippets/approval-block.md}}
|
|
128
|
-
`,
|
|
128
|
+
`,al=`---
|
|
129
129
|
id: design-output
|
|
130
130
|
title: Design Output Plan
|
|
131
131
|
standard: 21 CFR Part 820
|
|
@@ -205,7 +205,7 @@ List the documents constituting the essential design outputs for the DHF.
|
|
|
205
205
|
{{include:shared/snippets/revision-history-table.md}}
|
|
206
206
|
|
|
207
207
|
{{include:shared/snippets/approval-block.md}}
|
|
208
|
-
`,
|
|
208
|
+
`,sl=`---
|
|
209
209
|
id: design-review
|
|
210
210
|
title: Design Review Record
|
|
211
211
|
standard: 21 CFR Part 820
|
|
@@ -256,7 +256,7 @@ label: Total design elements at last review
|
|
|
256
256
|
---
|
|
257
257
|
|
|
258
258
|
{{include:shared/snippets/revision-history-table.md}}
|
|
259
|
-
`,
|
|
259
|
+
`,il=`---
|
|
260
260
|
id: design-validation
|
|
261
261
|
title: Design Validation Records
|
|
262
262
|
standard: 21 CFR Part 820
|
|
@@ -320,7 +320,7 @@ _[TODO: State validation conclusion — device meets intended use for intended u
|
|
|
320
320
|
{{include:shared/snippets/revision-history-table.md}}
|
|
321
321
|
|
|
322
322
|
{{include:shared/snippets/approval-block.md}}
|
|
323
|
-
`,
|
|
323
|
+
`,ll=`---
|
|
324
324
|
id: design-verification
|
|
325
325
|
title: Design Verification Records
|
|
326
326
|
standard: 21 CFR Part 820
|
|
@@ -377,7 +377,7 @@ _[TODO: Demonstrate that all design inputs are verified by at least one test]_
|
|
|
377
377
|
{{include:shared/snippets/revision-history-table.md}}
|
|
378
378
|
|
|
379
379
|
{{include:shared/snippets/approval-block.md}}
|
|
380
|
-
`,
|
|
380
|
+
`,dl=`---
|
|
381
381
|
id: dhf-index
|
|
382
382
|
title: Design History File Index
|
|
383
383
|
standard: 21 CFR Part 820
|
|
@@ -488,7 +488,7 @@ label: Total test cases
|
|
|
488
488
|
{{include:shared/snippets/approval-block.md}}
|
|
489
489
|
|
|
490
490
|
{{include:shared/snippets/references-section.md}}
|
|
491
|
-
`,
|
|
491
|
+
`,cl=`---
|
|
492
492
|
id: transfer-plan
|
|
493
493
|
title: Design Transfer Plan
|
|
494
494
|
standard: 21 CFR Part 820
|
|
@@ -538,7 +538,7 @@ empty: "No design outputs defined."
|
|
|
538
538
|
{{include:shared/snippets/revision-history-table.md}}
|
|
539
539
|
|
|
540
540
|
{{include:shared/snippets/approval-block.md}}
|
|
541
|
-
`,
|
|
541
|
+
`,ul=`---
|
|
542
542
|
id: user-needs
|
|
543
543
|
title: User Needs Document
|
|
544
544
|
standard: 21 CFR Part 820
|
|
@@ -619,7 +619,7 @@ Regulatory and standards requirements applicable to **{{project.product}}**:
|
|
|
619
619
|
{{include:shared/snippets/approval-block.md}}
|
|
620
620
|
|
|
621
621
|
{{include:shared/snippets/references-section.md}}
|
|
622
|
-
`,
|
|
622
|
+
`,pl=`---
|
|
623
623
|
id: vv-plan
|
|
624
624
|
title: Verification and Validation Plan
|
|
625
625
|
standard: 21 CFR Part 820
|
|
@@ -708,7 +708,7 @@ _[TODO: Describe hardware, software, and clinical test environments]_
|
|
|
708
708
|
{{include:shared/snippets/approval-block.md}}
|
|
709
709
|
|
|
710
710
|
{{include:shared/snippets/references-section.md}}
|
|
711
|
-
`,
|
|
711
|
+
`,ml=`---
|
|
712
712
|
id: vv-report
|
|
713
713
|
title: Verification and Validation Report
|
|
714
714
|
standard: 21 CFR Part 820
|
|
@@ -793,7 +793,7 @@ _[TODO: State whether the device meets all design inputs and is fit for intended
|
|
|
793
793
|
{{include:shared/snippets/revision-history-table.md}}
|
|
794
794
|
|
|
795
795
|
{{include:shared/snippets/approval-block.md}}
|
|
796
|
-
`,
|
|
796
|
+
`,fl=`---
|
|
797
797
|
id: incident-response
|
|
798
798
|
title: Cybersecurity Incident Response Plan
|
|
799
799
|
standard: FDA Cybersecurity Guidance 2023
|
|
@@ -859,7 +859,7 @@ _[TODO: Describe the coordinated disclosure policy for external researchers]_
|
|
|
859
859
|
---
|
|
860
860
|
|
|
861
861
|
{{include:shared/snippets/revision-history-table.md}}
|
|
862
|
-
`,
|
|
862
|
+
`,hl=`---
|
|
863
863
|
id: postmarket-surveillance
|
|
864
864
|
title: Post-Market Cybersecurity Surveillance Plan
|
|
865
865
|
standard: FDA Cybersecurity Guidance 2023
|
|
@@ -923,7 +923,7 @@ _[TODO: Describe how security patches are tested, validated, and released]_
|
|
|
923
923
|
---
|
|
924
924
|
|
|
925
925
|
{{include:shared/snippets/revision-history-table.md}}
|
|
926
|
-
`,
|
|
926
|
+
`,yl=`---
|
|
927
927
|
id: security-arch
|
|
928
928
|
title: Cybersecurity Architecture Description
|
|
929
929
|
standard: FDA Cybersecurity Guidance 2023
|
|
@@ -1006,7 +1006,7 @@ _[TODO: Describe penetration testing, vulnerability scanning, and security code
|
|
|
1006
1006
|
{{include:shared/snippets/revision-history-table.md}}
|
|
1007
1007
|
|
|
1008
1008
|
{{include:shared/snippets/approval-block.md}}
|
|
1009
|
-
`,
|
|
1009
|
+
`,gl=`---
|
|
1010
1010
|
id: threat-model
|
|
1011
1011
|
title: Cybersecurity Threat Model
|
|
1012
1012
|
standard: FDA Cybersecurity Guidance 2023
|
|
@@ -1106,7 +1106,7 @@ _[TODO: List any threats without security controls and provide residual risk jus
|
|
|
1106
1106
|
{{include:shared/snippets/approval-block.md}}
|
|
1107
1107
|
|
|
1108
1108
|
{{include:shared/snippets/references-section.md}}
|
|
1109
|
-
`,
|
|
1109
|
+
`,xl=`---
|
|
1110
1110
|
id: vuln-assessment
|
|
1111
1111
|
title: Vulnerability Assessment and Penetration Testing Report
|
|
1112
1112
|
standard: FDA Cybersecurity Guidance 2023
|
|
@@ -1184,7 +1184,7 @@ _[TODO: Document any accepted residual vulnerabilities with justification]_
|
|
|
1184
1184
|
{{include:shared/snippets/revision-history-table.md}}
|
|
1185
1185
|
|
|
1186
1186
|
{{include:shared/snippets/approval-block.md}}
|
|
1187
|
-
`,
|
|
1187
|
+
`,bl=`---
|
|
1188
1188
|
id: hrs
|
|
1189
1189
|
title: Hardware Requirements Specification
|
|
1190
1190
|
standard: IEC 60601-1:2005+AMD1:2012+AMD2:2020
|
|
@@ -1354,7 +1354,7 @@ empty: "No allocations defined."
|
|
|
1354
1354
|
{{include:shared/snippets/approval-block.md}}
|
|
1355
1355
|
|
|
1356
1356
|
{{include:shared/snippets/references-section.md}}
|
|
1357
|
-
`,
|
|
1357
|
+
`,vl=`---
|
|
1358
1358
|
id: change-control
|
|
1359
1359
|
title: Software Change Control Log
|
|
1360
1360
|
standard: IEC 62304:2006+AMD1:2015
|
|
@@ -1394,7 +1394,7 @@ All changes must:
|
|
|
1394
1394
|
---
|
|
1395
1395
|
|
|
1396
1396
|
{{include:shared/snippets/revision-history-table.md}}
|
|
1397
|
-
`,
|
|
1397
|
+
`,wl=`---
|
|
1398
1398
|
id: detailed-design
|
|
1399
1399
|
title: Software Detailed Design
|
|
1400
1400
|
standard: IEC 62304:2006+AMD1:2015
|
|
@@ -1463,7 +1463,7 @@ _[TODO: List criteria that verify this design meets software requirements]_
|
|
|
1463
1463
|
{{include:shared/snippets/revision-history-table.md}}
|
|
1464
1464
|
|
|
1465
1465
|
{{include:shared/snippets/approval-block.md}}
|
|
1466
|
-
`,
|
|
1466
|
+
`,kl=`---
|
|
1467
1467
|
id: integration-test
|
|
1468
1468
|
title: Software Integration Test Plan
|
|
1469
1469
|
standard: IEC 62304:2006+AMD1:2015
|
|
@@ -1531,7 +1531,7 @@ _[TODO: Define objective pass/fail criteria for integration tests]_
|
|
|
1531
1531
|
{{include:shared/snippets/revision-history-table.md}}
|
|
1532
1532
|
|
|
1533
1533
|
{{include:shared/snippets/approval-block.md}}
|
|
1534
|
-
`,
|
|
1534
|
+
`,Sl=`---
|
|
1535
1535
|
id: sad
|
|
1536
1536
|
title: Software Architecture Description
|
|
1537
1537
|
standard: IEC 62304:2006+AMD1:2015
|
|
@@ -1647,7 +1647,7 @@ _[TODO: Describe how safety-critical software items are segregated from non-safe
|
|
|
1647
1647
|
{{include:shared/snippets/approval-block.md}}
|
|
1648
1648
|
|
|
1649
1649
|
{{include:shared/snippets/references-section.md}}
|
|
1650
|
-
`,
|
|
1650
|
+
`,Cl=`---
|
|
1651
1651
|
id: sbom
|
|
1652
1652
|
title: Software Bill of Materials (SBOM)
|
|
1653
1653
|
standard: IEC 62304:2006+AMD1:2015
|
|
@@ -1715,7 +1715,7 @@ _[TODO: Reference FDA cybersecurity submission or security assessment]_
|
|
|
1715
1715
|
{{include:shared/snippets/revision-history-table.md}}
|
|
1716
1716
|
|
|
1717
1717
|
{{include:shared/snippets/approval-block.md}}
|
|
1718
|
-
`,
|
|
1718
|
+
`,El=`---
|
|
1719
1719
|
id: sdp
|
|
1720
1720
|
title: Software Development Plan
|
|
1721
1721
|
standard: IEC 62304:2006+AMD1:2015
|
|
@@ -1824,7 +1824,7 @@ _[TODO: List development tools, compilers, IDEs, and their versions]_
|
|
|
1824
1824
|
{{include:shared/snippets/approval-block.md}}
|
|
1825
1825
|
|
|
1826
1826
|
{{include:shared/snippets/references-section.md}}
|
|
1827
|
-
`,
|
|
1827
|
+
`,jl=`---
|
|
1828
1828
|
id: soup
|
|
1829
1829
|
title: SOUP List (Software of Unknown Provenance)
|
|
1830
1830
|
standard: IEC 62304:2006+AMD1:2015
|
|
@@ -1903,7 +1903,7 @@ _[TODO: Reference Software Bill of Materials (SBOM) for FDA cybersecurity requir
|
|
|
1903
1903
|
{{include:shared/snippets/approval-block.md}}
|
|
1904
1904
|
|
|
1905
1905
|
{{include:shared/snippets/references-section.md}}
|
|
1906
|
-
`,
|
|
1906
|
+
`,Dl=`---
|
|
1907
1907
|
id: srs
|
|
1908
1908
|
title: Software Requirements Specification
|
|
1909
1909
|
standard: IEC 62304:2006+AMD1:2015
|
|
@@ -2075,7 +2075,7 @@ empty: "No software requirements are linked to a verification case. Add Verified
|
|
|
2075
2075
|
{{include:shared/snippets/approval-block.md}}
|
|
2076
2076
|
|
|
2077
2077
|
{{include:shared/snippets/references-section.md}}
|
|
2078
|
-
`,
|
|
2078
|
+
`,Bl=`---
|
|
2079
2079
|
id: sw-traceability
|
|
2080
2080
|
title: Software Traceability Matrix
|
|
2081
2081
|
standard: IEC 62304:2006+AMD1:2015
|
|
@@ -2186,7 +2186,7 @@ _[TODO: List any software requirements without corresponding test cases]_
|
|
|
2186
2186
|
{{include:shared/snippets/revision-history-table.md}}
|
|
2187
2187
|
|
|
2188
2188
|
{{include:shared/snippets/approval-block.md}}
|
|
2189
|
-
`,
|
|
2189
|
+
`,Fl=`---
|
|
2190
2190
|
id: system-test
|
|
2191
2191
|
title: Software System Test Plan
|
|
2192
2192
|
standard: IEC 62304:2006+AMD1:2015
|
|
@@ -2253,7 +2253,7 @@ _[TODO: Describe how test failures and anomalies are documented and tracked]_
|
|
|
2253
2253
|
{{include:shared/snippets/revision-history-table.md}}
|
|
2254
2254
|
|
|
2255
2255
|
{{include:shared/snippets/approval-block.md}}
|
|
2256
|
-
`,
|
|
2256
|
+
`,Al=`---
|
|
2257
2257
|
id: formative-eval
|
|
2258
2258
|
title: Formative Usability Evaluation Report
|
|
2259
2259
|
standard: IEC 62366-1:2015+AMD1:2020
|
|
@@ -2300,7 +2300,7 @@ _[TODO: Summarize user interface design changes made as a result of formative ev
|
|
|
2300
2300
|
{{include:shared/snippets/revision-history-table.md}}
|
|
2301
2301
|
|
|
2302
2302
|
{{include:shared/snippets/approval-block.md}}
|
|
2303
|
-
`,
|
|
2303
|
+
`,Nl=`---
|
|
2304
2304
|
id: summative-eval
|
|
2305
2305
|
title: Summative Usability Evaluation Report
|
|
2306
2306
|
standard: IEC 62366-1:2015+AMD1:2020
|
|
@@ -2369,7 +2369,7 @@ _[TODO: State whether the device passed summative usability evaluation]_
|
|
|
2369
2369
|
{{include:shared/snippets/revision-history-table.md}}
|
|
2370
2370
|
|
|
2371
2371
|
{{include:shared/snippets/approval-block.md}}
|
|
2372
|
-
`,
|
|
2372
|
+
`,Tl=`---
|
|
2373
2373
|
id: task-analysis
|
|
2374
2374
|
title: Task Analysis
|
|
2375
2375
|
standard: IEC 62366-1:2015+AMD1:2020
|
|
@@ -2462,7 +2462,7 @@ _[TODO: Document sequential and parallel task flows with decision points]_
|
|
|
2462
2462
|
---
|
|
2463
2463
|
|
|
2464
2464
|
{{include:shared/snippets/revision-history-table.md}}
|
|
2465
|
-
`,
|
|
2465
|
+
`,Rl=`---
|
|
2466
2466
|
id: ue-plan
|
|
2467
2467
|
title: Usability Engineering Plan
|
|
2468
2468
|
standard: IEC 62366-1:2015+AMD1:2020
|
|
@@ -2543,7 +2543,7 @@ empty: "No UserInterface elements defined."
|
|
|
2543
2543
|
{{include:shared/snippets/approval-block.md}}
|
|
2544
2544
|
|
|
2545
2545
|
{{include:shared/snippets/references-section.md}}
|
|
2546
|
-
`,
|
|
2546
|
+
`,Il=`---
|
|
2547
2547
|
id: ui-spec
|
|
2548
2548
|
title: User Interface Specification
|
|
2549
2549
|
standard: IEC 62366-1:2015+AMD1:2020
|
|
@@ -2604,7 +2604,7 @@ _[TODO: Document all labels, symbols, and icons used on the physical device]_
|
|
|
2604
2604
|
{{include:shared/snippets/revision-history-table.md}}
|
|
2605
2605
|
|
|
2606
2606
|
{{include:shared/snippets/approval-block.md}}
|
|
2607
|
-
`,
|
|
2607
|
+
`,Ml=`---
|
|
2608
2608
|
id: urra
|
|
2609
2609
|
title: Use-Related Risk Analysis
|
|
2610
2610
|
standard: IEC 62366-1:2015+AMD1:2020
|
|
@@ -2678,7 +2678,7 @@ empty: "No usability-related risk controls defined."
|
|
|
2678
2678
|
{{include:shared/snippets/revision-history-table.md}}
|
|
2679
2679
|
|
|
2680
2680
|
{{include:shared/snippets/approval-block.md}}
|
|
2681
|
-
`,
|
|
2681
|
+
`,_l=`---
|
|
2682
2682
|
id: use-spec
|
|
2683
2683
|
title: Intended Use and Indications for Use Specification
|
|
2684
2684
|
standard: IEC 62366-1:2015+AMD1:2020
|
|
@@ -2739,7 +2739,7 @@ _[TODO: Describe contraindications, limitations, and warnings that constrain use
|
|
|
2739
2739
|
{{include:shared/snippets/revision-history-table.md}}
|
|
2740
2740
|
|
|
2741
2741
|
{{include:shared/snippets/approval-block.md}}
|
|
2742
|
-
`,
|
|
2742
|
+
`,Pl=`---
|
|
2743
2743
|
id: fmea
|
|
2744
2744
|
title: Failure Mode and Effects Analysis
|
|
2745
2745
|
standard: IEC 60812:2018
|
|
@@ -2855,7 +2855,7 @@ _[TODO: List any failure modes without risk controls and justify residual risk p
|
|
|
2855
2855
|
{{include:shared/snippets/revision-history-table.md}}
|
|
2856
2856
|
|
|
2857
2857
|
{{include:shared/snippets/approval-block.md}}
|
|
2858
|
-
`,
|
|
2858
|
+
`,Ol=`---
|
|
2859
2859
|
id: fta
|
|
2860
2860
|
title: Fault Tree Analysis
|
|
2861
2861
|
standard: ISO 14971:2019
|
|
@@ -2925,7 +2925,7 @@ _[TODO: List minimal cut sets and associated risk reduction recommendations]_
|
|
|
2925
2925
|
{{include:shared/snippets/revision-history-table.md}}
|
|
2926
2926
|
|
|
2927
2927
|
{{include:shared/snippets/approval-block.md}}
|
|
2928
|
-
`,
|
|
2928
|
+
`,zl=`---
|
|
2929
2929
|
id: har
|
|
2930
2930
|
title: Hazard Analysis Report
|
|
2931
2931
|
standard: ISO 14971:2019
|
|
@@ -3090,7 +3090,7 @@ _[TODO: Document benefit-risk justification if any residual risks remain]_
|
|
|
3090
3090
|
{{include:shared/snippets/approval-block.md}}
|
|
3091
3091
|
|
|
3092
3092
|
{{include:shared/snippets/references-section.md}}
|
|
3093
|
-
`,
|
|
3093
|
+
`,Ul=`---
|
|
3094
3094
|
id: risk-benefit
|
|
3095
3095
|
title: Risk-Benefit Analysis
|
|
3096
3096
|
standard: ISO 14971:2019
|
|
@@ -3141,7 +3141,7 @@ _[TODO: State the conclusion: the medical benefits of the intended use outweigh
|
|
|
3141
3141
|
{{include:shared/snippets/revision-history-table.md}}
|
|
3142
3142
|
|
|
3143
3143
|
{{include:shared/snippets/approval-block.md}}
|
|
3144
|
-
`,
|
|
3144
|
+
`,Ll=`---
|
|
3145
3145
|
id: risk-matrix
|
|
3146
3146
|
title: Risk Matrix
|
|
3147
3147
|
standard: ISO 14971:2019
|
|
@@ -3192,7 +3192,7 @@ empty: "No risk controls defined."
|
|
|
3192
3192
|
---
|
|
3193
3193
|
|
|
3194
3194
|
{{include:shared/snippets/revision-history-table.md}}
|
|
3195
|
-
`,
|
|
3195
|
+
`,ql=`---
|
|
3196
3196
|
id: rmp
|
|
3197
3197
|
title: Risk Management Plan
|
|
3198
3198
|
standard: ISO 14971:2019
|
|
@@ -3361,7 +3361,7 @@ This plan shall be reviewed:
|
|
|
3361
3361
|
{{include:shared/snippets/approval-block.md}}
|
|
3362
3362
|
|
|
3363
3363
|
{{include:shared/snippets/references-section.md}}
|
|
3364
|
-
|
|
3364
|
+
`,$l=`---
|
|
3365
3365
|
id: rmr
|
|
3366
3366
|
title: Risk Management Report
|
|
3367
3367
|
standard: ISO 14971:2019
|
|
@@ -3462,7 +3462,7 @@ Post-production information collection activities are documented in the Post-Mar
|
|
|
3462
3462
|
{{include:shared/snippets/approval-block.md}}
|
|
3463
3463
|
|
|
3464
3464
|
{{include:shared/snippets/references-section.md}}
|
|
3465
|
-
`,
|
|
3465
|
+
`,Vl=`---
|
|
3466
3466
|
id: approval-block
|
|
3467
3467
|
title: Approval Block
|
|
3468
3468
|
---
|
|
@@ -3478,7 +3478,7 @@ This document has been reviewed and approved by the following personnel:
|
|
|
3478
3478
|
| | Engineering Lead | | |
|
|
3479
3479
|
| | Clinical Affairs | | |
|
|
3480
3480
|
|
|
3481
|
-
`,
|
|
3481
|
+
`,Wl=`---
|
|
3482
3482
|
id: document-control-header
|
|
3483
3483
|
title: Document Control Header
|
|
3484
3484
|
---
|
|
@@ -3493,7 +3493,7 @@ title: Document Control Header
|
|
|
3493
3493
|
| **Date** | — |
|
|
3494
3494
|
| **Confidentiality** | Confidential — {{project.company}} |
|
|
3495
3495
|
|
|
3496
|
-
`,
|
|
3496
|
+
`,Hl=`---
|
|
3497
3497
|
id: references-section
|
|
3498
3498
|
title: References
|
|
3499
3499
|
---
|
|
@@ -3509,7 +3509,7 @@ title: References
|
|
|
3509
3509
|
| 21 CFR Part 820 | Quality System Regulation |
|
|
3510
3510
|
| IEC 81001-5-1:2021 | Health software and health IT systems safety, effectiveness and security |
|
|
3511
3511
|
|
|
3512
|
-
`,
|
|
3512
|
+
`,Kl=`---
|
|
3513
3513
|
id: revision-history-table
|
|
3514
3514
|
title: Revision History Table
|
|
3515
3515
|
---
|
|
@@ -3520,7 +3520,7 @@ title: Revision History Table
|
|
|
3520
3520
|
| --- | --- | --- | --- |
|
|
3521
3521
|
| 1.0 | {{project.version}} | {{project.authors}} | Initial release |
|
|
3522
3522
|
|
|
3523
|
-
`,
|
|
3523
|
+
`,Gl=`---
|
|
3524
3524
|
id: sad-system
|
|
3525
3525
|
title: System Architecture Description
|
|
3526
3526
|
standard: ISO/IEC/IEEE 42010:2022
|
|
@@ -3693,7 +3693,7 @@ empty: "No IEC 60601-1 compliance traces defined."
|
|
|
3693
3693
|
{{include:shared/snippets/approval-block.md}}
|
|
3694
3694
|
|
|
3695
3695
|
{{include:shared/snippets/references-section.md}}
|
|
3696
|
-
`,
|
|
3696
|
+
`,Yl=`---
|
|
3697
3697
|
id: standards-checklist
|
|
3698
3698
|
title: Standards Conformance Checklist
|
|
3699
3699
|
standard: ISO 13485:2016
|
|
@@ -3780,7 +3780,7 @@ empty: "No open gaps — every required clause is claimed."
|
|
|
3780
3780
|
{{include:shared/snippets/approval-block.md}}
|
|
3781
3781
|
|
|
3782
3782
|
{{include:shared/snippets/references-section.md}}
|
|
3783
|
-
`,
|
|
3783
|
+
`,Jl=`---
|
|
3784
3784
|
id: standards-traceability
|
|
3785
3785
|
title: Standards Traceability Matrix
|
|
3786
3786
|
standard: ISO 13485:2016
|
|
@@ -3905,7 +3905,7 @@ empty: "No standard clauses declared. Add StandardClause instances for the claus
|
|
|
3905
3905
|
{{include:shared/snippets/approval-block.md}}
|
|
3906
3906
|
|
|
3907
3907
|
{{include:shared/snippets/references-section.md}}
|
|
3908
|
-
|
|
3908
|
+
`,Xl=`---
|
|
3909
3909
|
id: syrs
|
|
3910
3910
|
title: System Requirements Specification
|
|
3911
3911
|
standard: IEC 60601-1:2005+AMD1:2012+AMD2:2020
|
|
@@ -4033,35 +4033,35 @@ empty: "No risk controls defined."
|
|
|
4033
4033
|
{{include:shared/snippets/approval-block.md}}
|
|
4034
4034
|
|
|
4035
4035
|
{{include:shared/snippets/references-section.md}}
|
|
4036
|
-
`,Vl=Object.assign({"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/21cfr820/change-record.md":Yi,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/21cfr820/design-input.md":Ji,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/21cfr820/design-output.md":Xi,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/21cfr820/design-review.md":Qi,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/21cfr820/design-validation.md":Zi,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/21cfr820/design-verification.md":el,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/21cfr820/dhf-index.md":tl,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/21cfr820/transfer-plan.md":nl,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/21cfr820/user-needs.md":rl,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/21cfr820/vv-plan.md":ol,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/21cfr820/vv-report.md":al,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/fda-cybersecurity/incident-response.md":sl,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/fda-cybersecurity/postmarket-surveillance.md":il,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/fda-cybersecurity/security-arch.md":ll,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/fda-cybersecurity/threat-model.md":dl,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/fda-cybersecurity/vuln-assessment.md":cl,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/iec-60601/hrs.md":ul,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/iec-62304/change-control.md":pl,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/iec-62304/detailed-design.md":ml,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/iec-62304/integration-test.md":fl,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/iec-62304/sad.md":hl,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/iec-62304/sbom.md":yl,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/iec-62304/sdp.md":gl,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/iec-62304/soup.md":xl,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/iec-62304/srs.md":bl,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/iec-62304/sw-traceability.md":vl,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/iec-62304/system-test.md":wl,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/iec-62366/formative-eval.md":kl,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/iec-62366/summative-eval.md":Sl,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/iec-62366/task-analysis.md":El,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/iec-62366/ue-plan.md":Cl,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/iec-62366/ui-spec.md":jl,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/iec-62366/urra.md":Dl,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/iec-62366/use-spec.md":Bl,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/iso-14971/fmea.md":Fl,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/iso-14971/fta.md":Al,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/iso-14971/har.md":Nl,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/iso-14971/risk-benefit.md":Tl,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/iso-14971/risk-matrix.md":Rl,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/iso-14971/rmp.md":Il,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/iso-14971/rmr.md":Ml,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/shared/snippets/approval-block.md":_l,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/shared/snippets/document-control-header.md":Pl,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/shared/snippets/references-section.md":Ol,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/shared/snippets/revision-history-table.md":zl,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/system/sad.md":Ul,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/system/standards-checklist.md":Ll,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/system/standards-traceability.md":ql,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/system/syrs.md":$l}),vt={};for(const[e,r]of Object.entries(Vl)){const n=e.match(/templates\/dhf\/(.+)\.md$/);n&&(vt[n[1]]=r)}Object.keys(vt).length;function Wl(e){const r=e.match(/^---\r?\n([\s\S]*?)\r?\n---/);return r?r[1]:""}function xr(e,r){const n=e.match(new RegExp(`^${r}:\\s*(.+)$`,"m"));if(n)return n[1].trim().replace(/^["']|["']$/g,"")||void 0}function Hl(e,r){const n=e.match(new RegExp(`^${r}:\\s*\\[(.*)\\]$`,"m"));return n?n[1].split(",").map(o=>o.trim().replace(/^["']|["']$/g,"")).filter(Boolean):[]}function Kl(){const e=[];for(const[r,n]of Object.entries(vt)){const o=r.indexOf("/");if(o<0)continue;const a=r.slice(0,o);if(a==="shared")continue;const s=Wl(n);e.push({id:r,directory:a,title:xr(s,"title"),standard:xr(s,"standard"),clauses:Hl(s,"clauses")})}return e.sort((r,n)=>r.id.localeCompare(n.id))}function Gl(e){return e.replace(/^---[\s\S]*?---\n?/,"")}function ko(e){return e.replace(/\{\{include:([^}]+)\}\}/g,(r,n)=>{const o=n.replace(/\.md$/,""),a=vt[o];return a?ko(Gl(a)):`<!-- [include: ${n} — not found] -->`})}function Yl(e){const r=vt[e];return r?ko(r):null}const jn="#6B7280",br=["#dc2626","#2563eb","#7c3aed","#0891b2","#0d9488","#4f46e5","#059669","#b45309","#d97706"];function Jl(e){let r=0;for(let n=0;n<e.length;n++)r=r*31+e.charCodeAt(n)>>>0;return br[r%br.length]}function Xl(e,r){const n=new Map;for(const s of r)n.set(s,(n.get(s)??0)+1);const o=[...n.entries()].sort((s,i)=>i[1]-s[1]);return o.length===1||o.length>1&&o[0][1]>o[1][1]?o[0][0].split(":")[0].trim():e.split("-").map(s=>s.charAt(0).toUpperCase()+s.slice(1)).join(" ")}function dt(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"}function Ql(){const e=new Map;for(const r of Kl()){e.has(r.directory)||e.set(r.directory,{designations:[],templates:[]});const n=e.get(r.directory);r.standard&&n.designations.push(r.standard);const o=r.title??r.id.slice(r.id.indexOf("/")+1);n.templates.push({id:r.id,title:o,prefix:dt(o)})}return[...e.entries()].sort(([r],[n])=>r.localeCompare(n)).map(([r,{designations:n,templates:o}])=>({id:r,label:Xl(r,n),color:Jl(r),templates:o.sort((a,s)=>a.title.localeCompare(s.title))}))}const He=Ql();function Zl(e){var r;return((r=He.find(n=>n.label===e))==null?void 0:r.color)??jn}const ed={position:"fixed",inset:0,zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(0,0,0,0.4)"},td={background:"#fff",borderRadius:"12px",padding:"20px",width:"460px",maxHeight:"560px",display:"flex",flexDirection:"column",boxShadow:"0 20px 60px rgba(0,0,0,0.2)"},vr=["Category","Template","Confirm"];function cn(e,r=1e4){const{registerLlmRequest:n}=E.getState(),o=`dhf-${Date.now()}-${Math.random().toString(36).slice(2)}`;return new Promise((a,s)=>{n(o,a,s),e(o),setTimeout(()=>s(new Error("Request timed out.")),r)})}function nd({initialGroupId:e,existingDocs:r,numberingPrefix:n,onCreate:o,onClose:a}){const s=E(F=>F.connected),i=He.find(F=>F.id===e)??null,[l,c]=p.useState(i?1:0),[d,u]=p.useState(i),[m,b]=p.useState(""),[w,S]=p.useState({builtIn:new Set,repo:new Set,blank:!1}),[g,h]=p.useState("Untitled Document"),[y,B]=p.useState(null),[O,D]=p.useState(null),[R,A]=p.useState(!1),[v,k]=p.useState(""),[j,P]=p.useState(""),[N,M]=p.useState({}),[L,C]=p.useState(!1),[z,$]=p.useState(null),[U,G]=p.useState(""),H=E(F=>F.model),X=E(F=>F.availableOntologies),Y=p.useMemo(()=>{const F=vo(X);return Object.values((H==null?void 0:H.elements)??{}).filter(W=>Ot(W.kind,F)).sort((W,K)=>(W.name||W.id).localeCompare(K.name||K.id))},[H,X]),se=d===null&&l>0?m.trim()||"Other":(d==null?void 0:d.label)??"",I=(d==null?void 0:d.color)??jn;p.useEffect(()=>{l!==1||y!==null||!s||cn(F=>Hs(F)).then(B).catch(F=>D((F==null?void 0:F.message)??"Could not list repository files."))},[l,y,s]);const x=p.useMemo(()=>{const F=[];for(const W of(d==null?void 0:d.templates)??[])w.builtIn.has(W.id)&&F.push({key:W.id,defaultTitle:W.title,prefix:W.prefix,templateId:W.id});for(const W of w.repo){const K=y==null?void 0:y.find(le=>le.path===W),Q=(K==null?void 0:K.title)??W.split("/").pop().replace(/\.md$/,"");F.push({key:`repo:${W}`,defaultTitle:Q,prefix:dt(Q),templateId:`repo:${W}`})}if(w.blank&&F.push({key:"blank",defaultTitle:g.trim()||"Untitled Document",prefix:dt(g),templateId:"blank"}),R&&v.trim()){const W=v.trim();F.push({key:"new-template",defaultTitle:W,prefix:dt(W),templateId:"new-template"})}return F},[w,d,y,g,R,v]),_=F=>N[F.key]??F.defaultTitle,q=F=>F.templateId==="blank"||F.templateId==="new-template"||F.templateId.startsWith("repo:")?dt(_(F)):F.prefix,J=p.useMemo(()=>{const F=new Map;return x.map(W=>{const K=`${n}-${q(W)}-`,Q=r.filter(re=>re.id.startsWith(K)).length,le=F.get(K)??0;return F.set(K,le+1),`${K}${String(Q+le+1).padStart(3,"0")}`})},[x,N,r,n]);async function ie(){C(!0),$(null);try{const F=[];for(const W of x){let K=null;if(W.templateId.startsWith("repo:"))K=await cn(Q=>Ks(Q,W.templateId.slice(5)));else if(W.templateId==="new-template"){const Q=j.trim()||`# ${_(W)}
|
|
4036
|
+
`,Ql=Object.assign({"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/21cfr820/change-record.md":rl,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/21cfr820/design-input.md":ol,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/21cfr820/design-output.md":al,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/21cfr820/design-review.md":sl,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/21cfr820/design-validation.md":il,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/21cfr820/design-verification.md":ll,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/21cfr820/dhf-index.md":dl,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/21cfr820/transfer-plan.md":cl,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/21cfr820/user-needs.md":ul,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/21cfr820/vv-plan.md":pl,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/21cfr820/vv-report.md":ml,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/fda-cybersecurity/incident-response.md":fl,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/fda-cybersecurity/postmarket-surveillance.md":hl,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/fda-cybersecurity/security-arch.md":yl,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/fda-cybersecurity/threat-model.md":gl,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/fda-cybersecurity/vuln-assessment.md":xl,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/iec-60601/hrs.md":bl,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/iec-62304/change-control.md":vl,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/iec-62304/detailed-design.md":wl,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/iec-62304/integration-test.md":kl,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/iec-62304/sad.md":Sl,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/iec-62304/sbom.md":Cl,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/iec-62304/sdp.md":El,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/iec-62304/soup.md":jl,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/iec-62304/srs.md":Dl,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/iec-62304/sw-traceability.md":Bl,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/iec-62304/system-test.md":Fl,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/iec-62366/formative-eval.md":Al,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/iec-62366/summative-eval.md":Nl,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/iec-62366/task-analysis.md":Tl,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/iec-62366/ue-plan.md":Rl,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/iec-62366/ui-spec.md":Il,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/iec-62366/urra.md":Ml,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/iec-62366/use-spec.md":_l,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/iso-14971/fmea.md":Pl,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/iso-14971/fta.md":Ol,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/iso-14971/har.md":zl,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/iso-14971/risk-benefit.md":Ul,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/iso-14971/risk-matrix.md":Ll,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/iso-14971/rmp.md":ql,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/iso-14971/rmr.md":$l,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/shared/snippets/approval-block.md":Vl,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/shared/snippets/document-control-header.md":Wl,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/shared/snippets/references-section.md":Hl,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/shared/snippets/revision-history-table.md":Kl,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/system/sad.md":Gl,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/system/standards-checklist.md":Yl,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/system/standards-traceability.md":Jl,"../../../../node_modules/@memoarchitect/ontology/src/artifacts/templates/dhf/system/syrs.md":Xl}),wt={};for(const[e,r]of Object.entries(Ql)){const n=e.match(/templates\/dhf\/(.+)\.md$/);n&&(wt[n[1]]=r)}Object.keys(wt).length;function Zl(e){const r=e.match(/^---\r?\n([\s\S]*?)\r?\n---/);return r?r[1]:""}function Sr(e,r){const n=e.match(new RegExp(`^${r}:\\s*(.+)$`,"m"));if(n)return n[1].trim().replace(/^["']|["']$/g,"")||void 0}function ed(e,r){const n=e.match(new RegExp(`^${r}:\\s*\\[(.*)\\]$`,"m"));return n?n[1].split(",").map(o=>o.trim().replace(/^["']|["']$/g,"")).filter(Boolean):[]}function td(){const e=[];for(const[r,n]of Object.entries(wt)){const o=r.indexOf("/");if(o<0)continue;const a=r.slice(0,o);if(a==="shared")continue;const s=Zl(n);e.push({id:r,directory:a,title:Sr(s,"title"),standard:Sr(s,"standard"),clauses:ed(s,"clauses")})}return e.sort((r,n)=>r.id.localeCompare(n.id))}function nd(e){return e.replace(/^---[\s\S]*?---\n?/,"")}function Do(e){return e.replace(/\{\{include:([^}]+)\}\}/g,(r,n)=>{const o=n.replace(/\.md$/,""),a=wt[o];return a?Do(nd(a)):`<!-- [include: ${n} — not found] -->`})}function rd(e){const r=wt[e];return r?Do(r):null}const Dn="#6B7280",Cr=["#dc2626","#2563eb","#7c3aed","#0891b2","#0d9488","#4f46e5","#059669","#b45309","#d97706"];function od(e){let r=0;for(let n=0;n<e.length;n++)r=r*31+e.charCodeAt(n)>>>0;return Cr[r%Cr.length]}function ad(e,r){const n=new Map;for(const s of r)n.set(s,(n.get(s)??0)+1);const o=[...n.entries()].sort((s,i)=>i[1]-s[1]);return o.length===1||o.length>1&&o[0][1]>o[1][1]?o[0][0].split(":")[0].trim():e.split("-").map(s=>s.charAt(0).toUpperCase()+s.slice(1)).join(" ")}function dt(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"}function sd(){const e=new Map;for(const r of td()){e.has(r.directory)||e.set(r.directory,{designations:[],templates:[]});const n=e.get(r.directory);r.standard&&n.designations.push(r.standard);const o=r.title??r.id.slice(r.id.indexOf("/")+1);n.templates.push({id:r.id,title:o,prefix:dt(o)})}return[...e.entries()].sort(([r],[n])=>r.localeCompare(n)).map(([r,{designations:n,templates:o}])=>({id:r,label:ad(r,n),color:od(r),templates:o.sort((a,s)=>a.title.localeCompare(s.title))}))}const Ke=sd();function id(e){var r;return((r=Ke.find(n=>n.label===e))==null?void 0:r.color)??Dn}const ld={position:"fixed",inset:0,zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(0,0,0,0.4)"},dd={background:"#fff",borderRadius:"12px",padding:"20px",width:"460px",maxHeight:"560px",display:"flex",flexDirection:"column",boxShadow:"0 20px 60px rgba(0,0,0,0.2)"},Er=["Category","Template","Confirm"];function mn(e,r=1e4){const{registerLlmRequest:n}=S.getState(),o=`dhf-${Date.now()}-${Math.random().toString(36).slice(2)}`;return new Promise((a,s)=>{n(o,a,s),e(o),setTimeout(()=>s(new Error("Request timed out.")),r)})}function cd({initialGroupId:e,existingDocs:r,numberingPrefix:n,onCreate:o,onClose:a}){const s=S(R=>R.connected),i=Ke.find(R=>R.id===e)??null,[l,c]=p.useState(i?1:0),[d,u]=p.useState(i),[m,b]=p.useState(""),[v,w]=p.useState({builtIn:new Set,repo:new Set,blank:!1}),[g,h]=p.useState("Untitled Document"),[y,B]=p.useState(null),[N,D]=p.useState(null),[A,F]=p.useState(!1),[C,k]=p.useState(""),[T,z]=p.useState(""),[_,j]=p.useState({}),[L,E]=p.useState(!1),[O,V]=p.useState(null),[U,$]=p.useState(""),K=S(R=>R.model),J=S(R=>R.availableOntologies),Y=p.useMemo(()=>{const R=Eo(J);return Object.values((K==null?void 0:K.elements)??{}).filter(H=>Ut(H.kind,R)).sort((H,G)=>(H.name||H.id).localeCompare(G.name||G.id))},[K,J]),ee=d===null&&l>0?m.trim()||"Other":(d==null?void 0:d.label)??"",M=(d==null?void 0:d.color)??Dn;p.useEffect(()=>{l!==1||y!==null||!s||mn(R=>Xs(R)).then(B).catch(R=>D((R==null?void 0:R.message)??"Could not list repository files."))},[l,y,s]);const x=p.useMemo(()=>{const R=[];for(const H of(d==null?void 0:d.templates)??[])v.builtIn.has(H.id)&&R.push({key:H.id,defaultTitle:H.title,prefix:H.prefix,templateId:H.id});for(const H of v.repo){const G=y==null?void 0:y.find(le=>le.path===H),Z=(G==null?void 0:G.title)??H.split("/").pop().replace(/\.md$/,"");R.push({key:`repo:${H}`,defaultTitle:Z,prefix:dt(Z),templateId:`repo:${H}`})}if(v.blank&&R.push({key:"blank",defaultTitle:g.trim()||"Untitled Document",prefix:dt(g),templateId:"blank"}),A&&C.trim()){const H=C.trim();R.push({key:"new-template",defaultTitle:H,prefix:dt(H),templateId:"new-template"})}return R},[v,d,y,g,A,C]),P=R=>_[R.key]??R.defaultTitle,q=R=>R.templateId==="blank"||R.templateId==="new-template"||R.templateId.startsWith("repo:")?dt(P(R)):R.prefix,X=p.useMemo(()=>{const R=new Map;return x.map(H=>{const G=`${n}-${q(H)}-`,Z=r.filter(ae=>ae.id.startsWith(G)).length,le=R.get(G)??0;return R.set(G,le+1),`${G}${String(Z+le+1).padStart(3,"0")}`})},[x,_,r,n]);async function ie(){E(!0),V(null);try{const R=[];for(const H of x){let G=null;if(H.templateId.startsWith("repo:"))G=await mn(Z=>Qs(Z,H.templateId.slice(5)));else if(H.templateId==="new-template"){const Z=T.trim()||`# ${P(H)}
|
|
4037
4037
|
|
|
4038
4038
|
_[TODO: Add template content]_
|
|
4039
|
-
`,le=await
|
|
4039
|
+
`,le=await mn(ae=>Zs(ae,P(H),Z));R.push({title:P(H),prefix:q(H),templateId:`repo:${le.path}`,groupLabel:ee,systemId:U||void 0,content:Z});continue}else H.templateId==="blank"&&(G=`# ${P(H)}
|
|
4040
4040
|
|
|
4041
4041
|
_[TODO: Add content]_
|
|
4042
|
-
`);F.push({title:_(W),prefix:q(W),templateId:W.templateId,groupLabel:se,systemId:U||void 0,content:K})}o(F)}catch(F){$((F==null?void 0:F.message)??"Could not read template."),C(!1)}}const ne=l===0?!0:l===1?x.length>0:x.length>0&&!L;return t.jsx("div",{style:ed,onClick:F=>{F.target===F.currentTarget&&a()},children:t.jsxs("div",{style:td,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:vr.map((F,W)=>t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"5px",fontSize:"11px",fontWeight:W===l?700:500,color:W===l?"#1B3A4B":W<l?"#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:W===l?"#1B3A4B":W<l?"#059669":"#D1D5DB"},children:W<l?"✓":W+1}),F,W<vr.length-1&&t.jsx("span",{style:{color:"#D1D5DB"},children:"—"})]},F))}),l===0&&t.jsxs("div",{style:{flex:1,overflowY:"auto",display:"flex",flexDirection:"column",gap:"4px"},children:[He.map(F=>t.jsx(wr,{label:F.label,color:F.color,detail:`${F.templates.length} meMO templates`,selected:(d==null?void 0:d.id)===F.id,onClick:()=>{u(F),S({builtIn:new Set,repo:new Set,blank:!1})}},F.id)),t.jsx(wr,{label:"Other",color:jn,detail:"Custom category — blank or repository template",selected:d===null&&m!=="",onClick:()=>{u(null),b(m||"Other"),S({builtIn:new Set,repo:new Set,blank:!1})}}),d===null&&m!==""&&t.jsx("input",{value:m,onChange:F=>b(F.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"}})]}),l===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:I,display:"inline-block"}}),t.jsx("strong",{style:{color:"#1B3A4B"},children:se}),t.jsx("span",{children:"— pick one or more sources"})]}),d&&d.templates.length>0&&t.jsx(un,{title:"meMO templates",hint:"Prefilled sections and model queries",children:d.templates.map(F=>t.jsx(Nt,{label:F.title,sub:F.id,color:I,checked:w.builtIn.has(F.id),onToggle:()=>S(W=>{const K=new Set(W.builtIn);return K.has(F.id)?K.delete(F.id):K.add(F.id),{...W,builtIn:K}})},F.id))}),t.jsx(un,{title:"Blank document",hint:"Start from an empty page",children:t.jsx(Nt,{label:w.blank?"":"Blank document",color:I,checked:w.blank,onToggle:()=>S(F=>({...F,blank:!F.blank})),children:w.blank&&t.jsx("input",{value:g,onChange:F=>h(F.target.value),onClick:F=>F.stopPropagation(),style:{flex:1,padding:"4px 8px",border:"1px solid #D1D5DB",borderRadius:"5px",fontSize:"12px",color:"#1B3A4B",outline:"none"}})})}),t.jsxs(un,{title:"Project templates",hint:"Reusable templates in dhf/templates/",children:[!s&&t.jsx(rt,{text:"Dev server not connected — project templates unavailable."}),s&&O&&t.jsx(rt,{text:O,error:!0}),s&&!O&&y===null&&t.jsx(rt,{text:"Loading project templates…"}),s&&(y==null?void 0:y.length)===0&&t.jsx(rt,{text:"No project templates yet."}),s&&(y==null?void 0:y.map(F=>t.jsx(Nt,{label:F.title,sub:F.path,color:I,checked:w.repo.has(F.path),onToggle:()=>S(W=>{const K=new Set(W.repo);return K.has(F.path)?K.delete(F.path):K.add(F.path),{...W,repo:K}})},F.path))),t.jsx(Nt,{label:"Add new template",sub:"Save and reuse in this project",color:I,checked:R,disabled:!s,disabledNote:s?void 0:"server unavailable",onToggle:()=>A(F=>!F)}),R&&t.jsxs("div",{style:{marginLeft:"22px",display:"flex",flexDirection:"column",gap:"6px"},children:[t.jsx("input",{value:v,onChange:F=>k(F.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:j,onChange:F=>P(F.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"}})]})]})]}),l===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:[x.length," document",x.length===1?"":"s"," will be created in",t.jsxs("strong",{style:{color:"#1B3A4B"},children:[" ",se]})," and saved to ",t.jsx("code",{style:{background:"#F3F4F6",padding:"0 4px",borderRadius:"3px",fontSize:"11px"},children:"dhf/documents/"}),":"]}),Y.length>0&&t.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"8px",fontSize:"12px",color:"#374151",marginBottom:"4px"},children:[t.jsx("span",{style:{whiteSpace:"nowrap"},children:"System"}),t.jsxs("select",{value:U,onChange:F=>G(F.target.value),style:{flex:1,padding:"5px 8px",border:"1px solid #E5E7EB",borderRadius:"5px",fontSize:"12px",color:"#1B3A4B",background:"#fff"},children:[t.jsx("option",{value:"",children:"Global — project-wide"}),Y.map(F=>t.jsx("option",{value:F.id,children:F.name||F.id},F.id))]})]}),x.map((F,W)=>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:I,whiteSpace:"nowrap"},children:J[W]}),t.jsx("input",{value:_(F),onChange:K=>M(Q=>({...Q,[F.key]:K.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:F.templateId==="blank"?"blank":F.templateId==="new-template"?"new template":F.templateId.startsWith("repo:")?"project":"meMO"})]},F.key)),z&&t.jsx(rt,{text:z,error:!0})]}),t.jsxs("div",{style:{display:"flex",gap:"8px",justifyContent:"flex-end",marginTop:"16px"},children:[l>0&&t.jsx("button",{onClick:()=>c(F=>F-1),disabled:L,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"}),l<2?t.jsx("button",{onClick:()=>c(F=>F+1),disabled:!ne,style:{padding:"7px 16px",borderRadius:"6px",border:"none",background:ne?"#1B3A4B":"#E5E7EB",color:ne?"#fff":"#9CA3AF",fontSize:"13px",fontWeight:600,cursor:ne?"pointer":"default"},children:"Next →"}):t.jsx("button",{onClick:ie,disabled:!ne,style:{padding:"7px 16px",borderRadius:"6px",border:"none",background:ne?I:"#E5E7EB",color:ne?"#fff":"#9CA3AF",fontSize:"13px",fontWeight:600,cursor:ne?"pointer":"default"},children:L?"Creating…":`Create ${x.length>0?`(${x.length})`:""}`})]})]})})}function wr({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 un({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 Nt({label:e,sub:r,color:n,checked:o,disabled:a,disabledNote:s,onToggle:i,children:l}){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&&i(),style:{accentColor:n}}),e&&t.jsx("span",{style:{fontSize:"13px",color:"#1B3A4B"},children:e}),l,r&&t.jsx("span",{style:{marginLeft:"auto",fontSize:"10px",fontFamily:"monospace",color:"#9CA3AF",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"180px"},children:r}),a&&s&&t.jsx("span",{style:{fontSize:"10px",color:"#9CA3AF"},children:s})]})}function rt({text:e,error:r}){return t.jsx("div",{style:{fontSize:"11px",color:r?"#DC2626":"#9CA3AF",fontStyle:"italic",padding:"4px 8px"},children:e})}const kr={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 rd(e){return e.length<=3?e.toUpperCase():(e[0]+e.slice(1).replace(/[aeiouAEIOU]/g,"")).slice(0,3).toUpperCase()}function od(e){if(kr[e])return kr[e];const r=e.replace(/([A-Z])/g," $1").trim().split(" ").filter(Boolean);return r.length===0?"EL":r.map(rd).join("-")}function ad(e){return e.split("-")[0]}function So(e){return`/catalog/${e.split("-")[0]}/${e}`}function sd(e){return`/catalog/${e}`}function Eo(e,r){return`/diagrams/${e.toLowerCase().replace(/\s+/g,"-")}/${encodeURIComponent(r)}`}const id=p.lazy(()=>de(()=>import("./ScenarioEditor-B_M819qh.js"),__vite__mapDeps([0,1,2])).then(e=>({default:e.ScenarioEditor})));function Ne({expanded:e,size:r=14,color:n=f.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 Sr(){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 ze({open:e,color:r=f.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 Wn({color:e=f.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"})]})}async function Ae(e){try{const r=await e;if(!r.success){window.alert(r.error??"The containment change was refused.");return}for(const n of r.warnings??[])window.alert(n.message)}catch(r){window.alert(r instanceof Error?r.message:String(r))}}function ld({elementId:e,currentKind:r,onClose:n}){const o=E(d=>d.updateElementKind),a=E(d=>d.model),[s,i]=p.useState(r),l=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,m)=>u.localeCompare(m))},[a]);return p.useEffect(()=>{const d=u=>{l.current&&!l.current.contains(u.target)&&n()};return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[n]),t.jsxs("div",{ref:l,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:s,onChange:d=>i(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,s),n()},className:"px-3 py-1.5 rounded font-medium",style:{fontSize:"12px",color:"#FFFFFF",background:"#2DD4A8"},children:"Apply"})]})]})}function dd({menu:e,onClose:r}){var g;const n=E(h=>h.model),o=E(h=>h.selectElement),a=E(h=>h.addElement),s=E(h=>h.moveElementToPackage),i=E(h=>h.createPackage),l=E(h=>h.renamePackage),c=E(h=>h.deletePackage),d=E(h=>h.deleteModelElement),[u,m]=p.useState(null),b=p.useRef(null);if(p.useEffect(()=>{const h=y=>{b.current&&!b.current.contains(y.target)&&r()};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[r]),!n)return null;let w="",S=[];if(e.type==="element"&&e.elementId){const h=n.elements[e.elementId];if(!h)return null;w=h.name;const y=!(((g=n.registries)==null?void 0:g.kinds)??[]).some(B=>B.name===h.kind);S=[{label:"View details",action:()=>o(h.id)},{label:"Move to package…",action:()=>{const B=window.prompt("Move to which package? (qualified name, e.g. Plant::Hydraulics)",h.package||"");B!==null&&Ae(s(h.id,B.trim()))}},{label:"Copy ID",action:()=>{var B;return(B=navigator.clipboard)==null?void 0:B.writeText(h.id)}},{label:"Delete element…",danger:!0,action:()=>{window.confirm(`Delete “${h.name}”?
|
|
4042
|
+
`);R.push({title:P(H),prefix:q(H),templateId:H.templateId,groupLabel:ee,systemId:U||void 0,content:G})}o(R)}catch(R){V((R==null?void 0:R.message)??"Could not read template."),E(!1)}}const oe=l===0?!0:l===1?x.length>0:x.length>0&&!L;return t.jsx("div",{style:ld,onClick:R=>{R.target===R.currentTarget&&a()},children:t.jsxs("div",{style:dd,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:Er.map((R,H)=>t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"5px",fontSize:"11px",fontWeight:H===l?700:500,color:H===l?"#1B3A4B":H<l?"#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:H===l?"#1B3A4B":H<l?"#059669":"#D1D5DB"},children:H<l?"✓":H+1}),R,H<Er.length-1&&t.jsx("span",{style:{color:"#D1D5DB"},children:"—"})]},R))}),l===0&&t.jsxs("div",{style:{flex:1,overflowY:"auto",display:"flex",flexDirection:"column",gap:"4px"},children:[Ke.map(R=>t.jsx(jr,{label:R.label,color:R.color,detail:`${R.templates.length} meMO templates`,selected:(d==null?void 0:d.id)===R.id,onClick:()=>{u(R),w({builtIn:new Set,repo:new Set,blank:!1})}},R.id)),t.jsx(jr,{label:"Other",color:Dn,detail:"Custom category — blank or repository template",selected:d===null&&m!=="",onClick:()=>{u(null),b(m||"Other"),w({builtIn:new Set,repo:new Set,blank:!1})}}),d===null&&m!==""&&t.jsx("input",{value:m,onChange:R=>b(R.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"}})]}),l===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:M,display:"inline-block"}}),t.jsx("strong",{style:{color:"#1B3A4B"},children:ee}),t.jsx("span",{children:"— pick one or more sources"})]}),d&&d.templates.length>0&&t.jsx(fn,{title:"meMO templates",hint:"Prefilled sections and model queries",children:d.templates.map(R=>t.jsx(Tt,{label:R.title,sub:R.id,color:M,checked:v.builtIn.has(R.id),onToggle:()=>w(H=>{const G=new Set(H.builtIn);return G.has(R.id)?G.delete(R.id):G.add(R.id),{...H,builtIn:G}})},R.id))}),t.jsx(fn,{title:"Blank document",hint:"Start from an empty page",children:t.jsx(Tt,{label:v.blank?"":"Blank document",color:M,checked:v.blank,onToggle:()=>w(R=>({...R,blank:!R.blank})),children:v.blank&&t.jsx("input",{value:g,onChange:R=>h(R.target.value),onClick:R=>R.stopPropagation(),style:{flex:1,padding:"4px 8px",border:"1px solid #D1D5DB",borderRadius:"5px",fontSize:"12px",color:"#1B3A4B",outline:"none"}})})}),t.jsxs(fn,{title:"Project templates",hint:"Reusable templates in dhf/templates/",children:[!s&&t.jsx(rt,{text:"Dev server not connected — project templates unavailable."}),s&&N&&t.jsx(rt,{text:N,error:!0}),s&&!N&&y===null&&t.jsx(rt,{text:"Loading project templates…"}),s&&(y==null?void 0:y.length)===0&&t.jsx(rt,{text:"No project templates yet."}),s&&(y==null?void 0:y.map(R=>t.jsx(Tt,{label:R.title,sub:R.path,color:M,checked:v.repo.has(R.path),onToggle:()=>w(H=>{const G=new Set(H.repo);return G.has(R.path)?G.delete(R.path):G.add(R.path),{...H,repo:G}})},R.path))),t.jsx(Tt,{label:"Add new template",sub:"Save and reuse in this project",color:M,checked:A,disabled:!s,disabledNote:s?void 0:"server unavailable",onToggle:()=>F(R=>!R)}),A&&t.jsxs("div",{style:{marginLeft:"22px",display:"flex",flexDirection:"column",gap:"6px"},children:[t.jsx("input",{value:C,onChange:R=>k(R.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:T,onChange:R=>z(R.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"}})]})]})]}),l===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:[x.length," document",x.length===1?"":"s"," will be created in",t.jsxs("strong",{style:{color:"#1B3A4B"},children:[" ",ee]})," and saved to ",t.jsx("code",{style:{background:"#F3F4F6",padding:"0 4px",borderRadius:"3px",fontSize:"11px"},children:"dhf/documents/"}),":"]}),Y.length>0&&t.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"8px",fontSize:"12px",color:"#374151",marginBottom:"4px"},children:[t.jsx("span",{style:{whiteSpace:"nowrap"},children:"System"}),t.jsxs("select",{value:U,onChange:R=>$(R.target.value),style:{flex:1,padding:"5px 8px",border:"1px solid #E5E7EB",borderRadius:"5px",fontSize:"12px",color:"#1B3A4B",background:"#fff"},children:[t.jsx("option",{value:"",children:"Global — project-wide"}),Y.map(R=>t.jsx("option",{value:R.id,children:R.name||R.id},R.id))]})]}),x.map((R,H)=>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:M,whiteSpace:"nowrap"},children:X[H]}),t.jsx("input",{value:P(R),onChange:G=>j(Z=>({...Z,[R.key]:G.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:R.templateId==="blank"?"blank":R.templateId==="new-template"?"new template":R.templateId.startsWith("repo:")?"project":"meMO"})]},R.key)),O&&t.jsx(rt,{text:O,error:!0})]}),t.jsxs("div",{style:{display:"flex",gap:"8px",justifyContent:"flex-end",marginTop:"16px"},children:[l>0&&t.jsx("button",{onClick:()=>c(R=>R-1),disabled:L,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"}),l<2?t.jsx("button",{onClick:()=>c(R=>R+1),disabled:!oe,style:{padding:"7px 16px",borderRadius:"6px",border:"none",background:oe?"#1B3A4B":"#E5E7EB",color:oe?"#fff":"#9CA3AF",fontSize:"13px",fontWeight:600,cursor:oe?"pointer":"default"},children:"Next →"}):t.jsx("button",{onClick:ie,disabled:!oe,style:{padding:"7px 16px",borderRadius:"6px",border:"none",background:oe?M:"#E5E7EB",color:oe?"#fff":"#9CA3AF",fontSize:"13px",fontWeight:600,cursor:oe?"pointer":"default"},children:L?"Creating…":`Create ${x.length>0?`(${x.length})`:""}`})]})]})})}function jr({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 fn({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 Tt({label:e,sub:r,color:n,checked:o,disabled:a,disabledNote:s,onToggle:i,children:l}){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&&i(),style:{accentColor:n}}),e&&t.jsx("span",{style:{fontSize:"13px",color:"#1B3A4B"},children:e}),l,r&&t.jsx("span",{style:{marginLeft:"auto",fontSize:"10px",fontFamily:"monospace",color:"#9CA3AF",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"180px"},children:r}),a&&s&&t.jsx("span",{style:{fontSize:"10px",color:"#9CA3AF"},children:s})]})}function rt({text:e,error:r}){return t.jsx("div",{style:{fontSize:"11px",color:r?"#DC2626":"#9CA3AF",fontStyle:"italic",padding:"4px 8px"},children:e})}const Dr={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 ud(e){return e.length<=3?e.toUpperCase():(e[0]+e.slice(1).replace(/[aeiouAEIOU]/g,"")).slice(0,3).toUpperCase()}function pd(e){if(Dr[e])return Dr[e];const r=e.replace(/([A-Z])/g," $1").trim().split(" ").filter(Boolean);return r.length===0?"EL":r.map(ud).join("-")}function md(e){return e.split("-")[0]}function Bo(e){return`/catalog/${e.split("-")[0]}/${e}`}function fd(e){return`/catalog/${e}`}function Fo(e,r){return`/diagrams/${e.toLowerCase().replace(/\s+/g,"-")}/${encodeURIComponent(r)}`}const hd=p.lazy(()=>de(()=>import("./ScenarioEditor-CiHaTvVY.js"),__vite__mapDeps([0,1,2])).then(e=>({default:e.ScenarioEditor})));function ke({expanded:e,size:r=14,color:n=f.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 Br(){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 Re({open:e,color:r=f.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 xt({color:e=f.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"})]})}async function ve(e){try{const r=await e;if(!r.success){window.alert(r.error??"The containment change was refused.");return}for(const n of r.warnings??[])window.alert(n.message)}catch(r){window.alert(r instanceof Error?r.message:String(r))}}function yd({elementId:e,currentKind:r,onClose:n}){const o=S(d=>d.updateElementKind),a=S(d=>d.model),[s,i]=p.useState(r),l=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,m)=>u.localeCompare(m))},[a]);return p.useEffect(()=>{const d=u=>{l.current&&!l.current.contains(u.target)&&n()};return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[n]),t.jsxs("div",{ref:l,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:s,onChange:d=>i(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,s),n()},className:"px-3 py-1.5 rounded font-medium",style:{fontSize:"12px",color:"#FFFFFF",background:"#2DD4A8"},children:"Apply"})]})]})}function gd({menu:e,onClose:r}){var g;const n=S(h=>h.model),o=S(h=>h.selectElement),a=S(h=>h.addElement),s=S(h=>h.moveElementToPackage),i=S(h=>h.createPackage),l=S(h=>h.renamePackage),c=S(h=>h.deletePackage),d=S(h=>h.deleteModelElement),[u,m]=p.useState(null),b=p.useRef(null);if(p.useEffect(()=>{const h=y=>{b.current&&!b.current.contains(y.target)&&r()};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[r]),!n)return null;let v="",w=[];if(e.type==="element"&&e.elementId){const h=n.elements[e.elementId];if(!h)return null;v=h.name;const y=!(((g=n.registries)==null?void 0:g.kinds)??[]).some(B=>B.name===h.kind);w=[{label:"View details",action:()=>o(h.id)},{label:"Move to package…",action:()=>{const B=window.prompt("Move to which package? (qualified name, e.g. Plant::Hydraulics)",h.package||"");B!==null&&ve(s(h.id,B.trim()))}},{label:"Group in new package…",action:()=>{const B=gr(n,h),N=window.prompt(B?`Name the group inside ${B.split("::").pop()}`:"Name the group");if(!(N!=null&&N.trim()))return;const D=`${B}::${N.trim()}`;i(N.trim(),B).then(async A=>{if(!A.success){window.alert(A.error??"The package could not be created.");return}return await Li(D),ve(s(h.id,D))})}},...xr(n,h).length>0?[{label:"Move into group…",action:()=>{var A;const B=gr(n,h),N=xr(n,h),D=window.prompt(`Move into which group? (${N.join(", ")})`,((A=h.attributes)==null?void 0:A.elementPackage)??N[0]??"");D!=null&&D.trim()&&ve(s(h.id,`${B}::${D.trim()}`))}}]:[],{label:"Copy ID",action:()=>{var B;return(B=navigator.clipboard)==null?void 0:B.writeText(h.id)}},{label:"Delete element…",danger:!0,action:()=>{window.confirm(`Delete “${h.name}”?
|
|
4043
4043
|
|
|
4044
|
-
All incoming and outgoing relationships will also be deleted. This cannot be undone.`)&&d(h.id).then(B=>{B.success||window.alert(B.error??"The element could not be deleted.")})}},...y?[{label:"⚠ Change Type…",action:()=>m({elementId:h.id,currentKind:h.kind})}]:[]]}else if(e.type==="folder"&&e.packageName&&e.kind){const h=e.packageName;
|
|
4044
|
+
All incoming and outgoing relationships will also be deleted. This cannot be undone.`)&&d(h.id).then(B=>{B.success||window.alert(B.error??"The element could not be deleted.")})}},...y?[{label:"⚠ Change Type…",action:()=>m({elementId:h.id,currentKind:h.kind})}]:[]]}else if(e.type==="folder"&&e.packageName&&e.kind){const h=e.packageName;v=`Package: ${h.split("::").pop()}`,w=[{label:"Add Element here",action:()=>{const y=window.prompt("Enter element name:");y&&a(e.kind,y,h)}},{label:"New Package…",action:()=>{const y=window.prompt("Enter package name:");y&&ve(i(y.trim(),h))}},{label:"Rename Package…",action:()=>{const y=window.prompt("Enter new package name:",h.split("::").pop()??"");y&&ve(l(h,y.trim()))}},{label:"Delete Package (keep contents)",danger:!0,action:()=>{window.confirm(`Remove the package "${h}"?
|
|
4045
4045
|
|
|
4046
|
-
Everything it declares moves into the enclosing package. Qualified names that refer to it will need updating by hand.`)&&Ae(c(h))}}]}else e.type==="kind"&&e.kind&&(w=`Category: ${e.kind}`,S=[{label:"Add Element",action:()=>{const h=window.prompt("Enter element name:");h&&a(e.kind,h,"")}},{label:"New Package…",action:()=>{const h=window.prompt("Enter package name:");h&&Ae(i(h.trim()))}}]);return S.length?t.jsxs(t.Fragment,{children:[t.jsxs("div",{ref:b,className:"fixed z-50 rounded-lg overflow-hidden py-1",style:{left:e.x,top:e.y,background:f.surface,border:`1px solid ${f.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:f.primary,fontSize:T.xs,borderBottom:`1px solid ${f.border}`},children:w.toUpperCase()}),S.map((h,y)=>t.jsx("div",{className:"px-3 py-2 cursor-pointer transition-colors",style:{color:h.danger?"#DC2626":f.secondary,fontSize:T.explorer.item},onMouseEnter:B=>B.currentTarget.style.background="#F0F0ED",onMouseLeave:B=>B.currentTarget.style.background="transparent",onClick:()=>{h.action(),u||r()},children:h.label},y))]}),u&&t.jsx(ld,{elementId:u.elementId,currentKind:u.currentKind,onClose:()=>{m(null),r()}})]}):null}function Dn({nodes:e,level:r,expanded:n,toggleExpand:o,selectedElementId:a,selectElement:s,selectedElementIds:i,toggleElementSelection:l,violationCounts:c,baseColor:d,onContextMenu:u,onDragStart:m,onDrop:b,isUndefined:w}){return t.jsx(t.Fragment,{children:e.map(S=>{if(S.type==="folder"){const g=n.has(S.id);return t.jsxs("div",{style:{marginLeft:r>0?"16px":"0"},draggable:!0,onDragStart:h=>m(h,S),onDragOver:h=>h.preventDefault(),onDrop:h=>b(h,S.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(S.id),onContextMenu:h=>u(h,"folder",S.id),children:[t.jsx(Ne,{expanded:g,size:12,color:f.muted}),t.jsx(ze,{open:g,color:d}),t.jsx("span",{className:"font-medium flex-1 truncate",style:{color:f.secondary,fontSize:T.explorer.kind},children:S.name})]}),g&&t.jsx(Dn,{nodes:S.children,level:r+1,expanded:n,toggleExpand:o,selectedElementId:a,selectElement:s,selectedElementIds:i,toggleElementSelection:l,violationCounts:c,baseColor:d,onContextMenu:u,onDragStart:m,onDrop:b,isUndefined:w})]},S.id)}else{const g=S.element,h=a===g.id,y=i.has(g.id),B=c.get(g.id)||0,O=ce[g.layer]||d;return t.jsxs(p.Fragment,{children:[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:y?"#FFF3CD":h?f.accent+"18":"transparent",fontWeight:h||y?500:400},draggable:!0,onDragStart:D=>m(D,{type:"element",element:g,id:g.id,name:g.name,children:[]}),onMouseEnter:D=>{!h&&!y&&(D.currentTarget.style.background="#F0F0ED")},onMouseLeave:D=>{D.currentTarget.style.background=y?"#FFF3CD":h?f.accent+"18":"transparent"},onClick:D=>{D.metaKey||D.ctrlKey||D.shiftKey?(D.preventDefault(),l(g.id)):s(g.id)},onContextMenu:D=>u(D,"element",g.id),children:[t.jsx("input",{type:"checkbox",checked:y,onChange:D=>{D.stopPropagation(),l(g.id)},onClick:D=>D.stopPropagation(),className:"flex-shrink-0",style:{width:"12px",height:"12px",cursor:"pointer",opacity:y?1:0,transition:"opacity 120ms",accentColor:"#2DD4A8"},onMouseEnter:D=>{D.currentTarget.style.opacity="1"},onMouseLeave:D=>{D.currentTarget.style.opacity=y?"1":"0"}}),t.jsx(Wn,{color:w?"#F59E0B":O}),t.jsx(Gi,{element:g,selected:h}),w&&t.jsx("span",{title:`Kind "${g.kind}" is not defined in the ontology`,style:{color:"#F59E0B",fontSize:"12px",flexShrink:0},children:"⚠"}),B>0&&t.jsx("span",{className:"px-1 py-0.5 rounded-full",style:{background:"#FEF2F2",color:"#DC2626",fontSize:T.explorer.count,fontWeight:600,minWidth:"16px",textAlign:"center"},children:B})]}),S.children.length>0&&t.jsx(Dn,{nodes:S.children,level:r+1,expanded:n,toggleExpand:o,selectedElementId:a,selectElement:s,selectedElementIds:i,toggleElementSelection:l,violationCounts:c,baseColor:d,onContextMenu:u,onDragStart:m,onDrop:b,isUndefined:w})]},g.id)}})})}function cd(e,r,n){return e.endsWith("View")||r==="viewpoints"||r==="views"||n==="viewpoints"||n==="views"}function ud(e,r,n){return cd(e,r,n)||e==="ItemDefinition"}function pd(e,r,n){return!n.has(e.kind)&&io(e,{kinds:r})!==void 0}function md(e,r){var a;const n=new Map,o=new Map;for(const s of r)for(const i of s.layers)o.has(i.id)||o.set(i.id,i);for(const s of e){const i=((a=s.namespace)==null?void 0:a[0])??s.layer;if(!i||i==="unknown")continue;let l=n.get(i);if(!l){const c=o.get(i);l={id:i,label:(c==null?void 0:c.label)??Co(i),color:(c==null?void 0:c.color)??ce[i]??"#6B7280",kinds:[]},n.set(i,l)}l.kinds.includes(s.name)||l.kinds.push(s.name)}return[...n.values()]}function fd(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 hd(e){var n;const r={};for(const o of e)r[o.name]=(n=o.namespace)==null?void 0:n[1];return r}function Co(e){return e.split(/[_-]/).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join(" ")}function yd(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 Er=["documents","assets","templates","analyses","adrs","reviews"];function gd(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 xd(e,r,n,o,a=[],s){var A;const i=r.toLowerCase(),l=new Set(["views","viewpoints","manifest"]),c=fd(n),d=hd(n),u=md(n,o).filter(v=>!l.has(v.id)),m=new Set(u.map(v=>v.id)),b=new Map;for(const v of e){if(s&&!s.has(v.kind))continue;const k=c[v.kind]??v.layer,j=d[v.kind];ud(v.kind,k,j)||i&&!v.name.toLowerCase().includes(i)&&!v.kind.toLowerCase().includes(i)||b.set(v.id,v)}const w=new Map;for(const v of b.values())w.set(v.id,{id:v.id,name:v.name,type:"element",element:v,children:[]});const S=[];for(const v of w.values()){const k=(A=v.element)==null?void 0:A.owner,j=k?w.get(k):void 0;j?j.children.push(v):S.push(v)}const g=v=>{v.sort((k,j)=>k.type!==j.type?k.type==="folder"?-1:1:k.name.localeCompare(j.name)),v.forEach(k=>g(k.children))};for(const v of w.values())g(v.children);const h=v=>{var P,N,M,L;const k=(N=(P=n.find(C=>C.name===v))==null?void 0:P.namespace)==null?void 0:N[0];let j=v;for(;;){const C=n.find($=>$.name===j);if(!C||C.isAbstract||!C.superType||((L=(M=n.find($=>$.name===C.superType))==null?void 0:M.namespace)==null?void 0:L[0])!==k)return j;j=C.superType}},y=(v,k,j)=>{var M;const P=new Map;for(const L of v){const C=L.element.kind,z=j==="artifacts"?gd(C,(M=n.find(U=>U.name===C))==null?void 0:M.superType):d[C]??"";P.has(z)||P.set(z,new Map);const $=P.get(z);$.set(C,[...$.get(C)??[],L])}const N=new Map;for(const[L,C]of P.entries()){const z=new Map;for(const[H,X]of C.entries())X.length===1&&z.set(H,h(H));const $=new Map;for(const H of z.values())$.set(H,($.get(H)??0)+1);const U=new Map;for(const[H,X]of C.entries()){const Y=z.get(H),ae=Y&&($.get(Y)??0)>1?Y:H;U.set(ae,[...U.get(ae)??[],...X])}const G=new Map;for(const[H,X]of U.entries()){const Y=[...X];g(Y),G.set(H,Y)}N.set(L,G)}return[...N.entries()].sort(([L],[C])=>j==="artifacts"?Er.indexOf(L)-Er.indexOf(C):L.localeCompare(C)).map(([L,C])=>({id:L,label:L?Co(L):"",color:L?ce[L]??k:k,kinds:C}))},B=[];for(const v of u){const k=[];for(const j of S){const P=j.element,N=c[P.kind];!N||N!==v.id||k.push(j)}k.length>0&&B.push({group:v,subGroups:y(k,v.color,v.id)})}const O=[],D=[],R=new Set(n.map(v=>v.name));for(const v of S){const k=v.element,j=c[k.kind];j&&m.has(j)||j&&l.has(j)||(pd(k,n,R)?O.push(v):D.push(v))}if(O.length>0){const v="#64748B";B.push({group:{id:"standard-sysml-diagram-elements",label:"Other — SysML Diagram Elements",color:v,kinds:[]},subGroups:y(O,v).map(k=>({...k,id:"diagram-elements",label:"Diagram Elements"}))})}if(D.length>0){const v="#F59E0B";B.push({group:{id:"undefined",label:"Undefined — Not in Ontology",color:v,kinds:[]},subGroups:y(D,v).map(k=>({...k,id:"undefined-elements",label:"Elements"}))})}return B}function bd({searchTerm:e,selectedElementId:r,onSelect:n}){const o=E(u=>u.model),a=E(u=>u.availableOntologies),[s,i]=p.useState(new Set),l=p.useMemo(()=>{const u=Object.values((o==null?void 0:o.elements)??{}),m=vo(a),b=new Map(u.map(g=>[g.id,g])),w=(o==null?void 0:o.relationships)??[],S=bo.map(g=>g.id==="usecases"?{...g,systemOf:h=>Ti(h,b,w,m)}:g);return Ri(u,S,e)},[o,a,e]),c=u=>i(m=>{const b=new Set(m);return b.has(u)?b.delete(u):b.add(u),b}),d=(u,m)=>{const b=u.children.length>0,w=!s.has(u.id);return t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-1.5 py-1 cursor-pointer select-none",style:{paddingLeft:`${8+m*14}px`,paddingRight:"8px",borderRadius:"4px",margin:"0 4px",background:u.element&&u.element.id===r?"#EEF2FF":"transparent"},onClick:()=>{b&&c(u.id),u.element&&n(u.element.id)},children:[b?t.jsx(Ne,{expanded:w,size:12}):t.jsx("span",{style:{width:"12px",display:"inline-block"}}),u.isGroup?t.jsx(ze,{open:w}):t.jsx(Wn,{}),t.jsx("span",{className:"truncate flex-1",style:{color:f.primary},children:u.name}),!u.isGroup&&t.jsx("span",{style:{color:f.faint,fontSize:T.explorer.count},children:u.kind})]}),w&&u.children.map(S=>d(S,m+1))]},u.id)};return l.length===0?t.jsx("div",{className:"flex-1 flex items-center justify-center px-4 text-center",style:{color:f.faint,fontSize:"12px"},children:e?"Nothing matches that search.":"No composition to show yet."}):t.jsx("div",{className:"flex-1 overflow-y-auto py-1",style:{fontSize:T.explorer.item},children:l.map(u=>{const m=!s.has(`b:${u.id}`);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"},onClick:()=>c(`b:${u.id}`),children:[t.jsx(Ne,{expanded:m,size:13}),t.jsx(ze,{open:m}),t.jsx("span",{className:"font-semibold flex-1",style:{color:f.primary,fontSize:T.explorer.kind},children:u.label}),t.jsx("span",{style:{color:f.faint,fontSize:T.explorer.count},children:u.nodes.length})]}),m&&u.nodes.map(b=>d(b,1))]},u.id)})})}function Cr({searchTerm:e}){var se;const r=ke(),n=E(I=>I.model),o=E(I=>I.selectedElementId),a=E(I=>I.selectElement),s=E(I=>I.setActiveView),i=E(I=>I.selectedElementIds),l=E(I=>I.toggleElementSelection),c=E(I=>I.selectAllElements),d=E(I=>I.clearElementSelection),u=E(I=>I.moveElementToPackage),m=E(I=>I.movePackage),b=E(I=>I.validation),w=E(I=>I.availableOntologies),S=E(I=>I.setExplorerTab),g=E(I=>I.setActiveMode),h=E(I=>I.setSelectedOntologyKind),y=((se=n==null?void 0:n.registries)==null?void 0:se.kinds)??[],B=p.useCallback(I=>{var _;a(I),s({type:"element-detail",elementId:I});const x=(_=n==null?void 0:n.elements)==null?void 0:_[I];x&&r(So(x.shortId??x.id))},[a,s,n,r]),[O,D]=p.useState("catalog"),[R,A]=p.useState(new Set),v=p.useRef(!1),[k,j]=p.useState(null),[P,N]=p.useState(null),[M,L]=p.useState(new Set),C=p.useCallback((I,x)=>{x==null||x.stopPropagation(),A(_=>{const q=new Set(_);return q.has(I)?q.delete(I):q.add(I),q})},[]),z=p.useCallback((I,x,_,q)=>{I.preventDefault(),j({x:I.clientX,y:I.clientY,type:x,elementId:x==="element"?_:void 0,packageName:x==="folder"?_.replace("f:",""):void 0,kind:q||(x==="kind"?_.replace("k:","").split(":").pop():void 0)})},[]),$=p.useMemo(()=>{var I;return n?xd(Object.values(n.elements),e,((I=n.registries)==null?void 0:I.kinds)??[],w,n.packages??[],M.size?M:void 0):[]},[n,e,w,M]);p.useEffect(()=>{if(v.current||$.length===0)return;const I=new Set;for(const{group:x,subGroups:_}of $)for(const q of _)for(const J of q.kinds.keys())I.add(`k:${x.id}:${q.id?`${q.id}:`:""}${J}`);v.current=!0,A(I)},[$]),p.useEffect(()=>{const I=()=>{if(!e.trim())return;const _=new Set;for(const{group:q,subGroups:J}of $){_.add(`g:${q.id}`);for(const ie of J){ie.id&&_.add(`sg:${q.id}:${ie.id}`);for(const ne of ie.kinds.keys())_.add(`k:${q.id}:${ie.id?`${ie.id}:`:""}${ne}`)}}A(_)},x=()=>A(new Set);return window.addEventListener("memo:expand-explorer-search",I),window.addEventListener("memo:collapse-explorer-tree",x),()=>{window.removeEventListener("memo:expand-explorer-search",I),window.removeEventListener("memo:collapse-explorer-tree",x)}},[$,e]);const U=p.useCallback((I,x,_)=>{var q;N({id:x.id,kind:_}),I.dataTransfer.setData("application/memo-node",JSON.stringify({id:x.id,type:x.type,kind:_,name:x.name,elementId:(q=x.element)==null?void 0:q.id,packageName:x.type==="folder"?x.id.replace("f:",""):void 0})),I.dataTransfer.effectAllowed="move"},[]),G=p.useCallback((I,x)=>{(P==null?void 0:P.kind)===x&&(I.preventDefault(),I.dataTransfer.dropEffect="move")},[P]),H=p.useCallback((I,x,_)=>{I.preventDefault(),N(null);try{const q=JSON.parse(I.dataTransfer.getData("application/memo-node"));if(q.kind!==_)return;if(q.type==="element")Ae(u(q.elementId,x));else if(q.type==="folder"){if(x===q.packageName||x.startsWith(`${q.packageName}::`))return;Ae(m(q.packageName,x))}}catch(q){console.error("Drop error:",q)}},[u,m]),X=p.useMemo(()=>{const I=new Map;if(b)for(const x of b.violations)I.set(x.elementId,(I.get(x.elementId)||0)+1);return I},[b]),Y=p.useMemo(()=>{const I=[],x=_=>{for(const q of _)q.type==="element"&&q.element?I.push(q.element.id):x(q.children)};for(const{subGroups:_}of $)for(const q of _)for(const J of q.kinds.values())x(J);return I},[$]),ae=i.size;return t.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[t.jsxs("details",{className:"px-3 py-1.5 flex-shrink-0",style:{borderBottom:`1px solid ${f.border}`,fontSize:T.xs},children:[t.jsxs("summary",{style:{cursor:"pointer",color:f.secondary},children:["Filter element types",M.size?` (${M.size})`:""]}),t.jsxs("div",{className:"mt-1 max-h-32 overflow-y-auto",children:[t.jsx("button",{onClick:()=>L(new Set),style:{color:f.accent,fontSize:T.xs},children:"Show all"}),y.filter(I=>!I.isAbstract).sort((I,x)=>I.name.localeCompare(x.name)).map(I=>t.jsxs("label",{className:"flex items-center gap-1 py-0.5",children:[t.jsx("input",{type:"checkbox",checked:!M.size||M.has(I.name),onChange:()=>L(x=>{const _=x.size?new Set(x):new Set(y.filter(q=>!q.isAbstract).map(q=>q.name));return _.has(I.name)?_.delete(I.name):_.add(I.name),_})}),I.label||I.name]},I.name))]})]}),ae>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:[ae," selected"]}),t.jsx("span",{style:{color:"#B45309"},children:"— Cmd/Ctrl+click to multi-select"}),t.jsx("button",{onClick:d,className:"ml-auto px-2 py-0.5 rounded",style:{color:"#92400E",background:"#FDE68A",fontSize:"12px",fontWeight:500},children:"Clear"})]}),e&&Y.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:[Y.length," matching"]}),t.jsx("button",{onClick:()=>c(Y),className:"ml-auto px-2 py-0.5 rounded",style:{color:"#0369A1",background:"#BAE6FD",fontSize:"12px",fontWeight:500},children:"Select All"})]}),t.jsx("div",{className:"flex px-2 pt-1.5 pb-1 gap-1 flex-shrink-0",children:["catalog","breakdown"].map(I=>t.jsx("button",{onClick:()=>D(I),className:"px-2 py-0.5 rounded capitalize",style:{fontSize:"11px",fontWeight:500,...O===I?{background:f.accent,color:"#fff"}:{background:"transparent",color:f.faint}},children:I},I))}),O==="breakdown"?t.jsx(bd,{searchTerm:e,selectedElementId:o,onSelect:B}):t.jsxs("div",{className:"flex-1 overflow-y-auto py-1",style:{fontSize:T.explorer.item},children:[$.map(({group:I,subGroups:x})=>{const _=`g:${I.id}`,q=R.has(_),J=I.id==="undefined",ie=W=>W.reduce((K,Q)=>K+(Q.type==="element"?1:ie(Q.children)),0),ne=W=>Array.from(W.kinds.values()).reduce((K,Q)=>K+ie(Q),0),F=x.reduce((W,K)=>W+ne(K),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:W=>W.currentTarget.style.background=J?"#FDE68A":"#F0F0ED",onMouseLeave:W=>W.currentTarget.style.background=J?"#FFF3CD":"transparent",onClick:()=>C(_),onContextMenu:W=>z(W,"group",_),children:[t.jsx(Ne,{expanded:q,size:14,color:I.color}),J?t.jsx("span",{style:{fontSize:"14px",lineHeight:1,flexShrink:0},children:"⚠"}):t.jsx(ze,{open:q,color:I.color}),t.jsx("span",{className:"font-semibold flex-1 truncate",style:{color:J?"#92400E":f.primary,fontSize:T.explorer.group},children:I.label}),t.jsx("span",{className:"px-1.5 py-0.5 rounded-full",style:{background:I.color+"25",color:I.color,fontSize:T.explorer.count,fontWeight:600,minWidth:"20px",textAlign:"center"},children:F})]}),(()=>{const W=(K,Q,le)=>{const re=`k:${I.id}:${le?le+":":""}${K}`,me=R.has(re),Se=ee=>{var te;for(const Me of ee){if(Me.type==="element")return(te=Me.element)==null?void 0:te.layer;const wt=Se(Me.children);if(wt)return wt}},Re=Se(Q),Z=J?"#F59E0B":Re&&ce[Re]||I.color,fe=y.some(ee=>ee.name===K),et=ee=>ee.flatMap(te=>te.type==="element"&&te.element?[te.element.id]:et(te.children)),Ie=et(Q);return t.jsxs("div",{style:{marginLeft:"16px"},onDragOver:ee=>G(ee,K),onDrop:ee=>H(ee,"",K),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:ee=>ee.currentTarget.style.background="#F0F0ED",onMouseLeave:ee=>ee.currentTarget.style.background="transparent",onClick:()=>C(re),onContextMenu:ee=>z(ee,"kind",re,K),children:[t.jsx(Ne,{expanded:me,size:12,color:f.muted}),t.jsx(ze,{open:me,color:Z}),t.jsxs("span",{className:"font-medium flex-1 truncate",style:{color:J?"#B45309":f.secondary,fontSize:T.explorer.kind},children:[yd(K,Ie.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:ee=>{ee.stopPropagation(),c(Ie)},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:f.faint,fontSize:"17px"},children:"☑"}),fe&&ue("ontology")&&t.jsx("button",{onClick:ee=>{ee.stopPropagation();for(const te of w)for(const Me of te.layers)if(Me.kinds.some(wt=>wt.name===K)){h(K),S("ontologies"),g("ontology"),s({type:"ontology-detail",packageName:te.name,layerId:Me.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:f.faint,fontSize:"17px"},children:"⬡"})]}),t.jsx(Cn,{count:Ie.length,color:Z,title:`${Ie.length} ${Ie.length===1?"element":"elements"}`})]}),me&&t.jsx(Dn,{nodes:Q,level:0,expanded:R,toggleExpand:C,selectedElementId:o,selectElement:B,selectedElementIds:i,toggleElementSelection:l,violationCounts:X,baseColor:Z,onContextMenu:(ee,te,Me)=>z(ee,te,Me,K),onDragStart:(ee,te)=>U(ee,te,K),onDrop:(ee,te)=>H(ee,te,K),isUndefined:J})]},K)};return q?x.map(K=>{if(!K.id)return t.jsx("div",{children:Array.from(K.kinds.entries()).map(([me,Se])=>W(me,Se,""))},"__root");const Q=`sg:${I.id}:${K.id}`,le=R.has(Q),re=ne(K);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:me=>me.currentTarget.style.background="#F0F0ED",onMouseLeave:me=>me.currentTarget.style.background="transparent",onClick:()=>C(Q),children:[t.jsx(Ne,{expanded:le,size:13,color:K.color}),t.jsx(ze,{open:le,color:K.color}),t.jsx("span",{className:"font-semibold flex-1 truncate",style:{color:f.primary,fontSize:T.explorer.kind},children:K.label}),t.jsx("span",{className:"px-1.5 py-0.5 rounded-full",style:{background:K.color+"25",color:K.color,fontSize:T.explorer.count,fontWeight:600,minWidth:"20px",textAlign:"center"},children:re})]}),le&&Array.from(K.kinds.entries()).map(([me,Se])=>W(me,Se,K.id))]},K.id)}):null})()]},I.id)}),k&&t.jsx(dd,{menu:k,onClose:()=>j(null)})]})]})}function vd({diagram:e}){const r=e.viewKind?Vn[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:T.badge},title:r.fullName,children:r.label});const n=["afd","ofd","ffd"].includes(e.diagramType.toLowerCase())?_i(e):e.diagramType,o=qe[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:T.badge},title:o.fullName,children:o.code}):null}function wd({viewpointId:e,onClose:r}){const n=E(d=>d.createDiagram),[o,a]=p.useState("Untitled"),[s,i]=p.useState("bdd"),l=p.useRef(null);p.useEffect(()=>{const d=u=>{l.current&&!l.current.contains(u.target)&&r()};return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[r]);const c=()=>{o.trim()&&(n({name:o.trim(),diagramType:s,viewpointId:e}),r())};return t.jsxs("div",{ref:l,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:f.primary,fontSize:"13px"},children:"New Model View"}),t.jsx("label",{className:"block mb-1",style:{fontSize:T.xs,color:f.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:f.primary,fontSize:"13px"}}),t.jsx("label",{className:"block mb-1",style:{fontSize:T.xs,color:f.secondary},children:"Type"}),t.jsx("select",{value:s,onChange:d=>i(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:f.primary,fontSize:"13px"},children:Object.entries(qe).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:f.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:f.accent},children:"Create"})]})]})}const kd=new Set(["__unassigned","__model"]),Ee="__uncategorized";function jo(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 s=(n.explorerOrder??Number.MAX_SAFE_INTEGER)-(o.explorerOrder??Number.MAX_SAFE_INTEGER);if(s!==0)return s}return n.label.localeCompare(o.label)})}function Do(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 s=a.split(" ");return s.length>1&&s[0]===n})?e.map(a=>a.slice(n.length+1)):e}function Sd(e){const r=jo(((e==null?void 0:e.viewpoints)??[]).filter(o=>!kd.has(o.id))),n=new Set;for(const o of r)for(const a of En(e,o.id))n.add(a.id);return{viewpoints:r,uncategorized:((e==null?void 0:e.diagrams)??[]).filter(o=>!n.has(o.id))}}function Ed(e){const r=[];for(const o of e){let a=r,s="",i;for(const l of(o.package??"").split("::").filter(Boolean)){s=s?`${s}::${l}`:l;let c=a.find(d=>d.id===s);c||(c={id:s,name:l,children:[],diagrams:[]},a.push(c)),i=c,a=c.children}if(a===r){let l=r.find(c=>c.id==="__unpackaged");l||(l={id:"__unpackaged",name:"No owning package",children:[],diagrams:[]},r.push(l)),l.diagrams.push(o)}else i.diagrams.push(o)}const n=o=>{o.sort((a,s)=>a.name.localeCompare(s.name)),o.forEach(a=>{a.diagrams.sort((s,i)=>s.name.localeCompare(i.name)),n(a.children)})};return n(r),r}function Cd({searchTerm:e}){const r=E(j=>j.model),n=E(j=>j.activeView),o=E(j=>j.setActiveView),a=E(j=>j.selectViewpoint),s=E(j=>j.deleteDiagram),i=E(j=>j.createPackage),l=E(j=>j.moveElementToPackage),c=ke(),d=j=>{if(!j.elementId)return;const P=window.prompt(`Move “${j.name}” into which package? (qualified name, e.g. Views::Safety)`,j.package??"");P!==null&&Ae(l(j.elementId,P.trim()))},u=j=>{const P=En(r,j).map(M=>M.package).filter(M=>!!M);if(P.length===0)return;const N=new Map;for(const M of P)N.set(M,(N.get(M)??0)+1);return[...N.entries()].sort((M,L)=>L[1]-M[1]||M[0].length-L[0].length||M[0].localeCompare(L[0]))[0][0]},[m,b]=p.useState(new Set),[w,S]=p.useState(null),g=j=>{b(P=>{const N=new Set(P);return N.has(j)?N.delete(j):N.add(j),N})},{viewpoints:h,uncategorized:y}=p.useMemo(()=>Sd(r),[r]),B=p.useMemo(()=>Do(h.map(j=>j.label)),[h]),O=j=>{if(!e)return j;const P=e.toLowerCase();return j.filter(N=>N.name.toLowerCase().includes(P)||N.diagramType.toLowerCase().includes(P))},D=n.type==="diagram"?n.diagramId:null,R=O(y),A=p.useMemo(()=>{const j=new Map;for(const P of R){const M=[...(P.elementIds??[]).map(L=>{var C;return(C=r==null?void 0:r.elements[L])==null?void 0:C.layer}).filter(L=>!!L)].sort((L,C)=>{const z=Oe.indexOf(L),$=Oe.indexOf(C);return(z<0?Number.MAX_SAFE_INTEGER:z)-($<0?Number.MAX_SAFE_INTEGER:$)})[0]??"other";j.set(M,[...j.get(M)??[],P])}return[...j.entries()].sort(([P],[N])=>{const M=Oe.indexOf(P),L=Oe.indexOf(N);return(M<0?Number.MAX_SAFE_INTEGER:M)-(L<0?Number.MAX_SAFE_INTEGER:L)})},[R,r==null?void 0:r.elements]),v=(j,P)=>j.map(N=>t.jsx(jd,{diag:N,isSelected:D===N.id,onSelect:()=>{o({type:"diagram",diagramId:N.id}),a(P==="__model"?null:P),c(Eo(N.diagramType,N.shortId??N.id))},onDelete:N.auto?void 0:()=>s(N.id),onMoveToPackage:N.elementId?()=>d(N):void 0},N.id)),k=(j,P)=>{const N=Ed(j),M=(z,$=0)=>t.jsxs("div",{style:{marginLeft:$?"12px":0},children:[t.jsx("div",{className:"px-2 py-1 font-semibold",style:{color:f.muted,fontSize:T.xs},children:z.name}),t.jsx("div",{style:{marginLeft:"8px"},children:v(z.diagrams,P)}),z.children.map(U=>M(U,$+1))]},z.id);if(j.some(z=>z.package))return N.map(z=>M(z));const L=z=>z.group;if(!j.some(z=>L(z)))return v(j,P);const C=new Map;for(const z of j){const $=L(z)||"Other";C.set($,[...C.get($)??[],z])}return[...C.entries()].sort(([z],[$])=>z.localeCompare($)).map(([z,$])=>t.jsxs("div",{style:{margin:"5px 4px 2px"},children:[t.jsx("div",{className:"px-2 py-1 font-semibold",style:{color:f.muted,fontSize:T.xs},children:z}),t.jsx("div",{style:{marginLeft:"8px"},children:v($,P)})]},z))};return t.jsxs("div",{className:"flex-1 overflow-y-auto py-1",style:{fontSize:T.explorer.item},children:[h.map((j,P)=>{var z;const N=m.has(j.id),M=(z=j.visibleLayers)!=null&&z[0]&&ce[j.visibleLayers[0]]||f.muted,L=En(r,j.id),C=O(L);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:$=>$.currentTarget.style.background="#F0F0ED",onMouseLeave:$=>$.currentTarget.style.background="transparent",onClick:()=>{a(j.id),g(j.id)},children:[t.jsx(Ne,{expanded:N,size:14,color:M}),t.jsx(ze,{open:N,color:M}),t.jsx("span",{className:"font-semibold flex-1 truncate",style:{color:f.primary,fontSize:T.explorer.group},children:B[P]}),t.jsx(Cn,{count:L.length,color:M,title:`${L.length} views`})]}),N&&t.jsxs("div",{style:{marginLeft:"16px"},children:[k(C,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:f.accent,fontSize:T.xs,background:"transparent"},onMouseEnter:$=>$.currentTarget.style.background=f.accent+"12",onMouseLeave:$=>$.currentTarget.style.background="transparent",onClick:()=>S(j.id),children:[t.jsx("span",{style:{fontSize:"14px",lineHeight:1},children:"+"})," New View"]}),t.jsxs("button",{className:"flex items-center gap-1 px-2 py-1 w-full text-left",style:{borderRadius:"4px",margin:"2px 4px",color:f.accent,fontSize:T.xs,background:"transparent"},onMouseEnter:$=>$.currentTarget.style.background=f.accent+"12",onMouseLeave:$=>$.currentTarget.style.background="transparent",onClick:()=>{const $=u(j.id),U=window.prompt($?`New package under ${$}`:"New SysML package name");U!=null&&U.trim()&&Ae(i(U.trim(),$))},children:[t.jsx("span",{style:{fontSize:"14px",lineHeight:1},children:"+"})," New Package"]})]})]},j.id)}),R.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),g(Ee)},children:[t.jsx(Ne,{expanded:m.has(Ee),size:14,color:f.muted}),t.jsx(ze,{open:m.has(Ee),color:f.muted}),t.jsx("span",{className:"font-semibold flex-1",style:{color:f.primary,fontSize:T.explorer.group},children:"Uncategorized"}),t.jsx("span",{title:"These views conform to no authored viewpoint. Bind an authored view with viewpointDefinition to file it.",style:{color:f.faint,fontSize:T.badge},children:"no viewpoint"}),t.jsx(Cn,{count:R.length,color:f.muted,title:`${R.length} views`})]}),m.has(Ee)&&t.jsxs("div",{style:{marginLeft:"16px"},children:[R.some(j=>j.group)?k(R,Ee):A.map(([j,P])=>t.jsxs("div",{style:{margin:"5px 4px 2px"},children:[t.jsx("div",{className:"px-2 py-1 font-semibold",style:{color:ce[j]??f.muted,fontSize:T.xs,borderLeft:`3px solid ${ce[j]??f.border}`},children:Xe[j]??`${j.charAt(0).toUpperCase()}${j.slice(1)}`}),t.jsx("div",{style:{marginLeft:"8px"},children:v(P,Ee)})]},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:f.accent,fontSize:T.xs,background:"transparent"},onMouseEnter:j=>j.currentTarget.style.background=f.accent+"12",onMouseLeave:j=>j.currentTarget.style.background="transparent",onClick:()=>S("__model"),children:[t.jsx("span",{style:{fontSize:"14px",lineHeight:1},children:"+"})," New View"]})]})]}),w!==null&&t.jsx(wd,{viewpointId:w,onClose:()=>S(null)})]})}function jd({diag:e,isSelected:r,onSelect:n,onDelete:o,onMoveToPackage:a}){var c;const[s,i]=p.useState(!1);qe[e.diagramType];const l=((c=e.elementIds)==null?void 0:c.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?f.accent+"18":s?"#F0F0ED":"transparent",fontSize:T.explorer.item},onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),onClick:n,title:e.description,children:[t.jsx(vd,{diagram:e}),e.auto&&!e.sourceFile&&t.jsx("span",{className:"px-1 py-0.5 rounded",style:{background:"#F0F0ED",color:f.faint,fontSize:T.badge,fontWeight:600},children:"AUTO"}),t.jsx("span",{className:"flex-1",style:{minWidth:0},children:t.jsxs("span",{className:"truncate block",style:{color:r?f.accentDark:f.primary},children:[t.jsxs("span",{style:{color:f.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:f.muted,fontSize:T.explorer.count,fontWeight:600,minWidth:"18px",textAlign:"center"},children:l}),a&&s&&t.jsx("button",{onClick:d=>{d.stopPropagation(),a()},title:"Move this view into a package","aria-label":`Move ${e.name} into a package`,style:{background:"none",border:"none",cursor:"pointer",color:f.muted,fontSize:"12px",padding:"0 2px",lineHeight:1},children:"⌸"}),o&&s&&t.jsx("button",{onClick:d=>{d.stopPropagation(),o()},title:"Delete diagram",style:{background:"none",border:"none",cursor:"pointer",color:"#DC2626",fontSize:"12px",padding:"0 2px",lineHeight:1},children:"×"})]})}function Dd(){const e=E(D=>D.setActiveView),r=E(D=>D.activeView),n=E(D=>D.dhfDocuments),o=E(D=>D.addDhfDocument),a=E(D=>D.removeDhfDocument),s=E(D=>D.dhfSettings),[i,l]=p.useState(new Set(He.map(D=>D.id))),[c,d]=p.useState(null),[u,m]=p.useState(null),b=r.type==="dhf-document"?r.docId:null,w=p.useMemo(()=>{const D=new Set(He.map(R=>R.label));return[...new Set(n.map(R=>R.group))].filter(R=>R&&!D.has(R)).sort()},[n]),S=E(D=>D.model),g=p.useMemo(()=>{const D=(S==null?void 0:S.elements)??{};return xo(n,R=>{const A=R.systemId?D[R.systemId]:void 0;return A?{systemId:A.id,label:A.name||A.id}:R.systemId?{systemId:R.systemId,label:R.systemId}:{label:$n}})},[n,S]),h=D=>[...He.filter(R=>D.some(A=>A.group===R.label)).map(R=>({key:R.id,groupId:R.id,label:R.label,color:R.color,docs:D.filter(A=>A.group===R.label)})),...w.filter(R=>D.some(A=>A.group===R)).map(R=>({key:`custom:${R}`,groupId:void 0,label:R,color:Zl(R),docs:D.filter(A=>A.group===R)}))];function y(D){l(R=>{const A=new Set(R);return A.has(D)?A.delete(D):A.add(D),A})}function B(D,R){D.preventDefault(),D.stopPropagation(),m({x:D.clientX,y:D.clientY,groupId:R})}function O(D){const R=s.documentNumberingPrefix||"DOC",A=[];for(const v of D){const k=`${R}-${v.prefix}-`,j=[...n,...A].filter(z=>z.id.startsWith(k)),P=`${k}${String(j.length+1).padStart(3,"0")}`,N=z=>z.replace(/^---[\s\S]*?---\n?/,""),M=v.content!==null?N(v.content):(()=>{const z=Yl(v.templateId);return z?N(z):`# ${v.title}
|
|
4046
|
+
Everything it declares moves into the enclosing package. Qualified names that refer to it will need updating by hand.`)&&ve(c(h))}}]}else e.type==="kind"&&e.kind&&(v=`Category: ${e.kind}`,w=[{label:"Add Element",action:()=>{const h=window.prompt("Enter element name:");h&&a(e.kind,h,"")}},{label:"New Package…",action:()=>{const h=window.prompt("Enter package name:");h&&ve(i(h.trim()))}}]);return w.length?t.jsxs(t.Fragment,{children:[t.jsxs("div",{ref:b,className:"fixed z-50 rounded-lg overflow-hidden py-1",style:{left:e.x,top:e.y,background:f.surface,border:`1px solid ${f.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:f.primary,fontSize:I.xs,borderBottom:`1px solid ${f.border}`},children:v.toUpperCase()}),w.map((h,y)=>t.jsx("div",{className:"px-3 py-2 cursor-pointer transition-colors",style:{color:h.danger?"#DC2626":f.secondary,fontSize:I.explorer.item},onMouseEnter:B=>B.currentTarget.style.background="#F0F0ED",onMouseLeave:B=>B.currentTarget.style.background="transparent",onClick:()=>{h.action(),u||r()},children:h.label},y))]}),u&&t.jsx(yd,{elementId:u.elementId,currentKind:u.currentKind,onClose:()=>{m(null),r()}})]}):null}function Bn({nodes:e,level:r,expanded:n,toggleExpand:o,selectedElementId:a,selectElement:s,selectedElementIds:i,toggleElementSelection:l,violationCounts:c,baseColor:d,onContextMenu:u,onDragStart:m,onDrop:b,isUndefined:v}){return t.jsx(t.Fragment,{children:e.map(w=>{if(w.type==="folder"){const g=n.has(w.id);return t.jsxs("div",{style:{marginLeft:r>0?"16px":"0"},draggable:!0,onDragStart:h=>m(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(ke,{expanded:g,size:12,color:f.muted}),t.jsx(Re,{open:g,color:d}),t.jsx("span",{className:"font-medium flex-1 truncate",style:{color:f.secondary,fontSize:I.explorer.kind},children:w.name})]}),g&&t.jsx(Bn,{nodes:w.children,level:r+1,expanded:n,toggleExpand:o,selectedElementId:a,selectElement:s,selectedElementIds:i,toggleElementSelection:l,violationCounts:c,baseColor:d,onContextMenu:u,onDragStart:m,onDrop:b,isUndefined:v})]},w.id)}else{const g=w.element,h=a===g.id,y=i.has(g.id),B=c.get(g.id)||0,N=ce[g.layer]||d;return t.jsxs(p.Fragment,{children:[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:y?"#FFF3CD":h?f.accent+"18":"transparent",fontWeight:h||y?500:400},draggable:!0,onDragStart:D=>m(D,{type:"element",element:g,id:g.id,name:g.name,children:[]}),onMouseEnter:D=>{!h&&!y&&(D.currentTarget.style.background="#F0F0ED")},onMouseLeave:D=>{D.currentTarget.style.background=y?"#FFF3CD":h?f.accent+"18":"transparent"},onClick:D=>{D.metaKey||D.ctrlKey||D.shiftKey?(D.preventDefault(),l(g.id)):s(g.id)},onContextMenu:D=>u(D,"element",g.id),children:[t.jsx("input",{type:"checkbox",checked:y,onChange:D=>{D.stopPropagation(),l(g.id)},onClick:D=>D.stopPropagation(),className:"flex-shrink-0",style:{width:"12px",height:"12px",cursor:"pointer",opacity:y?1:0,transition:"opacity 120ms",accentColor:"#2DD4A8"},onMouseEnter:D=>{D.currentTarget.style.opacity="1"},onMouseLeave:D=>{D.currentTarget.style.opacity=y?"1":"0"}}),t.jsx(xt,{color:v?"#F59E0B":N}),t.jsx(nl,{element:g,selected:h}),v&&t.jsx("span",{title:`Kind "${g.kind}" is not defined in the ontology`,style:{color:"#F59E0B",fontSize:"12px",flexShrink:0},children:"⚠"}),B>0&&t.jsx("span",{className:"px-1 py-0.5 rounded-full",style:{background:"#FEF2F2",color:"#DC2626",fontSize:I.explorer.count,fontWeight:600,minWidth:"16px",textAlign:"center"},children:B})]}),w.children.length>0&&t.jsx(Bn,{nodes:w.children,level:r+1,expanded:n,toggleExpand:o,selectedElementId:a,selectElement:s,selectedElementIds:i,toggleElementSelection:l,violationCounts:c,baseColor:d,onContextMenu:u,onDragStart:m,onDrop:b,isUndefined:v})]},g.id)}})})}function xd(e,r,n){return e.endsWith("View")||e.endsWith("Viewpoint")||r==="viewpoints"||r==="views"||n==="viewpoints"||n==="views"}function bd(e,r,n){return xd(e,r,n)||e==="ItemDefinition"}function vd(e,r,n){return!n.has(e.kind)&&mo(e,{kinds:r})!==void 0}function wd(e,r){var a;const n=new Map,o=new Map;for(const s of r)for(const i of s.layers)o.has(i.id)||o.set(i.id,i);for(const s of e){const i=((a=s.namespace)==null?void 0:a[0])??s.layer;if(!i||i==="unknown")continue;let l=n.get(i);if(!l){const c=o.get(i);l={id:i,label:(c==null?void 0:c.label)??Gn(i),color:(c==null?void 0:c.color)??ce[i]??"#6B7280",kinds:[]},n.set(i,l)}l.kinds.includes(s.name)||l.kinds.push(s.name)}return[...n.values()]}function kd(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 Sd(e){var n;const r={};for(const o of e)r[o.name]=(n=o.namespace)==null?void 0:n[1];return r}function Gn(e){return e.split(/[_-]/).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join(" ")}function Cd(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 Fr=["documents","assets","templates","analyses","adrs","reviews"];function Ed(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 jd(e,r,n,o,a=[],s){var C,k;const i=r.toLowerCase(),l=new Set(["views","viewpoints","manifest"]),c=kd(n),d=Sd(n),u=wd(n,o).filter(T=>!l.has(T.id)),m=new Set(u.map(T=>T.id)),b=new Map;for(const T of e){if(s&&!s.has(T.kind))continue;const z=c[T.kind]??T.layer,_=d[T.kind];bd(T.kind,z,_)||i&&!T.name.toLowerCase().includes(i)&&!T.kind.toLowerCase().includes(i)||b.set(T.id,T)}const v=new Map;for(const T of b.values())v.set(T.id,{id:T.id,name:T.name,type:"element",element:T,children:[]});const w=Wn(b.values()),g=[];for(const T of v.values()){const z=(C=T.element)==null?void 0:C.owner,_=(z?v.get(z):void 0)??(T.element?v.get(((k=Hn(T.element,w))==null?void 0:k.id)??""):void 0);_&&_!==T?_.children.push(T):g.push(T)}const h=T=>{T.sort((z,_)=>z.type!==_.type?z.type==="folder"?-1:1:z.name.localeCompare(_.name)),T.forEach(z=>h(z.children))};for(const T of v.values())h(T.children);const y=T=>{var j,L,E,O;const z=(L=(j=n.find(V=>V.name===T))==null?void 0:j.namespace)==null?void 0:L[0];let _=T;for(;;){const V=n.find($=>$.name===_);if(!V||V.isAbstract||!V.superType||((O=(E=n.find($=>$.name===V.superType))==null?void 0:E.namespace)==null?void 0:O[0])!==z)return _;_=V.superType}},B=(T,z,_)=>{var E;const j=new Map;for(const O of T){const V=O.element.kind,U=_==="artifacts"?Ed(V,(E=n.find(K=>K.name===V))==null?void 0:E.superType):d[V]??"";j.has(U)||j.set(U,new Map);const $=j.get(U);$.set(V,[...$.get(V)??[],O])}const L=new Map;for(const[O,V]of j.entries()){const U=new Map;for(const[Y,Q]of V.entries())Q.length===1&&U.set(Y,y(Y));const $=new Map;for(const Y of U.values())$.set(Y,($.get(Y)??0)+1);const K=new Map;for(const[Y,Q]of V.entries()){const ee=U.get(Y),M=ee&&($.get(ee)??0)>1?ee:Y;K.set(M,[...K.get(M)??[],...Q])}const J=new Map;for(const[Y,Q]of K.entries()){const ee=[...Q];h(ee),J.set(Y,ee)}L.set(O,J)}return[...L.entries()].sort(([O],[V])=>_==="artifacts"?Fr.indexOf(O)-Fr.indexOf(V):O.localeCompare(V)).map(([O,V])=>({id:O,label:O?Gn(O):"",color:O?ce[O]??z:z,kinds:V}))},N=[];for(const T of u){const z=[];for(const _ of g){const j=_.element,L=c[j.kind];!L||L!==T.id||z.push(_)}z.length>0&&N.push({group:T,subGroups:B(z,T.color,T.id)})}const D=[],A=[],F=new Set(n.map(T=>T.name));for(const T of g){const z=T.element,_=c[z.kind];_&&m.has(_)||_&&l.has(_)||(vd(z,n,F)?D.push(T):A.push(T))}if(D.length>0){const T="#64748B";N.push({group:{id:"standard-sysml-diagram-elements",label:"Other — SysML Diagram Elements",color:T,kinds:[]},subGroups:B(D,T).map(z=>({...z,id:"diagram-elements",label:"Diagram Elements"}))})}if(A.length>0){const T="#F59E0B";N.push({group:{id:"undefined",label:"Undefined — Not in Ontology",color:T,kinds:[]},subGroups:B(A,T).map(z=>({...z,id:"undefined-elements",label:"Elements"}))})}return N}function Dd(e,r=""){const n=Wn(e),o=new Map;for(const l of e){const c=Hn(l,n);c&&o.set(c.id,[...o.get(c.id)??[],l])}const a=r.trim().toLowerCase(),s=l=>!a||l.definition.name.toLowerCase().includes(a)||l.definition.kind.toLowerCase().includes(a)||l.usages.some(c=>c.name.toLowerCase().includes(a)),i=new Map;for(const l of new Set(n.values())){const c={definition:l,usages:(o.get(l.id)??[]).sort((u,m)=>u.name.localeCompare(m.name))};if(!s(c))continue;const d=l.layer&&l.layer!=="unknown"?l.layer:"other";i.set(d,[...i.get(d)??[],c])}return[...i.entries()].sort(([l],[c])=>{const d=u=>{const m=Te.indexOf(u);return m<0?Number.MAX_SAFE_INTEGER:m};return d(l)-d(c)||l.localeCompare(c)}).map(([l,c])=>({layer:l,definitions:c.sort((d,u)=>d.definition.name.localeCompare(u.definition.name))}))}function Bd({searchTerm:e,selectedElementId:r,onSelect:n,onContextMenu:o}){const a=S(d=>d.model),[s,i]=p.useState(new Set),l=p.useMemo(()=>Dd(Object.values((a==null?void 0:a.elements)??{}),e),[a,e]),c=d=>i(u=>{const m=new Set(u);return m.has(d)?m.delete(d):m.add(d),m});return l.length===0?t.jsx("div",{className:"flex-1 flex items-center justify-center px-4 text-center",style:{color:f.faint,fontSize:"12px",lineHeight:1.6},children:e?"No definition matches that search.":"This model declares no definitions of its own. The ontology’s types are in the Ontology tab."}):t.jsx("div",{className:"flex-1 overflow-y-auto py-1",style:{fontSize:I.explorer.item},children:l.map(({layer:d,definitions:u})=>{const m=!s.has(`l:${d}`),b=ce[d]??f.muted;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"},onClick:()=>c(`l:${d}`),children:[t.jsx(ke,{expanded:m,size:13,color:b}),t.jsx(Re,{open:m,color:b}),t.jsx("span",{className:"font-semibold flex-1 truncate",style:{color:f.primary,fontSize:I.explorer.group},children:Le[d]??Gn(d)}),t.jsx(Ht,{count:u.length,color:b,title:`${u.length} definitions`})]}),m&&u.map(({definition:v,usages:w})=>{const g=!s.has(v.id);return t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-1.5 py-1 cursor-pointer select-none",style:{paddingLeft:"22px",paddingRight:"8px",borderRadius:"4px",margin:"0 4px",background:v.id===r?"#EEF2FF":"transparent"},onClick:()=>{w.length&&c(v.id),n(v.id)},onContextMenu:h=>o(h,"element",v.id),children:[w.length?t.jsx(ke,{expanded:g,size:12}):t.jsx("span",{style:{width:"12px",display:"inline-block"}}),t.jsx(xt,{color:b}),t.jsx("span",{className:"truncate flex-1",style:{color:f.primary},children:v.name}),t.jsx("span",{style:{color:w.length?f.muted:"#B45309",fontSize:I.explorer.count},children:w.length===0?"unused":`${w.length}×`})]}),g&&w.map(h=>t.jsxs("div",{className:"flex items-center gap-1.5 py-1 cursor-pointer select-none",style:{paddingLeft:"48px",paddingRight:"8px",borderRadius:"4px",margin:"0 4px",background:h.id===r?"#EEF2FF":"transparent"},onClick:()=>n(h.id),onContextMenu:y=>o(y,"element",h.id),children:[t.jsx(xt,{}),t.jsx("span",{className:"truncate flex-1",style:{color:f.secondary},children:h.name}),t.jsx("span",{style:{color:f.faint,fontSize:I.explorer.count},children:h.construct})]},h.id))]},v.id)})]},d)})})}function Fd({searchTerm:e,selectedElementId:r,onSelect:n,onContextMenu:o}){const a=S(m=>m.model),s=S(m=>m.availableOntologies),[i,l]=p.useState(new Set),c=p.useMemo(()=>{const m=Object.values((a==null?void 0:a.elements)??{}),b=Eo(s),v=new Map(m.map(h=>[h.id,h])),w=(a==null?void 0:a.relationships)??[],g=Co.map(h=>h.id==="usecases"?{...h,systemOf:y=>Pi(y,v,w,b)}:h);return zi(m,g,e)},[a,s,e]),d=m=>l(b=>{const v=new Set(b);return v.has(m)?v.delete(m):v.add(m),v}),u=(m,b)=>{var g;const v=m.children.length>0,w=!i.has(m.id);return t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-1.5 py-1 cursor-pointer select-none",style:{paddingLeft:`${8+b*14}px`,paddingRight:"8px",borderRadius:"4px",margin:"0 4px",background:m.element&&m.element.id===r?"#EEF2FF":"transparent"},onClick:()=>{v&&d(m.id),m.element&&n(m.element.id)},onContextMenu:m.element?h=>o(h,"element",m.element.id):void 0,children:[v?t.jsx(ke,{expanded:w,size:12}):t.jsx("span",{style:{width:"12px",display:"inline-block"}}),m.isGroup?t.jsx(Re,{open:w}):t.jsx(xt,{}),t.jsxs("span",{className:"truncate flex-1",style:{color:f.primary},children:[m.name,((g=m.element)==null?void 0:g.isDefinition)&&t.jsx("span",{style:{color:f.muted,fontWeight:600,marginLeft:"5px",fontSize:"0.85em"},children:"def"})]}),!m.isGroup&&t.jsx("span",{style:{color:f.faint,fontSize:I.explorer.count},children:m.kind})]}),w&&m.children.map(h=>u(h,b+1))]},m.id)};return c.length===0?t.jsx("div",{className:"flex-1 flex items-center justify-center px-4 text-center",style:{color:f.faint,fontSize:"12px"},children:e?"Nothing matches that search.":"No composition to show yet."}):t.jsx("div",{className:"flex-1 overflow-y-auto py-1",style:{fontSize:I.explorer.item},children:c.map(m=>{const b=!i.has(`b:${m.id}`);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"},onClick:()=>d(`b:${m.id}`),children:[t.jsx(ke,{expanded:b,size:13}),t.jsx(Re,{open:b}),t.jsx("span",{className:"font-semibold flex-1",style:{color:f.primary,fontSize:I.explorer.kind},children:m.label}),t.jsx("span",{style:{color:f.faint,fontSize:I.explorer.count},children:m.nodes.length})]}),b&&m.nodes.map(v=>u(v,1))]},m.id)})})}function Ar({searchTerm:e}){var ee;const r=Ce(),n=S(M=>M.model),o=S(M=>M.selectedElementId),a=S(M=>M.selectElement),s=S(M=>M.setActiveView),i=S(M=>M.selectedElementIds),l=S(M=>M.toggleElementSelection),c=S(M=>M.selectAllElements),d=S(M=>M.clearElementSelection),u=S(M=>M.moveElementToPackage),m=S(M=>M.movePackage),b=S(M=>M.validation),v=S(M=>M.availableOntologies),w=S(M=>M.setExplorerTab),g=S(M=>M.setActiveMode),h=S(M=>M.setSelectedOntologyKind),y=((ee=n==null?void 0:n.registries)==null?void 0:ee.kinds)??[],B=p.useCallback(M=>{var P;a(M),s({type:"element-detail",elementId:M});const x=(P=n==null?void 0:n.elements)==null?void 0:P[M];x&&r(Bo(x.shortId??x.id))},[a,s,n,r]),[N,D]=p.useState("catalog"),[A,F]=p.useState(new Set),C=p.useRef(!1),[k,T]=p.useState(null),[z,_]=p.useState(null),[j,L]=p.useState(new Set),E=p.useCallback((M,x)=>{x==null||x.stopPropagation(),F(P=>{const q=new Set(P);return q.has(M)?q.delete(M):q.add(M),q})},[]),O=p.useCallback((M,x,P,q)=>{M.preventDefault(),T({x:M.clientX,y:M.clientY,type:x,elementId:x==="element"?P:void 0,packageName:x==="folder"?P.replace("f:",""):void 0,kind:q||(x==="kind"?P.replace("k:","").split(":").pop():void 0)})},[]),V=p.useMemo(()=>{var M;return n?jd(Object.values(n.elements),e,((M=n.registries)==null?void 0:M.kinds)??[],v,n.packages??[],j.size?j:void 0):[]},[n,e,v,j]);p.useEffect(()=>{if(C.current||V.length===0)return;const M=new Set;for(const{group:x,subGroups:P}of V)for(const q of P)for(const X of q.kinds.keys())M.add(`k:${x.id}:${q.id?`${q.id}:`:""}${X}`);C.current=!0,F(M)},[V]),p.useEffect(()=>{const M=()=>{if(!e.trim())return;const P=new Set;for(const{group:q,subGroups:X}of V){P.add(`g:${q.id}`);for(const ie of X){ie.id&&P.add(`sg:${q.id}:${ie.id}`);for(const oe of ie.kinds.keys())P.add(`k:${q.id}:${ie.id?`${ie.id}:`:""}${oe}`)}}F(P)},x=()=>F(new Set);return window.addEventListener("memo:expand-explorer-search",M),window.addEventListener("memo:collapse-explorer-tree",x),()=>{window.removeEventListener("memo:expand-explorer-search",M),window.removeEventListener("memo:collapse-explorer-tree",x)}},[V,e]);const U=p.useCallback((M,x,P)=>{var q;_({id:x.id,kind:P}),M.dataTransfer.setData("application/memo-node",JSON.stringify({id:x.id,type:x.type,kind:P,name:x.name,elementId:(q=x.element)==null?void 0:q.id,packageName:x.type==="folder"?x.id.replace("f:",""):void 0})),M.dataTransfer.effectAllowed="move"},[]),$=p.useCallback((M,x)=>{(z==null?void 0:z.kind)===x&&(M.preventDefault(),M.dataTransfer.dropEffect="move")},[z]),K=p.useCallback((M,x,P)=>{M.preventDefault(),_(null);try{const q=JSON.parse(M.dataTransfer.getData("application/memo-node"));if(q.kind!==P)return;if(q.type==="element")ve(u(q.elementId,x));else if(q.type==="folder"){if(x===q.packageName||x.startsWith(`${q.packageName}::`))return;ve(m(q.packageName,x))}}catch(q){console.error("Drop error:",q)}},[u,m]),J=p.useMemo(()=>{const M=new Map;if(b)for(const x of b.violations)M.set(x.elementId,(M.get(x.elementId)||0)+1);return M},[b]),Y=p.useMemo(()=>{const M=[],x=P=>{for(const q of P)q.type==="element"&&q.element?M.push(q.element.id):x(q.children)};for(const{subGroups:P}of V)for(const q of P)for(const X of q.kinds.values())x(X);return M},[V]),Q=i.size;return t.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[t.jsxs("details",{className:"px-3 py-1.5 flex-shrink-0",style:{borderBottom:`1px solid ${f.border}`,fontSize:I.xs},children:[t.jsxs("summary",{style:{cursor:"pointer",color:f.secondary},children:["Filter element types",j.size?` (${j.size})`:""]}),t.jsxs("div",{className:"mt-1 max-h-32 overflow-y-auto",children:[t.jsx("button",{onClick:()=>L(new Set),style:{color:f.accent,fontSize:I.xs},children:"Show all"}),y.filter(M=>!M.isAbstract).sort((M,x)=>M.name.localeCompare(x.name)).map(M=>t.jsxs("label",{className:"flex items-center gap-1 py-0.5",children:[t.jsx("input",{type:"checkbox",checked:!j.size||j.has(M.name),onChange:()=>L(x=>{const P=x.size?new Set(x):new Set(y.filter(q=>!q.isAbstract).map(q=>q.name));return P.has(M.name)?P.delete(M.name):P.add(M.name),P})}),M.label||M.name]},M.name))]})]}),Q>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:[Q," selected"]}),t.jsx("span",{style:{color:"#B45309"},children:"— Cmd/Ctrl+click to multi-select"}),t.jsx("button",{onClick:d,className:"ml-auto px-2 py-0.5 rounded",style:{color:"#92400E",background:"#FDE68A",fontSize:"12px",fontWeight:500},children:"Clear"})]}),e&&Y.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:[Y.length," matching"]}),t.jsx("button",{onClick:()=>c(Y),className:"ml-auto px-2 py-0.5 rounded",style:{color:"#0369A1",background:"#BAE6FD",fontSize:"12px",fontWeight:500},children:"Select All"})]}),t.jsx("div",{className:"flex px-2 pt-1.5 pb-1 gap-1 flex-shrink-0",children:["catalog","breakdown","definitions"].map(M=>t.jsx("button",{onClick:()=>D(M),className:"px-2 py-0.5 rounded capitalize",style:{fontSize:"11px",fontWeight:500,...N===M?{background:f.accent,color:"#fff"}:{background:"transparent",color:f.faint}},children:M},M))}),N==="definitions"?t.jsx(Bd,{searchTerm:e,selectedElementId:o,onSelect:B,onContextMenu:O}):N==="breakdown"?t.jsx(Fd,{searchTerm:e,selectedElementId:o,onSelect:B,onContextMenu:O}):t.jsx("div",{className:"flex-1 overflow-y-auto py-1",style:{fontSize:I.explorer.item},children:V.map(({group:M,subGroups:x})=>{const P=`g:${M.id}`,q=A.has(P),X=M.id==="undefined",ie=H=>H.reduce((G,Z)=>G+(Z.type==="element"?1:ie(Z.children)),0),oe=H=>Array.from(H.kinds.values()).reduce((G,Z)=>G+ie(Z),0),R=x.reduce((H,G)=>H+oe(G),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",...X?{background:"#FFF3CD"}:{}},onMouseEnter:H=>H.currentTarget.style.background=X?"#FDE68A":"#F0F0ED",onMouseLeave:H=>H.currentTarget.style.background=X?"#FFF3CD":"transparent",onClick:()=>E(P),onContextMenu:H=>O(H,"group",P),children:[t.jsx(ke,{expanded:q,size:14,color:M.color}),X?t.jsx("span",{style:{fontSize:"14px",lineHeight:1,flexShrink:0},children:"⚠"}):t.jsx(Re,{open:q,color:M.color}),t.jsx("span",{className:"font-semibold flex-1 truncate",style:{color:X?"#92400E":f.primary,fontSize:I.explorer.group},children:M.label}),t.jsx("span",{className:"px-1.5 py-0.5 rounded-full",style:{background:M.color+"25",color:M.color,fontSize:I.explorer.count,fontWeight:600,minWidth:"20px",textAlign:"center"},children:R})]}),(()=>{const H=(G,Z,le)=>{const ae=`k:${M.id}:${le?le+":":""}${G}`,me=A.has(ae),Ee=ne=>{var re;for(const Pe of ne){if(Pe.type==="element")return(re=Pe.element)==null?void 0:re.layer;const kt=Ee(Pe.children);if(kt)return kt}},Me=Ee(Z),te=X?"#F59E0B":Me&&ce[Me]||M.color,fe=y.some(ne=>ne.name===G),et=ne=>ne.flatMap(re=>re.type==="element"&&re.element?[re.element.id]:et(re.children)),_e=et(Z);return t.jsxs("div",{style:{marginLeft:"16px"},onDragOver:ne=>$(ne,G),onDrop:ne=>K(ne,"",G),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:ne=>ne.currentTarget.style.background="#F0F0ED",onMouseLeave:ne=>ne.currentTarget.style.background="transparent",onClick:()=>E(ae),onContextMenu:ne=>O(ne,"kind",ae,G),children:[t.jsx(ke,{expanded:me,size:12,color:f.muted}),t.jsx(Re,{open:me,color:te}),t.jsxs("span",{className:"font-medium flex-1 truncate",style:{color:X?"#B45309":f.secondary,fontSize:I.explorer.kind},children:[Cd(G,_e.length),X&&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:ne=>{ne.stopPropagation(),c(_e)},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:f.faint,fontSize:"17px"},children:"☑"}),fe&&ue("ontology")&&t.jsx("button",{onClick:ne=>{ne.stopPropagation();for(const re of v)for(const Pe of re.layers)if(Pe.kinds.some(kt=>kt.name===G)){h(G),w("ontologies"),g("ontology"),s({type:"ontology-detail",packageName:re.name,layerId:Pe.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:f.faint,fontSize:"17px"},children:"⬡"})]}),t.jsx(Ht,{count:_e.length,color:te,title:`${_e.length} ${_e.length===1?"element":"elements"}`})]}),me&&t.jsx(Bn,{nodes:Z,level:0,expanded:A,toggleExpand:E,selectedElementId:o,selectElement:B,selectedElementIds:i,toggleElementSelection:l,violationCounts:J,baseColor:te,onContextMenu:(ne,re,Pe)=>O(ne,re,Pe,G),onDragStart:(ne,re)=>U(ne,re,G),onDrop:(ne,re)=>K(ne,re,G),isUndefined:X})]},G)};return q?x.map(G=>{if(!G.id)return t.jsx("div",{children:Array.from(G.kinds.entries()).map(([me,Ee])=>H(me,Ee,""))},"__root");const Z=`sg:${M.id}:${G.id}`,le=A.has(Z),ae=oe(G);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:me=>me.currentTarget.style.background="#F0F0ED",onMouseLeave:me=>me.currentTarget.style.background="transparent",onClick:()=>E(Z),children:[t.jsx(ke,{expanded:le,size:13,color:G.color}),t.jsx(Re,{open:le,color:G.color}),t.jsx("span",{className:"font-semibold flex-1 truncate",style:{color:f.primary,fontSize:I.explorer.kind},children:G.label}),t.jsx("span",{className:"px-1.5 py-0.5 rounded-full",style:{background:G.color+"25",color:G.color,fontSize:I.explorer.count,fontWeight:600,minWidth:"20px",textAlign:"center"},children:ae})]}),le&&Array.from(G.kinds.entries()).map(([me,Ee])=>H(me,Ee,G.id))]},G.id)}):null})()]},M.id)})}),k&&t.jsx(gd,{menu:k,onClose:()=>T(null)})]})}function Ad({diagram:e}){const r=e.viewKind?Kn[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:I.badge},title:r.fullName,children:r.label});const n=["afd","ofd","ffd"].includes(e.diagramType.toLowerCase())?Vi(e):e.diagramType,o=$e[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:I.badge},title:o.fullName,children:o.code}):null}function Nd({viewpointId:e,onClose:r}){const n=S(d=>d.createDiagram),[o,a]=p.useState("Untitled"),[s,i]=p.useState("bdd"),l=p.useRef(null);p.useEffect(()=>{const d=u=>{l.current&&!l.current.contains(u.target)&&r()};return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[r]);const c=()=>{o.trim()&&(n({name:o.trim(),diagramType:s,viewpointId:e}),r())};return t.jsxs("div",{ref:l,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:f.primary,fontSize:"13px"},children:"New Model View"}),t.jsx("label",{className:"block mb-1",style:{fontSize:I.xs,color:f.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:f.primary,fontSize:"13px"}}),t.jsx("label",{className:"block mb-1",style:{fontSize:I.xs,color:f.secondary},children:"Type"}),t.jsx("select",{value:s,onChange:d=>i(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:f.primary,fontSize:"13px"},children:Object.entries($e).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:f.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:f.accent},children:"Create"})]})]})}const Td=new Set(["__unassigned","__model"]),Ne="__uncategorized";function Ao(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 s=(n.explorerOrder??Number.MAX_SAFE_INTEGER)-(o.explorerOrder??Number.MAX_SAFE_INTEGER);if(s!==0)return s}return n.label.localeCompare(o.label)})}function No(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 s=a.split(" ");return s.length>1&&s[0]===n})?e.map(a=>a.slice(n.length+1)):e}function Rd(e){const r=Ao(((e==null?void 0:e.viewpoints)??[]).filter(o=>!Td.has(o.id))),n=new Set;for(const o of r)for(const a of zt(e,o.id))n.add(a.id);return{viewpoints:r,uncategorized:((e==null?void 0:e.diagrams)??[]).filter(o=>!n.has(o.id))}}function To(e){const r=new Map(e.map(s=>[s.id,s])),n=s=>{var l;const i=new Set([s.id]);for(let c=s.parentId;c;c=(l=r.get(c))==null?void 0:l.parentId){if(i.has(c))return;i.add(c)}return s.parentId&&r.has(s.parentId)?s.parentId:void 0},o=new Map,a=[];for(const s of e){const i=n(s);i?o.set(i,[...o.get(i)??[],s]):a.push(s)}return{rootViewpoints:a,viewpointChildren:o}}function Id(e){const r=[];for(const o of e){let a=r,s="",i;for(const l of(o.package??"").split("::").filter(Boolean)){s=s?`${s}::${l}`:l;let c=a.find(d=>d.id===s);c||(c={id:s,name:l,children:[],diagrams:[]},a.push(c)),i=c,a=c.children}if(a===r){let l=r.find(c=>c.id==="__unpackaged");l||(l={id:"__unpackaged",name:"No owning package",children:[],diagrams:[]},r.push(l)),l.diagrams.push(o)}else i.diagrams.push(o)}const n=o=>{o.sort((a,s)=>a.name.localeCompare(s.name)),o.forEach(a=>{a.diagrams.sort((s,i)=>s.name.localeCompare(i.name)),n(a.children)})};return n(r),r}function Md({searchTerm:e}){const r=S(j=>j.model),n=S(j=>j.activeView),o=S(j=>j.setActiveView),a=S(j=>j.selectViewpoint),s=S(j=>j.deleteDiagram),i=S(j=>j.createPackage),l=S(j=>j.moveElementToPackage),c=Ce(),d=j=>{if(!j.elementId)return;const L=window.prompt(`Move “${j.name}” into which package? (qualified name, e.g. Views::Safety)`,j.package??"");L!==null&&ve(l(j.elementId,L.trim()))},u=j=>{const L=zt(r,j).map(O=>O.package).filter(O=>!!O);if(L.length===0)return;const E=new Map;for(const O of L)E.set(O,(E.get(O)??0)+1);return[...E.entries()].sort((O,V)=>V[1]-O[1]||O[0].length-V[0].length||O[0].localeCompare(V[0]))[0][0]},[m,b]=p.useState(new Set),[v,w]=p.useState(null),g=j=>{b(L=>{const E=new Set(L);return E.has(j)?E.delete(j):E.add(j),E})},{viewpoints:h,uncategorized:y}=p.useMemo(()=>Rd(r),[r]),B=p.useMemo(()=>{const j=No(h.map(L=>L.label));return new Map(h.map((L,E)=>[L.id,j[E]]))},[h]),{rootViewpoints:N,viewpointChildren:D}=p.useMemo(()=>To(h),[h]),A=j=>{if(!e)return j;const L=e.toLowerCase();return j.filter(E=>E.name.toLowerCase().includes(L)||E.diagramType.toLowerCase().includes(L))},F=n.type==="diagram"?n.diagramId:null,C=A(y),k=p.useMemo(()=>{const j=new Map;for(const L of C){const O=[...(L.elementIds??[]).map(V=>{var U;return(U=r==null?void 0:r.elements[V])==null?void 0:U.layer}).filter(V=>!!V)].sort((V,U)=>{const $=Te.indexOf(V),K=Te.indexOf(U);return($<0?Number.MAX_SAFE_INTEGER:$)-(K<0?Number.MAX_SAFE_INTEGER:K)})[0]??"other";j.set(O,[...j.get(O)??[],L])}return[...j.entries()].sort(([L],[E])=>{const O=Te.indexOf(L),V=Te.indexOf(E);return(O<0?Number.MAX_SAFE_INTEGER:O)-(V<0?Number.MAX_SAFE_INTEGER:V)})},[C,r==null?void 0:r.elements]),T=(j,L)=>j.map(E=>t.jsx(_d,{diag:E,isSelected:F===E.id,onSelect:()=>{o({type:"diagram",diagramId:E.id}),a(L==="__model"?null:L),c(Fo(E.diagramType,E.shortId??E.id))},onDelete:E.auto?void 0:()=>s(E.id),onMoveToPackage:E.elementId?()=>d(E):void 0},E.id)),z=(j,L)=>{const E=Id(j),O=($,K=0)=>t.jsxs("div",{style:{marginLeft:K?"12px":0},children:[t.jsx("div",{className:"px-2 py-1 font-semibold",style:{color:f.muted,fontSize:I.xs},children:$.name}),t.jsx("div",{style:{marginLeft:"8px"},children:T($.diagrams,L)}),$.children.map(J=>O(J,K+1))]},$.id);if(j.some($=>$.package))return E.map($=>O($));const V=$=>$.group;if(!j.some($=>V($)))return T(j,L);const U=new Map;for(const $ of j){const K=V($)||"Other";U.set(K,[...U.get(K)??[],$])}return[...U.entries()].sort(([$],[K])=>$.localeCompare(K)).map(([$,K])=>t.jsxs("div",{style:{margin:"5px 4px 2px"},children:[t.jsx("div",{className:"px-2 py-1 font-semibold",style:{color:f.muted,fontSize:I.xs},children:$}),t.jsx("div",{style:{marginLeft:"8px"},children:T(K,L)})]},$))},_=(j,L)=>{var J;const E=D.get(j.id)??[],O=m.has(j.id),V=(J=j.visibleLayers)!=null&&J[0]&&ce[j.visibleLayers[0]]||f.muted,U=zt(r,j.id),$=A(U),K=(function Y(Q){return zt(r,Q.id).length+(D.get(Q.id)??[]).reduce((ee,M)=>ee+Y(M),0)})(j);return t.jsxs("div",{className:"mb-0.5",style:{marginLeft:L?"14px":0},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:Y=>Y.currentTarget.style.background="#F0F0ED",onMouseLeave:Y=>Y.currentTarget.style.background="transparent",onClick:()=>{a(j.id),g(j.id)},children:[t.jsx(ke,{expanded:O,size:14,color:V}),t.jsx(Re,{open:O,color:V}),t.jsx("span",{className:"font-semibold flex-1 truncate",style:{color:f.primary,fontSize:I.explorer.group},children:B.get(j.id)??j.label}),t.jsx(Ht,{count:K,color:V,title:E.length?`${U.length} views here, ${K} including the viewpoints it frames`:`${U.length} views`})]}),O&&t.jsxs("div",{style:{marginLeft:"16px"},children:[E.map(Y=>_(Y,L+1)),z($,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:f.accent,fontSize:I.xs,background:"transparent"},onMouseEnter:Y=>Y.currentTarget.style.background=f.accent+"12",onMouseLeave:Y=>Y.currentTarget.style.background="transparent",onClick:()=>w(j.id),children:[t.jsx("span",{style:{fontSize:"14px",lineHeight:1},children:"+"})," New View"]}),t.jsxs("button",{className:"flex items-center gap-1 px-2 py-1 w-full text-left",style:{borderRadius:"4px",margin:"2px 4px",color:f.accent,fontSize:I.xs,background:"transparent"},onMouseEnter:Y=>Y.currentTarget.style.background=f.accent+"12",onMouseLeave:Y=>Y.currentTarget.style.background="transparent",onClick:()=>{const Y=u(j.id),Q=window.prompt(Y?`New package under ${Y}`:"New SysML package name");Q!=null&&Q.trim()&&ve(i(Q.trim(),Y))},children:[t.jsx("span",{style:{fontSize:"14px",lineHeight:1},children:"+"})," New Package"]})]})]},j.id)};return t.jsxs("div",{className:"flex-1 overflow-y-auto py-1",style:{fontSize:I.explorer.item},children:[N.map(j=>_(j,0)),C.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),g(Ne)},children:[t.jsx(ke,{expanded:m.has(Ne),size:14,color:f.muted}),t.jsx(Re,{open:m.has(Ne),color:f.muted}),t.jsx("span",{className:"font-semibold flex-1",style:{color:f.primary,fontSize:I.explorer.group},children:"Uncategorized"}),t.jsx("span",{title:"These views conform to no authored viewpoint. Bind an authored view with viewpointDefinition to file it.",style:{color:f.faint,fontSize:I.badge},children:"no viewpoint"}),t.jsx(Ht,{count:C.length,color:f.muted,title:`${C.length} views`})]}),m.has(Ne)&&t.jsxs("div",{style:{marginLeft:"16px"},children:[C.some(j=>j.group)?z(C,Ne):k.map(([j,L])=>t.jsxs("div",{style:{margin:"5px 4px 2px"},children:[t.jsx("div",{className:"px-2 py-1 font-semibold",style:{color:ce[j]??f.muted,fontSize:I.xs,borderLeft:`3px solid ${ce[j]??f.border}`},children:Le[j]??`${j.charAt(0).toUpperCase()}${j.slice(1)}`}),t.jsx("div",{style:{marginLeft:"8px"},children:T(L,Ne)})]},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:f.accent,fontSize:I.xs,background:"transparent"},onMouseEnter:j=>j.currentTarget.style.background=f.accent+"12",onMouseLeave:j=>j.currentTarget.style.background="transparent",onClick:()=>w("__model"),children:[t.jsx("span",{style:{fontSize:"14px",lineHeight:1},children:"+"})," New View"]})]})]}),v!==null&&t.jsx(Nd,{viewpointId:v,onClose:()=>w(null)})]})}function _d({diag:e,isSelected:r,onSelect:n,onDelete:o,onMoveToPackage:a}){var c;const[s,i]=p.useState(!1);$e[e.diagramType];const l=((c=e.elementIds)==null?void 0:c.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?f.accent+"18":s?"#F0F0ED":"transparent",fontSize:I.explorer.item},onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),onClick:n,title:e.description,children:[t.jsx(Ad,{diagram:e}),e.auto&&!e.sourceFile&&t.jsx("span",{className:"px-1 py-0.5 rounded",style:{background:"#F0F0ED",color:f.faint,fontSize:I.badge,fontWeight:600},children:"AUTO"}),t.jsx("span",{className:"flex-1",style:{minWidth:0},children:t.jsxs("span",{className:"truncate block",style:{color:r?f.accentDark:f.primary},children:[t.jsxs("span",{style:{color:f.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:f.muted,fontSize:I.explorer.count,fontWeight:600,minWidth:"18px",textAlign:"center"},children:l}),a&&s&&t.jsx("button",{onClick:d=>{d.stopPropagation(),a()},title:"Move this view into a package","aria-label":`Move ${e.name} into a package`,style:{background:"none",border:"none",cursor:"pointer",color:f.muted,fontSize:"12px",padding:"0 2px",lineHeight:1},children:"⌸"}),o&&s&&t.jsx("button",{onClick:d=>{d.stopPropagation(),o()},title:"Delete diagram",style:{background:"none",border:"none",cursor:"pointer",color:"#DC2626",fontSize:"12px",padding:"0 2px",lineHeight:1},children:"×"})]})}function Pd(){const e=S(D=>D.setActiveView),r=S(D=>D.activeView),n=S(D=>D.dhfDocuments),o=S(D=>D.addDhfDocument),a=S(D=>D.removeDhfDocument),s=S(D=>D.dhfSettings),[i,l]=p.useState(new Set(Ke.map(D=>D.id))),[c,d]=p.useState(null),[u,m]=p.useState(null),b=r.type==="dhf-document"?r.docId:null,v=p.useMemo(()=>{const D=new Set(Ke.map(A=>A.label));return[...new Set(n.map(A=>A.group))].filter(A=>A&&!D.has(A)).sort()},[n]),w=S(D=>D.model),g=p.useMemo(()=>{const D=(w==null?void 0:w.elements)??{};return So(n,A=>{const F=A.systemId?D[A.systemId]:void 0;return F?{systemId:F.id,label:F.name||F.id}:A.systemId?{systemId:A.systemId,label:A.systemId}:{label:Vn}})},[n,w]),h=D=>[...Ke.filter(A=>D.some(F=>F.group===A.label)).map(A=>({key:A.id,groupId:A.id,label:A.label,color:A.color,docs:D.filter(F=>F.group===A.label)})),...v.filter(A=>D.some(F=>F.group===A)).map(A=>({key:`custom:${A}`,groupId:void 0,label:A,color:id(A),docs:D.filter(F=>F.group===A)}))];function y(D){l(A=>{const F=new Set(A);return F.has(D)?F.delete(D):F.add(D),F})}function B(D,A){D.preventDefault(),D.stopPropagation(),m({x:D.clientX,y:D.clientY,groupId:A})}function N(D){const A=s.documentNumberingPrefix||"DOC",F=[];for(const C of D){const k=`${A}-${C.prefix}-`,T=[...n,...F].filter(O=>O.id.startsWith(k)),z=`${k}${String(T.length+1).padStart(3,"0")}`,_=O=>O.replace(/^---[\s\S]*?---\n?/,""),j=C.content!==null?_(C.content):(()=>{const O=rd(C.templateId);return O?_(O):`# ${C.title}
|
|
4047
4047
|
|
|
4048
4048
|
_[TODO: Add content]_
|
|
4049
4049
|
`})(),L=`---
|
|
4050
|
-
id: ${
|
|
4051
|
-
title: ${
|
|
4052
|
-
template: ${
|
|
4050
|
+
id: ${z}
|
|
4051
|
+
title: ${C.title}
|
|
4052
|
+
template: ${C.templateId}
|
|
4053
4053
|
---
|
|
4054
4054
|
|
|
4055
|
-
${M}`,C={id:P,title:v.title,group:v.groupLabel,templateId:v.templateId,content:L,createdAt:Date.now(),authors:"",approvers:""};o(C),A.push(C),A.length===1&&e({type:"dhf-document",docId:C.id})}d(null)}return p.useEffect(()=>{if(!u)return;function D(){m(null)}return window.addEventListener("click",D),()=>window.removeEventListener("click",D)},[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:f.accentDark,fontSize:T.explorer.item,fontWeight:600,color:"#fff",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",gap:"6px"},onMouseEnter:D=>{D.currentTarget.style.background="#254B60"},onMouseLeave:D=>{D.currentTarget.style.background=f.accentDark},children:[t.jsx("span",{style:{fontSize:"14px",lineHeight:1},children:"+"})," New Document"]})}),g.map(D=>t.jsxs("div",{children:[g.length>1&&t.jsx("div",{style:{padding:"9px 10px 2px",fontSize:"10px",fontWeight:700,letterSpacing:".07em",textTransform:"uppercase",color:f.muted},children:D.label}),h(D.items).map(R=>{const A=`${D.systemId??"global"}:${R.key}`,v=i.has(R.key);return t.jsxs("div",{children:[t.jsxs("button",{onClick:()=>y(R.key),onContextMenu:R.groupId?k=>B(k,R.groupId):void 0,className:"w-full flex items-center gap-2 px-3 py-2 text-left",style:{fontSize:T.xs,fontWeight:600,color:f.secondary,borderRadius:"4px"},onMouseEnter:k=>k.currentTarget.style.background=f.surfaceAlt,onMouseLeave:k=>k.currentTarget.style.background="transparent",title:R.groupId?"Right-click to add documents":void 0,children:[t.jsx("span",{style:{display:"inline-block",width:"7px",height:"7px",borderRadius:"50%",background:R.color,flexShrink:0}}),t.jsx("span",{className:"flex-1 uppercase tracking-wide",style:{fontSize:"10px"},children:R.label}),t.jsx("span",{style:{fontSize:"10px",color:R.color,fontWeight:700},children:R.docs.length}),t.jsx(Ne,{expanded:v,size:11})]}),v&&R.docs.map(k=>{const j=b===k.id;return t.jsxs("div",{style:{display:"flex",alignItems:"center",paddingLeft:"28px",paddingRight:"4px",background:j?`${R.color}18`:"transparent",borderLeft:j?`2px solid ${R.color}`:"2px solid transparent",cursor:"pointer"},onMouseEnter:P=>{j||(P.currentTarget.style.background=f.surfaceAlt)},onMouseLeave:P=>{P.currentTarget.style.background=j?`${R.color}18`:"transparent"},children:[t.jsxs("button",{onClick:()=>e({type:"dhf-document",docId:k.id}),style:{flex:1,display:"flex",alignItems:"center",gap:"6px",background:"none",border:"none",padding:"5px 0",fontSize:T.explorer.element,color:j?R.color:f.primary,fontWeight:j?600:400,cursor:"pointer",textAlign:"left"},children:[t.jsx(Wn,{color:R.color}),t.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:k.id})]}),t.jsx("button",{onClick:P=>{P.stopPropagation(),a(k.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:P=>{P.currentTarget.style.opacity="1",P.currentTarget.style.color="#ef4444"},onMouseLeave:P=>{P.currentTarget.style.opacity="0",P.currentTarget.style.color="#9CA3AF"},children:"×"})]},k.id)})]},A)})]},D.systemId??D.label)),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:D=>D.stopPropagation(),children:t.jsx("button",{onClick:()=>{d({initialGroupId:u.groupId}),m(null)},style:{display:"block",width:"100%",padding:"8px 14px",background:"none",border:"none",textAlign:"left",fontSize:"13px",color:"#1B3A4B",cursor:"pointer"},onMouseEnter:D=>D.currentTarget.style.background="#F3F4F6",onMouseLeave:D=>D.currentTarget.style.background="none",children:"Add document…"})}),c&&t.jsx(nd,{initialGroupId:c.initialGroupId,existingDocs:n,numberingPrefix:s.documentNumberingPrefix||"DOC",onCreate:O,onClose:()=>d(null)})]})}const Bo="memo-explorer-width",pt=300,mt=240,Bn=720,Bd=320;function pn(){return typeof window>"u"||!window.innerWidth?Bn:Math.max(mt,Math.min(Bn,window.innerWidth-Bd))}function Fd(e){return Number.isFinite(e)?Math.min(Bn,Math.max(mt,e)):pt}function Ad(){if(typeof window>"u")return pt;try{const e=Number.parseInt(localStorage.getItem(Bo)??"",10);return Number.isFinite(e)?Fd(e):pt}catch{return pt}}function Nd(){var O,D,R;const e=E(A=>A.sidebarCollapsed),r=E(A=>A.toggleSidebar);E(A=>A.explorerTab);const n=E(A=>A.setExplorerTab),o=E(A=>A.searchTerm),a=E(A=>A.setSearchTerm),s=E(A=>A.model),i=E(A=>A.activeMode),l=E(A=>A.activeView),c=l.type==="diagram"&&((D=(O=s==null?void 0:s.diagrams)==null?void 0:O.find(A=>A.id===l.diagramId))==null?void 0:D.viewpointId)&&((R=s.diagrams.find(A=>A.id===l.diagramId))==null?void 0:R.viewpointId)!=="__model",d=c||i==="diagram"?"Viewpoints":"Model Explorer",[u,m]=p.useState(Ad),[b,w]=p.useState(pn),S=Math.min(u,b),g=p.useRef(null),h=p.useCallback(A=>{m(Math.max(mt,Math.min(pn(),A)))},[]),y=p.useCallback(()=>{var A;(A=g.current)==null||A.call(g),g.current=null},[]),B=p.useCallback(A=>{if(A.button!==0)return;A.preventDefault(),y();const v=A.clientX,k=S,j=document.body.style.cursor,P=document.body.style.userSelect;document.body.style.cursor="col-resize",document.body.style.userSelect="none";const N=L=>{h(k+L.clientX-v)},M=()=>{window.removeEventListener("pointermove",N),window.removeEventListener("pointerup",M),window.removeEventListener("pointercancel",M),document.body.style.cursor=j,document.body.style.userSelect=P,g.current=null};g.current=M,window.addEventListener("pointermove",N),window.addEventListener("pointerup",M),window.addEventListener("pointercancel",M)},[h,S,y]);return p.useEffect(()=>{try{localStorage.setItem(Bo,String(Math.round(u)))}catch{}},[u]),p.useEffect(()=>{const A=()=>w(pn());return window.addEventListener("resize",A),()=>{window.removeEventListener("resize",A),y()}},[y]),p.useEffect(()=>{(l.type==="ontology"||l.type==="ontology-detail")&&n("ontologies")},[l.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 ${f.border}`,cursor:"pointer"},children:[t.jsx("span",{style:{color:f.muted,fontSize:18,lineHeight:1},children:"›"}),t.jsx("span",{style:{color:f.muted,fontSize:10,writingMode:"vertical-rl"},children:d})]}):t.jsxs("div",{className:"flex flex-col overflow-hidden flex-shrink-0",style:{position:"relative",width:`${S}px`,background:f.surface,borderRight:`1px solid ${f.border}`},children:[t.jsxs("div",{className:"flex items-center justify-between px-3 py-2",style:{background:f.surfaceAlt,borderBottom:`1px solid ${f.border}`,flexShrink:0},children:[t.jsx("span",{style:{fontSize:T.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 ${f.border}`,borderRadius:5,background:"#FFFFFF",color:f.muted,cursor:"pointer",fontSize:18,lineHeight:1},children:"‹"})]}),l.type==="diagram"&&!c?t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"px-3 py-2",style:{borderBottom:`1px solid ${f.border}`},children:t.jsxs("div",{className:"flex gap-1",children:[t.jsx("input",{type:"text",placeholder:"Search elements...",value:o,onChange:A=>a(A.target.value),onKeyDown:A=>{A.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:f.surfaceAlt,border:`1px solid ${f.border}`,color:f.primary,fontSize:T.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:f.surfaceAlt,border:`1px solid ${f.border}`,color:f.secondary,cursor:"pointer"},children:t.jsx(Sr,{})})]})}),t.jsx(Cr,{searchTerm:o})]}):i==="dashboard"?t.jsx(Ki,{}):i==="dhf"?t.jsx(Dd,{}):i==="diagram"||c?t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"px-3 py-2",style:{borderBottom:`1px solid ${f.border}`},children:t.jsx("input",{type:"text",placeholder:"Search viewpoints and views...",value:o,onChange:A=>a(A.target.value),className:"w-full px-3 py-2 rounded-lg focus:outline-none",style:{background:f.surfaceAlt,border:`1px solid ${f.border}`,color:f.primary,fontSize:T.explorer.search}})}),t.jsx(Cd,{searchTerm:o})]}):i==="ontology"?t.jsx(Hi,{}):i==="scenario"?t.jsx(p.Suspense,{fallback:t.jsx("div",{className:"p-3",style:{color:f.faint,fontSize:T.explorer.item},children:"Loading use cases…"}),children:t.jsx(id,{explorerOnly:!0})}):t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"px-3 py-2",style:{borderBottom:`1px solid ${f.border}`},children:t.jsxs("div",{className:"flex gap-1",children:[t.jsx("input",{type:"text",placeholder:"Search elements...",value:o,onChange:A=>a(A.target.value),onKeyDown:A=>{A.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:f.surfaceAlt,border:`1px solid ${f.border}`,color:f.primary,fontSize:T.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:f.surfaceAlt,border:`1px solid ${f.border}`,color:f.secondary,cursor:"pointer"},children:t.jsx(Sr,{})})]})}),t.jsx(Cr,{searchTerm:o})]}),t.jsx("div",{className:"memo-explorer-resizer",role:"separator","aria-label":"Resize Model Explorer","aria-orientation":"vertical","aria-valuemin":mt,"aria-valuemax":b,"aria-valuenow":Math.round(S),tabIndex:0,title:"Drag to resize · Double-click to reset",onPointerDown:B,onDoubleClick:()=>h(pt),onKeyDown:A=>{A.key==="ArrowLeft"?(A.preventDefault(),h(S-20)):A.key==="ArrowRight"?(A.preventDefault(),h(S+20)):A.key==="Home"?(A.preventDefault(),h(mt)):A.key==="End"&&(A.preventDefault(),h(b))}})]})}function Td(e,r){if(r.length===0)return!0;const n=`${e.label??e.value} ${e.group??""} ${e.keywords??""}`.toLowerCase();return r.every(o=>n.includes(o))}function Rd(e,r){const n=r.trim().toLowerCase().split(/\s+/).filter(Boolean);if(n.length===0)return e;const o=[],a=[];for(const s of e){if(!Td(s,n))continue;(s.label??s.value).toLowerCase().startsWith(n[0])?o.push(s):a.push(s)}return[...o,...a]}function Jt({label:e,options:r,selected:n,onChange:o,allLabel:a="All",placeholder:s="Type to filter…",width:i=150,title:l,describedAs:c,maxVisible:d=300,parentOf:u,iconOnly:m,align:b="left"}){var $;const[w,S]=p.useState(!1),[g,h]=p.useState(""),[y,B]=p.useState(0),[O,D]=p.useState(new Set),R=p.useRef(null),A=p.useRef(null),v=p.useMemo(()=>new Set(n),[n]),k=p.useMemo(()=>Rd(r,g),[r,g]),j=k.length>d?k.slice(0,d):k,P=k.length-j.length,N=p.useMemo(()=>{if(!u)return null;const U=new Map(r.map(I=>[I.value,I])),G=new Set(k.map(I=>I.value));for(const I of[...G]){let x=u.get(I);for(;x&&U.has(x)&&!G.has(x);)G.add(x),x=u.get(x)}const H=new Map;for(const I of G){const x=u.get(I);if(x&&G.has(x)){const _=H.get(x)??[];_.push(I),H.set(x,_)}}const X=(I,x)=>{var _,q;return(((_=U.get(I))==null?void 0:_.label)??I).localeCompare(((q=U.get(x))==null?void 0:q.label)??x)};H.forEach(I=>I.sort(X));const Y=[...G].filter(I=>!u.get(I)||!G.has(u.get(I))).sort(X),ae=[],se=(I,x)=>{const _=U.get(I);if(!_)return;const q=H.get(I)??[];ae.push({option:_,depth:x,children:q}),q.length>0&&O.has(I)&&q.forEach(J=>se(J,x+1))};return Y.forEach(I=>se(I,0)),ae},[r,k,u,O]);p.useEffect(()=>{B(0)},[g,w]),p.useEffect(()=>{if(!w)return;const U=G=>{var H;(H=R.current)!=null&&H.contains(G.target)||(S(!1),h(""))};return document.addEventListener("mousedown",U),()=>document.removeEventListener("mousedown",U)},[w]),p.useEffect(()=>{var U;w&&((U=A.current)==null||U.focus())},[w]);const M=p.useCallback(U=>{o(v.has(U)?n.filter(G=>G!==U):[...n,U])},[o,n,v]),L=p.useCallback(U=>{if(!u)return M(U);const G=new Set([U]);let H=!0;for(;H;){H=!1;for(const[Y,ae]of u)G.has(ae)&&!G.has(Y)&&(G.add(Y),H=!0)}const X=[...G].every(Y=>v.has(Y));o(X?n.filter(Y=>!G.has(Y)):[...new Set([...n,...G])])},[u,M,n,v,o]),C=U=>{if(U.key==="Escape"){S(!1),h("");return}U.key==="ArrowDown"&&(U.preventDefault(),B(G=>Math.min(G+1,j.length-1))),U.key==="ArrowUp"&&(U.preventDefault(),B(G=>Math.max(G-1,0))),U.key==="Enter"&&j[y]&&(U.preventDefault(),M(j[y].value))},z=n.length===0?a:n.length===1?(($=r.find(U=>U.value===n[0]))==null?void 0:$.label)??n[0]:`${n.length} selected`;return t.jsxs("div",{ref:R,style:{position:"relative",display:"flex",alignItems:"center",gap:"5px"},children:[t.jsx("span",{style:{fontSize:T.xs,color:f.muted,whiteSpace:"nowrap"},children:e}),t.jsx("button",{type:"button","aria-haspopup":"listbox","aria-expanded":w,title:l??(n.length>0?n.join(", "):a),onClick:()=>S(U=>!U),style:m?{width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"4px",background:"transparent",border:"none",color:n.length>0?f.accent:f.muted,cursor:"pointer",padding:0}:{width:i,display:"flex",alignItems:"center",justifyContent:"space-between",gap:"6px",padding:"3px 7px",borderRadius:"5px",border:`1px solid ${n.length>0?f.accent:f.border}`,background:f.surface,fontSize:T.xs,color:n.length>0?f.primary:f.muted,cursor:"pointer",textAlign:"left"},children:m?t.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:t.jsx("polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3"})}):t.jsxs(t.Fragment,{children:[t.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:z}),t.jsx("span",{style:{fontSize:"9px",color:f.faint},children:"▼"})]})}),w&&t.jsxs("div",{role:"listbox",style:{position:"absolute",top:"calc(100% + 4px)",...b==="right"?{right:0}:{left:0},zIndex:60,width:Math.max(i+70,220),background:f.surface,border:`1px solid ${f.border}`,borderRadius:"7px",boxShadow:ki.lg,overflow:"hidden"},children:[t.jsx("input",{ref:A,value:g,onChange:U=>h(U.target.value),onKeyDown:C,placeholder:s,"aria-label":`Filter ${c??e}`,style:{width:"100%",padding:"7px 9px",border:"none",borderBottom:`1px solid ${f.borderLight}`,fontSize:T.xs,outline:"none",color:f.primary}}),t.jsxs("div",{style:{maxHeight:"260px",overflowY:"auto"},children:[k.length===0&&t.jsxs("div",{style:{padding:"10px",fontSize:T.xs,color:f.faint},children:["Nothing matches ","“",g,"”"]}),(N??j.map(U=>({option:U,depth:0,children:[]}))).map(({option:U,depth:G,children:H},X)=>{var se;const Y=v.has(U.value),ae=!N&&U.group&&U.group!==((se=j[X-1])==null?void 0:se.group)?U.group:null;return t.jsxs("div",{children:[ae&&t.jsx("div",{style:{position:"sticky",top:0,zIndex:1,padding:"4px 9px 2px",fontSize:"10px",fontWeight:600,color:f.faint,background:f.surface,borderBottom:`1px solid ${f.borderLight}`},children:ae}),t.jsxs("div",{role:"option","aria-selected":Y,onMouseEnter:()=>B(X),onClick:()=>L(U.value),style:{display:"flex",alignItems:"center",gap:"7px",padding:"5px 9px 5px "+(9+G*16)+"px",cursor:"pointer",fontSize:T.xs,background:X===y?f.surfaceAlt:"transparent",color:f.primary},children:[N&&t.jsx("button",{type:"button","aria-label":H.length>0?`${O.has(U.value)?"Collapse":"Expand"} ${U.label??U.value}`:void 0,disabled:H.length===0,onClick:I=>{I.stopPropagation(),H.length!==0&&D(x=>{const _=new Set(x);return _.has(U.value)?_.delete(U.value):_.add(U.value),_})},style:{width:"13px",padding:0,border:"none",background:"none",color:f.muted,cursor:H.length>0?"pointer":"default"},children:H.length>0?O.has(U.value)?"▾":"▸":""}),t.jsx("input",{type:"checkbox",readOnly:!0,checked:Y,style:{accentColor:f.accent}}),U.color&&t.jsx("span",{style:{width:"8px",height:"8px",borderRadius:"2px",background:U.color,flexShrink:0}}),t.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:U.label??U.value}),U.hint&&t.jsx("span",{style:{color:f.faint,fontSize:"11px"},children:U.hint})]})]},U.value)}),P>0&&t.jsxs("div",{style:{padding:"7px 9px",fontSize:"11px",color:f.faint,borderTop:`1px solid ${f.borderLight}`},children:[P.toLocaleString()," more match. Keep typing to narrow, or use"," ","Select matches to take all ",k.length.toLocaleString(),"."]})]}),t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"6px 9px",borderTop:`1px solid ${f.borderLight}`},children:[t.jsxs("button",{type:"button",onClick:()=>o(k.map(U=>U.value)),style:{fontSize:"11px",color:"#2563EB",background:"none",border:"none",cursor:"pointer",padding:0},children:["Select ",g?`matches (${k.length})`:`all (${r.length})`]}),t.jsx("button",{type:"button",onClick:()=>o([]),style:{fontSize:"11px",color:f.muted,background:"none",border:"none",cursor:"pointer",padding:0},children:"None"}),n.length>0&&t.jsxs("span",{style:{marginLeft:"auto",fontSize:"11px",color:f.faint},children:[n.length," picked"]})]})]})]})}const jr="#E5E5E0",Id="#2DD4A8",Vt=40;function Dr(e,r){var s;const n=e.id.toLowerCase(),o=((s=e.shortId)==null?void 0:s.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 Md(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??Vt):[]}function _d(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 Pd(e,r){return Md(e,{query:r.query,excludeId:r.source.id,limit:Object.keys(e).length}).filter(n=>!r.filterKinds||r.filterKinds.length===0||r.filterKinds.includes(n.kind)).filter(n=>Ge(r.source,n,r.registries).length>0).slice(0,r.limit??Vt)}function Od({element:e,model:r,registries:n,enabled:o,onCreate:a}){var v;const[s,i]=p.useState(""),[l,c]=p.useState(!1),[d,u]=p.useState(0),[m,b]=p.useState([]),w=p.useRef(null),S=p.useRef(null);p.useEffect(()=>{i(""),c(!1),u(0),b([])},[e.id]);const g=p.useMemo(()=>Array.from(new Set(Object.values(r.elements).map(k=>k.kind))).sort(),[r.elements]),h=p.useMemo(()=>Pd(r.elements,{query:s,source:e,registries:n,filterKinds:m}),[r.elements,e,s,n,m]),y=p.useMemo(()=>_d(h),[h]),B=p.useMemo(()=>y.flatMap(k=>k.elements),[y]);p.useEffect(()=>{u(0)},[s]),p.useEffect(()=>{var k,j;l&&((j=(k=S.current)==null?void 0:k.querySelector('[data-active="true"]'))==null||j.scrollIntoView({block:"nearest"}))},[d,l]);const O=p.useCallback(k=>{const j=Ge(e,k,n);if(j.length>0){const P=["trace","satisfies","implements","verifies","validates"],M=j.find(L=>P.some(C=>L.definition.name.toLowerCase().includes(C)||L.definition.label.toLowerCase().includes(C)))??j[0];a({type:M.definition.name,sourceId:M.sourceId,targetId:M.targetId,direction:M.direction})}i(""),c(!1)},[e,n,a]),D=p.useCallback(()=>{i(""),c(!1)},[]),R=p.useCallback(k=>{if(k.key==="Escape"){if(l){c(!1);return}D();return}if(!l||B.length===0){k.key==="ArrowDown"&&B.length>0&&(k.preventDefault(),c(!0));return}if(k.key==="ArrowDown")k.preventDefault(),u(j=>(j+1)%B.length);else if(k.key==="ArrowUp")k.preventDefault(),u(j=>(j-1+B.length)%B.length);else if(k.key==="Enter"){k.preventDefault();const j=B[d];j&&O(j)}},[l,B,d,O,D]),A=(v=B[d])==null?void 0:v.id;return t.jsx("div",{className:"mt-1.5",style:{opacity:o?1:.6},children:t.jsxs("div",{className:"relative",children:[t.jsxs("div",{className:"flex gap-2",children:[t.jsx("input",{ref:w,value:s,disabled:!o,onChange:k=>{i(k.target.value),c(!0)},onFocus:()=>{s.trim()&&c(!0)},onBlur:()=>{window.setTimeout(()=>c(!1),120)},onKeyDown:R,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":l,"aria-controls":"memo-quick-add-matches","aria-activedescendant":l&&A?`memo-quick-add-${A}`:void 0,role:"combobox",autoComplete:"off",className:"flex-1 px-2 py-1 rounded focus:outline-none",style:{fontSize:T.xs,background:"#FFFFFF",border:`1px solid ${l&&s.trim()?Id:jr}`,color:"#374151",minWidth:0}}),t.jsx("div",{style:{flexShrink:0},children:t.jsx(Jt,{label:"",options:g.map(k=>({value:k,label:k})),selected:m,onChange:b,allLabel:"All Types",iconOnly:!0})})]}),l&&s.trim()&&t.jsxs("div",{id:"memo-quick-add-matches",ref:S,role:"listbox",className:"absolute left-0 right-0 z-20 mt-1 rounded overflow-y-auto",style:{maxHeight:240,background:"#FFFFFF",border:`1px solid ${jr}`,boxShadow:"0 8px 24px rgba(15,23,42,0.14)"},children:[B.length===0?t.jsxs("div",{className:"px-2 py-2",style:{fontSize:T.xs,color:"#9CA3AF"},children:["No MEMO-legal trace target matches “",s.trim(),"”."]}):y.map(k=>t.jsxs("div",{children:[t.jsx(zd,{kind:k.kind,layer:k.layer,count:k.elements.length}),k.elements.map(j=>t.jsx(Ud,{element:j,active:j.id===A,onSelect:()=>O(j)},j.id))]},k.kind)),h.length===Vt&&t.jsxs("div",{className:"px-2 py-1",style:{fontSize:"10px",color:"#9CA3AF"},children:["Showing the first ",Vt," matches — keep typing to narrow."]})]})]})})}function zd({kind:e,layer:r,count:n}){const o=ce[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 Ud({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:T.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 Ld={text:"14px",heading:"13px",meta:"12px",valuePadding:"9px 12px",fieldGap:"10px",sectionPadding:"0 0 18px 0",radius:"10px",twoColumnAttributes:!0},qd={text:"12px",heading:"12px",meta:"11px",valuePadding:"4px 7px",fieldGap:"5px",sectionPadding:"0 0 10px 0",radius:"7px",twoColumnAttributes:!1};function $e(e){return e==="page"?Ld:qd}const Fo={kind:"editable"},$d={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 Br(e){const r=$d[e];return r?{kind:"identity",reason:r}:Fo}function Su(e){return e==="doc"?Fo:{kind:"derived",reason:`"${e}" is derived from the SysML source when the model is built.`}}function Fn(e){return e.kind==="editable"}function Ao(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 Vd({title:e,count:r,actions:n,density:o,defaultOpen:a=!0,collapsible:s=!0,children:i}){const[l,c]=p.useState(a),d=$e(o),u=o==="page",m=s?l:!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 ${f.borderLight}`,borderRadius:u?14:0,background:u?f.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:s?"pointer":"default",padding:u?"0 0 10px 0":"6px 10px",borderRadius:u?0:"6px",margin:u?0:"2px 4px"},onClick:s?()=>c(b=>!b):void 0,onMouseEnter:b=>{!u&&s&&(b.currentTarget.style.background=f.surfaceAlt)},onMouseLeave:b=>{u||(b.currentTarget.style.background="transparent")},children:[t.jsx("h3",{style:{flex:1,margin:0,fontSize:u?d.heading:"10px",fontWeight:u?700:"bold",color:u?f.primary:"#6B7280",letterSpacing:u?0:"0.05em",textTransform:u?"none":"uppercase"},children:e}),typeof r=="number"&&(u?t.jsx("span",{style:{fontSize:d.meta,color:f.faint},children:r}):t.jsx("span",{className:"px-1.5 py-0.5 rounded-md font-medium text-[10px]",style:{background:"#F3F4F6",color:"#6B7280"},children:r})),n&&t.jsx("span",{onClick:b=>b.stopPropagation(),children:n}),s&&t.jsx("span",{style:{color:"#D1D5DB",fontSize:u?d.meta:14},children:m?"▾":"▸"})]}),m&&t.jsx("div",{style:{padding:u?0:"0 14px 8px"},children:i})]})}function Fr({value:e,editability:r,density:n,mono:o}){const a=$e(n),s=r.kind==="editable"?"":r.reason;return t.jsxs("div",{title:s||Ao(r),style:{display:"flex",alignItems:"center",gap:6,padding:a.valuePadding,borderRadius:a.radius,background:f.surfaceAlt,border:"1px solid transparent",color:f.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:f.faint,fontStyle:"italic"},children:"none"})}),t.jsx("span",{"aria-hidden":!0,style:{fontSize:a.meta,color:"#C7CBD1",flexShrink:0},children:"🔒"})]})}function ot({value:e,onSave:r,density:n,multiline:o,placeholder:a,autoFocus:s,compact:i=!1}){const[l,c]=p.useState(!1),[d,u]=p.useState(!1),[m,b]=p.useState(e),w=$e(n),S=p.useRef(!1),g=p.useRef(null),[h,y]=p.useState(null),[B,O]=p.useState(0),D=E(M=>M.model),R=E(M=>M.inspectElement);p.useEffect(()=>{b(e)},[e]);const A=p.useMemo(()=>h===null||!D?[]:Object.values(D.elements).filter(M=>{const L=(M.shortId??"").toLowerCase(),C=M.id.toLowerCase(),z=M.name.toLowerCase();return L.includes(h)||C.includes(h)||z.includes(h)}).slice(0,10),[h,D]),v=p.useCallback(()=>{S.current||h===null&&(S.current=!0,c(!1),m!==e&&r(m))},[m,e,r,h]),k=p.useCallback(M=>{var L;if(h!==null){if(M.key==="ArrowDown"){M.preventDefault(),O(C=>(C+1)%Math.max(1,A.length));return}if(M.key==="ArrowUp"){M.preventDefault(),O(C=>(C-1+A.length)%Math.max(1,A.length));return}if(M.key==="Enter"||M.key==="Tab"){M.preventDefault();const C=A[B];if(C){const z=((L=g.current)==null?void 0:L.selectionStart)??0,$=m.slice(0,z),U=m.slice(z),G=$.match(/(?:^|\s)@([a-zA-Z0-9_-]*)$/);if(G){const H=z-G[1].length-1,X=`[${C.name}](@${C.shortId??C.id}) `,Y=m.slice(0,H)+X+U;b(Y),y(null),setTimeout(()=>{g.current&&(g.current.selectionStart=H+X.length,g.current.selectionEnd=g.current.selectionStart,g.current.focus())},0)}}else y(null);return}if(M.key==="Escape"){M.preventDefault(),y(null);return}}M.key==="Enter"&&!o&&(M.preventDefault(),v()),M.key==="Escape"&&(S.current=!0,b(e),c(!1))},[v,o,e,h,A,B,m]),j=M=>{const L=M.target.value;b(L);const C=M.target.selectionStart??0,$=L.slice(0,C).match(/(?:^|\s)@([a-zA-Z0-9_-]*)$/);$?(y($[1].toLowerCase()),O(0)):y(null)},P=()=>{S.current=!1,b(e),c(!0)};if(l){const M={ref:g,value:m,autoFocus:!0,onChange:j,onBlur:()=>{setTimeout(v,200)},onKeyDown:k,placeholder:a,style:{width:"100%",padding:i?"5px 8px":w.valuePadding,borderRadius:i?"6px":w.radius,border:`1px solid ${f.accent}`,boxShadow:`0 0 0 3px ${f.accent}25`,background:f.surface,color:f.primary,fontSize:w.text,fontFamily:"inherit",outline:"none",...o?{minHeight:n==="page"?"110px":"54px",resize:"vertical",lineHeight:1.6}:{}}};return t.jsxs("div",{style:{position:"relative",width:"100%"},children:[o?t.jsx("textarea",{...M}):t.jsx("input",{type:"text",...M}),h!==null&&A.length>0&&t.jsx("div",{style:{position:"absolute",top:"100%",left:0,right:0,marginTop:4,background:"#fff",border:"1px solid #E5E7EB",borderRadius:6,boxShadow:"0 4px 12px rgba(0,0,0,0.1)",zIndex:100,maxHeight:200,overflowY:"auto"},children:A.map((L,C)=>t.jsxs("div",{style:{padding:"6px 12px",fontSize:13,cursor:"pointer",background:C===B?"#F3F4F6":"#fff",display:"flex",justifyContent:"space-between"},onClick:()=>{var H,X;const z=((H=g.current)==null?void 0:H.selectionStart)??m.length,$=m.slice(0,z),U=m.slice(z),G=$.match(/(?:^|\s)@([a-zA-Z0-9_-]*)$/);if(G){const Y=z-G[1].length-1,ae=m.slice(0,Y)+`[${L.name}](@${L.shortId??L.id}) `+U;b(ae)}y(null),(X=g.current)==null||X.focus()},children:[t.jsx("span",{style:{fontWeight:500,color:"#111827"},children:L.name}),t.jsx("span",{style:{color:"#6B7280",fontSize:11},children:L.shortId??L.id})]},L.id))})]})}const N=M=>{if(!M)return a??"Click to add…";if(!D)return M;const L=/(\[[^\]]+\]\(@[a-zA-Z0-9_-]+\)|@[a-zA-Z0-9_-]+)/g;return M.split(L).map((z,$)=>{let U="",G="";if(z.startsWith("@"))U=z.slice(1);else if(z.startsWith("[")&&z.includes("](@")){const H=z.match(/\[([^\]]+)\]\(@([a-zA-Z0-9_-]+)\)/);H&&(G=H[1],U=H[2])}if(U){const H=Object.values(D.elements).find(X=>(X.shortId??X.id)===U)||D.elements[U];if(H)return t.jsx("span",{onClick:X=>{X.stopPropagation(),R(H.id)},style:{color:f.accent,cursor:"pointer",fontWeight:600,background:"#E0F2FE",padding:"1px 4px",borderRadius:"4px"},title:H.name,children:G||`@${H.shortId??H.id}`},$)}return t.jsx("span",{children:z},$)})};return t.jsxs("div",{role:"button",tabIndex:0,title:"Click to edit",onClick:P,onFocus:()=>u(!0),onBlur:()=>u(!1),onKeyDown:M=>{(M.key==="Enter"||M.key===" ")&&(M.preventDefault(),P())},onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),style:{display:"flex",alignItems:"flex-start",gap:6,padding:i?"5px 8px":w.valuePadding,borderRadius:i?"6px":w.radius,background:d?"#F3F4F6":"transparent",border:`1px solid ${d?"#E5E7EB":"transparent"}`,boxShadow:"none",color:e?f.primary:f.faint,fontSize:w.text,cursor:"text",transition:"background-color 150ms ease, border-color 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:N(e)}),t.jsx("span",{"aria-hidden":!0,style:{flexShrink:0,fontSize:w.meta,color:f.accent,opacity:d?1:0,transition:"opacity 150ms ease"},children:"✎"})]})}function Eu({label:e,editability:r,density:n,children:o}){const a=$e(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:f.muted},children:[t.jsx("span",{style:{fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace"},children:e}),t.jsx("span",{className:"sr-only",children:Ao(r)}),!Fn(r)&&t.jsx("span",{title:r.kind==="editable"?"":r.reason,style:{fontSize:"10px",padding:"0 4px",borderRadius:4,background:f.surfaceAlt,color:f.faint,border:`1px solid ${f.border}`},children:r.kind==="identity"?"identifier":"derived"})]}),o]})}function Cu({density:e}){const r=$e(e);return t.jsxs("div",{className:"flex items-center gap-4 flex-wrap",style:{fontSize:r.meta,color:f.faint},children:[t.jsxs("span",{className:"flex items-center gap-1.5",children:[t.jsx("span",{style:{color:f.accent},children:"✎"})," editable here"]}),t.jsx("span",{children:"Identity and source metadata are read-only"})]})}function Wd(e,r,n,o){var c;const a=new Map,s=(d,u)=>{var w;const m=u==="outgoing"?d.targetId:d.sourceId,b=a.get(m)??{id:m,element:n.elements[m],links:[]};b.links.push({relationship:d,direction:u,label:((w=Pn(d.type,o))==null?void 0:w.label)??d.type}),a.set(m,b)};e.forEach(d=>s(d,"outgoing")),r.forEach(d=>s(d,"incoming"));const i=new Map;for(const d of a.values()){const u=((c=d.element)==null?void 0:c.layer)||"other";i.set(u,[...i.get(u)??[],d])}const l=d=>{const u=Oe.indexOf(d);return u<0?Number.MAX_SAFE_INTEGER:u};return[...i.entries()].map(([d,u])=>({layer:d,elements:u.sort((m,b)=>{var w,S;return(((w=m.element)==null?void 0:w.name)??m.id).localeCompare(((S=b.element)==null?void 0:S.name)??b.id)})})).sort((d,u)=>l(d.layer)-l(u.layer)||d.layer.localeCompare(u.layer))}function Hd({element:e,model:r,registries:n,outgoing:o,incoming:a,density:s,onNavigate:i,onCreate:l,onDelete:c}){const[d,u]=p.useState(""),m=p.useMemo(()=>Wd(o,a,r,n),[o,a,r,n]),b=d.trim().toLowerCase(),w=p.useMemo(()=>m.map(g=>({...g,elements:g.elements.filter(h=>{var y,B,O;return!b||[(y=h.element)==null?void 0:y.name,(B=h.element)==null?void 0:B.kind,(O=h.element)==null?void 0:O.shortId,h.id,g.layer,...h.links.map(D=>D.label)].filter(Boolean).join(" ").toLowerCase().includes(b)})})).filter(g=>g.elements.length>0),[m,b]),S=m.reduce((g,h)=>g+h.elements.length,0);return t.jsxs("div",{style:{border:s==="page"?"none":`1px solid ${f.border}`,borderRadius:12,background:s==="page"?"transparent":f.surfaceAlt,padding:s==="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:f.primary,fontSize:13,fontWeight:700},children:"Linked elements"}),t.jsxs("div",{style:{color:f.muted,fontSize:11},children:[S," element",S===1?"":"s"," across ",m.length," layer",m.length===1?"":"s"]})]}),S>6&&t.jsx("input",{value:d,onChange:g=>u(g.target.value),placeholder:"Filter linked elements…","aria-label":"Filter linked elements",className:"transition-shadow focus:shadow-md",style:{marginLeft:"auto",width:240,padding:"8px 12px",borderRadius:8,border:`1px solid ${f.border}`,background:"#F9FAFB",color:f.primary,fontSize:13,outline:"none"}})]}),S===0&&t.jsx("div",{style:{color:f.faint,fontSize:12},children:"No linked elements."}),t.jsx("div",{style:{display:"flex",flexDirection:"column",gap:14},children:w.map(g=>{const h=ce[g.layer]||f.muted;return t.jsxs("section",{style:{padding:"16px 20px",background:h+"08",border:`1px solid ${h}15`,borderRadius:12},children:[t.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[t.jsx("span",{style:{width:10,height:10,borderRadius:3,background:h}}),t.jsx("strong",{style:{color:f.primary,fontSize:14,letterSpacing:"0.02em"},children:Xe[g.layer]??g.layer}),t.jsx("span",{style:{color:f.faint,fontSize:12,background:h+"15",padding:"1px 6px",borderRadius:10},children:g.elements.length})]}),t.jsx("div",{style:{display:"grid",gridTemplateColumns:s==="page"?"repeat(auto-fill, 264px)":"1fr",justifyContent:"start",gap:7},children:g.elements.map(y=>t.jsx(Kd,{element:e,linked:y,registries:n,color:h,onNavigate:i,onCreate:l,onDelete:c},y.id))})]},g.layer)})})]})}function Kd({element:e,linked:r,registries:n,color:o,onNavigate:a,onCreate:s,onDelete:i}){var b,w,S,g;const[l,c]=p.useState(!1),d=p.useMemo(()=>!e||!r.element?[]:Ge(e,r.element,n).map(h=>({value:`${h.definition.name}::${h.direction}`,label:`${h.definition.label} ${h.direction==="outgoing"?"to":"from"}`})),[e,r.element,n]),u=r.links.map(h=>`${h.relationship.type}::${h.direction}`),m=p.useCallback(h=>{if(h.length===0||!s||!i)return;const y=new Set(h),B=new Set(u);for(const D of r.links)y.has(`${D.relationship.type}::${D.direction}`)||i(D.relationship.id);const O=Ge(e,r.element,n);for(const D of h)if(!B.has(D)){const R=O.find(A=>`${A.definition.name}::${A.direction}`===D);R&&s({type:R.definition.name,sourceId:R.sourceId,targetId:R.targetId,direction:R.direction})}},[u,r.links,e,r.element,n,s,i]);return t.jsx("button",{onClick:()=>a(r.id),onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),className:"text-left transition-all duration-200",title:`Open ${((b=r.element)==null?void 0:b.name)??r.id}`,style:{padding:"12px 14px",borderRadius:10,background:"#FFFFFF",border:`1px solid ${l?o+"80":"#E5E7EB"}`,cursor:"pointer",minWidth:0,width:"100%",maxWidth:280,boxShadow:l?"0 4px 12px rgba(0,0,0,0.05)":"0 1px 2px rgba(0,0,0,0.02)",transform:l?"translateY(-1px)":"none"},children:t.jsxs("div",{style:{minWidth:0},children:[t.jsxs("div",{className:"flex items-start justify-between mb-1",style:{gap:4},children:[t.jsx("div",{children:r.links.map(h=>t.jsxs("div",{style:{color:h.direction==="outgoing"?"#2563EB":"#059669",fontSize:10,fontWeight:600,marginBottom:2},children:[h.label," ",h.direction==="outgoing"?"to":"from"]},h.relationship.id))}),d.length>1&&s&&t.jsx("div",{onClick:h=>h.stopPropagation(),style:{flexShrink:0,marginTop:-4,marginRight:-4},children:t.jsx(Jt,{label:"",options:d,selected:u,onChange:m,iconOnly:!0,align:"right",title:"Change relationship type"})})]}),t.jsx("strong",{className:"truncate",style:{display:"block",color:f.primary,fontSize:13},children:((w=r.element)==null?void 0:w.name)??r.id}),t.jsx("div",{className:"font-mono truncate",style:{color:"#9CA3AF",fontSize:"10px",marginTop:2},title:r.id,children:((S=r.element)==null?void 0:S.shortId)??r.id}),t.jsx("div",{style:{color:f.muted,fontSize:10,marginTop:2},children:((g=r.element)==null?void 0:g.kind)??"Unknown element type"})]})})}function Gd({element:e,outgoing:r,incoming:n,density:o}){const a=E(N=>N.model),s=E(N=>N.connected),i=E(N=>N.selectElement),l=E(N=>N.selectedDiagramId),c=E(N=>N.pendingRelationships),d=E(N=>N.createRelationship),u=E(N=>N.deleteRelationship),m=E(N=>N.dismissPendingRelationship),b=E(N=>N.addElementToDiagram),[w,S]=p.useState(!1),[g,h]=p.useState(null),[y,B]=p.useState(["Requirement","Risk","Function","SystemFunction","ComponentFunction"]),O=p.useMemo(()=>mo(a),[a]);p.useEffect(()=>{h(null),S(!1),B(["Requirement","Risk","Function","SystemFunction","ComponentFunction"])},[e.id]);const D=c.filter(N=>N.sourceId===e.id||N.targetId===e.id),R=r.length+n.length,A=p.useCallback(async N=>{var U;h(null);const M=await d({...N,selectedElementId:e.id,diagramId:l??void 0});if(!M.success){h({kind:"error",message:M.error??"The relationship could not be created."});return}const L=N.sourceId===e.id?N.targetId:N.sourceId,C=Yt(a,l),z=(U=M.diagnostics)==null?void 0:U.find(G=>G.code==="REL-005"),$=!!C&&!!C.elementIds&&C.elementIds.length>0&&!C.elementIds.includes(L);h($&&!z&&l?{kind:"success",message:`Relationship created in ${M.sourceFile??"the model"}.`,offerAddToView:{elementId:L,diagramId:l}}:z?{kind:"success",message:`Relationship created in ${M.sourceFile??"the model"}.`,profileMessage:z.message}:null)},[d,e.id,l,a]),v=p.useCallback(async N=>{const M=await u(N);M.success||h({kind:"error",message:M.error??"The relationship could not be deleted."})},[u]),k=p.useMemo(()=>{const N=new Map,M=(L,C)=>{const z=C==="outgoing"?L.targetId:L.sourceId,$=a==null?void 0:a.elements[z],U=($==null?void 0:$.kind)||"Unknown Type",G=N.get(U)??new Map,H=G.get(z)??[];H.push({rel:L,direction:C}),G.set(z,H),N.set(U,G)};return a&&(r.forEach(L=>M(L,"outgoing")),n.forEach(L=>M(L,"incoming"))),N},[r,n,a]),j=Array.from(k.keys()).sort(),P=new Map([...k.entries()].filter(([N])=>y.includes(N)));return a?t.jsx(t.Fragment,{children:t.jsxs(Vd,{title:"Relationships",count:R,density:o,collapsible:o==="panel",actions:t.jsxs("div",{className:"flex items-center gap-1",children:[R>0&&t.jsx("button",{onClick:()=>S(!0),style:{width:24,height:24,borderRadius:"4px",background:"transparent",color:"#6B7280",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center"},title:"View Details (Rich Grid)","aria-label":"View Details",onMouseEnter:N=>N.currentTarget.style.background="#F3F4F6",onMouseLeave:N=>N.currentTarget.style.background="transparent",children:t.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:t.jsx("path",{d:"M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7"})})}),R>0&&t.jsx(Jt,{label:"",options:j.map(N=>({value:N,label:N})),selected:y,onChange:B,allLabel:"None",iconOnly:!0,align:"right"})]}),children:[t.jsx("div",{style:{marginBottom:o==="page"?14:8,maxWidth:o==="page"?720:void 0},children:t.jsx(Od,{element:e,model:a,registries:O,enabled:s,onCreate:A})}),w&&t.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",style:{padding:"2rem"},onClick:()=>S(!1),children:t.jsxs("div",{className:"bg-white rounded-xl shadow-2xl flex flex-col overflow-hidden w-full max-w-5xl max-h-full",onClick:N=>N.stopPropagation(),children:[t.jsxs("div",{className:"flex justify-between items-center px-5 py-4 border-b border-gray-200 bg-gray-50/50",children:[t.jsx("h2",{className:"text-lg font-bold text-gray-900",children:"Element Relationships"}),t.jsx("button",{onClick:()=>S(!1),className:"text-gray-400 hover:text-gray-700 font-bold px-2 py-1 bg-transparent border-none cursor-pointer",children:"✕"})]}),t.jsx("div",{className:"flex-1 overflow-auto p-6 bg-gray-50/30",children:t.jsx(Hd,{element:e,model:a,registries:O,outgoing:r,incoming:n,density:o,onNavigate:N=>{S(!1),i(N)},onCreate:d,onDelete:v})})]})}),R===0&&D.length===0&&t.jsx("div",{style:{fontSize:$e(o).meta,color:f.faint,padding:"2px 0 6px"},children:"No relationships yet — add the first one below."}),R>0&&P.size>0&&t.jsx("div",{className:"flex items-center justify-between",style:{marginBottom:12,marginTop:12,borderTop:"1px solid #E5E7EB",paddingTop:12},children:t.jsx("span",{style:{fontSize:"10px",fontWeight:700,color:"#9CA3AF",textTransform:"uppercase",letterSpacing:"0.04em"},children:"Existing Links"})}),t.jsx("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[...P.entries()].map(([N,M])=>t.jsxs("div",{children:[t.jsx("div",{style:{fontSize:"10px",color:f.muted,textTransform:"uppercase",fontWeight:700,letterSpacing:"0.04em",marginBottom:6},children:N}),t.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[...M.entries()].map(([L,C])=>t.jsx(Jd,{sourceElement:e,oppositeId:L,links:C,model:a,registries:O,density:o,deletable:s,onNavigate:()=>i(L),onCreate:d,onDelete:v},L))})]},N))}),D.map(N=>t.jsx(Xd,{pending:N,model:a,onDismiss:()=>m(N.pendingId)},N.pendingId)),g&&t.jsx(Yd,{status:g,onAddToView:()=>{g.offerAddToView&&(b(g.offerAddToView.diagramId,g.offerAddToView.elementId),h({kind:"success",message:"Element added to this view."}))},onDismiss:()=>h(null),model:a})]})}):null}function Yd({status:e,onAddToView:r,onDismiss:n,model:o}){var i;const a=e.kind==="success",s=e.offerAddToView?((i=o.elements[e.offerAddToView.elementId])==null?void 0:i.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:T.xs},children:["Relationship created. Add ",s," to this view?"]})]})}function Jd({sourceElement:e,oppositeId:r,links:n,model:o,registries:a,deletable:s,density:i,onNavigate:l,onCreate:c,onDelete:d}){const u=o.elements[r],m=u&&ce[u.layer]||"#666",[b,w]=p.useState(!1),[S,g]=p.useState(!1),[h,y]=p.useState(null),B=$e(i),O=n.filter(v=>s&&v.rel.named===!0),D=p.useMemo(()=>!e||!u?[]:Ge(e,u,a).map(v=>({value:`${v.definition.name}::${v.direction}`,label:`${v.definition.label} ${v.direction==="outgoing"?"to":"from"}`})),[e,u,a]),R=n.map(v=>`${v.rel.type}::${v.direction}`),A=p.useCallback(v=>{if(v.length===0||!c||!d)return;const k=new Set(v),j=new Set(R);for(const N of n)k.has(`${N.rel.type}::${N.direction}`)||d(N.rel.id);const P=Ge(e,u,a);for(const N of v)if(!j.has(N)){const M=P.find(L=>`${L.definition.name}::${L.direction}`===N);M&&c({type:M.definition.name,sourceId:M.sourceId,targetId:M.targetId,direction:M.direction})}},[R,n,e,u,a,c,d]);return t.jsxs("div",{onMouseEnter:()=>g(!0),onMouseLeave:()=>g(!1),style:{borderLeft:`3px solid ${m}`,borderRadius:6,background:f.surface,borderTop:`1px solid ${f.borderLight}`,borderRight:`1px solid ${f.borderLight}`,borderBottom:`1px solid ${f.borderLight}`,width:"100%"},children:[t.jsxs("div",{className:"flex items-center gap-2",style:{padding:i==="page"?"8px 10px":"6px 8px",fontSize:B.text},children:[t.jsxs("button",{onClick:l,className:"text-left flex items-center gap-1.5",style:{display:"flex",flex:1,minWidth:0,background:"none",border:"none",cursor:"pointer",padding:0},title:`Go to ${(u==null?void 0:u.name)??r}`,children:[t.jsx("strong",{className:"truncate font-mono",style:{color:f.primary,fontSize:"11px",fontWeight:600},children:(u==null?void 0:u.shortId)??r}),n.length>1&&t.jsx("span",{style:{fontSize:"10px",color:"#9CA3AF",background:"#F3F4F6",padding:"1px 4px",borderRadius:4,fontWeight:600},children:n.length})]}),D.length>1&&c&&t.jsx("div",{onClick:v=>v.stopPropagation(),style:{flexShrink:0},children:t.jsx(Jt,{label:"",options:D,selected:R,onChange:A,allLabel:"Relationships",iconOnly:!0,align:"right"})}),t.jsx("button",{onClick:()=>w(v=>!v),style:{background:"none",border:"none",cursor:"pointer",color:f.faint,padding:2},"aria-label":b?"Hide relationship details":"Show relationship details",children:b?"▾":"▸"}),O.length>0&&(S||b||h==="header")&&t.jsxs("div",{className:"relative flex items-center",children:[t.jsx("button",{onClick:v=>{v.stopPropagation(),y("header")},"aria-label":`Remove relationships to ${(u==null?void 0:u.name)??r}`,title:"Remove relationships",style:{width:20,height:20,padding:0,border:0,borderRadius:10,background:"#FFFFFFAA",color:"#9CA3AF",cursor:"pointer",lineHeight:1},children:"×"}),h==="header"&&t.jsxs("div",{className:"absolute right-full mr-2 top-1/2 -translate-y-1/2 z-20 bg-white rounded-lg shadow-xl border border-gray-200 p-2.5 w-48",onClick:v=>v.stopPropagation(),style:{boxShadow:"0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1)"},children:[t.jsxs("div",{style:{fontSize:"11px",fontWeight:600,color:"#374151",marginBottom:"8px"},children:["Remove ",O.length>1?`all ${O.length} relationships`:"relationship","?"]}),t.jsxs("div",{className:"flex gap-1.5 justify-end",children:[t.jsx("button",{onClick:()=>y(null),className:"px-2 py-1 rounded",style:{fontSize:"10px",background:"#F3F4F6",color:"#4B5563",border:"none",cursor:"pointer"},children:"Cancel"}),t.jsx("button",{onClick:()=>{y(null),O.forEach(v=>d(v.rel.id))},className:"px-2 py-1 rounded",style:{fontSize:"10px",background:"#EF4444",color:"#FFFFFF",border:"none",cursor:"pointer"},children:"Remove"})]})]})]})]}),b&&t.jsx("div",{className:"px-3 pb-2 space-y-2",style:{borderTop:`1px solid ${f.borderLight}`,paddingTop:7},children:n.map(({rel:v,direction:k},j)=>{const P=Pn(v.type,a),N=s&&v.named===!0;return t.jsxs("div",{style:{fontSize:"10px",color:"#6B7280",marginTop:j>0?8:0,paddingTop:j>0?8:0,borderTop:j>0?`1px dashed ${f.borderLight}`:"none"},children:[t.jsx(Tt,{label:"Kind",value:(P==null?void 0:P.label)??v.type,valueColor:m}),t.jsx(Tt,{label:"Roles",value:`${v.sourceEnd||(P==null?void 0:P.sourceEnd.name)||"source"} → ${v.targetEnd||(P==null?void 0:P.targetEnd.name)||"target"}`}),t.jsx(Tt,{label:"ID",value:v.id,mono:!0}),t.jsx(Tt,{label:"Source",value:v.file||"—",mono:!0}),!v.named&&t.jsx("div",{style:{color:"#D97706",marginTop:4},children:"Anonymous connection — name it in SysML to allow deletion from here."}),N&&t.jsxs("div",{className:"relative inline-block mt-2",children:[t.jsx("button",{onClick:M=>{M.stopPropagation(),y(v.id)},className:"px-1.5 py-0.5 rounded",style:{background:"#FEF2F2",color:"#DC2626",border:"1px solid #FECACA",cursor:"pointer",fontSize:"10px"},children:"Remove this relationship"}),h===v.id&&t.jsxs("div",{className:"absolute left-full ml-2 top-1/2 -translate-y-1/2 z-20 bg-white rounded-lg shadow-xl border border-gray-200 p-2.5 w-48",onClick:M=>M.stopPropagation(),children:[t.jsx("div",{style:{fontSize:"11px",fontWeight:600,color:"#374151",marginBottom:"8px"},children:"Remove relationship?"}),t.jsxs("div",{className:"flex gap-1.5 justify-end",children:[t.jsx("button",{onClick:()=>y(null),className:"px-2 py-1 rounded",style:{fontSize:"10px",background:"#F3F4F6",border:"none",cursor:"pointer"},children:"Cancel"}),t.jsx("button",{onClick:()=>{y(null),d(v.id)},className:"px-2 py-1 rounded",style:{fontSize:"10px",background:"#EF4444",color:"#FFFFFF",border:"none",cursor:"pointer"},children:"Remove"})]})]})]})]},v.id)})})]})}function Tt({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 Xd({pending:e,model:r,onDismiss:n}){const o=e.direction==="outgoing"?e.targetId:e.sourceId,a=r.elements[o],s=e.status==="failed";return t.jsxs("div",{className:"flex items-center gap-1.5 ml-2 rounded",style:{padding:"4px 8px",fontSize:T.xs,background:s?"#FEF2F2":"#F9FAFB",color:s?"#DC2626":"#6B7280",fontStyle:s?"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:T.xs},children:e.label}),t.jsx("span",{className:"truncate flex-1",children:(a==null?void 0:a.name)??o}),s?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…"})]})}const Qd=[{value:"",label:"Default"},{value:"#FEF3C7",label:"Amber"},{value:"#DCFCE7",label:"Green"},{value:"#DBEAFE",label:"Blue"},{value:"#FCE7F3",label:"Pink"},{value:"#FEE2E2",label:"Red"},{value:"#EDE9FE",label:"Violet"},{value:"#E5E7EB",label:"Grey"}],at={display:"flex",alignItems:"center",gap:8,marginBottom:8,fontSize:T.xs,color:f.secondary},st={width:62,flexShrink:0};function Zd(){const e=E(c=>c.selectionStyle),[r,n]=p.useState(!0),[o,a]=p.useState("#FFFFFF");if(!e)return null;const{count:s,opacity:i,apply:l}=e;return t.jsxs("div",{style:{borderTop:`1px solid ${f.borderLight}`,padding:"10px 12px"},children:[t.jsxs("button",{onClick:()=>n(c=>!c),"aria-expanded":r,style:{display:"flex",alignItems:"center",gap:6,width:"100%",background:"none",border:"none",padding:0,cursor:"pointer",fontSize:"10px",fontWeight:700,letterSpacing:".07em",textTransform:"uppercase",color:f.muted},children:[t.jsx("span",{style:{fontSize:9},children:r?"▾":"▸"}),"Style",t.jsxs("span",{style:{marginLeft:"auto",fontWeight:600,textTransform:"none",letterSpacing:0},children:[s," selected"]})]}),r&&t.jsxs("div",{style:{marginTop:10},children:[t.jsxs("div",{style:at,children:[t.jsx("span",{style:st,children:"Fill"}),t.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:4,flex:1},children:[Qd.map(c=>t.jsx("button",{title:`Fill: ${c.label}`,"aria-label":`Fill ${c.label}`,onClick:()=>l({color:c.value}),style:{width:20,height:20,padding:0,borderRadius:4,cursor:"pointer",border:`1px solid ${f.border}`,background:c.value||"#FFFFFF",color:"#94A3B8",fontSize:11,lineHeight:1,fontWeight:700},children:c.value?"":"⌫"},c.label)),t.jsx("input",{type:"color","aria-label":"Custom fill colour",title:"Custom fill colour",value:o,onChange:c=>{a(c.target.value),l({color:c.target.value})},style:{width:22,height:20,padding:1,border:`1px solid ${f.border}`,borderRadius:4,cursor:"pointer"}})]})]}),t.jsxs("div",{style:at,children:[t.jsx("span",{style:st,children:"Border"}),t.jsx("input",{type:"color","aria-label":"Border colour",onChange:c=>l({borderColor:c.target.value}),style:{width:26,height:22,padding:1,border:`1px solid ${f.border}`,borderRadius:4,cursor:"pointer"}}),t.jsx("button",{onClick:()=>l({borderColor:""}),style:{border:`1px solid ${f.border}`,background:f.surface,borderRadius:4,fontSize:11,padding:"2px 7px",cursor:"pointer",color:f.secondary},children:"Reset"})]}),t.jsxs("div",{style:at,children:[t.jsx("span",{style:st,children:"Text"}),t.jsx("input",{type:"color","aria-label":"Text colour",onChange:c=>l({textColor:c.target.value}),style:{width:26,height:22,padding:1,border:`1px solid ${f.border}`,borderRadius:4,cursor:"pointer"}}),t.jsxs("select",{"aria-label":"Text size",defaultValue:"",onChange:c=>c.target.value&&l({fontSize:Number(c.target.value)}),style:{height:22,border:`1px solid ${f.border}`,borderRadius:4,color:f.secondary,fontSize:11},children:[t.jsx("option",{value:"",children:"Auto"}),[10,12,14,16,18,20].map(c=>t.jsxs("option",{value:c,children:[c,"px"]},c))]}),t.jsx("button",{title:"Bold text",onClick:()=>l({fontWeight:700}),style:{border:`1px solid ${f.border}`,background:f.surface,borderRadius:4,fontSize:11,fontWeight:700,padding:"2px 8px",cursor:"pointer",color:f.secondary},children:"B"})]}),t.jsxs("div",{style:at,children:[t.jsx("span",{style:st,children:"Align"}),[["left","≡","Align text left"],["center","≣","Align text centre"],["right","☷","Align text right"]].map(([c,d,u])=>t.jsx("button",{title:u,"aria-label":u,onClick:()=>l({textAlign:c}),style:{width:24,height:22,border:`1px solid ${f.border}`,background:f.surface,borderRadius:4,fontSize:12,cursor:"pointer",color:f.secondary},children:d},c)),[["top","⤒","Align text at top"],["middle","↕","Align text vertically centred"],["bottom","⤓","Align text at bottom"]].map(([c,d,u])=>t.jsx("button",{title:u,"aria-label":u,onClick:()=>l({verticalAlign:c}),style:{width:24,height:22,border:`1px solid ${f.border}`,background:f.surface,borderRadius:4,fontSize:12,cursor:"pointer",color:f.secondary},children:d},c))]}),t.jsxs("label",{style:at,children:[t.jsx("span",{style:st,children:"Opacity"}),t.jsx("input",{type:"range",min:.2,max:1,step:.05,value:i,"aria-label":"Fill opacity",onChange:c=>l({opacity:Number(c.target.value)}),style:{flex:1}}),t.jsxs("span",{style:{width:30,textAlign:"right",color:f.faint},children:[Math.round(i*100),"%"]})]})]})]})}const Pe="panel";function pe({title:e,count:r,defaultOpen:n=!0,actions:o,children:a}){const[s,i]=p.useState(n);return t.jsxs("div",{className:"mb-3 mx-3 bg-white border border-gray-200/60 rounded-xl shadow-sm overflow-hidden",children:[t.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 cursor-pointer transition-colors hover:bg-gray-50",onClick:()=>i(l=>!l),children:[t.jsx("span",{className:"font-bold flex-1 text-[10px] uppercase tracking-wider",style:{color:"#6B7280"},children:e}),o&&t.jsx("span",{onClick:l=>l.stopPropagation(),children:o}),typeof r=="number"&&t.jsx("span",{className:"px-1.5 py-0.5 rounded-md font-medium text-[10px]",style:{background:"#F3F4F6",color:"#6B7280"},children:r}),t.jsx("span",{style:{color:"#D1D5DB",fontSize:14},children:s?"▾":"▸"})]}),s&&t.jsx("div",{className:"px-3 pb-3 pt-1",children:a})]})}function ec({label:e,kind:r,kindColor:n,onClick:o,arrow:a,typeBadge:s,typeColor:i,selected:l}){return t.jsxs("div",{className:"flex items-center gap-1.5 cursor-pointer transition-colors ml-2",style:{borderRadius:"6px",padding:"4px 8px",background:l?"#2DD4A818":"transparent",color:l?"#1B3A4B":"#374151",fontWeight:l?500:400,fontSize:T.xs},onMouseEnter:c=>{l||(c.currentTarget.style.background="#F0F0ED")},onMouseLeave:c=>{l||(c.currentTarget.style.background="transparent")},onClick:o,children:[a&&t.jsx("span",{style:{color:"#9CA3AF"},children:a}),s&&t.jsx("span",{className:"px-1 py-0.5 rounded",style:{background:(i||"#2563EB")+"18",color:i||"#2563EB",fontSize:T.xs},children:s}),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:T.badge},children:r})]})}function tc(){const e=E(s=>s.model),r=E(s=>s.activeView),n=r.type==="diagram"?r.diagramId:null,o=Yt(e,n);if(!o)return null;const a=qe[o.diagramType];return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"p-5 mb-2",style:{background:"#FFFFFF",borderBottom:"1px solid #F3F4F6",borderLeft:`4px solid ${(a==null?void 0:a.color)||"#6B7280"}`,boxShadow:"0 1px 2px rgba(0,0,0,0.02)"},children:[t.jsx("div",{className:"text-sm font-bold truncate",style:{color:"#111827"},children:o.name}),t.jsxs("div",{className:"flex items-center gap-2 text-xs mt-2",children:[a&&t.jsx("span",{className:"px-2 py-0.5 rounded-md font-semibold",style:{background:a.color+"18",color:a.color},children:a.code}),t.jsx("span",{style:{color:"#6B7280",fontWeight:500},children:(a==null?void 0:a.fullName)||o.diagramType})]}),o.auto&&t.jsx("div",{className:"text-xs mt-2 font-medium",style:{color:"#9CA3AF"},children:"Auto-generated"})]}),t.jsxs("div",{className:"flex-1 overflow-y-auto pt-2 pb-4 bg-gray-50/50",children:[o.description&&t.jsx(pe,{title:"Description",defaultOpen:!0,children:t.jsx("div",{className:"text-xs leading-relaxed",style:{color:"#374151"},children:o.description})}),t.jsx(pe,{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:T.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:T.xs},children:o.sourceFile})]})]})}),o.properties&&Object.keys(o.properties).length>0&&t.jsx(pe,{title:"Properties",count:Object.keys(o.properties).length,children:t.jsx("div",{className:"space-y-1.5",children:Object.entries(o.properties).map(([s,i])=>t.jsxs("div",{className:"flex text-xs",children:[t.jsx("span",{className:"min-w-[80px]",style:{color:"#6B7280"},children:s}),t.jsx("span",{className:"truncate",style:{color:"#1a1a1a"},children:i})]},s))})}),o.elementIds&&o.elementIds.length>0&&t.jsx(pe,{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(pe,{title:"Relationship Types",count:o.relationshipTypes.length,children:t.jsx("div",{className:"flex flex-wrap gap-1",children:o.relationshipTypes.map(s=>t.jsx("span",{className:"px-1.5 py-0.5 rounded text-xs",style:{background:"#EFF6FF",color:"#2563EB",fontSize:T.xs},children:s},s))})})]})]})}const nc=4e3;function rc({elementId:e}){const r=E(i=>i.model),n=E(i=>i.lastSourceChange),[o,a]=p.useState(null),s=p.useMemo(()=>di(r,e),[r,e]);return p.useEffect(()=>{if(!ci(n,s))return;a(n.at);const i=setTimeout(()=>a(null),nc);return()=>clearTimeout(i)},[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:T.badge,background:"#ECFDF5",color:"#047857",border:"1px solid #A7F3D0"},children:"↻ Updated"}):null}function oc(){var R,A;const e=E(v=>v.model),r=E(v=>v.selectedElementId),n=E(v=>v.validation),o=E(v=>v.selectElement),a=E(v=>v.updateElementField),s=E(v=>v.updateElementAttribute),i=E(v=>v.applyEdit),l=E(v=>v.deleteModelElement),[c,d]=p.useState(!1);p.useEffect(()=>{d(!1)},[r]),p.useEffect(()=>{if(!r)return;const v=k=>{(k.metaKey||k.ctrlKey)&&k.key==="s"&&(k.preventDefault(),i(r),d(!1))};return window.addEventListener("keydown",v),()=>window.removeEventListener("keydown",v)},[r,i]);const u=p.useMemo(()=>r&&e?li(e,r):[],[e,r]);if(!r||!e)return null;const m=e.elements[r];if(!m)return null;const b=u.filter(v=>v.sourceId===r),w=u.filter(v=>v.targetId===r),S=ce[m.layer]||"#666",g=(n==null?void 0:n.violations.filter(v=>v.elementId===r))||[],h=new Set(["boundaryColor","boundaryOpacity","boundaryWidth","fill","stroke","opacity","color","backgroundColor","bounds.x","bounds.y","bounds.width","bounds.height"]),y=[["id",m.id],...m.uuid?[["uuid",m.uuid]]:[],["kind",m.kind],["layer",m.layer],...Object.entries(m.attributes).filter(([v])=>v!=="name"&&v!=="id"&&!h.has(v)&&v!=="description"&&v!=="shortDescription")],B=Object.entries(m.attributes).filter(([v])=>h.has(v)),O=(v,k)=>{s(r,v,k),i(r)},D=v=>{const k=v.trim();!k||k===m.name||(a(r,"name",k),i(r))};return t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"p-5 mb-2 relative group",style:{background:"#FFFFFF",borderBottom:"1px solid #F3F4F6",borderLeft:`4px solid ${S}`,boxShadow:"0 1px 2px rgba(0,0,0,0.02)"},children:t.jsxs("div",{className:"flex justify-between items-start mb-2",children:[t.jsx("div",{className:"flex items-start gap-3 pr-4 min-w-0 flex-1",children:t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"text-[15px] font-bold leading-tight",style:{color:"#111827"},children:t.jsx(ot,{value:m.name,onSave:D,density:Pe,placeholder:"Element name"})}),t.jsx("div",{className:"text-sm font-medium mt-3 text-gray-700",children:t.jsx(ot,{value:m.attributes.shortDescription||"",onSave:v=>O("shortDescription",v),density:Pe,multiline:!0,placeholder:"Add a short description..."})}),t.jsx("div",{className:"text-xs text-gray-500 mt-1.5 leading-relaxed",children:t.jsx(ot,{value:m.attributes.description||"",onSave:v=>O("description",v),density:Pe,multiline:!0,placeholder:"Add a detailed description..."})})]})}),t.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",children:[t.jsx("button",{onClick:()=>void navigator.clipboard.writeText(m.id),title:`Copy ID: ${m.id}`,className:"p-1 hover:bg-gray-100 rounded text-gray-400 hover:text-gray-700",children:t.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),t.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})}),t.jsx("button",{onClick:()=>void l(m.id),title:"Delete element",className:"p-1 hover:bg-red-50 rounded text-gray-400 hover:text-red-600",children:t.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("polyline",{points:"3 6 5 6 21 6"}),t.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}),t.jsx("line",{x1:"10",y1:"11",x2:"10",y2:"17"}),t.jsx("line",{x1:"14",y1:"11",x2:"14",y2:"17"})]})})]})]})}),t.jsxs("div",{className:"flex-1 overflow-y-auto pt-2 pb-6 bg-gray-50/50",children:[m.parameters&&m.parameters.length>0&&t.jsx(pe,{title:"Parameters",count:m.parameters.length,children:t.jsx("div",{className:"space-y-1.5",children:m.parameters.map(v=>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:v.direction==="in"?"#EFF6FF":v.direction==="out"?"#FFF7ED":"#F0FDF4",color:v.direction==="in"?"#2563EB":v.direction==="out"?"#EA580C":"#16A34A"},children:v.direction}),t.jsx("span",{style:{color:"#374151",fontWeight:500},children:v.name}),t.jsx("span",{style:{color:"#6B7280"},children:":"}),t.jsx("span",{style:{color:"#6B7280"},children:v.type})]},v.name))})}),m.allocatedTo&&t.jsx(pe,{title:"Allocated To",defaultOpen:!0,children:t.jsx(ec,{label:((R=e.elements[m.allocatedTo])==null?void 0:R.name)||m.allocatedTo,kind:(A=e.elements[m.allocatedTo])==null?void 0:A.kind,kindColor:"#E67E22",arrow:"→",onClick:()=>o(m.allocatedTo)})}),B.length>0&&t.jsx(pe,{title:"Appearance",count:B.length,defaultOpen:!1,children:t.jsx("div",{className:"space-y-1.5",children:B.map(([v,k])=>{const j=Br(v);return t.jsxs("div",{className:"flex text-xs items-start gap-1.5",children:[t.jsx("span",{className:"min-w-[100px] pt-0.5",style:{color:"#6B7280"},children:v}),t.jsx("div",{style:{flex:1,minWidth:0},children:v==="boundaryColor"?t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("input",{"aria-label":"Boundary color",type:"color",value:/^#[0-9a-f]{6}$/i.test(String(k))?String(k):"#14B8A6",onChange:P=>{const N=document.getElementById(`screen-node-${m.id}`);N&&(N.style.borderColor=P.target.value)},onBlur:P=>O(v,P.target.value),style:{width:28,height:24,padding:0,border:"1px solid #D8D8D2",borderRadius:4,background:"#FFFFFF"}}),t.jsx("span",{className:"font-mono text-[10px] text-gray-500",children:String(k)})]}):v==="boundaryWidth"?t.jsxs("div",{className:"flex items-center gap-3 pr-2",children:[t.jsx("input",{"aria-label":"Boundary width",type:"range",min:"1",max:"10",step:"1",defaultValue:Number(k??"2"),onChange:P=>{const N=document.getElementById(`screen-node-${m.id}`);N&&(N.style.borderWidth=P.target.value+"px")},onMouseUp:P=>O(v,P.target.value),style:{width:"100%"}}),t.jsxs("span",{className:"font-mono text-[10px] text-gray-500 w-6",children:[k,"px"]})]}):Fn(j)?t.jsx(ot,{value:String(k??""),onSave:P=>O(v,P),density:Pe,placeholder:"Click to set…"}):t.jsx(Fr,{value:String(k??""),editability:j,density:Pe,mono:v!=="kind"&&v!=="layer"})})]},v)})})}),y.length>0&&t.jsx(pe,{title:"Attributes",count:y.length,defaultOpen:!1,children:t.jsx("div",{className:"space-y-1.5",children:y.map(([v,k])=>{const j=Br(v);return t.jsxs("div",{className:"flex text-xs items-start gap-1.5",children:[t.jsx("span",{className:"min-w-[100px] pt-0.5",style:{color:"#6B7280"},children:v}),t.jsx("div",{style:{flex:1,minWidth:0},children:Fn(j)?t.jsx(ot,{value:String(k??""),onSave:P=>O(v,P),density:Pe,multiline:v==="description"||v==="rationale",placeholder:"Click to set…"}):t.jsx(Fr,{value:String(k??""),editability:j,density:Pe,mono:v!=="kind"&&v!=="layer"})})]},v)})})}),t.jsx(ac,{subject:m}),g.length>0&&t.jsx(pe,{title:"Guidance",count:g.length,defaultOpen:!0,children:t.jsx("div",{className:"space-y-2",children:g.map((v,k)=>t.jsxs("div",{className:"text-xs p-2.5 rounded-lg",style:{background:v.severity==="error"?"#FEF2F2":v.severity==="warning"?"#FFFBEB":"#EFF6FF",border:`1px solid ${v.severity==="error"?"#FECACA":v.severity==="warning"?"#FDE68A":"#BFDBFE"}`},children:[t.jsx("div",{style:{color:v.severity==="error"?"#DC2626":v.severity==="warning"?"#D97706":"#2563EB"},children:v.description}),t.jsxs("div",{className:"mt-0.5",style:{color:"#6B7280"},children:["[",v.ruleId,"]"]})]},`${v.ruleId}-${k}`))})}),g.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"]})}),m.file&&t.jsx(pe,{title:"Source",defaultOpen:!1,actions:t.jsx(rc,{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:v=>{v.currentTarget.style.background="#EFF6FF"},onMouseLeave:v=>{v.currentTarget.style.background="transparent"},onClick:()=>{navigator.clipboard.writeText(m.file).catch(()=>{})},title:"Click to copy path",children:[t.jsx("span",{style:{flexShrink:0},children:"⟨/⟩"}),t.jsx("span",{className:"font-mono truncate",children:m.file}),t.jsx("span",{style:{flexShrink:0,color:"#9CA3AF",fontSize:"9px"},children:"copy"})]})}),t.jsx(Gd,{element:m,outgoing:b,incoming:w,density:Pe})]})]})}const Rt={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 ac({subject:e}){var N,M,L;const r=E(C=>C.model),n=E(C=>C.createModelElement),o=E(C=>C.createRelationship),a=E(C=>C.persistElementAttributes),[s,i]=p.useState(""),[l,c]=p.useState(""),[d,u]=p.useState(""),[m,b]=p.useState(null),[w,S]=p.useState(!1),[g,h]=p.useState(""),[y,B]=p.useState(null),[O,D]=p.useState("");if(!r)return null;const R=new Set(Object.values(Rt).map(C=>C.relation.toLowerCase())),v=[...new Set(r.relationships.filter(C=>R.has(C.type.toLowerCase())&&C.targetId===e.id).map(C=>C.sourceId))].map(C=>r.elements[C]).filter(C=>!!C),k=new Map;for(const C of r.relationships.filter(z=>z.type.toLowerCase()==="composes"))((N=r.elements[C.sourceId])==null?void 0:N.kind)!=="ModelComment"||((M=r.elements[C.targetId])==null?void 0:M.kind)!=="ModelComment"||k.set(C.sourceId,[...k.get(C.sourceId)??[],r.elements[C.targetId]]);const j=async()=>{var G,H,X;if(!l.trim())return;const C=y?"comment":m??"comment";D("Saving…");const z=Rt[C],$=s.trim()||`Model ${z.label}`,U=n({name:$,kind:z.kind,construct:"part",layer:e.layer,file:e.file||"model/generated.sysml",doc:"",attributes:{shortDescription:$,body:l.trim(),author:d.trim()||"currentReviewer",createdAt:new Date().toISOString(),...C==="comment"?{commentStatus:"CommentStatusKind::open"}:{},...C==="rationale"&&g.trim()?{basis:g.trim()}:{},...C==="note"&&g.trim()?{noteKind:g.trim()}:{}}});try{const Y=(G=E.getState().model)==null?void 0:G.elements[U],ae=Date.now()+1e4;for(;((H=E.getState().model)==null?void 0:H.elements[U])===Y&&Date.now()<ae;)await new Promise(x=>setTimeout(x,100));const se=(X=E.getState().model)==null?void 0:X.elements[U];if(!se||se===Y)throw new Error("The saved annotation did not appear in the rebuilt model.");const I=await o({type:y?"Composes":z.relation,sourceId:y??U,targetId:y?U:e.id,direction:"outgoing",selectedElementId:y??U});if(!I.success)throw new Error(I.error);i(""),c(""),h(""),B(null),b(null),D("Saved.")}catch(Y){D(Y instanceof Error?Y.message:String(Y))}},P=(C,z=!1)=>{var G;const $=C.kind==="ModelRationale"?"rationale":C.kind==="ModelNote"?"note":"comment",U=$==="rationale"?"#7C3AED":$==="note"?"#2563EB":"#2DD4A8";return t.jsxs("div",{style:{marginLeft:z?14:0,borderLeft:`2px solid ${z?"#D1D5DB":U}`,padding:"5px 7px",marginBottom:6},children:[t.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[t.jsx("span",{style:{color:U,fontSize:9,fontWeight:700,textTransform:"uppercase"},children:$}),t.jsx("strong",{style:{color:"#374151"},children:C.attributes.author||"Unknown"}),t.jsx("span",{style:{color:"#9CA3AF"},children:C.attributes.createdAt||""})]}),t.jsx("div",{style:{fontSize:11,fontWeight:600,color:"#374151"},children:C.attributes.shortDescription||C.name}),t.jsx("div",{style:{fontSize:11,color:"#4B5563",whiteSpace:"pre-wrap"},children:C.attributes.body}),$==="rationale"&&C.attributes.basis&&t.jsxs("div",{style:{fontSize:10,color:"#7C3AED"},children:["Basis: ",C.attributes.basis]}),$==="note"&&C.attributes.noteKind&&t.jsxs("div",{style:{fontSize:10,color:"#2563EB"},children:["Kind: ",C.attributes.noteKind]}),$==="comment"&&t.jsxs("div",{className:"flex gap-2",style:{marginTop:3},children:[!z&&t.jsx("button",{onClick:()=>{B(C.id),b("comment")},style:{border:0,background:"transparent",color:"#2563EB",fontSize:10,cursor:"pointer"},children:"Reply"}),!((G=C.attributes.commentStatus)!=null&&G.endsWith("resolved"))&&t.jsx("button",{onClick:()=>a(C.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"})]}),(k.get(C.id)??[]).map(H=>P(H,!0))]},C.id)};return t.jsxs(pe,{title:"Annotations",count:v.length,defaultOpen:!0,children:[t.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[t.jsx("button",{onClick:()=>b("note"),title:"Add Note",className:`p-1.5 rounded flex items-center justify-center transition-colors ${m==="note"?"bg-blue-100 text-blue-700":"bg-gray-100 hover:bg-gray-200 text-gray-600"}`,children:t.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),t.jsx("polyline",{points:"14 2 14 8 20 8"}),t.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),t.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),t.jsx("polyline",{points:"10 9 9 9 8 9"})]})}),t.jsx("button",{onClick:()=>b("comment"),title:"Add Comment",className:`p-1.5 rounded flex items-center justify-center transition-colors ${m==="comment"?"bg-teal-100 text-teal-700":"bg-gray-100 hover:bg-gray-200 text-gray-600"}`,children:t.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})})}),t.jsx("button",{onClick:()=>b("rationale"),title:"Add Rationale",className:`p-1.5 rounded flex items-center justify-center transition-colors ${m==="rationale"?"bg-purple-100 text-purple-700":"bg-gray-100 hover:bg-gray-200 text-gray-600"}`,children:t.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t.jsx("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"})})}),t.jsx("div",{className:"flex-1"}),t.jsxs("button",{onClick:()=>S(!0),title:"View Annotations",className:"p-1.5 rounded bg-gray-100 hover:bg-gray-200 text-gray-600 flex items-center gap-1.5 text-xs font-semibold",children:[t.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),t.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),"View (",v.length,")"]})]}),(m||y)&&t.jsxs("div",{className:"bg-gray-50 border border-gray-200 rounded p-2 mb-2",children:[t.jsxs("div",{className:"flex justify-between items-center mb-2",children:[t.jsx("span",{className:"text-xs font-semibold",style:{color:y?"#0F766E":m==="rationale"?"#7C3AED":m==="note"?"#2563EB":"#2DD4A8"},children:y?`Replying to ${(L=r.elements[y])==null?void 0:L.name}`:`New ${Rt[m].label}`}),t.jsx("button",{onClick:()=>{b(null),B(null)},className:"text-gray-400 hover:text-gray-600",children:"✕"})]}),t.jsx("input",{value:d,onChange:C=>u(C.target.value),placeholder:"Author",style:{width:"100%",marginBottom:4,fontSize:11}}),t.jsx("input",{value:s,onChange:C=>i(C.target.value),placeholder:"Short summary",style:{width:"100%",marginBottom:4,fontSize:11}}),!y&&m!=="comment"&&t.jsx("input",{value:g,onChange:C=>h(C.target.value),placeholder:m==="rationale"?"Basis / evidence (optional)":"Note kind (optional)",style:{width:"100%",marginBottom:4,fontSize:11}}),t.jsx("textarea",{value:l,onChange:C=>c(C.target.value),placeholder:y?"Reply":Rt[m].placeholder,rows:3,style:{width:"100%",fontSize:11}}),t.jsxs("div",{className:"flex gap-2 mt-1",children:[t.jsx("button",{onClick:j,disabled:!l.trim(),style:{fontSize:11,padding:"4px 8px",background:"#374151",color:"white",borderRadius:4,flex:1},children:"Save"}),t.jsx("button",{onClick:()=>{b(null),B(null)},style:{fontSize:11,padding:"4px 8px",background:"#E5E7EB",color:"#374151",borderRadius:4},children:"Cancel"})]}),O&&t.jsx("div",{style:{fontSize:10,color:"#6B7280",marginTop:4},children:O})]}),w&&t.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30",onClick:()=>S(!1),children:t.jsxs("div",{className:"bg-white rounded-lg shadow-2xl w-[400px] max-h-[85vh] flex flex-col",onClick:C=>C.stopPropagation(),children:[t.jsxs("div",{className:"p-3 border-b font-bold flex justify-between items-center text-gray-800",children:["Annotations",t.jsx("button",{onClick:()=>S(!1),className:"text-gray-400 hover:text-gray-700",children:"✕"})]}),t.jsx("div",{className:"p-4 overflow-y-auto",children:v.length>0?v.map(C=>P(C)):t.jsx("div",{className:"text-gray-500 text-sm text-center py-8",children:"No annotations yet."})})]})})]})}function sc(){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],s=n.type==="flow",i=n.flowItem,l=i&&/energy|power|voltage|current/i.test(i)?"Energy":i&&/material|fluid|gas|batch/i.test(i)?"Material":s?"Data":"Control",c=l==="Energy"?"#D97706":l==="Material"?"#16A34A":l==="Data"?"#3498DB":"#4B5563";return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"p-5 mb-2",style:{background:"#FFFFFF",borderBottom:"1px solid #F3F4F6",borderLeft:`4px solid ${c}`,boxShadow:"0 1px 2px rgba(0,0,0,0.02)"},children:[t.jsx("div",{className:"text-[15px] font-bold",style:{color:"#111827"},children:"Connection"}),t.jsxs("div",{className:"mt-2 text-xs font-medium",style:{color:"#4B5563"},children:[(o==null?void 0:o.name)??n.sourceId," → ",(a==null?void 0:a.name)??n.targetId]}),t.jsxs("div",{className:"mt-3 flex gap-2",children:[t.jsxs("span",{className:"px-2 py-1 rounded-md text-[11px] font-bold uppercase tracking-wider",style:{background:c+"15",color:c},children:[l," flow"]}),t.jsx("span",{className:"px-2 py-1 rounded-md text-[11px] font-bold uppercase tracking-wider",style:{background:"#F3F4F6",color:"#4B5563"},children:n.type})]})]}),t.jsxs("div",{className:"flex-1 overflow-y-auto pt-2 pb-4 bg-gray-50/50",children:[t.jsx(pe,{title:"Involved item",defaultOpen:!0,children:t.jsx("div",{className:"text-xs",style:{color:"#374151"},children:i??"No transported item is modeled for this connection."})}),t.jsx(pe,{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(pe,{title:"Traceability",defaultOpen:!1,children:t.jsx("div",{className:"text-xs",style:{color:"#6B7280"},children:n.file||"Model relationship"})})]})]})}function ic(){const e=E(l=>l.selectedElementId),r=E(l=>l.activeView),n=E(l=>l.selectedRelationshipId),o=E(l=>l.propertiesPanelCollapsed),a=E(l=>l.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 s=r.type==="diagram"&&!e&&!n,i=!!e;return t.jsxs("div",{className:"flex flex-col overflow-hidden flex-shrink-0 bg-gray-50/30",style:{width:"320px",borderLeft:"1px solid #E5E7EB",boxShadow:"-4px 0 16px rgba(0,0,0,0.02)"},children:[t.jsxs("div",{className:"flex items-center justify-between px-4 py-3 bg-white border-b border-gray-200 flex-shrink-0 z-10 shadow-sm",children:[t.jsx("span",{className:"text-[11px] uppercase tracking-wider font-bold text-gray-800",children:"Properties"}),t.jsx("button",{onClick:a,className:"flex items-center justify-center transition-colors",style:{color:"#9CA3AF",fontSize:"18px",lineHeight:1,width:"28px",height:"28px",borderRadius:"6px",background:"#FFFFFF",border:"1px solid #E5E7EB"},onMouseEnter:l=>{l.currentTarget.style.color="#374151",l.currentTarget.style.borderColor="#D1D5DB"},onMouseLeave:l=>{l.currentTarget.style.color="#9CA3AF",l.currentTarget.style.borderColor="#E5E7EB"},title:"Collapse properties","aria-label":"Collapse properties",children:"›"})]}),n?t.jsx(sc,{}):i?t.jsx(oc,{}):s?t.jsx(tc,{}):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"})}),t.jsx(Zd,{})]})}function mn(e=f.border){return{borderTop:`1px solid ${e}`}}function lc({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:f.primary,fontSize:T.xs,minWidth:0}})}function dc({values:e}){const r=[...new Set(e.filter(Boolean))];return r.length===0?t.jsx("span",{style:{color:f.faint,fontSize:"12px"},children:"—"}):r.length===1?t.jsx("span",{style:{color:f.muted,fontSize:"12px"},children:r[0]}):t.jsxs("span",{style:{color:"#F59E0B",fontSize:"12px"},children:[r.length," different values"]})}function cc(){const e=E(g=>g.model),r=E(g=>g.selectedElementIds),n=E(g=>g.clearElementSelection),o=E(g=>g.bulkUpdateAttributes),a=p.useMemo(()=>[...r],[r]),s=p.useMemo(()=>a.map(g=>e==null?void 0:e.elements[g]).filter(Boolean),[a,e]),i=p.useMemo(()=>{if(s.length===0)return[];const g="_",h=s.map(B=>new Set(Object.keys(B.attributes).filter(O=>!O.startsWith(g))));return[...h[0]].filter(B=>h.every(O=>O.has(B))).sort()},[s]),l=p.useMemo(()=>{const g={};for(const h of i)g[h]=s.map(y=>y.attributes[h]??"");return g},[s,i]),c=p.useMemo(()=>[...new Set(s.map(g=>g.kind))].sort(),[s]),[d,u]=p.useState({}),m=p.useCallback((g,h)=>{u(y=>({...y,[g]:h}))},[]),b=Object.values(d).some(g=>g!==""),w=p.useCallback(()=>{const g=Object.fromEntries(Object.entries(d).filter(([,h])=>h!==""));Object.keys(g).length!==0&&(o(a,g),u({}))},[d,a,o]),S=p.useCallback(()=>{u({})},[]);return s.length<2?null:t.jsxs("div",{className:"flex flex-col overflow-hidden",style:{width:"280px",background:f.surface,borderLeft:`1px solid ${f.border}`,fontSize:T.xs},children:[t.jsxs("div",{className:"flex items-center justify-between px-4 py-3 flex-shrink-0",style:{borderBottom:`1px solid ${f.border}`},children:[t.jsxs("div",{children:[t.jsx("div",{className:"font-semibold",style:{color:f.primary,fontSize:T.sm},children:"Bulk Edit"}),t.jsxs("div",{style:{color:f.muted,fontSize:"12px",marginTop:"2px"},children:[a.length," elements selected"]})]}),t.jsx("button",{onClick:n,className:"px-2 py-1 rounded",style:{color:f.muted,background:"#F0F0ED",fontSize:"12px"},title:"Clear selection",children:"✕ Clear"})]}),t.jsxs("div",{className:"px-4 py-3 flex-shrink-0",style:mn(),children:[t.jsx("div",{style:{color:f.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(g=>t.jsx("span",{className:"px-2 py-0.5 rounded-full",style:{background:"#EEF2FF",color:"#4F46E5",fontSize:"12px",fontWeight:500},children:g},g))}),t.jsxs("div",{style:{color:f.faint,fontSize:"12px",marginTop:"6px"},children:[s.map(g=>g.name).slice(0,5).join(", "),s.length>5&&` +${s.length-5} more`]})]}),t.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-3",style:mn(),children:[t.jsxs("div",{style:{color:f.muted,fontSize:"12px",fontWeight:600,marginBottom:"8px",textTransform:"uppercase",letterSpacing:"0.5px"},children:["Common Attributes",i.length>0&&t.jsxs("span",{style:{color:f.faint,fontWeight:400,marginLeft:"4px"},children:["(",i.length,")"]})]}),i.length===0?t.jsx("div",{style:{color:f.faint,fontSize:"12px"},children:"No common attributes across selected elements."}):t.jsx("div",{className:"space-y-3",children:i.map(g=>t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between mb-1",children:[t.jsx("span",{style:{color:f.secondary,fontSize:"12px",fontWeight:500},children:g}),t.jsx(dc,{values:l[g]})]}),t.jsx(lc,{placeholder:`Set for all ${a.length} elements…`,value:d[g]??"",onChange:h=>m(g,h)})]},g))})]}),i.length>0&&t.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 flex-shrink-0",style:mn(),children:[t.jsx("button",{onClick:S,disabled:!b,className:"flex-1 py-1.5 rounded",style:{fontSize:T.xs,fontWeight:500,color:b?f.secondary:f.faint,background:b?"#F0F0ED":"#F7F7F5",cursor:b?"pointer":"default"},children:"Reset"}),t.jsxs("button",{onClick:w,disabled:!b,className:"flex-1 py-1.5 rounded font-semibold",style:{fontSize:T.xs,color:"#FFFFFF",background:b?"#2DD4A8":"#A7F3D0",cursor:b?"pointer":"default"},children:["Apply to ",a.length]})]})]})}const Ar="memo-gapbar-pulse";if(typeof document<"u"&&!document.getElementById(Ar)){const e=document.createElement("style");e.id=Ar,e.textContent=`
|
|
4055
|
+
${j}`,E={id:z,title:C.title,group:C.groupLabel,templateId:C.templateId,content:L,createdAt:Date.now(),authors:"",approvers:""};o(E),F.push(E),F.length===1&&e({type:"dhf-document",docId:E.id})}d(null)}return p.useEffect(()=>{if(!u)return;function D(){m(null)}return window.addEventListener("click",D),()=>window.removeEventListener("click",D)},[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:f.accentDark,fontSize:I.explorer.item,fontWeight:600,color:"#fff",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",gap:"6px"},onMouseEnter:D=>{D.currentTarget.style.background="#254B60"},onMouseLeave:D=>{D.currentTarget.style.background=f.accentDark},children:[t.jsx("span",{style:{fontSize:"14px",lineHeight:1},children:"+"})," New Document"]})}),g.map(D=>t.jsxs("div",{children:[g.length>1&&t.jsx("div",{style:{padding:"9px 10px 2px",fontSize:"10px",fontWeight:700,letterSpacing:".07em",textTransform:"uppercase",color:f.muted},children:D.label}),h(D.items).map(A=>{const F=`${D.systemId??"global"}:${A.key}`,C=i.has(A.key);return t.jsxs("div",{children:[t.jsxs("button",{onClick:()=>y(A.key),onContextMenu:A.groupId?k=>B(k,A.groupId):void 0,className:"w-full flex items-center gap-2 px-3 py-2 text-left",style:{fontSize:I.xs,fontWeight:600,color:f.secondary,borderRadius:"4px"},onMouseEnter:k=>k.currentTarget.style.background=f.surfaceAlt,onMouseLeave:k=>k.currentTarget.style.background="transparent",title:A.groupId?"Right-click to add documents":void 0,children:[t.jsx("span",{style:{display:"inline-block",width:"7px",height:"7px",borderRadius:"50%",background:A.color,flexShrink:0}}),t.jsx("span",{className:"flex-1 uppercase tracking-wide",style:{fontSize:"10px"},children:A.label}),t.jsx("span",{style:{fontSize:"10px",color:A.color,fontWeight:700},children:A.docs.length}),t.jsx(ke,{expanded:C,size:11})]}),C&&A.docs.map(k=>{const T=b===k.id;return t.jsxs("div",{style:{display:"flex",alignItems:"center",paddingLeft:"28px",paddingRight:"4px",background:T?`${A.color}18`:"transparent",borderLeft:T?`2px solid ${A.color}`:"2px solid transparent",cursor:"pointer"},onMouseEnter:z=>{T||(z.currentTarget.style.background=f.surfaceAlt)},onMouseLeave:z=>{z.currentTarget.style.background=T?`${A.color}18`:"transparent"},children:[t.jsxs("button",{onClick:()=>e({type:"dhf-document",docId:k.id}),style:{flex:1,display:"flex",alignItems:"center",gap:"6px",background:"none",border:"none",padding:"5px 0",fontSize:I.explorer.element,color:T?A.color:f.primary,fontWeight:T?600:400,cursor:"pointer",textAlign:"left"},children:[t.jsx(xt,{color:A.color}),t.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:k.id})]}),t.jsx("button",{onClick:z=>{z.stopPropagation(),a(k.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:z=>{z.currentTarget.style.opacity="1",z.currentTarget.style.color="#ef4444"},onMouseLeave:z=>{z.currentTarget.style.opacity="0",z.currentTarget.style.color="#9CA3AF"},children:"×"})]},k.id)})]},F)})]},D.systemId??D.label)),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:D=>D.stopPropagation(),children:t.jsx("button",{onClick:()=>{d({initialGroupId:u.groupId}),m(null)},style:{display:"block",width:"100%",padding:"8px 14px",background:"none",border:"none",textAlign:"left",fontSize:"13px",color:"#1B3A4B",cursor:"pointer"},onMouseEnter:D=>D.currentTarget.style.background="#F3F4F6",onMouseLeave:D=>D.currentTarget.style.background="none",children:"Add document…"})}),c&&t.jsx(cd,{initialGroupId:c.initialGroupId,existingDocs:n,numberingPrefix:s.documentNumberingPrefix||"DOC",onCreate:N,onClose:()=>d(null)})]})}const Ro="memo-explorer-width",pt=300,mt=240,Fn=720,Od=320;function hn(){return typeof window>"u"||!window.innerWidth?Fn:Math.max(mt,Math.min(Fn,window.innerWidth-Od))}function zd(e){return Number.isFinite(e)?Math.min(Fn,Math.max(mt,e)):pt}function Ud(){if(typeof window>"u")return pt;try{const e=Number.parseInt(localStorage.getItem(Ro)??"",10);return Number.isFinite(e)?zd(e):pt}catch{return pt}}function Ld(){var N,D,A;const e=S(F=>F.sidebarCollapsed),r=S(F=>F.toggleSidebar);S(F=>F.explorerTab);const n=S(F=>F.setExplorerTab),o=S(F=>F.searchTerm),a=S(F=>F.setSearchTerm),s=S(F=>F.model),i=S(F=>F.activeMode),l=S(F=>F.activeView),c=l.type==="diagram"&&((D=(N=s==null?void 0:s.diagrams)==null?void 0:N.find(F=>F.id===l.diagramId))==null?void 0:D.viewpointId)&&((A=s.diagrams.find(F=>F.id===l.diagramId))==null?void 0:A.viewpointId)!=="__model",d=c||i==="diagram"?"Viewpoints":"Model Explorer",[u,m]=p.useState(Ud),[b,v]=p.useState(hn),w=Math.min(u,b),g=p.useRef(null),h=p.useCallback(F=>{m(Math.max(mt,Math.min(hn(),F)))},[]),y=p.useCallback(()=>{var F;(F=g.current)==null||F.call(g),g.current=null},[]),B=p.useCallback(F=>{if(F.button!==0)return;F.preventDefault(),y();const C=F.clientX,k=w,T=document.body.style.cursor,z=document.body.style.userSelect;document.body.style.cursor="col-resize",document.body.style.userSelect="none";const _=L=>{h(k+L.clientX-C)},j=()=>{window.removeEventListener("pointermove",_),window.removeEventListener("pointerup",j),window.removeEventListener("pointercancel",j),document.body.style.cursor=T,document.body.style.userSelect=z,g.current=null};g.current=j,window.addEventListener("pointermove",_),window.addEventListener("pointerup",j),window.addEventListener("pointercancel",j)},[h,w,y]);return p.useEffect(()=>{try{localStorage.setItem(Ro,String(Math.round(u)))}catch{}},[u]),p.useEffect(()=>{const F=()=>v(hn());return window.addEventListener("resize",F),()=>{window.removeEventListener("resize",F),y()}},[y]),p.useEffect(()=>{(l.type==="ontology"||l.type==="ontology-detail")&&n("ontologies")},[l.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 ${f.border}`,cursor:"pointer"},children:[t.jsx("span",{style:{color:f.muted,fontSize:18,lineHeight:1},children:"›"}),t.jsx("span",{style:{color:f.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:f.surface,borderRight:`1px solid ${f.border}`},children:[t.jsxs("div",{className:"flex items-center justify-between px-3 py-2",style:{background:f.surfaceAlt,borderBottom:`1px solid ${f.border}`,flexShrink:0},children:[t.jsx("span",{style:{fontSize:I.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 ${f.border}`,borderRadius:5,background:"#FFFFFF",color:f.muted,cursor:"pointer",fontSize:18,lineHeight:1},children:"‹"})]}),l.type==="diagram"&&!c?t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"px-3 py-2",style:{borderBottom:`1px solid ${f.border}`},children:t.jsxs("div",{className:"flex gap-1",children:[t.jsx("input",{type:"text",placeholder:"Search elements...",value:o,onChange:F=>a(F.target.value),onKeyDown:F=>{F.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:f.surfaceAlt,border:`1px solid ${f.border}`,color:f.primary,fontSize:I.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:f.surfaceAlt,border:`1px solid ${f.border}`,color:f.secondary,cursor:"pointer"},children:t.jsx(Br,{})})]})}),t.jsx(Ar,{searchTerm:o})]}):i==="dashboard"?t.jsx(tl,{}):i==="dhf"?t.jsx(Pd,{}):i==="diagram"||c?t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"px-3 py-2",style:{borderBottom:`1px solid ${f.border}`},children:t.jsx("input",{type:"text",placeholder:"Search viewpoints and views...",value:o,onChange:F=>a(F.target.value),className:"w-full px-3 py-2 rounded-lg focus:outline-none",style:{background:f.surfaceAlt,border:`1px solid ${f.border}`,color:f.primary,fontSize:I.explorer.search}})}),t.jsx(Md,{searchTerm:o})]}):i==="ontology"?t.jsx(el,{}):i==="scenario"?t.jsx(p.Suspense,{fallback:t.jsx("div",{className:"p-3",style:{color:f.faint,fontSize:I.explorer.item},children:"Loading use cases…"}),children:t.jsx(hd,{explorerOnly:!0})}):t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"px-3 py-2",style:{borderBottom:`1px solid ${f.border}`},children:t.jsxs("div",{className:"flex gap-1",children:[t.jsx("input",{type:"text",placeholder:"Search elements...",value:o,onChange:F=>a(F.target.value),onKeyDown:F=>{F.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:f.surfaceAlt,border:`1px solid ${f.border}`,color:f.primary,fontSize:I.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:f.surfaceAlt,border:`1px solid ${f.border}`,color:f.secondary,cursor:"pointer"},children:t.jsx(Br,{})})]})}),t.jsx(Ar,{searchTerm:o})]}),t.jsx("div",{className:"memo-explorer-resizer",role:"separator","aria-label":"Resize Model Explorer","aria-orientation":"vertical","aria-valuemin":mt,"aria-valuemax":b,"aria-valuenow":Math.round(w),tabIndex:0,title:"Drag to resize · Double-click to reset",onPointerDown:B,onDoubleClick:()=>h(pt),onKeyDown:F=>{F.key==="ArrowLeft"?(F.preventDefault(),h(w-20)):F.key==="ArrowRight"?(F.preventDefault(),h(w+20)):F.key==="Home"?(F.preventDefault(),h(mt)):F.key==="End"&&(F.preventDefault(),h(b))}})]})}function qd(e,r){if(r.length===0)return!0;const n=`${e.label??e.value} ${e.group??""} ${e.keywords??""}`.toLowerCase();return r.every(o=>n.includes(o))}function $d(e,r){const n=r.trim().toLowerCase().split(/\s+/).filter(Boolean);if(n.length===0)return e;const o=[],a=[];for(const s of e){if(!qd(s,n))continue;(s.label??s.value).toLowerCase().startsWith(n[0])?o.push(s):a.push(s)}return[...o,...a]}function Zt({label:e,options:r,selected:n,onChange:o,allLabel:a="All",placeholder:s="Type to filter…",width:i=150,title:l,describedAs:c,maxVisible:d=300,parentOf:u,iconOnly:m,align:b="left"}){var V;const[v,w]=p.useState(!1),[g,h]=p.useState(""),[y,B]=p.useState(0),[N,D]=p.useState(new Set),A=p.useRef(null),F=p.useRef(null),C=p.useMemo(()=>new Set(n),[n]),k=p.useMemo(()=>$d(r,g),[r,g]),T=k.length>d?k.slice(0,d):k,z=k.length-T.length,_=p.useMemo(()=>{if(!u)return null;const U=new Map(r.map(M=>[M.value,M])),$=new Set(k.map(M=>M.value));for(const M of[...$]){let x=u.get(M);for(;x&&U.has(x)&&!$.has(x);)$.add(x),x=u.get(x)}const K=new Map;for(const M of $){const x=u.get(M);if(x&&$.has(x)){const P=K.get(x)??[];P.push(M),K.set(x,P)}}const J=(M,x)=>{var P,q;return(((P=U.get(M))==null?void 0:P.label)??M).localeCompare(((q=U.get(x))==null?void 0:q.label)??x)};K.forEach(M=>M.sort(J));const Y=[...$].filter(M=>!u.get(M)||!$.has(u.get(M))).sort(J),Q=[],ee=(M,x)=>{const P=U.get(M);if(!P)return;const q=K.get(M)??[];Q.push({option:P,depth:x,children:q}),q.length>0&&N.has(M)&&q.forEach(X=>ee(X,x+1))};return Y.forEach(M=>ee(M,0)),Q},[r,k,u,N]);p.useEffect(()=>{B(0)},[g,v]),p.useEffect(()=>{if(!v)return;const U=$=>{var K;(K=A.current)!=null&&K.contains($.target)||(w(!1),h(""))};return document.addEventListener("mousedown",U),()=>document.removeEventListener("mousedown",U)},[v]),p.useEffect(()=>{var U;v&&((U=F.current)==null||U.focus())},[v]);const j=p.useCallback(U=>{o(C.has(U)?n.filter($=>$!==U):[...n,U])},[o,n,C]),L=p.useCallback(U=>{if(!u)return j(U);const $=new Set([U]);let K=!0;for(;K;){K=!1;for(const[Y,Q]of u)$.has(Q)&&!$.has(Y)&&($.add(Y),K=!0)}const J=[...$].every(Y=>C.has(Y));o(J?n.filter(Y=>!$.has(Y)):[...new Set([...n,...$])])},[u,j,n,C,o]),E=U=>{if(U.key==="Escape"){w(!1),h("");return}U.key==="ArrowDown"&&(U.preventDefault(),B($=>Math.min($+1,T.length-1))),U.key==="ArrowUp"&&(U.preventDefault(),B($=>Math.max($-1,0))),U.key==="Enter"&&T[y]&&(U.preventDefault(),j(T[y].value))},O=n.length===0?a:n.length===1?((V=r.find(U=>U.value===n[0]))==null?void 0:V.label)??n[0]:`${n.length} selected`;return t.jsxs("div",{ref:A,style:{position:"relative",display:"flex",alignItems:"center",gap:"5px"},children:[t.jsx("span",{style:{fontSize:I.xs,color:f.muted,whiteSpace:"nowrap"},children:e}),t.jsx("button",{type:"button","aria-haspopup":"listbox","aria-expanded":v,title:l??(n.length>0?n.join(", "):a),onClick:()=>w(U=>!U),style:m?{width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"4px",background:"transparent",border:"none",color:n.length>0?f.accent:f.muted,cursor:"pointer",padding:0}:{width:i,display:"flex",alignItems:"center",justifyContent:"space-between",gap:"6px",padding:"3px 7px",borderRadius:"5px",border:`1px solid ${n.length>0?f.accent:f.border}`,background:f.surface,fontSize:I.xs,color:n.length>0?f.primary:f.muted,cursor:"pointer",textAlign:"left"},children:m?t.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:t.jsx("polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3"})}):t.jsxs(t.Fragment,{children:[t.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:O}),t.jsx("span",{style:{fontSize:"9px",color:f.faint},children:"▼"})]})}),v&&t.jsxs("div",{role:"listbox",style:{position:"absolute",top:"calc(100% + 4px)",...b==="right"?{right:0}:{left:0},zIndex:60,width:Math.max(i+70,220),background:f.surface,border:`1px solid ${f.border}`,borderRadius:"7px",boxShadow:Di.lg,overflow:"hidden"},children:[t.jsx("input",{ref:F,value:g,onChange:U=>h(U.target.value),onKeyDown:E,placeholder:s,"aria-label":`Filter ${c??e}`,style:{width:"100%",padding:"7px 9px",border:"none",borderBottom:`1px solid ${f.borderLight}`,fontSize:I.xs,outline:"none",color:f.primary}}),t.jsxs("div",{style:{maxHeight:"260px",overflowY:"auto"},children:[k.length===0&&t.jsxs("div",{style:{padding:"10px",fontSize:I.xs,color:f.faint},children:["Nothing matches ","“",g,"”"]}),(_??T.map(U=>({option:U,depth:0,children:[]}))).map(({option:U,depth:$,children:K},J)=>{var ee;const Y=C.has(U.value),Q=!_&&U.group&&U.group!==((ee=T[J-1])==null?void 0:ee.group)?U.group:null;return t.jsxs("div",{children:[Q&&t.jsx("div",{style:{position:"sticky",top:0,zIndex:1,padding:"4px 9px 2px",fontSize:"10px",fontWeight:600,color:f.faint,background:f.surface,borderBottom:`1px solid ${f.borderLight}`},children:Q}),t.jsxs("div",{role:"option","aria-selected":Y,onMouseEnter:()=>B(J),onClick:()=>L(U.value),style:{display:"flex",alignItems:"center",gap:"7px",padding:"5px 9px 5px "+(9+$*16)+"px",cursor:"pointer",fontSize:I.xs,background:J===y?f.surfaceAlt:"transparent",color:f.primary},children:[_&&t.jsx("button",{type:"button","aria-label":K.length>0?`${N.has(U.value)?"Collapse":"Expand"} ${U.label??U.value}`:void 0,disabled:K.length===0,onClick:M=>{M.stopPropagation(),K.length!==0&&D(x=>{const P=new Set(x);return P.has(U.value)?P.delete(U.value):P.add(U.value),P})},style:{width:"13px",padding:0,border:"none",background:"none",color:f.muted,cursor:K.length>0?"pointer":"default"},children:K.length>0?N.has(U.value)?"▾":"▸":""}),t.jsx("input",{type:"checkbox",readOnly:!0,checked:Y,style:{accentColor:f.accent}}),U.color&&t.jsx("span",{style:{width:"8px",height:"8px",borderRadius:"2px",background:U.color,flexShrink:0}}),t.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:U.label??U.value}),U.hint&&t.jsx("span",{style:{color:f.faint,fontSize:"11px"},children:U.hint})]})]},U.value)}),z>0&&t.jsxs("div",{style:{padding:"7px 9px",fontSize:"11px",color:f.faint,borderTop:`1px solid ${f.borderLight}`},children:[z.toLocaleString()," more match. Keep typing to narrow, or use"," ","Select matches to take all ",k.length.toLocaleString(),"."]})]}),t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"6px 9px",borderTop:`1px solid ${f.borderLight}`},children:[t.jsxs("button",{type:"button",onClick:()=>o(k.map(U=>U.value)),style:{fontSize:"11px",color:"#2563EB",background:"none",border:"none",cursor:"pointer",padding:0},children:["Select ",g?`matches (${k.length})`:`all (${r.length})`]}),t.jsx("button",{type:"button",onClick:()=>o([]),style:{fontSize:"11px",color:f.muted,background:"none",border:"none",cursor:"pointer",padding:0},children:"None"}),n.length>0&&t.jsxs("span",{style:{marginLeft:"auto",fontSize:"11px",color:f.faint},children:[n.length," picked"]})]})]})]})}const Nr="#E5E5E0",Vd="#2DD4A8",Kt=40;function Tr(e,r){var s;const n=e.id.toLowerCase(),o=((s=e.shortId)==null?void 0:s.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 Wd(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)=>Tr(o,n)-Tr(a,n)||o.name.localeCompare(a.name)).slice(0,r.limit??Kt):[]}function Hd(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 Kd(e,r){return Wd(e,{query:r.query,excludeId:r.source.id,limit:Object.keys(e).length}).filter(n=>!r.filterKinds||r.filterKinds.length===0||r.filterKinds.includes(n.kind)).filter(n=>Ye(r.source,n,r.registries).length>0).slice(0,r.limit??Kt)}function Gd({element:e,model:r,registries:n,enabled:o,onCreate:a}){var C;const[s,i]=p.useState(""),[l,c]=p.useState(!1),[d,u]=p.useState(0),[m,b]=p.useState([]),v=p.useRef(null),w=p.useRef(null);p.useEffect(()=>{i(""),c(!1),u(0),b([])},[e.id]);const g=p.useMemo(()=>Array.from(new Set(Object.values(r.elements).map(k=>k.kind))).sort(),[r.elements]),h=p.useMemo(()=>Kd(r.elements,{query:s,source:e,registries:n,filterKinds:m}),[r.elements,e,s,n,m]),y=p.useMemo(()=>Hd(h),[h]),B=p.useMemo(()=>y.flatMap(k=>k.elements),[y]);p.useEffect(()=>{u(0)},[s]),p.useEffect(()=>{var k,T;l&&((T=(k=w.current)==null?void 0:k.querySelector('[data-active="true"]'))==null||T.scrollIntoView({block:"nearest"}))},[d,l]);const N=p.useCallback(k=>{const T=Ye(e,k,n);if(T.length>0){const z=["trace","satisfies","implements","verifies","validates"],j=T.find(L=>z.some(E=>L.definition.name.toLowerCase().includes(E)||L.definition.label.toLowerCase().includes(E)))??T[0];a({type:j.definition.name,sourceId:j.sourceId,targetId:j.targetId,direction:j.direction})}i(""),c(!1)},[e,n,a]),D=p.useCallback(()=>{i(""),c(!1)},[]),A=p.useCallback(k=>{if(k.key==="Escape"){if(l){c(!1);return}D();return}if(!l||B.length===0){k.key==="ArrowDown"&&B.length>0&&(k.preventDefault(),c(!0));return}if(k.key==="ArrowDown")k.preventDefault(),u(T=>(T+1)%B.length);else if(k.key==="ArrowUp")k.preventDefault(),u(T=>(T-1+B.length)%B.length);else if(k.key==="Enter"){k.preventDefault();const T=B[d];T&&N(T)}},[l,B,d,N,D]),F=(C=B[d])==null?void 0:C.id;return t.jsx("div",{className:"mt-1.5",style:{opacity:o?1:.6},children:t.jsxs("div",{className:"relative",children:[t.jsxs("div",{className:"flex gap-2",children:[t.jsx("input",{ref:v,value:s,disabled:!o,onChange:k=>{i(k.target.value),c(!0)},onFocus:()=>{s.trim()&&c(!0)},onBlur:()=>{window.setTimeout(()=>c(!1),120)},onKeyDown:A,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":l,"aria-controls":"memo-quick-add-matches","aria-activedescendant":l&&F?`memo-quick-add-${F}`:void 0,role:"combobox",autoComplete:"off",className:"flex-1 px-2 py-1 rounded focus:outline-none",style:{fontSize:I.xs,background:"#FFFFFF",border:`1px solid ${l&&s.trim()?Vd:Nr}`,color:"#374151",minWidth:0}}),t.jsx("div",{style:{flexShrink:0},children:t.jsx(Zt,{label:"",options:g.map(k=>({value:k,label:k})),selected:m,onChange:b,allLabel:"All Types",iconOnly:!0})})]}),l&&s.trim()&&t.jsxs("div",{id:"memo-quick-add-matches",ref:w,role:"listbox",className:"absolute left-0 right-0 z-20 mt-1 rounded overflow-y-auto",style:{maxHeight:240,background:"#FFFFFF",border:`1px solid ${Nr}`,boxShadow:"0 8px 24px rgba(15,23,42,0.14)"},children:[B.length===0?t.jsxs("div",{className:"px-2 py-2",style:{fontSize:I.xs,color:"#9CA3AF"},children:["No MEMO-legal trace target matches “",s.trim(),"”."]}):y.map(k=>t.jsxs("div",{children:[t.jsx(Yd,{kind:k.kind,layer:k.layer,count:k.elements.length}),k.elements.map(T=>t.jsx(Jd,{element:T,active:T.id===F,onSelect:()=>N(T)},T.id))]},k.kind)),h.length===Kt&&t.jsxs("div",{className:"px-2 py-1",style:{fontSize:"10px",color:"#9CA3AF"},children:["Showing the first ",Kt," matches — keep typing to narrow."]})]})]})})}function Yd({kind:e,layer:r,count:n}){const o=ce[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 Jd({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:I.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 Xd={text:"14px",heading:"13px",meta:"12px",valuePadding:"9px 12px",fieldGap:"10px",sectionPadding:"0 0 18px 0",radius:"10px",twoColumnAttributes:!0},Qd={text:"12px",heading:"12px",meta:"11px",valuePadding:"4px 7px",fieldGap:"5px",sectionPadding:"0 0 10px 0",radius:"7px",twoColumnAttributes:!1};function Ve(e){return e==="page"?Xd:Qd}const Io={kind:"editable"},Zd={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 Rr(e){const r=Zd[e];return r?{kind:"identity",reason:r}:Io}function Ru(e){return e==="doc"?Io:{kind:"derived",reason:`"${e}" is derived from the SysML source when the model is built.`}}function An(e){return e.kind==="editable"}function Mo(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 ec({title:e,count:r,actions:n,density:o,defaultOpen:a=!0,collapsible:s=!0,children:i}){const[l,c]=p.useState(a),d=Ve(o),u=o==="page",m=s?l:!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 ${f.borderLight}`,borderRadius:u?14:0,background:u?f.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:s?"pointer":"default",padding:u?"0 0 10px 0":"6px 10px",borderRadius:u?0:"6px",margin:u?0:"2px 4px"},onClick:s?()=>c(b=>!b):void 0,onMouseEnter:b=>{!u&&s&&(b.currentTarget.style.background=f.surfaceAlt)},onMouseLeave:b=>{u||(b.currentTarget.style.background="transparent")},children:[t.jsx("h3",{style:{flex:1,margin:0,fontSize:u?d.heading:"10px",fontWeight:u?700:"bold",color:u?f.primary:"#6B7280",letterSpacing:u?0:"0.05em",textTransform:u?"none":"uppercase"},children:e}),typeof r=="number"&&(u?t.jsx("span",{style:{fontSize:d.meta,color:f.faint},children:r}):t.jsx("span",{className:"px-1.5 py-0.5 rounded-md font-medium text-[10px]",style:{background:"#F3F4F6",color:"#6B7280"},children:r})),n&&t.jsx("span",{onClick:b=>b.stopPropagation(),children:n}),s&&t.jsx("span",{style:{color:"#D1D5DB",fontSize:u?d.meta:14},children:m?"▾":"▸"})]}),m&&t.jsx("div",{style:{padding:u?0:"0 14px 8px"},children:i})]})}function Ir({value:e,editability:r,density:n,mono:o}){const a=Ve(n),s=r.kind==="editable"?"":r.reason;return t.jsxs("div",{title:s||Mo(r),style:{display:"flex",alignItems:"center",gap:6,padding:a.valuePadding,borderRadius:a.radius,background:f.surfaceAlt,border:"1px solid transparent",color:f.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:f.faint,fontStyle:"italic"},children:"none"})}),t.jsx("span",{"aria-hidden":!0,style:{fontSize:a.meta,color:"#C7CBD1",flexShrink:0},children:"🔒"})]})}function ot({value:e,onSave:r,density:n,multiline:o,placeholder:a,autoFocus:s,compact:i=!1}){const[l,c]=p.useState(!1),[d,u]=p.useState(!1),[m,b]=p.useState(e),v=Ve(n),w=p.useRef(!1),g=p.useRef(null),[h,y]=p.useState(null),[B,N]=p.useState(0),D=S(j=>j.model),A=S(j=>j.inspectElement);p.useEffect(()=>{b(e)},[e]);const F=p.useMemo(()=>h===null||!D?[]:Object.values(D.elements).filter(j=>{const L=(j.shortId??"").toLowerCase(),E=j.id.toLowerCase(),O=j.name.toLowerCase();return L.includes(h)||E.includes(h)||O.includes(h)}).slice(0,10),[h,D]),C=p.useCallback(()=>{w.current||h===null&&(w.current=!0,c(!1),m!==e&&r(m))},[m,e,r,h]),k=p.useCallback(j=>{var L;if(h!==null){if(j.key==="ArrowDown"){j.preventDefault(),N(E=>(E+1)%Math.max(1,F.length));return}if(j.key==="ArrowUp"){j.preventDefault(),N(E=>(E-1+F.length)%Math.max(1,F.length));return}if(j.key==="Enter"||j.key==="Tab"){j.preventDefault();const E=F[B];if(E){const O=((L=g.current)==null?void 0:L.selectionStart)??0,V=m.slice(0,O),U=m.slice(O),$=V.match(/(?:^|\s)@([a-zA-Z0-9_-]*)$/);if($){const K=O-$[1].length-1,J=`[${E.name}](@${E.shortId??E.id}) `,Y=m.slice(0,K)+J+U;b(Y),y(null),setTimeout(()=>{g.current&&(g.current.selectionStart=K+J.length,g.current.selectionEnd=g.current.selectionStart,g.current.focus())},0)}}else y(null);return}if(j.key==="Escape"){j.preventDefault(),y(null);return}}j.key==="Enter"&&!o&&(j.preventDefault(),C()),j.key==="Escape"&&(w.current=!0,b(e),c(!1))},[C,o,e,h,F,B,m]),T=j=>{const L=j.target.value;b(L);const E=j.target.selectionStart??0,V=L.slice(0,E).match(/(?:^|\s)@([a-zA-Z0-9_-]*)$/);V?(y(V[1].toLowerCase()),N(0)):y(null)},z=()=>{w.current=!1,b(e),c(!0)};if(l){const j={ref:g,value:m,autoFocus:!0,onChange:T,onBlur:()=>{setTimeout(C,200)},onKeyDown:k,placeholder:a,style:{width:"100%",padding:i?"5px 8px":v.valuePadding,borderRadius:i?"6px":v.radius,border:`1px solid ${f.accent}`,boxShadow:`0 0 0 3px ${f.accent}25`,background:f.surface,color:f.primary,fontSize:v.text,fontFamily:"inherit",outline:"none",...o?{minHeight:n==="page"?"110px":"54px",resize:"vertical",lineHeight:1.6}:{}}};return t.jsxs("div",{style:{position:"relative",width:"100%"},children:[o?t.jsx("textarea",{...j}):t.jsx("input",{type:"text",...j}),h!==null&&F.length>0&&t.jsx("div",{style:{position:"absolute",top:"100%",left:0,right:0,marginTop:4,background:"#fff",border:"1px solid #E5E7EB",borderRadius:6,boxShadow:"0 4px 12px rgba(0,0,0,0.1)",zIndex:100,maxHeight:200,overflowY:"auto"},children:F.map((L,E)=>t.jsxs("div",{style:{padding:"6px 12px",fontSize:13,cursor:"pointer",background:E===B?"#F3F4F6":"#fff",display:"flex",justifyContent:"space-between"},onClick:()=>{var K,J;const O=((K=g.current)==null?void 0:K.selectionStart)??m.length,V=m.slice(0,O),U=m.slice(O),$=V.match(/(?:^|\s)@([a-zA-Z0-9_-]*)$/);if($){const Y=O-$[1].length-1,Q=m.slice(0,Y)+`[${L.name}](@${L.shortId??L.id}) `+U;b(Q)}y(null),(J=g.current)==null||J.focus()},children:[t.jsx("span",{style:{fontWeight:500,color:"#111827"},children:L.name}),t.jsx("span",{style:{color:"#6B7280",fontSize:11},children:L.shortId??L.id})]},L.id))})]})}const _=j=>{if(!j)return a??"Click to add…";if(!D)return j;const L=/(\[[^\]]+\]\(@[a-zA-Z0-9_-]+\)|@[a-zA-Z0-9_-]+)/g;return j.split(L).map((O,V)=>{let U="",$="";if(O.startsWith("@"))U=O.slice(1);else if(O.startsWith("[")&&O.includes("](@")){const K=O.match(/\[([^\]]+)\]\(@([a-zA-Z0-9_-]+)\)/);K&&($=K[1],U=K[2])}if(U){const K=Object.values(D.elements).find(J=>(J.shortId??J.id)===U)||D.elements[U];if(K)return t.jsx("span",{onClick:J=>{J.stopPropagation(),A(K.id)},style:{color:f.accent,cursor:"pointer",fontWeight:600,background:"#E0F2FE",padding:"1px 4px",borderRadius:"4px"},title:K.name,children:$||`@${K.shortId??K.id}`},V)}return t.jsx("span",{children:O},V)})};return t.jsxs("div",{role:"button",tabIndex:0,title:"Click to edit",onClick:z,onFocus:()=>u(!0),onBlur:()=>u(!1),onKeyDown:j=>{(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),z())},onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),style:{display:"flex",alignItems:"flex-start",gap:6,padding:i?"5px 8px":v.valuePadding,borderRadius:i?"6px":v.radius,background:d?"#F3F4F6":"transparent",border:`1px solid ${d?"#E5E7EB":"transparent"}`,boxShadow:"none",color:e?f.primary:f.faint,fontSize:v.text,cursor:"text",transition:"background-color 150ms ease, border-color 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)}),t.jsx("span",{"aria-hidden":!0,style:{flexShrink:0,fontSize:v.meta,color:f.accent,opacity:d?1:0,transition:"opacity 150ms ease"},children:"✎"})]})}function Iu({label:e,editability:r,density:n,children:o}){const a=Ve(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:f.muted},children:[t.jsx("span",{style:{fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace"},children:e}),t.jsx("span",{className:"sr-only",children:Mo(r)}),!An(r)&&t.jsx("span",{title:r.kind==="editable"?"":r.reason,style:{fontSize:"10px",padding:"0 4px",borderRadius:4,background:f.surfaceAlt,color:f.faint,border:`1px solid ${f.border}`},children:r.kind==="identity"?"identifier":"derived"})]}),o]})}function Mu({density:e}){const r=Ve(e);return t.jsxs("div",{className:"flex items-center gap-4 flex-wrap",style:{fontSize:r.meta,color:f.faint},children:[t.jsxs("span",{className:"flex items-center gap-1.5",children:[t.jsx("span",{style:{color:f.accent},children:"✎"})," editable here"]}),t.jsx("span",{children:"Identity and source metadata are read-only"})]})}function tc(e,r,n,o){var c;const a=new Map,s=(d,u)=>{var v;const m=u==="outgoing"?d.targetId:d.sourceId,b=a.get(m)??{id:m,element:n.elements[m],links:[]};b.links.push({relationship:d,direction:u,label:((v=On(d.type,o))==null?void 0:v.label)??d.type}),a.set(m,b)};e.forEach(d=>s(d,"outgoing")),r.forEach(d=>s(d,"incoming"));const i=new Map;for(const d of a.values()){const u=((c=d.element)==null?void 0:c.layer)||"other";i.set(u,[...i.get(u)??[],d])}const l=d=>{const u=Te.indexOf(d);return u<0?Number.MAX_SAFE_INTEGER:u};return[...i.entries()].map(([d,u])=>({layer:d,elements:u.sort((m,b)=>{var v,w;return(((v=m.element)==null?void 0:v.name)??m.id).localeCompare(((w=b.element)==null?void 0:w.name)??b.id)})})).sort((d,u)=>l(d.layer)-l(u.layer)||d.layer.localeCompare(u.layer))}function nc({element:e,model:r,registries:n,outgoing:o,incoming:a,density:s,onNavigate:i,onCreate:l,onDelete:c}){const[d,u]=p.useState(""),m=p.useMemo(()=>tc(o,a,r,n),[o,a,r,n]),b=d.trim().toLowerCase(),v=p.useMemo(()=>m.map(g=>({...g,elements:g.elements.filter(h=>{var y,B,N;return!b||[(y=h.element)==null?void 0:y.name,(B=h.element)==null?void 0:B.kind,(N=h.element)==null?void 0:N.shortId,h.id,g.layer,...h.links.map(D=>D.label)].filter(Boolean).join(" ").toLowerCase().includes(b)})})).filter(g=>g.elements.length>0),[m,b]),w=m.reduce((g,h)=>g+h.elements.length,0);return t.jsxs("div",{style:{border:s==="page"?"none":`1px solid ${f.border}`,borderRadius:12,background:s==="page"?"transparent":f.surfaceAlt,padding:s==="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:f.primary,fontSize:13,fontWeight:700},children:"Linked elements"}),t.jsxs("div",{style:{color:f.muted,fontSize:11},children:[w," element",w===1?"":"s"," across ",m.length," layer",m.length===1?"":"s"]})]}),w>6&&t.jsx("input",{value:d,onChange:g=>u(g.target.value),placeholder:"Filter linked elements…","aria-label":"Filter linked elements",className:"transition-shadow focus:shadow-md",style:{marginLeft:"auto",width:240,padding:"8px 12px",borderRadius:8,border:`1px solid ${f.border}`,background:"#F9FAFB",color:f.primary,fontSize:13,outline:"none"}})]}),w===0&&t.jsx("div",{style:{color:f.faint,fontSize:12},children:"No linked elements."}),t.jsx("div",{style:{display:"flex",flexDirection:"column",gap:14},children:v.map(g=>{const h=ce[g.layer]||f.muted;return t.jsxs("section",{style:{padding:"16px 20px",background:h+"08",border:`1px solid ${h}15`,borderRadius:12},children:[t.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[t.jsx("span",{style:{width:10,height:10,borderRadius:3,background:h}}),t.jsx("strong",{style:{color:f.primary,fontSize:14,letterSpacing:"0.02em"},children:Le[g.layer]??g.layer}),t.jsx("span",{style:{color:f.faint,fontSize:12,background:h+"15",padding:"1px 6px",borderRadius:10},children:g.elements.length})]}),t.jsx("div",{style:{display:"grid",gridTemplateColumns:s==="page"?"repeat(auto-fill, 264px)":"1fr",justifyContent:"start",gap:7},children:g.elements.map(y=>t.jsx(rc,{element:e,linked:y,registries:n,color:h,onNavigate:i,onCreate:l,onDelete:c},y.id))})]},g.layer)})})]})}function rc({element:e,linked:r,registries:n,color:o,onNavigate:a,onCreate:s,onDelete:i}){var b,v,w,g;const[l,c]=p.useState(!1),d=p.useMemo(()=>!e||!r.element?[]:Ye(e,r.element,n).map(h=>({value:`${h.definition.name}::${h.direction}`,label:`${h.definition.label} ${h.direction==="outgoing"?"to":"from"}`})),[e,r.element,n]),u=r.links.map(h=>`${h.relationship.type}::${h.direction}`),m=p.useCallback(h=>{if(h.length===0||!s||!i)return;const y=new Set(h),B=new Set(u);for(const D of r.links)y.has(`${D.relationship.type}::${D.direction}`)||i(D.relationship.id);const N=Ye(e,r.element,n);for(const D of h)if(!B.has(D)){const A=N.find(F=>`${F.definition.name}::${F.direction}`===D);A&&s({type:A.definition.name,sourceId:A.sourceId,targetId:A.targetId,direction:A.direction})}},[u,r.links,e,r.element,n,s,i]);return t.jsx("button",{onClick:()=>a(r.id),onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),className:"text-left transition-all duration-200",title:`Open ${((b=r.element)==null?void 0:b.name)??r.id}`,style:{padding:"12px 14px",borderRadius:10,background:"#FFFFFF",border:`1px solid ${l?o+"80":"#E5E7EB"}`,cursor:"pointer",minWidth:0,width:"100%",maxWidth:280,boxShadow:l?"0 4px 12px rgba(0,0,0,0.05)":"0 1px 2px rgba(0,0,0,0.02)",transform:l?"translateY(-1px)":"none"},children:t.jsxs("div",{style:{minWidth:0},children:[t.jsxs("div",{className:"flex items-start justify-between mb-1",style:{gap:4},children:[t.jsx("div",{children:r.links.map(h=>t.jsxs("div",{style:{color:h.direction==="outgoing"?"#2563EB":"#059669",fontSize:10,fontWeight:600,marginBottom:2},children:[h.label," ",h.direction==="outgoing"?"to":"from"]},h.relationship.id))}),d.length>1&&s&&t.jsx("div",{onClick:h=>h.stopPropagation(),style:{flexShrink:0,marginTop:-4,marginRight:-4},children:t.jsx(Zt,{label:"",options:d,selected:u,onChange:m,iconOnly:!0,align:"right",title:"Change relationship type"})})]}),t.jsx("strong",{className:"truncate",style:{display:"block",color:f.primary,fontSize:13},children:((v=r.element)==null?void 0:v.name)??r.id}),t.jsx("div",{className:"font-mono truncate",style:{color:"#9CA3AF",fontSize:"10px",marginTop:2},title:r.id,children:((w=r.element)==null?void 0:w.shortId)??r.id}),t.jsx("div",{style:{color:f.muted,fontSize:10,marginTop:2},children:((g=r.element)==null?void 0:g.kind)??"Unknown element type"})]})})}function oc({element:e,outgoing:r,incoming:n,density:o}){const a=S(_=>_.model),s=S(_=>_.connected),i=S(_=>_.selectElement),l=S(_=>_.selectedDiagramId),c=S(_=>_.pendingRelationships),d=S(_=>_.createRelationship),u=S(_=>_.deleteRelationship),m=S(_=>_.dismissPendingRelationship),b=S(_=>_.addElementToDiagram),[v,w]=p.useState(!1),[g,h]=p.useState(null),[y,B]=p.useState(["Requirement","Risk","Function","SystemFunction","ComponentFunction"]),N=p.useMemo(()=>xo(a),[a]);p.useEffect(()=>{h(null),w(!1),B(["Requirement","Risk","Function","SystemFunction","ComponentFunction"])},[e.id]);const D=c.filter(_=>_.sourceId===e.id||_.targetId===e.id),A=r.length+n.length,F=p.useCallback(async _=>{var U;h(null);const j=await d({..._,selectedElementId:e.id,diagramId:l??void 0});if(!j.success){h({kind:"error",message:j.error??"The relationship could not be created."});return}const L=_.sourceId===e.id?_.targetId:_.sourceId,E=Qt(a,l),O=(U=j.diagnostics)==null?void 0:U.find($=>$.code==="REL-005"),V=!!E&&!!E.elementIds&&E.elementIds.length>0&&!E.elementIds.includes(L);h(V&&!O&&l?{kind:"success",message:`Relationship created in ${j.sourceFile??"the model"}.`,offerAddToView:{elementId:L,diagramId:l}}:O?{kind:"success",message:`Relationship created in ${j.sourceFile??"the model"}.`,profileMessage:O.message}:null)},[d,e.id,l,a]),C=p.useCallback(async _=>{const j=await u(_);j.success||h({kind:"error",message:j.error??"The relationship could not be deleted."})},[u]),k=p.useMemo(()=>{const _=new Map,j=(L,E)=>{const O=E==="outgoing"?L.targetId:L.sourceId,V=a==null?void 0:a.elements[O],U=(V==null?void 0:V.kind)||"Unknown Type",$=_.get(U)??new Map,K=$.get(O)??[];K.push({rel:L,direction:E}),$.set(O,K),_.set(U,$)};return a&&(r.forEach(L=>j(L,"outgoing")),n.forEach(L=>j(L,"incoming"))),_},[r,n,a]),T=Array.from(k.keys()).sort(),z=new Map([...k.entries()].filter(([_])=>y.includes(_)));return a?t.jsx(t.Fragment,{children:t.jsxs(ec,{title:"Relationships",count:A,density:o,collapsible:o==="panel",actions:t.jsxs("div",{className:"flex items-center gap-1",children:[A>0&&t.jsx("button",{onClick:()=>w(!0),style:{width:24,height:24,borderRadius:"4px",background:"transparent",color:"#6B7280",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center"},title:"View Details (Rich Grid)","aria-label":"View Details",onMouseEnter:_=>_.currentTarget.style.background="#F3F4F6",onMouseLeave:_=>_.currentTarget.style.background="transparent",children:t.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:t.jsx("path",{d:"M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7"})})}),A>0&&t.jsx(Zt,{label:"",options:T.map(_=>({value:_,label:_})),selected:y,onChange:B,allLabel:"None",iconOnly:!0,align:"right"})]}),children:[t.jsx("div",{style:{marginBottom:o==="page"?14:8,maxWidth:o==="page"?720:void 0},children:t.jsx(Gd,{element:e,model:a,registries:N,enabled:s,onCreate:F})}),v&&t.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",style:{padding:"2rem"},onClick:()=>w(!1),children:t.jsxs("div",{className:"bg-white rounded-xl shadow-2xl flex flex-col overflow-hidden w-full max-w-5xl max-h-full",onClick:_=>_.stopPropagation(),children:[t.jsxs("div",{className:"flex justify-between items-center px-5 py-4 border-b border-gray-200 bg-gray-50/50",children:[t.jsx("h2",{className:"text-lg font-bold text-gray-900",children:"Element Relationships"}),t.jsx("button",{onClick:()=>w(!1),className:"text-gray-400 hover:text-gray-700 font-bold px-2 py-1 bg-transparent border-none cursor-pointer",children:"✕"})]}),t.jsx("div",{className:"flex-1 overflow-auto p-6 bg-gray-50/30",children:t.jsx(nc,{element:e,model:a,registries:N,outgoing:r,incoming:n,density:o,onNavigate:_=>{w(!1),i(_)},onCreate:d,onDelete:C})})]})}),A===0&&D.length===0&&t.jsx("div",{style:{fontSize:Ve(o).meta,color:f.faint,padding:"2px 0 6px"},children:"No relationships yet — add the first one below."}),A>0&&z.size>0&&t.jsx("div",{className:"flex items-center justify-between",style:{marginBottom:12,marginTop:12,borderTop:"1px solid #E5E7EB",paddingTop:12},children:t.jsx("span",{style:{fontSize:"10px",fontWeight:700,color:"#9CA3AF",textTransform:"uppercase",letterSpacing:"0.04em"},children:"Existing Links"})}),t.jsx("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[...z.entries()].map(([_,j])=>t.jsxs("div",{children:[t.jsx("div",{style:{fontSize:"10px",color:f.muted,textTransform:"uppercase",fontWeight:700,letterSpacing:"0.04em",marginBottom:6},children:_}),t.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[...j.entries()].map(([L,E])=>t.jsx(sc,{sourceElement:e,oppositeId:L,links:E,model:a,registries:N,density:o,deletable:s,onNavigate:()=>i(L),onCreate:d,onDelete:C},L))})]},_))}),D.map(_=>t.jsx(ic,{pending:_,model:a,onDismiss:()=>m(_.pendingId)},_.pendingId)),g&&t.jsx(ac,{status:g,onAddToView:()=>{g.offerAddToView&&(b(g.offerAddToView.diagramId,g.offerAddToView.elementId),h({kind:"success",message:"Element added to this view."}))},onDismiss:()=>h(null),model:a})]})}):null}function ac({status:e,onAddToView:r,onDismiss:n,model:o}){var i;const a=e.kind==="success",s=e.offerAddToView?((i=o.elements[e.offerAddToView.elementId])==null?void 0:i.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:I.xs},children:["Relationship created. Add ",s," to this view?"]})]})}function sc({sourceElement:e,oppositeId:r,links:n,model:o,registries:a,deletable:s,density:i,onNavigate:l,onCreate:c,onDelete:d}){const u=o.elements[r],m=u&&ce[u.layer]||"#666",[b,v]=p.useState(!1),[w,g]=p.useState(!1),[h,y]=p.useState(null),B=Ve(i),N=n.filter(C=>s&&C.rel.named===!0),D=p.useMemo(()=>!e||!u?[]:Ye(e,u,a).map(C=>({value:`${C.definition.name}::${C.direction}`,label:`${C.definition.label} ${C.direction==="outgoing"?"to":"from"}`})),[e,u,a]),A=n.map(C=>`${C.rel.type}::${C.direction}`),F=p.useCallback(C=>{if(C.length===0||!c||!d)return;const k=new Set(C),T=new Set(A);for(const _ of n)k.has(`${_.rel.type}::${_.direction}`)||d(_.rel.id);const z=Ye(e,u,a);for(const _ of C)if(!T.has(_)){const j=z.find(L=>`${L.definition.name}::${L.direction}`===_);j&&c({type:j.definition.name,sourceId:j.sourceId,targetId:j.targetId,direction:j.direction})}},[A,n,e,u,a,c,d]);return t.jsxs("div",{onMouseEnter:()=>g(!0),onMouseLeave:()=>g(!1),style:{borderLeft:`3px solid ${m}`,borderRadius:6,background:f.surface,borderTop:`1px solid ${f.borderLight}`,borderRight:`1px solid ${f.borderLight}`,borderBottom:`1px solid ${f.borderLight}`,width:"100%"},children:[t.jsxs("div",{className:"flex items-center gap-2",style:{padding:i==="page"?"8px 10px":"6px 8px",fontSize:B.text},children:[t.jsxs("button",{onClick:l,className:"text-left flex items-center gap-1.5",style:{display:"flex",flex:1,minWidth:0,background:"none",border:"none",cursor:"pointer",padding:0},title:`Go to ${(u==null?void 0:u.name)??r}`,children:[t.jsx("strong",{className:"truncate font-mono",style:{color:f.primary,fontSize:"11px",fontWeight:600},children:(u==null?void 0:u.shortId)??r}),n.length>1&&t.jsx("span",{style:{fontSize:"10px",color:"#9CA3AF",background:"#F3F4F6",padding:"1px 4px",borderRadius:4,fontWeight:600},children:n.length})]}),D.length>1&&c&&t.jsx("div",{onClick:C=>C.stopPropagation(),style:{flexShrink:0},children:t.jsx(Zt,{label:"",options:D,selected:A,onChange:F,allLabel:"Relationships",iconOnly:!0,align:"right"})}),t.jsx("button",{onClick:()=>v(C=>!C),style:{background:"none",border:"none",cursor:"pointer",color:f.faint,padding:2},"aria-label":b?"Hide relationship details":"Show relationship details",children:b?"▾":"▸"}),N.length>0&&(w||b||h==="header")&&t.jsxs("div",{className:"relative flex items-center",children:[t.jsx("button",{onClick:C=>{C.stopPropagation(),y("header")},"aria-label":`Remove relationships to ${(u==null?void 0:u.name)??r}`,title:"Remove relationships",style:{width:20,height:20,padding:0,border:0,borderRadius:10,background:"#FFFFFFAA",color:"#9CA3AF",cursor:"pointer",lineHeight:1},children:"×"}),h==="header"&&t.jsxs("div",{className:"absolute right-full mr-2 top-1/2 -translate-y-1/2 z-20 bg-white rounded-lg shadow-xl border border-gray-200 p-2.5 w-48",onClick:C=>C.stopPropagation(),style:{boxShadow:"0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1)"},children:[t.jsxs("div",{style:{fontSize:"11px",fontWeight:600,color:"#374151",marginBottom:"8px"},children:["Remove ",N.length>1?`all ${N.length} relationships`:"relationship","?"]}),t.jsxs("div",{className:"flex gap-1.5 justify-end",children:[t.jsx("button",{onClick:()=>y(null),className:"px-2 py-1 rounded",style:{fontSize:"10px",background:"#F3F4F6",color:"#4B5563",border:"none",cursor:"pointer"},children:"Cancel"}),t.jsx("button",{onClick:()=>{y(null),N.forEach(C=>d(C.rel.id))},className:"px-2 py-1 rounded",style:{fontSize:"10px",background:"#EF4444",color:"#FFFFFF",border:"none",cursor:"pointer"},children:"Remove"})]})]})]})]}),b&&t.jsx("div",{className:"px-3 pb-2 space-y-2",style:{borderTop:`1px solid ${f.borderLight}`,paddingTop:7},children:n.map(({rel:C,direction:k},T)=>{const z=On(C.type,a),_=s&&C.named===!0;return t.jsxs("div",{style:{fontSize:"10px",color:"#6B7280",marginTop:T>0?8:0,paddingTop:T>0?8:0,borderTop:T>0?`1px dashed ${f.borderLight}`:"none"},children:[t.jsx(Rt,{label:"Kind",value:(z==null?void 0:z.label)??C.type,valueColor:m}),t.jsx(Rt,{label:"Roles",value:`${C.sourceEnd||(z==null?void 0:z.sourceEnd.name)||"source"} → ${C.targetEnd||(z==null?void 0:z.targetEnd.name)||"target"}`}),t.jsx(Rt,{label:"ID",value:C.id,mono:!0}),t.jsx(Rt,{label:"Source",value:C.file||"—",mono:!0}),!C.named&&t.jsx("div",{style:{color:"#D97706",marginTop:4},children:"Anonymous connection — name it in SysML to allow deletion from here."}),_&&t.jsxs("div",{className:"relative inline-block mt-2",children:[t.jsx("button",{onClick:j=>{j.stopPropagation(),y(C.id)},className:"px-1.5 py-0.5 rounded",style:{background:"#FEF2F2",color:"#DC2626",border:"1px solid #FECACA",cursor:"pointer",fontSize:"10px"},children:"Remove this relationship"}),h===C.id&&t.jsxs("div",{className:"absolute left-full ml-2 top-1/2 -translate-y-1/2 z-20 bg-white rounded-lg shadow-xl border border-gray-200 p-2.5 w-48",onClick:j=>j.stopPropagation(),children:[t.jsx("div",{style:{fontSize:"11px",fontWeight:600,color:"#374151",marginBottom:"8px"},children:"Remove relationship?"}),t.jsxs("div",{className:"flex gap-1.5 justify-end",children:[t.jsx("button",{onClick:()=>y(null),className:"px-2 py-1 rounded",style:{fontSize:"10px",background:"#F3F4F6",border:"none",cursor:"pointer"},children:"Cancel"}),t.jsx("button",{onClick:()=>{y(null),d(C.id)},className:"px-2 py-1 rounded",style:{fontSize:"10px",background:"#EF4444",color:"#FFFFFF",border:"none",cursor:"pointer"},children:"Remove"})]})]})]})]},C.id)})})]})}function Rt({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 ic({pending:e,model:r,onDismiss:n}){const o=e.direction==="outgoing"?e.targetId:e.sourceId,a=r.elements[o],s=e.status==="failed";return t.jsxs("div",{className:"flex items-center gap-1.5 ml-2 rounded",style:{padding:"4px 8px",fontSize:I.xs,background:s?"#FEF2F2":"#F9FAFB",color:s?"#DC2626":"#6B7280",fontStyle:s?"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:I.xs},children:e.label}),t.jsx("span",{className:"truncate flex-1",children:(a==null?void 0:a.name)??o}),s?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…"})]})}const lc=[{value:"",label:"Default"},{value:"#FEF3C7",label:"Amber"},{value:"#DCFCE7",label:"Green"},{value:"#DBEAFE",label:"Blue"},{value:"#FCE7F3",label:"Pink"},{value:"#FEE2E2",label:"Red"},{value:"#EDE9FE",label:"Violet"},{value:"#E5E7EB",label:"Grey"}],at={display:"flex",alignItems:"center",gap:8,marginBottom:8,fontSize:I.xs,color:f.secondary},st={width:62,flexShrink:0};function dc(){const e=S(c=>c.selectionStyle),[r,n]=p.useState(!0),[o,a]=p.useState("#FFFFFF");if(!e)return null;const{count:s,opacity:i,apply:l}=e;return t.jsxs("div",{style:{borderTop:`1px solid ${f.borderLight}`,padding:"10px 12px"},children:[t.jsxs("button",{onClick:()=>n(c=>!c),"aria-expanded":r,style:{display:"flex",alignItems:"center",gap:6,width:"100%",background:"none",border:"none",padding:0,cursor:"pointer",fontSize:"10px",fontWeight:700,letterSpacing:".07em",textTransform:"uppercase",color:f.muted},children:[t.jsx("span",{style:{fontSize:9},children:r?"▾":"▸"}),"Style",t.jsxs("span",{style:{marginLeft:"auto",fontWeight:600,textTransform:"none",letterSpacing:0},children:[s," selected"]})]}),r&&t.jsxs("div",{style:{marginTop:10},children:[t.jsxs("div",{style:at,children:[t.jsx("span",{style:st,children:"Fill"}),t.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:4,flex:1},children:[lc.map(c=>t.jsx("button",{title:`Fill: ${c.label}`,"aria-label":`Fill ${c.label}`,onClick:()=>l({color:c.value}),style:{width:20,height:20,padding:0,borderRadius:4,cursor:"pointer",border:`1px solid ${f.border}`,background:c.value||"#FFFFFF",color:"#94A3B8",fontSize:11,lineHeight:1,fontWeight:700},children:c.value?"":"⌫"},c.label)),t.jsx("input",{type:"color","aria-label":"Custom fill colour",title:"Custom fill colour",value:o,onChange:c=>{a(c.target.value),l({color:c.target.value})},style:{width:22,height:20,padding:1,border:`1px solid ${f.border}`,borderRadius:4,cursor:"pointer"}})]})]}),t.jsxs("div",{style:at,children:[t.jsx("span",{style:st,children:"Border"}),t.jsx("input",{type:"color","aria-label":"Border colour",onChange:c=>l({borderColor:c.target.value}),style:{width:26,height:22,padding:1,border:`1px solid ${f.border}`,borderRadius:4,cursor:"pointer"}}),t.jsx("button",{onClick:()=>l({borderColor:""}),style:{border:`1px solid ${f.border}`,background:f.surface,borderRadius:4,fontSize:11,padding:"2px 7px",cursor:"pointer",color:f.secondary},children:"Reset"})]}),t.jsxs("div",{style:at,children:[t.jsx("span",{style:st,children:"Text"}),t.jsx("input",{type:"color","aria-label":"Text colour",onChange:c=>l({textColor:c.target.value}),style:{width:26,height:22,padding:1,border:`1px solid ${f.border}`,borderRadius:4,cursor:"pointer"}}),t.jsxs("select",{"aria-label":"Text size",defaultValue:"",onChange:c=>c.target.value&&l({fontSize:Number(c.target.value)}),style:{height:22,border:`1px solid ${f.border}`,borderRadius:4,color:f.secondary,fontSize:11},children:[t.jsx("option",{value:"",children:"Auto"}),[10,12,14,16,18,20].map(c=>t.jsxs("option",{value:c,children:[c,"px"]},c))]}),t.jsx("button",{title:"Bold text",onClick:()=>l({fontWeight:700}),style:{border:`1px solid ${f.border}`,background:f.surface,borderRadius:4,fontSize:11,fontWeight:700,padding:"2px 8px",cursor:"pointer",color:f.secondary},children:"B"})]}),t.jsxs("div",{style:at,children:[t.jsx("span",{style:st,children:"Align"}),[["left","≡","Align text left"],["center","≣","Align text centre"],["right","☷","Align text right"]].map(([c,d,u])=>t.jsx("button",{title:u,"aria-label":u,onClick:()=>l({textAlign:c}),style:{width:24,height:22,border:`1px solid ${f.border}`,background:f.surface,borderRadius:4,fontSize:12,cursor:"pointer",color:f.secondary},children:d},c)),[["top","⤒","Align text at top"],["middle","↕","Align text vertically centred"],["bottom","⤓","Align text at bottom"]].map(([c,d,u])=>t.jsx("button",{title:u,"aria-label":u,onClick:()=>l({verticalAlign:c}),style:{width:24,height:22,border:`1px solid ${f.border}`,background:f.surface,borderRadius:4,fontSize:12,cursor:"pointer",color:f.secondary},children:d},c))]}),t.jsxs("label",{style:at,children:[t.jsx("span",{style:st,children:"Opacity"}),t.jsx("input",{type:"range",min:.2,max:1,step:.05,value:i,"aria-label":"Fill opacity",onChange:c=>l({opacity:Number(c.target.value)}),style:{flex:1}}),t.jsxs("span",{style:{width:30,textAlign:"right",color:f.faint},children:[Math.round(i*100),"%"]})]})]})]})}const ze="panel";function pe({title:e,count:r,defaultOpen:n=!0,actions:o,children:a}){const[s,i]=p.useState(n);return t.jsxs("div",{className:"mb-3 mx-3 bg-white border border-gray-200/60 rounded-xl shadow-sm overflow-hidden",children:[t.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 cursor-pointer transition-colors hover:bg-gray-50",onClick:()=>i(l=>!l),children:[t.jsx("span",{className:"font-bold flex-1 text-[10px] uppercase tracking-wider",style:{color:"#6B7280"},children:e}),o&&t.jsx("span",{onClick:l=>l.stopPropagation(),children:o}),typeof r=="number"&&t.jsx("span",{className:"px-1.5 py-0.5 rounded-md font-medium text-[10px]",style:{background:"#F3F4F6",color:"#6B7280"},children:r}),t.jsx("span",{style:{color:"#D1D5DB",fontSize:14},children:s?"▾":"▸"})]}),s&&t.jsx("div",{className:"px-3 pb-3 pt-1",children:a})]})}function cc({label:e,kind:r,kindColor:n,onClick:o,arrow:a,typeBadge:s,typeColor:i,selected:l}){return t.jsxs("div",{className:"flex items-center gap-1.5 cursor-pointer transition-colors ml-2",style:{borderRadius:"6px",padding:"4px 8px",background:l?"#2DD4A818":"transparent",color:l?"#1B3A4B":"#374151",fontWeight:l?500:400,fontSize:I.xs},onMouseEnter:c=>{l||(c.currentTarget.style.background="#F0F0ED")},onMouseLeave:c=>{l||(c.currentTarget.style.background="transparent")},onClick:o,children:[a&&t.jsx("span",{style:{color:"#9CA3AF"},children:a}),s&&t.jsx("span",{className:"px-1 py-0.5 rounded",style:{background:(i||"#2563EB")+"18",color:i||"#2563EB",fontSize:I.xs},children:s}),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:I.badge},children:r})]})}function uc(){const e=S(s=>s.model),r=S(s=>s.activeView),n=r.type==="diagram"?r.diagramId:null,o=Qt(e,n);if(!o)return null;const a=$e[o.diagramType];return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"p-5 mb-2",style:{background:"#FFFFFF",borderBottom:"1px solid #F3F4F6",borderLeft:`4px solid ${(a==null?void 0:a.color)||"#6B7280"}`,boxShadow:"0 1px 2px rgba(0,0,0,0.02)"},children:[t.jsx("div",{className:"text-sm font-bold truncate",style:{color:"#111827"},children:o.name}),t.jsxs("div",{className:"flex items-center gap-2 text-xs mt-2",children:[a&&t.jsx("span",{className:"px-2 py-0.5 rounded-md font-semibold",style:{background:a.color+"18",color:a.color},children:a.code}),t.jsx("span",{style:{color:"#6B7280",fontWeight:500},children:(a==null?void 0:a.fullName)||o.diagramType})]}),o.auto&&t.jsx("div",{className:"text-xs mt-2 font-medium",style:{color:"#9CA3AF"},children:"Auto-generated"})]}),t.jsxs("div",{className:"flex-1 overflow-y-auto pt-2 pb-4 bg-gray-50/50",children:[o.description&&t.jsx(pe,{title:"Description",defaultOpen:!0,children:t.jsx("div",{className:"text-xs leading-relaxed",style:{color:"#374151"},children:o.description})}),t.jsx(pe,{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:I.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:I.xs},children:o.sourceFile})]})]})}),o.properties&&Object.keys(o.properties).length>0&&t.jsx(pe,{title:"Properties",count:Object.keys(o.properties).length,children:t.jsx("div",{className:"space-y-1.5",children:Object.entries(o.properties).map(([s,i])=>t.jsxs("div",{className:"flex text-xs",children:[t.jsx("span",{className:"min-w-[80px]",style:{color:"#6B7280"},children:s}),t.jsx("span",{className:"truncate",style:{color:"#1a1a1a"},children:i})]},s))})}),o.elementIds&&o.elementIds.length>0&&t.jsx(pe,{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(pe,{title:"Relationship Types",count:o.relationshipTypes.length,children:t.jsx("div",{className:"flex flex-wrap gap-1",children:o.relationshipTypes.map(s=>t.jsx("span",{className:"px-1.5 py-0.5 rounded text-xs",style:{background:"#EFF6FF",color:"#2563EB",fontSize:I.xs},children:s},s))})})]})]})}const pc=4e3;function mc({elementId:e}){const r=S(i=>i.model),n=S(i=>i.lastSourceChange),[o,a]=p.useState(null),s=p.useMemo(()=>fi(r,e),[r,e]);return p.useEffect(()=>{if(!hi(n,s))return;a(n.at);const i=setTimeout(()=>a(null),pc);return()=>clearTimeout(i)},[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:I.badge,background:"#ECFDF5",color:"#047857",border:"1px solid #A7F3D0"},children:"↻ Updated"}):null}function fc(){var A,F;const e=S(C=>C.model),r=S(C=>C.selectedElementId),n=S(C=>C.validation),o=S(C=>C.selectElement),a=S(C=>C.updateElementField),s=S(C=>C.updateElementAttribute),i=S(C=>C.applyEdit),l=S(C=>C.deleteModelElement),[c,d]=p.useState(!1);p.useEffect(()=>{d(!1)},[r]),p.useEffect(()=>{if(!r)return;const C=k=>{(k.metaKey||k.ctrlKey)&&k.key==="s"&&(k.preventDefault(),i(r),d(!1))};return window.addEventListener("keydown",C),()=>window.removeEventListener("keydown",C)},[r,i]);const u=p.useMemo(()=>r&&e?mi(e,r):[],[e,r]);if(!r||!e)return null;const m=e.elements[r];if(!m)return null;const b=u.filter(C=>C.sourceId===r),v=u.filter(C=>C.targetId===r),w=ce[m.layer]||"#666",g=(n==null?void 0:n.violations.filter(C=>C.elementId===r))||[],h=new Set(["boundaryColor","boundaryOpacity","boundaryWidth","fill","stroke","opacity","color","backgroundColor","bounds.x","bounds.y","bounds.width","bounds.height"]),y=[["id",m.id],...m.uuid?[["uuid",m.uuid]]:[],["kind",m.kind],["layer",m.layer],...Object.entries(m.attributes).filter(([C])=>C!=="name"&&C!=="id"&&!h.has(C)&&C!=="description"&&C!=="shortDescription")],B=Object.entries(m.attributes).filter(([C])=>h.has(C)),N=(C,k)=>{s(r,C,k),i(r)},D=C=>{const k=C.trim();!k||k===m.name||(a(r,"name",k),i(r))};return t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"p-5 mb-2 relative group",style:{background:"#FFFFFF",borderBottom:"1px solid #F3F4F6",borderLeft:`4px solid ${w}`,boxShadow:"0 1px 2px rgba(0,0,0,0.02)"},children:t.jsxs("div",{className:"flex justify-between items-start mb-2",children:[t.jsx("div",{className:"flex items-start gap-3 pr-4 min-w-0 flex-1",children:t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"text-[15px] font-bold leading-tight",style:{color:"#111827"},children:t.jsx(ot,{value:m.name,onSave:D,density:ze,placeholder:"Element name"})}),t.jsx("div",{className:"text-sm font-medium mt-3 text-gray-700",children:t.jsx(ot,{value:m.attributes.shortDescription||"",onSave:C=>N("shortDescription",C),density:ze,multiline:!0,placeholder:"Add a short description..."})}),t.jsx("div",{className:"text-xs text-gray-500 mt-1.5 leading-relaxed",children:t.jsx(ot,{value:m.attributes.description||"",onSave:C=>N("description",C),density:ze,multiline:!0,placeholder:"Add a detailed description..."})})]})}),t.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",children:[t.jsx("button",{onClick:()=>void navigator.clipboard.writeText(m.id),title:`Copy ID: ${m.id}`,className:"p-1 hover:bg-gray-100 rounded text-gray-400 hover:text-gray-700",children:t.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),t.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})}),t.jsx("button",{onClick:()=>void l(m.id),title:"Delete element",className:"p-1 hover:bg-red-50 rounded text-gray-400 hover:text-red-600",children:t.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("polyline",{points:"3 6 5 6 21 6"}),t.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}),t.jsx("line",{x1:"10",y1:"11",x2:"10",y2:"17"}),t.jsx("line",{x1:"14",y1:"11",x2:"14",y2:"17"})]})})]})]})}),t.jsxs("div",{className:"flex-1 overflow-y-auto pt-2 pb-6 bg-gray-50/50",children:[m.parameters&&m.parameters.length>0&&t.jsx(pe,{title:"Parameters",count:m.parameters.length,children:t.jsx("div",{className:"space-y-1.5",children:m.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))})}),m.allocatedTo&&t.jsx(pe,{title:"Allocated To",defaultOpen:!0,children:t.jsx(cc,{label:((A=e.elements[m.allocatedTo])==null?void 0:A.name)||m.allocatedTo,kind:(F=e.elements[m.allocatedTo])==null?void 0:F.kind,kindColor:"#E67E22",arrow:"→",onClick:()=>o(m.allocatedTo)})}),B.length>0&&t.jsx(pe,{title:"Appearance",count:B.length,defaultOpen:!1,children:t.jsx("div",{className:"space-y-1.5",children:B.map(([C,k])=>{const T=Rr(C);return t.jsxs("div",{className:"flex text-xs items-start gap-1.5",children:[t.jsx("span",{className:"min-w-[100px] pt-0.5",style:{color:"#6B7280"},children:C}),t.jsx("div",{style:{flex:1,minWidth:0},children:C==="boundaryColor"?t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("input",{"aria-label":"Boundary color",type:"color",value:/^#[0-9a-f]{6}$/i.test(String(k))?String(k):"#14B8A6",onChange:z=>{const _=document.getElementById(`screen-node-${m.id}`);_&&(_.style.borderColor=z.target.value)},onBlur:z=>N(C,z.target.value),style:{width:28,height:24,padding:0,border:"1px solid #D8D8D2",borderRadius:4,background:"#FFFFFF"}}),t.jsx("span",{className:"font-mono text-[10px] text-gray-500",children:String(k)})]}):C==="boundaryWidth"?t.jsxs("div",{className:"flex items-center gap-3 pr-2",children:[t.jsx("input",{"aria-label":"Boundary width",type:"range",min:"1",max:"10",step:"1",defaultValue:Number(k??"2"),onChange:z=>{const _=document.getElementById(`screen-node-${m.id}`);_&&(_.style.borderWidth=z.target.value+"px")},onMouseUp:z=>N(C,z.target.value),style:{width:"100%"}}),t.jsxs("span",{className:"font-mono text-[10px] text-gray-500 w-6",children:[k,"px"]})]}):An(T)?t.jsx(ot,{value:String(k??""),onSave:z=>N(C,z),density:ze,placeholder:"Click to set…"}):t.jsx(Ir,{value:String(k??""),editability:T,density:ze,mono:C!=="kind"&&C!=="layer"})})]},C)})})}),y.length>0&&t.jsx(pe,{title:"Attributes",count:y.length,defaultOpen:!1,children:t.jsx("div",{className:"space-y-1.5",children:y.map(([C,k])=>{const T=Rr(C);return t.jsxs("div",{className:"flex text-xs items-start gap-1.5",children:[t.jsx("span",{className:"min-w-[100px] pt-0.5",style:{color:"#6B7280"},children:C}),t.jsx("div",{style:{flex:1,minWidth:0},children:An(T)?t.jsx(ot,{value:String(k??""),onSave:z=>N(C,z),density:ze,multiline:C==="description"||C==="rationale",placeholder:"Click to set…"}):t.jsx(Ir,{value:String(k??""),editability:T,density:ze,mono:C!=="kind"&&C!=="layer"})})]},C)})})}),t.jsx(hc,{subject:m}),g.length>0&&t.jsx(pe,{title:"Guidance",count:g.length,defaultOpen:!0,children:t.jsx("div",{className:"space-y-2",children:g.map((C,k)=>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}-${k}`))})}),g.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"]})}),m.file&&t.jsx(pe,{title:"Source",defaultOpen:!1,actions:t.jsx(mc,{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(m.file).catch(()=>{})},title:"Click to copy path",children:[t.jsx("span",{style:{flexShrink:0},children:"⟨/⟩"}),t.jsx("span",{className:"font-mono truncate",children:m.file}),t.jsx("span",{style:{flexShrink:0,color:"#9CA3AF",fontSize:"9px"},children:"copy"})]})}),t.jsx(oc,{element:m,outgoing:b,incoming:v,density:ze})]})]})}const It={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 hc({subject:e}){var _,j,L;const r=S(E=>E.model),n=S(E=>E.createModelElement),o=S(E=>E.createRelationship),a=S(E=>E.persistElementAttributes),[s,i]=p.useState(""),[l,c]=p.useState(""),[d,u]=p.useState(""),[m,b]=p.useState(null),[v,w]=p.useState(!1),[g,h]=p.useState(""),[y,B]=p.useState(null),[N,D]=p.useState("");if(!r)return null;const A=new Set(Object.values(It).map(E=>E.relation.toLowerCase())),C=[...new Set(r.relationships.filter(E=>A.has(E.type.toLowerCase())&&E.targetId===e.id).map(E=>E.sourceId))].map(E=>r.elements[E]).filter(E=>!!E),k=new Map;for(const E of r.relationships.filter(O=>O.type.toLowerCase()==="composes"))((_=r.elements[E.sourceId])==null?void 0:_.kind)!=="ModelComment"||((j=r.elements[E.targetId])==null?void 0:j.kind)!=="ModelComment"||k.set(E.sourceId,[...k.get(E.sourceId)??[],r.elements[E.targetId]]);const T=async()=>{var $,K,J;if(!l.trim())return;const E=y?"comment":m??"comment";D("Saving…");const O=It[E],V=s.trim()||`Model ${O.label}`,U=n({name:V,kind:O.kind,construct:"part",layer:e.layer,file:e.file||"model/generated.sysml",doc:"",attributes:{shortDescription:V,body:l.trim(),author:d.trim()||"currentReviewer",createdAt:new Date().toISOString(),...E==="comment"?{commentStatus:"CommentStatusKind::open"}:{},...E==="rationale"&&g.trim()?{basis:g.trim()}:{},...E==="note"&&g.trim()?{noteKind:g.trim()}:{}}});try{const Y=($=S.getState().model)==null?void 0:$.elements[U],Q=Date.now()+1e4;for(;((K=S.getState().model)==null?void 0:K.elements[U])===Y&&Date.now()<Q;)await new Promise(x=>setTimeout(x,100));const ee=(J=S.getState().model)==null?void 0:J.elements[U];if(!ee||ee===Y)throw new Error("The saved annotation did not appear in the rebuilt model.");const M=await o({type:y?"Composes":O.relation,sourceId:y??U,targetId:y?U:e.id,direction:"outgoing",selectedElementId:y??U});if(!M.success)throw new Error(M.error);i(""),c(""),h(""),B(null),b(null),D("Saved.")}catch(Y){D(Y instanceof Error?Y.message:String(Y))}},z=(E,O=!1)=>{var $;const V=E.kind==="ModelRationale"?"rationale":E.kind==="ModelNote"?"note":"comment",U=V==="rationale"?"#7C3AED":V==="note"?"#2563EB":"#2DD4A8";return t.jsxs("div",{style:{marginLeft:O?14:0,borderLeft:`2px solid ${O?"#D1D5DB":U}`,padding:"5px 7px",marginBottom:6},children:[t.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[t.jsx("span",{style:{color:U,fontSize:9,fontWeight:700,textTransform:"uppercase"},children:V}),t.jsx("strong",{style:{color:"#374151"},children:E.attributes.author||"Unknown"}),t.jsx("span",{style:{color:"#9CA3AF"},children:E.attributes.createdAt||""})]}),t.jsx("div",{style:{fontSize:11,fontWeight:600,color:"#374151"},children:E.attributes.shortDescription||E.name}),t.jsx("div",{style:{fontSize:11,color:"#4B5563",whiteSpace:"pre-wrap"},children:E.attributes.body}),V==="rationale"&&E.attributes.basis&&t.jsxs("div",{style:{fontSize:10,color:"#7C3AED"},children:["Basis: ",E.attributes.basis]}),V==="note"&&E.attributes.noteKind&&t.jsxs("div",{style:{fontSize:10,color:"#2563EB"},children:["Kind: ",E.attributes.noteKind]}),V==="comment"&&t.jsxs("div",{className:"flex gap-2",style:{marginTop:3},children:[!O&&t.jsx("button",{onClick:()=>{B(E.id),b("comment")},style:{border:0,background:"transparent",color:"#2563EB",fontSize:10,cursor:"pointer"},children:"Reply"}),!(($=E.attributes.commentStatus)!=null&&$.endsWith("resolved"))&&t.jsx("button",{onClick:()=>a(E.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"})]}),(k.get(E.id)??[]).map(K=>z(K,!0))]},E.id)};return t.jsxs(pe,{title:"Annotations",count:C.length,defaultOpen:!0,children:[t.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[t.jsx("button",{onClick:()=>b("note"),title:"Add Note",className:`p-1.5 rounded flex items-center justify-center transition-colors ${m==="note"?"bg-blue-100 text-blue-700":"bg-gray-100 hover:bg-gray-200 text-gray-600"}`,children:t.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),t.jsx("polyline",{points:"14 2 14 8 20 8"}),t.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),t.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),t.jsx("polyline",{points:"10 9 9 9 8 9"})]})}),t.jsx("button",{onClick:()=>b("comment"),title:"Add Comment",className:`p-1.5 rounded flex items-center justify-center transition-colors ${m==="comment"?"bg-teal-100 text-teal-700":"bg-gray-100 hover:bg-gray-200 text-gray-600"}`,children:t.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})})}),t.jsx("button",{onClick:()=>b("rationale"),title:"Add Rationale",className:`p-1.5 rounded flex items-center justify-center transition-colors ${m==="rationale"?"bg-purple-100 text-purple-700":"bg-gray-100 hover:bg-gray-200 text-gray-600"}`,children:t.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t.jsx("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"})})}),t.jsx("div",{className:"flex-1"}),t.jsxs("button",{onClick:()=>w(!0),title:"View Annotations",className:"p-1.5 rounded bg-gray-100 hover:bg-gray-200 text-gray-600 flex items-center gap-1.5 text-xs font-semibold",children:[t.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),t.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),"View (",C.length,")"]})]}),(m||y)&&t.jsxs("div",{className:"bg-gray-50 border border-gray-200 rounded p-2 mb-2",children:[t.jsxs("div",{className:"flex justify-between items-center mb-2",children:[t.jsx("span",{className:"text-xs font-semibold",style:{color:y?"#0F766E":m==="rationale"?"#7C3AED":m==="note"?"#2563EB":"#2DD4A8"},children:y?`Replying to ${(L=r.elements[y])==null?void 0:L.name}`:`New ${It[m].label}`}),t.jsx("button",{onClick:()=>{b(null),B(null)},className:"text-gray-400 hover:text-gray-600",children:"✕"})]}),t.jsx("input",{value:d,onChange:E=>u(E.target.value),placeholder:"Author",style:{width:"100%",marginBottom:4,fontSize:11}}),t.jsx("input",{value:s,onChange:E=>i(E.target.value),placeholder:"Short summary",style:{width:"100%",marginBottom:4,fontSize:11}}),!y&&m!=="comment"&&t.jsx("input",{value:g,onChange:E=>h(E.target.value),placeholder:m==="rationale"?"Basis / evidence (optional)":"Note kind (optional)",style:{width:"100%",marginBottom:4,fontSize:11}}),t.jsx("textarea",{value:l,onChange:E=>c(E.target.value),placeholder:y?"Reply":It[m].placeholder,rows:3,style:{width:"100%",fontSize:11}}),t.jsxs("div",{className:"flex gap-2 mt-1",children:[t.jsx("button",{onClick:T,disabled:!l.trim(),style:{fontSize:11,padding:"4px 8px",background:"#374151",color:"white",borderRadius:4,flex:1},children:"Save"}),t.jsx("button",{onClick:()=>{b(null),B(null)},style:{fontSize:11,padding:"4px 8px",background:"#E5E7EB",color:"#374151",borderRadius:4},children:"Cancel"})]}),N&&t.jsx("div",{style:{fontSize:10,color:"#6B7280",marginTop:4},children:N})]}),v&&t.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30",onClick:()=>w(!1),children:t.jsxs("div",{className:"bg-white rounded-lg shadow-2xl w-[400px] max-h-[85vh] flex flex-col",onClick:E=>E.stopPropagation(),children:[t.jsxs("div",{className:"p-3 border-b font-bold flex justify-between items-center text-gray-800",children:["Annotations",t.jsx("button",{onClick:()=>w(!1),className:"text-gray-400 hover:text-gray-700",children:"✕"})]}),t.jsx("div",{className:"p-4 overflow-y-auto",children:C.length>0?C.map(E=>z(E)):t.jsx("div",{className:"text-gray-500 text-sm text-center py-8",children:"No annotations yet."})})]})})]})}function yc(){const e=S(d=>d.model),r=S(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],s=n.type==="flow",i=n.flowItem,l=i&&/energy|power|voltage|current/i.test(i)?"Energy":i&&/material|fluid|gas|batch/i.test(i)?"Material":s?"Data":"Control",c=l==="Energy"?"#D97706":l==="Material"?"#16A34A":l==="Data"?"#3498DB":"#4B5563";return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"p-5 mb-2",style:{background:"#FFFFFF",borderBottom:"1px solid #F3F4F6",borderLeft:`4px solid ${c}`,boxShadow:"0 1px 2px rgba(0,0,0,0.02)"},children:[t.jsx("div",{className:"text-[15px] font-bold",style:{color:"#111827"},children:"Connection"}),t.jsxs("div",{className:"mt-2 text-xs font-medium",style:{color:"#4B5563"},children:[(o==null?void 0:o.name)??n.sourceId," → ",(a==null?void 0:a.name)??n.targetId]}),t.jsxs("div",{className:"mt-3 flex gap-2",children:[t.jsxs("span",{className:"px-2 py-1 rounded-md text-[11px] font-bold uppercase tracking-wider",style:{background:c+"15",color:c},children:[l," flow"]}),t.jsx("span",{className:"px-2 py-1 rounded-md text-[11px] font-bold uppercase tracking-wider",style:{background:"#F3F4F6",color:"#4B5563"},children:n.type})]})]}),t.jsxs("div",{className:"flex-1 overflow-y-auto pt-2 pb-4 bg-gray-50/50",children:[t.jsx(pe,{title:"Involved item",defaultOpen:!0,children:t.jsx("div",{className:"text-xs",style:{color:"#374151"},children:i??"No transported item is modeled for this connection."})}),t.jsx(pe,{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(pe,{title:"Traceability",defaultOpen:!1,children:t.jsx("div",{className:"text-xs",style:{color:"#6B7280"},children:n.file||"Model relationship"})})]})]})}function gc(){const e=S(l=>l.selectedElementId),r=S(l=>l.activeView),n=S(l=>l.selectedRelationshipId),o=S(l=>l.propertiesPanelCollapsed),a=S(l=>l.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 s=r.type==="diagram"&&!e&&!n,i=!!e;return t.jsxs("div",{className:"flex flex-col overflow-hidden flex-shrink-0 bg-gray-50/30",style:{width:"320px",borderLeft:"1px solid #E5E7EB",boxShadow:"-4px 0 16px rgba(0,0,0,0.02)"},children:[t.jsxs("div",{className:"flex items-center justify-between px-4 py-3 bg-white border-b border-gray-200 flex-shrink-0 z-10 shadow-sm",children:[t.jsx("span",{className:"text-[11px] uppercase tracking-wider font-bold text-gray-800",children:"Properties"}),t.jsx("button",{onClick:a,className:"flex items-center justify-center transition-colors",style:{color:"#9CA3AF",fontSize:"18px",lineHeight:1,width:"28px",height:"28px",borderRadius:"6px",background:"#FFFFFF",border:"1px solid #E5E7EB"},onMouseEnter:l=>{l.currentTarget.style.color="#374151",l.currentTarget.style.borderColor="#D1D5DB"},onMouseLeave:l=>{l.currentTarget.style.color="#9CA3AF",l.currentTarget.style.borderColor="#E5E7EB"},title:"Collapse properties","aria-label":"Collapse properties",children:"›"})]}),n?t.jsx(yc,{}):i?t.jsx(fc,{}):s?t.jsx(uc,{}):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"})}),t.jsx(dc,{})]})}function yn(e=f.border){return{borderTop:`1px solid ${e}`}}function xc({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:f.primary,fontSize:I.xs,minWidth:0}})}function bc({values:e}){const r=[...new Set(e.filter(Boolean))];return r.length===0?t.jsx("span",{style:{color:f.faint,fontSize:"12px"},children:"—"}):r.length===1?t.jsx("span",{style:{color:f.muted,fontSize:"12px"},children:r[0]}):t.jsxs("span",{style:{color:"#F59E0B",fontSize:"12px"},children:[r.length," different values"]})}function vc(){const e=S(g=>g.model),r=S(g=>g.selectedElementIds),n=S(g=>g.clearElementSelection),o=S(g=>g.bulkUpdateAttributes),a=p.useMemo(()=>[...r],[r]),s=p.useMemo(()=>a.map(g=>e==null?void 0:e.elements[g]).filter(Boolean),[a,e]),i=p.useMemo(()=>{if(s.length===0)return[];const g="_",h=s.map(B=>new Set(Object.keys(B.attributes).filter(N=>!N.startsWith(g))));return[...h[0]].filter(B=>h.every(N=>N.has(B))).sort()},[s]),l=p.useMemo(()=>{const g={};for(const h of i)g[h]=s.map(y=>y.attributes[h]??"");return g},[s,i]),c=p.useMemo(()=>[...new Set(s.map(g=>g.kind))].sort(),[s]),[d,u]=p.useState({}),m=p.useCallback((g,h)=>{u(y=>({...y,[g]:h}))},[]),b=Object.values(d).some(g=>g!==""),v=p.useCallback(()=>{const g=Object.fromEntries(Object.entries(d).filter(([,h])=>h!==""));Object.keys(g).length!==0&&(o(a,g),u({}))},[d,a,o]),w=p.useCallback(()=>{u({})},[]);return s.length<2?null:t.jsxs("div",{className:"flex flex-col overflow-hidden",style:{width:"280px",background:f.surface,borderLeft:`1px solid ${f.border}`,fontSize:I.xs},children:[t.jsxs("div",{className:"flex items-center justify-between px-4 py-3 flex-shrink-0",style:{borderBottom:`1px solid ${f.border}`},children:[t.jsxs("div",{children:[t.jsx("div",{className:"font-semibold",style:{color:f.primary,fontSize:I.sm},children:"Bulk Edit"}),t.jsxs("div",{style:{color:f.muted,fontSize:"12px",marginTop:"2px"},children:[a.length," elements selected"]})]}),t.jsx("button",{onClick:n,className:"px-2 py-1 rounded",style:{color:f.muted,background:"#F0F0ED",fontSize:"12px"},title:"Clear selection",children:"✕ Clear"})]}),t.jsxs("div",{className:"px-4 py-3 flex-shrink-0",style:yn(),children:[t.jsx("div",{style:{color:f.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(g=>t.jsx("span",{className:"px-2 py-0.5 rounded-full",style:{background:"#EEF2FF",color:"#4F46E5",fontSize:"12px",fontWeight:500},children:g},g))}),t.jsxs("div",{style:{color:f.faint,fontSize:"12px",marginTop:"6px"},children:[s.map(g=>g.name).slice(0,5).join(", "),s.length>5&&` +${s.length-5} more`]})]}),t.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-3",style:yn(),children:[t.jsxs("div",{style:{color:f.muted,fontSize:"12px",fontWeight:600,marginBottom:"8px",textTransform:"uppercase",letterSpacing:"0.5px"},children:["Common Attributes",i.length>0&&t.jsxs("span",{style:{color:f.faint,fontWeight:400,marginLeft:"4px"},children:["(",i.length,")"]})]}),i.length===0?t.jsx("div",{style:{color:f.faint,fontSize:"12px"},children:"No common attributes across selected elements."}):t.jsx("div",{className:"space-y-3",children:i.map(g=>t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between mb-1",children:[t.jsx("span",{style:{color:f.secondary,fontSize:"12px",fontWeight:500},children:g}),t.jsx(bc,{values:l[g]})]}),t.jsx(xc,{placeholder:`Set for all ${a.length} elements…`,value:d[g]??"",onChange:h=>m(g,h)})]},g))})]}),i.length>0&&t.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 flex-shrink-0",style:yn(),children:[t.jsx("button",{onClick:w,disabled:!b,className:"flex-1 py-1.5 rounded",style:{fontSize:I.xs,fontWeight:500,color:b?f.secondary:f.faint,background:b?"#F0F0ED":"#F7F7F5",cursor:b?"pointer":"default"},children:"Reset"}),t.jsxs("button",{onClick:v,disabled:!b,className:"flex-1 py-1.5 rounded font-semibold",style:{fontSize:I.xs,color:"#FFFFFF",background:b?"#2DD4A8":"#A7F3D0",cursor:b?"pointer":"default"},children:["Apply to ",a.length]})]})]})}const Mr="memo-gapbar-pulse";if(typeof document<"u"&&!document.getElementById(Mr)){const e=document.createElement("style");e.id=Mr,e.textContent=`
|
|
4056
4056
|
@keyframes memo-pulse-red {
|
|
4057
4057
|
0%, 100% { opacity: 1; }
|
|
4058
4058
|
50% { opacity: 0.35; }
|
|
4059
4059
|
}
|
|
4060
|
-
`,document.head.appendChild(e)}const It={error:{color:"#DC2626",bg:"#FEF2F2",icon:"✖"},warning:{color:"#D97706",bg:"#FFFBEB",icon:"⚠"},info:{color:"#2563EB",bg:"#EFF6FF",icon:"ℹ"}};function uc(){const e=E(k=>k.validation),r=E(k=>k.analysisIssues),n=E(k=>k.selectElement),o=E(k=>k.model),a=E(k=>k.completeness),s=E(k=>k.gapBarExpanded),i=E(k=>k.toggleGapBar),l=E(k=>k.gapBarHeight),c=E(k=>k.setGapBarHeight),[d,u]=p.useState("problems"),m=p.useRef(!1),b=p.useRef(0),w=p.useRef(0),S=o?Object.keys(o.elements).length:0,g=(e==null?void 0:e.violations.filter(k=>k.severity==="error"))??[],h=(e==null?void 0:e.violations.filter(k=>k.severity==="warning"))??[],y=(e==null?void 0:e.violations.length)??0,B=r.filter(k=>k.severity==="warning").length,O=y>0||r.length>0,D=!!a,R=O&&D,A=(a==null?void 0:a.layers.filter(k=>k.totalElements>0))??[],v=p.useCallback(k=>{k.preventDefault(),m.current=!0,b.current=k.clientY,w.current=l;const j=N=>{if(!m.current)return;const M=b.current-N.clientY;c(w.current+M)},P=()=>{m.current=!1,document.removeEventListener("mousemove",j),document.removeEventListener("mouseup",P)};document.addEventListener("mousemove",j),document.addEventListener("mouseup",P)},[l,c]);return t.jsxs("div",{style:{background:f.surface,borderTop:`1px solid ${f.border}`,flexShrink:0},children:[s&&t.jsx("div",{style:{height:"4px",cursor:"row-resize",background:"transparent",flexShrink:0},onMouseDown:v,onMouseEnter:k=>{k.currentTarget.style.background=f.accent+"40"},onMouseLeave:k=>{k.currentTarget.style.background="transparent"}}),t.jsxs("div",{className:"flex items-center px-4 gap-3 cursor-pointer select-none",style:{height:"32px",fontSize:T.sm},onClick:i,children:[t.jsx("span",{style:{color:f.faint,fontSize:"10px",transition:"transform 150ms ease",transform:s?"rotate(0deg)":"rotate(-90deg)",display:"inline-block"},children:"▼"}),t.jsx("span",{style:{color:f.secondary,fontWeight:600,fontSize:T.xs},children:"Problems"}),g.length>0&&t.jsxs("span",{className:"flex items-center gap-1",style:{color:"#DC2626",fontSize:T.xs},children:[t.jsx("span",{style:{fontSize:"10px"},children:"✖"})," ",g.length]}),h.length>0&&t.jsxs("span",{className:"flex items-center gap-1",style:{color:"#D97706",fontSize:T.xs},children:[t.jsx("span",{style:{fontSize:"10px"},children:"⚠"})," ",h.length]}),B>0&&t.jsxs("span",{className:"flex items-center gap-1",style:{color:"#D97706",fontSize:T.xs},children:[t.jsx("span",{style:{fontSize:"9px",opacity:.7},children:"DSM"}),t.jsx("span",{style:{fontSize:"10px"},children:"⚠"})," ",B]}),!O&&e&&t.jsx("span",{style:{color:"#10B981",fontSize:T.xs},children:"✓ No problems"}),!e&&t.jsx("span",{style:{color:f.faint,fontSize:T.xs},children:"Waiting for validation…"}),D&&t.jsxs(t.Fragment,{children:[t.jsx("div",{style:{width:"1px",height:"14px",background:f.border,flexShrink:0}}),t.jsx("span",{style:{color:f.secondary,fontWeight:600,fontSize:T.xs},children:"Completeness"}),t.jsxs("span",{style:{color:a.overall>=80?"#10B981":a.overall>=50?"#D97706":"#DC2626",fontSize:T.xs,fontWeight:600},children:[a.overall,"%"]}),t.jsx("div",{className:"flex items-center gap-0.5",children:A.map(k=>{const j=k.percentage<40;return t.jsx("div",{title:`${Xe[k.layerId]||k.layerLabel}: ${k.percentage}%`,style:{width:8,height:8,borderRadius:"2px",background:k.layerColor,opacity:Math.max(k.percentage/100,.12),flexShrink:0,animation:j?"memo-pulse-red 1.4s ease-in-out infinite":"none",cursor:"default"}},k.layerId)})})]}),t.jsxs("span",{className:"ml-auto flex items-center gap-1",style:{fontSize:T.xs},children:[e&&t.jsxs("span",{style:{color:f.faint},children:[e.rulesEvaluated," rules | ",e.rulesPassed," passed |"," "]}),t.jsxs("strong",{style:{color:f.secondary,fontWeight:700},children:[S," elements"]}),o&&t.jsxs(t.Fragment,{children:[t.jsx("span",{style:{color:f.faint},children:" · "}),t.jsxs("strong",{style:{color:f.secondary,fontWeight:700},children:[o.relationships.length," rels"]})]})]})]}),s&&t.jsxs("div",{style:{borderTop:`1px solid ${f.borderLight}`},children:[R&&t.jsx("div",{className:"flex",style:{borderBottom:`1px solid ${f.border}`,background:"#FAFAF8"},children:["problems","completeness"].map(k=>t.jsx("button",{onClick:j=>{j.stopPropagation(),u(k)},className:"px-4 py-1.5 font-medium transition-colors",style:{fontSize:T.xs,borderBottom:d===k?`2px solid ${f.accent}`:"2px solid transparent",color:d===k?f.accentDark:f.faint,background:"transparent"},children:k==="problems"?`Problems (${y+r.length})`:`Completeness ${a.overall}%`},k))}),(d==="problems"||!R)&&t.jsx("div",{className:"overflow-y-auto",style:{maxHeight:`${l}px`},children:O?t.jsxs(t.Fragment,{children:[y>0&&(e==null?void 0:e.violations.map((k,j)=>{const P=It[k.severity]||It.info;return t.jsxs("div",{className:"flex items-center gap-2 px-4 py-1.5 cursor-pointer transition-colors",style:{color:P.color,fontSize:T.xs},onMouseEnter:N=>N.currentTarget.style.background=P.bg,onMouseLeave:N=>N.currentTarget.style.background="transparent",onClick:()=>n(k.elementId),children:[t.jsx("span",{children:P.icon}),t.jsxs("span",{style:{color:f.faint},children:["[",k.ruleId,"]"]}),t.jsxs("span",{className:"font-medium",children:[k.elementKind,"/",k.elementName]}),t.jsx("span",{className:"truncate flex-1",style:{color:f.muted},children:k.description})]},`${k.ruleId}-${k.elementId}-${j}`)})),r.length>0&&t.jsxs(t.Fragment,{children:[y>0&&t.jsx("div",{style:{padding:"4px 16px",fontSize:"10px",fontWeight:600,color:f.faint,background:f.surfaceAlt,borderTop:`1px solid ${f.border}`,textTransform:"uppercase",letterSpacing:"0.06em"},children:"DSM Analysis"}),r.map(k=>{const j=It[k.severity]||It.info;return t.jsxs("div",{className:"flex items-center gap-2 px-4 py-1.5 cursor-pointer transition-colors",style:{color:j.color,fontSize:T.xs},onMouseEnter:P=>P.currentTarget.style.background=j.bg,onMouseLeave:P=>P.currentTarget.style.background="transparent",onClick:()=>n(k.elementId),children:[t.jsx("span",{children:j.icon}),t.jsxs("span",{style:{color:f.faint},children:["[",k.source,"]"]}),t.jsx("span",{className:"font-medium",children:k.elementName}),t.jsx("span",{className:"truncate flex-1",style:{color:f.muted},children:k.message}),k.tag&&t.jsx("span",{style:{flexShrink:0,fontSize:"9px",padding:"1px 5px",borderRadius:"4px",background:"#E5E7EB",color:"#374151"},children:k.tag})]},k.id)})]})]}):t.jsx("div",{className:"px-4 py-3",style:{color:f.faint,fontSize:T.xs},children:e?"✓ No problems found":"Waiting for validation…"})}),(d==="completeness"||!R)&&D&&t.jsxs("div",{className:"overflow-y-auto",style:{maxHeight:`${l}px`},children:[t.jsxs("div",{className:"px-4 py-2 flex items-center gap-3",style:{borderBottom:`1px solid ${f.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:A.map(k=>{const j=Math.max(k.totalElements/a.totalElements*100,2);return t.jsx("div",{style:{width:`${j}%`,height:"100%",background:k.layerColor+"30",borderRadius:"4px",overflow:"hidden"},children:t.jsx("div",{style:{width:`${k.percentage}%`,height:"100%",background:k.layerColor,borderRadius:"4px"}})},k.layerId)})}),t.jsxs("span",{style:{color:f.faint,fontSize:T.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:A.map(k=>t.jsxs("div",{className:"flex items-center gap-2",style:{fontSize:T.xs},children:[t.jsx("span",{className:"w-2.5 h-2.5 rounded flex-shrink-0",style:{backgroundColor:k.layerColor}}),t.jsx("span",{className:"flex-1 truncate",style:{color:"#374151"},children:Xe[k.layerId]||k.layerLabel}),t.jsxs("span",{style:{color:"#6B7280"},children:[k.percentage,"%"]}),t.jsxs("span",{style:{color:"#9CA3AF"},children:["(",k.completeElements,"/",k.totalElements,")"]})]},k.layerId))})]})]})]})}function pc(){const[e,r]=p.useState(!1),[n,o]=p.useState(""),[a,s]=p.useState(0),i=p.useRef(null),l=E(h=>h.model),c=E(h=>h.selectElement),d=E(h=>h.setActiveView),u=E(h=>h.selectViewpoint),m=E(h=>h.setExplorerTab);p.useEffect(()=>{const h=y=>{(y.metaKey||y.ctrlKey)&&y.key==="k"&&(y.preventDefault(),r(B=>!B),o(""),s(0)),y.key==="Escape"&&e&&r(!1)};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[e]),p.useEffect(()=>{e&&setTimeout(()=>{var h;return(h=i.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"})}),!l)return h;for(const y of l.diagrams??[]){const B=qe[y.diagramType];h.push({id:`diag:${y.id}`,label:y.name,sublabel:(B==null?void 0:B.fullName)||y.diagramType,kind:"diagram",color:B==null?void 0:B.color,action:()=>{d({type:"diagram",diagramId:y.id}),u(y.viewpointId==="__model"?null:y.viewpointId),m("views")}})}for(const y of l.viewpoints??[])h.push({id:`vp:${y.id}`,label:y.label,sublabel:"Viewpoint",kind:"viewpoint",action:()=>{u(y.id),m("views")}});for(const y of Object.values(l.elements))h.push({id:`el:${y.id}`,label:y.name,sublabel:`${y.kind} · ${y.layer}`,kind:"element",color:ce[y.layer],action:()=>{c(y.id),m("model")}});return h},[l,d,c,u,m]),w=p.useMemo(()=>{if(!n)return b.slice(0,20);const h=n.toLowerCase();return b.filter(y=>{var B;return y.label.toLowerCase().includes(h)||((B=y.sublabel)==null?void 0:B.toLowerCase().includes(h))}).slice(0,20)},[b,n]);p.useEffect(()=>{s(0)},[w]);const S=p.useCallback(h=>{h.key==="ArrowDown"&&(h.preventDefault(),s(y=>Math.min(y+1,w.length-1))),h.key==="ArrowUp"&&(h.preventDefault(),s(y=>Math.max(y-1,0))),h.key==="Enter"&&w[a]&&(w[a].action(),r(!1))},[w,a]);if(!e)return null;const g={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:i,type:"text",placeholder:"Search elements, diagrams, tools...",value:n,onChange:h=>o(h.target.value),onKeyDown:S,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:[w.length===0&&t.jsx("div",{className:"px-4 py-6 text-center text-xs",style:{color:"#9CA3AF"},children:"No results found"}),w.map((h,y)=>t.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 cursor-pointer",style:{background:y===a?"#F0F0ED":"transparent"},onMouseEnter:()=>s(y),onClick:()=>{h.action(),r(!1)},children:[t.jsx("span",{style:{color:h.color||"#9CA3AF",fontSize:"12px"},children:g[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 mc(e){const r=e.trim().split(/\r?\n/).filter(Boolean);if(r.length<2)return{headers:[],rows:[]};const o=r[0].includes(" ")?" ":",",a=l=>l.split(o).map(c=>c.replace(/^"(.*)"$/,"$1").replace(/""/g,'"').trim()),s=a(r[0]),i=r.slice(1).map(l=>{const c=a(l),d={};return s.forEach((u,m)=>{d[u]=c[m]??""}),d});return{headers:s,rows:i}}const Nr=["id","name","kind","construct","doc","— skip —"];function fc(){const e=E(x=>x.bulkImportOpen),r=E(x=>x.setBulkImportOpen),n=E(x=>x.importResult),o=E(x=>x.clearImportResult),a=E(x=>x.model),s=p.useRef(null),[i,l]=p.useState("input"),[c,d]=p.useState(""),[u,m]=p.useState(null),[b,w]=p.useState("bulk_import"),[S,g]=p.useState(""),[h,y]=p.useState([]),[B,O]=p.useState([]),[D,R]=p.useState([]),[A,v]=p.useState([]),[k,j]=p.useState([]),[P,N]=p.useState([]),[M,L]=p.useState(""),[C,z]=p.useState(!1);Mo.useMemo(()=>a?Array.from(new Set(Object.values(a.elements).map(x=>x.kind))).sort():[],[a]),p.useEffect(()=>{e||(l("input"),d(""),m(null),w("bulk_import"),g(""),y([]),O([]),R([]),v([]),j([]),N([]),L(""),z(!1),o())},[e,o]),p.useEffect(()=>{n&&z(!1)},[n]);const $=p.useCallback(()=>{r(!1)},[r]),U=p.useCallback(x=>{var J;const _=(J=x.target.files)==null?void 0:J[0];if(!_)return;const q=new FileReader;q.onload=ie=>{var W;const ne=(W=ie.target)==null?void 0:W.result;d(ne),g("");const F=_.name.replace(/\.[^.]+$/,"").replace(/[^a-zA-Z0-9_]/g,"_");F&&w(F)},q.readAsText(_)},[]),G=p.useCallback(()=>{if(!c.trim()){g("Paste CSV data or upload a file first.");return}const{headers:x,rows:_}=mc(c);if(x.length===0){g("Could not parse headers. Make sure the first row contains column names.");return}if(_.length===0){g("No data rows found after the header row.");return}y(x),O(_),R(Ts(x,u??void 0)),g(""),l("mapping")},[c,u]),H=p.useCallback(()=>{const x=u==null?void 0:u.defaultKind,_=Is(B,D,{},x);L(_.csv),N(_.warnings);const q=_.csv.trim().split(`
|
|
4061
|
-
`);if(q.length<2){
|
|
4060
|
+
`,document.head.appendChild(e)}const Mt={error:{color:"#DC2626",bg:"#FEF2F2",icon:"✖"},warning:{color:"#D97706",bg:"#FFFBEB",icon:"⚠"},info:{color:"#2563EB",bg:"#EFF6FF",icon:"ℹ"}};function wc(){const e=S(k=>k.validation),r=S(k=>k.analysisIssues),n=S(k=>k.selectElement),o=S(k=>k.model),a=S(k=>k.completeness),s=S(k=>k.gapBarExpanded),i=S(k=>k.toggleGapBar),l=S(k=>k.gapBarHeight),c=S(k=>k.setGapBarHeight),[d,u]=p.useState("problems"),m=p.useRef(!1),b=p.useRef(0),v=p.useRef(0),w=o?Object.keys(o.elements).length:0,g=(e==null?void 0:e.violations.filter(k=>k.severity==="error"))??[],h=(e==null?void 0:e.violations.filter(k=>k.severity==="warning"))??[],y=(e==null?void 0:e.violations.length)??0,B=r.filter(k=>k.severity==="warning").length,N=y>0||r.length>0,D=!!a,A=N&&D,F=(a==null?void 0:a.layers.filter(k=>k.totalElements>0))??[],C=p.useCallback(k=>{k.preventDefault(),m.current=!0,b.current=k.clientY,v.current=l;const T=_=>{if(!m.current)return;const j=b.current-_.clientY;c(v.current+j)},z=()=>{m.current=!1,document.removeEventListener("mousemove",T),document.removeEventListener("mouseup",z)};document.addEventListener("mousemove",T),document.addEventListener("mouseup",z)},[l,c]);return t.jsxs("div",{style:{background:f.surface,borderTop:`1px solid ${f.border}`,flexShrink:0},children:[s&&t.jsx("div",{style:{height:"4px",cursor:"row-resize",background:"transparent",flexShrink:0},onMouseDown:C,onMouseEnter:k=>{k.currentTarget.style.background=f.accent+"40"},onMouseLeave:k=>{k.currentTarget.style.background="transparent"}}),t.jsxs("div",{className:"flex items-center px-4 gap-3 cursor-pointer select-none",style:{height:"32px",fontSize:I.sm},onClick:i,children:[t.jsx("span",{style:{color:f.faint,fontSize:"10px",transition:"transform 150ms ease",transform:s?"rotate(0deg)":"rotate(-90deg)",display:"inline-block"},children:"▼"}),t.jsx("span",{style:{color:f.secondary,fontWeight:600,fontSize:I.xs},children:"Problems"}),g.length>0&&t.jsxs("span",{className:"flex items-center gap-1",style:{color:"#DC2626",fontSize:I.xs},children:[t.jsx("span",{style:{fontSize:"10px"},children:"✖"})," ",g.length]}),h.length>0&&t.jsxs("span",{className:"flex items-center gap-1",style:{color:"#D97706",fontSize:I.xs},children:[t.jsx("span",{style:{fontSize:"10px"},children:"⚠"})," ",h.length]}),B>0&&t.jsxs("span",{className:"flex items-center gap-1",style:{color:"#D97706",fontSize:I.xs},children:[t.jsx("span",{style:{fontSize:"9px",opacity:.7},children:"DSM"}),t.jsx("span",{style:{fontSize:"10px"},children:"⚠"})," ",B]}),!N&&e&&t.jsx("span",{style:{color:"#10B981",fontSize:I.xs},children:"✓ No problems"}),!e&&t.jsx("span",{style:{color:f.faint,fontSize:I.xs},children:"Waiting for validation…"}),D&&t.jsxs(t.Fragment,{children:[t.jsx("div",{style:{width:"1px",height:"14px",background:f.border,flexShrink:0}}),t.jsx("span",{style:{color:f.secondary,fontWeight:600,fontSize:I.xs},children:"Completeness"}),t.jsxs("span",{style:{color:a.overall>=80?"#10B981":a.overall>=50?"#D97706":"#DC2626",fontSize:I.xs,fontWeight:600},children:[a.overall,"%"]}),t.jsx("div",{className:"flex items-center gap-0.5",children:F.map(k=>{const T=k.percentage<40;return t.jsx("div",{title:`${Le[k.layerId]||k.layerLabel}: ${k.percentage}%`,style:{width:8,height:8,borderRadius:"2px",background:k.layerColor,opacity:Math.max(k.percentage/100,.12),flexShrink:0,animation:T?"memo-pulse-red 1.4s ease-in-out infinite":"none",cursor:"default"}},k.layerId)})})]}),t.jsxs("span",{className:"ml-auto flex items-center gap-1",style:{fontSize:I.xs},children:[e&&t.jsxs("span",{style:{color:f.faint},children:[e.rulesEvaluated," rules | ",e.rulesPassed," passed |"," "]}),t.jsxs("strong",{style:{color:f.secondary,fontWeight:700},children:[w," elements"]}),o&&t.jsxs(t.Fragment,{children:[t.jsx("span",{style:{color:f.faint},children:" · "}),t.jsxs("strong",{style:{color:f.secondary,fontWeight:700},children:[o.relationships.length," rels"]})]})]})]}),s&&t.jsxs("div",{style:{borderTop:`1px solid ${f.borderLight}`},children:[A&&t.jsx("div",{className:"flex",style:{borderBottom:`1px solid ${f.border}`,background:"#FAFAF8"},children:["problems","completeness"].map(k=>t.jsx("button",{onClick:T=>{T.stopPropagation(),u(k)},className:"px-4 py-1.5 font-medium transition-colors",style:{fontSize:I.xs,borderBottom:d===k?`2px solid ${f.accent}`:"2px solid transparent",color:d===k?f.accentDark:f.faint,background:"transparent"},children:k==="problems"?`Problems (${y+r.length})`:`Completeness ${a.overall}%`},k))}),(d==="problems"||!A)&&t.jsx("div",{className:"overflow-y-auto",style:{maxHeight:`${l}px`},children:N?t.jsxs(t.Fragment,{children:[y>0&&(e==null?void 0:e.violations.map((k,T)=>{const z=Mt[k.severity]||Mt.info;return t.jsxs("div",{className:"flex items-center gap-2 px-4 py-1.5 cursor-pointer transition-colors",style:{color:z.color,fontSize:I.xs},onMouseEnter:_=>_.currentTarget.style.background=z.bg,onMouseLeave:_=>_.currentTarget.style.background="transparent",onClick:()=>n(k.elementId),children:[t.jsx("span",{children:z.icon}),t.jsxs("span",{style:{color:f.faint},children:["[",k.ruleId,"]"]}),t.jsxs("span",{className:"font-medium",children:[k.elementKind,"/",k.elementName]}),t.jsx("span",{className:"truncate flex-1",style:{color:f.muted},children:k.description})]},`${k.ruleId}-${k.elementId}-${T}`)})),r.length>0&&t.jsxs(t.Fragment,{children:[y>0&&t.jsx("div",{style:{padding:"4px 16px",fontSize:"10px",fontWeight:600,color:f.faint,background:f.surfaceAlt,borderTop:`1px solid ${f.border}`,textTransform:"uppercase",letterSpacing:"0.06em"},children:"DSM Analysis"}),r.map(k=>{const T=Mt[k.severity]||Mt.info;return t.jsxs("div",{className:"flex items-center gap-2 px-4 py-1.5 cursor-pointer transition-colors",style:{color:T.color,fontSize:I.xs},onMouseEnter:z=>z.currentTarget.style.background=T.bg,onMouseLeave:z=>z.currentTarget.style.background="transparent",onClick:()=>n(k.elementId),children:[t.jsx("span",{children:T.icon}),t.jsxs("span",{style:{color:f.faint},children:["[",k.source,"]"]}),t.jsx("span",{className:"font-medium",children:k.elementName}),t.jsx("span",{className:"truncate flex-1",style:{color:f.muted},children:k.message}),k.tag&&t.jsx("span",{style:{flexShrink:0,fontSize:"9px",padding:"1px 5px",borderRadius:"4px",background:"#E5E7EB",color:"#374151"},children:k.tag})]},k.id)})]})]}):t.jsx("div",{className:"px-4 py-3",style:{color:f.faint,fontSize:I.xs},children:e?"✓ No problems found":"Waiting for validation…"})}),(d==="completeness"||!A)&&D&&t.jsxs("div",{className:"overflow-y-auto",style:{maxHeight:`${l}px`},children:[t.jsxs("div",{className:"px-4 py-2 flex items-center gap-3",style:{borderBottom:`1px solid ${f.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:F.map(k=>{const T=Math.max(k.totalElements/a.totalElements*100,2);return t.jsx("div",{style:{width:`${T}%`,height:"100%",background:k.layerColor+"30",borderRadius:"4px",overflow:"hidden"},children:t.jsx("div",{style:{width:`${k.percentage}%`,height:"100%",background:k.layerColor,borderRadius:"4px"}})},k.layerId)})}),t.jsxs("span",{style:{color:f.faint,fontSize:I.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:F.map(k=>t.jsxs("div",{className:"flex items-center gap-2",style:{fontSize:I.xs},children:[t.jsx("span",{className:"w-2.5 h-2.5 rounded flex-shrink-0",style:{backgroundColor:k.layerColor}}),t.jsx("span",{className:"flex-1 truncate",style:{color:"#374151"},children:Le[k.layerId]||k.layerLabel}),t.jsxs("span",{style:{color:"#6B7280"},children:[k.percentage,"%"]}),t.jsxs("span",{style:{color:"#9CA3AF"},children:["(",k.completeElements,"/",k.totalElements,")"]})]},k.layerId))})]})]})]})}function kc(){const[e,r]=p.useState(!1),[n,o]=p.useState(""),[a,s]=p.useState(0),i=p.useRef(null),l=S(h=>h.model),c=S(h=>h.selectElement),d=S(h=>h.setActiveView),u=S(h=>h.selectViewpoint),m=S(h=>h.setExplorerTab);p.useEffect(()=>{const h=y=>{(y.metaKey||y.ctrlKey)&&y.key==="k"&&(y.preventDefault(),r(B=>!B),o(""),s(0)),y.key==="Escape"&&e&&r(!1)};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[e]),p.useEffect(()=>{e&&setTimeout(()=>{var h;return(h=i.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"})}),!l)return h;for(const y of l.diagrams??[]){const B=$e[y.diagramType];h.push({id:`diag:${y.id}`,label:y.name,sublabel:(B==null?void 0:B.fullName)||y.diagramType,kind:"diagram",color:B==null?void 0:B.color,action:()=>{d({type:"diagram",diagramId:y.id}),u(y.viewpointId==="__model"?null:y.viewpointId),m("views")}})}for(const y of l.viewpoints??[])h.push({id:`vp:${y.id}`,label:y.label,sublabel:"Viewpoint",kind:"viewpoint",action:()=>{u(y.id),m("views")}});for(const y of Object.values(l.elements))h.push({id:`el:${y.id}`,label:y.name,sublabel:`${y.kind} · ${y.layer}`,kind:"element",color:ce[y.layer],action:()=>{c(y.id),m("model")}});return h},[l,d,c,u,m]),v=p.useMemo(()=>{if(!n)return b.slice(0,20);const h=n.toLowerCase();return b.filter(y=>{var B;return y.label.toLowerCase().includes(h)||((B=y.sublabel)==null?void 0:B.toLowerCase().includes(h))}).slice(0,20)},[b,n]);p.useEffect(()=>{s(0)},[v]);const w=p.useCallback(h=>{h.key==="ArrowDown"&&(h.preventDefault(),s(y=>Math.min(y+1,v.length-1))),h.key==="ArrowUp"&&(h.preventDefault(),s(y=>Math.max(y-1,0))),h.key==="Enter"&&v[a]&&(v[a].action(),r(!1))},[v,a]);if(!e)return null;const g={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:i,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:[v.length===0&&t.jsx("div",{className:"px-4 py-6 text-center text-xs",style:{color:"#9CA3AF"},children:"No results found"}),v.map((h,y)=>t.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 cursor-pointer",style:{background:y===a?"#F0F0ED":"transparent"},onMouseEnter:()=>s(y),onClick:()=>{h.action(),r(!1)},children:[t.jsx("span",{style:{color:h.color||"#9CA3AF",fontSize:"12px"},children:g[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 Sc(e){const r=e.trim().split(/\r?\n/).filter(Boolean);if(r.length<2)return{headers:[],rows:[]};const o=r[0].includes(" ")?" ":",",a=l=>l.split(o).map(c=>c.replace(/^"(.*)"$/,"$1").replace(/""/g,'"').trim()),s=a(r[0]),i=r.slice(1).map(l=>{const c=a(l),d={};return s.forEach((u,m)=>{d[u]=c[m]??""}),d});return{headers:s,rows:i}}const _r=["id","name","kind","construct","doc","— skip —"];function Cc(){const e=S(x=>x.bulkImportOpen),r=S(x=>x.setBulkImportOpen),n=S(x=>x.importResult),o=S(x=>x.clearImportResult),a=S(x=>x.model),s=p.useRef(null),[i,l]=p.useState("input"),[c,d]=p.useState(""),[u,m]=p.useState(null),[b,v]=p.useState("bulk_import"),[w,g]=p.useState(""),[h,y]=p.useState([]),[B,N]=p.useState([]),[D,A]=p.useState([]),[F,C]=p.useState([]),[k,T]=p.useState([]),[z,_]=p.useState([]),[j,L]=p.useState(""),[E,O]=p.useState(!1);Uo.useMemo(()=>a?Array.from(new Set(Object.values(a.elements).map(x=>x.kind))).sort():[],[a]),p.useEffect(()=>{e||(l("input"),d(""),m(null),v("bulk_import"),g(""),y([]),N([]),A([]),C([]),T([]),_([]),L(""),O(!1),o())},[e,o]),p.useEffect(()=>{n&&O(!1)},[n]);const V=p.useCallback(()=>{r(!1)},[r]),U=p.useCallback(x=>{var X;const P=(X=x.target.files)==null?void 0:X[0];if(!P)return;const q=new FileReader;q.onload=ie=>{var H;const oe=(H=ie.target)==null?void 0:H.result;d(oe),g("");const R=P.name.replace(/\.[^.]+$/,"").replace(/[^a-zA-Z0-9_]/g,"_");R&&v(R)},q.readAsText(P)},[]),$=p.useCallback(()=>{if(!c.trim()){g("Paste CSV data or upload a file first.");return}const{headers:x,rows:P}=Sc(c);if(x.length===0){g("Could not parse headers. Make sure the first row contains column names.");return}if(P.length===0){g("No data rows found after the header row.");return}y(x),N(P),A(Ps(x,u??void 0)),g(""),l("mapping")},[c,u]),K=p.useCallback(()=>{const x=u==null?void 0:u.defaultKind,P=zs(B,D,{},x);L(P.csv),_(P.warnings);const q=P.csv.trim().split(`
|
|
4061
|
+
`);if(q.length<2){T(["No rows to preview after applying mappings."]),C([]),l("preview");return}const X=q[0].split(",").map(R=>R.replace(/^"|"$/g,"").trim()),ie=[],oe=[];q.slice(1,21).forEach((R,H)=>{const G=R.split(",").map(le=>le.replace(/^"|"$/g,"").trim()),Z={rowIndex:H+1,id:"",name:"",kind:"",doc:""};X.forEach((le,ae)=>{Z[le]=G[ae]??""}),Z.id||oe.push(`Row ${H+2}: missing id`),Z.name||oe.push(`Row ${H+2}: missing name`),Z.kind||oe.push(`Row ${H+2}: missing kind`),ie.push(Z)}),C(ie),T(oe),l("preview")},[B,D,u]),J=p.useCallback(()=>{j&&(O(!0),o(),ii({elementsCsv:j,packageName:b||"bulk_import"}))},[j,b,o]),Y=p.useCallback((x,P)=>{A(q=>q.map((X,ie)=>ie===x?{...X,targetAttribute:P}:X))},[]);if(!e)return null;const Q={input:"1 · Input",mapping:"2 · Map columns",preview:"3 · Preview & Import"},ee=["input","mapping","preview"],M=ee.indexOf(i);return t.jsx("div",{ref:s,className:"fixed inset-0 z-50 flex items-center justify-center",style:{background:"rgba(0,0,0,0.35)"},onMouseDown:x=>{x.target===s.current&&V()},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:V,style:Ec,children:"✕"})]}),t.jsx("div",{className:"flex",style:{borderBottom:"1px solid #F0F0EC",background:"#FAFAF8",flexShrink:0},children:ee.map((x,P)=>t.jsx("div",{className:"flex-1 flex items-center justify-center py-2.5",style:{fontSize:I.xs,fontWeight:P===M?700:400,color:P===M?"#1B3A4B":P<M?"#2D6A7A":"#9CA3AF",borderBottom:P===M?"2px solid #2D6A7A":"2px solid transparent"},children:Q[x]},x))}),t.jsxs("div",{className:"flex-1 overflow-y-auto px-6 py-5",style:{minHeight:0},children:[i==="input"&&t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{style:gn,children:"Artifact type (recipe preset)"}),t.jsxs("select",{value:(u==null?void 0:u.id)??"",onChange:x=>{const P=ar.find(q=>q.id===x.target.value)??null;m(P)},style:xn,children:[t.jsx("option",{value:"",children:"— Custom / no preset —"}),ar.map(x=>t.jsx("option",{value:x.id,children:x.name},x.id))]}),u&&t.jsx("p",{style:{fontSize:I.xs,color:"#6B7280",marginTop:4},children:u.description})]}),t.jsxs("div",{children:[t.jsxs("label",{style:gn,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:x=>v(x.target.value.replace(/[^a-zA-Z0-9_]/g,"_")),style:xn,placeholder:"bulk_import"})]}),t.jsxs("div",{children:[t.jsxs("label",{style:gn,children:["CSV data ",t.jsx("span",{style:{color:"#E74C3C"},children:"*"})]}),t.jsx("textarea",{value:c,onChange:x=>{d(x.target.value),g("")},placeholder:`Paste CSV or tab-separated data here.
|
|
4062
4062
|
First row must be the header.
|
|
4063
4063
|
|
|
4064
4064
|
Example:
|
|
4065
4065
|
id,name,kind,doc
|
|
4066
|
-
req_001,System shall be safe,Requirement,Safety requirement`,rows:10,style:{...
|
|
4067
|
-
`).length," line(s) loaded"]})]})]}),i==="mapping"&&t.jsxs("div",{className:"flex flex-col gap-3",children:[t.jsxs("p",{style:{fontSize:T.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:T.xs,fontWeight:600,color:"#374151"},children:"Source column"}),t.jsx("span",{style:{flex:1,fontSize:T.xs,fontWeight:600,color:"#374151"},children:"Maps to"}),t.jsx("span",{style:{width:80,fontSize:T.xs,fontWeight:600,color:"#374151"},children:"Transform"})]}),D.map((x,_)=>{const q=["id","name","kind"].includes(x.targetAttribute),J=!x.targetAttribute,ie=D.filter((F,W)=>W!==_&&["id","name","kind","doc","construct"].includes(F.targetAttribute)).map(F=>F.targetAttribute),ne=Nr.filter(F=>F==="— skip —"||!ie.includes(F)||F===x.targetAttribute);return t.jsxs("div",{className:"flex items-center",style:{padding:"6px 12px",borderBottom:_<D.length-1?"1px solid #F0F0EC":"none",background:q?"#F0FDF4":"transparent"},children:[t.jsx("div",{style:{flex:1,fontSize:T.xs,color:"#374151",fontFamily:"monospace"},children:x.sourceColumn}),t.jsx("div",{style:{flex:1,paddingRight:8},children:t.jsxs("select",{value:x.targetAttribute||"",onChange:F=>Y(_,F.target.value==="— skip —"?"":F.target.value),style:{width:"100%",fontSize:T.xs,padding:"3px 6px",borderRadius:5,border:`1px solid ${J?"#E5E5E0":q?"#22C55E":"#E5E5E0"}`,background:J?"#F9FAFB":"#FFFFFF",color:J?"#9CA3AF":"#1a1a1a"},children:[ne.map(F=>t.jsx("option",{value:F,children:F},F)),x.targetAttribute&&!Nr.includes(x.targetAttribute)&&t.jsx("option",{value:x.targetAttribute,children:x.targetAttribute})]})}),t.jsx("div",{style:{width:80,fontSize:"10px",color:"#9CA3AF"},children:x.transform??"—"})]},_)})]}),B.length>0&&t.jsxs("details",{children:[t.jsxs("summary",{style:{fontSize:T.xs,color:"#6B7280",cursor:"pointer",marginTop:4},children:["Show raw data sample (",Math.min(B.length,3)," of ",B.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(x=>t.jsx("th",{style:Ve,children:x},x))})}),t.jsx("tbody",{children:B.slice(0,3).map((x,_)=>t.jsx("tr",{children:h.map(q=>t.jsx("td",{style:ct,children:x[q]??""},q))},_))})]})})]})]}),i==="preview"&&t.jsxs("div",{className:"flex flex-col gap-4",children:[k.length>0&&t.jsxs("div",{style:{background:"#FEF2F2",border:"1px solid #FECACA",borderRadius:8,padding:"10px 14px"},children:[t.jsxs("p",{style:{fontSize:T.xs,fontWeight:700,color:"#DC2626",margin:"0 0 4px"},children:[k.length," validation error(s) — rows with missing required fields will be skipped"]}),k.slice(0,5).map((x,_)=>t.jsx("p",{style:{fontSize:"11px",color:"#DC2626",margin:"1px 0"},children:x},_)),k.length>5&&t.jsxs("p",{style:{fontSize:"11px",color:"#DC2626",margin:"2px 0 0"},children:["+",k.length-5," more…"]})]}),P.length>0&&t.jsxs("div",{style:{background:"#FFFBEB",border:"1px solid #FDE68A",borderRadius:8,padding:"10px 14px"},children:[t.jsxs("p",{style:{fontSize:T.xs,fontWeight:700,color:"#D97706",margin:"0 0 4px"},children:[P.length," warning(s)"]}),P.slice(0,3).map((x,_)=>t.jsx("p",{style:{fontSize:"11px",color:"#D97706",margin:"1px 0"},children:x},_))]}),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:T.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((x,_)=>t.jsx("p",{style:{fontSize:"11px",color:"#DC2626",margin:"1px 0"},children:x},_)),n.warnings.slice(0,3).map((x,_)=>t.jsx("p",{style:{fontSize:"11px",color:"#D97706",margin:"1px 0"},children:x},_))]}),A.length>0&&t.jsxs(t.Fragment,{children:[t.jsxs("p",{style:{fontSize:T.xs,color:"#6B7280",margin:0},children:["Showing first ",A.length," of ",B.length," row(s)",B.length>A.length&&` (+${B.length-A.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:Ve,children:"#"}),t.jsx("th",{style:Ve,children:"id"}),t.jsx("th",{style:Ve,children:"name"}),t.jsx("th",{style:Ve,children:"kind"}),t.jsx("th",{style:Ve,children:"doc"})]})}),t.jsx("tbody",{children:A.map(x=>{const _=!x.id||!x.name||!x.kind;return t.jsxs("tr",{style:{background:_?"#FEF9F9":"transparent"},children:[t.jsx("td",{style:Rr,children:x.rowIndex}),t.jsx("td",{style:{...Rr,color:x.id?"#1a1a1a":"#DC2626"},children:x.id||"⚠ missing"}),t.jsx("td",{style:{...ct,maxWidth:160,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:String(x.name||"—")}),t.jsx("td",{style:{...ct,color:x.kind?"#1B3A4B":"#DC2626"},children:x.kind||"⚠ missing"}),t.jsx("td",{style:{...ct,maxWidth:180,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:"#6B7280"},children:String(x.doc||"—")})]},x.rowIndex)})})]})})]}),A.length===0&&k.length===0&&t.jsx("p",{style:{fontSize:T.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:i!=="input"&&!n&&t.jsx("button",{onClick:()=>l(se[I-1]),style:Tr,children:"← Back"})}),t.jsxs("div",{className:"flex gap-2 items-center",children:[t.jsx("button",{onClick:$,style:Tr,children:n!=null&&n.success?"Done":"Cancel"}),!n&&t.jsxs(t.Fragment,{children:[i==="input"&&t.jsx("button",{onClick:G,style:yn,children:"Next →"}),i==="mapping"&&t.jsx("button",{onClick:H,style:yn,children:"Preview →"}),i==="preview"&&t.jsx("button",{onClick:X,disabled:C||A.length===0,style:{...yn,opacity:C||A.length===0?.5:1,cursor:C||A.length===0?"not-allowed":"pointer"},children:C?"Importing…":`Import ${B.length} element(s)`})]})]})]})]})})}const fn={display:"block",fontSize:T.xs,fontWeight:600,color:"#374151",marginBottom:6},hn={width:"100%",padding:"7px 10px",borderRadius:8,border:"1px solid #E5E5E0",fontSize:T.sm,color:"#1a1a1a",background:"#FAFAF8",boxSizing:"border-box"},hc={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"},yn={padding:"7px 18px",borderRadius:8,background:"#1B3A4B",border:"none",color:"#FFFFFF",fontSize:T.xs,fontWeight:600,cursor:"pointer"},Tr={padding:"7px 14px",borderRadius:8,background:"transparent",border:"1px solid #E5E5E0",color:"#374151",fontSize:T.xs,cursor:"pointer"},Ve={padding:"5px 8px",textAlign:"left",fontWeight:600,fontSize:"10px",color:"#6B7280",borderBottom:"1px solid #E5E5E0",whiteSpace:"nowrap"},ct={padding:"4px 8px",fontSize:"11px",color:"#1a1a1a",borderBottom:"1px solid #F5F5F2"},Rr={...ct,fontFamily:"monospace",fontSize:"10px",color:"#6B7280"};function yc(){var u,m,b;const e=E(w=>w.activeView),r=E(w=>w.model),n=E(w=>w.selectedElementId),o=E(w=>w.activeMode),a=E(w=>w.setActiveMode),s=E(w=>w.selectElement),i=E(w=>w.setActiveView),l=ke(),c=[],d=(()=>{switch(e.type){case"diagram":return;case"element-detail":return{label:"Model Explorer",icon:"☰",onClick:()=>{a("catalog"),i({type:"welcome"}),l("/catalog")}};case"dsm":return{label:"DSM Analysis",icon:"▦",onClick:()=>{i({type:"dsm"}),l("/dsm")}};case"traceability":return{label:"Traceability Matrix",icon:"☷",onClick:()=>{i({type:"traceability"}),l("/traceability")}};case"ontology":case"ontology-detail":return{label:"Ontology Explorer",icon:"◉",onClick:()=>{i({type:"ontology"}),l("/ontology")}};case"scenario-editor":return{label:"Use Cases",icon:"▶",onClick:()=>{a("scenario"),i({type:"scenario-editor"}),l("/use-cases")}};case"dhf-dashboard":case"dhf-dashboard-legacy":case"dhf-document":return{label:"Documents",icon:"⊞",onClick:()=>{a("dhf"),i({type:"dhf-dashboard"}),l("/dhf")}};case"welcome":return o==="diagram"?{label:"Viewpoints",icon:"⊟",onClick:()=>l("/diagrams")}:o==="catalog"?{label:"Model Explorer",icon:"☰",onClick:()=>l("/catalog")}:void 0;default:return}})();switch(e.type){case"diagram":{const w=Yt(r,e.diagramId);if(w){const S=w.viewpointId==="__model"?"Unassigned Views":((m=(u=r==null?void 0:r.viewpoints)==null?void 0:u.find(O=>O.id===w.viewpointId))==null?void 0:m.label)||w.viewpointId,g=(b=r==null?void 0:r.viewpoints)==null?void 0:b.find(O=>O.id===w.viewpointId);c.push({label:g?`${g.id} · ${S}`:S});const h=w.viewKind?Vn[w.viewKind]:void 0,y=qe[w.diagramType],B=(h==null?void 0:h.label)??(y==null?void 0:y.code)??w.diagramType;c.push({label:`${w.shortId??w.id} · ${B}: ${w.name}`})}break}case"element-detail":{const w=e.elementId,S=r==null?void 0:r.elements[w];if(S){const g=S.shortId??S.id,h=g.split("-")[0];c.push({label:"Catalog",onClick:()=>l("/catalog")}),c.push({label:h,onClick:()=>l(`/catalog/${h}`)}),c.push({label:`${g} ${S.name}`})}break}}if(n&&r&&e.type!=="element-detail"){const w=r.elements[n];w&&c.push({label:w.name,onClick:()=>s(w.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((w,S)=>t.jsxs("span",{className:"flex items-center gap-1",children:[(d||S>0)&&t.jsx("span",{className:"text-xs",style:{color:"#D1D5DB"},children:"/"}),w.onClick?t.jsx("button",{className:"text-xs px-1 py-0.5 rounded transition-colors",style:{color:"#374151"},onMouseEnter:g=>g.currentTarget.style.background="#F0F0ED",onMouseLeave:g=>g.currentTarget.style.background="transparent",onClick:w.onClick,children:w.label}):t.jsx("span",{className:"text-xs",style:{color:S===c.length-1?"#374151":"#9CA3AF"},children:w.label})]},S)),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 Ir="memo-onboarding-completed",it=[{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 gc(){const[e,r]=p.useState(!1),[n,o]=p.useState(0);p.useEffect(()=>{try{if(!localStorage.getItem(Ir)){const b=setTimeout(()=>r(!0),800);return()=>clearTimeout(b)}}catch{}},[]);const a=p.useCallback(()=>{r(!1);try{localStorage.setItem(Ir,"true")}catch{}},[]),s=p.useCallback(()=>{n>=it.length-1?a():o(n+1)},[n,a]),i=p.useCallback(()=>{n>0&&o(n-1)},[n]);if(!e)return null;const l=it[n],c=n===it.length-1,d=n===0,u=()=>{switch(l.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:m=>m.stopPropagation(),children:[t.jsx("div",{className:"flex items-center gap-1 mb-3",children:it.map((m,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:l.title}),t.jsx("p",{className:"text-xs leading-relaxed mb-4",style:{color:"#6B7280"},children:l.description}),t.jsxs("div",{className:"flex items-center gap-2",children:[!d&&t.jsx("button",{onClick:i,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:s,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 ",it.length]})]})]})}function xc(){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 bc(){const e=E(s=>s.editConflict),r=E(s=>s.setEditConflict);if(!e)return null;const n=e.reason==="stale-identity",o=JSON.stringify(e.rejectedDraft,null,2),a=()=>{const s=URL.createObjectURL(new Blob([o],{type:"application/json"})),i=document.createElement("a");i.href=s,i.download=`rejected-edit-${e.rejectedCommandId}.json`,i.click(),URL.revokeObjectURL(s)};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:()=>ti(e.sourceFile),children:"Reveal file"}),t.jsx("button",{onClick:()=>r(null),children:"Dismiss"})]})]})}const vc=20;function wc(){const e=E(u=>u.sourceCoherence),[r,n]=p.useState(!1);if(!e)return null;const{files:o,diagnostics:a,lastGoodRevision:s}=e,i=a.slice(0,vc),l=a.length-i.length,c=a.length||o.length,d=`${c} source ${c===1?"error":"errors"} — showing the last model that compiled`;return t.jsxs("div",{style:{position:"fixed",bottom:16,left:"50%",transform:"translateX(-50%)",zIndex:9e3,display:"flex",flexDirection:"column",alignItems:"center",gap:8},children:[r&&t.jsxs("div",{style:{maxWidth:620,width:"calc(100vw - 32px)",maxHeight:"40vh",overflowY:"auto",background:"#1E293B",border:"1px solid #EF4444",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:"#FCA5A5",marginBottom:4},children:s>0?`Showing the last model that compiled (revision ${s})`:"Showing everything that parsed"}),t.jsxs("div",{style:{fontSize:"0.75rem",color:"#CBD5E1",marginBottom:i.length?8:0},children:[o.length===1?o[0]:`${o.length} files`," did not parse. Edits are held until the source compiles again — no restart needed."]}),i.map((u,m)=>t.jsxs("div",{style:{fontSize:"0.7rem",color:"#94A3B8",fontFamily:"monospace",lineHeight:1.5},children:[u.file,u.line!==void 0?`:${u.line}`:"",u.column!==void 0?`:${u.column}`:""," — ",u.message]},`${u.file}:${u.line??0}:${m}`)),l>0&&t.jsxs("div",{style:{fontSize:"0.7rem",color:"#64748B",marginTop:4},children:["and ",l," more"]})]}),t.jsxs("button",{type:"button",role:"status","aria-live":"polite","aria-expanded":r,"aria-label":d,title:d,onClick:()=>n(u=>!u),style:{display:"flex",alignItems:"center",gap:6,background:"#7F1D1D",border:"1px solid #EF4444",borderRadius:999,padding:"6px 12px",color:"#FEE2E2",cursor:"pointer",fontSize:"0.75rem",fontWeight:600,boxShadow:"0 6px 18px rgba(0,0,0,0.35)"},children:[t.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[t.jsx("circle",{cx:"12",cy:"12",r:"9",stroke:"#FCA5A5",strokeWidth:"2"}),t.jsx("path",{d:"M12 7v6",stroke:"#FCA5A5",strokeWidth:"2",strokeLinecap:"round"}),t.jsx("circle",{cx:"12",cy:"16.5",r:"1.1",fill:"#FCA5A5"})]}),c]})]})}function No({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 kc(e){return Xe[e]?Xe[e]:e?e.split(/[_-]/).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join(" "):"Other"}function Sc(){const e=E(s=>s.model),r=ke(),n=p.useMemo(()=>{if(!e)return[];const s={};for(const c of Object.values(e.elements)){const d=od(c.kind),u=ad(d);s[u]||(s[u]={count:0,kinds:new Set,layer:c.layer}),s[u].count++,s[u].kinds.add(c.kind)}const i=new Map;for(const c of Object.entries(s)){const d=c[1].layer;i.has(d)||i.set(d,[]),i.get(d).push(c)}for(const c of i.values())c.sort((d,u)=>u[1].count-d[1].count);const l=new Map(Oe.map((c,d)=>[c,d]));return[...i.entries()].sort(([c],[d])=>{const u=l.get(c)??Oe.length,m=l.get(d)??Oe.length;return u!==m?u-m:c.localeCompare(d)})},[e]),o=p.useMemo(()=>n.flatMap(([,s])=>s),[n]);if(!e)return t.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",background:"#F7F7F5"},children:t.jsx("p",{style:{color:f.muted,fontSize:T.sm},children:"Loading…"})});const a=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:f.primary,margin:"0 0 4px"},children:"Catalog"}),t.jsxs("p",{style:{color:f.muted,fontSize:T.sm,margin:0},children:[a," elements across ",o.length," families"]})]}),t.jsx(No,{size:132})]}),n.map(([s,i])=>{const l=ce[s]??"#9CA3AF";return t.jsxs("div",{style:{marginBottom:"28px"},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"12px"},children:[t.jsx("span",{style:{width:"8px",height:"8px",borderRadius:"50%",background:l,flexShrink:0}}),t.jsx("h2",{style:{fontSize:"13px",fontWeight:700,color:f.secondary,textTransform:"uppercase",letterSpacing:"0.04em",margin:0},children:kc(s)})]}),t.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(200px, 1fr))",gap:"12px"},children:i.map(([c,d])=>t.jsx(Ec,{family:c,count:d.count,kinds:d.kinds,color:l,onClick:()=>r(sd(c))},c))})]},s||"__none")})]})}function Ec({family:e,count:r,kinds:n,color:o,onClick:a}){return t.jsxs("div",{onClick:a,style:{background:f.surface,border:`1px solid ${f.border}`,borderRadius:"10px",padding:"16px",cursor:"pointer",transition:"box-shadow 0.15s, border-color 0.15s",borderTop:`3px solid ${o}`},onMouseEnter:s=>{s.currentTarget.style.boxShadow="0 4px 12px rgba(0,0,0,0.08)",s.currentTarget.style.borderTopColor=o},onMouseLeave:s=>{s.currentTarget.style.boxShadow="none"},children:[t.jsx("div",{style:{fontWeight:700,fontSize:"15px",color:f.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:f.muted,lineHeight:"1.5"},children:[Array.from(n).slice(0,3).join(", "),n.size>3&&` +${n.size-3} more`]})]})}function Cc(){var a;const e=E(s=>s.model),r=ke(),n=p.useMemo(()=>{var b;const s=(e==null?void 0:e.diagrams)??[],i=new Map,l=new Map(((e==null?void 0:e.viewpoints)??[]).map(w=>[w.id,w]));for(const w of s){const S=w.viewpointIds;for(const g of S!=null&&S.length?S:[w.viewpointId]){const h=(b=e==null?void 0:e.viewpoints)==null?void 0:b.find(O=>O.id===g),y=h?g:Ee,B=i.get(y);B?B.items.push(w):i.set(y,{id:y,label:(h==null?void 0:h.label)??"Uncategorized",items:[w]})}}const c=jo([...i.values()].filter(w=>w.id!==Ee).map(w=>({...w,...l.get(w.id)}))),d=Do(c.map(w=>w.label)),u=c.map((w,S)=>({...w,label:d[S],items:[...w.items].sort((g,h)=>g.name.localeCompare(h.name))})),m=i.get(Ee);return m?[...u,{...m,items:[...m.items].sort((w,S)=>w.name.localeCompare(S.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:f.muted,fontSize:T.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:f.primary,margin:"0 0 4px"},children:"Viewpoints"}),t.jsxs("p",{style:{color:f.muted,fontSize:T.sm,margin:0},children:[o," model ",o===1?"view":"views"," across ",n.length," ",n.length===1?"viewpoint":"viewpoints"]})]}),t.jsx(No,{size:132})]}),o===0&&t.jsx("p",{style:{color:f.muted,fontSize:T.sm},children:"This model defines no model views yet."}),n.map(s=>t.jsxs("section",{style:{marginBottom:"28px"},children:[t.jsxs("h2",{style:{fontSize:"11px",fontWeight:700,color:f.muted,textTransform:"uppercase",letterSpacing:"0.06em",margin:"0 0 10px 0"},children:[s.label,t.jsx("code",{style:{marginLeft:8,color:f.faint,textTransform:"none"},children:s.id===Ee?"no viewpoint":s.id}),t.jsx("span",{style:{marginLeft:8,fontWeight:400},children:s.items.length})]}),t.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(220px, 1fr))",gap:"12px"},children:s.items.map(i=>t.jsx(jc,{diagram:i,onClick:()=>r(Eo(i.diagramType,i.shortId??i.id))},i.id))})]},s.id))]})}function jc({diagram:e,onClick:r}){var c;const n=e.viewKind?Vn[e.viewKind]:void 0,o=qe[e.diagramType],a=n??o,s=(n==null?void 0:n.label)??(o==null?void 0:o.code),i=(a==null?void 0:a.color)??"#6B7280",l=((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:f.surface,border:`1px solid ${f.border}`,borderRadius:"10px",padding:"14px 16px",cursor:"pointer",transition:"box-shadow 0.15s",borderTop:`3px solid ${i}`},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:i+"18",color:i,borderRadius:4,padding:"1px 5px",fontSize:"10px",fontWeight:700},children:s}),e.auto&&t.jsx("span",{style:{fontSize:"10px",color:f.muted},children:"auto"})]}),t.jsx("div",{style:{fontWeight:600,fontSize:"14px",color:f.primary,marginBottom:4},children:e.name}),t.jsx("div",{style:{fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",fontSize:"10px",color:f.faint,marginBottom:4},children:e.shortId??e.id}),t.jsxs("div",{style:{fontSize:"11px",color:f.muted,lineHeight:1.5},children:[(a==null?void 0:a.fullName)??e.diagramType,l>0&&` · ${l} element${l===1?"":"s"}`]})]})}function Dc({family:e}){const r=E(c=>c.model),n=ke(),[o,a]=p.useState(""),s=p.useMemo(()=>r?Object.values(r.elements).filter(c=>{const d=c.shortId??"";return d.startsWith(e+"-")||d.startsWith(e+" ")}):[],[r,e]),i=p.useMemo(()=>{if(!o.trim())return s;const c=o.toLowerCase();return s.filter(d=>d.name.toLowerCase().includes(c)||(d.shortId??"").toLowerCase().includes(c)||d.kind.toLowerCase().includes(c))},[s,o]),l=p.useMemo(()=>{const c={};for(const d of s)c[d.kind]=(c[d.kind]??0)+1;return c},[s]);return r?s.length===0?t.jsx(gn,{family:e,children:t.jsxs("p",{style:{color:f.muted,fontSize:T.sm},children:["No elements found with family prefix ",t.jsx("code",{children:e}),"."]})}):t.jsxs(gn,{family:e,children:[t.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px",marginBottom:"16px"},children:Object.entries(l).map(([c,d])=>{const u=ce[c]??"#9CA3AF";return t.jsxs("span",{style:{fontSize:T.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 ${s.length} elements…`,value:o,onChange:c=>a(c.target.value),style:{width:"100%",boxSizing:"border-box",padding:"7px 12px",fontSize:T.sm,border:`1px solid ${f.border}`,borderRadius:"6px",background:f.surface,color:f.primary,outline:"none",marginBottom:"12px"}}),t.jsxs("div",{style:{background:f.surface,border:`1px solid ${f.border}`,borderRadius:"8px",overflow:"hidden"},children:[t.jsxs("div",{style:{display:"grid",gridTemplateColumns:"140px 1fr 120px 120px",padding:"8px 16px",background:f.surfaceAlt,borderBottom:`1px solid ${f.border}`,fontSize:T.xs,fontWeight:600,color:f.muted,gap:"12px"},children:[t.jsx("span",{children:"ID"}),t.jsx("span",{children:"Name"}),t.jsx("span",{children:"Kind"}),t.jsx("span",{children:"Layer"})]}),i.length===0?t.jsxs("div",{style:{padding:"24px 16px",color:f.muted,fontSize:T.sm,textAlign:"center"},children:['No results for "',o,'"']}):i.map((c,d)=>t.jsx(Bc,{element:c,zebra:d%2===1,onClick:()=>n(So(c.shortId??c.id))},c.id))]}),t.jsxs("p",{style:{color:f.faint,fontSize:"11px",marginTop:"8px"},children:[i.length," of ",s.length," elements shown"]})]}):t.jsx(gn,{family:e,children:t.jsx("p",{style:{color:f.muted,fontSize:T.sm},children:"Loading model…"})})}function Bc({element:e,zebra:r,onClick:n}){const o=ce[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":f.surface,cursor:"pointer",borderBottom:`1px solid ${f.borderLight}`,alignItems:"center",transition:"background 0.1s"},onMouseEnter:a=>a.currentTarget.style.background="#F0FDF4",onMouseLeave:a=>a.currentTarget.style.background=r?"#FAFAF8":f.surface,children:[t.jsx("code",{style:{fontSize:"11px",color:"#2DD4A8",fontWeight:600,fontFamily:"monospace"},children:e.shortId??e.id}),t.jsx("span",{style:{fontSize:T.sm,color:f.primary,fontWeight:500,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.name}),t.jsx("span",{style:{fontSize:T.xs,color:f.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 gn({family:e,children:r}){const n=ke();return t.jsxs("div",{style:{flex:1,overflow:"auto",background:"#F7F7F5",padding:"32px 40px"},children:[t.jsxs("nav",{style:{fontSize:T.xs,color:f.muted,marginBottom:"20px"},children:[t.jsx("button",{onClick:()=>n("/catalog"),style:{background:"none",border:"none",color:"#2DD4A8",cursor:"pointer",padding:0,fontSize:T.xs},children:"Catalog"})," / ",t.jsx("span",{style:{color:f.primary,fontWeight:600},children:e})]}),t.jsx("h1",{style:{fontSize:"20px",fontWeight:700,color:f.primary,marginBottom:"6px",marginTop:0},children:e}),r]})}const Fc=p.lazy(()=>de(()=>import("./DiagramEditor-D6CT8dNm.js"),__vite__mapDeps([3,1,2,4])).then(e=>({default:e.DiagramEditor}))),Ac=p.lazy(()=>de(()=>import("./DSMView-V3iNMXFW.js").then(e=>e.D),__vite__mapDeps([5,1,2,4])).then(e=>({default:e.DSMView}))),Nc=p.lazy(()=>de(()=>import("./OntologyViewer-Cx5WU_uI.js"),__vite__mapDeps([6,1,2])).then(e=>({default:e.OntologyViewer}))),Tc=p.lazy(()=>de(()=>import("./TraceabilityMatrix-DGny6KvJ.js"),__vite__mapDeps([7,1,2,5,4])).then(e=>({default:e.TraceabilityMatrix}))),Rc=p.lazy(()=>de(()=>import("./ScenarioEditor-B_M819qh.js"),__vite__mapDeps([0,1,2])).then(e=>({default:e.ScenarioEditor}))),Ic=p.lazy(()=>de(()=>import("./ModelDiff-CNpUtYV1.js"),__vite__mapDeps([8,1,2])).then(e=>({default:e.ModelDiff}))),Mc=p.lazy(()=>de(()=>import("./ComplianceWizard-DqeyOz4M.js"),__vite__mapDeps([9,1,2])).then(e=>({default:e.ComplianceWizard}))),_c=p.lazy(()=>de(()=>import("./StatisticsDashboard-DDsFeIAZ.js"),__vite__mapDeps([10,1,2])).then(e=>({default:e.StatisticsDashboard}))),Pc=p.lazy(()=>de(()=>import("./DhfDashboard-K1p89I1a.js"),__vite__mapDeps([11,1,2])).then(e=>({default:e.DhfDashboard}))),Oc=p.lazy(()=>de(()=>import("./DhfWorkbench-BqS0Z41-.js"),__vite__mapDeps([12,1,2])).then(e=>({default:e.DhfWorkbench}))),zc=p.lazy(()=>de(()=>import("./AiWorkspace-DABn1bcB.js"),__vite__mapDeps([13,1,2])).then(e=>({default:e.AiWorkspace}))),To=p.lazy(()=>de(()=>import("./ElementDetailView-D1ydy4ml.js"),__vite__mapDeps([14,1,2])).then(e=>({default:e.ElementDetailView}))),xe=p.lazy(()=>de(()=>import("./Dashboard-BQj09cZH.js"),__vite__mapDeps([15,1,2])).then(e=>({default:e.Dashboard}))),Uc=p.lazy(()=>de(()=>import("./ReviewDashboard-B6tw6wBJ.js"),__vite__mapDeps([16,1,2])).then(e=>({default:e.ReviewDashboard}))),Lc=p.lazy(()=>de(()=>import("./WorkflowWizard-D9NwvOlw.js"),__vite__mapDeps([17,1,2])).then(e=>({default:e.WorkflowWizard}))),qc=p.lazy(()=>de(()=>import("./TabularView-kcWhQVcI.js"),__vite__mapDeps([18,1,2])).then(e=>({default:e.TabularView}))),$c=p.lazy(()=>de(()=>import("./ImportView-RFKKNv71.js"),__vite__mapDeps([19,1,2])).then(e=>({default:e.ImportView}))),Vc=p.lazy(()=>de(()=>import("./AnalysisWorkspace-B8CYPLNe.js"),__vite__mapDeps([20,1,2])).then(e=>({default:e.AnalysisWorkspace}))),Wc=p.lazy(()=>de(()=>import("./UiScreensWorkspace-BpIx67i-.js"),__vite__mapDeps([21,1,2,22,4])).then(e=>({default:e.UiScreensWorkspace})));function We(){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),s=E(c=>c.setActiveMode),i=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"&&s("diagram"),i("views"))}},[e,n,r,o,a,s,i]);const l=()=>{switch(e.type){case"diagram":return t.jsx(Fc,{diagramId:e.diagramId});case"dsm":return t.jsx(Ac,{});case"traceability":return ue("analysis")?t.jsx(Tc,{}):t.jsx(xe,{});case"tabular":return t.jsx(qc,{});case"ontology":case"ontology-detail":return ue("ontology")?t.jsx(Nc,{}):t.jsx(xe,{});case"scenario-editor":return t.jsx(Rc,{});case"model-diff":return ue("model-tools")?t.jsx(Ic,{}):t.jsx(xe,{});case"compliance-wizard":return ue("model-tools")?t.jsx(Mc,{}):t.jsx(xe,{});case"statistics":return ue("model-tools")?t.jsx(_c,{}):t.jsx(xe,{});case"dhf-dashboard":case"dhf-document":return t.jsx(Oc,{});case"dhf-dashboard-legacy":return t.jsx(Pc,{});case"ai":case"ask":case"sysml-generator":return ue("ai-tools")?t.jsx(zc,{}):t.jsx(xe,{});case"element-detail":return t.jsx(To,{});case"dashboard":return t.jsx(xe,{});case"review-dashboard":return ue("model-tools")?t.jsx(Uc,{}):t.jsx(xe,{});case"workflow-wizard":return ue("model-tools")?t.jsx(Lc,{}):t.jsx(xe,{});case"import":return ue("import")?t.jsx($c,{}):t.jsx(xe,{});case"analysis":return ue("analysis")?t.jsx(Vc,{}):t.jsx(xe,{});case"ui-screens":return t.jsx(Wc,{});case"welcome":default:return t.jsx(Mr,{})}};return(e.type==="welcome"||e.type==="dashboard")&&e.type==="welcome"?t.jsx(Mr,{}):t.jsx(p.Suspense,{fallback:t.jsx(Ro,{}),children:l()})}function Ro(){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 zt="linear-gradient(135deg, #EEF7F3 0%, #EAF2F8 55%, #F2EEF8 100%)";function Mr(){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,s=e?Object.keys(e.elements).length:0,i=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 l(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:zt,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."}),s>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:s})," 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,")"]})]}),i.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:i.map(d=>t.jsxs("button",{onClick:()=>l(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 Hc(){const e=E(u=>u.connected),r=E(u=>u.model),n=E(u=>u.activeView),o=E(u=>u.selectedElementIds),{pathname:a}=De(),s=a.startsWith("/catalog"),i=E(u=>u.activeMode),l=E(u=>u.toggleGapBar);p.useEffect(()=>{const u=m=>{(m.metaKey||m.ctrlKey)&&m.shiftKey&&m.key==="P"&&(m.preventDefault(),l())};return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[l]);const c=n.type!=="dsm"&&n.type!=="traceability"&&n.type!=="dashboard"&&n.type!=="ai"&&n.type!=="ask"&&n.type!=="sysml-generator"&&n.type!=="analysis"&&n.type!=="ui-screens";p.useEffect(()=>{qs()||lo()},[]);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:zt,color:"#1a1a1a"},children:[t.jsx(Ft,{}),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(Jc,{}),t.jsx(Ft,{}),t.jsx(Ai,{}),t.jsx(yc,{}),t.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[c&&t.jsx(Nd,{}),t.jsx("div",{className:"flex-1 flex flex-col",style:{minWidth:0},children:t.jsxs(Ia,{children:[t.jsx(be,{path:"/catalog",element:t.jsx(Sc,{})}),t.jsx(be,{path:"/catalog/:family",element:t.jsx(Kc,{})}),t.jsx(be,{path:"/catalog/:family/:shortId",element:t.jsx(Gc,{})}),t.jsx(be,{path:"/diagrams",element:t.jsx(Cc,{})}),t.jsx(be,{path:"/diagrams/:diagramType/:diagramId",element:t.jsx(Yc,{})}),gi().map(u=>t.jsx(be,{path:u,element:t.jsx(We,{})},u)),t.jsx(be,{path:"/ontology/:packageName",element:t.jsx(We,{})}),t.jsx(be,{path:"/ontology/:packageName/:layerId",element:t.jsx(We,{})}),t.jsx(be,{path:"/dhf/:docId",element:t.jsx(We,{})}),t.jsx(be,{path:"*",element:t.jsx(We,{})})]})}),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"&&!s&&i!=="dhf"&&i!=="ontology"&&(o.size>=2?t.jsx(cc,{}):t.jsx(ic,{}))]}),t.jsx(uc,{}),t.jsx(pc,{}),t.jsx(fc,{}),t.jsx(gc,{}),t.jsx(xc,{}),t.jsx(wc,{}),t.jsx(bc,{})]}):t.jsxs("div",{className:"flex flex-col h-screen",style:{background:zt,color:"#1a1a1a"},children:[t.jsx(Ft,{}),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:zt,color:"#1a1a1a"},children:[t.jsx(Ft,{}),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 Kc(){const{family:e=""}=Tn();return t.jsx(Dc,{family:e.toUpperCase()})}function Gc(){const{shortId:e=""}=Tn(),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(s=>(s.shortId??s.id)===e);a&&(o(a.id),n({type:"element-detail",elementId:a.id}))},[e,r,n,o]),t.jsx(p.Suspense,{fallback:t.jsx(Ro,{}),children:t.jsx(To,{})})}function Yc(){const{diagramId:e=""}=Tn(),r=E(a=>a.model),n=E(a=>a.selectDiagram),o=E(a=>a.setActiveView);return p.useEffect(()=>{var s;if(!r)return;const a=(s=r.diagrams)==null?void 0:s.find(i=>{var l;return i.id===e||i.id.toLowerCase()===e.toLowerCase()||((l=i.shortId)==null?void 0:l.toLowerCase())===e.toLowerCase()});a&&(n(a.id),o({type:"diagram",diagramId:a.id}))},[e,r,n,o]),t.jsx(We,{})}function Jc(){const e=E(b=>b.activeView),r=E(b=>b.model),n=E(b=>b.setActiveView),o=E(b=>b.setActiveMode),a=E(b=>b.selectedElementId),s=ke(),i=De(),l=ba(),c=p.useRef(!1),d=p.useRef(!1),[u,m]=p.useState(null);return p.useEffect(()=>{const b=!c.current;if(c.current=!0,!b&&l!=="POP")return;const w=fi(i.pathname,i.search);if(i.pathname==="/diagrams"&&(o("diagram"),E.getState().setExplorerTab("views"),E.getState().sidebarCollapsed&&E.getState().toggleSidebar(),e.type!=="welcome"&&(d.current=!0,n({type:"welcome"}))),(w==null?void 0:w.type)==="scenario-editor"&&o("scenario"),w&&JSON.stringify(w)!==JSON.stringify(e)&&(d.current=!0,n(w)),w&&w.type!=="element-detail"&&w.type!=="welcome"){const g=new URLSearchParams(i.search).get("element");g?m(g):E.getState().selectedElementId&&E.getState().inspectElement(null)}},[i.pathname,i.search,l]),p.useEffect(()=>{var b;if(u&&r){const w=((b=Object.values(r.elements).find(S=>(S.shortId??S.id)===u))==null?void 0:b.id)??u;w!==E.getState().selectedElementId&&E.getState().inspectElement(w),m(null)}},[u,r]),p.useEffect(()=>{var w;if(!c.current)return;if(d.current){d.current=!1;return}if(e.type==="welcome"&&i.pathname!=="/"||hi(i.pathname)&&!(e.type==="diagram"||e.type==="element-detail")||yi(i.pathname))return;let b=null;if(e.type==="element-detail"&&r){const S=r.elements[e.elementId];if(S){const g=S.shortId??S.id;b=`/catalog/${g.split("-")[0]}/${g}`}}else if(e.type==="diagram"&&r){const S=(w=r.diagrams)==null?void 0:w.find(g=>g.id===e.diagramId);S&&(b=`/diagrams/${pi(S.diagramType)}/${encodeURIComponent(S.shortId??S.id)}`)}else b=mi(e);if(b&&e.type!=="element-detail"&&e.type!=="welcome"&&a){const S=r==null?void 0:r.elements[a],g=(S==null?void 0:S.shortId)??a,h=b.includes("?")?"&":"?";b+=`${h}element=${encodeURIComponent(g)}`}if(b&&i.pathname+i.search!==b){const g=b.split("?")[0]===i.pathname;s(b,{replace:g})}},[e,r,a]),null}const Xc=window.location.protocol==="file:"?as:os;Po.createRoot(document.getElementById("root")).render(t.jsx(p.StrictMode,{children:t.jsx(Xc,{children:t.jsx(Hc,{})})}));export{eu as $,pu as A,Cu as B,f as C,qe as D,Gi as E,T as F,ot as G,Gd as H,ac as I,Eu as J,Su as K,Oe as L,No as M,ke as N,nu as O,Vd as P,lu as Q,Fr as R,ki as S,Jt as T,nn as U,tu as V,Mi as W,gu as X,ku as Y,yu as Z,de as _,hu as a,io as a0,Vn as a1,su as a2,iu as a3,xu as a4,au as b,ru as c,ti as d,fu as e,Xe as f,Yt as g,ce as h,mo as i,Ge as j,vo as k,ou as l,Ii as m,bu as n,vu as o,li as p,Dt as q,wu as r,ci as s,Cn as t,E as u,_i as v,mu as w,uu as x,du as y,cu as z};
|
|
4066
|
+
req_001,System shall be safe,Requirement,Safety requirement`,rows:10,style:{...xn,resize:"vertical",fontFamily:"monospace",fontSize:"12px",lineHeight:"1.5"}}),w&&t.jsx("p",{style:{fontSize:I.xs,color:"#E74C3C",marginTop:4},children:w})]}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("span",{style:{fontSize:I.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:I.xs,color:"#374151"},children:["Browse…",t.jsx("input",{type:"file",accept:".csv,.tsv,.txt",style:{display:"none"},onChange:U})]}),c&&t.jsxs("span",{style:{fontSize:I.xs,color:"#6B7280"},children:[c.split(`
|
|
4067
|
+
`).length," line(s) loaded"]})]})]}),i==="mapping"&&t.jsxs("div",{className:"flex flex-col gap-3",children:[t.jsxs("p",{style:{fontSize:I.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:I.xs,fontWeight:600,color:"#374151"},children:"Source column"}),t.jsx("span",{style:{flex:1,fontSize:I.xs,fontWeight:600,color:"#374151"},children:"Maps to"}),t.jsx("span",{style:{width:80,fontSize:I.xs,fontWeight:600,color:"#374151"},children:"Transform"})]}),D.map((x,P)=>{const q=["id","name","kind"].includes(x.targetAttribute),X=!x.targetAttribute,ie=D.filter((R,H)=>H!==P&&["id","name","kind","doc","construct"].includes(R.targetAttribute)).map(R=>R.targetAttribute),oe=_r.filter(R=>R==="— skip —"||!ie.includes(R)||R===x.targetAttribute);return t.jsxs("div",{className:"flex items-center",style:{padding:"6px 12px",borderBottom:P<D.length-1?"1px solid #F0F0EC":"none",background:q?"#F0FDF4":"transparent"},children:[t.jsx("div",{style:{flex:1,fontSize:I.xs,color:"#374151",fontFamily:"monospace"},children:x.sourceColumn}),t.jsx("div",{style:{flex:1,paddingRight:8},children:t.jsxs("select",{value:x.targetAttribute||"",onChange:R=>Y(P,R.target.value==="— skip —"?"":R.target.value),style:{width:"100%",fontSize:I.xs,padding:"3px 6px",borderRadius:5,border:`1px solid ${X?"#E5E5E0":q?"#22C55E":"#E5E5E0"}`,background:X?"#F9FAFB":"#FFFFFF",color:X?"#9CA3AF":"#1a1a1a"},children:[oe.map(R=>t.jsx("option",{value:R,children:R},R)),x.targetAttribute&&!_r.includes(x.targetAttribute)&&t.jsx("option",{value:x.targetAttribute,children:x.targetAttribute})]})}),t.jsx("div",{style:{width:80,fontSize:"10px",color:"#9CA3AF"},children:x.transform??"—"})]},P)})]}),B.length>0&&t.jsxs("details",{children:[t.jsxs("summary",{style:{fontSize:I.xs,color:"#6B7280",cursor:"pointer",marginTop:4},children:["Show raw data sample (",Math.min(B.length,3)," of ",B.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(x=>t.jsx("th",{style:We,children:x},x))})}),t.jsx("tbody",{children:B.slice(0,3).map((x,P)=>t.jsx("tr",{children:h.map(q=>t.jsx("td",{style:ct,children:x[q]??""},q))},P))})]})})]})]}),i==="preview"&&t.jsxs("div",{className:"flex flex-col gap-4",children:[k.length>0&&t.jsxs("div",{style:{background:"#FEF2F2",border:"1px solid #FECACA",borderRadius:8,padding:"10px 14px"},children:[t.jsxs("p",{style:{fontSize:I.xs,fontWeight:700,color:"#DC2626",margin:"0 0 4px"},children:[k.length," validation error(s) — rows with missing required fields will be skipped"]}),k.slice(0,5).map((x,P)=>t.jsx("p",{style:{fontSize:"11px",color:"#DC2626",margin:"1px 0"},children:x},P)),k.length>5&&t.jsxs("p",{style:{fontSize:"11px",color:"#DC2626",margin:"2px 0 0"},children:["+",k.length-5," more…"]})]}),z.length>0&&t.jsxs("div",{style:{background:"#FFFBEB",border:"1px solid #FDE68A",borderRadius:8,padding:"10px 14px"},children:[t.jsxs("p",{style:{fontSize:I.xs,fontWeight:700,color:"#D97706",margin:"0 0 4px"},children:[z.length," warning(s)"]}),z.slice(0,3).map((x,P)=>t.jsx("p",{style:{fontSize:"11px",color:"#D97706",margin:"1px 0"},children:x},P))]}),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:I.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((x,P)=>t.jsx("p",{style:{fontSize:"11px",color:"#DC2626",margin:"1px 0"},children:x},P)),n.warnings.slice(0,3).map((x,P)=>t.jsx("p",{style:{fontSize:"11px",color:"#D97706",margin:"1px 0"},children:x},P))]}),F.length>0&&t.jsxs(t.Fragment,{children:[t.jsxs("p",{style:{fontSize:I.xs,color:"#6B7280",margin:0},children:["Showing first ",F.length," of ",B.length," row(s)",B.length>F.length&&` (+${B.length-F.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:We,children:"#"}),t.jsx("th",{style:We,children:"id"}),t.jsx("th",{style:We,children:"name"}),t.jsx("th",{style:We,children:"kind"}),t.jsx("th",{style:We,children:"doc"})]})}),t.jsx("tbody",{children:F.map(x=>{const P=!x.id||!x.name||!x.kind;return t.jsxs("tr",{style:{background:P?"#FEF9F9":"transparent"},children:[t.jsx("td",{style:Or,children:x.rowIndex}),t.jsx("td",{style:{...Or,color:x.id?"#1a1a1a":"#DC2626"},children:x.id||"⚠ missing"}),t.jsx("td",{style:{...ct,maxWidth:160,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:String(x.name||"—")}),t.jsx("td",{style:{...ct,color:x.kind?"#1B3A4B":"#DC2626"},children:x.kind||"⚠ missing"}),t.jsx("td",{style:{...ct,maxWidth:180,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:"#6B7280"},children:String(x.doc||"—")})]},x.rowIndex)})})]})})]}),F.length===0&&k.length===0&&t.jsx("p",{style:{fontSize:I.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:i!=="input"&&!n&&t.jsx("button",{onClick:()=>l(ee[M-1]),style:Pr,children:"← Back"})}),t.jsxs("div",{className:"flex gap-2 items-center",children:[t.jsx("button",{onClick:V,style:Pr,children:n!=null&&n.success?"Done":"Cancel"}),!n&&t.jsxs(t.Fragment,{children:[i==="input"&&t.jsx("button",{onClick:$,style:bn,children:"Next →"}),i==="mapping"&&t.jsx("button",{onClick:K,style:bn,children:"Preview →"}),i==="preview"&&t.jsx("button",{onClick:J,disabled:E||F.length===0,style:{...bn,opacity:E||F.length===0?.5:1,cursor:E||F.length===0?"not-allowed":"pointer"},children:E?"Importing…":`Import ${B.length} element(s)`})]})]})]})]})})}const gn={display:"block",fontSize:I.xs,fontWeight:600,color:"#374151",marginBottom:6},xn={width:"100%",padding:"7px 10px",borderRadius:8,border:"1px solid #E5E5E0",fontSize:I.sm,color:"#1a1a1a",background:"#FAFAF8",boxSizing:"border-box"},Ec={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"},bn={padding:"7px 18px",borderRadius:8,background:"#1B3A4B",border:"none",color:"#FFFFFF",fontSize:I.xs,fontWeight:600,cursor:"pointer"},Pr={padding:"7px 14px",borderRadius:8,background:"transparent",border:"1px solid #E5E5E0",color:"#374151",fontSize:I.xs,cursor:"pointer"},We={padding:"5px 8px",textAlign:"left",fontWeight:600,fontSize:"10px",color:"#6B7280",borderBottom:"1px solid #E5E5E0",whiteSpace:"nowrap"},ct={padding:"4px 8px",fontSize:"11px",color:"#1a1a1a",borderBottom:"1px solid #F5F5F2"},Or={...ct,fontFamily:"monospace",fontSize:"10px",color:"#6B7280"};function jc(){var u,m,b;const e=S(v=>v.activeView),r=S(v=>v.model),n=S(v=>v.selectedElementId),o=S(v=>v.activeMode),a=S(v=>v.setActiveMode),s=S(v=>v.selectElement),i=S(v=>v.setActiveView),l=Ce(),c=[],d=(()=>{switch(e.type){case"diagram":return;case"element-detail":return{label:"Model Explorer",icon:"☰",onClick:()=>{a("catalog"),i({type:"welcome"}),l("/catalog")}};case"dsm":return{label:"DSM Analysis",icon:"▦",onClick:()=>{i({type:"dsm"}),l("/dsm")}};case"traceability":return{label:"Traceability Matrix",icon:"☷",onClick:()=>{i({type:"traceability"}),l("/traceability")}};case"ontology":case"ontology-detail":return{label:"Ontology Explorer",icon:"◉",onClick:()=>{i({type:"ontology"}),l("/ontology")}};case"scenario-editor":return{label:"Use Cases",icon:"▶",onClick:()=>{a("scenario"),i({type:"scenario-editor"}),l("/use-cases")}};case"dhf-dashboard":case"dhf-dashboard-legacy":case"dhf-document":return{label:"Documents",icon:"⊞",onClick:()=>{a("dhf"),i({type:"dhf-dashboard"}),l("/dhf")}};case"welcome":return o==="diagram"?{label:"Viewpoints",icon:"⊟",onClick:()=>l("/diagrams")}:o==="catalog"?{label:"Model Explorer",icon:"☰",onClick:()=>l("/catalog")}:void 0;default:return}})();switch(e.type){case"diagram":{const v=Qt(r,e.diagramId);if(v){const w=v.viewpointId==="__model"?"Unassigned Views":((m=(u=r==null?void 0:r.viewpoints)==null?void 0:u.find(N=>N.id===v.viewpointId))==null?void 0:m.label)||v.viewpointId,g=(b=r==null?void 0:r.viewpoints)==null?void 0:b.find(N=>N.id===v.viewpointId);c.push({label:g?`${g.id} · ${w}`:w});const h=v.viewKind?Kn[v.viewKind]:void 0,y=$e[v.diagramType],B=(h==null?void 0:h.label)??(y==null?void 0:y.code)??v.diagramType;c.push({label:`${v.shortId??v.id} · ${B}: ${v.name}`})}break}case"element-detail":{const v=e.elementId,w=r==null?void 0:r.elements[v];if(w){const g=w.shortId??w.id,h=g.split("-")[0];c.push({label:"Catalog",onClick:()=>l("/catalog")}),c.push({label:h,onClick:()=>l(`/catalog/${h}`)}),c.push({label:`${g} ${w.name}`})}break}}if(n&&r&&e.type!=="element-detail"){const v=r.elements[n];v&&c.push({label:v.name,onClick:()=>s(v.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((v,w)=>t.jsxs("span",{className:"flex items-center gap-1",children:[(d||w>0)&&t.jsx("span",{className:"text-xs",style:{color:"#D1D5DB"},children:"/"}),v.onClick?t.jsx("button",{className:"text-xs px-1 py-0.5 rounded transition-colors",style:{color:"#374151"},onMouseEnter:g=>g.currentTarget.style.background="#F0F0ED",onMouseLeave:g=>g.currentTarget.style.background="transparent",onClick:v.onClick,children:v.label}):t.jsx("span",{className:"text-xs",style:{color:w===c.length-1?"#374151":"#9CA3AF"},children:v.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 zr="memo-onboarding-completed",it=[{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 Dc(){const[e,r]=p.useState(!1),[n,o]=p.useState(0);p.useEffect(()=>{try{if(!localStorage.getItem(zr)){const b=setTimeout(()=>r(!0),800);return()=>clearTimeout(b)}}catch{}},[]);const a=p.useCallback(()=>{r(!1);try{localStorage.setItem(zr,"true")}catch{}},[]),s=p.useCallback(()=>{n>=it.length-1?a():o(n+1)},[n,a]),i=p.useCallback(()=>{n>0&&o(n-1)},[n]);if(!e)return null;const l=it[n],c=n===it.length-1,d=n===0,u=()=>{switch(l.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:m=>m.stopPropagation(),children:[t.jsx("div",{className:"flex items-center gap-1 mb-3",children:it.map((m,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:l.title}),t.jsx("p",{className:"text-xs leading-relaxed mb-4",style:{color:"#6B7280"},children:l.description}),t.jsxs("div",{className:"flex items-center gap-2",children:[!d&&t.jsx("button",{onClick:i,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:s,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 ",it.length]})]})]})}function Bc(){const e=S(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 Fc(){const e=S(s=>s.editConflict),r=S(s=>s.setEditConflict);if(!e)return null;const n=e.reason==="stale-identity",o=JSON.stringify(e.rejectedDraft,null,2),a=()=>{const s=URL.createObjectURL(new Blob([o],{type:"application/json"})),i=document.createElement("a");i.href=s,i.download=`rejected-edit-${e.rejectedCommandId}.json`,i.click(),URL.revokeObjectURL(s)};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:()=>si(e.sourceFile),children:"Reveal file"}),t.jsx("button",{onClick:()=>r(null),children:"Dismiss"})]})]})}const Ac=20;function Nc(){const e=S(u=>u.sourceCoherence),[r,n]=p.useState(!1);if(!e)return null;const{files:o,diagnostics:a,lastGoodRevision:s}=e,i=a.slice(0,Ac),l=a.length-i.length,c=a.length||o.length,d=`${c} source ${c===1?"error":"errors"} — showing the last model that compiled`;return t.jsxs("div",{style:{position:"fixed",bottom:16,left:"50%",transform:"translateX(-50%)",zIndex:9e3,display:"flex",flexDirection:"column",alignItems:"center",gap:8},children:[r&&t.jsxs("div",{style:{maxWidth:620,width:"calc(100vw - 32px)",maxHeight:"40vh",overflowY:"auto",background:"#1E293B",border:"1px solid #EF4444",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:"#FCA5A5",marginBottom:4},children:s>0?`Showing the last model that compiled (revision ${s})`:"Showing everything that parsed"}),t.jsxs("div",{style:{fontSize:"0.75rem",color:"#CBD5E1",marginBottom:i.length?8:0},children:[o.length===1?o[0]:`${o.length} files`," did not parse. Edits are held until the source compiles again — no restart needed."]}),i.map((u,m)=>t.jsxs("div",{style:{fontSize:"0.7rem",color:"#94A3B8",fontFamily:"monospace",lineHeight:1.5},children:[u.file,u.line!==void 0?`:${u.line}`:"",u.column!==void 0?`:${u.column}`:""," — ",u.message]},`${u.file}:${u.line??0}:${m}`)),l>0&&t.jsxs("div",{style:{fontSize:"0.7rem",color:"#64748B",marginTop:4},children:["and ",l," more"]})]}),t.jsxs("button",{type:"button",role:"status","aria-live":"polite","aria-expanded":r,"aria-label":d,title:d,onClick:()=>n(u=>!u),style:{display:"flex",alignItems:"center",gap:6,background:"#7F1D1D",border:"1px solid #EF4444",borderRadius:999,padding:"6px 12px",color:"#FEE2E2",cursor:"pointer",fontSize:"0.75rem",fontWeight:600,boxShadow:"0 6px 18px rgba(0,0,0,0.35)"},children:[t.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[t.jsx("circle",{cx:"12",cy:"12",r:"9",stroke:"#FCA5A5",strokeWidth:"2"}),t.jsx("path",{d:"M12 7v6",stroke:"#FCA5A5",strokeWidth:"2",strokeLinecap:"round"}),t.jsx("circle",{cx:"12",cy:"16.5",r:"1.1",fill:"#FCA5A5"})]}),c]})]})}function _o({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 Tc(e){return Le[e]?Le[e]:e?e.split(/[_-]/).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join(" "):"Other"}function Rc(){const e=S(s=>s.model),r=Ce(),n=p.useMemo(()=>{if(!e)return[];const s={};for(const c of Object.values(e.elements)){const d=pd(c.kind),u=md(d);s[u]||(s[u]={count:0,kinds:new Set,layer:c.layer}),s[u].count++,s[u].kinds.add(c.kind)}const i=new Map;for(const c of Object.entries(s)){const d=c[1].layer;i.has(d)||i.set(d,[]),i.get(d).push(c)}for(const c of i.values())c.sort((d,u)=>u[1].count-d[1].count);const l=new Map(Te.map((c,d)=>[c,d]));return[...i.entries()].sort(([c],[d])=>{const u=l.get(c)??Te.length,m=l.get(d)??Te.length;return u!==m?u-m:c.localeCompare(d)})},[e]),o=p.useMemo(()=>n.flatMap(([,s])=>s),[n]);if(!e)return t.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",background:"#F7F7F5"},children:t.jsx("p",{style:{color:f.muted,fontSize:I.sm},children:"Loading…"})});const a=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:f.primary,margin:"0 0 4px"},children:"Catalog"}),t.jsxs("p",{style:{color:f.muted,fontSize:I.sm,margin:0},children:[a," elements across ",o.length," families"]})]}),t.jsx(_o,{size:132})]}),n.map(([s,i])=>{const l=ce[s]??"#9CA3AF";return t.jsxs("div",{style:{marginBottom:"28px"},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"12px"},children:[t.jsx("span",{style:{width:"8px",height:"8px",borderRadius:"50%",background:l,flexShrink:0}}),t.jsx("h2",{style:{fontSize:"13px",fontWeight:700,color:f.secondary,textTransform:"uppercase",letterSpacing:"0.04em",margin:0},children:Tc(s)})]}),t.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(200px, 1fr))",gap:"12px"},children:i.map(([c,d])=>t.jsx(Ic,{family:c,count:d.count,kinds:d.kinds,color:l,onClick:()=>r(fd(c))},c))})]},s||"__none")})]})}function Ic({family:e,count:r,kinds:n,color:o,onClick:a}){return t.jsxs("div",{onClick:a,style:{background:f.surface,border:`1px solid ${f.border}`,borderRadius:"10px",padding:"16px",cursor:"pointer",transition:"box-shadow 0.15s, border-color 0.15s",borderTop:`3px solid ${o}`},onMouseEnter:s=>{s.currentTarget.style.boxShadow="0 4px 12px rgba(0,0,0,0.08)",s.currentTarget.style.borderTopColor=o},onMouseLeave:s=>{s.currentTarget.style.boxShadow="none"},children:[t.jsx("div",{style:{fontWeight:700,fontSize:"15px",color:f.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:f.muted,lineHeight:"1.5"},children:[Array.from(n).slice(0,3).join(", "),n.size>3&&` +${n.size-3} more`]})]})}function Mc(){var a;const e=S(s=>s.model),r=Ce(),n=p.useMemo(()=>{var B;const s=(e==null?void 0:e.diagrams)??[],i=new Map,l=new Map(((e==null?void 0:e.viewpoints)??[]).map(N=>[N.id,N]));for(const N of s){const D=N.viewpointIds;for(const A of D!=null&&D.length?D:[N.viewpointId]){const F=(B=e==null?void 0:e.viewpoints)==null?void 0:B.find(T=>T.id===A),C=F?A:Ne,k=i.get(C);k?k.items.push(N):i.set(C,{id:C,label:(F==null?void 0:F.label)??"Uncategorized",items:[N]})}}const c=Ao([...l.values()]),{rootViewpoints:d,viewpointChildren:u}=To(c),m=[],b=(N,D,A)=>{if(!A.has(N.id)){A.add(N.id),m.push({viewpoint:N,depth:D});for(const F of u.get(N.id)??[])b(F,D+1,A)}},v=new Set;for(const N of d)b(N,0,v);const w=No(m.map(N=>N.viewpoint.label)),g=N=>{var D;return(((D=i.get(N))==null?void 0:D.items.length)??0)>0||(u.get(N)??[]).some(A=>g(A.id))},h=m.map((N,D)=>{var A;return{...i.get(N.viewpoint.id)??{id:N.viewpoint.id,label:N.viewpoint.label,items:[]},...N.viewpoint,label:w[D],depth:N.depth,childCount:(u.get(N.viewpoint.id)??[]).length,items:[...((A=i.get(N.viewpoint.id))==null?void 0:A.items)??[]].sort((F,C)=>F.name.localeCompare(C.name))}}).filter(N=>g(N.id)),y=i.get(Ne);return y?[...h,{...y,depth:0,childCount:0,items:[...y.items].sort((N,D)=>N.name.localeCompare(D.name))}]:h},[e]);if(!e)return t.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",background:"#F7F7F5"},children:t.jsx("p",{style:{color:f.muted,fontSize:I.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:f.primary,margin:"0 0 4px"},children:"Viewpoints"}),t.jsxs("p",{style:{color:f.muted,fontSize:I.sm,margin:0},children:[o," model ",o===1?"view":"views"," across ",n.length," ",n.length===1?"viewpoint":"viewpoints"]})]}),t.jsx(_o,{size:132})]}),o===0&&t.jsx("p",{style:{color:f.muted,fontSize:I.sm},children:"This model defines no model views yet."}),n.map(s=>t.jsxs("section",{style:{marginBottom:"28px",marginLeft:s.depth?`${s.depth*20}px`:0,paddingLeft:s.depth?"14px":0,borderLeft:s.depth?`2px solid ${f.border}`:"none"},children:[t.jsxs("h2",{style:{fontSize:"11px",fontWeight:700,color:f.muted,textTransform:"uppercase",letterSpacing:"0.06em",margin:"0 0 10px 0"},children:[s.label,t.jsx("code",{style:{marginLeft:8,color:f.faint,textTransform:"none"},children:s.id===Ne?"no viewpoint":s.id}),t.jsx("span",{style:{marginLeft:8,fontWeight:400},children:s.items.length}),s.childCount>0&&t.jsxs("span",{style:{marginLeft:8,fontWeight:400,textTransform:"none",color:f.faint},children:["frames ",s.childCount," ",s.childCount===1?"viewpoint":"viewpoints"]})]}),s.items.length===0?t.jsx("p",{style:{color:f.faint,fontSize:I.sm,margin:"0 0 4px"},children:"No views of its own — the viewpoints it frames are below."}):t.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(220px, 1fr))",gap:"12px"},children:s.items.map(i=>t.jsx(_c,{diagram:i,onClick:()=>r(Fo(i.diagramType,i.shortId??i.id))},i.id))})]},s.id))]})}function _c({diagram:e,onClick:r}){var c;const n=e.viewKind?Kn[e.viewKind]:void 0,o=$e[e.diagramType],a=n??o,s=(n==null?void 0:n.label)??(o==null?void 0:o.code),i=(a==null?void 0:a.color)??"#6B7280",l=((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:f.surface,border:`1px solid ${f.border}`,borderRadius:"10px",padding:"14px 16px",cursor:"pointer",transition:"box-shadow 0.15s",borderTop:`3px solid ${i}`},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:i+"18",color:i,borderRadius:4,padding:"1px 5px",fontSize:"10px",fontWeight:700},children:s}),e.auto&&t.jsx("span",{style:{fontSize:"10px",color:f.muted},children:"auto"})]}),t.jsx("div",{style:{fontWeight:600,fontSize:"14px",color:f.primary,marginBottom:4},children:e.name}),t.jsx("div",{style:{fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",fontSize:"10px",color:f.faint,marginBottom:4},children:e.shortId??e.id}),t.jsxs("div",{style:{fontSize:"11px",color:f.muted,lineHeight:1.5},children:[(a==null?void 0:a.fullName)??e.diagramType,l>0&&` · ${l} element${l===1?"":"s"}`]})]})}function Pc({family:e}){const r=S(c=>c.model),n=Ce(),[o,a]=p.useState(""),s=p.useMemo(()=>r?Object.values(r.elements).filter(c=>{const d=c.shortId??"";return d.startsWith(e+"-")||d.startsWith(e+" ")}):[],[r,e]),i=p.useMemo(()=>{if(!o.trim())return s;const c=o.toLowerCase();return s.filter(d=>d.name.toLowerCase().includes(c)||(d.shortId??"").toLowerCase().includes(c)||d.kind.toLowerCase().includes(c))},[s,o]),l=p.useMemo(()=>{const c={};for(const d of s)c[d.kind]=(c[d.kind]??0)+1;return c},[s]);return r?s.length===0?t.jsx(vn,{family:e,children:t.jsxs("p",{style:{color:f.muted,fontSize:I.sm},children:["No elements found with family prefix ",t.jsx("code",{children:e}),"."]})}):t.jsxs(vn,{family:e,children:[t.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px",marginBottom:"16px"},children:Object.entries(l).map(([c,d])=>{const u=ce[c]??"#9CA3AF";return t.jsxs("span",{style:{fontSize:I.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 ${s.length} elements…`,value:o,onChange:c=>a(c.target.value),style:{width:"100%",boxSizing:"border-box",padding:"7px 12px",fontSize:I.sm,border:`1px solid ${f.border}`,borderRadius:"6px",background:f.surface,color:f.primary,outline:"none",marginBottom:"12px"}}),t.jsxs("div",{style:{background:f.surface,border:`1px solid ${f.border}`,borderRadius:"8px",overflow:"hidden"},children:[t.jsxs("div",{style:{display:"grid",gridTemplateColumns:"140px 1fr 120px 120px",padding:"8px 16px",background:f.surfaceAlt,borderBottom:`1px solid ${f.border}`,fontSize:I.xs,fontWeight:600,color:f.muted,gap:"12px"},children:[t.jsx("span",{children:"ID"}),t.jsx("span",{children:"Name"}),t.jsx("span",{children:"Kind"}),t.jsx("span",{children:"Layer"})]}),i.length===0?t.jsxs("div",{style:{padding:"24px 16px",color:f.muted,fontSize:I.sm,textAlign:"center"},children:['No results for "',o,'"']}):i.map((c,d)=>t.jsx(Oc,{element:c,zebra:d%2===1,onClick:()=>n(Bo(c.shortId??c.id))},c.id))]}),t.jsxs("p",{style:{color:f.faint,fontSize:"11px",marginTop:"8px"},children:[i.length," of ",s.length," elements shown"]})]}):t.jsx(vn,{family:e,children:t.jsx("p",{style:{color:f.muted,fontSize:I.sm},children:"Loading model…"})})}function Oc({element:e,zebra:r,onClick:n}){const o=ce[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":f.surface,cursor:"pointer",borderBottom:`1px solid ${f.borderLight}`,alignItems:"center",transition:"background 0.1s"},onMouseEnter:a=>a.currentTarget.style.background="#F0FDF4",onMouseLeave:a=>a.currentTarget.style.background=r?"#FAFAF8":f.surface,children:[t.jsx("code",{style:{fontSize:"11px",color:"#2DD4A8",fontWeight:600,fontFamily:"monospace"},children:e.shortId??e.id}),t.jsx("span",{style:{fontSize:I.sm,color:f.primary,fontWeight:500,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.name}),t.jsx("span",{style:{fontSize:I.xs,color:f.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 vn({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:I.xs,color:f.muted,marginBottom:"20px"},children:[t.jsx("button",{onClick:()=>n("/catalog"),style:{background:"none",border:"none",color:"#2DD4A8",cursor:"pointer",padding:0,fontSize:I.xs},children:"Catalog"})," / ",t.jsx("span",{style:{color:f.primary,fontWeight:600},children:e})]}),t.jsx("h1",{style:{fontSize:"20px",fontWeight:700,color:f.primary,marginBottom:"6px",marginTop:0},children:e}),r]})}const zc=p.lazy(()=>de(()=>import("./DiagramEditor-icnDwdxM.js"),__vite__mapDeps([3,1,2,4])).then(e=>({default:e.DiagramEditor}))),Uc=p.lazy(()=>de(()=>import("./DSMView-BsjhUbpW.js").then(e=>e.D),__vite__mapDeps([5,1,2,4])).then(e=>({default:e.DSMView}))),Lc=p.lazy(()=>de(()=>import("./OntologyViewer-0BJ2jMZ8.js"),__vite__mapDeps([6,1,2])).then(e=>({default:e.OntologyViewer}))),qc=p.lazy(()=>de(()=>import("./TraceabilityMatrix-DDoHYsCP.js"),__vite__mapDeps([7,1,2,5,4])).then(e=>({default:e.TraceabilityMatrix}))),$c=p.lazy(()=>de(()=>import("./ScenarioEditor-CiHaTvVY.js"),__vite__mapDeps([0,1,2])).then(e=>({default:e.ScenarioEditor}))),Vc=p.lazy(()=>de(()=>import("./ModelDiff-H5nxOavB.js"),__vite__mapDeps([8,1,2])).then(e=>({default:e.ModelDiff}))),Wc=p.lazy(()=>de(()=>import("./ComplianceWizard-CYBizPbC.js"),__vite__mapDeps([9,1,2])).then(e=>({default:e.ComplianceWizard}))),Hc=p.lazy(()=>de(()=>import("./StatisticsDashboard-w2dtCD94.js"),__vite__mapDeps([10,1,2])).then(e=>({default:e.StatisticsDashboard}))),Kc=p.lazy(()=>de(()=>import("./DhfDashboard-BdhBA4OL.js"),__vite__mapDeps([11,1,2])).then(e=>({default:e.DhfDashboard}))),Gc=p.lazy(()=>de(()=>import("./DhfWorkbench-tnIpEFmu.js"),__vite__mapDeps([12,1,2])).then(e=>({default:e.DhfWorkbench}))),Yc=p.lazy(()=>de(()=>import("./AiWorkspace-GFHs046m.js"),__vite__mapDeps([13,1,2])).then(e=>({default:e.AiWorkspace}))),Po=p.lazy(()=>de(()=>import("./ElementDetailView-Crpltlrz.js"),__vite__mapDeps([14,1,2])).then(e=>({default:e.ElementDetailView}))),xe=p.lazy(()=>de(()=>import("./Dashboard-rdbfFJYx.js"),__vite__mapDeps([15,1,2])).then(e=>({default:e.Dashboard}))),Jc=p.lazy(()=>de(()=>import("./ReviewDashboard-Dl-YTC4_.js"),__vite__mapDeps([16,1,2])).then(e=>({default:e.ReviewDashboard}))),Xc=p.lazy(()=>de(()=>import("./WorkflowWizard-Br1zPSLC.js"),__vite__mapDeps([17,1,2])).then(e=>({default:e.WorkflowWizard}))),Qc=p.lazy(()=>de(()=>import("./TabularView-CFy0PK1L.js"),__vite__mapDeps([18,1,2])).then(e=>({default:e.TabularView}))),Zc=p.lazy(()=>de(()=>import("./ImportView-1vrZ1CGB.js"),__vite__mapDeps([19,1,2])).then(e=>({default:e.ImportView}))),eu=p.lazy(()=>de(()=>import("./AnalysisWorkspace-BfZ4GYza.js"),__vite__mapDeps([20,1,2])).then(e=>({default:e.AnalysisWorkspace}))),tu=p.lazy(()=>de(()=>import("./UiScreensWorkspace-DOxjCMG9.js"),__vite__mapDeps([21,1,2,22,4])).then(e=>({default:e.UiScreensWorkspace})));function He(){const e=S(c=>c.activeView),r=S(c=>c.model),n=S(c=>c.activeMode);S(c=>c.selectedViewpointId);const o=S(c=>c.selectedDiagramId),a=S(c=>c.selectDiagram),s=S(c=>c.setActiveMode),i=S(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"&&s("diagram"),i("views"))}},[e,n,r,o,a,s,i]);const l=()=>{switch(e.type){case"diagram":return t.jsx(zc,{diagramId:e.diagramId});case"dsm":return t.jsx(Uc,{});case"traceability":return ue("analysis")?t.jsx(qc,{}):t.jsx(xe,{});case"tabular":return t.jsx(Qc,{});case"ontology":case"ontology-detail":return ue("ontology")?t.jsx(Lc,{}):t.jsx(xe,{});case"scenario-editor":return t.jsx($c,{});case"model-diff":return ue("model-tools")?t.jsx(Vc,{}):t.jsx(xe,{});case"compliance-wizard":return ue("model-tools")?t.jsx(Wc,{}):t.jsx(xe,{});case"statistics":return ue("model-tools")?t.jsx(Hc,{}):t.jsx(xe,{});case"dhf-dashboard":case"dhf-document":return t.jsx(Gc,{});case"dhf-dashboard-legacy":return t.jsx(Kc,{});case"ai":case"ask":case"sysml-generator":return ue("ai-tools")?t.jsx(Yc,{}):t.jsx(xe,{});case"element-detail":return t.jsx(Po,{});case"dashboard":return t.jsx(xe,{});case"review-dashboard":return ue("model-tools")?t.jsx(Jc,{}):t.jsx(xe,{});case"workflow-wizard":return ue("model-tools")?t.jsx(Xc,{}):t.jsx(xe,{});case"import":return ue("import")?t.jsx(Zc,{}):t.jsx(xe,{});case"analysis":return ue("analysis")?t.jsx(eu,{}):t.jsx(xe,{});case"ui-screens":return t.jsx(tu,{});case"welcome":default:return t.jsx(Ur,{})}};return(e.type==="welcome"||e.type==="dashboard")&&e.type==="welcome"?t.jsx(Ur,{}):t.jsx(p.Suspense,{fallback:t.jsx(Oo,{}),children:l()})}function Oo(){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 Lt="linear-gradient(135deg, #EEF7F3 0%, #EAF2F8 55%, #F2EEF8 100%)";function Ur(){var c;const e=S(d=>d.model),r=S(d=>d.setActiveView),n=S(d=>d.selectElement),o=S(d=>d.setExplorerTab),a=((c=e==null?void 0:e.diagrams)==null?void 0:c.length)??0,s=e?Object.keys(e.elements).length:0,i=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 l(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:Lt,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."}),s>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:s})," 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,")"]})]}),i.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:i.map(d=>t.jsxs("button",{onClick:()=>l(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 nu(){const e=S(u=>u.connected),r=S(u=>u.model),n=S(u=>u.activeView),o=S(u=>u.selectedElementIds),{pathname:a}=Be(),s=a.startsWith("/catalog"),i=S(u=>u.activeMode),l=S(u=>u.toggleGapBar);p.useEffect(()=>{const u=m=>{(m.metaKey||m.ctrlKey)&&m.shiftKey&&m.key==="P"&&(m.preventDefault(),l())};return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[l]);const c=n.type!=="dsm"&&n.type!=="traceability"&&n.type!=="dashboard"&&n.type!=="ai"&&n.type!=="ask"&&n.type!=="sysml-generator"&&n.type!=="analysis"&&n.type!=="ui-screens";p.useEffect(()=>{Ks()||fo()},[]);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:Lt,color:"#1a1a1a"},children:[t.jsx(At,{}),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(su,{}),t.jsx(At,{}),t.jsx(Mi,{}),t.jsx(jc,{}),t.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[c&&t.jsx(Ld,{}),t.jsx("div",{className:"flex-1 flex flex-col",style:{minWidth:0},children:t.jsxs(za,{children:[t.jsx(be,{path:"/catalog",element:t.jsx(Rc,{})}),t.jsx(be,{path:"/catalog/:family",element:t.jsx(ru,{})}),t.jsx(be,{path:"/catalog/:family/:shortId",element:t.jsx(ou,{})}),t.jsx(be,{path:"/diagrams",element:t.jsx(Mc,{})}),t.jsx(be,{path:"/diagrams/:diagramType/:diagramId",element:t.jsx(au,{})}),ki().map(u=>t.jsx(be,{path:u,element:t.jsx(He,{})},u)),t.jsx(be,{path:"/ontology/:packageName",element:t.jsx(He,{})}),t.jsx(be,{path:"/ontology/:packageName/:layerId",element:t.jsx(He,{})}),t.jsx(be,{path:"/dhf/:docId",element:t.jsx(He,{})}),t.jsx(be,{path:"*",element:t.jsx(He,{})})]})}),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"&&!s&&i!=="dhf"&&i!=="ontology"&&(o.size>=2?t.jsx(vc,{}):t.jsx(gc,{}))]}),t.jsx(wc,{}),t.jsx(kc,{}),t.jsx(Cc,{}),t.jsx(Dc,{}),t.jsx(Bc,{}),t.jsx(Nc,{}),t.jsx(Fc,{})]}):t.jsxs("div",{className:"flex flex-col h-screen",style:{background:Lt,color:"#1a1a1a"},children:[t.jsx(At,{}),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:Lt,color:"#1a1a1a"},children:[t.jsx(At,{}),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 ru(){const{family:e=""}=Rn();return t.jsx(Pc,{family:e.toUpperCase()})}function ou(){const{shortId:e=""}=Rn(),r=S(a=>a.model),n=S(a=>a.setActiveView),o=S(a=>a.selectElement);return p.useEffect(()=>{if(!r)return;const a=Object.values(r.elements).find(s=>(s.shortId??s.id)===e);a&&(o(a.id),n({type:"element-detail",elementId:a.id}))},[e,r,n,o]),t.jsx(p.Suspense,{fallback:t.jsx(Oo,{}),children:t.jsx(Po,{})})}function au(){const{diagramId:e=""}=Rn(),r=S(a=>a.model),n=S(a=>a.selectDiagram),o=S(a=>a.setActiveView);return p.useEffect(()=>{var s;if(!r)return;const a=(s=r.diagrams)==null?void 0:s.find(i=>{var l;return i.id===e||i.id.toLowerCase()===e.toLowerCase()||((l=i.shortId)==null?void 0:l.toLowerCase())===e.toLowerCase()});a&&(n(a.id),o({type:"diagram",diagramId:a.id}))},[e,r,n,o]),t.jsx(He,{})}function su(){const e=S(b=>b.activeView),r=S(b=>b.model),n=S(b=>b.setActiveView),o=S(b=>b.setActiveMode),a=S(b=>b.selectedElementId),s=Ce(),i=Be(),l=Ca(),c=p.useRef(!1),d=p.useRef(!1),[u,m]=p.useState(null);return p.useEffect(()=>{const b=!c.current;if(c.current=!0,!b&&l!=="POP")return;const v=bi(i.pathname,i.search);if(i.pathname==="/diagrams"&&(o("diagram"),S.getState().setExplorerTab("views"),S.getState().sidebarCollapsed&&S.getState().toggleSidebar(),e.type!=="welcome"&&(d.current=!0,n({type:"welcome"}))),(v==null?void 0:v.type)==="scenario-editor"&&o("scenario"),v&&JSON.stringify(v)!==JSON.stringify(e)&&(d.current=!0,n(v)),v&&v.type!=="element-detail"&&v.type!=="welcome"){const g=new URLSearchParams(i.search).get("element");g?m(g):S.getState().selectedElementId&&S.getState().inspectElement(null)}},[i.pathname,i.search,l]),p.useEffect(()=>{var b;if(u&&r){const v=((b=Object.values(r.elements).find(w=>(w.shortId??w.id)===u))==null?void 0:b.id)??u;v!==S.getState().selectedElementId&&S.getState().inspectElement(v),m(null)}},[u,r]),p.useEffect(()=>{var v;if(!c.current)return;if(d.current){d.current=!1;return}if(e.type==="welcome"&&i.pathname!=="/"||vi(i.pathname)&&!(e.type==="diagram"||e.type==="element-detail")||wi(i.pathname))return;let b=null;if(e.type==="element-detail"&&r){const w=r.elements[e.elementId];if(w){const g=w.shortId??w.id;b=`/catalog/${g.split("-")[0]}/${g}`}}else if(e.type==="diagram"&&r){const w=(v=r.diagrams)==null?void 0:v.find(g=>g.id===e.diagramId);w&&(b=`/diagrams/${gi(w.diagramType)}/${encodeURIComponent(w.shortId??w.id)}`)}else b=xi(e);if(b&&e.type!=="element-detail"&&e.type!=="welcome"&&a){const w=r==null?void 0:r.elements[a],g=(w==null?void 0:w.shortId)??a,h=b.includes("?")?"&":"?";b+=`${h}element=${encodeURIComponent(g)}`}if(b&&i.pathname+i.search!==b){const g=b.split("?")[0]===i.pathname;s(b,{replace:g})}},[e,r,a]),null}const iu=window.location.protocol==="file:"?cs:ds;qo.createRoot(document.getElementById("root")).render(t.jsx(p.StrictMode,{children:t.jsx(iu,{children:t.jsx(nu,{})})}));export{Du as $,ku as A,Mu as B,f as C,$e as D,nl as E,I as F,ot as G,oc as H,hc as I,Iu as J,Ru as K,Te as L,_o as M,Ce as N,pu as O,ec as P,xr as Q,Ir as R,Di as S,Zt as T,gr as U,Li as V,xu as W,an as X,uu as Y,$i as Z,de as _,Eu as a,Tu as a0,ju as a1,cu as a2,mo as a3,Kn as a4,yu as a5,gu as a6,Bu as a7,hu as b,mu as c,si as d,Cu as e,Le as f,Qt as g,ce as h,xo as i,Ye as j,Eo as k,fu as l,qi as m,Fu as n,Au as o,mi as p,Bt as q,Nu as r,hi as s,Ht as t,S as u,Vi as v,Su as w,wu as x,bu as y,vu as z};
|