es-toolkit 1.13.1-dev.363 → 1.13.1-dev.365

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.
@@ -2,520 +2,62 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
- const randomInt = require('../_chunk/randomInt-CF7bZK.js');
5
+ const size = require('../_chunk/size-CJyNw8.js');
6
6
  const isNil = require('../_chunk/isNil-IuJ4cv.js');
7
7
 
8
- function chunk(arr, size) {
9
- if (!Number.isInteger(size) || size <= 0) {
10
- throw new Error('Size must be an integer greater than zero.');
11
- }
12
- const chunkLength = Math.ceil(arr.length / size);
13
- const result = Array(chunkLength);
14
- for (let index = 0; index < chunkLength; index++) {
15
- const start = index * size;
16
- const end = start + size;
17
- result[index] = arr.slice(start, end);
18
- }
19
- return result;
20
- }
21
-
22
- function compact(arr) {
23
- const result = [];
24
- for (const item of arr) {
25
- if (item) {
26
- result.push(item);
27
- }
28
- }
29
- return result;
30
- }
31
-
32
- function countBy(arr, mapper) {
33
- const result = {};
34
- for (const item of arr) {
35
- const key = mapper(item);
36
- result[key] = (result[key] ?? 0) + 1;
37
- }
38
- return result;
39
- }
40
-
41
- function difference(firstArr, secondArr) {
42
- const secondSet = new Set(secondArr);
43
- return firstArr.filter(item => !secondSet.has(item));
44
- }
45
-
46
- function differenceBy(firstArr, secondArr, mapper) {
47
- const mappedSecondSet = new Set(secondArr.map(item => mapper(item)));
48
- return firstArr.filter(item => {
49
- return !mappedSecondSet.has(mapper(item));
50
- });
51
- }
52
-
53
- function differenceWith(firstArr, secondArr, areItemsEqual) {
54
- return firstArr.filter(firstItem => {
55
- return secondArr.every(secondItem => {
56
- return !areItemsEqual(firstItem, secondItem);
57
- });
58
- });
59
- }
60
-
61
- function drop(arr, itemsCount) {
62
- itemsCount = Math.max(itemsCount, 0);
63
- return arr.slice(itemsCount);
64
- }
65
-
66
- function dropRight(arr, itemsCount) {
67
- itemsCount = Math.min(-itemsCount, 0);
68
- if (itemsCount === 0) {
69
- return arr.slice();
70
- }
71
- return arr.slice(0, itemsCount);
72
- }
73
-
74
- function dropRightWhile(arr, canContinueDropping) {
75
- for (let i = arr.length - 1; i >= 0; i--) {
76
- if (!canContinueDropping(arr[i])) {
77
- return arr.slice(0, i + 1);
78
- }
79
- }
80
- return [];
81
- }
82
-
83
- function dropWhile(arr, canContinueDropping) {
84
- const dropEndIndex = arr.findIndex(item => !canContinueDropping(item));
85
- if (dropEndIndex === -1) {
86
- return [];
87
- }
88
- return arr.slice(dropEndIndex);
89
- }
90
-
91
- function fill(array, value, start = 0, end = array.length) {
92
- const length = array.length;
93
- const finalStart = Math.max(start >= 0 ? start : length + start, 0);
94
- const finalEnd = Math.min(end >= 0 ? end : length + end, length);
95
- for (let i = finalStart; i < finalEnd; i++) {
96
- array[i] = value;
97
- }
98
- return array;
99
- }
100
-
101
- function flatten(arr, depth = 1) {
102
- const result = [];
103
- const flooredDepth = Math.floor(depth);
104
- const recursive = (arr, currentDepth) => {
105
- for (const item of arr) {
106
- if (Array.isArray(item) && currentDepth < flooredDepth) {
107
- recursive(item, currentDepth + 1);
108
- }
109
- else {
110
- result.push(item);
111
- }
112
- }
113
- };
114
- recursive(arr, 0);
115
- return result;
116
- }
117
-
118
- function flatMap(arr, iteratee, depth = 1) {
119
- return flatten(arr.map(item => iteratee(item)), depth);
120
- }
121
-
122
8
  function flattenDeep(arr) {
123
- return flatten(arr, Infinity);
124
- }
125
-
126
- function forEachRight(arr, callback) {
127
- for (let i = arr.length - 1; i >= 0; i--) {
128
- const element = arr[i];
129
- callback(element, i, arr);
130
- }
131
- }
132
-
133
- function groupBy(arr, getKeyFromItem) {
134
- const result = {};
135
- for (const item of arr) {
136
- const key = getKeyFromItem(item);
137
- if (result[key] == null) {
138
- result[key] = [];
139
- }
140
- result[key].push(item);
141
- }
142
- return result;
143
- }
144
-
145
- function intersection(firstArr, secondArr) {
146
- const secondSet = new Set(secondArr);
147
- return firstArr.filter(item => {
148
- return secondSet.has(item);
149
- });
150
- }
151
-
152
- function intersectionBy(firstArr, secondArr, mapper) {
153
- const mappedSecondSet = new Set(secondArr.map(mapper));
154
- return firstArr.filter(item => mappedSecondSet.has(mapper(item)));
155
- }
156
-
157
- function intersectionWith(firstArr, secondArr, areItemsEqual) {
158
- return firstArr.filter(firstItem => {
159
- return secondArr.some(secondItem => {
160
- return areItemsEqual(firstItem, secondItem);
161
- });
162
- });
163
- }
164
-
165
- function keyBy(arr, getKeyFromItem) {
166
- const result = {};
167
- for (const item of arr) {
168
- const key = getKeyFromItem(item);
169
- result[key] = item;
170
- }
171
- return result;
172
- }
173
-
174
- function maxBy(items, getValue) {
175
- let maxElement = items[0];
176
- let max = -Infinity;
177
- for (const element of items) {
178
- const value = getValue(element);
179
- if (value > max) {
180
- max = value;
181
- maxElement = element;
182
- }
183
- }
184
- return maxElement;
185
- }
186
-
187
- function minBy(items, getValue) {
188
- let minElement = items[0];
189
- let min = Infinity;
190
- for (const element of items) {
191
- const value = getValue(element);
192
- if (value < min) {
193
- min = value;
194
- minElement = element;
195
- }
196
- }
197
- return minElement;
198
- }
199
-
200
- function orderBy(collection, keys, orders) {
201
- const compareValues = (a, b, order) => {
202
- if (a < b) {
203
- return order === 'asc' ? -1 : 1;
204
- }
205
- if (a > b) {
206
- return order === 'asc' ? 1 : -1;
207
- }
208
- return 0;
209
- };
210
- const effectiveOrders = keys.map((_, index) => orders[index] || orders[orders.length - 1]);
211
- return collection.slice().sort((a, b) => {
212
- for (let i = 0; i < keys.length; i++) {
213
- const key = keys[i];
214
- const order = effectiveOrders[i];
215
- const result = compareValues(a[key], b[key], order);
216
- if (result !== 0) {
217
- return result;
218
- }
219
- }
220
- return 0;
221
- });
222
- }
223
-
224
- function partition(arr, isInTruthy) {
225
- const truthy = [];
226
- const falsy = [];
227
- for (const item of arr) {
228
- if (isInTruthy(item)) {
229
- truthy.push(item);
230
- }
231
- else {
232
- falsy.push(item);
233
- }
234
- }
235
- return [truthy, falsy];
236
- }
237
-
238
- function sample(arr) {
239
- const randomIndex = Math.floor(Math.random() * arr.length);
240
- return arr[randomIndex];
241
- }
242
-
243
- function sampleSize(array, size) {
244
- if (size > array.length) {
245
- throw new Error('Size must be less than or equal to the length of array.');
246
- }
247
- const result = new Array(size);
248
- const selected = new Set();
249
- for (let step = array.length - size, resultIndex = 0; step < array.length; step++, resultIndex++) {
250
- let index = randomInt.randomInt(0, step + 1);
251
- if (selected.has(index)) {
252
- index = step;
253
- }
254
- selected.add(index);
255
- result[resultIndex] = array[index];
256
- }
257
- return result;
258
- }
259
-
260
- function shuffle(arr) {
261
- const result = arr.slice();
262
- for (let i = result.length - 1; i >= 1; i--) {
263
- const j = Math.floor(Math.random() * (i + 1));
264
- [result[i], result[j]] = [result[j], result[i]];
265
- }
266
- return result;
267
- }
268
-
269
- function take(arr, count) {
270
- return arr.slice(0, count);
271
- }
272
-
273
- function takeRight(arr, count = 1) {
274
- if (count <= 0) {
275
- return [];
276
- }
277
- return arr.slice(-count);
278
- }
279
-
280
- function takeRightWhile(arr, shouldContinueTaking) {
281
- for (let i = arr.length - 1; i >= 0; i--) {
282
- if (!shouldContinueTaking(arr[i])) {
283
- return arr.slice(i + 1);
284
- }
285
- }
286
- return arr.slice();
287
- }
288
-
289
- function takeWhile(arr, shouldContinueTaking) {
290
- const result = [];
291
- for (const item of arr) {
292
- if (!shouldContinueTaking(item)) {
293
- break;
294
- }
295
- result.push(item);
296
- }
297
- return result;
298
- }
299
-
300
- function unionBy(arr1, arr2, mapper) {
301
- const map = new Map();
302
- for (const item of [...arr1, ...arr2]) {
303
- const key = mapper(item);
304
- if (!map.has(key)) {
305
- map.set(key, item);
306
- }
307
- }
308
- return Array.from(map.values());
309
- }
310
-
311
- function uniqWith(arr, areItemsEqual) {
312
- const result = [];
313
- for (const item of arr) {
314
- const isUniq = result.every(v => !areItemsEqual(v, item));
315
- if (isUniq) {
316
- result.push(item);
317
- }
318
- }
319
- return result;
320
- }
321
-
322
- function unionWith(arr1, arr2, areItemsEqual) {
323
- return uniqWith(arr1.concat(arr2), areItemsEqual);
324
- }
325
-
326
- function uniqBy(arr, mapper) {
327
- const map = new Map();
328
- for (const item of arr) {
329
- const key = mapper(item);
330
- if (!map.has(key)) {
331
- map.set(key, item);
332
- }
333
- }
334
- return Array.from(map.values());
335
- }
336
-
337
- function unzip(zipped) {
338
- let maxLen = 0;
339
- for (let i = 0; i < zipped.length; i++) {
340
- if (zipped[i].length > maxLen) {
341
- maxLen = zipped[i].length;
342
- }
343
- }
344
- const result = new Array(maxLen);
345
- for (let i = 0; i < maxLen; i++) {
346
- result[i] = new Array(zipped.length);
347
- for (let j = 0; j < zipped.length; j++) {
348
- result[i][j] = zipped[j][i];
349
- }
350
- }
351
- return result;
352
- }
353
-
354
- function unzipWith(target, iteratee) {
355
- const maxLength = Math.max(...target.map(innerArray => innerArray.length));
356
- const result = new Array(maxLength);
357
- for (let i = 0; i < maxLength; i++) {
358
- const group = new Array(target.length);
359
- for (let j = 0; j < target.length; j++) {
360
- group[j] = target[j][i];
361
- }
362
- result[i] = iteratee(...group);
363
- }
364
- return result;
365
- }
366
-
367
- function xor(arr1, arr2) {
368
- return difference(isNil.union(arr1, arr2), intersection(arr1, arr2));
369
- }
370
-
371
- function xorBy(arr1, arr2, mapper) {
372
- const union = unionBy(arr1, arr2, mapper);
373
- const intersection = intersectionBy(arr1, arr2, mapper);
374
- return differenceBy(union, intersection, mapper);
375
- }
376
-
377
- function xorWith(arr1, arr2, areElementsEqual) {
378
- const union = unionWith(arr1, arr2, areElementsEqual);
379
- const intersection = intersectionWith(arr1, arr2, areElementsEqual);
380
- return differenceWith(union, intersection, areElementsEqual);
381
- }
382
-
383
- function zip(...arrs) {
384
- const result = [];
385
- const maxIndex = Math.max(...arrs.map(x => x.length));
386
- for (let i = 0; i < maxIndex; i++) {
387
- const element = [];
388
- for (const arr of arrs) {
389
- element.push(arr[i]);
390
- }
391
- result.push(element);
392
- }
393
- return result;
394
- }
395
-
396
- function zipObject(keys, values) {
397
- const result = {};
398
- for (let i = 0; i < keys.length; i++) {
399
- result[keys[i]] = values[i];
400
- }
401
- return result;
402
- }
403
-
404
- function zipWith(arr1, ...rest) {
405
- const arrs = [arr1, ...rest.slice(0, -1)];
406
- const combine = rest[rest.length - 1];
407
- const result = [];
408
- const maxIndex = Math.max(...arrs.map(arr => arr.length));
409
- for (let i = 0; i < maxIndex; i++) {
410
- const elements = arrs.map(arr => arr[i]);
411
- result.push(combine(...elements));
412
- }
413
- return result;
414
- }
415
-
416
- function without(array, ...values) {
417
- const valuesSet = new Set(values);
418
- return array.filter(item => !valuesSet.has(item));
419
- }
420
-
421
- function head(arr) {
422
- return arr[0];
423
- }
424
-
425
- function tail(arr) {
426
- const len = arr.length;
427
- if (len <= 1) {
428
- return [];
429
- }
430
- const result = new Array(len - 1);
431
- for (let i = 1; i < len; i++) {
432
- result[i - 1] = arr[i];
433
- }
434
- return result;
435
- }
436
-
437
- function toFilled(arr, value, start = 0, end = arr.length) {
438
- const length = arr.length;
439
- const finalStart = Math.max(start >= 0 ? start : length + start, 0);
440
- const finalEnd = Math.min(end >= 0 ? end : length + end, length);
441
- const newArr = arr.slice();
442
- for (let i = finalStart; i < finalEnd; i++) {
443
- newArr[i] = value;
444
- }
445
- return newArr;
446
- }
447
-
448
- function last(arr) {
449
- return arr[arr.length - 1];
450
- }
451
-
452
- function initial(arr) {
453
- if (arr.length <= 1) {
454
- return [];
455
- }
456
- return arr.slice(0, -1);
457
- }
458
-
459
- function size(target) {
460
- if (isNil.isNil(target)) {
461
- return 0;
462
- }
463
- const tag = Object.prototype.toString.call(target);
464
- if (tag === '[object Map]' || tag === '[object Set]') {
465
- return target.size;
466
- }
467
- return Object.keys(target).length;
468
- }
469
-
9
+ return size.flatten(arr, Infinity);
10
+ }
11
+
12
+ exports.chunk = size.chunk;
13
+ exports.compact = size.compact;
14
+ exports.countBy = size.countBy;
15
+ exports.difference = size.difference;
16
+ exports.differenceBy = size.differenceBy;
17
+ exports.differenceWith = size.differenceWith;
18
+ exports.drop = size.drop;
19
+ exports.dropRight = size.dropRight;
20
+ exports.dropRightWhile = size.dropRightWhile;
21
+ exports.dropWhile = size.dropWhile;
22
+ exports.fill = size.fill;
23
+ exports.flatMap = size.flatMap;
24
+ exports.flatten = size.flatten;
25
+ exports.forEachRight = size.forEachRight;
26
+ exports.groupBy = size.groupBy;
27
+ exports.head = size.head;
28
+ exports.initial = size.initial;
29
+ exports.intersection = size.intersection;
30
+ exports.intersectionBy = size.intersectionBy;
31
+ exports.intersectionWith = size.intersectionWith;
32
+ exports.keyBy = size.keyBy;
33
+ exports.last = size.last;
34
+ exports.maxBy = size.maxBy;
35
+ exports.minBy = size.minBy;
36
+ exports.orderBy = size.orderBy;
37
+ exports.partition = size.partition;
38
+ exports.sample = size.sample;
39
+ exports.sampleSize = size.sampleSize;
40
+ exports.shuffle = size.shuffle;
41
+ exports.size = size.size;
42
+ exports.tail = size.tail;
43
+ exports.take = size.take;
44
+ exports.takeRight = size.takeRight;
45
+ exports.takeRightWhile = size.takeRightWhile;
46
+ exports.takeWhile = size.takeWhile;
47
+ exports.toFilled = size.toFilled;
48
+ exports.unionBy = size.unionBy;
49
+ exports.unionWith = size.unionWith;
50
+ exports.uniqBy = size.uniqBy;
51
+ exports.uniqWith = size.uniqWith;
52
+ exports.unzip = size.unzip;
53
+ exports.unzipWith = size.unzipWith;
54
+ exports.without = size.without;
55
+ exports.xor = size.xor;
56
+ exports.xorBy = size.xorBy;
57
+ exports.xorWith = size.xorWith;
58
+ exports.zip = size.zip;
59
+ exports.zipObject = size.zipObject;
60
+ exports.zipWith = size.zipWith;
470
61
  exports.union = isNil.union;
