@prefecthq/prefab-ui-docs 0.16.3 → 0.18.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 (66) hide show
  1. package/dist/_renderer/_basePickBy-fiErwOTY.mjs +151 -0
  2. package/dist/_renderer/_baseUniq-Iy7gOYgw.mjs +614 -0
  3. package/dist/_renderer/arc-BYm2F1-h.mjs +83 -0
  4. package/dist/_renderer/architectureDiagram-2XIMDMQ5-BKR0-ZSX.mjs +4683 -0
  5. package/dist/_renderer/band-TE_TbDmh.mjs +56 -0
  6. package/dist/_renderer/blockDiagram-WCTKOSBZ-BruGG_9M.mjs +2298 -0
  7. package/dist/_renderer/c4Diagram-IC4MRINW-K4nxeBNU.mjs +1581 -0
  8. package/dist/_renderer/channel-D4_UYSAN.mjs +5 -0
  9. package/dist/_renderer/charts-CPJdqwrq.mjs +19182 -0
  10. package/dist/_renderer/chunk-4BX2VUAB-mqLb5fm9.mjs +9 -0
  11. package/dist/_renderer/chunk-55IACEB6-Bxgi9T70.mjs +8 -0
  12. package/dist/_renderer/chunk-FMBD7UC4-Dsah75wQ.mjs +19 -0
  13. package/dist/_renderer/chunk-JSJVCQXG-Bsg6dsjU.mjs +68 -0
  14. package/dist/_renderer/chunk-KX2RTZJC-DvDXsxvC.mjs +20 -0
  15. package/dist/_renderer/chunk-NQ4KR5QH-CwFlbBfF.mjs +1384 -0
  16. package/dist/_renderer/chunk-QZHKN3VN-CYPyScRI.mjs +15 -0
  17. package/dist/_renderer/chunk-WL4C6EOR-2eYOPJVd.mjs +1430 -0
  18. package/dist/_renderer/classDiagram-VBA2DB6C-Dj8h8-wl.mjs +16 -0
  19. package/dist/_renderer/classDiagram-v2-RAHNMMFH-Dj8h8-wl.mjs +16 -0
  20. package/dist/_renderer/clone-BmajYOc3.mjs +8 -0
  21. package/dist/_renderer/{compound-calendar-Cn18AoRs.mjs → compound-calendar-8CggRUlt.mjs} +3 -3
  22. package/dist/_renderer/{content-e43PvxaF.mjs → content-BPYMcbeG.mjs} +6 -6
  23. package/dist/_renderer/cose-bilkent-S5V4N54A-BLhD0lt7.mjs +2609 -0
  24. package/dist/_renderer/cytoscape.esm-CjI2IsL8.mjs +18735 -0
  25. package/dist/_renderer/dagre-KLK3FWXG-DCIde85z.mjs +447 -0
  26. package/dist/_renderer/defaultLocale-BgPVtth8.mjs +171 -0
  27. package/dist/_renderer/diagram-E7M64L7V-BbWs-jbo.mjs +533 -0
  28. package/dist/_renderer/diagram-IFDJBPK2-Sfx8kanl.mjs +221 -0
  29. package/dist/_renderer/diagram-P4PSJMXO-DCqYaW3Z.mjs +143 -0
  30. package/dist/_renderer/{embed-DRE2wKZJ.mjs → embed-hOWEFnqe.mjs} +4474 -4439
  31. package/dist/_renderer/embed.mjs +1 -1
  32. package/dist/_renderer/erDiagram-INFDFZHY-D8cdLSCi.mjs +863 -0
  33. package/dist/_renderer/flowDiagram-PKNHOUZH-B_rW2Xww.mjs +1647 -0
  34. package/dist/_renderer/ganttDiagram-A5KZAMGK-Be_Svnat.mjs +1964 -0
  35. package/dist/_renderer/gitGraphDiagram-K3NZZRJ6--wMgYsSv.mjs +709 -0
  36. package/dist/_renderer/graph-alLjIojU.mjs +604 -0
  37. package/dist/_renderer/{icons-CImNZgDa.mjs → icons-w8tvN_30.mjs} +155 -135
  38. package/dist/_renderer/infoDiagram-LFFYTUFH-QW1PzgNF.mjs +24 -0
  39. package/dist/_renderer/init-DxzjmxYy.mjs +32 -0
  40. package/dist/_renderer/ishikawaDiagram-PHBUUO56-xY8fsGh3.mjs +621 -0
  41. package/dist/_renderer/journeyDiagram-4ABVD52K-7XeHSH9G.mjs +834 -0
  42. package/dist/_renderer/kanban-definition-K7BYSVSG-Cn7INDI0.mjs +723 -0
  43. package/dist/_renderer/katex-AQJr8RMF.mjs +11623 -0
  44. package/dist/_renderer/layout-Bspk8k85.mjs +1335 -0
  45. package/dist/_renderer/linear-CVnzSbdA.mjs +275 -0
  46. package/dist/_renderer/mermaid-C_GnErbP.mjs +48 -0
  47. package/dist/_renderer/mermaid.core-BzbdT8_O.mjs +13838 -0
  48. package/dist/_renderer/mindmap-definition-YRQLILUH-CVIMKVZI.mjs +788 -0
  49. package/dist/_renderer/ordinal-Bq0KrZxK.mjs +62 -0
  50. package/dist/_renderer/pieDiagram-SKSYHLDU-CL_luPJM.mjs +162 -0
  51. package/dist/_renderer/{svg-BL0kMZ_p.mjs → purify.es-M2Bspgo5.mjs} +222 -240
  52. package/dist/_renderer/quadrantDiagram-337W2JSQ-BQWFWFNU.mjs +1024 -0
  53. package/dist/_renderer/requirementDiagram-Z7DCOOCP-Di29RxJ6.mjs +862 -0
  54. package/dist/_renderer/sankeyDiagram-WA2Y5GQK-DY4kgDbR.mjs +810 -0
  55. package/dist/_renderer/sequenceDiagram-2WXFIKYE-vjbD37pn.mjs +2823 -0
  56. package/dist/_renderer/stateDiagram-RAJIS63D-BQ9BAuO6.mjs +264 -0
  57. package/dist/_renderer/stateDiagram-v2-FVOUBMTO-Bs26kEor.mjs +16 -0
  58. package/dist/_renderer/string-kGvNrjOo.mjs +934 -0
  59. package/dist/_renderer/svg-BTtf8EdH.mjs +22 -0
  60. package/dist/_renderer/time-sQ_UKgU4.mjs +765 -0
  61. package/dist/_renderer/timeline-definition-YZTLITO2-CJfaRgME.mjs +799 -0
  62. package/dist/_renderer/treemap-KZPCXAKY-DQq6TCTm.mjs +17996 -0
  63. package/dist/_renderer/vennDiagram-LZ73GAT5-BkBksHrj.mjs +1564 -0
  64. package/dist/_renderer/xychartDiagram-JWTSCODW-Boo1R-nF.mjs +1299 -0
  65. package/package.json +1 -1
  66. package/dist/_renderer/charts-Dr57vKmb.mjs +0 -21311
