@likec4/core 1.19.1 → 1.20.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 (91) hide show
  1. package/dist/builder/index.cjs +881 -0
  2. package/dist/builder/index.d.cts +503 -0
  3. package/dist/builder/index.d.mts +5 -4
  4. package/dist/builder/index.d.ts +5 -4
  5. package/dist/builder/{index.js → index.mjs} +14 -4
  6. package/dist/compute-view/index.cjs +86 -0
  7. package/dist/compute-view/index.d.cts +23 -0
  8. package/dist/compute-view/index.d.mts +3 -2
  9. package/dist/compute-view/index.d.ts +3 -2
  10. package/dist/compute-view/{index.js → index.mjs} +6 -5
  11. package/dist/index.cjs +4320 -0
  12. package/dist/index.d.cts +270 -0
  13. package/dist/index.d.mts +130 -4
  14. package/dist/index.d.ts +130 -4
  15. package/dist/{index.js → index.mjs} +512 -7
  16. package/dist/model/index.cjs +40 -0
  17. package/dist/model/index.d.cts +259 -0
  18. package/dist/model/index.d.mts +8 -3
  19. package/dist/model/index.d.ts +8 -3
  20. package/dist/model/index.mjs +1 -0
  21. package/dist/shared/core.B2QYWlYe.cjs +435 -0
  22. package/dist/shared/core.B72vUaNB.d.cts +850 -0
  23. package/dist/shared/core.BGus30EM.cjs +8027 -0
  24. package/dist/shared/core.BRuJ3Wzf.d.mts +12 -0
  25. package/dist/shared/{core.BZ9Msq7w.d.mts → core.BdbFkE_p.d.cts} +14 -4
  26. package/dist/shared/core.BvdNMbcA.d.cts +12 -0
  27. package/dist/shared/{object_hash.CE_oF3I3.js → core.BxvDITEI.mjs} +26 -389
  28. package/dist/shared/core.ByNgh-mC.d.cts +127 -0
  29. package/dist/shared/core.C9DCnJh8.cjs +908 -0
  30. package/dist/shared/{index.DafVOuVd.js → core.CqCTxzMY.mjs} +1111 -572
  31. package/dist/shared/core.D74xkKkG.d.cts +148 -0
  32. package/dist/shared/{core.C05RDLhi.d.ts → core.D_Gc58Gt.d.ts} +23 -5
  33. package/dist/shared/core.Damrzla-.d.ts +12 -0
  34. package/dist/shared/{core.CmYMqgha.d.mts → core.Dfzrh1VA.d.mts} +23 -5
  35. package/dist/shared/core.DsoCu540.cjs +26 -0
  36. package/dist/shared/{view.CyZrG8BJ.js → core.DunIMHRf.mjs} +27 -1
  37. package/dist/shared/{core.BIfgabEw.d.ts → core.ZWiGANIJ.d.ts} +14 -4
  38. package/dist/shared/core.gv1bMwCC.cjs +39 -0
  39. package/dist/shared/core.jy6z2iRn.d.mts +729 -0
  40. package/dist/shared/core.m3rCQAv6.mjs +37 -0
  41. package/dist/types/index.cjs +107 -0
  42. package/dist/types/index.d.cts +72 -0
  43. package/dist/types/index.d.mts +2 -2
  44. package/dist/types/index.d.ts +2 -2
  45. package/dist/types/{index.js → index.mjs} +1 -1
  46. package/dist/utils/index.cjs +95 -0
  47. package/dist/utils/index.d.cts +356 -0
  48. package/dist/utils/index.d.mts +1 -64
  49. package/dist/utils/index.d.ts +1 -64
  50. package/dist/utils/index.mjs +56 -0
  51. package/package.json +52 -26
  52. package/src/builder/Builder.view-common.ts +21 -1
  53. package/src/compute-view/deployment-view/__test__/fixture.ts +31 -3
  54. package/src/compute-view/deployment-view/_types.ts +2 -1
  55. package/src/compute-view/deployment-view/compute.ts +4 -36
  56. package/src/compute-view/deployment-view/predicates/index.ts +8 -0
  57. package/src/compute-view/deployment-view/predicates/relation-direct.ts +125 -99
  58. package/src/compute-view/deployment-view/predicates/relation-in-out.ts +16 -8
  59. package/src/compute-view/deployment-view/predicates/relation-incoming.ts +18 -12
  60. package/src/compute-view/deployment-view/predicates/relation-outgoing.ts +16 -9
  61. package/src/compute-view/deployment-view/predicates/relation-where.ts +18 -0
  62. package/src/compute-view/deployment-view/predicates/utils.ts +214 -0
  63. package/src/compute-view/element-view/__test__/fixture.ts +17 -4
  64. package/src/compute-view/element-view/compute.ts +3 -2
  65. package/src/compute-view/element-view/predicates.ts +520 -0
  66. package/src/compute-view/element-view/utils.ts +11 -7
  67. package/src/compute-view/index.ts +1 -0
  68. package/src/compute-view/relationships-view/_types.ts +16 -0
  69. package/src/compute-view/relationships-view/compute.ts +74 -0
  70. package/src/compute-view/relationships-view/layout.ts +357 -0
  71. package/src/compute-view/relationships-view/utils.ts +40 -0
  72. package/src/compute-view/utils/relationExpressionToPredicates.ts +11 -4
  73. package/src/index.ts +16 -0
  74. package/src/model/DeploymentElementModel.ts +18 -1
  75. package/src/model/ElementModel.ts +13 -0
  76. package/src/model/LikeC4Model.ts +2 -2
  77. package/src/model/RelationModel.ts +9 -0
  78. package/src/model/connection/deployment/DeploymentConnectionModel.ts +11 -1
  79. package/src/model/guards.ts +17 -1
  80. package/src/model/view/LikeC4ViewModel.ts +7 -1
  81. package/src/model/view/NodeModel.ts +5 -0
  82. package/src/types/deployments.ts +1 -0
  83. package/src/types/expression-v2.ts +12 -0
  84. package/src/types/index.ts +1 -0
  85. package/src/types/operators.ts +46 -6
  86. package/src/types/view.ts +2 -2
  87. package/src/utils/index.ts +0 -5
  88. package/src/utils/iterable/unique.ts +1 -7
  89. package/dist/model/index.js +0 -1
  90. package/dist/utils/index.js +0 -347
  91. /package/dist/shared/{chunk-RAAYCPUM.M-JWF7SS.js → core.M-JWF7SS.mjs} +0 -0
@@ -1,13 +1,610 @@
1
- import { O as x, P as s$1, Q as a$4, k as hierarchyLevel, o as isAncestor, f as commonAncestor, r as sortNaturalByFqn, m as m$3, c as commonHead, R as getDefaultExportFromCjs, S as requireForeach, T as requireIterator, U as u$7, N as objectHash, J as intersection, H as difference, L as union, M as stringHash, I as equals, x as isString, q as isDescendantOf, a as isSameHierarchy, C as isome, y as ifilter, B as isIterable, G as toSet, u as sortParentsFirst, F as toArray, D as DefaultMap, A as imap, i as i$9, V as d$6, p as parentFqn, W as n$5, g as compareByFqnHierarchically, w as isNonEmptyArray, d as compareNatural, n as nameFromFqn, t as t$6, l as l$7, X as hasIntersection, s as sortByFqnHierarchically, e as ancestorsFqn, E as iunique, z as iflat, v as getOrCreate } from './object_hash.CE_oF3I3.js';
2
- import { e as DefaultElementShape, d as DefaultThemeColor, a7 as o$9, q as isElementWhere, M as whereOperatorAsPredicate, z as isWildcard, l as isElementKindExpr, p as isElementTagExpr, n as n$4, r as isExpandedElementExpr, m as isElementRef, h as isCustomElement, a5 as isViewRuleStyle, a8 as y$1, Q as ComputedNode, E as ElementKind, N as DefaultArrowType, F as FqnExpr, a4 as isViewRulePredicate, R as RelationExpr, a0 as isViewRuleAutoLayout, a3 as isViewRuleGroup, a1 as isViewRuleGlobalPredicateRef, a2 as isViewRuleGlobalStyle, a6 as stepEdgeId, _ as isDynamicViewParallelSteps, P as DefaultRelationshipColor, O as DefaultLineStyle, u as isOutgoing$1, s as isIncoming$1, t as isInOut, v as isRelation, y as isRelationWhere, j as isCustomRelationExpr, x as isRelationPredicateExpr, b as isElementPredicateExpr, a as isElementView, Z as isDynamicView, Y as isDeploymentView, D as DeploymentElement, U as extractStep, $ as isStepEdgeId, c as isScopedElementView } from './view.CyZrG8BJ.js';
3
- import { u as u$6, a as nonNullable, i as invariant, n as nonexhaustive } from './chunk-RAAYCPUM.M-JWF7SS.js';
1
+ import { g as getDefaultExportFromCjs, P as x, Q as s$1, R as a$4, r as hierarchyLevel, s as isAncestor, j as commonAncestor, w as sortNaturalByFqn, m as m$3, e as commonHead, S as u$7, O as objectHash, K as intersection, I as difference, M as union, N as stringHash, J as equals, A as isString, u as isDescendantOf, c as isSameHierarchy, F as isome, B as ifilter, E as isIterable, t as toSet, x as sortParentsFirst, H as toArray, D as imap, a as i$9, T as d$6, p as parentFqn, U as n$5, k as compareByFqnHierarchically, z as isNonEmptyArray, f as compareNatural, n as nameFromFqn, b as t$6, V as hasIntersection, l as l$7, v as sortByFqnHierarchically, h as ancestorsFqn, G as iunique, C as iflat, y as getOrCreate, i as ifind } from './core.BxvDITEI.mjs';
2
+ import { e as DefaultElementShape, d as DefaultThemeColor, a7 as o$9, q as isElementWhere, M as whereOperatorAsPredicate, z as isWildcard, l as isElementKindExpr, p as isElementTagExpr, n as n$4, r as isExpandedElementExpr, m as isElementRef, h as isCustomElement, a5 as isViewRuleStyle, a8 as y$1, Q as ComputedNode, E as ElementKind, N as DefaultArrowType, F as FqnExpr, R as RelationExpr, o as o$a, a4 as isViewRulePredicate, a0 as isViewRuleAutoLayout, a3 as isViewRuleGroup, a1 as isViewRuleGlobalPredicateRef, a2 as isViewRuleGlobalStyle, a6 as stepEdgeId, _ as isDynamicViewParallelSteps, P as DefaultRelationshipColor, O as DefaultLineStyle, u as isOutgoing$1, s as isIncoming$1, t as isInOut, v as isRelation, y as isRelationWhere, j as isCustomRelationExpr, x as isRelationPredicateExpr, b as isElementPredicateExpr, a as isElementView, Z as isDynamicView, Y as isDeploymentView, D as DeploymentElement, U as extractStep, $ as isStepEdgeId, c as isScopedElementView } from './core.DunIMHRf.mjs';
3
+ import { u as u$6, a as nonNullable, i as invariant, n as nonexhaustive } from './core.M-JWF7SS.mjs';
4
4
 
