UNPKG

41.7 kBJavaScriptView Raw
1import { aK as isObjectLike, aL as baseGetTag, aM as Symbol$1, ah as isArray, ag as isArrayLike, aN as arrayLikeKeys, aO as baseKeys, aP as memoize, aQ as isArguments, aR as copyObject, ae as keysIn, aS as getPrototype, aT as cloneArrayBuffer, aU as cloneTypedArray, aV as getTag, aW as nodeUtil, an as baseUnary, a8 as isObject, aX as copyArray, aY as isBuffer, aZ as cloneBuffer, a_ as initCloneObject, a$ as Stack, am as assignValue, b0 as MapCache, af as eq, b1 as Uint8Array, b2 as isTypedArray, b3 as isLength, al as isIndex, ak as identity, ai as baseFor, b4 as Set, ac as baseRest, b5 as isArrayLikeObject, ao as constant, z as isFunction, b6 as isEmpty } from "./mermaid-dcacb631.js";
2var symbolTag$3 = "[object Symbol]";
3function isSymbol(value) {
4 return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag$3;
5}
6function arrayMap(array, iteratee) {
7 var index = -1, length = array == null ? 0 : array.length, result = Array(length);
8 while (++index < length) {
9 result[index] = iteratee(array[index], index, array);
10 }
11 return result;
12}
13var INFINITY$2 = 1 / 0;
14var symbolProto$2 = Symbol$1 ? Symbol$1.prototype : void 0, symbolToString = symbolProto$2 ? symbolProto$2.toString : void 0;
15function baseToString(value) {
16 if (typeof value == "string") {
17 return value;
18 }
19 if (isArray(value)) {
20 return arrayMap(value, baseToString) + "";
21 }
22 if (isSymbol(value)) {
23 return symbolToString ? symbolToString.call(value) : "";
24 }
25 var result = value + "";
26 return result == "0" && 1 / value == -INFINITY$2 ? "-0" : result;
27}
28function noop() {
29}
30function arrayEach(array, iteratee) {
31 var index = -1, length = array == null ? 0 : array.length;
32 while (++index < length) {
33 if (iteratee(array[index], index, array) === false) {
34 break;
35 }
36 }
37 return array;
38}
39function baseFindIndex(array, predicate, fromIndex, fromRight) {
40 var length = array.length, index = fromIndex + (fromRight ? 1 : -1);
41 while (fromRight ? index-- : ++index < length) {
42 if (predicate(array[index], index, array)) {
43 return index;
44 }
45 }
46 return -1;
47}
48function baseIsNaN(value) {
49 return value !== value;
50}
51function strictIndexOf(array, value, fromIndex) {
52 var index = fromIndex - 1, length = array.length;
53 while (++index < length) {
54 if (array[index] === value) {
55 return index;
56 }
57 }
58 return -1;
59}
60function baseIndexOf(array, value, fromIndex) {
61 return value === value ? strictIndexOf(array, value, fromIndex) : baseFindIndex(array, baseIsNaN, fromIndex);
62}
63function arrayIncludes(array, value) {
64 var length = array == null ? 0 : array.length;
65 return !!length && baseIndexOf(array, value, 0) > -1;
66}
67function keys(object) {
68 return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
69}
70var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/;
71function isKey(value, object) {
72 if (isArray(value)) {
73 return false;
74 }
75 var type = typeof value;
76 if (type == "number" || type == "symbol" || type == "boolean" || value == null || isSymbol(value)) {
77 return true;
78 }
79 return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object(object);
80}
81var MAX_MEMOIZE_SIZE = 500;
82function memoizeCapped(func) {
83 var result = memoize(func, function(key) {
84 if (cache.size === MAX_MEMOIZE_SIZE) {
85 cache.clear();
86 }
87 return key;
88 });
89 var cache = result.cache;
90 return result;
91}
92var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
93var reEscapeChar = /\\(\\)?/g;
94var stringToPath = memoizeCapped(function(string) {
95 var result = [];
96 if (string.charCodeAt(0) === 46) {
97 result.push("");
98 }
99 string.replace(rePropName, function(match, number, quote, subString) {
100 result.push(quote ? subString.replace(reEscapeChar, "$1") : number || match);
101 });
102 return result;
103});
104const stringToPath$1 = stringToPath;
105function toString(value) {
106 return value == null ? "" : baseToString(value);
107}
108function castPath(value, object) {
109 if (isArray(value)) {
110 return value;
111 }
112 return isKey(value, object) ? [value] : stringToPath$1(toString(value));
113}
114var INFINITY$1 = 1 / 0;
115function toKey(value) {
116 if (typeof value == "string" || isSymbol(value)) {
117 return value;
118 }
119 var result = value + "";
120 return result == "0" && 1 / value == -INFINITY$1 ? "-0" : result;
121}
122function baseGet(object, path) {
123 path = castPath(path, object);
124 var index = 0, length = path.length;
125 while (object != null && index < length) {
126 object = object[toKey(path[index++])];
127 }
128 return index && index == length ? object : void 0;
129}
130function get(object, path, defaultValue) {
131 var result = object == null ? void 0 : baseGet(object, path);
132 return result === void 0 ? defaultValue : result;
133}
134function arrayPush(array, values2) {
135 var index = -1, length = values2.length, offset = array.length;
136 while (++index < length) {
137 array[offset + index] = values2[index];
138 }
139 return array;
140}
141var spreadableSymbol = Symbol$1 ? Symbol$1.isConcatSpreadable : void 0;
142function isFlattenable(value) {
143 return isArray(value) || isArguments(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
144}
145function baseFlatten(array, depth, predicate, isStrict, result) {
146 var index = -1, length = array.length;
147 predicate || (predicate = isFlattenable);
148 result || (result = []);
149 while (++index < length) {
150 var value = array[index];
151 if (depth > 0 && predicate(value)) {
152 if (depth > 1) {
153 baseFlatten(value, depth - 1, predicate, isStrict, result);
154 } else {
155 arrayPush(result, value);
156 }
157 } else if (!isStrict) {
158 result[result.length] = value;
159 }
160 }
161 return result;
162}
163function arrayReduce(array, iteratee, accumulator, initAccum) {
164 var index = -1, length = array == null ? 0 : array.length;
165 if (initAccum && length) {
166 accumulator = array[++index];
167 }
168 while (++index < length) {
169 accumulator = iteratee(accumulator, array[index], index, array);
170 }
171 return accumulator;
172}
173function baseAssign(object, source) {
174 return object && copyObject(source, keys(source), object);
175}
176function baseAssignIn(object, source) {
177 return object && copyObject(source, keysIn(source), object);
178}
179function arrayFilter(array, predicate) {
180 var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = [];
181 while (++index < length) {
182 var value = array[index];
183 if (predicate(value, index, array)) {
184 result[resIndex++] = value;
185 }
186 }
187 return result;
188}
189function stubArray() {
190 return [];
191}
192var objectProto$4 = Object.prototype;
193var propertyIsEnumerable = objectProto$4.propertyIsEnumerable;
194var nativeGetSymbols$1 = Object.getOwnPropertySymbols;
195var getSymbols = !nativeGetSymbols$1 ? stubArray : function(object) {
196 if (object == null) {
197 return [];
198 }
199 object = Object(object);
200 return arrayFilter(nativeGetSymbols$1(object), function(symbol) {
201 return propertyIsEnumerable.call(object, symbol);
202 });
203};
204const getSymbols$1 = getSymbols;
205function copySymbols(source, object) {
206 return copyObject(source, getSymbols$1(source), object);
207}
208var nativeGetSymbols = Object.getOwnPropertySymbols;
209var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
210 var result = [];
211 while (object) {
212 arrayPush(result, getSymbols$1(object));
213 object = getPrototype(object);
214 }
215 return result;
216};
217const getSymbolsIn$1 = getSymbolsIn;
218function copySymbolsIn(source, object) {
219 return copyObject(source, getSymbolsIn$1(source), object);
220}
221function baseGetAllKeys(object, keysFunc, symbolsFunc) {
222 var result = keysFunc(object);
223 return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
224}
225function getAllKeys(object) {
226 return baseGetAllKeys(object, keys, getSymbols$1);
227}
228function getAllKeysIn(object) {
229 return baseGetAllKeys(object, keysIn, getSymbolsIn$1);
230}
231var objectProto$3 = Object.prototype;
232var hasOwnProperty$3 = objectProto$3.hasOwnProperty;
233function initCloneArray(array) {
234 var length = array.length, result = new array.constructor(length);
235 if (length && typeof array[0] == "string" && hasOwnProperty$3.call(array, "index")) {
236 result.index = array.index;
237 result.input = array.input;
238 }
239 return result;
240}
241function cloneDataView(dataView, isDeep) {
242 var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
243 return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
244}
245var reFlags = /\w*$/;
246function cloneRegExp(regexp) {
247 var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
248 result.lastIndex = regexp.lastIndex;
249 return result;
250}
251var symbolProto$1 = Symbol$1 ? Symbol$1.prototype : void 0, symbolValueOf$1 = symbolProto$1 ? symbolProto$1.valueOf : void 0;
252function cloneSymbol(symbol) {
253 return symbolValueOf$1 ? Object(symbolValueOf$1.call(symbol)) : {};
254}
255var boolTag$2 = "[object Boolean]", dateTag$2 = "[object Date]", mapTag$3 = "[object Map]", numberTag$2 = "[object Number]", regexpTag$2 = "[object RegExp]", setTag$3 = "[object Set]", stringTag$2 = "[object String]", symbolTag$2 = "[object Symbol]";
256var arrayBufferTag$2 = "[object ArrayBuffer]", dataViewTag$2 = "[object DataView]", float32Tag$1 = "[object Float32Array]", float64Tag$1 = "[object Float64Array]", int8Tag$1 = "[object Int8Array]", int16Tag$1 = "[object Int16Array]", int32Tag$1 = "[object Int32Array]", uint8Tag$1 = "[object Uint8Array]", uint8ClampedTag$1 = "[object Uint8ClampedArray]", uint16Tag$1 = "[object Uint16Array]", uint32Tag$1 = "[object Uint32Array]";
257function initCloneByTag(object, tag, isDeep) {
258 var Ctor = object.constructor;
259 switch (tag) {
260 case arrayBufferTag$2:
261 return cloneArrayBuffer(object);
262 case boolTag$2:
263 case dateTag$2:
264 return new Ctor(+object);
265 case dataViewTag$2:
266 return cloneDataView(object, isDeep);
267 case float32Tag$1:
268 case float64Tag$1:
269 case int8Tag$1:
270 case int16Tag$1:
271 case int32Tag$1:
272 case uint8Tag$1:
273 case uint8ClampedTag$1:
274 case uint16Tag$1:
275 case uint32Tag$1:
276 return cloneTypedArray(object, isDeep);
277 case mapTag$3:
278 return new Ctor();
279 case numberTag$2:
280 case stringTag$2:
281 return new Ctor(object);
282 case regexpTag$2:
283 return cloneRegExp(object);
284 case setTag$3:
285 return new Ctor();
286 case symbolTag$2:
287 return cloneSymbol(object);
288 }
289}
290var mapTag$2 = "[object Map]";
291function baseIsMap(value) {
292 return isObjectLike(value) && getTag(value) == mapTag$2;
293}
294var nodeIsMap = nodeUtil && nodeUtil.isMap;
295var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
296const isMap$1 = isMap;
297var setTag$2 = "[object Set]";
298function baseIsSet(value) {
299 return isObjectLike(value) && getTag(value) == setTag$2;
300}
301var nodeIsSet = nodeUtil && nodeUtil.isSet;
302var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
303const isSet$1 = isSet;
304var CLONE_DEEP_FLAG = 1, CLONE_FLAT_FLAG = 2, CLONE_SYMBOLS_FLAG = 4;
305var argsTag$1 = "[object Arguments]", arrayTag$1 = "[object Array]", boolTag$1 = "[object Boolean]", dateTag$1 = "[object Date]", errorTag$1 = "[object Error]", funcTag = "[object Function]", genTag = "[object GeneratorFunction]", mapTag$1 = "[object Map]", numberTag$1 = "[object Number]", objectTag$1 = "[object Object]", regexpTag$1 = "[object RegExp]", setTag$1 = "[object Set]", stringTag$1 = "[object String]", symbolTag$1 = "[object Symbol]", weakMapTag = "[object WeakMap]";
306var arrayBufferTag$1 = "[object ArrayBuffer]", dataViewTag$1 = "[object DataView]", float32Tag = "[object Float32Array]", float64Tag = "[object Float64Array]", int8Tag = "[object Int8Array]", int16Tag = "[object Int16Array]", int32Tag = "[object Int32Array]", uint8Tag = "[object Uint8Array]", uint8ClampedTag = "[object Uint8ClampedArray]", uint16Tag = "[object Uint16Array]", uint32Tag = "[object Uint32Array]";
307var cloneableTags = {};
308cloneableTags[argsTag$1] = cloneableTags[arrayTag$1] = cloneableTags[arrayBufferTag$1] = cloneableTags[dataViewTag$1] = cloneableTags[boolTag$1] = cloneableTags[dateTag$1] = cloneableTags[float32Tag] = cloneableTags[float64Tag] = cloneableTags[int8Tag] = cloneableTags[int16Tag] = cloneableTags[int32Tag] = cloneableTags[mapTag$1] = cloneableTags[numberTag$1] = cloneableTags[objectTag$1] = cloneableTags[regexpTag$1] = cloneableTags[setTag$1] = cloneableTags[stringTag$1] = cloneableTags[symbolTag$1] = cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
309cloneableTags[errorTag$1] = cloneableTags[funcTag] = cloneableTags[weakMapTag] = false;
310function baseClone(value, bitmask, customizer, key, object, stack) {
311 var result, isDeep = bitmask & CLONE_DEEP_FLAG, isFlat = bitmask & CLONE_FLAT_FLAG, isFull = bitmask & CLONE_SYMBOLS_FLAG;
312 if (customizer) {
313 result = object ? customizer(value, key, object, stack) : customizer(value);
314 }
315 if (result !== void 0) {
316 return result;
317 }
318 if (!isObject(value)) {
319 return value;
320 }
321 var isArr = isArray(value);
322 if (isArr) {
323 result = initCloneArray(value);
324 if (!isDeep) {
325 return copyArray(value, result);
326 }
327 } else {
328 var tag = getTag(value), isFunc = tag == funcTag || tag == genTag;
329 if (isBuffer(value)) {
330 return cloneBuffer(value, isDeep);
331 }
332 if (tag == objectTag$1 || tag == argsTag$1 || isFunc && !object) {
333 result = isFlat || isFunc ? {} : initCloneObject(value);
334 if (!isDeep) {
335 return isFlat ? copySymbolsIn(value, baseAssignIn(result, value)) : copySymbols(value, baseAssign(result, value));
336 }
337 } else {
338 if (!cloneableTags[tag]) {
339 return object ? value : {};
340 }
341 result = initCloneByTag(value, tag, isDeep);
342 }
343 }
344 stack || (stack = new Stack());
345 var stacked = stack.get(value);
346 if (stacked) {
347 return stacked;
348 }
349 stack.set(value, result);
350 if (isSet$1(value)) {
351 value.forEach(function(subValue) {
352 result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
353 });
354 } else if (isMap$1(value)) {
355 value.forEach(function(subValue, key2) {
356 result.set(key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
357 });
358 }
359 var keysFunc = isFull ? isFlat ? getAllKeysIn : getAllKeys : isFlat ? keysIn : keys;
360 var props = isArr ? void 0 : keysFunc(value);
361 arrayEach(props || value, function(subValue, key2) {
362 if (props) {
363 key2 = subValue;
364 subValue = value[key2];
365 }
366 assignValue(result, key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
367 });
368 return result;
369}
370var HASH_UNDEFINED = "__lodash_hash_undefined__";
371function setCacheAdd(value) {
372 this.__data__.set(value, HASH_UNDEFINED);
373 return this;
374}
375function setCacheHas(value) {
376 return this.__data__.has(value);
377}
378function SetCache(values2) {
379 var index = -1, length = values2 == null ? 0 : values2.length;
380 this.__data__ = new MapCache();
381 while (++index < length) {
382 this.add(values2[index]);
383 }
384}
385SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
386SetCache.prototype.has = setCacheHas;
387function arraySome(array, predicate) {
388 var index = -1, length = array == null ? 0 : array.length;
389 while (++index < length) {
390 if (predicate(array[index], index, array)) {
391 return true;
392 }
393 }
394 return false;
395}
396function cacheHas(cache, key) {
397 return cache.has(key);
398}
399var COMPARE_PARTIAL_FLAG$5 = 1, COMPARE_UNORDERED_FLAG$3 = 2;
400function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
401 var isPartial = bitmask & COMPARE_PARTIAL_FLAG$5, arrLength = array.length, othLength = other.length;
402 if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
403 return false;
404 }
405 var arrStacked = stack.get(array);
406 var othStacked = stack.get(other);
407 if (arrStacked && othStacked) {
408 return arrStacked == other && othStacked == array;
409 }
410 var index = -1, result = true, seen = bitmask & COMPARE_UNORDERED_FLAG$3 ? new SetCache() : void 0;
411 stack.set(array, other);
412 stack.set(other, array);
413 while (++index < arrLength) {
414 var arrValue = array[index], othValue = other[index];
415 if (customizer) {
416 var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack);
417 }
418 if (compared !== void 0) {
419 if (compared) {
420 continue;
421 }
422 result = false;
423 break;
424 }
425 if (seen) {
426 if (!arraySome(other, function(othValue2, othIndex) {
427 if (!cacheHas(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
428 return seen.push(othIndex);
429 }
430 })) {
431 result = false;
432 break;
433 }
434 } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
435 result = false;
436 break;
437 }
438 }
439 stack["delete"](array);
440 stack["delete"](other);
441 return result;
442}
443function mapToArray(map) {
444 var index = -1, result = Array(map.size);
445 map.forEach(function(value, key) {
446 result[++index] = [key, value];
447 });
448 return result;
449}
450function setToArray(set) {
451 var index = -1, result = Array(set.size);
452 set.forEach(function(value) {
453 result[++index] = value;
454 });
455 return result;
456}
457var COMPARE_PARTIAL_FLAG$4 = 1, COMPARE_UNORDERED_FLAG$2 = 2;
458var boolTag = "[object Boolean]", dateTag = "[object Date]", errorTag = "[object Error]", mapTag = "[object Map]", numberTag = "[object Number]", regexpTag = "[object RegExp]", setTag = "[object Set]", stringTag = "[object String]", symbolTag = "[object Symbol]";
459var arrayBufferTag = "[object ArrayBuffer]", dataViewTag = "[object DataView]";
460var symbolProto = Symbol$1 ? Symbol$1.prototype : void 0, symbolValueOf = symbolProto ? symbolProto.valueOf : void 0;
461function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
462 switch (tag) {
463 case dataViewTag:
464 if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
465 return false;
466 }
467 object = object.buffer;
468 other = other.buffer;
469 case arrayBufferTag:
470 if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
471 return false;
472 }
473 return true;
474 case boolTag:
475 case dateTag:
476 case numberTag:
477 return eq(+object, +other);
478 case errorTag:
479 return object.name == other.name && object.message == other.message;
480 case regexpTag:
481 case stringTag:
482 return object == other + "";
483 case mapTag:
484 var convert = mapToArray;
485 case setTag:
486 var isPartial = bitmask & COMPARE_PARTIAL_FLAG$4;
487 convert || (convert = setToArray);
488 if (object.size != other.size && !isPartial) {
489 return false;
490 }
491 var stacked = stack.get(object);
492 if (stacked) {
493 return stacked == other;
494 }
495 bitmask |= COMPARE_UNORDERED_FLAG$2;
496 stack.set(object, other);
497 var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
498 stack["delete"](object);
499 return result;
500 case symbolTag:
501 if (symbolValueOf) {
502 return symbolValueOf.call(object) == symbolValueOf.call(other);
503 }
504 }
505 return false;
506}
507var COMPARE_PARTIAL_FLAG$3 = 1;
508var objectProto$2 = Object.prototype;
509var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
510function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
511 var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3, objProps = getAllKeys(object), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length;
512 if (objLength != othLength && !isPartial) {
513 return false;
514 }
515 var index = objLength;
516 while (index--) {
517 var key = objProps[index];
518 if (!(isPartial ? key in other : hasOwnProperty$2.call(other, key))) {
519 return false;
520 }
521 }
522 var objStacked = stack.get(object);
523 var othStacked = stack.get(other);
524 if (objStacked && othStacked) {
525 return objStacked == other && othStacked == object;
526 }
527 var result = true;
528 stack.set(object, other);
529 stack.set(other, object);
530 var skipCtor = isPartial;
531 while (++index < objLength) {
532 key = objProps[index];
533 var objValue = object[key], othValue = other[key];
534 if (customizer) {
535 var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
536 }
537 if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
538 result = false;
539 break;
540 }
541 skipCtor || (skipCtor = key == "constructor");
542 }
543 if (result && !skipCtor) {
544 var objCtor = object.constructor, othCtor = other.constructor;
545 if (objCtor != othCtor && ("constructor" in object && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
546 result = false;
547 }
548 }
549 stack["delete"](object);
550 stack["delete"](other);
551 return result;
552}
553var COMPARE_PARTIAL_FLAG$2 = 1;
554var argsTag = "[object Arguments]", arrayTag = "[object Array]", objectTag = "[object Object]";
555var objectProto$1 = Object.prototype;
556var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
557function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
558 var objIsArr = isArray(object), othIsArr = isArray(other), objTag = objIsArr ? arrayTag : getTag(object), othTag = othIsArr ? arrayTag : getTag(other);
559 objTag = objTag == argsTag ? objectTag : objTag;
560 othTag = othTag == argsTag ? objectTag : othTag;
561 var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag;
562 if (isSameTag && isBuffer(object)) {
563 if (!isBuffer(other)) {
564 return false;
565 }
566 objIsArr = true;
567 objIsObj = false;
568 }
569 if (isSameTag && !objIsObj) {
570 stack || (stack = new Stack());
571 return objIsArr || isTypedArray(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
572 }
573 if (!(bitmask & COMPARE_PARTIAL_FLAG$2)) {
574 var objIsWrapped = objIsObj && hasOwnProperty$1.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty$1.call(other, "__wrapped__");
575 if (objIsWrapped || othIsWrapped) {
576 var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
577 stack || (stack = new Stack());
578 return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
579 }
580 }
581 if (!isSameTag) {
582 return false;
583 }
584 stack || (stack = new Stack());
585 return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
586}
587function baseIsEqual(value, other, bitmask, customizer, stack) {
588 if (value === other) {
589 return true;
590 }
591 if (value == null || other == null || !isObjectLike(value) && !isObjectLike(other)) {
592 return value !== value && other !== other;
593 }
594 return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
595}
596var COMPARE_PARTIAL_FLAG$1 = 1, COMPARE_UNORDERED_FLAG$1 = 2;
597function baseIsMatch(object, source, matchData, customizer) {
598 var index = matchData.length, length = index, noCustomizer = !customizer;
599 if (object == null) {
600 return !length;
601 }
602 object = Object(object);
603 while (index--) {
604 var data = matchData[index];
605 if (noCustomizer && data[2] ? data[1] !== object[data[0]] : !(data[0] in object)) {
606 return false;
607 }
608 }
609 while (++index < length) {
610 data = matchData[index];
611 var key = data[0], objValue = object[key], srcValue = data[1];
612 if (noCustomizer && data[2]) {
613 if (objValue === void 0 && !(key in object)) {
614 return false;
615 }
616 } else {
617 var stack = new Stack();
618 if (customizer) {
619 var result = customizer(objValue, srcValue, key, object, source, stack);
620 }
621 if (!(result === void 0 ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG$1 | COMPARE_UNORDERED_FLAG$1, customizer, stack) : result)) {
622 return false;
623 }
624 }
625 }
626 return true;
627}
628function isStrictComparable(value) {
629 return value === value && !isObject(value);
630}
631function getMatchData(object) {
632 var result = keys(object), length = result.length;
633 while (length--) {
634 var key = result[length], value = object[key];
635 result[length] = [key, value, isStrictComparable(value)];
636 }
637 return result;
638}
639function matchesStrictComparable(key, srcValue) {
640 return function(object) {
641 if (object == null) {
642 return false;
643 }
644 return object[key] === srcValue && (srcValue !== void 0 || key in Object(object));
645 };
646}
647function baseMatches(source) {
648 var matchData = getMatchData(source);
649 if (matchData.length == 1 && matchData[0][2]) {
650 return matchesStrictComparable(matchData[0][0], matchData[0][1]);
651 }
652 return function(object) {
653 return object === source || baseIsMatch(object, source, matchData);
654 };
655}
656function baseHasIn(object, key) {
657 return object != null && key in Object(object);
658}
659function hasPath(object, path, hasFunc) {
660 path = castPath(path, object);
661 var index = -1, length = path.length, result = false;
662 while (++index < length) {
663 var key = toKey(path[index]);
664 if (!(result = object != null && hasFunc(object, key))) {
665 break;
666 }
667 object = object[key];
668 }
669 if (result || ++index != length) {
670 return result;
671 }
672 length = object == null ? 0 : object.length;
673 return !!length && isLength(length) && isIndex(key, length) && (isArray(object) || isArguments(object));
674}
675function hasIn(object, path) {
676 return object != null && hasPath(object, path, baseHasIn);
677}
678var COMPARE_PARTIAL_FLAG = 1, COMPARE_UNORDERED_FLAG = 2;
679function baseMatchesProperty(path, srcValue) {
680 if (isKey(path) && isStrictComparable(srcValue)) {
681 return matchesStrictComparable(toKey(path), srcValue);
682 }
683 return function(object) {
684 var objValue = get(object, path);
685 return objValue === void 0 && objValue === srcValue ? hasIn(object, path) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
686 };
687}
688function baseProperty(key) {
689 return function(object) {
690 return object == null ? void 0 : object[key];
691 };
692}
693function basePropertyDeep(path) {
694 return function(object) {
695 return baseGet(object, path);
696 };
697}
698function property(path) {
699 return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
700}
701function baseIteratee(value) {
702 if (typeof value == "function") {
703 return value;
704 }
705 if (value == null) {
706 return identity;
707 }
708 if (typeof value == "object") {
709 return isArray(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value);
710 }
711 return property(value);
712}
713function baseForOwn(object, iteratee) {
714 return object && baseFor(object, iteratee, keys);
715}
716function createBaseEach(eachFunc, fromRight) {
717 return function(collection, iteratee) {
718 if (collection == null) {
719 return collection;
720 }
721 if (!isArrayLike(collection)) {
722 return eachFunc(collection, iteratee);
723 }
724 var length = collection.length, index = fromRight ? length : -1, iterable = Object(collection);
725 while (fromRight ? index-- : ++index < length) {
726 if (iteratee(iterable[index], index, iterable) === false) {
727 break;
728 }
729 }
730 return collection;
731 };
732}
733var baseEach = createBaseEach(baseForOwn);
734const baseEach$1 = baseEach;
735function arrayIncludesWith(array, value, comparator) {
736 var index = -1, length = array == null ? 0 : array.length;
737 while (++index < length) {
738 if (comparator(value, array[index])) {
739 return true;
740 }
741 }
742 return false;
743}
744function castFunction(value) {
745 return typeof value == "function" ? value : identity;
746}
747function forEach(collection, iteratee) {
748 var func = isArray(collection) ? arrayEach : baseEach$1;
749 return func(collection, castFunction(iteratee));
750}
751function baseFilter(collection, predicate) {
752 var result = [];
753 baseEach$1(collection, function(value, index, collection2) {
754 if (predicate(value, index, collection2)) {
755 result.push(value);
756 }
757 });
758 return result;
759}
760function filter(collection, predicate) {
761 var func = isArray(collection) ? arrayFilter : baseFilter;
762 return func(collection, baseIteratee(predicate));
763}
764var objectProto = Object.prototype;
765var hasOwnProperty = objectProto.hasOwnProperty;
766function baseHas(object, key) {
767 return object != null && hasOwnProperty.call(object, key);
768}
769function has(object, path) {
770 return object != null && hasPath(object, path, baseHas);
771}
772function baseValues(object, props) {
773 return arrayMap(props, function(key) {
774 return object[key];
775 });
776}
777function values(object) {
778 return object == null ? [] : baseValues(object, keys(object));
779}
780function isUndefined(value) {
781 return value === void 0;
782}
783function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
784 eachFunc(collection, function(value, index, collection2) {
785 accumulator = initAccum ? (initAccum = false, value) : iteratee(accumulator, value, index, collection2);
786 });
787 return accumulator;
788}
789function reduce(collection, iteratee, accumulator) {
790 var func = isArray(collection) ? arrayReduce : baseReduce, initAccum = arguments.length < 3;
791 return func(collection, baseIteratee(iteratee), accumulator, initAccum, baseEach$1);
792}
793var INFINITY = 1 / 0;
794var createSet = !(Set && 1 / setToArray(new Set([, -0]))[1] == INFINITY) ? noop : function(values2) {
795 return new Set(values2);
796};
797const createSet$1 = createSet;
798var LARGE_ARRAY_SIZE = 200;
799function baseUniq(array, iteratee, comparator) {
800 var index = -1, includes = arrayIncludes, length = array.length, isCommon = true, result = [], seen = result;
801 if (comparator) {
802 isCommon = false;
803 includes = arrayIncludesWith;
804 } else if (length >= LARGE_ARRAY_SIZE) {
805 var set = iteratee ? null : createSet$1(array);
806 if (set) {
807 return setToArray(set);
808 }
809 isCommon = false;
810 includes = cacheHas;
811 seen = new SetCache();
812 } else {
813 seen = iteratee ? [] : result;
814 }
815 outer:
816 while (++index < length) {
817 var value = array[index], computed = iteratee ? iteratee(value) : value;
818 value = comparator || value !== 0 ? value : 0;
819 if (isCommon && computed === computed) {
820 var seenIndex = seen.length;
821 while (seenIndex--) {
822 if (seen[seenIndex] === computed) {
823 continue outer;
824 }
825 }
826 if (iteratee) {
827 seen.push(computed);
828 }
829 result.push(value);
830 } else if (!includes(seen, computed, comparator)) {
831 if (seen !== result) {
832 seen.push(computed);
833 }
834 result.push(value);
835 }
836 }
837 return result;
838}
839var union = baseRest(function(arrays) {
840 return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
841});
842const union$1 = union;
843var DEFAULT_EDGE_NAME = "\0";
844var GRAPH_NODE = "\0";
845var EDGE_KEY_DELIM = "";
846class Graph {
847 constructor(opts = {}) {
848 this._isDirected = has(opts, "directed") ? opts.directed : true;
849 this._isMultigraph = has(opts, "multigraph") ? opts.multigraph : false;
850 this._isCompound = has(opts, "compound") ? opts.compound : false;
851 this._label = void 0;
852 this._defaultNodeLabelFn = constant(void 0);
853 this._defaultEdgeLabelFn = constant(void 0);
854 this._nodes = {};
855 if (this._isCompound) {
856 this._parent = {};
857 this._children = {};
858 this._children[GRAPH_NODE] = {};
859 }
860 this._in = {};
861 this._preds = {};
862 this._out = {};
863 this._sucs = {};
864 this._edgeObjs = {};
865 this._edgeLabels = {};
866 }
867 /* === Graph functions ========= */
868 isDirected() {
869 return this._isDirected;
870 }
871 isMultigraph() {
872 return this._isMultigraph;
873 }
874 isCompound() {
875 return this._isCompound;
876 }
877 setGraph(label) {
878 this._label = label;
879 return this;
880 }
881 graph() {
882 return this._label;
883 }
884 /* === Node functions ========== */
885 setDefaultNodeLabel(newDefault) {
886 if (!isFunction(newDefault)) {
887 newDefault = constant(newDefault);
888 }
889 this._defaultNodeLabelFn = newDefault;
890 return this;
891 }
892 nodeCount() {
893 return this._nodeCount;
894 }
895 nodes() {
896 return keys(this._nodes);
897 }
898 sources() {
899 var self = this;
900 return filter(this.nodes(), function(v) {
901 return isEmpty(self._in[v]);
902 });
903 }
904 sinks() {
905 var self = this;
906 return filter(this.nodes(), function(v) {
907 return isEmpty(self._out[v]);
908 });
909 }
910 setNodes(vs, value) {
911 var args = arguments;
912 var self = this;
913 forEach(vs, function(v) {
914 if (args.length > 1) {
915 self.setNode(v, value);
916 } else {
917 self.setNode(v);
918 }
919 });
920 return this;
921 }
922 setNode(v, value) {
923 if (has(this._nodes, v)) {
924 if (arguments.length > 1) {
925 this._nodes[v] = value;
926 }
927 return this;
928 }
929 this._nodes[v] = arguments.length > 1 ? value : this._defaultNodeLabelFn(v);
930 if (this._isCompound) {
931 this._parent[v] = GRAPH_NODE;
932 this._children[v] = {};
933 this._children[GRAPH_NODE][v] = true;
934 }
935 this._in[v] = {};
936 this._preds[v] = {};
937 this._out[v] = {};
938 this._sucs[v] = {};
939 ++this._nodeCount;
940 return this;
941 }
942 node(v) {
943 return this._nodes[v];
944 }
945 hasNode(v) {
946 return has(this._nodes, v);
947 }
948 removeNode(v) {
949 var self = this;
950 if (has(this._nodes, v)) {
951 var removeEdge = function(e) {
952 self.removeEdge(self._edgeObjs[e]);
953 };
954 delete this._nodes[v];
955 if (this._isCompound) {
956 this._removeFromParentsChildList(v);
957 delete this._parent[v];
958 forEach(this.children(v), function(child) {
959 self.setParent(child);
960 });
961 delete this._children[v];
962 }
963 forEach(keys(this._in[v]), removeEdge);
964 delete this._in[v];
965 delete this._preds[v];
966 forEach(keys(this._out[v]), removeEdge);
967 delete this._out[v];
968 delete this._sucs[v];
969 --this._nodeCount;
970 }
971 return this;
972 }
973 setParent(v, parent) {
974 if (!this._isCompound) {
975 throw new Error("Cannot set parent in a non-compound graph");
976 }
977 if (isUndefined(parent)) {
978 parent = GRAPH_NODE;
979 } else {
980 parent += "";
981 for (var ancestor = parent; !isUndefined(ancestor); ancestor = this.parent(ancestor)) {
982 if (ancestor === v) {
983 throw new Error("Setting " + parent + " as parent of " + v + " would create a cycle");
984 }
985 }
986 this.setNode(parent);
987 }
988 this.setNode(v);
989 this._removeFromParentsChildList(v);
990 this._parent[v] = parent;
991 this._children[parent][v] = true;
992 return this;
993 }
994 _removeFromParentsChildList(v) {
995 delete this._children[this._parent[v]][v];
996 }
997 parent(v) {
998 if (this._isCompound) {
999 var parent = this._parent[v];
1000 if (parent !== GRAPH_NODE) {
1001 return parent;
1002 }
1003 }
1004 }
1005 children(v) {
1006 if (isUndefined(v)) {
1007 v = GRAPH_NODE;
1008 }
1009 if (this._isCompound) {
1010 var children = this._children[v];
1011 if (children) {
1012 return keys(children);
1013 }
1014 } else if (v === GRAPH_NODE) {
1015 return this.nodes();
1016 } else if (this.hasNode(v)) {
1017 return [];
1018 }
1019 }
1020 predecessors(v) {
1021 var predsV = this._preds[v];
1022 if (predsV) {
1023 return keys(predsV);
1024 }
1025 }
1026 successors(v) {
1027 var sucsV = this._sucs[v];
1028 if (sucsV) {
1029 return keys(sucsV);
1030 }
1031 }
1032 neighbors(v) {
1033 var preds = this.predecessors(v);
1034 if (preds) {
1035 return union$1(preds, this.successors(v));
1036 }
1037 }
1038 isLeaf(v) {
1039 var neighbors;
1040 if (this.isDirected()) {
1041 neighbors = this.successors(v);
1042 } else {
1043 neighbors = this.neighbors(v);
1044 }
1045 return neighbors.length === 0;
1046 }
1047 filterNodes(filter2) {
1048 var copy = new this.constructor({
1049 directed: this._isDirected,
1050 multigraph: this._isMultigraph,
1051 compound: this._isCompound
1052 });
1053 copy.setGraph(this.graph());
1054 var self = this;
1055 forEach(this._nodes, function(value, v) {
1056 if (filter2(v)) {
1057 copy.setNode(v, value);
1058 }
1059 });
1060 forEach(this._edgeObjs, function(e) {
1061 if (copy.hasNode(e.v) && copy.hasNode(e.w)) {
1062 copy.setEdge(e, self.edge(e));
1063 }
1064 });
1065 var parents = {};
1066 function findParent(v) {
1067 var parent = self.parent(v);
1068 if (parent === void 0 || copy.hasNode(parent)) {
1069 parents[v] = parent;
1070 return parent;
1071 } else if (parent in parents) {
1072 return parents[parent];
1073 } else {
1074 return findParent(parent);
1075 }
1076 }
1077 if (this._isCompound) {
1078 forEach(copy.nodes(), function(v) {
1079 copy.setParent(v, findParent(v));
1080 });
1081 }
1082 return copy;
1083 }
1084 /* === Edge functions ========== */
1085 setDefaultEdgeLabel(newDefault) {
1086 if (!isFunction(newDefault)) {
1087 newDefault = constant(newDefault);
1088 }
1089 this._defaultEdgeLabelFn = newDefault;
1090 return this;
1091 }
1092 edgeCount() {
1093 return this._edgeCount;
1094 }
1095 edges() {
1096 return values(this._edgeObjs);
1097 }
1098 setPath(vs, value) {
1099 var self = this;
1100 var args = arguments;
1101 reduce(vs, function(v, w) {
1102 if (args.length > 1) {
1103 self.setEdge(v, w, value);
1104 } else {
1105 self.setEdge(v, w);
1106 }
1107 return w;
1108 });
1109 return this;
1110 }
1111 /*
1112 * setEdge(v, w, [value, [name]])
1113 * setEdge({ v, w, [name] }, [value])
1114 */
1115 setEdge() {
1116 var v, w, name, value;
1117 var valueSpecified = false;
1118 var arg0 = arguments[0];
1119 if (typeof arg0 === "object" && arg0 !== null && "v" in arg0) {
1120 v = arg0.v;
1121 w = arg0.w;
1122 name = arg0.name;
1123 if (arguments.length === 2) {
1124 value = arguments[1];
1125 valueSpecified = true;
1126 }
1127 } else {
1128 v = arg0;
1129 w = arguments[1];
1130 name = arguments[3];
1131 if (arguments.length > 2) {
1132 value = arguments[2];
1133 valueSpecified = true;
1134 }
1135 }
1136 v = "" + v;
1137 w = "" + w;
1138 if (!isUndefined(name)) {
1139 name = "" + name;
1140 }
1141 var e = edgeArgsToId(this._isDirected, v, w, name);
1142 if (has(this._edgeLabels, e)) {
1143 if (valueSpecified) {
1144 this._edgeLabels[e] = value;
1145 }
1146 return this;
1147 }
1148 if (!isUndefined(name) && !this._isMultigraph) {
1149 throw new Error("Cannot set a named edge when isMultigraph = false");
1150 }
1151 this.setNode(v);
1152 this.setNode(w);
1153 this._edgeLabels[e] = valueSpecified ? value : this._defaultEdgeLabelFn(v, w, name);
1154 var edgeObj = edgeArgsToObj(this._isDirected, v, w, name);
1155 v = edgeObj.v;
1156 w = edgeObj.w;
1157 Object.freeze(edgeObj);
1158 this._edgeObjs[e] = edgeObj;
1159 incrementOrInitEntry(this._preds[w], v);
1160 incrementOrInitEntry(this._sucs[v], w);
1161 this._in[w][e] = edgeObj;
1162 this._out[v][e] = edgeObj;
1163 this._edgeCount++;
1164 return this;
1165 }
1166 edge(v, w, name) {
1167 var e = arguments.length === 1 ? edgeObjToId(this._isDirected, arguments[0]) : edgeArgsToId(this._isDirected, v, w, name);
1168 return this._edgeLabels[e];
1169 }
1170 hasEdge(v, w, name) {
1171 var e = arguments.length === 1 ? edgeObjToId(this._isDirected, arguments[0]) : edgeArgsToId(this._isDirected, v, w, name);
1172 return has(this._edgeLabels, e);
1173 }
1174 removeEdge(v, w, name) {
1175 var e = arguments.length === 1 ? edgeObjToId(this._isDirected, arguments[0]) : edgeArgsToId(this._isDirected, v, w, name);
1176 var edge = this._edgeObjs[e];
1177 if (edge) {
1178 v = edge.v;
1179 w = edge.w;
1180 delete this._edgeLabels[e];
1181 delete this._edgeObjs[e];
1182 decrementOrRemoveEntry(this._preds[w], v);
1183 decrementOrRemoveEntry(this._sucs[v], w);
1184 delete this._in[w][e];
1185 delete this._out[v][e];
1186 this._edgeCount--;
1187 }
1188 return this;
1189 }
1190 inEdges(v, u) {
1191 var inV = this._in[v];
1192 if (inV) {
1193 var edges = values(inV);
1194 if (!u) {
1195 return edges;
1196 }
1197 return filter(edges, function(edge) {
1198 return edge.v === u;
1199 });
1200 }
1201 }
1202 outEdges(v, w) {
1203 var outV = this._out[v];
1204 if (outV) {
1205 var edges = values(outV);
1206 if (!w) {
1207 return edges;
1208 }
1209 return filter(edges, function(edge) {
1210 return edge.w === w;
1211 });
1212 }
1213 }
1214 nodeEdges(v, w) {
1215 var inEdges = this.inEdges(v, w);
1216 if (inEdges) {
1217 return inEdges.concat(this.outEdges(v, w));
1218 }
1219 }
1220}
1221Graph.prototype._nodeCount = 0;
1222Graph.prototype._edgeCount = 0;
1223function incrementOrInitEntry(map, k) {
1224 if (map[k]) {
1225 map[k]++;
1226 } else {
1227 map[k] = 1;
1228 }
1229}
1230function decrementOrRemoveEntry(map, k) {
1231 if (!--map[k]) {
1232 delete map[k];
1233 }
1234}
1235function edgeArgsToId(isDirected, v_, w_, name) {
1236 var v = "" + v_;
1237 var w = "" + w_;
1238 if (!isDirected && v > w) {
1239 var tmp = v;
1240 v = w;
1241 w = tmp;
1242 }
1243 return v + EDGE_KEY_DELIM + w + EDGE_KEY_DELIM + (isUndefined(name) ? DEFAULT_EDGE_NAME : name);
1244}
1245function edgeArgsToObj(isDirected, v_, w_, name) {
1246 var v = "" + v_;
1247 var w = "" + w_;
1248 if (!isDirected && v > w) {
1249 var tmp = v;
1250 v = w;
1251 w = tmp;
1252 }
1253 var edgeObj = { v, w };
1254 if (name) {
1255 edgeObj.name = name;
1256 }
1257 return edgeObj;
1258}
1259function edgeObjToId(isDirected, edgeObj) {
1260 return edgeArgsToId(isDirected, edgeObj.v, edgeObj.w, edgeObj.name);
1261}
1262export {
1263 Graph as G,
1264 isSymbol as a,
1265 baseFlatten as b,
1266 baseClone as c,
1267 baseIteratee as d,
1268 baseFindIndex as e,
1269 forEach as f,
1270 baseEach$1 as g,
1271 has as h,
1272 isUndefined as i,
1273 arrayMap as j,
1274 keys as k,
1275 castFunction as l,
1276 baseForOwn as m,
1277 castPath as n,
1278 baseGet as o,
1279 hasIn as p,
1280 toString as q,
1281 filter as r,
1282 reduce as s,
1283 toKey as t,
1284 values as v
1285};