@tolki/arr 0.0.0-stage → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/arr.js ADDED
@@ -0,0 +1,1184 @@
1
+ import { SortDirection as te } from "@tolki/enum";
2
+ import { collapse as ye, crossJoin as be, union as we, first as de, last as Oe, select as $e, values as Ae, wrap as je, prepend as Ke, replaceRecursive as Ie } from "@tolki/obj";
3
+ import { getNestedValue as $, getMixedValue as M, setMixed as xe, dotFlatten as Se, MAX_UNDOT_INDEX as F, undotExpandArray as Me, forgetKeys as Ee, hasMixed as Ne, resolvePluckPath as Z, explodePluckPath as G, getRaw as Pe, setMixedImmutable as Ce, pushWithPath as Re, isCanonicalUndotIndex as Ue } from "@tolki/path";
4
+ import { randomInt as re, finish as k } from "@tolki/str";
5
+ import { createSortSpecComparator as De, isArray as l, isNull as g, isUndefined as y, InvalidArgumentException as j, arrayValueMessage as Le, isBoolean as Q, phpTypeName as L, isPhpFalsy as v, isFunction as b, looseEqual as W, isPlainObject as A, arrayableValues as T, defineKey as d, toPhpKeyString as X, keyedEntries as We, isIntegerLikeKey as q, isPrototypeObject as E, phpArrayKey as C, isNumber as oe, isMap as x, isIterable as S, isPhpArrayKey as se, isWeakMap as Te, isObject as w, getAccessibleValues as p, isInteger as Ve, phpStringCast as _e, isSymbol as Fe, phpComputedKey as Je, resolveTakeCount as ie, castableToArray as ee, isFalsy as z, operatorMatch as J, isString as N, isPhpNumeric as Y, resolveSliceRange as Be, ItemNotFoundException as ne, MultipleItemsFoundException as Qe, compareValues as O, resolveSpliceRange as Xe, cssListItemToString as ue, arrayableItems as K, resolvePadLength as qe, strictEqual as H, phpValueMatcher as ce, phpValueMatch as V, readMapKey as ze, writeMapKey as Ye, phpSortComparator as He } from "@tolki/utils";
6
+ const Ze = De(
7
+ (e, n) => $(e, n)
8
+ );
9
+ function a(e) {
10
+ return l(e);
11
+ }
12
+ function an(e) {
13
+ return l(e);
14
+ }
15
+ function P(e) {
16
+ return w(e) && !S(e) ? Object.values(e) : e;
17
+ }
18
+ function R(e) {
19
+ return !A(e) && w(e) && b(e.all) ? e.all() : e;
20
+ }
21
+ function fe(e, n, t = !1) {
22
+ const r = [...e];
23
+ if (g(n) || y(n))
24
+ return r;
25
+ const o = N(n) ? n.split(".") : [String(n)];
26
+ let s = r;
27
+ const i = t ? o : o.slice(0, -1);
28
+ for (const [u, c] of i.entries()) {
29
+ const h = x(s) ? ze(s, c) : Object.hasOwn(s, c) ? { found: !0, value: s[c] } : { found: !1 };
30
+ if (!h.found)
31
+ return r;
32
+ const f = h.value;
33
+ if (!l(f) && !A(f) && !x(f) || E(f) && t && u === i.length - 1 && !l(f))
34
+ return r;
35
+ let m;
36
+ if (E(f))
37
+ m = l(f) ? [] : {};
38
+ else if (x(f))
39
+ m = new Map(f);
40
+ else {
41
+ m = l(f) ? [...f] : {};
42
+ const I = f;
43
+ for (const U of Reflect.ownKeys(f))
44
+ Object.hasOwn(m, U) || Object.defineProperty(m, U, {
45
+ value: I[U],
46
+ writable: !0,
47
+ enumerable: Object.prototype.propertyIsEnumerable.call(
48
+ f,
49
+ U
50
+ ),
51
+ configurable: !0
52
+ });
53
+ }
54
+ x(s) ? Ye(s, c, m) : d(s, c, m), s = m;
55
+ }
56
+ return r;
57
+ }
58
+ function mn(e, n, t) {
59
+ const r = M(e, n);
60
+ return !g(r) && !y(r) ? [...e] : xe(
61
+ fe(e, n),
62
+ n,
63
+ t
64
+ );
65
+ }
66
+ function gn(e, n, t = null) {
67
+ const r = M(e, n, t);
68
+ if (!l(r))
69
+ throw new j(Le(r, n));
70
+ return r;
71
+ }
72
+ function vn(e, n, t = null) {
73
+ const r = M(e, n, t);
74
+ if (!Q(r))
75
+ throw new j(
76
+ `Array value for key [${n}] must be a boolean, ${L(r)} found.`
77
+ );
78
+ return r;
79
+ }
80
+ function yn(e, n, t) {
81
+ if (n <= 0)
82
+ return [];
83
+ if (t) {
84
+ const o = [];
85
+ for (let s = 0; s < e.length; s += n) {
86
+ const i = e.slice(s, s + n).map((u, c) => [s + c, u]);
87
+ o.push(Object.fromEntries(i));
88
+ }
89
+ return o;
90
+ }
91
+ const r = [];
92
+ for (let o = 0; o < e.length; o += n) {
93
+ const s = e.slice(o, o + n);
94
+ r.push(s);
95
+ }
96
+ return r;
97
+ }
98
+ function Ge(e, n) {
99
+ const t = [];
100
+ let r = [];
101
+ for (const [o, s] of e.entries())
102
+ r.length > 0 && v(n(s, o, r)) && (t.push(r), r = []), r.push(s);
103
+ return r.length > 0 && t.push(r), t;
104
+ }
105
+ function bn(e, n) {
106
+ const t = b(n) ? n : (r) => g(n) || y(n) ? r : $(r, n);
107
+ return Ge(
108
+ e,
109
+ (r, o, s) => W(
110
+ t(r, o),
111
+ t(s[s.length - 1], o - 1)
112
+ )
113
+ );
114
+ }
115
+ function wn(e) {
116
+ const n = e.map((r) => R(r));
117
+ if (n.some((r) => A(r)))
118
+ return ye({ ...e });
119
+ const t = [];
120
+ for (const r of n)
121
+ l(r) && t.push(...r);
122
+ return t;
123
+ }
124
+ function dn(e, n) {
125
+ const t = T(n);
126
+ if (e.length !== t.length)
127
+ throw new Error(
128
+ "array_combine(): Argument #1 ($keys) and argument #2 ($values) must have the same number of elements"
129
+ );
130
+ const r = {};
131
+ for (let o = 0; o < e.length; o++)
132
+ d(r, X(e[o]), t[o]);
133
+ return r;
134
+ }
135
+ function On(...e) {
136
+ return be(
137
+ ...e.map((n, t) => ({ [t]: n }))
138
+ ).map((n) => Object.values(n));
139
+ }
140
+ function $n(e) {
141
+ return [e.map((t, r) => r), e.slice()];
142
+ }
143
+ function An(e, n = "", t = 1 / 0) {
144
+ return Se(e, n, t);
145
+ }
146
+ function ke(e) {
147
+ return e.split(".").every(Ue);
148
+ }
149
+ function jn(e) {
150
+ const n = /* @__PURE__ */ new Map();
151
+ let t = 0;
152
+ for (const [r] of We(e ?? {})) {
153
+ if (!ke(r))
154
+ throw new TypeError(
155
+ `Arr.undot cannot build an array from the key "${r}": every dot segment must be a canonical decimal integer (no leading zeros, sign, or exponent) from 0 up to ${F}. Use Obj.undot for string keys.`
156
+ );
157
+ const o = r.split(".");
158
+ for (let s = 0; s < o.length; s++) {
159
+ const i = o.slice(0, s).join("."), u = Number(o[s]), c = n.get(i) ?? 0;
160
+ if (!(u <= c) && (t += u - c, n.set(i, u), t > F))
161
+ throw new TypeError(
162
+ `Arr.undot cannot build an array: these keys' combined container indices exceed the ${F} budget.`
163
+ );
164
+ }
165
+ }
166
+ return Me(e);
167
+ }
168
+ function Kn(...e) {
169
+ return en(...e);
170
+ }
171
+ function en(...e) {
172
+ const n = we(...e), t = [];
173
+ for (const [r, o] of Object.entries(n))
174
+ if (q(r)) {
175
+ for (; t.length < Number(r); )
176
+ t.push(void 0);
177
+ t.push(o);
178
+ }
179
+ return t;
180
+ }
181
+ function In(e, ...n) {
182
+ return E(e) || e.unshift(...n), e;
183
+ }
184
+ function xn(e, n) {
185
+ return le(e, n);
186
+ }
187
+ function Sn(e, n, t = !1) {
188
+ const r = l(n) ? n : [n];
189
+ return e.filter((o) => !r.some(
190
+ (s) => t ? o === s : W(o, s)
191
+ ));
192
+ }
193
+ function Mn(e, n) {
194
+ const t = C(X(n));
195
+ return oe(t) && Object.hasOwn(e, t);
196
+ }
197
+ function En(e, n, t) {
198
+ const r = () => y(t) ? null : b(t) ? t() : t;
199
+ if (g(e) || y(e))
200
+ return r();
201
+ const o = R(e);
202
+ if (x(o) || A(o) && !S(o))
203
+ return de(
204
+ o,
205
+ n,
206
+ t
207
+ );
208
+ const s = l(o), i = s ? o : P(o);
209
+ if (!n) {
210
+ if (s) {
211
+ const h = o;
212
+ return h.length === 0 ? r() : h[0];
213
+ }
214
+ for (const h of i)
215
+ return h;
216
+ return r();
217
+ }
218
+ const u = S(o) && !s ? o : P(he(o));
219
+ let c = 0;
220
+ for (const h of u)
221
+ if (!v(n(h, c++)))
222
+ return h;
223
+ return r();
224
+ }
225
+ function Nn(e, n, t) {
226
+ const r = () => y(t) ? null : b(t) ? t() : t;
227
+ if (g(e) || y(e))
228
+ return r();
229
+ const o = R(e);
230
+ if (x(o) || A(o) && !S(o))
231
+ return Oe(
232
+ o,
233
+ n,
234
+ t
235
+ );
236
+ const s = l(o), i = s ? o : P(o);
237
+ if (!n) {
238
+ if (s) {
239
+ const I = o;
240
+ return I.length === 0 ? r() : I[I.length - 1];
241
+ }
242
+ let f, m = !1;
243
+ for (const I of i)
244
+ f = I, m = !0;
245
+ return m ? f : r();
246
+ }
247
+ if (s) {
248
+ const f = o;
249
+ for (let m = f.length - 1; m >= 0; m--)
250
+ if (!v(n(f[m], m)))
251
+ return f[m];
252
+ return r();
253
+ }
254
+ let u = 0, c = !1, h;
255
+ for (const f of i)
256
+ v(n(f, u)) || (h = f, c = !0), u++;
257
+ return c ? h : r();
258
+ }
259
+ function Pn(e, n) {
260
+ if (!e || n === 0)
261
+ return [];
262
+ const t = e.length;
263
+ if (t === 0)
264
+ return [];
265
+ if (n > 0)
266
+ return n >= t ? e.slice() : e.slice(0, n);
267
+ const r = Math.abs(n);
268
+ return r >= t ? e.slice() : e.slice(t - r);
269
+ }
270
+ function nn(e, n = 1 / 0) {
271
+ const t = [];
272
+ if (!a(e))
273
+ return t;
274
+ for (const r of e) {
275
+ const o = R(r);
276
+ if (!l(o) && !A(o)) {
277
+ t.push(o);
278
+ continue;
279
+ }
280
+ const s = l(o) ? o : Object.values(o);
281
+ for (const i of n === 1 ? s : nn(s, n - 1))
282
+ t.push(i);
283
+ }
284
+ return t;
285
+ }
286
+ function Cn(e) {
287
+ if (!a(e))
288
+ return {};
289
+ const n = {};
290
+ for (let t = 0; t < e.length; t++) {
291
+ const r = e[t];
292
+ se(r) && d(n, String(r), t);
293
+ }
294
+ return n;
295
+ }
296
+ function Rn(e, n, t = null) {
297
+ const r = M(e, n, t);
298
+ if (!oe(r))
299
+ throw new j(
300
+ `Array value for key [${n}] must be a float, ${L(r)} found.`
301
+ );
302
+ return r;
303
+ }
304
+ function le(e, n) {
305
+ return Ee(e, n);
306
+ }
307
+ function Un(e) {
308
+ return he(e);
309
+ }
310
+ function he(e) {
311
+ if (l(e))
312
+ return e.slice();
313
+ if (x(e)) {
314
+ const n = {};
315
+ for (const [t, r] of e)
316
+ d(n, String(t), r);
317
+ return n;
318
+ }
319
+ if (Te(e))
320
+ throw new Error(
321
+ "WeakMap values cannot be enumerated in JavaScript; cannot convert to array of values."
322
+ );
323
+ if (S(e))
324
+ return [...e];
325
+ if (!g(e) && w(e))
326
+ return e;
327
+ throw new j(
328
+ "Items cannot be represented by a scalar value."
329
+ );
330
+ }
331
+ function Dn(e, n, t = null) {
332
+ if (g(n) || y(n))
333
+ return l(e) ? e : b(t) ? t() : t;
334
+ if (!l(e))
335
+ return b(t) ? t() : t;
336
+ const r = M(e, n, null);
337
+ return g(r) ? b(t) ? t() : t : r;
338
+ }
339
+ function pe(e, n) {
340
+ const t = l(n) ? n : [n];
341
+ if (!a(e) || t.length === 0)
342
+ return !1;
343
+ for (const r of t)
344
+ if (g(r) || y(r) || !Ne(e, r))
345
+ return !1;
346
+ return !0;
347
+ }
348
+ function Ln(e, n) {
349
+ const t = l(n) ? n : [n];
350
+ if (!a(e) || t.length === 0)
351
+ return !1;
352
+ for (const r of t)
353
+ if (!pe(e, r))
354
+ return !1;
355
+ return !0;
356
+ }
357
+ function Wn(e, n) {
358
+ if (g(n))
359
+ return !1;
360
+ const t = l(n) ? n : [n];
361
+ if (t.length === 0 || !a(e))
362
+ return !1;
363
+ for (const r of t)
364
+ if (pe(e, r))
365
+ return !0;
366
+ return !1;
367
+ }
368
+ function Tn(e, n) {
369
+ if (a(e)) {
370
+ const r = p(e);
371
+ for (let o = 0; o < r.length; o++)
372
+ if (v(n(r[o], o)))
373
+ return !1;
374
+ return !0;
375
+ }
376
+ if (!S(e) && !w(e))
377
+ return !1;
378
+ let t = 0;
379
+ for (const r of P(e))
380
+ if (v(n(r, t++)))
381
+ return !1;
382
+ return !0;
383
+ }
384
+ function Vn(e, n) {
385
+ if (a(e)) {
386
+ const r = p(e);
387
+ for (let o = 0; o < r.length; o++)
388
+ if (!v(n(r[o], o)))
389
+ return !0;
390
+ return !1;
391
+ }
392
+ if (!S(e) && !w(e))
393
+ return !1;
394
+ let t = 0;
395
+ for (const r of P(e))
396
+ if (!v(n(r, t++)))
397
+ return !0;
398
+ return !1;
399
+ }
400
+ function _n(e, n, t = null) {
401
+ const r = M(e, n, t);
402
+ if (!Ve(r))
403
+ throw new j(
404
+ `Array value for key [${n}] must be an integer, ${L(r)} found.`
405
+ );
406
+ return r;
407
+ }
408
+ function Fn(e, n, t = "") {
409
+ const o = p(e).map((c) => _e(c));
410
+ if (t === "")
411
+ return o.join(n);
412
+ const s = o.length;
413
+ if (s === 0)
414
+ return "";
415
+ if (s === 1)
416
+ return o[0];
417
+ const i = o.slice(0, -1).join(n), u = o[s - 1];
418
+ return i + t + u;
419
+ }
420
+ function Jn(e, n) {
421
+ if (!a(e))
422
+ return {};
423
+ const t = e, r = {};
424
+ for (const [o, s] of t.entries()) {
425
+ const i = b(n) ? n(s, o) : $(s, n);
426
+ d(
427
+ r,
428
+ Fe(i) ? i : C(i),
429
+ s
430
+ );
431
+ }
432
+ return r;
433
+ }
434
+ function Bn(e, n) {
435
+ const t = p(e), r = {};
436
+ for (let o = 0; o < t.length; o++)
437
+ r[n + o] = t[o];
438
+ return r;
439
+ }
440
+ function Qn(e, n) {
441
+ const t = p(e), r = l(n) ? n : g(n) ? [] : [n], o = new Set(r.filter(se).map(String));
442
+ return t.filter((s, i) => o.has(String(i)));
443
+ }
444
+ function Xn(e, n, t = !1) {
445
+ const r = l(n) ? n : [n];
446
+ return e.filter((o) => r.some(
447
+ (s) => t ? o === s : W(o, s)
448
+ ));
449
+ }
450
+ function qn(e, n) {
451
+ const t = $e(
452
+ { ...p(e) },
453
+ n
454
+ );
455
+ return Object.values(t);
456
+ }
457
+ function zn(e, n, t = null) {
458
+ if (!a(e))
459
+ return [];
460
+ const r = y(n) ? null : n, o = e, s = g(t) || y(t) ? [] : {};
461
+ for (const i of o) {
462
+ let u;
463
+ if (b(r) ? u = r(i) : u = Z(
464
+ i,
465
+ G(
466
+ r
467
+ )
468
+ ), g(t) || y(t)) {
469
+ s.push(u);
470
+ continue;
471
+ }
472
+ const c = b(t) ? t(i) : Z(
473
+ i,
474
+ G(t)
475
+ );
476
+ d(
477
+ s,
478
+ Je(c, { stringables: !0 }),
479
+ u
480
+ );
481
+ }
482
+ return s;
483
+ }
484
+ function Yn(e, n = 1) {
485
+ if (!a(e) || E(e))
486
+ return n === 1 ? null : [];
487
+ const t = e;
488
+ if (t.length === 0)
489
+ return n === 1 ? null : [];
490
+ if (n === 1)
491
+ return t.pop();
492
+ if (n < 1)
493
+ return [];
494
+ const r = [], o = ie(n, t.length);
495
+ for (let s = 0; s < o; s++)
496
+ r.push(t.pop());
497
+ return r;
498
+ }
499
+ function Hn(e, n) {
500
+ const t = p(e), r = [];
501
+ for (let o = 0; o < t.length; o++)
502
+ r.push(n(t[o], o));
503
+ return r;
504
+ }
505
+ function Zn(e, n) {
506
+ if (!a(e))
507
+ return {};
508
+ const t = e, r = {};
509
+ for (let o = 0; o < t.length; o++) {
510
+ const s = n(t[o], o);
511
+ for (const [i, u] of Object.entries(s))
512
+ d(
513
+ r,
514
+ i,
515
+ u
516
+ );
517
+ }
518
+ return r;
519
+ }
520
+ function Gn(e, n) {
521
+ const t = p(e), r = [];
522
+ for (let o = 0; o < t.length; o++) {
523
+ const s = t[o], i = R(s), u = l(i) ? i : Ae(je(i));
524
+ r.push(n(...u, o));
525
+ }
526
+ return r;
527
+ }
528
+ function kn(e, n, ...t) {
529
+ const r = p(e);
530
+ if (t.length === 0)
531
+ return [n, ...r];
532
+ const o = Ke({ ...Array.from(r) }, n, ...t);
533
+ return C(t[0]) === 0 ? Object.values(o) : o;
534
+ }
535
+ function et(e, n, t = null) {
536
+ const r = () => b(t) ? t() : t;
537
+ if (!a(e))
538
+ return { value: r(), data: [] };
539
+ if (g(n) || y(n)) {
540
+ const c = ee(e).slice();
541
+ return { value: r(), data: c };
542
+ }
543
+ const o = ee(e), { found: s, value: i } = Pe(o, n);
544
+ if (z(s)) {
545
+ const c = o.slice();
546
+ return { value: r(), data: c };
547
+ }
548
+ const u = le(o, n);
549
+ return {
550
+ value: i,
551
+ data: u
552
+ };
553
+ }
554
+ function nt(e) {
555
+ if (g(e) || y(e))
556
+ return "";
557
+ const n = (o) => encodeURIComponent(o).replace(
558
+ /[!'()*]/g,
559
+ (s) => `%${s.charCodeAt(0).toString(16).toUpperCase()}`
560
+ ), t = (o) => Q(o) ? o ? "1" : "0" : String(o), r = (o, s = "") => {
561
+ const i = [];
562
+ if (l(o))
563
+ for (let u = 0; u < o.length; u++) {
564
+ const c = s ? `${s}[${u}]` : String(u), h = o[u];
565
+ if (!g(h) && !y(h))
566
+ if (l(h) || w(h))
567
+ i.push(...r(h, c));
568
+ else {
569
+ const f = n(c);
570
+ i.push(
571
+ `${f}=${n(t(h))}`
572
+ );
573
+ }
574
+ }
575
+ else if (w(o) && !g(o))
576
+ for (const [u, c] of Object.entries(o)) {
577
+ const h = s ? `${s}[${u}]` : u;
578
+ if (!g(c) && !y(c))
579
+ if (l(c) || w(c))
580
+ i.push(...r(c, h));
581
+ else {
582
+ const f = n(h);
583
+ i.push(
584
+ `${f}=${n(t(c))}`
585
+ );
586
+ }
587
+ }
588
+ else {
589
+ const c = n(s || "0");
590
+ i.push(
591
+ `${c}=${n(t(o))}`
592
+ );
593
+ }
594
+ return i;
595
+ };
596
+ return r(e).join("&");
597
+ }
598
+ function tt(e, n, t = !1) {
599
+ const r = !g(n) && !y(n);
600
+ if (!l(e))
601
+ return r ? [] : null;
602
+ const o = e, s = o.length, i = r ? n : 1;
603
+ if (J(i, ">", s))
604
+ throw new j(
605
+ `You requested ${X(i)} items, but there are only ${s} items available.`
606
+ );
607
+ if (s === 0 || r && J(i, "<=", 0))
608
+ return [];
609
+ const u = tn(i), c = [], h = Array.from({ length: s }, (f, m) => m);
610
+ for (let f = 0; f < u; f++) {
611
+ const m = re(0, h.length - 1);
612
+ c.push(h[m]), h.splice(m, 1);
613
+ }
614
+ if (c.sort((f, m) => f - m), !r)
615
+ return o[c[0]];
616
+ if (t) {
617
+ const f = {};
618
+ for (const m of c)
619
+ f[m] = o[m];
620
+ return f;
621
+ } else
622
+ return c.map((f) => o[f]);
623
+ }
624
+ function tn(e) {
625
+ if (N(e) ? !Y(e) : Number.isNaN(e))
626
+ throw new TypeError(
627
+ `Random\\Randomizer::pickArrayKeys(): Argument #2 ($num) must be of type int, ${N(e) ? "string" : "float"} given`
628
+ );
629
+ const n = Math.trunc(Number(e));
630
+ if (n < 1)
631
+ throw new Error(
632
+ "Random\\Randomizer::pickArrayKeys(): Argument #2 ($num) must be between 1 and the number of elements in argument #1 ($array)"
633
+ );
634
+ return n;
635
+ }
636
+ function rt(e, n = 1) {
637
+ if (n < 0)
638
+ throw new j(
639
+ "Number of shifted items may not be less than zero."
640
+ );
641
+ if (n === 0)
642
+ return [];
643
+ if (!a(e) || E(e))
644
+ return n === 1 ? null : [];
645
+ const t = e;
646
+ if (t.length === 0)
647
+ return n === 1 ? null : [];
648
+ if (n === 1)
649
+ return t.shift();
650
+ const r = [], o = ie(n, t.length);
651
+ for (let s = 0; s < o; s++)
652
+ r.push(t.shift());
653
+ return r;
654
+ }
655
+ function ot(e, n, t) {
656
+ return Ce(e, n, t);
657
+ }
658
+ function st(e, n, ...t) {
659
+ return Re(
660
+ l(e) ? fe(e, n, !0) : e,
661
+ n,
662
+ ...t
663
+ );
664
+ }
665
+ function it(e) {
666
+ const t = p(e).slice();
667
+ for (let r = t.length - 1; r > 0; r--) {
668
+ const o = re(0, r);
669
+ [t[r], t[o]] = [t[o], t[r]];
670
+ }
671
+ return t;
672
+ }
673
+ function ut(e, n) {
674
+ const t = _(n);
675
+ return rn(
676
+ p(e),
677
+ (r, o) => v(t(r, o))
678
+ );
679
+ }
680
+ function rn(e, n) {
681
+ const t = p(e), r = _(n), o = t.findIndex(
682
+ (s, i) => v(r(s, i))
683
+ );
684
+ return t.slice(o === -1 ? t.length : o);
685
+ }
686
+ function ct(e, n, t = null) {
687
+ if (!a(e))
688
+ return [];
689
+ const r = e.slice(), { start: o, end: s } = Be(r.length, n, t);
690
+ return r.slice(o, s);
691
+ }
692
+ function ft(e, n) {
693
+ const t = p(e);
694
+ if (t.length === 0)
695
+ throw new ne();
696
+ let r;
697
+ if (n) {
698
+ r = [];
699
+ for (let s = 0; s < t.length; s++) {
700
+ const i = t[s];
701
+ v(n(i, s)) || r.push(i);
702
+ }
703
+ } else
704
+ r = t.slice();
705
+ const o = r.length;
706
+ if (o === 0)
707
+ throw new ne();
708
+ if (o > 1)
709
+ throw new Qe(o);
710
+ return r[0];
711
+ }
712
+ function ae(e, n, t = !1) {
713
+ const r = n.map(
714
+ (o) => Ze(o, t)
715
+ );
716
+ return e.sort(
717
+ He((o, s) => {
718
+ for (const i of r) {
719
+ const u = i(o, s);
720
+ if (u !== 0)
721
+ return u;
722
+ }
723
+ return 0;
724
+ })
725
+ );
726
+ }
727
+ function lt(e, n = null) {
728
+ const r = p(e).slice();
729
+ if (l(n))
730
+ return ae(
731
+ r,
732
+ n
733
+ );
734
+ if (z(n))
735
+ return r.sort((o, s) => O(o, s));
736
+ if (N(n))
737
+ return r.sort((o, s) => {
738
+ const i = $(
739
+ o,
740
+ n
741
+ ), u = $(
742
+ s,
743
+ n
744
+ );
745
+ return O(i, u);
746
+ });
747
+ if (b(n)) {
748
+ const o = r.map((s, i) => ({
749
+ value: s,
750
+ sortKey: n(s, i)
751
+ }));
752
+ return o.sort((s, i) => O(s.sortKey, i.sortKey)), o.map((s) => s.value);
753
+ }
754
+ return r;
755
+ }
756
+ function ht(e, n) {
757
+ const r = p(e).slice();
758
+ if (l(n))
759
+ return ae(
760
+ r,
761
+ n,
762
+ !0
763
+ );
764
+ if (z(n))
765
+ return r.sort((o, s) => O(s, o));
766
+ if (N(n))
767
+ return r.sort((o, s) => {
768
+ const i = $(
769
+ o,
770
+ n
771
+ ), u = $(
772
+ s,
773
+ n
774
+ );
775
+ return O(u, i);
776
+ });
777
+ if (b(n)) {
778
+ const o = r.map((s, i) => ({
779
+ value: s,
780
+ sortKey: n(s, i)
781
+ }));
782
+ return o.sort((s, i) => O(i.sortKey, s.sortKey)), o.map((s) => s.value);
783
+ }
784
+ return r;
785
+ }
786
+ function pt(e, n = !1) {
787
+ return D(e, n);
788
+ }
789
+ function D(e, n) {
790
+ const t = n === !0 || n === te.Descending;
791
+ if (!a(e) && !w(e))
792
+ return e;
793
+ let r;
794
+ if (l(e) ? r = e.slice() : r = { ...e }, l(r)) {
795
+ for (let o = 0; o < r.length; o++) {
796
+ const s = r[o];
797
+ (l(s) || A(s)) && (r[o] = D(s, t));
798
+ }
799
+ r.sort((o, s) => {
800
+ const i = O(o, s);
801
+ return t ? -i : i;
802
+ });
803
+ } else {
804
+ const o = Object.entries(r);
805
+ for (const [u, c] of o)
806
+ (l(c) || A(c)) && d(r, u, D(c, t));
807
+ const s = {};
808
+ if (o.every(([u], c) => u === String(c)))
809
+ return o.map(([u]) => r[u]).sort((u, c) => {
810
+ const h = O(u, c);
811
+ return t ? -h : h;
812
+ }).forEach((u, c) => {
813
+ d(s, String(c), u);
814
+ }), s;
815
+ const i = o.sort(([u], [c]) => {
816
+ const h = O(u, c);
817
+ return t ? -h : h;
818
+ });
819
+ for (const [u] of i)
820
+ d(s, u, r[u]);
821
+ r = s;
822
+ }
823
+ return r;
824
+ }
825
+ function at(e) {
826
+ return D(e, te.Descending);
827
+ }
828
+ function mt(e, n, t, ...r) {
829
+ if (!a(e) || E(e))
830
+ return [];
831
+ const o = [];
832
+ for (const u of r)
833
+ a(u) || w(u) ? o.push(
834
+ ...Object.values(u)
835
+ ) : o.push(u);
836
+ const { start: s, count: i } = Xe(e.length, n, t);
837
+ return e.splice(s, i, ...o);
838
+ }
839
+ function on(e, n) {
840
+ const t = p(e), r = _(n), o = t.findIndex(
841
+ (s, i) => !v(r(s, i))
842
+ );
843
+ return t.slice(0, o === -1 ? t.length : o);
844
+ }
845
+ function gt(e, n) {
846
+ const t = _(n);
847
+ return on(
848
+ p(e),
849
+ (r, o) => v(t(r, o))
850
+ );
851
+ }
852
+ function vt(e, n, t = null) {
853
+ const r = M(e, n, t);
854
+ if (!N(r))
855
+ throw new j(
856
+ `Array value for key [${n}] must be a string, ${L(r)} found.`
857
+ );
858
+ return r;
859
+ }
860
+ function yt(e) {
861
+ if (!a(e) && !w(e))
862
+ return "";
863
+ let n;
864
+ l(e) ? n = { ...e } : n = e;
865
+ const t = [];
866
+ for (const [r, o] of Object.entries(n))
867
+ Y(r) ? t.push(ue(o)) : v(o) || t.push(r);
868
+ return t.join(" ");
869
+ }
870
+ function bt(e) {
871
+ if (!a(e) && !w(e))
872
+ return "";
873
+ let n;
874
+ l(e) ? n = { ...e } : n = e;
875
+ const t = [];
876
+ for (const [r, o] of Object.entries(n))
877
+ Y(r) ? t.push(k(ue(o), ";")) : v(o) || t.push(k(r, ";"));
878
+ return t.join(" ");
879
+ }
880
+ function me(e, n) {
881
+ const t = p(e), r = [];
882
+ for (let o = 0; o < t.length; o++) {
883
+ const s = t[o];
884
+ v(n(s, o)) || r.push(s);
885
+ }
886
+ return r;
887
+ }
888
+ function wt(e, n) {
889
+ return me(e, (t, r) => v(n(t, r)));
890
+ }
891
+ function dt(e, n) {
892
+ const t = p(e);
893
+ for (const [r, o] of Object.entries(K(n)))
894
+ if (q(r)) {
895
+ for (; t.length < Number(r); )
896
+ t.push(void 0);
897
+ t[Number(r)] = o;
898
+ }
899
+ return t;
900
+ }
901
+ function Ot(e, n) {
902
+ const t = p(e), r = Object.fromEntries(
903
+ Object.entries(K(n)).filter(
904
+ ([i]) => q(i)
905
+ )
906
+ ), o = Ie(
907
+ { ...t },
908
+ r
909
+ ), s = [];
910
+ for (const [i, u] of Object.entries(o)) {
911
+ for (; s.length < Number(i); )
912
+ s.push(void 0);
913
+ s.push(u);
914
+ }
915
+ return s;
916
+ }
917
+ function $t(e) {
918
+ return p(e).slice().reverse();
919
+ }
920
+ function At(e, n, t) {
921
+ const r = qe(n), o = p(e), s = o.length, i = Math.abs(r);
922
+ if (i <= s)
923
+ return o;
924
+ const u = i - s, c = Array(u).fill(t);
925
+ return r < 0 ? [...c, ...o] : [...o, ...c];
926
+ }
927
+ function jt(e, n) {
928
+ const t = p(e), r = [], o = [];
929
+ for (let s = 0; s < t.length; s++) {
930
+ const i = t[s];
931
+ v(n(i, s)) ? o.push(i) : r.push(i);
932
+ }
933
+ return [r, o];
934
+ }
935
+ function Kt(e) {
936
+ return me(e, (n) => !g(n));
937
+ }
938
+ function sn(e, n, t) {
939
+ return b(e) ? e : (r) => J(ge(r, e), n, t);
940
+ }
941
+ function ge(e, n) {
942
+ return g(n) || y(n) ? e : $(e, n) ?? null;
943
+ }
944
+ function B(e, n, ...t) {
945
+ const [r, o] = t;
946
+ if (t.length > 1 || t.length === 1 && !Q(r) && !y(r)) {
947
+ const i = t.length > 1 ? String(r) : "=";
948
+ return B(
949
+ e,
950
+ sn(
951
+ n,
952
+ i,
953
+ t.length > 1 ? o : r
954
+ )
955
+ );
956
+ }
957
+ const s = r === !0;
958
+ if (!l(e))
959
+ return !1;
960
+ if (b(n)) {
961
+ const i = n;
962
+ for (const [u, c] of e.entries())
963
+ if (!v(i(c, u)))
964
+ return !0;
965
+ return !1;
966
+ }
967
+ return s ? e.some((i) => H(i, n)) : e.some((i) => W(i, n));
968
+ }
969
+ function It(e, n, t) {
970
+ return y(t) ? B(e, n, !0) : B(
971
+ e,
972
+ (r) => H(ge(r, n), t)
973
+ );
974
+ }
975
+ function xt(e, n) {
976
+ return l(e) ? b(n) ? e.filter(
977
+ (t, r) => !v(n(t, r))
978
+ ) : e.filter((t) => !v(t)) : [];
979
+ }
980
+ function St(e) {
981
+ return g(e) ? [] : l(e) ? e : [e];
982
+ }
983
+ function Mt(e) {
984
+ return a(e) ? Array.from(e.keys()) : [];
985
+ }
986
+ function Et(e) {
987
+ return a(e) ? Array.from(e.values()) : [];
988
+ }
989
+ function Nt(e, n) {
990
+ if (!a(e))
991
+ return [];
992
+ const t = T(n), r = ce(t), o = [];
993
+ for (const s of e)
994
+ r(s) || o.push(s);
995
+ return o;
996
+ }
997
+ function Pt(e, n) {
998
+ if (!a(e))
999
+ return [];
1000
+ const t = K(n);
1001
+ return p(e).filter(
1002
+ (r, o) => !Object.hasOwn(t, o) || !V(r, t[o])
1003
+ );
1004
+ }
1005
+ function Ct(e, n) {
1006
+ if (!a(e))
1007
+ return [];
1008
+ const t = K(n);
1009
+ return p(e).filter(
1010
+ (r, o) => !Object.hasOwn(t, o)
1011
+ );
1012
+ }
1013
+ function Rt(e, n, t) {
1014
+ if (!a(e))
1015
+ return [];
1016
+ const r = T(n);
1017
+ return p(e).filter(
1018
+ (o) => !r.some((s) => t(o, s))
1019
+ );
1020
+ }
1021
+ function Ut(e, n, t) {
1022
+ return ve(e, n, t, !0);
1023
+ }
1024
+ function Dt(e, n, t) {
1025
+ return ve(e, n, t, !1);
1026
+ }
1027
+ function ve(e, n, t, r) {
1028
+ if (!a(e))
1029
+ return [];
1030
+ const o = K(n), s = Object.keys(o);
1031
+ return p(e).filter((i, u) => {
1032
+ const c = s.find(
1033
+ (h) => t(u, C(h))
1034
+ );
1035
+ return c === void 0 || r && !V(o[c], i);
1036
+ });
1037
+ }
1038
+ function un(e, n, t = null) {
1039
+ if (!a(e))
1040
+ return [];
1041
+ const r = p(e), o = T(n), s = [];
1042
+ if (b(t)) {
1043
+ for (const u of r)
1044
+ o.some((c) => t(u, c)) && s.push(u);
1045
+ return s;
1046
+ }
1047
+ const i = ce(o);
1048
+ for (const u of r)
1049
+ i(u) && s.push(u);
1050
+ return s;
1051
+ }
1052
+ function Lt(e, n, t) {
1053
+ return un(
1054
+ e,
1055
+ n,
1056
+ t
1057
+ );
1058
+ }
1059
+ function Wt(e, n) {
1060
+ if (!a(e))
1061
+ return [];
1062
+ const t = K(n);
1063
+ return p(e).filter(
1064
+ (r, o) => Object.hasOwn(t, o) && V(r, t[o])
1065
+ );
1066
+ }
1067
+ function Tt(e, n, t) {
1068
+ if (!a(e))
1069
+ return [];
1070
+ const r = Object.entries(K(n));
1071
+ return p(e).filter(
1072
+ (o, s) => r.some(
1073
+ ([i, u]) => (
1074
+ // Only the keyed overload's operand yields a string key, and its callback accepts one.
1075
+ t(s, C(i)) && V(o, u)
1076
+ )
1077
+ )
1078
+ );
1079
+ }
1080
+ function Vt(e, n) {
1081
+ if (!a(e))
1082
+ return [];
1083
+ const t = K(n);
1084
+ return p(e).filter(
1085
+ (r, o) => Object.hasOwn(t, o)
1086
+ );
1087
+ }
1088
+ function _(e) {
1089
+ return b(e) ? e : (n) => H(n, e);
1090
+ }
1091
+ export {
1092
+ a as accessible,
1093
+ mn as add,
1094
+ gn as arrayItem,
1095
+ an as arrayable,
1096
+ vn as boolean,
1097
+ yn as chunk,
1098
+ bn as chunkBy,
1099
+ Ge as chunkWhile,
1100
+ wn as collapse,
1101
+ dn as combine,
1102
+ B as contains,
1103
+ It as containsStrict,
1104
+ On as crossJoin,
1105
+ Nt as diff,
1106
+ Pt as diffAssoc,
1107
+ Ut as diffAssocUsing,
1108
+ Ct as diffKeys,
1109
+ Dt as diffKeysUsing,
1110
+ Rt as diffUsing,
1111
+ $n as divide,
1112
+ An as dot,
1113
+ Tn as every,
1114
+ xn as except,
1115
+ Sn as exceptValues,
1116
+ Mn as exists,
1117
+ xt as filter,
1118
+ En as first,
1119
+ nn as flatten,
1120
+ Cn as flip,
1121
+ Rn as float,
1122
+ le as forget,
1123
+ Un as from,
1124
+ Dn as get,
1125
+ pe as has,
1126
+ Ln as hasAll,
1127
+ Wn as hasAny,
1128
+ _n as integer,
1129
+ un as intersect,
1130
+ Wt as intersectAssoc,
1131
+ Tt as intersectAssocUsing,
1132
+ Vt as intersectByKeys,
1133
+ Lt as intersectUsing,
1134
+ Fn as join,
1135
+ Jn as keyBy,
1136
+ Mt as keys,
1137
+ Nn as last,
1138
+ Hn as map,
1139
+ Gn as mapSpread,
1140
+ Zn as mapWithKeys,
1141
+ Qn as only,
1142
+ Xn as onlyValues,
1143
+ At as pad,
1144
+ jt as partition,
1145
+ zn as pluck,
1146
+ Yn as pop,
1147
+ kn as prepend,
1148
+ Bn as prependKeysWith,
1149
+ et as pull,
1150
+ st as push,
1151
+ nt as query,
1152
+ tt as random,
1153
+ wt as reject,
1154
+ dt as replace,
1155
+ Ot as replaceRecursive,
1156
+ $t as reverse,
1157
+ qn as select,
1158
+ ot as set,
1159
+ rt as shift,
1160
+ it as shuffle,
1161
+ ut as skipUntil,
1162
+ rn as skipWhile,
1163
+ ct as slice,
1164
+ ft as sole,
1165
+ Vn as some,
1166
+ lt as sort,
1167
+ ht as sortDesc,
1168
+ pt as sortRecursive,
1169
+ at as sortRecursiveDesc,
1170
+ mt as splice,
1171
+ vt as string,
1172
+ Pn as take,
1173
+ on as takeUntil,
1174
+ gt as takeWhile,
1175
+ yt as toCssClasses,
1176
+ bt as toCssStyles,
1177
+ jn as undot,
1178
+ Kn as union,
1179
+ In as unshift,
1180
+ Et as values,
1181
+ me as where,
1182
+ Kt as whereNotNull,
1183
+ St as wrap
1184
+ };