5
- function r$3(...t){return u$6(Object.values,t)}
5
+ /**
6
+ * Mnemonist DefaultMap
7
+ * =====================
8
+ *
9
+ * JavaScript implementation of a default map that will return a constructed
10
+ * value any time one tries to access an inexisting key. It's quite similar
11
+ * to python's defaultdict.
12
+ */
13
+
14
+ var defaultMap;
15
+ var hasRequiredDefaultMap;
16
+
17
+ function requireDefaultMap () {
18
+ if (hasRequiredDefaultMap) return defaultMap;
19
+ hasRequiredDefaultMap = 1;
20
+ /**
21
+ * DefaultMap.
22
+ *
23
+ * @constructor
24
+ */
25
+ function DefaultMap(factory) {
26
+ if (typeof factory !== 'function')
27
+ throw new Error('mnemonist/DefaultMap.constructor: expecting a function.');
28
+
29
+ this.items = new Map();
30
+ this.factory = factory;
31
+ this.size = 0;
32
+ }
33
+
34
+ /**
35
+ * Method used to clear the structure.
36
+ *
37
+ * @return {undefined}
38
+ */
39
+ DefaultMap.prototype.clear = function() {
40
+
41
+ // Properties
42
+ this.items.clear();
43
+ this.size = 0;
44
+ };
45
+
46
+ /**
47
+ * Method used to get the value set for given key. If the key does not exist,
48
+ * the value will be created using the provided factory.
49
+ *
50
+ * @param {any} key - Target key.
51
+ * @return {any}
52
+ */
53
+ DefaultMap.prototype.get = function(key) {
54
+ var value = this.items.get(key);
55
+
56
+ if (typeof value === 'undefined') {
57
+ value = this.factory(key, this.size);
58
+ this.items.set(key, value);
59
+ this.size++;
60
+ }
61
+
62
+ return value;
63
+ };
64
+
65
+ /**
66
+ * Method used to get the value set for given key. If the key does not exist,
67
+ * a value won't be created.
68
+ *
69
+ * @param {any} key - Target key.
70
+ * @return {any}
71
+ */
72
+ DefaultMap.prototype.peek = function(key) {
73
+ return this.items.get(key);
74
+ };
75
+
76
+ /**
77
+ * Method used to set a value for given key.
78
+ *
79
+ * @param {any} key - Target key.
80
+ * @param {any} value - Value.
81
+ * @return {DefaultMap}
82
+ */
83
+ DefaultMap.prototype.set = function(key, value) {
84
+ this.items.set(key, value);
85
+ this.size = this.items.size;
86
+
87
+ return this;
88
+ };
89
+
90
+ /**
91
+ * Method used to test the existence of a key in the map.
92
+ *
93
+ * @param {any} key - Target key.
94
+ * @return {boolean}
95
+ */
96
+ DefaultMap.prototype.has = function(key) {
97
+ return this.items.has(key);
98
+ };
99
+
100
+ /**
101
+ * Method used to delete target key.
102
+ *
103
+ * @param {any} key - Target key.
104
+ * @return {boolean}
105
+ */
106
+ DefaultMap.prototype.delete = function(key) {
107
+ var deleted = this.items.delete(key);
108
+
109
+ this.size = this.items.size;
110
+
111
+ return deleted;
112
+ };
113
+
114
+ /**
115
+ * Method used to iterate over each of the key/value pairs.
116
+ *
117
+ * @param {function} callback - Function to call for each item.
118
+ * @param {object} scope - Optional scope.
119
+ * @return {undefined}
120
+ */
121
+ DefaultMap.prototype.forEach = function(callback, scope) {
122
+ scope = arguments.length > 1 ? scope : this;
123
+
124
+ this.items.forEach(callback, scope);
125
+ };
126
+
127
+ /**
128
+ * Iterators.
129
+ */
130
+ DefaultMap.prototype.entries = function() {
131
+ return this.items.entries();
132
+ };
133
+
134
+ DefaultMap.prototype.keys = function() {
135
+ return this.items.keys();
136
+ };
137
+
138
+ DefaultMap.prototype.values = function() {
139
+ return this.items.values();
140
+ };
141
+
142
+ /**
143
+ * Attaching the #.entries method to Symbol.iterator if possible.
144
+ */
145
+ if (typeof Symbol !== 'undefined')
146
+ DefaultMap.prototype[Symbol.iterator] = DefaultMap.prototype.entries;
147
+
148
+ /**
149
+ * Convenience known methods.
150
+ */
151
+ DefaultMap.prototype.inspect = function() {
152
+ return this.items;
153
+ };
154
+
155
+ if (typeof Symbol !== 'undefined')
156
+ DefaultMap.prototype[Symbol.for('nodejs.util.inspect.custom')] = DefaultMap.prototype.inspect;
157
+
158
+ /**
159
+ * Typical factories.
160
+ */
161
+ DefaultMap.autoIncrement = function() {
162
+ var i = 0;
163
+
164
+ return function() {
165
+ return i++;
166
+ };
167
+ };
168
+
169
+ /**
170
+ * Exporting.
171
+ */
172
+ defaultMap = DefaultMap;
173
+ return defaultMap;
174
+ }
175
+
176
+ var defaultMapExports = requireDefaultMap();
177
+ const DefaultMap = /*@__PURE__*/getDefaultExportFromCjs(defaultMapExports);
178
+
179
+ /**
180
+ * Obliterator Iterator Class
181
+ * ===========================
182
+ *
183
+ * Simple class representing the library's iterators.
184
+ */
185
+
186
+ var iterator;
187
+ var hasRequiredIterator;
188
+
189
+ function requireIterator () {
190
+ if (hasRequiredIterator) return iterator;
191
+ hasRequiredIterator = 1;
192
+ /**
193
+ * Iterator class.
194
+ *
195
+ * @constructor
196
+ * @param {function} next - Next function.
197
+ */
198
+ function Iterator(next) {
199
+ if (typeof next !== 'function')
200
+ throw new Error('obliterator/iterator: expecting a function!');
201
+
202
+ this.next = next;
203
+ }
204
+
205
+ /**
206
+ * If symbols are supported, we add `next` to `Symbol.iterator`.
207
+ */
208
+ if (typeof Symbol !== 'undefined')
209
+ Iterator.prototype[Symbol.iterator] = function () {
210
+ return this;
211
+ };
212
+
213
+ /**
214
+ * Returning an iterator of the given values.
215
+ *
216
+ * @param {any...} values - Values.
217
+ * @return {Iterator}
218
+ */
219
+ Iterator.of = function () {
220
+ var args = arguments,
221
+ l = args.length,
222
+ i = 0;
223
+
224
+ return new Iterator(function () {
225
+ if (i >= l) return {done: true};
226
+
227
+ return {done: false, value: args[i++]};
228
+ });
229
+ };
230
+
231
+ /**
232
+ * Returning an empty iterator.
233
+ *
234
+ * @return {Iterator}
235
+ */
236
+ Iterator.empty = function () {
237
+ var iterator = new Iterator(function () {
238
+ return {done: true};
239
+ });
240
+
241
+ return iterator;
242
+ };
243
+
244
+ /**
245
+ * Returning an iterator over the given indexed sequence.
246
+ *
247
+ * @param {string|Array} sequence - Target sequence.
248
+ * @return {Iterator}
249
+ */
250
+ Iterator.fromSequence = function (sequence) {
251
+ var i = 0,
252
+ l = sequence.length;
253
+
254
+ return new Iterator(function () {
255
+ if (i >= l) return {done: true};
256
+
257
+ return {done: false, value: sequence[i++]};
258
+ });
259
+ };
260
+
261
+ /**
262
+ * Returning whether the given value is an iterator.
263
+ *
264
+ * @param {any} value - Value.
265
+ * @return {boolean}
266
+ */
267
+ Iterator.is = function (value) {
268
+ if (value instanceof Iterator) return true;
269
+
270
+ return (
271
+ typeof value === 'object' &&
272
+ value !== null &&
273
+ typeof value.next === 'function'
274
+ );
275
+ };
276
+
277
+ /**
278
+ * Exporting.
279
+ */
280
+ iterator = Iterator;
281
+ return iterator;
282
+ }
283
+
284
+ var support = {};
285
+
286
+ var hasRequiredSupport;
287
+
288
+ function requireSupport () {
289
+ if (hasRequiredSupport) return support;
290
+ hasRequiredSupport = 1;
291
+ support.ARRAY_BUFFER_SUPPORT = typeof ArrayBuffer !== 'undefined';
292
+ support.SYMBOL_SUPPORT = typeof Symbol !== 'undefined';
293
+ return support;
294
+ }
295
+
296
+ /**
297
+ * Obliterator ForEach Function
298
+ * =============================
299
+ *
300
+ * Helper function used to easily iterate over mixed values.
301
+ */
302
+
303
+ var foreach;
304
+ var hasRequiredForeach;
305
+
306
+ function requireForeach () {
307
+ if (hasRequiredForeach) return foreach;
308
+ hasRequiredForeach = 1;
309
+ var support = requireSupport();
310
+
311
+ var ARRAY_BUFFER_SUPPORT = support.ARRAY_BUFFER_SUPPORT;
312
+ var SYMBOL_SUPPORT = support.SYMBOL_SUPPORT;
313
+
314
+ /**
315
+ * Function able to iterate over almost any iterable JS value.
316
+ *
317
+ * @param {any} iterable - Iterable value.
318
+ * @param {function} callback - Callback function.
319
+ */
320
+ foreach = function forEach(iterable, callback) {
321
+ var iterator, k, i, l, s;
322
+
323
+ if (!iterable) throw new Error('obliterator/forEach: invalid iterable.');
324
+
325
+ if (typeof callback !== 'function')
326
+ throw new Error('obliterator/forEach: expecting a callback.');
327
+
328
+ // The target is an array or a string or function arguments
329
+ if (
330
+ Array.isArray(iterable) ||
331
+ (ARRAY_BUFFER_SUPPORT && ArrayBuffer.isView(iterable)) ||
332
+ typeof iterable === 'string' ||
333
+ iterable.toString() === '[object Arguments]'
334
+ ) {
335
+ for (i = 0, l = iterable.length; i < l; i++) callback(iterable[i], i);
336
+ return;
337
+ }
338
+
339
+ // The target has a #.forEach method
340
+ if (typeof iterable.forEach === 'function') {
341
+ iterable.forEach(callback);
342
+ return;
343
+ }
344
+
345
+ // The target is iterable
346
+ if (
347
+ SYMBOL_SUPPORT &&
348
+ Symbol.iterator in iterable &&
349
+ typeof iterable.next !== 'function'
350
+ ) {
351
+ iterable = iterable[Symbol.iterator]();
352
+ }
353
+
354
+ // The target is an iterator
355
+ if (typeof iterable.next === 'function') {
356
+ iterator = iterable;
357
+ i = 0;
358
+
359
+ while (((s = iterator.next()), s.done !== true)) {
360
+ callback(s.value, i);
361
+ i++;
362
+ }
363
+
364
+ return;
365
+ }
366
+
367
+ // The target is a plain object
368
+ for (k in iterable) {
369
+ if (iterable.hasOwnProperty(k)) {
370
+ callback(iterable[k], k);
371
+ }
372
+ }
373
+
374
+ return;
375
+ };
376
+ return foreach;
377
+ }
378
+
379
+ /**
380
+ * Mnemonist Stack
381
+ * ================
382
+ *
383
+ * Stack implementation relying on JavaScript arrays, which are fast enough &
384
+ * correctly optimized for this kind of work.
385
+ */
386
+
387
+ var stack;
388
+ var hasRequiredStack;
389
+
390
+ function requireStack () {
391
+ if (hasRequiredStack) return stack;
392
+ hasRequiredStack = 1;
393
+ var Iterator = requireIterator(),
394
+ forEach = requireForeach();
395
+
396
+ /**
397
+ * Stack
398
+ *
399
+ * @constructor
400
+ */
401
+ function Stack() {
402
+ this.clear();
403
+ }
404
+
405
+ /**
406
+ * Method used to clear the stack.
407
+ *
408
+ * @return {undefined}
409
+ */
410
+ Stack.prototype.clear = function() {
411
+
412
+ // Properties
413
+ this.items = [];
414
+ this.size = 0;
415
+ };
416
+
417
+ /**
418
+ * Method used to add an item to the stack.
419
+ *
420
+ * @param {any} item - Item to add.
421
+ * @return {number}
422
+ */
423
+ Stack.prototype.push = function(item) {
424
+ this.items.push(item);
425
+ return ++this.size;
426
+ };
427
+
428
+ /**
429
+ * Method used to retrieve & remove the last item of the stack.
430
+ *
431
+ * @return {any}
432
+ */
433
+ Stack.prototype.pop = function() {
434
+ if (this.size === 0)
435
+ return;
436
+
437
+ this.size--;
438
+ return this.items.pop();
439
+ };
440
+
441
+ /**
442
+ * Method used to get the last item of the stack.
443
+ *
444
+ * @return {any}
445
+ */
446
+ Stack.prototype.peek = function() {
447
+ return this.items[this.size - 1];
448
+ };
449
+
450
+ /**
451
+ * Method used to iterate over the stack.
452
+ *
453
+ * @param {function} callback - Function to call for each item.
454
+ * @param {object} scope - Optional scope.
455
+ * @return {undefined}
456
+ */
457
+ Stack.prototype.forEach = function(callback, scope) {
458
+ scope = arguments.length > 1 ? scope : this;
459
+
460
+ for (var i = 0, l = this.items.length; i < l; i++)
461
+ callback.call(scope, this.items[l - i - 1], i, this);
462
+ };
463
+
464
+ /**
465
+ * Method used to convert the stack to a JavaScript array.
466
+ *
467
+ * @return {array}
468
+ */
469
+ Stack.prototype.toArray = function() {
470
+ var array = new Array(this.size),
471
+ l = this.size - 1,
472
+ i = this.size;
473
+
474
+ while (i--)
475
+ array[i] = this.items[l - i];
476
+
477
+ return array;
478
+ };
479
+
480
+ /**
481
+ * Method used to create an iterator over a stack's values.
482
+ *
483
+ * @return {Iterator}
484
+ */
485
+ Stack.prototype.values = function() {
486
+ var items = this.items,
487
+ l = items.length,
488
+ i = 0;
489
+
490
+ return new Iterator(function() {
491
+ if (i >= l)
492
+ return {
493
+ done: true
494
+ };
495
+
496
+ var value = items[l - i - 1];
497
+ i++;
498
+
499
+ return {
500
+ value: value,
501
+ done: false
502
+ };
503
+ });
504
+ };
505
+
506
+ /**
507
+ * Method used to create an iterator over a stack's entries.
508
+ *
509
+ * @return {Iterator}
510
+ */
511
+ Stack.prototype.entries = function() {
512
+ var items = this.items,
513
+ l = items.length,
514
+ i = 0;
515
+
516
+ return new Iterator(function() {
517
+ if (i >= l)
518
+ return {
519
+ done: true
520
+ };
521
+
522
+ var value = items[l - i - 1];
523
+
524
+ return {
525
+ value: [i++, value],
526
+ done: false
527
+ };
528
+ });
529
+ };
530
+
531
+ /**
532
+ * Attaching the #.values method to Symbol.iterator if possible.
533
+ */
534
+ if (typeof Symbol !== 'undefined')
535
+ Stack.prototype[Symbol.iterator] = Stack.prototype.values;
6
536
 
7
- function d$5(...e){return e.length===2?(n,...r)=>t$5(n,...e,...r):t$5(...e)}var t$5=(e,n,r,...a)=>n(e,...a)?typeof r=="function"?r(e,...a):r.onTrue(e,...a):typeof r=="function"?e:r.onFalse(e,...a);
537
+
538
+ /**
539
+ * Convenience known methods.
540
+ */
541
+ Stack.prototype.toString = function() {
542
+ return this.toArray().join(',');
543
+ };
544
+
545
+ Stack.prototype.toJSON = function() {
546
+ return this.toArray();
547
+ };
548
+
549
+ Stack.prototype.inspect = function() {
550
+ var array = this.toArray();
551
+
552
+ // Trick so that node displays the name of the constructor
553
+ Object.defineProperty(array, 'constructor', {
554
+ value: Stack,
555
+ enumerable: false
556
+ });
557
+
558
+ return array;
559
+ };
560
+
561
+ if (typeof Symbol !== 'undefined')
562
+ Stack.prototype[Symbol.for('nodejs.util.inspect.custom')] = Stack.prototype.inspect;
563
+
564
+ /**
565
+ * Static @.from function taking an arbitrary iterable & converting it into
566
+ * a stack.
567
+ *
568
+ * @param {Iterable} iterable - Target iterable.
569
+ * @return {Stack}
570
+ */
571
+ Stack.from = function(iterable) {
572
+ var stack = new Stack();
573
+
574
+ forEach(iterable, function(value) {
575
+ stack.push(value);
576
+ });
577
+
578
+ return stack;
579
+ };
580
+
581
+ /**
582
+ * Static @.of function taking an arbitrary number of arguments & converting it
583
+ * into a stack.
584
+ *
585
+ * @param {...any} args
586
+ * @return {Stack}
587
+ */
588
+ Stack.of = function() {
589
+ return Stack.from(arguments);
590
+ };
591
+
592
+ /**
593
+ * Exporting.
594
+ */
595
+ stack = Stack;
596
+ return stack;
597
+ }
598
+
599
+ var stackExports = requireStack();
600
+ const Stack = /*@__PURE__*/getDefaultExportFromCjs(stackExports);
8
601
 
