@likec4/core 1.49.0 → 1.51.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.
Files changed (80) hide show
  1. package/dist/THIRD-PARTY-LICENSES.md +24 -2
  2. package/dist/_chunks/Builder.view-element.mjs +2 -2
  3. package/dist/_chunks/LikeC4Model.d.mts +3 -3
  4. package/dist/_chunks/_types.d.mts +1 -1
  5. package/dist/_chunks/_types2.d.mts +2 -2
  6. package/dist/_chunks/assignTagColors.mjs +1 -1
  7. package/dist/_chunks/geometry.mjs +1 -0
  8. package/dist/_chunks/index.d.mts +1964 -219
  9. package/dist/_chunks/{theme.d.mts → index3.d.mts} +1 -1
  10. package/dist/_chunks/index4.d.mts +288 -0
  11. package/dist/_chunks/{to-text.d.mts → index5.d.mts} +1 -1
  12. package/dist/_chunks/libs/@mantine/colors-generator.mjs +2 -2
  13. package/dist/_chunks/libs/@radix-ui/colors.mjs +1 -1
  14. package/dist/_chunks/libs/@ungap/structured-clone.mjs +1 -1
  15. package/dist/_chunks/libs/bail.mjs +1 -1
  16. package/dist/_chunks/libs/ccount.mjs +1 -1
  17. package/dist/_chunks/libs/character-entities-html4.mjs +1 -1
  18. package/dist/_chunks/libs/character-entities-legacy.mjs +1 -1
  19. package/dist/_chunks/libs/character-entities.mjs +2 -2
  20. package/dist/_chunks/libs/comma-separated-tokens.mjs +1 -1
  21. package/dist/_chunks/libs/decode-named-character-reference.mjs +1 -1
  22. package/dist/_chunks/libs/defu.mjs +1 -1
  23. package/dist/_chunks/libs/devlop.mjs +1 -1
  24. package/dist/_chunks/libs/escape-string-regexp.mjs +1 -1
  25. package/dist/_chunks/libs/extend.mjs +1 -1
  26. package/dist/_chunks/libs/graphology-dag.mjs +1 -1
  27. package/dist/_chunks/libs/graphology.mjs +1 -1
  28. package/dist/_chunks/libs/hast-util-sanitize.mjs +1 -1
  29. package/dist/_chunks/libs/hast-util-to-html.mjs +2 -2
  30. package/dist/_chunks/libs/is-plain-obj.mjs +1 -1
  31. package/dist/_chunks/libs/longest-streak.mjs +1 -1
  32. package/dist/_chunks/libs/markdown-table.mjs +2 -2
  33. package/dist/_chunks/libs/mdast-util-find-and-replace.mjs +1 -1
  34. package/dist/_chunks/libs/mdast-util-from-markdown.mjs +2 -2
  35. package/dist/_chunks/libs/mdast-util-gfm.mjs +9 -9
  36. package/dist/_chunks/libs/mdast-util-to-hast.mjs +7 -7
  37. package/dist/_chunks/libs/micromark-extension-gfm.mjs +1 -1
  38. package/dist/_chunks/libs/mnemonist.mjs +1 -1
  39. package/dist/_chunks/libs/natural-compare-lite.mjs +2 -2
  40. package/dist/_chunks/libs/ohash.mjs +1 -1
  41. package/dist/_chunks/libs/rehype-sanitize.mjs +1 -1
  42. package/dist/_chunks/libs/rehype-stringify.mjs +1 -1
  43. package/dist/_chunks/libs/remark-gfm.mjs +1 -1
  44. package/dist/_chunks/libs/remark-github-blockquote-alert.mjs +2 -2
  45. package/dist/_chunks/libs/remark-parse.mjs +1 -1
  46. package/dist/_chunks/libs/remark-rehype.mjs +1 -1
  47. package/dist/_chunks/libs/remeda.mjs +2 -1
  48. package/dist/_chunks/libs/trough.mjs +1 -1
  49. package/dist/_chunks/libs/unified.mjs +1 -1
  50. package/dist/_chunks/manual-layout.mjs +1 -0
  51. package/dist/_chunks/mnemonist.d.mts +1 -0
  52. package/dist/_chunks/model.mjs +4 -0
  53. package/dist/_chunks/rolldown-runtime.mjs +1 -1
  54. package/dist/_chunks/types.mjs +1 -0
  55. package/dist/_chunks/utils.mjs +1 -0
  56. package/dist/builder/index.d.mts +5 -2
  57. package/dist/builder/index.mjs +1 -1
  58. package/dist/compute-view/index.d.mts +6 -5
  59. package/dist/compute-view/index.mjs +2 -2
  60. package/dist/geometry/index.d.mts +1 -1
  61. package/dist/geometry/index.mjs +1 -1
  62. package/dist/index.d.mts +5 -7
  63. package/dist/index.mjs +1 -1
  64. package/dist/model/index.d.mts +7 -4
  65. package/dist/model/index.mjs +1 -1
  66. package/dist/styles/index.d.mts +3 -2
  67. package/dist/styles/index.mjs +1 -1
  68. package/dist/types/index.d.mts +3 -3
  69. package/dist/types/index.mjs +1 -1
  70. package/dist/utils/graphology/index.mjs +1 -1
  71. package/dist/utils/index.d.mts +4 -2
  72. package/dist/utils/index.mjs +1 -1
  73. package/package.json +11 -11
  74. package/dist/_chunks/RichText.mjs +0 -1
  75. package/dist/_chunks/calcDriftsFromSnapshot.mjs +0 -1
  76. package/dist/_chunks/guards.d.mts +0 -2026
  77. package/dist/_chunks/guards.mjs +0 -4
  78. package/dist/_chunks/to-text.mjs +0 -1
  79. package/dist/_chunks/vector.mjs +0 -1
  80. /package/dist/_chunks/{vector.d.mts → index2.d.mts} +0 -0
