@catstral/levy-utils 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +147 -7
- package/dist/array/index.d.ts +1 -0
- package/dist/array/utils/sum/index.d.ts +13 -0
- package/dist/callback/index.d.ts +2 -0
- package/dist/callback/utils/compose/index.d.ts +43 -0
- package/dist/callback/utils/preset/index.d.ts +13 -0
- package/dist/levyUtils.cjs +2 -2
- package/dist/levyUtils.js +150 -104
- package/dist/misc/index.d.ts +3 -0
- package/dist/misc/utils/match/index.d.ts +22 -0
- package/dist/misc/utils/readOnly/index.d.ts +47 -0
- package/dist/misc/utils/values/index.d.ts +13 -0
- package/dist/object/index.d.ts +1 -0
- package/dist/object/utils/extend/index.d.ts +14 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
# levy-utils
|
|
2
|
-
levy-utils is a lightweight, dependency-light library of common JS/TS utility functions covering everyday needs: array/object manipulation, type checks, async helpers, and value conversion.
|
|
1
|
+
# @catstral/levy-utils
|
|
2
|
+
@catstral/levy-utils is a lightweight, dependency-light library of common JS/TS utility functions covering everyday needs: array/object manipulation, type checks, async helpers, and value conversion.
|
|
3
3
|
|
|
4
4
|
## How to install
|
|
5
5
|
Install with a package manager
|
|
6
6
|
```bash
|
|
7
7
|
# using npm
|
|
8
|
-
npm install levy-utils
|
|
8
|
+
npm install @catstral/levy-utils
|
|
9
9
|
|
|
10
10
|
# using yarn
|
|
11
|
-
yarn add levy-utils
|
|
11
|
+
yarn add @catstral/levy-utils
|
|
12
12
|
|
|
13
13
|
# using pnpm
|
|
14
|
-
pnpm add levy-utils
|
|
14
|
+
pnpm add @catstral/levy-utils
|
|
15
15
|
|
|
16
16
|
# using bun
|
|
17
|
-
bun add levy-utils
|
|
17
|
+
bun add @catstral/levy-utils
|
|
18
18
|
```
|
|
19
19
|
|
|
20
20
|
## Usage
|
|
21
21
|
```ts
|
|
22
|
-
import { range, sift, toggle } from "levy-utils";
|
|
22
|
+
import { range, sift, toggle } from "@catstral/levy-utils";
|
|
23
23
|
```
|
|
24
24
|
|
|
25
25
|
## Utils
|
|
@@ -31,22 +31,28 @@ A list of all the utilities supported:
|
|
|
31
31
|
- [list](#liststartorlength-end-options)
|
|
32
32
|
- [select](#selectlist-filter-mapper)
|
|
33
33
|
- [sift](#siftlist)
|
|
34
|
+
- [sum](#sumlist-mapper)
|
|
34
35
|
- [toggle](#togglelist-itemtotoggle-options)
|
|
35
36
|
- [Callback utilities](#callback-utilities)
|
|
36
37
|
- [chain](#chaincallbacks)
|
|
38
|
+
- [compose](#composecallbacks)
|
|
37
39
|
- [defer](#defercallback)
|
|
40
|
+
- [preset](#presetcallback-parameters)
|
|
38
41
|
- [retry](#retrycallback-options)
|
|
39
42
|
- [Miscellaneous utilities](#miscellaneous-utilities)
|
|
40
43
|
- [compute / isComputation](#computevalue-args--iscomputationvalue)
|
|
41
44
|
- [isEmpty](#isemptyvalue)
|
|
42
45
|
- [isPrimitive](#isprimitivevalue)
|
|
46
|
+
- [match](#matchvalue-clause-fallback)
|
|
43
47
|
- [range](#rangestartorlength-end-options)
|
|
44
48
|
- [sleep](#sleepdelay)
|
|
49
|
+
- [values](#valuestarget)
|
|
45
50
|
- [Number utilities](#number-utilities)
|
|
46
51
|
- [toFloat](#tofloatvalue-fallback)
|
|
47
52
|
- [toInt](#tointvalue-fallback)
|
|
48
53
|
- [Object utilities](#object-utilities)
|
|
49
54
|
- [entries](#entriesvalue)
|
|
55
|
+
- [extend](#extendvalue-other)
|
|
50
56
|
- [isObject](#isobjectitem)
|
|
51
57
|
- [keys](#keysvalue)
|
|
52
58
|
- [omit](#omitobject-keys)
|
|
@@ -148,6 +154,27 @@ sift([1, 0, 2, null, 3, undefined, false]);
|
|
|
148
154
|
// [1, 2, 3]
|
|
149
155
|
```
|
|
150
156
|
|
|
157
|
+
#### `sum(list, mapper?)`
|
|
158
|
+
Sums a list of items into a total number.
|
|
159
|
+
|
|
160
|
+
```ts
|
|
161
|
+
sum([1, 2, 3]);
|
|
162
|
+
// Expected output:
|
|
163
|
+
// 6
|
|
164
|
+
|
|
165
|
+
sum([1, 2, 3], (n) => n * 2);
|
|
166
|
+
// Expected output:
|
|
167
|
+
// 12
|
|
168
|
+
|
|
169
|
+
sum([false, true, "", "Hello", null, {}, undefined, []]);
|
|
170
|
+
// Expected output:
|
|
171
|
+
// 4
|
|
172
|
+
|
|
173
|
+
sum(["3", "4", "5"], (item) => Number.parseInt(item, 10));
|
|
174
|
+
// Expected output:
|
|
175
|
+
// 12
|
|
176
|
+
```
|
|
177
|
+
|
|
151
178
|
#### `toggle(list, itemToToggle, options?)`
|
|
152
179
|
Toggles a value in an array: removes it if present, adds it if not.
|
|
153
180
|
|
|
@@ -200,6 +227,24 @@ chain(() => true, (value: boolean) => value ? "true" : "false");
|
|
|
200
227
|
// "true"
|
|
201
228
|
```
|
|
202
229
|
|
|
230
|
+
#### `compose(...callbacks)`
|
|
231
|
+
Turns many callbacks into a single re-usable callback.
|
|
232
|
+
|
|
233
|
+
```ts
|
|
234
|
+
const fn = compose(
|
|
235
|
+
(n: number) => n + 1,
|
|
236
|
+
(n: number) => n * 2,
|
|
237
|
+
);
|
|
238
|
+
|
|
239
|
+
fn(2);
|
|
240
|
+
// Expected output:
|
|
241
|
+
// 6
|
|
242
|
+
|
|
243
|
+
fn(5);
|
|
244
|
+
// Expected output:
|
|
245
|
+
// 12
|
|
246
|
+
```
|
|
247
|
+
|
|
203
248
|
#### `defer(callback)`
|
|
204
249
|
Defers a callback to the next execution cycle.
|
|
205
250
|
|
|
@@ -207,6 +252,24 @@ Defers a callback to the next execution cycle.
|
|
|
207
252
|
defer(() => console.log("runs after the current call stack clears"));
|
|
208
253
|
```
|
|
209
254
|
|
|
255
|
+
#### `preset(callback, parameters)`
|
|
256
|
+
Presets the parameters of a callback with a callback that computes its arguments.
|
|
257
|
+
|
|
258
|
+
```ts
|
|
259
|
+
const fn = preset(
|
|
260
|
+
Number.parseInt,
|
|
261
|
+
(value: string): [string, number] => [value, 10],
|
|
262
|
+
);
|
|
263
|
+
|
|
264
|
+
fn("10");
|
|
265
|
+
// Expected output:
|
|
266
|
+
// 10
|
|
267
|
+
|
|
268
|
+
fn("3.2");
|
|
269
|
+
// Expected output:
|
|
270
|
+
// 3
|
|
271
|
+
```
|
|
272
|
+
|
|
210
273
|
#### `retry(callback, options?)`
|
|
211
274
|
Retries an async (or sync) callback until it succeeds or the maximum number of attempts is reached.
|
|
212
275
|
|
|
@@ -289,6 +352,35 @@ isPrimitive({});
|
|
|
289
352
|
// false
|
|
290
353
|
```
|
|
291
354
|
|
|
355
|
+
#### `match(value, clause, fallback?)`
|
|
356
|
+
Matches a value to a clause that return a value
|
|
357
|
+
and returns a fallback if none of the cases match.
|
|
358
|
+
|
|
359
|
+
```ts
|
|
360
|
+
const fn = (value: string) => {
|
|
361
|
+
return match(
|
|
362
|
+
value,
|
|
363
|
+
{
|
|
364
|
+
A: 1,
|
|
365
|
+
B: 2,
|
|
366
|
+
},
|
|
367
|
+
-1
|
|
368
|
+
);
|
|
369
|
+
};
|
|
370
|
+
|
|
371
|
+
fn("A");
|
|
372
|
+
// Expected output:
|
|
373
|
+
// 1
|
|
374
|
+
|
|
375
|
+
fn("B");
|
|
376
|
+
// Expected output:
|
|
377
|
+
// 2
|
|
378
|
+
|
|
379
|
+
fn("C");
|
|
380
|
+
// Expected output:
|
|
381
|
+
// -1
|
|
382
|
+
```
|
|
383
|
+
|
|
292
384
|
#### `range(startOrLength, end?, options?)`
|
|
293
385
|
Returns a generator that yields values over a specified range (inclusive), optionally stepped and/or mapped to another value.
|
|
294
386
|
|
|
@@ -331,6 +423,35 @@ await sleep(1000);
|
|
|
331
423
|
// waits 1 second
|
|
332
424
|
```
|
|
333
425
|
|
|
426
|
+
#### `values(target)`
|
|
427
|
+
Returns an array of values based on the given target.
|
|
428
|
+
|
|
429
|
+
```ts
|
|
430
|
+
values([1, 2, 3]);
|
|
431
|
+
// Expected output:
|
|
432
|
+
// [1, 2, 3]
|
|
433
|
+
|
|
434
|
+
values(new Set([4, 5, 6]));
|
|
435
|
+
// Expected output:
|
|
436
|
+
// [4, 5, 6]
|
|
437
|
+
|
|
438
|
+
values({
|
|
439
|
+
A: "a",
|
|
440
|
+
B: "b",
|
|
441
|
+
C: "c",
|
|
442
|
+
});
|
|
443
|
+
// Expected output:
|
|
444
|
+
// ["a", "b", "c"]
|
|
445
|
+
|
|
446
|
+
values(new Map([
|
|
447
|
+
["D", "d"],
|
|
448
|
+
["E", "e"],
|
|
449
|
+
["F", "f"],
|
|
450
|
+
]));
|
|
451
|
+
// Expected output:
|
|
452
|
+
// ["d", "e", "f"]
|
|
453
|
+
```
|
|
454
|
+
|
|
334
455
|
<!-- !SECTION -->
|
|
335
456
|
<!-- SECTION: Number utils -->
|
|
336
457
|
|
|
@@ -385,6 +506,25 @@ entries({
|
|
|
385
506
|
// [["a", 1], ["b", "two"]] (typed as [K, T[K]][])
|
|
386
507
|
```
|
|
387
508
|
|
|
509
|
+
#### `extend(value, other)`
|
|
510
|
+
Extends an object with another object.
|
|
511
|
+
|
|
512
|
+
```ts
|
|
513
|
+
extend(
|
|
514
|
+
{
|
|
515
|
+
key: "value",
|
|
516
|
+
},
|
|
517
|
+
{
|
|
518
|
+
foo: "bar",
|
|
519
|
+
},
|
|
520
|
+
);
|
|
521
|
+
// Expected output:
|
|
522
|
+
// {
|
|
523
|
+
// key: "value",
|
|
524
|
+
// foo: "bar",
|
|
525
|
+
// }
|
|
526
|
+
```
|
|
527
|
+
|
|
388
528
|
#### `isObject(item)`
|
|
389
529
|
Checks if a value is an object, excluding arrays.
|
|
390
530
|
|
package/dist/array/index.d.ts
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sums a list of items into a total number.
|
|
3
|
+
*
|
|
4
|
+
* If no mapper is specified, non-numeric values are converted to `1` if truthy and `0` if falsey.
|
|
5
|
+
*
|
|
6
|
+
* The time complexity for this is `O(n)` where `n` is the amount of items in the list.
|
|
7
|
+
*
|
|
8
|
+
* @template T
|
|
9
|
+
* @param {T[]} list The list of values to sum up
|
|
10
|
+
* @param {(item: T) => number} mapper A callback to convert an item to be summable
|
|
11
|
+
* @returns The sum of the list
|
|
12
|
+
*/
|
|
13
|
+
export declare function sum<const T>(list: T[], mapper?: (item: T) => number): number;
|
package/dist/callback/index.d.ts
CHANGED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export type ComposeCallback<V = never> = ((previousValue: V) => unknown) | (() => unknown);
|
|
2
|
+
export type ComposeEntry = (...args: never[]) => unknown;
|
|
3
|
+
/**
|
|
4
|
+
* @private
|
|
5
|
+
*/
|
|
6
|
+
type _ComposeResult<T extends ComposeCallback[], Prev> = T extends [
|
|
7
|
+
infer Current extends ComposeCallback<Prev>,
|
|
8
|
+
...infer Rest extends ComposeCallback[]
|
|
9
|
+
] ? _ComposeResult<Rest, ReturnType<Current>> : Prev;
|
|
10
|
+
export type ComposeResult<T extends unknown[]> = T extends [
|
|
11
|
+
infer Entry extends ComposeEntry,
|
|
12
|
+
...infer Rest extends ComposeCallback[]
|
|
13
|
+
] ? _ComposeResult<Rest, ReturnType<Entry>> : undefined;
|
|
14
|
+
/**
|
|
15
|
+
* @private
|
|
16
|
+
*/
|
|
17
|
+
type _Compose<T extends unknown[], Prev> = T extends [
|
|
18
|
+
infer Current extends ComposeCallback<Prev>,
|
|
19
|
+
...infer Rest extends unknown[]
|
|
20
|
+
] ? [Current, ..._Compose<Rest, ReturnType<Current>>] : T extends [] ? [] : never;
|
|
21
|
+
export type Compose<T extends unknown[]> = number extends T["length"] ? T : T extends [infer Entry extends ComposeEntry, ...infer Rest extends unknown[]] ? [Entry, ..._Compose<Rest, ReturnType<Entry>>] : [];
|
|
22
|
+
export type ComposeParameters<T extends unknown[]> = T extends [infer Entry extends ComposeEntry, ...unknown[]] ? Parameters<Entry> : [];
|
|
23
|
+
/**
|
|
24
|
+
* Turns many callbacks into a single re-usable callback.
|
|
25
|
+
*
|
|
26
|
+
* Callbacks accept the result of the previous callback as an arugment,
|
|
27
|
+
* returning the result of the final callback.
|
|
28
|
+
*
|
|
29
|
+
* NOTE: Due to a typescript limitation the arguments of the composed value
|
|
30
|
+
* require a hint in order to infer the argument correctly (it does not allow
|
|
31
|
+
* passing an invalid arugment type however)
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* // Note the type hint for the argument
|
|
35
|
+
* const composed = compose((value: number) => value + 1, (value: number) => value * 2);
|
|
36
|
+
* // This results in `composed(1)` being `4`, and can be called again with a different value
|
|
37
|
+
*
|
|
38
|
+
* @template {ComposeEntry[]} T
|
|
39
|
+
* @param {Compose<T>} callbacks The callbacks to compose together
|
|
40
|
+
* @returns {(...args: ComposeParameters<T>) => ComposeResult<T>} A callback that runs the composed callbacks and returns the final result
|
|
41
|
+
*/
|
|
42
|
+
export declare function compose<const T extends ComposeEntry[]>(...callbacks: Compose<T>): (...args: ComposeParameters<T>) => ComposeResult<T>;
|
|
43
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Presets the parameters of a callback with a callback that computes its arguments.
|
|
3
|
+
*
|
|
4
|
+
* The time complexity for this is `O(1)`.
|
|
5
|
+
*
|
|
6
|
+
* @template {(...args: never[]) => unknown} T
|
|
7
|
+
* @template {unknown[]} [Args=never[]]
|
|
8
|
+
* @template {Parameters<T>} [Params=Parameters<T>]
|
|
9
|
+
* @param {T} callback The callback to preset the parameters for
|
|
10
|
+
* @param {Computable<Params, Args>} parameters The parameters or callback that computes parameters to preset
|
|
11
|
+
* @returns {(...args: Args) => ReturnType<T>} A callback that runs the input `callback` with the preset parameters
|
|
12
|
+
*/
|
|
13
|
+
export declare function preset<const T extends (...args: never[]) => unknown, const Args extends unknown[] = never[]>(callback: T, parameters: (...args: Args) => Parameters<T>): (...args: Args) => ReturnType<T>;
|
package/dist/levyUtils.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,o)=>(o=n==null?{}:e(i(n)),s(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n)),l=class extends Error{},u=class extends l{util=`cluster`};function d(e,t){if(t<1)throw new u(`Cluster size cannot be smaller than 1`);if(!Array.isArray(e))throw new u(`Items must be an array`);let n=[[]],r=0;for(let i of e)n[r].length<t?n[r].push(i):(r+=1,n[r]=[i]);return n}function f(e,t){let n={};for(let r of e){let e=t(r);n[e]=(n[e]??0)+1}return n}function p(e,t){let n=[[],[]];for(let r of e)n[+!t(r)].push(r);return n}function m(e){return typeof e==`function`}function h(e,...t){return m(e)?e(...t):e}var g=class extends l{util=`list`};function _(e,t,n){let r=typeof t==`number`?e:0,i=typeof t==`number`?t:e,a=r>i;if(n&&typeof n.step==`number`){if(n.step===0)throw new g(`Step cannot be 0, that would cause the list to become infinite`);if(a&&n.step>0)throw new g(`Given start and end should cause the list to traverse negatively, but step is specified to traverse positively`);if(!a&&n.step<0)throw new g(`Given start and end should cause the list to traverse positively, but step is specified to traverse negatively`)}let o=[];for(;a?r>=i:r<=i;)n?.valueMapper===void 0?o.push(r):o.push(h(n.valueMapper,r)),r+=n?.step??(a?-1:1);return o}function v(e,t,n){let r=[];for(let[i,a]of e.entries())if(t(a,i)){let e=n(a,r.length,i);r.push(e)}return r}function y(e){return e.filter(e=>!!e)}function b(e,t,n){let r=e=>n?.toKey?.(e)??e,i=e.findIndex(e=>r(e)===r(t)),a=[...e];if(i===-1)switch(n?.strategy??`APPEND`){case`APPEND`:a.push(t);break;case`PREPEND`:a.unshift(t)}else a.splice(i,1);return a}function x(...e){let t;for(let n of e)t=n(t);return t}function S(e){setTimeout(()=>{e()},0)}async function C(e){return new Promise(t=>{setTimeout(t,Math.max(e,0))})}var w=class extends l{util=`retry`};async function T(e,t){let n=t?.attempts??3,r=t?.backoff??!1,i=t?.delay??1e3,a=0;for(;;){a+=1;try{return await e()}catch(e){if(a>=n)throw new w(`Callback failed too often, stopping retry loop`,{cause:e});t?.onRetry?.(e,a),await C(i)}r&&(i*=2)}}var E=class extends Error{};function D(e){return typeof e==`function`}function O(e,...t){return D(e)?e(...t):e}function k(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function A(e){return e==null?!0:typeof e==`string`?e.length===0:k(e)?Object.keys(e).length===0:Array.isArray(e)?e.length===0:!1}function j(e){if(e===null)return!0;switch(typeof e){case`boolean`:case`number`:case`string`:case`symbol`:case`undefined`:return!0;default:return!1}}var M=class extends l{util=`range`};function*N(e,t,n){let r=typeof t==`number`?e:0,i=typeof t==`number`?t:e,a=r>i;if(n&&typeof n.step==`number`){if(n.step===0)throw new M(`Step cannot be 0, that would cause the range to become infinite`);if(a&&n.step>0)throw new M(`Given start and end should cause the range to traverse negatively, but step is specified to traverse positively`);if(!a&&n.step<0)throw new M(`Given start and end should cause the range to traverse positively, but step is specified to traverse negatively`)}for(;a?r>=i:r<=i;)n?.valueMapper===void 0?yield r:yield h(n.valueMapper,r),r+=n?.step??(a?-1:1)}async function ee(e){return new Promise(t=>{setTimeout(t,Math.max(e,0))})}function te(e,t=0){let n;switch(typeof e){case`boolean`:n=+!!e;break;case`number`:case`bigint`:n=Number.parseFloat(e.toString());break;case`string`:n=Number.parseFloat(e);break;default:return t}return Number.isNaN(n)||!Number.isFinite(n)?t:n}function ne(e,t=0){let n=Math.trunc(t),r;switch(typeof e){case`boolean`:r=+!!e;break;case`number`:case`bigint`:r=Number.parseInt(e.toString(),10);break;case`string`:r=Number.parseInt(e,10);break;default:return n}return Number.isNaN(r)||!Number.isFinite(r)?n:r}function re(e){return Object.entries(e)}function ie(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ae(e){return Object.keys(e)}function oe(e,t){let n={...e},r=Array.isArray(t)?t:[t];for(let e of r)delete n[e];return n}function se(e,t){let n={},r=Array.isArray(t)?t:[t];for(let t of r)n[t]=e[t];return n}function ce(e,t){if(t?.parser)return t.parser(e);let n=t?.groupNumbers??!1,r=t?.groupUppercaseLetters??!0,i=[],a=/[A-Z]/,o=/[0-9]/,s=/[\s-_]/,c=``,l=()=>{i.push(c),c=``};for(let t of e.trim()){let e=c.at(-1);if(e===void 0){if(s.test(t))continue;c+=t;continue}if(s.test(t)){l();continue}if(n){if(o.test(t)){if(o.test(e)){c+=t;continue}l(),c+=t;continue}if(o.test(e)){l(),c+=t;continue}}if(a.test(t)){if(r&&a.test(e)){c+=t;continue}l(),c+=t;continue}let u=c.at(-2);r&&a.test(e)&&u!==void 0&&a.test(u)&&(i.push(c.slice(0,-1)),c=e),c+=t}return c.length>0&&l(),i}function P(e,t){let n=ce(e,t),r=n.length-1;return n.reduce((e,n,i)=>(e+=t.transform(n,i),i!==r&&(e+=t.seperator),e),``)}function F(e,t){return P(e,{...t,seperator:``,transform:(e,t)=>t===0?e.toLowerCase():`${e.slice(0,1).toUpperCase()}${e.slice(1).toLowerCase()}`})}function I(e){return`${e.slice(0,1).toUpperCase()}${e.slice(1)}`}function L(e,t){return P(e,{...t,seperator:`-`,transform:e=>`${e.slice(0,1).toUpperCase()}${e.slice(1).toLowerCase()}`})}function R(e,t){return P(e,{...t,seperator:`-`,transform:e=>t?.screaming?e.toUpperCase():e.toLowerCase()})}function z(e,t){return R(e,{...t,screaming:!0})}function B(e){return e.toLowerCase()}function V(e,t){return P(e,{...t,seperator:``,transform:e=>`${e.slice(0,1).toUpperCase()}${e.slice(1)}`})}function H(e,t){return P(e,{...t,seperator:`_`,transform:e=>t?.screaming?e.toUpperCase():e.toLowerCase()})}function U(e,t){return H(e,{...t,screaming:!0})}function W(e,t){return P(e,{...t,seperator:` `,transform:e=>`${e.slice(0,1).toUpperCase()}${e.slice(1)}`})}function le(e){return`${e.slice(0,1).toLowerCase()}${e.slice(1)}`}function ue(e){return e.toUpperCase()}function de(e,t){let n=new URL(e),r=Object.fromEntries(n.searchParams.entries());if(t){let e={};for(let n in t)e[n]=t[n](r[n]);return e}return r}function fe(e){return e.normalize().toLowerCase().replace(/[^\w ]+/g,``).replace(/ +/g,`-`)}var G=c(o(((e,t)=>{var n=function(){this.Diff_Timeout=1,this.Diff_EditCost=4,this.Match_Threshold=.5,this.Match_Distance=1e3,this.Patch_DeleteThreshold=.5,this.Patch_Margin=4,this.Match_MaxBits=32},r=-1,i=1,a=0;n.Diff=function(e,t){return[e,t]},n.prototype.diff_main=function(e,t,r,i){i===void 0&&(i=this.Diff_Timeout<=0?Number.MAX_VALUE:new Date().getTime()+this.Diff_Timeout*1e3);var o=i;if(e==null||t==null)throw Error(`Null input. (diff_main)`);if(e==t)return e?[new n.Diff(a,e)]:[];r===void 0&&(r=!0);var s=r,c=this.diff_commonPrefix(e,t),l=e.substring(0,c);e=e.substring(c),t=t.substring(c),c=this.diff_commonSuffix(e,t);var u=e.substring(e.length-c);e=e.substring(0,e.length-c),t=t.substring(0,t.length-c);var d=this.diff_compute_(e,t,s,o);return l&&d.unshift(new n.Diff(a,l)),u&&d.push(new n.Diff(a,u)),this.diff_cleanupMerge(d),d},n.prototype.diff_compute_=function(e,t,o,s){var c;if(!e)return[new n.Diff(i,t)];if(!t)return[new n.Diff(r,e)];var l=e.length>t.length?e:t,u=e.length>t.length?t:e,d=l.indexOf(u);if(d!=-1)return c=[new n.Diff(i,l.substring(0,d)),new n.Diff(a,u),new n.Diff(i,l.substring(d+u.length))],e.length>t.length&&(c[0][0]=c[2][0]=r),c;if(u.length==1)return[new n.Diff(r,e),new n.Diff(i,t)];var f=this.diff_halfMatch_(e,t);if(f){var p=f[0],m=f[1],h=f[2],g=f[3],_=f[4],v=this.diff_main(p,h,o,s),y=this.diff_main(m,g,o,s);return v.concat([new n.Diff(a,_)],y)}return o&&e.length>100&&t.length>100?this.diff_lineMode_(e,t,s):this.diff_bisect_(e,t,s)},n.prototype.diff_lineMode_=function(e,t,o){var s=this.diff_linesToChars_(e,t);e=s.chars1,t=s.chars2;var c=s.lineArray,l=this.diff_main(e,t,!1,o);this.diff_charsToLines_(l,c),this.diff_cleanupSemantic(l),l.push(new n.Diff(a,``));for(var u=0,d=0,f=0,p=``,m=``;u<l.length;){switch(l[u][0]){case i:f++,m+=l[u][1];break;case r:d++,p+=l[u][1];break;case a:if(d>=1&&f>=1){l.splice(u-d-f,d+f),u=u-d-f;for(var h=this.diff_main(p,m,!1,o),g=h.length-1;g>=0;g--)l.splice(u,0,h[g]);u+=h.length}f=0,d=0,p=``,m=``}u++}return l.pop(),l},n.prototype.diff_bisect_=function(e,t,a){for(var o=e.length,s=t.length,c=Math.ceil((o+s)/2),l=c,u=2*c,d=Array(u),f=Array(u),p=0;p<u;p++)d[p]=-1,f[p]=-1;d[l+1]=0,f[l+1]=0;for(var m=o-s,h=m%2!=0,g=0,_=0,v=0,y=0,b=0;b<c&&!(new Date().getTime()>a);b++){for(var x=-b+g;x<=b-_;x+=2){for(var S=l+x,C=x==-b||x!=b&&d[S-1]<d[S+1]?d[S+1]:d[S-1]+1,w=C-x;C<o&&w<s&&e.charAt(C)==t.charAt(w);)C++,w++;if(d[S]=C,C>o)_+=2;else if(w>s)g+=2;else if(h){var T=l+m-x;if(T>=0&&T<u&&f[T]!=-1){var E=o-f[T];if(C>=E)return this.diff_bisectSplit_(e,t,C,w,a)}}}for(var D=-b+v;D<=b-y;D+=2){for(var T=l+D,E=D==-b||D!=b&&f[T-1]<f[T+1]?f[T+1]:f[T-1]+1,O=E-D;E<o&&O<s&&e.charAt(o-E-1)==t.charAt(s-O-1);)E++,O++;if(f[T]=E,E>o)y+=2;else if(O>s)v+=2;else if(!h){var S=l+m-D;if(S>=0&&S<u&&d[S]!=-1){var C=d[S],w=l+C-S;if(E=o-E,C>=E)return this.diff_bisectSplit_(e,t,C,w,a)}}}}return[new n.Diff(r,e),new n.Diff(i,t)]},n.prototype.diff_bisectSplit_=function(e,t,n,r,i){var a=e.substring(0,n),o=t.substring(0,r),s=e.substring(n),c=t.substring(r),l=this.diff_main(a,o,!1,i),u=this.diff_main(s,c,!1,i);return l.concat(u)},n.prototype.diff_linesToChars_=function(e,t){var n=[],r={};n[0]=``;function i(e){for(var t=``,i=0,o=-1,s=n.length;o<e.length-1;){o=e.indexOf(`
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,o)=>(o=n==null?{}:e(i(n)),s(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n)),l=class extends Error{},u=class extends l{util=`cluster`};function d(e,t){if(t<1)throw new u(`Cluster size cannot be smaller than 1`);if(!Array.isArray(e))throw new u(`Items must be an array`);let n=[[]],r=0;for(let i of e)n[r].length<t?n[r].push(i):(r+=1,n[r]=[i]);return n}function f(e,t){let n={};for(let r of e){let e=t(r);n[e]=(n[e]??0)+1}return n}function p(e,t){let n=[[],[]];for(let r of e)n[+!t(r)].push(r);return n}function m(e){return typeof e==`function`}function h(e,...t){return m(e)?e(...t):e}var g=class extends l{util=`list`};function _(e,t,n){let r=typeof t==`number`?e:0,i=typeof t==`number`?t:e,a=r>i;if(n&&typeof n.step==`number`){if(n.step===0)throw new g(`Step cannot be 0, that would cause the list to become infinite`);if(a&&n.step>0)throw new g(`Given start and end should cause the list to traverse negatively, but step is specified to traverse positively`);if(!a&&n.step<0)throw new g(`Given start and end should cause the list to traverse positively, but step is specified to traverse negatively`)}let o=[];for(;a?r>=i:r<=i;)n?.valueMapper===void 0?o.push(r):o.push(h(n.valueMapper,r)),r+=n?.step??(a?-1:1);return o}function v(e,t,n){let r=[];for(let[i,a]of e.entries())if(t(a,i)){let e=n(a,r.length,i);r.push(e)}return r}function y(e){return e.filter(e=>!!e)}function b(e,t){let n=0;if(t)for(let r of e){let e=t(r);Number.isNaN(e)||(n+=e)}else for(let t of e){if(typeof t==`number`&&!Number.isNaN(t)){n+=t;continue}n+=+!!t}return n}function x(e,t,n){let r=e=>n?.toKey?.(e)??e,i=e.findIndex(e=>r(e)===r(t)),a=[...e];if(i===-1)switch(n?.strategy??`APPEND`){case`APPEND`:a.push(t);break;case`PREPEND`:a.unshift(t)}else a.splice(i,1);return a}function S(...e){let t;for(let n of e)t=n(t);return t}function C(...e){return(...t)=>e.reduce((e,n,r)=>{let i=n;return r===0?i(...t):i(e)},void 0)}function w(e){setTimeout(()=>{e()},0)}function T(e,t){return(...n)=>e(...t(...n))}async function E(e){return new Promise(t=>{setTimeout(t,Math.max(e,0))})}var D=class extends l{util=`retry`};async function O(e,t){let n=t?.attempts??3,r=t?.backoff??!1,i=t?.delay??1e3,a=0;for(;;){a+=1;try{return await e()}catch(e){if(a>=n)throw new D(`Callback failed too often, stopping retry loop`,{cause:e});t?.onRetry?.(e,a),await E(i)}r&&(i*=2)}}function k(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function A(e){return e==null?!0:typeof e==`string`?e.length===0:k(e)?Object.keys(e).length===0:Array.isArray(e)?e.length===0:!1}function ee(e){if(e===null)return!0;switch(typeof e){case`boolean`:case`number`:case`string`:case`symbol`:case`undefined`:return!0;default:return!1}}function te(e,t,n){let r=String(e);return r in t?h(t[r]):m(n)?n(r):n}var j=class extends l{util=`range`};function*ne(e,t,n){let r=typeof t==`number`?e:0,i=typeof t==`number`?t:e,a=r>i;if(n&&typeof n.step==`number`){if(n.step===0)throw new j(`Step cannot be 0, that would cause the range to become infinite`);if(a&&n.step>0)throw new j(`Given start and end should cause the range to traverse negatively, but step is specified to traverse positively`);if(!a&&n.step<0)throw new j(`Given start and end should cause the range to traverse positively, but step is specified to traverse negatively`)}for(;a?r>=i:r<=i;)n?.valueMapper===void 0?yield r:yield h(n.valueMapper,r),r+=n?.step??(a?-1:1)}function re(e){return Object.isFrozen(e)}function ie(e,t=!1){let n=(e,t)=>{let r=e=>t&&e&&typeof e==`object`?n(e,t):e;return e instanceof Map?new Map(Array.from(e,([e,t])=>[r(e),r(t)])):e instanceof Set?new Set(Array.from(e,r)):Array.isArray(e)?e.map(r):Object.fromEntries(Object.entries(e).map(([e,t])=>[e,r(t)]))},r=n(e,t);if(!t)return Object.freeze(r);let i=e=>{let t=e=>{e&&typeof e==`object`&&i(e)};if(e instanceof Map)for(let[n,r]of e)t(n),t(r);else if(e instanceof Set)for(let n of e)t(n);else for(let n of Array.isArray(e)?e:Object.values(e))t(n);return Object.freeze(e)};return i(r)}function M(e){return e instanceof Map?Array.from(e.values()):typeof e[Symbol.iterator]==`function`?Array.from(e):Object.values(e)}function N(e,t=0){let n;switch(typeof e){case`boolean`:n=+!!e;break;case`number`:case`bigint`:n=Number.parseFloat(e.toString());break;case`string`:n=Number.parseFloat(e);break;default:return t}return Number.isNaN(n)||!Number.isFinite(n)?t:n}function P(e,t=0){let n=Math.trunc(t),r;switch(typeof e){case`boolean`:r=+!!e;break;case`number`:case`bigint`:r=Number.parseInt(e.toString(),10);break;case`string`:r=Number.parseInt(e,10);break;default:return n}return Number.isNaN(r)||!Number.isFinite(r)?n:r}function ae(e){return Object.entries(e)}function oe(e,t){let n=Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e));return Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)),n}function se(e){return Object.keys(e)}function ce(e,t){let n={...e},r=Array.isArray(t)?t:[t];for(let e of r)delete n[e];return n}function le(e,t){let n={},r=Array.isArray(t)?t:[t];for(let t of r)n[t]=e[t];return n}function F(e,t){if(t?.parser)return t.parser(e);let n=t?.groupNumbers??!1,r=t?.groupUppercaseLetters??!0,i=[],a=/[A-Z]/,o=/[0-9]/,s=/[\s-_]/,c=``,l=()=>{i.push(c),c=``};for(let t of e.trim()){let e=c.at(-1);if(e===void 0){if(s.test(t))continue;c+=t;continue}if(s.test(t)){l();continue}if(n){if(o.test(t)){if(o.test(e)){c+=t;continue}l(),c+=t;continue}if(o.test(e)){l(),c+=t;continue}}if(a.test(t)){if(r&&a.test(e)){c+=t;continue}l(),c+=t;continue}let u=c.at(-2);r&&a.test(e)&&u!==void 0&&a.test(u)&&(i.push(c.slice(0,-1)),c=e),c+=t}return c.length>0&&l(),i}function I(e,t){let n=F(e,t),r=n.length-1;return n.reduce((e,n,i)=>(e+=t.transform(n,i),i!==r&&(e+=t.seperator),e),``)}function L(e,t){return I(e,{...t,seperator:``,transform:(e,t)=>t===0?e.toLowerCase():`${e.slice(0,1).toUpperCase()}${e.slice(1).toLowerCase()}`})}function R(e){return`${e.slice(0,1).toUpperCase()}${e.slice(1)}`}function z(e,t){return I(e,{...t,seperator:`-`,transform:e=>`${e.slice(0,1).toUpperCase()}${e.slice(1).toLowerCase()}`})}function B(e,t){return I(e,{...t,seperator:`-`,transform:e=>t?.screaming?e.toUpperCase():e.toLowerCase()})}function V(e,t){return B(e,{...t,screaming:!0})}function H(e){return e.toLowerCase()}function U(e,t){return I(e,{...t,seperator:``,transform:e=>`${e.slice(0,1).toUpperCase()}${e.slice(1)}`})}function W(e,t){return I(e,{...t,seperator:`_`,transform:e=>t?.screaming?e.toUpperCase():e.toLowerCase()})}function G(e,t){return W(e,{...t,screaming:!0})}function ue(e,t){return I(e,{...t,seperator:` `,transform:e=>`${e.slice(0,1).toUpperCase()}${e.slice(1)}`})}function de(e){return`${e.slice(0,1).toLowerCase()}${e.slice(1)}`}function fe(e){return e.toUpperCase()}function pe(e,t){let n=new URL(e),r=Object.fromEntries(n.searchParams.entries());if(t){let e={};for(let n in t)e[n]=t[n](r[n]);return e}return r}function me(e){return e.normalize().toLowerCase().replace(/[^\w ]+/g,``).replace(/ +/g,`-`)}var K=c(o(((e,t)=>{var n=function(){this.Diff_Timeout=1,this.Diff_EditCost=4,this.Match_Threshold=.5,this.Match_Distance=1e3,this.Patch_DeleteThreshold=.5,this.Patch_Margin=4,this.Match_MaxBits=32},r=-1,i=1,a=0;n.Diff=function(e,t){return[e,t]},n.prototype.diff_main=function(e,t,r,i){i===void 0&&(i=this.Diff_Timeout<=0?Number.MAX_VALUE:new Date().getTime()+this.Diff_Timeout*1e3);var o=i;if(e==null||t==null)throw Error(`Null input. (diff_main)`);if(e==t)return e?[new n.Diff(a,e)]:[];r===void 0&&(r=!0);var s=r,c=this.diff_commonPrefix(e,t),l=e.substring(0,c);e=e.substring(c),t=t.substring(c),c=this.diff_commonSuffix(e,t);var u=e.substring(e.length-c);e=e.substring(0,e.length-c),t=t.substring(0,t.length-c);var d=this.diff_compute_(e,t,s,o);return l&&d.unshift(new n.Diff(a,l)),u&&d.push(new n.Diff(a,u)),this.diff_cleanupMerge(d),d},n.prototype.diff_compute_=function(e,t,o,s){var c;if(!e)return[new n.Diff(i,t)];if(!t)return[new n.Diff(r,e)];var l=e.length>t.length?e:t,u=e.length>t.length?t:e,d=l.indexOf(u);if(d!=-1)return c=[new n.Diff(i,l.substring(0,d)),new n.Diff(a,u),new n.Diff(i,l.substring(d+u.length))],e.length>t.length&&(c[0][0]=c[2][0]=r),c;if(u.length==1)return[new n.Diff(r,e),new n.Diff(i,t)];var f=this.diff_halfMatch_(e,t);if(f){var p=f[0],m=f[1],h=f[2],g=f[3],_=f[4],v=this.diff_main(p,h,o,s),y=this.diff_main(m,g,o,s);return v.concat([new n.Diff(a,_)],y)}return o&&e.length>100&&t.length>100?this.diff_lineMode_(e,t,s):this.diff_bisect_(e,t,s)},n.prototype.diff_lineMode_=function(e,t,o){var s=this.diff_linesToChars_(e,t);e=s.chars1,t=s.chars2;var c=s.lineArray,l=this.diff_main(e,t,!1,o);this.diff_charsToLines_(l,c),this.diff_cleanupSemantic(l),l.push(new n.Diff(a,``));for(var u=0,d=0,f=0,p=``,m=``;u<l.length;){switch(l[u][0]){case i:f++,m+=l[u][1];break;case r:d++,p+=l[u][1];break;case a:if(d>=1&&f>=1){l.splice(u-d-f,d+f),u=u-d-f;for(var h=this.diff_main(p,m,!1,o),g=h.length-1;g>=0;g--)l.splice(u,0,h[g]);u+=h.length}f=0,d=0,p=``,m=``}u++}return l.pop(),l},n.prototype.diff_bisect_=function(e,t,a){for(var o=e.length,s=t.length,c=Math.ceil((o+s)/2),l=c,u=2*c,d=Array(u),f=Array(u),p=0;p<u;p++)d[p]=-1,f[p]=-1;d[l+1]=0,f[l+1]=0;for(var m=o-s,h=m%2!=0,g=0,_=0,v=0,y=0,b=0;b<c&&!(new Date().getTime()>a);b++){for(var x=-b+g;x<=b-_;x+=2){for(var S=l+x,C=x==-b||x!=b&&d[S-1]<d[S+1]?d[S+1]:d[S-1]+1,w=C-x;C<o&&w<s&&e.charAt(C)==t.charAt(w);)C++,w++;if(d[S]=C,C>o)_+=2;else if(w>s)g+=2;else if(h){var T=l+m-x;if(T>=0&&T<u&&f[T]!=-1){var E=o-f[T];if(C>=E)return this.diff_bisectSplit_(e,t,C,w,a)}}}for(var D=-b+v;D<=b-y;D+=2){for(var T=l+D,E=D==-b||D!=b&&f[T-1]<f[T+1]?f[T+1]:f[T-1]+1,O=E-D;E<o&&O<s&&e.charAt(o-E-1)==t.charAt(s-O-1);)E++,O++;if(f[T]=E,E>o)y+=2;else if(O>s)v+=2;else if(!h){var S=l+m-D;if(S>=0&&S<u&&d[S]!=-1){var C=d[S],w=l+C-S;if(E=o-E,C>=E)return this.diff_bisectSplit_(e,t,C,w,a)}}}}return[new n.Diff(r,e),new n.Diff(i,t)]},n.prototype.diff_bisectSplit_=function(e,t,n,r,i){var a=e.substring(0,n),o=t.substring(0,r),s=e.substring(n),c=t.substring(r),l=this.diff_main(a,o,!1,i),u=this.diff_main(s,c,!1,i);return l.concat(u)},n.prototype.diff_linesToChars_=function(e,t){var n=[],r={};n[0]=``;function i(e){for(var t=``,i=0,o=-1,s=n.length;o<e.length-1;){o=e.indexOf(`
|
|
2
2
|
`,i),o==-1&&(o=e.length-1);var c=e.substring(i,o+1);(r.hasOwnProperty?r.hasOwnProperty(c):r[c]!==void 0)?t+=String.fromCharCode(r[c]):(s==a&&(c=e.substring(i),o=e.length),t+=String.fromCharCode(s),r[c]=s,n[s++]=c),i=o+1}return t}var a=4e4,o=i(e);return a=65535,{chars1:o,chars2:i(t),lineArray:n}},n.prototype.diff_charsToLines_=function(e,t){for(var n=0;n<e.length;n++){for(var r=e[n][1],i=[],a=0;a<r.length;a++)i[a]=t[r.charCodeAt(a)];e[n][1]=i.join(``)}},n.prototype.diff_commonPrefix=function(e,t){if(!e||!t||e.charAt(0)!=t.charAt(0))return 0;for(var n=0,r=Math.min(e.length,t.length),i=r,a=0;n<i;)e.substring(a,i)==t.substring(a,i)?(n=i,a=n):r=i,i=Math.floor((r-n)/2+n);return i},n.prototype.diff_commonSuffix=function(e,t){if(!e||!t||e.charAt(e.length-1)!=t.charAt(t.length-1))return 0;for(var n=0,r=Math.min(e.length,t.length),i=r,a=0;n<i;)e.substring(e.length-i,e.length-a)==t.substring(t.length-i,t.length-a)?(n=i,a=n):r=i,i=Math.floor((r-n)/2+n);return i},n.prototype.diff_commonOverlap_=function(e,t){var n=e.length,r=t.length;if(n==0||r==0)return 0;n>r?e=e.substring(n-r):n<r&&(t=t.substring(0,n));var i=Math.min(n,r);if(e==t)return i;for(var a=0,o=1;;){var s=e.substring(i-o),c=t.indexOf(s);if(c==-1)return a;o+=c,(c==0||e.substring(i-o)==t.substring(0,o))&&(a=o,o++)}},n.prototype.diff_halfMatch_=function(e,t){if(this.Diff_Timeout<=0)return null;var n=e.length>t.length?e:t,r=e.length>t.length?t:e;if(n.length<4||r.length*2<n.length)return null;var i=this;function a(e,t,n){for(var r=e.substring(n,n+Math.floor(e.length/4)),a=-1,o=``,s,c,l,u;(a=t.indexOf(r,a+1))!=-1;){var d=i.diff_commonPrefix(e.substring(n),t.substring(a)),f=i.diff_commonSuffix(e.substring(0,n),t.substring(0,a));o.length<f+d&&(o=t.substring(a-f,a)+t.substring(a,a+d),s=e.substring(0,n-f),c=e.substring(n+d),l=t.substring(0,a-f),u=t.substring(a+d))}return o.length*2>=e.length?[s,c,l,u,o]:null}var o=a(n,r,Math.ceil(n.length/4)),s=a(n,r,Math.ceil(n.length/2)),c;if(!o&&!s)return null;c=s?o&&o[4].length>s[4].length?o:s:o;var l,u,d,f;e.length>t.length?(l=c[0],u=c[1],d=c[2],f=c[3]):(d=c[0],f=c[1],l=c[2],u=c[3]);var p=c[4];return[l,u,d,f,p]},n.prototype.diff_cleanupSemantic=function(e){for(var t=!1,o=[],s=0,c=null,l=0,u=0,d=0,f=0,p=0;l<e.length;)e[l][0]==a?(o[s++]=l,u=f,d=p,f=0,p=0,c=e[l][1]):(e[l][0]==i?f+=e[l][1].length:p+=e[l][1].length,c&&c.length<=Math.max(u,d)&&c.length<=Math.max(f,p)&&(e.splice(o[s-1],0,new n.Diff(r,c)),e[o[s-1]+1][0]=i,s--,s--,l=s>0?o[s-1]:-1,u=0,d=0,f=0,p=0,c=null,t=!0)),l++;for(t&&this.diff_cleanupMerge(e),this.diff_cleanupSemanticLossless(e),l=1;l<e.length;){if(e[l-1][0]==r&&e[l][0]==i){var m=e[l-1][1],h=e[l][1],g=this.diff_commonOverlap_(m,h),_=this.diff_commonOverlap_(h,m);g>=_?(g>=m.length/2||g>=h.length/2)&&(e.splice(l,0,new n.Diff(a,h.substring(0,g))),e[l-1][1]=m.substring(0,m.length-g),e[l+1][1]=h.substring(g),l++):(_>=m.length/2||_>=h.length/2)&&(e.splice(l,0,new n.Diff(a,m.substring(0,_))),e[l-1][0]=i,e[l-1][1]=h.substring(0,h.length-_),e[l+1][0]=r,e[l+1][1]=m.substring(_),l++),l++}l++}},n.prototype.diff_cleanupSemanticLossless=function(e){function t(e,t){if(!e||!t)return 6;var r=e.charAt(e.length-1),i=t.charAt(0),a=r.match(n.nonAlphaNumericRegex_),o=i.match(n.nonAlphaNumericRegex_),s=a&&r.match(n.whitespaceRegex_),c=o&&i.match(n.whitespaceRegex_),l=s&&r.match(n.linebreakRegex_),u=c&&i.match(n.linebreakRegex_),d=l&&e.match(n.blanklineEndRegex_),f=u&&t.match(n.blanklineStartRegex_);return d||f?5:l||u?4:a&&!s&&c?3:s||c?2:a||o?1:0}for(var r=1;r<e.length-1;){if(e[r-1][0]==a&&e[r+1][0]==a){var i=e[r-1][1],o=e[r][1],s=e[r+1][1],c=this.diff_commonSuffix(i,o);if(c){var l=o.substring(o.length-c);i=i.substring(0,i.length-c),o=l+o.substring(0,o.length-c),s=l+s}for(var u=i,d=o,f=s,p=t(i,o)+t(o,s);o.charAt(0)===s.charAt(0);){i+=o.charAt(0),o=o.substring(1)+s.charAt(0),s=s.substring(1);var m=t(i,o)+t(o,s);m>=p&&(p=m,u=i,d=o,f=s)}e[r-1][1]!=u&&(u?e[r-1][1]=u:(e.splice(r-1,1),r--),e[r][1]=d,f?e[r+1][1]=f:(e.splice(r+1,1),r--))}r++}},n.nonAlphaNumericRegex_=/[^a-zA-Z0-9]/,n.whitespaceRegex_=/\s/,n.linebreakRegex_=/[\r\n]/,n.blanklineEndRegex_=/\n\r?\n$/,n.blanklineStartRegex_=/^\r?\n\r?\n/,n.prototype.diff_cleanupEfficiency=function(e){for(var t=!1,o=[],s=0,c=null,l=0,u=!1,d=!1,f=!1,p=!1;l<e.length;)e[l][0]==a?(e[l][1].length<this.Diff_EditCost&&(f||p)?(o[s++]=l,u=f,d=p,c=e[l][1]):(s=0,c=null),f=p=!1):(e[l][0]==r?p=!0:f=!0,c&&(u&&d&&f&&p||c.length<this.Diff_EditCost/2&&u+d+f+p==3)&&(e.splice(o[s-1],0,new n.Diff(r,c)),e[o[s-1]+1][0]=i,s--,c=null,u&&d?(f=p=!0,s=0):(s--,l=s>0?o[s-1]:-1,f=p=!1),t=!0)),l++;t&&this.diff_cleanupMerge(e)},n.prototype.diff_cleanupMerge=function(e){e.push(new n.Diff(a,``));for(var t=0,o=0,s=0,c=``,l=``,u;t<e.length;)switch(e[t][0]){case i:s++,l+=e[t][1],t++;break;case r:o++,c+=e[t][1],t++;break;case a:o+s>1?(o!==0&&s!==0&&(u=this.diff_commonPrefix(l,c),u!==0&&(t-o-s>0&&e[t-o-s-1][0]==a?e[t-o-s-1][1]+=l.substring(0,u):(e.splice(0,0,new n.Diff(a,l.substring(0,u))),t++),l=l.substring(u),c=c.substring(u)),u=this.diff_commonSuffix(l,c),u!==0&&(e[t][1]=l.substring(l.length-u)+e[t][1],l=l.substring(0,l.length-u),c=c.substring(0,c.length-u))),t-=o+s,e.splice(t,o+s),c.length&&(e.splice(t,0,new n.Diff(r,c)),t++),l.length&&(e.splice(t,0,new n.Diff(i,l)),t++),t++):t!==0&&e[t-1][0]==a?(e[t-1][1]+=e[t][1],e.splice(t,1)):t++,s=0,o=0,c=``,l=``}e[e.length-1][1]===``&&e.pop();var d=!1;for(t=1;t<e.length-1;)e[t-1][0]==a&&e[t+1][0]==a&&(e[t][1].substring(e[t][1].length-e[t-1][1].length)==e[t-1][1]?(e[t][1]=e[t-1][1]+e[t][1].substring(0,e[t][1].length-e[t-1][1].length),e[t+1][1]=e[t-1][1]+e[t+1][1],e.splice(t-1,1),d=!0):e[t][1].substring(0,e[t+1][1].length)==e[t+1][1]&&(e[t-1][1]+=e[t+1][1],e[t][1]=e[t][1].substring(e[t+1][1].length)+e[t+1][1],e.splice(t+1,1),d=!0)),t++;d&&this.diff_cleanupMerge(e)},n.prototype.diff_xIndex=function(e,t){var n=0,a=0,o=0,s=0,c;for(c=0;c<e.length&&(e[c][0]!==i&&(n+=e[c][1].length),e[c][0]!==r&&(a+=e[c][1].length),!(n>t));c++)o=n,s=a;return e.length!=c&&e[c][0]===r?s:s+(t-o)},n.prototype.diff_prettyHtml=function(e){for(var t=[],n=/&/g,o=/</g,s=/>/g,c=/\n/g,l=0;l<e.length;l++){var u=e[l][0],d=e[l][1].replace(n,`&`).replace(o,`<`).replace(s,`>`).replace(c,`¶<br>`);switch(u){case i:t[l]=`<ins style="background:#e6ffe6;">`+d+`</ins>`;break;case r:t[l]=`<del style="background:#ffe6e6;">`+d+`</del>`;break;case a:t[l]=`<span>`+d+`</span>`}}return t.join(``)},n.prototype.diff_text1=function(e){for(var t=[],n=0;n<e.length;n++)e[n][0]!==i&&(t[n]=e[n][1]);return t.join(``)},n.prototype.diff_text2=function(e){for(var t=[],n=0;n<e.length;n++)e[n][0]!==r&&(t[n]=e[n][1]);return t.join(``)},n.prototype.diff_levenshtein=function(e){for(var t=0,n=0,o=0,s=0;s<e.length;s++){var c=e[s][0],l=e[s][1];switch(c){case i:n+=l.length;break;case r:o+=l.length;break;case a:t+=Math.max(n,o),n=0,o=0}}return t+=Math.max(n,o),t},n.prototype.diff_toDelta=function(e){for(var t=[],n=0;n<e.length;n++)switch(e[n][0]){case i:t[n]=`+`+encodeURI(e[n][1]);break;case r:t[n]=`-`+e[n][1].length;break;case a:t[n]=`=`+e[n][1].length}return t.join(` `).replace(/%20/g,` `)},n.prototype.diff_fromDelta=function(e,t){for(var o=[],s=0,c=0,l=t.split(/\t/g),u=0;u<l.length;u++){var d=l[u].substring(1);switch(l[u].charAt(0)){case`+`:try{o[s++]=new n.Diff(i,decodeURI(d))}catch{throw Error(`Illegal escape in diff_fromDelta: `+d)}break;case`-`:case`=`:var f=parseInt(d,10);if(isNaN(f)||f<0)throw Error(`Invalid number in diff_fromDelta: `+d);var p=e.substring(c,c+=f);l[u].charAt(0)==`=`?o[s++]=new n.Diff(a,p):o[s++]=new n.Diff(r,p);break;default:if(l[u])throw Error(`Invalid diff operation in diff_fromDelta: `+l[u])}}if(c!=e.length)throw Error(`Delta length (`+c+`) does not equal source text length (`+e.length+`).`);return o},n.prototype.match_main=function(e,t,n){if(e==null||t==null||n==null)throw Error(`Null input. (match_main)`);return n=Math.max(0,Math.min(n,e.length)),e==t?0:e.length?e.substring(n,n+t.length)==t?n:this.match_bitap_(e,t,n):-1},n.prototype.match_bitap_=function(e,t,n){if(t.length>this.Match_MaxBits)throw Error(`Pattern too long for this browser.`);var r=this.match_alphabet_(t),i=this;function a(e,r){var a=e/t.length,o=Math.abs(n-r);return i.Match_Distance?a+o/i.Match_Distance:o?1:a}var o=this.Match_Threshold,s=e.indexOf(t,n);s!=-1&&(o=Math.min(a(0,s),o),s=e.lastIndexOf(t,n+t.length),s!=-1&&(o=Math.min(a(0,s),o)));var c=1<<t.length-1;s=-1;for(var l,u,d=t.length+e.length,f,p=0;p<t.length;p++){for(l=0,u=d;l<u;)a(p,n+u)<=o?l=u:d=u,u=Math.floor((d-l)/2+l);d=u;var m=Math.max(1,n-u+1),h=Math.min(n+u,e.length)+t.length,g=Array(h+2);g[h+1]=(1<<p)-1;for(var _=h;_>=m;_--){var v=r[e.charAt(_-1)];if(p===0?g[_]=(g[_+1]<<1|1)&v:g[_]=(g[_+1]<<1|1)&v|(f[_+1]|f[_])<<1|1|f[_+1],g[_]&c){var y=a(p,_-1);if(y<=o){if(o=y,s=_-1,s>n)m=Math.max(1,2*n-s);else break}}}if(a(p+1,n)>o)break;f=g}return s},n.prototype.match_alphabet_=function(e){for(var t={},n=0;n<e.length;n++)t[e.charAt(n)]=0;for(var n=0;n<e.length;n++)t[e.charAt(n)]|=1<<e.length-n-1;return t},n.prototype.patch_addContext_=function(e,t){if(t.length!=0){if(e.start2===null)throw Error(`patch not initialized`);for(var r=t.substring(e.start2,e.start2+e.length1),i=0;t.indexOf(r)!=t.lastIndexOf(r)&&r.length<this.Match_MaxBits-this.Patch_Margin-this.Patch_Margin;)i+=this.Patch_Margin,r=t.substring(e.start2-i,e.start2+e.length1+i);i+=this.Patch_Margin;var o=t.substring(e.start2-i,e.start2);o&&e.diffs.unshift(new n.Diff(a,o));var s=t.substring(e.start2+e.length1,e.start2+e.length1+i);s&&e.diffs.push(new n.Diff(a,s)),e.start1-=o.length,e.start2-=o.length,e.length1+=o.length+s.length,e.length2+=o.length+s.length}},n.prototype.patch_make=function(e,t,o){var s,c;if(typeof e==`string`&&typeof t==`string`&&o===void 0)s=e,c=this.diff_main(s,t,!0),c.length>2&&(this.diff_cleanupSemantic(c),this.diff_cleanupEfficiency(c));else if(e&&typeof e==`object`&&t===void 0&&o===void 0)c=e,s=this.diff_text1(c);else if(typeof e==`string`&&t&&typeof t==`object`&&o===void 0)s=e,c=t;else if(typeof e==`string`&&typeof t==`string`&&o&&typeof o==`object`)s=e,c=o;else throw Error(`Unknown call format to patch_make.`);if(c.length===0)return[];for(var l=[],u=new n.patch_obj,d=0,f=0,p=0,m=s,h=s,g=0;g<c.length;g++){var _=c[g][0],v=c[g][1];switch(!d&&_!==a&&(u.start1=f,u.start2=p),_){case i:u.diffs[d++]=c[g],u.length2+=v.length,h=h.substring(0,p)+v+h.substring(p);break;case r:u.length1+=v.length,u.diffs[d++]=c[g],h=h.substring(0,p)+h.substring(p+v.length);break;case a:v.length<=2*this.Patch_Margin&&d&&c.length!=g+1?(u.diffs[d++]=c[g],u.length1+=v.length,u.length2+=v.length):v.length>=2*this.Patch_Margin&&d&&(this.patch_addContext_(u,m),l.push(u),u=new n.patch_obj,d=0,m=h,f=p)}_!==i&&(f+=v.length),_!==r&&(p+=v.length)}return d&&(this.patch_addContext_(u,m),l.push(u)),l},n.prototype.patch_deepCopy=function(e){for(var t=[],r=0;r<e.length;r++){var i=e[r],a=new n.patch_obj;a.diffs=[];for(var o=0;o<i.diffs.length;o++)a.diffs[o]=new n.Diff(i.diffs[o][0],i.diffs[o][1]);a.start1=i.start1,a.start2=i.start2,a.length1=i.length1,a.length2=i.length2,t[r]=a}return t},n.prototype.patch_apply=function(e,t){if(e.length==0)return[t,[]];e=this.patch_deepCopy(e);var n=this.patch_addPadding(e);t=n+t+n,this.patch_splitMax(e);for(var o=0,s=[],c=0;c<e.length;c++){var l=e[c].start2+o,u=this.diff_text1(e[c].diffs),d,f=-1;if(u.length>this.Match_MaxBits?(d=this.match_main(t,u.substring(0,this.Match_MaxBits),l),d!=-1&&(f=this.match_main(t,u.substring(u.length-this.Match_MaxBits),l+u.length-this.Match_MaxBits),(f==-1||d>=f)&&(d=-1))):d=this.match_main(t,u,l),d==-1)s[c]=!1,o-=e[c].length2-e[c].length1;else{s[c]=!0,o=d-l;var p=f==-1?t.substring(d,d+u.length):t.substring(d,f+this.Match_MaxBits);if(u==p)t=t.substring(0,d)+this.diff_text2(e[c].diffs)+t.substring(d+u.length);else{var m=this.diff_main(u,p,!1);if(u.length>this.Match_MaxBits&&this.diff_levenshtein(m)/u.length>this.Patch_DeleteThreshold)s[c]=!1;else{this.diff_cleanupSemanticLossless(m);for(var h=0,g,_=0;_<e[c].diffs.length;_++){var v=e[c].diffs[_];v[0]!==a&&(g=this.diff_xIndex(m,h)),v[0]===i?t=t.substring(0,d+g)+v[1]+t.substring(d+g):v[0]===r&&(t=t.substring(0,d+g)+t.substring(d+this.diff_xIndex(m,h+v[1].length))),v[0]!==r&&(h+=v[1].length)}}}}}return t=t.substring(n.length,t.length-n.length),[t,s]},n.prototype.patch_addPadding=function(e){for(var t=this.Patch_Margin,r=``,i=1;i<=t;i++)r+=String.fromCharCode(i);for(var i=0;i<e.length;i++)e[i].start1+=t,e[i].start2+=t;var o=e[0],s=o.diffs;if(s.length==0||s[0][0]!=a)s.unshift(new n.Diff(a,r)),o.start1-=t,o.start2-=t,o.length1+=t,o.length2+=t;else if(t>s[0][1].length){var c=t-s[0][1].length;s[0][1]=r.substring(s[0][1].length)+s[0][1],o.start1-=c,o.start2-=c,o.length1+=c,o.length2+=c}if(o=e[e.length-1],s=o.diffs,s.length==0||s[s.length-1][0]!=a)s.push(new n.Diff(a,r)),o.length1+=t,o.length2+=t;else if(t>s[s.length-1][1].length){var c=t-s[s.length-1][1].length;s[s.length-1][1]+=r.substring(0,c),o.length1+=c,o.length2+=c}return r},n.prototype.patch_splitMax=function(e){for(var t=this.Match_MaxBits,o=0;o<e.length;o++)if(!(e[o].length1<=t)){var s=e[o];e.splice(o--,1);for(var c=s.start1,l=s.start2,u=``;s.diffs.length!==0;){var d=new n.patch_obj,f=!0;for(d.start1=c-u.length,d.start2=l-u.length,u!==``&&(d.length1=d.length2=u.length,d.diffs.push(new n.Diff(a,u)));s.diffs.length!==0&&d.length1<t-this.Patch_Margin;){var p=s.diffs[0][0],m=s.diffs[0][1];p===i?(d.length2+=m.length,l+=m.length,d.diffs.push(s.diffs.shift()),f=!1):p===r&&d.diffs.length==1&&d.diffs[0][0]==a&&m.length>2*t?(d.length1+=m.length,c+=m.length,f=!1,d.diffs.push(new n.Diff(p,m)),s.diffs.shift()):(m=m.substring(0,t-d.length1-this.Patch_Margin),d.length1+=m.length,c+=m.length,p===a?(d.length2+=m.length,l+=m.length):f=!1,d.diffs.push(new n.Diff(p,m)),m==s.diffs[0][1]?s.diffs.shift():s.diffs[0][1]=s.diffs[0][1].substring(m.length))}u=this.diff_text2(d.diffs),u=u.substring(u.length-this.Patch_Margin);var h=this.diff_text1(s.diffs).substring(0,this.Patch_Margin);h!==``&&(d.length1+=h.length,d.length2+=h.length,d.diffs.length!==0&&d.diffs[d.diffs.length-1][0]===a?d.diffs[d.diffs.length-1][1]+=h:d.diffs.push(new n.Diff(a,h))),f||e.splice(++o,0,d)}}},n.prototype.patch_toText=function(e){for(var t=[],n=0;n<e.length;n++)t[n]=e[n];return t.join(``)},n.prototype.patch_fromText=function(e){var t=[];if(!e)return t;for(var o=e.split(`
|
|
3
3
|
`),s=0,c=/^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$/;s<o.length;){var l=o[s].match(c);if(!l)throw Error(`Invalid patch string: `+o[s]);var u=new n.patch_obj;for(t.push(u),u.start1=parseInt(l[1],10),l[2]===``?(u.start1--,u.length1=1):l[2]==`0`?u.length1=0:(u.start1--,u.length1=parseInt(l[2],10)),u.start2=parseInt(l[3],10),l[4]===``?(u.start2--,u.length2=1):l[4]==`0`?u.length2=0:(u.start2--,u.length2=parseInt(l[4],10)),s++;s<o.length;){var d=o[s].charAt(0);try{var f=decodeURI(o[s].substring(1))}catch{throw Error(`Illegal escape in patch_fromText: `+f)}if(d==`-`)u.diffs.push(new n.Diff(r,f));else if(d==`+`)u.diffs.push(new n.Diff(i,f));else if(d==` `)u.diffs.push(new n.Diff(a,f));else if(d==`@`)break;else if(d!==``)throw Error(`Invalid patch mode "`+d+`" in: `+f);s++}}return t},n.patch_obj=function(){this.diffs=[],this.start1=null,this.start2=null,this.length1=0,this.length2=0},n.patch_obj.prototype.toString=function(){for(var e=this.length1===0?this.start1+`,0`:this.length1==1?this.start1+1:this.start1+1+`,`+this.length1,t=this.length2===0?this.start2+`,0`:this.length2==1?this.start2+1:this.start2+1+`,`+this.length2,n=[`@@ -`+e+` +`+t+` @@
|
|
4
4
|
`],o,s=0;s<this.diffs.length;s++){switch(this.diffs[s][0]){case i:o=`+`;break;case r:o=`-`;break;case a:o=` `}n[s+1]=o+encodeURI(this.diffs[s][1])+`
|
|
5
|
-
`}return n.join(``).replace(/%20/g,` `)},t.exports=n,t.exports.diff_match_patch=n,t.exports.DIFF_DELETE=r,t.exports.DIFF_INSERT=i,t.exports.DIFF_EQUAL=a}))(),1),
|
|
5
|
+
`}return n.join(``).replace(/%20/g,` `)},t.exports=n,t.exports.diff_match_patch=n,t.exports.DIFF_DELETE=r,t.exports.DIFF_INSERT=i,t.exports.DIFF_EQUAL=a}))(),1),he=new Set([`area`,`base`,`br`,`col`,`embed`,`hr`,`img`,`input`,`link`,`meta`,`param`,`source`,`track`,`wbr`]),ge=new Set(`a.abbr.b.bdi.bdo.br.button.cite.code.data.dfn.em.i.img.input.kbd.label.mark.q.rp.rt.ruby.s.samp.select.small.span.strong.sub.sup.textarea.time.u.var.wbr`.split(`.`));function _e(e,t){if(e.startsWith(`<!--`,t)){let n=e.indexOf(`-->`,t+4);return n===-1?-1:n+2}let n=null,r=t;for(let i of e.slice(t+1)){if(r+=1,n){i===n&&(n=null);continue}if(i===`"`||i===`'`){n=i;continue}if(i===`>`)return r}return-1}function ve(e){let t=[],n=0;for(;n<e.length;){if(e[n]===`<`){let r=_e(e,n);if(r===-1){t.push({kind:`text`,value:e.slice(n)});break}t.push({kind:`tag`,value:e.slice(n,r+1)}),n=r+1;continue}let r=e.indexOf(`<`,n),i=r===-1?e.length:r;t.push({kind:`text`,value:e.slice(n,i)}),n=i}return t}function ye(e){let t=/^<\/?\s*([a-zA-Z][a-zA-Z0-9:-]*)/.exec(e);return t?t[1].toLowerCase():``}function q(e){let t=[],n=[],r=()=>n.length?n[n.length-1].children:t;for(let t of ve(e)){if(t.kind===`text`){t.value&&r().push({kind:`text`,text:t.value});continue}let e=t.value;if(e.startsWith(`<!`)){r().push({kind:`element`,tag:``,openTag:e,closeTag:``,children:[]});continue}let i=ye(e);if(e.startsWith(`</`)){let t=-1;for(let e=n.length-1;e>=0;--e)if(n[e].tag===i){t=e;break}if(t===-1){r().push({kind:`text`,text:e});continue}let a=n[t];for(;n.length>t;)n.pop();a.closeTag=e;continue}let a={kind:`element`,tag:i,openTag:e,closeTag:``,children:[]};r().push(a),!/\/\s*>$/.test(e)&&!he.has(i)&&n.push(a)}return t}function J(e){return ge.has(e)?`INLINE`:`BLOCK`}function Y(e){return e.kind===`text`?e.text:`${e.openTag}${e.children.map(Y).join(``)}${e.closeTag}`}function X(e){return e.kind===`text`?`T:${e.text}`:`E:${e.openTag}${e.children.map(X).join(``)}${e.closeTag}`}function Z(e){switch(e){case K.default.DIFF_EQUAL:return`EQUAL`;case K.default.DIFF_INSERT:return`INSERT`;case K.default.DIFF_DELETE:return`DELETE`;default:throw Error(`Got invalid difference marker to determine type`)}}function be({oldItems:e,newItems:t,key:n}){let r=new Map,i=33,a=()=>{i===55296&&(i=57344);let e=String.fromCharCode(i);return i+=1,e},o=e=>{let t=``;for(let i of e){let e=n(i),o=r.get(e);o===void 0&&(o=a(),r.set(e,o)),t+=o}return t},s=o(e),c=o(t),l=new K.default().diff_main(s,c),u=[],d=0,f=0;for(let[n,r]of l)for(let i of r)n===K.default.DIFF_EQUAL?(u.push({type:`EQUAL`,oldItem:e[d],newItem:t[f]}),d+=1,f+=1):n===K.default.DIFF_DELETE?(u.push({type:`DELETE`,oldItem:e[d]}),d+=1):(u.push({type:`INSERT`,newItem:t[f]}),f+=1);return u}function xe(e,t){let n=new K.default,r=n.diff_main(e,t);return n.diff_cleanupSemantic(r),r.map(([e,t])=>({type:Z(e),content:t,context:`INLINE`}))}function Q(e,t){return e.kind===`text`?{type:t,content:e.text,context:`INLINE`}:{type:t,content:Y(e),context:J(e.tag)}}function $(e,t){let n=be({oldItems:e,newItems:t,key:X}),r=[];for(let e=0;e<n.length;e+=1){let t=n[e];if(t.type===`EQUAL`){r.push(Q(t.oldItem,`EQUAL`));continue}let i=n[e+1];if(t.type===`DELETE`&&i?.type===`INSERT`){let n=t.oldItem,a=i.newItem;if(n.kind===`element`&&a.kind===`element`&&n.tag===a.tag&&n.openTag===a.openTag&&n.closeTag===a.closeTag){r.push({type:`EQUAL`,content:n.openTag,context:J(n.tag)},...$(n.children,a.children)),n.closeTag&&r.push({type:`EQUAL`,content:n.closeTag,context:J(n.tag)}),e+=1;continue}if(n.kind===`text`&&a.kind===`text`){r.push(...xe(n.text,a.text)),e+=1;continue}r.push(Q(n,`DELETE`),Q(a,`INSERT`)),e+=1;continue}if(t.type===`DELETE`){r.push(Q(t.oldItem,`DELETE`));continue}r.push(Q(t.newItem,`INSERT`))}return r}function Se(e){let t=[];for(let n of e){let e=t[t.length-1];if(e&&e.type===n.type&&e.context===n.context){e.content+=n.content;continue}t.push({...n})}return t}function Ce(e,t,n){let r=n?.htmlAware??!1,i=n?.raw??!1,a=[];if(r){let n=q(e),r=q(t);a.push(...Se($(n,r)))}else{let n=new K.default,r=n.diff_main(e,t);n.diff_cleanupSemantic(r);for(let[e,t]of r)a.push({content:t,type:Z(e),context:`UNKNOWN`})}if(!i){let e=``,t=[``,``],i=[``,``],o=[`<span data-diff="insert">`,`</span>`],s=[`<div data-diff="insert">`,`</div>`],c=[`<span data-diff="delete">`,`</span>`],l=[`<div data-diff="delete">`,`</div>`],u=(e,t)=>{let n=t.equal,r=t.insert,i=t.delete;return typeof e.equal==`string`?n=[e.equal,e.equal]:e.equal&&(n=e.equal),typeof e.insert==`string`?r=[e.insert,e.insert]:e.insert&&(r=e.insert),typeof e.delete==`string`?i=[e.delete,e.delete]:e.delete&&(i=e.delete),{equalTags:n,insertTags:r,deleteTags:i}};if(n&&`tags`in n&&n.tags){if(`inlineContext`in n.tags||`blockContext`in n.tags){if(n.tags.inlineContext){let e=u(n.tags.inlineContext,{equal:[``,``],insert:[`<span data-diff="insert">`,`</span>`],delete:[`<span data-diff="delete">`,`</span>`]});t=e.equalTags,o=e.insertTags,c=e.deleteTags}if(n.tags.blockContext){let e=u(n.tags.blockContext,{equal:[``,``],insert:[`<div data-diff="insert">`,`</div>`],delete:[`<div data-diff="delete">`,`</div>`]});i=e.equalTags,s=e.insertTags,l=e.deleteTags}}else if(`equal`in n.tags||`insert`in n.tags||`delete`in n.tags){if(r){let e=u(n.tags,{equal:[``,``],insert:[`<span data-diff="insert">`,`</span>`],delete:[`<span data-diff="delete">`,`</span>`]}),r=u(n.tags,{equal:[``,``],insert:[`<div data-diff="insert">`,`</div>`],delete:[`<div data-diff="delete">`,`</div>`]});t=e.equalTags,i=r.equalTags,o=e.insertTags,s=r.insertTags,c=e.deleteTags,l=r.deleteTags}else{let e=u(n.tags,{equal:[``,``],insert:[`<span data-diff="insert">`,`</span>`],delete:[`<span data-diff="delete">`,`</span>`]});t=e.equalTags,i=e.equalTags,o=e.insertTags,s=e.insertTags,c=e.deleteTags,l=e.deleteTags}}}for(let n of a){let r,a;switch(n.type){case`EQUAL`:switch(n.context){case`BLOCK`:r=i[0],a=i[1];break;case`INLINE`:case`UNKNOWN`:r=t[0],a=t[1]}break;case`INSERT`:switch(n.context){case`BLOCK`:r=s[0],a=s[1];break;case`INLINE`:case`UNKNOWN`:r=o[0],a=o[1]}break;case`DELETE`:switch(n.context){case`BLOCK`:r=l[0],a=l[1];break;case`INLINE`:case`UNKNOWN`:r=c[0],a=c[1]}}e+=`${r}${n.content}${a}`}return e}return a}exports.ClusterUtilError=u,exports.ListUtilError=g,exports.RangeUtilError=j,exports.RetryUtilError=D,exports.UtilError=l,exports.camelCase=L,exports.capitalize=R,exports.chain=S,exports.cluster=d,exports.compose=C,exports.compute=h,exports.counting=f,exports.customCase=I,exports.defer=w,exports.entries=ae,exports.extend=oe,exports.fork=p,exports.httpHeaderCase=z,exports.trainCase=z,exports.isComputation=m,exports.isEmpty=A,exports.isObject=k,exports.isPrimitive=ee,exports.isReadOnly=re,exports.kebabCase=B,exports.keys=se,exports.list=_,exports.lowerCase=H,exports.match=te,exports.omit=ce,exports.parseUrlParams=pe,exports.pascalCase=U,exports.pick=le,exports.preset=T,exports.range=ne,exports.readOnly=ie,exports.retry=O,exports.screamingKebabCase=V,exports.screamingSnakeCase=G,exports.select=v,exports.sift=y,exports.sleep=E,exports.slug=me,exports.snakeCase=W,exports.sum=b,exports.textDifference=Ce,exports.titleCase=ue,exports.toFloat=N,exports.toInt=P,exports.toggle=x,exports.uncapitalize=de,exports.upperCase=fe,exports.values=M;
|
package/dist/levyUtils.js
CHANGED
|
@@ -75,8 +75,25 @@ function y(e) {
|
|
|
75
75
|
return e.filter((e) => !!e);
|
|
76
76
|
}
|
|
77
77
|
//#endregion
|
|
78
|
+
//#region lib/array/utils/sum/index.ts
|
|
79
|
+
function b(e, t) {
|
|
80
|
+
let n = 0;
|
|
81
|
+
if (t) for (let r of e) {
|
|
82
|
+
let e = t(r);
|
|
83
|
+
Number.isNaN(e) || (n += e);
|
|
84
|
+
}
|
|
85
|
+
else for (let t of e) {
|
|
86
|
+
if (typeof t == "number" && !Number.isNaN(t)) {
|
|
87
|
+
n += t;
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
n += +!!t;
|
|
91
|
+
}
|
|
92
|
+
return n;
|
|
93
|
+
}
|
|
94
|
+
//#endregion
|
|
78
95
|
//#region lib/array/utils/toggle/index.ts
|
|
79
|
-
function
|
|
96
|
+
function x(e, t, n) {
|
|
80
97
|
let r = (e) => n?.toKey?.(e) ?? e, i = e.findIndex((e) => r(e) === r(t)), a = [...e];
|
|
81
98
|
if (i === -1) switch (n?.strategy ?? "APPEND") {
|
|
82
99
|
case "APPEND":
|
|
@@ -89,55 +106,57 @@ function b(e, t, n) {
|
|
|
89
106
|
}
|
|
90
107
|
//#endregion
|
|
91
108
|
//#region lib/callback/utils/chain/index.ts
|
|
92
|
-
function
|
|
109
|
+
function S(...e) {
|
|
93
110
|
let t;
|
|
94
111
|
for (let n of e) t = n(t);
|
|
95
112
|
return t;
|
|
96
113
|
}
|
|
97
114
|
//#endregion
|
|
115
|
+
//#region lib/callback/utils/compose/index.ts
|
|
116
|
+
function C(...e) {
|
|
117
|
+
return (...t) => e.reduce((e, n, r) => {
|
|
118
|
+
let i = n;
|
|
119
|
+
return r === 0 ? i(...t) : i(e);
|
|
120
|
+
}, void 0);
|
|
121
|
+
}
|
|
122
|
+
//#endregion
|
|
98
123
|
//#region lib/callback/utils/defer/index.ts
|
|
99
|
-
function
|
|
124
|
+
function w(e) {
|
|
100
125
|
setTimeout(() => {
|
|
101
126
|
e();
|
|
102
127
|
}, 0);
|
|
103
128
|
}
|
|
104
129
|
//#endregion
|
|
130
|
+
//#region lib/callback/utils/preset/index.ts
|
|
131
|
+
function T(e, t) {
|
|
132
|
+
return (...n) => e(...t(...n));
|
|
133
|
+
}
|
|
134
|
+
//#endregion
|
|
105
135
|
//#region lib/misc/utils/sleep/index.ts
|
|
106
|
-
async function
|
|
136
|
+
async function E(e) {
|
|
107
137
|
return new Promise((t) => {
|
|
108
138
|
setTimeout(t, Math.max(e, 0));
|
|
109
139
|
});
|
|
110
140
|
}
|
|
111
141
|
//#endregion
|
|
112
142
|
//#region lib/callback/utils/retry/index.ts
|
|
113
|
-
var
|
|
143
|
+
var D = class extends l {
|
|
114
144
|
util = "retry";
|
|
115
145
|
};
|
|
116
|
-
async function
|
|
146
|
+
async function O(e, t) {
|
|
117
147
|
let n = t?.attempts ?? 3, r = t?.backoff ?? !1, i = t?.delay ?? 1e3, a = 0;
|
|
118
148
|
for (;;) {
|
|
119
149
|
a += 1;
|
|
120
150
|
try {
|
|
121
151
|
return await e();
|
|
122
152
|
} catch (e) {
|
|
123
|
-
if (a >= n) throw new
|
|
124
|
-
t?.onRetry?.(e, a), await
|
|
153
|
+
if (a >= n) throw new D("Callback failed too often, stopping retry loop", { cause: e });
|
|
154
|
+
t?.onRetry?.(e, a), await E(i);
|
|
125
155
|
}
|
|
126
156
|
r && (i *= 2);
|
|
127
157
|
}
|
|
128
158
|
}
|
|
129
159
|
//#endregion
|
|
130
|
-
//#region lib/error.ts
|
|
131
|
-
var E = class extends Error {};
|
|
132
|
-
//#endregion
|
|
133
|
-
//#region lib/misc/utils/compute/index.ts
|
|
134
|
-
function D(e) {
|
|
135
|
-
return typeof e == "function";
|
|
136
|
-
}
|
|
137
|
-
function O(e, ...t) {
|
|
138
|
-
return D(e) ? e(...t) : e;
|
|
139
|
-
}
|
|
140
|
-
//#endregion
|
|
141
160
|
//#region lib/object/utils/isObject/index.ts
|
|
142
161
|
function k(e) {
|
|
143
162
|
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
@@ -149,7 +168,7 @@ function A(e) {
|
|
|
149
168
|
}
|
|
150
169
|
//#endregion
|
|
151
170
|
//#region lib/misc/utils/isPrimitive/index.ts
|
|
152
|
-
function
|
|
171
|
+
function ee(e) {
|
|
153
172
|
if (e === null) return !0;
|
|
154
173
|
switch (typeof e) {
|
|
155
174
|
case "boolean":
|
|
@@ -161,29 +180,55 @@ function j(e) {
|
|
|
161
180
|
}
|
|
162
181
|
}
|
|
163
182
|
//#endregion
|
|
183
|
+
//#region lib/misc/utils/match/index.ts
|
|
184
|
+
function te(e, t, n) {
|
|
185
|
+
let r = String(e);
|
|
186
|
+
return r in t ? h(t[r]) : m(n) ? n(r) : n;
|
|
187
|
+
}
|
|
188
|
+
//#endregion
|
|
164
189
|
//#region lib/misc/utils/range/index.ts
|
|
165
|
-
var
|
|
190
|
+
var j = class extends l {
|
|
166
191
|
util = "range";
|
|
167
192
|
};
|
|
168
|
-
function*
|
|
193
|
+
function* ne(e, t, n) {
|
|
169
194
|
let r = typeof t == "number" ? e : 0, i = typeof t == "number" ? t : e, a = r > i;
|
|
170
195
|
if (n && typeof n.step == "number") {
|
|
171
|
-
if (n.step === 0) throw new
|
|
172
|
-
if (a && n.step > 0) throw new
|
|
173
|
-
if (!a && n.step < 0) throw new
|
|
196
|
+
if (n.step === 0) throw new j("Step cannot be 0, that would cause the range to become infinite");
|
|
197
|
+
if (a && n.step > 0) throw new j("Given start and end should cause the range to traverse negatively, but step is specified to traverse positively");
|
|
198
|
+
if (!a && n.step < 0) throw new j("Given start and end should cause the range to traverse positively, but step is specified to traverse negatively");
|
|
174
199
|
}
|
|
175
200
|
for (; a ? r >= i : r <= i;) n?.valueMapper === void 0 ? yield r : yield h(n.valueMapper, r), r += n?.step ?? (a ? -1 : 1);
|
|
176
201
|
}
|
|
177
202
|
//#endregion
|
|
178
|
-
//#region lib/misc/utils/
|
|
179
|
-
|
|
180
|
-
return
|
|
181
|
-
|
|
182
|
-
|
|
203
|
+
//#region lib/misc/utils/readOnly/index.ts
|
|
204
|
+
function re(e) {
|
|
205
|
+
return Object.isFrozen(e);
|
|
206
|
+
}
|
|
207
|
+
function ie(e, t = !1) {
|
|
208
|
+
let n = (e, t) => {
|
|
209
|
+
let r = (e) => t && e && typeof e == "object" ? n(e, t) : e;
|
|
210
|
+
return e instanceof Map ? new Map(Array.from(e, ([e, t]) => [r(e), r(t)])) : e instanceof Set ? new Set(Array.from(e, r)) : Array.isArray(e) ? e.map(r) : Object.fromEntries(Object.entries(e).map(([e, t]) => [e, r(t)]));
|
|
211
|
+
}, r = n(e, t);
|
|
212
|
+
if (!t) return Object.freeze(r);
|
|
213
|
+
let i = (e) => {
|
|
214
|
+
let t = (e) => {
|
|
215
|
+
e && typeof e == "object" && i(e);
|
|
216
|
+
};
|
|
217
|
+
if (e instanceof Map) for (let [n, r] of e) t(n), t(r);
|
|
218
|
+
else if (e instanceof Set) for (let n of e) t(n);
|
|
219
|
+
else for (let n of Array.isArray(e) ? e : Object.values(e)) t(n);
|
|
220
|
+
return Object.freeze(e);
|
|
221
|
+
};
|
|
222
|
+
return i(r);
|
|
223
|
+
}
|
|
224
|
+
//#endregion
|
|
225
|
+
//#region lib/misc/utils/values/index.ts
|
|
226
|
+
function M(e) {
|
|
227
|
+
return e instanceof Map ? Array.from(e.values()) : typeof e[Symbol.iterator] == "function" ? Array.from(e) : Object.values(e);
|
|
183
228
|
}
|
|
184
229
|
//#endregion
|
|
185
230
|
//#region lib/number/utils/toFloat/index.ts
|
|
186
|
-
function
|
|
231
|
+
function N(e, t = 0) {
|
|
187
232
|
let n;
|
|
188
233
|
switch (typeof e) {
|
|
189
234
|
case "boolean":
|
|
@@ -202,7 +247,7 @@ function te(e, t = 0) {
|
|
|
202
247
|
}
|
|
203
248
|
//#endregion
|
|
204
249
|
//#region lib/number/utils/toInt/index.ts
|
|
205
|
-
function
|
|
250
|
+
function P(e, t = 0) {
|
|
206
251
|
let n = Math.trunc(t), r;
|
|
207
252
|
switch (typeof e) {
|
|
208
253
|
case "boolean":
|
|
@@ -221,36 +266,37 @@ function ne(e, t = 0) {
|
|
|
221
266
|
}
|
|
222
267
|
//#endregion
|
|
223
268
|
//#region lib/object/utils/entries/index.ts
|
|
224
|
-
function
|
|
269
|
+
function ae(e) {
|
|
225
270
|
return Object.entries(e);
|
|
226
271
|
}
|
|
227
272
|
//#endregion
|
|
228
|
-
//#region lib/object/utils/
|
|
229
|
-
function
|
|
230
|
-
|
|
273
|
+
//#region lib/object/utils/extend/index.ts
|
|
274
|
+
function oe(e, t) {
|
|
275
|
+
let n = Object.create(Object.getPrototypeOf(e), Object.getOwnPropertyDescriptors(e));
|
|
276
|
+
return Object.defineProperties(n, Object.getOwnPropertyDescriptors(t)), n;
|
|
231
277
|
}
|
|
232
278
|
//#endregion
|
|
233
279
|
//#region lib/object/utils/keys/index.ts
|
|
234
|
-
function
|
|
280
|
+
function se(e) {
|
|
235
281
|
return Object.keys(e);
|
|
236
282
|
}
|
|
237
283
|
//#endregion
|
|
238
284
|
//#region lib/object/utils/omit/index.ts
|
|
239
|
-
function
|
|
285
|
+
function ce(e, t) {
|
|
240
286
|
let n = { ...e }, r = Array.isArray(t) ? t : [t];
|
|
241
287
|
for (let e of r) delete n[e];
|
|
242
288
|
return n;
|
|
243
289
|
}
|
|
244
290
|
//#endregion
|
|
245
291
|
//#region lib/object/utils/pick/index.ts
|
|
246
|
-
function
|
|
292
|
+
function le(e, t) {
|
|
247
293
|
let n = {}, r = Array.isArray(t) ? t : [t];
|
|
248
294
|
for (let t of r) n[t] = e[t];
|
|
249
295
|
return n;
|
|
250
296
|
}
|
|
251
297
|
//#endregion
|
|
252
298
|
//#region lib/string/casing/internal/splitCasing/index.ts
|
|
253
|
-
function
|
|
299
|
+
function F(e, t) {
|
|
254
300
|
if (t?.parser) return t.parser(e);
|
|
255
301
|
let n = t?.groupNumbers ?? !1, r = t?.groupUppercaseLetters ?? !0, i = [], a = /[A-Z]/, o = /[0-9]/, s = /[\s-_]/, c = "", l = () => {
|
|
256
302
|
i.push(c), c = "";
|
|
@@ -295,14 +341,14 @@ function ce(e, t) {
|
|
|
295
341
|
}
|
|
296
342
|
//#endregion
|
|
297
343
|
//#region lib/string/casing/utils/custom/index.ts
|
|
298
|
-
function
|
|
299
|
-
let n =
|
|
344
|
+
function I(e, t) {
|
|
345
|
+
let n = F(e, t), r = n.length - 1;
|
|
300
346
|
return n.reduce((e, n, i) => (e += t.transform(n, i), i !== r && (e += t.seperator), e), "");
|
|
301
347
|
}
|
|
302
348
|
//#endregion
|
|
303
349
|
//#region lib/string/casing/utils/camel/index.ts
|
|
304
|
-
function
|
|
305
|
-
return
|
|
350
|
+
function L(e, t) {
|
|
351
|
+
return I(e, {
|
|
306
352
|
...t,
|
|
307
353
|
seperator: "",
|
|
308
354
|
transform: (e, t) => t === 0 ? e.toLowerCase() : `${e.slice(0, 1).toUpperCase()}${e.slice(1).toLowerCase()}`
|
|
@@ -310,13 +356,13 @@ function F(e, t) {
|
|
|
310
356
|
}
|
|
311
357
|
//#endregion
|
|
312
358
|
//#region lib/string/casing/utils/capitalize/index.ts
|
|
313
|
-
function
|
|
359
|
+
function R(e) {
|
|
314
360
|
return `${e.slice(0, 1).toUpperCase()}${e.slice(1)}`;
|
|
315
361
|
}
|
|
316
362
|
//#endregion
|
|
317
363
|
//#region lib/string/casing/utils/http/index.ts
|
|
318
|
-
function
|
|
319
|
-
return
|
|
364
|
+
function z(e, t) {
|
|
365
|
+
return I(e, {
|
|
320
366
|
...t,
|
|
321
367
|
seperator: "-",
|
|
322
368
|
transform: (e) => `${e.slice(0, 1).toUpperCase()}${e.slice(1).toLowerCase()}`
|
|
@@ -324,28 +370,28 @@ function L(e, t) {
|
|
|
324
370
|
}
|
|
325
371
|
//#endregion
|
|
326
372
|
//#region lib/string/casing/utils/kebab/index.ts
|
|
327
|
-
function
|
|
328
|
-
return
|
|
373
|
+
function B(e, t) {
|
|
374
|
+
return I(e, {
|
|
329
375
|
...t,
|
|
330
376
|
seperator: "-",
|
|
331
377
|
transform: (e) => t?.screaming ? e.toUpperCase() : e.toLowerCase()
|
|
332
378
|
});
|
|
333
379
|
}
|
|
334
|
-
function
|
|
335
|
-
return
|
|
380
|
+
function V(e, t) {
|
|
381
|
+
return B(e, {
|
|
336
382
|
...t,
|
|
337
383
|
screaming: !0
|
|
338
384
|
});
|
|
339
385
|
}
|
|
340
386
|
//#endregion
|
|
341
387
|
//#region lib/string/casing/utils/lower/index.ts
|
|
342
|
-
function
|
|
388
|
+
function H(e) {
|
|
343
389
|
return e.toLowerCase();
|
|
344
390
|
}
|
|
345
391
|
//#endregion
|
|
346
392
|
//#region lib/string/casing/utils/pascal/index.ts
|
|
347
|
-
function
|
|
348
|
-
return
|
|
393
|
+
function U(e, t) {
|
|
394
|
+
return I(e, {
|
|
349
395
|
...t,
|
|
350
396
|
seperator: "",
|
|
351
397
|
transform: (e) => `${e.slice(0, 1).toUpperCase()}${e.slice(1)}`
|
|
@@ -353,23 +399,23 @@ function V(e, t) {
|
|
|
353
399
|
}
|
|
354
400
|
//#endregion
|
|
355
401
|
//#region lib/string/casing/utils/snake/index.ts
|
|
356
|
-
function
|
|
357
|
-
return
|
|
402
|
+
function W(e, t) {
|
|
403
|
+
return I(e, {
|
|
358
404
|
...t,
|
|
359
405
|
seperator: "_",
|
|
360
406
|
transform: (e) => t?.screaming ? e.toUpperCase() : e.toLowerCase()
|
|
361
407
|
});
|
|
362
408
|
}
|
|
363
|
-
function
|
|
364
|
-
return
|
|
409
|
+
function G(e, t) {
|
|
410
|
+
return W(e, {
|
|
365
411
|
...t,
|
|
366
412
|
screaming: !0
|
|
367
413
|
});
|
|
368
414
|
}
|
|
369
415
|
//#endregion
|
|
370
416
|
//#region lib/string/casing/utils/title/index.ts
|
|
371
|
-
function
|
|
372
|
-
return
|
|
417
|
+
function ue(e, t) {
|
|
418
|
+
return I(e, {
|
|
373
419
|
...t,
|
|
374
420
|
seperator: " ",
|
|
375
421
|
transform: (e) => `${e.slice(0, 1).toUpperCase()}${e.slice(1)}`
|
|
@@ -377,17 +423,17 @@ function W(e, t) {
|
|
|
377
423
|
}
|
|
378
424
|
//#endregion
|
|
379
425
|
//#region lib/string/casing/utils/uncapitalize/index.ts
|
|
380
|
-
function
|
|
426
|
+
function de(e) {
|
|
381
427
|
return `${e.slice(0, 1).toLowerCase()}${e.slice(1)}`;
|
|
382
428
|
}
|
|
383
429
|
//#endregion
|
|
384
430
|
//#region lib/string/casing/utils/upper/index.ts
|
|
385
|
-
function
|
|
431
|
+
function fe(e) {
|
|
386
432
|
return e.toUpperCase();
|
|
387
433
|
}
|
|
388
434
|
//#endregion
|
|
389
435
|
//#region lib/string/utils/parseUrlParams/index.ts
|
|
390
|
-
function
|
|
436
|
+
function pe(e, t) {
|
|
391
437
|
let n = new URL(e), r = Object.fromEntries(n.searchParams.entries());
|
|
392
438
|
if (t) {
|
|
393
439
|
let e = {};
|
|
@@ -398,12 +444,12 @@ function de(e, t) {
|
|
|
398
444
|
}
|
|
399
445
|
//#endregion
|
|
400
446
|
//#region lib/string/utils/slug/index.ts
|
|
401
|
-
function
|
|
447
|
+
function me(e) {
|
|
402
448
|
return e.normalize().toLowerCase().replace(/[^\w ]+/g, "").replace(/ +/g, "-");
|
|
403
449
|
}
|
|
404
450
|
//#endregion
|
|
405
451
|
//#region lib/string/utils/textDifference/index.ts
|
|
406
|
-
var
|
|
452
|
+
var K = /* @__PURE__ */ c((/* @__PURE__ */ o(((e, t) => {
|
|
407
453
|
var n = function() {
|
|
408
454
|
this.Diff_Timeout = 1, this.Diff_EditCost = 4, this.Match_Threshold = .5, this.Match_Distance = 1e3, this.Patch_DeleteThreshold = .5, this.Patch_Margin = 4, this.Match_MaxBits = 32;
|
|
409
455
|
}, r = -1, i = 1, a = 0;
|
|
@@ -864,7 +910,7 @@ var G = /* @__PURE__ */ c((/* @__PURE__ */ o(((e, t) => {
|
|
|
864
910
|
}
|
|
865
911
|
return n.join("").replace(/%20/g, " ");
|
|
866
912
|
}, t.exports = n, t.exports.diff_match_patch = n, t.exports.DIFF_DELETE = r, t.exports.DIFF_INSERT = i, t.exports.DIFF_EQUAL = a;
|
|
867
|
-
})))(), 1),
|
|
913
|
+
})))(), 1), he = /* @__PURE__ */ new Set([
|
|
868
914
|
"area",
|
|
869
915
|
"base",
|
|
870
916
|
"br",
|
|
@@ -879,8 +925,8 @@ var G = /* @__PURE__ */ c((/* @__PURE__ */ o(((e, t) => {
|
|
|
879
925
|
"source",
|
|
880
926
|
"track",
|
|
881
927
|
"wbr"
|
|
882
|
-
]),
|
|
883
|
-
function
|
|
928
|
+
]), ge = /* @__PURE__ */ new Set(/* @__PURE__ */ "a.abbr.b.bdi.bdo.br.button.cite.code.data.dfn.em.i.img.input.kbd.label.mark.q.rp.rt.ruby.s.samp.select.small.span.strong.sub.sup.textarea.time.u.var.wbr".split("."));
|
|
929
|
+
function _e(e, t) {
|
|
884
930
|
if (e.startsWith("<!--", t)) {
|
|
885
931
|
let n = e.indexOf("-->", t + 4);
|
|
886
932
|
return n === -1 ? -1 : n + 2;
|
|
@@ -899,11 +945,11 @@ function he(e, t) {
|
|
|
899
945
|
}
|
|
900
946
|
return -1;
|
|
901
947
|
}
|
|
902
|
-
function
|
|
948
|
+
function ve(e) {
|
|
903
949
|
let t = [], n = 0;
|
|
904
950
|
for (; n < e.length;) {
|
|
905
951
|
if (e[n] === "<") {
|
|
906
|
-
let r =
|
|
952
|
+
let r = _e(e, n);
|
|
907
953
|
if (r === -1) {
|
|
908
954
|
t.push({
|
|
909
955
|
kind: "text",
|
|
@@ -925,13 +971,13 @@ function ge(e) {
|
|
|
925
971
|
}
|
|
926
972
|
return t;
|
|
927
973
|
}
|
|
928
|
-
function
|
|
974
|
+
function ye(e) {
|
|
929
975
|
let t = /^<\/?\s*([a-zA-Z][a-zA-Z0-9:-]*)/.exec(e);
|
|
930
976
|
return t ? t[1].toLowerCase() : "";
|
|
931
977
|
}
|
|
932
|
-
function
|
|
978
|
+
function q(e) {
|
|
933
979
|
let t = [], n = [], r = () => n.length ? n[n.length - 1].children : t;
|
|
934
|
-
for (let t of
|
|
980
|
+
for (let t of ve(e)) {
|
|
935
981
|
if (t.kind === "text") {
|
|
936
982
|
t.value && r().push({
|
|
937
983
|
kind: "text",
|
|
@@ -950,7 +996,7 @@ function K(e) {
|
|
|
950
996
|
});
|
|
951
997
|
continue;
|
|
952
998
|
}
|
|
953
|
-
let i =
|
|
999
|
+
let i = ye(e);
|
|
954
1000
|
if (e.startsWith("</")) {
|
|
955
1001
|
let t = -1;
|
|
956
1002
|
for (let e = n.length - 1; e >= 0; --e) if (n[e].tag === i) {
|
|
@@ -976,28 +1022,28 @@ function K(e) {
|
|
|
976
1022
|
closeTag: "",
|
|
977
1023
|
children: []
|
|
978
1024
|
};
|
|
979
|
-
r().push(a), !/\/\s*>$/.test(e) && !
|
|
1025
|
+
r().push(a), !/\/\s*>$/.test(e) && !he.has(i) && n.push(a);
|
|
980
1026
|
}
|
|
981
1027
|
return t;
|
|
982
1028
|
}
|
|
983
|
-
function q(e) {
|
|
984
|
-
return me.has(e) ? "INLINE" : "BLOCK";
|
|
985
|
-
}
|
|
986
1029
|
function J(e) {
|
|
987
|
-
return e
|
|
1030
|
+
return ge.has(e) ? "INLINE" : "BLOCK";
|
|
988
1031
|
}
|
|
989
1032
|
function Y(e) {
|
|
990
|
-
return e.kind === "text" ?
|
|
1033
|
+
return e.kind === "text" ? e.text : `${e.openTag}${e.children.map(Y).join("")}${e.closeTag}`;
|
|
991
1034
|
}
|
|
992
1035
|
function X(e) {
|
|
1036
|
+
return e.kind === "text" ? `T:${e.text}` : `E:${e.openTag}${e.children.map(X).join("")}${e.closeTag}`;
|
|
1037
|
+
}
|
|
1038
|
+
function Z(e) {
|
|
993
1039
|
switch (e) {
|
|
994
|
-
case
|
|
995
|
-
case
|
|
996
|
-
case
|
|
1040
|
+
case K.default.DIFF_EQUAL: return "EQUAL";
|
|
1041
|
+
case K.default.DIFF_INSERT: return "INSERT";
|
|
1042
|
+
case K.default.DIFF_DELETE: return "DELETE";
|
|
997
1043
|
default: throw Error("Got invalid difference marker to determine type");
|
|
998
1044
|
}
|
|
999
1045
|
}
|
|
1000
|
-
function
|
|
1046
|
+
function be({ oldItems: e, newItems: t, key: n }) {
|
|
1001
1047
|
let r = /* @__PURE__ */ new Map(), i = 33, a = () => {
|
|
1002
1048
|
i === 55296 && (i = 57344);
|
|
1003
1049
|
let e = String.fromCharCode(i);
|
|
@@ -1009,12 +1055,12 @@ function ve({ oldItems: e, newItems: t, key: n }) {
|
|
|
1009
1055
|
o === void 0 && (o = a(), r.set(e, o)), t += o;
|
|
1010
1056
|
}
|
|
1011
1057
|
return t;
|
|
1012
|
-
}, s = o(e), c = o(t), l = new
|
|
1013
|
-
for (let [n, r] of l) for (let i of r) n ===
|
|
1058
|
+
}, s = o(e), c = o(t), l = new K.default().diff_main(s, c), u = [], d = 0, f = 0;
|
|
1059
|
+
for (let [n, r] of l) for (let i of r) n === K.default.DIFF_EQUAL ? (u.push({
|
|
1014
1060
|
type: "EQUAL",
|
|
1015
1061
|
oldItem: e[d],
|
|
1016
1062
|
newItem: t[f]
|
|
1017
|
-
}), d += 1, f += 1) : n ===
|
|
1063
|
+
}), d += 1, f += 1) : n === K.default.DIFF_DELETE ? (u.push({
|
|
1018
1064
|
type: "DELETE",
|
|
1019
1065
|
oldItem: e[d]
|
|
1020
1066
|
}), d += 1) : (u.push({
|
|
@@ -1023,10 +1069,10 @@ function ve({ oldItems: e, newItems: t, key: n }) {
|
|
|
1023
1069
|
}), f += 1);
|
|
1024
1070
|
return u;
|
|
1025
1071
|
}
|
|
1026
|
-
function
|
|
1027
|
-
let n = new
|
|
1072
|
+
function xe(e, t) {
|
|
1073
|
+
let n = new K.default(), r = n.diff_main(e, t);
|
|
1028
1074
|
return n.diff_cleanupSemantic(r), r.map(([e, t]) => ({
|
|
1029
|
-
type:
|
|
1075
|
+
type: Z(e),
|
|
1030
1076
|
content: t,
|
|
1031
1077
|
context: "INLINE"
|
|
1032
1078
|
}));
|
|
@@ -1038,15 +1084,15 @@ function Q(e, t) {
|
|
|
1038
1084
|
context: "INLINE"
|
|
1039
1085
|
} : {
|
|
1040
1086
|
type: t,
|
|
1041
|
-
content:
|
|
1042
|
-
context:
|
|
1087
|
+
content: Y(e),
|
|
1088
|
+
context: J(e.tag)
|
|
1043
1089
|
};
|
|
1044
1090
|
}
|
|
1045
1091
|
function $(e, t) {
|
|
1046
|
-
let n =
|
|
1092
|
+
let n = be({
|
|
1047
1093
|
oldItems: e,
|
|
1048
1094
|
newItems: t,
|
|
1049
|
-
key:
|
|
1095
|
+
key: X
|
|
1050
1096
|
}), r = [];
|
|
1051
1097
|
for (let e = 0; e < n.length; e += 1) {
|
|
1052
1098
|
let t = n[e];
|
|
@@ -1061,16 +1107,16 @@ function $(e, t) {
|
|
|
1061
1107
|
r.push({
|
|
1062
1108
|
type: "EQUAL",
|
|
1063
1109
|
content: n.openTag,
|
|
1064
|
-
context:
|
|
1110
|
+
context: J(n.tag)
|
|
1065
1111
|
}, ...$(n.children, a.children)), n.closeTag && r.push({
|
|
1066
1112
|
type: "EQUAL",
|
|
1067
1113
|
content: n.closeTag,
|
|
1068
|
-
context:
|
|
1114
|
+
context: J(n.tag)
|
|
1069
1115
|
}), e += 1;
|
|
1070
1116
|
continue;
|
|
1071
1117
|
}
|
|
1072
1118
|
if (n.kind === "text" && a.kind === "text") {
|
|
1073
|
-
r.push(...
|
|
1119
|
+
r.push(...xe(n.text, a.text)), e += 1;
|
|
1074
1120
|
continue;
|
|
1075
1121
|
}
|
|
1076
1122
|
r.push(Q(n, "DELETE"), Q(a, "INSERT")), e += 1;
|
|
@@ -1084,7 +1130,7 @@ function $(e, t) {
|
|
|
1084
1130
|
}
|
|
1085
1131
|
return r;
|
|
1086
1132
|
}
|
|
1087
|
-
function
|
|
1133
|
+
function Se(e) {
|
|
1088
1134
|
let t = [];
|
|
1089
1135
|
for (let n of e) {
|
|
1090
1136
|
let e = t[t.length - 1];
|
|
@@ -1096,17 +1142,17 @@ function ye(e) {
|
|
|
1096
1142
|
}
|
|
1097
1143
|
return t;
|
|
1098
1144
|
}
|
|
1099
|
-
function
|
|
1145
|
+
function Ce(e, t, n) {
|
|
1100
1146
|
let r = n?.htmlAware ?? !1, i = n?.raw ?? !1, a = [];
|
|
1101
1147
|
if (r) {
|
|
1102
|
-
let n =
|
|
1103
|
-
a.push(...
|
|
1148
|
+
let n = q(e), r = q(t);
|
|
1149
|
+
a.push(...Se($(n, r)));
|
|
1104
1150
|
} else {
|
|
1105
|
-
let n = new
|
|
1151
|
+
let n = new K.default(), r = n.diff_main(e, t);
|
|
1106
1152
|
n.diff_cleanupSemantic(r);
|
|
1107
1153
|
for (let [e, t] of r) a.push({
|
|
1108
1154
|
content: t,
|
|
1109
|
-
type:
|
|
1155
|
+
type: Z(e),
|
|
1110
1156
|
context: "UNKNOWN"
|
|
1111
1157
|
});
|
|
1112
1158
|
}
|
|
@@ -1195,4 +1241,4 @@ function be(e, t, n) {
|
|
|
1195
1241
|
return a;
|
|
1196
1242
|
}
|
|
1197
1243
|
//#endregion
|
|
1198
|
-
export { u as ClusterUtilError, g as ListUtilError,
|
|
1244
|
+
export { u as ClusterUtilError, g as ListUtilError, j as RangeUtilError, D as RetryUtilError, l as UtilError, L as camelCase, R as capitalize, S as chain, d as cluster, C as compose, h as compute, f as counting, I as customCase, w as defer, ae as entries, oe as extend, p as fork, z as httpHeaderCase, z as trainCase, m as isComputation, A as isEmpty, k as isObject, ee as isPrimitive, re as isReadOnly, B as kebabCase, se as keys, _ as list, H as lowerCase, te as match, ce as omit, pe as parseUrlParams, U as pascalCase, le as pick, T as preset, ne as range, ie as readOnly, O as retry, V as screamingKebabCase, G as screamingSnakeCase, v as select, y as sift, E as sleep, me as slug, W as snakeCase, b as sum, Ce as textDifference, ue as titleCase, N as toFloat, P as toInt, x as toggle, de as uncapitalize, fe as upperCase, M as values };
|
package/dist/misc/index.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
export * from './utils/compute';
|
|
2
2
|
export * from './utils/isEmpty';
|
|
3
3
|
export * from './utils/isPrimitive';
|
|
4
|
+
export * from './utils/match';
|
|
4
5
|
export * from './utils/range';
|
|
6
|
+
export * from './utils/readOnly';
|
|
5
7
|
export * from './utils/sleep';
|
|
8
|
+
export * from './utils/values';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Computable } from '../compute';
|
|
2
|
+
export type MatchTarget = string | number | boolean | bigint | null | undefined;
|
|
3
|
+
export type MatchClause<T extends MatchTarget> = Partial<Record<`${T}`, Computable<unknown>>>;
|
|
4
|
+
type ComputedValue<C> = C extends Computable<infer V> ? V : never;
|
|
5
|
+
/**
|
|
6
|
+
* Matches a value to a clause that return a value
|
|
7
|
+
* and returns a fallback if none of the cases match.
|
|
8
|
+
*
|
|
9
|
+
* The time complexity for this is `O(1)`.
|
|
10
|
+
*
|
|
11
|
+
* @template {MatchTarget} T
|
|
12
|
+
* @template {MatchClause<T>} C
|
|
13
|
+
* @template F
|
|
14
|
+
* @param value The target value to match
|
|
15
|
+
* @param clause Clause cases to check `value` against
|
|
16
|
+
* @param fallback A fallback if no case in `clause` matches
|
|
17
|
+
* @returns {ComputedValue<C[keyof C]> | F | undefined}
|
|
18
|
+
*/
|
|
19
|
+
export declare function match<const T extends MatchTarget, const C extends Required<MatchClause<T>>>(value: T, clause: C): ComputedValue<C[keyof C]>;
|
|
20
|
+
export declare function match<const T extends MatchTarget, const C extends MatchClause<T>>(value: T, clause: C): ComputedValue<C[keyof C]> | undefined;
|
|
21
|
+
export declare function match<const T extends MatchTarget, const C extends MatchClause<T>, const F>(value: T, clause: C, fallback: Computable<F, [value: `${Exclude<T, keyof C>}`]>): ComputedValue<C[keyof C]> | F;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Key } from '../../../types';
|
|
2
|
+
export type ReadOnlyTarget = Record<Key, unknown> | readonly unknown[] | unknown[] | Map<unknown, unknown> | Set<unknown>;
|
|
3
|
+
export type ReadOnly<T> = T extends Record<Key, unknown> ? Readonly<T> : T extends readonly (infer U)[] ? readonly U[] : T extends ReadonlyMap<infer K, infer V> ? ReadonlyMap<K, V> : T extends ReadonlySet<infer U> ? ReadonlySet<U> : T;
|
|
4
|
+
export type DeepReadOnly<T> = T extends Record<Key, unknown> ? {
|
|
5
|
+
readonly [K in keyof T]: DeepReadOnly<T[K]>;
|
|
6
|
+
} : T extends readonly (infer U)[] ? readonly DeepReadOnly<U>[] : T extends ReadonlyMap<infer K, infer V> ? ReadonlyMap<DeepReadOnly<K>, DeepReadOnly<V>> : T extends ReadonlySet<infer U> ? ReadonlySet<DeepReadOnly<U>> : T;
|
|
7
|
+
/**
|
|
8
|
+
* Checks if the given value is read-only.
|
|
9
|
+
*
|
|
10
|
+
* Whether an object's existing property attributes and values cannot be modified, and new properties cannot be added.
|
|
11
|
+
*
|
|
12
|
+
* The time complexity for this is `O(1)`.
|
|
13
|
+
*
|
|
14
|
+
* @template {Record<Key, unknown> | unknown[] | readonly unknown[]} T
|
|
15
|
+
* @param {T} value The value to check if it is read-only
|
|
16
|
+
* @returns {value is Readonly<T>} A boolean that signals if the given value is read-only
|
|
17
|
+
*/
|
|
18
|
+
export declare function isReadOnly<const T extends Record<Key, unknown> | unknown[] | readonly unknown[]>(value: T): value is Readonly<T>;
|
|
19
|
+
/**
|
|
20
|
+
* Returns a shallow read-only copy of an object, array, map, or set.
|
|
21
|
+
*
|
|
22
|
+
* Only `value` itself is copied and frozen — nested objects/arrays/maps/sets keep the exact same
|
|
23
|
+
* references as `value` and remain mutable.
|
|
24
|
+
*
|
|
25
|
+
* The time complexity for this is `O(n)` where `n` is the amount of top-level entries in `value`.
|
|
26
|
+
*
|
|
27
|
+
* @template {ReadOnlyTarget} T
|
|
28
|
+
* @param {T} value The object, array, map, or set to return a frozen shallow copy of
|
|
29
|
+
* @param {false} [deepFreeze] Whether nested objects, arrays, maps, and sets should also be cloned and frozen
|
|
30
|
+
* @returns {Readonly<T>} A frozen shallow copy of `value`
|
|
31
|
+
*/
|
|
32
|
+
export declare function readOnly<const T extends ReadOnlyTarget>(value: T, deepFreeze?: false): Readonly<T>;
|
|
33
|
+
/**
|
|
34
|
+
* Returns a deep read-only copy of an object, array, map, or set.
|
|
35
|
+
*
|
|
36
|
+
* Every nested object, array, map, and set is recursively cloned and frozen, so nothing in the
|
|
37
|
+
* result is shared with `value`.
|
|
38
|
+
*
|
|
39
|
+
* The time complexity for this is `O(n)` where `n` is the total amount of nested entries in `value`.
|
|
40
|
+
*
|
|
41
|
+
* @template {ReadOnlyTarget} T
|
|
42
|
+
* @param {T} value The object, array, map, or set to return a frozen deep copy of
|
|
43
|
+
* @param {true} deepFreeze Whether nested objects, arrays, maps, and sets should also be cloned and frozen
|
|
44
|
+
* @returns {DeepReadOnly<T>} A deeply frozen copy of `value`
|
|
45
|
+
*/
|
|
46
|
+
export declare function readOnly<const T extends ReadOnlyTarget>(value: T, deepFreeze: true): DeepReadOnly<T>;
|
|
47
|
+
export declare function readOnly<const T extends ReadOnlyTarget>(value: T, deepFreeze: boolean): Readonly<T> | DeepReadOnly<T>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Key } from '../../../types';
|
|
2
|
+
export type ValuesTarget = ArrayLike<unknown> | Record<Key, unknown> | Map<unknown, unknown> | Set<unknown> | Iterable<unknown>;
|
|
3
|
+
export type Values<T extends ValuesTarget> = T extends ArrayLike<infer V> ? V[] : T extends Record<Key, infer V> ? V[] : T extends Map<unknown, infer V> ? V[] : T extends Set<infer V> ? V[] : T extends Iterable<infer V> ? V[] : never;
|
|
4
|
+
/**
|
|
5
|
+
* Returns an array of values based on the given target.
|
|
6
|
+
*
|
|
7
|
+
* The time complexity for this is `O(n)` where `n` is the amount of values in the given `target`.
|
|
8
|
+
*
|
|
9
|
+
* @template {ValuesTarget} T
|
|
10
|
+
* @param target The given value to extract values from
|
|
11
|
+
* @returns {Values<T>} An array of values associated with `target`
|
|
12
|
+
*/
|
|
13
|
+
export declare function values<const T extends ValuesTarget>(target: T): Values<T>;
|
package/dist/object/index.d.ts
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Key } from '../../../types';
|
|
2
|
+
export type Extend<T extends Record<Key, unknown>, U extends Partial<T> | Record<Key, unknown>> = Omit<T, keyof U> & U;
|
|
3
|
+
/**
|
|
4
|
+
* Extends an object with another object.
|
|
5
|
+
*
|
|
6
|
+
* The time complexity for this is `O(n * m)` where `n` is the amount of keys in `other`.
|
|
7
|
+
*
|
|
8
|
+
* @template {Record<Key, unknown>} T
|
|
9
|
+
* @template {Partial<T> & Record<Key, unknown>} U
|
|
10
|
+
* @param {T} value The object to extend
|
|
11
|
+
* @param {U} other The object to override or extend properties of `value` with
|
|
12
|
+
* @returns {Extend<T, U>} An object where `value` is extended by `other`
|
|
13
|
+
*/
|
|
14
|
+
export declare function extend<const T extends Record<Key, unknown>, const U extends Partial<T> | Record<Key, unknown>>(value: T, other: U): Extend<T, U>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@catstral/levy-utils",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Re-useable and common JS/TS utility functions",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"contributors": [
|
|
@@ -60,4 +60,4 @@
|
|
|
60
60
|
"dependencies": {
|
|
61
61
|
"diff-match-patch": "^1.0.5"
|
|
62
62
|
}
|
|
63
|
-
}
|
|
63
|
+
}
|