9
602
  function f(t,i){let o=i.length-t.length;if(o===1){let[n,...r]=i;return x(n,{lazy:t,lazyArgs:r})}if(o===0){let n={lazy:t,lazyArgs:i};return Object.assign(e=>x(e,n),n)}throw new Error("Wrong number of arguments")}
10
603
 
604
+ function r$3(...t){return u$6(Object.values,t)}
605
+
606
+ function d$5(...e){return e.length===2?(n,...r)=>t$5(n,...e,...r):t$5(...e)}var t$5=(e,n,r,...a)=>n(e,...a)?typeof r=="function"?r(e,...a):r.onTrue(e,...a):typeof r=="function"?e:r.onFalse(e,...a);
607
+
11
608
  function i$8(...e){return f(o$8,e)}function o$8(){let e=new Set;return t=>e.has(t)?s$1:(e.add(t),{done:!1,hasNext:!0,next:t})}
12
609
 
13
610
  function l$6(...e){return u$6(o$7,e,u$5)}var o$7=(e,r)=>r<0?[]:e.slice(0,r);function u$5(e){if(e<=0)return a$4;let r=e;return a=>(r-=1,{done:r<=0,hasNext:!0,next:a})}
@@ -22,50 +619,50 @@ function l$5(...e){return u$6(u$3,e)}var u$3=(e,a,n)=>e.reduce(a,n);
22
619
 
23
620
  function t$4(...e){return u$6(r$2,e)}function r$2(e){return [...e].reverse()}
24
621
 
25
- function i$7(...e){return u$6(o$5,e)}function o$5(e,n){let t={};for(let r of n)r in e&&(t[r]=e[r]);return t}
622
+ function p$1(...e){return u$6(t$3,e)}var t$3=(e,o)=>e[o];
26
623
 
27
- function d$3(...e){return u$6(i$6,e)}function i$6(e,o){let t={};for(let[r,n]of Object.entries(e))o(n,r,e)&&(t[r]=n);return t}
624
+ function d$3(...r){return u$6(i$7,r)}var i$7=(r,t)=>{let a=[[],[]];for(let[o,e]of r.entries())t(e,o,r)?a[0].push(e):a[1].push(e);return a};
28
625
 
29
- function i$5(...n){return o=>x(o,...n)}
626
+ function i$6(...e){return u$6(o$5,e)}function o$5(e,n){let t={};for(let r of n)r in e&&(t[r]=e[r]);return t}
30
627
 
31
- function p$1(...n){return u$6(t$3,n)}var t$3=(n,e)=>n[e];
628
+ function d$2(...e){return u$6(i$5,e)}function i$5(e,o){let t={};for(let[r,n]of Object.entries(e))o(n,r,e)&&(t[r]=n);return t}
32
629
 
33
- function d$2(...e){return u$6(l$4,e)}function l$4(e,a){let t={...e};for(let[n,o]of Object.entries(t))a(o,n,e)&&delete t[n];return t}
630
+ function i$4(...n){return o=>x(o,...n)}
34
631
 
35
- function t$2(...n){return u$6(o$4,n)}var o$4=n=>n.length===1?n[0]:void 0;
632
+ function d$1(...e){return u$6(l$4,e)}function l$4(e,a){let t={...e};for(let[n,o]of Object.entries(t))a(o,n,e)&&delete t[n];return t}
36
633
 
37
- function d$1(...r){return u$6(i$4,r)}var i$4=(r,t)=>{let a=[[],[]];for(let[o,e]of r.entries())t(e,o,r)?a[0].push(e):a[1].push(e);return a};
634
+ function t$2(...n){return u$6(o$4,n)}var o$4=n=>n.length===1?n[0]:void 0;
38
635
 
39
- function a$2(...e){return u$6(n$2,e)}var n$2=e=>e.at(-1);
636
+ function i$3(...e){return u$6(o$3,e)}function o$3(e,r){let a={};for(let[n,u]of Object.entries(e)){let l=r(u,n,e);a[n]=l;}return a}
40
637
 
41
- function l$3(...n){return u$6(d,n)}function d(n,o){let e={};for(let[a,t]of n.entries()){let[y,u]=o(t,a,n);e[y]=u;}return e}
638
+ function n$2(e){return !!e}
42
639
 
43
- function i$3(...e){return u$6(o$3,e)}function o$3(e,r){let a={};for(let[n,u]of Object.entries(e)){let l=r(u,n,e);a[n]=l;}return a}
640
+ function a$2(...e){return u$6(n$1,e)}var n$1=e=>e.at(-1);
44
641
 
45
- function n$1(e){return !!e}
642
+ function l$3(...n){return u$6(d,n)}function d(n,o){let e={};for(let[a,t]of n.entries()){let[y,u]=o(t,a,n);e[y]=u;}return e}
46
643
 
47
644
  function e$1(r){return typeof r=="number"&&!Number.isNaN(r)}
48
645
 
646
+ function n(e){return e===void 0?!0:typeof e=="string"||Array.isArray(e)?e.length===0:Object.keys(e).length===0}
647
+
49
648
  function e(o){return typeof o=="boolean"}
50
649
 
51
- function n(e){return e===void 0?!0:typeof e=="string"||Array.isArray(e)?e.length===0:Object.keys(e).length===0}
650
+ function i$2(...e){return u$6(p,e)}var p=(e,a)=>{let n={};for(let[d,t]of e.entries()){let y=a(t,d,e);if(y!==void 0){let{[y]:r}=n;r===void 0&&(r=[],n[y]=r),r.push(t);}}return n};
52
651
 
53
652
  function k(...n){return u$6(u$2,n)}function u$2(n,e){if(n===e||Object.is(n,e))return !0;if(typeof n!="object"||typeof e!="object"||n===null||e===null||Object.getPrototypeOf(n)!==Object.getPrototypeOf(e))return !1;if(Array.isArray(n))return l$2(n,e);if(n instanceof Map)return a$1(n,e);if(n instanceof Set)return c(n,e);if(n instanceof Date)return n.getTime()===e.getTime();if(n instanceof RegExp)return n.toString()===e.toString();if(Object.keys(n).length!==Object.keys(e).length)return !1;for(let[r,t]of Object.entries(n))if(!(r in e)||!u$2(t,e[r]))return !1;return !0}function l$2(n,e){if(n.length!==e.length)return !1;for(let[r,t]of n.entries())if(!u$2(t,e[r]))return !1;return !0}function a$1(n,e){if(n.size!==e.size)return !1;for(let[r,t]of n.entries())if(!e.has(r)||!u$2(t,e.get(r)))return !1;return !0}function c(n,e){if(n.size!==e.size)return !1;let r=[...e];for(let t of n){let o=!1;for(let[s,f]of r.entries())if(u$2(t,f)){o=!0,r.splice(s,1);break}if(!o)return !1}return !0}
54
653
 
55
654
  function u$1(...a){return u$6(o$2,a,l$1)}var o$2=(a,r)=>a.flatMap(r),l$1=a=>(r,t,y)=>{let n=a(r,t,y);return Array.isArray(n)?{done:!1,hasNext:!0,hasMany:!0,next:n}:{done:!1,hasNext:!0,next:n}};
56
655
 
57
- function u(...e){return u$6(o$1,e,i$2)}function o$1(e,r){return e.forEach(r),e}var i$2=e=>(r,n,t)=>(e(r,n,t),{done:!1,hasNext:!0,next:r});
656
+ function u(...e){return u$6(o$1,e,i$1)}function o$1(e,r){return e.forEach(r),e}var i$1=e=>(r,n,t)=>(e(r,n,t),{done:!1,hasNext:!0,next:r});
58
657
 
59
- function i$1(...e){return u$6(p,e)}var p=(e,a)=>{let n={};for(let[d,t]of e.entries()){let y=a(t,d,e);if(y!==void 0){let{[y]:r}=n;r===void 0&&(r=[],n[y]=r),r.push(t);}}return n};
658
+ function t$1(...r){return u$6(Object.entries,r)}
60
659
 
61
660
  function T(...a){return u$6(l,a,y)}var l=(a,e)=>a.filter(e),y=a=>(e,t,o)=>a(e,t,o)?{done:!1,hasNext:!0,next:e}:s$1;
62
661
 
63
- function o(...e){return u$6(t$1,e)}var t$1=(e,r)=>{for(let n=e.length-1;n>=0;n--){let a=e[n];if(r(a,n,e))return a}};
662
+ function o(...e){return u$6(t,e)}var t=(e,r)=>{for(let n=e.length-1;n>=0;n--){let a=e[n];if(r(a,n,e))return a}};
64
663
 
65
664
  function m(...e){return u$6(i,e)}function i(e,t){for(let[n,o]of e.entries())if(!t(o,n,e))return e.slice(n);return []}
66
665
 
67
- function t(...r){return u$6(Object.entries,r)}
68
-
69
666
  function a(...e){return u$6(r$1,e)}var r$1=(e,t)=>[...e,...t];
70
667
 
71
668
  function r(n){return ()=>n}