@@ -1,4 +0,0 @@
1
- import{n as __exportAll}from"./rolldown-runtime.mjs";import{A as t,E as t$3,I as e$2,L as e$1,N as e$5,O as e,Q as t$1,T as t$6,X as t$4,c as t$8,et as t$5,i as n,l as t$7,m as e$4,r as t$2,s as e$3}from"./libs/remeda.mjs";import{A as LikeC4Styles,D as whereOperatorAsPredicate,J as FqnRef,Q as GlobalFqn,V as isDeploymentNode,_t as _type,bt as preferSummary,dt as isStepEdgeId,gt as _stage,lt as isGlobalFqn,pt as splitGlobalFqn,st as extractStep,t as RichText,ut as isGroupElementKind,vt as isOnStage,xt as exact,yt as preferDescription}from"./RichText.mjs";import{$ as nonNullable,A as ancestorsFqn,B as parentFqn,D as ifilter,E as ifind,F as hierarchyLevel,H as sortNaturalByFqn,I as isAncestor,J as compareNatural,L as isDescendantOf,Q as invariant,R as isSameHierarchy,S as ihead,U as sortParentsFirst,Y as compareNaturalHierarchically,a as difference,c as intersection,h as memoizeProp,j as commonAncestor,k as getOrCreate,o as equals,q as isString,r as stringHash,u as union,y as isome,z as nameFromFqn}from"./to-text.mjs";import{t as import_default_map}from"./libs/mnemonist.mjs";import{n as applyManualLayout,t as calcDriftsFromSnapshot}from"./calcDriftsFromSnapshot.mjs";var ElementModel=class{Aux;id;_literalId;hierarchyLevel;imported;constructor(r,i){this.$model=r,this.$element=i,this.id=this.$element.id,this._literalId=this.$element.id;let[a,o]=splitGlobalFqn(this.id);a?(this.imported={from:a,fqn:o},this.hierarchyLevel=hierarchyLevel(o)):(this.imported=null,this.hierarchyLevel=hierarchyLevel(this.id))}get name(){return nameFromFqn(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 memoizeProp(this,Symbol.for(`tags`),()=>n([...this.$element.tags??[],...this.$model.specification.elements[this.$element.kind]?.tags??[]]))}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 RichText.memoize(this,`summary`,preferSummary(this.$element))}get description(){return RichText.memoize(this,`description`,preferDescription(this.$element))}get technology(){return this.$element.technology??null}get links(){return this.$element.links??[]}get defaultView(){return memoizeProp(this,Symbol.for(`defaultView`),()=>ihead(this.scopedViews())??null)}get isRoot(){return this.parent===null}get style(){return memoizeProp(this,`style`,()=>exact({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(r){return isAncestor(this,r)}isDescendantOf(r){return isAncestor(r,this)}ancestors(){return this.$model.ancestors(this)}commonAncestor(r){let i=commonAncestor(this.id,r.id);return i?this.$model.element(i):null}children(){return this.$model.children(this)}descendants(r){return r?sortNaturalByFqn([...this.$model.descendants(this)],r)[Symbol.iterator]():this.$model.descendants(this)}siblings(){return this.$model.siblings(this)}*ascendingSiblings(){yield*this.siblings();for(let r of this.ancestors())yield*r.siblings()}*descendingSiblings(){for(let r of[...this.ancestors()].reverse())yield*r.siblings();yield*this.siblings()}incoming(r=`all`){return this.$model.incoming(this,r)}*incomers(r=`all`){let i=new Set;for(let a of this.incoming(r))i.has(a.source.id)||(i.add(a.source.id),yield a.source)}outgoing(r=`all`){return this.$model.outgoing(this,r)}*outgoers(r=`all`){let i=new Set;for(let a of this.outgoing(r))i.has(a.target.id)||(i.add(a.target.id),yield a.target)}get allOutgoing(){return memoizeProp(this,Symbol.for(`allOutgoing`),()=>new Set(this.outgoing()))}get allIncoming(){return memoizeProp(this,Symbol.for(`allIncoming`),()=>new Set(this.incoming()))}views(){return memoizeProp(this,Symbol.for(`views`),()=>{let r=new Set;for(let i of this.$model.views())i.includesElement(this.id)&&r.add(i);return r})}scopedViews(){return memoizeProp(this,Symbol.for(`scopedViews`),()=>{let r=new Set;for(let i of this.$model.views())i.isScopedElementView()&&i.viewOf.id===this.id&&r.add(i);return r})}isDeployed(){return e(ihead(this.deployments()))}deployments(){return this.$model.deployment.instancesOf(this)}hasMetadata(){return!!this.$element.metadata&&!e$1(this.$element.metadata)}getMetadata(r){return r?this.$element.metadata?.[r]:this.$element.metadata??{}}isTagged(r){return this.tags.includes(r)}},AbstractDeploymentElementModel=class{Aux;get style(){return memoizeProp(this,`style`,()=>exact({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 nameFromFqn(this.id)}get shape(){return this.style.shape}get color(){return this.style.color}get icon(){return this.style.icon??null}get summary(){return RichText.memoize(this,`summary`,preferSummary(this.$node))}get description(){return RichText.memoize(this,`description`,preferDescription(this.$node))}get technology(){return this.$node.technology??null}get links(){return this.$node.links??[]}ancestors(){return this.$model.ancestors(this)}commonAncestor(r){let i=commonAncestor(this.id,r.id);return i?this.$model.node(i):null}siblings(){return this.$model.siblings(this)}isSibling(r){return this.parent===r.parent}*ascendingSiblings(){yield*this.siblings();for(let r of this.ancestors())yield*r.siblings()}*descendingSiblings(){for(let r of[...this.ancestors()].reverse())yield*r.siblings();yield*this.siblings()}incoming(r=`all`){return this.$model.incoming(this,r)}outgoing(r=`all`){return this.$model.outgoing(this,r)}*incomers(r=`all`){let i=new Set;for(let a of this.incoming(r))i.has(a.source.id)||(i.add(a.source.id),yield a.source)}*outgoers(r=`all`){let i=new Set;for(let a of this.outgoing(r))i.has(a.target.id)||(i.add(a.target.id),yield a.target)}*views(){for(let r of this.$model.views())r._type===`deployment`&&r.includesDeployment(this.id)&&(yield r)}isDeploymentNode(){return!1}isInstance(){return!1}get allOutgoing(){return memoizeProp(this,Symbol.for(`allOutgoing`),()=>RelationshipsAccum.from(new Set(this.outgoingModelRelationships()),new Set(this.outgoing())))}get allIncoming(){return memoizeProp(this,Symbol.for(`allIncoming`),()=>RelationshipsAccum.from(new Set(this.incomingModelRelationships()),new Set(this.incoming())))}hasMetadata(){return!!this.$node.metadata&&!e$1(this.$node.metadata)}getMetadata(r){return r?this.$node.metadata?.[r]:this.$node.metadata??{}}isTagged(r){return this.tags.includes(r)}},DeploymentNodeModel=class extends AbstractDeploymentElementModel{id;_literalId;title;hierarchyLevel;constructor(r,i){super(),this.$model=r,this.$node=i,this.id=i.id,this._literalId=i.id,this.title=i.title,this.hierarchyLevel=hierarchyLevel(i.id)}get parent(){return this.$model.parent(this)}get kind(){return this.$node.kind}get tags(){return memoizeProp(this,Symbol.for(`tags`),()=>n([...this.$node.tags??[],...this.$model.$model.specification.deployments[this.kind]?.tags??[]]))}children(){return this.$model.children(this)}descendants(r=`desc`){return this.$model.descendants(this,r)}isDeploymentNode(){return!0}*instances(){for(let r of this.descendants(`desc`))r.isInstance()&&(yield r)}onlyOneInstance(){let r=this.children();if(r.size!==1)return null;let i=ihead(r);return i?i.isInstance()?i:i.onlyOneInstance():null}_relationshipsFromInstances=null;relationshipsFromInstances(){if(this._relationshipsFromInstances)return this._relationshipsFromInstances;let{outgoing:r,incoming:i}=this._relationshipsFromInstances={outgoing:new Set,incoming:new Set};for(let a of this.instances()){for(let i of a.element.outgoing())r.add(i);for(let r of a.element.incoming())i.add(r)}return this._relationshipsFromInstances}outgoingModelRelationships(){return this.relationshipsFromInstances().outgoing.values()}incomingModelRelationships(){return this.relationshipsFromInstances().incoming.values()}internalModelRelationships(){let{outgoing:r,incoming:i}=this.relationshipsFromInstances();return intersection(i,r)}},DeployedInstanceModel=class extends AbstractDeploymentElementModel{id;_literalId;title;hierarchyLevel;constructor(r,i,a){super(),this.$model=r,this.$instance=i,this.element=a,this.id=i.id,this._literalId=i.id,this.title=i.title??a.title,this.hierarchyLevel=hierarchyLevel(i.id)}get $node(){return this.$instance}get parent(){return nonNullable(this.$model.parent(this),`Parent of ${this.id} not found`)}get style(){return memoizeProp(this,`style`,()=>exact({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 memoizeProp(this,Symbol.for(`tags`),()=>n([...this.$instance.tags??[],...this.element.tags]))}get kind(){return this.element.kind}get summary(){return RichText.memoize(this,`summary`,preferSummary(this.$instance)??preferSummary(this.element.$element))}get description(){return RichText.memoize(this,`description`,preferDescription(this.$instance)??preferDescription(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 r of this.$model.views())if(r._type===`deployment`){if(r.includesDeployment(this.id)){yield r;continue}r.includesDeployment(this.parent.id)&&this.parent.onlyOneInstance()&&(yield r)}}},NestedElementOfDeployedInstanceModel=class{constructor(r,i){this.instance=r,this.element=i}get id(){return this.instance.id}get _literalId(){return this.instance.id}get style(){return memoizeProp(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}},DeploymentRelationModel=class{boundary;source;target;constructor(r,i){this.$model=r,this.$relationship=i,this.source=r.deploymentRef(i.source),this.target=r.deploymentRef(i.target);let a=commonAncestor(this.source.id,this.target.id);this.boundary=a?this.$model.node(a):null}get id(){return this.$relationship.id}get expression(){return`${this.source.id} -> ${this.target.id}`}get title(){return e(this.$relationship.title)?this.$relationship.title:null}get technology(){return e$2(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 RichText.memoize(this,`summary`,preferSummary(this.$relationship))}get description(){return RichText.memoize(this,`description`,preferDescription(this.$relationship))}get tags(){return this.$relationship.tags??[]}get kind(){return this.$relationship.kind??null}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 r of this.$model.views())r.includesRelation(this.id)&&(yield r)}isDeploymentRelation(){return!0}isModelRelation(){return!1}hasMetadata(){return!!this.$relationship.metadata&&!e$1(this.$relationship.metadata)}getMetadata(r){return r?this.$relationship.metadata?.[r]:this.$relationship.metadata??{}}isTagged(r){return this.tags.includes(r)}},RelationshipsAccum=class r{static empty(){return new r}static from(i,a){return new r(new Set(i),new Set(a))}constructor(r=new Set,i=new Set){this.model=r,this.deployment=i}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(i){return r.from(intersection(this.model,i.model),intersection(this.deployment,i.deployment))}difference(i){return r.from(difference(this.model,i.model),difference(this.deployment,i.deployment))}union(i){return r.from(union(this.model,i.model),union(this.deployment,i.deployment))}};const getId=r=>typeof r==`string`?r:r.id,VIEW_FOLDERS_SEPARATOR=`/`,splitViewTitle=r=>{if(invariant(!r.includes(`
2
- `),`View title cannot contain newlines`),r.includes(`/`)){let i=r.split(`/`).map(r=>r.trim()).filter(r=>r.length>0);return t$1(i,1)?i:[``]}return[r.trim()]},normalizeViewPath=r=>splitViewTitle(r).join(`/`),getViewFolderPath=r=>{let i=splitViewTitle(r);return t$1(i,2)?i.slice(0,-1).join(`/`):null},extractViewTitleFromPath=r=>r.includes(`/`)?splitViewTitle(r).pop()??r:r.trim();var LikeC4DeploymentModel=class{#e=new Map;#t=new Map;#n=new import_default_map.default(()=>new Set);#r=new import_default_map.default(()=>new Set);#i=new Set;#a=new Map;#o=new import_default_map.default(()=>new Set);#s=new import_default_map.default(()=>new Set);#c=new import_default_map.default(()=>new Set);#l=new import_default_map.default(()=>new Set);#u=new Map;$deployments;constructor(r){this.$model=r;let i=this.$deployments=r.$data.deployments,a=t$2(i.elements);for(let r of sortParentsFirst(a)){let i=this.addElement(r);for(let r of i.tags)this.#l.get(r).add(i);i.isInstance()&&this.#r.get(i.element.id).add(i)}for(let r of t$2(i.relations)){let i=this.addRelation(r);for(let r of i.tags)this.#l.get(r).add(i)}}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(r){if(r instanceof DeploymentNodeModel||r instanceof DeployedInstanceModel)return r;let i=getId(r);return nonNullable(this.#e.get(i),`Element ${i} not found`)}findElement(r){return this.#e.get(r)??null}node(r){let i=this.element(r);return invariant(i.isDeploymentNode(),`Element ${i.id} is not a deployment node`),i}findNode(r){let i=this.findElement(r);return i?(invariant(i.isDeploymentNode(),`Element ${i?.id} is not a deployment node`),i):null}instance(r){let i=this.element(r);return invariant(i.isInstance(),`Element ${i.id} is not a deployed instance`),i}findInstance(r){let i=this.findElement(r);return i?(invariant(i.isInstance(),`Element ${i?.id} is not a deployed instance`),i):null}roots(){return this.#i.values()}elements(){return this.#e.values()}*nodes(){for(let r of this.#e.values())r.isDeploymentNode()&&(yield r)}*nodesOfKind(r){for(let i of this.#e.values())i.isDeploymentNode()&&i.kind===r&&(yield i)}*instances(){for(let r of this.#e.values())r.isInstance()&&(yield r)}*instancesOf(r){let i=getId(r),a=this.#r.get(i);a&&(yield*a)}deploymentRef(r){if(FqnRef.isInsideInstanceRef(r)){let{deployment:i,element:a}=r;return getOrCreate(this.#u,`${i}@${a}`,()=>new NestedElementOfDeployedInstanceModel(this.instance(i),this.$model.element(a)))}return this.element(r.deployment)}relationships(){return this.#a.values()}relationship(r){let i=getId(r);return nonNullable(this.#a.get(i),`DeploymentRelationModel ${i} not found`)}findRelationship(r){return this.#a.get(r)??null}*views(){for(let r of this.$model.views())r.isDeploymentView()&&(yield r)}parent(r){let i=getId(r);return this.#t.get(i)||null}children(r){let i=getId(r);return this.#n.get(i)}*siblings(r){let i=getId(r),a=this.parent(r)?.children()??this.roots();for(let r of a)r.id!==i&&(yield r)}*ancestors(r){let i=getId(r),a;for(;a=this.#t.get(i);)yield a,i=a.id}*descendants(r,i=`desc`){for(let a of this.children(r))i===`asc`?(yield a,yield*this.descendants(a.id)):(yield*this.descendants(a.id),yield a)}*incoming(r,i=`all`){let a=getId(r);for(let r of this.#o.get(a))switch(!0){case i===`all`:case i===`direct`&&r.target.id===a:case i===`to-descendants`&&r.target.id!==a:yield r;break}}*outgoing(r,i=`all`){let a=getId(r);for(let r of this.#s.get(a))switch(!0){case i===`all`:case i===`direct`&&r.source.id===a:case i===`from-descendants`&&r.source.id!==a:yield r;break}}addElement(r){if(this.#e.has(r.id))throw Error(`Element ${r.id} already exists`);let i=isDeploymentNode(r)?new DeploymentNodeModel(this,Object.freeze(r)):new DeployedInstanceModel(this,Object.freeze(r),this.$model.element(r.element));this.#e.set(i.id,i);let a=parentFqn(i.id);return a?(invariant(this.#e.has(a),`Parent ${a} of ${i.id} not found`),this.#t.set(i.id,this.node(a)),this.#n.get(a).add(i)):(invariant(i.isDeploymentNode(),`Root element ${i.id} is not a deployment node`),this.#i.add(i)),i}addRelation(r){if(this.#a.has(r.id))throw Error(`Relation ${r.id} already exists`);let i=new DeploymentRelationModel(this,Object.freeze(r));this.#a.set(i.id,i),this.#o.get(i.target.id).add(i),this.#s.get(i.source.id).add(i);let a=i.boundary?.id??null;if(a)for(let r of[a,...ancestorsFqn(a)])this.#c.get(r).add(i);for(let r of ancestorsFqn(i.source.id)){if(r===a)break;this.#s.get(r).add(i)}for(let r of ancestorsFqn(i.target.id)){if(r===a)break;this.#o.get(r).add(i)}return i}},RelationshipModel=class{source;target;boundary;constructor(r,i){this.model=r,this.$relationship=i,this.source=r.element(FqnRef.flatten(i.source)),this.target=r.element(FqnRef.flatten(i.target));let a=commonAncestor(this.source.id,this.target.id);this.boundary=a?this.model.element(a):null}get id(){return this.$relationship.id}get expression(){return`${this.source.id} -> ${this.target.id}`}get title(){return e$2(this.$relationship.title)?null:this.$relationship.title}get technology(){return e$2(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 RichText.memoize(this,`summary`,preferSummary(this.$relationship))}get description(){return RichText.memoize(this,`description`,preferDescription(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 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 r of this.model.views())r.includesRelation(this.id)&&(yield r)}isDeploymentRelation(){return!1}isModelRelation(){return!0}hasMetadata(){return!!this.$relationship.metadata&&!e$1(this.$relationship.metadata)}getMetadata(r){return r?this.$relationship.metadata?.[r]:this.$relationship.metadata??{}}isTagged(r){return this.tags.includes(r)}},EdgeModel=class{Aux;$viewModel;$view;$edge;constructor(r,i,a,o){this.source=a,this.target=o,this.$viewModel=r,this.$view=r.$view,this.$edge=i}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 RichText.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()?extractStep(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 isStepEdgeId(this.id)}*relationships(r){for(let i of this.$edge.relations)if(r){let a=this.$viewModel.$model.findRelationship(i,r);a&&(yield a)}else yield this.$viewModel.$model.relationship(i)}includesRelation(r){let i=typeof r==`string`?r:r.id;return this.$edge.relations.includes(i)}isTagged(r){return this.tags.includes(r)}},NodeModel=class{Aux;$viewModel;$view;$node;constructor(r,i){this.$viewModel=r,this.$view=r.$view,this.$node=i}get id(){return this.$node.id}get title(){return this.$node.title}get kind(){return this.$node.kind}get description(){return RichText.memoize(this,`description`,this.$node.description)}get technology(){return this.$node.technology??null}get notes(){return RichText.memoize(this,`notes`,this.$node.notes)}get parent(){return this.$node.parent?this.$viewModel.node(this.$node.parent):null}get element(){let r=this.$node.modelRef;return r?this.$viewModel.$model.element(r):null}get deployment(){let r=this.$node.deploymentRef;return r?this.$viewModel.$model.deployment.element(r):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 memoizeProp(this,`children`,()=>new Set(this.$node.children.map(r=>this.$viewModel.node(r))))}*ancestors(){let r=this.parent;for(;r;)yield r,r=r.parent}*siblings(){let r=this.parent?.children()??this.$viewModel.roots();for(let i of r)i.id!==this.id&&(yield i)}*incoming(r=`all`){for(let i of this.$node.inEdges){let a=this.$viewModel.edge(i);switch(!0){case r===`all`:case r===`direct`&&a.target.id===this.id:case r===`to-descendants`&&a.target.id!==this.id:yield a;break}}}*incomers(r=`all`){let i=new Set;for(let a of this.incoming(r))i.has(a.source.id)||(i.add(a.source.id),yield a.source)}*outgoing(r=`all`){for(let i of this.$node.outEdges){let a=this.$viewModel.edge(i);switch(!0){case r===`all`:case r===`direct`&&a.source.id===this.id:case r===`from-descendants`&&a.source.id!==this.id:yield a;break}}}*outgoers(r=`all`){let i=new Set;for(let a of this.outgoing(r))i.has(a.target.id)||(i.add(a.target.id),yield a.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 e(this.$node.modelRef)}hasDeployment(){return e(this.$node.deploymentRef)}hasDeployedInstance(){return this.hasElement()&&this.hasDeployment()}isGroup(){return isGroupElementKind(this.$node)}isTagged(r){return this.tags.includes(r)}},LikeC4ViewModel=class{Aux;#e;#t=new Set;#n=new Map;#r=new Map;#i=new Set;#a=new Set;#o=new Set;#s=new import_default_map.default(r=>new Set);#c;id;$model;title;folder;viewPath;constructor(r,i,a,o){this.$model=r,this.#e=a,this.id=a.id,this.folder=i,this.#c=o;for(let r of this.#e.nodes){let i=new NodeModel(this,Object.freeze(r));this.#n.set(r.id,i),r.parent||this.#t.add(i),r.deploymentRef&&this.#a.add(r.deploymentRef),r.modelRef&&this.#i.add(r.modelRef);for(let r of i.tags)this.#s.get(r).add(i)}for(let r of this.#e.edges){let i=new EdgeModel(this,Object.freeze(r),this.node(r.source),this.node(r.target));for(let r of i.tags)this.#s.get(r).add(i);for(let i of r.relations)this.#o.add(i);this.#r.set(r.id,i)}this.title=a.title?extractViewTitleFromPath(a.title):null,this.viewPath=a.title?normalizeViewPath(a.title):a.id}get $styles(){return this.$model.$styles}get _type(){return this.#e[_type]}get stage(){return this.#e[_stage]}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 memoizeProp(this,`breadcrumbs`,()=>this.folder.isRoot?[this]:[...this.folder.breadcrumbs,this])}get description(){return RichText.memoize(this,`description`,this.#e.description)}get tags(){return this.#e.tags??[]}get links(){return this.#e.links??[]}get viewOf(){if(this.isElementView()){let r=this.#e.viewOf;return r?this.$model.element(r):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 r=this.#c;return r?memoizeProp(this,`withDriftReasons`,()=>calcDriftsFromSnapshot(this.#e,r)):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 r=this.$manual;return!!r?.drifts&&r.drifts.length>0}get $manual(){if(!this.isLayouted())return null;let r=this.#c;return r?memoizeProp(this,`snapshotWithManualLayout`,()=>applyManualLayout(this.#e,r)):null}get projectId(){return this.$model.projectId}roots(){return this.#t.values()}*compounds(){for(let r of this.#n.values())r.hasChildren()&&(yield r)}node(r){let i=getId(r);return nonNullable(this.#n.get(i),`Node ${i} not found in view ${this.#e.id}`)}findNode(r){return this.#n.get(getId(r))??null}findNodeWithElement(r){let i=getId(r);return this.#i.has(i)?ifind(this.#n.values(),r=>r.hasElement()&&r.element.id===i)??null:null}nodes(){return this.#n.values()}edge(r){let i=getId(r);return nonNullable(this.#r.get(i),`Edge ${i} not found in view ${this.#e.id}`)}findEdge(r){return this.#r.get(getId(r))??null}edges(){return this.#r.values()}*edgesWithRelation(r){for(let i of this.#r.values())i.includesRelation(r)&&(yield i)}*elements(){for(let r of this.#n.values())r.hasElement()&&(yield r)}isTagged(r){return this.tags.includes(r)}includesElement(r){return this.#i.has(getId(r))}includesDeployment(r){return this.#a.has(getId(r))}includesRelation(r){return this.#o.has(getId(r))}isComputed(){return this.#e[_stage]===`computed`}isLayouted(){return this.#e[_stage]===`layouted`}isDiagram(){return this.#e[_stage]===`layouted`}isElementView(){return this.#e[_type]===`element`}isScopedElementView(){return this.#e[_type]===`element`&&e(this.#e.viewOf)}isDeploymentView(){return this.#e[_type]===`deployment`}isDynamicView(){return this.#e[_type]===`dynamic`}},LikeC4ViewsFolder=class r{$model;path;title;isRoot;parentPath;defaultViewId;constructor(r,i,o){this.$model=r,this.path=i.join(`/`),this.isRoot=this.path===``,this.title=t$3(i),this.isRoot?this.parentPath=void 0:this.parentPath=i.slice(0,-1).join(`/`),this.defaultViewId=o}get defaultView(){return this.defaultViewId?this.$model.view(this.defaultViewId):null}get breadcrumbs(){return invariant(!this.isRoot,`Root view folder has no breadcrumbs`),memoizeProp(this,`breadcrumbs`,()=>{let r=this.parent;return r?r.isRoot?[r,this]:[...r.breadcrumbs,this]:[this]})}get parent(){return invariant(!this.isRoot,`Root view folder has no parent`),e$2(this.parentPath)?null:this.$model.viewFolder(this.parentPath)}get children(){return this.$model.viewFolderItems(this.path)}get folders(){return memoizeProp(this,`folders`,()=>{let i=[];for(let a of this.children)a instanceof r&&i.push(a);return i})}get views(){return memoizeProp(this,`views`,()=>{let r=[];for(let i of this.children)i instanceof LikeC4ViewModel&&r.push(i);return r})}},LikeC4Model=class r{Aux;_elements=new Map;_parents=new Map;_children=new import_default_map.default(()=>new Set);_rootElements=new Set;_relations=new Map;_incoming=new import_default_map.default(()=>new Set);_outgoing=new import_default_map.default(()=>new Set);_internal=new import_default_map.default(()=>new Set);_views=new Map;_rootViewFolder;_viewFolders=new Map;_viewFolderItems=new import_default_map.default(()=>new Set);_allTags=new import_default_map.default(()=>new Set);static fromParsed(i){return new r(i)}static create(i){return new r(i)}static fromDump(i){let{_stage:a=`layouted`,projectId:o=`unknown`,project:s,globals:c,imports:l,deployments:u,views:d,relations:f,elements:p,specification:m}=i;return new r({[_stage]:a,projectId:o,project:s,globals:{predicates:c?.predicates??{},dynamicPredicates:c?.dynamicPredicates??{},styles:c?.styles??{}},imports:l??{},deployments:{elements:u?.elements??{},relations:u?.relations??{}},views:d??{},relations:f??{},elements:p??{},specification:m})}deployment;$data;constructor(r){this.$data=r;for(let[,i]of t$4(r.elements)){let r=this.addElement(i);for(let i of r.tags)this._allTags.get(i).add(r)}for(let[i,a]of t$4(r.imports??{}))for(let r of sortParentsFirst(a)){let a=this.addImportedElement(i,r);for(let r of a.tags)this._allTags.get(r).add(a)}for(let i of t$2(r.relations)){let r=this.addRelation(i);for(let i of r.tags)this._allTags.get(i).add(r)}if(this.deployment=new LikeC4DeploymentModel(this),isOnStage(r,`computed`)||isOnStage(r,`layouted`)){let i=compareNaturalHierarchically(`/`),a=t$5(t$2(r.views),t$6(r=>({view:r,path:normalizeViewPath(r.title??r.id),folderPath:r.title&&getViewFolderPath(r.title)||``})),t$7((r,a)=>i(r.folderPath,a.folderPath))),o=r=>{let i=this._viewFolders.get(r);if(!i){let o=e$3(r,`/`);invariant(t$1(o,1),`View group path "${r}" must have at least one element`);let s;s=r===``?a.find(r=>r.view.id===`index`):a.find(i=>i.path===r),i=new LikeC4ViewsFolder(this,o,s?.view.id),this._viewFolders.set(r,i)}return i};this._rootViewFolder=o(``);for(let{folderPath:r}of a)this._viewFolders.has(r)||e$3(r,`/`).reduce((r,i)=>{let a=r.join(`/`),c=o(e$1(a)?i:a+`/`+i);return this._viewFolderItems.get(a).add(c),r.push(i),r},[]);for(let{view:i,folderPath:s}of a){let a=new LikeC4ViewModel(this,o(s),i,r.manualLayouts?.[i.id]);this._viewFolderItems.get(s).add(a),this._views.set(i.id,a);for(let r of a.tags)this._allTags.get(r).add(a)}}else this._rootViewFolder=new LikeC4ViewsFolder(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 memoizeProp(this,`styles`,()=>LikeC4Styles.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[_stage]}get projectId(){return this.$data.projectId??`default`}get project(){return this.$data.project??memoizeProp(this,Symbol.for(`project`),()=>({id:this.projectId,styles:{},manualLayouts:{}}))}get specification(){return this.$data.specification}get globals(){return memoizeProp(this,Symbol.for(`globals`),()=>({predicates:{...this.$data.globals?.predicates},dynamicPredicates:{...this.$data.globals?.dynamicPredicates},styles:{...this.$data.globals?.styles}}))}element(r){if(r instanceof ElementModel)return r;let i=getId(r);return nonNullable(this._elements.get(i),`Element ${i} not found`)}findElement(r){return this._elements.get(getId(r))??null}roots(){return this._rootElements.values()}elements(){return this._elements.values()}relationships(){return this._relations.values()}relationship(r,i){if(i===`deployment`)return this.deployment.relationship(r);let a=getId(r),o=this._relations.get(a)??null;return o||i===`model`?nonNullable(o,`Model relation ${a} not found`):nonNullable(this.deployment.findRelationship(a),`No model/deployment relation ${a} not found`)}findRelationship(r,i){if(i===`deployment`)return this.deployment.findRelationship(r);let a=this._relations.get(getId(r))??null;return a||i===`model`?a:this.deployment.findRelationship(r)}views(){return this._views.values()}view(r){let i=getId(r);return nonNullable(this._views.get(i),`View ${i} not found`)}findView(r){return this._views.get(r)??null}findManualLayout(r){return`manualLayouts`in this.$data?this.$data.manualLayouts?.[r]??null:null}viewFolder(r){return nonNullable(this._viewFolders.get(r),`View folder ${r} not found`)}get rootViewFolder(){return this._rootViewFolder}get hasViewFolders(){return this._viewFolders.size>1}viewFolderItems(r){return invariant(this._viewFolders.has(r),`View folder ${r} not found`),this._viewFolderItems.get(r)}parent(r){let i=getId(r);return this._parents.get(i)||null}children(r){let i=getId(r);return this._children.get(i)}*siblings(r){let i=getId(r),a=this._parents.get(i),o=a?this._children.get(a.id).values():this.roots();for(let r of o)r.id!==i&&(yield r)}*ancestors(r){let i=getId(r),a;for(;a=this._parents.get(i);)yield a,i=a.id}*descendants(r){for(let i of this.children(r))yield i,yield*this.descendants(i.id)}*incoming(r,i=`all`){let a=getId(r);for(let r of this._incoming.get(a))switch(!0){case i===`all`:case i===`direct`&&r.target.id===a:case i===`to-descendants`&&r.target.id!==a:yield r;break}}*outgoing(r,i=`all`){let a=getId(r);for(let r of this._outgoing.get(a))switch(!0){case i===`all`:case i===`direct`&&r.source.id===a:case i===`from-descendants`&&r.source.id!==a:yield r;break}}get tags(){return memoizeProp(this,`tags`,()=>t$7([...this._allTags.keys()],compareNatural))}get tagsSortedByUsage(){return memoizeProp(this,`tagsSortedByUsage`,()=>t$5([...this._allTags.entries()],t$6(([r,i])=>({tag:r,count:i.size,tagged:i})),t$7((r,i)=>compareNatural(r.tag,i.tag)),t$8([e$4(`count`),`desc`])))}findByTag(r,i){return ifilter(this._allTags.get(r),r=>i===`elements`?r instanceof ElementModel:i===`views`?r instanceof LikeC4ViewModel:i===`relationships`?r instanceof RelationshipModel:!0)}*elementsOfKind(r){for(let i of this._elements.values())i.kind===r&&(yield i)}*elementsWhere(r){let i=whereOperatorAsPredicate(r);for(let r of this._elements.values())i(r)&&(yield r)}*relationshipsWhere(r){let i=whereOperatorAsPredicate(r);for(let r of this._relations.values())i(r)&&(yield r)}addElement(r){if(this._elements.has(r.id))throw Error(`Element ${r.id} already exists`);let i=new ElementModel(this,Object.freeze(r));this._elements.set(i.id,i);let a=parentFqn(i.id);return a?(invariant(this._elements.has(a),`Parent ${a} of ${i.id} not found`),this._parents.set(i.id,this.element(a)),this._children.get(a).add(i)):this._rootElements.add(i),i}addImportedElement(r,i){invariant(!isGlobalFqn(i.id),`Imported element already has global FQN`);let a=GlobalFqn(r,i.id);if(this._elements.has(a))throw Error(`Element ${a} already exists`);let o=new ElementModel(this,Object.freeze({...i,id:a}));this._elements.set(o.id,o);let s=parentFqn(o.id);for(;s;){if(s.includes(`.`)&&this._elements.has(s))return this._parents.set(o.id,this.element(s)),this._children.get(s).add(o),o;s=parentFqn(s)}return this._rootElements.add(o),o}addRelation(r){if(this._relations.has(r.id))throw Error(`Relation ${r.id} already exists`);let i=new RelationshipModel(this,Object.freeze(r)),{source:a,target:o}=i;this._relations.set(i.id,i),this._incoming.get(o.id).add(i),this._outgoing.get(a.id).add(i);let s=commonAncestor(a.id,o.id);if(s)for(let r of[s,...ancestorsFqn(s)])this._internal.get(r).add(i);for(let r of ancestorsFqn(a.id)){if(r===s)break;this._outgoing.get(r).add(i)}for(let r of ancestorsFqn(o.id)){if(r===s)break;this._incoming.get(r).add(i)}return i}};(function(r){r.EMPTY=LikeC4Model.create({_stage:`computed`,projectId:`default`,project:{id:`default`},specification:{elements:{},relationships:{},deployments:{},tags:{}},globals:{predicates:{},dynamicPredicates:{},styles:{}},deployments:{elements:{},relations:{}},elements:{},relations:{},views:{},imports:{}})})(LikeC4Model||={});let Connection;(function(r){r.isInside=r=>i=>isAncestor(r,i.source.id)&&isAncestor(r,i.target.id);let i=r.isDirectedBetween=(r,i)=>a=>(a.source.id===r||isAncestor(r,a.source.id))&&(a.target.id===i||isAncestor(i,a.target.id));r.isAnyBetween=(r,a)=>{let o=i(r,a),s=i(a,r);return r=>o(r)||s(r)};let a=r.isIncoming=r=>i=>(i.target.id===r||isAncestor(r,i.target.id))&&!isAncestor(r,i.source.id),o=r.isOutgoing=r=>i=>(i.source.id===r||isAncestor(r,i.source.id))&&!isAncestor(r,i.target.id);r.isAnyInOut=r=>{let i=a(r),s=o(r);return r=>i(r)||s(r)}})(Connection||={});const customInspectSymbol=Symbol.for(`nodejs.util.inspect.custom`);var DeploymentConnectionModel=class r{id;constructor(r,i,a){this.source=r,this.target=i,this.relations=a,this.id=stringHash(`deployment:${r.id}:${i.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}[customInspectSymbol](i,a,o){let s=this.toString();return Object.defineProperty(s,`constructor`,{value:r,enumerable:!1}),s}toString(){let r=[...this.relations.model].map(r=>` `+r.expression);r.length?r.unshift(` model:`):r.unshift(` model: []`);let i=[...this.relations.deployment].map(r=>` `+r.expression);return i.length?i.unshift(` deployment:`):i.unshift(` deployment: []`),[this.expression,...r,...i].join(`
3
- `)}hasDirectDeploymentRelation(){for(let r of this.relations.deployment)if(r.source.id===this.source.id||r.target.id===this.target.id)return!0;return!1}*values(){yield*this.relations.model,yield*this.relations.deployment}mergeWith(i){return Array.isArray(i)?i.reduce((r,i)=>r.mergeWith(i),this):(invariant(this.source.id===i.source.id,`Cannot merge connections with different sources`),invariant(this.target.id===i.target.id,`Cannot merge connections with different targets`),new r(this.source,this.target,this.relations.union(i.relations)))}difference(i){return new r(this.source,this.target,this.relations.difference(i.relations))}intersect(i){return new r(this.source,this.target,this.relations.intersect(i.relations))}equals(i){return invariant(i instanceof r,`Other should ne DeploymentConnectionModel`),this.id===i.id&&this.source.id===i.source.id&&this.target.id===i.target.id&&equals(this.relations.model,i.relations.model)&&equals(this.relations.deployment,i.relations.deployment)}update(i){return i&&={model:this.relations.model,deployment:this.relations.deployment,...i},new r(this.source,this.target,i?new RelationshipsAccum(i.model??new Set,i.deployment??new Set):this.relations)}};function isNestedConnection(r,i){if(!i){let i=r;return r=>isNestedConnection(r,i)}let a=r.source===i.source,o=r.target===i.target;if(a&&o)return!1;let s=isAncestor(i.source.id,r.source.id),c=isAncestor(i.target.id,r.target.id);return s&&c||a&&c||o&&s}function findDeepestNestedConnection(r,i){let a=i;for(let i of r)isNestedConnection(i,a)&&(a=i);return a===i?null:a}function sortDeepestFirst(r){let i=[],a=r.slice(),o;for(;o=a.shift();){let r;for(;r=findDeepestNestedConnection(a,o);){let o=a.indexOf(r);i.push(a.splice(o,1)[0])}i.push(o)}return i}function boundaryHierarchy(r){return r.boundary?.id?`.${r.boundary.id}`:``}function sortConnectionsByBoundaryHierarchy(r,i){if(!r||isString(r)){let i=r??`asc`;return r=>_sortByBoundary(r,i)}return _sortByBoundary(r,i??`asc`)}function _sortByBoundary(r,i){return t$5(r,t$6(r=>({id:boundaryHierarchy(r),conn:r})),sortNaturalByFqn(i),t$6(r=>r.conn))}function findAscendingConnections(r,i){return r.filter(r=>isNestedConnection(i,r))}function findDescendantConnections(r,i){return r.filter(isNestedConnection(i))}function mergeConnections(r){let i=new Map;for(let a of r){let r=i.get(a.id);r?i.set(a.id,a.mergeWith(r)):i.set(a.id,a)}return[...i.values()]}function differenceConnections(r,i){let a=new Map([...i].map(r=>[r.id,r]));return[...r].reduce((r,i)=>{let o=a.get(i.id);if(!o)return r.push(i),r;let s=i.difference(o);return s.nonEmpty()&&r.push(s),r},[])}function hasSameSourceTarget(r,i){return i?r.source===i.source&&r.target===i.target:i=>r.source===i.source&&r.target===i.target}function hasSameSource(r,i){return i?r.source===i.source:i=>r.source===i.source}function hasSameTarget(r,i){return i?r.target===i.target:i=>r.target===i.target}function isOutgoing(r,i){if(!i){let i=r;return r=>isOutgoing(r,i)}let a=r;return isDescendantOf(a.source,i)&&!isDescendantOf(a.target,i)}function isIncoming(r,i){if(!i){let i=r;return r=>isIncoming(r,i)}let a=r;return isDescendantOf(a.target,i)&&!isDescendantOf(a.source,i)}function isAnyInOut(r,i){if(!i){let i=r;return r=>isAnyInOut(r,i)}let a=r;return isDescendantOf(a.source,i)!==isDescendantOf(a.target,i)}var ConnectionModel=class r{id;constructor(r,i,a=new Set){this.source=r,this.target=i,this.relations=a,this.id=stringHash(`model:${r.id}:${i.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()&&isome(this.relations,e$5(hasSameSourceTarget(this)))}get directRelations(){return new Set(ifilter(this.relations,hasSameSourceTarget(this)))}nonEmpty(){return this.relations.size>0}mergeWith(i){return invariant(this.source.id===i.source.id,`Cannot merge connections with different sources`),invariant(this.target.id===i.target.id,`Cannot merge connections with different targets`),new r(this.source,this.target,union(this.relations,i.relations))}difference(i){return new r(this.source,this.target,difference(this.relations,i.relations))}intersect(i){return invariant(i instanceof r,`Cannot intersect connection with different type`),new r(this.source,this.target,intersection(this.relations,i.relations))}equals(i){invariant(i instanceof r,`Cannot merge connection with different type`);let a=i;return this.id===a.id&&this.source.id===a.source.id&&this.target.id===a.target.id&&equals(this.relations,a.relations)}update(i){return new r(this.source,this.target,i)}[customInspectSymbol](i,a,o){let s=this.toString();return Object.defineProperty(s,`constructor`,{value:r,enumerable:!1}),s}toString(){return[this.expression,this.relations.size?` relations:`:` relations: [ ]`,...[...this.relations].map(r=>` `+r.expression)].join(`
4
- `)}reversed(){return new r(this.target,this.source)}},find_exports$1=__exportAll({findConnection:()=>findConnection$1,findConnectionsBetween:()=>findConnectionsBetween$1,findConnectionsWithin:()=>findConnectionsWithin$1});function findConnection$1(r,i,a=`directed`){if(r===i||isSameHierarchy(r,i))return[];let o=r.allOutgoing.intersect(i.allIncoming),s=o.nonEmpty?[new DeploymentConnectionModel(r,i,o)]:[];return a===`directed`?s:[...s,...findConnection$1(i,r,`directed`)]}function findConnectionsBetween$1(r,i,a=`both`){if(r.allIncoming.isEmpty&&r.allOutgoing.isEmpty)return[];let o=[],s=[];for(let c of i)if(r!==c)for(let i of findConnection$1(r,c,a))i.source===r?o.push(i):s.push(i);return[...o,...s]}function findConnectionsWithin$1(r){return[...r].reduce((r,i,a,o)=>(a===o.length-1||r.push(...findConnectionsBetween$1(i,o.slice(a+1),`both`)),r),[])}var find_exports=__exportAll({findConnection:()=>findConnection,findConnectionsBetween:()=>findConnectionsBetween,findConnectionsWithin:()=>findConnectionsWithin});function findConnection(r,i,a=`directed`){if(r===i||isSameHierarchy(r,i))return[];let o=intersection(r.allOutgoing,i.allIncoming),s=o.size>0?new ConnectionModel(r,i,o):null;if(a===`directed`)return s?[s]:[];let c=intersection(r.allIncoming,i.allOutgoing),l=c.size>0?new ConnectionModel(i,r,c):null;return s&&l?[s,l]:s?[s]:l?[l]:[]}function findConnectionsBetween(r,i,a=`both`){if(r.allIncoming.size===0&&r.allOutgoing.size===0)return[];let o=[],s=[];for(let c of i)if(r!==c)for(let i of findConnection(r,c,a))i.source===r?o.push(i):s.push(i);return[...o,...s]}function findConnectionsWithin(r){return[...r].reduce((r,i,a,o)=>(a===o.length-1||r.push(...findConnectionsBetween(i,o.slice(a+1),`both`)),r),[])}function isDeploymentNodeModel(r){return r instanceof DeploymentNodeModel}function isDeployedInstanceModel(r){return r instanceof DeployedInstanceModel}function isDeploymentElementModel(r){return isDeploymentNodeModel(r)||isDeployedInstanceModel(r)}function isNestedElementOfDeployedInstanceModel(r){return r instanceof NestedElementOfDeployedInstanceModel}function isDeploymentRelationModel(r){return r instanceof DeploymentRelationModel}function isRelationModel(r){return r instanceof RelationshipModel}function isElementModel(r){return r instanceof ElementModel}function isLikeC4ViewModel(r){return r instanceof LikeC4ViewModel}function isNodeModel(r){return r instanceof NodeModel}function isEdgeModel(r){return r instanceof EdgeModel}export{DeploymentConnectionModel as A,VIEW_FOLDERS_SEPARATOR as B,isAnyInOut as C,mergeConnections as D,isOutgoing as E,LikeC4ViewModel as F,DeploymentNodeModel as G,getViewFolderPath as H,NodeModel as I,ElementModel as J,DeploymentRelationModel as K,EdgeModel as L,Connection as M,LikeC4Model as N,sortConnectionsByBoundaryHierarchy as O,LikeC4ViewsFolder as P,RelationshipModel as R,hasSameTarget as S,isNestedConnection as T,normalizeViewPath as U,extractViewTitleFromPath as V,DeployedInstanceModel as W,findAscendingConnections as _,isEdgeModel as a,hasSameSource as b,isNestedElementOfDeployedInstanceModel as c,findConnection as d,findConnectionsBetween as f,differenceConnections as g,ConnectionModel as h,isDeploymentRelationModel as i,customInspectSymbol as j,sortDeepestFirst as k,isNodeModel as l,find_exports$1 as m,isDeploymentElementModel as n,isElementModel as o,find_exports as p,RelationshipsAccum as q,isDeploymentNodeModel as r,isLikeC4ViewModel as s,isDeployedInstanceModel as t,isRelationModel as u,findDeepestNestedConnection as v,isIncoming as w,hasSameSourceTarget as x,findDescendantConnections as y,LikeC4DeploymentModel as z};
@@ -1 +0,0 @@
1
- import{r as __toESM}from"./rolldown-runtime.mjs";import{t as defu}from"./libs/defu.mjs";import{F as e$1,P as e$4,Q as t$5,R as e$2,T as t$3,a as t$2,et as t,f as e$3,k as e,l as t$4,t as t$1}from"./libs/remeda.mjs";import{s as import_set}from"./libs/mnemonist.mjs";import{t as require_natural_compare_lite}from"./libs/natural-compare-lite.mjs";import{t as hash}from"./libs/ohash.mjs";import{n as defaultSchema}from"./libs/hast-util-sanitize.mjs";import{t as rehypeSanitize}from"./libs/rehype-sanitize.mjs";import{t as rehypeStringify}from"./libs/rehype-stringify.mjs";import{c as toString,t as fromMarkdown}from"./libs/mdast-util-from-markdown.mjs";import{t as remarkGfm}from"./libs/remark-gfm.mjs";import{t as remarkAlert}from"./libs/remark-github-blockquote-alert.mjs";import{t as remarkParse}from"./libs/remark-parse.mjs";import{t as remarkRehype}from"./libs/remark-rehype.mjs";import{t as unified}from"./libs/unified.mjs";function nonNullable(n,r){if(n===void 0||n==null){let i=typeof r==`function`?r():r;throw Error(i??`Expected defined value, but received ${n}`)}return n}function invariant(n,r){if(!n)throw Error(r??`Invariant failed`)}function nonexhaustive(n){throw Error(`NonExhaustive value: ${n}`)}function commonHead(n,r,i){return n.length===0||r.length===0?[]:(i??=Object.is,t(t$1(n,r),t$2(([n,r])=>i(n,r)),t$3(([n,r])=>n)))}var import_natural_compare_lite=__toESM(require_natural_compare_lite(),1);function compareNatural(n,r){return n===r?0:e(n)?e(r)?(0,import_natural_compare_lite.default)(n,r):1:e(r)?-1:0}function _sortNatural(n){return t$4(n,compareNatural)}function sortNatural(...n){return n.length===0?_sortNatural:_sortNatural(n[0])}function compareNaturalHierarchically(n=`.`,r=!1){return(i,a)=>{if(i===a)return 0;if(!i)return-1;if(!a)return 1;let o=i.split(n),s=a.split(n),c=Math.min(o.length,s.length);for(let n=0;n<c;n++){let r=o[n],i=s[n],a=(0,import_natural_compare_lite.default)(r,i);if(a!==0)return a}let l=o.length-s.length;return r?-1*l:l}}function isString(n){return n!=null&&typeof n==`string`}function isNonEmptyArray(n){return!!n&&Array.isArray(n)&&n.length>0}function hasProp(n,r){return n[r]!=null}function isAnyOf(...n){return(r=>n.some(n=>n(r)))}function parentFqn(n){let r=n.lastIndexOf(`.`);return r>0?n.slice(0,r):null}function nameFromFqn(n){let r=n.lastIndexOf(`.`);return r>0?n.slice(r+1):n}const asString=n=>isString(n)?n:n.id;function isAncestor(n,r){let i=asString(n);return r?asString(r).startsWith(i+`.`):n=>{let r=asString(n);return i.startsWith(r+`.`)}}function isSameHierarchy(n,r){if(!r)return r=>isSameHierarchy(n,r);let i=asString(n),a=asString(r);return i===a||a.startsWith(i+`.`)||i.startsWith(a+`.`)}function isDescendantOf(n,r){return r?isAncestor(r,n):r=>isAncestor(n,r)}function hierarchyLevel(n){return(isString(n)?n:n.id).split(`.`).length}function hierarchyDistance(n,r){let i=isString(n)?n:n.id,a=isString(r)?r:r.id;if(i===a)return 0;let o=hierarchyLevel(i),s=hierarchyLevel(a);if(isSameHierarchy(i,a))return Math.abs(o-s);let c=commonAncestor(i,a),l=c?hierarchyLevel(c):0;return o+s-(2*l+1)}function commonAncestor(n,r){let i=n.split(`.`);if(i.length<2)return null;let a=r.split(`.`);if(a.length<2)return null;let o=[];for(let n=0;n<Math.min(i.length,a.length)-1&&i[n]===a[n];n++)o.push(i[n]);return o.length===0?null:o.join(`.`)}function ancestorsFqn(n){let r=n.split(`.`);if(r.pop(),!t$5(r,2))return r;for(let n=1;n<r.length;n++)r[n]=r[n-1]+`.`+r[n];return r.reverse()}function compareFqnHierarchically(n,r){let i=n.split(`.`).length,a=r.split(`.`).length;switch(!0){case i>a:return 1;case i<a:return-1;default:return 0}}function compareByFqnHierarchically(n,r){return compareFqnHierarchically(n.id,r.id)}function sortByFqnHierarchically(n){return n.map(n=>({item:n,fqn:n.id.split(`.`)})).sort((n,r)=>n.fqn.length-r.fqn.length).map(({item:n})=>n)}function findTopAncestor(n,r){let i=r;for(let r of n)r!==i&&isAncestor(r,i)&&(i=r);return i===r?null:i}function sortParentsFirst(n){let r=[],i=[...n],a;for(;a=i.shift();){let n;for(;n=findTopAncestor(i,a);)r.push(...i.splice(i.indexOf(n),1));r.push(a)}return r}function sortNaturalByFqn(n,r){if(!n||isString(n)){let r=n??`asc`;return n=>sortNaturalByFqn(n,r)}let i=r===`desc`?-1:1;return n.map(n=>({item:n,fqn:n.id.split(`.`)})).sort((n,r)=>{if(n.fqn.length!==r.fqn.length)return(n.fqn.length-r.fqn.length)*i;for(let i=0;i<n.fqn.length;i++){let a=compareNatural(n.fqn[i],r.fqn[i]);if(a!==0)return a}return 0}).map(({item:n})=>n)}function getOrCreate(n,r,i){let a=n.get(r);return a||(a=i(r),n.set(r,a)),a}function isIterable(n){return typeof n==`object`&&!!n&&Symbol.iterator in n}function ifilter(n,r){let a=r??n;invariant(e$1(a));function*o(n){for(let r of n)a(r)&&(yield r)}return r?o(n):o}function ifind(n,r){let a=r??n;invariant(e$1(a));function o(n){for(let r of n)if(a(r))return r}return r?o(n):o}function ifirst(n,r){let i=r??n;invariant(typeof i==`number`&&i>=0,`Count must be a non-negative number`);function*a(n){let r=0;for(let a of n){if(r>=i)break;yield a,r++}}return r===void 0?n=>a(n):a(n)}function iflat(n){return n?_iflat(n):_iflat}function*_iflat(n){for(let r of n)yield*r}function iflatMap(n,r){let a=r??n;invariant(e$1(a));function*o(n){for(let r of n)yield*a(r)}return r?o(n):o}function ihead(n){return n?_head(n):_head}function _head(n){let{value:r}=n[Symbol.iterator]().next();return r}function imap(n,r){let a=r??n;invariant(e$1(a));function*o(n){for(let r of n)yield a(r)}return r?o(n):o}function ireduce(n,r,a){let o=e$2(a)?r:n,c=a??r;invariant(e$1(o));function l(n){let r=c;for(let i of n)r=o(r,i);return r}return e$2(a)?l(n):l}function isome(n,r){let a=r??n;invariant(e$1(a));function o(n){for(let r of n)if(a(r))return!0;return!1}return r?o(n):o}function toArray(n){return n?Array.from(n):n=>Array.from(n)}function toSet(n){return n?new Set(n):n=>new Set(n)}function iunique(n){return n?_iunique(n):_iunique}function*_iunique(n){let r=new Set;for(let i of n)r.has(i)||(r.add(i),yield i)}function memoizeProp(n,r,i){let a=typeof r==`symbol`?r:Symbol.for(r);return n.hasOwnProperty(a)||Object.defineProperty(n,a,{enumerable:!1,writable:!1,value:i()}),n[a]}function delay(...n){let r=100;return n.length===2?r=e$3(n[0],n[1]):n.length===1&&(r=n[0]),new Promise(n=>{setTimeout(()=>{n(`LIKEC4_DELAY`)},r??100)})}function promiseNextTick(){return Promise.resolve().then(()=>void 0)}function onNextTick(n){Promise.resolve().then(n)}const compareRelations=(n,r)=>{let i=commonAncestor(n.source.id,n.target.id),a=commonAncestor(r.source.id,r.target.id);if(i&&!a)return 1;if(!i&&a)return-1;let o=i&&a?compareFqnHierarchically(i,a):0;if(o!==0)return o;let s=compareFqnHierarchically(n.source.id,r.source.id);return s===0?compareFqnHierarchically(n.target.id,r.target.id):s};function union(...n){let r=new Set;for(let i of n)for(let n of i)r.add(n);return r}function intersection(n,...r){let i=new Set;if(n.size===0)return i;let a=t$5(r,2)?(0,import_set.intersection)(...r):r[0];if(a.size===0)return i;for(let r of n)a.has(r)&&i.add(r);return i}function difference(n,r){if(n.size===0)return new Set;if(r.size===0)return new Set(n);let i=new Set;for(let a of n)r.has(a)||i.add(a);return i}function equals(n,r){return n.size===r.size&&[...n].every(n=>r.has(n))}function symmetricDifference(n,r){return(0,import_set.symmetricDifference)(n,r)}function hasIntersection(n,r){if(n.size===0||r.size===0)return!1;r.size<n.size&&([n,r]=[r,n]);for(let i of n)if(r.has(i))return!0;return!1}function objectHash(n){return invariant(typeof n==`object`&&e$4(n),`objectHash: value must be an object`),hash(n)}function stringHash(n){let r=5381,i=n.length;invariant(i>0,`stringHash: empty string`);for(let a=0;a<i;a++)r=r*33^n.charCodeAt(a);return(r>>>0).toString(36)}function parser(){return unified().use(remarkParse).use(remarkGfm).use(remarkAlert).use(remarkRehype,{allowDangerousHtml:!0}).use(rehypeSanitize,defu({attributes:{"*":[`className`],svg:[`width`,`height`,`viewBox`,`fill`,`ariaHidden`],path:[`d`,`fill`,`stroke`,`strokeWidth`,`strokeLinecap`,`strokeLinejoin`]},tagNames:[`svg`,`g`,`path`,`div`]},defaultSchema)).use(rehypeStringify,{allowDangerousHtml:!0})}function markdownToHtml(n){return(``+parser().processSync(n)).trim()}function markdownToText(n){return toString(fromMarkdown(n),{includeHtml:!1,includeImageAlt:!1})}export{nonNullable as $,ancestorsFqn as A,parentFqn as B,iflatMap as C,ifilter as D,ifind as E,hierarchyLevel as F,isAnyOf as G,sortNaturalByFqn as H,isAncestor as I,compareNatural as J,isNonEmptyArray as K,isDescendantOf as L,compareByFqnHierarchically as M,compareFqnHierarchically as N,isIterable as O,hierarchyDistance as P,invariant as Q,isSameHierarchy as R,ihead as S,ifirst as T,sortParentsFirst as U,sortByFqnHierarchically as V,hasProp as W,sortNatural as X,compareNaturalHierarchically as Y,commonHead as Z,toArray as _,difference as a,ireduce as b,intersection as c,compareRelations as d,nonexhaustive as et,delay as f,iunique as g,memoizeProp as h,objectHash as i,commonAncestor as j,getOrCreate as k,symmetricDifference as l,promiseNextTick as m,markdownToHtml as n,equals as o,onNextTick as p,isString as q,stringHash as r,hasIntersection as s,markdownToText as t,union as u,toSet as v,iflat as w,imap as x,isome as y,nameFromFqn as z};
@@ -1 +0,0 @@
1
- import{Q as t}from"./libs/remeda.mjs";import{Q as invariant}from"./to-text.mjs";function isPoint(e){return Array.isArray(e)&&e.length===2&&typeof e[0]==`number`&&typeof e[1]==`number`}function convertPoint(e){return isPoint(e)?{x:e[0],y:e[1]}:[e.x,e.y]}const BBox={center({x:e,y:n,width:r,height:i}){return{x:e+r/2,y:n+i/2}},toPoints({x:e,y:n,width:r,height:i}){return[{x:e,y:n},{x:e+r,y:n},{x:e+r,y:n+i},{x:e,y:n+i}]},fromPoints(e){let{x1:n,y1:r,x2:i,y2:a}=RectBox.fromPoints(e);return{x:n,y:r,width:i-n,height:a-r}},merge(...r){if(invariant(t(r,1),`No boxes provided`),r.length===1)return r[0];let i=r[0].x,a=r[0].y,o=r[0].x+r[0].width,s=r[0].y+r[0].height;for(let e=1;e<r.length;e++){let n=r[e];i=Math.min(i,n.x),a=Math.min(a,n.y),o=Math.max(o,n.x+n.width),s=Math.max(s,n.y+n.height)}return{x:Math.floor(i),y:Math.floor(a),width:Math.round(o-i),height:Math.round(s-a)}},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,n){return n===0?e:{x:e.x-n,y:e.y-n,width:e.width+n*2,height:e.height+n*2}},shrink(e,n){return n===0?e:{x:e.x+n,y:e.y+n,width:e.width-n*2,height:e.height-n*2}},includes(e,n){return e===n?!0:e.x<=n.x&&e.y<=n.y&&e.x+e.width>=n.x+n.width&&e.y+e.height>=n.y+n.height}},RectBox={center({x1:e,y1:n,x2:r,y2:i}){return{x:(e+r)/2,y:(n+i)/2}},fromPoints(e){invariant(e.length>0,`At least one point is required`);let r=1/0,i=1/0,a=-1/0,o=-1/0;for(let[n,s]of e)r=Math.min(r,n),i=Math.min(i,s),a=Math.max(a,n),o=Math.max(o,s);return{x1:r,y1:i,x2:a,y2:o}},merge(...e){invariant(e.length>0,`No boxes provided`);let r=1/0,i=1/0,a=-1/0,o=-1/0;for(let n of e)r=Math.min(r,n.x1),i=Math.min(i,n.y1),a=Math.max(a,n.x2),o=Math.max(o,n.y2);return{x1:r,y1:i,x2:a,y2:o}},toBBox(e){return{x:e.x1,y:e.y1,width:e.x2-e.x1,height:e.y2-e.y1}},includes(e,n){return e===n?!0:e.x1<=n.x1&&e.y1<=n.y1&&e.x2>=n.x2&&e.y2>=n.y2}};var Vector=class e{constructor(e,r){this.x=e,this.y=r,invariant(typeof e==`number`&&!isNaN(e)&&isFinite(e)&&typeof r==`number`&&!isNaN(r)&&isFinite(r),`Invalid arguments for Vector: (${e}, ${r})`)}static create(...n){return n.length===2?new e(n[0],n[1]):new e(n[0].x,n[0].y)}static add(e,n){return{x:e.x+n.x,y:e.y+n.y}}static subtract(e,n){return{x:e.x-n.x,y:e.y-n.y}}static multiply(e,n){return{x:e.x*n,y:e.y*n}}static divide(e,n){return{x:e.x/n,y:e.y/n}}static dot(e,n){return e.x*n.x+e.y*n.y}add(n){return new e(this.x+n.x,this.y+n.y)}subtract(n){return new e(this.x-n.x,this.y-n.y)}multiply(n){return new e(this.x*n,this.y*n)}divide(n){return new e(this.x/n,this.y/n)}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 n=this.length();return n===0?new e(0,0):new e(this.x/n,this.y/n)}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 vector(...e){return e.length===1&&e[0]instanceof Vector?e[0]:e.length===2?new Vector(e[0],e[1]):new Vector(e[0].x,e[0].y)}export{convertPoint as a,RectBox as i,vector as n,isPoint as o,BBox as r,Vector as t};
File without changes