@inpageedit/core 0.13.0 → 0.14.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/LICENSE +20 -20
- package/dist/{BasePlugin-Bf2UuIHF.js → BasePlugin-CU8beLYu.js} +17 -26
- package/dist/BasePlugin-CU8beLYu.js.map +1 -0
- package/dist/IconQuickEdit-CMCQncyj.js.map +1 -1
- package/dist/InputBox-nQKtiWtZ.js.map +1 -1
- package/dist/{PluginPrefSync-Dn1Xsiqz.js → PluginPrefSync-B-gPsC2n.js} +124 -128
- package/dist/PluginPrefSync-B-gPsC2n.js.map +1 -0
- package/dist/PluginStoreApp-CDteVCBG.js +453 -0
- package/dist/PluginStoreApp-CDteVCBG.js.map +1 -0
- package/dist/{endpoints-DgyuoRZd.js → Preferences-85Q9FAmb.js} +589 -565
- package/dist/Preferences-85Q9FAmb.js.map +1 -0
- package/dist/WatchlistAction-BbNAyryN.js.map +1 -1
- package/dist/components/index.js.map +1 -1
- package/dist/{index-BuYNq7f3.js → index-19CgGBI0.js} +1419 -921
- package/dist/index-19CgGBI0.js.map +1 -0
- package/dist/{index-B7c6jL9x.js → index-BKIf3i0I.js} +146 -137
- package/dist/index-BKIf3i0I.js.map +1 -0
- package/dist/{index-CCRMmnwk.js → index-BrtFJ-M0.js} +67 -66
- package/dist/index-BrtFJ-M0.js.map +1 -0
- package/dist/index-CG38LlAh.js.map +1 -1
- package/dist/index-CM_6yF2v.js.map +1 -1
- package/dist/index-CQr1DJ8n.js +173 -0
- package/dist/index-CQr1DJ8n.js.map +1 -0
- package/dist/{index-BQ-cHWkJ.js → index-CVTBg5O9.js} +66 -48
- package/dist/index-CVTBg5O9.js.map +1 -0
- package/dist/index-Ci82vLXg.js +179 -0
- package/dist/index-Ci82vLXg.js.map +1 -0
- package/dist/{index-BwdWyHLe.js → index-D3iZhRMJ.js} +93 -93
- package/dist/index-D3iZhRMJ.js.map +1 -0
- package/dist/index-DD5CVCfD.js.map +1 -1
- package/dist/{index-BJ7_Q1mB.js → index-DGtq21uW.js} +17 -16
- package/dist/index-DGtq21uW.js.map +1 -0
- package/dist/index-DXL7teb0.js +394 -0
- package/dist/index-DXL7teb0.js.map +1 -0
- package/dist/index-DjPpAyfE.js +116 -0
- package/dist/index-DjPpAyfE.js.map +1 -0
- package/dist/{index-eSlbrNqF.js → index-rpiO9fpc.js} +4 -5
- package/dist/{index-eSlbrNqF.js.map → index-rpiO9fpc.js.map} +1 -1
- package/dist/index.d.ts +327 -26
- package/dist/index.js +32 -26
- package/dist/index.js.map +1 -1
- package/dist/makeCallable-LDU0xZMJ.js.map +1 -1
- package/dist/models/index.js +174 -154
- package/dist/models/index.js.map +1 -1
- package/dist/noop-ClDc6zv4.js.map +1 -1
- package/dist/plugins/index.js +10 -10
- package/dist/services/index.js +1 -1
- package/dist/style.css +1 -1
- package/dist/vueHooks-l04s8cIl.js.map +1 -1
- package/lib/index.umd.js +20 -12
- package/lib/index.umd.js.map +1 -1
- package/lib/style.css +1 -1
- package/package.json +4 -4
- package/dist/BasePlugin-Bf2UuIHF.js.map +0 -1
- package/dist/PluginPrefSync-Dn1Xsiqz.js.map +0 -1
- package/dist/PluginStoreApp-CpOLArL7.js +0 -452
- package/dist/PluginStoreApp-CpOLArL7.js.map +0 -1
- package/dist/Preferences-DS4-CFWe.js +0 -9
- package/dist/Preferences-DS4-CFWe.js.map +0 -1
- package/dist/endpoints-DgyuoRZd.js.map +0 -1
- package/dist/index-2RfILgXm.js +0 -180
- package/dist/index-2RfILgXm.js.map +0 -1
- package/dist/index-B7c6jL9x.js.map +0 -1
- package/dist/index-BJ7_Q1mB.js.map +0 -1
- package/dist/index-BNh95-x2.js +0 -115
- package/dist/index-BNh95-x2.js.map +0 -1
- package/dist/index-BQ-cHWkJ.js.map +0 -1
- package/dist/index-BuYNq7f3.js.map +0 -1
- package/dist/index-BwdWyHLe.js.map +0 -1
- package/dist/index-CCRMmnwk.js.map +0 -1
- package/dist/index-CnIpUF9x.js +0 -173
- package/dist/index-CnIpUF9x.js.map +0 -1
- package/dist/index-CyG7_IYz.js +0 -394
- package/dist/index-CyG7_IYz.js.map +0 -1
|
@@ -1,102 +1,102 @@
|
|
|
1
|
-
const
|
|
2
|
-
let
|
|
1
|
+
const xe = () => {
|
|
2
|
+
let e, t;
|
|
3
3
|
return { promise: new Promise((n, c) => {
|
|
4
|
-
|
|
5
|
-
}), resolve:
|
|
4
|
+
e = n, t = c;
|
|
5
|
+
}), resolve: e, reject: t };
|
|
6
6
|
};
|
|
7
|
-
Promise.withResolvers || (Promise.withResolvers =
|
|
8
|
-
var
|
|
9
|
-
function
|
|
7
|
+
Promise.withResolvers || (Promise.withResolvers = xe);
|
|
8
|
+
var ve = Object.defineProperty, w = (e, t) => ve(e, "name", { value: t, configurable: !0 });
|
|
9
|
+
function ke() {
|
|
10
10
|
}
|
|
11
|
-
w(
|
|
12
|
-
function $(
|
|
13
|
-
return
|
|
11
|
+
w(ke, "noop");
|
|
12
|
+
function $(e) {
|
|
13
|
+
return e == null;
|
|
14
14
|
}
|
|
15
15
|
w($, "isNullable");
|
|
16
|
-
function
|
|
17
|
-
return !$(
|
|
16
|
+
function Oe(e) {
|
|
17
|
+
return !$(e);
|
|
18
18
|
}
|
|
19
|
-
w(
|
|
20
|
-
function J(
|
|
21
|
-
return
|
|
19
|
+
w(Oe, "isNonNullable");
|
|
20
|
+
function J(e) {
|
|
21
|
+
return e && typeof e == "object" && !Array.isArray(e);
|
|
22
22
|
}
|
|
23
23
|
w(J, "isPlainObject");
|
|
24
|
-
function
|
|
25
|
-
return Object.fromEntries(Object.entries(
|
|
24
|
+
function fe(e, t) {
|
|
25
|
+
return Object.fromEntries(Object.entries(e).filter(([r, n]) => t(r, n)));
|
|
26
26
|
}
|
|
27
|
-
w(
|
|
28
|
-
function
|
|
29
|
-
return Object.fromEntries(Object.entries(
|
|
27
|
+
w(fe, "filterKeys");
|
|
28
|
+
function C(e, t) {
|
|
29
|
+
return Object.fromEntries(Object.entries(e).map(([r, n]) => [r, t(n, r)]));
|
|
30
30
|
}
|
|
31
|
-
w(
|
|
32
|
-
function
|
|
33
|
-
if (!
|
|
31
|
+
w(C, "mapValues");
|
|
32
|
+
function ae(e, t, r) {
|
|
33
|
+
if (!t) return { ...e };
|
|
34
34
|
const n = {};
|
|
35
|
-
for (const c of
|
|
36
|
-
(r ||
|
|
35
|
+
for (const c of t)
|
|
36
|
+
(r || e[c] !== void 0) && (n[c] = e[c]);
|
|
37
37
|
return n;
|
|
38
38
|
}
|
|
39
|
-
w(
|
|
40
|
-
function
|
|
41
|
-
if (!
|
|
42
|
-
const r = { ...
|
|
43
|
-
for (const n of
|
|
39
|
+
w(ae, "pick");
|
|
40
|
+
function Se(e, t) {
|
|
41
|
+
if (!t) return { ...e };
|
|
42
|
+
const r = { ...e };
|
|
43
|
+
for (const n of t)
|
|
44
44
|
Reflect.deleteProperty(r, n);
|
|
45
45
|
return r;
|
|
46
46
|
}
|
|
47
|
-
w(
|
|
48
|
-
function A(
|
|
49
|
-
return Object.defineProperty(
|
|
47
|
+
w(Se, "omit");
|
|
48
|
+
function A(e, t, r) {
|
|
49
|
+
return Object.defineProperty(e, t, { writable: !0, value: r, enumerable: !1 });
|
|
50
50
|
}
|
|
51
51
|
w(A, "defineProperty");
|
|
52
|
-
function
|
|
53
|
-
return
|
|
52
|
+
function je(e, t) {
|
|
53
|
+
return t.every((r) => e.includes(r));
|
|
54
54
|
}
|
|
55
|
-
w(
|
|
56
|
-
function
|
|
57
|
-
return
|
|
55
|
+
w(je, "contain");
|
|
56
|
+
function $e(e, t) {
|
|
57
|
+
return e.filter((r) => t.includes(r));
|
|
58
58
|
}
|
|
59
|
-
w(
|
|
60
|
-
function
|
|
61
|
-
return
|
|
59
|
+
w($e, "intersection");
|
|
60
|
+
function _e(e, t) {
|
|
61
|
+
return e.filter((r) => !t.includes(r));
|
|
62
62
|
}
|
|
63
|
-
w(
|
|
64
|
-
function
|
|
65
|
-
return Array.from(/* @__PURE__ */ new Set([...
|
|
63
|
+
w(_e, "difference");
|
|
64
|
+
function Ae(e, t) {
|
|
65
|
+
return Array.from(/* @__PURE__ */ new Set([...e, ...t]));
|
|
66
66
|
}
|
|
67
|
-
w(
|
|
68
|
-
function
|
|
69
|
-
return [...new Set(
|
|
67
|
+
w(Ae, "union");
|
|
68
|
+
function Re(e) {
|
|
69
|
+
return [...new Set(e)];
|
|
70
70
|
}
|
|
71
|
-
w(
|
|
72
|
-
function
|
|
73
|
-
const r =
|
|
74
|
-
return r >= 0 ? (
|
|
71
|
+
w(Re, "deduplicate");
|
|
72
|
+
function N(e, t) {
|
|
73
|
+
const r = e?.indexOf(t);
|
|
74
|
+
return r >= 0 ? (e.splice(r, 1), !0) : !1;
|
|
75
75
|
}
|
|
76
|
-
w(
|
|
77
|
-
function
|
|
78
|
-
return Array.isArray(
|
|
76
|
+
w(N, "remove");
|
|
77
|
+
function Pe(e) {
|
|
78
|
+
return Array.isArray(e) ? e : $(e) ? [] : [e];
|
|
79
79
|
}
|
|
80
|
-
w(
|
|
81
|
-
function
|
|
82
|
-
return arguments.length === 1 ? (r) =>
|
|
80
|
+
w(Pe, "makeArray");
|
|
81
|
+
function I(e, t) {
|
|
82
|
+
return arguments.length === 1 ? (r) => I(e, r) : e in globalThis && t instanceof globalThis[e] || Object.prototype.toString.call(t).slice(8, -1) === e;
|
|
83
83
|
}
|
|
84
|
-
w(
|
|
85
|
-
function
|
|
86
|
-
return
|
|
84
|
+
w(I, "is");
|
|
85
|
+
function M(e) {
|
|
86
|
+
return I("ArrayBuffer", e) || I("SharedArrayBuffer", e);
|
|
87
87
|
}
|
|
88
|
-
w(
|
|
89
|
-
function
|
|
90
|
-
return
|
|
88
|
+
w(M, "isArrayBufferLike");
|
|
89
|
+
function ue(e) {
|
|
90
|
+
return M(e) || ArrayBuffer.isView(e);
|
|
91
91
|
}
|
|
92
|
-
w(
|
|
92
|
+
w(ue, "isArrayBufferSource");
|
|
93
93
|
var E;
|
|
94
|
-
((
|
|
95
|
-
|
|
96
|
-
function
|
|
94
|
+
((e) => {
|
|
95
|
+
e.is = M, e.isSource = ue;
|
|
96
|
+
function t(a) {
|
|
97
97
|
return ArrayBuffer.isView(a) ? a.buffer.slice(a.byteOffset, a.byteOffset + a.byteLength) : a;
|
|
98
98
|
}
|
|
99
|
-
|
|
99
|
+
e.fromSource = t, w(t, "fromSource");
|
|
100
100
|
function r(a) {
|
|
101
101
|
if (typeof Buffer < "u")
|
|
102
102
|
return Buffer.from(a).toString("base64");
|
|
@@ -106,136 +106,136 @@ var E;
|
|
|
106
106
|
y += String.fromCharCode(d[b]);
|
|
107
107
|
return btoa(y);
|
|
108
108
|
}
|
|
109
|
-
|
|
109
|
+
e.toBase64 = r, w(r, "toBase64");
|
|
110
110
|
function n(a) {
|
|
111
|
-
return typeof Buffer < "u" ?
|
|
111
|
+
return typeof Buffer < "u" ? t(Buffer.from(a, "base64")) : Uint8Array.from(atob(a), (y) => y.charCodeAt(0));
|
|
112
112
|
}
|
|
113
|
-
|
|
113
|
+
e.fromBase64 = n, w(n, "fromBase64");
|
|
114
114
|
function c(a) {
|
|
115
115
|
return typeof Buffer < "u" ? Buffer.from(a).toString("hex") : Array.from(new Uint8Array(a), (y) => y.toString(16).padStart(2, "0")).join("");
|
|
116
116
|
}
|
|
117
|
-
|
|
117
|
+
e.toHex = c, w(c, "toHex");
|
|
118
118
|
function i(a) {
|
|
119
|
-
if (typeof Buffer < "u") return
|
|
119
|
+
if (typeof Buffer < "u") return t(Buffer.from(a, "hex"));
|
|
120
120
|
const y = a.length % 2 === 0 ? a : a.slice(0, a.length - 1), d = [];
|
|
121
121
|
for (let b = 0; b < y.length; b += 2)
|
|
122
122
|
d.push(parseInt(`${y[b]}${y[b + 1]}`, 16));
|
|
123
123
|
return Uint8Array.from(d).buffer;
|
|
124
124
|
}
|
|
125
|
-
|
|
125
|
+
e.fromHex = i, w(i, "fromHex");
|
|
126
126
|
})(E || (E = {}));
|
|
127
127
|
E.fromBase64;
|
|
128
128
|
E.toBase64;
|
|
129
129
|
E.fromHex;
|
|
130
130
|
E.toHex;
|
|
131
|
-
function V(
|
|
132
|
-
if (!
|
|
133
|
-
if (
|
|
134
|
-
if (
|
|
135
|
-
if (
|
|
136
|
-
if (ArrayBuffer.isView(
|
|
137
|
-
const r =
|
|
131
|
+
function V(e, t = /* @__PURE__ */ new Map()) {
|
|
132
|
+
if (!e || typeof e != "object") return e;
|
|
133
|
+
if (I("Date", e)) return new Date(e.valueOf());
|
|
134
|
+
if (I("RegExp", e)) return new RegExp(e.source, e.flags);
|
|
135
|
+
if (M(e)) return e.slice(0);
|
|
136
|
+
if (ArrayBuffer.isView(e)) return e.buffer.slice(e.byteOffset, e.byteOffset + e.byteLength);
|
|
137
|
+
const r = t.get(e);
|
|
138
138
|
if (r) return r;
|
|
139
|
-
if (Array.isArray(
|
|
139
|
+
if (Array.isArray(e)) {
|
|
140
140
|
const c = [];
|
|
141
|
-
return
|
|
142
|
-
c[a] = Reflect.apply(V, null, [i,
|
|
141
|
+
return t.set(e, c), e.forEach((i, a) => {
|
|
142
|
+
c[a] = Reflect.apply(V, null, [i, t]);
|
|
143
143
|
}), c;
|
|
144
144
|
}
|
|
145
|
-
const n = Object.create(Object.getPrototypeOf(
|
|
146
|
-
|
|
147
|
-
for (const c of Reflect.ownKeys(
|
|
148
|
-
const i = { ...Reflect.getOwnPropertyDescriptor(
|
|
149
|
-
"value" in i && (i.value = Reflect.apply(V, null, [i.value,
|
|
145
|
+
const n = Object.create(Object.getPrototypeOf(e));
|
|
146
|
+
t.set(e, n);
|
|
147
|
+
for (const c of Reflect.ownKeys(e)) {
|
|
148
|
+
const i = { ...Reflect.getOwnPropertyDescriptor(e, c) };
|
|
149
|
+
"value" in i && (i.value = Reflect.apply(V, null, [i.value, t])), Reflect.defineProperty(n, c, i);
|
|
150
150
|
}
|
|
151
151
|
return n;
|
|
152
152
|
}
|
|
153
153
|
w(V, "clone");
|
|
154
|
-
function
|
|
155
|
-
if (
|
|
156
|
-
if (typeof
|
|
154
|
+
function B(e, t, r) {
|
|
155
|
+
if (e === t || !r && $(e) && $(t)) return !0;
|
|
156
|
+
if (typeof e != typeof t || typeof e != "object" || !e || !t) return !1;
|
|
157
157
|
function n(c, i) {
|
|
158
|
-
return c(
|
|
158
|
+
return c(e) ? c(t) ? i(e, t) : !1 : c(t) ? !1 : void 0;
|
|
159
159
|
}
|
|
160
|
-
return w(n, "check"), n(Array.isArray, (c, i) => c.length === i.length && c.every((a, y) =>
|
|
160
|
+
return w(n, "check"), n(Array.isArray, (c, i) => c.length === i.length && c.every((a, y) => B(a, i[y]))) ?? n(I("Date"), (c, i) => c.valueOf() === i.valueOf()) ?? n(I("RegExp"), (c, i) => c.source === i.source && c.flags === i.flags) ?? n(M, (c, i) => {
|
|
161
161
|
if (c.byteLength !== i.byteLength) return !1;
|
|
162
162
|
const a = new Uint8Array(c), y = new Uint8Array(i);
|
|
163
163
|
for (let d = 0; d < a.length; d++)
|
|
164
164
|
if (a[d] !== y[d]) return !1;
|
|
165
165
|
return !0;
|
|
166
|
-
}) ?? Object.keys({ ...
|
|
166
|
+
}) ?? Object.keys({ ...e, ...t }).every((c) => B(e[c], t[c], r));
|
|
167
167
|
}
|
|
168
|
-
w(
|
|
169
|
-
function
|
|
170
|
-
return
|
|
168
|
+
w(B, "deepEqual");
|
|
169
|
+
function Ee(e) {
|
|
170
|
+
return e.charAt(0).toUpperCase() + e.slice(1);
|
|
171
171
|
}
|
|
172
|
-
w(
|
|
173
|
-
function
|
|
174
|
-
return
|
|
172
|
+
w(Ee, "capitalize");
|
|
173
|
+
function De(e) {
|
|
174
|
+
return e.charAt(0).toLowerCase() + e.slice(1);
|
|
175
175
|
}
|
|
176
|
-
w(
|
|
177
|
-
function
|
|
178
|
-
return
|
|
176
|
+
w(De, "uncapitalize");
|
|
177
|
+
function Ce(e) {
|
|
178
|
+
return e.replace(/[_-][a-z]/g, (t) => t.slice(1).toUpperCase());
|
|
179
179
|
}
|
|
180
|
-
w(
|
|
181
|
-
function
|
|
180
|
+
w(Ce, "camelCase");
|
|
181
|
+
function X(e, t, r) {
|
|
182
182
|
const n = [];
|
|
183
183
|
let c = 0;
|
|
184
|
-
for (let i = 0; i <
|
|
185
|
-
const a =
|
|
184
|
+
for (let i = 0; i < e.length; i++) {
|
|
185
|
+
const a = e.charCodeAt(i);
|
|
186
186
|
if (a >= 65 && a <= 90) {
|
|
187
187
|
if (c === 1) {
|
|
188
|
-
const y =
|
|
188
|
+
const y = e.charCodeAt(i + 1);
|
|
189
189
|
y >= 97 && y <= 122 && n.push(r), n.push(a + 32);
|
|
190
190
|
} else
|
|
191
191
|
c !== 0 && n.push(r), n.push(a + 32);
|
|
192
192
|
c = 1;
|
|
193
|
-
} else a >= 97 && a <= 122 ? (n.push(a), c = 2) :
|
|
193
|
+
} else a >= 97 && a <= 122 ? (n.push(a), c = 2) : t.includes(a) ? (c !== 0 && n.push(r), c = 0) : n.push(a);
|
|
194
194
|
}
|
|
195
195
|
return String.fromCharCode(...n);
|
|
196
196
|
}
|
|
197
|
-
w(
|
|
198
|
-
function
|
|
199
|
-
return
|
|
197
|
+
w(X, "tokenize");
|
|
198
|
+
function Ne(e) {
|
|
199
|
+
return X(e, [45, 95], 45);
|
|
200
200
|
}
|
|
201
|
-
w(
|
|
202
|
-
function
|
|
203
|
-
return
|
|
201
|
+
w(Ne, "paramCase");
|
|
202
|
+
function Ie(e) {
|
|
203
|
+
return X(e, [45, 95], 95);
|
|
204
204
|
}
|
|
205
|
-
w(
|
|
206
|
-
function
|
|
207
|
-
return typeof
|
|
205
|
+
w(Ie, "snakeCase");
|
|
206
|
+
function Be(e) {
|
|
207
|
+
return typeof e != "string" ? `[${e.toString()}]` : /^[a-z_$][\w$]*$/i.test(e) ? `.${e}` : `[${JSON.stringify(e)}]`;
|
|
208
208
|
}
|
|
209
|
-
w(
|
|
210
|
-
function
|
|
211
|
-
return
|
|
209
|
+
w(Be, "formatProperty");
|
|
210
|
+
function le(e) {
|
|
211
|
+
return e.replace(/\/$/, "");
|
|
212
212
|
}
|
|
213
|
-
w(
|
|
214
|
-
function
|
|
215
|
-
return
|
|
213
|
+
w(le, "trimSlash");
|
|
214
|
+
function Ue(e) {
|
|
215
|
+
return e.startsWith("/") || (e = "/" + e), le(e);
|
|
216
216
|
}
|
|
217
|
-
w(
|
|
218
|
-
var
|
|
219
|
-
((
|
|
220
|
-
|
|
221
|
-
let
|
|
217
|
+
w(Ue, "sanitize");
|
|
218
|
+
var se;
|
|
219
|
+
((e) => {
|
|
220
|
+
e.millisecond = 1, e.second = 1e3, e.minute = e.second * 60, e.hour = e.minute * 60, e.day = e.hour * 24, e.week = e.day * 7;
|
|
221
|
+
let t = (/* @__PURE__ */ new Date()).getTimezoneOffset();
|
|
222
222
|
function r(x) {
|
|
223
|
-
|
|
223
|
+
t = x;
|
|
224
224
|
}
|
|
225
|
-
|
|
225
|
+
e.setTimezoneOffset = r, w(r, "setTimezoneOffset");
|
|
226
226
|
function n() {
|
|
227
|
-
return
|
|
227
|
+
return t;
|
|
228
228
|
}
|
|
229
|
-
|
|
229
|
+
e.getTimezoneOffset = n, w(n, "getTimezoneOffset");
|
|
230
230
|
function c(x = /* @__PURE__ */ new Date(), v) {
|
|
231
|
-
return typeof x == "number" && (x = new Date(x)), v === void 0 && (v =
|
|
231
|
+
return typeof x == "number" && (x = new Date(x)), v === void 0 && (v = t), Math.floor((x.valueOf() / e.minute - v) / 1440);
|
|
232
232
|
}
|
|
233
|
-
|
|
233
|
+
e.getDateNumber = c, w(c, "getDateNumber");
|
|
234
234
|
function i(x, v) {
|
|
235
|
-
const
|
|
236
|
-
return v === void 0 && (v =
|
|
235
|
+
const U = new Date(x * e.day);
|
|
236
|
+
return v === void 0 && (v = t), new Date(+U + v * e.minute);
|
|
237
237
|
}
|
|
238
|
-
|
|
238
|
+
e.fromDateNumber = i, w(i, "fromDateNumber");
|
|
239
239
|
const a = /\d+(?:\.\d+)?/.source, y = new RegExp(`^${[
|
|
240
240
|
"w(?:eek(?:s)?)?",
|
|
241
241
|
"d(?:ay(?:s)?)?",
|
|
@@ -245,29 +245,29 @@ var st;
|
|
|
245
245
|
].map((x) => `(${a}${x})?`).join("")}$`);
|
|
246
246
|
function d(x) {
|
|
247
247
|
const v = y.exec(x);
|
|
248
|
-
return v ? (parseFloat(v[1]) *
|
|
248
|
+
return v ? (parseFloat(v[1]) * e.week || 0) + (parseFloat(v[2]) * e.day || 0) + (parseFloat(v[3]) * e.hour || 0) + (parseFloat(v[4]) * e.minute || 0) + (parseFloat(v[5]) * e.second || 0) : 0;
|
|
249
249
|
}
|
|
250
|
-
|
|
250
|
+
e.parseTime = d, w(d, "parseTime");
|
|
251
251
|
function b(x) {
|
|
252
252
|
const v = d(x);
|
|
253
253
|
return v ? x = Date.now() + v : /^\d{1,2}(:\d{1,2}){1,2}$/.test(x) ? x = `${(/* @__PURE__ */ new Date()).toLocaleDateString()}-${x}` : /^\d{1,2}-\d{1,2}-\d{1,2}(:\d{1,2}){1,2}$/.test(x) && (x = `${(/* @__PURE__ */ new Date()).getFullYear()}-${x}`), x ? new Date(x) : /* @__PURE__ */ new Date();
|
|
254
254
|
}
|
|
255
|
-
|
|
255
|
+
e.parseDate = b, w(b, "parseDate");
|
|
256
256
|
function j(x) {
|
|
257
257
|
const v = Math.abs(x);
|
|
258
|
-
return v >=
|
|
258
|
+
return v >= e.day - e.hour / 2 ? Math.round(x / e.day) + "d" : v >= e.hour - e.minute / 2 ? Math.round(x / e.hour) + "h" : v >= e.minute - e.second / 2 ? Math.round(x / e.minute) + "m" : v >= e.second ? Math.round(x / e.second) + "s" : x + "ms";
|
|
259
259
|
}
|
|
260
|
-
|
|
261
|
-
function
|
|
260
|
+
e.format = j, w(j, "format");
|
|
261
|
+
function O(x, v = 2) {
|
|
262
262
|
return x.toString().padStart(v, "0");
|
|
263
263
|
}
|
|
264
|
-
|
|
264
|
+
e.toDigits = O, w(O, "toDigits");
|
|
265
265
|
function R(x, v = /* @__PURE__ */ new Date()) {
|
|
266
|
-
return x.replace("yyyy", v.getFullYear().toString()).replace("yy", v.getFullYear().toString().slice(2)).replace("MM",
|
|
266
|
+
return x.replace("yyyy", v.getFullYear().toString()).replace("yy", v.getFullYear().toString().slice(2)).replace("MM", O(v.getMonth() + 1)).replace("dd", O(v.getDate())).replace("hh", O(v.getHours())).replace("mm", O(v.getMinutes())).replace("ss", O(v.getSeconds())).replace("SSS", O(v.getMilliseconds(), 3));
|
|
267
267
|
}
|
|
268
|
-
|
|
269
|
-
})(
|
|
270
|
-
var
|
|
268
|
+
e.template = R, w(R, "template");
|
|
269
|
+
})(se || (se = {}));
|
|
270
|
+
var ze = Object.defineProperty, g = (e, t) => ze(e, "name", { value: t, configurable: !0 }), h = {
|
|
271
271
|
// internal symbols
|
|
272
272
|
shadow: Symbol.for("cordis.shadow"),
|
|
273
273
|
receiver: Symbol.for("cordis.receiver"),
|
|
@@ -288,120 +288,120 @@ var zt = Object.defineProperty, g = (t, e) => zt(t, "name", { value: e, configur
|
|
|
288
288
|
tracker: Symbol.for("cordis.tracker"),
|
|
289
289
|
provide: Symbol.for("cordis.provide"),
|
|
290
290
|
immediate: Symbol.for("cordis.immediate")
|
|
291
|
-
},
|
|
292
|
-
}.constructor,
|
|
291
|
+
}, Fe = function* () {
|
|
292
|
+
}.constructor, oe = async function* () {
|
|
293
293
|
}.constructor;
|
|
294
|
-
function
|
|
295
|
-
return !(!
|
|
294
|
+
function ee(e) {
|
|
295
|
+
return !(!e.prototype || e instanceof Fe || oe !== Function && e instanceof oe);
|
|
296
296
|
}
|
|
297
|
-
g(
|
|
298
|
-
function
|
|
299
|
-
const r =
|
|
300
|
-
return r &&
|
|
297
|
+
g(ee, "isConstructor");
|
|
298
|
+
function q(e, t) {
|
|
299
|
+
const r = e.Config || e.schema;
|
|
300
|
+
return r && e.schema !== !1 && (t = r(t)), t ?? {};
|
|
301
301
|
}
|
|
302
|
-
g(
|
|
303
|
-
function
|
|
304
|
-
return [Map, Set, Date, Promise].some((
|
|
302
|
+
g(q, "resolveConfig");
|
|
303
|
+
function he(e) {
|
|
304
|
+
return [Map, Set, Date, Promise].some((t) => e instanceof t);
|
|
305
305
|
}
|
|
306
|
-
g(
|
|
307
|
-
function
|
|
308
|
-
if (
|
|
309
|
-
const r = Object.create(
|
|
310
|
-
for (const n of Reflect.ownKeys(
|
|
311
|
-
Object.defineProperty(r, n, Object.getOwnPropertyDescriptor(
|
|
306
|
+
g(he, "isUnproxyable");
|
|
307
|
+
function te(e, t) {
|
|
308
|
+
if (e === Object.prototype) return t;
|
|
309
|
+
const r = Object.create(te(Object.getPrototypeOf(e), t));
|
|
310
|
+
for (const n of Reflect.ownKeys(e))
|
|
311
|
+
Object.defineProperty(r, n, Object.getOwnPropertyDescriptor(e, n));
|
|
312
312
|
return r;
|
|
313
313
|
}
|
|
314
|
-
g(
|
|
315
|
-
function
|
|
316
|
-
return
|
|
314
|
+
g(te, "joinPrototype");
|
|
315
|
+
function re(e) {
|
|
316
|
+
return e && (typeof e == "object" || typeof e == "function");
|
|
317
317
|
}
|
|
318
|
-
g(
|
|
319
|
-
function
|
|
320
|
-
if (!
|
|
321
|
-
if (Object.hasOwn(
|
|
322
|
-
return Object.getPrototypeOf(
|
|
323
|
-
const n =
|
|
324
|
-
return n ? G(
|
|
318
|
+
g(re, "isObject");
|
|
319
|
+
function D(e, t, r) {
|
|
320
|
+
if (!re(t)) return t;
|
|
321
|
+
if (Object.hasOwn(t, h.shadow))
|
|
322
|
+
return Object.getPrototypeOf(t);
|
|
323
|
+
const n = t[h.tracker];
|
|
324
|
+
return n ? G(e, t, n, r) : t;
|
|
325
325
|
}
|
|
326
|
-
g(
|
|
327
|
-
function
|
|
328
|
-
return
|
|
329
|
-
get: /* @__PURE__ */ g((r, n, c) => n in
|
|
330
|
-
set: /* @__PURE__ */ g((r, n, c, i) => n in
|
|
331
|
-
}) :
|
|
326
|
+
g(D, "getTraceable");
|
|
327
|
+
function L(e, t) {
|
|
328
|
+
return t ? new Proxy(e, {
|
|
329
|
+
get: /* @__PURE__ */ g((r, n, c) => n in t && n !== "constructor" ? Reflect.get(t, n, c) : Reflect.get(r, n, c), "get"),
|
|
330
|
+
set: /* @__PURE__ */ g((r, n, c, i) => n in t && n !== "constructor" ? Reflect.set(t, n, c, i) : Reflect.set(r, n, c, i), "set")
|
|
331
|
+
}) : e;
|
|
332
332
|
}
|
|
333
|
-
g(
|
|
334
|
-
function H(
|
|
335
|
-
return
|
|
333
|
+
g(L, "withProps");
|
|
334
|
+
function H(e, t, r) {
|
|
335
|
+
return L(e, Object.defineProperty(/* @__PURE__ */ Object.create(null), t, {
|
|
336
336
|
value: r,
|
|
337
337
|
writable: !1
|
|
338
338
|
}));
|
|
339
339
|
}
|
|
340
340
|
g(H, "withProp");
|
|
341
|
-
function W(
|
|
341
|
+
function W(e, t, r, n) {
|
|
342
342
|
if (!r) return n;
|
|
343
|
-
const c = Reflect.getOwnPropertyDescriptor(
|
|
344
|
-
return c ? H(n, r,
|
|
343
|
+
const c = Reflect.getOwnPropertyDescriptor(t, r)?.value;
|
|
344
|
+
return c ? H(n, r, e.extend({ [h.shadow]: c })) : n;
|
|
345
345
|
}
|
|
346
346
|
g(W, "createShadow");
|
|
347
|
-
function
|
|
348
|
-
return new Proxy(
|
|
347
|
+
function pe(e, t, r, n) {
|
|
348
|
+
return new Proxy(t, {
|
|
349
349
|
apply: /* @__PURE__ */ g((c, i, a) => (i === r && (i = n), a = a.map((y) => typeof y != "function" || y[h.original] ? y : new Proxy(y, {
|
|
350
350
|
get: /* @__PURE__ */ g((d, b, j) => {
|
|
351
351
|
if (b === h.original) return d;
|
|
352
|
-
const
|
|
353
|
-
return b === "toString" &&
|
|
354
|
-
return Reflect.apply(
|
|
355
|
-
} :
|
|
352
|
+
const O = Reflect.get(d, b, j);
|
|
353
|
+
return b === "toString" && O === Function.prototype.toString ? function(...R) {
|
|
354
|
+
return Reflect.apply(O, this === j ? d : this, R);
|
|
355
|
+
} : O;
|
|
356
356
|
}, "get"),
|
|
357
|
-
apply: /* @__PURE__ */ g((d, b, j) => Reflect.apply(d,
|
|
358
|
-
construct: /* @__PURE__ */ g((d, b, j) => Reflect.construct(d, b.map((
|
|
359
|
-
})),
|
|
357
|
+
apply: /* @__PURE__ */ g((d, b, j) => Reflect.apply(d, D(e, b), j.map((O) => D(e, O))), "apply"),
|
|
358
|
+
construct: /* @__PURE__ */ g((d, b, j) => Reflect.construct(d, b.map((O) => D(e, O)), j), "construct")
|
|
359
|
+
})), D(e, Reflect.apply(c, i, a))), "apply")
|
|
360
360
|
});
|
|
361
361
|
}
|
|
362
|
-
g(
|
|
363
|
-
function G(
|
|
364
|
-
|
|
365
|
-
const c = new Proxy(
|
|
362
|
+
g(pe, "createShadowMethod");
|
|
363
|
+
function G(e, t, r, n) {
|
|
364
|
+
e[h.shadow] && (e = Object.getPrototypeOf(e));
|
|
365
|
+
const c = new Proxy(t, {
|
|
366
366
|
get: /* @__PURE__ */ g((i, a, y) => {
|
|
367
367
|
if (a === h.original) return i;
|
|
368
|
-
if (a === r.property) return
|
|
368
|
+
if (a === r.property) return e;
|
|
369
369
|
if (typeof a == "symbol")
|
|
370
370
|
return Reflect.get(i, a, y);
|
|
371
|
-
if (r.associate &&
|
|
372
|
-
return Reflect.get(
|
|
373
|
-
const d = W(
|
|
374
|
-
return j ? G(
|
|
371
|
+
if (r.associate && e[h.internal][`${r.associate}.${a}`])
|
|
372
|
+
return Reflect.get(e, `${r.associate}.${a}`, H(e, h.receiver, y));
|
|
373
|
+
const d = W(e, i, r.property, y), b = Reflect.get(i, a, d), j = b?.[h.tracker];
|
|
374
|
+
return j ? G(e, b, j) : !n && typeof b == "function" ? pe(e, b, y, d) : b;
|
|
375
375
|
}, "get"),
|
|
376
376
|
set: /* @__PURE__ */ g((i, a, y, d) => {
|
|
377
377
|
if (a === h.original || a === r.property) return !1;
|
|
378
378
|
if (typeof a == "symbol")
|
|
379
379
|
return Reflect.set(i, a, y, d);
|
|
380
|
-
if (r.associate &&
|
|
381
|
-
return Reflect.set(
|
|
382
|
-
const b = W(
|
|
380
|
+
if (r.associate && e[h.internal][`${r.associate}.${a}`])
|
|
381
|
+
return Reflect.set(e, `${r.associate}.${a}`, y, H(e, h.receiver, d));
|
|
382
|
+
const b = W(e, i, r.property, d);
|
|
383
383
|
return Reflect.set(i, a, y, b);
|
|
384
384
|
}, "set"),
|
|
385
|
-
apply: /* @__PURE__ */ g((i, a, y) =>
|
|
385
|
+
apply: /* @__PURE__ */ g((i, a, y) => ne(c, i, a, y), "apply")
|
|
386
386
|
});
|
|
387
387
|
return c;
|
|
388
388
|
}
|
|
389
389
|
g(G, "createTraceable");
|
|
390
|
-
function
|
|
391
|
-
return
|
|
390
|
+
function ne(e, t, r, n) {
|
|
391
|
+
return t[h.invoke] ? t[h.invoke].apply(e, n) : Reflect.apply(t, r, n);
|
|
392
392
|
}
|
|
393
|
-
g(
|
|
394
|
-
function Y(
|
|
393
|
+
g(ne, "applyTraceable");
|
|
394
|
+
function Y(e, t, r) {
|
|
395
395
|
const n = /* @__PURE__ */ g(function(...c) {
|
|
396
396
|
const i = G(n.ctx, n, r);
|
|
397
|
-
return
|
|
397
|
+
return ne(i, n, this, c);
|
|
398
398
|
}, "self");
|
|
399
|
-
return A(n, "name",
|
|
399
|
+
return A(n, "name", e), Object.setPrototypeOf(n, t);
|
|
400
400
|
}
|
|
401
401
|
g(Y, "createCallable");
|
|
402
|
-
var
|
|
403
|
-
constructor(
|
|
404
|
-
this.ctx =
|
|
402
|
+
var Le = class z {
|
|
403
|
+
constructor(t) {
|
|
404
|
+
this.ctx = t, A(this, h.tracker, {
|
|
405
405
|
associate: "reflect",
|
|
406
406
|
property: "ctx"
|
|
407
407
|
}), this._mixin("reflect", ["get", "set", "provide", "accessor", "mixin", "alias"]), this._mixin("scope", ["config", "runtime", "effect", "collect", "accept", "decline"]), this._mixin("registry", ["using", "inject", "plugin"]), this._mixin("lifecycle", ["on", "once", "parallel", "emit", "serial", "bail", "start", "stop"]);
|
|
@@ -409,117 +409,117 @@ var Mt = class U {
|
|
|
409
409
|
static {
|
|
410
410
|
g(this, "ReflectService");
|
|
411
411
|
}
|
|
412
|
-
static resolveInject(
|
|
413
|
-
let n =
|
|
412
|
+
static resolveInject(t, r) {
|
|
413
|
+
let n = t[h.internal][r];
|
|
414
414
|
for (; n?.type === "alias"; )
|
|
415
|
-
r = n.name, n =
|
|
415
|
+
r = n.name, n = t[h.internal][r];
|
|
416
416
|
return [r, n];
|
|
417
417
|
}
|
|
418
|
-
static checkInject(
|
|
419
|
-
if (
|
|
418
|
+
static checkInject(t, r, n) {
|
|
419
|
+
if (t = t[h.shadow] ?? t, ["prototype", "then", "registry", "lifecycle"].includes(r) || r[0] === "$" || r[0] === "_" || !t.runtime.plugin || t.bail(t, "internal/inject", r)) return;
|
|
420
420
|
const c = n.stack.split(`
|
|
421
421
|
`);
|
|
422
422
|
c.splice(1, 1), n.stack = c.join(`
|
|
423
|
-
`),
|
|
423
|
+
`), t.emit(t, "internal/warning", n);
|
|
424
424
|
}
|
|
425
425
|
static handler = {
|
|
426
|
-
get: /* @__PURE__ */ g((
|
|
427
|
-
if (typeof r != "string") return Reflect.get(
|
|
428
|
-
if (Reflect.has(
|
|
429
|
-
return
|
|
430
|
-
const [c, i] =
|
|
431
|
-
return i ? i.type === "accessor" ? i.get.call(n, n[h.receiver]) : (i.builtin ||
|
|
426
|
+
get: /* @__PURE__ */ g((t, r, n) => {
|
|
427
|
+
if (typeof r != "string") return Reflect.get(t, r, n);
|
|
428
|
+
if (Reflect.has(t, r))
|
|
429
|
+
return D(n, Reflect.get(t, r, n), !0);
|
|
430
|
+
const [c, i] = z.resolveInject(t, r), a = new Error(`property ${c} is not registered, declare it as \`inject\` to suppress this warning`);
|
|
431
|
+
return i ? i.type === "accessor" ? i.get.call(n, n[h.receiver]) : (i.builtin || z.checkInject(n, c, a), n.reflect.get(c)) : (z.checkInject(n, c, a), Reflect.get(t, c, n));
|
|
432
432
|
}, "get"),
|
|
433
|
-
set: /* @__PURE__ */ g((
|
|
434
|
-
if (typeof r != "string") return Reflect.set(
|
|
435
|
-
const [i, a] =
|
|
436
|
-
return a ? a.type === "accessor" ? a.set ? a.set.call(c, n, c[h.receiver]) : !1 : (c.reflect.set(i, n), !0) : Reflect.set(
|
|
433
|
+
set: /* @__PURE__ */ g((t, r, n, c) => {
|
|
434
|
+
if (typeof r != "string") return Reflect.set(t, r, n, c);
|
|
435
|
+
const [i, a] = z.resolveInject(t, r);
|
|
436
|
+
return a ? a.type === "accessor" ? a.set ? a.set.call(c, n, c[h.receiver]) : !1 : (c.reflect.set(i, n), !0) : Reflect.set(t, i, n, c);
|
|
437
437
|
}, "set"),
|
|
438
|
-
has: /* @__PURE__ */ g((
|
|
439
|
-
if (typeof r != "string") return Reflect.has(
|
|
440
|
-
if (Reflect.has(
|
|
441
|
-
const [, n] =
|
|
438
|
+
has: /* @__PURE__ */ g((t, r) => {
|
|
439
|
+
if (typeof r != "string") return Reflect.has(t, r);
|
|
440
|
+
if (Reflect.has(t, r)) return !0;
|
|
441
|
+
const [, n] = z.resolveInject(t, r);
|
|
442
442
|
return !!n;
|
|
443
443
|
}, "has")
|
|
444
444
|
};
|
|
445
|
-
get(
|
|
446
|
-
if (this.ctx[h.internal][
|
|
447
|
-
const n = this.ctx[h.isolate][
|
|
448
|
-
return
|
|
445
|
+
get(t) {
|
|
446
|
+
if (this.ctx[h.internal][t]?.type !== "service") return;
|
|
447
|
+
const n = this.ctx[h.isolate][t], c = this.ctx[h.store][n]?.value;
|
|
448
|
+
return D(this.ctx, c);
|
|
449
449
|
}
|
|
450
|
-
set(
|
|
451
|
-
this.provide(
|
|
452
|
-
const n = this.ctx[h.isolate][
|
|
450
|
+
set(t, r) {
|
|
451
|
+
this.provide(t);
|
|
452
|
+
const n = this.ctx[h.isolate][t], c = this.ctx[h.store][n]?.value;
|
|
453
453
|
r ??= void 0;
|
|
454
454
|
let i = /* @__PURE__ */ g(() => {
|
|
455
455
|
}, "dispose");
|
|
456
456
|
if (c === r) return i;
|
|
457
457
|
if (!$(r) && !$(c))
|
|
458
|
-
throw new Error(`service ${
|
|
458
|
+
throw new Error(`service ${t} has been registered`);
|
|
459
459
|
const a = this.ctx;
|
|
460
460
|
$(r) || (i = a.effect(() => () => {
|
|
461
|
-
a.set(
|
|
462
|
-
})),
|
|
461
|
+
a.set(t, void 0);
|
|
462
|
+
})), he(r) && a.emit(a, "internal/warning", new Error(`service ${t} is an unproxyable object, which may lead to unexpected behavior`));
|
|
463
463
|
const y = Object.create(a);
|
|
464
|
-
return y[h.filter] = (d) => a[h.isolate][
|
|
464
|
+
return y[h.filter] = (d) => a[h.isolate][t] === d[h.isolate][t], a.emit(y, "internal/before-service", t, r), a[h.store][n] = { value: r, source: a }, a.emit(y, "internal/service", t, c), i;
|
|
465
465
|
}
|
|
466
|
-
provide(
|
|
466
|
+
provide(t, r, n) {
|
|
467
467
|
const c = this.ctx.root[h.internal];
|
|
468
|
-
if (
|
|
469
|
-
const i = Symbol(
|
|
470
|
-
c[
|
|
471
|
-
associate:
|
|
468
|
+
if (t in c) return;
|
|
469
|
+
const i = Symbol(t);
|
|
470
|
+
c[t] = { type: "service", builtin: n }, this.ctx.root[h.isolate][t] = i, re(r) && (this.ctx[h.store][i] = { value: r, source: null }, A(r, h.tracker, {
|
|
471
|
+
associate: t,
|
|
472
472
|
property: "ctx"
|
|
473
473
|
}));
|
|
474
474
|
}
|
|
475
|
-
_accessor(
|
|
475
|
+
_accessor(t, r) {
|
|
476
476
|
const n = this.ctx.root[h.internal];
|
|
477
|
-
return
|
|
478
|
-
} : (n[
|
|
477
|
+
return t in n ? () => {
|
|
478
|
+
} : (n[t] = { type: "accessor", ...r }, () => delete this.ctx.root[h.isolate][t]);
|
|
479
479
|
}
|
|
480
|
-
accessor(
|
|
481
|
-
this.ctx.scope.effect(() => this._accessor(
|
|
480
|
+
accessor(t, r) {
|
|
481
|
+
this.ctx.scope.effect(() => this._accessor(t, r));
|
|
482
482
|
}
|
|
483
|
-
alias(
|
|
483
|
+
alias(t, r) {
|
|
484
484
|
const n = this.ctx.root[h.internal];
|
|
485
|
-
if (!(
|
|
485
|
+
if (!(t in n))
|
|
486
486
|
for (const c of r)
|
|
487
|
-
n[c] ||= { type: "alias", name:
|
|
487
|
+
n[c] ||= { type: "alias", name: t };
|
|
488
488
|
}
|
|
489
|
-
_mixin(
|
|
490
|
-
const n = Array.isArray(r) ? r.map((a) => [a, a]) : Object.entries(r), c = typeof
|
|
489
|
+
_mixin(t, r) {
|
|
490
|
+
const n = Array.isArray(r) ? r.map((a) => [a, a]) : Object.entries(r), c = typeof t == "string" ? (a) => a[t] : () => t, i = n.map(([a, y]) => this._accessor(y, {
|
|
491
491
|
get(d) {
|
|
492
492
|
const b = c(this);
|
|
493
493
|
if ($(b)) return b;
|
|
494
|
-
const j = d ?
|
|
495
|
-
return typeof
|
|
494
|
+
const j = d ? L(d, b) : b, O = Reflect.get(b, a, j);
|
|
495
|
+
return typeof O != "function" ? O : O.bind(j ?? b);
|
|
496
496
|
},
|
|
497
497
|
set(d, b) {
|
|
498
|
-
const j = c(this),
|
|
499
|
-
return Reflect.set(j, a, d,
|
|
498
|
+
const j = c(this), O = b ? L(b, j) : j;
|
|
499
|
+
return Reflect.set(j, a, d, O);
|
|
500
500
|
}
|
|
501
501
|
}));
|
|
502
502
|
return () => i.forEach((a) => a());
|
|
503
503
|
}
|
|
504
|
-
mixin(
|
|
505
|
-
this.ctx.scope.effect(() => this._mixin(
|
|
504
|
+
mixin(t, r) {
|
|
505
|
+
this.ctx.scope.effect(() => this._mixin(t, r));
|
|
506
506
|
}
|
|
507
|
-
trace(
|
|
508
|
-
return
|
|
507
|
+
trace(t) {
|
|
508
|
+
return D(this.ctx, t);
|
|
509
509
|
}
|
|
510
|
-
bind(
|
|
511
|
-
return new Proxy(
|
|
510
|
+
bind(t) {
|
|
511
|
+
return new Proxy(t, {
|
|
512
512
|
apply: /* @__PURE__ */ g((r, n, c) => r.apply(this.trace(n), c.map((i) => this.trace(i))), "apply")
|
|
513
513
|
});
|
|
514
514
|
}
|
|
515
|
-
}, Q =
|
|
516
|
-
function
|
|
517
|
-
return
|
|
515
|
+
}, Q = Le;
|
|
516
|
+
function Z(e) {
|
|
517
|
+
return e !== null && e !== !1 && e !== void 0;
|
|
518
518
|
}
|
|
519
|
-
g(
|
|
520
|
-
var
|
|
521
|
-
constructor(
|
|
522
|
-
this.ctx =
|
|
519
|
+
g(Z, "isBailed");
|
|
520
|
+
var Me = class {
|
|
521
|
+
constructor(e) {
|
|
522
|
+
this.ctx = e, A(this, h.tracker, {
|
|
523
523
|
associate: "lifecycle",
|
|
524
524
|
property: "ctx"
|
|
525
525
|
}), A(this.on("internal/listener", function(r, n, c) {
|
|
@@ -527,14 +527,14 @@ var Ft = class {
|
|
|
527
527
|
if (r === "ready")
|
|
528
528
|
return this.lifecycle.isActive ? (this.scope.ensure(async () => n()), () => !1) : void 0;
|
|
529
529
|
if (r === "dispose")
|
|
530
|
-
return this.scope.disposables[i](n), A(n, "name", "event <dispose>"), () =>
|
|
530
|
+
return this.scope.disposables[i](n), A(n, "name", "event <dispose>"), () => N(this.scope.disposables, n);
|
|
531
531
|
if (r === "fork")
|
|
532
|
-
return this.scope.runtime.forkables[i](n), this.scope.collect("event <fork>", () =>
|
|
533
|
-
}), P.static,
|
|
532
|
+
return this.scope.runtime.forkables[i](n), this.scope.collect("event <fork>", () => N(this.scope.runtime.forkables, n));
|
|
533
|
+
}), P.static, e.scope);
|
|
534
534
|
for (const r of ["info", "error", "warning"])
|
|
535
535
|
A(this.on(`internal/${r}`, (n, ...c) => {
|
|
536
536
|
this._hooks[`internal/${r}`].length > 1;
|
|
537
|
-
}), P.static,
|
|
537
|
+
}), P.static, e.scope);
|
|
538
538
|
A(this.on("internal/before-service", function(r) {
|
|
539
539
|
for (const n of this.registry.values()) {
|
|
540
540
|
if (!n.inject[r]?.required) continue;
|
|
@@ -542,23 +542,23 @@ var Ft = class {
|
|
|
542
542
|
for (const i of c)
|
|
543
543
|
this[h.filter](i.ctx) && (i.updateStatus(), i.reset());
|
|
544
544
|
}
|
|
545
|
-
}, { global: !0 }), P.static,
|
|
545
|
+
}, { global: !0 }), P.static, e.scope), A(this.on("internal/service", function(r) {
|
|
546
546
|
for (const n of this.registry.values()) {
|
|
547
547
|
if (!n.inject[r]?.required) continue;
|
|
548
548
|
const c = n.isReusable ? n.children : [n];
|
|
549
549
|
for (const i of c)
|
|
550
550
|
this[h.filter](i.ctx) && i.start();
|
|
551
551
|
}
|
|
552
|
-
}, { global: !0 }), P.static,
|
|
553
|
-
const
|
|
552
|
+
}, { global: !0 }), P.static, e.scope);
|
|
553
|
+
const t = /* @__PURE__ */ g((r, n) => {
|
|
554
554
|
if (!r.runtime.plugin) return !1;
|
|
555
555
|
for (const c in r.runtime.inject)
|
|
556
556
|
if (n === Q.resolveInject(r.ctx, c)[0]) return !0;
|
|
557
|
-
return
|
|
557
|
+
return t(r.parent.scope, n);
|
|
558
558
|
}, "checkInject");
|
|
559
559
|
A(this.on("internal/inject", function(r) {
|
|
560
|
-
return
|
|
561
|
-
}, { global: !0 }), P.static,
|
|
560
|
+
return t(this.scope, r);
|
|
561
|
+
}, { global: !0 }), P.static, e.scope);
|
|
562
562
|
}
|
|
563
563
|
static {
|
|
564
564
|
g(this, "Lifecycle");
|
|
@@ -570,82 +570,82 @@ var Ft = class {
|
|
|
570
570
|
for (; this._tasks.size; )
|
|
571
571
|
await Promise.all(Array.from(this._tasks));
|
|
572
572
|
}
|
|
573
|
-
filterHooks(
|
|
574
|
-
return
|
|
575
|
-
const n =
|
|
576
|
-
return r.global || !n || n.call(
|
|
573
|
+
filterHooks(e, t) {
|
|
574
|
+
return t = D(this.ctx, t), e.slice().filter((r) => {
|
|
575
|
+
const n = t?.[P.filter];
|
|
576
|
+
return r.global || !n || n.call(t, r.ctx);
|
|
577
577
|
});
|
|
578
578
|
}
|
|
579
|
-
*dispatch(
|
|
580
|
-
const r = typeof
|
|
581
|
-
n !== "internal/event" && this.emit("internal/event",
|
|
579
|
+
*dispatch(e, t) {
|
|
580
|
+
const r = typeof t[0] == "object" || typeof t[0] == "function" ? t.shift() : null, n = t.shift();
|
|
581
|
+
n !== "internal/event" && this.emit("internal/event", e, n, t, r);
|
|
582
582
|
for (const c of this.filterHooks(this._hooks[n] || [], r))
|
|
583
|
-
yield c.callback.apply(r,
|
|
583
|
+
yield c.callback.apply(r, t);
|
|
584
584
|
}
|
|
585
|
-
async parallel(...
|
|
586
|
-
await Promise.all(this.dispatch("emit",
|
|
585
|
+
async parallel(...e) {
|
|
586
|
+
await Promise.all(this.dispatch("emit", e));
|
|
587
587
|
}
|
|
588
|
-
emit(...
|
|
589
|
-
Array.from(this.dispatch("emit",
|
|
588
|
+
emit(...e) {
|
|
589
|
+
Array.from(this.dispatch("emit", e));
|
|
590
590
|
}
|
|
591
|
-
async serial(...
|
|
592
|
-
for await (const
|
|
593
|
-
if (
|
|
591
|
+
async serial(...e) {
|
|
592
|
+
for await (const t of this.dispatch("serial", e))
|
|
593
|
+
if (Z(t)) return t;
|
|
594
594
|
}
|
|
595
|
-
bail(...
|
|
596
|
-
for (const
|
|
597
|
-
if (
|
|
595
|
+
bail(...e) {
|
|
596
|
+
for (const t of this.dispatch("bail", e))
|
|
597
|
+
if (Z(t)) return t;
|
|
598
598
|
}
|
|
599
|
-
register(
|
|
599
|
+
register(e, t, r, n) {
|
|
600
600
|
const c = n.prepend ? "unshift" : "push";
|
|
601
|
-
return
|
|
601
|
+
return t[c]({ ctx: this.ctx, callback: r, ...n }), this.ctx.state.collect(e, () => this.unregister(t, r));
|
|
602
602
|
}
|
|
603
|
-
unregister(
|
|
604
|
-
const r =
|
|
603
|
+
unregister(e, t) {
|
|
604
|
+
const r = e.findIndex((n) => n.callback === t);
|
|
605
605
|
if (r >= 0)
|
|
606
|
-
return
|
|
606
|
+
return e.splice(r, 1), !0;
|
|
607
607
|
}
|
|
608
|
-
on(
|
|
609
|
-
typeof r != "object" && (r = { prepend: r }), this.ctx.scope.assertActive(),
|
|
610
|
-
const n = this.bail(this.ctx, "internal/listener",
|
|
608
|
+
on(e, t, r) {
|
|
609
|
+
typeof r != "object" && (r = { prepend: r }), this.ctx.scope.assertActive(), t = this.ctx.reflect.bind(t);
|
|
610
|
+
const n = this.bail(this.ctx, "internal/listener", e, t, r);
|
|
611
611
|
if (n) return n;
|
|
612
|
-
const c = this._hooks[
|
|
613
|
-
return this.register(i, c,
|
|
612
|
+
const c = this._hooks[e] ||= [], i = typeof e == "string" ? `event <${e}>` : "event (Symbol)";
|
|
613
|
+
return this.register(i, c, t, r);
|
|
614
614
|
}
|
|
615
|
-
once(
|
|
616
|
-
const n = this.on(
|
|
617
|
-
return n(),
|
|
615
|
+
once(e, t, r) {
|
|
616
|
+
const n = this.on(e, function(...c) {
|
|
617
|
+
return n(), t.apply(this, c);
|
|
618
618
|
}, r);
|
|
619
619
|
return n;
|
|
620
620
|
}
|
|
621
621
|
async start() {
|
|
622
622
|
this.isActive = !0;
|
|
623
|
-
const
|
|
624
|
-
for (;
|
|
625
|
-
const { ctx:
|
|
626
|
-
|
|
623
|
+
const e = this._hooks.ready || [];
|
|
624
|
+
for (; e.length; ) {
|
|
625
|
+
const { ctx: t, callback: r } = e.shift();
|
|
626
|
+
t.scope.ensure(async () => r());
|
|
627
627
|
}
|
|
628
628
|
await this.flush();
|
|
629
629
|
}
|
|
630
630
|
async stop() {
|
|
631
631
|
this.isActive = !1, this.ctx.scope.reset();
|
|
632
632
|
}
|
|
633
|
-
},
|
|
634
|
-
constructor(
|
|
635
|
-
super(r ??
|
|
633
|
+
}, qe = Me, Je = /* @__PURE__ */ ((e) => (e[e.PENDING = 0] = "PENDING", e[e.LOADING = 1] = "LOADING", e[e.ACTIVE = 2] = "ACTIVE", e[e.FAILED = 3] = "FAILED", e[e.DISPOSED = 4] = "DISPOSED", e))(Je || {}), T = class ye extends Error {
|
|
634
|
+
constructor(t, r) {
|
|
635
|
+
super(r ?? ye.Code[t]), this.code = t;
|
|
636
636
|
}
|
|
637
637
|
static {
|
|
638
638
|
g(this, "CordisError");
|
|
639
639
|
}
|
|
640
640
|
};
|
|
641
|
-
((
|
|
642
|
-
|
|
641
|
+
((e) => {
|
|
642
|
+
e.Code = {
|
|
643
643
|
INACTIVE_EFFECT: "cannot create effect on inactive context"
|
|
644
644
|
};
|
|
645
|
-
})(
|
|
646
|
-
var
|
|
647
|
-
constructor(
|
|
648
|
-
this.parent =
|
|
645
|
+
})(T || (T = {}));
|
|
646
|
+
var de = class {
|
|
647
|
+
constructor(e, t) {
|
|
648
|
+
this.parent = e, this.config = t, this.uid = e.registry ? e.registry.counter : 0, this.ctx = this.context = e.extend({ scope: this }), this.proxy = new Proxy({}, {
|
|
649
649
|
get: /* @__PURE__ */ g((r, n) => Reflect.get(this.config, n), "get")
|
|
650
650
|
});
|
|
651
651
|
}
|
|
@@ -669,20 +669,20 @@ var dt = class {
|
|
|
669
669
|
}
|
|
670
670
|
assertActive() {
|
|
671
671
|
if (!(this.uid !== null || this.isActive))
|
|
672
|
-
throw new
|
|
672
|
+
throw new T("INACTIVE_EFFECT");
|
|
673
673
|
}
|
|
674
|
-
effect(
|
|
674
|
+
effect(e, t) {
|
|
675
675
|
this.assertActive();
|
|
676
|
-
const r =
|
|
676
|
+
const r = ee(e) ? new e(this.ctx, t) : e(this.ctx, t);
|
|
677
677
|
let n = !1;
|
|
678
678
|
const c = typeof r == "function" ? r : r.dispose.bind(r), i = /* @__PURE__ */ g((...a) => {
|
|
679
679
|
if (!n)
|
|
680
|
-
return n = !0,
|
|
680
|
+
return n = !0, N(this.disposables, i), c(...a);
|
|
681
681
|
}, "wrapped");
|
|
682
682
|
return this.disposables.push(i), typeof r == "function" ? i : (r.dispose = i, r);
|
|
683
683
|
}
|
|
684
|
-
collect(
|
|
685
|
-
const r = A(() => (
|
|
684
|
+
collect(e, t) {
|
|
685
|
+
const r = A(() => (N(this.disposables, r), t()), "name", e);
|
|
686
686
|
return this.disposables.push(r), r;
|
|
687
687
|
}
|
|
688
688
|
restart() {
|
|
@@ -691,51 +691,51 @@ var dt = class {
|
|
|
691
691
|
_getStatus() {
|
|
692
692
|
return this.uid === null ? 4 : this.hasError ? 3 : this.tasks.size ? 1 : this.ready ? 2 : 0;
|
|
693
693
|
}
|
|
694
|
-
updateStatus(
|
|
695
|
-
const
|
|
696
|
-
|
|
694
|
+
updateStatus(e) {
|
|
695
|
+
const t = this.status;
|
|
696
|
+
e?.(), this.status = this._getStatus(), t !== this.status && this.context.emit("internal/status", this, t);
|
|
697
697
|
}
|
|
698
|
-
ensure(
|
|
699
|
-
const
|
|
698
|
+
ensure(e) {
|
|
699
|
+
const t = e().catch((r) => {
|
|
700
700
|
this.context.emit(this.ctx, "internal/error", r), this.cancel(r);
|
|
701
701
|
}).finally(() => {
|
|
702
|
-
this.updateStatus(() => this.tasks.delete(
|
|
702
|
+
this.updateStatus(() => this.tasks.delete(t)), this.context.events._tasks.delete(t);
|
|
703
703
|
});
|
|
704
|
-
this.updateStatus(() => this.tasks.add(
|
|
704
|
+
this.updateStatus(() => this.tasks.add(t)), this.context.events._tasks.add(t);
|
|
705
705
|
}
|
|
706
|
-
cancel(
|
|
707
|
-
this.error =
|
|
706
|
+
cancel(e) {
|
|
707
|
+
this.error = e, this.updateStatus(() => this.hasError = !0), this.reset();
|
|
708
708
|
}
|
|
709
709
|
get ready() {
|
|
710
|
-
return Object.entries(this.runtime.inject).every(([
|
|
710
|
+
return Object.entries(this.runtime.inject).every(([e, t]) => !t.required || !$(this.ctx.get(e)));
|
|
711
711
|
}
|
|
712
712
|
reset() {
|
|
713
|
-
this.isActive = !1, this.disposables = this.disposables.splice(0).filter((
|
|
714
|
-
if (this.uid !== null &&
|
|
715
|
-
(async () =>
|
|
716
|
-
this.context.emit(this.ctx, "internal/error",
|
|
713
|
+
this.isActive = !1, this.disposables = this.disposables.splice(0).filter((e) => {
|
|
714
|
+
if (this.uid !== null && e[P.static] === this) return !0;
|
|
715
|
+
(async () => e())().catch((t) => {
|
|
716
|
+
this.context.emit(this.ctx, "internal/error", t);
|
|
717
717
|
});
|
|
718
718
|
});
|
|
719
719
|
}
|
|
720
|
-
init(
|
|
721
|
-
this.config ? this.start() : this.cancel(
|
|
720
|
+
init(e) {
|
|
721
|
+
this.config ? this.start() : this.cancel(e);
|
|
722
722
|
}
|
|
723
723
|
start() {
|
|
724
724
|
if (!this.ready || this.isActive || this.uid === null) return !0;
|
|
725
725
|
this.isActive = !0, this.updateStatus(() => this.hasError = !1);
|
|
726
726
|
}
|
|
727
|
-
accept(...
|
|
728
|
-
const r = { keys: Array.isArray(
|
|
729
|
-
return this.effect(() => (this.acceptors.push(r), r.immediate && r.callback?.(this.config), () =>
|
|
727
|
+
accept(...e) {
|
|
728
|
+
const r = { keys: Array.isArray(e[0]) ? e.shift() : null, callback: e[0], ...e[1] };
|
|
729
|
+
return this.effect(() => (this.acceptors.push(r), r.immediate && r.callback?.(this.config), () => N(this.acceptors, r)));
|
|
730
730
|
}
|
|
731
|
-
decline(
|
|
732
|
-
return this.accept(
|
|
731
|
+
decline(e) {
|
|
732
|
+
return this.accept(e, () => !0);
|
|
733
733
|
}
|
|
734
|
-
checkUpdate(
|
|
735
|
-
if (
|
|
736
|
-
if (
|
|
734
|
+
checkUpdate(e, t) {
|
|
735
|
+
if (t || !this.config) return [!0, !0];
|
|
736
|
+
if (t === !1) return [!1, !1];
|
|
737
737
|
const r = /* @__PURE__ */ Object.create(null), n = /* @__PURE__ */ g((d) => {
|
|
738
|
-
const b = r[d] ??= !
|
|
738
|
+
const b = r[d] ??= !B(this.config[d], e[d]);
|
|
739
739
|
return i ||= b, b;
|
|
740
740
|
}, "checkPropertyUpdate"), c = /* @__PURE__ */ new Set();
|
|
741
741
|
let i = !1, a = !1, y = this.runtime.isReactive || null;
|
|
@@ -750,22 +750,22 @@ var dt = class {
|
|
|
750
750
|
R ||= n(x);
|
|
751
751
|
if (!R) continue;
|
|
752
752
|
}
|
|
753
|
-
b?.(
|
|
753
|
+
b?.(e) && (a = !0);
|
|
754
754
|
}
|
|
755
|
-
for (const d in { ...this.config, ...
|
|
755
|
+
for (const d in { ...this.config, ...e })
|
|
756
756
|
if (y !== !1 && !(d in r) && !c.has(d)) {
|
|
757
757
|
const b = n(d);
|
|
758
758
|
y === null && (a ||= b);
|
|
759
759
|
}
|
|
760
760
|
return [i, a];
|
|
761
761
|
}
|
|
762
|
-
},
|
|
763
|
-
constructor(
|
|
764
|
-
super(
|
|
762
|
+
}, Ve = class extends de {
|
|
763
|
+
constructor(e, t, r, n) {
|
|
764
|
+
super(e, r), this.runtime = t, this.dispose = A(e.scope.collect(`fork <${e.runtime.name}>`, () => {
|
|
765
765
|
this.uid = null, this.reset(), this.context.emit("internal/fork", this);
|
|
766
|
-
const c =
|
|
767
|
-
return
|
|
768
|
-
}), P.static,
|
|
766
|
+
const c = N(t.disposables, this.dispose);
|
|
767
|
+
return N(t.children, this) && !t.children.length && e.registry.delete(t.plugin), c;
|
|
768
|
+
}), P.static, t), t.children.push(this), t.disposables.push(this.dispose), this.context.emit("internal/fork", this), this.init(n);
|
|
769
769
|
}
|
|
770
770
|
static {
|
|
771
771
|
g(this, "ForkScope");
|
|
@@ -773,24 +773,24 @@ var dt = class {
|
|
|
773
773
|
dispose;
|
|
774
774
|
start() {
|
|
775
775
|
if (super.start()) return !0;
|
|
776
|
-
for (const
|
|
777
|
-
this.ensure(async () =>
|
|
776
|
+
for (const e of this.runtime.forkables)
|
|
777
|
+
this.ensure(async () => e(this.context, this._config));
|
|
778
778
|
}
|
|
779
|
-
update(
|
|
779
|
+
update(e, t) {
|
|
780
780
|
const r = this.config, n = this.runtime.isForkable ? this : this.runtime;
|
|
781
781
|
if (n.config !== r) return;
|
|
782
782
|
let c;
|
|
783
783
|
try {
|
|
784
|
-
c =
|
|
784
|
+
c = q(this.runtime.plugin, e);
|
|
785
785
|
} catch (y) {
|
|
786
786
|
return this.context.emit("internal/error", y), this.cancel(y);
|
|
787
787
|
}
|
|
788
|
-
const [i, a] = n.checkUpdate(c,
|
|
789
|
-
this.context.emit("internal/before-update", this,
|
|
788
|
+
const [i, a] = n.checkUpdate(c, t);
|
|
789
|
+
this.context.emit("internal/before-update", this, e), this.config = c, n.config = c, i && this.context.emit("internal/update", this, r), a && n.restart();
|
|
790
790
|
}
|
|
791
|
-
},
|
|
792
|
-
constructor(
|
|
793
|
-
super(
|
|
791
|
+
}, ce = class extends de {
|
|
792
|
+
constructor(e, t, r, n) {
|
|
793
|
+
super(e, r), this.plugin = t, t ? (this.setup(), this.init(n)) : (this.name = "root", this.isActive = !0);
|
|
794
794
|
}
|
|
795
795
|
static {
|
|
796
796
|
g(this, "MainScope");
|
|
@@ -807,37 +807,37 @@ var dt = class {
|
|
|
807
807
|
get isForkable() {
|
|
808
808
|
return this.forkables.length > 0;
|
|
809
809
|
}
|
|
810
|
-
fork(
|
|
811
|
-
return new
|
|
810
|
+
fork(e, t, r) {
|
|
811
|
+
return new Ve(e, this, t, r);
|
|
812
812
|
}
|
|
813
813
|
dispose() {
|
|
814
814
|
return this.uid = null, this.reset(), this.context.emit("internal/runtime", this), !0;
|
|
815
815
|
}
|
|
816
816
|
setup() {
|
|
817
|
-
const { name:
|
|
818
|
-
|
|
817
|
+
const { name: e } = this.plugin;
|
|
818
|
+
e && e !== "apply" && (this.name = e), this.schema = this.plugin.Config || this.plugin.schema, this.inject = K.resolve(this.plugin.using || this.plugin.inject), this.isReusable = this.plugin.reusable, this.isReactive = this.plugin.reactive, this.context.emit("internal/runtime", this), this.isReusable && this.forkables.push(this.apply);
|
|
819
819
|
}
|
|
820
|
-
apply = /* @__PURE__ */ g((
|
|
820
|
+
apply = /* @__PURE__ */ g((e, t) => {
|
|
821
821
|
if (typeof this.plugin != "function")
|
|
822
|
-
return this.plugin.apply(
|
|
823
|
-
if (
|
|
824
|
-
const r = new this.plugin(
|
|
825
|
-
return n &&
|
|
822
|
+
return this.plugin.apply(e, t);
|
|
823
|
+
if (ee(this.plugin)) {
|
|
824
|
+
const r = new this.plugin(e, t), n = r[P.expose];
|
|
825
|
+
return n && e.set(n, r), r.fork && this.forkables.push(r.fork.bind(r)), r;
|
|
826
826
|
} else
|
|
827
|
-
return this.plugin(
|
|
827
|
+
return this.plugin(e, t);
|
|
828
828
|
}, "apply");
|
|
829
829
|
reset() {
|
|
830
830
|
super.reset();
|
|
831
|
-
for (const
|
|
832
|
-
|
|
831
|
+
for (const e of this.children)
|
|
832
|
+
e.reset();
|
|
833
833
|
}
|
|
834
834
|
start() {
|
|
835
835
|
if (super.start()) return !0;
|
|
836
836
|
!this.isReusable && this.plugin && this.ensure(async () => this.value = this.apply(this.ctx, this._config));
|
|
837
|
-
for (const
|
|
838
|
-
|
|
837
|
+
for (const e of this.children)
|
|
838
|
+
e.start();
|
|
839
839
|
}
|
|
840
|
-
update(
|
|
840
|
+
update(e, t) {
|
|
841
841
|
if (this.isForkable) {
|
|
842
842
|
const y = new Error(`attempting to update forkable plugin "${this.plugin.name}", which may lead to unexpected behavior`);
|
|
843
843
|
this.context.emit(this.ctx, "internal/warning", y);
|
|
@@ -845,28 +845,28 @@ var dt = class {
|
|
|
845
845
|
const r = this.config;
|
|
846
846
|
let n;
|
|
847
847
|
try {
|
|
848
|
-
n =
|
|
848
|
+
n = q(this.runtime.plugin || this.context.constructor, e);
|
|
849
849
|
} catch (y) {
|
|
850
850
|
return this.context.emit("internal/error", y), this.cancel(y);
|
|
851
851
|
}
|
|
852
|
-
const [c, i] = this.checkUpdate(n,
|
|
853
|
-
this.config = n, a && (this.context.emit("internal/before-update", a,
|
|
852
|
+
const [c, i] = this.checkUpdate(n, t), a = this.children.find((y) => y.config === r);
|
|
853
|
+
this.config = n, a && (this.context.emit("internal/before-update", a, e), a.config = n, c && this.context.emit("internal/update", a, r)), i && this.restart();
|
|
854
854
|
}
|
|
855
855
|
};
|
|
856
|
-
function
|
|
857
|
-
return
|
|
856
|
+
function me(e) {
|
|
857
|
+
return e && typeof e == "object" && typeof e.apply == "function";
|
|
858
858
|
}
|
|
859
|
-
g(
|
|
860
|
-
function K(
|
|
861
|
-
return function(
|
|
859
|
+
g(me, "isApplicable");
|
|
860
|
+
function K(e) {
|
|
861
|
+
return function(t, r) {
|
|
862
862
|
if (r.kind === "class")
|
|
863
|
-
|
|
863
|
+
t.inject = e;
|
|
864
864
|
else if (r.kind === "method")
|
|
865
865
|
r.addInitializer(function() {
|
|
866
866
|
const n = this[h.tracker]?.property;
|
|
867
867
|
if (!n) throw new Error("missing context tracker");
|
|
868
|
-
this[n].inject(
|
|
869
|
-
|
|
868
|
+
this[n].inject(e, (c) => {
|
|
869
|
+
t.call(L(this, { [n]: c }));
|
|
870
870
|
});
|
|
871
871
|
});
|
|
872
872
|
else
|
|
@@ -874,24 +874,24 @@ function K(t) {
|
|
|
874
874
|
};
|
|
875
875
|
}
|
|
876
876
|
g(K, "Inject");
|
|
877
|
-
((
|
|
878
|
-
function
|
|
877
|
+
((e) => {
|
|
878
|
+
function t(r) {
|
|
879
879
|
if (!r) return {};
|
|
880
880
|
if (Array.isArray(r))
|
|
881
881
|
return Object.fromEntries(r.map((a) => [a, { required: !0 }]));
|
|
882
882
|
const { required: n, optional: c, ...i } = r;
|
|
883
883
|
return Array.isArray(n) && Object.assign(i, Object.fromEntries(n.map((a) => [a, { required: !0 }]))), Array.isArray(c) && Object.assign(i, Object.fromEntries(c.map((a) => [a, { required: !1 }]))), i;
|
|
884
884
|
}
|
|
885
|
-
|
|
885
|
+
e.resolve = t, g(t, "resolve");
|
|
886
886
|
})(K || (K = {}));
|
|
887
|
-
var
|
|
888
|
-
constructor(
|
|
889
|
-
this.ctx =
|
|
887
|
+
var He = class {
|
|
888
|
+
constructor(e, t) {
|
|
889
|
+
this.ctx = e, A(this, h.tracker, {
|
|
890
890
|
associate: "registry",
|
|
891
891
|
property: "ctx"
|
|
892
|
-
}), this.context =
|
|
893
|
-
const r = new
|
|
894
|
-
|
|
892
|
+
}), this.context = e;
|
|
893
|
+
const r = new ce(e, null, t);
|
|
894
|
+
e.scope = r, r.ctx = e, this.set(null, r);
|
|
895
895
|
}
|
|
896
896
|
static {
|
|
897
897
|
g(this, "Registry");
|
|
@@ -905,27 +905,27 @@ var Jt = class {
|
|
|
905
905
|
get size() {
|
|
906
906
|
return this._internal.size;
|
|
907
907
|
}
|
|
908
|
-
resolve(
|
|
909
|
-
if (
|
|
910
|
-
if (
|
|
911
|
-
if (
|
|
908
|
+
resolve(e, t = !1) {
|
|
909
|
+
if (e === null || typeof e == "function") return e;
|
|
910
|
+
if (me(e)) return e.apply;
|
|
911
|
+
if (t) throw new Error('invalid plugin, expect function or object with an "apply" method, received ' + typeof e);
|
|
912
912
|
}
|
|
913
|
-
get(
|
|
914
|
-
const
|
|
915
|
-
return
|
|
913
|
+
get(e) {
|
|
914
|
+
const t = this.resolve(e);
|
|
915
|
+
return t && this._internal.get(t);
|
|
916
916
|
}
|
|
917
|
-
has(
|
|
918
|
-
const
|
|
919
|
-
return !!
|
|
917
|
+
has(e) {
|
|
918
|
+
const t = this.resolve(e);
|
|
919
|
+
return !!t && this._internal.has(t);
|
|
920
920
|
}
|
|
921
|
-
set(
|
|
922
|
-
const r = this.resolve(
|
|
923
|
-
this._internal.set(r,
|
|
921
|
+
set(e, t) {
|
|
922
|
+
const r = this.resolve(e);
|
|
923
|
+
this._internal.set(r, t);
|
|
924
924
|
}
|
|
925
|
-
delete(
|
|
926
|
-
const
|
|
925
|
+
delete(e) {
|
|
926
|
+
const t = this.resolve(e), r = t && this._internal.get(t);
|
|
927
927
|
if (r)
|
|
928
|
-
return this._internal.delete(
|
|
928
|
+
return this._internal.delete(t), r.dispose(), r;
|
|
929
929
|
}
|
|
930
930
|
keys() {
|
|
931
931
|
return this._internal.keys();
|
|
@@ -936,26 +936,26 @@ var Jt = class {
|
|
|
936
936
|
entries() {
|
|
937
937
|
return this._internal.entries();
|
|
938
938
|
}
|
|
939
|
-
forEach(
|
|
940
|
-
return this._internal.forEach(
|
|
939
|
+
forEach(e) {
|
|
940
|
+
return this._internal.forEach(e);
|
|
941
941
|
}
|
|
942
|
-
using(
|
|
943
|
-
return this.inject(
|
|
942
|
+
using(e, t) {
|
|
943
|
+
return this.inject(e, t);
|
|
944
944
|
}
|
|
945
|
-
inject(
|
|
946
|
-
return this.plugin({ inject:
|
|
945
|
+
inject(e, t) {
|
|
946
|
+
return this.plugin({ inject: e, apply: t, name: t.name });
|
|
947
947
|
}
|
|
948
|
-
plugin(
|
|
949
|
-
if (this.resolve(
|
|
948
|
+
plugin(e, t, r) {
|
|
949
|
+
if (this.resolve(e, !0), this.ctx.scope.assertActive(), !r)
|
|
950
950
|
try {
|
|
951
|
-
|
|
951
|
+
t = q(e, t);
|
|
952
952
|
} catch (c) {
|
|
953
|
-
this.context.emit(this.ctx, "internal/error", c), r = c,
|
|
953
|
+
this.context.emit(this.ctx, "internal/error", c), r = c, t = null;
|
|
954
954
|
}
|
|
955
|
-
let n = this.get(
|
|
956
|
-
return n ? (n.isForkable || this.context.emit(this.ctx, "internal/warning", new Error(`duplicate plugin detected: ${
|
|
955
|
+
let n = this.get(e);
|
|
956
|
+
return n ? (n.isForkable || this.context.emit(this.ctx, "internal/warning", new Error(`duplicate plugin detected: ${e.name}`)), n.fork(this.ctx, t, r)) : (n = new ce(this.ctx, e, t, r), this.set(e, n), n.fork(this.ctx, t, r));
|
|
957
957
|
}
|
|
958
|
-
},
|
|
958
|
+
}, Ke = He, P = class F {
|
|
959
959
|
static {
|
|
960
960
|
g(this, "Context");
|
|
961
961
|
}
|
|
@@ -969,26 +969,26 @@ var Jt = class {
|
|
|
969
969
|
static intercept = h.intercept;
|
|
970
970
|
static origin = "ctx";
|
|
971
971
|
static current = "ctx";
|
|
972
|
-
static is(
|
|
973
|
-
return !!
|
|
972
|
+
static is(t) {
|
|
973
|
+
return !!t?.[F.is];
|
|
974
974
|
}
|
|
975
975
|
static {
|
|
976
|
-
|
|
976
|
+
F.is[Symbol.toPrimitive] = () => Symbol.for("cordis.is"), F.prototype[F.is] = !0;
|
|
977
977
|
}
|
|
978
978
|
/** @deprecated use `Service.traceable` instead */
|
|
979
|
-
static associate(
|
|
980
|
-
return
|
|
979
|
+
static associate(t, r) {
|
|
980
|
+
return t;
|
|
981
981
|
}
|
|
982
|
-
constructor(
|
|
983
|
-
|
|
982
|
+
constructor(t) {
|
|
983
|
+
t = q(this.constructor, t), this[h.store] = /* @__PURE__ */ Object.create(null), this[h.isolate] = /* @__PURE__ */ Object.create(null), this[h.internal] = /* @__PURE__ */ Object.create(null), this[h.intercept] = /* @__PURE__ */ Object.create(null);
|
|
984
984
|
const r = new Proxy(this, Q.handler);
|
|
985
|
-
r.root = r, r.reflect = new Q(r), r.registry = new
|
|
985
|
+
r.root = r, r.reflect = new Q(r), r.registry = new Ke(r, t), r.lifecycle = new qe(r);
|
|
986
986
|
const n = /* @__PURE__ */ g((c) => {
|
|
987
987
|
if (c) {
|
|
988
988
|
n(Object.getPrototypeOf(c));
|
|
989
989
|
for (const i of Object.getOwnPropertyNames(c)) {
|
|
990
990
|
const a = c[i].prototype?.constructor;
|
|
991
|
-
a && (r[c[i].key] = new a(r,
|
|
991
|
+
a && (r[c[i].key] = new a(r, t), A(r[c[i].key], "ctx", r));
|
|
992
992
|
}
|
|
993
993
|
}
|
|
994
994
|
}, "attach");
|
|
@@ -998,10 +998,10 @@ var Jt = class {
|
|
|
998
998
|
return `Context <${this.name}>`;
|
|
999
999
|
}
|
|
1000
1000
|
get name() {
|
|
1001
|
-
let
|
|
1002
|
-
for (;
|
|
1003
|
-
|
|
1004
|
-
return
|
|
1001
|
+
let t = this.runtime;
|
|
1002
|
+
for (; t && !t.name; )
|
|
1003
|
+
t = t.parent.runtime;
|
|
1004
|
+
return t?.name;
|
|
1005
1005
|
}
|
|
1006
1006
|
get events() {
|
|
1007
1007
|
return this.lifecycle;
|
|
@@ -1010,21 +1010,21 @@ var Jt = class {
|
|
|
1010
1010
|
get state() {
|
|
1011
1011
|
return this.scope;
|
|
1012
1012
|
}
|
|
1013
|
-
extend(
|
|
1014
|
-
const r = Reflect.getOwnPropertyDescriptor(this, h.shadow)?.value, n = Object.assign(Object.create(
|
|
1013
|
+
extend(t = {}) {
|
|
1014
|
+
const r = Reflect.getOwnPropertyDescriptor(this, h.shadow)?.value, n = Object.assign(Object.create(D(this, this)), t);
|
|
1015
1015
|
return r ? Object.assign(Object.create(n), { [h.shadow]: r }) : n;
|
|
1016
1016
|
}
|
|
1017
|
-
isolate(
|
|
1017
|
+
isolate(t, r) {
|
|
1018
1018
|
const n = Object.create(this[h.isolate]);
|
|
1019
|
-
return n[
|
|
1019
|
+
return n[t] = r ?? Symbol(t), this.extend({ [h.isolate]: n });
|
|
1020
1020
|
}
|
|
1021
|
-
intercept(
|
|
1021
|
+
intercept(t, r) {
|
|
1022
1022
|
const n = Object.create(this[h.intercept]);
|
|
1023
|
-
return n[
|
|
1023
|
+
return n[t] = r, this.extend({ [h.intercept]: n });
|
|
1024
1024
|
}
|
|
1025
1025
|
};
|
|
1026
1026
|
P.prototype[P.internal] = /* @__PURE__ */ Object.create(null);
|
|
1027
|
-
var
|
|
1027
|
+
var Te = class be {
|
|
1028
1028
|
static {
|
|
1029
1029
|
g(this, "Service");
|
|
1030
1030
|
}
|
|
@@ -1041,40 +1041,40 @@ var Qt = class bt {
|
|
|
1041
1041
|
ctx;
|
|
1042
1042
|
name;
|
|
1043
1043
|
config;
|
|
1044
|
-
constructor(...
|
|
1044
|
+
constructor(...t) {
|
|
1045
1045
|
let r, n, c, i;
|
|
1046
|
-
P.is(
|
|
1046
|
+
P.is(t[0]) ? (r = t[0], typeof t[1] == "string" ? (n = t[1], c = t[2]) : i = t[1]) : i = t[0], n ??= this.constructor[h.provide], c ??= this.constructor[h.immediate];
|
|
1047
1047
|
let a = this;
|
|
1048
1048
|
const y = {
|
|
1049
1049
|
associate: n,
|
|
1050
1050
|
property: "ctx"
|
|
1051
1051
|
};
|
|
1052
|
-
return a[h.invoke] && (a = Y(n,
|
|
1052
|
+
return a[h.invoke] && (a = Y(n, te(Object.getPrototypeOf(this), Function.prototype), y)), r ? a.ctx = r : a[h.setup](), a.name = n, a.config = i, A(a, h.tracker, y), a.ctx.provide(n), a.ctx.runtime.name = n, c && (r ? a[h.expose] = n : a.ctx.set(n, a)), a.ctx.on("ready", async () => {
|
|
1053
1053
|
await Promise.resolve(), await a.start(), c || a.ctx.set(n, a);
|
|
1054
1054
|
}), a.ctx.on("dispose", () => a.stop()), a;
|
|
1055
1055
|
}
|
|
1056
|
-
[h.filter](
|
|
1057
|
-
return
|
|
1056
|
+
[h.filter](t) {
|
|
1057
|
+
return t[h.isolate][this.name] === this.ctx[h.isolate][this.name];
|
|
1058
1058
|
}
|
|
1059
1059
|
[h.setup]() {
|
|
1060
1060
|
this.ctx = new P();
|
|
1061
1061
|
}
|
|
1062
|
-
[h.extend](
|
|
1062
|
+
[h.extend](t) {
|
|
1063
1063
|
let r;
|
|
1064
|
-
return this[
|
|
1064
|
+
return this[be.invoke] ? r = Y(this.name, this, this[h.tracker]) : r = Object.create(this), Object.assign(r, t);
|
|
1065
1065
|
}
|
|
1066
|
-
static [Symbol.hasInstance](
|
|
1067
|
-
let r =
|
|
1066
|
+
static [Symbol.hasInstance](t) {
|
|
1067
|
+
let r = t.constructor;
|
|
1068
1068
|
for (; r; ) {
|
|
1069
1069
|
if (r = r.prototype?.constructor, r === this) return !0;
|
|
1070
1070
|
r = Object.getPrototypeOf(r);
|
|
1071
1071
|
}
|
|
1072
1072
|
return !1;
|
|
1073
1073
|
}
|
|
1074
|
-
},
|
|
1075
|
-
return
|
|
1076
|
-
},
|
|
1077
|
-
"src/index.ts"(
|
|
1074
|
+
}, Ge = Object.defineProperty, We = Object.getOwnPropertyNames, k = (e, t) => Ge(e, "name", { value: t, configurable: !0 }), Ye = (e, t) => function() {
|
|
1075
|
+
return t || (0, e[We(e)[0]])((t = { exports: {} }).exports, t), t.exports;
|
|
1076
|
+
}, Qe = Ye({
|
|
1077
|
+
"src/index.ts"(e, t) {
|
|
1078
1078
|
var r = Symbol.for("schemastery"), n = Symbol.for("ValidationError");
|
|
1079
1079
|
globalThis.__schemastery_index__ ??= 0;
|
|
1080
1080
|
var c = class extends TypeError {
|
|
@@ -1085,7 +1085,7 @@ var Qt = class bt {
|
|
|
1085
1085
|
f.startsWith(".") && (f = f.slice(1)), super((f === "$" ? "" : `${f} `) + o), this.options = s;
|
|
1086
1086
|
}
|
|
1087
1087
|
static {
|
|
1088
|
-
|
|
1088
|
+
k(this, "ValidationError");
|
|
1089
1089
|
}
|
|
1090
1090
|
name = "ValidationError";
|
|
1091
1091
|
static is(o) {
|
|
@@ -1095,15 +1095,15 @@ var Qt = class bt {
|
|
|
1095
1095
|
Object.defineProperty(c.prototype, n, {
|
|
1096
1096
|
value: !0
|
|
1097
1097
|
});
|
|
1098
|
-
var i = /* @__PURE__ */
|
|
1099
|
-
const s = /* @__PURE__ */
|
|
1098
|
+
var i = /* @__PURE__ */ k(function(o) {
|
|
1099
|
+
const s = /* @__PURE__ */ k(function(f, u = {}) {
|
|
1100
1100
|
return i.resolve(f, s, u)[0];
|
|
1101
1101
|
}, "schema");
|
|
1102
1102
|
if (o.refs) {
|
|
1103
|
-
const f =
|
|
1103
|
+
const f = C(o.refs, (l) => new i(l)), u = /* @__PURE__ */ k((l) => f[l], "getRef");
|
|
1104
1104
|
for (const l in f) {
|
|
1105
1105
|
const p = f[l];
|
|
1106
|
-
p.sKey = u(p.sKey), p.inner = u(p.inner), p.list = p.list && p.list.map(u), p.dict = p.dict &&
|
|
1106
|
+
p.sKey = u(p.sKey), p.inner = u(p.inner), p.list = p.list && p.list.map(u), p.dict = p.dict && C(p.dict, u);
|
|
1107
1107
|
}
|
|
1108
1108
|
return f[o.uid];
|
|
1109
1109
|
}
|
|
@@ -1116,15 +1116,15 @@ var Qt = class bt {
|
|
|
1116
1116
|
}, "Schema");
|
|
1117
1117
|
i.prototype = Object.create(Function.prototype), i.prototype[r] = !0, i.ValidationError = c;
|
|
1118
1118
|
var a;
|
|
1119
|
-
i.prototype.toJSON = /* @__PURE__ */
|
|
1119
|
+
i.prototype.toJSON = /* @__PURE__ */ k(function() {
|
|
1120
1120
|
if (a)
|
|
1121
1121
|
return a[this.uid] ??= JSON.parse(JSON.stringify({ ...this })), this.uid;
|
|
1122
1122
|
a = { [this.uid]: { ...this } }, a[this.uid] = JSON.parse(JSON.stringify({ ...this }));
|
|
1123
1123
|
const s = { uid: this.uid, refs: a };
|
|
1124
1124
|
return a = void 0, s;
|
|
1125
|
-
}, "toJSON"), i.prototype.set = /* @__PURE__ */
|
|
1125
|
+
}, "toJSON"), i.prototype.set = /* @__PURE__ */ k(function(s, f) {
|
|
1126
1126
|
return this.dict[s] = f, this;
|
|
1127
|
-
}, "set"), i.prototype.push = /* @__PURE__ */
|
|
1127
|
+
}, "set"), i.prototype.push = /* @__PURE__ */ k(function(s) {
|
|
1128
1128
|
return this.list.push(s), this;
|
|
1129
1129
|
}, "push");
|
|
1130
1130
|
function y(o, s) {
|
|
@@ -1135,18 +1135,18 @@ var Qt = class bt {
|
|
|
1135
1135
|
}
|
|
1136
1136
|
return f;
|
|
1137
1137
|
}
|
|
1138
|
-
|
|
1138
|
+
k(y, "mergeDesc");
|
|
1139
1139
|
function d(o) {
|
|
1140
1140
|
return o?.$value ?? o?.$inner;
|
|
1141
1141
|
}
|
|
1142
|
-
|
|
1142
|
+
k(d, "getInner");
|
|
1143
1143
|
function b(o) {
|
|
1144
|
-
return
|
|
1144
|
+
return fe(o ?? {}, (s) => !s.startsWith("$"));
|
|
1145
1145
|
}
|
|
1146
|
-
|
|
1146
|
+
k(b, "extractKeys"), i.prototype.i18n = /* @__PURE__ */ k(function(s) {
|
|
1147
1147
|
const f = i(this), u = y(f.meta.description, s);
|
|
1148
|
-
return Object.keys(u).length && (f.meta.description = u), f.dict && (f.dict =
|
|
1149
|
-
}, "i18n"), i.prototype.extra = /* @__PURE__ */
|
|
1148
|
+
return Object.keys(u).length && (f.meta.description = u), f.dict && (f.dict = C(f.dict, (l, p) => l.i18n(C(s, (m) => d(m)?.[p] ?? m?.[p])))), f.list && (f.list = f.list.map((l, p) => l.i18n(C(s, (m = {}) => Array.isArray(d(m)) ? d(m)[p] : Array.isArray(m) ? m[p] : b(m))))), f.inner && (f.inner = f.inner.i18n(C(s, (l) => d(l) ? d(l) : b(l)))), f.sKey && (f.sKey = f.sKey.i18n(C(s, (l) => l?.$key))), f;
|
|
1149
|
+
}, "i18n"), i.prototype.extra = /* @__PURE__ */ k(function(s, f) {
|
|
1150
1150
|
const u = i(this);
|
|
1151
1151
|
return u.meta = { ...u.meta, [s]: f }, u;
|
|
1152
1152
|
}, "extra");
|
|
@@ -1157,17 +1157,17 @@ var Qt = class bt {
|
|
|
1157
1157
|
return f.meta = { ...f.meta, [o]: s }, f;
|
|
1158
1158
|
}
|
|
1159
1159
|
});
|
|
1160
|
-
i.prototype.deprecated = /* @__PURE__ */
|
|
1160
|
+
i.prototype.deprecated = /* @__PURE__ */ k(function() {
|
|
1161
1161
|
const s = i(this);
|
|
1162
1162
|
return s.meta.badges ||= [], s.meta.badges.push({ text: "deprecated", type: "danger" }), s;
|
|
1163
|
-
}, "deprecated"), i.prototype.experimental = /* @__PURE__ */
|
|
1163
|
+
}, "deprecated"), i.prototype.experimental = /* @__PURE__ */ k(function() {
|
|
1164
1164
|
const s = i(this);
|
|
1165
1165
|
return s.meta.badges ||= [], s.meta.badges.push({ text: "experimental", type: "warning" }), s;
|
|
1166
|
-
}, "experimental"), i.prototype.pattern = /* @__PURE__ */
|
|
1167
|
-
const f = i(this), u =
|
|
1166
|
+
}, "experimental"), i.prototype.pattern = /* @__PURE__ */ k(function(s) {
|
|
1167
|
+
const f = i(this), u = ae(s, ["source", "flags"]);
|
|
1168
1168
|
return f.meta = { ...f.meta, pattern: u }, f;
|
|
1169
|
-
}, "pattern"), i.prototype.simplify = /* @__PURE__ */
|
|
1170
|
-
if (
|
|
1169
|
+
}, "pattern"), i.prototype.simplify = /* @__PURE__ */ k(function(s) {
|
|
1170
|
+
if (B(s, this.meta.default, this.type === "dict")) return null;
|
|
1171
1171
|
if ($(s)) return s;
|
|
1172
1172
|
if (this.type === "object" || this.type === "dict") {
|
|
1173
1173
|
const f = {};
|
|
@@ -1175,7 +1175,7 @@ var Qt = class bt {
|
|
|
1175
1175
|
const p = (this.type === "object" ? this.dict[u] : this.inner)?.simplify(s[u]);
|
|
1176
1176
|
(this.type === "dict" || !$(p)) && (f[u] = p);
|
|
1177
1177
|
}
|
|
1178
|
-
return
|
|
1178
|
+
return B(f, this.meta.default, this.type === "dict") ? null : f;
|
|
1179
1179
|
} else if (this.type === "array" || this.type === "tuple") {
|
|
1180
1180
|
const f = [];
|
|
1181
1181
|
return s.forEach((u, l) => {
|
|
@@ -1194,9 +1194,9 @@ var Qt = class bt {
|
|
|
1194
1194
|
} catch {
|
|
1195
1195
|
}
|
|
1196
1196
|
return s;
|
|
1197
|
-
}, "simplify"), i.prototype.toString = /* @__PURE__ */
|
|
1198
|
-
return
|
|
1199
|
-
}, "toString"), i.prototype.role = /* @__PURE__ */
|
|
1197
|
+
}, "simplify"), i.prototype.toString = /* @__PURE__ */ k(function(s) {
|
|
1198
|
+
return ie[this.type]?.(this, s) ?? `Schema<${this.type}>`;
|
|
1199
|
+
}, "toString"), i.prototype.role = /* @__PURE__ */ k(function(o, s) {
|
|
1200
1200
|
const f = i(this);
|
|
1201
1201
|
return f.meta = { ...f.meta, role: o, extra: s }, f;
|
|
1202
1202
|
}, "role");
|
|
@@ -1208,18 +1208,18 @@ var Qt = class bt {
|
|
|
1208
1208
|
}
|
|
1209
1209
|
});
|
|
1210
1210
|
var j = {};
|
|
1211
|
-
i.extend = /* @__PURE__ */
|
|
1211
|
+
i.extend = /* @__PURE__ */ k(function(s, f) {
|
|
1212
1212
|
j[s] = f;
|
|
1213
|
-
}, "extend"), i.resolve = /* @__PURE__ */
|
|
1213
|
+
}, "extend"), i.resolve = /* @__PURE__ */ k(function(s, f, u = {}, l = !1) {
|
|
1214
1214
|
if (!f) return [s];
|
|
1215
1215
|
if (u.ignore?.(s, f)) return [s];
|
|
1216
1216
|
if ($(s) && f.type !== "lazy") {
|
|
1217
1217
|
if (f.meta.required) throw new c("missing required value", u);
|
|
1218
|
-
let m = f,
|
|
1219
|
-
for (; m?.type === "intersect" && $(
|
|
1220
|
-
m = m.list[0],
|
|
1221
|
-
if ($(
|
|
1222
|
-
s = V(
|
|
1218
|
+
let m = f, S = f.meta.default;
|
|
1219
|
+
for (; m?.type === "intersect" && $(S); )
|
|
1220
|
+
m = m.list[0], S = m?.meta.default;
|
|
1221
|
+
if ($(S)) return [s];
|
|
1222
|
+
s = V(S);
|
|
1223
1223
|
}
|
|
1224
1224
|
const p = j[f.type];
|
|
1225
1225
|
if (!p) throw new c(`unsupported type "${f.type}"`, u);
|
|
@@ -1229,7 +1229,7 @@ var Qt = class bt {
|
|
|
1229
1229
|
if (!f.meta.loose) throw m;
|
|
1230
1230
|
return [f.meta.default];
|
|
1231
1231
|
}
|
|
1232
|
-
}, "resolve"), i.from = /* @__PURE__ */
|
|
1232
|
+
}, "resolve"), i.from = /* @__PURE__ */ k(function(s) {
|
|
1233
1233
|
if ($(s))
|
|
1234
1234
|
return i.any();
|
|
1235
1235
|
if (["string", "number", "boolean"].includes(typeof s))
|
|
@@ -1251,14 +1251,14 @@ var Qt = class bt {
|
|
|
1251
1251
|
}
|
|
1252
1252
|
else
|
|
1253
1253
|
throw new TypeError(`cannot infer schema from ${s}`);
|
|
1254
|
-
}, "from"), i.lazy = /* @__PURE__ */
|
|
1255
|
-
const f = /* @__PURE__ */
|
|
1254
|
+
}, "from"), i.lazy = /* @__PURE__ */ k(function(s) {
|
|
1255
|
+
const f = /* @__PURE__ */ k(() => (u.inner[r] || (u.inner = u.builder(), u.inner.meta = { ...u.meta, ...u.inner.meta }), u.inner.toJSON()), "toJSON"), u = new i({ type: "lazy", builder: s, inner: { toJSON: f } });
|
|
1256
1256
|
return u;
|
|
1257
|
-
}, "lazy"), i.natural = /* @__PURE__ */
|
|
1257
|
+
}, "lazy"), i.natural = /* @__PURE__ */ k(function() {
|
|
1258
1258
|
return i.number().step(1).min(0);
|
|
1259
|
-
}, "natural"), i.percent = /* @__PURE__ */
|
|
1259
|
+
}, "natural"), i.percent = /* @__PURE__ */ k(function() {
|
|
1260
1260
|
return i.number().step(0.01).min(0).max(1).role("slider");
|
|
1261
|
-
}, "percent"), i.date = /* @__PURE__ */
|
|
1261
|
+
}, "percent"), i.date = /* @__PURE__ */ k(function() {
|
|
1262
1262
|
return i.union([
|
|
1263
1263
|
i.is(Date),
|
|
1264
1264
|
i.transform(i.string().role("datetime"), (s, f) => {
|
|
@@ -1267,7 +1267,7 @@ var Qt = class bt {
|
|
|
1267
1267
|
return u;
|
|
1268
1268
|
}, !0)
|
|
1269
1269
|
]);
|
|
1270
|
-
}, "date"), i.regExp = /* @__PURE__ */
|
|
1270
|
+
}, "date"), i.regExp = /* @__PURE__ */ k(function(s = "") {
|
|
1271
1271
|
return i.union([
|
|
1272
1272
|
i.is(RegExp),
|
|
1273
1273
|
i.transform(i.string().role("regexp", { flag: s }), (f, u) => {
|
|
@@ -1278,7 +1278,7 @@ var Qt = class bt {
|
|
|
1278
1278
|
}
|
|
1279
1279
|
}, !0)
|
|
1280
1280
|
]);
|
|
1281
|
-
}, "regExp"), i.arrayBuffer = /* @__PURE__ */
|
|
1281
|
+
}, "regExp"), i.arrayBuffer = /* @__PURE__ */ k(function(s) {
|
|
1282
1282
|
return i.union([
|
|
1283
1283
|
i.is(ArrayBuffer),
|
|
1284
1284
|
i.is(SharedArrayBuffer),
|
|
@@ -1297,21 +1297,21 @@ var Qt = class bt {
|
|
|
1297
1297
|
}, "arrayBuffer"), i.extend("lazy", (o, s, f, u) => (s.inner[r] || (s.inner = s.builder(), s.inner.meta = { ...s.meta, ...s.inner.meta }), i.resolve(o, s.inner, f, u))), i.extend("any", (o) => [o]), i.extend("never", (o, s, f) => {
|
|
1298
1298
|
throw new c(`expected nullable but got ${o}`, f);
|
|
1299
1299
|
}), i.extend("const", (o, { value: s }, f) => {
|
|
1300
|
-
if (
|
|
1300
|
+
if (B(o, s)) return [s];
|
|
1301
1301
|
throw new c(`expected ${s} but got ${o}`, f);
|
|
1302
1302
|
});
|
|
1303
|
-
function
|
|
1303
|
+
function O(o, s, f, u, l = !1) {
|
|
1304
1304
|
const { max: p = 1 / 0, min: m = -1 / 0 } = s;
|
|
1305
1305
|
if (o > p) throw new c(`expected ${f} <= ${p} but got ${o}`, u);
|
|
1306
1306
|
if (o < m && !l) throw new c(`expected ${f} >= ${m} but got ${o}`, u);
|
|
1307
1307
|
}
|
|
1308
|
-
|
|
1308
|
+
k(O, "checkWithinRange"), i.extend("string", (o, { meta: s }, f) => {
|
|
1309
1309
|
if (typeof o != "string") throw new c(`expected string but got ${o}`, f);
|
|
1310
1310
|
if (s.pattern) {
|
|
1311
1311
|
const u = new RegExp(s.pattern.source, s.pattern.flags);
|
|
1312
1312
|
if (!u.test(o)) throw new c(`expect string to match regexp ${u}`, f);
|
|
1313
1313
|
}
|
|
1314
|
-
return
|
|
1314
|
+
return O(o.length, s, "string length", f), [o];
|
|
1315
1315
|
});
|
|
1316
1316
|
function R(o, s) {
|
|
1317
1317
|
const f = o.toString();
|
|
@@ -1321,16 +1321,16 @@ var Qt = class bt {
|
|
|
1321
1321
|
const l = f.slice(u + 1), p = f.slice(0, u);
|
|
1322
1322
|
return l.length <= s ? +(p + l.padEnd(s, "0")) : +(p + l.slice(0, s) + "." + l.slice(s));
|
|
1323
1323
|
}
|
|
1324
|
-
|
|
1324
|
+
k(R, "decimalShift");
|
|
1325
1325
|
function x(o, s, f) {
|
|
1326
1326
|
if (f = Math.abs(f), !/^\d+\.\d+$/.test(f.toString()))
|
|
1327
1327
|
return (o - s) % f === 0;
|
|
1328
1328
|
const u = f.toString().indexOf("."), l = f.toString().slice(u + 1).length;
|
|
1329
1329
|
return Math.abs(R(o, l) - R(s, l)) % R(f, l) === 0;
|
|
1330
1330
|
}
|
|
1331
|
-
|
|
1331
|
+
k(x, "isMultipleOf"), i.extend("number", (o, { meta: s }, f) => {
|
|
1332
1332
|
if (typeof o != "number") throw new c(`expected number but got ${o}`, f);
|
|
1333
|
-
|
|
1333
|
+
O(o, s, "number", f);
|
|
1334
1334
|
const { step: u } = s;
|
|
1335
1335
|
if (u && !x(o, s.min ?? 0, u))
|
|
1336
1336
|
throw new c(`expected number multiple of ${u} but got ${o}`, f);
|
|
@@ -1383,21 +1383,21 @@ var Qt = class bt {
|
|
|
1383
1383
|
return delete o[s], f.meta.default;
|
|
1384
1384
|
}
|
|
1385
1385
|
}
|
|
1386
|
-
|
|
1386
|
+
k(v, "property"), i.extend("array", (o, { inner: s, meta: f }, u) => {
|
|
1387
1387
|
if (!Array.isArray(o)) throw new c(`expected array but got ${o}`, u);
|
|
1388
|
-
return
|
|
1388
|
+
return O(o.length, f, "array length", u, !$(s.meta.default)), [o.map((l, p) => v(o, p, s, u))];
|
|
1389
1389
|
}), i.extend("dict", (o, { inner: s, sKey: f }, u, l) => {
|
|
1390
1390
|
if (!J(o)) throw new c(`expected object but got ${o}`, u);
|
|
1391
1391
|
const p = {};
|
|
1392
1392
|
for (const m in o) {
|
|
1393
|
-
let
|
|
1393
|
+
let S;
|
|
1394
1394
|
try {
|
|
1395
|
-
|
|
1396
|
-
} catch (
|
|
1395
|
+
S = i.resolve(m, f, u)[0];
|
|
1396
|
+
} catch (we) {
|
|
1397
1397
|
if (l) continue;
|
|
1398
|
-
throw
|
|
1398
|
+
throw we;
|
|
1399
1399
|
}
|
|
1400
|
-
p[
|
|
1400
|
+
p[S] = v(o, m, s, u), o[S] = o[m], m !== S && delete o[m];
|
|
1401
1401
|
}
|
|
1402
1402
|
return [p];
|
|
1403
1403
|
}), i.extend("tuple", (o, { list: s }, f, u) => {
|
|
@@ -1405,18 +1405,18 @@ var Qt = class bt {
|
|
|
1405
1405
|
const l = s.map((p, m) => v(o, m, p, f));
|
|
1406
1406
|
return u ? [l] : (l.push(...o.slice(s.length)), [l]);
|
|
1407
1407
|
});
|
|
1408
|
-
function
|
|
1408
|
+
function U(o, s) {
|
|
1409
1409
|
for (const f in s)
|
|
1410
1410
|
f in o || (o[f] = s[f]);
|
|
1411
1411
|
}
|
|
1412
|
-
|
|
1412
|
+
k(U, "merge"), i.extend("object", (o, { dict: s }, f, u) => {
|
|
1413
1413
|
if (!J(o)) throw new c(`expected object but got ${o}`, f);
|
|
1414
1414
|
const l = {};
|
|
1415
1415
|
for (const p in s) {
|
|
1416
1416
|
const m = v(o, p, s[p], f);
|
|
1417
1417
|
(!$(m) || p in o) && (l[p] = m);
|
|
1418
1418
|
}
|
|
1419
|
-
return u ||
|
|
1419
|
+
return u || U(l, o), [l];
|
|
1420
1420
|
}), i.extend("union", (o, { list: s, toString: f }, u, l) => {
|
|
1421
1421
|
for (const p of s)
|
|
1422
1422
|
try {
|
|
@@ -1428,27 +1428,27 @@ var Qt = class bt {
|
|
|
1428
1428
|
if (!s.length) return [o];
|
|
1429
1429
|
let p;
|
|
1430
1430
|
for (const m of s) {
|
|
1431
|
-
const
|
|
1432
|
-
if (!$(
|
|
1431
|
+
const S = i.resolve(o, m, u, !0)[0];
|
|
1432
|
+
if (!$(S))
|
|
1433
1433
|
if ($(p))
|
|
1434
|
-
p =
|
|
1434
|
+
p = S;
|
|
1435
1435
|
else {
|
|
1436
|
-
if (typeof p != typeof
|
|
1436
|
+
if (typeof p != typeof S)
|
|
1437
1437
|
throw new c(`expected ${f()} but got ${JSON.stringify(o)}`, u);
|
|
1438
|
-
if (typeof
|
|
1439
|
-
|
|
1440
|
-
else if (p !==
|
|
1438
|
+
if (typeof S == "object")
|
|
1439
|
+
U(p ??= {}, S);
|
|
1440
|
+
else if (p !== S)
|
|
1441
1441
|
throw new c(`expected ${f()} but got ${JSON.stringify(o)}`, u);
|
|
1442
1442
|
}
|
|
1443
1443
|
}
|
|
1444
|
-
return !l && J(o) &&
|
|
1444
|
+
return !l && J(o) && U(p, o), [p];
|
|
1445
1445
|
}), i.extend("transform", (o, { inner: s, callback: f, preserve: u }, l) => {
|
|
1446
1446
|
const [p, m = o] = i.resolve(o, s, l, !0);
|
|
1447
1447
|
return u ? [f(p)] : [f(p), f(m)];
|
|
1448
1448
|
});
|
|
1449
|
-
var
|
|
1449
|
+
var ie = {};
|
|
1450
1450
|
function _(o, s, f) {
|
|
1451
|
-
|
|
1451
|
+
ie[o] = f, Object.assign(i, {
|
|
1452
1452
|
[o](...u) {
|
|
1453
1453
|
const l = new i({ type: o });
|
|
1454
1454
|
return s.forEach((p, m) => {
|
|
@@ -1463,22 +1463,22 @@ var Qt = class bt {
|
|
|
1463
1463
|
l.list = u[m].map(i.from);
|
|
1464
1464
|
break;
|
|
1465
1465
|
case "dict":
|
|
1466
|
-
l.dict =
|
|
1466
|
+
l.dict = C(u[m], i.from);
|
|
1467
1467
|
break;
|
|
1468
1468
|
case "bits": {
|
|
1469
1469
|
l.bits = {};
|
|
1470
|
-
for (const
|
|
1471
|
-
typeof u[m][
|
|
1470
|
+
for (const S in u[m])
|
|
1471
|
+
typeof u[m][S] == "number" && (l.bits[S] = u[m][S]);
|
|
1472
1472
|
break;
|
|
1473
1473
|
}
|
|
1474
1474
|
case "callback": {
|
|
1475
|
-
const
|
|
1476
|
-
|
|
1475
|
+
const S = l.callback = u[m];
|
|
1476
|
+
S.toJSON ||= () => S.toString();
|
|
1477
1477
|
break;
|
|
1478
1478
|
}
|
|
1479
1479
|
case "constructor": {
|
|
1480
|
-
const
|
|
1481
|
-
typeof
|
|
1480
|
+
const S = l.constructor = u[m];
|
|
1481
|
+
typeof S == "function" && (S.toJSON ||= () => S.name);
|
|
1482
1482
|
break;
|
|
1483
1483
|
}
|
|
1484
1484
|
default:
|
|
@@ -1488,20 +1488,44 @@ var Qt = class bt {
|
|
|
1488
1488
|
}
|
|
1489
1489
|
});
|
|
1490
1490
|
}
|
|
1491
|
-
|
|
1491
|
+
k(_, "defineMethod"), _("is", ["constructor"], ({ constructor: o }) => typeof o == "function" ? o.name : o), _("any", [], () => "any"), _("never", [], () => "never"), _("const", ["value"], ({ value: o }) => typeof o == "string" ? JSON.stringify(o) : o), _("string", [], () => "string"), _("number", [], () => "number"), _("boolean", [], () => "boolean"), _("bitset", ["bits"], () => "bitset"), _("function", [], () => "function"), _("array", ["inner"], ({ inner: o }) => `${o.toString(!0)}[]`), _("dict", ["inner", "sKey"], ({ inner: o, sKey: s }) => `{ [key: ${s.toString()}]: ${o.toString()} }`), _("tuple", ["list"], ({ list: o }) => `[${o.map((s) => s.toString()).join(", ")}]`), _("object", ["dict"], ({ dict: o }) => Object.keys(o).length === 0 ? "{}" : `{ ${Object.entries(o).map(([s, f]) => `${s}${f.meta.required ? "" : "?"}: ${f.toString()}`).join(", ")} }`), _("union", ["list"], ({ list: o }, s) => {
|
|
1492
1492
|
const f = o.map(({ toString: u }) => u()).join(" | ");
|
|
1493
1493
|
return s ? `(${f})` : f;
|
|
1494
|
-
}), _("intersect", ["list"], ({ list: o }) => `${o.map((s) => s.toString(!0)).join(" & ")}`), _("transform", ["inner", "callback", "preserve"], ({ inner: o }, s) => o.toString(s)),
|
|
1494
|
+
}), _("intersect", ["list"], ({ list: o }) => `${o.map((s) => s.toString(!0)).join(" & ")}`), _("transform", ["inner", "callback", "preserve"], ({ inner: o }, s) => o.toString(s)), t.exports = i;
|
|
1495
1495
|
}
|
|
1496
1496
|
});
|
|
1497
|
-
const
|
|
1498
|
-
var
|
|
1497
|
+
const Xe = Qe();
|
|
1498
|
+
var Ze = /* @__PURE__ */ ((e) => (e.ANALYTICS_API_BASE = "https://analytics.ipe.wiki/api/v6", e.ANALYTICS_DASH_URL = "https://analytics.ipe.wiki", e.GITHUB_URL = "https://github.com/inpageedit/inpageedit-next", e.GITHUB_OWNER = "inpageedit", e.GITHUB_REPO = "inpageedit-next", e.HOME_URL = "https://www.ipe.wiki/", e.UPDATE_LOGS_URL = "https://www.ipe.wiki/changelogs/", e.PLUGIN_REGISTRY_URL = "https://registry.ipe.wiki/registry.v1.json", e.I18N_INDEX_URL = "https://registry.ipe.wiki/i18n/index.json", e.QQ_GROUP_ID = "1026023666", e))(Ze || {});
|
|
1499
|
+
function ge(e) {
|
|
1500
|
+
return e.charAt(0).toLowerCase() + e.slice(1);
|
|
1501
|
+
}
|
|
1502
|
+
function et(e) {
|
|
1503
|
+
return ge(e).replace(/_/g, "-").replace(/.[A-Z]+/g, (t) => t[0] + "-" + t.slice(1).toLowerCase());
|
|
1504
|
+
}
|
|
1505
|
+
function tt(e) {
|
|
1506
|
+
return ge(e).replace(/-/g, "_").replace(/.[A-Z]+/g, (t) => t[0] + "_" + t.slice(1).toLowerCase());
|
|
1507
|
+
}
|
|
1508
|
+
function rt(e) {
|
|
1509
|
+
return function(t) {
|
|
1510
|
+
return t.PreferencesSchema = e, t;
|
|
1511
|
+
};
|
|
1512
|
+
}
|
|
1499
1513
|
export {
|
|
1500
|
-
|
|
1501
|
-
|
|
1514
|
+
T as C,
|
|
1515
|
+
Ze as E,
|
|
1516
|
+
Ve as F,
|
|
1502
1517
|
K as I,
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1518
|
+
ce as M,
|
|
1519
|
+
rt as R,
|
|
1520
|
+
Xe as S,
|
|
1521
|
+
de as a,
|
|
1522
|
+
Je as b,
|
|
1523
|
+
Te as c,
|
|
1524
|
+
xe as d,
|
|
1525
|
+
qe as e,
|
|
1526
|
+
tt as f,
|
|
1527
|
+
P as g,
|
|
1528
|
+
et as p,
|
|
1529
|
+
h as s
|
|
1506
1530
|
};
|
|
1507
|
-
//# sourceMappingURL=
|
|
1531
|
+
//# sourceMappingURL=Preferences-85Q9FAmb.js.map
|