@@ -91,6 +688,9 @@ class ElementModel {
91
688
  get color() {
92
689
  return this.$element.color ?? DefaultThemeColor;
93
690
  }
691
+ get icon() {
692
+ return this.$element.icon ?? null;
693
+ }
94
694
  get tags() {
95
695
  return this.$element.tags ?? [];
96
696
  }
@@ -109,6 +709,9 @@ class ElementModel {
109
709
  get defaultView() {
110
710
  return this.scopedViews().next().value ?? null;
111
711
  }
712
+ get isRoot() {
713
+ return this.parent === null;
714
+ }
112
715
  isAncestorOf(another) {
113
716
  return isAncestor(this, another);
114
717
  }
@@ -235,37 +838,40 @@ class ElementModel {
235
838
  * @returns true if the element is deployed
236
839
  */
237
840
  isDeployed() {
238
- return n$1(this.deployments().next().value);
841
+ return n$2(this.deployments().next().value);
239
842
  }
240
843
  deployments() {
241
844
  return this.$model.deployment.instancesOf(this);
242
845
  }
243
846
  }
847
+ function isElementModel(element) {
848
+ return element instanceof ElementModel;
849
+ }
244
850
 
245
851
  function buildElementNotations(nodes) {
246
852
  return x(
247
853
  nodes,
248
- i$1(p$1("notation")),
854
+ i$2(p$1("notation")),
249
855
  i$3(
250
- i$5(
251
- i$1(p$1("shape")),
856
+ i$4(
857
+ i$2(p$1("shape")),
252
858
  i$3(
253
- i$5(
254
- i$1(p$1("color")),
859
+ i$4(
860
+ i$2(p$1("color")),
255
861
  i$3(
256
- i$5(
862
+ i$4(
257
863
  m$3(p$1("kind")),
258
864
  i$8()
259
865
  )
260
866
  ),
261
- t(),
867
+ t$1(),
262
868
  m$3(([color, kinds]) => ({
263
869
  kinds,
264
870
  color
265
871
  }))
266
872
  )
267
873
  ),
268
- t(),
874
+ t$1(),
269
875
  u$1(
270
876
  ([shape, colors]) => colors.map(({ color, kinds }) => ({
271
877
  shape,
@@ -275,7 +881,7 @@ function buildElementNotations(nodes) {
275
881
  )
276
882
  )
277
883
  ),
278
- t(),
884
+ t$1(),
279
885
  u$1(
280
886
  ([title, shapes]) => shapes.map(({ shape, color, kinds }) => ({
281
887
  title,
@@ -1362,7 +1968,7 @@ function topologicalSort(param) {
1362
1968
  // // [prop('sourceLevel'), 'asc'],
1363
1969
  // ),
1364
1970
  );
1365
- const [edgesBetweenLeafs, edgesWithCompounds] = d$1(
1971
+ const [edgesBetweenLeafs, edgesWithCompounds] = d$3(
1366
1972
  enrichedEdges,
1367
1973
  ({ source, target }) => source.children.length === 0 && target.children.length === 0
1368
1974
  );
@@ -1446,12 +2052,12 @@ function calcViewLayoutHash(view) {
1446
2052
  autoLayout: view.autoLayout,
1447
2053
  nodes: x(
1448
2054
  view.nodes,
1449
- m$3(i$7(["id", "title", "description", "technology", "shape", "icon", "children"])),
1450
- l$3(({ id, icon, ...node }) => [id, { ...node, icon: n$1(icon) ? "Y" : "N" }])
2055
+ m$3(i$6(["id", "title", "description", "technology", "shape", "icon", "children"])),
2056
+ l$3(({ id, icon, ...node }) => [id, { ...node, icon: n$2(icon) ? "Y" : "N" }])
1451
2057
  ),
1452
2058
  edges: x(
1453
2059
  view.edges,
1454
- m$3(i$7(["source", "target", "label", "description", "technology", "dir", "head", "tail", "line"])),
2060
+ m$3(i$6(["source", "target", "label", "description", "technology", "dir", "head", "tail", "line"])),
1455
2061
  l$3(({ source, target, ...edge }) => [`${source}:${target}`, edge])
1456
2062
  )
1457
2063
  };
@@ -1538,6 +2144,9 @@ class AbstractDeploymentElementModel {
1538
2144
  get tags() {
1539
2145
  return this.$node.tags ?? [];
1540
2146
  }
2147
+ get kind() {
2148
+ return this.$node.kind ?? null;
2149
+ }
1541
2150
  get description() {
1542
2151
  return this.$node.description ?? null;
1543
2152
  }
@@ -1797,6 +2406,9 @@ class DeployedInstanceModel extends AbstractDeploymentElementModel {
1797
2406
  get tags() {
1798
2407
  return this.$instance.tags ?? [];
1799
2408
  }
2409
+ get kind() {
2410
+ return this.$instance.kind ?? null;
2411
+ }
1800
2412
  get description() {
1801
2413
  return this.$instance.description ?? this.element.description;
1802
2414
  }
@@ -1912,6 +2524,9 @@ class DeploymentRelationModel {
1912
2524
  get tags() {
1913
2525
  return this.$relationship.tags ?? [];
1914
2526
  }
2527
+ get kind() {
2528
+ return this.$relationship.kind ?? null;
2529
+ }
1915
2530
  get navigateTo() {
1916
2531
  return this.$relationship.navigateTo ? this.$model.$model.view(this.$relationship.navigateTo) : null;
1917
2532
  }
@@ -1926,6 +2541,9 @@ class DeploymentRelationModel {
1926
2541
  }
1927
2542
  return;
1928
2543
  }
2544
+ isDeploymentRelation() {
2545
+ return true;
2546
+ }
1929
2547
  }
1930
2548
  class RelationshipsAccum {
1931
2549
  /**
@@ -2053,11 +2671,10 @@ class DeploymentConnectionModel {
2053
2671
  yield* this.relations.model;
2054
2672
  yield* this.relations.deployment;
2055
2673
  }
2056
- /**
2057
- * Merge with another connection, if it has the same source and target.
2058
- * Returns new connection with union of relationships.
2059
- */
2060
2674
  mergeWith(other) {
2675
+ if (Array.isArray(other)) {
2676
+ return other.reduce((acc, o) => acc.mergeWith(o), this);
2677
+ }
2061
2678
  invariant(this.source.id === other.source.id, "Cannot merge connections with different sources");
2062
2679
  invariant(this.target.id === other.target.id, "Cannot merge connections with different targets");
2063
2680
  return new DeploymentConnectionModel(
@@ -2776,7 +3393,7 @@ class AbstractStageInclude {
2776
3393
  let state = this.precommit(this.memory.mutableState());
2777
3394
  let fromConnections = /* @__PURE__ */ new Set();
2778
3395
  if (this._connections.length > 0) {
2779
- const [fromKnown, rest] = d$1(
3396
+ const [fromKnown, rest] = d$3(
2780
3397
  this._connections,
2781
3398
  (c) => state.final.has(c.source)
2782
3399
  );
@@ -2867,12 +3484,12 @@ function findCrossBoundarySameSourceOrTarget(connections) {
2867
3484
  { group: `$source-${conn.source.id}`, conn },
2868
3485
  { group: `$target-${conn.target.id}`, conn }
2869
3486
  ]),
2870
- i$1(p$1("group")),
3487
+ i$2(p$1("group")),
2871
3488
  r$3(),
2872
3489
  T(i$9(2)),
2873
3490
  u(
2874
3491
  // In each group, sort by hierarchy, first are deepest
2875
- i$5(
3492
+ i$4(
2876
3493
  m$3(p$1("conn")),
2877
3494
  sortConnectionsByBoundaryHierarchy("desc"),
2878
3495
  // Drop first, as it is the deepest
@@ -3332,31 +3949,31 @@ function mergePropsFromRelationships(relations, prefer) {
3332
3949
  relations,
3333
3950
  l$5(
3334
3951
  (acc, r) => {
3335
- if (n$1(r.title) && !acc.title.includes(r.title)) {
3952
+ if (n$2(r.title) && !acc.title.includes(r.title)) {
3336
3953
  acc.title.push(r.title);
3337
3954
  }
3338
- if (n$1(r.description) && !acc.description.includes(r.description)) {
3955
+ if (n$2(r.description) && !acc.description.includes(r.description)) {
3339
3956
  acc.description.push(r.description);
3340
3957
  }
3341
- if (n$1(r.technology) && !acc.technology.includes(r.technology)) {
3958
+ if (n$2(r.technology) && !acc.technology.includes(r.technology)) {
3342
3959
  acc.technology.push(r.technology);
3343
3960
  }
3344
- if (n$1(r.kind) && !acc.kind.includes(r.kind)) {
3961
+ if (n$2(r.kind) && !acc.kind.includes(r.kind)) {
3345
3962
  acc.kind.push(r.kind);
3346
3963
  }
3347
- if (n$1(r.color) && !acc.color.includes(r.color)) {
3964
+ if (n$2(r.color) && !acc.color.includes(r.color)) {
3348
3965
  acc.color.push(r.color);
3349
3966
  }
3350
- if (n$1(r.line) && !acc.line.includes(r.line)) {
3967
+ if (n$2(r.line) && !acc.line.includes(r.line)) {
3351
3968
  acc.line.push(r.line);
3352
3969
  }
3353
- if (n$1(r.head) && !acc.head.includes(r.head)) {
3970
+ if (n$2(r.head) && !acc.head.includes(r.head)) {
3354
3971
  acc.head.push(r.head);
3355
3972
  }
3356
- if (n$1(r.tail) && !acc.tail.includes(r.tail)) {
3973
+ if (n$2(r.tail) && !acc.tail.includes(r.tail)) {
3357
3974
  acc.tail.push(r.tail);
3358
3975
  }
3359
- if (n$1(r.navigateTo) && !acc.navigateTo.includes(r.navigateTo)) {
3976
+ if (n$2(r.navigateTo) && !acc.navigateTo.includes(r.navigateTo)) {
3360
3977
  acc.navigateTo.push(r.navigateTo);
3361
3978
  }
3362
3979
  if (r.tags) {
@@ -3385,7 +4002,7 @@ function mergePropsFromRelationships(relations, prefer) {
3385
4002
  let technology = t$2(allprops.technology);
3386
4003
  let title = t$2(allprops.title) ?? (allprops.title.length > 1 ? "[...]" : null);
3387
4004
  const tags = i$8(allprops.tags);
3388
- let merged = d$3(
4005
+ let merged = d$2(
3389
4006
  {
3390
4007
  // If there is no title, but there is technology, use technology as title
3391
4008
  title: title ?? (technology ? `[${technology}]` : null),
@@ -3400,12 +4017,12 @@ function mergePropsFromRelationships(relations, prefer) {
3400
4017
  ...isNonEmptyArray(allprops.links) && { links: allprops.links },
3401
4018
  ...isNonEmptyArray(tags) && { tags }
3402
4019
  },
3403
- n$1
4020
+ n$2
3404
4021
  );
3405
4022
  if (prefer) {
3406
4023
  return {
3407
4024
  ...merged,
3408
- ...d$3(pickRelationshipProps(prefer), n$1)
4025
+ ...d$2(pickRelationshipProps(prefer), n$2)
3409
4026
  };
3410
4027
  }
3411
4028
  return merged;
@@ -3687,57 +4304,312 @@ function includeDeployedNodeWithExpanded(node, { memory, stage }) {
3687
4304
  break;
3688
4305
  }
3689
4306
  }
3690
- if (hasConnectionsWithVisible) {
3691
- stage.connectWithExisting(children, "in");
3692
- stage.addConnections(findConnectionsWithin(children));
3693
- stage.connectWithExisting(children, "out");
4307
+ if (hasConnectionsWithVisible) {
4308
+ stage.connectWithExisting(children, "in");
4309
+ stage.addConnections(findConnectionsWithin(children));
4310
+ stage.connectWithExisting(children, "out");
4311
+ }
4312
+ stage.addImplicit(children);
4313
+ if (stage.connections.length > 0) {
4314
+ stage.addExplicit(node);
4315
+ }
4316
+ }
4317
+ function includeDeployedNodeDescendants(node, { stage }) {
4318
+ const dfs = (node2) => {
4319
+ const children = [];
4320
+ for (const child of node2.children()) {
4321
+ if (child.isDeploymentNode()) {
4322
+ children.push(...dfs(child));
4323
+ }
4324
+ children.push(child);
4325
+ }
4326
+ stage.connectWithExisting(children, "in");
4327
+ stage.addConnections(findConnectionsWithin(children));
4328
+ stage.addImplicit(children);
4329
+ return children;
4330
+ };
4331
+ const descendants = dfs(node);
4332
+ if (descendants.length === 0) {
4333
+ return;
4334
+ }
4335
+ stage.connectWithExisting(descendants, "out");
4336
+ const allconnected = findConnectedElements(stage);
4337
+ descendants.forEach((desc) => {
4338
+ if (allconnected.has(desc)) {
4339
+ stage.addExplicit(desc);
4340
+ }
4341
+ });
4342
+ }
4343
+ function findConnectedElements(stage) {
4344
+ return x(
4345
+ stage.mergedConnections(),
4346
+ cleanCrossBoundary,
4347
+ cleanRedundantRelationships,
4348
+ l$5((acc, c) => {
4349
+ acc.add(c.source);
4350
+ acc.add(c.target);
4351
+ return acc;
4352
+ }, /* @__PURE__ */ new Set())
4353
+ );
4354
+ }
4355
+
4356
+ function isDeploymentNode(model) {
4357
+ return model.isDeploymentNode();
4358
+ }
4359
+ function isDeployedInstance(model) {
4360
+ return model.isInstance();
4361
+ }
4362
+ function isNestedElementOfDeployedInstanceModel(model) {
4363
+ return !model.isInstance() && !model.isDeploymentNode();
4364
+ }
4365
+ function isDeploymentElementModel(x) {
4366
+ return x instanceof DeploymentNodeModel || x instanceof DeployedInstanceModel;
4367
+ }
4368
+
4369
+ const OutgoingRelationPredicate = {
4370
+ include: ({ expr, model, memory, stage, where }) => {
4371
+ const targets = [...memory.elements];
4372
+ if (FqnExpr.isWildcard(expr.outgoing)) {
4373
+ for (const target of targets) {
4374
+ if (target.allIncoming.isEmpty) {
4375
+ continue;
4376
+ }
4377
+ for (const source of resolveAscendingSiblings(target)) {
4378
+ const toInclude = applyPredicate(findConnection(source, target, "directed"), where);
4379
+ stage.addConnections(toInclude);
4380
+ }
4381
+ }
4382
+ return stage;
4383
+ }
4384
+ invariant(FqnExpr.isDeploymentRef(expr.outgoing), "Only deployment refs are supported in include");
4385
+ const sources = resolveElements$1(model, expr.outgoing);
4386
+ for (const source of sources) {
4387
+ const toInclude = applyPredicate(findConnectionsBetween(source, targets, "directed"), where);
4388
+ stage.addConnections(toInclude);
4389
+ }
4390
+ return stage;
4391
+ },
4392
+ exclude: ({ expr, model, memory, stage, where }) => {
4393
+ if (FqnExpr.isModelRef(expr.outgoing)) {
4394
+ const excludedRelations = resolveAllOutgoingRelations(model, expr.outgoing);
4395
+ return excludeModelRelations(excludedRelations, { stage, memory }, where);
4396
+ }
4397
+ if (FqnExpr.isWildcard(expr.outgoing)) {
4398
+ return stage;
4399
+ }
4400
+ const isOutgoing = filterOutgoingConnections(resolveElements$1(model, expr.outgoing));
4401
+ const toExclude = x(
4402
+ memory.connections,
4403
+ T(isOutgoing),
4404
+ applyPredicate(where)
4405
+ );
4406
+ stage.excludeConnections(toExclude);
4407
+ return stage;
4408
+ }
4409
+ };
4410
+ function filterOutgoingConnections(sources) {
4411
+ return y$1(
4412
+ sources.map((source) => {
4413
+ const satisfies = (el) => el === source || isAncestor(source, el);
4414
+ return (connection) => {
4415
+ return satisfies(connection.source) && !satisfies(connection.target);
4416
+ };
4417
+ })
4418
+ );
4419
+ }
4420
+ function resolveAllOutgoingRelations(model, moodelRef) {
4421
+ const targets = resolveModelElements(model, moodelRef);
4422
+ return new Set(targets.flatMap((e) => [...e.allOutgoing]));
4423
+ }
4424
+
4425
+ const InOutRelationPredicate$1 = {
4426
+ include: ({ expr, model, memory, stage, where }) => {
4427
+ const sources = [...memory.elements];
4428
+ if (FqnExpr.isWildcard(expr.inout)) {
4429
+ for (const source of sources) {
4430
+ const targets2 = [...resolveAscendingSiblings(source)];
4431
+ const toInclude = matchConnections(findConnectionsBetween(source, targets2, "both"), where);
4432
+ stage.addConnections(toInclude);
4433
+ }
4434
+ return stage;
4435
+ }
4436
+ invariant(FqnExpr.isDeploymentRef(expr.inout), "Only deployment refs are supported in include");
4437
+ const targets = resolveElements$1(model, expr.inout);
4438
+ for (const source of sources) {
4439
+ const toInclude = matchConnections(findConnectionsBetween(source, targets, "both"), where);
4440
+ stage.addConnections(toInclude);
4441
+ }
4442
+ return stage;
4443
+ },
4444
+ exclude: ({ expr, model, memory, stage, where }) => {
4445
+ if (FqnExpr.isModelRef(expr.inout)) {
4446
+ const elements2 = resolveModelElements(model, expr.inout);
4447
+ if (elements2.length === 0) {
4448
+ return stage;
4449
+ }
4450
+ const excludedRelations = union(
4451
+ /* @__PURE__ */ new Set(),
4452
+ ...elements2.flatMap((e) => [e.allIncoming, e.allOutgoing])
4453
+ );
4454
+ return excludeModelRelations(excludedRelations, { stage, memory }, where);
4455
+ }
4456
+ if (FqnExpr.isWildcard(expr.inout)) {
4457
+ return stage;
4458
+ }
4459
+ const elements = resolveElements$1(model, expr.inout);
4460
+ const isIncoming = filterIncomingConnections(elements);
4461
+ const isOutgoing = filterOutgoingConnections(elements);
4462
+ const toExclude = x(
4463
+ memory.connections,
4464
+ T((c) => isIncoming(c) !== isOutgoing(c)),
4465
+ applyPredicate(where)
4466
+ );
4467
+ stage.excludeConnections(toExclude);
4468
+ return stage;
4469
+ }
4470
+ };
4471
+
4472
+ const WhereRelationPredicate = {
4473
+ include: ({ expr, model, memory, stage }) => {
4474
+ const where = whereOperatorAsPredicate(expr.where.condition);
4475
+ return predicateToPatch("include", { expr: expr.where.expr, model, stage, memory, where });
4476
+ },
4477
+ exclude: ({ expr, model, memory, stage }) => {
4478
+ const where = whereOperatorAsPredicate(expr.where.condition);
4479
+ return predicateToPatch("exclude", { expr: expr.where.expr, model, stage, memory, where });
4480
+ }
4481
+ };
4482
+
4483
+ const WildcardPredicate$1 = {
4484
+ include: ({ model, stage }) => {
4485
+ const children = [];
4486
+ const rootElements = [...model.roots()].map((root) => {
4487
+ if (!root.onlyOneInstance()) {
4488
+ children.push(...root.children());
4489
+ }
4490
+ return root;
4491
+ });
4492
+ stage.addExplicit(rootElements);
4493
+ if (children.length > 1) {
4494
+ stage.addConnections(findConnectionsWithin([
4495
+ ...rootElements,
4496
+ ...children
4497
+ ]));
4498
+ }
4499
+ return stage;
4500
+ },
4501
+ exclude: ({ stage, memory }) => {
4502
+ stage.exclude(memory.elements);
4503
+ return stage;
4504
+ }
4505
+ };
4506
+
4507
+ function predicateToPatch(op, { expr, where, ...ctx }) {
4508
+ switch (true) {
4509
+ case FqnExpr.isModelRef(expr):
4510
+ return void 0;
4511
+ case FqnExpr.isDeploymentRef(expr):
4512
+ return DeploymentRefPredicate[op]({ ...ctx, expr, where });
4513
+ case FqnExpr.isWildcard(expr):
4514
+ return WildcardPredicate$1[op]({ ...ctx, expr, where });
4515
+ case RelationExpr.isDirect(expr):
4516
+ return DirectRelationPredicate[op]({ ...ctx, expr, where });
4517
+ case RelationExpr.isInOut(expr):
4518
+ return InOutRelationPredicate$1[op]({ ...ctx, expr, where });
4519
+ case RelationExpr.isOutgoing(expr):
4520
+ return OutgoingRelationPredicate[op]({ ...ctx, expr, where });
4521
+ case RelationExpr.isIncoming(expr):
4522
+ return IncomingRelationPredicate[op]({ ...ctx, expr, where });
4523
+ case RelationExpr.isWhere(expr):
4524
+ return WhereRelationPredicate[op]({ ...ctx, expr, where });
4525
+ default:
4526
+ nonexhaustive(expr);
3694
4527
  }
3695
- stage.addImplicit(children);
3696
- if (stage.connections.length > 0) {
3697
- stage.addExplicit(node);
4528
+ }
4529
+ function excludeModelRelations(relationsToExclude, { stage, memory }, where, filterConnections = () => true) {
4530
+ if (relationsToExclude.size === 0) {
4531
+ return stage;
4532
+ }
4533
+ const toExclude = x(
4534
+ memory.connections,
4535
+ T((c) => filterConnections(c)),
4536
+ // Find connections that have at least one relation in common with the excluded relations
4537
+ T((c) => hasIntersection(c.relations.model, relationsToExclude)),
4538
+ m$3(
4539
+ (c) => c.update({
4540
+ deployment: null,
4541
+ model: intersection(c.relations.model, relationsToExclude)
4542
+ })
4543
+ ),
4544
+ applyPredicate(where),
4545
+ T((c) => c.nonEmpty())
4546
+ );
4547
+ if (toExclude.length === 0) {
4548
+ return stage;
3698
4549
  }
4550
+ return stage.excludeConnections(toExclude);
3699
4551
  }
3700
- function includeDeployedNodeDescendants(node, { stage }) {
3701
- const dfs = (node2) => {
3702
- const children = [];
3703
- for (const child of node2.children()) {
3704
- if (child.isDeploymentNode()) {
3705
- children.push(...dfs(child));
3706
- }
3707
- children.push(child);
3708
- }
3709
- stage.connectWithExisting(children, "in");
3710
- stage.addConnections(findConnectionsWithin(children));
3711
- stage.addImplicit(children);
3712
- return children;
3713
- };
3714
- const descendants = dfs(node);
3715
- if (descendants.length === 0) {
3716
- return;
4552
+ function matchConnection(c, where) {
4553
+ return applyPredicate(c, where).nonEmpty();
4554
+ }
4555
+ function applyPredicate(...args) {
4556
+ if (args.length === 1) {
4557
+ return (x) => applyPredicate(x, args[0]);
3717
4558
  }
3718
- stage.connectWithExisting(descendants, "out");
3719
- const allconnected = findConnectedElements(stage);
3720
- descendants.forEach((desc) => {
3721
- if (allconnected.has(desc)) {
3722
- stage.addExplicit(desc);
3723
- }
4559
+ const [c, where] = args;
4560
+ if (where === null) {
4561
+ return c;
4562
+ }
4563
+ if (o$a(c)) {
4564
+ return c.map((x) => applyPredicate(x, where)).filter((x) => x.nonEmpty());
4565
+ }
4566
+ return c.update({
4567
+ model: new Set([...c.relations.model.values()].filter((r) => where(toFilterableRelation(c)(r)))),
4568
+ deployment: new Set([...c.relations.deployment.values()].filter((r) => where(toFilterableRelation(c)(r))))
3724
4569
  });
3725
4570
  }
3726
- function findConnectedElements(stage) {
4571
+ function matchConnections(connections, where) {
4572
+ if (!where) {
4573
+ return connections;
4574
+ }
3727
4575
  return x(
3728
- stage.mergedConnections(),
3729
- cleanCrossBoundary,
3730
- cleanRedundantRelationships,
3731
- l$5((acc, c) => {
3732
- acc.add(c.source);
3733
- acc.add(c.target);
3734
- return acc;
3735
- }, /* @__PURE__ */ new Set())
4576
+ connections,
4577
+ T((c) => matchConnection(c, where))
3736
4578
  );
3737
4579
  }
4580
+ function toFilterable(relationEndpoint, connectionEndpoint) {
4581
+ if (isElementModel(relationEndpoint)) {
4582
+ const deployedInstance = isDeploymentElementModel(connectionEndpoint) && isDeployedInstance(connectionEndpoint) ? connectionEndpoint : null;
4583
+ return {
4584
+ kind: relationEndpoint.kind,
4585
+ tags: [...relationEndpoint.tags, ...deployedInstance?.tags ?? []]
4586
+ };
4587
+ }
4588
+ if (isNestedElementOfDeployedInstanceModel(relationEndpoint)) {
4589
+ return i$6(relationEndpoint.element, ["tags", "kind"]);
4590
+ }
4591
+ if (isDeployedInstance(relationEndpoint)) {
4592
+ return {
4593
+ kind: relationEndpoint.element.kind,
4594
+ tags: [...relationEndpoint.tags, ...relationEndpoint.element.tags]
4595
+ };
4596
+ }
4597
+ if (isDeploymentNode(relationEndpoint)) {
4598
+ return i$6(relationEndpoint, ["tags", "kind"]);
4599
+ }
4600
+ nonexhaustive(relationEndpoint);
4601
+ }
4602
+ function toFilterableRelation(c) {
4603
+ return (relation) => ({
4604
+ tags: relation.tags,
4605
+ kind: relation.kind,
4606
+ source: toFilterable(relation.source, c.source),
4607
+ target: toFilterable(relation.target, c.target)
4608
+ });
4609
+ }
3738
4610
 
3739
4611
  const IncomingRelationPredicate = {
3740
- include: ({ expr, model, memory, stage }) => {
4612
+ include: ({ expr, model, memory, stage, where }) => {
3741
4613
  const sources = [...memory.elements];
3742
4614
  if (FqnExpr.isWildcard(expr.incoming)) {
3743
4615
  for (const source of sources) {
@@ -3745,27 +4617,33 @@ const IncomingRelationPredicate = {
3745
4617
  continue;
3746
4618
  }
3747
4619
  const targets2 = [...resolveAscendingSiblings(source)];
3748
- stage.addConnections(findConnectionsBetween(source, targets2, "directed"));
4620
+ const toInclude = applyPredicate(findConnectionsBetween(source, targets2, "directed"), where);
4621
+ stage.addConnections(toInclude);
3749
4622
  }
3750
4623
  return stage;
3751
4624
  }
3752
4625
  invariant(FqnExpr.isDeploymentRef(expr.incoming), "Only deployment refs are supported in include");
3753
4626
  const targets = resolveElements$1(model, expr.incoming);
3754
4627
  for (const source of sources) {
3755
- stage.addConnections(findConnectionsBetween(source, targets, "directed"));
4628
+ const toInclude = applyPredicate(findConnectionsBetween(source, targets, "directed"), where);
4629
+ stage.addConnections(toInclude);
3756
4630
  }
3757
4631
  return stage;
3758
4632
  },
3759
- exclude: ({ expr, model, memory, stage }) => {
4633
+ exclude: ({ expr, model, memory, stage, where }) => {
3760
4634
  if (FqnExpr.isModelRef(expr.incoming)) {
3761
4635
  const excludedRelations = resolveAllImcomingRelations(model, expr.incoming);
3762
- return excludeModelRelations(excludedRelations, { stage, memory });
4636
+ return excludeModelRelations(excludedRelations, { stage, memory }, where);
3763
4637
  }
3764
4638
  if (FqnExpr.isWildcard(expr.incoming)) {
3765
4639
  return stage;
3766
4640
  }
3767
4641
  const isIncoming = filterIncomingConnections(resolveElements$1(model, expr.incoming));
3768
- const toExclude = memory.connections.filter(isIncoming);
4642
+ const toExclude = x(
4643
+ memory.connections,
4644
+ T(isIncoming),
4645
+ applyPredicate(where)
4646
+ );
3769
4647
  stage.excludeConnections(toExclude);
3770
4648
  return stage;
3771
4649
  }
@@ -3785,56 +4663,6 @@ function resolveAllImcomingRelations(model, moodelRef) {
3785
4663
  return new Set(targets.flatMap((e) => [...e.allIncoming]));
3786
4664
  }
3787
4665
 
3788
- const OutgoingRelationPredicate = {
3789
- include: ({ expr, model, memory, stage }) => {
3790
- const targets = [...memory.elements];
3791
- if (FqnExpr.isWildcard(expr.outgoing)) {
3792
- for (const target of targets) {
3793
- if (target.allIncoming.isEmpty) {
3794
- continue;
3795
- }
3796
- for (const source of resolveAscendingSiblings(target)) {
3797
- stage.addConnections(findConnection(source, target, "directed"));
3798
- }
3799
- }
3800
- return stage;
3801
- }
3802
- invariant(FqnExpr.isDeploymentRef(expr.outgoing), "Only deployment refs are supported in include");
3803
- const sources = resolveElements$1(model, expr.outgoing);
3804
- for (const source of sources) {
3805
- stage.addConnections(findConnectionsBetween(source, targets, "directed"));
3806
- }
3807
- return stage;
3808
- },
3809
- exclude: ({ expr, model, memory, stage }) => {
3810
- if (FqnExpr.isModelRef(expr.outgoing)) {
3811
- const excludedRelations = resolveAllOutgoingRelations(model, expr.outgoing);
3812
- return excludeModelRelations(excludedRelations, { stage, memory });
3813
- }
3814
- if (FqnExpr.isWildcard(expr.outgoing)) {
3815
- return stage;
3816
- }
3817
- const isOutgoing = filterOutgoingConnections(resolveElements$1(model, expr.outgoing));
3818
- const toExclude = memory.connections.filter(isOutgoing);
3819
- stage.excludeConnections(toExclude);
3820
- return stage;
3821
- }
3822
- };
3823
- function filterOutgoingConnections(sources) {
3824
- return y$1(
3825
- sources.map((source) => {
3826
- const satisfies = (el) => el === source || isAncestor(source, el);
3827
- return (connection) => {
3828
- return satisfies(connection.source) && !satisfies(connection.target);
3829
- };
3830
- })
3831
- );
3832
- }
3833
- function resolveAllOutgoingRelations(model, moodelRef) {
3834
- const targets = resolveModelElements(model, moodelRef);
3835
- return new Set(targets.flatMap((e) => [...e.allOutgoing]));
3836
- }
3837
-
3838
4666
  const resolveAscendingSiblings = (element) => {
3839
4667
  const siblings = /* @__PURE__ */ new Set();
3840
4668
  for (let sibling of element.descendingSiblings()) {
@@ -3843,7 +4671,7 @@ const resolveAscendingSiblings = (element) => {
3843
4671
  return siblings;
3844
4672
  };
3845
4673
  const DirectRelationPredicate = {
3846
- include: ({ expr: { source, target, isBidirectional = false }, model, stage }) => {
4674
+ include: ({ expr: { source, target, isBidirectional = false }, model, stage, where }) => {
3847
4675
  invariant(!FqnExpr.isModelRef(source), "Invalid source model ref in direct relation");
3848
4676
  invariant(!FqnExpr.isModelRef(target), "Invalid target model ref in direct relation");
3849
4677
  const sourceIsWildcard = FqnExpr.isWildcard(source);
@@ -3853,10 +4681,14 @@ const DirectRelationPredicate = {
3853
4681
  switch (true) {
3854
4682
  // * -> *
3855
4683
  case (sourceIsWildcard && targetIsWildcard): {
3856
- connections = findConnectionsWithin(model.instances()).map((c) => {
3857
- stage.addImplicit(c.boundary);
3858
- return c;
3859
- });
4684
+ connections = x(
4685
+ findConnectionsWithin(model.instances()),
4686
+ applyPredicate(where),
4687
+ m$3((c) => {
4688
+ stage.addImplicit(c.boundary);
4689
+ return c;
4690
+ })
4691
+ );
3860
4692
  break;
3861
4693
  }
3862
4694
  // source -> *; source <-> *
@@ -3868,10 +4700,15 @@ const DirectRelationPredicate = {
3868
4700
  const isTarget = filterIncomingConnections(sources);
3869
4701
  postFilter = (c) => isSource(c) !== isTarget(c);
3870
4702
  }
3871
- connections = sources.flatMap((source2) => {
3872
- const targets = resolveAscendingSiblings(source2);
3873
- return findConnectionsBetween(source2, targets, dir);
3874
- }).filter(postFilter);
4703
+ connections = x(
4704
+ sources,
4705
+ u$1((source2) => {
4706
+ const targets = resolveAscendingSiblings(source2);
4707
+ return findConnectionsBetween(source2, targets, dir);
4708
+ }),
4709
+ T(postFilter),
4710
+ applyPredicate(where)
4711
+ );
3875
4712
  break;
3876
4713
  }
3877
4714
  // * -> target; * <-> target
@@ -3883,10 +4720,15 @@ const DirectRelationPredicate = {
3883
4720
  const isSource = filterOutgoingConnections(targets);
3884
4721
  postFilter = (c) => isSource(c) !== isTarget(c);
3885
4722
  }
3886
- connections = targets.flatMap((target2) => {
3887
- const sources = resolveAscendingSiblings(target2);
3888
- return [...sources].flatMap((source2) => findConnection(source2, target2, dir));
3889
- }).filter(postFilter);
4723
+ connections = x(
4724
+ targets,
4725
+ u$1((target2) => {
4726
+ const sources = resolveAscendingSiblings(target2);
4727
+ return [...sources].flatMap((source2) => findConnection(source2, target2, dir));
4728
+ }),
4729
+ T(postFilter),
4730
+ applyPredicate(where)
4731
+ );
3890
4732
  break;
3891
4733
  }
3892
4734
  default: {
@@ -3899,7 +4741,8 @@ const DirectRelationPredicate = {
3899
4741
  connections = x(
3900
4742
  sources,
3901
4743
  u$1((s) => findConnectionsBetween(s, targets, dir)),
3902
- T((c) => isSource(c) && isTarget(c))
4744
+ T((c) => isSource(c) && isTarget(c)),
4745
+ applyPredicate(where)
3903
4746
  );
3904
4747
  }
3905
4748
  }
@@ -3912,72 +4755,64 @@ const DirectRelationPredicate = {
3912
4755
  }
3913
4756
  return stage;
3914
4757
  },
3915
- exclude: ({ expr, model, memory, stage }) => {
3916
- if (FqnExpr.isWildcard(expr.source) && FqnExpr.isWildcard(expr.target)) {
3917
- stage.excludeConnections(memory.connections);
3918
- return stage;
3919
- }
3920
- if (FqnExpr.isModelRef(expr.source) && FqnExpr.isModelRef(expr.target)) {
3921
- const toExclude2 = resolveRelationsBetweenModelElements({
3922
- source: expr.source,
3923
- target: expr.target,
3924
- expr,
3925
- model
3926
- });
3927
- return excludeModelRelations(toExclude2, { stage, memory });
3928
- }
3929
- if (FqnExpr.isModelRef(expr.source)) {
3930
- if (FqnExpr.isWildcard(expr.target)) {
3931
- const toExclude2 = resolveAllOutgoingRelations(model, expr.source);
3932
- return excludeModelRelations(toExclude2, { stage, memory });
3933
- }
3934
- const allOutgoing = resolveAllOutgoingRelations(model, expr.source);
3935
- const isTarget2 = deploymentExpressionToPredicate(expr.target);
3936
- return excludeModelRelations(
3937
- allOutgoing,
3938
- { stage, memory },
3939
- (c) => isTarget2(c.target)
3940
- );
3941
- }
3942
- if (FqnExpr.isModelRef(expr.target)) {
3943
- const toExclude2 = resolveAllImcomingRelations(model, expr.target);
3944
- const isSource2 = deploymentExpressionToPredicate(expr.source);
3945
- return excludeModelRelations(
3946
- toExclude2,
3947
- { stage, memory },
3948
- (c) => isSource2(c.source)
3949
- );
3950
- }
3951
- const isSource = deploymentExpressionToPredicate(expr.source);
4758
+ exclude: ({ expr, model, memory, stage, where }) => {
3952
4759
  const isTarget = deploymentExpressionToPredicate(expr.target);
3953
- const satisfies = (connection) => {
3954
- return isSource(connection.source) && isTarget(connection.target) || expr.isBidirectional && isSource(connection.target) && isTarget(connection.source);
3955
- };
3956
- const toExclude = memory.connections.filter(satisfies);
3957
- stage.excludeConnections(toExclude);
3958
- return stage;
4760
+ const isSource = deploymentExpressionToPredicate(expr.source);
4761
+ let modelRelationsToExclude;
4762
+ switch (true) {
4763
+ // * -> *
4764
+ case (FqnExpr.isWildcard(expr.source) && FqnExpr.isWildcard(expr.target)):
4765
+ stage.excludeConnections(applyPredicate(memory.connections, where));
4766
+ return stage;
4767
+ // model -> model
4768
+ case (FqnExpr.isModelRef(expr.source) && FqnExpr.isModelRef(expr.target)):
4769
+ modelRelationsToExclude = resolveRelationsBetweenModelElements({
4770
+ source: expr.source,
4771
+ target: expr.target,
4772
+ expr,
4773
+ model
4774
+ });
4775
+ return excludeModelRelations(modelRelationsToExclude, { stage, memory }, where);
4776
+ // model -> *
4777
+ case (FqnExpr.isModelRef(expr.source) && FqnExpr.isWildcard(expr.target)):
4778
+ modelRelationsToExclude = resolveAllOutgoingRelations(model, expr.source);
4779
+ return excludeModelRelations(modelRelationsToExclude, { stage, memory }, where);
4780
+ // model -> deployment
4781
+ case FqnExpr.isModelRef(expr.source):
4782
+ modelRelationsToExclude = resolveAllOutgoingRelations(model, expr.source);
4783
+ return excludeModelRelations(
4784
+ modelRelationsToExclude,
4785
+ { stage, memory },
4786
+ where,
4787
+ (c) => isTarget(c.target)
4788
+ );
4789
+ // deployment -> model
4790
+ case FqnExpr.isModelRef(expr.target):
4791
+ modelRelationsToExclude = resolveAllImcomingRelations(model, expr.target);
4792
+ return excludeModelRelations(
4793
+ modelRelationsToExclude,
4794
+ { stage, memory },
4795
+ where,
4796
+ (c) => isSource(c.source)
4797
+ );
4798
+ // deployment -> deployment
4799
+ default:
4800
+ const satisfies = (connection) => {
4801
+ return isSource(connection.source) && isTarget(connection.target) || expr.isBidirectional === true && isSource(connection.target) && isTarget(connection.source);
4802
+ };
4803
+ const deploymentRelationsToExclude = x(
4804
+ memory.connections,
4805
+ T(satisfies),
4806
+ applyPredicate(where)
4807
+ );
4808
+ if (deploymentRelationsToExclude.length === 0) {
4809
+ return stage;
4810
+ }
4811
+ stage.excludeConnections(deploymentRelationsToExclude);
4812
+ return stage;
4813
+ }
3959
4814
  }
3960
4815
  };
3961
- function excludeModelRelations(relationsToExclude, { stage, memory }, filterConnections = () => true) {
3962
- if (relationsToExclude.size === 0) {
3963
- return stage;
3964
- }
3965
- const toExclude = x(
3966
- memory.connections,
3967
- // Find connections that have at least one relation in common with the excluded relations
3968
- T((c) => filterConnections(c) && hasIntersection(c.relations.model, relationsToExclude)),
3969
- m$3(
3970
- (c) => c.update({
3971
- deployment: null,
3972
- model: intersection(c.relations.model, relationsToExclude)
3973
- })
3974
- )
3975
- );
3976
- if (toExclude.length === 0) {
3977
- return stage;
3978
- }
3979
- return stage.excludeConnections(toExclude);
3980
- }
3981
4816
  function resolveRelationsBetweenModelElements({
3982
4817
  source,
3983
4818
  target,
@@ -3986,78 +4821,13 @@ function resolveRelationsBetweenModelElements({
3986
4821
  }) {
3987
4822
  const sources = resolveModelElements(model, source);
3988
4823
  const targets = resolveModelElements(model, target);
3989
- const dir = expr.isBidirectional ? "both" : "directed";
3990
- const modelConnections = [];
3991
- for (const source2 of sources) {
3992
- modelConnections.push(...findConnectionsBetween$1(source2, targets, dir));
3993
- }
3994
- return new Set(modelConnections.flatMap((c) => [...c.relations]));
3995
- }
3996
-
3997
- const InOutRelationPredicate$1 = {
3998
- include: ({ expr, model, memory, stage }) => {
3999
- const sources = [...memory.elements];
4000
- if (FqnExpr.isWildcard(expr.inout)) {
4001
- for (const source of sources) {
4002
- const targets2 = [...resolveAscendingSiblings(source)];
4003
- stage.addConnections(findConnectionsBetween(source, targets2, "both"));
4004
- }
4005
- return stage;
4006
- }
4007
- invariant(FqnExpr.isDeploymentRef(expr.inout), "Only deployment refs are supported in include");
4008
- const targets = resolveElements$1(model, expr.inout);
4009
- for (const source of sources) {
4010
- stage.addConnections(findConnectionsBetween(source, targets, "both"));
4011
- }
4012
- return stage;
4013
- },
4014
- exclude: ({ expr, model, memory, stage }) => {
4015
- if (FqnExpr.isModelRef(expr.inout)) {
4016
- const elements2 = resolveModelElements(model, expr.inout);
4017
- if (elements2.length === 0) {
4018
- return stage;
4019
- }
4020
- const excludedRelations = union(
4021
- /* @__PURE__ */ new Set(),
4022
- ...elements2.flatMap((e) => [e.allIncoming, e.allOutgoing])
4023
- );
4024
- return excludeModelRelations(excludedRelations, { stage, memory });
4025
- }
4026
- if (FqnExpr.isWildcard(expr.inout)) {
4027
- return stage;
4028
- }
4029
- const elements = resolveElements$1(model, expr.inout);
4030
- const isIncoming = filterIncomingConnections(elements);
4031
- const isOutgoing = filterOutgoingConnections(elements);
4032
- const toExclude = memory.connections.filter((c) => isIncoming(c) !== isOutgoing(c));
4033
- stage.excludeConnections(toExclude);
4034
- return stage;
4035
- }
4036
- };
4037
-
4038
- const WildcardPredicate$1 = {
4039
- include: ({ model, stage }) => {
4040
- const children = [];
4041
- const rootElements = [...model.roots()].map((root) => {
4042
- if (!root.onlyOneInstance()) {
4043
- children.push(...root.children());
4044
- }
4045
- return root;
4046
- });
4047
- stage.addExplicit(rootElements);
4048
- if (children.length > 1) {
4049
- stage.addConnections(findConnectionsWithin([
4050
- ...rootElements,
4051
- ...children
4052
- ]));
4053
- }
4054
- return stage;
4055
- },
4056
- exclude: ({ stage, memory }) => {
4057
- stage.exclude(memory.elements);
4058
- return stage;
4824
+ const dir = expr.isBidirectional ? "both" : "directed";
4825
+ const modelConnections = [];
4826
+ for (const source2 of sources) {
4827
+ modelConnections.push(...findConnectionsBetween$1(source2, targets, dir));
4059
4828
  }
4060
- };
4829
+ return new Set(modelConnections.flatMap((c) => [...c.relations]));
4830
+ }
4061
4831
 
4062
4832
  let StageFinal$1 = class StageFinal {
4063
4833
  constructor(memory) {
@@ -4235,31 +5005,8 @@ function processPredicates$1(model, rules) {
4235
5005
  const exprs = rule.include ?? rule.exclude;
4236
5006
  for (const expr of exprs) {
4237
5007
  let stage = op === "include" ? memory.stageInclude(expr) : memory.stageExclude(expr);
4238
- const ctx = { model, stage, memory };
4239
- switch (true) {
4240
- case FqnExpr.isModelRef(expr):
4241
- break;
4242
- case FqnExpr.isDeploymentRef(expr):
4243
- stage = DeploymentRefPredicate[op]({ ...ctx, expr }) ?? stage;
4244
- break;
4245
- case FqnExpr.isWildcard(expr):
4246
- stage = WildcardPredicate$1[op]({ ...ctx, expr }) ?? stage;
4247
- break;
4248
- case RelationExpr.isDirect(expr):
4249
- stage = DirectRelationPredicate[op]({ ...ctx, expr }) ?? stage;
4250
- break;
4251
- case RelationExpr.isInOut(expr):
4252
- stage = InOutRelationPredicate$1[op]({ ...ctx, expr }) ?? stage;
4253
- break;
4254
- case RelationExpr.isOutgoing(expr):
4255
- stage = OutgoingRelationPredicate[op]({ ...ctx, expr }) ?? stage;
4256
- break;
4257
- case RelationExpr.isIncoming(expr):
4258
- stage = IncomingRelationPredicate[op]({ ...ctx, expr }) ?? stage;
4259
- break;
4260
- default:
4261
- nonexhaustive(expr);
4262
- }
5008
+ const ctx = { expr, model, stage, memory, where: null };
5009
+ stage = predicateToPatch(op, ctx) ?? stage;
4263
5010
  memory = stage.commit();
4264
5011
  }
4265
5012
  }
@@ -4273,7 +5020,7 @@ function computeDeploymentView(likec4model, {
4273
5020
  // exclude rules
4274
5021
  ...view
4275
5022
  }) {
4276
- let memory = processPredicates$1(likec4model.deployment, rules);
5023
+ const memory = processPredicates$1(likec4model.deployment, rules);
4277
5024
  const nodesMap = buildNodes$1(memory);
4278
5025
  const computedEdges = toComputedEdges$1(memory.connections);
4279
5026
  linkNodesWithEdges(nodesMap, computedEdges);
@@ -4330,7 +5077,7 @@ function applyCustomElementProperties(_rules, _nodes) {
4330
5077
  for (const {
4331
5078
  custom: { expr, ...props }
4332
5079
  } of rules) {
4333
- const { border, opacity, ...rest } = d$2(props, n$4);
5080
+ const { border, opacity, ...rest } = d$1(props, n$4);
4334
5081
  const notEmpty = !n(rest);
4335
5082
  const satisfies = elementExprToPredicate(expr);
4336
5083
  nodes.forEach((node, i) => {
@@ -4440,7 +5187,7 @@ class DynamicViewCompute {
4440
5187
  line,
4441
5188
  notation
4442
5189
  } = this.findRelations(source, target);
4443
- const navigateTo = n$1(stepNavigateTo) && stepNavigateTo !== this.view.id ? stepNavigateTo : derivedNavigateTo;
5190
+ const navigateTo = n$2(stepNavigateTo) && stepNavigateTo !== this.view.id ? stepNavigateTo : derivedNavigateTo;
4444
5191
  this.steps.push({
4445
5192
  id,
4446
5193
  ...step,
@@ -4584,7 +5331,7 @@ class DynamicViewCompute {
4584
5331
  const alltags = x(
4585
5332
  relationships,
4586
5333
  u$1((r) => r.tags),
4587
- T(n$1),
5334
+ T(n$2),
4588
5335
  i$8()
4589
5336
  );
4590
5337
  const tags = i$9(alltags, 1) ? alltags : null;
@@ -4594,7 +5341,7 @@ class DynamicViewCompute {
4594
5341
  const navigateTo = relationNavigateTo && relationNavigateTo !== this.view.id ? relationNavigateTo : x(
4595
5342
  relationships,
4596
5343
  m$3((r) => r.$relationship.navigateTo),
4597
- T(n$1),
5344
+ T(n$2),
4598
5345
  T((v) => v !== this.view.id),
4599
5346
  i$8(),
4600
5347
  t$2()
@@ -4602,11 +5349,11 @@ class DynamicViewCompute {
4602
5349
  const commonProperties = x(
4603
5350
  relationships,
4604
5351
  l$5((acc, { title, $relationship: r }) => {
4605
- n$1(title) && acc.title.add(title);
4606
- n$1(r.tail) && acc.tail.add(r.tail);
4607
- n$1(r.head) && acc.head.add(r.head);
4608
- n$1(r.color) && acc.color.add(r.color);
4609
- n$1(r.line) && acc.line.add(r.line);
5352
+ n$2(title) && acc.title.add(title);
5353
+ n$2(r.tail) && acc.tail.add(r.tail);
5354
+ n$2(r.head) && acc.head.add(r.head);
5355
+ n$2(r.color) && acc.color.add(r.color);
5356
+ n$2(r.line) && acc.line.add(r.line);
4610
5357
  return acc;
4611
5358
  }, {
4612
5359
  tail: /* @__PURE__ */ new Set(),
@@ -4639,7 +5386,12 @@ function relationExpressionToPredicates(expr) {
4639
5386
  case isRelationWhere(expr): {
4640
5387
  const predicate = relationExpressionToPredicates(expr.where.expr);
4641
5388
  const where = whereOperatorAsPredicate(expr.where.condition);
4642
- return (e) => predicate(e) && where(e);
5389
+ return (e) => predicate(e) && where({
5390
+ source: { tags: e.source.tags, kind: e.source.kind },
5391
+ target: { tags: e.target.tags, kind: e.target.kind },
5392
+ ...e.tags && { tags: e.tags },
5393
+ ...e.kind && { kind: e.kind }
5394
+ });
4643
5395
  }
4644
5396
  case isRelation(expr): {
4645
5397
  const isSource = elementExprToPredicate(expr.source);
@@ -4674,7 +5426,7 @@ function applyCustomRelationProperties(_rules, nodes, _edges) {
4674
5426
  for (const {
4675
5427
  customRelation: { relation, title, ...customprops }
4676
5428
  } of rules) {
4677
- const props = d$2(customprops, n$4);
5429
+ const props = d$1(customprops, n$4);
4678
5430
  const satisfies = relationExpressionToPredicates(relation);
4679
5431
  edges.forEach((edge, i) => {
4680
5432
  const source = nodes.find((n) => n.id === edge.source);
@@ -4682,7 +5434,7 @@ function applyCustomRelationProperties(_rules, nodes, _edges) {
4682
5434
  if (!source || !target) {
4683
5435
  return;
4684
5436
  }
4685
- if (satisfies({ source, target, ...i$7(edge, ["kind", "tags"]) })) {
5437
+ if (satisfies({ source, target, ...i$6(edge, ["kind", "tags"]) })) {
4686
5438
  edges[i] = {
4687
5439
  ...edge,
4688
5440
  ...props,
@@ -4695,229 +5447,6 @@ function applyCustomRelationProperties(_rules, nodes, _edges) {
4695
5447
  return edges;
4696
5448
  }
4697
5449
 
4698
- /**
4699
- * Mnemonist Stack
4700
- * ================
4701
- *
4702
- * Stack implementation relying on JavaScript arrays, which are fast enough &
4703
- * correctly optimized for this kind of work.
4704
- */
4705
-
4706
- var stack;
4707
- var hasRequiredStack;
4708
-
4709
- function requireStack () {
4710
- if (hasRequiredStack) return stack;
4711
- hasRequiredStack = 1;
4712
- var Iterator = requireIterator(),
4713
- forEach = requireForeach();
4714
-
4715
- /**
4716
- * Stack
4717
- *
4718
- * @constructor
4719
- */
4720
- function Stack() {
4721
- this.clear();
4722
- }
4723
-
4724
- /**
4725
- * Method used to clear the stack.
4726
- *
4727
- * @return {undefined}
4728
- */
4729
- Stack.prototype.clear = function() {
4730
-
4731
- // Properties
4732
- this.items = [];
4733
- this.size = 0;
4734
- };
4735
-
4736
- /**
4737
- * Method used to add an item to the stack.
4738
- *
4739
- * @param {any} item - Item to add.
4740
- * @return {number}
4741
- */
4742
- Stack.prototype.push = function(item) {
4743
- this.items.push(item);
4744
- return ++this.size;
4745
- };
4746
-
4747
- /**
4748
- * Method used to retrieve & remove the last item of the stack.
4749
- *
4750
- * @return {any}
4751
- */
4752
- Stack.prototype.pop = function() {
4753
- if (this.size === 0)
4754
- return;
4755
-
4756
- this.size--;
4757
- return this.items.pop();
4758
- };
4759
-
4760
- /**
4761
- * Method used to get the last item of the stack.
4762
- *
4763
- * @return {any}
4764
- */
4765
- Stack.prototype.peek = function() {
4766
- return this.items[this.size - 1];
4767
- };
4768
-
4769
- /**
4770
- * Method used to iterate over the stack.
4771
- *
4772
- * @param {function} callback - Function to call for each item.
4773
- * @param {object} scope - Optional scope.
4774
- * @return {undefined}
4775
- */
4776
- Stack.prototype.forEach = function(callback, scope) {
4777
- scope = arguments.length > 1 ? scope : this;
4778
-
4779
- for (var i = 0, l = this.items.length; i < l; i++)
4780
- callback.call(scope, this.items[l - i - 1], i, this);
4781
- };
4782
-
4783
- /**
4784
- * Method used to convert the stack to a JavaScript array.
4785
- *
4786
- * @return {array}
4787
- */
4788
- Stack.prototype.toArray = function() {
4789
- var array = new Array(this.size),
4790
- l = this.size - 1,
4791
- i = this.size;
4792
-
4793
- while (i--)
4794
- array[i] = this.items[l - i];
4795
-
4796
- return array;
4797
- };
4798
-
4799
- /**
4800
- * Method used to create an iterator over a stack's values.
4801
- *
4802
- * @return {Iterator}
4803
- */
4804
- Stack.prototype.values = function() {
4805
- var items = this.items,
4806
- l = items.length,
4807
- i = 0;
4808
-
4809
- return new Iterator(function() {
4810
- if (i >= l)
4811
- return {
4812
- done: true
4813
- };
4814
-
4815
- var value = items[l - i - 1];
4816
- i++;
4817
-
4818
- return {
4819
- value: value,
4820
- done: false
4821
- };
4822
- });
4823
- };
4824
-
4825
- /**
4826
- * Method used to create an iterator over a stack's entries.
4827
- *
4828
- * @return {Iterator}
4829
- */
4830
- Stack.prototype.entries = function() {
4831
- var items = this.items,
4832
- l = items.length,
4833
- i = 0;
4834
-
4835
- return new Iterator(function() {
4836
- if (i >= l)
4837
- return {
4838
- done: true
4839
- };
4840
-
4841
- var value = items[l - i - 1];
4842
-
4843
- return {
4844
- value: [i++, value],
4845
- done: false
4846
- };
4847
- });
4848
- };
4849
-
4850
- /**
4851
- * Attaching the #.values method to Symbol.iterator if possible.
4852
- */
4853
- if (typeof Symbol !== 'undefined')
4854
- Stack.prototype[Symbol.iterator] = Stack.prototype.values;
4855
-
4856
-
4857
- /**
4858
- * Convenience known methods.
4859
- */
4860
- Stack.prototype.toString = function() {
4861
- return this.toArray().join(',');
4862
- };
4863
-
4864
- Stack.prototype.toJSON = function() {
4865
- return this.toArray();
4866
- };
4867
-
4868
- Stack.prototype.inspect = function() {
4869
- var array = this.toArray();
4870
-
4871
- // Trick so that node displays the name of the constructor
4872
- Object.defineProperty(array, 'constructor', {
4873
- value: Stack,
4874
- enumerable: false
4875
- });
4876
-
4877
- return array;
4878
- };
4879
-
4880
- if (typeof Symbol !== 'undefined')
4881
- Stack.prototype[Symbol.for('nodejs.util.inspect.custom')] = Stack.prototype.inspect;
4882
-
4883
- /**
4884
- * Static @.from function taking an arbitrary iterable & converting it into
4885
- * a stack.
4886
- *
4887
- * @param {Iterable} iterable - Target iterable.
4888
- * @return {Stack}
4889
- */
4890
- Stack.from = function(iterable) {
4891
- var stack = new Stack();
4892
-
4893
- forEach(iterable, function(value) {
4894
- stack.push(value);
4895
- });
4896
-
4897
- return stack;
4898
- };
4899
-
4900
- /**
4901
- * Static @.of function taking an arbitrary number of arguments & converting it
4902
- * into a stack.
4903
- *
4904
- * @param {...any} args
4905
- * @return {Stack}
4906
- */
4907
- Stack.of = function() {
4908
- return Stack.from(arguments);
4909
- };
4910
-
4911
- /**
4912
- * Exporting.
4913
- */
4914
- stack = Stack;
4915
- return stack;
4916
- }
4917
-
4918
- var stackExports = requireStack();
4919
- const Stack = /*@__PURE__*/getDefaultExportFromCjs(stackExports);
4920
-
4921
5450
  class NodesGroup {
4922
5451
  constructor(id, viewRule, parent = null, elements = /* @__PURE__ */ new Set()) {
4923
5452
  this.id = id;
@@ -5488,7 +6017,11 @@ function toComputedEdges(connections) {
5488
6017
  ...props
5489
6018
  } = mergePropsFromRelationships(
5490
6019
  relations.map((r) => r.$relationship),
5491
- relations.find((r) => r.source.id === source && r.target.id === target)?.$relationship
6020
+ // Prefer only single relationship
6021
+ // https://github.com/likec4/likec4/issues/1423
6022
+ t$2(
6023
+ T(relations, (r) => r.source.id === source && r.target.id === target)
6024
+ )?.$relationship
5492
6025
  );
5493
6026
  const edge = {
5494
6027
  id: e.id,
@@ -5556,7 +6089,7 @@ const DirectRelationExprPredicate = {
5556
6089
  ifilter(where),
5557
6090
  iunique(),
5558
6091
  toArray(),
5559
- d$1((r) => r.source === source2),
6092
+ d$3((r) => r.source === source2),
5560
6093
  ([outgoing, incoming]) => a(
5561
6094
  x(
5562
6095
  outgoing,
@@ -5611,7 +6144,7 @@ const DirectRelationExprPredicate = {
5611
6144
  }),
5612
6145
  ifilter(where),
5613
6146
  toArray(),
5614
- d$1((r) => r.target === target2),
6147
+ d$3((r) => r.target === target2),
5615
6148
  ([incoming, outgoing]) => a(
5616
6149
  x(
5617
6150
  outgoing,
@@ -5678,7 +6211,7 @@ const DirectRelationExprPredicate = {
5678
6211
  case (sourceIsWildcard && targetIsWildcard): {
5679
6212
  relations = x(
5680
6213
  memory.connections,
5681
- u$1(i$5(
6214
+ u$1(i$4(
5682
6215
  p$1("relations"),
5683
6216
  ifilter(where),
5684
6217
  toArray()
@@ -6718,6 +7251,9 @@ class RelationshipModel {
6718
7251
  get tags() {
6719
7252
  return this.$relationship.tags ?? [];
6720
7253
  }
7254
+ get kind() {
7255
+ return this.$relationship.kind ?? null;
7256
+ }
6721
7257
  get links() {
6722
7258
  return this.$relationship.links ?? [];
6723
7259
  }
@@ -6732,6 +7268,9 @@ class RelationshipModel {
6732
7268
  }
6733
7269
  return;
6734
7270
  }
7271
+ isDeploymentRelation() {
7272
+ return false;
7273
+ }
6735
7274
  }
6736
7275
 
6737
7276
  class EdgeModel {
@@ -6826,6 +7365,9 @@ class NodeModel {
6826
7365
  get color() {
6827
7366
  return this.$node.color;
6828
7367
  }
7368
+ get icon() {
7369
+ return this.$node.icon ?? null;
7370
+ }
6829
7371
  get tags() {
6830
7372
  return this.$node.tags ?? [];
6831
7373
  }
@@ -7042,6 +7584,10 @@ class LikeC4ViewModel {
7042
7584
  findNode(node) {
7043
7585
  return this.#nodes.get(getId(node)) ?? null;
7044
7586
  }
7587
+ findNodeWithElement(fqn) {
7588
+ const nd = ifind(this.#nodes.values(), (node) => node.element?.id === fqn) ?? null;
7589
+ return nd && nd.hasElement() ? nd : null;
7590
+ }
7045
7591
  /**
7046
7592
  * Iterate over all nodes.
7047
7593
  */
@@ -7281,7 +7827,7 @@ class LikeC4Model {
7281
7827
  return nonNullable(this.#views.get(viewId), `View ${viewId} not found`);
7282
7828
  }
7283
7829
  findView(viewId) {
7284
- return nonNullable(this.#views.get(viewId), `View ${viewId} not found`);
7830
+ return this.#views.get(viewId) ?? null;
7285
7831
  }
7286
7832
  /**
7287
7833
  * Returns the parent element of given element.
@@ -7433,11 +7979,4 @@ class LikeC4Model {
7433
7979
  }
7434
7980
  }
7435
7981
 
7436
- function isDeploymentNode(model) {
7437
- return model.isDeploymentNode();
7438
- }
7439
- function isDeployedInstance(model) {
7440
- return model.isInstance();
7441
- }
7442
-
7443
- export { sortConnectionsByBoundaryHierarchy as A, sortDeepestFirst as B, Connection as C, DeploymentConnectionModel as D, ElementModel as E, DeployedInstanceModel as F, Graph as G, DeploymentNodeModel as H, DeploymentRelationModel as I, EdgeModel as J, isDeployedInstance as K, LikeC4Model as L, isDeploymentNode as M, NodeModel as N, RelationshipModel as R, computeViews as a, LikeC4DeploymentModel as b, computeView as c, d$3 as d, LikeC4ViewModel as e, ConnectionModel as f, find as g, differenceConnections as h, i$3 as i, findAscendingConnections as j, findDeepestNestedConnection as k, l$3 as l, findDescendantConnections as m, hasSameSource as n, hasSameSourceTarget as o, hasSameTarget as p, isAnyInOut as q, r$3 as r, isIncoming as s, topologicalSortExports as t, unsafeComputeView as u, isNestedConnection as v, willCreateCycle as w, isOutgoing as x, mergeConnections as y, find$1 as z };
7982
+ export { isOutgoing as A, mergeConnections as B, Connection as C, DefaultMap as D, ElementModel as E, find$1 as F, Graph as G, sortConnectionsByBoundaryHierarchy as H, sortDeepestFirst as I, DeployedInstanceModel as J, DeploymentNodeModel as K, LikeC4Model as L, DeploymentRelationModel as M, EdgeModel as N, NodeModel as O, isDeployedInstance as P, isDeploymentNode as Q, RelationshipModel as R, Stack as S, computeViews as a, requireIterator as b, computeView as c, d$2 as d, requireForeach as e, LikeC4DeploymentModel as f, LikeC4ViewModel as g, ConnectionModel as h, i$3 as i, find as j, DeploymentConnectionModel as k, l$3 as l, differenceConnections as m, findAscendingConnections as n, findDeepestNestedConnection as o, findDescendantConnections as p, hasSameSource as q, r$3 as r, hasSameSourceTarget as s, topologicalSortExports as t, unsafeComputeView as u, hasSameTarget as v, willCreateCycle as w, isAnyInOut as x, isIncoming as y, isNestedConnection as z };