@sheetxl/scripting 0.3.0 → 0.3.2
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/LICENSE.md +11 -11
- package/README.md +309 -309
- package/browser/cjs/{B3nadCTI8zdSk-gc.cjs → B8hUmPaJ_G4771ms.cjs} +3 -8
- package/browser/cjs/{DkIsuPZMPkfoK3Jp.cjs → CDos45AgioCc7Wru.cjs} +3 -8
- package/browser/cjs/DB8tm0twSDrHOSAo.cjs +6 -0
- package/browser/cjs/DL09xflzNUP8hggN.cjs +6 -0
- package/browser/cjs/{CT0S-WHf7X39cTea.cjs → UM9UO3OmBrcEPsNS.cjs} +8 -13
- package/browser/cjs/index.cjs +2 -2
- package/browser/cjs/{4EW9W7anuBC4Ixuz.cjs → nBFuoglmCOUhR50a.cjs} +2 -2
- package/browser/esm/BoiW_BOJ5OHmdLyZ.mjs +24 -0
- package/{node/esm/BdBONnJjxA0vmb5w.mjs → browser/esm/BwMOs09MXUNDNqns.mjs} +2 -2
- package/browser/esm/{pgx_xxlbzJi1h-Ry.mjs → DSLk4bBkl_1838ab.mjs} +309 -315
- package/browser/esm/{CrJw0g8KXPNom-Ky.mjs → DjLbON0PxpHIrmHp.mjs} +9 -10
- package/browser/esm/{CbLsYpc8AjvzOnX5.mjs → bSwkn4uRfbKHTmAz.mjs} +8 -13
- package/browser/esm/{DBbM59Yn4kFX4SQm.mjs → df4LgjlLDxYFxpkG.mjs} +4 -10
- package/browser/esm/index.mjs +2 -2
- package/licenses/dependencies.txt +22 -22
- package/node/esm/{BSKRgKTYzXYZhJeu.mjs → BBFK3m6jfVOnGFzn.mjs} +8 -13
- package/node/esm/{CyqoOZg4zm3hMd1x.mjs → BayKEHPkMWnwNMsV.mjs} +3 -9
- package/node/esm/CvEasjhhNzMnHVk8.mjs +14 -0
- package/node/esm/{B7hOAXX2NY8LWfPG.mjs → D5S3RWVBlv0XlRsZ.mjs} +1 -1
- package/{browser/esm/BlO3_ovphho937XG.mjs → node/esm/D9govIs06RXYWtVj.mjs} +2 -2
- package/node/esm/index.mjs +3 -9
- package/package.json +3 -3
- package/browser/cjs/C3lcIYRZjt7EC-RA.cjs +0 -6
- package/browser/cjs/DELLeANCkwzuN1P-.cjs +0 -6
- package/browser/esm/CcktEIRGkk5IsJ6u.mjs +0 -24
- package/node/esm/DLL8RPg_Fg_1u71G.mjs +0 -14
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license @sheetxl/scripting - Scripting - Scripting engine for Macros and formulas; includes TypeScript and EsBuild. - v0.3.
|
|
3
|
-
*
|
|
4
|
-
* (C) 2025-present SheetXL Inc. & Michael T. Ford
|
|
5
|
-
* License: The license can be found at https://www.sheetxl.com/license.
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* @license @sheetxl/utils - Utils - Utilities used by most SheetXL components. - v0.3.0
|
|
2
|
+
* @license @sheetxl/scripting - Scripting - Scripting engine for Macros and formulas; includes TypeScript and EsBuild. - v0.3.2
|
|
9
3
|
*
|
|
10
4
|
* (C) 2025-present SheetXL Inc. & Michael T. Ford
|
|
11
5
|
* License: The license can be found at https://www.sheetxl.com/license.
|
|
@@ -15,30 +9,30 @@ Object.freeze(Object.defineProperty({ __proto__: null, EmptyBounds: Mt, EmptyRec
|
|
|
15
9
|
const m = "column", j = "row", Rt = Object.freeze({ colIndex: 0, rowIndex: 0 }), At = Object.freeze({ colStart: 0, rowStart: 0, colEnd: 0, rowEnd: 0 }), yt = (e, t) => e.colStart === t.colStart ? e.rowStart - t.rowStart : e.colStart - t.colStart, gt = (e, t) => e.rowStart === t.rowStart ? e.colStart - t.colStart : e.rowStart - t.rowStart, Ft = (e, t) => e.rowEnd === t.rowEnd ? t.colEnd - e.colEnd : t.rowEnd - e.rowEnd, Lt = (e, t) => e.colEnd === t.colEnd ? t.rowEnd - e.rowEnd : t.colEnd - e.colEnd, J = (e, t) => e.colIndex === t.colIndex ? e.rowIndex - t.rowIndex : e.colIndex - t.colIndex, H = (e, t) => e.rowIndex === t.rowIndex ? e.colIndex - t.colIndex : e.rowIndex - t.rowIndex, bt = (e = j, t = !1) => t ? e !== m ? Ft : Lt : e !== m ? gt : yt, Y = (e, t) => e === t || !(!e || !t) && e.rowIndex === t.rowIndex && e.colIndex === t.colIndex, D = (e, t) => e === t || !(!e || !t) && e.rowStart === t.rowStart && e.rowEnd === t.rowEnd && e.colStart === t.colStart && e.colEnd === t.colEnd, $ = (e, t) => !(!e || !t || e.colStart > t.colEnd || t.colStart > e.colEnd || e.rowStart > t.rowEnd || t.rowStart > e.rowEnd), K = (e, t) => {
|
|
16
10
|
if (e === t) return !0;
|
|
17
11
|
if (!e || !t || e.length !== t.length) return !1;
|
|
18
|
-
for (let
|
|
12
|
+
for (let n = 0; n < e.length; n++) if (!D(e[n], t[n])) return !1;
|
|
19
13
|
return !0;
|
|
20
|
-
}, U = (e, t,
|
|
14
|
+
}, U = (e, t, n) => {
|
|
21
15
|
if (!e && !t) return null;
|
|
22
|
-
if (!e) return
|
|
23
|
-
if (!t) return
|
|
24
|
-
const
|
|
25
|
-
let l =
|
|
26
|
-
return l ? (l.colStart =
|
|
16
|
+
if (!e) return n ? t : { ...t };
|
|
17
|
+
if (!t) return n ? e : { ...e };
|
|
18
|
+
const r = Math.min(e.colStart, t.colStart), o = Math.min(e.rowStart, t.rowStart), a = Math.max(e.colEnd, t.colEnd), i = Math.max(e.rowEnd, t.rowEnd);
|
|
19
|
+
let l = n;
|
|
20
|
+
return l ? (l.colStart = r, l.rowStart = o, l.colEnd = a, l.rowEnd = i) : l = { colStart: r, rowStart: o, colEnd: a, rowEnd: i }, l;
|
|
27
21
|
}, Z = (e, t) => {
|
|
28
22
|
if (!t || t.length === 0) return e;
|
|
29
|
-
const
|
|
30
|
-
for (let
|
|
31
|
-
const o = t[
|
|
32
|
-
$(
|
|
23
|
+
const n = { ...e };
|
|
24
|
+
for (let r = 0; r < t.length; r++) {
|
|
25
|
+
const o = t[r];
|
|
26
|
+
$(n, o) && (n.rowStart = Math.min(n.rowStart, o.rowStart), n.colStart = Math.min(n.colStart, o.colStart), n.rowEnd = Math.max(n.rowEnd, o.rowEnd), n.colEnd = Math.max(n.colEnd, o.colEnd));
|
|
33
27
|
}
|
|
34
|
-
return
|
|
35
|
-
}, Ut = [null, null], Pt = (e, t,
|
|
28
|
+
return n;
|
|
29
|
+
}, Ut = [null, null], Pt = (e, t, n) => {
|
|
36
30
|
if (e[0].value === e[1].value) return t;
|
|
37
31
|
};
|
|
38
|
-
function X(e, t = 2,
|
|
32
|
+
function X(e, t = 2, n, r = j, o) {
|
|
39
33
|
let a = [...e];
|
|
40
34
|
if (t <= 0 || e.length <= 1) return a;
|
|
41
|
-
let i =
|
|
35
|
+
let i = r === m, l = 0, s = !1;
|
|
42
36
|
do {
|
|
43
37
|
const c = a.sort(bt(i ? j : m));
|
|
44
38
|
a = [], a.push(c[0]);
|
|
@@ -49,9 +43,9 @@ function X(e, t = 2, r, n = j, o) {
|
|
|
49
43
|
let G = !1;
|
|
50
44
|
if (G = i ? u && p === g.rowStart && O === g.rowEnd && x + 1 === g.colStart : u && f === g.colStart && x === g.colEnd && O + 1 === g.rowStart, G) {
|
|
51
45
|
let S = { colStart: f, rowStart: p, colEnd: i ? g.colEnd : x, rowEnd: i ? O : g.rowEnd };
|
|
52
|
-
if (u.value !== void 0 && (S.value = u.value),
|
|
46
|
+
if (u.value !== void 0 && (S.value = u.value), n) {
|
|
53
47
|
const F = o ?? [null, null];
|
|
54
|
-
F[0] = u, F[1] = g, S =
|
|
48
|
+
F[0] = u, F[1] = g, S = n(F, S, r);
|
|
55
49
|
}
|
|
56
50
|
if (S) {
|
|
57
51
|
a[w] = S, s = !0, u = S, f = u.colStart, p = u.rowStart, x = u.colEnd, O = u.rowEnd;
|
|
@@ -66,11 +60,11 @@ function X(e, t = 2, r, n = j, o) {
|
|
|
66
60
|
}
|
|
67
61
|
Object.freeze(Object.defineProperty({ __proto__: null, EmptyCell: Rt, EmptyRange: At, cellToRange: (e, t) => {
|
|
68
62
|
if (!e) return null;
|
|
69
|
-
let
|
|
70
|
-
return
|
|
71
|
-
}, columnFirstCellComparator: J, columnFirstRangeComparator: yt, createCellComparator: (e = j, t = !1) => t ? e !== m ? (
|
|
72
|
-
const
|
|
73
|
-
let
|
|
63
|
+
let n = t;
|
|
64
|
+
return n || (n = { ...e }, delete n.colIndex, delete n.rowIndex), n.colStart = e.colIndex ?? 0, n.rowStart = e.rowIndex ?? 0, n.colEnd = e.colIndex ?? 0, n.rowEnd = e.rowIndex ?? 0, n;
|
|
65
|
+
}, columnFirstCellComparator: J, columnFirstRangeComparator: yt, createCellComparator: (e = j, t = !1) => t ? e !== m ? (n, r) => n.rowIndex === r.rowIndex ? r.colIndex - n.colIndex : r.rowIndex - n.rowIndex : (n, r) => n.colIndex === r.colIndex ? r.rowIndex - n.rowIndex : r.colIndex - n.colIndex : e !== m ? H : J, createConflatingRanges: (e, t = !1) => {
|
|
66
|
+
const n = [];
|
|
67
|
+
let r, o, a = Number.MIN_SAFE_INTEGER, i = Number.MIN_SAFE_INTEGER;
|
|
74
68
|
return { append: (l, s, c) => {
|
|
75
69
|
let d = !0;
|
|
76
70
|
const w = c !== void 0;
|
|
@@ -78,55 +72,55 @@ Object.freeze(Object.defineProperty({ __proto__: null, EmptyCell: Rt, EmptyRange
|
|
|
78
72
|
const p = e ? e(o, c, t) : o === c ? c : void 0;
|
|
79
73
|
p === void 0 ? d = !1 : c = p;
|
|
80
74
|
}
|
|
81
|
-
if (d && s === i + 1 && l === a) return t ?
|
|
82
|
-
|
|
75
|
+
if (d && s === i + 1 && l === a) return t ? r.rowEnd = s : r.colEnd = s, i = s, void (o = c);
|
|
76
|
+
r && n.push(r);
|
|
83
77
|
const u = t ? l : s, f = t ? s : l;
|
|
84
|
-
|
|
85
|
-
}, done: (l) => (
|
|
86
|
-
}, createRangeComparator: bt, defaultRange: (e, t,
|
|
78
|
+
r = { colStart: u, rowStart: f, colEnd: u, rowEnd: f }, w && (r.value = c), a = l, i = s, o = c;
|
|
79
|
+
}, done: (l) => (r && (n.push(r), r = null), l ? X(n, 3, l === !0 ? Pt : l, t ? m : j, Ut) : n) };
|
|
80
|
+
}, createRangeComparator: bt, defaultRange: (e, t, n) => e ? n ? (n.colStart = e.colStart ?? t.colStart, n.rowStart = e.rowStart ?? t.rowStart, n.colEnd = e.colEnd ?? t.colEnd, n.rowEnd = e.rowEnd ?? t.rowEnd, n) : { colStart: e.colStart ?? t.colStart, rowStart: e.rowStart ?? t.rowStart, colEnd: e.colEnd ?? t.colEnd, rowEnd: e.rowEnd ?? t.rowEnd } : t, extendRangeToIntersectingRanges: Z, extendRangeToUnionRanges: (e, t) => {
|
|
87
81
|
if (!t || t.length === 0) return e;
|
|
88
|
-
let
|
|
89
|
-
for (; !D(
|
|
90
|
-
return
|
|
82
|
+
let n = e, r = null;
|
|
83
|
+
for (; !D(n, r); ) r = n, n = Z(r, t);
|
|
84
|
+
return n;
|
|
91
85
|
}, indexOfCoords: (e, t) => {
|
|
92
|
-
const
|
|
93
|
-
for (let
|
|
86
|
+
const n = { colStart: e.colIndex, rowStart: e.rowIndex, colEnd: e.colIndex, rowEnd: e.rowIndex };
|
|
87
|
+
for (let r = t.length - 1; r >= 0; r--) if ($(n, t[r])) return r;
|
|
94
88
|
return -1;
|
|
95
|
-
}, intersectRanges: (e, t,
|
|
96
|
-
if (!e) return
|
|
97
|
-
if (!t) return
|
|
89
|
+
}, intersectRanges: (e, t, n) => {
|
|
90
|
+
if (!e) return n ? t : { ...t };
|
|
91
|
+
if (!t) return n ? e : { ...e };
|
|
98
92
|
if (!e && !t || e.rowStart > t.rowEnd || e.rowEnd < t.rowStart || e.colStart > t.colEnd || e.colEnd < t.colStart) return null;
|
|
99
|
-
const
|
|
100
|
-
let l =
|
|
101
|
-
return l ? (l.colStart =
|
|
102
|
-
}, isCellWithinRange: (e, t) => !(!e || !t || e.rowIndex < t.rowStart || e.rowIndex > t.rowEnd || e.colIndex < t.colStart || e.colIndex > t.colEnd), isEqualCells: Y, isEqualRanges: D, isEqualRangesArrays: K, isEqualSelectionCoords: (e, t) => e === t || !(!e || !t) && e.rangeIndex === t.rangeIndex && !!Y(e.cell, t.cell) && K(e.ranges, t.ranges), isRangeWithinRange: (e, t) => !(e.rowStart < t.rowStart || e.rowEnd > t.rowEnd || e.colStart < t.colStart || e.colEnd > t.colEnd), isRangesIntersect: $, isSingleCell: (e) => !!e && e.rowEnd === e.rowStart && e.colStart === e.colEnd, isValidRange: (e) => !(!e || typeof e.colStart != "number" || e.colStart < 0 || typeof e.colEnd != "number" || e.colEnd < e.colStart || typeof e.rowStart != "number" || e.rowStart < 0 || typeof e.rowEnd != "number" || e.rowEnd < e.rowStart), mergeRangedValues: X, rowFirstCellComparator: H, rowFirstRangeComparator: gt, sanitizeRange: (e) => e ? { colStart: e.colIndex ?? e.colStart ?? 0, rowStart: e.rowIndex ?? e.rowStart ?? 0, colEnd: e.colIndex ?? e.colEnd ?? 0, rowEnd: e.rowIndex ?? e.rowEnd ?? 0 } : null, translateRange: (e, t = -e.rowStart,
|
|
93
|
+
const r = Math.max(e.colStart, t.colStart), o = Math.max(e.rowStart, t.rowStart), a = Math.min(e.colEnd, t.colEnd), i = Math.min(e.rowEnd, t.rowEnd);
|
|
94
|
+
let l = n;
|
|
95
|
+
return l ? (l.colStart = r, l.rowStart = o, l.colEnd = a, l.rowEnd = i) : l = { colStart: r, rowStart: o, colEnd: a, rowEnd: i }, l;
|
|
96
|
+
}, isCellWithinRange: (e, t) => !(!e || !t || e.rowIndex < t.rowStart || e.rowIndex > t.rowEnd || e.colIndex < t.colStart || e.colIndex > t.colEnd), isEqualCells: Y, isEqualRanges: D, isEqualRangesArrays: K, isEqualSelectionCoords: (e, t) => e === t || !(!e || !t) && e.rangeIndex === t.rangeIndex && !!Y(e.cell, t.cell) && K(e.ranges, t.ranges), isRangeWithinRange: (e, t) => !(e.rowStart < t.rowStart || e.rowEnd > t.rowEnd || e.colStart < t.colStart || e.colEnd > t.colEnd), isRangesIntersect: $, isSingleCell: (e) => !!e && e.rowEnd === e.rowStart && e.colStart === e.colEnd, isValidRange: (e) => !(!e || typeof e.colStart != "number" || e.colStart < 0 || typeof e.colEnd != "number" || e.colEnd < e.colStart || typeof e.rowStart != "number" || e.rowStart < 0 || typeof e.rowEnd != "number" || e.rowEnd < e.rowStart), mergeRangedValues: X, rowFirstCellComparator: H, rowFirstRangeComparator: gt, sanitizeRange: (e) => e ? { colStart: e.colIndex ?? e.colStart ?? 0, rowStart: e.rowIndex ?? e.rowStart ?? 0, colEnd: e.colIndex ?? e.colEnd ?? 0, rowEnd: e.rowIndex ?? e.rowEnd ?? 0 } : null, translateRange: (e, t = -e.rowStart, n = -e.colStart, r) => r ? (r.colStart = e.colStart + n, r.rowStart = e.rowStart + t, r.colEnd = e.colEnd + n, r.rowEnd = e.rowEnd + t, r) : { colStart: e.colStart + n, rowStart: e.rowStart + t, colEnd: e.colEnd + n, rowEnd: e.rowEnd + t }, unionRanges: U, unionRangesArrays: (e, t, n) => {
|
|
103
97
|
if (!e || e.length === 0) return null;
|
|
104
98
|
if (e.length === 1 && !t) return e[0];
|
|
105
|
-
let
|
|
106
|
-
for (let o = 1; o < e.length; o++)
|
|
107
|
-
return t && (
|
|
99
|
+
let r = e[0];
|
|
100
|
+
for (let o = 1; o < e.length; o++) r = U(r, e[o], n);
|
|
101
|
+
return t && (r = U(r, t, n)), r;
|
|
108
102
|
} }, Symbol.toStringTag, { value: "Module" }));
|
|
109
103
|
const kt = typeof Symbol == "function" && Symbol.for ? Symbol.for("react.element") : 60103;
|
|
110
104
|
function Nt(e) {
|
|
111
105
|
return /* @__PURE__ */ function(t) {
|
|
112
106
|
return !!t && typeof t == "object";
|
|
113
107
|
}(e) && !function(t) {
|
|
114
|
-
const
|
|
115
|
-
return
|
|
108
|
+
const n = Object.prototype.toString.call(t);
|
|
109
|
+
return n === "[object RegExp]" || n === "[object Date]" || t.$$typeof === kt;
|
|
116
110
|
}(e);
|
|
117
111
|
}
|
|
118
112
|
function I(e, t) {
|
|
119
|
-
return t.clone !== !1 && t.isMergeableObject(e) ? E((
|
|
120
|
-
var
|
|
113
|
+
return t.clone !== !1 && t.isMergeableObject(e) ? E((n = e, Array.isArray(n) ? [] : {}), e, t) : e;
|
|
114
|
+
var n;
|
|
121
115
|
}
|
|
122
|
-
function Bt(e, t,
|
|
123
|
-
return e.concat(t).map(function(
|
|
124
|
-
return I(
|
|
116
|
+
function Bt(e, t, n) {
|
|
117
|
+
return e.concat(t).map(function(r) {
|
|
118
|
+
return I(r, n);
|
|
125
119
|
});
|
|
126
120
|
}
|
|
127
121
|
function Q(e) {
|
|
128
|
-
return Object.keys(e).concat((t = e, Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(t).filter(function(
|
|
129
|
-
return Object.propertyIsEnumerable.call(t,
|
|
122
|
+
return Object.keys(e).concat((t = e, Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(t).filter(function(n) {
|
|
123
|
+
return Object.propertyIsEnumerable.call(t, n);
|
|
130
124
|
}) : []));
|
|
131
125
|
var t;
|
|
132
126
|
}
|
|
@@ -137,10 +131,10 @@ function tt(e, t) {
|
|
|
137
131
|
return !1;
|
|
138
132
|
}
|
|
139
133
|
}
|
|
140
|
-
function E(e, t,
|
|
141
|
-
(
|
|
142
|
-
const
|
|
143
|
-
return
|
|
134
|
+
function E(e, t, n) {
|
|
135
|
+
(n = n || {}).arrayMerge = n.arrayMerge || Bt, n.isMergeableObject = n.isMergeableObject || Nt, n.cloneUnlessOtherwiseSpecified = I;
|
|
136
|
+
const r = Array.isArray(t);
|
|
137
|
+
return r === Array.isArray(e) ? r ? n.arrayMerge(e, t, n) : function(o, a, i) {
|
|
144
138
|
const l = {};
|
|
145
139
|
return i.isMergeableObject(o) && Q(o).forEach(function(s) {
|
|
146
140
|
l[s] = I(o[s], i);
|
|
@@ -152,31 +146,31 @@ function E(e, t, r) {
|
|
|
152
146
|
return typeof f == "function" ? f : E;
|
|
153
147
|
}(s, i)(o[s], a[s], i) : l[s] = I(a[s], i));
|
|
154
148
|
}), l;
|
|
155
|
-
}(e, t,
|
|
149
|
+
}(e, t, n) : I(t, n);
|
|
156
150
|
}
|
|
157
151
|
E.all = function(e, t) {
|
|
158
152
|
if (!Array.isArray(e)) throw new Error("first argument should be an array");
|
|
159
|
-
return e.reduce(function(
|
|
160
|
-
return E(
|
|
153
|
+
return e.reduce(function(n, r) {
|
|
154
|
+
return E(n, r, t);
|
|
161
155
|
}, {});
|
|
162
156
|
};
|
|
163
157
|
const zt = Object.freeze([]), qt = Object.freeze({}), et = (e) => e, R = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(e) {
|
|
164
158
|
let t = 16 * Math.random() | 0;
|
|
165
159
|
return (e === "x" ? t : 3 & t | 8).toString(16);
|
|
166
|
-
}), mt = (e, t) => e === t || !(!Array.isArray(e) || !Array.isArray(t) || e.length !== t.length) && e.every((
|
|
160
|
+
}), mt = (e, t) => e === t || !(!Array.isArray(e) || !Array.isArray(t) || e.length !== t.length) && e.every((n, r) => n === t[r]), _ = (e) => typeof e == "object" && !Array.isArray(e) && e !== null, Et = (e) => typeof e != "object" || Array.isArray(e) || e === null ? e : (Object.keys(e).forEach(function(t) {
|
|
167
161
|
e[t] && typeof e[t] == "object" ? Et(e[t]) : e[t] !== null && e[t] !== void 0 || delete e[t], typeof e[t] == "object" && Object.keys(e[t]).length === 0 && delete e[t];
|
|
168
|
-
}), Object.keys(e).length === 0 ? null : e), Dt = (e, t) => !(e !== t && !mt(e, t) && !e.isEqual?.(t)), St = (e, t,
|
|
162
|
+
}), Object.keys(e).length === 0 ? null : e), Dt = (e, t) => !(e !== t && !mt(e, t) && !e.isEqual?.(t)), St = (e, t, n = Dt) => {
|
|
169
163
|
if (e == null || e === t) return null;
|
|
170
|
-
if (!e || typeof e != "object" || Array.isArray(e) || e.isImmutable?.()) return
|
|
171
|
-
const
|
|
172
|
-
if (
|
|
164
|
+
if (!e || typeof e != "object" || Array.isArray(e) || e.isImmutable?.()) return n(e, t) ? null : e;
|
|
165
|
+
const r = Object.keys(e);
|
|
166
|
+
if (r.length === 0) return null;
|
|
173
167
|
let o = !1;
|
|
174
|
-
for (let a = 0; a <
|
|
175
|
-
const i =
|
|
176
|
-
St(e[i], t?.[i],
|
|
168
|
+
for (let a = 0; a < r.length; a++) {
|
|
169
|
+
const i = r[a];
|
|
170
|
+
St(e[i], t?.[i], n) === null && (o = !0, delete e[i]);
|
|
177
171
|
}
|
|
178
172
|
return o && Object.keys(e).length === 0 ? null : void 0;
|
|
179
|
-
},
|
|
173
|
+
}, nt = typeof performance == "object" && typeof performance.now == "function" ? () => performance.now() : () => Date.now(), rt = (e) => e == null, ot = (e, t) => !(t.left > e.right || t.right < e.left || t.top > e.bottom || t.bottom < e.top), at = !(typeof window > "u" || !window.document || !window.document.createElement), y = { Windows: "windows", MacOS: "macos", IOS: "ios", Linux: "linux", Android: "android", Safari: "safari", Firefox: "firefox", Node: "node", Unknown: "unknown" }, T = () => {
|
|
180
174
|
if (vt()) return y.Node;
|
|
181
175
|
const e = globalThis.navigator !== void 0 && globalThis.navigator.userAgent ? globalThis.navigator.userAgent.toLowerCase() : "";
|
|
182
176
|
return e ? /(win32|win64|windows|wince)/i.test(e) ? y.Windows : /(macintosh|macintel|macppc|mac68k|macos)/i.test(e) ? y.MacOS : /(iphone|ipad|ipod)/i.test(e) ? y.IOS : /android/.test(e) ? y.Android : /linux/.test(e) ? y.Linux : /^((?!chrome|android|).)*safari/i.test(e) ? y.Safari : /^((?!chrome|android|Seamonkey).)*firefox/i.test(e) ? y.Firefox : y.Unknown : y.Unknown;
|
|
@@ -184,282 +178,282 @@ const zt = Object.freeze([]), qt = Object.freeze({}), et = (e) => e, R = () => "
|
|
|
184
178
|
function vt() {
|
|
185
179
|
return typeof process < "u" && process.release?.name === "node" || (typeof process < "u" && process.browser, !1);
|
|
186
180
|
}
|
|
187
|
-
const it = (e, t = !1) => (document.hasFocus() || t) && (e === document.activeElement || e?.contains(document.activeElement)), $t = Object.freeze(Object.defineProperty({ __proto__: null, EmptyArray: zt, EmptyObject: qt, OSType: y, arrayMove: function(e, t,
|
|
188
|
-
const
|
|
189
|
-
return
|
|
181
|
+
const it = (e, t = !1) => (document.hasFocus() || t) && (e === document.activeElement || e?.contains(document.activeElement)), $t = Object.freeze(Object.defineProperty({ __proto__: null, EmptyArray: zt, EmptyObject: qt, OSType: y, arrayMove: function(e, t, n) {
|
|
182
|
+
const r = e.slice();
|
|
183
|
+
return r.splice(n < 0 ? r.length + n : n, 0, r.splice(t, 1)[0]), r;
|
|
190
184
|
}, asNumber: (e) => {
|
|
191
|
-
const t = ((
|
|
185
|
+
const t = ((n) => 1 * n)(e);
|
|
192
186
|
return Number.isFinite(t) ? t : 0;
|
|
193
187
|
}, camelToPrettyCase: (e) => e.length === 1 ? e.toUpperCase() : e.replace(/([A-Z])/g, " $1").replace(/^./, function(t) {
|
|
194
188
|
return t.toUpperCase();
|
|
195
189
|
}).trim(), canUseDOM: at, cancelTimeout: (e) => {
|
|
196
190
|
cancelAnimationFrame(e.id);
|
|
197
|
-
}, castToString: (e) => e == null || e === void 0 ? "" : typeof e != "string" ? "" + e : e, cloneObject: (e) =>
|
|
191
|
+
}, castToString: (e) => e == null || e === void 0 ? "" : typeof e != "string" ? "" + e : e, cloneObject: (e) => rt(e) ? e : JSON.parse(JSON.stringify(e)), consoleWithNoSource: (...e) => new Promise((t) => {
|
|
198
192
|
setTimeout(() => {
|
|
199
193
|
Function("console.log.apply(console, arguments)").apply(null, e), t();
|
|
200
194
|
});
|
|
201
|
-
}), debounce: function(e, t = 300,
|
|
202
|
-
let
|
|
195
|
+
}), debounce: function(e, t = 300, n = !1) {
|
|
196
|
+
let r, o, a, i, l = 0;
|
|
203
197
|
function s() {
|
|
204
198
|
let d = Date.now() - l;
|
|
205
|
-
d < t && d >= 0 ?
|
|
199
|
+
d < t && d >= 0 ? r = setTimeout(s, t - d) : (r = null, n || (i = e.apply(a, o), a = o = null));
|
|
206
200
|
}
|
|
207
201
|
t == null && (t = 100);
|
|
208
202
|
const c = function() {
|
|
209
203
|
a = globalThis, o = arguments, l = Date.now();
|
|
210
|
-
var d =
|
|
211
|
-
return
|
|
204
|
+
var d = n && !r;
|
|
205
|
+
return r || (r = setTimeout(s, t)), d && (i = e.apply(a, o), a = o = null), i;
|
|
212
206
|
};
|
|
213
207
|
return c.clear = function() {
|
|
214
|
-
|
|
208
|
+
r && (clearTimeout(r), r = null);
|
|
215
209
|
}, c.flush = function() {
|
|
216
|
-
|
|
210
|
+
r && (i = e.apply(a, o), a = o = null, clearTimeout(r), r = null);
|
|
217
211
|
}, c;
|
|
218
|
-
}, deepEqual: function e(t,
|
|
219
|
-
if (t ===
|
|
220
|
-
if (t &&
|
|
221
|
-
if (t.constructor !==
|
|
222
|
-
let
|
|
212
|
+
}, deepEqual: function e(t, n) {
|
|
213
|
+
if (t === n) return !0;
|
|
214
|
+
if (t && n && typeof t == "object" && typeof n == "object") {
|
|
215
|
+
if (t.constructor !== n.constructor) return !1;
|
|
216
|
+
let r, o, a;
|
|
223
217
|
if (Array.isArray(t)) {
|
|
224
|
-
if (
|
|
225
|
-
for (o =
|
|
218
|
+
if (r = t.length, r != n.length) return !1;
|
|
219
|
+
for (o = r; o-- !== 0; ) if (!e(t[o], n[o])) return !1;
|
|
226
220
|
return !0;
|
|
227
221
|
}
|
|
228
|
-
if (t instanceof Map &&
|
|
229
|
-
if (t.size !==
|
|
230
|
-
for (o of t.entries()) if (!
|
|
231
|
-
for (o of t.entries()) if (!e(o[1],
|
|
222
|
+
if (t instanceof Map && n instanceof Map) {
|
|
223
|
+
if (t.size !== n.size) return !1;
|
|
224
|
+
for (o of t.entries()) if (!n.has(o[0])) return !1;
|
|
225
|
+
for (o of t.entries()) if (!e(o[1], n.get(o[0]))) return !1;
|
|
232
226
|
return !0;
|
|
233
227
|
}
|
|
234
|
-
if (t instanceof Set &&
|
|
235
|
-
if (t.size !==
|
|
236
|
-
for (o of t.entries()) if (!
|
|
228
|
+
if (t instanceof Set && n instanceof Set) {
|
|
229
|
+
if (t.size !== n.size) return !1;
|
|
230
|
+
for (o of t.entries()) if (!n.has(o[0])) return !1;
|
|
237
231
|
return !0;
|
|
238
232
|
}
|
|
239
|
-
if (ArrayBuffer.isView(t) && ArrayBuffer.isView(
|
|
240
|
-
if (
|
|
241
|
-
for (o =
|
|
233
|
+
if (ArrayBuffer.isView(t) && ArrayBuffer.isView(n)) {
|
|
234
|
+
if (r = t.length, r != n.length) return !1;
|
|
235
|
+
for (o = r; o-- !== 0; ) if (t[o] !== n[o]) return !1;
|
|
242
236
|
return !0;
|
|
243
237
|
}
|
|
244
|
-
if (t.constructor === RegExp) return t.source ===
|
|
245
|
-
if (t.valueOf !== Object.prototype.valueOf) return t.valueOf() ===
|
|
246
|
-
if (t.toString !== Object.prototype.toString) return t.toString() ===
|
|
247
|
-
if (a = Object.keys(t),
|
|
248
|
-
for (o =
|
|
249
|
-
for (o =
|
|
238
|
+
if (t.constructor === RegExp) return t.source === n.source && t.flags === n.flags;
|
|
239
|
+
if (t.valueOf !== Object.prototype.valueOf) return t.valueOf() === n.valueOf();
|
|
240
|
+
if (t.toString !== Object.prototype.toString) return t.toString() === n.toString();
|
|
241
|
+
if (a = Object.keys(t), r = a.length, r !== Object.keys(n).length) return !1;
|
|
242
|
+
for (o = r; o-- !== 0; ) if (!Object.prototype.hasOwnProperty.call(n, a[o])) return !1;
|
|
243
|
+
for (o = r; o-- !== 0; ) {
|
|
250
244
|
let i = a[o];
|
|
251
|
-
if (!(i === "_owner" && t.$$typeof || e(t[i],
|
|
245
|
+
if (!(i === "_owner" && t.$$typeof || e(t[i], n[i]))) return !1;
|
|
252
246
|
}
|
|
253
247
|
return !0;
|
|
254
248
|
}
|
|
255
|
-
return t != t &&
|
|
249
|
+
return t != t && n != n;
|
|
256
250
|
}, deepFreeze: function e(t) {
|
|
257
|
-
return Object.freeze(t), Object.keys(t).forEach((
|
|
258
|
-
typeof t[
|
|
251
|
+
return Object.freeze(t), Object.keys(t).forEach((n) => {
|
|
252
|
+
typeof t[n] != "object" || t[n] === null || Object.isFrozen(t[n]) || e(t[n]);
|
|
259
253
|
}), t;
|
|
260
254
|
}, deepMerge: E, diffValues: (e, t) => {
|
|
261
|
-
const
|
|
255
|
+
const n = {}, r = Object.keys(t), o = r.length;
|
|
262
256
|
for (let a = 0; a < o; a++) {
|
|
263
|
-
const i =
|
|
264
|
-
e[i] !== t[i] && (e[i] === void 0 ?
|
|
265
|
-
}
|
|
266
|
-
return Object.keys(
|
|
267
|
-
}, findEqualOrGreater: function(e, t,
|
|
268
|
-
let
|
|
269
|
-
for (;
|
|
270
|
-
let a = Math.floor((
|
|
257
|
+
const i = r[a];
|
|
258
|
+
e[i] !== t[i] && (e[i] === void 0 ? n[i] = t[i] : n[i] = e[i]);
|
|
259
|
+
}
|
|
260
|
+
return Object.keys(n).length === 0 ? null : n;
|
|
261
|
+
}, findEqualOrGreater: function(e, t, n = et) {
|
|
262
|
+
let r = 0, o = e.length - 1;
|
|
263
|
+
for (; r <= o; ) {
|
|
264
|
+
let a = Math.floor((r + o) / 2), i = n(e[a]);
|
|
271
265
|
if (i === t) return a;
|
|
272
|
-
i < t ?
|
|
266
|
+
i < t ? r = a + 1 : o = a - 1;
|
|
273
267
|
}
|
|
274
|
-
return
|
|
275
|
-
}, findEqualOrLesser: function(e, t,
|
|
276
|
-
let
|
|
277
|
-
for (;
|
|
278
|
-
let a = Math.floor((
|
|
268
|
+
return r;
|
|
269
|
+
}, findEqualOrLesser: function(e, t, n = et) {
|
|
270
|
+
let r = e.length - 1, o = 0;
|
|
271
|
+
for (; r >= o; ) {
|
|
272
|
+
let a = Math.floor((r + o) / 2), i = n(e[a]);
|
|
279
273
|
if (i === t) return a;
|
|
280
|
-
i > t ?
|
|
274
|
+
i > t ? r = a - 1 : o = a + 1;
|
|
281
275
|
}
|
|
282
|
-
return
|
|
283
|
-
}, findNextStep: (e, t = !0,
|
|
284
|
-
const a = Math.max(e -
|
|
285
|
-
return Math.min(o, Math[t ? "ceil" : "floor"](a /
|
|
286
|
-
},
|
|
276
|
+
return r;
|
|
277
|
+
}, findNextStep: (e, t = !0, n = 15, r = 10, o = 400) => {
|
|
278
|
+
const a = Math.max(e - r, 0) + (t ? 1 : -1);
|
|
279
|
+
return Math.min(o, Math[t ? "ceil" : "floor"](a / n) * n + r);
|
|
280
|
+
}, getDPI: () => {
|
|
287
281
|
let e = 1;
|
|
288
282
|
return typeof window == "object" && (e = window.devicePixelRatio || 1), e;
|
|
289
283
|
}, getFromPath: (e, t) => {
|
|
290
|
-
const
|
|
291
|
-
let
|
|
292
|
-
for (let o = 0; o <
|
|
293
|
-
const a =
|
|
294
|
-
if (!
|
|
295
|
-
let i =
|
|
296
|
-
if (typeof i == "function" && (i = i.bind(
|
|
297
|
-
|
|
298
|
-
}
|
|
299
|
-
return
|
|
284
|
+
const n = t.split(".");
|
|
285
|
+
let r = e;
|
|
286
|
+
for (let o = 0; o < n.length; o++) {
|
|
287
|
+
const a = n[o];
|
|
288
|
+
if (!r) return null;
|
|
289
|
+
let i = r[a];
|
|
290
|
+
if (typeof i == "function" && (i = i.bind(r)()), !i || !_(i)) return i;
|
|
291
|
+
r = i;
|
|
292
|
+
}
|
|
293
|
+
return r ?? null;
|
|
300
294
|
}, getOS: T, hasFocus: it, isDefined: (e) => e != null, isEmpty: (e) => e == null || e === "", isEqualArrays: mt, isEqualBounds: (e, t) => e === t || !(e && !t || t && !e) && e.x === t.x && e.y === t.y && e.width === t.width && e.height === t.height, isEqualObjectKeys: (e, t) => {
|
|
301
295
|
if (e === t) return !0;
|
|
302
296
|
if (e && !t || t && !e) return !1;
|
|
303
|
-
const
|
|
304
|
-
if (
|
|
305
|
-
for (let
|
|
297
|
+
const n = Object.keys(e);
|
|
298
|
+
if (n.length !== Object.keys(t).length) return !1;
|
|
299
|
+
for (let r = 0; r < n.length; r++) if (e[n[r]] !== t[n[r]]) return !1;
|
|
306
300
|
return !0;
|
|
307
|
-
}, isNode: vt, isNullOrUndefined:
|
|
301
|
+
}, isNode: vt, isNullOrUndefined: rt, isNumeric: (e) => {
|
|
308
302
|
const t = 1 * e;
|
|
309
303
|
return Number.isFinite(t) && typeof t == "number";
|
|
310
304
|
}, isObject: _, isPromiseLike: (e) => !!e && typeof e.then == "function", isRectInsideRect: (e, t) => e.top >= t.top && e.bottom <= t.bottom && e.left >= t.left && e.right <= t.right, isRectIntersect: ot, mergeContentful: (...e) => {
|
|
311
305
|
const t = e.length;
|
|
312
306
|
if (t > 0 && e[t - 1] !== void 0 && !_(e[t - 1])) return e[t - 1];
|
|
313
|
-
let
|
|
314
|
-
for (let
|
|
315
|
-
return
|
|
307
|
+
let n = e[0] || {};
|
|
308
|
+
for (let r = 1; r < t; r++) n = E(n, e[r] || {}, { arrayMerge: (o, a) => [...a] });
|
|
309
|
+
return n;
|
|
316
310
|
}, nextTick: (e) => {
|
|
317
311
|
typeof window < "u" && typeof window.requestAnimationFrame == "function" ? window.requestAnimationFrame(() => {
|
|
318
312
|
e();
|
|
319
313
|
}) : (typeof setImmediate == "function" ? setImmediate : setTimeout)(() => {
|
|
320
314
|
e();
|
|
321
315
|
});
|
|
322
|
-
}, openFileDialog: (e = "*.*") => new Promise((t,
|
|
323
|
-
if (!at) return void
|
|
324
|
-
const
|
|
325
|
-
|
|
316
|
+
}, openFileDialog: (e = "*.*") => new Promise((t, n) => {
|
|
317
|
+
if (!at) return void n("Unable to open dialog with no dom.");
|
|
318
|
+
const r = document.createElement("input");
|
|
319
|
+
r.type = "file", r.accept = e;
|
|
326
320
|
let o = null, a = !1;
|
|
327
321
|
globalThis.addEventListener?.("focus", () => {
|
|
328
322
|
setTimeout(() => {
|
|
329
323
|
o || a || (a = !0, t(null));
|
|
330
324
|
}, 1e3);
|
|
331
|
-
}, { once: !0, passive: !0 }),
|
|
332
|
-
if (o =
|
|
325
|
+
}, { once: !0, passive: !0 }), r.onchange = () => {
|
|
326
|
+
if (o = r.files[0], o) {
|
|
333
327
|
if (a) return void console.warn("File open detected after faux cancel.", o);
|
|
334
328
|
t(o);
|
|
335
329
|
}
|
|
336
|
-
},
|
|
330
|
+
}, r.autofocus = !0, r.click();
|
|
337
331
|
}), rafThrottle: (e) => {
|
|
338
|
-
let t,
|
|
339
|
-
|
|
332
|
+
let t, n = !1, r = function() {
|
|
333
|
+
n = !1, e(t);
|
|
340
334
|
};
|
|
341
335
|
return function(o) {
|
|
342
|
-
t = o, t && t.persist && t.persist(),
|
|
336
|
+
t = o, t && t.persist && t.persist(), n || (n = !0, requestAnimationFrame(r));
|
|
343
337
|
};
|
|
344
338
|
}, removeEmptyProperties: Et, removeEqualValues: St, removeListenerAll: (e) => {
|
|
345
339
|
if (!e) return [];
|
|
346
340
|
for (let t = 0; t < e.length; t++) e[t] && e[t]();
|
|
347
341
|
return [];
|
|
348
342
|
}, requestTimeout: (e, t) => {
|
|
349
|
-
const
|
|
350
|
-
|
|
343
|
+
const n = nt(), r = { id: requestAnimationFrame(function o() {
|
|
344
|
+
nt() - n >= t ? e.call(null) : r.id = requestAnimationFrame(o);
|
|
351
345
|
}) };
|
|
352
|
-
return
|
|
346
|
+
return r;
|
|
353
347
|
}, roundAccurately: (e, t = 0) => {
|
|
354
348
|
if (e == null || !isFinite(e)) return null;
|
|
355
|
-
const
|
|
356
|
-
return Number(Math.round(e *
|
|
357
|
-
}, setToPath: (e, t,
|
|
358
|
-
const
|
|
349
|
+
const n = 10 ** t;
|
|
350
|
+
return Number(Math.round(e * n) / n);
|
|
351
|
+
}, setToPath: (e, t, n) => {
|
|
352
|
+
const r = t.split(".");
|
|
359
353
|
let o = e;
|
|
360
354
|
if (!o) throw new Error("Can not set path to a null path.");
|
|
361
|
-
for (let a = 0; o && a <
|
|
362
|
-
const i =
|
|
355
|
+
for (let a = 0; o && a < r.length - 1; a++) {
|
|
356
|
+
const i = r[a];
|
|
363
357
|
let l = o[i];
|
|
364
358
|
if (l == null && (l = {}, o[i] = l), !_(l)) throw new Error("Can not set path to a non object path.");
|
|
365
359
|
o = l;
|
|
366
360
|
}
|
|
367
|
-
if (typeof
|
|
368
|
-
return o[
|
|
361
|
+
if (typeof n != "number" && typeof n != "boolean" && typeof n != "string" && !_(n)) throw new Error(`Can not set path to ${n} that is not a a supported primitive.`);
|
|
362
|
+
return o[r[r.length - 1]] = n, e;
|
|
369
363
|
}, splitNumber: (e) => {
|
|
370
364
|
let t = Math.abs(e);
|
|
371
365
|
if (isNaN(t) || !isFinite(e)) return null;
|
|
372
|
-
let
|
|
373
|
-
if (
|
|
374
|
-
return { ip: Math.trunc(e), fp: o, ipLength: Math.ceil(Math.log10(
|
|
375
|
-
}, subtractRect: (e, t,
|
|
366
|
+
let n = 0 | t, r = t - n, o = 0, a = 0, i = 1;
|
|
367
|
+
if (r > 5e-8) for (; a < 8 && Math.abs(o / i - r) > 5e-8; ) a++, i *= 10, o = Math.round(r * i);
|
|
368
|
+
return { ip: Math.trunc(e), fp: o, ipLength: Math.ceil(Math.log10(n + 1)), fpLength: a };
|
|
369
|
+
}, subtractRect: (e, t, n = !1) => {
|
|
376
370
|
if (!t) return [e];
|
|
377
371
|
if (!ot(e, t)) return [];
|
|
378
|
-
const
|
|
372
|
+
const r = [];
|
|
379
373
|
let o = e;
|
|
380
374
|
const a = () => {
|
|
381
|
-
t.top > o.top && t.top < o.bottom && (
|
|
375
|
+
t.top > o.top && t.top < o.bottom && (r.push({ ...o, bottom: t.top }), o = { ...o, top: t.top });
|
|
382
376
|
}, i = () => {
|
|
383
|
-
t.bottom > o.top && t.bottom < o.bottom && (
|
|
377
|
+
t.bottom > o.top && t.bottom < o.bottom && (r.push({ ...o, top: t.bottom }), o = { ...o, bottom: t.bottom });
|
|
384
378
|
}, l = () => {
|
|
385
|
-
t.right > o.left && t.right < o.right && (
|
|
379
|
+
t.right > o.left && t.right < o.right && (r.push({ ...o, left: t.right }), o = { ...o, right: t.right });
|
|
386
380
|
}, s = () => {
|
|
387
|
-
t.left > o.left && t.left < o.right && (
|
|
381
|
+
t.left > o.left && t.left < o.right && (r.push({ ...o, right: t.left }), o = { ...o, left: t.left });
|
|
388
382
|
};
|
|
389
|
-
return
|
|
383
|
+
return n ? (s(), l(), a(), i()) : (a(), i(), l(), s()), r;
|
|
390
384
|
}, textToKey: (e) => e.replace(/[^a-zA-Z0-9]/g, "").toLowerCase(), throttle: function(e, t) {
|
|
391
|
-
let
|
|
392
|
-
return (...
|
|
385
|
+
let n = null;
|
|
386
|
+
return (...r) => {
|
|
393
387
|
const o = Date.now();
|
|
394
|
-
(!
|
|
388
|
+
(!n || o - n >= t) && (n = o, e(...r));
|
|
395
389
|
};
|
|
396
390
|
}, toSafeJSON: function e(t) {
|
|
397
391
|
if (t === null || typeof t != "object") return t;
|
|
398
392
|
if (typeof t.toJSON == "function") return t.toJSON();
|
|
399
|
-
if (Array.isArray(t)) return t.map((
|
|
393
|
+
if (Array.isArray(t)) return t.map((r) => e(r));
|
|
400
394
|
if (typeof t.toString == "function" && t.toString !== Object.prototype.toString) return t.toString();
|
|
401
|
-
const
|
|
402
|
-
for (const
|
|
403
|
-
return
|
|
395
|
+
const n = {};
|
|
396
|
+
for (const r in t) t.hasOwnProperty(r) && (n[r] = e(t[r]));
|
|
397
|
+
return n;
|
|
404
398
|
}, transpose: (e) => {
|
|
405
399
|
if (!e) return e;
|
|
406
|
-
const t = e.length,
|
|
407
|
-
for (let o = 0; o <
|
|
408
|
-
for (let o = 0; o < t; o++) for (let a = 0; a <
|
|
409
|
-
return
|
|
400
|
+
const t = e.length, n = e[0].length, r = [];
|
|
401
|
+
for (let o = 0; o < n; o++) r[o] = Array(t);
|
|
402
|
+
for (let o = 0; o < t; o++) for (let a = 0; a < n; a++) r[a][o] = e[o][a];
|
|
403
|
+
return r;
|
|
410
404
|
}, uuidV4: R, validEnumValue: (e, t) => {
|
|
411
405
|
if (!Object.values(e).includes(t)) throw new Error(`Invalid type: ${t ?? "null"}. Must be one of: ${Object.values(t).join(", ")}.`);
|
|
412
|
-
}, whenFocus: async (e, t = !1) => new Promise((
|
|
413
|
-
it(e, t) ?
|
|
414
|
-
|
|
406
|
+
}, whenFocus: async (e, t = !1) => new Promise((n) => {
|
|
407
|
+
it(e, t) ? n(!0) : e.addEventListener("focusin", () => {
|
|
408
|
+
n(!0);
|
|
415
409
|
}, { once: !0 }), e.focus();
|
|
416
410
|
}) }, Symbol.toStringTag, { value: "Module" }));
|
|
417
411
|
Object.freeze(Object.defineProperty({ __proto__: null, MESSAGE_ERROR_INVALID_ARG: (e) => `Invalid argument: '${e}'.` }, Symbol.toStringTag, { value: "Module" }));
|
|
418
412
|
const xt = (e) => {
|
|
419
|
-
const t = new Uint8Array(e),
|
|
420
|
-
let
|
|
421
|
-
for (let o = 0; o <
|
|
422
|
-
if (typeof window < "u" && typeof globalThis.btoa == "function") return globalThis.btoa(
|
|
423
|
-
if (typeof Buffer < "u") return Buffer.from(
|
|
413
|
+
const t = new Uint8Array(e), n = t.byteLength;
|
|
414
|
+
let r = "";
|
|
415
|
+
for (let o = 0; o < n; o++) r += String.fromCharCode(t[o]);
|
|
416
|
+
if (typeof window < "u" && typeof globalThis.btoa == "function") return globalThis.btoa(r);
|
|
417
|
+
if (typeof Buffer < "u") return Buffer.from(r, "binary").toString("base64");
|
|
424
418
|
throw new Error("Unsupported environment");
|
|
425
|
-
}, W = (e) => new Promise((t,
|
|
419
|
+
}, W = (e) => new Promise((t, n) => {
|
|
426
420
|
if (e) if (typeof FileReader < "u") {
|
|
427
|
-
const
|
|
428
|
-
|
|
429
|
-
t(
|
|
430
|
-
},
|
|
431
|
-
r
|
|
432
|
-
},
|
|
421
|
+
const r = new FileReader();
|
|
422
|
+
r.onload = () => {
|
|
423
|
+
t(r.result);
|
|
424
|
+
}, r.onerror = () => {
|
|
425
|
+
n(r.error);
|
|
426
|
+
}, r.readAsText(e);
|
|
433
427
|
} else if (typeof Buffer < "u") {
|
|
434
|
-
const
|
|
428
|
+
const r = (o) => Buffer.from(o).toString("utf-8");
|
|
435
429
|
e.arrayBuffer().then((o) => {
|
|
436
|
-
t(
|
|
430
|
+
t(r(o));
|
|
437
431
|
}).catch((o) => {
|
|
438
|
-
|
|
432
|
+
n(o);
|
|
439
433
|
});
|
|
440
|
-
} else
|
|
434
|
+
} else n(new Error("Unsupported environment"));
|
|
441
435
|
else t("");
|
|
442
436
|
});
|
|
443
437
|
Object.freeze(Object.defineProperty({ __proto__: null, DEFAULT_MIME_TYPE: "*/*", arrayBufferToBase64: xt, base64ToArrayBuffer: (e) => {
|
|
444
|
-
const t = typeof window < "u" && typeof globalThis.atob == "function" ? globalThis.atob(e) : Buffer.from(e, "base64").toString("binary"),
|
|
445
|
-
for (let o = 0; o <
|
|
446
|
-
return
|
|
438
|
+
const t = typeof window < "u" && typeof globalThis.atob == "function" ? globalThis.atob(e) : Buffer.from(e, "base64").toString("binary"), n = t.length, r = new Uint8Array(n);
|
|
439
|
+
for (let o = 0; o < n; o++) r[o] = t.charCodeAt(o);
|
|
440
|
+
return r.buffer;
|
|
447
441
|
}, blobToString: W }, Symbol.toStringTag, { value: "Module" }));
|
|
448
|
-
const Ot = "data:image/png;base64,", _t = "Unable to resolve image.", lt = (e) => new Promise(async (t,
|
|
449
|
-
let
|
|
442
|
+
const Ot = "data:image/png;base64,", _t = "Unable to resolve image.", lt = (e) => new Promise(async (t, n) => {
|
|
443
|
+
let r = null;
|
|
450
444
|
try {
|
|
451
|
-
|
|
452
|
-
t({ width:
|
|
453
|
-
}, { once: !0 }),
|
|
454
|
-
URL.revokeObjectURL(e),
|
|
455
|
-
}, { once: !0 }), await
|
|
445
|
+
r = new Image(), r.src = e, r.addEventListener("load", function() {
|
|
446
|
+
t({ width: r.naturalWidth, height: r.naturalHeight });
|
|
447
|
+
}, { once: !0 }), r.addEventListener("error", function() {
|
|
448
|
+
URL.revokeObjectURL(e), n("Invalid Image");
|
|
449
|
+
}, { once: !0 }), await r.decode("sync");
|
|
456
450
|
} catch {
|
|
457
|
-
|
|
451
|
+
r?.src && URL.revokeObjectURL(r.src);
|
|
458
452
|
}
|
|
459
|
-
|
|
453
|
+
r || n(_t);
|
|
460
454
|
}), P = "image/svg+xml";
|
|
461
455
|
var st, ct;
|
|
462
|
-
Object.freeze(Object.defineProperty({ __proto__: null, DATA_URL_PNG_PREFIX: Ot, getImageDataUrl: (e, t = 1) => new Promise(async (
|
|
456
|
+
Object.freeze(Object.defineProperty({ __proto__: null, DATA_URL_PNG_PREFIX: Ot, getImageDataUrl: (e, t = 1) => new Promise(async (n, r) => {
|
|
463
457
|
let o = null;
|
|
464
458
|
try {
|
|
465
459
|
o = new Image(), o.src = e, o.addEventListener("load", function() {
|
|
@@ -467,40 +461,40 @@ Object.freeze(Object.defineProperty({ __proto__: null, DATA_URL_PNG_PREFIX: Ot,
|
|
|
467
461
|
const a = document.createElement("canvas");
|
|
468
462
|
a.width = o.naturalWidth, a.height = o.naturalHeight, a.getContext("2d").drawImage(o, 0, 0);
|
|
469
463
|
const i = a.toDataURL("image/png", t);
|
|
470
|
-
|
|
464
|
+
n({ elemImg: o, dataUrl: i });
|
|
471
465
|
} catch (a) {
|
|
472
|
-
URL.revokeObjectURL(e),
|
|
466
|
+
URL.revokeObjectURL(e), r(a);
|
|
473
467
|
}
|
|
474
468
|
}, { once: !0 }), o.addEventListener("error", function() {
|
|
475
|
-
URL.revokeObjectURL(e),
|
|
469
|
+
URL.revokeObjectURL(e), r("Invalid Image");
|
|
476
470
|
}, { once: !0 }), await o.decode("sync");
|
|
477
471
|
} catch {
|
|
478
472
|
o?.src && URL.revokeObjectURL(o.src);
|
|
479
473
|
}
|
|
480
|
-
o ||
|
|
474
|
+
o || r(_t);
|
|
481
475
|
}), loadImageDetails: async (e, t = null) => {
|
|
482
|
-
let
|
|
483
|
-
const
|
|
476
|
+
let n = null;
|
|
477
|
+
const r = async () => {
|
|
484
478
|
try {
|
|
485
479
|
const a = t ?? "image/*", i = URL.createObjectURL(new Blob([e], { type: a })), l = await lt(i);
|
|
486
|
-
|
|
480
|
+
n = { mimeType: a, naturalDimensions: l, asUrl: i };
|
|
487
481
|
} catch {
|
|
488
482
|
}
|
|
489
483
|
}, o = async () => {
|
|
490
484
|
try {
|
|
491
485
|
const a = new TextDecoder().decode(e), i = URL.createObjectURL(new Blob([a], { type: P })), l = await lt(i);
|
|
492
|
-
|
|
486
|
+
n = { mimeType: t ?? P, naturalDimensions: l, asUrl: i, asSVGText: a };
|
|
493
487
|
} catch {
|
|
494
488
|
}
|
|
495
489
|
};
|
|
496
|
-
if (t === P ? await o() : t.startsWith("image/") ? await
|
|
497
|
-
return
|
|
498
|
-
} }, Symbol.toStringTag, { value: "Module" })), (ct = st || (st = {})).resolveTypedUpdates = (e, t,
|
|
490
|
+
if (t === P ? await o() : t.startsWith("image/") ? await r() : (await r(), n || await o()), !n) throw new Error("Failed to load image");
|
|
491
|
+
return n;
|
|
492
|
+
} }, Symbol.toStringTag, { value: "Module" })), (ct = st || (st = {})).resolveTypedUpdates = (e, t, n, r) => {
|
|
499
493
|
if (e === null) return e;
|
|
500
|
-
if (e === void 0) return
|
|
494
|
+
if (e === void 0) return r;
|
|
501
495
|
let o = e;
|
|
502
496
|
if (t?.shorthand) {
|
|
503
|
-
const s = t?.shorthand(e,
|
|
497
|
+
const s = t?.shorthand(e, n);
|
|
504
498
|
s !== void 0 && (o = s);
|
|
505
499
|
}
|
|
506
500
|
if (o !== null && t?.getSubType) {
|
|
@@ -509,17 +503,17 @@ Object.freeze(Object.defineProperty({ __proto__: null, DATA_URL_PNG_PREFIX: Ot,
|
|
|
509
503
|
}
|
|
510
504
|
const a = t?.properties, i = t?.arrayType ?? !1;
|
|
511
505
|
let l = o;
|
|
512
|
-
if (t && t.merge && l &&
|
|
506
|
+
if (t && t.merge && l && r) l = t.merge(l, r, n);
|
|
513
507
|
else if (!i && a) {
|
|
514
|
-
const s = Object.keys({ ...o, ...
|
|
508
|
+
const s = Object.keys({ ...o, ...r });
|
|
515
509
|
l = null;
|
|
516
510
|
for (let c = 0; c < s.length; c++) {
|
|
517
511
|
const d = s[c];
|
|
518
512
|
let w, u = o[d];
|
|
519
513
|
if (u !== void 0) {
|
|
520
514
|
const f = a[d];
|
|
521
|
-
w = f ? (0, ct.resolveTypedUpdates)(u, f,
|
|
522
|
-
} else w =
|
|
515
|
+
w = f ? (0, ct.resolveTypedUpdates)(u, f, n, r?.[d]) : u;
|
|
516
|
+
} else w = r?.[d];
|
|
523
517
|
w != null && (l = l ?? {}, l[d] = w);
|
|
524
518
|
}
|
|
525
519
|
}
|
|
@@ -536,10 +530,10 @@ Please use Chrome or Edge if external copy and paste is required.`, Perms: k, Pe
|
|
|
536
530
|
document.hasFocus() ? e() : globalThis.addEventListener?.("focus", () => {
|
|
537
531
|
e();
|
|
538
532
|
}, { once: !0 }), document.activeElement.focus?.();
|
|
539
|
-
}), B = async (e, t,
|
|
540
|
-
if (T() === y.Safari) return await
|
|
533
|
+
}), B = async (e, t, n) => {
|
|
534
|
+
if (T() === y.Safari) return await n(new Error(It.Safari));
|
|
541
535
|
try {
|
|
542
|
-
const
|
|
536
|
+
const r = async (i) => {
|
|
543
537
|
try {
|
|
544
538
|
return await i();
|
|
545
539
|
} catch (l) {
|
|
@@ -548,9 +542,9 @@ Please use Chrome or Edge if external copy and paste is required.`, Perms: k, Pe
|
|
|
548
542
|
}
|
|
549
543
|
}, o = await globalThis?.navigator?.permissions?.query({ name: e, allowWithoutGesture: !0, allowWithoutSanitization: !0 });
|
|
550
544
|
let a = !1;
|
|
551
|
-
if (o.state === "prompt" && (a = await
|
|
552
|
-
} catch (
|
|
553
|
-
return
|
|
545
|
+
if (o.state === "prompt" && (a = await r(t)), a || o.state !== "granted" || (a = await t()), !a) return await n(new Error(o.state));
|
|
546
|
+
} catch (r) {
|
|
547
|
+
return r.message === "No valid data on clipboard" || r.name === "DataError" ? void 0 : await n(r);
|
|
554
548
|
}
|
|
555
549
|
}, jt = async (e) => {
|
|
556
550
|
try {
|
|
@@ -560,14 +554,14 @@ Please use Chrome or Edge if external copy and paste is required.`, Perms: k, Pe
|
|
|
560
554
|
return await e.read();
|
|
561
555
|
};
|
|
562
556
|
if (!globalThis.ClipboardItem) {
|
|
563
|
-
const e = (
|
|
557
|
+
const e = (n, r) => new Blob([r], { type: n });
|
|
564
558
|
class t {
|
|
565
|
-
constructor(
|
|
566
|
-
this._items = {}, this._types = Object.keys(
|
|
567
|
-
const a = {}, i = Object.keys(
|
|
559
|
+
constructor(r, o) {
|
|
560
|
+
this._items = {}, this._types = Object.keys(r);
|
|
561
|
+
const a = {}, i = Object.keys(r);
|
|
568
562
|
for (let l = 0; l < i.length; l++) {
|
|
569
563
|
const s = i[l];
|
|
570
|
-
let c =
|
|
564
|
+
let c = r[s];
|
|
571
565
|
a[s] = typeof c == "string" ? e(s, c) : c;
|
|
572
566
|
}
|
|
573
567
|
this._items = a, this._presentationStyle = o?.presentationStyle ?? "unspecified";
|
|
@@ -575,16 +569,16 @@ if (!globalThis.ClipboardItem) {
|
|
|
575
569
|
get types() {
|
|
576
570
|
return this._types;
|
|
577
571
|
}
|
|
578
|
-
getType(
|
|
579
|
-
return Promise.resolve(this._items[
|
|
572
|
+
getType(r) {
|
|
573
|
+
return Promise.resolve(this._items[r]);
|
|
580
574
|
}
|
|
581
|
-
supports(
|
|
575
|
+
supports(r) {
|
|
582
576
|
return !0;
|
|
583
577
|
}
|
|
584
578
|
}
|
|
585
579
|
globalThis.ClipboardItem = t;
|
|
586
580
|
}
|
|
587
|
-
const V = async (e, t = h) => new Promise(async (
|
|
581
|
+
const V = async (e, t = h) => new Promise(async (n, r) => {
|
|
588
582
|
try {
|
|
589
583
|
const o = await (async (a, i) => {
|
|
590
584
|
if (!a) return null;
|
|
@@ -596,38 +590,38 @@ const V = async (e, t = h) => new Promise(async (r, n) => {
|
|
|
596
590
|
if (o) {
|
|
597
591
|
const a = new FileReader();
|
|
598
592
|
a.onload = () => {
|
|
599
|
-
|
|
593
|
+
n(a.result);
|
|
600
594
|
}, a.onerror = () => {
|
|
601
|
-
|
|
595
|
+
n("");
|
|
602
596
|
}, a.readAsText(o);
|
|
603
|
-
} else
|
|
597
|
+
} else n("");
|
|
604
598
|
} catch (o) {
|
|
605
|
-
|
|
599
|
+
r(o);
|
|
606
600
|
}
|
|
607
601
|
}), dt = async (e, t = h) => {
|
|
608
|
-
const
|
|
609
|
-
if (!
|
|
610
|
-
let
|
|
602
|
+
const n = await V(e, t);
|
|
603
|
+
if (!n) return null;
|
|
604
|
+
let r = null;
|
|
611
605
|
try {
|
|
612
|
-
|
|
606
|
+
r = new DOMParser().parseFromString(n, h);
|
|
613
607
|
} catch {
|
|
614
608
|
console.warn("Can't parse html from clipboard.");
|
|
615
609
|
}
|
|
616
|
-
return
|
|
610
|
+
return r;
|
|
617
611
|
}, C = "clipboard-uuid", v = "web text/uuid", ft = (e) => `<div style="display:none" ${C}="${e}"/>`, Wt = (e, t) => {
|
|
618
|
-
let
|
|
612
|
+
let n = null;
|
|
619
613
|
try {
|
|
620
|
-
const
|
|
621
|
-
|
|
622
|
-
} catch (
|
|
623
|
-
console.warn("Can't embed uuid.",
|
|
614
|
+
const r = new DOMParser().parseFromString(t, h);
|
|
615
|
+
r.body.firstElementChild.setAttribute(C, e), n = r.getElementsByTagName("body")[0].innerHTML;
|
|
616
|
+
} catch (r) {
|
|
617
|
+
console.warn("Can't embed uuid.", r);
|
|
624
618
|
}
|
|
625
|
-
return
|
|
619
|
+
return n;
|
|
626
620
|
}, pt = (e, t) => {
|
|
627
621
|
if (!t || !e) return !1;
|
|
628
622
|
try {
|
|
629
|
-
const
|
|
630
|
-
if (
|
|
623
|
+
const n = t.querySelectorAll(`[${C}="${e}"]`);
|
|
624
|
+
if (n && n.length === 1) return !0;
|
|
631
625
|
if (t.querySelector("parsererror")) throw new Error("We are unable to parse node");
|
|
632
626
|
return !1;
|
|
633
627
|
} catch {
|
|
@@ -649,8 +643,8 @@ class wt {
|
|
|
649
643
|
await N();
|
|
650
644
|
const t = await V(this._nativeClipboard, v);
|
|
651
645
|
if (!this._state || t && t === this._state.uuid) return !0;
|
|
652
|
-
const
|
|
653
|
-
return !this._state || (pt(this._state.uuid,
|
|
646
|
+
const n = await dt(this._nativeClipboard, h);
|
|
647
|
+
return !this._state || (pt(this._state.uuid, n) || this.clear(), !0);
|
|
654
648
|
}, async (t) => {
|
|
655
649
|
t?.message === "denied" || t.message?.includes("Document is not focused") || T() === y.Safari || console.warn("Unable to detect clipboard changes: ", t);
|
|
656
650
|
});
|
|
@@ -661,7 +655,7 @@ class wt {
|
|
|
661
655
|
t._checkForChanges();
|
|
662
656
|
}, this._onBlur = () => {
|
|
663
657
|
globalThis.addEventListener?.("focus", t._onFocus, { once: !0 });
|
|
664
|
-
}, globalThis.addEventListener?.("blur", this._onBlur), this._nativeClipboard.addEventListener("clipboardchange", (
|
|
658
|
+
}, globalThis.addEventListener?.("blur", this._onBlur), this._nativeClipboard.addEventListener("clipboardchange", (n) => {
|
|
665
659
|
t._checkForChanges();
|
|
666
660
|
}));
|
|
667
661
|
}
|
|
@@ -670,13 +664,13 @@ class wt {
|
|
|
670
664
|
const t = this;
|
|
671
665
|
return await B("clipboard-read", async () => {
|
|
672
666
|
if (await N(), this._state?.uuid) {
|
|
673
|
-
const
|
|
674
|
-
if (
|
|
675
|
-
const
|
|
676
|
-
if (pt(t._state?.uuid,
|
|
667
|
+
const n = await V(this._nativeClipboard, v);
|
|
668
|
+
if (n && n === t._state.uuid) return !0;
|
|
669
|
+
const r = await dt(this._nativeClipboard, h);
|
|
670
|
+
if (pt(t._state?.uuid, r)) return !0;
|
|
677
671
|
}
|
|
678
672
|
return t._state = { items: await jt(this._nativeClipboard), uuid: null, ref: null }, this.dispatchEvent(new Event("clipboardread")), !0;
|
|
679
|
-
}, async (
|
|
673
|
+
}, async (n) => {
|
|
680
674
|
this.dispatchEvent(new Event("clipboarderrorread"));
|
|
681
675
|
}), this._state?.items ?? [];
|
|
682
676
|
}
|
|
@@ -685,10 +679,10 @@ class wt {
|
|
|
685
679
|
}
|
|
686
680
|
async _write(t) {
|
|
687
681
|
if (!this._nativeClipboard) return this._state = t, this.dispatchEvent(new Event("clipboardwrite")), this.dispatchEvent(new Event("clipboardchange")), null;
|
|
688
|
-
const
|
|
682
|
+
const n = this, r = [], o = t.uuid;
|
|
689
683
|
let a = t.items ?? [];
|
|
690
684
|
const i = () => {
|
|
691
|
-
|
|
685
|
+
n._state = { uuid: o, ref: t.ref, items: r }, n.dispatchEvent(new Event("clipboardwrite")), n.dispatchEvent(new Event("clipboardchange"));
|
|
692
686
|
};
|
|
693
687
|
await B("clipboard-write", async () => {
|
|
694
688
|
await N(), o && a.length === 0 && (a.push(new ClipboardItem({ [v]: new Blob([o], { type: v }) })), a.push(new ClipboardItem({ [h]: new Blob([ft(o)], { type: h }) })));
|
|
@@ -716,10 +710,10 @@ class wt {
|
|
|
716
710
|
const p = s.types[f];
|
|
717
711
|
u[p] = f === c ? w : s.getType(p);
|
|
718
712
|
}
|
|
719
|
-
d && c === -1 && (u[h] = w), o && (u[v] = new Blob([o], { type: v })),
|
|
713
|
+
d && c === -1 && (u[h] = w), o && (u[v] = new Blob([o], { type: v })), r.push(new ClipboardItem(u));
|
|
720
714
|
}
|
|
721
715
|
try {
|
|
722
|
-
|
|
716
|
+
r && r.length !== 0 ? await this._nativeClipboard.write(r) : await (async (l) => {
|
|
723
717
|
l && await l.writeText("");
|
|
724
718
|
})(this._nativeClipboard);
|
|
725
719
|
} catch (l) {
|
|
@@ -732,28 +726,28 @@ class wt {
|
|
|
732
726
|
}
|
|
733
727
|
async writeReference(t) {
|
|
734
728
|
if (!t) return void this.clear();
|
|
735
|
-
let
|
|
736
|
-
const
|
|
729
|
+
let n = null;
|
|
730
|
+
const r = {};
|
|
737
731
|
try {
|
|
738
732
|
const a = await t.toText?.() ?? null;
|
|
739
|
-
a && (
|
|
733
|
+
a && (r[b] = new Blob([a ?? ""], { type: b }));
|
|
740
734
|
} catch (a) {
|
|
741
|
-
|
|
735
|
+
n = a;
|
|
742
736
|
}
|
|
743
737
|
try {
|
|
744
738
|
const a = await t.toHtml?.() ?? null;
|
|
745
|
-
a && (
|
|
739
|
+
a && (r[h] = new Blob([a], { type: h }));
|
|
746
740
|
} catch (a) {
|
|
747
|
-
|
|
741
|
+
n = a, console.warn("export to html", a);
|
|
748
742
|
}
|
|
749
743
|
try {
|
|
750
744
|
const a = await t.toImage?.() ?? null;
|
|
751
|
-
a && (
|
|
745
|
+
a && (r[L] = a);
|
|
752
746
|
} catch (a) {
|
|
753
|
-
|
|
747
|
+
n = a, console.warn("export to png", a);
|
|
754
748
|
}
|
|
755
|
-
const o = this._write({ uuid: R(), ref: t, items: Object.keys(
|
|
756
|
-
if (
|
|
749
|
+
const o = this._write({ uuid: R(), ref: t, items: Object.keys(r).length > 0 ? [new ClipboardItem(r)] : null });
|
|
750
|
+
if (n) throw n;
|
|
757
751
|
return o;
|
|
758
752
|
}
|
|
759
753
|
clear(t = !1) {
|
|
@@ -763,32 +757,32 @@ class wt {
|
|
|
763
757
|
return await this.read(), this._state?.ref ?? null;
|
|
764
758
|
}
|
|
765
759
|
readText() {
|
|
766
|
-
return new Promise(async (t,
|
|
767
|
-
const
|
|
760
|
+
return new Promise(async (t, n) => {
|
|
761
|
+
const r = await this.read();
|
|
768
762
|
let o = null;
|
|
769
|
-
for (let i = 0; !o &&
|
|
763
|
+
for (let i = 0; !o && r && i < r.length; i++) r[i].types.includes(b) && (o = await r[i].getType(b));
|
|
770
764
|
if (!o) return void t("");
|
|
771
765
|
const a = new FileReader();
|
|
772
766
|
a.onload = () => {
|
|
773
767
|
t(a.result);
|
|
774
768
|
}, a.readAsText(o), a.onerror = (i) => {
|
|
775
|
-
|
|
769
|
+
n(i);
|
|
776
770
|
};
|
|
777
771
|
});
|
|
778
772
|
}
|
|
779
773
|
async writeText(t) {
|
|
780
|
-
const
|
|
781
|
-
return this._write({ uuid: R(), items:
|
|
774
|
+
const n = [new ClipboardItem({ [b]: new Blob([t], { type: b }) })];
|
|
775
|
+
return this._write({ uuid: R(), items: n, ref: null });
|
|
782
776
|
}
|
|
783
|
-
addEventListener(t,
|
|
784
|
-
const o =
|
|
777
|
+
addEventListener(t, n, r = {}) {
|
|
778
|
+
const o = r?.capture ? this._listenersCapture : this._listeners;
|
|
785
779
|
let a = o.get(t);
|
|
786
|
-
a || (a = /* @__PURE__ */ new Map(), o.set(t, a)), a.set(
|
|
780
|
+
a || (a = /* @__PURE__ */ new Map(), o.set(t, a)), a.set(n, typeof r == "boolean" ? {} : r);
|
|
787
781
|
}
|
|
788
782
|
dispatchEvent(t) {
|
|
789
783
|
if (!t) return;
|
|
790
|
-
const
|
|
791
|
-
const o =
|
|
784
|
+
const n = (r) => {
|
|
785
|
+
const o = r.get(t.type);
|
|
792
786
|
o && o.forEach((a, i) => {
|
|
793
787
|
try {
|
|
794
788
|
typeof i == "function" ? i(t) : i.handleEvent && i.handleEvent(t), a.once && o.delete(i);
|
|
@@ -797,11 +791,11 @@ class wt {
|
|
|
797
791
|
}
|
|
798
792
|
});
|
|
799
793
|
};
|
|
800
|
-
return
|
|
794
|
+
return n(this._listenersCapture), n(this._listeners), !0;
|
|
801
795
|
}
|
|
802
|
-
removeEventListener(t,
|
|
803
|
-
const o =
|
|
804
|
-
a && (a.delete(
|
|
796
|
+
removeEventListener(t, n, r) {
|
|
797
|
+
const o = r?.capture ? this._listenersCapture : this._listeners, a = o.get(t);
|
|
798
|
+
a && (a.delete(n), a.size === 0 && o.delete(t));
|
|
805
799
|
}
|
|
806
800
|
close() {
|
|
807
801
|
globalThis.removeEventListener?.("focus", this._onFocus), globalThis.removeEventListener?.("blur", this._onBlur);
|
|
@@ -815,10 +809,10 @@ const Vt = Object.freeze({ compileTypescript: async function(e) {
|
|
|
815
809
|
if (q && $t.deepEqual(q, e)) return ht;
|
|
816
810
|
const t = await async function() {
|
|
817
811
|
if (M) return M;
|
|
818
|
-
const { TypeScriptCompiler:
|
|
819
|
-
return M = new
|
|
820
|
-
}(),
|
|
821
|
-
return ht =
|
|
812
|
+
const { TypeScriptCompiler: r } = await import("./BwMOs09MXUNDNqns.mjs");
|
|
813
|
+
return M = new r(), M;
|
|
814
|
+
}(), n = await t.compileModule(e);
|
|
815
|
+
return ht = n, q = e, n;
|
|
822
816
|
} });
|
|
823
817
|
export {
|
|
824
818
|
Vt as S,
|