@likec4/core 1.55.1 → 1.57.0
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/dist/THIRD-PARTY-LICENSES.md +30 -30
- package/dist/_chunks/Builder.view-element.mjs +2 -2
- package/dist/_chunks/LikeC4Model.d.mts +2 -1
- package/dist/_chunks/_types.d.mts +7 -3
- package/dist/_chunks/_types2.d.mts +1 -1
- package/dist/_chunks/assignTagColors.mjs +1 -1
- package/dist/_chunks/index.d.mts +64 -2
- package/dist/_chunks/index3.d.mts +1 -1
- package/dist/_chunks/index4.d.mts +1 -1
- package/dist/_chunks/index5.d.mts +13 -2
- package/dist/_chunks/libs/chroma-js.mjs +15 -0
- package/dist/_chunks/libs/graphology-dag.d.mts +607 -0
- package/dist/_chunks/libs/graphology-dag.mjs +1 -1
- package/dist/_chunks/libs/hast-util-to-html.mjs +1 -1
- package/dist/_chunks/libs/mdast-util-find-and-replace.mjs +1 -1
- package/dist/_chunks/libs/mdast-util-from-markdown.mjs +1 -1
- package/dist/_chunks/libs/mdast-util-gfm.mjs +11 -11
- package/dist/_chunks/libs/mnemonist.d.mts +33 -33
- package/dist/_chunks/libs/mnemonist.mjs +1 -1
- package/dist/_chunks/libs/unified.mjs +1 -1
- package/dist/_chunks/manual-layout.mjs +1 -1
- package/dist/_chunks/mnemonist.d.mts +1 -1
- package/dist/_chunks/model.mjs +4 -4
- package/dist/_chunks/rolldown-runtime.mjs +1 -1
- package/dist/_chunks/types.mjs +1 -1
- package/dist/builder/index.d.mts +2 -8
- package/dist/builder/index.mjs +1 -1
- package/dist/compute-view/index.d.mts +2 -6
- package/dist/compute-view/index.mjs +2 -2
- package/dist/geometry/index.mjs +1 -1
- package/dist/index.d.mts +4 -5
- package/dist/index.mjs +1 -1
- package/dist/model/index.d.mts +0 -5
- package/dist/model/index.mjs +1 -1
- package/dist/styles/index.d.mts +1 -2
- package/dist/styles/index.mjs +1 -1
- package/dist/types/index.d.mts +2 -2
- package/dist/types/index.mjs +1 -1
- package/dist/utils/graphology/index.d.mts +2 -1
- package/dist/utils/graphology/index.mjs +1 -1
- package/dist/utils/index.d.mts +3 -5
- package/dist/utils/index.mjs +1 -1
- package/package.json +10 -10
- package/dist/_chunks/geometry.mjs +0 -1
- package/dist/_chunks/libs/@mantine/colors-generator.mjs +0 -15
- package/dist/_chunks/utils.mjs +0 -1
package/dist/_chunks/model.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime.mjs";import{A as t,E as n,I as r,L as i,N as a,O as o,Q as s,T as c,X as l,c as ee,et as u,i as d,l as te,m as ne,r as f,s as re}from"./libs/remeda.mjs";import{$ as ie,H as ae,O as oe,St as p,Y as m,_t as h,bt as g,ct as se,dt as ce,ft as le,j as ue,mt as de,t as _,ut as fe,vt as v,xt as y,yt as pe}from"./types.mjs";import{$ as b,A as x,B as S,D as me,E as he,F as C,H as ge,I as w,J as _e,L as T,Q as E,R as ve,S as D,U as ye,Y as be,a as O,c as k,h as A,j,k as xe,o as M,q as Se,r as Ce,u as N,y as we,z as Te}from"./utils.mjs";import{t as P}from"./libs/mnemonist.mjs";import{n as Ee,t as De}from"./manual-layout.mjs";var F=class{Aux;id;_literalId;hierarchyLevel;imported;constructor(e,t){this.$model=e,this.$element=t,this.id=this.$element.id,this._literalId=this.$element.id;let[n,r]=de(this.id);n?(this.imported={from:n,fqn:r},this.hierarchyLevel=C(r)):(this.imported=null,this.hierarchyLevel=C(this.id))}get name(){return Te(this.id)}get parent(){return this.$model.parent(this)}get kind(){return this.$element.kind}get shape(){return this.style.shape}get color(){return this.style.color}get icon(){return this.style.icon??null}get tags(){return A(this,Symbol.for(`tags`),()=>d([...this.$element.tags??[],...this.$model.specification.elements[this.$element.kind]?.tags??[]]))}get metadata(){return this.$element.metadata??{}}get title(){return this.$element.title}get hasSummary(){return!!this.$element.summary&&!!this.$element.description&&!t(this.$element.summary,this.$element.description)}get summary(){return _.memoize(this,`summary`,y(this.$element))}get description(){return _.memoize(this,`description`,g(this.$element))}get technology(){return this.$element.technology??null}get links(){return this.$element.links??[]}get defaultView(){return A(this,Symbol.for(`defaultView`),()=>D(this.scopedViews())??null)}get isRoot(){return this.parent===null}get style(){return A(this,`style`,()=>p({shape:this.$model.$styles.defaults.shape,color:this.$model.$styles.defaults.color,border:this.$model.$styles.defaults.border,opacity:this.$model.$styles.defaults.opacity,size:this.$model.$styles.defaults.size,padding:this.$model.$styles.defaults.padding,textSize:this.$model.$styles.defaults.text,iconPosition:this.$model.$styles.defaults.iconPosition,...this.$element.style}))}get projectId(){return this.imported?.from??this.$model.projectId}isAncestorOf(e){return w(this,e)}isDescendantOf(e){return w(e,this)}ancestors(){return this.$model.ancestors(this)}commonAncestor(e){let t=j(this.id,e.id);return t?this.$model.element(t):null}children(){return this.$model.children(this)}descendants(e){return e?ge([...this.$model.descendants(this)],e)[Symbol.iterator]():this.$model.descendants(this)}siblings(){return this.$model.siblings(this)}*ascendingSiblings(){yield*this.siblings();for(let e of this.ancestors())yield*e.siblings()}*descendingSiblings(){for(let e of[...this.ancestors()].reverse())yield*e.siblings();yield*this.siblings()}incoming(e=`all`){return this.$model.incoming(this,e)}*incomers(e=`all`){let t=new Set;for(let n of this.incoming(e))t.has(n.source.id)||(t.add(n.source.id),yield n.source)}outgoing(e=`all`){return this.$model.outgoing(this,e)}*outgoers(e=`all`){let t=new Set;for(let n of this.outgoing(e))t.has(n.target.id)||(t.add(n.target.id),yield n.target)}get allOutgoing(){return A(this,Symbol.for(`allOutgoing`),()=>new Set(this.outgoing()))}get allIncoming(){return A(this,Symbol.for(`allIncoming`),()=>new Set(this.incoming()))}views(){return A(this,Symbol.for(`views`),()=>{let e=new Set;for(let t of this.$model.views())t.includesElement(this.id)&&e.add(t);return e})}scopedViews(){return A(this,Symbol.for(`scopedViews`),()=>{let e=new Set;for(let t of this.$model.views())t.isScopedElementView()&&t.viewOf.id===this.id&&e.add(t);return e})}isDeployed(){return o(D(this.deployments()))}deployments(){return this.$model.deployment.instancesOf(this)}hasMetadata(){return!!this.$element.metadata&&!i(this.$element.metadata)}getMetadata(e){return e?this.$element.metadata?.[e]:this.$element.metadata??{}}isTagged(e){return this.tags.includes(e)}},Oe=class{Aux;get style(){return A(this,`style`,()=>p({shape:this.$model.$styles.defaults.shape,color:this.$model.$styles.defaults.color,border:this.$model.$styles.defaults.border,opacity:this.$model.$styles.defaults.opacity,size:this.$model.$styles.defaults.size,padding:this.$model.$styles.defaults.padding,textSize:this.$model.$styles.defaults.text,iconPosition:this.$model.$styles.defaults.iconPosition,...this.$node.style}))}get name(){return Te(this.id)}get shape(){return this.style.shape}get color(){return this.style.color}get icon(){return this.style.icon??null}get summary(){return _.memoize(this,`summary`,y(this.$node))}get description(){return _.memoize(this,`description`,g(this.$node))}get technology(){return this.$node.technology??null}get links(){return this.$node.links??[]}ancestors(){return this.$model.ancestors(this)}commonAncestor(e){let t=j(this.id,e.id);return t?this.$model.node(t):null}siblings(){return this.$model.siblings(this)}isSibling(e){return this.parent===e.parent}*ascendingSiblings(){yield*this.siblings();for(let e of this.ancestors())yield*e.siblings()}*descendingSiblings(){for(let e of[...this.ancestors()].reverse())yield*e.siblings();yield*this.siblings()}incoming(e=`all`){return this.$model.incoming(this,e)}outgoing(e=`all`){return this.$model.outgoing(this,e)}*incomers(e=`all`){let t=new Set;for(let n of this.incoming(e))t.has(n.source.id)||(t.add(n.source.id),yield n.source)}*outgoers(e=`all`){let t=new Set;for(let n of this.outgoing(e))t.has(n.target.id)||(t.add(n.target.id),yield n.target)}*views(){for(let e of this.$model.views())e._type===`deployment`&&e.includesDeployment(this.id)&&(yield e)}isDeploymentNode(){return!1}isInstance(){return!1}get allOutgoing(){return A(this,Symbol.for(`allOutgoing`),()=>z.from(new Set(this.outgoingModelRelationships()),new Set(this.outgoing())))}get allIncoming(){return A(this,Symbol.for(`allIncoming`),()=>z.from(new Set(this.incomingModelRelationships()),new Set(this.incoming())))}hasMetadata(){return!!this.$node.metadata&&!i(this.$node.metadata)}getMetadata(e){return e?this.$node.metadata?.[e]:this.$node.metadata??{}}isTagged(e){return this.tags.includes(e)}},I=class extends Oe{id;_literalId;title;hierarchyLevel;constructor(e,t){super(),this.$model=e,this.$node=t,this.id=t.id,this._literalId=t.id,this.title=t.title,this.hierarchyLevel=C(t.id)}get parent(){return this.$model.parent(this)}get kind(){return this.$node.kind}get metadata(){return this.$node.metadata??{}}get tags(){return A(this,Symbol.for(`tags`),()=>d([...this.$node.tags??[],...this.$model.$model.specification.deployments[this.kind]?.tags??[]]))}children(){return this.$model.children(this)}descendants(e=`desc`){return this.$model.descendants(this,e)}isDeploymentNode(){return!0}*instances(){for(let e of this.descendants(`desc`))e.isInstance()&&(yield e)}onlyOneInstance(){let e=this.children();if(e.size!==1)return null;let t=D(e);return t?t.isInstance()?t:t.onlyOneInstance():null}_relationshipsFromInstances=null;relationshipsFromInstances(){if(this._relationshipsFromInstances)return this._relationshipsFromInstances;let{outgoing:e,incoming:t}=this._relationshipsFromInstances={outgoing:new Set,incoming:new Set};for(let n of this.instances()){for(let t of n.element.outgoing())e.add(t);for(let e of n.element.incoming())t.add(e)}return this._relationshipsFromInstances}outgoingModelRelationships(){return this.relationshipsFromInstances().outgoing.values()}incomingModelRelationships(){return this.relationshipsFromInstances().incoming.values()}internalModelRelationships(){let{outgoing:e,incoming:t}=this.relationshipsFromInstances();return k(t,e)}},L=class extends Oe{id;_literalId;title;hierarchyLevel;constructor(e,t,n){super(),this.$model=e,this.$instance=t,this.element=n,this.id=t.id,this._literalId=t.id,this.title=t.title??n.title,this.hierarchyLevel=C(t.id)}get $node(){return this.$instance}get parent(){return b(this.$model.parent(this),`Parent of ${this.id} not found`)}get style(){return A(this,`style`,()=>p({shape:this.$model.$styles.defaults.shape,color:this.$model.$styles.defaults.color,border:this.$model.$styles.defaults.border,opacity:this.$model.$styles.defaults.opacity,size:this.$model.$styles.defaults.size,padding:this.$model.$styles.defaults.padding,textSize:this.$model.$styles.defaults.text,iconPosition:this.$model.$styles.defaults.iconPosition,...this.element.$element.style,...this.$instance.style}))}get tags(){return A(this,Symbol.for(`tags`),()=>d([...this.$instance.tags??[],...this.element.tags]))}get kind(){return this.element.kind}get metadata(){return this.$instance.metadata??this.element.metadata??{}}get summary(){return _.memoize(this,`summary`,y(this.$instance)??y(this.element.$element))}get description(){return _.memoize(this,`description`,g(this.$instance)??g(this.element.$element))}get technology(){return this.$instance.technology??this.element.technology??null}get links(){return this.$instance.links??this.element.links}isInstance(){return!0}outgoingModelRelationships(){return this.element.outgoing()}incomingModelRelationships(){return this.element.incoming()}*views(){for(let e of this.$model.views())if(e._type===`deployment`){if(e.includesDeployment(this.id)){yield e;continue}e.includesDeployment(this.parent.id)&&this.parent.onlyOneInstance()&&(yield e)}}},ke=class{constructor(e,t){this.instance=e,this.element=t}get id(){return this.instance.id}get _literalId(){return this.instance.id}get style(){return A(this,`style `,()=>({shape:this.element.shape,color:this.element.color,...this.element.$element.style}))}get shape(){return this.element.shape}get color(){return this.element.color}get title(){return this.element.title}get summary(){return this.element.summary}get description(){return this.element.description}get technology(){return this.element.technology}isDeploymentNode(){return!1}isInstance(){return!1}},R=class{boundary;source;target;constructor(e,t){this.$model=e,this.$relationship=t,this.source=e.deploymentRef(t.source),this.target=e.deploymentRef(t.target);let n=j(this.source.id,this.target.id);this.boundary=n?this.$model.node(n):null}get id(){return this.$relationship.id}get expression(){return`${this.source.id} -> ${this.target.id}`}get title(){return o(this.$relationship.title)?this.$relationship.title:null}get technology(){return r(this.$relationship.technology)?(this.kind&&this.$model.specification.relationships[this.kind])?.technology??null:this.$relationship.technology}get hasSummary(){return!!this.$relationship.summary&&!!this.$relationship.description&&!t(this.$relationship.summary,this.$relationship.description)}get summary(){return _.memoize(this,`summary`,y(this.$relationship))}get description(){return _.memoize(this,`description`,g(this.$relationship))}get tags(){return this.$relationship.tags??[]}get kind(){return this.$relationship.kind??null}get metadata(){return this.$relationship.metadata??{}}get navigateTo(){return this.$relationship.navigateTo?this.$model.$model.view(this.$relationship.navigateTo):null}get links(){return this.$relationship.links??[]}get color(){return this.$relationship.color??this.$model.$styles.defaults.relationship.color}get line(){return this.$relationship.line??this.$model.$styles.defaults.relationship.line}get head(){return this.$relationship.head??this.$model.$styles.defaults.relationship.arrow}get tail(){return this.$relationship.tail}*views(){for(let e of this.$model.views())e.includesRelation(this.id)&&(yield e)}isDeploymentRelation(){return!0}isModelRelation(){return!1}hasMetadata(){return!!this.$relationship.metadata&&!i(this.$relationship.metadata)}getMetadata(e){return e?this.$relationship.metadata?.[e]:this.$relationship.metadata??{}}isTagged(e){return this.tags.includes(e)}},z=class e{static empty(){return new e}static from(t,n){return new e(new Set(t),new Set(n))}constructor(e=new Set,t=new Set){this.model=e,this.deployment=t}get isEmpty(){return this.model.size===0&&this.deployment.size===0}get nonEmpty(){return this.model.size>0||this.deployment.size>0}get size(){return this.model.size+this.deployment.size}intersect(t){return e.from(k(this.model,t.model),k(this.deployment,t.deployment))}difference(t){return e.from(O(this.model,t.model),O(this.deployment,t.deployment))}union(t){return e.from(N(this.model,t.model),N(this.deployment,t.deployment))}};const B=e=>typeof e==`string`?e:e.id,Ae=`/`,V=e=>{if(E(!e.includes(`
|
|
2
|
-
`),`View title cannot contain newlines`),e.includes(`/`)){let t=e.split(`/`).map(e=>e.trim()).filter(e=>e.length>0);return s(t,1)?t:[``]}return[e.trim()]},H=e=>V(e).join(`/`),je=e=>{let t=V(e);return s(t,2)?t.slice(0,-1).join(`/`):null},Me=e=>e.includes(`/`)?V(e).pop()??e:e.trim();var Ne=class{#e=new Map;#t=new Map;#n=new P.default(()=>new Set);#r=new P.default(()=>new Set);#i=new Set;#a=new Map;#o=new P.default(()=>new Set);#s=new P.default(()=>new Set);#c=new P.default(()=>new Set);#l=new P.default(()=>new Set);#u=new Map;$deployments;constructor(e){this.$model=e;let t=this.$deployments=e.$data.deployments,n=f(t.elements);for(let e of ye(n)){let t=this.addElement(e);for(let e of t.tags)this.#l.get(e).add(t);t.isInstance()&&this.#r.get(t.element.id).add(t)}for(let e of f(t.relations)){let t=this.addRelation(e);for(let e of t.tags)this.#l.get(e).add(t)}}get $styles(){return this.$model.$styles}get projectId(){return this.$model.projectId}get project(){return this.$model.project}get specification(){return this.$model.specification}element(e){if(e instanceof I||e instanceof L)return e;let t=B(e);return b(this.#e.get(t),`Element ${t} not found`)}findElement(e){return this.#e.get(e)??null}node(e){let t=this.element(e);return E(t.isDeploymentNode(),`Element ${t.id} is not a deployment node`),t}findNode(e){let t=this.findElement(e);return t?(E(t.isDeploymentNode(),`Element ${t?.id} is not a deployment node`),t):null}instance(e){let t=this.element(e);return E(t.isInstance(),`Element ${t.id} is not a deployed instance`),t}findInstance(e){let t=this.findElement(e);return t?(E(t.isInstance(),`Element ${t?.id} is not a deployed instance`),t):null}roots(){return this.#i.values()}elements(){return this.#e.values()}*nodes(){for(let e of this.#e.values())e.isDeploymentNode()&&(yield e)}*nodesOfKind(e){for(let t of this.#e.values())t.isDeploymentNode()&&t.kind===e&&(yield t)}*instances(){for(let e of this.#e.values())e.isInstance()&&(yield e)}*instancesOf(e){let t=B(e),n=this.#r.get(t);n&&(yield*n)}deploymentRef(e){if(m.isInsideInstanceRef(e)){let{deployment:t,element:n}=e;return xe(this.#u,`${t}@${n}`,()=>new ke(this.instance(t),this.$model.element(n)))}return this.element(e.deployment)}relationships(){return this.#a.values()}relationship(e){let t=B(e);return b(this.#a.get(t),`DeploymentRelationModel ${t} not found`)}findRelationship(e){return this.#a.get(e)??null}*views(){for(let e of this.$model.views())e.isDeploymentView()&&(yield e)}parent(e){let t=B(e);return this.#t.get(t)||null}children(e){let t=B(e);return this.#n.get(t)}*siblings(e){let t=B(e),n=this.parent(e)?.children()??this.roots();for(let e of n)e.id!==t&&(yield e)}*ancestors(e){let t=B(e),n;for(;n=this.#t.get(t);)yield n,t=n.id}*descendants(e,t=`desc`){for(let n of this.children(e))t===`asc`?(yield n,yield*this.descendants(n.id)):(yield*this.descendants(n.id),yield n)}*incoming(e,t=`all`){let n=B(e);for(let e of this.#o.get(n))switch(!0){case t===`all`:case t===`direct`&&e.target.id===n:case t===`to-descendants`&&e.target.id!==n:yield e;break}}*outgoing(e,t=`all`){let n=B(e);for(let e of this.#s.get(n))switch(!0){case t===`all`:case t===`direct`&&e.source.id===n:case t===`from-descendants`&&e.source.id!==n:yield e;break}}addElement(e){if(this.#e.has(e.id))throw Error(`Element ${e.id} already exists`);let t=ae(e)?new I(this,Object.freeze(e)):new L(this,Object.freeze(e),this.$model.element(e.element));this.#e.set(t.id,t);let n=S(t.id);return n?(E(this.#e.has(n),`Parent ${n} of ${t.id} not found`),this.#t.set(t.id,this.node(n)),this.#n.get(n).add(t)):(E(t.isDeploymentNode(),`Root element ${t.id} is not a deployment node`),this.#i.add(t)),t}addRelation(e){if(this.#a.has(e.id))throw Error(`Relation ${e.id} already exists`);let t=new R(this,Object.freeze(e));this.#a.set(t.id,t),this.#o.get(t.target.id).add(t),this.#s.get(t.source.id).add(t);let n=t.boundary?.id??null;if(n)for(let e of[n,...x(n)])this.#c.get(e).add(t);for(let e of x(t.source.id)){if(e===n)break;this.#s.get(e).add(t)}for(let e of x(t.target.id)){if(e===n)break;this.#o.get(e).add(t)}return t}},U=class{source;target;boundary;constructor(e,t){this.model=e,this.$relationship=t,this.source=e.element(m.flatten(t.source)),this.target=e.element(m.flatten(t.target));let n=j(this.source.id,this.target.id);this.boundary=n?this.model.element(n):null}get id(){return this.$relationship.id}get expression(){return`${this.source.id} -> ${this.target.id}`}get title(){return r(this.$relationship.title)?null:this.$relationship.title}get technology(){return r(this.$relationship.technology)?(this.kind&&this.model.specification.relationships[this.kind])?.technology??null:this.$relationship.technology}get hasSummary(){return!!this.$relationship.summary&&!!this.$relationship.description&&!t(this.$relationship.summary,this.$relationship.description)}get summary(){return _.memoize(this,`summary`,y(this.$relationship))}get description(){return _.memoize(this,`description`,g(this.$relationship))}get navigateTo(){return this.$relationship.navigateTo?this.model.view(this.$relationship.navigateTo):null}get tags(){return this.$relationship.tags??[]}get kind(){return this.$relationship.kind??null}get metadata(){return this.$relationship.metadata??{}}get links(){return this.$relationship.links??[]}get color(){return this.$relationship.color??this.model.$styles.defaults.relationship.color}get line(){return this.$relationship.line??this.model.$styles.defaults.relationship.line}get head(){return this.$relationship.head??this.model.$styles.defaults.relationship.arrow}get tail(){return this.$relationship.tail}*views(){for(let e of this.model.views())e.includesRelation(this.id)&&(yield e)}isDeploymentRelation(){return!1}isModelRelation(){return!0}hasMetadata(){return!!this.$relationship.metadata&&!i(this.$relationship.metadata)}getMetadata(e){return e?this.$relationship.metadata?.[e]:this.$relationship.metadata??{}}isTagged(e){return this.tags.includes(e)}},W=class{Aux;$viewModel;$view;$edge;constructor(e,t,n,r){this.source=n,this.target=r,this.$viewModel=e,this.$view=e.$view,this.$edge=t}get id(){return this.$edge.id}get parent(){return this.$edge.parent?this.$viewModel.node(this.$edge.parent):null}get label(){return this.$edge.label??null}get description(){return _.memoize(this,`description`,this.$edge.description)}get technology(){return this.$edge.technology??null}hasParent(){return this.$edge.parent!==null}get tags(){return this.$edge.tags??[]}get stepNumber(){return this.isStep()?se(this.id):null}get navigateTo(){return this.$edge.navigateTo?this.$viewModel.$model.view(this.$edge.navigateTo):null}get color(){return this.$edge.color}get line(){return this.$edge.line??this.$viewModel.$styles.defaults.relationship.line}get head(){return this.$edge.head??this.$viewModel.$styles.defaults.relationship.arrow}get tail(){return this.$edge.tail}isStep(){return le(this.id)}*relationships(e){for(let t of this.$edge.relations)if(e){let n=this.$viewModel.$model.findRelationship(t,e);n&&(yield n)}else yield this.$viewModel.$model.relationship(t)}includesRelation(e){let t=typeof e==`string`?e:e.id;return this.$edge.relations.includes(t)}isTagged(e){return this.tags.includes(e)}},G=class{Aux;$viewModel;$view;$node;constructor(e,t){this.$viewModel=e,this.$view=e.$view,this.$node=t}get id(){return this.$node.id}get title(){return this.$node.title}get kind(){return this.$node.kind}get description(){return _.memoize(this,`description`,this.$node.description)}get technology(){return this.$node.technology??null}get notes(){return _.memoize(this,`notes`,this.$node.notes)}get parent(){return this.$node.parent?this.$viewModel.node(this.$node.parent):null}get element(){let e=this.$node.modelRef;return e?this.$viewModel.$model.element(e):null}get deployment(){let e=this.$node.deploymentRef;return e?this.$viewModel.$model.deployment.element(e):null}get shape(){return this.$node.shape}get color(){return this.$node.color}get icon(){return this.$node.icon??null}get tags(){return this.$node.tags}get links(){return this.$node.links??[]}get navigateTo(){return this.$node.navigateTo?this.$viewModel.$model.view(this.$node.navigateTo):null}get style(){return this.$node.style}get x(){return`x`in this.$node?this.$node.x:void 0}get y(){return`y`in this.$node?this.$node.y:void 0}get width(){return`width`in this.$node?this.$node.width:void 0}get height(){return`height`in this.$node?this.$node.height:void 0}children(){return A(this,`children`,()=>new Set(this.$node.children.map(e=>this.$viewModel.node(e))))}*ancestors(){let e=this.parent;for(;e;)yield e,e=e.parent}*siblings(){let e=this.parent?.children()??this.$viewModel.roots();for(let t of e)t.id!==this.id&&(yield t)}*incoming(e=`all`){for(let t of this.$node.inEdges){let n=this.$viewModel.edge(t);switch(!0){case e===`all`:case e===`direct`&&n.target.id===this.id:case e===`to-descendants`&&n.target.id!==this.id:yield n;break}}}*incomers(e=`all`){let t=new Set;for(let n of this.incoming(e))t.has(n.source.id)||(t.add(n.source.id),yield n.source)}*outgoing(e=`all`){for(let t of this.$node.outEdges){let n=this.$viewModel.edge(t);switch(!0){case e===`all`:case e===`direct`&&n.source.id===this.id:case e===`from-descendants`&&n.source.id!==this.id:yield n;break}}}*outgoers(e=`all`){let t=new Set;for(let n of this.outgoing(e))t.has(n.target.id)||(t.add(n.target.id),yield n.target)}isLayouted(){return`width`in this.$node&&`height`in this.$node}hasChildren(){return this.$node.children.length>0}hasParent(){return this.$node.parent!==null}hasElement(){return o(this.$node.modelRef)}hasDeployment(){return o(this.$node.deploymentRef)}hasDeployedInstance(){return this.hasElement()&&this.hasDeployment()}isGroup(){return ce(this.$node)}isTagged(e){return this.tags.includes(e)}},K=class{Aux;#e;#t=new Set;#n=new Map;#r=new Map;#i=new Set;#a=new Set;#o=new Set;#s=new P.default(e=>new Set);#c;id;$model;title;folder;viewPath;constructor(e,t,n,r){this.$model=e,this.#e=n,this.id=n.id,this.folder=t,this.#c=r;for(let e of this.#e.nodes){let t=new G(this,Object.freeze(e));this.#n.set(e.id,t),e.parent||this.#t.add(t),e.deploymentRef&&this.#a.add(e.deploymentRef),e.modelRef&&this.#i.add(e.modelRef);for(let e of t.tags)this.#s.get(e).add(t)}for(let e of this.#e.edges){let t=new W(this,Object.freeze(e),this.node(e.source),this.node(e.target));for(let e of t.tags)this.#s.get(e).add(t);for(let t of e.relations)this.#o.add(t);this.#r.set(e.id,t)}this.title=n.title?Me(n.title):null,this.viewPath=n.title?H(n.title):n.id}get $styles(){return this.$model.$styles}get _type(){return this.#e[v]}get stage(){return this.#e[h]}get bounds(){if(`bounds`in this.#e)return this.#e.bounds;if(this.#c)return this.#c.bounds;throw Error(`View is not layouted`)}get titleOrId(){return this.title??this.viewOf?.title??this.id}get titleOrUntitled(){return this.title??`Untitled`}get breadcrumbs(){return A(this,`breadcrumbs`,()=>this.folder.isRoot?[this]:[...this.folder.breadcrumbs,this])}get description(){return _.memoize(this,`description`,this.#e.description)}get tags(){return this.#e.tags??[]}get links(){return this.#e.links??[]}get viewOf(){if(this.isElementView()){let e=this.#e.viewOf;return e?this.$model.element(e):null}return null}get mode(){return this.isDynamicView()?this.#e.variant??`diagram`:null}get includedTags(){return[...this.#s.keys()]}get $view(){if(!this.isLayouted()||`drifts`in this.#e)return this.#e;let e=this.#c;return e?A(this,`withDriftReasons`,()=>De(this.#e,e)):this.#e}get $layouted(){if(!this.isLayouted())throw Error(`View is not layouted`);return this.$manual??this.#e}get hasManualLayout(){return this.#c!==void 0}get hasLayoutDrifts(){if(!this.isLayouted())return!1;let e=this.$manual;return!!e?.drifts&&e.drifts.length>0}get $manual(){if(!this.isLayouted())return null;let e=this.#c;return e?this.#e._layout===`manual`?this.#e:A(this,`snapshotWithManualLayout`,()=>Ee(this.#e,e)):null}get projectId(){return this.$model.projectId}roots(){return this.#t.values()}*compounds(){for(let e of this.#n.values())e.hasChildren()&&(yield e)}node(e){let t=B(e);return b(this.#n.get(t),`Node ${t} not found in view ${this.#e.id}`)}findNode(e){return this.#n.get(B(e))??null}findNodeWithElement(e){let t=B(e);return this.#i.has(t)?he(this.#n.values(),e=>e.hasElement()&&e.element.id===t)??null:null}nodes(){return this.#n.values()}edge(e){let t=B(e);return b(this.#r.get(t),`Edge ${t} not found in view ${this.#e.id}`)}findEdge(e){return this.#r.get(B(e))??null}edges(){return this.#r.values()}*edgesWithRelation(e){for(let t of this.#r.values())t.includesRelation(e)&&(yield t)}*elements(){for(let e of this.#n.values())e.hasElement()&&(yield e)}isTagged(e){return this.tags.includes(e)}includesElement(e){return this.#i.has(B(e))}includesDeployment(e){return this.#a.has(B(e))}includesRelation(e){return this.#o.has(B(e))}isComputed(){return this.#e[h]===`computed`}isLayouted(){return this.#e[h]===`layouted`}isDiagram(){return this.#e[h]===`layouted`}isElementView(){return this.#e[v]===`element`}isScopedElementView(){return this.#e[v]===`element`&&o(this.#e.viewOf)}isDeploymentView(){return this.#e[v]===`deployment`}isDynamicView(){return this.#e[v]===`dynamic`}},q=class e{$model;path;title;isRoot;parentPath;defaultViewId;constructor(e,t,r){this.$model=e,this.path=t.join(`/`),this.isRoot=this.path===``,this.title=n(t),this.isRoot?this.parentPath=void 0:this.parentPath=t.slice(0,-1).join(`/`),this.defaultViewId=r}get defaultView(){return this.defaultViewId?this.$model.view(this.defaultViewId):null}get breadcrumbs(){return E(!this.isRoot,`Root view folder has no breadcrumbs`),A(this,`breadcrumbs`,()=>{let e=this.parent;return e?e.isRoot?[e,this]:[...e.breadcrumbs,this]:[this]})}get parent(){return E(!this.isRoot,`Root view folder has no parent`),r(this.parentPath)?null:this.$model.viewFolder(this.parentPath)}get children(){return this.$model.viewFolderItems(this.path)}get folders(){return A(this,`folders`,()=>{let t=[];for(let n of this.children)n instanceof e&&t.push(n);return t})}get views(){return A(this,`views`,()=>{let e=[];for(let t of this.children)t instanceof K&&e.push(t);return e})}},J=class e{Aux;_elements=new Map;_parents=new Map;_children=new P.default(()=>new Set);_rootElements=new Set;_relations=new Map;_incoming=new P.default(()=>new Set);_outgoing=new P.default(()=>new Set);_internal=new P.default(()=>new Set);_views=new Map;_rootViewFolder;_viewFolders=new Map;_viewFolderItems=new P.default(()=>new Set);_allTags=new P.default(()=>new Set);static fromParsed(t){return new e(t)}static create(t){return new e(t)}static fromDump(t){let{_stage:n=`layouted`,projectId:r=`unknown`,project:i,globals:a,imports:o,deployments:s,views:c,relations:l,elements:ee,specification:u}=t;return new e({[h]:n,projectId:r,project:i,globals:{predicates:a?.predicates??{},dynamicPredicates:a?.dynamicPredicates??{},styles:a?.styles??{}},imports:o??{},deployments:{elements:s?.elements??{},relations:s?.relations??{}},views:c??{},relations:l??{},elements:ee??{},specification:u})}deployment;$data;constructor(e){this.$data=e;for(let[,t]of l(e.elements)){let e=this.addElement(t);for(let t of e.tags)this._allTags.get(t).add(e)}for(let[t,n]of l(e.imports??{}))for(let e of ye(n)){let n=this.addImportedElement(t,e);for(let e of n.tags)this._allTags.get(e).add(n)}for(let t of f(e.relations)){let e=this.addRelation(t);for(let t of e.tags)this._allTags.get(t).add(e)}if(this.deployment=new Ne(this),pe(e,`computed`)||pe(e,`layouted`)){let t=be(`/`),n=u(f(e.views),c(e=>({view:e,path:H(e.title??e.id),folderPath:e.title&&je(e.title)||``})),te((e,n)=>t(e.folderPath,n.folderPath))),r=e=>{let t=this._viewFolders.get(e);if(!t){let r=re(e,`/`);E(s(r,1),`View group path "${e}" must have at least one element`);let i;i=e===``?n.find(e=>e.view.id===`index`):n.find(t=>t.path===e),t=new q(this,r,i?.view.id),this._viewFolders.set(e,t)}return t};this._rootViewFolder=r(``);for(let{folderPath:e}of n)this._viewFolders.has(e)||re(e,`/`).reduce((e,t)=>{let n=e.join(`/`),a=r(i(n)?t:n+`/`+t);return this._viewFolderItems.get(n).add(a),e.push(t),e},[]);for(let{view:t,folderPath:i}of n){let n=new K(this,r(i),t,e.manualLayouts?.[t.id]);this._viewFolderItems.get(i).add(n),this._views.set(t.id,n);for(let e of n.tags)this._allTags.get(e).add(n)}}else this._rootViewFolder=new q(this,[``],void 0),this._viewFolders.set(this._rootViewFolder.path,this._rootViewFolder)}get asParsed(){return this}get asComputed(){return this}get asLayouted(){return this}get $styles(){return A(this,`styles`,()=>ue.from(this.project.styles,this.specification.customColors))}isParsed(){return this.stage===`parsed`}isLayouted(){return this.stage===`layouted`}isComputed(){return this.stage===`computed`}get $model(){return this.$data}get stage(){return this.$data[h]}get projectId(){return this.$data.projectId??`default`}get project(){return this.$data.project??A(this,Symbol.for(`project`),()=>({id:this.projectId,styles:{},manualLayouts:{}}))}get specification(){return this.$data.specification}get globals(){return A(this,Symbol.for(`globals`),()=>({predicates:{...this.$data.globals?.predicates},dynamicPredicates:{...this.$data.globals?.dynamicPredicates},styles:{...this.$data.globals?.styles}}))}element(e){if(e instanceof F)return e;let t=B(e);return b(this._elements.get(t),`Element ${t} not found`)}findElement(e){return this._elements.get(B(e))??null}roots(){return this._rootElements.values()}elements(){return this._elements.values()}relationships(){return this._relations.values()}relationship(e,t){if(t===`deployment`)return this.deployment.relationship(e);let n=B(e),r=this._relations.get(n)??null;return r||t===`model`?b(r,`Model relation ${n} not found`):b(this.deployment.findRelationship(n),`No model/deployment relation ${n} not found`)}findRelationship(e,t){if(t===`deployment`)return this.deployment.findRelationship(e);let n=this._relations.get(B(e))??null;return n||t===`model`?n:this.deployment.findRelationship(e)}views(){return this._views.values()}view(e){let t=B(e);return b(this._views.get(t),`View ${t} not found`)}findView(e){return this._views.get(e)??null}findManualLayout(e){return`manualLayouts`in this.$data?this.$data.manualLayouts?.[e]??null:null}viewFolder(e){return b(this._viewFolders.get(e),`View folder ${e} not found`)}get rootViewFolder(){return this._rootViewFolder}get hasViewFolders(){return this._viewFolders.size>1}viewFolderItems(e){return E(this._viewFolders.has(e),`View folder ${e} not found`),this._viewFolderItems.get(e)}parent(e){let t=B(e);return this._parents.get(t)||null}children(e){let t=B(e);return this._children.get(t)}*siblings(e){let t=B(e),n=this._parents.get(t),r=n?this._children.get(n.id).values():this.roots();for(let e of r)e.id!==t&&(yield e)}*ancestors(e){let t=B(e),n;for(;n=this._parents.get(t);)yield n,t=n.id}*descendants(e){for(let t of this.children(e))yield t,yield*this.descendants(t.id)}*incoming(e,t=`all`){let n=B(e);for(let e of this._incoming.get(n))switch(!0){case t===`all`:case t===`direct`&&e.target.id===n:case t===`to-descendants`&&e.target.id!==n:yield e;break}}*outgoing(e,t=`all`){let n=B(e);for(let e of this._outgoing.get(n))switch(!0){case t===`all`:case t===`direct`&&e.source.id===n:case t===`from-descendants`&&e.source.id!==n:yield e;break}}get tags(){return A(this,`tags`,()=>te([...this._allTags.keys()],_e))}get tagsSortedByUsage(){return A(this,`tagsSortedByUsage`,()=>u([...this._allTags.entries()],c(([e,t])=>({tag:e,count:t.size,tagged:t})),te((e,t)=>_e(e.tag,t.tag)),ee([ne(`count`),`desc`])))}findByTag(e,t){return me(this._allTags.get(e),e=>t===`elements`?e instanceof F:t===`views`?e instanceof K:t===`relationships`?e instanceof U:!0)}*elementsOfKind(e){for(let t of this._elements.values())t.kind===e&&(yield t)}*elementsWhere(e){let t=oe(e);for(let e of this._elements.values())t(e)&&(yield e)}*relationshipsWhere(e){let t=oe(e);for(let e of this._relations.values())t(e)&&(yield e)}addElement(e){if(this._elements.has(e.id))throw Error(`Element ${e.id} already exists`);let t=new F(this,Object.freeze(e));this._elements.set(t.id,t);let n=S(t.id);return n?(E(this._elements.has(n),`Parent ${n} of ${t.id} not found`),this._parents.set(t.id,this.element(n)),this._children.get(n).add(t)):this._rootElements.add(t),t}addImportedElement(e,t){E(!fe(t.id),`Imported element already has global FQN`);let n=ie(e,t.id);if(this._elements.has(n))throw Error(`Element ${n} already exists`);let r=new F(this,Object.freeze({...t,id:n}));this._elements.set(r.id,r);let i=S(r.id);for(;i;){if(i.includes(`.`)&&this._elements.has(i))return this._parents.set(r.id,this.element(i)),this._children.get(i).add(r),r;i=S(i)}return this._rootElements.add(r),r}addRelation(e){if(this._relations.has(e.id))throw Error(`Relation ${e.id} already exists`);let t=new U(this,Object.freeze(e)),{source:n,target:r}=t;this._relations.set(t.id,t),this._incoming.get(r.id).add(t),this._outgoing.get(n.id).add(t);let i=j(n.id,r.id);if(i)for(let e of[i,...x(i)])this._internal.get(e).add(t);for(let e of x(n.id)){if(e===i)break;this._outgoing.get(e).add(t)}for(let e of x(r.id)){if(e===i)break;this._incoming.get(e).add(t)}return t}};(function(e){e.EMPTY=J.create({_stage:`computed`,projectId:`default`,project:{id:`default`},specification:{elements:{},relationships:{},deployments:{},tags:{}},globals:{predicates:{},dynamicPredicates:{},styles:{}},deployments:{elements:{},relations:{}},elements:{},relations:{},views:{},imports:{}})})(J||={});let Pe;(function(e){e.isInside=e=>t=>w(e,t.source.id)&&w(e,t.target.id);let t=e.isDirectedBetween=(e,t)=>n=>(n.source.id===e||w(e,n.source.id))&&(n.target.id===t||w(t,n.target.id));e.isAnyBetween=(e,n)=>{let r=t(e,n),i=t(n,e);return e=>r(e)||i(e)};let n=e.isIncoming=e=>t=>(t.target.id===e||w(e,t.target.id))&&!w(e,t.source.id),r=e.isOutgoing=e=>t=>(t.source.id===e||w(e,t.source.id))&&!w(e,t.target.id);e.isAnyInOut=e=>{let t=n(e),i=r(e);return e=>t(e)||i(e)}})(Pe||={});const Y=Symbol.for(`nodejs.util.inspect.custom`);var Fe=class e{id;constructor(e,t,n){this.source=e,this.target=t,this.relations=n,this.id=Ce(`deployment:${e.id}:${t.id}`)}get expression(){return`${this.source.id} -> ${this.target.id}`}_boundary;get boundary(){return this._boundary??=this.source.commonAncestor(this.target),this._boundary}nonEmpty(){return this.relations.nonEmpty}[Y](t,n,r){let i=this.toString();return Object.defineProperty(i,`constructor`,{value:e,enumerable:!1}),i}toString(){let e=[...this.relations.model].map(e=>` `+e.expression);e.length?e.unshift(` model:`):e.unshift(` model: []`);let t=[...this.relations.deployment].map(e=>` `+e.expression);return t.length?t.unshift(` deployment:`):t.unshift(` deployment: []`),[this.expression,...e,...t].join(`
|
|
3
|
-
`)}hasDirectDeploymentRelation(){for(let e of this.relations.deployment)if(e.source.id===this.source.id||e.target.id===this.target.id)return!0;return!1}*values(){yield*this.relations.model,yield*this.relations.deployment}mergeWith(t){return Array.isArray(t)?t.reduce((e,t)=>e.mergeWith(t),this):(
|
|
4
|
-
`)}reversed(){return new e(this.target,this.source)}},Xe=e({findConnection:()=>$,findConnectionsBetween:()=>Ze,findConnectionsWithin:()=>Qe});function $(e,t,n=`directed`){if(e===t||
|
|
1
|
+
import{n as e}from"./rolldown-runtime.mjs";import{A as t,E as n,I as r,L as i,N as a,O as o,Q as s,T as c,X as l,c as ee,et as u,i as d,l as f,m as te,r as p,s as ne}from"./libs/remeda.mjs";import{$ as re,At as m,Cn as h,Dn as g,Dt as _,H as ie,Jt as ae,Lt as v,Mt as oe,O as se,On as y,Ot as b,Sn as x,Tt as ce,Vt as le,Wt as S,Y as C,Yt as ue,_n as de,_t as w,cn as T,ct as fe,dn as pe,dt as me,en as he,fn as E,ft as ge,gn as _e,hn as ve,j as ye,kn as D,ln as O,mn as be,mt as xe,nn as k,rn as A,sn as j,t as M,tn as Se,un as Ce,ut as we,vt as N,yt as Te}from"./types.mjs";import{t as P}from"./libs/mnemonist.mjs";import{n as Ee,t as De}from"./manual-layout.mjs";var F=class{$model;$element;Aux;id;_literalId;hierarchyLevel;imported;constructor(e,t){this.$model=e,this.$element=t,this.id=this.$element.id,this._literalId=this.$element.id;let[n,r]=xe(this.id);n?(this.imported={from:n,fqn:r},this.hierarchyLevel=j(r)):(this.imported=null,this.hierarchyLevel=j(this.id))}get name(){return pe(this.id)}get parent(){return this.$model.parent(this)}get kind(){return this.$element.kind}get shape(){return this.style.shape}get color(){return this.style.color}get icon(){return this.style.icon??null}get tags(){return v(this,Symbol.for(`tags`),()=>d([...this.$element.tags??[],...this.$model.specification.elements[this.$element.kind]?.tags??[]]))}get metadata(){return this.$element.metadata??{}}get title(){return this.$element.title}get hasSummary(){return!!this.$element.summary&&!!this.$element.description&&!t(this.$element.summary,this.$element.description)}get summary(){return M.memoize(this,`summary`,y(this.$element))}get description(){return M.memoize(this,`description`,g(this.$element))}get technology(){return this.$element.technology??null}get links(){return this.$element.links??[]}get defaultView(){return v(this,Symbol.for(`defaultView`),()=>S(this.scopedViews())??null)}get isRoot(){return this.parent===null}get style(){return v(this,`style`,()=>D({shape:this.$model.$styles.defaults.shape,color:this.$model.$styles.defaults.color,border:this.$model.$styles.defaults.border,opacity:this.$model.$styles.defaults.opacity,size:this.$model.$styles.defaults.size,padding:this.$model.$styles.defaults.padding,textSize:this.$model.$styles.defaults.text,iconPosition:this.$model.$styles.defaults.iconPosition,...this.$element.style}))}get projectId(){return this.imported?.from??this.$model.projectId}isAncestorOf(e){return T(this,e)}isDescendantOf(e){return T(e,this)}ancestors(){return this.$model.ancestors(this)}commonAncestor(e){let t=A(this.id,e.id);return t?this.$model.element(t):null}children(){return this.$model.children(this)}descendants(e){return e?be([...this.$model.descendants(this)],e)[Symbol.iterator]():this.$model.descendants(this)}siblings(){return this.$model.siblings(this)}*ascendingSiblings(){yield*this.siblings();for(let e of this.ancestors())yield*e.siblings()}*descendingSiblings(){for(let e of[...this.ancestors()].reverse())yield*e.siblings();yield*this.siblings()}incoming(e=`all`){return this.$model.incoming(this,e)}*incomers(e=`all`){let t=new Set;for(let n of this.incoming(e))t.has(n.source.id)||(t.add(n.source.id),yield n.source)}outgoing(e=`all`){return this.$model.outgoing(this,e)}*outgoers(e=`all`){let t=new Set;for(let n of this.outgoing(e))t.has(n.target.id)||(t.add(n.target.id),yield n.target)}get allOutgoing(){return v(this,Symbol.for(`allOutgoing`),()=>new Set(this.outgoing()))}get allIncoming(){return v(this,Symbol.for(`allIncoming`),()=>new Set(this.incoming()))}views(){return v(this,Symbol.for(`views`),()=>{let e=new Set;for(let t of this.$model.views())t.includesElement(this.id)&&e.add(t);return e})}scopedViews(){return v(this,Symbol.for(`scopedViews`),()=>{let e=new Set;for(let t of this.$model.views())t.isScopedElementView()&&t.viewOf.id===this.id&&e.add(t);return e})}isDeployed(){return o(S(this.deployments()))}deployments(){return this.$model.deployment.instancesOf(this)}hasMetadata(){return!!this.$element.metadata&&!i(this.$element.metadata)}getMetadata(e){return e?this.$element.metadata?.[e]:this.$element.metadata??{}}isTagged(e){return this.tags.includes(e)}},Oe=class{Aux;get style(){return v(this,`style`,()=>D({shape:this.$model.$styles.defaults.shape,color:this.$model.$styles.defaults.color,border:this.$model.$styles.defaults.border,opacity:this.$model.$styles.defaults.opacity,size:this.$model.$styles.defaults.size,padding:this.$model.$styles.defaults.padding,textSize:this.$model.$styles.defaults.text,iconPosition:this.$model.$styles.defaults.iconPosition,...this.$node.style}))}get name(){return pe(this.id)}get shape(){return this.style.shape}get color(){return this.style.color}get icon(){return this.style.icon??null}get summary(){return M.memoize(this,`summary`,y(this.$node))}get description(){return M.memoize(this,`description`,g(this.$node))}get technology(){return this.$node.technology??null}get links(){return this.$node.links??[]}ancestors(){return this.$model.ancestors(this)}commonAncestor(e){let t=A(this.id,e.id);return t?this.$model.node(t):null}siblings(){return this.$model.siblings(this)}isSibling(e){return this.parent===e.parent}*ascendingSiblings(){yield*this.siblings();for(let e of this.ancestors())yield*e.siblings()}*descendingSiblings(){for(let e of[...this.ancestors()].reverse())yield*e.siblings();yield*this.siblings()}incoming(e=`all`){return this.$model.incoming(this,e)}outgoing(e=`all`){return this.$model.outgoing(this,e)}*incomers(e=`all`){let t=new Set;for(let n of this.incoming(e))t.has(n.source.id)||(t.add(n.source.id),yield n.source)}*outgoers(e=`all`){let t=new Set;for(let n of this.outgoing(e))t.has(n.target.id)||(t.add(n.target.id),yield n.target)}*views(){for(let e of this.$model.views())e._type===`deployment`&&e.includesDeployment(this.id)&&(yield e)}isDeploymentNode(){return!1}isInstance(){return!1}get allOutgoing(){return v(this,Symbol.for(`allOutgoing`),()=>z.from(new Set(this.outgoingModelRelationships()),new Set(this.outgoing())))}get allIncoming(){return v(this,Symbol.for(`allIncoming`),()=>z.from(new Set(this.incomingModelRelationships()),new Set(this.incoming())))}hasMetadata(){return!!this.$node.metadata&&!i(this.$node.metadata)}getMetadata(e){return e?this.$node.metadata?.[e]:this.$node.metadata??{}}isTagged(e){return this.tags.includes(e)}},I=class extends Oe{$model;$node;id;_literalId;title;hierarchyLevel;constructor(e,t){super(),this.$model=e,this.$node=t,this.id=t.id,this._literalId=t.id,this.title=t.title,this.hierarchyLevel=j(t.id)}get parent(){return this.$model.parent(this)}get kind(){return this.$node.kind}get metadata(){return this.$node.metadata??{}}get tags(){return v(this,Symbol.for(`tags`),()=>d([...this.$node.tags??[],...this.$model.$model.specification.deployments[this.kind]?.tags??[]]))}children(){return this.$model.children(this)}descendants(e=`desc`){return this.$model.descendants(this,e)}isDeploymentNode(){return!0}*instances(){for(let e of this.descendants(`desc`))e.isInstance()&&(yield e)}onlyOneInstance(){let e=this.children();if(e.size!==1)return null;let t=S(e);return t?t.isInstance()?t:t.onlyOneInstance():null}_relationshipsFromInstances=null;relationshipsFromInstances(){if(this._relationshipsFromInstances)return this._relationshipsFromInstances;let{outgoing:e,incoming:t}=this._relationshipsFromInstances={outgoing:new Set,incoming:new Set};for(let n of this.instances()){for(let t of n.element.outgoing())e.add(t);for(let e of n.element.incoming())t.add(e)}return this._relationshipsFromInstances}outgoingModelRelationships(){return this.relationshipsFromInstances().outgoing.values()}incomingModelRelationships(){return this.relationshipsFromInstances().incoming.values()}internalModelRelationships(){let{outgoing:e,incoming:t}=this.relationshipsFromInstances();return m(t,e)}},L=class extends Oe{$model;$instance;element;id;_literalId;title;hierarchyLevel;constructor(e,t,n){super(),this.$model=e,this.$instance=t,this.element=n,this.id=t.id,this._literalId=t.id,this.title=t.title??n.title,this.hierarchyLevel=j(t.id)}get $node(){return this.$instance}get parent(){return h(this.$model.parent(this),`Parent of ${this.id} not found`)}get style(){return v(this,`style`,()=>D({shape:this.$model.$styles.defaults.shape,color:this.$model.$styles.defaults.color,border:this.$model.$styles.defaults.border,opacity:this.$model.$styles.defaults.opacity,size:this.$model.$styles.defaults.size,padding:this.$model.$styles.defaults.padding,textSize:this.$model.$styles.defaults.text,iconPosition:this.$model.$styles.defaults.iconPosition,...this.element.$element.style,...this.$instance.style}))}get tags(){return v(this,Symbol.for(`tags`),()=>d([...this.$instance.tags??[],...this.element.tags]))}get kind(){return this.element.kind}get metadata(){return this.$instance.metadata??this.element.metadata??{}}get summary(){return M.memoize(this,`summary`,y(this.$instance)??y(this.element.$element))}get description(){return M.memoize(this,`description`,g(this.$instance)??g(this.element.$element))}get technology(){return this.$instance.technology??this.element.technology??null}get links(){return this.$instance.links??this.element.links}isInstance(){return!0}outgoingModelRelationships(){return this.element.outgoing()}incomingModelRelationships(){return this.element.incoming()}*views(){for(let e of this.$model.views())if(e._type===`deployment`){if(e.includesDeployment(this.id)){yield e;continue}e.includesDeployment(this.parent.id)&&this.parent.onlyOneInstance()&&(yield e)}}},ke=class{instance;element;constructor(e,t){this.instance=e,this.element=t}get id(){return this.instance.id}get _literalId(){return this.instance.id}get style(){return v(this,`style `,()=>({shape:this.element.shape,color:this.element.color,...this.element.$element.style}))}get shape(){return this.element.shape}get color(){return this.element.color}get title(){return this.element.title}get summary(){return this.element.summary}get description(){return this.element.description}get technology(){return this.element.technology}isDeploymentNode(){return!1}isInstance(){return!1}},R=class{$model;$relationship;boundary;source;target;constructor(e,t){this.$model=e,this.$relationship=t,this.source=e.deploymentRef(t.source),this.target=e.deploymentRef(t.target);let n=A(this.source.id,this.target.id);this.boundary=n?this.$model.node(n):null}get id(){return this.$relationship.id}get expression(){return`${this.source.id} -> ${this.target.id}`}get title(){return o(this.$relationship.title)?this.$relationship.title:null}get technology(){return r(this.$relationship.technology)?(this.kind&&this.$model.specification.relationships[this.kind])?.technology??null:this.$relationship.technology}get hasSummary(){return!!this.$relationship.summary&&!!this.$relationship.description&&!t(this.$relationship.summary,this.$relationship.description)}get summary(){return M.memoize(this,`summary`,y(this.$relationship))}get description(){return M.memoize(this,`description`,g(this.$relationship))}get tags(){return this.$relationship.tags??[]}get kind(){return this.$relationship.kind??null}get metadata(){return this.$relationship.metadata??{}}get navigateTo(){return this.$relationship.navigateTo?this.$model.$model.view(this.$relationship.navigateTo):null}get links(){return this.$relationship.links??[]}get color(){return this.$relationship.color??this.$model.$styles.defaults.relationship.color}get line(){return this.$relationship.line??this.$model.$styles.defaults.relationship.line}get head(){return this.$relationship.head??this.$model.$styles.defaults.relationship.arrow}get tail(){return this.$relationship.tail}*views(){for(let e of this.$model.views())e.includesRelation(this.id)&&(yield e)}isDeploymentRelation(){return!0}isModelRelation(){return!1}hasMetadata(){return!!this.$relationship.metadata&&!i(this.$relationship.metadata)}getMetadata(e){return e?this.$relationship.metadata?.[e]:this.$relationship.metadata??{}}isTagged(e){return this.tags.includes(e)}},z=class e{model;deployment;static empty(){return new e}static from(t,n){return new e(new Set(t),new Set(n))}constructor(e=new Set,t=new Set){this.model=e,this.deployment=t}get isEmpty(){return this.model.size===0&&this.deployment.size===0}get nonEmpty(){return this.model.size>0||this.deployment.size>0}get size(){return this.model.size+this.deployment.size}intersect(t){return e.from(m(this.model,t.model),m(this.deployment,t.deployment))}difference(t){return e.from(_(this.model,t.model),_(this.deployment,t.deployment))}union(t){return e.from(oe(this.model,t.model),oe(this.deployment,t.deployment))}};const B=e=>typeof e==`string`?e:e.id,Ae=`/`,V=e=>{if(x(!e.includes(`
|
|
2
|
+
`),`View title cannot contain newlines`),e.includes(`/`)){let t=e.split(`/`).map(e=>e.trim()).filter(e=>e.length>0);return s(t,1)?t:[``]}return[e.trim()]},H=e=>V(e).join(`/`),je=e=>{let t=V(e);return s(t,2)?t.slice(0,-1).join(`/`):null},Me=e=>e.includes(`/`)?V(e).pop()??e:e.trim();var Ne=class{$model;#e=new Map;#t=new Map;#n=new P.default(()=>new Set);#r=new P.default(()=>new Set);#i=new Set;#a=new Map;#o=new P.default(()=>new Set);#s=new P.default(()=>new Set);#c=new P.default(()=>new Set);#l=new P.default(()=>new Set);#u=new Map;$deployments;constructor(e){this.$model=e;let t=this.$deployments=e.$data.deployments,n=p(t.elements);for(let e of ve(n)){let t=this.addElement(e);for(let e of t.tags)this.#l.get(e).add(t);t.isInstance()&&this.#r.get(t.element.id).add(t)}for(let e of p(t.relations)){let t=this.addRelation(e);for(let e of t.tags)this.#l.get(e).add(t)}}get $styles(){return this.$model.$styles}get projectId(){return this.$model.projectId}get project(){return this.$model.project}get specification(){return this.$model.specification}element(e){if(e instanceof I||e instanceof L)return e;let t=B(e);return h(this.#e.get(t),`Element ${t} not found`)}findElement(e){return this.#e.get(e)??null}node(e){let t=this.element(e);return x(t.isDeploymentNode(),`Element ${t.id} is not a deployment node`),t}findNode(e){let t=this.findElement(e);return t?(x(t.isDeploymentNode(),`Element ${t?.id} is not a deployment node`),t):null}instance(e){let t=this.element(e);return x(t.isInstance(),`Element ${t.id} is not a deployed instance`),t}findInstance(e){let t=this.findElement(e);return t?(x(t.isInstance(),`Element ${t?.id} is not a deployed instance`),t):null}roots(){return this.#i.values()}elements(){return this.#e.values()}*nodes(){for(let e of this.#e.values())e.isDeploymentNode()&&(yield e)}*nodesOfKind(e){for(let t of this.#e.values())t.isDeploymentNode()&&t.kind===e&&(yield t)}*instances(){for(let e of this.#e.values())e.isInstance()&&(yield e)}*instancesOf(e){let t=B(e),n=this.#r.get(t);n&&(yield*n)}deploymentRef(e){if(C.isInsideInstanceRef(e)){let{deployment:t,element:n}=e;return Se(this.#u,`${t}@${n}`,()=>new ke(this.instance(t),this.$model.element(n)))}return this.element(e.deployment)}relationships(){return this.#a.values()}relationship(e){let t=B(e);return h(this.#a.get(t),`DeploymentRelationModel ${t} not found`)}findRelationship(e){return this.#a.get(e)??null}*views(){for(let e of this.$model.views())e.isDeploymentView()&&(yield e)}parent(e){let t=B(e);return this.#t.get(t)||null}children(e){let t=B(e);return this.#n.get(t)}*siblings(e){let t=B(e),n=this.parent(e)?.children()??this.roots();for(let e of n)e.id!==t&&(yield e)}*ancestors(e){let t=B(e),n;for(;n=this.#t.get(t);)yield n,t=n.id}*descendants(e,t=`desc`){for(let n of this.children(e))t===`asc`?(yield n,yield*this.descendants(n.id)):(yield*this.descendants(n.id),yield n)}*incoming(e,t=`all`){let n=B(e);for(let e of this.#o.get(n))switch(!0){case t===`all`:case t===`direct`&&e.target.id===n:case t===`to-descendants`&&e.target.id!==n:yield e;break}}*outgoing(e,t=`all`){let n=B(e);for(let e of this.#s.get(n))switch(!0){case t===`all`:case t===`direct`&&e.source.id===n:case t===`from-descendants`&&e.source.id!==n:yield e;break}}addElement(e){if(this.#e.has(e.id))throw Error(`Element ${e.id} already exists`);let t=ie(e)?new I(this,Object.freeze(e)):new L(this,Object.freeze(e),this.$model.element(e.element));this.#e.set(t.id,t);let n=E(t.id);return n?(x(this.#e.has(n),`Parent ${n} of ${t.id} not found`),this.#t.set(t.id,this.node(n)),this.#n.get(n).add(t)):(x(t.isDeploymentNode(),`Root element ${t.id} is not a deployment node`),this.#i.add(t)),t}addRelation(e){if(this.#a.has(e.id))throw Error(`Relation ${e.id} already exists`);let t=new R(this,Object.freeze(e));this.#a.set(t.id,t),this.#o.get(t.target.id).add(t),this.#s.get(t.source.id).add(t);let n=t.boundary?.id??null;if(n)for(let e of[n,...k(n)])this.#c.get(e).add(t);for(let e of k(t.source.id)){if(e===n)break;this.#s.get(e).add(t)}for(let e of k(t.target.id)){if(e===n)break;this.#o.get(e).add(t)}return t}},U=class{model;$relationship;source;target;boundary;constructor(e,t){this.model=e,this.$relationship=t,this.source=e.element(C.flatten(t.source)),this.target=e.element(C.flatten(t.target));let n=A(this.source.id,this.target.id);this.boundary=n?this.model.element(n):null}get id(){return this.$relationship.id}get expression(){return`${this.source.id} -> ${this.target.id}`}get title(){return r(this.$relationship.title)?null:this.$relationship.title}get technology(){return r(this.$relationship.technology)?(this.kind&&this.model.specification.relationships[this.kind])?.technology??null:this.$relationship.technology}get hasSummary(){return!!this.$relationship.summary&&!!this.$relationship.description&&!t(this.$relationship.summary,this.$relationship.description)}get summary(){return M.memoize(this,`summary`,y(this.$relationship))}get description(){return M.memoize(this,`description`,g(this.$relationship))}get navigateTo(){return this.$relationship.navigateTo?this.model.view(this.$relationship.navigateTo):null}get tags(){return this.$relationship.tags??[]}get kind(){return this.$relationship.kind??null}get metadata(){return this.$relationship.metadata??{}}get links(){return this.$relationship.links??[]}get color(){return this.$relationship.color??this.model.$styles.defaults.relationship.color}get line(){return this.$relationship.line??this.model.$styles.defaults.relationship.line}get head(){return this.$relationship.head??this.model.$styles.defaults.relationship.arrow}get tail(){return this.$relationship.tail}*views(){for(let e of this.model.views())e.includesRelation(this.id)&&(yield e)}isDeploymentRelation(){return!1}isModelRelation(){return!0}hasMetadata(){return!!this.$relationship.metadata&&!i(this.$relationship.metadata)}getMetadata(e){return e?this.$relationship.metadata?.[e]:this.$relationship.metadata??{}}isTagged(e){return this.tags.includes(e)}},W=class{source;target;Aux;$viewModel;$view;$edge;constructor(e,t,n,r){this.source=n,this.target=r,this.$viewModel=e,this.$view=e.$view,this.$edge=t}get id(){return this.$edge.id}get parent(){return this.$edge.parent?this.$viewModel.node(this.$edge.parent):null}get label(){return this.$edge.label??null}get description(){return M.memoize(this,`description`,this.$edge.description)}get technology(){return this.$edge.technology??null}hasParent(){return this.$edge.parent!==null}get tags(){return this.$edge.tags??[]}get stepNumber(){return this.isStep()?fe(this.id):null}get navigateTo(){return this.$edge.navigateTo?this.$viewModel.$model.view(this.$edge.navigateTo):null}get color(){return this.$edge.color}get line(){return this.$edge.line??this.$viewModel.$styles.defaults.relationship.line}get head(){return this.$edge.head??this.$viewModel.$styles.defaults.relationship.arrow}get tail(){return this.$edge.tail}isStep(){return ge(this.id)}*relationships(e){for(let t of this.$edge.relations)if(e){let n=this.$viewModel.$model.findRelationship(t,e);n&&(yield n)}else yield this.$viewModel.$model.relationship(t)}includesRelation(e){let t=typeof e==`string`?e:e.id;return this.$edge.relations.includes(t)}isTagged(e){return this.tags.includes(e)}},G=class{Aux;$viewModel;$view;$node;constructor(e,t){this.$viewModel=e,this.$view=e.$view,this.$node=t}get id(){return this.$node.id}get title(){return this.$node.title}get kind(){return this.$node.kind}get description(){return M.memoize(this,`description`,this.$node.description)}get technology(){return this.$node.technology??null}get notes(){return M.memoize(this,`notes`,this.$node.notes)}get parent(){return this.$node.parent?this.$viewModel.node(this.$node.parent):null}get element(){let e=this.$node.modelRef;return e?this.$viewModel.$model.element(e):null}get deployment(){let e=this.$node.deploymentRef;return e?this.$viewModel.$model.deployment.element(e):null}get shape(){return this.$node.shape}get color(){return this.$node.color}get icon(){return this.$node.icon??null}get tags(){return this.$node.tags}get links(){return this.$node.links??[]}get navigateTo(){return this.$node.navigateTo?this.$viewModel.$model.view(this.$node.navigateTo):null}get style(){return this.$node.style}get x(){return`x`in this.$node?this.$node.x:void 0}get y(){return`y`in this.$node?this.$node.y:void 0}get width(){return`width`in this.$node?this.$node.width:void 0}get height(){return`height`in this.$node?this.$node.height:void 0}children(){return v(this,`children`,()=>new Set(this.$node.children.map(e=>this.$viewModel.node(e))))}*ancestors(){let e=this.parent;for(;e;)yield e,e=e.parent}*siblings(){let e=this.parent?.children()??this.$viewModel.roots();for(let t of e)t.id!==this.id&&(yield t)}*incoming(e=`all`){for(let t of this.$node.inEdges){let n=this.$viewModel.edge(t);switch(!0){case e===`all`:case e===`direct`&&n.target.id===this.id:case e===`to-descendants`&&n.target.id!==this.id:yield n;break}}}*incomers(e=`all`){let t=new Set;for(let n of this.incoming(e))t.has(n.source.id)||(t.add(n.source.id),yield n.source)}*outgoing(e=`all`){for(let t of this.$node.outEdges){let n=this.$viewModel.edge(t);switch(!0){case e===`all`:case e===`direct`&&n.source.id===this.id:case e===`from-descendants`&&n.source.id!==this.id:yield n;break}}}*outgoers(e=`all`){let t=new Set;for(let n of this.outgoing(e))t.has(n.target.id)||(t.add(n.target.id),yield n.target)}isLayouted(){return`width`in this.$node&&`height`in this.$node}hasChildren(){return this.$node.children.length>0}hasParent(){return this.$node.parent!==null}hasElement(){return o(this.$node.modelRef)}hasDeployment(){return o(this.$node.deploymentRef)}hasDeployedInstance(){return this.hasElement()&&this.hasDeployment()}isGroup(){return me(this.$node)}isTagged(e){return this.tags.includes(e)}},K=class{Aux;#e;#t=new Set;#n=new Map;#r=new Map;#i=new Set;#a=new Set;#o=new Set;#s=new P.default(e=>new Set);#c;id;$model;title;folder;viewPath;constructor(e,t,n,r){this.$model=e,this.#e=n,this.id=n.id,this.folder=t,this.#c=r;for(let e of this.#e.nodes){let t=new G(this,Object.freeze(e));this.#n.set(e.id,t),e.parent||this.#t.add(t),e.deploymentRef&&this.#a.add(e.deploymentRef),e.modelRef&&this.#i.add(e.modelRef);for(let e of t.tags)this.#s.get(e).add(t)}for(let e of this.#e.edges){let t=new W(this,Object.freeze(e),this.node(e.source),this.node(e.target));for(let e of t.tags)this.#s.get(e).add(t);for(let t of e.relations)this.#o.add(t);this.#r.set(e.id,t)}this.title=n.title?Me(n.title):null,this.viewPath=n.title?H(n.title):n.id}get $styles(){return this.$model.$styles}get _type(){return this.#e[N]}get stage(){return this.#e[w]}get bounds(){if(`bounds`in this.#e)return this.#e.bounds;if(this.#c)return this.#c.bounds;throw Error(`View is not layouted`)}get titleOrId(){return this.title??this.viewOf?.title??this.id}get titleOrUntitled(){return this.title??`Untitled`}get breadcrumbs(){return v(this,`breadcrumbs`,()=>this.folder.isRoot?[this]:[...this.folder.breadcrumbs,this])}get description(){return M.memoize(this,`description`,this.#e.description)}get tags(){return this.#e.tags??[]}get links(){return this.#e.links??[]}get viewOf(){if(this.isElementView()){let e=this.#e.viewOf;return e?this.$model.element(e):null}return null}get mode(){return this.isDynamicView()?this.#e.variant??`diagram`:null}get includedTags(){return[...this.#s.keys()]}get $view(){if(!this.isLayouted()||`drifts`in this.#e)return this.#e;let e=this.#c;return e?v(this,`withDriftReasons`,()=>De(this.#e,e)):this.#e}get $layouted(){if(!this.isLayouted())throw Error(`View is not layouted`);return this.$manual??this.#e}get hasManualLayout(){return this.#c!==void 0}get hasLayoutDrifts(){if(!this.isLayouted())return!1;let e=this.$manual;return!!e?.drifts&&e.drifts.length>0}get $manual(){if(!this.isLayouted())return null;let e=this.#c;return e?this.#e._layout===`manual`?this.#e:v(this,`snapshotWithManualLayout`,()=>Ee(this.#e,e)):null}get projectId(){return this.$model.projectId}roots(){return this.#t.values()}*compounds(){for(let e of this.#n.values())e.hasChildren()&&(yield e)}node(e){let t=B(e);return h(this.#n.get(t),`Node ${t} not found in view ${this.#e.id}`)}findNode(e){return this.#n.get(B(e))??null}findNodeWithElement(e){let t=B(e);return this.#i.has(t)?ae(this.#n.values(),e=>e.hasElement()&&e.element.id===t)??null:null}nodes(){return this.#n.values()}edge(e){let t=B(e);return h(this.#r.get(t),`Edge ${t} not found in view ${this.#e.id}`)}findEdge(e){return this.#r.get(B(e))??null}edges(){return this.#r.values()}*edgesWithRelation(e){for(let t of this.#r.values())t.includesRelation(e)&&(yield t)}*elements(){for(let e of this.#n.values())e.hasElement()&&(yield e)}isTagged(e){return this.tags.includes(e)}includesElement(e){return this.#i.has(B(e))}includesDeployment(e){return this.#a.has(B(e))}includesRelation(e){return this.#o.has(B(e))}isComputed(){return this.#e[w]===`computed`}isLayouted(){return this.#e[w]===`layouted`}isDiagram(){return this.#e[w]===`layouted`}isElementView(){return this.#e[N]===`element`}isScopedElementView(){return this.#e._type===`element`&&o(this.#e.viewOf)}isDeploymentView(){return this.#e[N]===`deployment`}isDynamicView(){return this.#e[N]===`dynamic`}},q=class e{$model;path;title;isRoot;parentPath;defaultViewId;constructor(e,t,r){this.$model=e,this.path=t.join(`/`),this.isRoot=this.path===``,this.title=n(t),this.isRoot?this.parentPath=void 0:this.parentPath=t.slice(0,-1).join(`/`),this.defaultViewId=r}get defaultView(){return this.defaultViewId?this.$model.view(this.defaultViewId):null}get breadcrumbs(){return x(!this.isRoot,`Root view folder has no breadcrumbs`),v(this,`breadcrumbs`,()=>{let e=this.parent;return e?e.isRoot?[e,this]:[...e.breadcrumbs,this]:[this]})}get parent(){return x(!this.isRoot,`Root view folder has no parent`),r(this.parentPath)?null:this.$model.viewFolder(this.parentPath)}get children(){return this.$model.viewFolderItems(this.path)}get folders(){return v(this,`folders`,()=>{let t=[];for(let n of this.children)n instanceof e&&t.push(n);return t})}get views(){return v(this,`views`,()=>{let e=[];for(let t of this.children)t instanceof K&&e.push(t);return e})}},J=class e{Aux;_elements=new Map;_parents=new Map;_children=new P.default(()=>new Set);_rootElements=new Set;_relations=new Map;_incoming=new P.default(()=>new Set);_outgoing=new P.default(()=>new Set);_internal=new P.default(()=>new Set);_views=new Map;_rootViewFolder;_viewFolders=new Map;_viewFolderItems=new P.default(()=>new Set);_allTags=new P.default(()=>new Set);static fromParsed(t){return new e(t)}static create(t){return new e(t)}static fromDump(t){let{_stage:n=`layouted`,projectId:r=`unknown`,project:i,globals:a,imports:o,deployments:s,views:c,relations:l,elements:ee,specification:u}=t;return new e({[w]:n,projectId:r,project:i,globals:{predicates:a?.predicates??{},dynamicPredicates:a?.dynamicPredicates??{},styles:a?.styles??{}},imports:o??{},deployments:{elements:s?.elements??{},relations:s?.relations??{}},views:c??{},relations:l??{},elements:ee??{},specification:u})}deployment;$data;constructor(e){this.$data=e;for(let[,t]of l(e.elements)){let e=this.addElement(t);for(let t of e.tags)this._allTags.get(t).add(e)}for(let[t,n]of l(e.imports??{}))for(let e of ve(n)){let n=this.addImportedElement(t,e);for(let e of n.tags)this._allTags.get(e).add(n)}for(let t of p(e.relations)){let e=this.addRelation(t);for(let t of e.tags)this._allTags.get(t).add(e)}if(this.deployment=new Ne(this),Te(e,`computed`)||Te(e,`layouted`)){let t=de(`/`),n=u(p(e.views),c(e=>({view:e,path:H(e.title??e.id),folderPath:e.title&&je(e.title)||``})),f((e,n)=>t(e.folderPath,n.folderPath))),r=e=>{let t=this._viewFolders.get(e);if(!t){let r=ne(e,`/`);x(s(r,1),`View group path "${e}" must have at least one element`);let i;i=e===``?n.find(e=>e.view.id===`index`):n.find(t=>t.path===e),t=new q(this,r,i?.view.id),this._viewFolders.set(e,t)}return t};this._rootViewFolder=r(``);for(let{folderPath:e}of n)this._viewFolders.has(e)||ne(e,`/`).reduce((e,t)=>{let n=e.join(`/`),a=r(i(n)?t:n+`/`+t);return this._viewFolderItems.get(n).add(a),e.push(t),e},[]);for(let{view:t,folderPath:i}of n){let n=new K(this,r(i),t,e.manualLayouts?.[t.id]);this._viewFolderItems.get(i).add(n),this._views.set(t.id,n);for(let e of n.tags)this._allTags.get(e).add(n)}}else this._rootViewFolder=new q(this,[``],void 0),this._viewFolders.set(this._rootViewFolder.path,this._rootViewFolder)}get asParsed(){return this}get asComputed(){return this}get asLayouted(){return this}get $styles(){return v(this,`styles`,()=>ye.from(this.project.styles,this.specification.customColors))}isParsed(){return this.stage===`parsed`}isLayouted(){return this.stage===`layouted`}isComputed(){return this.stage===`computed`}get $model(){return this.$data}get stage(){return this.$data[w]}get projectId(){return this.$data.projectId??`default`}get project(){return this.$data.project??v(this,Symbol.for(`project`),()=>({id:this.projectId,styles:{},manualLayouts:{}}))}get specification(){return this.$data.specification}get globals(){return v(this,Symbol.for(`globals`),()=>({predicates:{...this.$data.globals?.predicates},dynamicPredicates:{...this.$data.globals?.dynamicPredicates},styles:{...this.$data.globals?.styles}}))}element(e){if(e instanceof F)return e;let t=B(e);return h(this._elements.get(t),`Element ${t} not found`)}findElement(e){return this._elements.get(B(e))??null}roots(){return this._rootElements.values()}elements(){return this._elements.values()}relationships(){return this._relations.values()}relationship(e,t){if(t===`deployment`)return this.deployment.relationship(e);let n=B(e),r=this._relations.get(n)??null;return r||t===`model`?h(r,`Model relation ${n} not found`):h(this.deployment.findRelationship(n),`No model/deployment relation ${n} not found`)}findRelationship(e,t){if(t===`deployment`)return this.deployment.findRelationship(e);let n=this._relations.get(B(e))??null;return n||t===`model`?n:this.deployment.findRelationship(e)}views(){return this._views.values()}view(e){let t=B(e);return h(this._views.get(t),`View ${t} not found`)}findView(e){return this._views.get(e)??null}findManualLayout(e){return`manualLayouts`in this.$data?this.$data.manualLayouts?.[e]??null:null}viewFolder(e){return h(this._viewFolders.get(e),`View folder ${e} not found`)}get rootViewFolder(){return this._rootViewFolder}get hasViewFolders(){return this._viewFolders.size>1}viewFolderItems(e){return x(this._viewFolders.has(e),`View folder ${e} not found`),this._viewFolderItems.get(e)}parent(e){let t=B(e);return this._parents.get(t)||null}children(e){let t=B(e);return this._children.get(t)}*siblings(e){let t=B(e),n=this._parents.get(t),r=n?this._children.get(n.id).values():this.roots();for(let e of r)e.id!==t&&(yield e)}*ancestors(e){let t=B(e),n;for(;n=this._parents.get(t);)yield n,t=n.id}*descendants(e){for(let t of this.children(e))yield t,yield*this.descendants(t.id)}*incoming(e,t=`all`){let n=B(e);for(let e of this._incoming.get(n))switch(!0){case t===`all`:case t===`direct`&&e.target.id===n:case t===`to-descendants`&&e.target.id!==n:yield e;break}}*outgoing(e,t=`all`){let n=B(e);for(let e of this._outgoing.get(n))switch(!0){case t===`all`:case t===`direct`&&e.source.id===n:case t===`from-descendants`&&e.source.id!==n:yield e;break}}get tags(){return v(this,`tags`,()=>f([...this._allTags.keys()],_e))}get tagsSortedByUsage(){return v(this,`tagsSortedByUsage`,()=>u([...this._allTags.entries()],c(([e,t])=>({tag:e,count:t.size,tagged:t})),f((e,t)=>_e(e.tag,t.tag)),ee([te(`count`),`desc`])))}findByTag(e,t){return ue(this._allTags.get(e),e=>t===`elements`?e instanceof F:t===`views`?e instanceof K:t===`relationships`?e instanceof U:!0)}*elementsOfKind(e){for(let t of this._elements.values())t.kind===e&&(yield t)}*elementsWhere(e){let t=se(e);for(let e of this._elements.values())t(e)&&(yield e)}*relationshipsWhere(e){let t=se(e);for(let e of this._relations.values())t(e)&&(yield e)}addElement(e){if(this._elements.has(e.id))throw Error(`Element ${e.id} already exists`);let t=new F(this,Object.freeze(e));this._elements.set(t.id,t);let n=E(t.id);return n?(x(this._elements.has(n),`Parent ${n} of ${t.id} not found`),this._parents.set(t.id,this.element(n)),this._children.get(n).add(t)):this._rootElements.add(t),t}addImportedElement(e,t){x(!we(t.id),`Imported element already has global FQN`);let n=re(e,t.id);if(this._elements.has(n))throw Error(`Element ${n} already exists`);let r=new F(this,Object.freeze({...t,id:n}));this._elements.set(r.id,r);let i=E(r.id);for(;i;){if(i.includes(`.`)&&this._elements.has(i))return this._parents.set(r.id,this.element(i)),this._children.get(i).add(r),r;i=E(i)}return this._rootElements.add(r),r}addRelation(e){if(this._relations.has(e.id))throw Error(`Relation ${e.id} already exists`);let t=new U(this,Object.freeze(e)),{source:n,target:r}=t;this._relations.set(t.id,t),this._incoming.get(r.id).add(t),this._outgoing.get(n.id).add(t);let i=A(n.id,r.id);if(i)for(let e of[i,...k(i)])this._internal.get(e).add(t);for(let e of k(n.id)){if(e===i)break;this._outgoing.get(e).add(t)}for(let e of k(r.id)){if(e===i)break;this._incoming.get(e).add(t)}return t}};(function(e){e.EMPTY=J.create({_stage:`computed`,projectId:`default`,project:{id:`default`},specification:{elements:{},relationships:{},deployments:{},tags:{}},globals:{predicates:{},dynamicPredicates:{},styles:{}},deployments:{elements:{},relations:{}},elements:{},relations:{},views:{},imports:{}})})(J||={});let Pe;(function(e){e.isInside=e=>t=>T(e,t.source.id)&&T(e,t.target.id);let t=e.isDirectedBetween=(e,t)=>n=>(n.source.id===e||T(e,n.source.id))&&(n.target.id===t||T(t,n.target.id));e.isAnyBetween=(e,n)=>{let r=t(e,n),i=t(n,e);return e=>r(e)||i(e)};let n=e.isIncoming=e=>t=>(t.target.id===e||T(e,t.target.id))&&!T(e,t.source.id),r=e.isOutgoing=e=>t=>(t.source.id===e||T(e,t.source.id))&&!T(e,t.target.id);e.isAnyInOut=e=>{let t=n(e),i=r(e);return e=>t(e)||i(e)}})(Pe||={});const Y=Symbol.for(`nodejs.util.inspect.custom`);var Fe=class e{source;target;relations;id;constructor(e,t,n){this.source=e,this.target=t,this.relations=n,this.id=ce(`deployment:${e.id}:${t.id}`)}get expression(){return`${this.source.id} -> ${this.target.id}`}_boundary;get boundary(){return this._boundary??=this.source.commonAncestor(this.target),this._boundary}nonEmpty(){return this.relations.nonEmpty}[Y](t,n,r){let i=this.toString();return Object.defineProperty(i,"constructor",{value:e,enumerable:!1}),i}toString(){let e=[...this.relations.model].map(e=>` `+e.expression);e.length?e.unshift(` model:`):e.unshift(` model: []`);let t=[...this.relations.deployment].map(e=>` `+e.expression);return t.length?t.unshift(` deployment:`):t.unshift(` deployment: []`),[this.expression,...e,...t].join(`
|
|
3
|
+
`)}hasDirectDeploymentRelation(){for(let e of this.relations.deployment)if(e.source.id===this.source.id||e.target.id===this.target.id)return!0;return!1}*values(){yield*this.relations.model,yield*this.relations.deployment}mergeWith(t){return Array.isArray(t)?t.reduce((e,t)=>e.mergeWith(t),this):(x(this.source.id===t.source.id,`Cannot merge connections with different sources`),x(this.target.id===t.target.id,`Cannot merge connections with different targets`),new e(this.source,this.target,this.relations.union(t.relations)))}difference(t){return new e(this.source,this.target,this.relations.difference(t.relations))}intersect(t){return new e(this.source,this.target,this.relations.intersect(t.relations))}equals(t){return x(t instanceof e,`Other should ne DeploymentConnectionModel`),this.id===t.id&&this.source.id===t.source.id&&this.target.id===t.target.id&&b(this.relations.model,t.relations.model)&&b(this.relations.deployment,t.relations.deployment)}update(t){return t&&={model:this.relations.model,deployment:this.relations.deployment,...t},new e(this.source,this.target,t?new z(t.model??new Set,t.deployment??new Set):this.relations)}};function X(e,t){if(!t){let t=e;return e=>X(e,t)}let n=e.source===t.source,r=e.target===t.target;if(n&&r)return!1;let i=T(t.source.id,e.source.id),a=T(t.target.id,e.target.id);return i&&a||n&&a||r&&i}function Ie(e,t){let n=t;for(let t of e)X(t,n)&&(n=t);return n===t?null:n}function Le(e){let t=[],n=e.slice(),r;for(;r=n.shift();){let e;for(;e=Ie(n,r);){let r=n.indexOf(e);t.push(n.splice(r,1)[0])}t.push(r)}return t}function Re(e){return e.boundary?.id?`.${e.boundary.id}`:``}function ze(e,t){if(!e||he(e)){let t=e??`asc`;return e=>Be(e,t)}return Be(e,t??`asc`)}function Be(e,t){return u(e,c(e=>({id:Re(e),conn:e})),be(t),c(e=>e.conn))}function Ve(e,t){return e.filter(e=>X(t,e))}function He(e,t){return e.filter(X(t))}function Ue(e){let t=new Map;for(let n of e){let e=t.get(n.id);e?t.set(n.id,n.mergeWith(e)):t.set(n.id,n)}return[...t.values()]}function We(e,t){let n=new Map([...t].map(e=>[e.id,e]));return[...e].reduce((e,t)=>{let r=n.get(t.id);if(!r)return e.push(t),e;let i=t.difference(r);return i.nonEmpty()&&e.push(i),e},[])}function Z(e,t){return t?e.source===t.source&&e.target===t.target:t=>e.source===t.source&&e.target===t.target}function Ge(e,t){return t?e.source===t.source:t=>e.source===t.source}function Ke(e,t){return t?e.target===t.target:t=>e.target===t.target}function qe(e,t){if(!t){let t=e;return e=>qe(e,t)}let n=e;return O(n.source,t)&&!O(n.target,t)}function Je(e,t){if(!t){let t=e;return e=>Je(e,t)}let n=e;return O(n.target,t)&&!O(n.source,t)}function Ye(e,t){if(!t){let t=e;return e=>Ye(e,t)}let n=e;return O(n.source,t)!==O(n.target,t)}var Q=class e{source;target;relations;id;constructor(e,t,n=new Set){this.source=e,this.target=t,this.relations=n,this.id=ce(`model:${e.id}:${t.id}`)}_boundary;get boundary(){return this._boundary??=this.source.commonAncestor(this.target)}get expression(){return`${this.source.id} -> ${this.target.id}`}get isDirect(){return this.nonEmpty()&&!this.isImplicit}get isImplicit(){return this.nonEmpty()&&le(this.relations,a(Z(this)))}get directRelations(){return new Set(ue(this.relations,Z(this)))}nonEmpty(){return this.relations.size>0}mergeWith(t){return x(this.source.id===t.source.id,`Cannot merge connections with different sources`),x(this.target.id===t.target.id,`Cannot merge connections with different targets`),new e(this.source,this.target,oe(this.relations,t.relations))}difference(t){return new e(this.source,this.target,_(this.relations,t.relations))}intersect(t){return x(t instanceof e,`Cannot intersect connection with different type`),new e(this.source,this.target,m(this.relations,t.relations))}equals(t){x(t instanceof e,`Cannot merge connection with different type`);let n=t;return this.id===n.id&&this.source.id===n.source.id&&this.target.id===n.target.id&&b(this.relations,n.relations)}update(t){return new e(this.source,this.target,t)}[Y](t,n,r){let i=this.toString();return Object.defineProperty(i,"constructor",{value:e,enumerable:!1}),i}toString(){return[this.expression,this.relations.size?` relations:`:` relations: [ ]`,...[...this.relations].map(e=>` `+e.expression)].join(`
|
|
4
|
+
`)}reversed(){return new e(this.target,this.source)}},Xe=e({findConnection:()=>$,findConnectionsBetween:()=>Ze,findConnectionsWithin:()=>Qe});function $(e,t,n=`directed`){if(e===t||Ce(e,t))return[];let r=e.allOutgoing.intersect(t.allIncoming),i=r.nonEmpty?[new Fe(e,t,r)]:[];return n===`directed`?i:[...i,...$(t,e,`directed`)]}function Ze(e,t,n=`both`){if(e.allIncoming.isEmpty&&e.allOutgoing.isEmpty)return[];let r=[],i=[];for(let a of t)if(e!==a)for(let t of $(e,a,n))t.source===e?r.push(t):i.push(t);return[...r,...i]}function Qe(e){return[...e].reduce((e,t,n,r)=>(n===r.length-1||e.push(...Ze(t,r.slice(n+1),`both`)),e),[])}var $e=e({findConnection:()=>et,findConnectionsBetween:()=>tt,findConnectionsWithin:()=>nt});function et(e,t,n=`directed`){if(e===t||Ce(e,t))return[];let r=m(e.allOutgoing,t.allIncoming),i=r.size>0?new Q(e,t,r):null;if(n===`directed`)return i?[i]:[];let a=m(e.allIncoming,t.allOutgoing),o=a.size>0?new Q(t,e,a):null;return i&&o?[i,o]:i?[i]:o?[o]:[]}function tt(e,t,n=`both`){if(e.allIncoming.size===0&&e.allOutgoing.size===0)return[];let r=[],i=[];for(let a of t)if(e!==a)for(let t of et(e,a,n))t.source===e?r.push(t):i.push(t);return[...r,...i]}function nt(e){return[...e].reduce((e,t,n,r)=>(n===r.length-1||e.push(...tt(t,r.slice(n+1),`both`)),e),[])}function rt(e){return e instanceof I}function it(e){return e instanceof L}function at(e){return rt(e)||it(e)}function ot(e){return e instanceof ke}function st(e){return e instanceof R}function ct(e){return e instanceof U}function lt(e){return e instanceof F}function ut(e){return e instanceof K}function dt(e){return e instanceof G}function ft(e){return e instanceof W}export{Fe as A,Ae as B,Ye as C,Ue as D,qe as E,K as F,I as G,je as H,G as I,F as J,R as K,W as L,Pe as M,J as N,ze as O,q as P,U as R,Ke as S,X as T,H as U,Me as V,L as W,Ve as _,ft as a,Ge as b,ot as c,et as d,tt as f,We as g,Q as h,st as i,Y as j,Le as k,dt as l,Xe as m,at as n,lt as o,$e as p,z as q,rt as r,ut as s,it as t,ct as u,Ie as v,Je as w,Z as x,He as y,Ne as z};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,a)=>(a=n==null?{}:e(i(n)),c(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));export{s as n,l as r,o as t};
|
|
1
|
+
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,a)=>(a=n==null?{}:e(i(n)),c(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));export{s as n,l as r,o as t};
|
package/dist/_chunks/types.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime.mjs";import{t}from"./libs/defu.mjs";import{B as n,I as r,M as i,N as a,O as o,T as s,V as c,et as l,it as ee,k as u,rt as te,t as ne,x as re}from"./libs/remeda.mjs";import{Q as d,et as f,h as p,i as ie,n as ae,t as oe}from"./utils.mjs";import{i as m,n as se,t as ce}from"./libs/mnemonist.mjs";import{a as le,c as ue,d as de,f as fe,h as pe,i as me,l as he,m as ge,n as _e,o as ve,p as ye,r as be,s as xe,t as Se,u as Ce}from"./libs/@radix-ui/colors.mjs";import{n as h,t as we}from"./libs/@mantine/colors-generator.mjs";function Te(e){return re(e,e=>e===void 0)}function Ee(e){return e.summary??e.description}function De(e){return e.description??e.summary}function Oe(e,t){return e[g]===t}const g=`_stage`,ke=`_type`,Ae=`_layout`;var je=e({DeploymentFqn:()=>w,EdgeId:()=>j,Fqn:()=>x,GlobalFqn:()=>D,GroupElementKind:()=>S,MarkdownOrString:()=>v,NodeId:()=>A,NoneIcon:()=>b,ProjectId:()=>_,RelationId:()=>E,StepEdgeKind:()=>Me,ViewId:()=>T,extractStep:()=>P,flattenMarkdownOrString:()=>y,isGlobalFqn:()=>O,isGroupElementKind:()=>C,isStepEdgeId:()=>N,splitGlobalFqn:()=>k,stepEdgeId:()=>M});function _(e){return e}function v(e){return typeof e==`string`?{txt:e}:e}function y(e){if(r(e))return null;let t=u(e)?e:e.txt??e.md;return o(t?.trim())?t:null}const b=`none`;function x(e,t){return t?t+`.`+e:e}const S=`@group`;function C(e){return e.kind===S}function w(e,t){return t?t+`.`+e:e}function T(e){return e}function E(e){return e}function D(e,t){return d(typeof e==`string`&&e!=``),`@`+e+`.`+t}function O(e){return e.startsWith(`@`)}function k(e){if(!e.startsWith(`@`))return[null,e];let t=e.indexOf(`.`);if(t<2)throw Error(`Invalid global FQN`);return[e.slice(1,t),e.slice(t+1)]}function A(e){return e}function j(e){return e}function M(e,t){let n=`step-${String(e).padStart(2,`0`)}`;return t?`${n}.${t}`:n}const Me=`@step`;function N(e){return e.startsWith(`step-`)}function P(e){if(!N(e))throw Error(`Invalid step edge id: ${e}`);return parseFloat(e.slice(5))}let F;(function(e){function t(e){return`model`in e&&!(`project`in e)}e.isElementRef=t;function n(e){return`project`in e&&`model`in e}e.isImportRef=n;function r(e){if(u(e))throw Error(`Expected FqnRef, got: "${e}"`);if(n(e))return D(e.project,e.model);if(t(e))return e.model;throw Error(`Expected FqnRef.ModelRef or FqnRef.ImportRef`)}e.flatten=r;function i(e){return t(e)||n(e)}e.isModelRef=i;function a(e){return`deployment`in e&&`element`in e}e.isInsideInstanceRef=a;function o(e){return`deployment`in e&&!(`element`in e)}e.isDeploymentElementRef=o;function s(e){return o(e)||a(e)}e.isDeploymentRef=s})(F||={});let I;(function(e){function t(e){return`wildcard`in e&&e.wildcard===!0}e.isWildcard=t;function n(e){return`ref`in e&&F.isModelRef(e.ref)}e.isModelRef=n;function r(e){return`ref`in e&&F.isDeploymentRef(e.ref)}e.isDeploymentRef=r;function i(e){return`elementKind`in e&&`isEqual`in e}e.isElementKindExpr=i;function a(e){return`elementTag`in e&&`isEqual`in e}e.isElementTagExpr=a;function o(e){return`where`in e&&c(e.where.expr)}e.isWhere=o;function s(e){return`custom`in e&&(c(e.custom.expr)||o(e.custom.expr))}e.isCustom=s;function c(e){return t(e)||n(e)||r(e)||i(e)||a(e)}e.is=c;function l(e){return s(e)&&(e=e.custom.expr),o(e)&&(e=e.where.expr),e}e.unwrap=l})(I||={});let L;(function(e){function t(e){return`source`in e&&`target`in e}e.isDirect=t;function n(e){return`incoming`in e}e.isIncoming=n;function r(e){return`outgoing`in e}e.isOutgoing=r;function i(e){return`inout`in e}e.isInOut=i;function a(e){return`where`in e&&(t(e.where.expr)||n(e.where.expr)||r(e.where.expr)||i(e.where.expr))}e.isWhere=a;function o(e){return`customRelation`in e}e.isCustom=o;function s(e){return t(e)||n(e)||r(e)||i(e)}e.is=s;function c(e){return o(e)&&(e=e.customRelation.expr),a(e)&&(e=e.where.expr),e}e.unwrap=c})(L||={});let R;(function(e){function t(e){return`where`in e}e.isWhere=t;function n(e){return L.isWhere(e)}e.isRelationWhere=n;function r(e){return I.isWhere(e)}e.isFqnExprWhere=r;function i(e){return I.is(e)||I.isWhere(e)||I.isCustom(e)}e.isFqnExpr=i;function a(e){return L.is(e)||L.isWhere(e)||L.isCustom(e)}e.isRelation=a})(R||={});let z;(function(e){function t(e){return`wildcard`in e&&e.wildcard===!0}e.isWildcard=t;function n(e){return`ref`in e&&F.isModelRef(e.ref)}e.isModelRef=n;function r(e){return`elementKind`in e&&`isEqual`in e}e.isElementKindExpr=r;function i(e){return`elementTag`in e&&`isEqual`in e}e.isElementTagExpr=i;function a(e){return`where`in e&&s(e.where.expr)}e.isWhere=a;function o(e){return`custom`in e&&(s(e.custom.expr)||a(e.custom.expr))}e.isCustom=o;function s(e){return t(e)||n(e)||r(e)||i(e)}e.is=s;function c(e){return o(e)&&(e=e.custom.expr),a(e)&&(e=e.where.expr),e}e.unwrap=c})(z||={});let B;(function(e){function t(e){return`source`in e&&`target`in e}e.isDirect=t;function n(e){return`incoming`in e}e.isIncoming=n;function r(e){return`outgoing`in e}e.isOutgoing=r;function i(e){return`inout`in e}e.isInOut=i;function a(e){return`where`in e&&(t(e.where.expr)||n(e.where.expr)||r(e.where.expr)||i(e.where.expr))}e.isWhere=a;function o(e){return`customRelation`in e}e.isCustom=o;function s(e){return t(e)||n(e)||r(e)||i(e)}e.is=s;function c(e){return o(e)&&(e=e.customRelation.expr),a(e)&&(e=e.where.expr),e}e.unwrap=c})(B||={});let V;(function(e){function t(e){return`where`in e}e.isWhere=t;function n(e){return B.isWhere(e)}e.isRelationWhere=n;function r(e){return z.isWhere(e)}e.isFqnExprWhere=r;function i(e){return z.is(e)||z.isWhere(e)||z.isCustom(e)}e.isFqnExpr=i;function a(e){return B.is(e)||B.isWhere(e)||B.isCustom(e)}e.isRelationExpr=a})(V||={});function Ne(e){return o(e.kind)&&!o(e.element)}function Pe(e){return o(e.element)&&!o(e.kind)}const H={fill:`#3b82f6`,stroke:`#2563eb`,hiContrast:`#eff6ff`,loContrast:`#bfdbfe`},U={fill:`#0284c7`,stroke:`#0369a1`,hiContrast:`#f0f9ff`,loContrast:`#B6ECF7`},W={fill:`#64748b`,stroke:`#475569`,hiContrast:`#f8fafc`,loContrast:`#cbd5e1`},Fe={primary:H,blue:H,secondary:U,sky:U,muted:W,slate:W,gray:{fill:`#737373`,stroke:`#525252`,hiContrast:`#fafafa`,loContrast:`#d4d4d4`},red:{fill:`#AC4D39`,stroke:`#853A2D`,hiContrast:`#FBD3CB`,loContrast:`#f5b2a3`},green:{fill:`#428a4f`,stroke:`#2d5d39`,hiContrast:`#f8fafc`,loContrast:`#c2f0c2`},amber:{fill:`#A35829`,stroke:`#7E451D`,hiContrast:`#FFE0C2`,loContrast:`#f9b27c`},indigo:{fill:`#6366f1`,stroke:`#4f46e5`,hiContrast:`#eef2ff`,loContrast:`#c7d2fe`}},Ie={line:`#8D8D8D`,labelBg:`#18191B`,label:`#C9C9C9`},G={line:`#64748b`,labelBg:`#0f172a`,label:`#cbd5e1`},K={line:`#3b82f6`,labelBg:`#172554`,label:`#60a5fa`},q={line:`#0ea5e9`,labelBg:`#082f49`,label:`#38bdf8`},Le={amber:{line:`#b45309`,labelBg:`#78350f`,label:`#FFE0C2`},blue:K,gray:Ie,green:{line:`#15803d`,labelBg:`#052e16`,label:`#22c55e`},indigo:{line:`#6366f1`,labelBg:`#1e1b4b`,label:`#818cf8`},muted:G,primary:K,red:{line:`#AC4D39`,labelBg:`#b91c1c`,label:`#f5b2a3`},secondary:q,sky:q,slate:G},Re={sizes:{xs:{width:180,height:100},sm:{width:240,height:135},md:{width:320,height:180},lg:{width:420,height:234},xl:{width:520,height:290}},spacing:{xs:8,sm:10,md:16,lg:24,xl:32},textSizes:{xs:13.33,sm:16,md:19.2,lg:23.04,xl:27.65},iconSizes:{xs:24,sm:36,md:60,lg:82,xl:90}},ze=[`xs`,`sm`,`md`,`lg`,`xl`],Be=[`left`,`right`,`top`,`bottom`],Ve=[`solid`,`dashed`,`dotted`,`none`],He=[`rectangle`,`person`,`browser`,`mobile`,`cylinder`,`storage`,`queue`,`bucket`,`document`,`component`],J=[`amber`,`blue`,`gray`,`slate`,`green`,`indigo`,`muted`,`primary`,`red`,`secondary`,`sky`],Ue=[`tomato`,`grass`,`blue`,`ruby`,`orange`,`indigo`,`pink`,`teal`,`purple`,`amber`,`crimson`,`red`,`lime`,`yellow`,`violet`],Y={tomato:ye.tomato9,grass:me.grass9,blue:_e.blue9,ruby:de.ruby9,orange:xe.orange9,indigo:le.indigo9,pink:ue.pink9,teal:fe.teal9,purple:he.purple9,amber:Se.amber9,crimson:be.crimson9,red:Ce.red9,lime:ve.lime9,yellow:pe.yellow9,violet:ge.violet9};function We(e){return e in Y}const Ge={colors:J.reduce((e,t)=>(e[t]={elements:Fe[t],relationships:Le[t]},e),{}),...Re};function Ke(e){d(h.valid(e),`Invalid color: ${e}`);let t=we(e),n=t[6],r=qe(n);return{elements:{fill:n,stroke:t[7],...r},relationships:{line:t[4],label:t[3],labelBg:t[9]}}}function qe(e){let t=h(e),n=t.brighten(2),r=t.darken(2),i,a,o,s;do i=n,a=r,n=n.brighten(1),r=r.darken(1),o=h.contrastAPCA(t,n),s=h.contrastAPCA(t,r);while(Math.abs(o)<60&&Math.abs(s)<60&&(!c(n,i)||!c(r,a)));return Math.abs(o)>Math.abs(s)?{hiContrast:n.brighten(.4).hex(),loContrast:n.hex()}:{hiContrast:r.darken(.4).hex(),loContrast:r.hex()}}function Je(e,t){let n=t??6,r=h(e.fill),i=h(e.stroke),a=r.luminance()>.8,o=l(ne(h.scale(a?[r.darken(.02).desaturate(.05),r.darken(.1).desaturate(.1)]:[r.shade(.12,`lch`).desaturate(.05),r.shade(.35,`lch`).desaturate(.4)]).mode(`oklch`).correctLightness().colors(n,null),h.scale(a?[i.darken(.04).desaturate(.05),i.darken(.12).desaturate(.1)]:[i.shade(.15,`lch`).desaturate(.08),i.shade(.4,`lch`).desaturate(.4)]).mode(`oklch`).correctLightness().colors(n,null)),s(([t,n])=>({...e,fill:t.hex(),stroke:n.hex()})));return d(o.length===n,`Expected ${n} colors, got ${o.length}`),o}const Ye={color:`primary`,size:`md`,opacity:15,shape:`rectangle`,group:{opacity:15,border:`dashed`},relationship:{color:`gray`,line:`dashed`,arrow:`normal`}},Xe=Ge,X={theme:Xe,defaults:Ye};var Ze=class e{theme;defaults;static DEFAULT=new e(X);static from(n,i){if(!n&&!i)return this.DEFAULT;let{customCss:a,theme:o,defaults:s}={...n},l=t({theme:o},{defaults:{...s}},{theme:{colors:{...i}}},X);return r(a?.content)&&c(l,X)?this.DEFAULT:new e(l,a)}constructor(e,t){this.config=e,this.customCss=t,this.theme=e.theme,this.defaults=e.defaults}get fingerprint(){return p(this,`fingerprint`,()=>ie({config:this.config,customCss:this.customCss}))}get elementColors(){return this.theme.colors[this.defaults.color].elements}get relationshipColors(){return this.theme.colors[this.defaults.relationship.color].relationships}get groupColors(){let e=this.defaults.group?.color;if(!e)return this.elementColors;if(!this.isThemeColor(e))throw Error(`Default group color not found in theme: ${e}`);return p(this,`defaultGroup`,()=>({...this.elementColors,...this.theme.colors[e].elements}))}isDefaultColor(e){return e===this.defaults.color}colors(e){return this.computeFrom(e??this.defaults.color)}compoundColorsCache=new se.default(e=>new ce.default(t=>Je(e,t)));colorsForCompounds(e,t){return this.compoundColorsCache.get(e).get(t??6)}fontSize(e){return e??=this.defaults.text??this.defaults.size,this.theme.textSizes[e]}padding(e){return e??=this.defaults.padding??this.defaults.size,this.theme.spacing[e]}iconSize(e){return e??=this.defaults.size,this.theme.iconSizes[e]}isThemeColor(e){return e in this.theme.colors}nodeSizes(e){let t=Qe(e,this.defaults.size);return{sizes:t,values:{sizes:this.theme.sizes[t.size],padding:this.padding(t.padding),textSize:this.fontSize(t.textSize),iconSize:this.iconSize(t.iconSize)}}}computeFrom(e){if(this.isThemeColor(e))return this.theme.colors[e];if(!h.valid(e))throw Error(`Invalid color value: "${e}" (not a theme color and not a valid CSS color)`);return Ke(e)}equals(e){return e===this?!0:this.constructor===e.constructor?this.fingerprint===e.fingerprint:!1}tagColor(e){return this.isThemeColor(e)?this.theme.colors[e].elements:We(e)?this.computeFrom(Y[e]).elements:this.computeFrom(e).elements}};function Qe({size:e,padding:t,textSize:n,iconSize:r,...i},a=X.defaults.size){return e??=a,n??=e,t??=e,r??=e,{...i,size:e,padding:t,textSize:n,iconSize:r}}function $e(e){let t=typeof e==`string`?e:e.color;return t.startsWith(`#`)||t.startsWith(`rgb`)}function et(e){return`tag`in e}function tt(e){return`kind`in e}function nt(e){return`metadata`in e}function rt(e){return`participant`in e}function it(e){return`not`in e}function at(e){return`and`in e}function Z(e){return`or`in e}function Q(e){switch(!0){case rt(e):{let t=e.participant;return ot(t,Q(e.operator))}case et(e):{if(u(e.tag)||`eq`in e.tag){let t=u(e.tag)?e.tag:e.tag.eq;return e=>Array.isArray(e.tags)&&e.tags.includes(t)}let t=e.tag.neq;return e=>!Array.isArray(e.tags)||!e.tags.includes(t)}case tt(e):{if(u(e.kind)||`eq`in e.kind){let t=u(e.kind)?e.kind:e.kind.eq;return e=>e.kind===t}let t=e.kind.neq;return e=>i(e.kind)||e.kind!==t}case nt(e):{let{key:t,value:n}=e.metadata;if(n===void 0)return e=>e.metadata!=null&&t in e.metadata&&e.metadata[t]!=null;if(u(n)||`eq`in n){let e=u(n)?n:n.eq;return n=>{if(!n.metadata)return!1;let r=n.metadata[t];return Array.isArray(r)?r.includes(e):r===e}}let r=n.neq;return e=>{if(!e.metadata)return!0;let n=e.metadata[t];return n==null?!0:Array.isArray(n)?!n.includes(r):n!==r}}case it(e):return a(Q(e.not));case at(e):return ee(e.and.map(Q));case Z(e):return te(e.or.map(Q));default:f(e)}}function ot(e,t){return n=>{if(!n.source||!n.target)return!1;switch(e){case`source`:return t(n.source);case`target`:return t(n.target)}}}function st(e){return`include`in e||`exclude`in e}function ct(e){return`targets`in e&&`style`in e}function lt(e){return e._stage===`computed`}function ut(e){return e._stage===`layouted`}function $(e){return e._type===`element`}function dt(e){return $(e)&&o(e.viewOf)}function ft(e){return $(e)&&o(e.extends)}function pt(e){return e._type===`deployment`}function mt(e){return e._type===`dynamic`}function ht(e){return`styleId`in e}function gt(e){return`predicateId`in e}function _t(e){return e===`TB`||e===`BT`||e===`LR`||e===`RL`}function vt(e){return`direction`in e}function yt(e){return N(e)&&e.includes(`.`)?e.slice(0,e.indexOf(`.`)+1):null}function bt(e){return!!e&&!(`__series`in e||`__parallel`in e)}function xt(e){return!!e&&`__parallel`in e&&n(e.__parallel)}function St(e){return!!e&&`__series`in e&&n(e.__series)}function Ct(e){return`title`in e&&`groupRules`in e&&Array.isArray(e.groupRules)}function wt(e){return`rank`in e&&Array.isArray(e.targets)}const Tt=Symbol.for(`text`),Et=Symbol.for(`html`);var Dt=class e{static mdcache=new m.default(500);static txtcache=new m.default(500);static getOrCreateFromText(t){if(t=t.trimEnd(),t===``)return e.EMPTY;let n=e.txtcache.get(t);return n||(n=new e({txt:t}),e.txtcache.set(t,n),n)}static getOrCreateFromMarkdown(t){if(t=t.trimEnd(),t===``)return e.EMPTY;let n=e.mdcache.get(t);return n||(n=new e({md:t}),e.mdcache.set(t,n),n)}static memoize(t,n,r){return p(t,n,()=>e.from(r))}static from(t){return t==null||t===e.EMPTY?e.EMPTY:t instanceof e?t:typeof t==`string`?this.getOrCreateFromText(t):`isEmpty`in t&&t.isEmpty?e.EMPTY:`md`in t?this.getOrCreateFromMarkdown(t.md):this.getOrCreateFromText(t.txt)}static EMPTY=new class extends e{isEmpty=!0;nonEmpty=!1;isMarkdown=!1;$source=null;constructor(){super({txt:``})}get text(){return null}get md(){return null}get html(){return null}};$source;isEmpty;nonEmpty;isMarkdown;constructor(e){this.isMarkdown=!1,typeof e==`string`?(this.$source={txt:e},this.isEmpty=e.trim()===``):(this.$source=e,this.isEmpty=!0,`md`in e?(this.isEmpty=e.md===``,this.isMarkdown=!0):this.isEmpty=e.txt===``),this.nonEmpty=!this.isEmpty}get text(){if(this.isEmpty||this.$source===null)return``;let e=this.$source;return`txt`in e?e.txt:p(this,Tt,()=>oe(e.md))}get md(){if(this.isEmpty||this.$source===null)return``;let e=this.$source;if(`md`in e)return e.md;if(`txt`in e)return e.txt;f(e)}get html(){if(this.isEmpty||this.$source===null)return``;let e=this.$source;return`txt`in e?e.txt:p(this,Et,()=>ae(e.md))}equals(t){return this===t?!0:t instanceof e?this.isEmpty&&t.isEmpty?!0:this.isEmpty!==t.isEmpty||this.isMarkdown!==t.isMarkdown?!1:this.isMarkdown?this.$source?.md===t.$source?.md:this.$source?.txt===t.$source?.txt:!1}};export{D as $,Qe as A,J as B,nt as C,et as D,rt as E,Ve as F,B as G,Ne as H,Ue as I,L as J,R as K,He as L,Xe as M,Ye as N,Q as O,Ke as P,x as Q,Be as R,tt as S,Te as St,Z as T,V as U,Pe as V,z as W,w as X,F as Y,j as Z,ft as _,g as _t,bt as a,E as at,ct as b,De as bt,_t as c,P as ct,ht as d,C as dt,S as et,lt as f,N as ft,$ as g,Ae as gt,mt as h,M as ht,yt as i,_ as it,Ze as j,$e as k,vt as l,y as lt,ut as m,k as mt,Ct as n,A as nt,xt as o,Me as ot,pt as p,je as pt,I as q,wt as r,b as rt,St as s,T as st,Dt as t,v as tt,gt as u,O as ut,dt as v,ke as vt,it as w,at as x,Ee as xt,st as y,Oe as yt,ze as z};
|
|
1
|
+
import{n as e,r as t}from"./rolldown-runtime.mjs";import{t as n}from"./libs/defu.mjs";import{B as r,F as i,I as a,M as o,N as s,O as c,P as l,Q as u,R as d,T as f,V as p,a as ee,et as m,f as te,it as ne,k as h,l as re,rt as ie,t as g,x as ae}from"./libs/remeda.mjs";import{i as _,n as oe,s as se,t as ce}from"./libs/mnemonist.mjs";import{t as le}from"./libs/natural-compare-lite.mjs";import{t as ue}from"./libs/ohash.mjs";import{n as de}from"./libs/hast-util-sanitize.mjs";import{t as fe}from"./libs/rehype-sanitize.mjs";import{t as pe}from"./libs/rehype-stringify.mjs";import{l as me,t as he}from"./libs/mdast-util-from-markdown.mjs";import{t as ge}from"./libs/remark-gfm.mjs";import{t as _e}from"./libs/remark-github-blockquote-alert.mjs";import{t as ve}from"./libs/remark-parse.mjs";import{t as ye}from"./libs/remark-rehype.mjs";import{t as be}from"./libs/unified.mjs";import{a as xe,c as Se,d as Ce,f as we,h as Te,i as Ee,l as De,m as Oe,n as ke,o as Ae,p as je,r as Me,s as Ne,t as Pe,u as Fe}from"./libs/@radix-ui/colors.mjs";import{t as v}from"./libs/chroma-js.mjs";function Ie(e){return ae(e,e=>e===void 0)}function Le(e){return e.summary??e.description}function Re(e){return e.description??e.summary}function y(e){return Array.isArray(e)&&e.length===2&&typeof e[0]==`number`&&typeof e[1]==`number`}function ze(e){return y(e)?{x:e[0],y:e[1]}:[e.x,e.y]}function Be(e,t){if(e===void 0||e==null){let n=typeof t==`function`?t():t;throw Error(n??`Expected defined value, but received ${e}`)}return e}function b(e,t){if(!e)throw Error(t??`Invariant failed`)}function x(e){throw Error(`NonExhaustive value: ${e}`)}const Ve={center({x:e,y:t,width:n,height:r}){return{x:e+n/2,y:t+r/2}},toPoints({x:e,y:t,width:n,height:r}){return[{x:e,y:t},{x:e+n,y:t},{x:e+n,y:t+r},{x:e,y:t+r}]},fromPoints(e){let{x1:t,y1:n,x2:r,y2:i}=S.fromPoints(e);return{x:t,y:n,width:r-t,height:i-n}},merge(...e){if(b(u(e,1),`No boxes provided`),e.length===1)return e[0];let t=e[0].x,n=e[0].y,r=e[0].x+e[0].width,i=e[0].y+e[0].height;for(let a=1;a<e.length;a++){let o=e[a];t=Math.min(t,o.x),n=Math.min(n,o.y),r=Math.max(r,o.x+o.width),i=Math.max(i,o.y+o.height)}return{x:Math.floor(t),y:Math.floor(n),width:Math.round(r-t),height:Math.round(i-n)}},fromRectBox(e){return{x:Math.min(e.x1,e.x2),y:Math.min(e.y1,e.y2),width:Math.abs(e.x2-e.x1),height:Math.abs(e.y2-e.y1)}},toRectBox(e){return{x1:e.x,y1:e.y,x2:e.x+e.width,y2:e.y+e.height}},expand(e,t){return t===0?e:{x:e.x-t,y:e.y-t,width:e.width+t*2,height:e.height+t*2}},shrink(e,t){return t===0?e:{x:e.x+t,y:e.y+t,width:e.width-t*2,height:e.height-t*2}},includes(e,t){return e===t?!0:e.x<=t.x&&e.y<=t.y&&e.x+e.width>=t.x+t.width&&e.y+e.height>=t.y+t.height}},S={center({x1:e,y1:t,x2:n,y2:r}){return{x:(e+n)/2,y:(t+r)/2}},fromPoints(e){b(e.length>0,`At least one point is required`);let t=1/0,n=1/0,r=-1/0,i=-1/0;for(let[a,o]of e)t=Math.min(t,a),n=Math.min(n,o),r=Math.max(r,a),i=Math.max(i,o);return{x1:t,y1:n,x2:r,y2:i}},merge(...e){b(e.length>0,`No boxes provided`);let t=1/0,n=1/0,r=-1/0,i=-1/0;for(let a of e)t=Math.min(t,a.x1),n=Math.min(n,a.y1),r=Math.max(r,a.x2),i=Math.max(i,a.y2);return{x1:t,y1:n,x2:r,y2:i}},toBBox(e){return{x:e.x1,y:e.y1,width:e.x2-e.x1,height:e.y2-e.y1}},includes(e,t){return e===t?!0:e.x1<=t.x1&&e.y1<=t.y1&&e.x2>=t.x2&&e.y2>=t.y2}};function He(e,t,n){return e.length===0||t.length===0?[]:(n??=Object.is,m(g(e,t),ee(([e,t])=>n(e,t)),f(([e,t])=>e)))}var C=t(le(),1);function w(e,t){return e===t?0:h(e)?h(t)?(0,C.default)(e,t):1:h(t)?-1:0}function T(e){return re(e,w)}function Ue(...e){return e.length===0?T:T(e[0])}function We(e=`.`,t=!1){return(n,r)=>{if(n===r)return 0;if(!n)return-1;if(!r)return 1;let i=n.split(e),a=r.split(e),o=Math.min(i.length,a.length);for(let e=0;e<o;e++){let t=i[e],n=a[e],r=(0,C.default)(t,n);if(r!==0)return r}let s=i.length-a.length;return t?-1*s:s}}function Ge(e){let t=e.lastIndexOf(`.`);return t>0?e.slice(0,t):null}function Ke(e){let t=e.lastIndexOf(`.`);return t>0?e.slice(t+1):e}const E=e=>N(e)?e:e.id;function D(e,t){let n=E(e);return t?E(t).startsWith(n+`.`):e=>{let t=E(e);return n.startsWith(t+`.`)}}function O(e,t){if(!t)return t=>O(e,t);let n=E(e),r=E(t);return n===r||r.startsWith(n+`.`)||n.startsWith(r+`.`)}function qe(e,t){return t?D(t,e):t=>D(e,t)}function k(e){return(N(e)?e:e.id).split(`.`).length}function Je(e,t){let n=N(e)?e:e.id,r=N(t)?t:t.id;if(n===r)return 0;let i=k(n),a=k(r);if(O(n,r))return Math.abs(i-a);let o=A(n,r),s=o?k(o):0;return i+a-(2*s+1)}function A(e,t){let n=e.split(`.`);if(n.length<2)return null;let r=t.split(`.`);if(r.length<2)return null;let i=[];for(let e=0;e<Math.min(n.length,r.length)-1&&n[e]===r[e];e++)i.push(n[e]);return i.length===0?null:i.join(`.`)}function Ye(e){let t=e.split(`.`);if(t.pop(),!u(t,2))return t;for(let e=1;e<t.length;e++)t[e]=t[e-1]+`.`+t[e];return t.reverse()}function j(e,t){let n=e.split(`.`).length,r=t.split(`.`).length;switch(!0){case n>r:return 1;case n<r:return-1;default:return 0}}function Xe(e,t){return j(e.id,t.id)}function Ze(e){return e.map(e=>({item:e,fqn:e.id.split(`.`)})).sort((e,t)=>e.fqn.length-t.fqn.length).map(({item:e})=>e)}function Qe(e,t){let n=t;for(let t of e)t!==n&&D(t,n)&&(n=t);return n===t?null:n}function $e(e){let t=[],n=[...e],r;for(;r=n.shift();){let e;for(;e=Qe(n,r);)t.push(...n.splice(n.indexOf(e),1));t.push(r)}return t}function M(e,t){if(!e||N(e)){let t=e??`asc`;return e=>M(e,t)}let n=t===`desc`?-1:1;return e.map(e=>({item:e,fqn:e.id.split(`.`)})).sort((e,t)=>{if(e.fqn.length!==t.fqn.length)return(e.fqn.length-t.fqn.length)*n;for(let n=0;n<e.fqn.length;n++){let r=w(e.fqn[n],t.fqn[n]);if(r!==0)return r}return 0}).map(({item:e})=>e)}function et(e,t,n){let r=e.get(t);return r||(r=n(t),e.set(t,r)),r}function N(e){return e!=null&&typeof e==`string`}function tt(e){return!!e&&Array.isArray(e)&&e.length>0}function P(e,t){return b(typeof t==`string`,`Path must be string`),typeof e==`object`&&!!e&&e[t]!=null}function nt(e){return t=>P(t,e)}function rt(...e){if(e.length===1&&typeof e[0]==`string`)return nt(e[0]);let[t,n]=e;return P(t,n)}function it(...e){return(t=>e.some(e=>e(t)))}function at(e){return typeof e==`object`&&!!e&&Symbol.iterator in e}function ot(e,t){let n=t??e;b(i(n));function*r(e){for(let t of e)n(t)&&(yield t)}return t?r(e):r}function st(e,t){let n=t??e;b(i(n));function r(e){for(let t of e)if(n(t))return t}return t?r(e):r}function ct(e,t){let n=t??e;b(typeof n==`number`&&n>=0,`Count must be a non-negative number`);function*r(e){let t=0;for(let r of e){if(t>=n)break;yield r,t++}}return t===void 0?e=>r(e):r(e)}function lt(e){return e?F(e):F}function*F(e){for(let t of e)yield*t}function ut(e,t){let n=t??e;b(i(n));function*r(e){for(let t of e)yield*n(t)}return t?r(e):r}function dt(e){return e?I(e):I}function I(e){let{value:t}=e[Symbol.iterator]().next();return t}function ft(e,t){let n=t??e;b(i(n));function*r(e){for(let t of e)yield n(t)}return t?r(e):r}function pt(e,t,n){let r=d(n)?t:e,a=n??t;b(i(r));function o(e){let t=a;for(let n of e)t=r(t,n);return t}return d(n)?o(e):o}function mt(e,t){let n=t??e;b(i(n));function r(e){for(let t of e)if(n(t))return!0;return!1}return t?r(e):r}function ht(e){return e?Array.from(e):e=>Array.from(e)}function gt(e){return e?new Set(e):e=>new Set(e)}function _t(e){return e?L(e):L}function*L(e){let t=new Set;for(let n of e)t.has(n)||(t.add(n),yield n)}function R(e,t,n){let r=typeof t==`symbol`?t:Symbol.for(t);return e.hasOwnProperty(r)||Object.defineProperty(e,r,{enumerable:!1,writable:!1,value:n()}),e[r]}function vt(...e){let t=100;return e.length===2?t=te(e[0],e[1]):e.length===1&&(t=e[0]),new Promise(e=>{setTimeout(()=>{e(`LIKEC4_DELAY`)},t??100)})}function yt(){return Promise.resolve().then(()=>void 0)}function bt(e){Promise.resolve().then(e)}const xt=(e,t)=>{let n=A(e.source.id,e.target.id),r=A(t.source.id,t.target.id);if(n&&!r)return 1;if(!n&&r)return-1;let i=n&&r?j(n,r):0;if(i!==0)return i;let a=j(e.source.id,t.source.id);return a===0?j(e.target.id,t.target.id):a},St=se.intersection,Ct=se.symmetricDifference;function wt(...e){let t=new Set;for(let n of e)for(let e of n)t.add(e);return t}function Tt(e,...t){let n=new Set;if(e.size===0)return n;let r=u(t,2)?St(...t):t[0];if(r.size===0)return n;for(let t of e)r.has(t)&&n.add(t);return n}function Et(e,t){if(e.size===0)return new Set;if(t.size===0)return new Set(e);let n=new Set;for(let r of e)t.has(r)||n.add(r);return n}function Dt(e,t){return e.size===t.size&&[...e].every(e=>t.has(e))}function Ot(e,t){return Ct(e,t)}function kt(e,t){if(e.size===0||t.size===0)return!1;t.size<e.size&&([e,t]=[t,e]);for(let n of e)if(t.has(n))return!0;return!1}function z(e){return b(typeof e==`object`&&l(e),`objectHash: value must be an object`),ue(e)}function At(e){let t=5381,n=e.length;b(n>0,`stringHash: empty string`);for(let r=0;r<n;r++)t=t*33^e.charCodeAt(r);return(t>>>0).toString(36)}function jt(){return be().use(ve).use(ge).use(_e).use(ye,{allowDangerousHtml:!0}).use(fe,n({attributes:{"*":[`className`],svg:[`width`,`height`,`viewBox`,`fill`,`ariaHidden`],path:[`d`,`fill`,`stroke`,`strokeWidth`,`strokeLinecap`,`strokeLinejoin`]},tagNames:[`svg`,`g`,`path`,`div`],protocols:{src:[`data`]}},de)).use(pe,{allowDangerousHtml:!0})}function B(e){return(``+jt().processSync(e)).trim()}function V(e){return me(he(e),{includeHtml:!1,includeImageAlt:!1})}function Mt(e){return e}var H=class e{x;y;constructor(e,t){this.x=e,this.y=t,b(typeof e==`number`&&!isNaN(e)&&isFinite(e)&&typeof t==`number`&&!isNaN(t)&&isFinite(t),`Invalid arguments for Vector: (${e}, ${t})`)}static create(...t){return t.length===2?new e(t[0],t[1]):new e(t[0].x,t[0].y)}static add(e,t){return{x:e.x+t.x,y:e.y+t.y}}static subtract(e,t){return{x:e.x-t.x,y:e.y-t.y}}static multiply(e,t){return{x:e.x*t,y:e.y*t}}static divide(e,t){return{x:e.x/t,y:e.y/t}}static dot(e,t){return e.x*t.x+e.y*t.y}add(t){return new e(this.x+t.x,this.y+t.y)}subtract(t){return new e(this.x-t.x,this.y-t.y)}multiply(t){return new e(this.x*t,this.y*t)}divide(t){return new e(this.x/t,this.y/t)}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}length(){return this.x===0&&this.y===0?0:Math.sqrt(this.x**2+this.y**2)}normalize(){let t=this.length();return t===0?new e(0,0):new e(this.x/t,this.y/t)}round(){return new e(Math.round(this.x),Math.round(this.y))}trunc(){return new e(Math.trunc(this.x),Math.trunc(this.y))}toObject(){return{x:this.x,y:this.y}}};function Nt(...e){return e.length===1&&e[0]instanceof H?e[0]:e.length===2?new H(e[0],e[1]):new H(e[0].x,e[0].y)}function Pt(e,t){return e[Ft]===t}const Ft=`_stage`,It=`_type`,Lt=`_layout`;var Rt=e({DeploymentFqn:()=>Gt,EdgeId:()=>Zt,Fqn:()=>Ut,GlobalFqn:()=>W,GroupElementKind:()=>U,MarkdownOrString:()=>Bt,NodeId:()=>Xt,NoneIcon:()=>Ht,ProjectId:()=>zt,RelationId:()=>qt,StepEdgeKind:()=>$t,ViewId:()=>Kt,extractStep:()=>en,flattenMarkdownOrString:()=>Vt,isGlobalFqn:()=>Jt,isGroupElementKind:()=>Wt,isStepEdgeId:()=>G,splitGlobalFqn:()=>Yt,stepEdgeId:()=>Qt});function zt(e){return e}function Bt(e){return typeof e==`string`?{txt:e}:e}function Vt(e){if(a(e))return null;let t=h(e)?e:e.txt??e.md;return c(t?.trim())?t:null}const Ht=`none`;function Ut(e,t){return t?t+`.`+e:e}const U=`@group`;function Wt(e){return e.kind===U}function Gt(e,t){return t?t+`.`+e:e}function Kt(e){return e}function qt(e){return e}function W(e,t){return b(typeof e==`string`&&e!=``),`@`+e+`.`+t}function Jt(e){return e.startsWith(`@`)}function Yt(e){if(!e.startsWith(`@`))return[null,e];let t=e.indexOf(`.`);if(t<2)throw Error(`Invalid global FQN`);return[e.slice(1,t),e.slice(t+1)]}function Xt(e){return e}function Zt(e){return e}function Qt(e,t){let n=`step-${String(e).padStart(2,`0`)}`;return t?`${n}.${t}`:n}const $t=`@step`;function G(e){return e.startsWith(`step-`)}function en(e){if(!G(e))throw Error(`Invalid step edge id: ${e}`);return parseFloat(e.slice(5))}let K;(function(e){function t(e){return`model`in e&&!(`project`in e)}e.isElementRef=t;function n(e){return`project`in e&&`model`in e}e.isImportRef=n;function r(e){if(h(e))throw Error(`Expected FqnRef, got: "${e}"`);if(n(e))return W(e.project,e.model);if(t(e))return e.model;throw Error(`Expected FqnRef.ModelRef or FqnRef.ImportRef`)}e.flatten=r;function i(e){return t(e)||n(e)}e.isModelRef=i;function a(e){return`deployment`in e&&`element`in e}e.isInsideInstanceRef=a;function o(e){return`deployment`in e&&!(`element`in e)}e.isDeploymentElementRef=o;function s(e){return o(e)||a(e)}e.isDeploymentRef=s})(K||={});let q;(function(e){function t(e){return`wildcard`in e&&e.wildcard===!0}e.isWildcard=t;function n(e){return`ref`in e&&K.isModelRef(e.ref)}e.isModelRef=n;function r(e){return`ref`in e&&K.isDeploymentRef(e.ref)}e.isDeploymentRef=r;function i(e){return`elementKind`in e&&`isEqual`in e}e.isElementKindExpr=i;function a(e){return`elementTag`in e&&`isEqual`in e}e.isElementTagExpr=a;function o(e){return`where`in e&&c(e.where.expr)}e.isWhere=o;function s(e){return`custom`in e&&(c(e.custom.expr)||o(e.custom.expr))}e.isCustom=s;function c(e){return t(e)||n(e)||r(e)||i(e)||a(e)}e.is=c;function l(e){return s(e)&&(e=e.custom.expr),o(e)&&(e=e.where.expr),e}e.unwrap=l})(q||={});let J;(function(e){function t(e){return`source`in e&&`target`in e}e.isDirect=t;function n(e){return`incoming`in e}e.isIncoming=n;function r(e){return`outgoing`in e}e.isOutgoing=r;function i(e){return`inout`in e}e.isInOut=i;function a(e){return`where`in e&&(t(e.where.expr)||n(e.where.expr)||r(e.where.expr)||i(e.where.expr))}e.isWhere=a;function o(e){return`customRelation`in e}e.isCustom=o;function s(e){return t(e)||n(e)||r(e)||i(e)}e.is=s;function c(e){return o(e)&&(e=e.customRelation.expr),a(e)&&(e=e.where.expr),e}e.unwrap=c})(J||={});let tn;(function(e){function t(e){return`where`in e}e.isWhere=t;function n(e){return J.isWhere(e)}e.isRelationWhere=n;function r(e){return q.isWhere(e)}e.isFqnExprWhere=r;function i(e){return q.is(e)||q.isWhere(e)||q.isCustom(e)}e.isFqnExpr=i;function a(e){return J.is(e)||J.isWhere(e)||J.isCustom(e)}e.isRelation=a})(tn||={});let Y;(function(e){function t(e){return`wildcard`in e&&e.wildcard===!0}e.isWildcard=t;function n(e){return`ref`in e&&K.isModelRef(e.ref)}e.isModelRef=n;function r(e){return`elementKind`in e&&`isEqual`in e}e.isElementKindExpr=r;function i(e){return`elementTag`in e&&`isEqual`in e}e.isElementTagExpr=i;function a(e){return`where`in e&&s(e.where.expr)}e.isWhere=a;function o(e){return`custom`in e&&(s(e.custom.expr)||a(e.custom.expr))}e.isCustom=o;function s(e){return t(e)||n(e)||r(e)||i(e)}e.is=s;function c(e){return o(e)&&(e=e.custom.expr),a(e)&&(e=e.where.expr),e}e.unwrap=c})(Y||={});let X;(function(e){function t(e){return`source`in e&&`target`in e}e.isDirect=t;function n(e){return`incoming`in e}e.isIncoming=n;function r(e){return`outgoing`in e}e.isOutgoing=r;function i(e){return`inout`in e}e.isInOut=i;function a(e){return`where`in e&&(t(e.where.expr)||n(e.where.expr)||r(e.where.expr)||i(e.where.expr))}e.isWhere=a;function o(e){return`customRelation`in e}e.isCustom=o;function s(e){return t(e)||n(e)||r(e)||i(e)}e.is=s;function c(e){return o(e)&&(e=e.customRelation.expr),a(e)&&(e=e.where.expr),e}e.unwrap=c})(X||={});let nn;(function(e){function t(e){return`where`in e}e.isWhere=t;function n(e){return X.isWhere(e)}e.isRelationWhere=n;function r(e){return Y.isWhere(e)}e.isFqnExprWhere=r;function i(e){return Y.is(e)||Y.isWhere(e)||Y.isCustom(e)}e.isFqnExpr=i;function a(e){return X.is(e)||X.isWhere(e)||X.isCustom(e)}e.isRelationExpr=a})(nn||={});function rn(e){return c(e.kind)&&!c(e.element)}function an(e){return c(e.element)&&!c(e.kind)}const on={fill:`#3b82f6`,stroke:`#2563eb`,hiContrast:`#eff6ff`,loContrast:`#bfdbfe`},sn={fill:`#0284c7`,stroke:`#0369a1`,hiContrast:`#f0f9ff`,loContrast:`#B6ECF7`},cn={fill:`#64748b`,stroke:`#475569`,hiContrast:`#f8fafc`,loContrast:`#cbd5e1`},ln={primary:on,blue:on,secondary:sn,sky:sn,muted:cn,slate:cn,gray:{fill:`#737373`,stroke:`#525252`,hiContrast:`#fafafa`,loContrast:`#d4d4d4`},red:{fill:`#AC4D39`,stroke:`#853A2D`,hiContrast:`#FBD3CB`,loContrast:`#f5b2a3`},green:{fill:`#428a4f`,stroke:`#2d5d39`,hiContrast:`#f8fafc`,loContrast:`#c2f0c2`},amber:{fill:`#A35829`,stroke:`#7E451D`,hiContrast:`#FFE0C2`,loContrast:`#f9b27c`},indigo:{fill:`#6366f1`,stroke:`#4f46e5`,hiContrast:`#eef2ff`,loContrast:`#c7d2fe`}},un={line:`#8D8D8D`,labelBg:`#18191B`,label:`#C9C9C9`},dn={line:`#64748b`,labelBg:`#0f172a`,label:`#cbd5e1`},fn={line:`#3b82f6`,labelBg:`#172554`,label:`#eff5fd`},pn={line:`#0ea5e9`,labelBg:`#082f49`,label:`#d4f2ff`},mn={amber:{line:`#b45309`,labelBg:`#78350f`,label:`#FFE0C2`},blue:fn,gray:un,green:{line:`#15803d`,labelBg:`#052e16`,label:`#bbfcd3`},indigo:{line:`#6366f1`,labelBg:`#1e1b4b`,label:`#cbd0fd`},muted:dn,primary:fn,red:{line:`#AC4D39`,labelBg:`#b91c1c`,label:`#fcd9d2`},secondary:pn,sky:pn,slate:dn},hn={sizes:{xs:{width:180,height:100},sm:{width:240,height:135},md:{width:320,height:180},lg:{width:420,height:234},xl:{width:520,height:290}},spacing:{xs:8,sm:10,md:16,lg:24,xl:32},textSizes:{xs:13.33,sm:16,md:19.2,lg:23.04,xl:27.65},iconSizes:{xs:24,sm:36,md:60,lg:82,xl:90}},gn=[`xs`,`sm`,`md`,`lg`,`xl`],_n=[`left`,`right`,`top`,`bottom`],vn=[`solid`,`dashed`,`dotted`,`none`],yn=[`rectangle`,`person`,`browser`,`mobile`,`cylinder`,`storage`,`queue`,`bucket`,`document`,`component`],bn=[`amber`,`blue`,`gray`,`slate`,`green`,`indigo`,`muted`,`primary`,`red`,`secondary`,`sky`],xn=[`tomato`,`grass`,`blue`,`ruby`,`orange`,`indigo`,`pink`,`teal`,`purple`,`amber`,`crimson`,`red`,`lime`,`yellow`,`violet`],Sn={tomato:je.tomato9,grass:Ee.grass9,blue:ke.blue9,ruby:Ce.ruby9,orange:Ne.orange9,indigo:xe.indigo9,pink:Se.pink9,teal:we.teal9,purple:De.purple9,amber:Pe.amber9,crimson:Me.crimson9,red:Fe.red9,lime:Ae.lime9,yellow:Te.yellow9,violet:Oe.violet9};function Cn(e){return e in Sn}const wn={colors:bn.reduce((e,t)=>(e[t]={elements:ln[t],relationships:mn[t]},e),{}),...hn};function Tn(e,t){return t=Math.max(-1,Math.min(1,t)),e.map(e=>{let n=t>0?e+(255-e)*t:e*(1+t);return Math.round(Math.max(0,Math.min(255,n)))})}function En(e,t){return v(Tn(v(e).rgb(),t)).hex()}function Dn(e){b(v.valid(e),`Invalid color: ${e}`);let t=e.trim(),n=On(t.startsWith(`#`)?t:v(t).hex());return{elements:{fill:n.el_main,stroke:n.el_secondary,hiContrast:n.el_hiContrast,loContrast:n.el_loContrast},relationships:{line:n.rel_secondary,label:n.rel_hiContrast,labelBg:n.rel_main}}}function On(e){let t=e,n=v(t).darken(.8).hex(),r=kn(t),i=r.hiContrast,a=r.loContrast,o=t;return{el_main:t,el_secondary:n,el_hiContrast:i,el_loContrast:a,rel_main:o,rel_secondary:En(t,-.25),rel_hiContrast:kn(o).hiContrast}}function kn(e){let t=v(e),n=t.brighten(2),r=t.darken(2),i,a,o,s;do i=n,a=r,n=n.brighten(1),r=r.darken(1),o=v.contrastAPCA(t,n),s=v.contrastAPCA(t,r);while(Math.abs(o)<60&&Math.abs(s)<60&&(!p(n,i)||!p(r,a)));return Math.abs(o)>Math.abs(s)?{hiContrast:v(n.brighten(.4)).hex(),loContrast:n.hex()}:{hiContrast:v(r.darken(.4)).hex(),loContrast:r.hex()}}function An(e,t){let n=t??6,r=v(e.fill),i=v(e.stroke),a=r.luminance()>.8,o=m(g(v.scale(a?[r.darken(.02).desaturate(.05),r.darken(.1).desaturate(.1)]:[r.shade(.12,`lch`).desaturate(.05),r.shade(.35,`lch`).desaturate(.4)]).mode(`oklch`).correctLightness().colors(n,null),v.scale(a?[i.darken(.04).desaturate(.05),i.darken(.12).desaturate(.1)]:[i.shade(.15,`lch`).desaturate(.08),i.shade(.4,`lch`).desaturate(.4)]).mode(`oklch`).correctLightness().colors(n,null)),f(([t,n])=>({...e,fill:t.hex(),stroke:n.hex()})));return b(o.length===n,`Expected ${n} colors, got ${o.length}`),o}const jn={color:`primary`,size:`md`,opacity:15,shape:`rectangle`,group:{opacity:15,border:`dashed`},relationship:{color:`gray`,line:`dashed`,arrow:`normal`}},Mn=wn,Z={theme:Mn,defaults:jn};var Nn=class e{config;customCss;theme;defaults;static DEFAULT=new e(Z);static from(t,r){if(!t&&!r)return this.DEFAULT;let{customCss:i,theme:o,defaults:s}={...t},c=n({theme:o},{defaults:{...s}},{theme:{colors:{...r}}},Z);return a(i?.content)&&p(c,Z)?this.DEFAULT:new e(c,i)}constructor(e,t){this.config=e,this.customCss=t,this.theme=e.theme,this.defaults=e.defaults}get fingerprint(){return R(this,`fingerprint`,()=>z({config:this.config,customCss:this.customCss}))}get elementColors(){return this.theme.colors[this.defaults.color].elements}get relationshipColors(){return this.theme.colors[this.defaults.relationship.color].relationships}get groupColors(){let e=this.defaults.group?.color;if(!e)return this.elementColors;if(!this.isThemeColor(e))throw Error(`Default group color not found in theme: ${e}`);return R(this,`defaultGroup`,()=>({...this.elementColors,...this.theme.colors[e].elements}))}isDefaultColor(e){return e===this.defaults.color}colors(e){return this.computeFrom(e??this.defaults.color)}compoundColorsCache=new oe.default(e=>new ce.default(t=>An(e,t)));colorsForCompounds(e,t){return this.compoundColorsCache.get(e).get(t??6)}fontSize(e){return e??=this.defaults.text??this.defaults.size,this.theme.textSizes[e]}padding(e){return e??=this.defaults.padding??this.defaults.size,this.theme.spacing[e]}iconSize(e){return e??=this.defaults.size,this.theme.iconSizes[e]}isThemeColor(e){return e in this.theme.colors}nodeSizes(e){let t=Pn(e,this.defaults.size);return{sizes:t,values:{sizes:this.theme.sizes[t.size],padding:this.padding(t.padding),textSize:this.fontSize(t.textSize),iconSize:this.iconSize(t.iconSize)}}}computeFrom(e){if(this.isThemeColor(e))return this.theme.colors[e];if(!v.valid(e))throw Error(`Invalid color value: "${e}" (not a theme color and not a valid CSS color)`);return Dn(e)}equals(e){return e===this?!0:this.constructor===e.constructor?this.fingerprint===e.fingerprint:!1}tagColor(e){return this.isThemeColor(e)?this.theme.colors[e].elements:Cn(e)?this.computeFrom(Sn[e]).elements:this.computeFrom(e).elements}};function Pn({size:e,padding:t,textSize:n,iconSize:r,...i},a=Z.defaults.size){return e??=a,n??=e,t??=e,r??=e,{...i,size:e,padding:t,textSize:n,iconSize:r}}function Fn(e){let t=typeof e==`string`?e:e.color;return t.startsWith(`#`)||t.startsWith(`rgb`)}function In(e){return`tag`in e}function Ln(e){return`kind`in e}function Rn(e){return`metadata`in e}function zn(e){return`participant`in e}function Bn(e){return`not`in e}function Vn(e){return`and`in e}function Hn(e){return`or`in e}function Q(e){switch(!0){case zn(e):{let t=e.participant;return Un(t,Q(e.operator))}case In(e):{if(h(e.tag)||`eq`in e.tag){let t=h(e.tag)?e.tag:e.tag.eq;return e=>Array.isArray(e.tags)&&e.tags.includes(t)}let t=e.tag.neq;return e=>!Array.isArray(e.tags)||!e.tags.includes(t)}case Ln(e):{if(h(e.kind)||`eq`in e.kind){let t=h(e.kind)?e.kind:e.kind.eq;return e=>e.kind===t}let t=e.kind.neq;return e=>o(e.kind)||e.kind!==t}case Rn(e):{let{key:t,value:n}=e.metadata;if(n===void 0)return e=>e.metadata!=null&&t in e.metadata&&e.metadata[t]!=null;if(h(n)||`eq`in n){let e=h(n)?n:n.eq;return n=>{if(!n.metadata)return!1;let r=n.metadata[t];return Array.isArray(r)?r.includes(e):r===e}}let r=n.neq;return e=>{if(!e.metadata)return!0;let n=e.metadata[t];return n==null?!0:Array.isArray(n)?!n.includes(r):n!==r}}case Bn(e):return s(Q(e.not));case Vn(e):return ne(e.and.map(Q));case Hn(e):return ie(e.or.map(Q));default:x(e)}}function Un(e,t){return n=>{if(!n.source||!n.target)return!1;switch(e){case`source`:return t(n.source);case`target`:return t(n.target)}}}function Wn(e){return`include`in e||`exclude`in e}function Gn(e){return`targets`in e&&`style`in e}function Kn(e){return e._stage===`computed`}function qn(e){return e._stage===`layouted`}function $(e){return e._type===`element`}function Jn(e){return $(e)&&c(e.viewOf)}function Yn(e){return $(e)&&c(e.extends)}function Xn(e){return e._type===`deployment`}function Zn(e){return e._type===`dynamic`}function Qn(e){return`styleId`in e}function $n(e){return`predicateId`in e}function er(e){return e===`TB`||e===`BT`||e===`LR`||e===`RL`}function tr(e){return`direction`in e}function nr(e){return G(e)&&e.includes(`.`)?e.slice(0,e.indexOf(`.`)+1):null}function rr(e){return!!e&&!(`__series`in e||`__parallel`in e)}function ir(e){return!!e&&`__parallel`in e&&r(e.__parallel)}function ar(e){return!!e&&`__series`in e&&r(e.__series)}function or(e){return`title`in e&&`groupRules`in e&&Array.isArray(e.groupRules)}function sr(e){return`rank`in e&&Array.isArray(e.targets)}const cr=Symbol.for(`text`),lr=Symbol.for(`html`);var ur=class e{static mdcache=new _.default(500);static txtcache=new _.default(500);static getOrCreateFromText(t){if(t=t.trimEnd(),t===``)return e.EMPTY;let n=e.txtcache.get(t);return n||(n=new e({txt:t}),e.txtcache.set(t,n),n)}static getOrCreateFromMarkdown(t){if(t=t.trimEnd(),t===``)return e.EMPTY;let n=e.mdcache.get(t);return n||(n=new e({md:t}),e.mdcache.set(t,n),n)}static memoize(t,n,r){return R(t,n,()=>e.from(r))}static from(t){return t==null||t===e.EMPTY?e.EMPTY:t instanceof e?t:typeof t==`string`?this.getOrCreateFromText(t):`isEmpty`in t&&t.isEmpty?e.EMPTY:`md`in t?this.getOrCreateFromMarkdown(t.md):this.getOrCreateFromText(t.txt)}static EMPTY=new class extends e{isEmpty=!0;nonEmpty=!1;isMarkdown=!1;$source=null;constructor(){super({txt:``})}get text(){return null}get md(){return null}get html(){return null}};$source;isEmpty;nonEmpty;isMarkdown;constructor(e){this.isMarkdown=!1,typeof e==`string`?(this.$source={txt:e},this.isEmpty=e.trim()===``):(this.$source=e,this.isEmpty=!0,`md`in e?(this.isEmpty=e.md===``,this.isMarkdown=!0):this.isEmpty=e.txt===``),this.nonEmpty=!this.isEmpty}get text(){if(this.isEmpty||this.$source===null)return``;let e=this.$source;return`txt`in e?e.txt:R(this,cr,()=>V(e.md))}get md(){if(this.isEmpty||this.$source===null)return``;let e=this.$source;if(`md`in e)return e.md;if(`txt`in e)return e.txt;x(e)}get html(){if(this.isEmpty||this.$source===null)return``;let e=this.$source;return`txt`in e?e.txt:R(this,lr,()=>B(e.md))}equals(t){return this===t?!0:t instanceof e?this.isEmpty&&t.isEmpty?!0:this.isEmpty!==t.isEmpty||this.isMarkdown!==t.isMarkdown?!1:this.isMarkdown?this.$source?.md===t.$source?.md:this.$source?.txt===t.$source?.txt:!1}};export{W as $,tt as $t,Pn as A,Tt as At,bn as B,gt as Bt,Rn as C,Be as Cn,V as Ct,In as D,Re as Dn,Et as Dt,zn as E,y as En,z as Et,vn as F,bt as Ft,X as G,ut as Gt,rn as H,pt as Ht,xn as I,yt as It,J,st as Jt,tn as K,lt as Kt,yn as L,R as Lt,Mn as M,wt as Mt,jn as N,xt as Nt,Q as O,Le as On,Dt as Ot,Dn as P,vt as Pt,Ut as Q,it as Qt,_n as R,_t as Rt,Ln as S,b as Sn,Mt as St,Hn as T,ze as Tn,At as Tt,nn as U,ft as Ut,an as V,mt as Vt,Y as W,dt as Wt,Gt as X,at as Xt,K as Y,ot as Yt,Zt as Z,rt as Zt,Yn as _,We as _n,Ft as _t,rr as a,j as an,qt as at,Gn as b,Ve as bn,H as bt,er as c,D as cn,en as ct,Qn as d,Ke as dn,Wt as dt,N as en,U as et,Kn as f,Ge as fn,G as ft,$ as g,w as gn,Lt as gt,Zn as h,$e as hn,Qt as ht,nr as i,Xe as in,zt as it,Nn as j,Ot as jt,Fn as k,Ie as kn,kt,tr as l,qe as ln,Vt as lt,qn as m,M as mn,Yt as mt,or as n,Ye as nn,Xt as nt,ir as o,Je as on,$t as ot,Xn as p,Ze as pn,Rt as pt,q,ct as qt,sr as r,A as rn,Ht as rt,ar as s,k as sn,Kt as st,ur as t,et as tn,Bt as tt,$n as u,O as un,Jt as ut,Jn as v,Ue as vn,It as vt,Bn as w,x as wn,B as wt,Vn as x,S as xn,Nt as xt,Wn as y,He as yn,Pt as yt,gn as z,ht as zt};
|
package/dist/builder/index.d.mts
CHANGED
|
@@ -1,8 +1,2 @@
|
|
|
1
|
-
import "../_chunks/
|
|
2
|
-
|
|
3
|
-
import "../_chunks/index3.mjs";
|
|
4
|
-
import "../_chunks/libs/mnemonist.mjs";
|
|
5
|
-
import "../_chunks/mnemonist.mjs";
|
|
6
|
-
import "../_chunks/LikeC4Model.mjs";
|
|
7
|
-
import { $ as DeloymentModelHelpers, A as AddDeploymentViewHelper, B as ViewPredicate, C as AddViewHelper, D as ElementViewRulesBuilder, E as ElementViewBuilder, F as $exclude, G as NestedRelationshipHelper, H as ModelBuilder, I as $include, J as AddElement, K as RelationshipHelper, L as $rules, M as DeploymentRulesBuilderOp, N as DeploymentViewBuilder, O as TypedAddViewOfHelper, P as $autoLayout, Q as DeloymentModelBuildFunction, R as $style, S as $expr, T as AddViewRules, U as ModelBuilderFunction, V as AddElementHelpers, W as ModelHelpers, X as AddDeploymentNodeHelpers, Y as AddDeployedInstance, Z as AddDeploymentRelation, _ as ViewsBuilder, a as Invalid, b as mkViewBuilder, c as NewElementProps, d as Types, et as DeploymentModelBuilder, f as TypesNested, g as BuilderMethods, h as Builder, i as BuilderSpecification, j as AddDeploymentViewRules, k as $deploymentExpr, l as NewRelationProps, m as Warn, n as AnyTypesNested, nt as AddDeploymentNode, o as Metadata, p as ValidId, q as model, r as BuilderProjectSpecification, s as NewDeploymentNodeProps, t as AnyTypes, tt as deployment, u as NewViewProps, v as ViewsBuilderFunction, w as AddViewOfHelper, x as views, y as ViewsHelpers, z as LikeC4ViewBuilder } from "../_chunks/_types.mjs";
|
|
8
|
-
export { $autoLayout, $deploymentExpr, $exclude, $expr, $include, $rules, $style, AddDeployedInstance, AddDeploymentNode, AddDeploymentNodeHelpers, AddDeploymentRelation, AddDeploymentViewHelper, AddDeploymentViewRules, AddElement, AddElementHelpers, AddViewHelper, AddViewOfHelper, AddViewRules, AnyTypes, AnyTypesNested, Builder, BuilderMethods, BuilderProjectSpecification, BuilderSpecification, DeloymentModelBuildFunction, DeloymentModelHelpers, DeploymentModelBuilder, DeploymentRulesBuilderOp, DeploymentViewBuilder, ElementViewBuilder, ElementViewRulesBuilder, Invalid, LikeC4ViewBuilder, Metadata, ModelBuilder, ModelBuilderFunction, ModelHelpers, NestedRelationshipHelper, NewDeploymentNodeProps, NewElementProps, NewRelationProps, NewViewProps, RelationshipHelper, TypedAddViewOfHelper, Types, TypesNested, ValidId, ViewPredicate, ViewsBuilder, ViewsBuilderFunction, ViewsHelpers, Warn, deployment, mkViewBuilder, model, views };
|
|
1
|
+
import { $ as DeloymentModelBuildFunction, A as $includeAncestors, B as LikeC4ViewBuilder, C as AddViewHelper, D as ElementViewRulesBuilder, E as ElementViewBuilder, F as $autoLayout, G as ModelHelpers, H as AddElementHelpers, I as $exclude, J as model, K as NestedRelationshipHelper, L as $include, M as AddDeploymentViewRules, N as DeploymentRulesBuilderOp, O as TypedAddViewOfHelper, P as DeploymentViewBuilder, Q as AddDeploymentRelation, R as $rules, S as $expr, T as AddViewRules, U as ModelBuilder, V as ViewPredicate, W as ModelBuilderFunction, X as AddDeployedInstance, Y as AddElement, Z as AddDeploymentNodeHelpers, _ as ViewsBuilder, a as Invalid, b as mkViewBuilder, c as NewElementProps, d as Types, et as DeloymentModelHelpers, f as TypesNested, g as BuilderMethods, h as Builder, i as BuilderSpecification, j as AddDeploymentViewHelper, k as $deploymentExpr, l as NewRelationProps, m as Warn, n as AnyTypesNested, nt as deployment, o as Metadata, p as ValidId, q as RelationshipHelper, r as BuilderProjectSpecification, rt as AddDeploymentNode, s as NewDeploymentNodeProps, t as AnyTypes, tt as DeploymentModelBuilder, u as NewViewProps, v as ViewsBuilderFunction, w as AddViewOfHelper, x as views, y as ViewsHelpers, z as $style } from "../_chunks/_types.mjs";
|
|
2
|
+
export { $autoLayout, $deploymentExpr, $exclude, $expr, $include, $includeAncestors, $rules, $style, AddDeployedInstance, AddDeploymentNode, AddDeploymentNodeHelpers, AddDeploymentRelation, AddDeploymentViewHelper, AddDeploymentViewRules, AddElement, AddElementHelpers, AddViewHelper, AddViewOfHelper, AddViewRules, AnyTypes, AnyTypesNested, Builder, BuilderMethods, BuilderProjectSpecification, BuilderSpecification, DeloymentModelBuildFunction, DeloymentModelHelpers, DeploymentModelBuilder, DeploymentRulesBuilderOp, DeploymentViewBuilder, ElementViewBuilder, ElementViewRulesBuilder, Invalid, LikeC4ViewBuilder, Metadata, ModelBuilder, ModelBuilderFunction, ModelHelpers, NestedRelationshipHelper, NewDeploymentNodeProps, NewElementProps, NewRelationProps, NewViewProps, RelationshipHelper, TypedAddViewOfHelper, Types, TypesNested, ValidId, ViewPredicate, ViewsBuilder, ViewsBuilderFunction, ViewsHelpers, Warn, deployment, mkViewBuilder, model, views };
|
package/dist/builder/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"../_chunks/libs/defu.mjs";import{B as t,C as n,F as r,M as i,Q as a,T as o,U as s,W as c,X as l,Y as u,et as d,k as f,w as p}from"../_chunks/libs/remeda.mjs";import{St as m,V as h,W as g,Y as _,_t as v,g as y,mt as b,ut as x,vt as S}from"../_chunks/types.mjs";import"../_chunks/geometry.mjs";import{B as C,Q as w,R as T,z as E}from"../_chunks/utils.mjs";import"../_chunks/libs/graphology-dag.mjs";import{t as D}from"../_chunks/libs/mnemonist.mjs";import"../_chunks/libs/natural-compare-lite.mjs";import"../_chunks/libs/ohash.mjs";import"../_chunks/libs/@ungap/structured-clone.mjs";import"../_chunks/libs/hast-util-sanitize.mjs";import"../_chunks/libs/rehype-sanitize.mjs";import"../_chunks/libs/hast-util-to-html.mjs";import"../_chunks/libs/character-entities-legacy.mjs";import"../_chunks/libs/character-entities-html4.mjs";import"../_chunks/libs/ccount.mjs";import"../_chunks/libs/comma-separated-tokens.mjs";import"../_chunks/libs/rehype-stringify.mjs";import"../_chunks/libs/devlop.mjs";import"../_chunks/libs/mdast-util-from-markdown.mjs";import"../_chunks/libs/escape-string-regexp.mjs";import"../_chunks/libs/mdast-util-find-and-replace.mjs";import"../_chunks/libs/mdast-util-gfm.mjs";import"../_chunks/libs/markdown-table.mjs";import"../_chunks/libs/longest-streak.mjs";import"../_chunks/libs/character-entities.mjs";import"../_chunks/libs/decode-named-character-reference.mjs";import"../_chunks/libs/micromark-extension-gfm.mjs";import"../_chunks/libs/remark-gfm.mjs";import"../_chunks/libs/remark-github-blockquote-alert.mjs";import"../_chunks/libs/remark-parse.mjs";import"../_chunks/libs/mdast-util-to-hast.mjs";import"../_chunks/libs/remark-rehype.mjs";import"../_chunks/libs/bail.mjs";import"../_chunks/libs/extend.mjs";import"../_chunks/libs/is-plain-obj.mjs";import"../_chunks/libs/trough.mjs";import"../_chunks/libs/unified.mjs";import"../_chunks/libs/@radix-ui/colors.mjs";import"../_chunks/libs/@mantine/colors-generator.mjs";import"../_chunks/model.mjs";import"../_chunks/manual-layout.mjs";import{n as O,t as k}from"../_chunks/Builder.view-element.mjs";import"../_chunks/libs/graphology.mjs";import{t as A}from"../_chunks/assignTagColors.mjs";function j(e){if(f(e)){let t=e;switch(!0){case t.startsWith(`tag is not #`):return{tag:{neq:t.replace(`tag is not #`,``)}};case t.startsWith(`tag is #`):return{tag:{eq:t.replace(`tag is #`,``)}};case t.startsWith(`kind is not `):return{kind:{neq:t.replace(`kind is not `,``)}};case t.startsWith(`kind is `):return{kind:{eq:t.replace(`kind is `,``)}};case t.startsWith(`source.`):return{operator:j(t.replace(`source.`,``)),participant:`source`};case t.startsWith(`target.`):return{operator:j(t.replace(`target.`,``)),participant:`target`};default:throw Error(`Unknown where operator: ${e}`)}}if(e.and)return{and:o(e.and,j)};if(e.or)return{or:o(e.or,j)};if(e.not)return{not:j(e.not)};throw Error(`Unknown where operator: ${e}`)}function M(...e){return t=>{if(e.length===2&&typeof e[1]!=`string`&&(`where`in e[1]||`with`in e[1])){let n=t.$expr(e[0]),r=e[1].where?j(e[1].where):void 0;r&&(n={where:{expr:n,condition:r}});let i=e[1].with;return i&&(n=g.is(e[0])?{custom:{...i,expr:n}}:{customRelation:{...i,expr:n}}),t.include(n),t}return t.include(...e.map(e=>t.$expr(e))),t}}function N(...e){return t=>{let n=t.$expr(e[0]);if(e.length===2&&e[1].where){let t=j(e[1].where);n={where:{expr:n,condition:t}}}return t.exclude(n),t}}function P(e,{notation:n,...r}){return i=>i.style({targets:(t(e)?e:[e]).map(e=>i.$expr(e)),...n?{notation:n}:{},style:{...r}})}function F(e,t){return n=>n.autoLayout(e,t)}function I(...e){return t=>e.reduce((e,t)=>t(e),t)}function L(e){if(!f(e))return e;let t=e=>e;if(e===`*`)return t({wildcard:!0});if(e.startsWith(`->`))return e.endsWith(`->`)?t({inout:L(e.replace(/->/g,``).trim())}):t({incoming:L(e.replace(`-> `,``))});if(e.endsWith(` ->`))return t({outgoing:L(e.replace(` ->`,``))});if(e.includes(` <-> `)){let[n,r]=e.split(` <-> `);return t({source:L(n),target:L(r),isBidirectional:!0})}if(e.includes(` -> `)){let[n,r]=e.split(` -> `);return t({source:L(n),target:L(r)})}return e.endsWith(`._`)?t({ref:{deployment:e.replace(`._`,``)},selector:`expanded`}):e.endsWith(`.**`)?t({ref:{deployment:e.replace(`.**`,``)},selector:`descendants`}):e.endsWith(`.*`)?t({ref:{deployment:e.replace(`.*`,``)},selector:`children`}):t({ref:{deployment:e}})}function R(e){let t={$expr:e[S]===`deployment`?L:k,autoLayout(n,r){return e.rules.push(m({direction:n,rankSep:r?.rank,nodeSep:r?.node})),t},exclude(...n){return e.rules.push({exclude:n}),t},include(...n){return e.rules.push({include:n}),t},style(n){return e.rules.push(n),t},get Expr(){throw Error(`Expr is not available in runtime`)},get Types(){throw Error(`Types are not available in runtime`)},get ElementExpr(){throw Error(`ElementExpr is not available in runtime`)},get TypedExpr(){throw Error(`TypedExpr is not available in runtime`)}};return t}function z(e){return t(e)?s(e,e=>({})):e}function B({tags:e,elements:t,deployments:n,relationships:r,...i}){let a={};e&&Object.assign(a,z(e));let o=z(t);for(let[e,t]of l(o))if(t.tags)for(let n of t.tags)w(n in a,`Invalid specification for element kind "${e}": tag "${n}" not found`);let s=z(n??{});for(let[e,t]of l(s))if(t.tags)for(let n of t.tags)w(n in a,`Invalid specification for deployment kind "${e}": tag "${n}" not found`);return{...i,tags:a,elements:o,deployments:s,relationships:z(r??{})}}function V(e){return i(e)?null:typeof e==`string`?{txt:e}:e}function H(t,s=new Map,l=[],f=new Map,g={predicates:{},dynamicPredicates:{},styles:{}},k=new Map,j=[],L=new D.default(()=>new Map)){let z=B(t),U=()=>({elements:structuredClone(z.elements),deployments:structuredClone(z.deployments),relationships:structuredClone(z.relationships),tags:A(structuredClone(z.tags)),...z.metadataKeys?{metadataKeys:z.metadataKeys}:{},customColors:{}}),W=e=>{if(!(!e||!a(e,1)))return o(e,e=>typeof e==`string`?{url:e}:e)},G=(e,t,n)=>{r(t)&&(n=t,t={}),t??={};let{links:i=[],title:a=null,description:o=null,tags:s=[],...c}=typeof t==`string`?{title:t}:{...t},l=W(i);return[m({id:e,title:a,description:V(o),tags:s,links:l,_stage:`parsed`,...c}),n]},K=e=>{let[t,n]=b(e),r=(t?L.get(t):s).get(n);return w(r,`Element with id "${e}" not found`),r},q=e=>{if(typeof e==`string`){let[t,n]=b(e);return t?{project:t,model:n}:{model:n}}return`project`in e||`deployment`in e?e:q(e.model)},J={get Types(){throw Error(`Types are not available in runtime`)},clone:()=>{let e=new D.default(()=>new Map);for(let[t,n]of L)e.set(t,structuredClone(n));return H(structuredClone(z),structuredClone(s),structuredClone(l),structuredClone(f),structuredClone(g),structuredClone(k),structuredClone(j),e)},__addElement:e=>{let[t,n]=b(e.id),r=C(n),i=t?L.get(t):s;if(r&&w(i.get(r),`Parent element with id "${r}" not found for element with id "${e.id}"`),i.has(n))throw Error(`Element with id "${e.id}" already exists`);return i.set(n,t?{...e,id:n}:e),J},__addRelation(e){let t=q(e.source),n=_.flatten(t),r=q(e.target),i=_.flatten(r),a=K(n),o=K(i);if(x(n)&&x(i))throw Error(`Cannot create relationship between global elements`);return!x(n)&&!x(i)&&w(!T(a,o),`Cannot create relationship between elements in the same hierarchy`),l.push({id:`rel${l.length+1}`,...e,source:t,target:r}),J},__fqn(e){return w(e.trim()!==``,`Id must be non-empty`),e},__deploymentFqn(e){return w(e.trim()!==``,`Id must be non-empty`),e},__addSourcelessRelation(){throw Error(`Can be called only in nested model`)},__addView:e=>{if(f.has(e.id))throw Error(`View with id "${e.id}" already exists`);return y(e)&&`viewOf`in e&&w(s.get(e.viewOf),`Invalid scoped view ${e.id}, wlement with id "${e.viewOf}" not found`),f.set(e.id,e),J},__addDeployment:e=>{if(k.has(e.id))throw Error(`Deployment with id "${e.id}" already exists`);let t=C(e.id);return t&&w(k.get(t),`Parent element with id "${t}" not found for node with id "${e.id}"`),h(e)&&(w(t,`Instance ${e.id} of ${e.element} must be deployed under a parent node`),w(s.get(e.element),`Instance "${e.id}" references non-existing element "${e.element}"`)),k.set(e.id,e),J},__addDeploymentRelation:e=>(w(!T(e.source.deployment,e.target.deployment),`Cannot create relationship between elements in the same hierarchy`),w(k.has(e.source.deployment),`Relation "${e.source.deployment} -> ${e.target.deployment}" references non-existing source`),w(k.has(e.target.deployment),`Relation "${e.source.deployment} -> ${e.target.deployment}" references non-existing target`),j.push({id:`deploy_rel${j.length+1}`,...e}),J),build:e=>({[v]:`parsed`,projectId:typeof e==`string`?e:e?.id??`from-builder`,project:{id:typeof e==`string`?e:`from-builder`,...typeof e==`object`&&e?e:{}},specification:U(),elements:c(structuredClone(Array.from(s.entries()))),relations:p(l,e=>[e.id,structuredClone(e)]),globals:structuredClone(g),deployments:{elements:c(structuredClone(Array.from(k.entries()))),relations:p(j,e=>[e.id,structuredClone(e)])},views:c(structuredClone(Array.from(f.entries()))),imports:d(Array.from(L.entries()),o(([e,t])=>[e,structuredClone([...t.values()])]),u(([e,t])=>t.length>0),c())}),toLikeC4Model:e=>O(J.build(e)),helpers:()=>({model:{model:(...e)=>t=>e.reduce((e,t)=>t(e),t),rel:(t,n,r)=>i=>{let{title:a=``,links:o=[],description:s=null,notes:c=null,...l}=e(typeof r==`string`?{title:r}:{...r},{title:null,links:null}),u=W(o);return i.__addRelation(m({source:{model:t},target:{model:n},title:a,...s&&{description:V(s)},...c&&{notes:V(c)},links:u,...l})),i},relTo:(t,n)=>r=>{let{title:i=``,links:a,description:o=null,notes:s=null,...c}=e(typeof n==`string`?{title:n}:{...n},{title:null,links:null});return r.__addSourcelessRelation(m({target:{model:t},title:i,...o&&{description:V(o)},...s&&{notes:V(s)},links:W(a),...c})),r},...n(z.elements,({style:e,...t},n)=>(r,i)=>{let a=(a=>{let{links:o,icon:s,color:c,shape:l,style:u,title:d,description:f,summary:p,...h}=typeof i==`string`?{title:i}:{...i},g=s??e?.icon,_=W(o),v=a.__fqn(r);return a.__addElement(m({id:v,kind:n,...t,title:d??t.title??E(v),...f&&{description:V(f)},...p&&{summary:V(p)},style:m({icon:g,color:c??e?.color,shape:l??e?.shape,border:e?.border,opacity:e?.opacity,size:e?.size,padding:e?.padding,textSize:e?.textSize,...u}),..._&&{links:_},...h})),a});return a.with=(...e)=>t=>{a(t);let{__fqn:n,__addSourcelessRelation:i}=t;try{t.__fqn=e=>`${n(r)}.${e}`,t.__addSourcelessRelation=e=>t.__addRelation({...e,source:{model:n(r)}}),e.reduce((e,t)=>t(e),t)}finally{t.__fqn=n,t.__addSourcelessRelation=i}return t},a})},views:{views:(...e)=>t=>e.reduce((e,t)=>t(e),t),view:(e,t,n)=>{let[r,i]=G(e,t,n),a={...r,[S]:`element`,rules:[]},o=e=>(e.__addView(a),i&&i(R(a)),e);return o.with=(...e)=>t=>{o(t);let n=R(a);for(let t of e)t(n);return t},o},viewOf:(e,t,n,r)=>{let[i,a]=G(e,n,r),o={...i,viewOf:t,[S]:`element`,rules:[]},s=e=>(e.__addView(o),a&&a(R(o)),e);return s.with=(...e)=>t=>{s(t);let n=R(o);for(let t of e)t(n);return t},s},deploymentView:(e,t,n)=>{let[r,i]=G(e,t,n),a={...r,[S]:`deployment`,rules:[]},o=e=>(e.__addView(a),i&&i(R(a)),e);return o.with=(...e)=>t=>{o(t);let n=R(a);for(let t of e)t(n);return t},o},$autoLayout:F,$exclude:N,$include:M,$rules:I,$style:P},deployment:{deployment:(...e)=>t=>e.reduce((e,t)=>t(e),t),instanceOf:(e,t,n)=>r=>{i(t)?(t=e,e=E(e)):typeof t==`string`?n??={}:(n=t,t=e,e=E(e));let{links:a,title:o,description:s,summary:c,icon:l,color:u,shape:d,style:f,...p}=typeof n==`string`?{title:n}:{...n},h=r.__deploymentFqn(e);return r.__addDeployment(m({id:h,element:t,...o&&{title:o},...c&&{summary:V(c)},...s&&{description:V(s)},style:m({icon:l,color:u,shape:d,...f}),links:W(a),...p})),r},rel:(e,t,n)=>r=>{let{title:i=null,links:a,description:o=null,notes:s=null,...c}=typeof n==`string`?{title:n}:{...n};return r.__addDeploymentRelation(m({source:{deployment:e},target:{deployment:t},title:i,...o&&{description:V(o)},...s&&{notes:V(s)},links:W(a),...c})),r},...n(z.deployments??{},({style:e,...t},n)=>(r,i)=>{let a=(a=>{let{links:o,icon:s,style:c,title:l,description:u,summary:d,color:f,shape:p,...h}=typeof i==`string`?{title:i}:{...i},g=s??e?.icon,_=W(o),v=a.__deploymentFqn(r);return a.__addDeployment(m({id:v,kind:n,...t,title:l??t.title??E(v),...u&&{description:V(u)},...d&&{summary:V(d)},style:m({icon:g,color:f??e?.color,shape:p??e?.shape,border:e?.border,opacity:e?.opacity,size:e?.size,padding:e?.padding,textSize:e?.textSize,...c}),..._&&{links:_},...h})),a});return a.with=(...e)=>t=>{a(t);let{__deploymentFqn:n}=t;try{t.__deploymentFqn=e=>`${n(r)}.${e}`,e.reduce((e,t)=>t(e),t)}finally{t.__deploymentFqn=n}return t},a})}}),with:(...e)=>{let t=J.clone();return e.reduce((e,t)=>t(e),t)},model:e=>{let t=J.clone(),n=t.helpers().model,r=n.model;return e({...n,_:r},r)(t)},deployment:e=>{let t=J.clone(),n=t.helpers().deployment,r=n.deployment;return e({...n,_:r},r)(t)},views:e=>{let t=J.clone(),n=t.helpers().views;return e({...n,_:n.views},n.views)(t)}};return J}const U={forSpecification(e){let t=H(e);return{...t.helpers(),builder:t}},specification(e){return H(e)}};export{U as Builder};
|
|
1
|
+
import{t as e}from"../_chunks/libs/defu.mjs";import{B as t,C as n,F as r,M as i,Q as a,T as o,U as s,W as c,X as l,Y as u,et as d,k as f,w as p}from"../_chunks/libs/remeda.mjs";import{Sn as m,V as h,W as g,Y as _,_t as v,dn as y,fn as b,g as x,kn as S,mt as C,un as w,ut as T,vt as E}from"../_chunks/types.mjs";import{t as D}from"../_chunks/libs/mnemonist.mjs";import"../_chunks/model.mjs";import{n as O,t as k}from"../_chunks/Builder.view-element.mjs";import{t as A}from"../_chunks/assignTagColors.mjs";function j(e){if(f(e)){let t=e;switch(!0){case t.startsWith(`tag is not #`):return{tag:{neq:t.replace(`tag is not #`,``)}};case t.startsWith(`tag is #`):return{tag:{eq:t.replace(`tag is #`,``)}};case t.startsWith(`kind is not `):return{kind:{neq:t.replace(`kind is not `,``)}};case t.startsWith(`kind is `):return{kind:{eq:t.replace(`kind is `,``)}};case t.startsWith(`source.`):return{operator:j(t.replace(`source.`,``)),participant:`source`};case t.startsWith(`target.`):return{operator:j(t.replace(`target.`,``)),participant:`target`};default:throw Error(`Unknown where operator: ${e}`)}}if(e.and)return{and:o(e.and,j)};if(e.or)return{or:o(e.or,j)};if(e.not)return{not:j(e.not)};throw Error(`Unknown where operator: ${e}`)}function M(...e){return t=>{if(e.length===2&&typeof e[1]!=`string`&&(`where`in e[1]||`with`in e[1])){let n=t.$expr(e[0]),r=e[1].where?j(e[1].where):void 0;r&&(n={where:{expr:n,condition:r}});let i=e[1].with;return i&&(n=g.is(n)?{custom:{...i,expr:n}}:{customRelation:{...i,expr:n}}),t.include(n),t}return t.include(...e.map(e=>t.$expr(e))),t}}function N(...e){return t=>{let n=t.$expr(e[0]);if(e.length===2&&e[1].where){let t=j(e[1].where);n={where:{expr:n,condition:t}}}return t.exclude(n),t}}function P(e,{notation:n,...r}){return i=>i.style({targets:(t(e)?e:[e]).map(e=>i.$expr(e)),...n?{notation:n}:{},style:{...r}})}function F(e,t){return n=>n.autoLayout(e,t)}function I(...e){return t=>e.reduce((e,t)=>t(e),t)}function L(e){if(!f(e))return e;let t=e=>e;if(e===`*`)return t({wildcard:!0});if(e.startsWith(`->`))return e.endsWith(`->`)?t({inout:L(e.replace(/->/g,``).trim())}):t({incoming:L(e.replace(`-> `,``))});if(e.endsWith(` ->`))return t({outgoing:L(e.replace(` ->`,``))});if(e.includes(` <-> `)){let[n,r]=e.split(` <-> `);return t({source:L(n),target:L(r),isBidirectional:!0})}if(e.includes(` -> `)){let[n,r]=e.split(` -> `);return t({source:L(n),target:L(r)})}return e.endsWith(`._`)?t({ref:{deployment:e.replace(`._`,``)},selector:`expanded`}):e.endsWith(`.**`)?t({ref:{deployment:e.replace(`.**`,``)},selector:`descendants`}):e.endsWith(`.*`)?t({ref:{deployment:e.replace(`.*`,``)},selector:`children`}):t({ref:{deployment:e}})}function R(e){return t=>t.includeAncestors(e)}function z(e){let t={$expr:e._type===`deployment`?L:k,autoLayout(t,n){return e.rules.push(S({direction:t,rankSep:n?.rank,nodeSep:n?.node})),this},exclude(...t){return e.rules.push({exclude:t}),this},include(...t){return e.rules.push({include:t}),this},style(t){return e.rules.push(t),this},get Expr(){throw Error(`Expr is not available in runtime`)},get Types(){throw Error(`Types are not available in runtime`)},get ElementExpr(){throw Error(`ElementExpr is not available in runtime`)},get TypedExpr(){throw Error(`TypedExpr is not available in runtime`)}};return e._type===`deployment`?Object.assign(t,{includeAncestors(t){return e.rules.push({includeAncestors:t}),this}}):t}function B(e){return t(e)?s(e,e=>({})):e}function V({tags:e,elements:t,deployments:n,relationships:r,...i}){let a={};e&&Object.assign(a,B(e));let o=B(t);for(let[e,t]of l(o))if(t.tags)for(let n of t.tags)m(n in a,`Invalid specification for element kind "${e}": tag "${n}" not found`);let s=B(n??{});for(let[e,t]of l(s))if(t.tags)for(let n of t.tags)m(n in a,`Invalid specification for deployment kind "${e}": tag "${n}" not found`);return{...i,tags:a,elements:o,deployments:s,relationships:B(r??{})}}function H(e){return i(e)?null:typeof e==`string`?{txt:e}:e}function U(t,s=new Map,l=[],f=new Map,g={predicates:{},dynamicPredicates:{},styles:{}},k=new Map,j=[],L=new D.default(()=>new Map)){let B=V(t),W=()=>({elements:structuredClone(B.elements),deployments:structuredClone(B.deployments),relationships:structuredClone(B.relationships),tags:A(structuredClone(B.tags)),...B.metadataKeys?{metadataKeys:B.metadataKeys}:{},customColors:{}}),G=e=>{if(!(!e||!a(e,1)))return o(e,e=>typeof e==`string`?{url:e}:e)},K=(e,t,n)=>{r(t)&&(n=t,t={}),t??={};let{links:i=[],title:a=null,description:o=null,tags:s=[],...c}=typeof t==`string`?{title:t}:{...t},l=G(i);return[S({id:e,title:a,description:H(o),tags:s,links:l,_stage:`parsed`,...c}),n]},q=e=>{let[t,n]=C(e),r=(t?L.get(t):s).get(n);return m(r,`Element with id "${e}" not found`),r},J=e=>{if(typeof e==`string`){let[t,n]=C(e);return t?{project:t,model:n}:{model:n}}return`project`in e||`deployment`in e?e:J(e.model)},Y={get Types(){throw Error(`Types are not available in runtime`)},clone:()=>{let e=new D.default(()=>new Map);for(let[t,n]of L)e.set(t,structuredClone(n));return U(structuredClone(B),structuredClone(s),structuredClone(l),structuredClone(f),structuredClone(g),structuredClone(k),structuredClone(j),e)},__addElement:e=>{let[t,n]=C(e.id),r=b(n),i=t?L.get(t):s;if(r&&m(i.get(r),`Parent element with id "${r}" not found for element with id "${e.id}"`),i.has(n))throw Error(`Element with id "${e.id}" already exists`);return i.set(n,t?{...e,id:n}:e),Y},__addRelation(e){let t=J(e.source),n=_.flatten(t),r=J(e.target),i=_.flatten(r),a=q(n),o=q(i);if(T(n)&&T(i))throw Error(`Cannot create relationship between global elements`);return!T(n)&&!T(i)&&m(!w(a,o),`Cannot create relationship between elements in the same hierarchy`),l.push({id:`rel${l.length+1}`,...e,source:t,target:r}),Y},__fqn(e){return m(e.trim()!==``,`Id must be non-empty`),e},__deploymentFqn(e){return m(e.trim()!==``,`Id must be non-empty`),e},__addSourcelessRelation(){throw Error(`Can be called only in nested model`)},__addView:e=>{if(f.has(e.id))throw Error(`View with id "${e.id}" already exists`);return x(e)&&`viewOf`in e&&m(s.get(e.viewOf),`Invalid scoped view ${e.id}, wlement with id "${e.viewOf}" not found`),f.set(e.id,e),Y},__addDeployment:e=>{if(k.has(e.id))throw Error(`Deployment with id "${e.id}" already exists`);let t=b(e.id);return t&&m(k.get(t),`Parent element with id "${t}" not found for node with id "${e.id}"`),h(e)&&(m(t,`Instance ${e.id} of ${e.element} must be deployed under a parent node`),m(s.get(e.element),`Instance "${e.id}" references non-existing element "${e.element}"`)),k.set(e.id,e),Y},__addDeploymentRelation:e=>(m(!w(e.source.deployment,e.target.deployment),`Cannot create relationship between elements in the same hierarchy`),m(k.has(e.source.deployment),`Relation "${e.source.deployment} -> ${e.target.deployment}" references non-existing source`),m(k.has(e.target.deployment),`Relation "${e.source.deployment} -> ${e.target.deployment}" references non-existing target`),j.push({id:`deploy_rel${j.length+1}`,...e}),Y),build:e=>({[v]:`parsed`,projectId:typeof e==`string`?e:e?.id??`from-builder`,project:{id:typeof e==`string`?e:`from-builder`,...typeof e==`object`&&e?e:{}},specification:W(),elements:c(structuredClone(Array.from(s.entries()))),relations:p(l,e=>[e.id,structuredClone(e)]),globals:structuredClone(g),deployments:{elements:c(structuredClone(Array.from(k.entries()))),relations:p(j,e=>[e.id,structuredClone(e)])},views:c(structuredClone(Array.from(f.entries()))),imports:d(Array.from(L.entries()),o(([e,t])=>[e,structuredClone([...t.values()])]),u(([e,t])=>t.length>0),c())}),toLikeC4Model:e=>O(Y.build(e)),helpers:()=>({model:{model:(...e)=>t=>e.reduce((e,t)=>t(e),t),rel:(t,n,r)=>i=>{let{title:a=``,links:o=[],description:s=null,notes:c=null,...l}=e(typeof r==`string`?{title:r}:{...r},{title:null,links:null}),u=G(o);return i.__addRelation(S({source:{model:t},target:{model:n},title:a,...s&&{description:H(s)},...c&&{notes:H(c)},links:u,...l})),i},relTo:(t,n)=>r=>{let{title:i=``,links:a,description:o=null,notes:s=null,...c}=e(typeof n==`string`?{title:n}:{...n},{title:null,links:null});return r.__addSourcelessRelation(S({target:{model:t},title:i,...o&&{description:H(o)},...s&&{notes:H(s)},links:G(a),...c})),r},...n(B.elements,({style:e,...t},n)=>(r,i)=>{let a=(a=>{let{links:o,icon:s,color:c,shape:l,style:u,title:d,description:f,summary:p,...m}=typeof i==`string`?{title:i}:{...i},h=s??e?.icon,g=G(o),_=a.__fqn(r);return a.__addElement(S({id:_,kind:n,...t,title:d??t.title??y(_),...f&&{description:H(f)},...p&&{summary:H(p)},style:S({icon:h,color:c??e?.color,shape:l??e?.shape,border:e?.border,opacity:e?.opacity,size:e?.size,padding:e?.padding,textSize:e?.textSize,...u}),...g&&{links:g},...m})),a});return a.with=(...e)=>t=>{a(t);let{__fqn:n,__addSourcelessRelation:i}=t;try{t.__fqn=e=>`${n(r)}.${e}`,t.__addSourcelessRelation=e=>t.__addRelation({...e,source:{model:n(r)}}),e.reduce((e,t)=>t(e),t)}finally{t.__fqn=n,t.__addSourcelessRelation=i}return t},a})},views:{views:(...e)=>t=>e.reduce((e,t)=>t(e),t),view:(e,t,n)=>{let[r,i]=K(e,t,n),a={...r,[E]:`element`,rules:[]},o=e=>(e.__addView(a),i&&i(z(a)),e);return o.with=(...e)=>t=>{o(t);let n=z(a);for(let t of e)t(n);return t},o},viewOf:(e,t,n,r)=>{let[i,a]=K(e,n,r),o={...i,viewOf:t,[E]:`element`,rules:[]},s=e=>(e.__addView(o),a&&a(z(o)),e);return s.with=(...e)=>t=>{s(t);let n=z(o);for(let t of e)t(n);return t},s},deploymentView:(e,t,n)=>{let[r,i]=K(e,t,n),a={...r,[E]:`deployment`,rules:[]},o=e=>(e.__addView(a),i&&i(z(a)),e);return o.with=(...e)=>t=>{o(t);let n=z(a);for(let t of e)t(n);return t},o},$autoLayout:F,$exclude:N,$include:M,$rules:I,$style:P,$includeAncestors:R},deployment:{deployment:(...e)=>t=>e.reduce((e,t)=>t(e),t),instanceOf:(e,t,n)=>r=>{i(t)?(t=e,e=y(e)):typeof t==`string`?n??={}:(n=t,t=e,e=y(e));let{links:a,title:o,description:s,summary:c,icon:l,color:u,shape:d,style:f,...p}=typeof n==`string`?{title:n}:{...n},m=r.__deploymentFqn(e);return r.__addDeployment(S({id:m,element:t,...o&&{title:o},...c&&{summary:H(c)},...s&&{description:H(s)},style:S({icon:l,color:u,shape:d,...f}),links:G(a),...p})),r},rel:(e,t,n)=>r=>{let{title:i=null,links:a,description:o=null,notes:s=null,...c}=typeof n==`string`?{title:n}:{...n};return r.__addDeploymentRelation(S({source:{deployment:e},target:{deployment:t},title:i,...o&&{description:H(o)},...s&&{notes:H(s)},links:G(a),...c})),r},...n(B.deployments??{},({style:e,...t},n)=>(r,i)=>{let a=(a=>{let{links:o,icon:s,style:c,title:l,description:u,summary:d,color:f,shape:p,...m}=typeof i==`string`?{title:i}:{...i},h=s??e?.icon,g=G(o),_=a.__deploymentFqn(r);return a.__addDeployment(S({id:_,kind:n,...t,title:l??t.title??y(_),...u&&{description:H(u)},...d&&{summary:H(d)},style:S({icon:h,color:f??e?.color,shape:p??e?.shape,border:e?.border,opacity:e?.opacity,size:e?.size,padding:e?.padding,textSize:e?.textSize,...c}),...g&&{links:g},...m})),a});return a.with=(...e)=>t=>{a(t);let{__deploymentFqn:n}=t;try{t.__deploymentFqn=e=>`${n(r)}.${e}`,e.reduce((e,t)=>t(e),t)}finally{t.__deploymentFqn=n}return t},a})}}),with:(...e)=>{let t=Y.clone();return e.reduce((e,t)=>t(e),t)},model:e=>{let t=Y.clone(),n=t.helpers().model,r=n.model;return e({...n,_:r},r)(t)},deployment:e=>{let t=Y.clone(),n=t.helpers().deployment,r=n.deployment;return e({...n,_:r},r)(t)},views:e=>{let t=Y.clone(),n=t.helpers().views;return e({...n,_:n.views},n.views)(t)}};return Y}const W={forSpecification(e){let t=U(e);return{...t.helpers(),builder:t}},specification(e){return U(e)}};export{W as Builder};
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "../_chunks/index2.mjs";
|
|
3
|
-
import "../_chunks/index3.mjs";
|
|
4
|
-
import "../_chunks/libs/mnemonist.mjs";
|
|
5
|
-
import "../_chunks/mnemonist.mjs";
|
|
1
|
+
import { Hr as ElementId, Ir as AnyParsed, Nr as Any, On as ModelExpression, S as ComputedView, Xi as _stage, Zi as _type, _ as ComputedLikeC4ModelData, b as ParsedLikeC4ModelData, cn as AnyExcludePredicate, gn as ViewAutoLayout, hi as toComputed, it as ComputedEdge, ln as AnyIncludePredicate, oa as NonEmptyArray, oi as Unknown, ot as ComputedNode, pn as BaseViewProperties, ui as ViewId, w as ParsedView } from "../_chunks/index.mjs";
|
|
6
2
|
import { C as ElementModel, T as RelationshipModel, n as LikeC4Model } from "../_chunks/LikeC4Model.mjs";
|
|
7
|
-
import {
|
|
3
|
+
import { V as ViewPredicate } from "../_chunks/_types.mjs";
|
|
8
4
|
import "../_chunks/index4.mjs";
|
|
9
5
|
import { a as LayoutedProjectNode, i as LayoutedProjectEdge, n as ComputedProjectNode, o as LayoutedProjectsView, r as ComputedProjectsView, t as ComputedProjectEdge } from "../_chunks/_types2.mjs";
|
|
10
6
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
`)},shape:`rectangle`,children:[],inEdges:[],outEdges:[],color:`primary`,level:0,style:{},tags:[]};t.set(r.id,r)}return t}function X(
|
|
1
|
+
import{$ as e,C as t,D as n,K as r,L as i,Q as a,S as o,T as s,X as c,Y as l,b as u,d,et as f,i as p,m,r as h,w as g,y as _}from"../_chunks/libs/remeda.mjs";import{$ as v,$t as y,Bt as ee,Cn as b,On as x,Sn as S,Tt as C,Ut as w,Yt as T,_ as E,_t as D,cn as te,g as ne,hn as O,it as re,ln as k,st as A,vt as j,zt as M}from"../_chunks/types.mjs";import{t as N}from"../_chunks/libs/mnemonist.mjs";import"../_chunks/model.mjs";import{a as P,c as F,i as I,n as L,o as R,r as z,s as B,t as V}from"../_chunks/Builder.view-element.mjs";import{t as H}from"../_chunks/libs/graphology.mjs";import{n as U,t as W}from"../utils/graphology/index.mjs";function G(e){let t=new H({type:`directed`}),n=[];for(let r of h(e))t.addNode(r.id,{view:r}),E(r)&&n.push(r);if(n.length===0)return e;for(let e of n){if(!t.hasNode(e.extends)){console.warn(`View "${e.id}" extends from "${e.extends}" which does not exist`);continue}if((0,U.default)(t,e.id,e.extends)){console.warn(`View "${e.id}" extends from "${e.extends}" which creates a cycle`);continue}t.addDirectedEdge(e.id,e.extends)}return(0,W.topologicalSort)(t).reverse().reduce((e,n)=>{let r=t.getNodeAttribute(n,`view`);if(!E(r))return e[r.id]=r,e;let i=e[r.extends];if(!i||!ne(i))return e;let a=p([...i.tags??[],...r.tags??[]]),o=[...i.links??[],...r.links??[]];return e[r.id]={...i,...r,title:r.title??i.title??null,description:r.description??i.description??null,tags:a,links:y(o)?o:null,rules:[...i.rules,...r.rules]},e},{})}function K({edges:e,nodes:t,...n},r=`:`){let i=g(e,e=>[e.id,`${e.source}${r}${e.target}`]);return{...n,edges:e.map(e=>({...e,id:i[e.id]})),nodes:t.map(e=>({...e,inEdges:s(e.inEdges,e=>i[e]),outEdges:s(e.outEdges,e=>i[e])})),nodeIds:t.map(e=>e.id),edgeIds:e.map(e=>i[e.id])}}function q({views:e,...n}){return{...n,views:t(e,e=>o(K(e),[`nodeIds`,`edgeIds`]))}}const J=e=>n(e).length,Y=e=>C(e);function ie(e){let t=ae(e),n=(e,t)=>`${e}->${t}`,o=new N.default(e=>{let[t,n]=e.split(`->`);return{from:t,to:n,relationships:new Set}}),l=(e,t)=>o.get(n(e,t)).relationships,u=(e,t)=>{let n=t.projectId;S(n!==e.projectId,`Imported element must have a different project id`);let r=l(e.projectId,n);for(let n of t.incoming(`direct`))n.source.projectId===e.projectId&&r.add(n);let i=l(n,e.projectId);for(let n of t.outgoing(`direct`))n.target.projectId===e.projectId&&i.add(n)};for(let t of e)if(!i(t.$data.imports))for(let[e,n]of c(t.$data.imports))for(let r of n){let n=v(e,r.id);u(t,b(t.findElement(n),`Element ${r.id} from project ${e} not found in model ${t.projectId}`))}let d=Array.from(o.entries()).filter(([e,{relationships:t}])=>t.size>0).map(([e,{from:t,to:n,relationships:i}])=>{let o=[...i];S(a(o,1),`Relationships set must have at least one relationship`);let c={id:C(e),source:Y(t),target:Y(n),projectId:t,relations:s(o,m(`id`)),label:null,color:`gray`,parent:null,line:`solid`,tags:p(r(o,m(`tags`)))},l=_(o);return l&&(c.label=l.title,c.description=x(l.$relationship)??null,c.technology=l.technology,c.color=l.color,c.line=l.line,l.kind&&(c.kind=l.kind),l.$relationship.navigateTo&&(c.navigateTo=l.$relationship.navigateTo)),c});F(t,d);let f=B({nodes:t,edges:d});return{id:`projects-view`,[j]:`projects`,[D]:`computed`,title:`Projects`,description:{txt:`Overview of all projects and their relationships`},autoLayout:{direction:`TB`},...f}}function ae(e){let t=new Map;for(let n of e){let e=re(n.projectId),r={id:Y(e),kind:`@project`,parent:null,projectId:e,title:n.project.title??n.project.id,description:{txt:[`Elements: ${J(n.$data.elements)}`,`Relationships: ${J(n.$data.relations)}`,`Views: ${J(n.$data.views)}`].join(`
|
|
2
|
+
`)},shape:`rectangle`,children:[],inEdges:[],outEdges:[],color:`primary`,level:0,style:{},tags:[]};t.set(r.id,r)}return t}function X(t){let n=O([...t]),r=new Set(n),i=new Map,a=new N.default(()=>null),o=n.reduce((t,n,o,s)=>(i.set(n.id,n),t.set(n.id,f(s,e(o+1),l(k(n)),d((e,t)=>(r.delete(t),e.some(te(t))||(e.push(t),a.set(t.id,n)),e),[]))),t),new N.default(()=>[]));return{sorted:n,byId:e=>b(i.get(e),`Element not found by id: ${e}`),root:r,parent:e=>a.get(typeof e==`string`?e:e.id),children:e=>o.get(typeof e==`string`?e:e.id),flatten:u(()=>new Set([...r,...n.reduce((e,t)=>{let n=o.get(t.id);return n.length===0?(e.push(t),e):(n.length>1&&e.push(...n),e)},[])]))}}const Z=(e,t)=>e.size>2&&t.size!==e.size?new Set(O([...X(e).flatten(),...t])):e.size>1?new Set(O([...e])):e;function Q(e,t,n){let r=e=>t.has(e),i=new Set([e]),a={incomers:new Set,subjects:new Set([e]),outgoers:new Set},o=new Set(n.incoming.flatMap(t=>{if(a.subjects.add(t.target),a.incomers.add(t.source),i.add(t.target),t.target!==e){let n=t.target.parent;for(;n&&n!==e;)i.add(n),n=n.parent}let n=t.source,o=[];for(;o.push(n),!(r(n)||!n.parent);)n=n.parent;return o})),s=new Set(n.outgoing.flatMap(t=>{if(a.subjects.add(t.source),a.outgoers.add(t.target),i.add(t.source),t.source!==e){let n=t.source.parent;for(;n&&n!==e;)i.add(n),n=n.parent}let n=t.target,o=[];for(;o.push(n),!(r(n)||!n.parent);)n=n.parent;return o}));return{incomers:Z(o,a.incomers),incoming:new Set(n.incoming),subjects:Z(i,a.subjects),outgoing:new Set(n.outgoing),outgoers:Z(s,a.outgoers)}}function oe(e,t,n,r=`global`){let i=n?t.findView(n):null;if(r===`view`)return S(i,`Scope view id is required when scope is "view"`),se(e,i,t);let a=t.element(e);return Q(a,ee(a.ascendingSiblings()),{incoming:[...a.incoming()],outgoing:[...a.outgoing()]})}function se(e,t,n){let r=n.element(e),i={incoming:M(T(r.incoming(),e=>t.includesRelation(e.id))),outgoing:M(T(r.outgoing(),e=>t.includesRelation(e.id)))},a=k(r);return Q(r,new Set([...r.ascendingSiblings(),...f(t.elements(),w(e=>e.element),T(e=>e!==r&&a(e)))]),i)}function $(e,t){return{...R(e,{id:A(`adhoc`),_stage:`parsed`,_type:`element`,rules:t,title:null,description:null}),_type:`adhoc`,_stage:`computed`}}var ce=class e{model;static use(t){return new e(t)}#e=[];constructor(e){this.model=e}Expr;include(...e){return this.#e.push({include:e.map(e=>V(e))}),this}exclude(...e){return this.#e.push({exclude:e.map(e=>V(e))}),this}compute(){return $(this.model,this.#e)}};export{ce as AdhocView,$ as computeAdhocView,L as computeLikeC4Model,z as computeParsedModelData,ie as computeProjectsView,oe as computeRelationshipsView,I as computeView,G as resolveRulesExtendedViews,X as treeFromElements,P as unsafeComputeView,q as viewsWithReadableEdges,K as withReadableEdges};
|
package/dist/geometry/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{En as e,Tn as t,bn as n,bt as r,xn as i,xt as a}from"../_chunks/types.mjs";export{n as BBox,i as RectBox,r as Vector,t as convertPoint,e as isPoint,a as vector};
|
package/dist/index.d.mts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as DiagramNodeDriftReason, $i as Coalesce, $n as isTagEqual, $t as ElementViewIncludePredicate, A as isComputedView, Ai as ProjectId, An as ModelRelationExpr, Ar as IconPositions, At as ElementStyle, B as DeploymentViewIncludePredicate, Bi as flattenMarkdownOrString, Bn as NotOperator, Bt as DynamicStep, C as LayoutedView, Ci as GlobalFqn, Cn as ViewWithNotation, Cr as ThemeColor, Ct as DeploymentNode, D as ViewRule, Di as MarkdownOrString, Dn as isViewRuleGlobalStyle, Dr as BorderStyles, Dt as isDeploymentNode, E as ViewOnStage, Ei as IconUrl, En as isViewRuleGlobalPredicateRef, Er as isThemeColor, Et as isDeployedInstance, F as isExtendsElementView, Fi as StepEdgeIdLiteral, Fn as AndOperator, Fr as AnyLayouted, Ft as GlobalPredicateId, G as ParsedViewRuleAncestors, Gi as splitGlobalFqn, Gn as TagEqual, Gt as DynamicViewRule, H as DeploymentViewRule, Hi as isGroupElementKind, Hn as OrOperator, Ht as DynamicStepsSeries, I as isScopedElementView, Ii as StepEdgeKind, In as EqualOperator, Ir as AnyParsed, It as GlobalPredicates, J as LayoutType, Ji as ModelStage, Jn as isKindEqual, Jt as getParallelStepsPrefix, K as DiagramEdge, Ki as stepEdgeId, Kn as WhereOperator, Kt as DynamicViewStep, L as isViewRulePredicate, Li as Tag, Ln as Filterable, Lr as Aux, Lt as GlobalStyleID, M as isDiagramView, Mi as RelationKind, Mn as FqnExpr, Mr as ThemeColors, Mt as Relationship, N as isDynamicView, Ni as RelationshipKind, Nn as PredicateSelector, Nr as Any, Nt as ensureSizes, O as ViewRulePredicate, Oi as NodeId, On as ModelExpression, Ot as AbstractRelationship, P as isElementView, Pi as StepEdgeId, Pn as RelationExpr, Pr as AnyComputed, Pt as GlobalDynamicPredicates, Q as DiagramEdgeDriftReason, Qi as isOnStage, Qn as isParticipantOperator, Qt as ElementViewExcludePredicate, R as isViewRuleStyle, Ri as ViewId, Rn as KindEqual, Rt as GlobalStyles, S as ComputedView, Si as Fqn, Sn as ViewWithHash, Sr as TextSize, St as DeploymentElementRef, T as ProcessedView, Ti as Icon, Tn as isViewRuleAutoLayout, Tr as isCustomColor, Tt as DeploymentRelationship, U as DeploymentViewRuleStyle, Ui as isStepEdgeId, Un as Participant, Ut as DynamicViewDisplayVariant, V as DeploymentViewPredicate, Vi as isGlobalFqn, Vn as OperatorPredicate, Vt as DynamicStepsParallel, W as ParsedDeploymentView, Wi as scalar_d_exports, Wn as ParticipantOperator, Wt as DynamicViewIncludeRule, X as LayoutedDynamicView, Xi as _stage, Xn as isNotOperator, Xt as isDynamicStepsParallel, Y as LayoutedDeploymentView, Yi as _layout, Yn as isMetadataEqual, Yt as isDynamicStep, Z as LayoutedElementView, Zi as _type, Zn as isOrOperator, Zt as isDynamicStepsSeries, _ as ComputedLikeC4ModelData, _i as BuiltInIcon, _n as ViewRuleAutoLayout, _r as RelationshipColorValues, _t as Specification, a as isNonEmptyArray, aa as NTuple, an as ParsedElementView, ar as CustomColor, at as ComputedElementView, b as ParsedLikeC4ModelData, bi as EdgeId, bn as ViewRuleRank, br as Size, bt as DeployedInstance, c as RichTextEmpty, ca as Predicate, ci as UnknownLayouted, cn as AnyExcludePredicate, cr as ElementShape, ct as ComputedRankConstraint, d as AuxFromDump, di as _aux_d_exports, dn as AutoLayoutDirection, dr as IconSize, dt as LikeC4ProjectStyleDefaults, ea as ExclusiveUnion, en as ElementViewPredicate, er as whereOperatorAsPredicate, et as LayoutedViewDriftReason, f as LikeC4ModelDump, fi as preferDescription, fn as BaseParsedViewProperties, fr as LikeC4StyleDefaults, ft as LikeC4ProjectStylesConfig, g as AuxFromLikeC4ModelData, gi as AnyFqn, gn as ViewAutoLayout, gr as RelationshipArrowTypes, gt as RelationshipSpecification, h as SpecificationDump, hn as RankValue, hr as RelationshipArrowType, ht as ElementSpecification, i as isAnyOf, ia as Link, in as ElementViewRuleStyle, ir as ColorLiteral, it as ComputedEdge, j as isDeploymentView, ji as RelationId, jn as Expression, jr as Sizes, jt as ModelRelation, k as ViewWithType, ki as NoneIcon, kn as ModelFqnExpr, kr as ElementShapes, kt as Element, l as RichTextOrEmpty, la as ReorderedArray, li as UnknownParsed, ln as AnyIncludePredicate, lr as HexColor, lt as LikeC4Project, m as SpecTypesFromDump, mn as NodeNotation, mr as LikeC4Theme, mt as LikeC4ProjectTheme, n as GuardedBy, na as IteratorLike, nn as ElementViewRuleGroup, nr as BorderStyle, nt as ComputedDeploymentView, o as isString, oa as NonEmptyArray, oi as Unknown, on as isViewRuleGroup, or as CustomColorDefinitions, ot as ComputedNode, p as ProjectDump, pi as preferSummary, pn as BaseViewProperties, pr as LikeC4StylesConfig, pt as LikeC4ProjectStylesCustomStylesheets, q as DiagramNode, qi as ExtractOnStage, qn as isAndOperator, qr as LooseLiteral, qt as ParsedDynamicView, r as hasProp, ra as KeysOf, rn as ElementViewRuleRank, rr as Color, rt as ComputedDynamicView, s as RichText, sa as NonEmptyReadonlyArray, si as UnknownComputed, sn as isViewRuleRank, sr as ElementColorValues, st as ComputedNodeStyle, t as Guard, ta as IterableContainer, ti as SpecAux, tn as ElementViewRule, tr as FqnRef, tt as ViewManualLayoutSnapshot, u as ViewChange, ua as exact, un as AnyViewRuleStyle, ur as IconPosition, ut as LikeC4ProjectManualLayoutsConfig, v as LayoutedLikeC4ModelData, vi as DeploymentFqn, vn as ViewRuleGlobalPredicateRef, vr as RelationshipLineType, vt as TagSpecification, w as ParsedView, wi as GroupElementKind, wn as isAutoLayoutDirection, wr as ThemeColorValues, wt as DeploymentRelation, x as AnyView, xi as ElementKind, xn as ViewType, xr as SpacingSize, xt as DeploymentElement, y as LikeC4ModelData, yi as DeploymentKind, yn as ViewRuleGlobalStyle, yr as ShapeSize, yt as isTagColorSpecified, z as DeploymentViewExcludePredicate, zi as extractStep, zn as MetadataEqual, zt as ModelGlobals } from "./_chunks/index.mjs";
|
|
2
2
|
import { a as RectBox, c as XYPoint, i as BBox, l as convertPoint, n as VectorValue, o as Dimensions, r as vector, s as Point, t as Vector, u as isPoint } from "./_chunks/index2.mjs";
|
|
3
3
|
import { i as LikeC4Styles } from "./_chunks/index3.mjs";
|
|
4
|
-
import { a as DefaultWeakMap, i as LinkedList, n as
|
|
5
|
-
import "./_chunks/mnemonist.mjs";
|
|
4
|
+
import { a as DefaultWeakMap, i as LinkedList, n as Queue, o as DefaultMap, r as MultiMap } from "./_chunks/libs/mnemonist.mjs";
|
|
6
5
|
import { o as LayoutedProjectsView, r as ComputedProjectsView } from "./_chunks/_types2.mjs";
|
|
7
|
-
import {
|
|
6
|
+
import { A as ancestorsFqn, B as parentFqn, H as sortNaturalByFqn, I as isAncestor, J as invariant, L as isDescendantOf, O as isIterable, R as isSameHierarchy, U as sortParentsFirst, X as nonexhaustive, Y as nonNullable, h as memoizeProp, z as nameFromFqn } from "./_chunks/index5.mjs";
|
|
8
7
|
|
|
9
8
|
//#region src/manual-layout/applyCachedLayout.d.ts
|
|
10
9
|
/**
|
|
@@ -34,4 +33,4 @@ declare function applyManualLayout<V extends LayoutedView>(autoLayouted: V, snap
|
|
|
34
33
|
*/
|
|
35
34
|
declare function calcDriftsFromSnapshot<V extends LayoutedView>(autoLayouted: V, snapshot: ViewManualLayoutSnapshot): V;
|
|
36
35
|
//#endregion
|
|
37
|
-
export { AbstractRelationship, AndOperator, Any, Any as AnyAux, AnyComputed, AnyExcludePredicate, AnyFqn, AnyIncludePredicate, AnyLayouted, AnyParsed, AnyView, AnyViewRuleStyle, AutoLayoutDirection, Aux, AuxFromDump, AuxFromLikeC4ModelData, BBox, BaseParsedViewProperties, BaseViewProperties, BorderStyle, BorderStyles, BuiltInIcon, Coalesce, Color, ColorLiteral, ComputedDeploymentView, ComputedDynamicView, ComputedEdge, ComputedElementView, ComputedLikeC4ModelData, ComputedNode, ComputedNodeStyle, type ComputedProjectsView, ComputedRankConstraint, ComputedView, CustomColor, CustomColorDefinitions, DefaultMap, DefaultWeakMap, DeployedInstance, DeploymentElement, DeploymentElementRef, DeploymentFqn, DeploymentKind, DeploymentNode, DeploymentRelation, DeploymentRelationship, DeploymentViewExcludePredicate, DeploymentViewIncludePredicate, DeploymentViewPredicate, DeploymentViewRule, DeploymentViewRuleStyle, DiagramEdge, DiagramEdgeDriftReason, DiagramNode, DiagramNodeDriftReason, LayoutedView as DiagramView, LayoutedView, Dimensions, DynamicStep, DynamicStepsParallel, DynamicStepsSeries, DynamicViewDisplayVariant, DynamicViewIncludeRule, DynamicViewRule, DynamicViewStep, EdgeId, Element, ElementColorValues, ElementKind, ElementShape, ElementShapes, ElementSpecification, ElementStyle, ElementViewExcludePredicate, ElementViewIncludePredicate, ElementViewPredicate, ElementViewRule, ElementViewRuleGroup, ElementViewRuleRank, ElementViewRuleStyle, EqualOperator, ExclusiveUnion, Expression, ExtractOnStage, Filterable, Fqn, FqnExpr, FqnRef, GlobalDynamicPredicates, GlobalFqn, GlobalPredicateId, GlobalPredicates, GlobalStyleID, GlobalStyles, GroupElementKind, Guard, GuardedBy, HexColor, Icon, IconPosition, IconPositions, IconSize, IconUrl, IterableContainer, IteratorLike, KeysOf, KindEqual, LayoutType, LayoutedDeploymentView, LayoutedDynamicView, LayoutedElementView, LayoutedLikeC4ModelData, type LayoutedProjectsView, LayoutedViewDriftReason, LikeC4ModelData, LikeC4ModelDump, LikeC4Project, LikeC4ProjectManualLayoutsConfig, LikeC4ProjectStyleDefaults, LikeC4ProjectStylesConfig, LikeC4ProjectStylesCustomStylesheets, LikeC4ProjectTheme, type LikeC4StyleDefaults, LikeC4Styles, type LikeC4StylesConfig, type LikeC4Theme, ParsedView as LikeC4View, ParsedView, Link, LinkedList, LooseLiteral, MarkdownOrString, MetadataEqual, ModelExpression, ModelFqnExpr, ModelGlobals, ModelRelation, ModelRelationExpr, ModelStage, MultiMap, NTuple, NodeId, NodeNotation, NonEmptyArray, NonEmptyReadonlyArray, NoneIcon, NotOperator, OperatorPredicate, OrOperator, ParsedDeploymentView, ParsedDynamicView, ParsedElementView, ParsedLikeC4ModelData, Participant, ParticipantOperator, Point, Predicate, PredicateSelector, ProcessedView, ProjectDump, ProjectId, Queue, RankValue, RectBox, RelationExpr, RelationId, RelationKind, Relationship, RelationshipArrowType, RelationshipArrowTypes, RelationshipColorValues, RelationshipKind, RelationshipLineType, RelationshipSpecification, ReorderedArray, RichText, RichTextEmpty, RichTextOrEmpty, ShapeSize, Size, Sizes, SpacingSize, SpecAux, SpecTypesFromDump, Specification, SpecificationDump, StepEdgeId, StepEdgeIdLiteral, StepEdgeKind, Tag, TagEqual, TagSpecification, TextSize, ThemeColor, type ThemeColorValues, ThemeColors, Unknown, UnknownComputed, UnknownLayouted, UnknownParsed, Vector, VectorValue, ViewAutoLayout, ViewChange, ViewId, ViewManualLayoutSnapshot, ViewOnStage, ViewRule, ViewRuleAutoLayout, ViewRuleGlobalPredicateRef, ViewRuleGlobalStyle, ViewRulePredicate, ViewRuleRank, ViewType, ViewWithHash, ViewWithNotation, ViewWithType, WhereOperator, XYPoint, _layout, _stage, _type, ancestorsFqn, applyCachedLayout, applyManualLayout, _aux_d_exports as aux, calcDriftsFromSnapshot, convertPoint, ensureSizes, exact, extractStep, flattenMarkdownOrString, getParallelStepsPrefix, hasProp, invariant, isAncestor, isAndOperator, isAnyOf, isAutoLayoutDirection, isComputedView, isCustomColor, isDeployedInstance, isDeploymentNode, isDeploymentView, isDescendantOf, isDiagramView, isDiagramView as isLayoutedView, isDynamicStep, isDynamicStepsParallel, isDynamicStepsSeries, isDynamicView, isElementView, isExtendsElementView, isGlobalFqn, isGroupElementKind, isIterable, isKindEqual, isMetadataEqual, isNonEmptyArray, isNotOperator, isOnStage, isOrOperator, isParticipantOperator, isPoint, isSameHierarchy, isScopedElementView, isStepEdgeId, isString, isTagColorSpecified, isTagEqual, isThemeColor, isViewRuleAutoLayout, isViewRuleGlobalPredicateRef, isViewRuleGlobalStyle, isViewRuleGroup, isViewRulePredicate, isViewRuleRank, isViewRuleStyle, memoizeProp, nameFromFqn, nonNullable, nonexhaustive, parentFqn, preferDescription, preferSummary, scalar_d_exports as scalar, sortNaturalByFqn, sortParentsFirst, splitGlobalFqn, stepEdgeId, vector, whereOperatorAsPredicate };
|
|
36
|
+
export { AbstractRelationship, AndOperator, Any, Any as AnyAux, AnyComputed, AnyExcludePredicate, AnyFqn, AnyIncludePredicate, AnyLayouted, AnyParsed, AnyView, AnyViewRuleStyle, AutoLayoutDirection, Aux, AuxFromDump, AuxFromLikeC4ModelData, BBox, BaseParsedViewProperties, BaseViewProperties, BorderStyle, BorderStyles, BuiltInIcon, Coalesce, Color, ColorLiteral, ComputedDeploymentView, ComputedDynamicView, ComputedEdge, ComputedElementView, ComputedLikeC4ModelData, ComputedNode, ComputedNodeStyle, type ComputedProjectsView, ComputedRankConstraint, ComputedView, CustomColor, CustomColorDefinitions, DefaultMap, DefaultWeakMap, DeployedInstance, DeploymentElement, DeploymentElementRef, DeploymentFqn, DeploymentKind, DeploymentNode, DeploymentRelation, DeploymentRelationship, DeploymentViewExcludePredicate, DeploymentViewIncludePredicate, DeploymentViewPredicate, DeploymentViewRule, DeploymentViewRuleStyle, DiagramEdge, DiagramEdgeDriftReason, DiagramNode, DiagramNodeDriftReason, LayoutedView as DiagramView, LayoutedView, Dimensions, DynamicStep, DynamicStepsParallel, DynamicStepsSeries, DynamicViewDisplayVariant, DynamicViewIncludeRule, DynamicViewRule, DynamicViewStep, EdgeId, Element, ElementColorValues, ElementKind, ElementShape, ElementShapes, ElementSpecification, ElementStyle, ElementViewExcludePredicate, ElementViewIncludePredicate, ElementViewPredicate, ElementViewRule, ElementViewRuleGroup, ElementViewRuleRank, ElementViewRuleStyle, EqualOperator, ExclusiveUnion, Expression, ExtractOnStage, Filterable, Fqn, FqnExpr, FqnRef, GlobalDynamicPredicates, GlobalFqn, GlobalPredicateId, GlobalPredicates, GlobalStyleID, GlobalStyles, GroupElementKind, Guard, GuardedBy, HexColor, Icon, IconPosition, IconPositions, IconSize, IconUrl, IterableContainer, IteratorLike, KeysOf, KindEqual, LayoutType, LayoutedDeploymentView, LayoutedDynamicView, LayoutedElementView, LayoutedLikeC4ModelData, type LayoutedProjectsView, LayoutedViewDriftReason, LikeC4ModelData, LikeC4ModelDump, LikeC4Project, LikeC4ProjectManualLayoutsConfig, LikeC4ProjectStyleDefaults, LikeC4ProjectStylesConfig, LikeC4ProjectStylesCustomStylesheets, LikeC4ProjectTheme, type LikeC4StyleDefaults, LikeC4Styles, type LikeC4StylesConfig, type LikeC4Theme, ParsedView as LikeC4View, ParsedView, Link, LinkedList, LooseLiteral, MarkdownOrString, MetadataEqual, ModelExpression, ModelFqnExpr, ModelGlobals, ModelRelation, ModelRelationExpr, ModelStage, MultiMap, NTuple, NodeId, NodeNotation, NonEmptyArray, NonEmptyReadonlyArray, NoneIcon, NotOperator, OperatorPredicate, OrOperator, ParsedDeploymentView, ParsedDynamicView, ParsedElementView, ParsedLikeC4ModelData, ParsedViewRuleAncestors, Participant, ParticipantOperator, Point, Predicate, PredicateSelector, ProcessedView, ProjectDump, ProjectId, Queue, RankValue, RectBox, RelationExpr, RelationId, RelationKind, Relationship, RelationshipArrowType, RelationshipArrowTypes, RelationshipColorValues, RelationshipKind, RelationshipLineType, RelationshipSpecification, ReorderedArray, RichText, RichTextEmpty, RichTextOrEmpty, ShapeSize, Size, Sizes, SpacingSize, SpecAux, SpecTypesFromDump, Specification, SpecificationDump, StepEdgeId, StepEdgeIdLiteral, StepEdgeKind, Tag, TagEqual, TagSpecification, TextSize, ThemeColor, type ThemeColorValues, ThemeColors, Unknown, UnknownComputed, UnknownLayouted, UnknownParsed, Vector, VectorValue, ViewAutoLayout, ViewChange, ViewId, ViewManualLayoutSnapshot, ViewOnStage, ViewRule, ViewRuleAutoLayout, ViewRuleGlobalPredicateRef, ViewRuleGlobalStyle, ViewRulePredicate, ViewRuleRank, ViewType, ViewWithHash, ViewWithNotation, ViewWithType, WhereOperator, XYPoint, _layout, _stage, _type, ancestorsFqn, applyCachedLayout, applyManualLayout, _aux_d_exports as aux, calcDriftsFromSnapshot, convertPoint, ensureSizes, exact, extractStep, flattenMarkdownOrString, getParallelStepsPrefix, hasProp, invariant, isAncestor, isAndOperator, isAnyOf, isAutoLayoutDirection, isComputedView, isCustomColor, isDeployedInstance, isDeploymentNode, isDeploymentView, isDescendantOf, isDiagramView, isDiagramView as isLayoutedView, isDynamicStep, isDynamicStepsParallel, isDynamicStepsSeries, isDynamicView, isElementView, isExtendsElementView, isGlobalFqn, isGroupElementKind, isIterable, isKindEqual, isMetadataEqual, isNonEmptyArray, isNotOperator, isOnStage, isOrOperator, isParticipantOperator, isPoint, isSameHierarchy, isScopedElementView, isStepEdgeId, isString, isTagColorSpecified, isTagEqual, isThemeColor, isViewRuleAutoLayout, isViewRuleGlobalPredicateRef, isViewRuleGlobalStyle, isViewRuleGroup, isViewRulePredicate, isViewRuleRank, isViewRuleStyle, memoizeProp, nameFromFqn, nonNullable, nonexhaustive, parentFqn, preferDescription, preferSummary, scalar_d_exports as scalar, sortNaturalByFqn, sortParentsFirst, splitGlobalFqn, stepEdgeId, vector, whereOperatorAsPredicate };
|