471
62
  exports.uniq = isNil.uniq;
472
- exports.chunk = chunk;
473
- exports.compact = compact;
474
- exports.countBy = countBy;
475
- exports.difference = difference;
476
- exports.differenceBy = differenceBy;
477
- exports.differenceWith = differenceWith;
478
- exports.drop = drop;
479
- exports.dropRight = dropRight;
480
- exports.dropRightWhile = dropRightWhile;
481
- exports.dropWhile = dropWhile;
482
- exports.fill = fill;
483
- exports.flatMap = flatMap;
484
- exports.flatten = flatten;
485
63
  exports.flattenDeep = flattenDeep;
486
- exports.forEachRight = forEachRight;
487
- exports.groupBy = groupBy;
488
- exports.head = head;
489
- exports.initial = initial;
490
- exports.intersection = intersection;
491
- exports.intersectionBy = intersectionBy;
492
- exports.intersectionWith = intersectionWith;
493
- exports.keyBy = keyBy;
494
- exports.last = last;
495
- exports.maxBy = maxBy;
496
- exports.minBy = minBy;
497
- exports.orderBy = orderBy;
498
- exports.partition = partition;
499
- exports.sample = sample;
500
- exports.sampleSize = sampleSize;
501
- exports.shuffle = shuffle;
502
- exports.size = size;
503
- exports.tail = tail;
504
- exports.take = take;
505
- exports.takeRight = takeRight;
506
- exports.takeRightWhile = takeRightWhile;
507
- exports.takeWhile = takeWhile;
508
- exports.toFilled = toFilled;
509
- exports.unionBy = unionBy;
510
- exports.unionWith = unionWith;
511
- exports.uniqBy = uniqBy;
512
- exports.uniqWith = uniqWith;
513
- exports.unzip = unzip;
514
- exports.unzipWith = unzipWith;
515
- exports.without = without;
516
- exports.xor = xor;
517
- exports.xorBy = xorBy;
518
- exports.xorWith = xorWith;
519
- exports.zip = zip;
520
- exports.zipObject = zipObject;
521
- exports.zipWith = zipWith;
@@ -1,2 +1,2 @@
1
- var _=function(t){"use strict";function difference$1(t,e){const n=new Set(e);return t.filter((t=>!n.has(t)))}function differenceBy(t,e,n){const r=new Set(e.map((t=>n(t))));return t.filter((t=>!r.has(n(t))))}function differenceWith(t,e,n){return t.filter((t=>e.every((e=>!n(t,e)))))}function flatten$1(t,e=1){const n=[],r=Math.floor(e),recursive=(t,e)=>{for(const o of t)Array.isArray(o)&&e<r?recursive(o,e+1):n.push(o)};recursive(t,0);return n}function intersection(t,e){const n=new Set(e);return t.filter((t=>n.has(t)))}function intersectionBy(t,e,n){const r=new Set(e.map(n));return t.filter((t=>r.has(n(t))))}function intersectionWith(t,e,n){return t.filter((t=>e.some((e=>n(t,e)))))}function random(t,e){if(null==e){e=t;t=0}if(t>=e)throw new Error("Invalid input: The maximum value must be greater than the minimum value.");return Math.random()*(e-t)+t}function randomInt(t,e){return Math.floor(random(t,e))}function uniq(t){return Array.from(new Set(t))}function union(t,e){return uniq(t.concat(e))}function unionBy(t,e,n){const r=new Map;for(const o of[...t,...e]){const t=n(o);r.has(t)||r.set(t,o)}return Array.from(r.values())}function uniqWith(t,e){const n=[];for(const r of t){n.every((t=>!e(t,r)))&&n.push(r)}return n}function unionWith(t,e,n){return uniqWith(t.concat(e),n)}function zip(...t){const e=[],n=Math.max(...t.map((t=>t.length)));for(let r=0;r<n;r++){const n=[];for(const e of t)n.push(e[r]);e.push(n)}return e}function head(t){return t[0]}function isNil(t){return null==t}function isLength(t){return Number.isSafeInteger(t)&&t>=0}function isPlainObject$1(t){if("object"!=typeof t)return!1;if(null==t)return!1;if(null===Object.getPrototypeOf(t))return!0;if("[object Object]"!==t.toString())return!1;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}function isTypedArray$1(t){return t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Uint16Array||t instanceof Uint32Array||t instanceof BigUint64Array||t instanceof Int8Array||t instanceof Int16Array||t instanceof Int32Array||t instanceof BigInt64Array||t instanceof Float32Array||t instanceof Float64Array}function isPrimitive$1(t){return null==t||"object"!=typeof t&&"function"!=typeof t}class AbortError extends Error{constructor(t="The operation was aborted"){super(t);this.name="AbortError"}}class TimeoutError extends Error{constructor(t="The operation was timed out"){super(t);this.name="TimeoutError"}}function sum(t){let e=0;for(let n=0;n<t.length;n++)e+=t[n];return e}function mean(t){return sum(t)/t.length}function flattenObjectImpl(t,e=""){const n={},r=Object.keys(t);for(let o=0;o<r.length;o++){const i=r[o],c=t[i],u=e?`${e}.${i}`:i;if(isPlainObject$1(c)&&Object.keys(c).length>0)Object.assign(n,flattenObjectImpl(c,u));else if(Array.isArray(c))for(let t=0;t<c.length;t++)n[`${u}.${t}`]=c[t];else n[u]=c}return n}function mapKeys$1(t,e){const n={},r=Object.keys(t);for(let o=0;o<r.length;o++){const i=r[o],c=t[i];n[e(c,i,t)]=c}return n}function cloneDeep(t){return cloneDeepImpl(t)}function cloneDeepImpl(t,e=new Map){if(isPrimitive$1(t))return t;if(e.has(t))return e.get(t);if(Array.isArray(t)){const n=new Array(t.length);e.set(t,n);for(let r=0;r<t.length;r++)n[r]=cloneDeepImpl(t[r],e);t.hasOwnProperty("index")&&(n.index=t.index);t.hasOwnProperty("input")&&(n.input=t.input);return n}if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp){const e=new RegExp(t.source,t.flags);e.lastIndex=t.lastIndex;return e}if(t instanceof Map){const n=new Map;e.set(t,n);for(const[r,o]of t.entries())n.set(r,cloneDeepImpl(o,e));return n}if(t instanceof Set){const n=new Set;e.set(t,n);for(const r of t.values())n.add(cloneDeepImpl(r,e));return n}if("undefined"!=typeof Buffer&&Buffer.isBuffer(t))return t.subarray();if(isTypedArray$1(t)){const n=new(Object.getPrototypeOf(t).constructor)(t.length);e.set(t,n);for(let r=0;r<t.length;r++)n[r]=cloneDeepImpl(t[r],e);return n}if(t instanceof ArrayBuffer||"undefined"!=typeof SharedArrayBuffer&&t instanceof SharedArrayBuffer)return t.slice(0);if(t instanceof DataView){const n=new DataView(t.buffer.slice(0));e.set(t,n);copyProperties(n,t,e);return n}if("undefined"!=typeof File&&t instanceof File){const n=new File([t],t.name,{type:t.type});e.set(t,n);copyProperties(n,t,e);return n}if(t instanceof Blob){const n=new Blob([t],{type:t.type});e.set(t,n);copyProperties(n,t,e);return n}if(t instanceof Error){const n=new t.constructor;e.set(t,n);n.message=t.message;n.name=t.name;n.stack=t.stack;n.cause=t.cause;copyProperties(n,t,e);return n}if("object"==typeof t&&null!==t){const n={};e.set(t,n);copyProperties(n,t,e);return n}return t}function copyProperties(t,e,n){const r=Object.keys(e);for(let o=0;o<r.length;o++){const i=r[o],c=Object.getOwnPropertyDescriptor(e,i);(c?.writable||c?.set)&&(t[i]=cloneDeepImpl(e[i],n))}}function delay(t,{signal:e}={}){return new Promise(((n,r)=>{const abortError=()=>{r(new AbortError)};if(e?.aborted)return abortError();const o=setTimeout(n,t);e?.addEventListener("abort",(()=>{clearTimeout(o);abortError()}),{once:!0})}))}async function timeout(t){await delay(t);throw new TimeoutError}const capitalize=t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase(),e=/[A-Z]?[a-z]+|[0-9]+|[A-Z]+(?![a-z])/g;function getWords(t){return Array.from(t.match(e)??[])}const n=/^(?:0|[1-9]\d*)$/;function isIndex(t){switch(typeof t){case"number":return Number.isInteger(t)&&t>=0&&t<Number.MAX_SAFE_INTEGER;case"symbol":return!1;case"string":return n.test(t)}}function toPath(t){const e=/\\(\\)?/g,n=RegExp("[^.[\\]]+|\\[(?:([^\"'][^[]*)|([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))","g"),r=[];"."===t[0]&&r.push("");let o,i=0;for(;null!==(o=n.exec(t));){let t=o[0];const c=o[1],u=o[2],s=o[3];u?t=s.replace(e,"$1"):c&&(t=c);r.push(t);n.lastIndex===i?n.lastIndex++:i=n.lastIndex}return r}function set(t,e,n){const r=Array.isArray(e)?e:"string"==typeof e?toPath(e):[e];let o=t;for(let t=0;t<r.length-1;t++){const e=r[t],n=r[t+1];null==o[e]&&(o[e]=isIndex(n)?[]:{});o=o[e]}o[r[r.length-1]]=n;return t}const r=/^\w*$/,o=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/;function get(t,e,n){let i;i=Array.isArray(e)?e:"string"==typeof e&&function isDeepKey(t){switch(typeof t){case"number":case"symbol":return!1;case"string":return!r.test(t)&&o.test(t)}}(e)&&null==t?.[e]?toPath(e):[e];if(0===i.length)return n;let c,u=t;for(c=0;c<i.length&&null!=u;c++){let t=i[c];Object.is(t.valueOf(),-0)&&(t="-0");u=u[t]}return null===u&&c===i.length?u:u??n}function property(t){return function(e){return get(e,t)}}function identity(t){return t}function isArrayMatch(t,e){if(0===e.length)return!0;if(!Array.isArray(t))return!1;const n=new Set;for(let r=0;r<e.length;r++){const o=e[r],i=t.findIndex(((t,e)=>isMatch(t,o)&&!n.has(e)));if(-1===i)return!1;n.add(i)}return!0}function isMatch(t,e){if(e===t)return!0;switch(typeof e){case"object":{if(null==e)return!0;e=e??{};const n=Object.keys(e);if(null==t)return 0===n.length;if(Array.isArray(e))return isArrayMatch(t,e);if(e instanceof Map)return function isMapMatch(t,e){if(0===e.size)return!0;if(!(t instanceof Map))return!1;for(const[n,r]of e.entries())if(!isMatch(t.get(n),r))return!1;return!0}(t,e);if(e instanceof Set)return function isSetMatch(t,e){return 0===e.size||t instanceof Set&&isArrayMatch([...t],[...e])}(t,e);for(let r=0;r<n.length;r++){const o=n[r];if(!isPrimitive$1(t)&&!(o in t))return!1;if(void 0===e[o]&&void 0!==t[o])return!1;if(!isMatch(t[o],e[o]))return!1}return!0}case"function":return Object.keys(e).length>0&&isMatch(t,{...e});default:return!e}}t.AbortError=AbortError;t.TimeoutError=TimeoutError;t.after=(t,e)=>{if(!Number.isInteger(t)||t<0)throw new Error("n must be a non-negative integer.");let n=0;return(...r)=>{if(++n>=t)return e(...r)}};t.before=(t,e)=>{if(!Number.isInteger(t)||t<0)throw new Error("n must be a non-negative integer.");let n=0;return(...r)=>{if(++n<t)return e(...r)}};t.camelCase=function camelCase(t){const e=getWords(t);if(0===e.length)return"";const[n,...r]=e;return`${n.toLowerCase()}${r.map((t=>capitalize(t))).join("")}`};t.capitalize=capitalize;t.chunk=function chunk(t,e=1){return 0===(e=Math.max(Math.floor(e),0))?[]:function chunk$1(t,e){if(!Number.isInteger(e)||e<=0)throw new Error("Size must be an integer greater than zero.");const n=Math.ceil(t.length/e),r=Array(n);for(let o=0;o<n;o++){const n=o*e,i=n+e;r[o]=t.slice(n,i)}return r}(t,e)};t.clamp=function clamp(t,e,n){return null==n?Math.min(t,e):Math.min(Math.max(t,e),n)};t.clone=function clone(t){if(function isPrimitive(t){return null==t||"object"!=typeof t&&"function"!=typeof t}(t))return t;if(Array.isArray(t))return t.slice();if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp)return new RegExp(t.source,t.flags);if(t instanceof Map){const e=new Map;for(const[n,r]of t)e.set(n,r);return e}if(t instanceof Set){const e=new Set;for(const n of t)e.add(n);return e}if("object"==typeof t){const e=Object.getPrototypeOf(t),n=Object.create(e);return Object.assign(n,t)}return t};t.cloneDeep=cloneDeep;t.compact=function compact(t){const e=[];for(const n of t)n&&e.push(n);return e};t.concat=function concat(...t){return flatten$1(t)};t.countBy=function countBy(t,e){const n={};for(const r of t){const t=e(r);n[t]=(n[t]??0)+1}return n};t.debounce=function debounce(t,e,{signal:n}={}){let r=null;const debounced=function(...o){null!==r&&clearTimeout(r);n?.aborted||(r=setTimeout((()=>{t(...o);r=null}),e))};debounced.cancel=function(){if(null!==r){clearTimeout(r);r=null}};n?.addEventListener("abort",(function(){debounced.cancel()}),{once:!0});return debounced};t.delay=delay;t.difference=function difference(t,...e){return difference$1(t,flatten$1(e))};t.differenceBy=differenceBy;t.differenceWith=differenceWith;t.drop=function drop(t,e){e=Math.max(e,0);return t.slice(e)};t.dropRight=function dropRight(t,e){return 0===(e=Math.min(-e,0))?t.slice():t.slice(0,e)};t.dropRightWhile=function dropRightWhile(t,e){for(let n=t.length-1;n>=0;n--)if(!e(t[n]))return t.slice(0,n+1);return[]};t.dropWhile=function dropWhile(t,e){const n=t.findIndex((t=>!e(t)));return-1===n?[]:t.slice(n)};t.endsWith=(t,e,n=t.length)=>t.endsWith(e,n);t.fill=function fill(t,e,n=0,r=t.length){(n=Math.floor(n))||(n=0);(r=Math.floor(r))||(r=0);return function fill$1(t,e,n=0,r=t.length){const o=t.length,i=Math.max(n>=0?n:o+n,0),c=Math.min(r>=0?r:o+r,o);for(let n=i;n<c;n++)t[n]=e;return t}(t,e,n,r)};t.first=head;t.flatMap=function flatMap(t,e,n=1){return flatten$1(t.map((t=>e(t))),n)};t.flatten=function flatten(t,e=1){const n=[],r=Math.floor(e);if(!Array.isArray(t))return n;const recursive=(t,e)=>{for(const o of t)e<r&&(Array.isArray(o)||Boolean(o?.[Symbol.isConcatSpreadable])||null!==o&&"object"==typeof o&&"[object Arguments]"===Object.prototype.toString.call(o))?Array.isArray(o)?recursive(o,e+1):recursive(Array.from(o),e+1):n.push(o)};recursive(t,0);return n};t.flattenDeep=function flattenDeep(t){return flatten$1(t,1/0)};t.flattenObject=function flattenObject(t){return flattenObjectImpl(t)};t.forEachRight=function forEachRight(t,e){for(let n=t.length-1;n>=0;n--){e(t[n],n,t)}};t.get=get;t.groupBy=function groupBy(t,e){const n={};for(const r of t){const t=e(r);null==n[t]&&(n[t]=[]);n[t].push(r)}return n};t.head=head;t.inRange=function inRange(t,e,n){if(null==n){n=e;e=0}if(e>=n)throw new Error("The maximum value must be greater than the minimum value.");return e<=t&&t<n};t.initial=function initial(t){return t.length<=1?[]:t.slice(0,-1)};t.intersection=intersection;t.intersectionBy=intersectionBy;t.intersectionWith=intersectionWith;t.invert=function invert(t){const e={},n=Object.keys(t);for(let r=0;r<n.length;r++){const o=n[r];e[t[o]]=o}return e};t.isArguments=function isArguments(t){return null!==t&&"object"==typeof t&&"[object Arguments]"===function getTag(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}(t)};t.isArray=function isArray(t){return Array.isArray(t)};t.isArrayLike=function isArrayLike(t){return null!=t&&"function"!=typeof t&&isLength(t.length)};t.isEqual=function isEqual(t,e){if(Object.is(t,e))return!0;if(t instanceof Date&&e instanceof Date)return t.getTime()===e.getTime();if(t instanceof RegExp&&e instanceof RegExp)return t.source===e.source&&t.flags===e.flags;if("object"!=typeof t||"object"!=typeof e||null===t||null===e)return!1;const n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;if(union(n,r).length!==n.length)return!1;for(let r=0;r<n.length;r++){const o=n[r];if(!isEqual(t[o],e[o]))return!1}return!0};t.isFunction=function isFunction(t){return"function"==typeof t};t.isLength=isLength;t.isMatch=isMatch;t.isNil=isNil;t.isNotNil=function isNotNil(t){return null!=t};t.isNull=function isNull(t){return null===t};t.isObjectLike=function isObjectLike(t){return"object"==typeof t&&null!==t};t.isPlainObject=function isPlainObject(t){if("object"!=typeof t)return!1;if(null==t)return!1;if(null===Object.getPrototypeOf(t))return!0;if("[object Object]"!==t.toString()){const e=t[Symbol.toStringTag];if(null==e)return!1;return!!Object.getOwnPropertyDescriptor(t,Symbol.toStringTag)?.writable&&t.toString()===`[object ${e}]`}let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};t.isPrimitive=isPrimitive$1;t.isTypedArray=function isTypedArray(t){return isTypedArray$1(t)};t.isUndefined=function isUndefined(t){return void 0===t};t.kebabCase=t=>getWords(t).map((t=>t.toLowerCase())).join("-");t.keyBy=function keyBy(t,e){const n={};for(const r of t){n[e(r)]=r}return n};t.last=function last(t){return t[t.length-1]};t.lowerCase=t=>getWords(t).map((t=>t.toLowerCase())).join(" ");t.mapKeys=function mapKeys(t,e){switch(typeof(e=e??identity)){case"string":case"symbol":case"number":case"object":return mapKeys$1(t,property(e));case"function":return mapKeys$1(t,e)}};t.mapValues=function mapValues(t,e){const n={},r=Object.keys(t);for(let o=0;o<r.length;o++){const i=r[o],c=t[i];n[i]=e(c,i,t)}return n};t.matches=function matches(t){t=cloneDeep(t);return e=>isMatch(e,t)};t.max=function max(t=[]){let e,n=t[0];for(const r of t)if(null==e||r>e){e=r;n=r}return n};t.maxBy=function maxBy(t,e){let n=t[0],r=-1/0;for(const o of t){const t=e(o);if(t>r){r=t;n=o}}return n};t.mean=mean;t.meanBy=function meanBy(t,e){return mean(t.map((t=>e(t))))};t.min=function min(t=[]){let e,n=t[0];for(const r of t)if(null==e||r<e){e=r;n=r}return n};t.minBy=function minBy(t,e){let n=t[0],r=1/0;for(const o of t){const t=e(o);if(t<r){r=t;n=o}}return n};t.negate=function negate(t){return(...e)=>!t(...e)};t.noop=function noop(){};t.omit=function omit(t,e){const n={...t};for(const t of e)delete n[t];return n};t.omitBy=function omitBy(t,e){const n={};for(const[r,o]of Object.entries(t))e(o,r)||(n[r]=o);return n};t.once=function once(t){let e,n=!1;return function(){if(n)return e;const r=t();n=!0;e=r;return r}};t.orderBy=function orderBy(t,e,n){const compareValues=(t,e,n)=>t<e?"asc"===n?-1:1:t>e?"asc"===n?1:-1:0,r=e.map(((t,e)=>n[e]||n[n.length-1]));return t.slice().sort(((t,n)=>{for(let o=0;o<e.length;o++){const i=e[o],c=r[o],u=compareValues(t[i],n[i],c);if(0!==u)return u}return 0}))};t.padStart=(t,e=0,n=" ")=>Number.isSafeInteger(e)&&e>t.length&&n.length>0?t.padStart(e,n):t;t.partition=function partition(t,e){const n=[],r=[];for(const o of t)e(o)?n.push(o):r.push(o);return[n,r]};t.pick=function pick(t,e){const n={};for(const r of e)n[r]=t[r];return n};t.pickBy=function pickBy(t,e){const n={};for(const[r,o]of Object.entries(t))e(o,r)&&(n[r]=o);return n};t.property=property;t.random=random;t.randomInt=randomInt;t.range=function range(t,e,n){if(null==e){e=t;t=0}null==n&&(n=1);if(!Number.isInteger(n)||0===n)throw new Error("The step value must be a non-zero integer.");const r=Math.max(Math.ceil((e-t)/n),0),o=new Array(r);for(let e=0;e<r;e++)o[e]=t+e*n;return o};t.round=function round(t,e=0){if(!Number.isInteger(e))throw new Error("Precision must be an integer.");const n=Math.pow(10,e);return Math.round(t*n)/n};t.sample=function sample(t){return t[Math.floor(Math.random()*t.length)]};t.sampleSize=function sampleSize(t,e){if(e>t.length)throw new Error("Size must be less than or equal to the length of array.");const n=new Array(e),r=new Set;for(let o=t.length-e,i=0;o<t.length;o++,i++){let e=randomInt(0,o+1);r.has(e)&&(e=o);r.add(e);n[i]=t[e]}return n};t.set=set;t.shuffle=function shuffle(t){const e=t.slice();for(let t=e.length-1;t>=1;t--){const n=Math.floor(Math.random()*(t+1));[e[t],e[n]]=[e[n],e[t]]}return e};t.size=function size(t){if(isNil(t))return 0;const e=Object.prototype.toString.call(t);return"[object Map]"===e||"[object Set]"===e?t.size:Object.keys(t).length};t.snakeCase=t=>getWords(t).map((t=>t.toLowerCase())).join("_");t.startCase=function startCase(t){const e=getWords(t.trim());let n="";for(const t of e){n&&(n+=" ");t===t.toUpperCase()?n+=t:n+=t[0].toUpperCase()+t.slice(1).toLowerCase()}return n};t.startsWith=(t,e,n=0)=>t.startsWith(e,n);t.sum=sum;t.sumBy=function sumBy(t,e){return sum(t.map((t=>e(t))))};t.tail=function tail(t){const e=t.length;if(e<=1)return[];const n=new Array(e-1);for(let r=1;r<e;r++)n[r-1]=t[r];return n};t.take=function take(t,e){return t.slice(0,e)};t.takeRight=function takeRight(t,e=1){return e<=0?[]:t.slice(-e)};t.takeRightWhile=function takeRightWhile(t,e){for(let n=t.length-1;n>=0;n--)if(!e(t[n]))return t.slice(n+1);return t.slice()};t.takeWhile=function takeWhile(t,e){const n=[];for(const r of t){if(!e(r))break;n.push(r)}return n};t.throttle=function throttle(t,e){let n;return function(...r){const o=Date.now();if(null==n||o-n>=e){n=o;t(...r)}}};t.toFilled=function toFilled(t,e,n=0,r=t.length){const o=t.length,i=Math.max(n>=0?n:o+n,0),c=Math.min(r>=0?r:o+r,o),u=t.slice();for(let t=i;t<c;t++)u[t]=e;return u};t.union=union;t.unionBy=unionBy;t.unionWith=unionWith;t.uniq=uniq;t.uniqBy=function uniqBy(t,e){const n=new Map;for(const r of t){const t=e(r);n.has(t)||n.set(t,r)}return Array.from(n.values())};t.uniqWith=uniqWith;t.unzip=function unzip(t){let e=0;for(let n=0;n<t.length;n++)t[n].length>e&&(e=t[n].length);const n=new Array(e);for(let r=0;r<e;r++){n[r]=new Array(t.length);for(let e=0;e<t.length;e++)n[r][e]=t[e][r]}return n};t.unzipWith=function unzipWith(t,e){const n=Math.max(...t.map((t=>t.length))),r=new Array(n);for(let o=0;o<n;o++){const n=new Array(t.length);for(let e=0;e<t.length;e++)n[e]=t[e][o];r[o]=e(...n)}return r};t.withTimeout=async function withTimeout(t,e){return Promise.race([t(),timeout(e)])};t.without=function without(t,...e){const n=new Set(e);return t.filter((t=>!n.has(t)))};t.xor=function xor(t,e){return difference$1(union(t,e),intersection(t,e))};t.xorBy=function xorBy(t,e,n){return differenceBy(unionBy(t,e,n),intersectionBy(t,e,n),n)};t.xorWith=function xorWith(t,e,n){return differenceWith(unionWith(t,e,n),intersectionWith(t,e,n),n)};t.zip=zip;t.zipObject=function zipObject(t,e){const n={};for(let r=0;r<t.length;r++)n[t[r]]=e[r];return n};t.zipObjectDeep=function zipObjectDeep(t,e){const n={},r=zip(t,e);for(let t=0;t<r.length;t++){const[e,o]=r[t];null!=e&&set(n,e,o)}return n};t.zipWith=function zipWith(t,...e){const n=[t,...e.slice(0,-1)],r=e[e.length-1],o=[],i=Math.max(...n.map((t=>t.length)));for(let t=0;t<i;t++){const e=n.map((e=>e[t]));o.push(r(...e))}return o};Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});return t}({});
1
+ var _=function(t){"use strict";function difference$1(t,e){const n=new Set(e);return t.filter((t=>!n.has(t)))}function differenceBy(t,e,n){const r=new Set(e.map((t=>n(t))));return t.filter((t=>!r.has(n(t))))}function differenceWith(t,e,n){return t.filter((t=>e.every((e=>!n(t,e)))))}function flatten$1(t,e=1){const n=[],r=Math.floor(e),recursive=(t,e)=>{for(const o of t)Array.isArray(o)&&e<r?recursive(o,e+1):n.push(o)};recursive(t,0);return n}function intersection(t,e){const n=new Set(e);return t.filter((t=>n.has(t)))}function intersectionBy(t,e,n){const r=new Set(e.map(n));return t.filter((t=>r.has(n(t))))}function intersectionWith(t,e,n){return t.filter((t=>e.some((e=>n(t,e)))))}function random(t,e){if(null==e){e=t;t=0}if(t>=e)throw new Error("Invalid input: The maximum value must be greater than the minimum value.");return Math.random()*(e-t)+t}function randomInt(t,e){return Math.floor(random(t,e))}function uniq(t){return Array.from(new Set(t))}function union(t,e){return uniq(t.concat(e))}function unionBy(t,e,n){const r=new Map;for(const o of[...t,...e]){const t=n(o);r.has(t)||r.set(t,o)}return Array.from(r.values())}function uniqWith(t,e){const n=[];for(const r of t){n.every((t=>!e(t,r)))&&n.push(r)}return n}function unionWith(t,e,n){return uniqWith(t.concat(e),n)}function zip(...t){const e=[],n=Math.max(...t.map((t=>t.length)));for(let r=0;r<n;r++){const n=[];for(const e of t)n.push(e[r]);e.push(n)}return e}function head(t){return t[0]}function isNil(t){return null==t}function isLength(t){return Number.isSafeInteger(t)&&t>=0}function isPlainObject$1(t){if("object"!=typeof t)return!1;if(null==t)return!1;if(null===Object.getPrototypeOf(t))return!0;if("[object Object]"!==t.toString())return!1;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}function isTypedArray$1(t){return t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Uint16Array||t instanceof Uint32Array||t instanceof BigUint64Array||t instanceof Int8Array||t instanceof Int16Array||t instanceof Int32Array||t instanceof BigInt64Array||t instanceof Float32Array||t instanceof Float64Array}function isPrimitive$1(t){return null==t||"object"!=typeof t&&"function"!=typeof t}class AbortError extends Error{constructor(t="The operation was aborted"){super(t);this.name="AbortError"}}class TimeoutError extends Error{constructor(t="The operation was timed out"){super(t);this.name="TimeoutError"}}function sum(t){let e=0;for(let n=0;n<t.length;n++)e+=t[n];return e}function mean(t){return sum(t)/t.length}function flattenObjectImpl(t,e=""){const n={},r=Object.keys(t);for(let o=0;o<r.length;o++){const i=r[o],c=t[i],u=e?`${e}.${i}`:i;if(isPlainObject$1(c)&&Object.keys(c).length>0)Object.assign(n,flattenObjectImpl(c,u));else if(Array.isArray(c))for(let t=0;t<c.length;t++)n[`${u}.${t}`]=c[t];else n[u]=c}return n}function mapKeys$1(t,e){const n={},r=Object.keys(t);for(let o=0;o<r.length;o++){const i=r[o],c=t[i];n[e(c,i,t)]=c}return n}function cloneDeep(t){return cloneDeepImpl(t)}function cloneDeepImpl(t,e=new Map){if(isPrimitive$1(t))return t;if(e.has(t))return e.get(t);if(Array.isArray(t)){const n=new Array(t.length);e.set(t,n);for(let r=0;r<t.length;r++)n[r]=cloneDeepImpl(t[r],e);t.hasOwnProperty("index")&&(n.index=t.index);t.hasOwnProperty("input")&&(n.input=t.input);return n}if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp){const e=new RegExp(t.source,t.flags);e.lastIndex=t.lastIndex;return e}if(t instanceof Map){const n=new Map;e.set(t,n);for(const[r,o]of t.entries())n.set(r,cloneDeepImpl(o,e));return n}if(t instanceof Set){const n=new Set;e.set(t,n);for(const r of t.values())n.add(cloneDeepImpl(r,e));return n}if("undefined"!=typeof Buffer&&Buffer.isBuffer(t))return t.subarray();if(isTypedArray$1(t)){const n=new(Object.getPrototypeOf(t).constructor)(t.length);e.set(t,n);for(let r=0;r<t.length;r++)n[r]=cloneDeepImpl(t[r],e);return n}if(t instanceof ArrayBuffer||"undefined"!=typeof SharedArrayBuffer&&t instanceof SharedArrayBuffer)return t.slice(0);if(t instanceof DataView){const n=new DataView(t.buffer.slice(0));e.set(t,n);copyProperties(n,t,e);return n}if("undefined"!=typeof File&&t instanceof File){const n=new File([t],t.name,{type:t.type});e.set(t,n);copyProperties(n,t,e);return n}if(t instanceof Blob){const n=new Blob([t],{type:t.type});e.set(t,n);copyProperties(n,t,e);return n}if(t instanceof Error){const n=new t.constructor;e.set(t,n);n.message=t.message;n.name=t.name;n.stack=t.stack;n.cause=t.cause;copyProperties(n,t,e);return n}if("object"==typeof t&&null!==t){const n={};e.set(t,n);copyProperties(n,t,e);return n}return t}function copyProperties(t,e,n){const r=Object.keys(e);for(let o=0;o<r.length;o++){const i=r[o],c=Object.getOwnPropertyDescriptor(e,i);(c?.writable||c?.set)&&(t[i]=cloneDeepImpl(e[i],n))}}function delay(t,{signal:e}={}){return new Promise(((n,r)=>{const abortError=()=>{r(new AbortError)};if(e?.aborted)return abortError();const o=setTimeout(n,t);e?.addEventListener("abort",(()=>{clearTimeout(o);abortError()}),{once:!0})}))}async function timeout(t){await delay(t);throw new TimeoutError}const capitalize=t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase(),e=/[A-Z]?[a-z]+|[0-9]+|[A-Z]+(?![a-z])/g;function getWords(t){return Array.from(t.match(e)??[])}function flatten(t,e=1){const n=[],r=Math.floor(e);if(!Array.isArray(t))return n;const recursive=(t,e)=>{for(const o of t)e<r&&(Array.isArray(o)||Boolean(o?.[Symbol.isConcatSpreadable])||null!==o&&"object"==typeof o&&"[object Arguments]"===Object.prototype.toString.call(o))?Array.isArray(o)?recursive(o,e+1):recursive(Array.from(o),e+1):n.push(o)};recursive(t,0);return n}const n=/^(?:0|[1-9]\d*)$/;function isIndex(t){switch(typeof t){case"number":return Number.isInteger(t)&&t>=0&&t<Number.MAX_SAFE_INTEGER;case"symbol":return!1;case"string":return n.test(t)}}function toPath(t){const e=/\\(\\)?/g,n=RegExp("[^.[\\]]+|\\[(?:([^\"'][^[]*)|([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))","g"),r=[];"."===t[0]&&r.push("");let o,i=0;for(;null!==(o=n.exec(t));){let t=o[0];const c=o[1],u=o[2],s=o[3];u?t=s.replace(e,"$1"):c&&(t=c);r.push(t);n.lastIndex===i?n.lastIndex++:i=n.lastIndex}return r}function set(t,e,n){const r=Array.isArray(e)?e:"string"==typeof e?toPath(e):[e];let o=t;for(let t=0;t<r.length-1;t++){const e=r[t],n=r[t+1];null==o[e]&&(o[e]=isIndex(n)?[]:{});o=o[e]}o[r[r.length-1]]=n;return t}const r=/^\w*$/,o=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/;function get(t,e,n){let i;i=Array.isArray(e)?e:"string"==typeof e&&function isDeepKey(t){switch(typeof t){case"number":case"symbol":return!1;case"string":return!r.test(t)&&o.test(t)}}(e)&&null==t?.[e]?toPath(e):[e];if(0===i.length)return n;let c,u=t;for(c=0;c<i.length&&null!=u;c++){let t=i[c];Object.is(t.valueOf(),-0)&&(t="-0");u=u[t]}return null===u&&c===i.length?u:u??n}function property(t){return function(e){return get(e,t)}}function identity(t){return t}function isArrayMatch(t,e){if(0===e.length)return!0;if(!Array.isArray(t))return!1;const n=new Set;for(let r=0;r<e.length;r++){const o=e[r],i=t.findIndex(((t,e)=>isMatch(t,o)&&!n.has(e)));if(-1===i)return!1;n.add(i)}return!0}function isMatch(t,e){if(e===t)return!0;switch(typeof e){case"object":{if(null==e)return!0;e=e??{};const n=Object.keys(e);if(null==t)return 0===n.length;if(Array.isArray(e))return isArrayMatch(t,e);if(e instanceof Map)return function isMapMatch(t,e){if(0===e.size)return!0;if(!(t instanceof Map))return!1;for(const[n,r]of e.entries())if(!isMatch(t.get(n),r))return!1;return!0}(t,e);if(e instanceof Set)return function isSetMatch(t,e){return 0===e.size||t instanceof Set&&isArrayMatch([...t],[...e])}(t,e);for(let r=0;r<n.length;r++){const o=n[r];if(!isPrimitive$1(t)&&!(o in t))return!1;if(void 0===e[o]&&void 0!==t[o])return!1;if(!isMatch(t[o],e[o]))return!1}return!0}case"function":return Object.keys(e).length>0&&isMatch(t,{...e});default:return!e}}t.AbortError=AbortError;t.TimeoutError=TimeoutError;t.after=(t,e)=>{if(!Number.isInteger(t)||t<0)throw new Error("n must be a non-negative integer.");let n=0;return(...r)=>{if(++n>=t)return e(...r)}};t.before=(t,e)=>{if(!Number.isInteger(t)||t<0)throw new Error("n must be a non-negative integer.");let n=0;return(...r)=>{if(++n<t)return e(...r)}};t.camelCase=function camelCase(t){const e=getWords(t);if(0===e.length)return"";const[n,...r]=e;return`${n.toLowerCase()}${r.map((t=>capitalize(t))).join("")}`};t.capitalize=capitalize;t.chunk=function chunk(t,e=1){return 0===(e=Math.max(Math.floor(e),0))?[]:function chunk$1(t,e){if(!Number.isInteger(e)||e<=0)throw new Error("Size must be an integer greater than zero.");const n=Math.ceil(t.length/e),r=Array(n);for(let o=0;o<n;o++){const n=o*e,i=n+e;r[o]=t.slice(n,i)}return r}(t,e)};t.clamp=function clamp(t,e,n){return null==n?Math.min(t,e):Math.min(Math.max(t,e),n)};t.clone=function clone(t){if(function isPrimitive(t){return null==t||"object"!=typeof t&&"function"!=typeof t}(t))return t;if(Array.isArray(t))return t.slice();if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp)return new RegExp(t.source,t.flags);if(t instanceof Map){const e=new Map;for(const[n,r]of t)e.set(n,r);return e}if(t instanceof Set){const e=new Set;for(const n of t)e.add(n);return e}if("object"==typeof t){const e=Object.getPrototypeOf(t),n=Object.create(e);return Object.assign(n,t)}return t};t.cloneDeep=cloneDeep;t.compact=function compact(t){const e=[];for(const n of t)n&&e.push(n);return e};t.concat=function concat(...t){return flatten$1(t)};t.countBy=function countBy(t,e){const n={};for(const r of t){const t=e(r);n[t]=(n[t]??0)+1}return n};t.debounce=function debounce(t,e,{signal:n}={}){let r=null;const debounced=function(...o){null!==r&&clearTimeout(r);n?.aborted||(r=setTimeout((()=>{t(...o);r=null}),e))};debounced.cancel=function(){if(null!==r){clearTimeout(r);r=null}};n?.addEventListener("abort",(function(){debounced.cancel()}),{once:!0});return debounced};t.delay=delay;t.difference=function difference(t,...e){return difference$1(t,flatten$1(e))};t.differenceBy=differenceBy;t.differenceWith=differenceWith;t.drop=function drop(t,e){e=Math.max(e,0);return t.slice(e)};t.dropRight=function dropRight(t,e){return 0===(e=Math.min(-e,0))?t.slice():t.slice(0,e)};t.dropRightWhile=function dropRightWhile(t,e){for(let n=t.length-1;n>=0;n--)if(!e(t[n]))return t.slice(0,n+1);return[]};t.dropWhile=function dropWhile(t,e){const n=t.findIndex((t=>!e(t)));return-1===n?[]:t.slice(n)};t.endsWith=(t,e,n=t.length)=>t.endsWith(e,n);t.fill=function fill(t,e,n=0,r=t.length){(n=Math.floor(n))||(n=0);(r=Math.floor(r))||(r=0);return function fill$1(t,e,n=0,r=t.length){const o=t.length,i=Math.max(n>=0?n:o+n,0),c=Math.min(r>=0?r:o+r,o);for(let n=i;n<c;n++)t[n]=e;return t}(t,e,n,r)};t.first=head;t.flatMap=function flatMap(t,e,n=1){return flatten$1(t.map((t=>e(t))),n)};t.flatten=flatten;t.flattenDeep=function flattenDeep(t){return flatten(t,1/0)};t.flattenDepth=function flattenDepth(t,e=1){return flatten(t,e)};t.flattenObject=function flattenObject(t){return flattenObjectImpl(t)};t.forEachRight=function forEachRight(t,e){for(let n=t.length-1;n>=0;n--){e(t[n],n,t)}};t.get=get;t.groupBy=function groupBy(t,e){const n={};for(const r of t){const t=e(r);null==n[t]&&(n[t]=[]);n[t].push(r)}return n};t.head=head;t.inRange=function inRange(t,e,n){if(null==n){n=e;e=0}if(e>=n)throw new Error("The maximum value must be greater than the minimum value.");return e<=t&&t<n};t.initial=function initial(t){return t.length<=1?[]:t.slice(0,-1)};t.intersection=intersection;t.intersectionBy=intersectionBy;t.intersectionWith=intersectionWith;t.invert=function invert(t){const e={},n=Object.keys(t);for(let r=0;r<n.length;r++){const o=n[r];e[t[o]]=o}return e};t.isArguments=function isArguments(t){return null!==t&&"object"==typeof t&&"[object Arguments]"===function getTag(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}(t)};t.isArray=function isArray(t){return Array.isArray(t)};t.isArrayLike=function isArrayLike(t){return null!=t&&"function"!=typeof t&&isLength(t.length)};t.isEqual=function isEqual(t,e){if(Object.is(t,e))return!0;if(t instanceof Date&&e instanceof Date)return t.getTime()===e.getTime();if(t instanceof RegExp&&e instanceof RegExp)return t.source===e.source&&t.flags===e.flags;if("object"!=typeof t||"object"!=typeof e||null===t||null===e)return!1;const n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;if(union(n,r).length!==n.length)return!1;for(let r=0;r<n.length;r++){const o=n[r];if(!isEqual(t[o],e[o]))return!1}return!0};t.isFunction=function isFunction(t){return"function"==typeof t};t.isLength=isLength;t.isMatch=isMatch;t.isNil=isNil;t.isNotNil=function isNotNil(t){return null!=t};t.isNull=function isNull(t){return null===t};t.isObjectLike=function isObjectLike(t){return"object"==typeof t&&null!==t};t.isPlainObject=function isPlainObject(t){if("object"!=typeof t)return!1;if(null==t)return!1;if(null===Object.getPrototypeOf(t))return!0;if("[object Object]"!==t.toString()){const e=t[Symbol.toStringTag];if(null==e)return!1;return!!Object.getOwnPropertyDescriptor(t,Symbol.toStringTag)?.writable&&t.toString()===`[object ${e}]`}let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};t.isPrimitive=isPrimitive$1;t.isTypedArray=function isTypedArray(t){return isTypedArray$1(t)};t.isUndefined=function isUndefined(t){return void 0===t};t.kebabCase=t=>getWords(t).map((t=>t.toLowerCase())).join("-");t.keyBy=function keyBy(t,e){const n={};for(const r of t){n[e(r)]=r}return n};t.last=function last(t){return t[t.length-1]};t.lowerCase=t=>getWords(t).map((t=>t.toLowerCase())).join(" ");t.mapKeys=function mapKeys(t,e){switch(typeof(e=e??identity)){case"string":case"symbol":case"number":case"object":return mapKeys$1(t,property(e));case"function":return mapKeys$1(t,e)}};t.mapValues=function mapValues(t,e){const n={},r=Object.keys(t);for(let o=0;o<r.length;o++){const i=r[o],c=t[i];n[i]=e(c,i,t)}return n};t.matches=function matches(t){t=cloneDeep(t);return e=>isMatch(e,t)};t.max=function max(t=[]){let e,n=t[0];for(const r of t)if(null==e||r>e){e=r;n=r}return n};t.maxBy=function maxBy(t,e){let n=t[0],r=-1/0;for(const o of t){const t=e(o);if(t>r){r=t;n=o}}return n};t.mean=mean;t.meanBy=function meanBy(t,e){return mean(t.map((t=>e(t))))};t.min=function min(t=[]){let e,n=t[0];for(const r of t)if(null==e||r<e){e=r;n=r}return n};t.minBy=function minBy(t,e){let n=t[0],r=1/0;for(const o of t){const t=e(o);if(t<r){r=t;n=o}}return n};t.negate=function negate(t){return(...e)=>!t(...e)};t.noop=function noop(){};t.omit=function omit(t,e){const n={...t};for(const t of e)delete n[t];return n};t.omitBy=function omitBy(t,e){const n={};for(const[r,o]of Object.entries(t))e(o,r)||(n[r]=o);return n};t.once=function once(t){let e,n=!1;return function(){if(n)return e;const r=t();n=!0;e=r;return r}};t.orderBy=function orderBy(t,e,n){const compareValues=(t,e,n)=>t<e?"asc"===n?-1:1:t>e?"asc"===n?1:-1:0,r=e.map(((t,e)=>n[e]||n[n.length-1]));return t.slice().sort(((t,n)=>{for(let o=0;o<e.length;o++){const i=e[o],c=r[o],u=compareValues(t[i],n[i],c);if(0!==u)return u}return 0}))};t.padStart=(t,e=0,n=" ")=>Number.isSafeInteger(e)&&e>t.length&&n.length>0?t.padStart(e,n):t;t.partition=function partition(t,e){const n=[],r=[];for(const o of t)e(o)?n.push(o):r.push(o);return[n,r]};t.pick=function pick(t,e){const n={};for(const r of e)n[r]=t[r];return n};t.pickBy=function pickBy(t,e){const n={};for(const[r,o]of Object.entries(t))e(o,r)&&(n[r]=o);return n};t.property=property;t.random=random;t.randomInt=randomInt;t.range=function range(t,e,n){if(null==e){e=t;t=0}null==n&&(n=1);if(!Number.isInteger(n)||0===n)throw new Error("The step value must be a non-zero integer.");const r=Math.max(Math.ceil((e-t)/n),0),o=new Array(r);for(let e=0;e<r;e++)o[e]=t+e*n;return o};t.round=function round(t,e=0){if(!Number.isInteger(e))throw new Error("Precision must be an integer.");const n=Math.pow(10,e);return Math.round(t*n)/n};t.sample=function sample(t){return t[Math.floor(Math.random()*t.length)]};t.sampleSize=function sampleSize(t,e){if(e>t.length)throw new Error("Size must be less than or equal to the length of array.");const n=new Array(e),r=new Set;for(let o=t.length-e,i=0;o<t.length;o++,i++){let e=randomInt(0,o+1);r.has(e)&&(e=o);r.add(e);n[i]=t[e]}return n};t.set=set;t.shuffle=function shuffle(t){const e=t.slice();for(let t=e.length-1;t>=1;t--){const n=Math.floor(Math.random()*(t+1));[e[t],e[n]]=[e[n],e[t]]}return e};t.size=function size(t){if(isNil(t))return 0;const e=Object.prototype.toString.call(t);return"[object Map]"===e||"[object Set]"===e?t.size:Object.keys(t).length};t.snakeCase=t=>getWords(t).map((t=>t.toLowerCase())).join("_");t.startCase=function startCase(t){const e=getWords(t.trim());let n="";for(const t of e){n&&(n+=" ");t===t.toUpperCase()?n+=t:n+=t[0].toUpperCase()+t.slice(1).toLowerCase()}return n};t.startsWith=(t,e,n=0)=>t.startsWith(e,n);t.sum=sum;t.sumBy=function sumBy(t,e){return sum(t.map((t=>e(t))))};t.tail=function tail(t){const e=t.length;if(e<=1)return[];const n=new Array(e-1);for(let r=1;r<e;r++)n[r-1]=t[r];return n};t.take=function take(t,e){return t.slice(0,e)};t.takeRight=function takeRight(t,e=1){return e<=0?[]:t.slice(-e)};t.takeRightWhile=function takeRightWhile(t,e){for(let n=t.length-1;n>=0;n--)if(!e(t[n]))return t.slice(n+1);return t.slice()};t.takeWhile=function takeWhile(t,e){const n=[];for(const r of t){if(!e(r))break;n.push(r)}return n};t.throttle=function throttle(t,e){let n;return function(...r){const o=Date.now();if(null==n||o-n>=e){n=o;t(...r)}}};t.toFilled=function toFilled(t,e,n=0,r=t.length){const o=t.length,i=Math.max(n>=0?n:o+n,0),c=Math.min(r>=0?r:o+r,o),u=t.slice();for(let t=i;t<c;t++)u[t]=e;return u};t.union=union;t.unionBy=unionBy;t.unionWith=unionWith;t.uniq=uniq;t.uniqBy=function uniqBy(t,e){const n=new Map;for(const r of t){const t=e(r);n.has(t)||n.set(t,r)}return Array.from(n.values())};t.uniqWith=uniqWith;t.unzip=function unzip(t){let e=0;for(let n=0;n<t.length;n++)t[n].length>e&&(e=t[n].length);const n=new Array(e);for(let r=0;r<e;r++){n[r]=new Array(t.length);for(let e=0;e<t.length;e++)n[r][e]=t[e][r]}return n};t.unzipWith=function unzipWith(t,e){const n=Math.max(...t.map((t=>t.length))),r=new Array(n);for(let o=0;o<n;o++){const n=new Array(t.length);for(let e=0;e<t.length;e++)n[e]=t[e][o];r[o]=e(...n)}return r};t.withTimeout=async function withTimeout(t,e){return Promise.race([t(),timeout(e)])};t.without=function without(t,...e){const n=new Set(e);return t.filter((t=>!n.has(t)))};t.xor=function xor(t,e){return difference$1(union(t,e),intersection(t,e))};t.xorBy=function xorBy(t,e,n){return differenceBy(unionBy(t,e,n),intersectionBy(t,e,n),n)};t.xorWith=function xorWith(t,e,n){return differenceWith(unionWith(t,e,n),intersectionWith(t,e,n),n)};t.zip=zip;t.zipObject=function zipObject(t,e){const n={};for(let r=0;r<t.length;r++)n[t[r]]=e[r];return n};t.zipObjectDeep=function zipObjectDeep(t,e){const n={},r=zip(t,e);for(let t=0;t<r.length;t++){const[e,o]=r[t];null!=e&&set(n,e,o)}return n};t.zipWith=function zipWith(t,...e){const n=[t,...e.slice(0,-1)],r=e[e.length-1],o=[],i=Math.max(...n.map((t=>t.length)));for(let t=0;t<i;t++){const e=n.map((e=>e[t]));o.push(r(...e))}return o};Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});return t}({});
2
2
  //# sourceMappingURL=browser.global.js.map