@allgemein/base 1.9.1 → 1.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/Constants.d.ts +2 -2
  2. package/Constants.js +5 -8
  3. package/Constants.js.map +1 -1
  4. package/MetaArgs.d.ts +1 -1
  5. package/MetaArgs.js +4 -8
  6. package/MetaArgs.js.map +1 -1
  7. package/MetadataStorage.js +6 -10
  8. package/MetadataStorage.js.map +1 -1
  9. package/README.md +71 -0
  10. package/browser.d.ts +2 -2
  11. package/browser.js +2 -27
  12. package/browser.js.map +1 -1
  13. package/exceptions/NestedException.js +1 -5
  14. package/exceptions/NestedException.js.map +1 -1
  15. package/exceptions/NotSupportedError.js +1 -5
  16. package/exceptions/NotSupportedError.js.map +1 -1
  17. package/exceptions/NotYetImplementedError.js +2 -6
  18. package/exceptions/NotYetImplementedError.js.map +1 -1
  19. package/exceptions/TodoException.js +1 -5
  20. package/exceptions/TodoException.js.map +1 -1
  21. package/fns/isPromiseLike.js +1 -4
  22. package/fns/isPromiseLike.js.map +1 -1
  23. package/generics.d.ts +60 -0
  24. package/generics.js +1465 -0
  25. package/generics.js.map +1 -0
  26. package/index.d.ts +5 -5
  27. package/index.js +5 -26
  28. package/index.js.map +1 -1
  29. package/locking/LockFactory.d.ts +1 -1
  30. package/locking/LockFactory.js +8 -12
  31. package/locking/LockFactory.js.map +1 -1
  32. package/locking/Semaphore.js +2 -7
  33. package/locking/Semaphore.js.map +1 -1
  34. package/package.json +2 -2
  35. package/shared.d.ts +18 -17
  36. package/shared.js +18 -41
  37. package/shared.js.map +1 -1
  38. package/utils/ArrayUtils.js +22 -26
  39. package/utils/ArrayUtils.js.map +1 -1
  40. package/utils/ClassLoader.d.ts +5 -5
  41. package/utils/ClassLoader.js +41 -46
  42. package/utils/ClassLoader.js.map +1 -1
  43. package/utils/ClassUtils.d.ts +2 -2
  44. package/utils/ClassUtils.js +11 -15
  45. package/utils/ClassUtils.js.map +1 -1
  46. package/utils/CryptUtils.js +1 -5
  47. package/utils/CryptUtils.js.map +1 -1
  48. package/utils/FileUtils.js +12 -16
  49. package/utils/FileUtils.js.map +1 -1
  50. package/utils/Glob.js +6 -10
  51. package/utils/Glob.js.map +1 -1
  52. package/utils/Interpolation.js +5 -10
  53. package/utils/Interpolation.js.map +1 -1
  54. package/utils/JsonUtils.js +8 -12
  55. package/utils/JsonUtils.js.map +1 -1
  56. package/utils/PlatformUtils.d.ts +2 -1
  57. package/utils/PlatformUtils.js +58 -65
  58. package/utils/PlatformUtils.js.map +1 -1
  59. package/utils/PlatformUtilsBrowser.js +27 -31
  60. package/utils/PlatformUtilsBrowser.js.map +1 -1
  61. package/utils/Serializer.js +23 -27
  62. package/utils/Serializer.js.map +1 -1
  63. package/utils/TreeUtils.js +9 -13
  64. package/utils/TreeUtils.js.map +1 -1