@@ -0,0 +1,604 @@
1
+ import { ac as N, ad as j, ae as f, af as b, ag as E } from "./mermaid.core-BzbdT8_O.mjs";
2
+ import { a as v, c as P, k as _, f as g, d, i as l, v as p, r as D } from "./_baseUniq-Iy7gOYgw.mjs";
3
+ var w = N(function(o) {
4
+ return v(P(o, 1, j, !0));
5
+ }), F = "\0", a = "\0", O = "";
6
+ class L {
7
+ /**
8
+ * @param {GraphOptions} [opts] - Graph options.
9
+ */
10
+ constructor(e = {}) {
11
+ this._isDirected = Object.prototype.hasOwnProperty.call(e, "directed") ? e.directed : !0, this._isMultigraph = Object.prototype.hasOwnProperty.call(e, "multigraph") ? e.multigraph : !1, this._isCompound = Object.prototype.hasOwnProperty.call(e, "compound") ? e.compound : !1, this._label = void 0, this._defaultNodeLabelFn = f(void 0), this._defaultEdgeLabelFn = f(void 0), this._nodes = {}, this._isCompound && (this._parent = {}, this._children = {}, this._children[a] = {}), this._in = {}, this._preds = {}, this._out = {}, this._sucs = {}, this._edgeObjs = {}, this._edgeLabels = {};
12
+ }
13
+ /* === Graph functions ========= */
14
+ /**
15
+ *
16
+ * @returns {boolean} `true` if the graph is [directed](https://en.wikipedia.org/wiki/Directed_graph).
17
+ * A directed graph treats the order of nodes in an edge as significant whereas an
18
+ * [undirected](https://en.wikipedia.org/wiki/Graph_(mathematics)#Undirected_graph)
19
+ * graph does not.
20
+ * This example demonstrates the difference:
21
+ *
22
+ * @example
23
+ *
24
+ * ```js
25
+ * var directed = new Graph({ directed: true });
26
+ * directed.setEdge("a", "b", "my-label");
27
+ * directed.edge("a", "b"); // returns "my-label"
28
+ * directed.edge("b", "a"); // returns undefined
29
+ *
30
+ * var undirected = new Graph({ directed: false });
31
+ * undirected.setEdge("a", "b", "my-label");
32
+ * undirected.edge("a", "b"); // returns "my-label"
33
+ * undirected.edge("b", "a"); // returns "my-label"
34
+ * ```
35
+ */
36
+ isDirected() {
37
+ return this._isDirected;
38
+ }
39
+ /**
40
+ * @returns {boolean} `true` if the graph is a multigraph.
41
+ */
42
+ isMultigraph() {
43
+ return this._isMultigraph;
44
+ }
45
+ /**
46
+ * @returns {boolean} `true` if the graph is compound.
47
+ */
48
+ isCompound() {
49
+ return this._isCompound;
50
+ }
51
+ /**
52
+ * Sets the label for the graph to `label`.
53
+ *
54
+ * @param {GraphLabel} label - Label for the graph.
55
+ * @returns {this}
56
+ */
57
+ setGraph(e) {
58
+ return this._label = e, this;
59
+ }
60
+ /**
61
+ * @returns {GraphLabel | undefined} the currently assigned label for the graph.
62
+ * If no label has been assigned, returns `undefined`.
63
+ *
64
+ * @example
65
+ *
66
+ * ```js
67
+ * var g = new Graph();
68
+ * g.graph(); // returns undefined
69
+ * g.setGraph("graph-label");
70
+ * g.graph(); // returns "graph-label"
71
+ * ```
72
+ */
73
+ graph() {
74
+ return this._label;
75
+ }
76
+ /* === Node functions ========== */
77
+ /**
78
+ * Sets a new default value that is assigned to nodes that are created without
79
+ * a label.
80
+ *
81
+ * @param {typeof this._defaultNodeLabelFn | NodeLabel} newDefault - If a function,
82
+ * it is called with the id of the node being created.
83
+ * Otherwise, it is assigned as the label directly.
84
+ * @returns {this}
85
+ */
86
+ setDefaultNodeLabel(e) {
87
+ return b(e) || (e = f(e)), this._defaultNodeLabelFn = e, this;
88
+ }
89
+ /**
90
+ * @returns {number} the number of nodes in the graph.
91
+ */
92
+ nodeCount() {
93
+ return this._nodeCount;
94
+ }
95
+ /**
96
+ * @returns {NodeID[]} the ids of the nodes in the graph.
97
+ *
98
+ * @remarks
99
+ * Use {@link node()} to get the label for each node.
100
+ * Takes `O(|V|)` time.
101
+ */
102
+ nodes() {
103
+ return _(this._nodes);
104
+ }
105
+ /**
106
+ * @returns {NodeID[]} those nodes in the graph that have no in-edges.
107
+ * @remarks Takes `O(|V|)` time.
108
+ */
109
+ sources() {
110
+ var e = this;
111
+ return g(this.nodes(), function(t) {
112
+ return E(e._in[t]);
113
+ });
114
+ }
115
+ /**
116
+ * @returns {NodeID[]} those nodes in the graph that have no out-edges.
117
+ * @remarks Takes `O(|V|)` time.
118
+ */
119
+ sinks() {
120
+ var e = this;
121
+ return g(this.nodes(), function(t) {
122
+ return E(e._out[t]);
123
+ });
124
+ }
125
+ /**
126
+ * Invokes setNode method for each node in `vs` list.
127
+ *
128
+ * @param {Collection<NodeID | number>} vs - List of node IDs to create/set.
129
+ * @param {NodeLabel} [value] - If set, update all nodes with this value.
130
+ * @returns {this}
131
+ * @remarks Complexity: O(|names|).
132
+ */
133
+ setNodes(e, t) {
134
+ var s = arguments, i = this;
135
+ return d(e, function(r) {
136
+ s.length > 1 ? i.setNode(r, t) : i.setNode(r);
137
+ }), this;
138
+ }
139
+ /**
140
+ * Creates or updates the value for the node `v` in the graph.
141
+ *
142
+ * @param {NodeID | number} v - ID of the node to create/set.
143
+ * @param {NodeLabel} [value] - If supplied, it is set as the value for the node.
144
+ * If not supplied and the node was created by this call then
145
+ * {@link setDefaultNodeLabel} will be used to set the node's value.
146
+ * @returns {this} the graph, allowing this to be chained with other functions.
147
+ * @remarks Takes `O(1)` time.
148
+ */
149
+ setNode(e, t) {
150
+ return Object.prototype.hasOwnProperty.call(this._nodes, e) ? (arguments.length > 1 && (this._nodes[e] = t), this) : (this._nodes[e] = arguments.length > 1 ? t : this._defaultNodeLabelFn(e), this._isCompound && (this._parent[e] = a, this._children[e] = {}, this._children[a][e] = !0), this._in[e] = {}, this._preds[e] = {}, this._out[e] = {}, this._sucs[e] = {}, ++this._nodeCount, this);
151
+ }
152
+ /**
153
+ * Gets the label of node with specified name.
154
+ *
155
+ * @param {NodeID | number} v - Node ID.
156
+ * @returns {NodeLabel | undefined} the label assigned to the node with the id `v`
157
+ * if it is in the graph.
158
+ * Otherwise returns `undefined`.
159
+ * @remarks Takes `O(1)` time.
160
+ */
161
+ node(e) {
162
+ return this._nodes[e];
163
+ }
164
+ /**
165
+ * Detects whether graph has a node with specified name or not.
166
+ *
167
+ * @param {NodeID | number} v - Node ID.
168
+ * @returns {boolean} Returns `true` the graph has a node with the id.
169
+ * @remarks Takes `O(1)` time.
170
+ */
171
+ hasNode(e) {
172
+ return Object.prototype.hasOwnProperty.call(this._nodes, e);
173
+ }
174
+ /**
175
+ * Remove the node with the id `v` in the graph or do nothing if the node is
176
+ * not in the graph.
177
+ *
178
+ * If the node was removed this function also removes any incident edges.
179
+ *
180
+ * @param {NodeID | number} v - Node ID to remove.
181
+ * @returns {this} the graph, allowing this to be chained with other functions.
182
+ * @remarks Takes `O(|E|)` time.
183
+ */
184
+ removeNode(e) {
185
+ if (Object.prototype.hasOwnProperty.call(this._nodes, e)) {
186
+ var t = (s) => this.removeEdge(this._edgeObjs[s]);
187
+ delete this._nodes[e], this._isCompound && (this._removeFromParentsChildList(e), delete this._parent[e], d(this.children(e), (s) => {
188
+ this.setParent(s);
189
+ }), delete this._children[e]), d(_(this._in[e]), t), delete this._in[e], delete this._preds[e], d(_(this._out[e]), t), delete this._out[e], delete this._sucs[e], --this._nodeCount;
190
+ }
191
+ return this;
192
+ }
193
+ /**
194
+ * Sets the parent for `v` to `parent` if it is defined or removes the parent
195
+ * for `v` if `parent` is undefined.
196
+ *
197
+ * @param {NodeID | number} v - Node ID to set the parent for.
198
+ * @param {NodeID | number} [parent] - Parent node ID. If not defined, removes the parent.
199
+ * @returns {this} the graph, allowing this to be chained with other functions.
200
+ * @throws if the graph is not compound.
201
+ * @throws if setting the parent would create a cycle.
202
+ * @remarks Takes `O(1)` time.
203
+ */
204
+ setParent(e, t) {
205
+ if (!this._isCompound)
206
+ throw new Error("Cannot set parent in a non-compound graph");
207
+ if (l(t))
208
+ t = a;
209
+ else {
210
+ t += "";
211
+ for (var s = t; !l(s); s = this.parent(s))
212
+ if (s === e)
213
+ throw new Error("Setting " + t + " as parent of " + e + " would create a cycle");
214
+ this.setNode(t);
215
+ }
216
+ return this.setNode(e), this._removeFromParentsChildList(e), this._parent[e] = t, this._children[t][e] = !0, this;
217
+ }
218
+ /**
219
+ * @private
220
+ * @param {NodeID | number} v - Node ID.
221
+ */
222
+ _removeFromParentsChildList(e) {
223
+ delete this._children[this._parent[e]][e];
224
+ }
225
+ /**
226
+ * Get parent node for node `v`.
227
+ *
228
+ * @param {NodeID | number} v - Node ID.
229
+ * @returns {NodeID | undefined} the node that is a parent of node `v`
230
+ * or `undefined` if node `v` does not have a parent or is not a member of
231
+ * the graph.
232
+ * Always returns `undefined` for graphs that are not compound.
233
+ * @remarks Takes `O(1)` time.
234
+ */
235
+ parent(e) {
236
+ if (this._isCompound) {
237
+ var t = this._parent[e];
238
+ if (t !== a)
239
+ return t;
240
+ }
241
+ }
242
+ /**
243
+ * Gets list of direct children of node v.
244
+ *
245
+ * @param {NodeID | number} [v] - Node ID. If not specified, gets nodes
246
+ * with no parent (top-level nodes).
247
+ * @returns {NodeID[] | undefined} all nodes that are children of node `v` or
248
+ * `undefined` if node `v` is not in the graph.
249
+ * Always returns `[]` for graphs that are not compound.
250
+ * @remarks Takes `O(|V|)` time.
251
+ */
252
+ children(e) {
253
+ if (l(e) && (e = a), this._isCompound) {
254
+ var t = this._children[e];
255
+ if (t)
256
+ return _(t);
257
+ } else {
258
+ if (e === a)
259
+ return this.nodes();
260
+ if (this.hasNode(e))
261
+ return [];
262
+ }
263
+ }
264
+ /**
265
+ * @param {NodeID | number} v - Node ID.
266
+ * @returns {NodeID[] | undefined} all nodes that are predecessors of the
267
+ * specified node or `undefined` if node `v` is not in the graph.
268
+ * @remarks
269
+ * Behavior is undefined for undirected graphs - use {@link neighbors} instead.
270
+ * Takes `O(|V|)` time.
271
+ */
272
+ predecessors(e) {
273
+ var t = this._preds[e];
274
+ if (t)
275
+ return _(t);
276
+ }
277
+ /**
278
+ * @param {NodeID | number} v - Node ID.
279
+ * @returns {NodeID[] | undefined} all nodes that are successors of the
280
+ * specified node or `undefined` if node `v` is not in the graph.
281
+ * @remarks
282
+ * Behavior is undefined for undirected graphs - use {@link neighbors} instead.
283
+ * Takes `O(|V|)` time.
284
+ */
285
+ successors(e) {
286
+ var t = this._sucs[e];
287
+ if (t)
288
+ return _(t);
289
+ }
290
+ /**
291
+ * @param {NodeID | number} v - Node ID.
292
+ * @returns {NodeID[] | undefined} all nodes that are predecessors or
293
+ * successors of the specified node
294
+ * or `undefined` if node `v` is not in the graph.
295
+ * @remarks Takes `O(|V|)` time.
296
+ */
297
+ neighbors(e) {
298
+ var t = this.predecessors(e);
299
+ if (t)
300
+ return w(t, this.successors(e));
301
+ }
302
+ /**
303
+ * @param {NodeID | number} v - Node ID.
304
+ * @returns {boolean} True if the node is a leaf (has no successors), false otherwise.
305
+ */
306
+ isLeaf(e) {
307
+ var t;
308
+ return this.isDirected() ? t = this.successors(e) : t = this.neighbors(e), t.length === 0;
309
+ }
310
+ /**
311
+ * Creates new graph with nodes filtered via `filter`.
312
+ * Edges incident to rejected node
313
+ * are also removed.
314
+ *
315
+ * In case of compound graph, if parent is rejected by `filter`,
316
+ * than all its children are rejected too.
317
+
318
+ * @param {(v: NodeID) => boolean} filter - Function that returns `true` for nodes to keep.
319
+ * @returns {Graph<GraphLabel, NodeLabel, EdgeLabel>} A new graph containing only the nodes for which `filter` returns `true`.
320
+ * @remarks Average-case complexity: O(|E|+|V|).
321
+ */
322
+ filterNodes(e) {
323
+ var t = new this.constructor({
324
+ directed: this._isDirected,
325
+ multigraph: this._isMultigraph,
326
+ compound: this._isCompound
327
+ });
328
+ t.setGraph(this.graph());
329
+ var s = this;
330
+ d(this._nodes, function(n, h) {
331
+ e(h) && t.setNode(h, n);
332
+ }), d(this._edgeObjs, function(n) {
333
+ t.hasNode(n.v) && t.hasNode(n.w) && t.setEdge(n, s.edge(n));
334
+ });
335
+ var i = {};
336
+ function r(n) {
337
+ var h = s.parent(n);
338
+ return h === void 0 || t.hasNode(h) ? (i[n] = h, h) : h in i ? i[h] : r(h);
339
+ }
340
+ return this._isCompound && d(t.nodes(), function(n) {
341
+ t.setParent(n, r(n));
342
+ }), t;
343
+ }
344
+ /* === Edge functions ========== */
345
+ /**
346
+ * Sets a new default value that is assigned to edges that are created without
347
+ * a label.
348
+ *
349
+ * @param {typeof this._defaultEdgeLabelFn | EdgeLabel} newDefault - If a function,
350
+ * it is called with the parameters `(v, w, name)`.
351
+ * Otherwise, it is assigned as the label directly.
352
+ * @returns {this}
353
+ */
354
+ setDefaultEdgeLabel(e) {
355
+ return b(e) || (e = f(e)), this._defaultEdgeLabelFn = e, this;
356
+ }
357
+ /**
358
+ * @returns {number} the number of edges in the graph.
359
+ * @remarks Complexity: O(1).
360
+ */
361
+ edgeCount() {
362
+ return this._edgeCount;
363
+ }
364
+ /**
365
+ * Gets edges of the graph.
366
+ *
367
+ * @returns {EdgeObj[]} the {@link EdgeObj} for each edge in the graph.
368
+ *
369
+ * @remarks
370
+ * In case of compound graph subgraphs are not considered.
371
+ * Use {@link edge()} to get the label for each edge.
372
+ * Takes `O(|E|)` time.
373
+ */
374
+ edges() {
375
+ return p(this._edgeObjs);
376
+ }
377
+ /**
378
+ * Establish an edges path over the nodes in nodes list.
379
+ *
380
+ * If some edge is already exists, it will update its label, otherwise it will
381
+ * create an edge between pair of nodes with label provided or default label
382
+ * if no label provided.
383
+ *
384
+ * @param {Collection<NodeID>} vs - List of node IDs to create edges between.
385
+ * @param {EdgeLabel} [value] - If set, update all edges with this value.
386
+ * @returns {this}
387
+ * @remarks Complexity: O(|nodes|).
388
+ */
389
+ setPath(e, t) {
390
+ var s = this, i = arguments;
391
+ return D(e, function(r, n) {
392
+ return i.length > 1 ? s.setEdge(r, n, t) : s.setEdge(r, n), n;
393
+ }), this;
394
+ }
395
+ /**
396
+ * Creates or updates the label for the edge (`v`, `w`) with the optionally
397
+ * supplied `name`.
398
+ *
399
+ * @overload
400
+ * @param {EdgeObj} arg0 - Edge object.
401
+ * @param {EdgeLabel} [value] - If supplied, it is set as the label for the edge.
402
+ * If not supplied and the edge was created by this call then
403
+ * {@link setDefaultEdgeLabel} will be used to assign the edge's label.
404
+ * @returns {this} the graph, allowing this to be chained with other functions.
405
+ * @remarks Takes `O(1)` time.
406
+ */
407
+ /**
408
+ * Creates or updates the label for the edge (`v`, `w`) with the optionally
409
+ * supplied `name`.
410
+ *
411
+ * @overload
412
+ * @param {NodeID | number} v - Source node ID. Number values will be coerced to strings.
413
+ * @param {NodeID | number} w - Target node ID. Number values will be coerced to strings.
414
+ * @param {EdgeLabel} [value] - If supplied, it is set as the label for the edge.
415
+ * If not supplied and the edge was created by this call then
416
+ * {@link setDefaultEdgeLabel} will be used to assign the edge's label.
417
+ * @param {string | number} [name] - Edge name. Only useful with multigraphs.
418
+ * @returns {this} the graph, allowing this to be chained with other functions.
419
+ * @remarks Takes `O(1)` time.
420
+ */
421
+ setEdge() {
422
+ var e, t, s, i, r = !1, n = arguments[0];
423
+ typeof n == "object" && n !== null && "v" in n ? (e = n.v, t = n.w, s = n.name, arguments.length === 2 && (i = arguments[1], r = !0)) : (e = n, t = arguments[1], s = arguments[3], arguments.length > 2 && (i = arguments[2], r = !0)), e = "" + e, t = "" + t, l(s) || (s = "" + s);
424
+ var h = c(this._isDirected, e, t, s);
425
+ if (Object.prototype.hasOwnProperty.call(this._edgeLabels, h))
426
+ return r && (this._edgeLabels[h] = i), this;
427
+ if (!l(s) && !this._isMultigraph)
428
+ throw new Error("Cannot set a named edge when isMultigraph = false");
429
+ this.setNode(e), this.setNode(t), this._edgeLabels[h] = r ? i : this._defaultEdgeLabelFn(e, t, s);
430
+ var u = M(this._isDirected, e, t, s);
431
+ return e = u.v, t = u.w, Object.freeze(u), this._edgeObjs[h] = u, y(this._preds[t], e), y(this._sucs[e], t), this._in[t][h] = u, this._out[e][h] = u, this._edgeCount++, this;
432
+ }
433
+ /**
434
+ * Gets the label for the specified edge.
435
+ *
436
+ * @overload
437
+ * @param {EdgeObj} v - Edge object.
438
+ * @returns {EdgeLabel | undefined} the label for the edge (`v`, `w`) if the
439
+ * graph has an edge between `v` and `w` with the optional `name`.
440
+ * Returned `undefined` if there is no such edge in the graph.
441
+ * @remarks
442
+ * `v` and `w` can be interchanged for undirected graphs.
443
+ * Takes `O(1)` time.
444
+ */
445
+ /**
446
+ * Gets the label for the specified edge.
447
+ *
448
+ * @overload
449
+ * @param {NodeID | number} v - Source node ID.
450
+ * @param {NodeID | number} w - Target node ID.
451
+ * @param {string | number} [name] - Edge name. Only useful with multigraphs.
452
+ * @returns {EdgeLabel | undefined} the label for the edge (`v`, `w`) if the
453
+ * graph has an edge between `v` and `w` with the optional `name`.
454
+ * Returned `undefined` if there is no such edge in the graph.
455
+ * @remarks
456
+ * `v` and `w` can be interchanged for undirected graphs.
457
+ * Takes `O(1)` time.
458
+ */
459
+ edge(e, t, s) {
460
+ var i = arguments.length === 1 ? m(this._isDirected, arguments[0]) : c(this._isDirected, e, t, s);
461
+ return this._edgeLabels[i];
462
+ }
463
+ /**
464
+ * Detects whether the graph contains specified edge or not.
465
+ *
466
+ * @overload
467
+ * @param {EdgeObj} v - Edge object.
468
+ * @returns {boolean} `true` if the graph has an edge between `v` and `w`
469
+ * with the optional `name`.
470
+ * @remarks
471
+ * `v` and `w` can be interchanged for undirected graphs.
472
+ * No subgraphs are considered.
473
+ * Takes `O(1)` time.
474
+ */
475
+ /**
476
+ * Detects whether the graph contains specified edge or not.
477
+ *
478
+ * @overload
479
+ * @param {NodeID | number} v - Source node ID.
480
+ * @param {NodeID | number} w - Target node ID.
481
+ * @param {string | number} [name] - Edge name. Only useful with multigraphs.
482
+ * @returns {boolean} `true` if the graph has an edge between `v` and `w`
483
+ * with the optional `name`.
484
+ * @remarks
485
+ * `v` and `w` can be interchanged for undirected graphs.
486
+ * No subgraphs are considered.
487
+ * Takes `O(1)` time.
488
+ */
489
+ hasEdge(e, t, s) {
490
+ var i = arguments.length === 1 ? m(this._isDirected, arguments[0]) : c(this._isDirected, e, t, s);
491
+ return Object.prototype.hasOwnProperty.call(this._edgeLabels, i);
492
+ }
493
+ /**
494
+ * Removes the edge (`v`, `w`) if the graph has an edge between `v` and `w`
495
+ * with the optional `name`. If not this function does nothing.
496
+ *
497
+ * @overload
498
+ * @param {EdgeObj} v - Edge object.
499
+ * @returns {this}
500
+ * @remarks
501
+ * `v` and `w` can be interchanged for undirected graphs.
502
+ * No subgraphs are considered.
503
+ * Takes `O(1)` time.
504
+ */
505
+ /**
506
+ * Removes the edge (`v`, `w`) if the graph has an edge between `v` and `w`
507
+ * with the optional `name`. If not this function does nothing.
508
+ *
509
+ * @overload
510
+ * @param {NodeID | number} v - Source node ID.
511
+ * @param {NodeID | number} w - Target node ID.
512
+ * @param {string | number} [name] - Edge name. Only useful with multigraphs.
513
+ * @returns {this}
514
+ * @remarks
515
+ * `v` and `w` can be interchanged for undirected graphs.
516
+ * Takes `O(1)` time.
517
+ */
518
+ removeEdge(e, t, s) {
519
+ var i = arguments.length === 1 ? m(this._isDirected, arguments[0]) : c(this._isDirected, e, t, s), r = this._edgeObjs[i];
520
+ return r && (e = r.v, t = r.w, delete this._edgeLabels[i], delete this._edgeObjs[i], C(this._preds[t], e), C(this._sucs[e], t), delete this._in[t][i], delete this._out[e][i], this._edgeCount--), this;
521
+ }
522
+ /**
523
+ * @param {NodeID | number} v - Target node ID.
524
+ * @param {NodeID | number} [u] - Optionally filters edges down to just those
525
+ * coming from node `u`.
526
+ * @returns {EdgeObj[] | undefined} all edges that point to the node `v`.
527
+ * Returns `undefined` if node `v` is not in the graph.
528
+ * @remarks
529
+ * Behavior is undefined for undirected graphs - use {@link nodeEdges} instead.
530
+ * Takes `O(|E|)` time.
531
+ */
532
+ inEdges(e, t) {
533
+ var s = this._in[e];
534
+ if (s) {
535
+ var i = p(s);
536
+ return t ? g(i, function(r) {
537
+ return r.v === t;
538
+ }) : i;
539
+ }
540
+ }
541
+ /**
542
+ * @param {NodeID | number} v - Target node ID.
543
+ * @param {NodeID | number} [w] - Optionally filters edges down to just those
544
+ * that point to `w`.
545
+ * @returns {EdgeObj[] | undefined} all edges that point to the node `v`.
546
+ * Returns `undefined` if node `v` is not in the graph.
547
+ * @remarks
548
+ * Behavior is undefined for undirected graphs - use {@link nodeEdges} instead.
549
+ * Takes `O(|E|)` time.
550
+ */
551
+ outEdges(e, t) {
552
+ var s = this._out[e];
553
+ if (s) {
554
+ var i = p(s);
555
+ return t ? g(i, function(r) {
556
+ return r.w === t;
557
+ }) : i;
558
+ }
559
+ }
560
+ /**
561
+ * @param {NodeID | number} v - Target Node ID.
562
+ * @param {NodeID | number} [w] - If set, filters those edges down to just
563
+ * those between nodes `v` and `w` regardless of direction
564
+ * @returns {EdgeObj[] | undefined} all edges to or from node `v` regardless
565
+ * of direction. Returns `undefined` if node `v` is not in the graph.
566
+ * @remarks Takes `O(|E|)` time.
567
+ */
568
+ nodeEdges(e, t) {
569
+ var s = this.inEdges(e, t);
570
+ if (s)
571
+ return s.concat(this.outEdges(e, t));
572
+ }
573
+ }
574
+ L.prototype._nodeCount = 0;
575
+ L.prototype._edgeCount = 0;
576
+ function y(o, e) {
577
+ o[e] ? o[e]++ : o[e] = 1;
578
+ }
579
+ function C(o, e) {
580
+ --o[e] || delete o[e];
581
+ }
582
+ function c(o, e, t, s) {
583
+ var i = "" + e, r = "" + t;
584
+ if (!o && i > r) {
585
+ var n = i;
586
+ i = r, r = n;
587
+ }
588
+ return i + O + r + O + (l(s) ? F : s);
589
+ }
590
+ function M(o, e, t, s) {
591
+ var i = "" + e, r = "" + t;
592
+ if (!o && i > r) {
593
+ var n = i;
594
+ i = r, r = n;
595
+ }
596
+ var h = { v: i, w: r };
597
+ return s && (h.name = s), h;
598
+ }
599
+ function m(o, e) {
600
+ return c(o, e.v, e.w, e.name);
601
+ }
602
+ export {
603
+ L as G
604
+ };