@airalogy/aimd-recorder 1.17.0 → 1.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.
- package/README.md +11 -10
- package/README.zh-CN.md +11 -10
- package/dist/AimdCodeField-BQUuM-EF.js +182 -0
- package/dist/{AimdDnaSequenceField-D6ZgCDpp.js → AimdDnaSequenceField-KZU2Zj3E.js} +2 -2
- package/dist/{AimdEditor.vue_vue_type_style_index_0_lang-B5Tq4zPV.js → AimdEditor.vue_vue_type_style_index_0_lang-CzfYPp5r.js} +3922 -3829
- package/dist/AimdMarkdownField-t2d8uOeU.js +254 -0
- package/dist/AimdMarkdownNoteField-_h1oZSwH.js +259 -0
- package/dist/{_commonjsHelpers-CZXJ37nu.js → _commonjsHelpers-B5RozER-.js} +2 -2
- package/dist/aimd-recorder.css +1 -1
- package/dist/arc-DS_ocYoe.js +83 -0
- package/dist/architectureDiagram-3BPJPVTR-Dq2W8_tb.js +4692 -0
- package/dist/blockDiagram-GPEHLZMM-B4hnSAF_.js +2425 -0
- package/dist/c4Diagram-AAUBKEIU-CbffqNLY.js +1577 -0
- package/dist/channel-CtXnYrAk.js +5 -0
- package/dist/chunk-2J33WTMH-CROScrt5.js +19 -0
- package/dist/chunk-4BX2VUAB-DTmsQu5_.js +8 -0
- package/dist/chunk-55IACEB6-B5wDJzeX.js +8 -0
- package/dist/chunk-727SXJPM-CfyltY6o.js +1528 -0
- package/dist/chunk-AQP2D5EJ-B8274EYy.js +1387 -0
- package/dist/chunk-FMBD7UC4-CT_FK-SH.js +19 -0
- package/dist/chunk-ND2GUHAM-g9GulPi-.js +68 -0
- package/dist/chunk-QZHKN3VN-Di5HEktz.js +15 -0
- package/dist/classDiagram-4FO5ZUOK-BVUr246k.js +16 -0
- package/dist/classDiagram-v2-Q7XG4LA2-BVUr246k.js +16 -0
- package/dist/components.js +3279 -2216
- package/dist/composables.js +92 -68
- package/dist/cose-bilkent-S5V4N54A-GJ4IOO6v.js +2609 -0
- package/dist/cytoscape.esm-r59gEWFs.js +18710 -0
- package/dist/dagre-BM42HDAG-oL7Br44o.js +445 -0
- package/dist/defaultLocale-BgPVtth8.js +171 -0
- package/dist/diagram-2AECGRRQ-DtoCG_N4.js +217 -0
- package/dist/diagram-5GNKFQAL-f8QNdS7L.js +123 -0
- package/dist/diagram-KO2AKTUF-CsJOW_AX.js +461 -0
- package/dist/diagram-LMA3HP47-xmEKNZ7y.js +142 -0
- package/dist/diagram-OG6HWLK6-unpC7vo8.js +528 -0
- package/dist/erDiagram-TEJ5UH35-BGzFnCJD.js +899 -0
- package/dist/flowDiagram-I6XJVG4X-LBFhDnOs.js +1628 -0
- package/dist/ganttDiagram-6RSMTGT7-CFBc-jPD.js +2707 -0
- package/dist/gitGraphDiagram-PVQCEYII-BLduh-Rb.js +815 -0
- package/dist/graph-DdlKE625.js +1510 -0
- package/dist/index.js +104 -80
- package/dist/infoDiagram-5YYISTIA-CLQQI6zM.js +24 -0
- package/dist/init-DjUOC4st.js +16 -0
- package/dist/ishikawaDiagram-YF4QCWOH-CStdYBmW.js +621 -0
- package/dist/journeyDiagram-JHISSGLW-B6mRTzoE.js +834 -0
- package/dist/kanban-definition-UN3LZRKU-C-vnN5v4.js +724 -0
- package/dist/katex-DNob3HGn.js +11690 -0
- package/dist/layout-DDt0fz-M.js +1703 -0
- package/dist/linear-C-IAFdOt.js +259 -0
- package/dist/mermaid.core-CuZ3nINf.js +15940 -0
- package/dist/mindmap-definition-RKZ34NQL-TSZ1Vb3z.js +827 -0
- package/dist/ordinal-B6-f3MAq.js +61 -0
- package/dist/pieDiagram-4H26LBE5-DYok-1-k.js +163 -0
- package/dist/quadrantDiagram-W4KKPZXB-Cg856sbH.js +1024 -0
- package/dist/requirementDiagram-4Y6WPE33-BN9fGdlJ.js +882 -0
- package/dist/sankeyDiagram-5OEKKPKP-CDqTgonY.js +847 -0
- package/dist/sequenceDiagram-3UESZ5HK-Chjrc0-W.js +2891 -0
- package/dist/stateDiagram-AJRCARHV-DRyLHrdr.js +263 -0
- package/dist/stateDiagram-v2-BHNVJYJU-CZTIDHid.js +16 -0
- package/dist/timeline-definition-PNZ67QCA-Bc3D9AAG.js +1055 -0
- package/dist/{useFieldRendering-xLajJhyA.js → useCodeBlockRendering-qA6gj4vz.js} +3035 -2254
- package/dist/useMonacoAutoHeight-D4T-El3J.js +66 -0
- package/dist/vennDiagram-CIIHVFJN-CYAul48m.js +1557 -0
- package/dist/wardley-L42UT6IY-D7b2ujEZ.js +22512 -0
- package/dist/wardleyDiagram-YWT4CUSO-B7Tg0MG9.js +675 -0
- package/dist/xychartDiagram-2RQKCTM6-xWYVEqth.js +1342 -0
- package/package.json +9 -8
- package/src/__tests__/assigner-runner-dependent-data.test.ts +32 -0
- package/src/__tests__/markdown-field.test.ts +150 -1
- package/src/__tests__/markdown-note-field.test.ts +86 -3
- package/src/__tests__/recorder-assigner-control.test.ts +844 -0
- package/src/__tests__/recorder-editor.test.ts +17 -0
- package/src/__tests__/recorder-markdown-assigner-integration.test.ts +49 -0
- package/src/__tests__/step-field.test.ts +47 -1
- package/src/__tests__/type-plugins.test.ts +1 -0
- package/src/__tests__/var-field-render.test.ts +741 -1
- package/src/components/AimdCodeField.vue +24 -5
- package/src/components/AimdMarkdownField.vue +548 -11
- package/src/components/AimdMarkdownNoteField.vue +241 -30
- package/src/components/AimdRecorder.vue +1521 -95
- package/src/components/AimdRecorderEditor.vue +276 -8
- package/src/components/AimdRecorderWysiwygFieldHost.vue +6 -0
- package/src/components/AimdRecorderWysiwygSurface.vue +32 -0
- package/src/components/AimdStepCheckField.vue +82 -18
- package/src/components/AimdVarField.vue +694 -25
- package/src/components/AimdVarTableField.vue +283 -110
- package/src/components/icons/AimdAssignerCalculatorIcon.vue +18 -0
- package/src/components/icons/AimdAssignerCloudStatusIcon.vue +22 -0
- package/src/components/recorderMilkdownPlugin.ts +14 -0
- package/src/composables/__tests__/useRecordState.test.ts +86 -0
- package/src/composables/__tests__/useVarHelpers.test.ts +133 -0
- package/src/composables/index.ts +27 -1
- package/src/composables/useAssignerRunner.ts +376 -0
- package/src/composables/useCodeBlockRendering.ts +51 -0
- package/src/composables/useFieldRendering.ts +32 -4
- package/src/composables/useMonacoAutoHeight.ts +127 -0
- package/src/composables/useRecordState.ts +22 -3
- package/src/composables/useVarHelpers.ts +377 -9
- package/src/index.ts +13 -0
- package/src/locales.ts +45 -0
- package/src/styles/aimd.css +151 -1
- package/src/type-plugins.ts +7 -0
- package/src/types.ts +93 -2
- package/dist/AimdCodeField-DC3DPvgc.js +0 -172
- package/dist/AimdMarkdownField-BJ20QtO8.js +0 -67
- package/dist/AimdMarkdownNoteField-DwAQhoyk.js +0 -186
|
@@ -0,0 +1,1510 @@
|
|
|
1
|
+
import { A as fe, S as M, w as he, y as H, z as T, x as N, B as dt } from "./AimdEditor.vue_vue_type_style_index_0_lang-CzfYPp5r.js";
|
|
2
|
+
function Xe(e, t) {
|
|
3
|
+
for (var r = -1, n = e == null ? 0 : e.length, i = Array(n); ++r < n; )
|
|
4
|
+
i[r] = t(e[r], r, e);
|
|
5
|
+
return i;
|
|
6
|
+
}
|
|
7
|
+
var p = Array.isArray, ve = M ? M.prototype : void 0, Oe = ve ? ve.toString : void 0;
|
|
8
|
+
function Ye(e) {
|
|
9
|
+
if (typeof e == "string")
|
|
10
|
+
return e;
|
|
11
|
+
if (p(e))
|
|
12
|
+
return Xe(e, Ye) + "";
|
|
13
|
+
if (fe(e))
|
|
14
|
+
return Oe ? Oe.call(e) : "";
|
|
15
|
+
var t = e + "";
|
|
16
|
+
return t == "0" && 1 / e == -1 / 0 ? "-0" : t;
|
|
17
|
+
}
|
|
18
|
+
function W(e) {
|
|
19
|
+
return e;
|
|
20
|
+
}
|
|
21
|
+
var ct = "[object AsyncFunction]", lt = "[object Function]", pt = "[object GeneratorFunction]", gt = "[object Proxy]";
|
|
22
|
+
function Y(e) {
|
|
23
|
+
if (!he(e))
|
|
24
|
+
return !1;
|
|
25
|
+
var t = H(e);
|
|
26
|
+
return t == lt || t == pt || t == ct || t == gt;
|
|
27
|
+
}
|
|
28
|
+
var te = T["__core-js_shared__"], me = (function() {
|
|
29
|
+
var e = /[^.]+$/.exec(te && te.keys && te.keys.IE_PROTO || "");
|
|
30
|
+
return e ? "Symbol(src)_1." + e : "";
|
|
31
|
+
})();
|
|
32
|
+
function _t(e) {
|
|
33
|
+
return !!me && me in e;
|
|
34
|
+
}
|
|
35
|
+
var yt = Function.prototype, bt = yt.toString;
|
|
36
|
+
function x(e) {
|
|
37
|
+
if (e != null) {
|
|
38
|
+
try {
|
|
39
|
+
return bt.call(e);
|
|
40
|
+
} catch {
|
|
41
|
+
}
|
|
42
|
+
try {
|
|
43
|
+
return e + "";
|
|
44
|
+
} catch {
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return "";
|
|
48
|
+
}
|
|
49
|
+
var vt = /[\\^$.*+?()[\]{}|]/g, Ot = /^\[object .+?Constructor\]$/, mt = Function.prototype, wt = Object.prototype, At = mt.toString, Tt = wt.hasOwnProperty, Et = RegExp(
|
|
50
|
+
"^" + At.call(Tt).replace(vt, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
|
|
51
|
+
);
|
|
52
|
+
function Pt(e) {
|
|
53
|
+
if (!he(e) || _t(e))
|
|
54
|
+
return !1;
|
|
55
|
+
var t = Y(e) ? Et : Ot;
|
|
56
|
+
return t.test(x(e));
|
|
57
|
+
}
|
|
58
|
+
function Ct(e, t) {
|
|
59
|
+
return e?.[t];
|
|
60
|
+
}
|
|
61
|
+
function I(e, t) {
|
|
62
|
+
var r = Ct(e, t);
|
|
63
|
+
return Pt(r) ? r : void 0;
|
|
64
|
+
}
|
|
65
|
+
var ae = I(T, "WeakMap");
|
|
66
|
+
function $t(e, t, r) {
|
|
67
|
+
switch (r.length) {
|
|
68
|
+
case 0:
|
|
69
|
+
return e.call(t);
|
|
70
|
+
case 1:
|
|
71
|
+
return e.call(t, r[0]);
|
|
72
|
+
case 2:
|
|
73
|
+
return e.call(t, r[0], r[1]);
|
|
74
|
+
case 3:
|
|
75
|
+
return e.call(t, r[0], r[1], r[2]);
|
|
76
|
+
}
|
|
77
|
+
return e.apply(t, r);
|
|
78
|
+
}
|
|
79
|
+
function St() {
|
|
80
|
+
}
|
|
81
|
+
var xt = 800, It = 16, Lt = Date.now;
|
|
82
|
+
function Rt(e) {
|
|
83
|
+
var t = 0, r = 0;
|
|
84
|
+
return function() {
|
|
85
|
+
var n = Lt(), i = It - (n - r);
|
|
86
|
+
if (r = n, i > 0) {
|
|
87
|
+
if (++t >= xt)
|
|
88
|
+
return arguments[0];
|
|
89
|
+
} else
|
|
90
|
+
t = 0;
|
|
91
|
+
return e.apply(void 0, arguments);
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
function D(e) {
|
|
95
|
+
return function() {
|
|
96
|
+
return e;
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
var we = (function() {
|
|
100
|
+
try {
|
|
101
|
+
var e = I(Object, "defineProperty");
|
|
102
|
+
return e({}, "", {}), e;
|
|
103
|
+
} catch {
|
|
104
|
+
}
|
|
105
|
+
})(), Mt = we ? function(e, t) {
|
|
106
|
+
return we(e, "toString", {
|
|
107
|
+
configurable: !0,
|
|
108
|
+
enumerable: !1,
|
|
109
|
+
value: D(t),
|
|
110
|
+
writable: !0
|
|
111
|
+
});
|
|
112
|
+
} : W, Nt = Rt(Mt);
|
|
113
|
+
function Dt(e, t) {
|
|
114
|
+
for (var r = -1, n = e == null ? 0 : e.length; ++r < n && t(e[r], r, e) !== !1; )
|
|
115
|
+
;
|
|
116
|
+
return e;
|
|
117
|
+
}
|
|
118
|
+
function jt(e, t, r, n) {
|
|
119
|
+
for (var i = e.length, s = r + -1; ++s < i; )
|
|
120
|
+
if (t(e[s], s, e))
|
|
121
|
+
return s;
|
|
122
|
+
return -1;
|
|
123
|
+
}
|
|
124
|
+
function Ft(e) {
|
|
125
|
+
return e !== e;
|
|
126
|
+
}
|
|
127
|
+
function Gt(e, t, r) {
|
|
128
|
+
for (var n = r - 1, i = e.length; ++n < i; )
|
|
129
|
+
if (e[n] === t)
|
|
130
|
+
return n;
|
|
131
|
+
return -1;
|
|
132
|
+
}
|
|
133
|
+
function zt(e, t, r) {
|
|
134
|
+
return t === t ? Gt(e, t, r) : jt(e, Ft, r);
|
|
135
|
+
}
|
|
136
|
+
function Ut(e, t) {
|
|
137
|
+
var r = e == null ? 0 : e.length;
|
|
138
|
+
return !!r && zt(e, t, 0) > -1;
|
|
139
|
+
}
|
|
140
|
+
var Ht = 9007199254740991, Bt = /^(?:0|[1-9]\d*)$/;
|
|
141
|
+
function Ze(e, t) {
|
|
142
|
+
var r = typeof e;
|
|
143
|
+
return t = t ?? Ht, !!t && (r == "number" || r != "symbol" && Bt.test(e)) && e > -1 && e % 1 == 0 && e < t;
|
|
144
|
+
}
|
|
145
|
+
function We(e, t) {
|
|
146
|
+
return e === t || e !== e && t !== t;
|
|
147
|
+
}
|
|
148
|
+
var Ae = Math.max;
|
|
149
|
+
function Kt(e, t, r) {
|
|
150
|
+
return t = Ae(t === void 0 ? e.length - 1 : t, 0), function() {
|
|
151
|
+
for (var n = arguments, i = -1, s = Ae(n.length - t, 0), a = Array(s); ++i < s; )
|
|
152
|
+
a[i] = n[t + i];
|
|
153
|
+
i = -1;
|
|
154
|
+
for (var o = Array(t + 1); ++i < t; )
|
|
155
|
+
o[i] = n[i];
|
|
156
|
+
return o[t] = r(a), $t(e, this, o);
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
function qt(e, t) {
|
|
160
|
+
return Nt(Kt(e, t, W), e + "");
|
|
161
|
+
}
|
|
162
|
+
var Xt = 9007199254740991;
|
|
163
|
+
function de(e) {
|
|
164
|
+
return typeof e == "number" && e > -1 && e % 1 == 0 && e <= Xt;
|
|
165
|
+
}
|
|
166
|
+
function J(e) {
|
|
167
|
+
return e != null && de(e.length) && !Y(e);
|
|
168
|
+
}
|
|
169
|
+
var Yt = Object.prototype;
|
|
170
|
+
function Je(e) {
|
|
171
|
+
var t = e && e.constructor, r = typeof t == "function" && t.prototype || Yt;
|
|
172
|
+
return e === r;
|
|
173
|
+
}
|
|
174
|
+
function Zt(e, t) {
|
|
175
|
+
for (var r = -1, n = Array(e); ++r < e; )
|
|
176
|
+
n[r] = t(r);
|
|
177
|
+
return n;
|
|
178
|
+
}
|
|
179
|
+
var Wt = "[object Arguments]";
|
|
180
|
+
function Te(e) {
|
|
181
|
+
return N(e) && H(e) == Wt;
|
|
182
|
+
}
|
|
183
|
+
var Qe = Object.prototype, Jt = Qe.hasOwnProperty, Qt = Qe.propertyIsEnumerable, Q = Te(/* @__PURE__ */ (function() {
|
|
184
|
+
return arguments;
|
|
185
|
+
})()) ? Te : function(e) {
|
|
186
|
+
return N(e) && Jt.call(e, "callee") && !Qt.call(e, "callee");
|
|
187
|
+
};
|
|
188
|
+
function Vt() {
|
|
189
|
+
return !1;
|
|
190
|
+
}
|
|
191
|
+
var Ve = typeof exports == "object" && exports && !exports.nodeType && exports, Ee = Ve && typeof module == "object" && module && !module.nodeType && module, kt = Ee && Ee.exports === Ve, Pe = kt ? T.Buffer : void 0, er = Pe ? Pe.isBuffer : void 0, Z = er || Vt, tr = "[object Arguments]", rr = "[object Array]", nr = "[object Boolean]", ir = "[object Date]", sr = "[object Error]", ar = "[object Function]", or = "[object Map]", ur = "[object Number]", fr = "[object Object]", hr = "[object RegExp]", dr = "[object Set]", cr = "[object String]", lr = "[object WeakMap]", pr = "[object ArrayBuffer]", gr = "[object DataView]", _r = "[object Float32Array]", yr = "[object Float64Array]", br = "[object Int8Array]", vr = "[object Int16Array]", Or = "[object Int32Array]", mr = "[object Uint8Array]", wr = "[object Uint8ClampedArray]", Ar = "[object Uint16Array]", Tr = "[object Uint32Array]", h = {};
|
|
192
|
+
h[_r] = h[yr] = h[br] = h[vr] = h[Or] = h[mr] = h[wr] = h[Ar] = h[Tr] = !0;
|
|
193
|
+
h[tr] = h[rr] = h[pr] = h[nr] = h[gr] = h[ir] = h[sr] = h[ar] = h[or] = h[ur] = h[fr] = h[hr] = h[dr] = h[cr] = h[lr] = !1;
|
|
194
|
+
function Er(e) {
|
|
195
|
+
return N(e) && de(e.length) && !!h[H(e)];
|
|
196
|
+
}
|
|
197
|
+
function Pr(e) {
|
|
198
|
+
return function(t) {
|
|
199
|
+
return e(t);
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
var ke = typeof exports == "object" && exports && !exports.nodeType && exports, F = ke && typeof module == "object" && module && !module.nodeType && module, Cr = F && F.exports === ke, re = Cr && dt.process, Ce = (function() {
|
|
203
|
+
try {
|
|
204
|
+
var e = F && F.require && F.require("util").types;
|
|
205
|
+
return e || re && re.binding && re.binding("util");
|
|
206
|
+
} catch {
|
|
207
|
+
}
|
|
208
|
+
})(), $e = Ce && Ce.isTypedArray, ce = $e ? Pr($e) : Er, $r = Object.prototype, Sr = $r.hasOwnProperty;
|
|
209
|
+
function xr(e, t) {
|
|
210
|
+
var r = p(e), n = !r && Q(e), i = !r && !n && Z(e), s = !r && !n && !i && ce(e), a = r || n || i || s, o = a ? Zt(e.length, String) : [], u = o.length;
|
|
211
|
+
for (var f in e)
|
|
212
|
+
(t || Sr.call(e, f)) && !(a && // Safari 9 has enumerable `arguments.length` in strict mode.
|
|
213
|
+
(f == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
|
|
214
|
+
i && (f == "offset" || f == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
|
|
215
|
+
s && (f == "buffer" || f == "byteLength" || f == "byteOffset") || // Skip index properties.
|
|
216
|
+
Ze(f, u))) && o.push(f);
|
|
217
|
+
return o;
|
|
218
|
+
}
|
|
219
|
+
function Ir(e, t) {
|
|
220
|
+
return function(r) {
|
|
221
|
+
return e(t(r));
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
var Lr = Ir(Object.keys, Object), Rr = Object.prototype, Mr = Rr.hasOwnProperty;
|
|
225
|
+
function et(e) {
|
|
226
|
+
if (!Je(e))
|
|
227
|
+
return Lr(e);
|
|
228
|
+
var t = [];
|
|
229
|
+
for (var r in Object(e))
|
|
230
|
+
Mr.call(e, r) && r != "constructor" && t.push(r);
|
|
231
|
+
return t;
|
|
232
|
+
}
|
|
233
|
+
function y(e) {
|
|
234
|
+
return J(e) ? xr(e) : et(e);
|
|
235
|
+
}
|
|
236
|
+
var Nr = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, Dr = /^\w*$/;
|
|
237
|
+
function le(e, t) {
|
|
238
|
+
if (p(e))
|
|
239
|
+
return !1;
|
|
240
|
+
var r = typeof e;
|
|
241
|
+
return r == "number" || r == "symbol" || r == "boolean" || e == null || fe(e) ? !0 : Dr.test(e) || !Nr.test(e) || t != null && e in Object(t);
|
|
242
|
+
}
|
|
243
|
+
var G = I(Object, "create");
|
|
244
|
+
function jr() {
|
|
245
|
+
this.__data__ = G ? G(null) : {}, this.size = 0;
|
|
246
|
+
}
|
|
247
|
+
function Fr(e) {
|
|
248
|
+
var t = this.has(e) && delete this.__data__[e];
|
|
249
|
+
return this.size -= t ? 1 : 0, t;
|
|
250
|
+
}
|
|
251
|
+
var Gr = "__lodash_hash_undefined__", zr = Object.prototype, Ur = zr.hasOwnProperty;
|
|
252
|
+
function Hr(e) {
|
|
253
|
+
var t = this.__data__;
|
|
254
|
+
if (G) {
|
|
255
|
+
var r = t[e];
|
|
256
|
+
return r === Gr ? void 0 : r;
|
|
257
|
+
}
|
|
258
|
+
return Ur.call(t, e) ? t[e] : void 0;
|
|
259
|
+
}
|
|
260
|
+
var Br = Object.prototype, Kr = Br.hasOwnProperty;
|
|
261
|
+
function qr(e) {
|
|
262
|
+
var t = this.__data__;
|
|
263
|
+
return G ? t[e] !== void 0 : Kr.call(t, e);
|
|
264
|
+
}
|
|
265
|
+
var Xr = "__lodash_hash_undefined__";
|
|
266
|
+
function Yr(e, t) {
|
|
267
|
+
var r = this.__data__;
|
|
268
|
+
return this.size += this.has(e) ? 0 : 1, r[e] = G && t === void 0 ? Xr : t, this;
|
|
269
|
+
}
|
|
270
|
+
function S(e) {
|
|
271
|
+
var t = -1, r = e == null ? 0 : e.length;
|
|
272
|
+
for (this.clear(); ++t < r; ) {
|
|
273
|
+
var n = e[t];
|
|
274
|
+
this.set(n[0], n[1]);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
S.prototype.clear = jr;
|
|
278
|
+
S.prototype.delete = Fr;
|
|
279
|
+
S.prototype.get = Hr;
|
|
280
|
+
S.prototype.has = qr;
|
|
281
|
+
S.prototype.set = Yr;
|
|
282
|
+
function Zr() {
|
|
283
|
+
this.__data__ = [], this.size = 0;
|
|
284
|
+
}
|
|
285
|
+
function V(e, t) {
|
|
286
|
+
for (var r = e.length; r--; )
|
|
287
|
+
if (We(e[r][0], t))
|
|
288
|
+
return r;
|
|
289
|
+
return -1;
|
|
290
|
+
}
|
|
291
|
+
var Wr = Array.prototype, Jr = Wr.splice;
|
|
292
|
+
function Qr(e) {
|
|
293
|
+
var t = this.__data__, r = V(t, e);
|
|
294
|
+
if (r < 0)
|
|
295
|
+
return !1;
|
|
296
|
+
var n = t.length - 1;
|
|
297
|
+
return r == n ? t.pop() : Jr.call(t, r, 1), --this.size, !0;
|
|
298
|
+
}
|
|
299
|
+
function Vr(e) {
|
|
300
|
+
var t = this.__data__, r = V(t, e);
|
|
301
|
+
return r < 0 ? void 0 : t[r][1];
|
|
302
|
+
}
|
|
303
|
+
function kr(e) {
|
|
304
|
+
return V(this.__data__, e) > -1;
|
|
305
|
+
}
|
|
306
|
+
function en(e, t) {
|
|
307
|
+
var r = this.__data__, n = V(r, e);
|
|
308
|
+
return n < 0 ? (++this.size, r.push([e, t])) : r[n][1] = t, this;
|
|
309
|
+
}
|
|
310
|
+
function m(e) {
|
|
311
|
+
var t = -1, r = e == null ? 0 : e.length;
|
|
312
|
+
for (this.clear(); ++t < r; ) {
|
|
313
|
+
var n = e[t];
|
|
314
|
+
this.set(n[0], n[1]);
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
m.prototype.clear = Zr;
|
|
318
|
+
m.prototype.delete = Qr;
|
|
319
|
+
m.prototype.get = Vr;
|
|
320
|
+
m.prototype.has = kr;
|
|
321
|
+
m.prototype.set = en;
|
|
322
|
+
var z = I(T, "Map");
|
|
323
|
+
function tn() {
|
|
324
|
+
this.size = 0, this.__data__ = {
|
|
325
|
+
hash: new S(),
|
|
326
|
+
map: new (z || m)(),
|
|
327
|
+
string: new S()
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
function rn(e) {
|
|
331
|
+
var t = typeof e;
|
|
332
|
+
return t == "string" || t == "number" || t == "symbol" || t == "boolean" ? e !== "__proto__" : e === null;
|
|
333
|
+
}
|
|
334
|
+
function k(e, t) {
|
|
335
|
+
var r = e.__data__;
|
|
336
|
+
return rn(t) ? r[typeof t == "string" ? "string" : "hash"] : r.map;
|
|
337
|
+
}
|
|
338
|
+
function nn(e) {
|
|
339
|
+
var t = k(this, e).delete(e);
|
|
340
|
+
return this.size -= t ? 1 : 0, t;
|
|
341
|
+
}
|
|
342
|
+
function sn(e) {
|
|
343
|
+
return k(this, e).get(e);
|
|
344
|
+
}
|
|
345
|
+
function an(e) {
|
|
346
|
+
return k(this, e).has(e);
|
|
347
|
+
}
|
|
348
|
+
function on(e, t) {
|
|
349
|
+
var r = k(this, e), n = r.size;
|
|
350
|
+
return r.set(e, t), this.size += r.size == n ? 0 : 1, this;
|
|
351
|
+
}
|
|
352
|
+
function w(e) {
|
|
353
|
+
var t = -1, r = e == null ? 0 : e.length;
|
|
354
|
+
for (this.clear(); ++t < r; ) {
|
|
355
|
+
var n = e[t];
|
|
356
|
+
this.set(n[0], n[1]);
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
w.prototype.clear = tn;
|
|
360
|
+
w.prototype.delete = nn;
|
|
361
|
+
w.prototype.get = sn;
|
|
362
|
+
w.prototype.has = an;
|
|
363
|
+
w.prototype.set = on;
|
|
364
|
+
var un = "Expected a function";
|
|
365
|
+
function pe(e, t) {
|
|
366
|
+
if (typeof e != "function" || t != null && typeof t != "function")
|
|
367
|
+
throw new TypeError(un);
|
|
368
|
+
var r = function() {
|
|
369
|
+
var n = arguments, i = t ? t.apply(this, n) : n[0], s = r.cache;
|
|
370
|
+
if (s.has(i))
|
|
371
|
+
return s.get(i);
|
|
372
|
+
var a = e.apply(this, n);
|
|
373
|
+
return r.cache = s.set(i, a) || s, a;
|
|
374
|
+
};
|
|
375
|
+
return r.cache = new (pe.Cache || w)(), r;
|
|
376
|
+
}
|
|
377
|
+
pe.Cache = w;
|
|
378
|
+
var fn = 500;
|
|
379
|
+
function hn(e) {
|
|
380
|
+
var t = pe(e, function(n) {
|
|
381
|
+
return r.size === fn && r.clear(), n;
|
|
382
|
+
}), r = t.cache;
|
|
383
|
+
return t;
|
|
384
|
+
}
|
|
385
|
+
var dn = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, cn = /\\(\\)?/g, ln = hn(function(e) {
|
|
386
|
+
var t = [];
|
|
387
|
+
return e.charCodeAt(0) === 46 && t.push(""), e.replace(dn, function(r, n, i, s) {
|
|
388
|
+
t.push(i ? s.replace(cn, "$1") : n || r);
|
|
389
|
+
}), t;
|
|
390
|
+
});
|
|
391
|
+
function pn(e) {
|
|
392
|
+
return e == null ? "" : Ye(e);
|
|
393
|
+
}
|
|
394
|
+
function tt(e, t) {
|
|
395
|
+
return p(e) ? e : le(e, t) ? [e] : ln(pn(e));
|
|
396
|
+
}
|
|
397
|
+
function ee(e) {
|
|
398
|
+
if (typeof e == "string" || fe(e))
|
|
399
|
+
return e;
|
|
400
|
+
var t = e + "";
|
|
401
|
+
return t == "0" && 1 / e == -1 / 0 ? "-0" : t;
|
|
402
|
+
}
|
|
403
|
+
function rt(e, t) {
|
|
404
|
+
t = tt(t, e);
|
|
405
|
+
for (var r = 0, n = t.length; e != null && r < n; )
|
|
406
|
+
e = e[ee(t[r++])];
|
|
407
|
+
return r && r == n ? e : void 0;
|
|
408
|
+
}
|
|
409
|
+
function gn(e, t, r) {
|
|
410
|
+
var n = e == null ? void 0 : rt(e, t);
|
|
411
|
+
return n === void 0 ? r : n;
|
|
412
|
+
}
|
|
413
|
+
function nt(e, t) {
|
|
414
|
+
for (var r = -1, n = t.length, i = e.length; ++r < n; )
|
|
415
|
+
e[i + r] = t[r];
|
|
416
|
+
return e;
|
|
417
|
+
}
|
|
418
|
+
var Se = M ? M.isConcatSpreadable : void 0;
|
|
419
|
+
function _n(e) {
|
|
420
|
+
return p(e) || Q(e) || !!(Se && e && e[Se]);
|
|
421
|
+
}
|
|
422
|
+
function yn(e, t, r, n, i) {
|
|
423
|
+
var s = -1, a = e.length;
|
|
424
|
+
for (r || (r = _n), i || (i = []); ++s < a; ) {
|
|
425
|
+
var o = e[s];
|
|
426
|
+
r(o) ? nt(i, o) : n || (i[i.length] = o);
|
|
427
|
+
}
|
|
428
|
+
return i;
|
|
429
|
+
}
|
|
430
|
+
function bn(e, t, r, n) {
|
|
431
|
+
var i = -1, s = e == null ? 0 : e.length;
|
|
432
|
+
for (n && s && (r = e[++i]); ++i < s; )
|
|
433
|
+
r = t(r, e[i], i, e);
|
|
434
|
+
return r;
|
|
435
|
+
}
|
|
436
|
+
function vn() {
|
|
437
|
+
this.__data__ = new m(), this.size = 0;
|
|
438
|
+
}
|
|
439
|
+
function On(e) {
|
|
440
|
+
var t = this.__data__, r = t.delete(e);
|
|
441
|
+
return this.size = t.size, r;
|
|
442
|
+
}
|
|
443
|
+
function mn(e) {
|
|
444
|
+
return this.__data__.get(e);
|
|
445
|
+
}
|
|
446
|
+
function wn(e) {
|
|
447
|
+
return this.__data__.has(e);
|
|
448
|
+
}
|
|
449
|
+
var An = 200;
|
|
450
|
+
function Tn(e, t) {
|
|
451
|
+
var r = this.__data__;
|
|
452
|
+
if (r instanceof m) {
|
|
453
|
+
var n = r.__data__;
|
|
454
|
+
if (!z || n.length < An - 1)
|
|
455
|
+
return n.push([e, t]), this.size = ++r.size, this;
|
|
456
|
+
r = this.__data__ = new w(n);
|
|
457
|
+
}
|
|
458
|
+
return r.set(e, t), this.size = r.size, this;
|
|
459
|
+
}
|
|
460
|
+
function O(e) {
|
|
461
|
+
var t = this.__data__ = new m(e);
|
|
462
|
+
this.size = t.size;
|
|
463
|
+
}
|
|
464
|
+
O.prototype.clear = vn;
|
|
465
|
+
O.prototype.delete = On;
|
|
466
|
+
O.prototype.get = mn;
|
|
467
|
+
O.prototype.has = wn;
|
|
468
|
+
O.prototype.set = Tn;
|
|
469
|
+
function it(e, t) {
|
|
470
|
+
for (var r = -1, n = e == null ? 0 : e.length, i = 0, s = []; ++r < n; ) {
|
|
471
|
+
var a = e[r];
|
|
472
|
+
t(a, r, e) && (s[i++] = a);
|
|
473
|
+
}
|
|
474
|
+
return s;
|
|
475
|
+
}
|
|
476
|
+
function En() {
|
|
477
|
+
return [];
|
|
478
|
+
}
|
|
479
|
+
var Pn = Object.prototype, Cn = Pn.propertyIsEnumerable, xe = Object.getOwnPropertySymbols, $n = xe ? function(e) {
|
|
480
|
+
return e == null ? [] : (e = Object(e), it(xe(e), function(t) {
|
|
481
|
+
return Cn.call(e, t);
|
|
482
|
+
}));
|
|
483
|
+
} : En;
|
|
484
|
+
function Sn(e, t, r) {
|
|
485
|
+
var n = t(e);
|
|
486
|
+
return p(e) ? n : nt(n, r(e));
|
|
487
|
+
}
|
|
488
|
+
function Ie(e) {
|
|
489
|
+
return Sn(e, y, $n);
|
|
490
|
+
}
|
|
491
|
+
var oe = I(T, "DataView"), ue = I(T, "Promise"), R = I(T, "Set"), Le = "[object Map]", xn = "[object Object]", Re = "[object Promise]", Me = "[object Set]", Ne = "[object WeakMap]", De = "[object DataView]", In = x(oe), Ln = x(z), Rn = x(ue), Mn = x(R), Nn = x(ae), v = H;
|
|
492
|
+
(oe && v(new oe(new ArrayBuffer(1))) != De || z && v(new z()) != Le || ue && v(ue.resolve()) != Re || R && v(new R()) != Me || ae && v(new ae()) != Ne) && (v = function(e) {
|
|
493
|
+
var t = H(e), r = t == xn ? e.constructor : void 0, n = r ? x(r) : "";
|
|
494
|
+
if (n)
|
|
495
|
+
switch (n) {
|
|
496
|
+
case In:
|
|
497
|
+
return De;
|
|
498
|
+
case Ln:
|
|
499
|
+
return Le;
|
|
500
|
+
case Rn:
|
|
501
|
+
return Re;
|
|
502
|
+
case Mn:
|
|
503
|
+
return Me;
|
|
504
|
+
case Nn:
|
|
505
|
+
return Ne;
|
|
506
|
+
}
|
|
507
|
+
return t;
|
|
508
|
+
});
|
|
509
|
+
var je = T.Uint8Array, Dn = "__lodash_hash_undefined__";
|
|
510
|
+
function jn(e) {
|
|
511
|
+
return this.__data__.set(e, Dn), this;
|
|
512
|
+
}
|
|
513
|
+
function Fn(e) {
|
|
514
|
+
return this.__data__.has(e);
|
|
515
|
+
}
|
|
516
|
+
function U(e) {
|
|
517
|
+
var t = -1, r = e == null ? 0 : e.length;
|
|
518
|
+
for (this.__data__ = new w(); ++t < r; )
|
|
519
|
+
this.add(e[t]);
|
|
520
|
+
}
|
|
521
|
+
U.prototype.add = U.prototype.push = jn;
|
|
522
|
+
U.prototype.has = Fn;
|
|
523
|
+
function Gn(e, t) {
|
|
524
|
+
for (var r = -1, n = e == null ? 0 : e.length; ++r < n; )
|
|
525
|
+
if (t(e[r], r, e))
|
|
526
|
+
return !0;
|
|
527
|
+
return !1;
|
|
528
|
+
}
|
|
529
|
+
function st(e, t) {
|
|
530
|
+
return e.has(t);
|
|
531
|
+
}
|
|
532
|
+
var zn = 1, Un = 2;
|
|
533
|
+
function at(e, t, r, n, i, s) {
|
|
534
|
+
var a = r & zn, o = e.length, u = t.length;
|
|
535
|
+
if (o != u && !(a && u > o))
|
|
536
|
+
return !1;
|
|
537
|
+
var f = s.get(e), l = s.get(t);
|
|
538
|
+
if (f && l)
|
|
539
|
+
return f == t && l == e;
|
|
540
|
+
var d = -1, c = !0, b = r & Un ? new U() : void 0;
|
|
541
|
+
for (s.set(e, t), s.set(t, e); ++d < o; ) {
|
|
542
|
+
var g = e[d], _ = t[d];
|
|
543
|
+
if (n)
|
|
544
|
+
var A = a ? n(_, g, d, t, e, s) : n(g, _, d, e, t, s);
|
|
545
|
+
if (A !== void 0) {
|
|
546
|
+
if (A)
|
|
547
|
+
continue;
|
|
548
|
+
c = !1;
|
|
549
|
+
break;
|
|
550
|
+
}
|
|
551
|
+
if (b) {
|
|
552
|
+
if (!Gn(t, function(E, P) {
|
|
553
|
+
if (!st(b, P) && (g === E || i(g, E, r, n, s)))
|
|
554
|
+
return b.push(P);
|
|
555
|
+
})) {
|
|
556
|
+
c = !1;
|
|
557
|
+
break;
|
|
558
|
+
}
|
|
559
|
+
} else if (!(g === _ || i(g, _, r, n, s))) {
|
|
560
|
+
c = !1;
|
|
561
|
+
break;
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
return s.delete(e), s.delete(t), c;
|
|
565
|
+
}
|
|
566
|
+
function Hn(e) {
|
|
567
|
+
var t = -1, r = Array(e.size);
|
|
568
|
+
return e.forEach(function(n, i) {
|
|
569
|
+
r[++t] = [i, n];
|
|
570
|
+
}), r;
|
|
571
|
+
}
|
|
572
|
+
function ge(e) {
|
|
573
|
+
var t = -1, r = Array(e.size);
|
|
574
|
+
return e.forEach(function(n) {
|
|
575
|
+
r[++t] = n;
|
|
576
|
+
}), r;
|
|
577
|
+
}
|
|
578
|
+
var Bn = 1, Kn = 2, qn = "[object Boolean]", Xn = "[object Date]", Yn = "[object Error]", Zn = "[object Map]", Wn = "[object Number]", Jn = "[object RegExp]", Qn = "[object Set]", Vn = "[object String]", kn = "[object Symbol]", ei = "[object ArrayBuffer]", ti = "[object DataView]", Fe = M ? M.prototype : void 0, ne = Fe ? Fe.valueOf : void 0;
|
|
579
|
+
function ri(e, t, r, n, i, s, a) {
|
|
580
|
+
switch (r) {
|
|
581
|
+
case ti:
|
|
582
|
+
if (e.byteLength != t.byteLength || e.byteOffset != t.byteOffset)
|
|
583
|
+
return !1;
|
|
584
|
+
e = e.buffer, t = t.buffer;
|
|
585
|
+
case ei:
|
|
586
|
+
return !(e.byteLength != t.byteLength || !s(new je(e), new je(t)));
|
|
587
|
+
case qn:
|
|
588
|
+
case Xn:
|
|
589
|
+
case Wn:
|
|
590
|
+
return We(+e, +t);
|
|
591
|
+
case Yn:
|
|
592
|
+
return e.name == t.name && e.message == t.message;
|
|
593
|
+
case Jn:
|
|
594
|
+
case Vn:
|
|
595
|
+
return e == t + "";
|
|
596
|
+
case Zn:
|
|
597
|
+
var o = Hn;
|
|
598
|
+
case Qn:
|
|
599
|
+
var u = n & Bn;
|
|
600
|
+
if (o || (o = ge), e.size != t.size && !u)
|
|
601
|
+
return !1;
|
|
602
|
+
var f = a.get(e);
|
|
603
|
+
if (f)
|
|
604
|
+
return f == t;
|
|
605
|
+
n |= Kn, a.set(e, t);
|
|
606
|
+
var l = at(o(e), o(t), n, i, s, a);
|
|
607
|
+
return a.delete(e), l;
|
|
608
|
+
case kn:
|
|
609
|
+
if (ne)
|
|
610
|
+
return ne.call(e) == ne.call(t);
|
|
611
|
+
}
|
|
612
|
+
return !1;
|
|
613
|
+
}
|
|
614
|
+
var ni = 1, ii = Object.prototype, si = ii.hasOwnProperty;
|
|
615
|
+
function ai(e, t, r, n, i, s) {
|
|
616
|
+
var a = r & ni, o = Ie(e), u = o.length, f = Ie(t), l = f.length;
|
|
617
|
+
if (u != l && !a)
|
|
618
|
+
return !1;
|
|
619
|
+
for (var d = u; d--; ) {
|
|
620
|
+
var c = o[d];
|
|
621
|
+
if (!(a ? c in t : si.call(t, c)))
|
|
622
|
+
return !1;
|
|
623
|
+
}
|
|
624
|
+
var b = s.get(e), g = s.get(t);
|
|
625
|
+
if (b && g)
|
|
626
|
+
return b == t && g == e;
|
|
627
|
+
var _ = !0;
|
|
628
|
+
s.set(e, t), s.set(t, e);
|
|
629
|
+
for (var A = a; ++d < u; ) {
|
|
630
|
+
c = o[d];
|
|
631
|
+
var E = e[c], P = t[c];
|
|
632
|
+
if (n)
|
|
633
|
+
var be = a ? n(P, E, c, t, e, s) : n(E, P, c, e, t, s);
|
|
634
|
+
if (!(be === void 0 ? E === P || i(E, P, r, n, s) : be)) {
|
|
635
|
+
_ = !1;
|
|
636
|
+
break;
|
|
637
|
+
}
|
|
638
|
+
A || (A = c == "constructor");
|
|
639
|
+
}
|
|
640
|
+
if (_ && !A) {
|
|
641
|
+
var B = e.constructor, K = t.constructor;
|
|
642
|
+
B != K && "constructor" in e && "constructor" in t && !(typeof B == "function" && B instanceof B && typeof K == "function" && K instanceof K) && (_ = !1);
|
|
643
|
+
}
|
|
644
|
+
return s.delete(e), s.delete(t), _;
|
|
645
|
+
}
|
|
646
|
+
var oi = 1, Ge = "[object Arguments]", ze = "[object Array]", q = "[object Object]", ui = Object.prototype, Ue = ui.hasOwnProperty;
|
|
647
|
+
function fi(e, t, r, n, i, s) {
|
|
648
|
+
var a = p(e), o = p(t), u = a ? ze : v(e), f = o ? ze : v(t);
|
|
649
|
+
u = u == Ge ? q : u, f = f == Ge ? q : f;
|
|
650
|
+
var l = u == q, d = f == q, c = u == f;
|
|
651
|
+
if (c && Z(e)) {
|
|
652
|
+
if (!Z(t))
|
|
653
|
+
return !1;
|
|
654
|
+
a = !0, l = !1;
|
|
655
|
+
}
|
|
656
|
+
if (c && !l)
|
|
657
|
+
return s || (s = new O()), a || ce(e) ? at(e, t, r, n, i, s) : ri(e, t, u, r, n, i, s);
|
|
658
|
+
if (!(r & oi)) {
|
|
659
|
+
var b = l && Ue.call(e, "__wrapped__"), g = d && Ue.call(t, "__wrapped__");
|
|
660
|
+
if (b || g) {
|
|
661
|
+
var _ = b ? e.value() : e, A = g ? t.value() : t;
|
|
662
|
+
return s || (s = new O()), i(_, A, r, n, s);
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
return c ? (s || (s = new O()), ai(e, t, r, n, i, s)) : !1;
|
|
666
|
+
}
|
|
667
|
+
function _e(e, t, r, n, i) {
|
|
668
|
+
return e === t ? !0 : e == null || t == null || !N(e) && !N(t) ? e !== e && t !== t : fi(e, t, r, n, _e, i);
|
|
669
|
+
}
|
|
670
|
+
var hi = 1, di = 2;
|
|
671
|
+
function ci(e, t, r, n) {
|
|
672
|
+
var i = r.length, s = i;
|
|
673
|
+
if (e == null)
|
|
674
|
+
return !s;
|
|
675
|
+
for (e = Object(e); i--; ) {
|
|
676
|
+
var a = r[i];
|
|
677
|
+
if (a[2] ? a[1] !== e[a[0]] : !(a[0] in e))
|
|
678
|
+
return !1;
|
|
679
|
+
}
|
|
680
|
+
for (; ++i < s; ) {
|
|
681
|
+
a = r[i];
|
|
682
|
+
var o = a[0], u = e[o], f = a[1];
|
|
683
|
+
if (a[2]) {
|
|
684
|
+
if (u === void 0 && !(o in e))
|
|
685
|
+
return !1;
|
|
686
|
+
} else {
|
|
687
|
+
var l = new O(), d;
|
|
688
|
+
if (!(d === void 0 ? _e(f, u, hi | di, n, l) : d))
|
|
689
|
+
return !1;
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
return !0;
|
|
693
|
+
}
|
|
694
|
+
function ot(e) {
|
|
695
|
+
return e === e && !he(e);
|
|
696
|
+
}
|
|
697
|
+
function li(e) {
|
|
698
|
+
for (var t = y(e), r = t.length; r--; ) {
|
|
699
|
+
var n = t[r], i = e[n];
|
|
700
|
+
t[r] = [n, i, ot(i)];
|
|
701
|
+
}
|
|
702
|
+
return t;
|
|
703
|
+
}
|
|
704
|
+
function ut(e, t) {
|
|
705
|
+
return function(r) {
|
|
706
|
+
return r == null ? !1 : r[e] === t && (t !== void 0 || e in Object(r));
|
|
707
|
+
};
|
|
708
|
+
}
|
|
709
|
+
function pi(e) {
|
|
710
|
+
var t = li(e);
|
|
711
|
+
return t.length == 1 && t[0][2] ? ut(t[0][0], t[0][1]) : function(r) {
|
|
712
|
+
return r === e || ci(r, e, t);
|
|
713
|
+
};
|
|
714
|
+
}
|
|
715
|
+
function gi(e, t) {
|
|
716
|
+
return e != null && t in Object(e);
|
|
717
|
+
}
|
|
718
|
+
function _i(e, t, r) {
|
|
719
|
+
t = tt(t, e);
|
|
720
|
+
for (var n = -1, i = t.length, s = !1; ++n < i; ) {
|
|
721
|
+
var a = ee(t[n]);
|
|
722
|
+
if (!(s = e != null && r(e, a)))
|
|
723
|
+
break;
|
|
724
|
+
e = e[a];
|
|
725
|
+
}
|
|
726
|
+
return s || ++n != i ? s : (i = e == null ? 0 : e.length, !!i && de(i) && Ze(a, i) && (p(e) || Q(e)));
|
|
727
|
+
}
|
|
728
|
+
function yi(e, t) {
|
|
729
|
+
return e != null && _i(e, t, gi);
|
|
730
|
+
}
|
|
731
|
+
var bi = 1, vi = 2;
|
|
732
|
+
function Oi(e, t) {
|
|
733
|
+
return le(e) && ot(t) ? ut(ee(e), t) : function(r) {
|
|
734
|
+
var n = gn(r, e);
|
|
735
|
+
return n === void 0 && n === t ? yi(r, e) : _e(t, n, bi | vi);
|
|
736
|
+
};
|
|
737
|
+
}
|
|
738
|
+
function mi(e) {
|
|
739
|
+
return function(t) {
|
|
740
|
+
return t?.[e];
|
|
741
|
+
};
|
|
742
|
+
}
|
|
743
|
+
function wi(e) {
|
|
744
|
+
return function(t) {
|
|
745
|
+
return rt(t, e);
|
|
746
|
+
};
|
|
747
|
+
}
|
|
748
|
+
function Ai(e) {
|
|
749
|
+
return le(e) ? mi(ee(e)) : wi(e);
|
|
750
|
+
}
|
|
751
|
+
function ft(e) {
|
|
752
|
+
return typeof e == "function" ? e : e == null ? W : typeof e == "object" ? p(e) ? Oi(e[0], e[1]) : pi(e) : Ai(e);
|
|
753
|
+
}
|
|
754
|
+
function Ti(e) {
|
|
755
|
+
return function(t, r, n) {
|
|
756
|
+
for (var i = -1, s = Object(t), a = n(t), o = a.length; o--; ) {
|
|
757
|
+
var u = a[++i];
|
|
758
|
+
if (r(s[u], u, s) === !1)
|
|
759
|
+
break;
|
|
760
|
+
}
|
|
761
|
+
return t;
|
|
762
|
+
};
|
|
763
|
+
}
|
|
764
|
+
var Ei = Ti();
|
|
765
|
+
function Pi(e, t) {
|
|
766
|
+
return e && Ei(e, t, y);
|
|
767
|
+
}
|
|
768
|
+
function Ci(e, t) {
|
|
769
|
+
return function(r, n) {
|
|
770
|
+
if (r == null)
|
|
771
|
+
return r;
|
|
772
|
+
if (!J(r))
|
|
773
|
+
return e(r, n);
|
|
774
|
+
for (var i = r.length, s = -1, a = Object(r); ++s < i && n(a[s], s, a) !== !1; )
|
|
775
|
+
;
|
|
776
|
+
return r;
|
|
777
|
+
};
|
|
778
|
+
}
|
|
779
|
+
var ye = Ci(Pi);
|
|
780
|
+
function $i(e) {
|
|
781
|
+
return N(e) && J(e);
|
|
782
|
+
}
|
|
783
|
+
function Si(e) {
|
|
784
|
+
return typeof e == "function" ? e : W;
|
|
785
|
+
}
|
|
786
|
+
function C(e, t) {
|
|
787
|
+
var r = p(e) ? Dt : ye;
|
|
788
|
+
return r(e, Si(t));
|
|
789
|
+
}
|
|
790
|
+
function xi(e, t) {
|
|
791
|
+
var r = [];
|
|
792
|
+
return ye(e, function(n, i, s) {
|
|
793
|
+
t(n, i, s) && r.push(n);
|
|
794
|
+
}), r;
|
|
795
|
+
}
|
|
796
|
+
function X(e, t) {
|
|
797
|
+
var r = p(e) ? it : xi;
|
|
798
|
+
return r(e, ft(t));
|
|
799
|
+
}
|
|
800
|
+
function Ii(e, t) {
|
|
801
|
+
return Xe(t, function(r) {
|
|
802
|
+
return e[r];
|
|
803
|
+
});
|
|
804
|
+
}
|
|
805
|
+
function ie(e) {
|
|
806
|
+
return e == null ? [] : Ii(e, y(e));
|
|
807
|
+
}
|
|
808
|
+
var Li = "[object Map]", Ri = "[object Set]", Mi = Object.prototype, Ni = Mi.hasOwnProperty;
|
|
809
|
+
function He(e) {
|
|
810
|
+
if (e == null)
|
|
811
|
+
return !0;
|
|
812
|
+
if (J(e) && (p(e) || typeof e == "string" || typeof e.splice == "function" || Z(e) || ce(e) || Q(e)))
|
|
813
|
+
return !e.length;
|
|
814
|
+
var t = v(e);
|
|
815
|
+
if (t == Li || t == Ri)
|
|
816
|
+
return !e.size;
|
|
817
|
+
if (Je(e))
|
|
818
|
+
return !et(e).length;
|
|
819
|
+
for (var r in e)
|
|
820
|
+
if (Ni.call(e, r))
|
|
821
|
+
return !1;
|
|
822
|
+
return !0;
|
|
823
|
+
}
|
|
824
|
+
function L(e) {
|
|
825
|
+
return e === void 0;
|
|
826
|
+
}
|
|
827
|
+
function Di(e, t, r, n, i) {
|
|
828
|
+
return i(e, function(s, a, o) {
|
|
829
|
+
r = n ? (n = !1, s) : t(r, s, a, o);
|
|
830
|
+
}), r;
|
|
831
|
+
}
|
|
832
|
+
function ji(e, t, r) {
|
|
833
|
+
var n = p(e) ? bn : Di, i = arguments.length < 3;
|
|
834
|
+
return n(e, ft(t), r, i, ye);
|
|
835
|
+
}
|
|
836
|
+
var Fi = 1 / 0, Gi = R && 1 / ge(new R([, -0]))[1] == Fi ? function(e) {
|
|
837
|
+
return new R(e);
|
|
838
|
+
} : St, zi = 200;
|
|
839
|
+
function Ui(e, t, r) {
|
|
840
|
+
var n = -1, i = Ut, s = e.length, a = !0, o = [], u = o;
|
|
841
|
+
if (s >= zi) {
|
|
842
|
+
var f = Gi(e);
|
|
843
|
+
if (f)
|
|
844
|
+
return ge(f);
|
|
845
|
+
a = !1, i = st, u = new U();
|
|
846
|
+
} else
|
|
847
|
+
u = o;
|
|
848
|
+
e:
|
|
849
|
+
for (; ++n < s; ) {
|
|
850
|
+
var l = e[n], d = l;
|
|
851
|
+
if (l = l !== 0 ? l : 0, a && d === d) {
|
|
852
|
+
for (var c = u.length; c--; )
|
|
853
|
+
if (u[c] === d)
|
|
854
|
+
continue e;
|
|
855
|
+
o.push(l);
|
|
856
|
+
} else i(u, d, r) || (u !== o && u.push(d), o.push(l));
|
|
857
|
+
}
|
|
858
|
+
return o;
|
|
859
|
+
}
|
|
860
|
+
var Hi = qt(function(e) {
|
|
861
|
+
return Ui(yn(e, 1, $i, !0));
|
|
862
|
+
}), Bi = "\0", $ = "\0", Be = "";
|
|
863
|
+
class ht {
|
|
864
|
+
/**
|
|
865
|
+
* @param {GraphOptions} [opts] - Graph options.
|
|
866
|
+
*/
|
|
867
|
+
constructor(t = {}) {
|
|
868
|
+
this._isDirected = Object.prototype.hasOwnProperty.call(t, "directed") ? t.directed : !0, this._isMultigraph = Object.prototype.hasOwnProperty.call(t, "multigraph") ? t.multigraph : !1, this._isCompound = Object.prototype.hasOwnProperty.call(t, "compound") ? t.compound : !1, this._label = void 0, this._defaultNodeLabelFn = D(void 0), this._defaultEdgeLabelFn = D(void 0), this._nodes = {}, this._isCompound && (this._parent = {}, this._children = {}, this._children[$] = {}), this._in = {}, this._preds = {}, this._out = {}, this._sucs = {}, this._edgeObjs = {}, this._edgeLabels = {};
|
|
869
|
+
}
|
|
870
|
+
/* === Graph functions ========= */
|
|
871
|
+
/**
|
|
872
|
+
*
|
|
873
|
+
* @returns {boolean} `true` if the graph is [directed](https://en.wikipedia.org/wiki/Directed_graph).
|
|
874
|
+
* A directed graph treats the order of nodes in an edge as significant whereas an
|
|
875
|
+
* [undirected](https://en.wikipedia.org/wiki/Graph_(mathematics)#Undirected_graph)
|
|
876
|
+
* graph does not.
|
|
877
|
+
* This example demonstrates the difference:
|
|
878
|
+
*
|
|
879
|
+
* @example
|
|
880
|
+
*
|
|
881
|
+
* ```js
|
|
882
|
+
* var directed = new Graph({ directed: true });
|
|
883
|
+
* directed.setEdge("a", "b", "my-label");
|
|
884
|
+
* directed.edge("a", "b"); // returns "my-label"
|
|
885
|
+
* directed.edge("b", "a"); // returns undefined
|
|
886
|
+
*
|
|
887
|
+
* var undirected = new Graph({ directed: false });
|
|
888
|
+
* undirected.setEdge("a", "b", "my-label");
|
|
889
|
+
* undirected.edge("a", "b"); // returns "my-label"
|
|
890
|
+
* undirected.edge("b", "a"); // returns "my-label"
|
|
891
|
+
* ```
|
|
892
|
+
*/
|
|
893
|
+
isDirected() {
|
|
894
|
+
return this._isDirected;
|
|
895
|
+
}
|
|
896
|
+
/**
|
|
897
|
+
* @returns {boolean} `true` if the graph is a multigraph.
|
|
898
|
+
*/
|
|
899
|
+
isMultigraph() {
|
|
900
|
+
return this._isMultigraph;
|
|
901
|
+
}
|
|
902
|
+
/**
|
|
903
|
+
* @returns {boolean} `true` if the graph is compound.
|
|
904
|
+
*/
|
|
905
|
+
isCompound() {
|
|
906
|
+
return this._isCompound;
|
|
907
|
+
}
|
|
908
|
+
/**
|
|
909
|
+
* Sets the label for the graph to `label`.
|
|
910
|
+
*
|
|
911
|
+
* @param {GraphLabel} label - Label for the graph.
|
|
912
|
+
* @returns {this}
|
|
913
|
+
*/
|
|
914
|
+
setGraph(t) {
|
|
915
|
+
return this._label = t, this;
|
|
916
|
+
}
|
|
917
|
+
/**
|
|
918
|
+
* @returns {GraphLabel | undefined} the currently assigned label for the graph.
|
|
919
|
+
* If no label has been assigned, returns `undefined`.
|
|
920
|
+
*
|
|
921
|
+
* @example
|
|
922
|
+
*
|
|
923
|
+
* ```js
|
|
924
|
+
* var g = new Graph();
|
|
925
|
+
* g.graph(); // returns undefined
|
|
926
|
+
* g.setGraph("graph-label");
|
|
927
|
+
* g.graph(); // returns "graph-label"
|
|
928
|
+
* ```
|
|
929
|
+
*/
|
|
930
|
+
graph() {
|
|
931
|
+
return this._label;
|
|
932
|
+
}
|
|
933
|
+
/* === Node functions ========== */
|
|
934
|
+
/**
|
|
935
|
+
* Sets a new default value that is assigned to nodes that are created without
|
|
936
|
+
* a label.
|
|
937
|
+
*
|
|
938
|
+
* @param {typeof this._defaultNodeLabelFn | NodeLabel} newDefault - If a function,
|
|
939
|
+
* it is called with the id of the node being created.
|
|
940
|
+
* Otherwise, it is assigned as the label directly.
|
|
941
|
+
* @returns {this}
|
|
942
|
+
*/
|
|
943
|
+
setDefaultNodeLabel(t) {
|
|
944
|
+
return Y(t) || (t = D(t)), this._defaultNodeLabelFn = t, this;
|
|
945
|
+
}
|
|
946
|
+
/**
|
|
947
|
+
* @returns {number} the number of nodes in the graph.
|
|
948
|
+
*/
|
|
949
|
+
nodeCount() {
|
|
950
|
+
return this._nodeCount;
|
|
951
|
+
}
|
|
952
|
+
/**
|
|
953
|
+
* @returns {NodeID[]} the ids of the nodes in the graph.
|
|
954
|
+
*
|
|
955
|
+
* @remarks
|
|
956
|
+
* Use {@link node()} to get the label for each node.
|
|
957
|
+
* Takes `O(|V|)` time.
|
|
958
|
+
*/
|
|
959
|
+
nodes() {
|
|
960
|
+
return y(this._nodes);
|
|
961
|
+
}
|
|
962
|
+
/**
|
|
963
|
+
* @returns {NodeID[]} those nodes in the graph that have no in-edges.
|
|
964
|
+
* @remarks Takes `O(|V|)` time.
|
|
965
|
+
*/
|
|
966
|
+
sources() {
|
|
967
|
+
var t = this;
|
|
968
|
+
return X(this.nodes(), function(r) {
|
|
969
|
+
return He(t._in[r]);
|
|
970
|
+
});
|
|
971
|
+
}
|
|
972
|
+
/**
|
|
973
|
+
* @returns {NodeID[]} those nodes in the graph that have no out-edges.
|
|
974
|
+
* @remarks Takes `O(|V|)` time.
|
|
975
|
+
*/
|
|
976
|
+
sinks() {
|
|
977
|
+
var t = this;
|
|
978
|
+
return X(this.nodes(), function(r) {
|
|
979
|
+
return He(t._out[r]);
|
|
980
|
+
});
|
|
981
|
+
}
|
|
982
|
+
/**
|
|
983
|
+
* Invokes setNode method for each node in `vs` list.
|
|
984
|
+
*
|
|
985
|
+
* @param {Collection<NodeID | number>} vs - List of node IDs to create/set.
|
|
986
|
+
* @param {NodeLabel} [value] - If set, update all nodes with this value.
|
|
987
|
+
* @returns {this}
|
|
988
|
+
* @remarks Complexity: O(|names|).
|
|
989
|
+
*/
|
|
990
|
+
setNodes(t, r) {
|
|
991
|
+
var n = arguments, i = this;
|
|
992
|
+
return C(t, function(s) {
|
|
993
|
+
n.length > 1 ? i.setNode(s, r) : i.setNode(s);
|
|
994
|
+
}), this;
|
|
995
|
+
}
|
|
996
|
+
/**
|
|
997
|
+
* Creates or updates the value for the node `v` in the graph.
|
|
998
|
+
*
|
|
999
|
+
* @param {NodeID | number} v - ID of the node to create/set.
|
|
1000
|
+
* @param {NodeLabel} [value] - If supplied, it is set as the value for the node.
|
|
1001
|
+
* If not supplied and the node was created by this call then
|
|
1002
|
+
* {@link setDefaultNodeLabel} will be used to set the node's value.
|
|
1003
|
+
* @returns {this} the graph, allowing this to be chained with other functions.
|
|
1004
|
+
* @remarks Takes `O(1)` time.
|
|
1005
|
+
*/
|
|
1006
|
+
setNode(t, r) {
|
|
1007
|
+
return Object.prototype.hasOwnProperty.call(this._nodes, t) ? (arguments.length > 1 && (this._nodes[t] = r), this) : (this._nodes[t] = arguments.length > 1 ? r : this._defaultNodeLabelFn(t), this._isCompound && (this._parent[t] = $, this._children[t] = {}, this._children[$][t] = !0), this._in[t] = {}, this._preds[t] = {}, this._out[t] = {}, this._sucs[t] = {}, ++this._nodeCount, this);
|
|
1008
|
+
}
|
|
1009
|
+
/**
|
|
1010
|
+
* Gets the label of node with specified name.
|
|
1011
|
+
*
|
|
1012
|
+
* @param {NodeID | number} v - Node ID.
|
|
1013
|
+
* @returns {NodeLabel | undefined} the label assigned to the node with the id `v`
|
|
1014
|
+
* if it is in the graph.
|
|
1015
|
+
* Otherwise returns `undefined`.
|
|
1016
|
+
* @remarks Takes `O(1)` time.
|
|
1017
|
+
*/
|
|
1018
|
+
node(t) {
|
|
1019
|
+
return this._nodes[t];
|
|
1020
|
+
}
|
|
1021
|
+
/**
|
|
1022
|
+
* Detects whether graph has a node with specified name or not.
|
|
1023
|
+
*
|
|
1024
|
+
* @param {NodeID | number} v - Node ID.
|
|
1025
|
+
* @returns {boolean} Returns `true` the graph has a node with the id.
|
|
1026
|
+
* @remarks Takes `O(1)` time.
|
|
1027
|
+
*/
|
|
1028
|
+
hasNode(t) {
|
|
1029
|
+
return Object.prototype.hasOwnProperty.call(this._nodes, t);
|
|
1030
|
+
}
|
|
1031
|
+
/**
|
|
1032
|
+
* Remove the node with the id `v` in the graph or do nothing if the node is
|
|
1033
|
+
* not in the graph.
|
|
1034
|
+
*
|
|
1035
|
+
* If the node was removed this function also removes any incident edges.
|
|
1036
|
+
*
|
|
1037
|
+
* @param {NodeID | number} v - Node ID to remove.
|
|
1038
|
+
* @returns {this} the graph, allowing this to be chained with other functions.
|
|
1039
|
+
* @remarks Takes `O(|E|)` time.
|
|
1040
|
+
*/
|
|
1041
|
+
removeNode(t) {
|
|
1042
|
+
if (Object.prototype.hasOwnProperty.call(this._nodes, t)) {
|
|
1043
|
+
var r = (n) => this.removeEdge(this._edgeObjs[n]);
|
|
1044
|
+
delete this._nodes[t], this._isCompound && (this._removeFromParentsChildList(t), delete this._parent[t], C(this.children(t), (n) => {
|
|
1045
|
+
this.setParent(n);
|
|
1046
|
+
}), delete this._children[t]), C(y(this._in[t]), r), delete this._in[t], delete this._preds[t], C(y(this._out[t]), r), delete this._out[t], delete this._sucs[t], --this._nodeCount;
|
|
1047
|
+
}
|
|
1048
|
+
return this;
|
|
1049
|
+
}
|
|
1050
|
+
/**
|
|
1051
|
+
* Sets the parent for `v` to `parent` if it is defined or removes the parent
|
|
1052
|
+
* for `v` if `parent` is undefined.
|
|
1053
|
+
*
|
|
1054
|
+
* @param {NodeID | number} v - Node ID to set the parent for.
|
|
1055
|
+
* @param {NodeID | number} [parent] - Parent node ID. If not defined, removes the parent.
|
|
1056
|
+
* @returns {this} the graph, allowing this to be chained with other functions.
|
|
1057
|
+
* @throws if the graph is not compound.
|
|
1058
|
+
* @throws if setting the parent would create a cycle.
|
|
1059
|
+
* @remarks Takes `O(1)` time.
|
|
1060
|
+
*/
|
|
1061
|
+
setParent(t, r) {
|
|
1062
|
+
if (!this._isCompound)
|
|
1063
|
+
throw new Error("Cannot set parent in a non-compound graph");
|
|
1064
|
+
if (L(r))
|
|
1065
|
+
r = $;
|
|
1066
|
+
else {
|
|
1067
|
+
r += "";
|
|
1068
|
+
for (var n = r; !L(n); n = this.parent(n))
|
|
1069
|
+
if (n === t)
|
|
1070
|
+
throw new Error("Setting " + r + " as parent of " + t + " would create a cycle");
|
|
1071
|
+
this.setNode(r);
|
|
1072
|
+
}
|
|
1073
|
+
return this.setNode(t), this._removeFromParentsChildList(t), this._parent[t] = r, this._children[r][t] = !0, this;
|
|
1074
|
+
}
|
|
1075
|
+
/**
|
|
1076
|
+
* @private
|
|
1077
|
+
* @param {NodeID | number} v - Node ID.
|
|
1078
|
+
*/
|
|
1079
|
+
_removeFromParentsChildList(t) {
|
|
1080
|
+
delete this._children[this._parent[t]][t];
|
|
1081
|
+
}
|
|
1082
|
+
/**
|
|
1083
|
+
* Get parent node for node `v`.
|
|
1084
|
+
*
|
|
1085
|
+
* @param {NodeID | number} v - Node ID.
|
|
1086
|
+
* @returns {NodeID | undefined} the node that is a parent of node `v`
|
|
1087
|
+
* or `undefined` if node `v` does not have a parent or is not a member of
|
|
1088
|
+
* the graph.
|
|
1089
|
+
* Always returns `undefined` for graphs that are not compound.
|
|
1090
|
+
* @remarks Takes `O(1)` time.
|
|
1091
|
+
*/
|
|
1092
|
+
parent(t) {
|
|
1093
|
+
if (this._isCompound) {
|
|
1094
|
+
var r = this._parent[t];
|
|
1095
|
+
if (r !== $)
|
|
1096
|
+
return r;
|
|
1097
|
+
}
|
|
1098
|
+
}
|
|
1099
|
+
/**
|
|
1100
|
+
* Gets list of direct children of node v.
|
|
1101
|
+
*
|
|
1102
|
+
* @param {NodeID | number} [v] - Node ID. If not specified, gets nodes
|
|
1103
|
+
* with no parent (top-level nodes).
|
|
1104
|
+
* @returns {NodeID[] | undefined} all nodes that are children of node `v` or
|
|
1105
|
+
* `undefined` if node `v` is not in the graph.
|
|
1106
|
+
* Always returns `[]` for graphs that are not compound.
|
|
1107
|
+
* @remarks Takes `O(|V|)` time.
|
|
1108
|
+
*/
|
|
1109
|
+
children(t) {
|
|
1110
|
+
if (L(t) && (t = $), this._isCompound) {
|
|
1111
|
+
var r = this._children[t];
|
|
1112
|
+
if (r)
|
|
1113
|
+
return y(r);
|
|
1114
|
+
} else {
|
|
1115
|
+
if (t === $)
|
|
1116
|
+
return this.nodes();
|
|
1117
|
+
if (this.hasNode(t))
|
|
1118
|
+
return [];
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
1121
|
+
/**
|
|
1122
|
+
* @param {NodeID | number} v - Node ID.
|
|
1123
|
+
* @returns {NodeID[] | undefined} all nodes that are predecessors of the
|
|
1124
|
+
* specified node or `undefined` if node `v` is not in the graph.
|
|
1125
|
+
* @remarks
|
|
1126
|
+
* Behavior is undefined for undirected graphs - use {@link neighbors} instead.
|
|
1127
|
+
* Takes `O(|V|)` time.
|
|
1128
|
+
*/
|
|
1129
|
+
predecessors(t) {
|
|
1130
|
+
var r = this._preds[t];
|
|
1131
|
+
if (r)
|
|
1132
|
+
return y(r);
|
|
1133
|
+
}
|
|
1134
|
+
/**
|
|
1135
|
+
* @param {NodeID | number} v - Node ID.
|
|
1136
|
+
* @returns {NodeID[] | undefined} all nodes that are successors of the
|
|
1137
|
+
* specified node or `undefined` if node `v` is not in the graph.
|
|
1138
|
+
* @remarks
|
|
1139
|
+
* Behavior is undefined for undirected graphs - use {@link neighbors} instead.
|
|
1140
|
+
* Takes `O(|V|)` time.
|
|
1141
|
+
*/
|
|
1142
|
+
successors(t) {
|
|
1143
|
+
var r = this._sucs[t];
|
|
1144
|
+
if (r)
|
|
1145
|
+
return y(r);
|
|
1146
|
+
}
|
|
1147
|
+
/**
|
|
1148
|
+
* @param {NodeID | number} v - Node ID.
|
|
1149
|
+
* @returns {NodeID[] | undefined} all nodes that are predecessors or
|
|
1150
|
+
* successors of the specified node
|
|
1151
|
+
* or `undefined` if node `v` is not in the graph.
|
|
1152
|
+
* @remarks Takes `O(|V|)` time.
|
|
1153
|
+
*/
|
|
1154
|
+
neighbors(t) {
|
|
1155
|
+
var r = this.predecessors(t);
|
|
1156
|
+
if (r)
|
|
1157
|
+
return Hi(r, this.successors(t));
|
|
1158
|
+
}
|
|
1159
|
+
/**
|
|
1160
|
+
* @param {NodeID | number} v - Node ID.
|
|
1161
|
+
* @returns {boolean} True if the node is a leaf (has no successors), false otherwise.
|
|
1162
|
+
*/
|
|
1163
|
+
isLeaf(t) {
|
|
1164
|
+
var r;
|
|
1165
|
+
return this.isDirected() ? r = this.successors(t) : r = this.neighbors(t), r.length === 0;
|
|
1166
|
+
}
|
|
1167
|
+
/**
|
|
1168
|
+
* Creates new graph with nodes filtered via `filter`.
|
|
1169
|
+
* Edges incident to rejected node
|
|
1170
|
+
* are also removed.
|
|
1171
|
+
*
|
|
1172
|
+
* In case of compound graph, if parent is rejected by `filter`,
|
|
1173
|
+
* than all its children are rejected too.
|
|
1174
|
+
|
|
1175
|
+
* @param {(v: NodeID) => boolean} filter - Function that returns `true` for nodes to keep.
|
|
1176
|
+
* @returns {Graph<GraphLabel, NodeLabel, EdgeLabel>} A new graph containing only the nodes for which `filter` returns `true`.
|
|
1177
|
+
* @remarks Average-case complexity: O(|E|+|V|).
|
|
1178
|
+
*/
|
|
1179
|
+
filterNodes(t) {
|
|
1180
|
+
var r = new this.constructor({
|
|
1181
|
+
directed: this._isDirected,
|
|
1182
|
+
multigraph: this._isMultigraph,
|
|
1183
|
+
compound: this._isCompound
|
|
1184
|
+
});
|
|
1185
|
+
r.setGraph(this.graph());
|
|
1186
|
+
var n = this;
|
|
1187
|
+
C(this._nodes, function(a, o) {
|
|
1188
|
+
t(o) && r.setNode(o, a);
|
|
1189
|
+
}), C(this._edgeObjs, function(a) {
|
|
1190
|
+
r.hasNode(a.v) && r.hasNode(a.w) && r.setEdge(a, n.edge(a));
|
|
1191
|
+
});
|
|
1192
|
+
var i = {};
|
|
1193
|
+
function s(a) {
|
|
1194
|
+
var o = n.parent(a);
|
|
1195
|
+
return o === void 0 || r.hasNode(o) ? (i[a] = o, o) : o in i ? i[o] : s(o);
|
|
1196
|
+
}
|
|
1197
|
+
return this._isCompound && C(r.nodes(), function(a) {
|
|
1198
|
+
r.setParent(a, s(a));
|
|
1199
|
+
}), r;
|
|
1200
|
+
}
|
|
1201
|
+
/* === Edge functions ========== */
|
|
1202
|
+
/**
|
|
1203
|
+
* Sets a new default value that is assigned to edges that are created without
|
|
1204
|
+
* a label.
|
|
1205
|
+
*
|
|
1206
|
+
* @param {typeof this._defaultEdgeLabelFn | EdgeLabel} newDefault - If a function,
|
|
1207
|
+
* it is called with the parameters `(v, w, name)`.
|
|
1208
|
+
* Otherwise, it is assigned as the label directly.
|
|
1209
|
+
* @returns {this}
|
|
1210
|
+
*/
|
|
1211
|
+
setDefaultEdgeLabel(t) {
|
|
1212
|
+
return Y(t) || (t = D(t)), this._defaultEdgeLabelFn = t, this;
|
|
1213
|
+
}
|
|
1214
|
+
/**
|
|
1215
|
+
* @returns {number} the number of edges in the graph.
|
|
1216
|
+
* @remarks Complexity: O(1).
|
|
1217
|
+
*/
|
|
1218
|
+
edgeCount() {
|
|
1219
|
+
return this._edgeCount;
|
|
1220
|
+
}
|
|
1221
|
+
/**
|
|
1222
|
+
* Gets edges of the graph.
|
|
1223
|
+
*
|
|
1224
|
+
* @returns {EdgeObj[]} the {@link EdgeObj} for each edge in the graph.
|
|
1225
|
+
*
|
|
1226
|
+
* @remarks
|
|
1227
|
+
* In case of compound graph subgraphs are not considered.
|
|
1228
|
+
* Use {@link edge()} to get the label for each edge.
|
|
1229
|
+
* Takes `O(|E|)` time.
|
|
1230
|
+
*/
|
|
1231
|
+
edges() {
|
|
1232
|
+
return ie(this._edgeObjs);
|
|
1233
|
+
}
|
|
1234
|
+
/**
|
|
1235
|
+
* Establish an edges path over the nodes in nodes list.
|
|
1236
|
+
*
|
|
1237
|
+
* If some edge is already exists, it will update its label, otherwise it will
|
|
1238
|
+
* create an edge between pair of nodes with label provided or default label
|
|
1239
|
+
* if no label provided.
|
|
1240
|
+
*
|
|
1241
|
+
* @param {Collection<NodeID>} vs - List of node IDs to create edges between.
|
|
1242
|
+
* @param {EdgeLabel} [value] - If set, update all edges with this value.
|
|
1243
|
+
* @returns {this}
|
|
1244
|
+
* @remarks Complexity: O(|nodes|).
|
|
1245
|
+
*/
|
|
1246
|
+
setPath(t, r) {
|
|
1247
|
+
var n = this, i = arguments;
|
|
1248
|
+
return ji(t, function(s, a) {
|
|
1249
|
+
return i.length > 1 ? n.setEdge(s, a, r) : n.setEdge(s, a), a;
|
|
1250
|
+
}), this;
|
|
1251
|
+
}
|
|
1252
|
+
/**
|
|
1253
|
+
* Creates or updates the label for the edge (`v`, `w`) with the optionally
|
|
1254
|
+
* supplied `name`.
|
|
1255
|
+
*
|
|
1256
|
+
* @overload
|
|
1257
|
+
* @param {EdgeObj} arg0 - Edge object.
|
|
1258
|
+
* @param {EdgeLabel} [value] - If supplied, it is set as the label for the edge.
|
|
1259
|
+
* If not supplied and the edge was created by this call then
|
|
1260
|
+
* {@link setDefaultEdgeLabel} will be used to assign the edge's label.
|
|
1261
|
+
* @returns {this} the graph, allowing this to be chained with other functions.
|
|
1262
|
+
* @remarks Takes `O(1)` time.
|
|
1263
|
+
*/
|
|
1264
|
+
/**
|
|
1265
|
+
* Creates or updates the label for the edge (`v`, `w`) with the optionally
|
|
1266
|
+
* supplied `name`.
|
|
1267
|
+
*
|
|
1268
|
+
* @overload
|
|
1269
|
+
* @param {NodeID | number} v - Source node ID. Number values will be coerced to strings.
|
|
1270
|
+
* @param {NodeID | number} w - Target node ID. Number values will be coerced to strings.
|
|
1271
|
+
* @param {EdgeLabel} [value] - If supplied, it is set as the label for the edge.
|
|
1272
|
+
* If not supplied and the edge was created by this call then
|
|
1273
|
+
* {@link setDefaultEdgeLabel} will be used to assign the edge's label.
|
|
1274
|
+
* @param {string | number} [name] - Edge name. Only useful with multigraphs.
|
|
1275
|
+
* @returns {this} the graph, allowing this to be chained with other functions.
|
|
1276
|
+
* @remarks Takes `O(1)` time.
|
|
1277
|
+
*/
|
|
1278
|
+
setEdge() {
|
|
1279
|
+
var t, r, n, i, s = !1, a = arguments[0];
|
|
1280
|
+
typeof a == "object" && a !== null && "v" in a ? (t = a.v, r = a.w, n = a.name, arguments.length === 2 && (i = arguments[1], s = !0)) : (t = a, r = arguments[1], n = arguments[3], arguments.length > 2 && (i = arguments[2], s = !0)), t = "" + t, r = "" + r, L(n) || (n = "" + n);
|
|
1281
|
+
var o = j(this._isDirected, t, r, n);
|
|
1282
|
+
if (Object.prototype.hasOwnProperty.call(this._edgeLabels, o))
|
|
1283
|
+
return s && (this._edgeLabels[o] = i), this;
|
|
1284
|
+
if (!L(n) && !this._isMultigraph)
|
|
1285
|
+
throw new Error("Cannot set a named edge when isMultigraph = false");
|
|
1286
|
+
this.setNode(t), this.setNode(r), this._edgeLabels[o] = s ? i : this._defaultEdgeLabelFn(t, r, n);
|
|
1287
|
+
var u = Ki(this._isDirected, t, r, n);
|
|
1288
|
+
return t = u.v, r = u.w, Object.freeze(u), this._edgeObjs[o] = u, Ke(this._preds[r], t), Ke(this._sucs[t], r), this._in[r][o] = u, this._out[t][o] = u, this._edgeCount++, this;
|
|
1289
|
+
}
|
|
1290
|
+
/**
|
|
1291
|
+
* Gets the label for the specified edge.
|
|
1292
|
+
*
|
|
1293
|
+
* @overload
|
|
1294
|
+
* @param {EdgeObj} v - Edge object.
|
|
1295
|
+
* @returns {EdgeLabel | undefined} the label for the edge (`v`, `w`) if the
|
|
1296
|
+
* graph has an edge between `v` and `w` with the optional `name`.
|
|
1297
|
+
* Returned `undefined` if there is no such edge in the graph.
|
|
1298
|
+
* @remarks
|
|
1299
|
+
* `v` and `w` can be interchanged for undirected graphs.
|
|
1300
|
+
* Takes `O(1)` time.
|
|
1301
|
+
*/
|
|
1302
|
+
/**
|
|
1303
|
+
* Gets the label for the specified edge.
|
|
1304
|
+
*
|
|
1305
|
+
* @overload
|
|
1306
|
+
* @param {NodeID | number} v - Source node ID.
|
|
1307
|
+
* @param {NodeID | number} w - Target node ID.
|
|
1308
|
+
* @param {string | number} [name] - Edge name. Only useful with multigraphs.
|
|
1309
|
+
* @returns {EdgeLabel | undefined} the label for the edge (`v`, `w`) if the
|
|
1310
|
+
* graph has an edge between `v` and `w` with the optional `name`.
|
|
1311
|
+
* Returned `undefined` if there is no such edge in the graph.
|
|
1312
|
+
* @remarks
|
|
1313
|
+
* `v` and `w` can be interchanged for undirected graphs.
|
|
1314
|
+
* Takes `O(1)` time.
|
|
1315
|
+
*/
|
|
1316
|
+
edge(t, r, n) {
|
|
1317
|
+
var i = arguments.length === 1 ? se(this._isDirected, arguments[0]) : j(this._isDirected, t, r, n);
|
|
1318
|
+
return this._edgeLabels[i];
|
|
1319
|
+
}
|
|
1320
|
+
/**
|
|
1321
|
+
* Detects whether the graph contains specified edge or not.
|
|
1322
|
+
*
|
|
1323
|
+
* @overload
|
|
1324
|
+
* @param {EdgeObj} v - Edge object.
|
|
1325
|
+
* @returns {boolean} `true` if the graph has an edge between `v` and `w`
|
|
1326
|
+
* with the optional `name`.
|
|
1327
|
+
* @remarks
|
|
1328
|
+
* `v` and `w` can be interchanged for undirected graphs.
|
|
1329
|
+
* No subgraphs are considered.
|
|
1330
|
+
* Takes `O(1)` time.
|
|
1331
|
+
*/
|
|
1332
|
+
/**
|
|
1333
|
+
* Detects whether the graph contains specified edge or not.
|
|
1334
|
+
*
|
|
1335
|
+
* @overload
|
|
1336
|
+
* @param {NodeID | number} v - Source node ID.
|
|
1337
|
+
* @param {NodeID | number} w - Target node ID.
|
|
1338
|
+
* @param {string | number} [name] - Edge name. Only useful with multigraphs.
|
|
1339
|
+
* @returns {boolean} `true` if the graph has an edge between `v` and `w`
|
|
1340
|
+
* with the optional `name`.
|
|
1341
|
+
* @remarks
|
|
1342
|
+
* `v` and `w` can be interchanged for undirected graphs.
|
|
1343
|
+
* No subgraphs are considered.
|
|
1344
|
+
* Takes `O(1)` time.
|
|
1345
|
+
*/
|
|
1346
|
+
hasEdge(t, r, n) {
|
|
1347
|
+
var i = arguments.length === 1 ? se(this._isDirected, arguments[0]) : j(this._isDirected, t, r, n);
|
|
1348
|
+
return Object.prototype.hasOwnProperty.call(this._edgeLabels, i);
|
|
1349
|
+
}
|
|
1350
|
+
/**
|
|
1351
|
+
* Removes the edge (`v`, `w`) if the graph has an edge between `v` and `w`
|
|
1352
|
+
* with the optional `name`. If not this function does nothing.
|
|
1353
|
+
*
|
|
1354
|
+
* @overload
|
|
1355
|
+
* @param {EdgeObj} v - Edge object.
|
|
1356
|
+
* @returns {this}
|
|
1357
|
+
* @remarks
|
|
1358
|
+
* `v` and `w` can be interchanged for undirected graphs.
|
|
1359
|
+
* No subgraphs are considered.
|
|
1360
|
+
* Takes `O(1)` time.
|
|
1361
|
+
*/
|
|
1362
|
+
/**
|
|
1363
|
+
* Removes the edge (`v`, `w`) if the graph has an edge between `v` and `w`
|
|
1364
|
+
* with the optional `name`. If not this function does nothing.
|
|
1365
|
+
*
|
|
1366
|
+
* @overload
|
|
1367
|
+
* @param {NodeID | number} v - Source node ID.
|
|
1368
|
+
* @param {NodeID | number} w - Target node ID.
|
|
1369
|
+
* @param {string | number} [name] - Edge name. Only useful with multigraphs.
|
|
1370
|
+
* @returns {this}
|
|
1371
|
+
* @remarks
|
|
1372
|
+
* `v` and `w` can be interchanged for undirected graphs.
|
|
1373
|
+
* Takes `O(1)` time.
|
|
1374
|
+
*/
|
|
1375
|
+
removeEdge(t, r, n) {
|
|
1376
|
+
var i = arguments.length === 1 ? se(this._isDirected, arguments[0]) : j(this._isDirected, t, r, n), s = this._edgeObjs[i];
|
|
1377
|
+
return s && (t = s.v, r = s.w, delete this._edgeLabels[i], delete this._edgeObjs[i], qe(this._preds[r], t), qe(this._sucs[t], r), delete this._in[r][i], delete this._out[t][i], this._edgeCount--), this;
|
|
1378
|
+
}
|
|
1379
|
+
/**
|
|
1380
|
+
* @param {NodeID | number} v - Target node ID.
|
|
1381
|
+
* @param {NodeID | number} [u] - Optionally filters edges down to just those
|
|
1382
|
+
* coming from node `u`.
|
|
1383
|
+
* @returns {EdgeObj[] | undefined} all edges that point to the node `v`.
|
|
1384
|
+
* Returns `undefined` if node `v` is not in the graph.
|
|
1385
|
+
* @remarks
|
|
1386
|
+
* Behavior is undefined for undirected graphs - use {@link nodeEdges} instead.
|
|
1387
|
+
* Takes `O(|E|)` time.
|
|
1388
|
+
*/
|
|
1389
|
+
inEdges(t, r) {
|
|
1390
|
+
var n = this._in[t];
|
|
1391
|
+
if (n) {
|
|
1392
|
+
var i = ie(n);
|
|
1393
|
+
return r ? X(i, function(s) {
|
|
1394
|
+
return s.v === r;
|
|
1395
|
+
}) : i;
|
|
1396
|
+
}
|
|
1397
|
+
}
|
|
1398
|
+
/**
|
|
1399
|
+
* @param {NodeID | number} v - Target node ID.
|
|
1400
|
+
* @param {NodeID | number} [w] - Optionally filters edges down to just those
|
|
1401
|
+
* that point to `w`.
|
|
1402
|
+
* @returns {EdgeObj[] | undefined} all edges that point to the node `v`.
|
|
1403
|
+
* Returns `undefined` if node `v` is not in the graph.
|
|
1404
|
+
* @remarks
|
|
1405
|
+
* Behavior is undefined for undirected graphs - use {@link nodeEdges} instead.
|
|
1406
|
+
* Takes `O(|E|)` time.
|
|
1407
|
+
*/
|
|
1408
|
+
outEdges(t, r) {
|
|
1409
|
+
var n = this._out[t];
|
|
1410
|
+
if (n) {
|
|
1411
|
+
var i = ie(n);
|
|
1412
|
+
return r ? X(i, function(s) {
|
|
1413
|
+
return s.w === r;
|
|
1414
|
+
}) : i;
|
|
1415
|
+
}
|
|
1416
|
+
}
|
|
1417
|
+
/**
|
|
1418
|
+
* @param {NodeID | number} v - Target Node ID.
|
|
1419
|
+
* @param {NodeID | number} [w] - If set, filters those edges down to just
|
|
1420
|
+
* those between nodes `v` and `w` regardless of direction
|
|
1421
|
+
* @returns {EdgeObj[] | undefined} all edges to or from node `v` regardless
|
|
1422
|
+
* of direction. Returns `undefined` if node `v` is not in the graph.
|
|
1423
|
+
* @remarks Takes `O(|E|)` time.
|
|
1424
|
+
*/
|
|
1425
|
+
nodeEdges(t, r) {
|
|
1426
|
+
var n = this.inEdges(t, r);
|
|
1427
|
+
if (n)
|
|
1428
|
+
return n.concat(this.outEdges(t, r));
|
|
1429
|
+
}
|
|
1430
|
+
}
|
|
1431
|
+
ht.prototype._nodeCount = 0;
|
|
1432
|
+
ht.prototype._edgeCount = 0;
|
|
1433
|
+
function Ke(e, t) {
|
|
1434
|
+
e[t] ? e[t]++ : e[t] = 1;
|
|
1435
|
+
}
|
|
1436
|
+
function qe(e, t) {
|
|
1437
|
+
--e[t] || delete e[t];
|
|
1438
|
+
}
|
|
1439
|
+
function j(e, t, r, n) {
|
|
1440
|
+
var i = "" + t, s = "" + r;
|
|
1441
|
+
if (!e && i > s) {
|
|
1442
|
+
var a = i;
|
|
1443
|
+
i = s, s = a;
|
|
1444
|
+
}
|
|
1445
|
+
return i + Be + s + Be + (L(n) ? Bi : n);
|
|
1446
|
+
}
|
|
1447
|
+
function Ki(e, t, r, n) {
|
|
1448
|
+
var i = "" + t, s = "" + r;
|
|
1449
|
+
if (!e && i > s) {
|
|
1450
|
+
var a = i;
|
|
1451
|
+
i = s, s = a;
|
|
1452
|
+
}
|
|
1453
|
+
var o = { v: i, w: s };
|
|
1454
|
+
return n && (o.name = n), o;
|
|
1455
|
+
}
|
|
1456
|
+
function se(e, t) {
|
|
1457
|
+
return j(e, t.v, t.w, t.name);
|
|
1458
|
+
}
|
|
1459
|
+
export {
|
|
1460
|
+
Q as A,
|
|
1461
|
+
Y as B,
|
|
1462
|
+
Ei as C,
|
|
1463
|
+
ft as D,
|
|
1464
|
+
jt as E,
|
|
1465
|
+
ye as F,
|
|
1466
|
+
ht as G,
|
|
1467
|
+
Xe as H,
|
|
1468
|
+
Si as I,
|
|
1469
|
+
Pi as J,
|
|
1470
|
+
_i as K,
|
|
1471
|
+
W as L,
|
|
1472
|
+
tt as M,
|
|
1473
|
+
ee as N,
|
|
1474
|
+
rt as O,
|
|
1475
|
+
yi as P,
|
|
1476
|
+
pn as Q,
|
|
1477
|
+
C as R,
|
|
1478
|
+
O as S,
|
|
1479
|
+
D as T,
|
|
1480
|
+
je as U,
|
|
1481
|
+
X as V,
|
|
1482
|
+
ie as W,
|
|
1483
|
+
ji as X,
|
|
1484
|
+
J as a,
|
|
1485
|
+
Ze as b,
|
|
1486
|
+
qt as c,
|
|
1487
|
+
we as d,
|
|
1488
|
+
We as e,
|
|
1489
|
+
Je as f,
|
|
1490
|
+
xr as g,
|
|
1491
|
+
yn as h,
|
|
1492
|
+
L as i,
|
|
1493
|
+
Ir as j,
|
|
1494
|
+
y as k,
|
|
1495
|
+
$n as l,
|
|
1496
|
+
En as m,
|
|
1497
|
+
nt as n,
|
|
1498
|
+
Kt as o,
|
|
1499
|
+
Sn as p,
|
|
1500
|
+
v as q,
|
|
1501
|
+
Pr as r,
|
|
1502
|
+
Nt as s,
|
|
1503
|
+
Ce as t,
|
|
1504
|
+
Z as u,
|
|
1505
|
+
Dt as v,
|
|
1506
|
+
p as w,
|
|
1507
|
+
Ie as x,
|
|
1508
|
+
ce as y,
|
|
1509
|
+
$i as z
|
|
1510
|
+
};
|