package/generics.js ADDED
@@ -0,0 +1,1465 @@
1
+ /**
2
+ * Generic utility functions replacing lodash.
3
+ *
4
+ * The implementations follow lodash 4.17.21 semantics (iteratee shorthands,
5
+ * path handling, SameValueZero comparisons, clone/merge rules, unicode aware
6
+ * string casing), without depending on lodash itself.
7
+ */
8
+ const objectProto = Object.prototype;
9
+ const hasOwnProperty = objectProto.hasOwnProperty;
10
+ const propertyIsEnumerable = objectProto.propertyIsEnumerable;
11
+ const nativeObjectToString = objectProto.toString;
12
+ const funcToString = Function.prototype.toString;
13
+ const objectCtorString = funcToString.call(Object);
14
+ const symToStringTag = Symbol.toStringTag;
15
+ const symbolValueOf = Symbol.prototype.valueOf;
16
+ const symbolToString = Symbol.prototype.toString;
17
+ const spreadableSymbol = Symbol.isConcatSpreadable;
18
+ const INFINITY = 1 / 0;
19
+ const MAX_SAFE_INTEGER = 9007199254740991;
20
+ const MAX_INTEGER = 1.7976931348623157e+308;
21
+ const MAX_MEMOIZE_SIZE = 500;
22
+ const CLONE_DEEP_FLAG = 1;
23
+ const CLONE_SYMBOLS_FLAG = 4;
24
+ const COMPARE_PARTIAL_FLAG = 1;
25
+ const COMPARE_UNORDERED_FLAG = 2;
26
+ const argsTag = '[object Arguments]';
27
+ const arrayTag = '[object Array]';
28
+ const asyncTag = '[object AsyncFunction]';
29
+ const boolTag = '[object Boolean]';
30
+ const dateTag = '[object Date]';
31
+ const errorTag = '[object Error]';
32
+ const funcTag = '[object Function]';
33
+ const genTag = '[object GeneratorFunction]';
34
+ const mapTag = '[object Map]';
35
+ const numberTag = '[object Number]';
36
+ const nullTag = '[object Null]';
37
+ const objectTag = '[object Object]';
38
+ const proxyTag = '[object Proxy]';
39
+ const regexpTag = '[object RegExp]';
40
+ const setTag = '[object Set]';
41
+ const stringTag = '[object String]';
42
+ const symbolTag = '[object Symbol]';
43
+ const undefinedTag = '[object Undefined]';
44
+ const weakMapTag = '[object WeakMap]';
45
+ const arrayBufferTag = '[object ArrayBuffer]';
46
+ const dataViewTag = '[object DataView]';
47
+ const float32Tag = '[object Float32Array]';
48
+ const float64Tag = '[object Float64Array]';
49
+ const int8Tag = '[object Int8Array]';
50
+ const int16Tag = '[object Int16Array]';
51
+ const int32Tag = '[object Int32Array]';
52
+ const uint8Tag = '[object Uint8Array]';
53
+ const uint8ClampedTag = '[object Uint8ClampedArray]';
54
+ const uint16Tag = '[object Uint16Array]';
55
+ const uint32Tag = '[object Uint32Array]';
56
+ const typedArrayTags = {
57
+ [float32Tag]: true, [float64Tag]: true, [int8Tag]: true, [int16Tag]: true, [int32Tag]: true,
58
+ [uint8Tag]: true, [uint8ClampedTag]: true, [uint16Tag]: true, [uint32Tag]: true
59
+ };
60
+ const cloneableTags = {
61
+ ...typedArrayTags,
62
+ [argsTag]: true, [arrayTag]: true, [arrayBufferTag]: true, [dataViewTag]: true, [boolTag]: true,
63
+ [dateTag]: true, [mapTag]: true, [numberTag]: true, [objectTag]: true, [regexpTag]: true,
64
+ [setTag]: true, [stringTag]: true, [symbolTag]: true,
65
+ [errorTag]: false, [funcTag]: false, [weakMapTag]: false
66
+ };
67
+ const reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/;
68
+ const reIsPlainProp = /^\w*$/;
69
+ const rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
70
+ const reEscapeChar = /\\(\\)?/g;
71
+ const reIsUint = /^(?:0|[1-9]\d*)$/;
72
+ const reFlags = /\w*$/;
73
+ const reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
74
+ const reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
75
+ // Unicode character classes and word patterns (identical to lodash).
76
+ const rsAstralRange = '\\ud800-\\udfff';
77
+ const rsComboMarksRange = '\\u0300-\\u036f';
78
+ const reComboHalfMarksRange = '\\ufe20-\\ufe2f';
79
+ const rsComboSymbolsRange = '\\u20d0-\\u20ff';
80
+ const rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange;
81
+ const rsDingbatRange = '\\u2700-\\u27bf';
82
+ const rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff';
83
+ const rsMathOpRange = '\\xac\\xb1\\xd7\\xf7';
84
+ const rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf';
85
+ const rsPunctuationRange = '\\u2000-\\u206f';
86
+ const rsSpaceRange = ' \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000';
87
+ const rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde';
88
+ const rsVarRange = '\\ufe0e\\ufe0f';
89
+ const rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
90
+ const rsApos = '[\'\u2019]';
91
+ const rsAstral = '[' + rsAstralRange + ']';
92
+ const rsBreak = '[' + rsBreakRange + ']';
93
+ const rsCombo = '[' + rsComboRange + ']';
94
+ const rsDigits = '\\d+';
95
+ const rsDingbat = '[' + rsDingbatRange + ']';
96
+ const rsLower = '[' + rsLowerRange + ']';
97
+ const rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']';
98
+ const rsFitz = '\\ud83c[\\udffb-\\udfff]';
99
+ const rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')';
100
+ const rsNonAstral = '[^' + rsAstralRange + ']';
101
+ const rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}';
102
+ const rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]';
103
+ const rsUpper = '[' + rsUpperRange + ']';
104
+ const rsZWJ = '\\u200d';
105
+ const rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')';
106
+ const rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')';
107
+ const rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?';
108
+ const rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?';
109
+ const reOptMod = rsModifier + '?';
110
+ const rsOptVar = '[' + rsVarRange + ']?';
111
+ const rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*';
112
+ const rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])';
113
+ const rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])';
114
+ const rsSeq = rsOptVar + reOptMod + rsOptJoin;
115
+ const rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq;
116
+ const rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
117
+ const reApos = RegExp(rsApos, 'g');
118
+ const reComboMark = RegExp(rsCombo, 'g');
119
+ const reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
120
+ const reUnicodeWord = RegExp([
121
+ rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
122
+ rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
123
+ rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
124
+ rsUpper + '+' + rsOptContrUpper,
125
+ rsOrdUpper,
126
+ rsOrdLower,
127
+ rsDigits,
128
+ rsEmoji
129
+ ].join('|'), 'g');
130
+ const reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
131
+ const reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
132
+ const deburredLetters = {
133
+ // Latin-1 Supplement block.
134
+ '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
135
+ '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
136
+ '\xc7': 'C', '\xe7': 'c',
137
+ '\xd0': 'D', '\xf0': 'd',
138
+ '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
139
+ '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
140
+ '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
141
+ '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
142
+ '\xd1': 'N', '\xf1': 'n',
143
+ '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
144
+ '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
145
+ '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
146
+ '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
147
+ '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
148
+ '\xc6': 'Ae', '\xe6': 'ae',
149
+ '\xde': 'Th', '\xfe': 'th',
150
+ '\xdf': 'ss',
151
+ // Latin Extended-A block.
152
+ '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
153
+ '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
154
+ '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
155
+ '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
156
+ '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
157
+ '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
158
+ '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
159
+ '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
160
+ '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
161
+ '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
162
+ '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
163
+ '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
164
+ '\u0134': 'J', '\u0135': 'j',
165
+ '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
166
+ '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
167
+ '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
168
+ '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
169
+ '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
170
+ '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
171
+ '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
172
+ '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
173
+ '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
174
+ '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
175
+ '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
176
+ '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
177
+ '\u0163': 't', '\u0165': 't', '\u0167': 't',
178
+ '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
179
+ '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
180
+ '\u0174': 'W', '\u0175': 'w',
181
+ '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
182
+ '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
183
+ '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
184
+ '\u0132': 'IJ', '\u0133': 'ij',
185
+ '\u0152': 'Oe', '\u0153': 'oe',
186
+ '\u0149': '\'n', '\u017f': 's'
187
+ };
188
+ /* ---------------------------------------------------------------------------
189
+ * internal helpers
190
+ * ------------------------------------------------------------------------- */
191
+ function identity(value) {
192
+ return value;
193
+ }
194
+ function eq(value, other) {
195
+ return value === other || (value !== value && other !== other);
196
+ }
197
+ function baseToString(value) {
198
+ if (typeof value === 'string') {
199
+ return value;
200
+ }
201
+ if (isArray(value)) {
202
+ // Array.from visits holes, unlike Array#map
203
+ return Array.from(value, baseToString) + '';
204
+ }
205
+ if (isSymbol(value)) {
206
+ return symbolToString.call(value);
207
+ }
208
+ const result = (value + '');
209
+ return (result === '0' && (1 / value) === -INFINITY) ? '-0' : result;
210
+ }
211
+ function toStr(value) {
212
+ return value == null ? '' : baseToString(value);
213
+ }
214
+ export function upperFirst(string) {
215
+ const str = toStr(string);
216
+ if (!str) {
217
+ return '';
218
+ }
219
+ const strSymbols = reHasUnicode.test(str) ? stringToArray(str) : undefined;
220
+ const chr = strSymbols ? strSymbols[0] : str.charAt(0);
221
+ const trailing = strSymbols ? strSymbols.slice(1).join('') : str.slice(1);
222
+ return chr.toUpperCase() + trailing;
223
+ }
224
+ function getRawTag(value) {
225
+ const isOwn = hasOwnProperty.call(value, symToStringTag);
226
+ const tag = value[symToStringTag];
227
+ let unmasked = false;
228
+ try {
229
+ value[symToStringTag] = undefined;
230
+ unmasked = true;
231
+ }
232
+ catch (e) {
233
+ // read-only tag (built-ins, frozen objects, primitives)
234
+ }
235
+ const result = nativeObjectToString.call(value);
236
+ if (unmasked) {
237
+ if (isOwn) {
238
+ value[symToStringTag] = tag;
239
+ }
240
+ else {
241
+ delete value[symToStringTag];
242
+ }
243
+ }
244
+ return result;
245
+ }
246
+ function getTag(value) {
247
+ if (value == null) {
248
+ return value === undefined ? undefinedTag : nullTag;
249
+ }
250
+ return (symToStringTag in Object(value)) ? getRawTag(value) : nativeObjectToString.call(value);
251
+ }
252
+ function isArguments(value) {
253
+ return isObjectLike(value) && getTag(value) === argsTag;
254
+ }
255
+ function isSymbol(value) {
256
+ return typeof value === 'symbol' || (isObjectLike(value) && getTag(value) === symbolTag);
257
+ }
258
+ function isLength(value) {
259
+ return typeof value === 'number' && value > -1 && value % 1 === 0 && value <= MAX_SAFE_INTEGER;
260
+ }
261
+ function isArrayLike(value) {
262
+ return value != null && isLength(value.length) && !isFunction(value);
263
+ }
264
+ function isArrayLikeObject(value) {
265
+ return isObjectLike(value) && isArrayLike(value);
266
+ }
267
+ function isBuffer(value) {
268
+ const Buf = globalThis.Buffer;
269
+ return typeof Buf === 'function' && typeof Buf.isBuffer === 'function' ? Buf.isBuffer(value) : false;
270
+ }
271
+ function isTypedArray(value) {
272
+ return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[getTag(value)];
273
+ }
274
+ function isMap(value) {
275
+ return isObjectLike(value) && getTag(value) === mapTag;
276
+ }
277
+ function isPrototype(value) {
278
+ const Ctor = value && value.constructor;
279
+ const proto = (typeof Ctor === 'function' && Ctor.prototype) || objectProto;
280
+ return value === proto;
281
+ }
282
+ function isIndex(value, length) {
283
+ const type = typeof value;
284
+ length = length == null ? MAX_SAFE_INTEGER : length;
285
+ return !!length &&
286
+ (type === 'number' || (type !== 'symbol' && reIsUint.test(value))) &&
287
+ (value > -1 && value % 1 === 0 && value < length);
288
+ }
289
+ function isIterateeCall(value, index, object) {
290
+ if (!isObject(object)) {
291
+ return false;
292
+ }
293
+ const type = typeof index;
294
+ if (type === 'number' ? (isArrayLike(object) && isIndex(index, object.length)) : (type === 'string' && index in object)) {
295
+ return eq(object[index], value);
296
+ }
297
+ return false;
298
+ }
299
+ function isStrictComparable(value) {
300
+ return value === value && !isObject(value);
301
+ }
302
+ function isFlattenable(value) {
303
+ return isArray(value) || isArguments(value) || !!(value && value[spreadableSymbol]);
304
+ }
305
+ function toNumber(value) {
306
+ if (typeof value === 'number') {
307
+ return value;
308
+ }
309
+ if (isSymbol(value)) {
310
+ return NaN;
311
+ }
312
+ return Number(value);
313
+ }
314
+ function toFinite(value) {
315
+ if (!value) {
316
+ return value === 0 ? value : 0;
317
+ }
318
+ value = toNumber(value);
319
+ if (value === INFINITY || value === -INFINITY) {
320
+ return (value < 0 ? -1 : 1) * MAX_INTEGER;
321
+ }
322
+ return value === value ? value : 0;
323
+ }
324
+ function toInteger(value) {
325
+ const result = toFinite(value);
326
+ const remainder = result % 1;
327
+ return result === result ? (remainder ? result - remainder : result) : 0;
328
+ }
329
+ function toKey(value) {
330
+ if (typeof value === 'string' || isSymbol(value)) {
331
+ return value;
332
+ }
333
+ const result = (value + '');
334
+ return (result === '0' && (1 / value) === -INFINITY) ? '-0' : result;
335
+ }
336
+ function copyArray(source, array) {
337
+ const length = source.length;
338
+ array || (array = new Array(length));
339
+ for (let i = 0; i < length; i++) {
340
+ array[i] = source[i];
341
+ }
342
+ return array;
343
+ }
344
+ function arrayPush(array, values) {
345
+ const offset = array.length;
346
+ for (let i = 0; i < values.length; i++) {
347
+ array[offset + i] = values[i];
348
+ }
349
+ return array;
350
+ }
351
+ function baseFlatten(array, depth, result = []) {
352
+ for (const value of array) {
353
+ if (depth > 0 && isFlattenable(value)) {
354
+ if (depth > 1) {
355
+ baseFlatten(value, depth - 1, result);
356
+ }
357
+ else {
358
+ arrayPush(result, value);
359
+ }
360
+ }
361
+ else {
362
+ result[result.length] = value;
363
+ }
364
+ }
365
+ return result;
366
+ }
367
+ /* ---------------------------------------------------------------------------
368
+ * keys
369
+ * ------------------------------------------------------------------------- */
370
+ function arrayLikeKeys(value, inherited) {
371
+ const isArr = isArray(value);
372
+ const isArg = !isArr && isArguments(value);
373
+ const isBuff = !isArr && !isArg && isBuffer(value);
374
+ const isType = !isArr && !isArg && !isBuff && isTypedArray(value);
375
+ const skipIndexes = isArr || isArg || isBuff || isType;
376
+ const result = [];
377
+ if (skipIndexes) {
378
+ for (let i = 0; i < value.length; i++) {
379
+ result.push(String(i));
380
+ }
381
+ }
382
+ const length = result.length;
383
+ for (const key in value) {
384
+ if ((inherited || hasOwnProperty.call(value, key)) &&
385
+ !(skipIndexes && (key === 'length' ||
386
+ (isBuff && (key === 'offset' || key === 'parent')) ||
387
+ (isType && (key === 'buffer' || key === 'byteLength' || key === 'byteOffset')) ||
388
+ isIndex(key, length)))) {
389
+ result.push(key);
390
+ }
391
+ }
392
+ return result;
393
+ }
394
+ function baseKeys(object) {
395
+ if (!isPrototype(object)) {
396
+ return Object.keys(Object(object));
397
+ }
398
+ const result = [];
399
+ for (const key in Object(object)) {
400
+ if (hasOwnProperty.call(object, key) && key !== 'constructor') {
401
+ result.push(key);
402
+ }
403
+ }
404
+ return result;
405
+ }
406
+ function baseKeysIn(object) {
407
+ const result = [];
408
+ if (!isObject(object)) {
409
+ if (object != null) {
410
+ for (const key in Object(object)) {
411
+ result.push(key);
412
+ }
413
+ }
414
+ return result;
415
+ }
416
+ const isProto = isPrototype(object);
417
+ for (const key in object) {
418
+ if (!(key === 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
419
+ result.push(key);
420
+ }
421
+ }
422
+ return result;
423
+ }
424
+ function keysIn(object) {
425
+ return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
426
+ }
427
+ function getSymbols(object) {
428
+ if (object == null) {
429
+ return [];
430
+ }
431
+ object = Object(object);
432
+ return Object.getOwnPropertySymbols(object).filter(symbol => propertyIsEnumerable.call(object, symbol));
433
+ }
434
+ function getAllKeys(object) {
435
+ const result = keys(object);
436
+ return isArray(object) ? result : arrayPush(result, getSymbols(object));
437
+ }
438
+ /* ---------------------------------------------------------------------------
439
+ * property paths
440
+ * ------------------------------------------------------------------------- */
441
+ const pathCache = new Map();
442
+ function stringToPath(string) {
443
+ const cached = pathCache.get(string);
444
+ if (cached) {
445
+ return cached;
446
+ }
447
+ const result = [];
448
+ if (string.charCodeAt(0) === 46 /* . */) {
449
+ result.push('');
450
+ }
451
+ string.replace(rePropName, (match, number, quote, subString) => {
452
+ result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
453
+ return '';
454
+ });
455
+ if (pathCache.size >= MAX_MEMOIZE_SIZE) {
456
+ pathCache.clear();
457
+ }
458
+ pathCache.set(string, result);
459
+ return result;
460
+ }
461
+ function isKey(value, object) {
462
+ if (isArray(value)) {
463
+ return false;
464
+ }
465
+ const type = typeof value;
466
+ if (type === 'number' || type === 'symbol' || type === 'boolean' || value == null || isSymbol(value)) {
467
+ return true;
468
+ }
469
+ return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || (object != null && value in Object(object));
470
+ }
471
+ function castPath(value, object) {
472
+ if (isArray(value)) {
473
+ return value;
474
+ }
475
+ return isKey(value, object) ? [value] : stringToPath(toStr(value));
476
+ }
477
+ function baseGet(object, path) {
478
+ path = castPath(path, object);
479
+ let index = 0;
480
+ const length = path.length;
481
+ while (object != null && index < length) {
482
+ object = object[toKey(path[index++])];
483
+ }
484
+ return (index && index === length) ? object : undefined;
485
+ }
486
+ function hasPath(object, path, hasFunc) {
487
+ path = castPath(path, object);
488
+ let index = -1;
489
+ let length = path.length;
490
+ let result = false;
491
+ let key;
492
+ while (++index < length) {
493
+ key = toKey(path[index]);
494
+ if (!(result = object != null && hasFunc(object, key))) {
495
+ break;
496
+ }
497
+ object = object[key];
498
+ }
499
+ if (result || ++index !== length) {
500
+ return result;
501
+ }
502
+ length = object == null ? 0 : object.length;
503
+ return !!length && isLength(length) && isIndex(key, length) && (isArray(object) || isArguments(object));
504
+ }
505
+ function baseHas(object, key) {
506
+ return object != null && hasOwnProperty.call(object, key);
507
+ }
508
+ function baseHasIn(object, key) {
509
+ return object != null && key in Object(object);
510
+ }
511
+ function hasIn(object, path) {
512
+ return object != null && hasPath(object, path, baseHasIn);
513
+ }
514
+ function baseAssignValue(object, key, value) {
515
+ if (key === '__proto__') {
516
+ Object.defineProperty(object, key, { configurable: true, enumerable: true, value, writable: true });
517
+ }
518
+ else {
519
+ object[key] = value;
520
+ }
521
+ }
522
+ function assignValue(object, key, value) {
523
+ const objValue = object[key];
524
+ if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || (value === undefined && !(key in object))) {
525
+ baseAssignValue(object, key, value);
526
+ }
527
+ }
528
+ function copyObject(source, props, object) {
529
+ for (const key of props) {
530
+ assignValue(object, key, source[key]);
531
+ }
532
+ return object;
533
+ }
534
+ /* ---------------------------------------------------------------------------
535
+ * iteratees
536
+ * ------------------------------------------------------------------------- */
537
+ function baseProperty(key) {
538
+ return (object) => object == null ? undefined : object[key];
539
+ }
540
+ function property(path) {
541
+ if (isKey(path)) {
542
+ return baseProperty(toKey(path));
543
+ }
544
+ return (object) => baseGet(object, path);
545
+ }
546
+ function matchesStrictComparable(key, srcValue) {
547
+ return (object) => {
548
+ if (object == null) {
549
+ return false;
550
+ }
551
+ return object[key] === srcValue && (srcValue !== undefined || (key in Object(object)));
552
+ };
553
+ }
554
+ function getMatchData(object) {
555
+ return keys(object).map(key => {
556
+ const value = object[key];
557
+ return [key, value, isStrictComparable(value)];
558
+ });
559
+ }
560
+ function baseIsMatch(object, source, matchData) {
561
+ let index = matchData.length;
562
+ const length = index;
563
+ if (object == null) {
564
+ return !length;
565
+ }
566
+ object = Object(object);
567
+ while (index--) {
568
+ const data = matchData[index];
569
+ if (data[2] ? data[1] !== object[data[0]] : !(data[0] in object)) {
570
+ return false;
571
+ }
572
+ }
573
+ while (++index < length) {
574
+ const [key, srcValue, strict] = matchData[index];
575
+ const objValue = object[key];
576
+ if (strict) {
577
+ if (objValue === undefined && !(key in object)) {
578
+ return false;
579
+ }
580
+ }
581
+ else if (!baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG)) {
582
+ return false;
583
+ }
584
+ }
585
+ return true;
586
+ }
587
+ function baseMatches(source) {
588
+ const matchData = getMatchData(source);
589
+ if (matchData.length === 1 && matchData[0][2]) {
590
+ return matchesStrictComparable(matchData[0][0], matchData[0][1]);
591
+ }
592
+ return (object) => object === source || baseIsMatch(object, source, matchData);
593
+ }
594
+ function baseMatchesProperty(path, srcValue) {
595
+ if (isKey(path) && isStrictComparable(srcValue)) {
596
+ return matchesStrictComparable(toKey(path), srcValue);
597
+ }
598
+ return (object) => {
599
+ const objValue = get(object, path);
600
+ return (objValue === undefined && objValue === srcValue)
601
+ ? hasIn(object, path)
602
+ : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
603
+ };
604
+ }
605
+ function baseIteratee(value) {
606
+ if (typeof value === 'function') {
607
+ return value;
608
+ }
609
+ if (value == null) {
610
+ return identity;
611
+ }
612
+ if (typeof value === 'object') {
613
+ return isArray(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value);
614
+ }
615
+ return property(value);
616
+ }
617
+ function baseEach(collection, iteratee) {
618
+ if (collection == null) {
619
+ return;
620
+ }
621
+ const iterable = Object(collection);
622
+ if (isArrayLike(collection)) {
623
+ const length = collection.length;
624
+ for (let i = 0; i < length; i++) {
625
+ if (iteratee(iterable[i], i, iterable) === false) {
626
+ break;
627
+ }
628
+ }
629
+ return;
630
+ }
631
+ for (const key of keys(collection)) {
632
+ if (iteratee(iterable[key], key, iterable) === false) {
633
+ break;
634
+ }
635
+ }
636
+ }
637
+ function baseUniq(array, iteratee) {
638
+ const seen = new Set();
639
+ const result = [];
640
+ for (let i = 0; i < array.length; i++) {
641
+ let value = array[i];
642
+ const computed = iteratee ? iteratee(value) : value;
643
+ value = value !== 0 ? value : 0;
644
+ if (!seen.has(computed)) {
645
+ seen.add(computed);
646
+ result.push(value);
647
+ }
648
+ }
649
+ return result;
650
+ }
651
+ function baseIsEqual(value, other, bitmask = 0, stack) {
652
+ if (value === other) {
653
+ return true;
654
+ }
655
+ if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
656
+ return value !== value && other !== other;
657
+ }
658
+ return baseIsEqualDeep(value, other, bitmask, stack);
659
+ }
660
+ function baseIsEqualDeep(object, other, bitmask, stack) {
661
+ let objIsArr = isArray(object);
662
+ const othIsArr = isArray(other);
663
+ let objTag = objIsArr ? arrayTag : getTag(object);
664
+ let othTag = othIsArr ? arrayTag : getTag(other);
665
+ objTag = objTag === argsTag ? objectTag : objTag;
666
+ othTag = othTag === argsTag ? objectTag : othTag;
667
+ let objIsObj = objTag === objectTag;
668
+ const isSameTag = objTag === othTag;
669
+ if (isSameTag && isBuffer(object)) {
670
+ if (!isBuffer(other)) {
671
+ return false;
672
+ }
673
+ objIsArr = true;
674
+ objIsObj = false;
675
+ }
676
+ if (isSameTag && !objIsObj) {
677
+ stack || (stack = new Map());
678
+ return (objIsArr || isTypedArray(object))
679
+ ? equalArrays(object, other, bitmask, stack)
680
+ : equalByTag(object, other, objTag, bitmask, stack);
681
+ }
682
+ if (!isSameTag) {
683
+ return false;
684
+ }
685
+ stack || (stack = new Map());
686
+ return equalObjects(object, other, bitmask, stack);
687
+ }
688
+ function equalArrays(array, other, bitmask, stack) {
689
+ const isPartial = bitmask & COMPARE_PARTIAL_FLAG;
690
+ const arrLength = array.length;
691
+ const othLength = other.length;
692
+ if (arrLength !== othLength && !(isPartial && othLength > arrLength)) {
693
+ return false;
694
+ }
695
+ const arrStacked = stack.get(array);
696
+ const othStacked = stack.get(other);
697
+ if (arrStacked && othStacked) {
698
+ return arrStacked === other && othStacked === array;
699
+ }
700
+ let result = true;
701
+ const seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new Set() : undefined;
702
+ stack.set(array, other);
703
+ stack.set(other, array);
704
+ for (let index = 0; index < arrLength; index++) {
705
+ const arrValue = array[index];
706
+ if (seen) {
707
+ let found = false;
708
+ for (let othIndex = 0; othIndex < other.length; othIndex++) {
709
+ const othValue = other[othIndex];
710
+ if (!seen.has(othIndex) && (arrValue === othValue || baseIsEqual(arrValue, othValue, bitmask, stack))) {
711
+ seen.add(othIndex);
712
+ found = true;
713
+ break;
714
+ }
715
+ }
716
+ if (!found) {
717
+ result = false;
718
+ break;
719
+ }
720
+ }
721
+ else {
722
+ const othValue = other[index];
723
+ if (!(arrValue === othValue || baseIsEqual(arrValue, othValue, bitmask, stack))) {
724
+ result = false;
725
+ break;
726
+ }
727
+ }
728
+ }
729
+ stack.delete(array);
730
+ stack.delete(other);
731
+ return result;
732
+ }
733
+ function equalByTag(object, other, tag, bitmask, stack) {
734
+ switch (tag) {
735
+ case dataViewTag:
736
+ if (object.byteLength !== other.byteLength || object.byteOffset !== other.byteOffset) {
737
+ return false;
738
+ }
739
+ return equalByTag(object.buffer, other.buffer, arrayBufferTag, bitmask, stack);
740
+ case arrayBufferTag:
741
+ return !(object.byteLength !== other.byteLength || !baseIsEqual(new Uint8Array(object), new Uint8Array(other)));
742
+ case boolTag:
743
+ case dateTag:
744
+ case numberTag:
745
+ return eq(+object, +other);
746
+ case errorTag:
747
+ return object.name === other.name && object.message === other.message;
748
+ case regexpTag:
749
+ case stringTag:
750
+ // loose equality on purpose: compares String/RegExp wrapper objects with primitives
751
+ // eslint-disable-next-line eqeqeq
752
+ return object == (other + '');
753
+ case mapTag:
754
+ case setTag: {
755
+ const convert = tag === mapTag
756
+ ? (map) => Array.from(map.entries())
757
+ : (set) => Array.from(set.values());
758
+ const isPartial = bitmask & COMPARE_PARTIAL_FLAG;
759
+ if (object.size !== other.size && !isPartial) {
760
+ return false;
761
+ }
762
+ const stacked = stack.get(object);
763
+ if (stacked) {
764
+ return stacked === other;
765
+ }
766
+ stack.set(object, other);
767
+ const result = equalArrays(convert(object), convert(other), bitmask | COMPARE_UNORDERED_FLAG, stack);
768
+ stack.delete(object);
769
+ return result;
770
+ }
771
+ case symbolTag:
772
+ return symbolValueOf.call(object) === symbolValueOf.call(other);
773
+ }
774
+ return false;
775
+ }
776
+ function equalObjects(object, other, bitmask, stack) {
777
+ const isPartial = bitmask & COMPARE_PARTIAL_FLAG;
778
+ const objProps = getAllKeys(object);
779
+ const objLength = objProps.length;
780
+ const othLength = getAllKeys(other).length;
781
+ if (objLength !== othLength && !isPartial) {
782
+ return false;
783
+ }
784
+ for (let index = objLength - 1; index >= 0; index--) {
785
+ const key = objProps[index];
786
+ if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
787
+ return false;
788
+ }
789
+ }
790
+ const objStacked = stack.get(object);
791
+ const othStacked = stack.get(other);
792
+ if (objStacked && othStacked) {
793
+ return objStacked === other && othStacked === object;
794
+ }
795
+ let result = true;
796
+ stack.set(object, other);
797
+ stack.set(other, object);
798
+ let skipCtor = !!isPartial;
799
+ for (const key of objProps) {
800
+ const objValue = object[key];
801
+ const othValue = other[key];
802
+ if (!(objValue === othValue || baseIsEqual(objValue, othValue, bitmask, stack))) {
803
+ result = false;
804
+ break;
805
+ }
806
+ skipCtor || (skipCtor = key === 'constructor');
807
+ }
808
+ if (result && !skipCtor) {
809
+ const objCtor = object.constructor;
810
+ const othCtor = other.constructor;
811
+ if (objCtor !== othCtor &&
812
+ ('constructor' in object && 'constructor' in other) &&
813
+ !(typeof objCtor === 'function' && objCtor instanceof objCtor &&
814
+ typeof othCtor === 'function' && othCtor instanceof othCtor)) {
815
+ result = false;
816
+ }
817
+ }
818
+ stack.delete(object);
819
+ stack.delete(other);
820
+ return result;
821
+ }
822
+ /* ---------------------------------------------------------------------------
823
+ * cloning
824
+ * ------------------------------------------------------------------------- */
825
+ function initCloneArray(array) {
826
+ const length = array.length;
827
+ const result = new array.constructor(length);
828
+ // results of RegExp#exec
829
+ if (length && typeof array[0] === 'string' && hasOwnProperty.call(array, 'index')) {
830
+ result.index = array.index;
831
+ result.input = array.input;
832
+ }
833
+ return result;
834
+ }
835
+ function initCloneObject(object) {
836
+ if (typeof object.constructor === 'function' && !isPrototype(object)) {
837
+ const proto = Object.getPrototypeOf(object);
838
+ return isObject(proto) ? Object.create(proto) : {};
839
+ }
840
+ return {};
841
+ }
842
+ function cloneArrayBuffer(arrayBuffer) {
843
+ const result = new arrayBuffer.constructor(arrayBuffer.byteLength);
844
+ new Uint8Array(result).set(new Uint8Array(arrayBuffer));
845
+ return result;
846
+ }
847
+ function cloneBuffer(buffer, isDeep) {
848
+ if (isDeep) {
849
+ return buffer.slice();
850
+ }
851
+ const Buf = globalThis.Buffer;
852
+ const result = Buf && Buf.allocUnsafe ? Buf.allocUnsafe(buffer.length) : new buffer.constructor(buffer.length);
853
+ buffer.copy(result);
854
+ return result;
855
+ }
856
+ function initCloneByTag(object, tag, isDeep) {
857
+ const Ctor = object.constructor;
858
+ switch (tag) {
859
+ case arrayBufferTag:
860
+ return cloneArrayBuffer(object);
861
+ case boolTag:
862
+ case dateTag:
863
+ return new Ctor(+object);
864
+ case dataViewTag: {
865
+ const buffer = isDeep ? cloneArrayBuffer(object.buffer) : object.buffer;
866
+ return new Ctor(buffer, object.byteOffset, object.byteLength);
867
+ }
868
+ case float32Tag:
869
+ case float64Tag:
870
+ case int8Tag:
871
+ case int16Tag:
872
+ case int32Tag:
873
+ case uint8Tag:
874
+ case uint8ClampedTag:
875
+ case uint16Tag:
876
+ case uint32Tag: {
877
+ const buffer = isDeep ? cloneArrayBuffer(object.buffer) : object.buffer;
878
+ return new Ctor(buffer, object.byteOffset, object.length);
879
+ }
880
+ case mapTag:
881
+ case setTag:
882
+ return new Ctor();
883
+ case numberTag:
884
+ case stringTag:
885
+ return new Ctor(object);
886
+ case regexpTag: {
887
+ const result = new Ctor(object.source, reFlags.exec(String(object))[0]);
888
+ result.lastIndex = object.lastIndex;
889
+ return result;
890
+ }
891
+ case symbolTag:
892
+ return Object(symbolValueOf.call(object));
893
+ }
894
+ }
895
+ function baseClone(value, bitmask, key, object, stack) {
896
+ const isDeep = !!(bitmask & CLONE_DEEP_FLAG);
897
+ const isFull = !!(bitmask & CLONE_SYMBOLS_FLAG);
898
+ if (!isObject(value)) {
899
+ return value;
900
+ }
901
+ const isArr = isArray(value);
902
+ let result;
903
+ if (isArr) {
904
+ result = initCloneArray(value);
905
+ if (!isDeep) {
906
+ return copyArray(value, result);
907
+ }
908
+ }
909
+ else {
910
+ const tag = getTag(value);
911
+ const isFunc = tag === funcTag || tag === genTag;
912
+ if (isBuffer(value)) {
913
+ return cloneBuffer(value, isDeep);
914
+ }
915
+ if (tag === objectTag || tag === argsTag || (isFunc && !object)) {
916
+ result = isFunc ? {} : initCloneObject(value);
917
+ if (!isDeep) {
918
+ copyObject(value, keys(value), result);
919
+ return copyObject(value, getSymbols(value), result);
920
+ }
921
+ }
922
+ else {
923
+ if (!cloneableTags[tag]) {
924
+ return object ? value : {};
925
+ }
926
+ result = initCloneByTag(value, tag, isDeep);
927
+ }
928
+ }
929
+ stack || (stack = new Map());
930
+ const stacked = stack.get(value);
931
+ if (stacked) {
932
+ return stacked;
933
+ }
934
+ stack.set(value, result);
935
+ if (isSet(value)) {
936
+ value.forEach(subValue => {
937
+ result.add(baseClone(subValue, bitmask, subValue, value, stack));
938
+ });
939
+ }
940
+ else if (isMap(value)) {
941
+ value.forEach((subValue, subKey) => {
942
+ result.set(subKey, baseClone(subValue, bitmask, subKey, value, stack));
943
+ });
944
+ }
945
+ if (isArr) {
946
+ for (let i = 0; i < value.length; i++) {
947
+ assignValue(result, i, baseClone(value[i], bitmask, i, value, stack));
948
+ }
949
+ }
950
+ else {
951
+ const props = isFull ? getAllKeys(value) : keys(value);
952
+ for (const prop of props) {
953
+ assignValue(result, prop, baseClone(value[prop], bitmask, prop, value, stack));
954
+ }
955
+ }
956
+ return result;
957
+ }
958
+ function safeGet(object, key) {
959
+ if (key === 'constructor' && typeof object[key] === 'function') {
960
+ return undefined;
961
+ }
962
+ if (key === '__proto__') {
963
+ return undefined;
964
+ }
965
+ return object[key];
966
+ }
967
+ function assignMergeValue(object, key, value) {
968
+ if ((value !== undefined && !eq(object[key], value)) || (value === undefined && !(key in object))) {
969
+ baseAssignValue(object, key, value);
970
+ }
971
+ }
972
+ function baseMerge(object, source, customizer, stack) {
973
+ if (object === source) {
974
+ return;
975
+ }
976
+ const iterable = Object(source);
977
+ for (const key of keysIn(source)) {
978
+ const srcValue = iterable[key];
979
+ stack || (stack = new Map());
980
+ if (isObject(srcValue)) {
981
+ baseMergeDeep(object, source, key, customizer, stack);
982
+ }
983
+ else {
984
+ let newValue = customizer ? customizer(safeGet(object, key), srcValue, key + '', object, source, stack) : undefined;
985
+ if (newValue === undefined) {
986
+ newValue = srcValue;
987
+ }
988
+ assignMergeValue(object, key, newValue);
989
+ }
990
+ }
991
+ }
992
+ function baseMergeDeep(object, source, key, customizer, stack) {
993
+ const objValue = safeGet(object, key);
994
+ const srcValue = safeGet(source, key);
995
+ const stacked = stack.get(srcValue);
996
+ if (stacked) {
997
+ assignMergeValue(object, key, stacked);
998
+ return;
999
+ }
1000
+ let newValue = customizer ? customizer(objValue, srcValue, key + '', object, source, stack) : undefined;
1001
+ let isCommon = newValue === undefined;
1002
+ if (isCommon) {
1003
+ const isArr = isArray(srcValue);
1004
+ const isBuff = !isArr && isBuffer(srcValue);
1005
+ const isTyped = !isArr && !isBuff && isTypedArray(srcValue);
1006
+ newValue = srcValue;
1007
+ if (isArr || isBuff || isTyped) {
1008
+ if (isArray(objValue)) {
1009
+ newValue = objValue;
1010
+ }
1011
+ else if (isArrayLikeObject(objValue)) {
1012
+ newValue = copyArray(objValue);
1013
+ }
1014
+ else if (isBuff) {
1015
+ isCommon = false;
1016
+ newValue = cloneBuffer(srcValue, true);
1017
+ }
1018
+ else if (isTyped) {
1019
+ isCommon = false;
1020
+ newValue = new srcValue.constructor(cloneArrayBuffer(srcValue.buffer), srcValue.byteOffset, srcValue.length);
1021
+ }
1022
+ else {
1023
+ newValue = [];
1024
+ }
1025
+ }
1026
+ else if (isPlainObject(srcValue) || isArguments(srcValue)) {
1027
+ newValue = objValue;
1028
+ if (isArguments(objValue)) {
1029
+ newValue = copyObject(objValue, keysIn(objValue), {});
1030
+ }
1031
+ else if (!isObject(objValue) || isFunction(objValue)) {
1032
+ newValue = initCloneObject(srcValue);
1033
+ }
1034
+ }
1035
+ else {
1036
+ isCommon = false;
1037
+ }
1038
+ }
1039
+ if (isCommon) {
1040
+ stack.set(srcValue, newValue);
1041
+ baseMerge(newValue, srcValue, customizer, stack);
1042
+ stack.delete(srcValue);
1043
+ }
1044
+ assignMergeValue(object, key, newValue);
1045
+ }
1046
+ function createAssigner(assigner, withCustomizer) {
1047
+ return (object, ...sources) => {
1048
+ let length = sources.length;
1049
+ let customizer = length > 1 ? sources[length - 1] : undefined;
1050
+ const guard = length > 2 ? sources[2] : undefined;
1051
+ if (withCustomizer && typeof customizer === 'function') {
1052
+ length--;
1053
+ }
1054
+ else {
1055
+ customizer = undefined;
1056
+ }
1057
+ if (guard && isIterateeCall(sources[0], sources[1], guard)) {
1058
+ customizer = length < 3 ? undefined : customizer;
1059
+ length = 1;
1060
+ }
1061
+ object = Object(object);
1062
+ for (let i = 0; i < length; i++) {
1063
+ const source = sources[i];
1064
+ if (source) {
1065
+ assigner(object, source, customizer);
1066
+ }
1067
+ }
1068
+ return object;
1069
+ };
1070
+ }
1071
+ const baseAssign = createAssigner((object, source) => {
1072
+ if (isPrototype(source) || isArrayLike(source)) {
1073
+ copyObject(source, keys(source), object);
1074
+ return;
1075
+ }
1076
+ for (const key in source) {
1077
+ if (hasOwnProperty.call(source, key)) {
1078
+ assignValue(object, key, source[key]);
1079
+ }
1080
+ }
1081
+ }, false);
1082
+ const baseMergeAssigner = createAssigner((object, source, customizer) => baseMerge(object, source, customizer), true);
1083
+ function customDefaultsMerge(objValue, srcValue, _key, _object, _source, stack) {
1084
+ if (isObject(objValue) && isObject(srcValue)) {
1085
+ stack.set(srcValue, objValue);
1086
+ baseMerge(objValue, srcValue, customDefaultsMerge, stack);
1087
+ stack.delete(srcValue);
1088
+ }
1089
+ return objValue;
1090
+ }
1091
+ /* ---------------------------------------------------------------------------
1092
+ * strings
1093
+ * ------------------------------------------------------------------------- */
1094
+ function deburr(string) {
1095
+ const str = toStr(string);
1096
+ return str && str.replace(reLatin, chr => deburredLetters[chr]).replace(reComboMark, '');
1097
+ }
1098
+ function words(string) {
1099
+ return (reHasUnicodeWord.test(string) ? string.match(reUnicodeWord) : string.match(reAsciiWord)) || [];
1100
+ }
1101
+ function createCompounder(callback) {
1102
+ return (string) => words(deburr(string).replace(reApos, '')).reduce(callback, '');
1103
+ }
1104
+ function stringToArray(string) {
1105
+ return reHasUnicode.test(string) ? (string.match(reUnicode) || []) : string.split('');
1106
+ }
1107
+ /* ---------------------------------------------------------------------------
1108
+ * type checks
1109
+ * ------------------------------------------------------------------------- */
1110
+ export function isArray(value) {
1111
+ return Array.isArray(value);
1112
+ }
1113
+ export function isNull(value) {
1114
+ return value === null;
1115
+ }
1116
+ export function isObject(value) {
1117
+ const type = typeof value;
1118
+ return value != null && (type === 'object' || type === 'function');
1119
+ }
1120
+ export function isObjectLike(value) {
1121
+ return value != null && typeof value === 'object';
1122
+ }
1123
+ export function isBoolean(value) {
1124
+ return value === true || value === false || (isObjectLike(value) && getTag(value) === boolTag);
1125
+ }
1126
+ export function isDate(value) {
1127
+ return isObjectLike(value) && getTag(value) === dateTag;
1128
+ }
1129
+ export function isFunction(value) {
1130
+ if (!isObject(value)) {
1131
+ return false;
1132
+ }
1133
+ const tag = getTag(value);
1134
+ return tag === funcTag || tag === genTag || tag === asyncTag || tag === proxyTag;
1135
+ }
1136
+ export function isNumber(value) {
1137
+ return typeof value === 'number' || (isObjectLike(value) && getTag(value) === numberTag);
1138
+ }
1139
+ export function isPlainObject(value) {
1140
+ if (!isObjectLike(value) || getTag(value) !== objectTag) {
1141
+ return false;
1142
+ }
1143
+ const proto = Object.getPrototypeOf(value);
1144
+ if (proto === null) {
1145
+ return true;
1146
+ }
1147
+ const Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
1148
+ return typeof Ctor === 'function' && Ctor instanceof Ctor && funcToString.call(Ctor) === objectCtorString;
1149
+ }
1150
+ export function isRegExp(value) {
1151
+ return isObjectLike(value) && getTag(value) === regexpTag;
1152
+ }
1153
+ export function isSet(value) {
1154
+ return isObjectLike(value) && getTag(value) === setTag;
1155
+ }
1156
+ export function isString(value) {
1157
+ return typeof value === 'string' || (!isArray(value) && isObjectLike(value) && getTag(value) === stringTag);
1158
+ }
1159
+ export function isUndefined(value) {
1160
+ return value === undefined;
1161
+ }
1162
+ export function isEmpty(value) {
1163
+ if (value == null) {
1164
+ return true;
1165
+ }
1166
+ if (isArrayLike(value) &&
1167
+ (isArray(value) || typeof value === 'string' || typeof value.splice === 'function' ||
1168
+ isBuffer(value) || isTypedArray(value) || isArguments(value))) {
1169
+ return !value.length;
1170
+ }
1171
+ const tag = getTag(value);
1172
+ if (tag === mapTag || tag === setTag) {
1173
+ return !value.size;
1174
+ }
1175
+ if (isPrototype(value)) {
1176
+ return !baseKeys(value).length;
1177
+ }
1178
+ for (const key in value) {
1179
+ if (hasOwnProperty.call(value, key)) {
1180
+ return false;
1181
+ }
1182
+ }
1183
+ return true;
1184
+ }
1185
+ export function isEqual(value, other) {
1186
+ return baseIsEqual(value, other);
1187
+ }
1188
+ /* ---------------------------------------------------------------------------
1189
+ * arrays & collections
1190
+ * ------------------------------------------------------------------------- */
1191
+ export function first(array) {
1192
+ return (array && array.length) ? array[0] : undefined;
1193
+ }
1194
+ export const head = first;
1195
+ export function last(array) {
1196
+ const length = array == null ? 0 : array.length;
1197
+ return length ? array[length - 1] : undefined;
1198
+ }
1199
+ export function concat(array, ...values) {
1200
+ if (!arguments.length) {
1201
+ return [];
1202
+ }
1203
+ return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(values, 1));
1204
+ }
1205
+ export function filter(collection, predicate) {
1206
+ const pred = baseIteratee(predicate);
1207
+ const result = [];
1208
+ baseEach(collection, (value, key, coll) => {
1209
+ if (pred(value, key, coll)) {
1210
+ result.push(value);
1211
+ }
1212
+ });
1213
+ return result;
1214
+ }
1215
+ export function find(collection, predicate, fromIndex) {
1216
+ const iterable = Object(collection);
1217
+ if (!isArrayLike(collection)) {
1218
+ const pred = baseIteratee(predicate);
1219
+ const objKeys = keys(collection);
1220
+ const index = findIndex(objKeys, (key) => pred(iterable[key], key, iterable), fromIndex);
1221
+ return index > -1 ? iterable[objKeys[index]] : undefined;
1222
+ }
1223
+ const index = findIndex(collection, predicate, fromIndex);
1224
+ return index > -1 ? iterable[index] : undefined;
1225
+ }
1226
+ export function findIndex(array, predicate, fromIndex) {
1227
+ const length = array == null ? 0 : array.length;
1228
+ if (!length) {
1229
+ return -1;
1230
+ }
1231
+ let index = fromIndex == null ? 0 : toInteger(fromIndex);
1232
+ if (index < 0) {
1233
+ index = Math.max(length + index, 0);
1234
+ }
1235
+ const pred = baseIteratee(predicate);
1236
+ for (; index < length; index++) {
1237
+ if (pred(array[index], index, array)) {
1238
+ return index;
1239
+ }
1240
+ }
1241
+ return -1;
1242
+ }
1243
+ export function map(collection, iteratee) {
1244
+ const fn = baseIteratee(iteratee);
1245
+ const result = isArrayLike(collection) ? new Array(collection.length) : [];
1246
+ let index = -1;
1247
+ baseEach(collection, (value, key, coll) => {
1248
+ result[++index] = fn(value, key, coll);
1249
+ });
1250
+ return result;
1251
+ }
1252
+ export function remove(array, predicate) {
1253
+ const result = [];
1254
+ if (!(array && array.length)) {
1255
+ return result;
1256
+ }
1257
+ const pred = baseIteratee(predicate);
1258
+ const indexes = [];
1259
+ const length = array.length;
1260
+ for (let i = 0; i < length; i++) {
1261
+ const value = array[i];
1262
+ if (pred(value, i, array)) {
1263
+ result.push(value);
1264
+ indexes.push(i);
1265
+ }
1266
+ }
1267
+ for (let i = indexes.length - 1; i >= 0; i--) {
1268
+ Array.prototype.splice.call(array, indexes[i], 1);
1269
+ }
1270
+ return result;
1271
+ }
1272
+ export function uniq(array) {
1273
+ return (array && array.length) ? baseUniq(array) : [];
1274
+ }
1275
+ export function uniqBy(array, iteratee) {
1276
+ if (!(array && array.length)) {
1277
+ return [];
1278
+ }
1279
+ const fn = baseIteratee(iteratee);
1280
+ return baseUniq(array, value => fn(value));
1281
+ }
1282
+ export function intersection(...arrays) {
1283
+ const mapped = arrays.map(value => isArrayLikeObject(value) ? value : []);
1284
+ if (!(mapped.length && mapped[0] === arrays[0])) {
1285
+ return [];
1286
+ }
1287
+ const [firstArr, ...rest] = mapped;
1288
+ const sets = rest.map(arr => new Set(Array.from(arr)));
1289
+ const seen = new Set();
1290
+ const result = [];
1291
+ for (let i = 0; i < firstArr.length; i++) {
1292
+ let value = firstArr[i];
1293
+ value = value !== 0 ? value : 0;
1294
+ if (!seen.has(value) && sets.every(s => s.has(value))) {
1295
+ seen.add(value);
1296
+ result.push(value);
1297
+ }
1298
+ }
1299
+ return result;
1300
+ }
1301
+ function compareAscending(value, other) {
1302
+ if (value !== other) {
1303
+ const valIsDefined = value !== undefined;
1304
+ const valIsNull = value === null;
1305
+ const valIsReflexive = value === value;
1306
+ const valIsSymbol = isSymbol(value);
1307
+ const othIsDefined = other !== undefined;
1308
+ const othIsNull = other === null;
1309
+ const othIsReflexive = other === other;
1310
+ const othIsSymbol = isSymbol(other);
1311
+ if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
1312
+ (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
1313
+ (valIsNull && othIsDefined && othIsReflexive) ||
1314
+ (!valIsDefined && othIsReflexive) ||
1315
+ !valIsReflexive) {
1316
+ return 1;
1317
+ }
1318
+ if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
1319
+ (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
1320
+ (othIsNull && valIsDefined && valIsReflexive) ||
1321
+ (!othIsDefined && valIsReflexive) ||
1322
+ !othIsReflexive) {
1323
+ return -1;
1324
+ }
1325
+ }
1326
+ return 0;
1327
+ }
1328
+ export function orderBy(collection, iteratees, orders) {
1329
+ if (collection == null) {
1330
+ return [];
1331
+ }
1332
+ let itList = isArray(iteratees) ? iteratees : iteratees == null ? [] : [iteratees];
1333
+ const ordList = isArray(orders) ? orders : orders == null ? [] : [orders];
1334
+ if (itList.length) {
1335
+ itList = Array.from(itList, it => isArray(it) ? (value) => baseGet(value, it.length === 1 ? it[0] : it) : it);
1336
+ }
1337
+ else {
1338
+ itList = [identity];
1339
+ }
1340
+ const fns = Array.from(itList, it => {
1341
+ const fn = baseIteratee(it);
1342
+ return (value) => fn(value);
1343
+ });
1344
+ let index = -1;
1345
+ const entries = [];
1346
+ baseEach(collection, value => {
1347
+ entries.push({ criteria: fns.map(fn => fn(value)), index: ++index, value });
1348
+ });
1349
+ entries.sort((object, other) => {
1350
+ for (let i = 0; i < object.criteria.length; i++) {
1351
+ const result = compareAscending(object.criteria[i], other.criteria[i]);
1352
+ if (result) {
1353
+ if (i >= ordList.length) {
1354
+ return result;
1355
+ }
1356
+ return result * (ordList[i] === 'desc' ? -1 : 1);
1357
+ }
1358
+ }
1359
+ return object.index - other.index;
1360
+ });
1361
+ return entries.map(entry => entry.value);
1362
+ }
1363
+ /* ---------------------------------------------------------------------------
1364
+ * objects
1365
+ * ------------------------------------------------------------------------- */
1366
+ export function keys(object) {
1367
+ return isArrayLike(object) ? arrayLikeKeys(object, false) : baseKeys(object);
1368
+ }
1369
+ export function values(object) {
1370
+ if (object == null) {
1371
+ return [];
1372
+ }
1373
+ const iterable = Object(object);
1374
+ return keys(object).map(key => iterable[key]);
1375
+ }
1376
+ export function assign(target, ...sources) {
1377
+ return baseAssign(target, ...sources);
1378
+ }
1379
+ export function clone(value) {
1380
+ return baseClone(value, CLONE_SYMBOLS_FLAG);
1381
+ }
1382
+ export function cloneDeep(value) {
1383
+ return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
1384
+ }
1385
+ export function defaults(object, ...sources) {
1386
+ object = Object(object);
1387
+ let length = sources.length;
1388
+ const guard = length > 2 ? sources[2] : undefined;
1389
+ if (guard && isIterateeCall(sources[0], sources[1], guard)) {
1390
+ length = 1;
1391
+ }
1392
+ for (let i = 0; i < length; i++) {
1393
+ const source = sources[i];
1394
+ for (const key of keysIn(source)) {
1395
+ const value = object[key];
1396
+ if (value === undefined || (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
1397
+ object[key] = source[key];
1398
+ }
1399
+ }
1400
+ }
1401
+ return object;
1402
+ }
1403
+ export function defaultsDeep(object, ...sources) {
1404
+ return baseMergeAssigner(object, ...sources, undefined, customDefaultsMerge);
1405
+ }
1406
+ export function merge(target, ...sources) {
1407
+ return baseMergeAssigner(target, ...sources);
1408
+ }
1409
+ export function mergeWith(target, ...args) {
1410
+ return baseMergeAssigner(target, ...args);
1411
+ }
1412
+ export function get(object, path, defaultValue) {
1413
+ const result = object == null ? undefined : baseGet(object, path);
1414
+ return result === undefined ? defaultValue : result;
1415
+ }
1416
+ export function set(object, path, value) {
1417
+ if (!isObject(object)) {
1418
+ return object;
1419
+ }
1420
+ const keysArr = castPath(path, object);
1421
+ const length = keysArr.length;
1422
+ const lastIndex = length - 1;
1423
+ let nested = object;
1424
+ for (let index = 0; nested != null && index < length; index++) {
1425
+ const key = toKey(keysArr[index]);
1426
+ let newValue = value;
1427
+ if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
1428
+ return object;
1429
+ }
1430
+ if (index !== lastIndex) {
1431
+ const objValue = nested[key];
1432
+ newValue = isObject(objValue) ? objValue : (isIndex(keysArr[index + 1]) ? [] : {});
1433
+ }
1434
+ assignValue(nested, key, newValue);
1435
+ nested = nested[key];
1436
+ }
1437
+ return object;
1438
+ }
1439
+ export function has(object, path) {
1440
+ return object != null && hasPath(object, path, baseHas);
1441
+ }
1442
+ export function unset(object, path) {
1443
+ if (object == null) {
1444
+ return true;
1445
+ }
1446
+ const keysArr = castPath(path, object);
1447
+ const parent = keysArr.length < 2 ? object : baseGet(object, keysArr.slice(0, -1));
1448
+ if (parent == null) {
1449
+ return true;
1450
+ }
1451
+ return Reflect.deleteProperty(Object(parent), toKey(keysArr[keysArr.length - 1]));
1452
+ }
1453
+ /* ---------------------------------------------------------------------------
1454
+ * string casing
1455
+ * ------------------------------------------------------------------------- */
1456
+ export const camelCase = createCompounder((result, word, index) => {
1457
+ word = word.toLowerCase();
1458
+ return result + (index ? capitalize(word) : word);
1459
+ });
1460
+ export const kebabCase = createCompounder((result, word, index) => result + (index ? '-' : '') + word.toLowerCase());
1461
+ export const snakeCase = createCompounder((result, word, index) => result + (index ? '_' : '') + word.toLowerCase());
1462
+ export function capitalize(string) {
1463
+ return upperFirst(toStr(string).toLowerCase());
1464
+ }
1465
+ //# sourceMappingURL=generics.js.map