@inpageedit/core 0.10.0 → 0.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -2
- package/dist/PluginPrefSync-COidewzp.js +258 -0
- package/dist/PluginPrefSync-COidewzp.js.map +1 -0
- package/dist/__test__/utils/constants.d.ts +3 -2
- package/dist/components/index.js +69 -51
- package/dist/components/index.js.map +1 -1
- package/dist/constants/endpoints.d.ts +1 -1
- package/dist/{index-BR6gK_ki.js → index-BNDyaWnI.js} +44 -38
- package/dist/index-BNDyaWnI.js.map +1 -0
- package/dist/{index-BnAhw94L.js → index-BQzuJxBO.js} +2 -2
- package/dist/{index-BnAhw94L.js.map → index-BQzuJxBO.js.map} +1 -1
- package/dist/{index-Z-_kjibx.js → index-BUI2IX49.js} +763 -699
- package/dist/index-BUI2IX49.js.map +1 -0
- package/dist/{index-Cx-YiN1j.js → index-CBszdxJJ.js} +22 -21
- package/dist/index-CBszdxJJ.js.map +1 -0
- package/dist/index-CfgnJ51A.js +185 -0
- package/dist/index-CfgnJ51A.js.map +1 -0
- package/dist/index-Cx4qgCJK.js +4914 -0
- package/dist/{index-DqJUIV2e.js.map → index-Cx4qgCJK.js.map} +1 -1
- package/dist/index-D5J7RU5I.js +211 -0
- package/dist/index-D5J7RU5I.js.map +1 -0
- package/dist/{index-ByzgI28q.js → index-MhNAv9Vf.js} +6 -2
- package/dist/index-MhNAv9Vf.js.map +1 -0
- package/dist/{index-ByJfEsN8.js → index-U2RPZk8N.js} +148 -110
- package/dist/index-U2RPZk8N.js.map +1 -0
- package/dist/{index-CAiGct8U.js → index-VnRKIVau.js} +42 -42
- package/dist/index-VnRKIVau.js.map +1 -0
- package/dist/{index-eOIVMf9E.js → index-etJXONAj.js} +46 -35
- package/dist/index-etJXONAj.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/models/WikiTitle/index.d.ts +2 -2
- package/dist/plugins/analytics/index.d.ts +41 -0
- package/dist/plugins/in-article-links/index.d.ts +14 -0
- package/dist/plugins/preferences-ui/PluginPrefSync.d.ts +2 -0
- package/dist/plugins/preferences-ui/index.d.ts +3 -1
- package/dist/plugins/quick-delete/index.d.ts +3 -0
- package/dist/plugins/quick-diff/index.d.ts +17 -0
- package/dist/plugins/quick-edit/index.d.ts +8 -0
- package/dist/plugins/quick-move/index.d.ts +16 -0
- package/dist/plugins/quick-redirect/index.d.ts +15 -0
- package/dist/plugins/toolbox/index.d.ts +9 -0
- package/dist/services/PreferencesService.d.ts +9 -2
- package/dist/services/WikiMetadataService.d.ts +23 -23
- package/dist/style.css +1 -1
- package/dist/types/WikiMetadata.d.ts +6 -8
- package/lib/index.umd.js +24 -24
- package/lib/index.umd.js.map +1 -1
- package/lib/style.css +1 -1
- package/package.json +3 -3
- package/dist/ActionButton-BgbTKTg7.js +0 -24
- package/dist/ActionButton-BgbTKTg7.js.map +0 -1
- package/dist/PluginPrefSync-CNCU2DJU.js +0 -171
- package/dist/PluginPrefSync-CNCU2DJU.js.map +0 -1
- package/dist/index-2mNdeL-V.js +0 -193
- package/dist/index-2mNdeL-V.js.map +0 -1
- package/dist/index-BR6gK_ki.js.map +0 -1
- package/dist/index-ByJfEsN8.js.map +0 -1
- package/dist/index-ByzgI28q.js.map +0 -1
- package/dist/index-CAiGct8U.js.map +0 -1
- package/dist/index-Cx-YiN1j.js.map +0 -1
- package/dist/index-DqJUIV2e.js +0 -4861
- package/dist/index-Z-_kjibx.js.map +0 -1
- package/dist/index-eOIVMf9E.js.map +0 -1
|
@@ -1,103 +1,103 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
const
|
|
1
|
+
import { j as H, P as Er } from "./index-CvhkVj_L.js";
|
|
2
|
+
const ot = () => {
|
|
3
3
|
let r, e;
|
|
4
4
|
return { promise: new Promise((i, n) => {
|
|
5
5
|
r = i, e = n;
|
|
6
6
|
}), resolve: r, reject: e };
|
|
7
7
|
};
|
|
8
|
-
Promise.withResolvers || (Promise.withResolvers =
|
|
9
|
-
var
|
|
10
|
-
function
|
|
8
|
+
Promise.withResolvers || (Promise.withResolvers = ot);
|
|
9
|
+
var Or = Object.defineProperty, k = (r, e) => Or(r, "name", { value: e, configurable: !0 });
|
|
10
|
+
function Rr() {
|
|
11
11
|
}
|
|
12
|
-
|
|
12
|
+
k(Rr, "noop");
|
|
13
13
|
function T(r) {
|
|
14
14
|
return r == null;
|
|
15
15
|
}
|
|
16
|
-
|
|
16
|
+
k(T, "isNullable");
|
|
17
17
|
function $r(r) {
|
|
18
18
|
return !T(r);
|
|
19
19
|
}
|
|
20
|
-
|
|
21
|
-
function
|
|
20
|
+
k($r, "isNonNullable");
|
|
21
|
+
function Ce(r) {
|
|
22
22
|
return r && typeof r == "object" && !Array.isArray(r);
|
|
23
23
|
}
|
|
24
|
-
|
|
24
|
+
k(Ce, "isPlainObject");
|
|
25
25
|
function Dt(r, e) {
|
|
26
26
|
return Object.fromEntries(Object.entries(r).filter(([t, i]) => e(t, i)));
|
|
27
27
|
}
|
|
28
|
-
|
|
28
|
+
k(Dt, "filterKeys");
|
|
29
29
|
function te(r, e) {
|
|
30
30
|
return Object.fromEntries(Object.entries(r).map(([t, i]) => [t, e(i, t)]));
|
|
31
31
|
}
|
|
32
|
-
|
|
33
|
-
function
|
|
32
|
+
k(te, "mapValues");
|
|
33
|
+
function Nt(r, e, t) {
|
|
34
34
|
if (!e) return { ...r };
|
|
35
35
|
const i = {};
|
|
36
36
|
for (const n of e)
|
|
37
37
|
(t || r[n] !== void 0) && (i[n] = r[n]);
|
|
38
38
|
return i;
|
|
39
39
|
}
|
|
40
|
-
|
|
41
|
-
function
|
|
40
|
+
k(Nt, "pick");
|
|
41
|
+
function Ar(r, e) {
|
|
42
42
|
if (!e) return { ...r };
|
|
43
43
|
const t = { ...r };
|
|
44
44
|
for (const i of e)
|
|
45
45
|
Reflect.deleteProperty(t, i);
|
|
46
46
|
return t;
|
|
47
47
|
}
|
|
48
|
-
|
|
49
|
-
function
|
|
48
|
+
k(Ar, "omit");
|
|
49
|
+
function N(r, e, t) {
|
|
50
50
|
return Object.defineProperty(r, e, { writable: !0, value: t, enumerable: !1 });
|
|
51
51
|
}
|
|
52
|
-
|
|
52
|
+
k(N, "defineProperty");
|
|
53
53
|
function Pr(r, e) {
|
|
54
54
|
return e.every((t) => r.includes(t));
|
|
55
55
|
}
|
|
56
|
-
|
|
57
|
-
function
|
|
56
|
+
k(Pr, "contain");
|
|
57
|
+
function Ir(r, e) {
|
|
58
58
|
return r.filter((t) => e.includes(t));
|
|
59
59
|
}
|
|
60
|
-
|
|
61
|
-
function
|
|
60
|
+
k(Ir, "intersection");
|
|
61
|
+
function Tr(r, e) {
|
|
62
62
|
return r.filter((t) => !e.includes(t));
|
|
63
63
|
}
|
|
64
|
-
|
|
65
|
-
function
|
|
64
|
+
k(Tr, "difference");
|
|
65
|
+
function Cr(r, e) {
|
|
66
66
|
return Array.from(/* @__PURE__ */ new Set([...r, ...e]));
|
|
67
67
|
}
|
|
68
|
-
|
|
68
|
+
k(Cr, "union");
|
|
69
69
|
function Lr(r) {
|
|
70
70
|
return [...new Set(r)];
|
|
71
71
|
}
|
|
72
|
-
|
|
72
|
+
k(Lr, "deduplicate");
|
|
73
73
|
function ne(r, e) {
|
|
74
74
|
const t = r?.indexOf(e);
|
|
75
75
|
return t >= 0 ? (r.splice(t, 1), !0) : !1;
|
|
76
76
|
}
|
|
77
|
-
|
|
78
|
-
function
|
|
77
|
+
k(ne, "remove");
|
|
78
|
+
function jr(r) {
|
|
79
79
|
return Array.isArray(r) ? r : T(r) ? [] : [r];
|
|
80
80
|
}
|
|
81
|
-
|
|
81
|
+
k(jr, "makeArray");
|
|
82
82
|
function se(r, e) {
|
|
83
83
|
return arguments.length === 1 ? (t) => se(r, t) : r in globalThis && e instanceof globalThis[r] || Object.prototype.toString.call(e).slice(8, -1) === r;
|
|
84
84
|
}
|
|
85
|
-
|
|
85
|
+
k(se, "is");
|
|
86
86
|
function Oe(r) {
|
|
87
87
|
return se("ArrayBuffer", r) || se("SharedArrayBuffer", r);
|
|
88
88
|
}
|
|
89
|
-
|
|
90
|
-
function
|
|
89
|
+
k(Oe, "isArrayBufferLike");
|
|
90
|
+
function Ut(r) {
|
|
91
91
|
return Oe(r) || ArrayBuffer.isView(r);
|
|
92
92
|
}
|
|
93
|
-
|
|
94
|
-
var
|
|
93
|
+
k(Ut, "isArrayBufferSource");
|
|
94
|
+
var J;
|
|
95
95
|
((r) => {
|
|
96
|
-
r.is = Oe, r.isSource =
|
|
96
|
+
r.is = Oe, r.isSource = Ut;
|
|
97
97
|
function e(o) {
|
|
98
98
|
return ArrayBuffer.isView(o) ? o.buffer.slice(o.byteOffset, o.byteOffset + o.byteLength) : o;
|
|
99
99
|
}
|
|
100
|
-
r.fromSource = e,
|
|
100
|
+
r.fromSource = e, k(e, "fromSource");
|
|
101
101
|
function t(o) {
|
|
102
102
|
if (typeof Buffer < "u")
|
|
103
103
|
return Buffer.from(o).toString("base64");
|
|
@@ -107,15 +107,15 @@ var Q;
|
|
|
107
107
|
a += String.fromCharCode(c[u]);
|
|
108
108
|
return btoa(a);
|
|
109
109
|
}
|
|
110
|
-
r.toBase64 = t,
|
|
110
|
+
r.toBase64 = t, k(t, "toBase64");
|
|
111
111
|
function i(o) {
|
|
112
112
|
return typeof Buffer < "u" ? e(Buffer.from(o, "base64")) : Uint8Array.from(atob(o), (a) => a.charCodeAt(0));
|
|
113
113
|
}
|
|
114
|
-
r.fromBase64 = i,
|
|
114
|
+
r.fromBase64 = i, k(i, "fromBase64");
|
|
115
115
|
function n(o) {
|
|
116
116
|
return typeof Buffer < "u" ? Buffer.from(o).toString("hex") : Array.from(new Uint8Array(o), (a) => a.toString(16).padStart(2, "0")).join("");
|
|
117
117
|
}
|
|
118
|
-
r.toHex = n,
|
|
118
|
+
r.toHex = n, k(n, "toHex");
|
|
119
119
|
function s(o) {
|
|
120
120
|
if (typeof Buffer < "u") return e(Buffer.from(o, "hex"));
|
|
121
121
|
const a = o.length % 2 === 0 ? o : o.slice(0, o.length - 1), c = [];
|
|
@@ -123,13 +123,13 @@ var Q;
|
|
|
123
123
|
c.push(parseInt(`${a[u]}${a[u + 1]}`, 16));
|
|
124
124
|
return Uint8Array.from(c).buffer;
|
|
125
125
|
}
|
|
126
|
-
r.fromHex = s,
|
|
127
|
-
})(
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
function
|
|
126
|
+
r.fromHex = s, k(s, "fromHex");
|
|
127
|
+
})(J || (J = {}));
|
|
128
|
+
J.fromBase64;
|
|
129
|
+
J.toBase64;
|
|
130
|
+
J.fromHex;
|
|
131
|
+
J.toHex;
|
|
132
|
+
function Le(r, e = /* @__PURE__ */ new Map()) {
|
|
133
133
|
if (!r || typeof r != "object") return r;
|
|
134
134
|
if (se("Date", r)) return new Date(r.valueOf());
|
|
135
135
|
if (se("RegExp", r)) return new RegExp(r.source, r.flags);
|
|
@@ -140,25 +140,25 @@ function Ce(r, e = /* @__PURE__ */ new Map()) {
|
|
|
140
140
|
if (Array.isArray(r)) {
|
|
141
141
|
const n = [];
|
|
142
142
|
return e.set(r, n), r.forEach((s, o) => {
|
|
143
|
-
n[o] = Reflect.apply(
|
|
143
|
+
n[o] = Reflect.apply(Le, null, [s, e]);
|
|
144
144
|
}), n;
|
|
145
145
|
}
|
|
146
146
|
const i = Object.create(Object.getPrototypeOf(r));
|
|
147
147
|
e.set(r, i);
|
|
148
148
|
for (const n of Reflect.ownKeys(r)) {
|
|
149
149
|
const s = { ...Reflect.getOwnPropertyDescriptor(r, n) };
|
|
150
|
-
"value" in s && (s.value = Reflect.apply(
|
|
150
|
+
"value" in s && (s.value = Reflect.apply(Le, null, [s.value, e])), Reflect.defineProperty(i, n, s);
|
|
151
151
|
}
|
|
152
152
|
return i;
|
|
153
153
|
}
|
|
154
|
-
|
|
154
|
+
k(Le, "clone");
|
|
155
155
|
function ce(r, e, t) {
|
|
156
156
|
if (r === e || !t && T(r) && T(e)) return !0;
|
|
157
157
|
if (typeof r != typeof e || typeof r != "object" || !r || !e) return !1;
|
|
158
158
|
function i(n, s) {
|
|
159
159
|
return n(r) ? n(e) ? s(r, e) : !1 : n(e) ? !1 : void 0;
|
|
160
160
|
}
|
|
161
|
-
return
|
|
161
|
+
return k(i, "check"), i(Array.isArray, (n, s) => n.length === s.length && n.every((o, a) => ce(o, s[a]))) ?? i(se("Date"), (n, s) => n.valueOf() === s.valueOf()) ?? i(se("RegExp"), (n, s) => n.source === s.source && n.flags === s.flags) ?? i(Oe, (n, s) => {
|
|
162
162
|
if (n.byteLength !== s.byteLength) return !1;
|
|
163
163
|
const o = new Uint8Array(n), a = new Uint8Array(s);
|
|
164
164
|
for (let c = 0; c < o.length; c++)
|
|
@@ -166,20 +166,20 @@ function ce(r, e, t) {
|
|
|
166
166
|
return !0;
|
|
167
167
|
}) ?? Object.keys({ ...r, ...e }).every((n) => ce(r[n], e[n], t));
|
|
168
168
|
}
|
|
169
|
-
|
|
170
|
-
function
|
|
169
|
+
k(ce, "deepEqual");
|
|
170
|
+
function Dr(r) {
|
|
171
171
|
return r.charAt(0).toUpperCase() + r.slice(1);
|
|
172
172
|
}
|
|
173
|
-
|
|
173
|
+
k(Dr, "capitalize");
|
|
174
174
|
function Nr(r) {
|
|
175
175
|
return r.charAt(0).toLowerCase() + r.slice(1);
|
|
176
176
|
}
|
|
177
|
-
|
|
178
|
-
function
|
|
177
|
+
k(Nr, "uncapitalize");
|
|
178
|
+
function Ur(r) {
|
|
179
179
|
return r.replace(/[_-][a-z]/g, (e) => e.slice(1).toUpperCase());
|
|
180
180
|
}
|
|
181
|
-
|
|
182
|
-
function
|
|
181
|
+
k(Ur, "camelCase");
|
|
182
|
+
function at(r, e, t) {
|
|
183
183
|
const i = [];
|
|
184
184
|
let n = 0;
|
|
185
185
|
for (let s = 0; s < r.length; s++) {
|
|
@@ -195,48 +195,48 @@ function ot(r, e, t) {
|
|
|
195
195
|
}
|
|
196
196
|
return String.fromCharCode(...i);
|
|
197
197
|
}
|
|
198
|
-
|
|
199
|
-
function Ur(r) {
|
|
200
|
-
return ot(r, [45, 95], 45);
|
|
201
|
-
}
|
|
202
|
-
x(Ur, "paramCase");
|
|
198
|
+
k(at, "tokenize");
|
|
203
199
|
function Mr(r) {
|
|
204
|
-
return
|
|
200
|
+
return at(r, [45, 95], 45);
|
|
205
201
|
}
|
|
206
|
-
|
|
202
|
+
k(Mr, "paramCase");
|
|
207
203
|
function Br(r) {
|
|
204
|
+
return at(r, [45, 95], 95);
|
|
205
|
+
}
|
|
206
|
+
k(Br, "snakeCase");
|
|
207
|
+
function Hr(r) {
|
|
208
208
|
return typeof r != "string" ? `[${r.toString()}]` : /^[a-z_$][\w$]*$/i.test(r) ? `.${r}` : `[${JSON.stringify(r)}]`;
|
|
209
209
|
}
|
|
210
|
-
|
|
211
|
-
function
|
|
210
|
+
k(Hr, "formatProperty");
|
|
211
|
+
function Mt(r) {
|
|
212
212
|
return r.replace(/\/$/, "");
|
|
213
213
|
}
|
|
214
|
-
|
|
214
|
+
k(Mt, "trimSlash");
|
|
215
215
|
function Fr(r) {
|
|
216
|
-
return r.startsWith("/") || (r = "/" + r),
|
|
216
|
+
return r.startsWith("/") || (r = "/" + r), Mt(r);
|
|
217
217
|
}
|
|
218
|
-
|
|
219
|
-
var
|
|
218
|
+
k(Fr, "sanitize");
|
|
219
|
+
var St;
|
|
220
220
|
((r) => {
|
|
221
221
|
r.millisecond = 1, r.second = 1e3, r.minute = r.second * 60, r.hour = r.minute * 60, r.day = r.hour * 24, r.week = r.day * 7;
|
|
222
222
|
let e = (/* @__PURE__ */ new Date()).getTimezoneOffset();
|
|
223
223
|
function t(g) {
|
|
224
224
|
e = g;
|
|
225
225
|
}
|
|
226
|
-
r.setTimezoneOffset = t,
|
|
226
|
+
r.setTimezoneOffset = t, k(t, "setTimezoneOffset");
|
|
227
227
|
function i() {
|
|
228
228
|
return e;
|
|
229
229
|
}
|
|
230
|
-
r.getTimezoneOffset = i,
|
|
230
|
+
r.getTimezoneOffset = i, k(i, "getTimezoneOffset");
|
|
231
231
|
function n(g = /* @__PURE__ */ new Date(), b) {
|
|
232
232
|
return typeof g == "number" && (g = new Date(g)), b === void 0 && (b = e), Math.floor((g.valueOf() / r.minute - b) / 1440);
|
|
233
233
|
}
|
|
234
|
-
r.getDateNumber = n,
|
|
234
|
+
r.getDateNumber = n, k(n, "getDateNumber");
|
|
235
235
|
function s(g, b) {
|
|
236
|
-
const
|
|
237
|
-
return b === void 0 && (b = e), new Date(
|
|
236
|
+
const R = new Date(g * r.day);
|
|
237
|
+
return b === void 0 && (b = e), new Date(+R + b * r.minute);
|
|
238
238
|
}
|
|
239
|
-
r.fromDateNumber = s,
|
|
239
|
+
r.fromDateNumber = s, k(s, "fromDateNumber");
|
|
240
240
|
const o = /\d+(?:\.\d+)?/.source, a = new RegExp(`^${[
|
|
241
241
|
"w(?:eek(?:s)?)?",
|
|
242
242
|
"d(?:ay(?:s)?)?",
|
|
@@ -248,27 +248,27 @@ var kt;
|
|
|
248
248
|
const b = a.exec(g);
|
|
249
249
|
return b ? (parseFloat(b[1]) * r.week || 0) + (parseFloat(b[2]) * r.day || 0) + (parseFloat(b[3]) * r.hour || 0) + (parseFloat(b[4]) * r.minute || 0) + (parseFloat(b[5]) * r.second || 0) : 0;
|
|
250
250
|
}
|
|
251
|
-
r.parseTime = c,
|
|
251
|
+
r.parseTime = c, k(c, "parseTime");
|
|
252
252
|
function u(g) {
|
|
253
253
|
const b = c(g);
|
|
254
254
|
return b ? g = Date.now() + b : /^\d{1,2}(:\d{1,2}){1,2}$/.test(g) ? g = `${(/* @__PURE__ */ new Date()).toLocaleDateString()}-${g}` : /^\d{1,2}-\d{1,2}-\d{1,2}(:\d{1,2}){1,2}$/.test(g) && (g = `${(/* @__PURE__ */ new Date()).getFullYear()}-${g}`), g ? new Date(g) : /* @__PURE__ */ new Date();
|
|
255
255
|
}
|
|
256
|
-
r.parseDate = u,
|
|
256
|
+
r.parseDate = u, k(u, "parseDate");
|
|
257
257
|
function p(g) {
|
|
258
258
|
const b = Math.abs(g);
|
|
259
259
|
return b >= r.day - r.hour / 2 ? Math.round(g / r.day) + "d" : b >= r.hour - r.minute / 2 ? Math.round(g / r.hour) + "h" : b >= r.minute - r.second / 2 ? Math.round(g / r.minute) + "m" : b >= r.second ? Math.round(g / r.second) + "s" : g + "ms";
|
|
260
260
|
}
|
|
261
|
-
r.format = p,
|
|
261
|
+
r.format = p, k(p, "format");
|
|
262
262
|
function y(g, b = 2) {
|
|
263
263
|
return g.toString().padStart(b, "0");
|
|
264
264
|
}
|
|
265
|
-
r.toDigits = y,
|
|
265
|
+
r.toDigits = y, k(y, "toDigits");
|
|
266
266
|
function w(g, b = /* @__PURE__ */ new Date()) {
|
|
267
267
|
return g.replace("yyyy", b.getFullYear().toString()).replace("yy", b.getFullYear().toString().slice(2)).replace("MM", y(b.getMonth() + 1)).replace("dd", y(b.getDate())).replace("hh", y(b.getHours())).replace("mm", y(b.getMinutes())).replace("ss", y(b.getSeconds())).replace("SSS", y(b.getMilliseconds(), 3));
|
|
268
268
|
}
|
|
269
|
-
r.template = w,
|
|
270
|
-
})(
|
|
271
|
-
var
|
|
269
|
+
r.template = w, k(w, "template");
|
|
270
|
+
})(St || (St = {}));
|
|
271
|
+
var zr = Object.defineProperty, x = (r, e) => zr(r, "name", { value: e, configurable: !0 }), _ = {
|
|
272
272
|
// internal symbols
|
|
273
273
|
shadow: Symbol.for("cordis.shadow"),
|
|
274
274
|
receiver: Symbol.for("cordis.receiver"),
|
|
@@ -289,126 +289,126 @@ var Hr = Object.defineProperty, k = (r, e) => Hr(r, "name", { value: e, configur
|
|
|
289
289
|
tracker: Symbol.for("cordis.tracker"),
|
|
290
290
|
provide: Symbol.for("cordis.provide"),
|
|
291
291
|
immediate: Symbol.for("cordis.immediate")
|
|
292
|
-
},
|
|
292
|
+
}, qr = function* () {
|
|
293
293
|
}.constructor, xt = async function* () {
|
|
294
294
|
}.constructor;
|
|
295
|
-
function
|
|
296
|
-
return !(!r.prototype || r instanceof
|
|
295
|
+
function ct(r) {
|
|
296
|
+
return !(!r.prototype || r instanceof qr || xt !== Function && r instanceof xt);
|
|
297
297
|
}
|
|
298
|
-
|
|
299
|
-
function
|
|
298
|
+
x(ct, "isConstructor");
|
|
299
|
+
function Re(r, e) {
|
|
300
300
|
const t = r.Config || r.schema;
|
|
301
301
|
return t && r.schema !== !1 && (e = t(e)), e ?? {};
|
|
302
302
|
}
|
|
303
|
-
|
|
304
|
-
function
|
|
303
|
+
x(Re, "resolveConfig");
|
|
304
|
+
function Bt(r) {
|
|
305
305
|
return [Map, Set, Date, Promise].some((e) => r instanceof e);
|
|
306
306
|
}
|
|
307
|
-
|
|
308
|
-
function
|
|
307
|
+
x(Bt, "isUnproxyable");
|
|
308
|
+
function lt(r, e) {
|
|
309
309
|
if (r === Object.prototype) return e;
|
|
310
|
-
const t = Object.create(
|
|
310
|
+
const t = Object.create(lt(Object.getPrototypeOf(r), e));
|
|
311
311
|
for (const i of Reflect.ownKeys(r))
|
|
312
312
|
Object.defineProperty(t, i, Object.getOwnPropertyDescriptor(r, i));
|
|
313
313
|
return t;
|
|
314
314
|
}
|
|
315
|
-
|
|
316
|
-
function
|
|
315
|
+
x(lt, "joinPrototype");
|
|
316
|
+
function ut(r) {
|
|
317
317
|
return r && (typeof r == "object" || typeof r == "function");
|
|
318
318
|
}
|
|
319
|
-
|
|
319
|
+
x(ut, "isObject");
|
|
320
320
|
function Z(r, e, t) {
|
|
321
|
-
if (!
|
|
321
|
+
if (!ut(e)) return e;
|
|
322
322
|
if (Object.hasOwn(e, _.shadow))
|
|
323
323
|
return Object.getPrototypeOf(e);
|
|
324
324
|
const i = e[_.tracker];
|
|
325
|
-
return i ?
|
|
325
|
+
return i ? ze(r, e, i, t) : e;
|
|
326
326
|
}
|
|
327
|
-
|
|
328
|
-
function
|
|
327
|
+
x(Z, "getTraceable");
|
|
328
|
+
function ke(r, e) {
|
|
329
329
|
return e ? new Proxy(r, {
|
|
330
|
-
get: /* @__PURE__ */
|
|
331
|
-
set: /* @__PURE__ */
|
|
330
|
+
get: /* @__PURE__ */ x((t, i, n) => i in e && i !== "constructor" ? Reflect.get(e, i, n) : Reflect.get(t, i, n), "get"),
|
|
331
|
+
set: /* @__PURE__ */ x((t, i, n, s) => i in e && i !== "constructor" ? Reflect.set(e, i, n, s) : Reflect.set(t, i, n, s), "set")
|
|
332
332
|
}) : r;
|
|
333
333
|
}
|
|
334
|
-
|
|
334
|
+
x(ke, "withProps");
|
|
335
335
|
function je(r, e, t) {
|
|
336
|
-
return
|
|
336
|
+
return ke(r, Object.defineProperty(/* @__PURE__ */ Object.create(null), e, {
|
|
337
337
|
value: t,
|
|
338
338
|
writable: !1
|
|
339
339
|
}));
|
|
340
340
|
}
|
|
341
|
-
|
|
342
|
-
function
|
|
341
|
+
x(je, "withProp");
|
|
342
|
+
function Ge(r, e, t, i) {
|
|
343
343
|
if (!t) return i;
|
|
344
344
|
const n = Reflect.getOwnPropertyDescriptor(e, t)?.value;
|
|
345
345
|
return n ? je(i, t, r.extend({ [_.shadow]: n })) : i;
|
|
346
346
|
}
|
|
347
|
-
|
|
347
|
+
x(Ge, "createShadow");
|
|
348
348
|
function Ht(r, e, t, i) {
|
|
349
349
|
return new Proxy(e, {
|
|
350
|
-
apply: /* @__PURE__ */
|
|
351
|
-
get: /* @__PURE__ */
|
|
350
|
+
apply: /* @__PURE__ */ x((n, s, o) => (s === t && (s = i), o = o.map((a) => typeof a != "function" || a[_.original] ? a : new Proxy(a, {
|
|
351
|
+
get: /* @__PURE__ */ x((c, u, p) => {
|
|
352
352
|
if (u === _.original) return c;
|
|
353
353
|
const y = Reflect.get(c, u, p);
|
|
354
354
|
return u === "toString" && y === Function.prototype.toString ? function(...w) {
|
|
355
355
|
return Reflect.apply(y, this === p ? c : this, w);
|
|
356
356
|
} : y;
|
|
357
357
|
}, "get"),
|
|
358
|
-
apply: /* @__PURE__ */
|
|
359
|
-
construct: /* @__PURE__ */
|
|
358
|
+
apply: /* @__PURE__ */ x((c, u, p) => Reflect.apply(c, Z(r, u), p.map((y) => Z(r, y))), "apply"),
|
|
359
|
+
construct: /* @__PURE__ */ x((c, u, p) => Reflect.construct(c, u.map((y) => Z(r, y)), p), "construct")
|
|
360
360
|
})), Z(r, Reflect.apply(n, s, o))), "apply")
|
|
361
361
|
});
|
|
362
362
|
}
|
|
363
|
-
|
|
364
|
-
function
|
|
363
|
+
x(Ht, "createShadowMethod");
|
|
364
|
+
function ze(r, e, t, i) {
|
|
365
365
|
r[_.shadow] && (r = Object.getPrototypeOf(r));
|
|
366
366
|
const n = new Proxy(e, {
|
|
367
|
-
get: /* @__PURE__ */
|
|
367
|
+
get: /* @__PURE__ */ x((s, o, a) => {
|
|
368
368
|
if (o === _.original) return s;
|
|
369
369
|
if (o === t.property) return r;
|
|
370
370
|
if (typeof o == "symbol")
|
|
371
371
|
return Reflect.get(s, o, a);
|
|
372
372
|
if (t.associate && r[_.internal][`${t.associate}.${o}`])
|
|
373
373
|
return Reflect.get(r, `${t.associate}.${o}`, je(r, _.receiver, a));
|
|
374
|
-
const c =
|
|
375
|
-
return p ?
|
|
374
|
+
const c = Ge(r, s, t.property, a), u = Reflect.get(s, o, c), p = u?.[_.tracker];
|
|
375
|
+
return p ? ze(r, u, p) : !i && typeof u == "function" ? Ht(r, u, a, c) : u;
|
|
376
376
|
}, "get"),
|
|
377
|
-
set: /* @__PURE__ */
|
|
377
|
+
set: /* @__PURE__ */ x((s, o, a, c) => {
|
|
378
378
|
if (o === _.original || o === t.property) return !1;
|
|
379
379
|
if (typeof o == "symbol")
|
|
380
380
|
return Reflect.set(s, o, a, c);
|
|
381
381
|
if (t.associate && r[_.internal][`${t.associate}.${o}`])
|
|
382
382
|
return Reflect.set(r, `${t.associate}.${o}`, a, je(r, _.receiver, c));
|
|
383
|
-
const u =
|
|
383
|
+
const u = Ge(r, s, t.property, c);
|
|
384
384
|
return Reflect.set(s, o, a, u);
|
|
385
385
|
}, "set"),
|
|
386
|
-
apply: /* @__PURE__ */
|
|
386
|
+
apply: /* @__PURE__ */ x((s, o, a) => ht(n, s, o, a), "apply")
|
|
387
387
|
});
|
|
388
388
|
return n;
|
|
389
389
|
}
|
|
390
|
-
|
|
391
|
-
function
|
|
390
|
+
x(ze, "createTraceable");
|
|
391
|
+
function ht(r, e, t, i) {
|
|
392
392
|
return e[_.invoke] ? e[_.invoke].apply(r, i) : Reflect.apply(e, t, i);
|
|
393
393
|
}
|
|
394
|
-
|
|
395
|
-
function
|
|
396
|
-
const i = /* @__PURE__ */
|
|
397
|
-
const s =
|
|
398
|
-
return
|
|
394
|
+
x(ht, "applyTraceable");
|
|
395
|
+
function Xe(r, e, t) {
|
|
396
|
+
const i = /* @__PURE__ */ x(function(...n) {
|
|
397
|
+
const s = ze(i.ctx, i, t);
|
|
398
|
+
return ht(s, i, this, n);
|
|
399
399
|
}, "self");
|
|
400
|
-
return
|
|
400
|
+
return N(i, "name", r), Object.setPrototypeOf(i, e);
|
|
401
401
|
}
|
|
402
|
-
|
|
403
|
-
var
|
|
402
|
+
x(Xe, "createCallable");
|
|
403
|
+
var Kr = class de {
|
|
404
404
|
constructor(e) {
|
|
405
|
-
this.ctx = e,
|
|
405
|
+
this.ctx = e, N(this, _.tracker, {
|
|
406
406
|
associate: "reflect",
|
|
407
407
|
property: "ctx"
|
|
408
408
|
}), 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
409
|
}
|
|
410
410
|
static {
|
|
411
|
-
|
|
411
|
+
x(this, "ReflectService");
|
|
412
412
|
}
|
|
413
413
|
static resolveInject(e, t) {
|
|
414
414
|
let i = e[_.internal][t];
|
|
@@ -424,19 +424,19 @@ var qr = class de {
|
|
|
424
424
|
`), e.emit(e, "internal/warning", i);
|
|
425
425
|
}
|
|
426
426
|
static handler = {
|
|
427
|
-
get: /* @__PURE__ */
|
|
427
|
+
get: /* @__PURE__ */ x((e, t, i) => {
|
|
428
428
|
if (typeof t != "string") return Reflect.get(e, t, i);
|
|
429
429
|
if (Reflect.has(e, t))
|
|
430
430
|
return Z(i, Reflect.get(e, t, i), !0);
|
|
431
431
|
const [n, s] = de.resolveInject(e, t), o = new Error(`property ${n} is not registered, declare it as \`inject\` to suppress this warning`);
|
|
432
432
|
return s ? s.type === "accessor" ? s.get.call(i, i[_.receiver]) : (s.builtin || de.checkInject(i, n, o), i.reflect.get(n)) : (de.checkInject(i, n, o), Reflect.get(e, n, i));
|
|
433
433
|
}, "get"),
|
|
434
|
-
set: /* @__PURE__ */
|
|
434
|
+
set: /* @__PURE__ */ x((e, t, i, n) => {
|
|
435
435
|
if (typeof t != "string") return Reflect.set(e, t, i, n);
|
|
436
436
|
const [s, o] = de.resolveInject(e, t);
|
|
437
437
|
return o ? o.type === "accessor" ? o.set ? o.set.call(n, i, n[_.receiver]) : !1 : (n.reflect.set(s, i), !0) : Reflect.set(e, s, i, n);
|
|
438
438
|
}, "set"),
|
|
439
|
-
has: /* @__PURE__ */
|
|
439
|
+
has: /* @__PURE__ */ x((e, t) => {
|
|
440
440
|
if (typeof t != "string") return Reflect.has(e, t);
|
|
441
441
|
if (Reflect.has(e, t)) return !0;
|
|
442
442
|
const [, i] = de.resolveInject(e, t);
|
|
@@ -452,7 +452,7 @@ var qr = class de {
|
|
|
452
452
|
this.provide(e);
|
|
453
453
|
const i = this.ctx[_.isolate][e], n = this.ctx[_.store][i]?.value;
|
|
454
454
|
t ??= void 0;
|
|
455
|
-
let s = /* @__PURE__ */
|
|
455
|
+
let s = /* @__PURE__ */ x(() => {
|
|
456
456
|
}, "dispose");
|
|
457
457
|
if (n === t) return s;
|
|
458
458
|
if (!T(t) && !T(n))
|
|
@@ -460,7 +460,7 @@ var qr = class de {
|
|
|
460
460
|
const o = this.ctx;
|
|
461
461
|
T(t) || (s = o.effect(() => () => {
|
|
462
462
|
o.set(e, void 0);
|
|
463
|
-
})),
|
|
463
|
+
})), Bt(t) && o.emit(o, "internal/warning", new Error(`service ${e} is an unproxyable object, which may lead to unexpected behavior`));
|
|
464
464
|
const a = Object.create(o);
|
|
465
465
|
return a[_.filter] = (c) => o[_.isolate][e] === c[_.isolate][e], o.emit(a, "internal/before-service", e, t), o[_.store][i] = { value: t, source: o }, o.emit(a, "internal/service", e, n), s;
|
|
466
466
|
}
|
|
@@ -468,7 +468,7 @@ var qr = class de {
|
|
|
468
468
|
const n = this.ctx.root[_.internal];
|
|
469
469
|
if (e in n) return;
|
|
470
470
|
const s = Symbol(e);
|
|
471
|
-
n[e] = { type: "service", builtin: i }, this.ctx.root[_.isolate][e] = s,
|
|
471
|
+
n[e] = { type: "service", builtin: i }, this.ctx.root[_.isolate][e] = s, ut(t) && (this.ctx[_.store][s] = { value: t, source: null }, N(t, _.tracker, {
|
|
472
472
|
associate: e,
|
|
473
473
|
property: "ctx"
|
|
474
474
|
}));
|
|
@@ -492,11 +492,11 @@ var qr = class de {
|
|
|
492
492
|
get(c) {
|
|
493
493
|
const u = n(this);
|
|
494
494
|
if (T(u)) return u;
|
|
495
|
-
const p = c ?
|
|
495
|
+
const p = c ? ke(c, u) : u, y = Reflect.get(u, o, p);
|
|
496
496
|
return typeof y != "function" ? y : y.bind(p ?? u);
|
|
497
497
|
},
|
|
498
498
|
set(c, u) {
|
|
499
|
-
const p = n(this), y = u ?
|
|
499
|
+
const p = n(this), y = u ? ke(u, p) : p;
|
|
500
500
|
return Reflect.set(p, o, c, y);
|
|
501
501
|
}
|
|
502
502
|
}));
|
|
@@ -510,59 +510,59 @@ var qr = class de {
|
|
|
510
510
|
}
|
|
511
511
|
bind(e) {
|
|
512
512
|
return new Proxy(e, {
|
|
513
|
-
apply: /* @__PURE__ */
|
|
513
|
+
apply: /* @__PURE__ */ x((t, i, n) => t.apply(this.trace(i), n.map((s) => this.trace(s))), "apply")
|
|
514
514
|
});
|
|
515
515
|
}
|
|
516
|
-
},
|
|
517
|
-
function
|
|
516
|
+
}, Ve = Kr;
|
|
517
|
+
function Qe(r) {
|
|
518
518
|
return r !== null && r !== !1 && r !== void 0;
|
|
519
519
|
}
|
|
520
|
-
|
|
521
|
-
var
|
|
520
|
+
x(Qe, "isBailed");
|
|
521
|
+
var Wr = class {
|
|
522
522
|
constructor(r) {
|
|
523
|
-
this.ctx = r,
|
|
523
|
+
this.ctx = r, N(this, _.tracker, {
|
|
524
524
|
associate: "lifecycle",
|
|
525
525
|
property: "ctx"
|
|
526
|
-
}),
|
|
526
|
+
}), N(this.on("internal/listener", function(t, i, n) {
|
|
527
527
|
const s = n.prepend ? "unshift" : "push";
|
|
528
528
|
if (t === "ready")
|
|
529
529
|
return this.lifecycle.isActive ? (this.scope.ensure(async () => i()), () => !1) : void 0;
|
|
530
530
|
if (t === "dispose")
|
|
531
|
-
return this.scope.disposables[s](i),
|
|
531
|
+
return this.scope.disposables[s](i), N(i, "name", "event <dispose>"), () => ne(this.scope.disposables, i);
|
|
532
532
|
if (t === "fork")
|
|
533
533
|
return this.scope.runtime.forkables[s](i), this.scope.collect("event <fork>", () => ne(this.scope.runtime.forkables, i));
|
|
534
|
-
}),
|
|
534
|
+
}), q.static, r.scope);
|
|
535
535
|
for (const t of ["info", "error", "warning"])
|
|
536
|
-
|
|
536
|
+
N(this.on(`internal/${t}`, (i, ...n) => {
|
|
537
537
|
this._hooks[`internal/${t}`].length > 1;
|
|
538
|
-
}),
|
|
539
|
-
|
|
538
|
+
}), q.static, r.scope);
|
|
539
|
+
N(this.on("internal/before-service", function(t) {
|
|
540
540
|
for (const i of this.registry.values()) {
|
|
541
541
|
if (!i.inject[t]?.required) continue;
|
|
542
542
|
const n = i.isReusable ? i.children : [i];
|
|
543
543
|
for (const s of n)
|
|
544
544
|
this[_.filter](s.ctx) && (s.updateStatus(), s.reset());
|
|
545
545
|
}
|
|
546
|
-
}, { global: !0 }),
|
|
546
|
+
}, { global: !0 }), q.static, r.scope), N(this.on("internal/service", function(t) {
|
|
547
547
|
for (const i of this.registry.values()) {
|
|
548
548
|
if (!i.inject[t]?.required) continue;
|
|
549
549
|
const n = i.isReusable ? i.children : [i];
|
|
550
550
|
for (const s of n)
|
|
551
551
|
this[_.filter](s.ctx) && s.start();
|
|
552
552
|
}
|
|
553
|
-
}, { global: !0 }),
|
|
554
|
-
const e = /* @__PURE__ */
|
|
553
|
+
}, { global: !0 }), q.static, r.scope);
|
|
554
|
+
const e = /* @__PURE__ */ x((t, i) => {
|
|
555
555
|
if (!t.runtime.plugin) return !1;
|
|
556
556
|
for (const n in t.runtime.inject)
|
|
557
|
-
if (i ===
|
|
557
|
+
if (i === Ve.resolveInject(t.ctx, n)[0]) return !0;
|
|
558
558
|
return e(t.parent.scope, i);
|
|
559
559
|
}, "checkInject");
|
|
560
|
-
|
|
560
|
+
N(this.on("internal/inject", function(t) {
|
|
561
561
|
return e(this.scope, t);
|
|
562
|
-
}, { global: !0 }),
|
|
562
|
+
}, { global: !0 }), q.static, r.scope);
|
|
563
563
|
}
|
|
564
564
|
static {
|
|
565
|
-
|
|
565
|
+
x(this, "Lifecycle");
|
|
566
566
|
}
|
|
567
567
|
isActive = !1;
|
|
568
568
|
_tasks = /* @__PURE__ */ new Set();
|
|
@@ -573,7 +573,7 @@ var Kr = class {
|
|
|
573
573
|
}
|
|
574
574
|
filterHooks(r, e) {
|
|
575
575
|
return e = Z(this.ctx, e), r.slice().filter((t) => {
|
|
576
|
-
const i = e?.[
|
|
576
|
+
const i = e?.[q.filter];
|
|
577
577
|
return t.global || !i || i.call(e, t.ctx);
|
|
578
578
|
});
|
|
579
579
|
}
|
|
@@ -591,11 +591,11 @@ var Kr = class {
|
|
|
591
591
|
}
|
|
592
592
|
async serial(...r) {
|
|
593
593
|
for await (const e of this.dispatch("serial", r))
|
|
594
|
-
if (
|
|
594
|
+
if (Qe(e)) return e;
|
|
595
595
|
}
|
|
596
596
|
bail(...r) {
|
|
597
597
|
for (const e of this.dispatch("bail", r))
|
|
598
|
-
if (
|
|
598
|
+
if (Qe(e)) return e;
|
|
599
599
|
}
|
|
600
600
|
register(r, e, t, i) {
|
|
601
601
|
const n = i.prepend ? "unshift" : "push";
|
|
@@ -631,12 +631,12 @@ var Kr = class {
|
|
|
631
631
|
async stop() {
|
|
632
632
|
this.isActive = !1, this.ctx.scope.reset();
|
|
633
633
|
}
|
|
634
|
-
},
|
|
634
|
+
}, Yr = Wr, Je = class Ft extends Error {
|
|
635
635
|
constructor(e, t) {
|
|
636
|
-
super(t ??
|
|
636
|
+
super(t ?? Ft.Code[e]), this.code = e;
|
|
637
637
|
}
|
|
638
638
|
static {
|
|
639
|
-
|
|
639
|
+
x(this, "CordisError");
|
|
640
640
|
}
|
|
641
641
|
};
|
|
642
642
|
((r) => {
|
|
@@ -644,14 +644,14 @@ var Kr = class {
|
|
|
644
644
|
INACTIVE_EFFECT: "cannot create effect on inactive context"
|
|
645
645
|
};
|
|
646
646
|
})(Je || (Je = {}));
|
|
647
|
-
var
|
|
647
|
+
var zt = class {
|
|
648
648
|
constructor(r, e) {
|
|
649
649
|
this.parent = r, this.config = e, this.uid = r.registry ? r.registry.counter : 0, this.ctx = this.context = r.extend({ scope: this }), this.proxy = new Proxy({}, {
|
|
650
|
-
get: /* @__PURE__ */
|
|
650
|
+
get: /* @__PURE__ */ x((t, i) => Reflect.get(this.config, i), "get")
|
|
651
651
|
});
|
|
652
652
|
}
|
|
653
653
|
static {
|
|
654
|
-
|
|
654
|
+
x(this, "EffectScope");
|
|
655
655
|
}
|
|
656
656
|
uid;
|
|
657
657
|
ctx;
|
|
@@ -674,16 +674,16 @@ var qt = class {
|
|
|
674
674
|
}
|
|
675
675
|
effect(r, e) {
|
|
676
676
|
this.assertActive();
|
|
677
|
-
const t =
|
|
677
|
+
const t = ct(r) ? new r(this.ctx, e) : r(this.ctx, e);
|
|
678
678
|
let i = !1;
|
|
679
|
-
const n = typeof t == "function" ? t : t.dispose.bind(t), s = /* @__PURE__ */
|
|
679
|
+
const n = typeof t == "function" ? t : t.dispose.bind(t), s = /* @__PURE__ */ x((...o) => {
|
|
680
680
|
if (!i)
|
|
681
681
|
return i = !0, ne(this.disposables, s), n(...o);
|
|
682
682
|
}, "wrapped");
|
|
683
683
|
return this.disposables.push(s), typeof t == "function" ? s : (t.dispose = s, t);
|
|
684
684
|
}
|
|
685
685
|
collect(r, e) {
|
|
686
|
-
const t =
|
|
686
|
+
const t = N(() => (ne(this.disposables, t), e()), "name", r);
|
|
687
687
|
return this.disposables.push(t), t;
|
|
688
688
|
}
|
|
689
689
|
restart() {
|
|
@@ -712,7 +712,7 @@ var qt = class {
|
|
|
712
712
|
}
|
|
713
713
|
reset() {
|
|
714
714
|
this.isActive = !1, this.disposables = this.disposables.splice(0).filter((r) => {
|
|
715
|
-
if (this.uid !== null && r[
|
|
715
|
+
if (this.uid !== null && r[q.static] === this) return !0;
|
|
716
716
|
(async () => r())().catch((e) => {
|
|
717
717
|
this.context.emit(this.ctx, "internal/error", e);
|
|
718
718
|
});
|
|
@@ -735,7 +735,7 @@ var qt = class {
|
|
|
735
735
|
checkUpdate(r, e) {
|
|
736
736
|
if (e || !this.config) return [!0, !0];
|
|
737
737
|
if (e === !1) return [!1, !1];
|
|
738
|
-
const t = /* @__PURE__ */ Object.create(null), i = /* @__PURE__ */
|
|
738
|
+
const t = /* @__PURE__ */ Object.create(null), i = /* @__PURE__ */ x((c) => {
|
|
739
739
|
const u = t[c] ??= !ce(this.config[c], r[c]);
|
|
740
740
|
return s ||= u, u;
|
|
741
741
|
}, "checkPropertyUpdate"), n = /* @__PURE__ */ new Set();
|
|
@@ -760,16 +760,16 @@ var qt = class {
|
|
|
760
760
|
}
|
|
761
761
|
return [s, o];
|
|
762
762
|
}
|
|
763
|
-
},
|
|
763
|
+
}, Gr = class extends zt {
|
|
764
764
|
constructor(r, e, t, i) {
|
|
765
|
-
super(r, t), this.runtime = e, this.dispose =
|
|
765
|
+
super(r, t), this.runtime = e, this.dispose = N(r.scope.collect(`fork <${r.runtime.name}>`, () => {
|
|
766
766
|
this.uid = null, this.reset(), this.context.emit("internal/fork", this);
|
|
767
767
|
const n = ne(e.disposables, this.dispose);
|
|
768
768
|
return ne(e.children, this) && !e.children.length && r.registry.delete(e.plugin), n;
|
|
769
|
-
}),
|
|
769
|
+
}), q.static, e), e.children.push(this), e.disposables.push(this.dispose), this.context.emit("internal/fork", this), this.init(i);
|
|
770
770
|
}
|
|
771
771
|
static {
|
|
772
|
-
|
|
772
|
+
x(this, "ForkScope");
|
|
773
773
|
}
|
|
774
774
|
dispose;
|
|
775
775
|
start() {
|
|
@@ -782,19 +782,19 @@ var qt = class {
|
|
|
782
782
|
if (i.config !== t) return;
|
|
783
783
|
let n;
|
|
784
784
|
try {
|
|
785
|
-
n =
|
|
785
|
+
n = Re(this.runtime.plugin, r);
|
|
786
786
|
} catch (a) {
|
|
787
787
|
return this.context.emit("internal/error", a), this.cancel(a);
|
|
788
788
|
}
|
|
789
789
|
const [s, o] = i.checkUpdate(n, e);
|
|
790
790
|
this.context.emit("internal/before-update", this, r), this.config = n, i.config = n, s && this.context.emit("internal/update", this, t), o && i.restart();
|
|
791
791
|
}
|
|
792
|
-
},
|
|
792
|
+
}, kt = class extends zt {
|
|
793
793
|
constructor(r, e, t, i) {
|
|
794
794
|
super(r, t), this.plugin = e, e ? (this.setup(), this.init(i)) : (this.name = "root", this.isActive = !0);
|
|
795
795
|
}
|
|
796
796
|
static {
|
|
797
|
-
|
|
797
|
+
x(this, "MainScope");
|
|
798
798
|
}
|
|
799
799
|
value;
|
|
800
800
|
runtime = this;
|
|
@@ -809,7 +809,7 @@ var qt = class {
|
|
|
809
809
|
return this.forkables.length > 0;
|
|
810
810
|
}
|
|
811
811
|
fork(r, e, t) {
|
|
812
|
-
return new
|
|
812
|
+
return new Gr(r, this, e, t);
|
|
813
813
|
}
|
|
814
814
|
dispose() {
|
|
815
815
|
return this.uid = null, this.reset(), this.context.emit("internal/runtime", this), !0;
|
|
@@ -818,11 +818,11 @@ var qt = class {
|
|
|
818
818
|
const { name: r } = this.plugin;
|
|
819
819
|
r && r !== "apply" && (this.name = r), this.schema = this.plugin.Config || this.plugin.schema, this.inject = le.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);
|
|
820
820
|
}
|
|
821
|
-
apply = /* @__PURE__ */
|
|
821
|
+
apply = /* @__PURE__ */ x((r, e) => {
|
|
822
822
|
if (typeof this.plugin != "function")
|
|
823
823
|
return this.plugin.apply(r, e);
|
|
824
|
-
if (
|
|
825
|
-
const t = new this.plugin(r, e), i = t[
|
|
824
|
+
if (ct(this.plugin)) {
|
|
825
|
+
const t = new this.plugin(r, e), i = t[q.expose];
|
|
826
826
|
return i && r.set(i, t), t.fork && this.forkables.push(t.fork.bind(t)), t;
|
|
827
827
|
} else
|
|
828
828
|
return this.plugin(r, e);
|
|
@@ -846,7 +846,7 @@ var qt = class {
|
|
|
846
846
|
const t = this.config;
|
|
847
847
|
let i;
|
|
848
848
|
try {
|
|
849
|
-
i =
|
|
849
|
+
i = Re(this.runtime.plugin || this.context.constructor, r);
|
|
850
850
|
} catch (a) {
|
|
851
851
|
return this.context.emit("internal/error", a), this.cancel(a);
|
|
852
852
|
}
|
|
@@ -854,10 +854,10 @@ var qt = class {
|
|
|
854
854
|
this.config = i, o && (this.context.emit("internal/before-update", o, r), o.config = i, n && this.context.emit("internal/update", o, t)), s && this.restart();
|
|
855
855
|
}
|
|
856
856
|
};
|
|
857
|
-
function
|
|
857
|
+
function qt(r) {
|
|
858
858
|
return r && typeof r == "object" && typeof r.apply == "function";
|
|
859
859
|
}
|
|
860
|
-
|
|
860
|
+
x(qt, "isApplicable");
|
|
861
861
|
function le(r) {
|
|
862
862
|
return function(e, t) {
|
|
863
863
|
if (t.kind === "class")
|
|
@@ -867,14 +867,14 @@ function le(r) {
|
|
|
867
867
|
const i = this[_.tracker]?.property;
|
|
868
868
|
if (!i) throw new Error("missing context tracker");
|
|
869
869
|
this[i].inject(r, (n) => {
|
|
870
|
-
e.call(
|
|
870
|
+
e.call(ke(this, { [i]: n }));
|
|
871
871
|
});
|
|
872
872
|
});
|
|
873
873
|
else
|
|
874
874
|
throw new Error("@Inject can only be used on class or class methods");
|
|
875
875
|
};
|
|
876
876
|
}
|
|
877
|
-
|
|
877
|
+
x(le, "Inject");
|
|
878
878
|
((r) => {
|
|
879
879
|
function e(t) {
|
|
880
880
|
if (!t) return {};
|
|
@@ -883,19 +883,19 @@ k(le, "Inject");
|
|
|
883
883
|
const { required: i, optional: n, ...s } = t;
|
|
884
884
|
return Array.isArray(i) && Object.assign(s, Object.fromEntries(i.map((o) => [o, { required: !0 }]))), Array.isArray(n) && Object.assign(s, Object.fromEntries(n.map((o) => [o, { required: !1 }]))), s;
|
|
885
885
|
}
|
|
886
|
-
r.resolve = e,
|
|
886
|
+
r.resolve = e, x(e, "resolve");
|
|
887
887
|
})(le || (le = {}));
|
|
888
|
-
var
|
|
888
|
+
var Xr = class {
|
|
889
889
|
constructor(r, e) {
|
|
890
|
-
this.ctx = r,
|
|
890
|
+
this.ctx = r, N(this, _.tracker, {
|
|
891
891
|
associate: "registry",
|
|
892
892
|
property: "ctx"
|
|
893
893
|
}), this.context = r;
|
|
894
|
-
const t = new
|
|
894
|
+
const t = new kt(r, null, e);
|
|
895
895
|
r.scope = t, t.ctx = r, this.set(null, t);
|
|
896
896
|
}
|
|
897
897
|
static {
|
|
898
|
-
|
|
898
|
+
x(this, "Registry");
|
|
899
899
|
}
|
|
900
900
|
_counter = 0;
|
|
901
901
|
_internal = /* @__PURE__ */ new Map();
|
|
@@ -908,7 +908,7 @@ var Gr = class {
|
|
|
908
908
|
}
|
|
909
909
|
resolve(r, e = !1) {
|
|
910
910
|
if (r === null || typeof r == "function") return r;
|
|
911
|
-
if (
|
|
911
|
+
if (qt(r)) return r.apply;
|
|
912
912
|
if (e) throw new Error('invalid plugin, expect function or object with an "apply" method, received ' + typeof r);
|
|
913
913
|
}
|
|
914
914
|
get(r) {
|
|
@@ -949,16 +949,16 @@ var Gr = class {
|
|
|
949
949
|
plugin(r, e, t) {
|
|
950
950
|
if (this.resolve(r, !0), this.ctx.scope.assertActive(), !t)
|
|
951
951
|
try {
|
|
952
|
-
e =
|
|
952
|
+
e = Re(r, e);
|
|
953
953
|
} catch (n) {
|
|
954
954
|
this.context.emit(this.ctx, "internal/error", n), t = n, e = null;
|
|
955
955
|
}
|
|
956
956
|
let i = this.get(r);
|
|
957
|
-
return i ? (i.isForkable || this.context.emit(this.ctx, "internal/warning", new Error(`duplicate plugin detected: ${r.name}`)), i.fork(this.ctx, e, t)) : (i = new
|
|
957
|
+
return i ? (i.isForkable || this.context.emit(this.ctx, "internal/warning", new Error(`duplicate plugin detected: ${r.name}`)), i.fork(this.ctx, e, t)) : (i = new kt(this.ctx, r, e, t), this.set(r, i), i.fork(this.ctx, e, t));
|
|
958
958
|
}
|
|
959
|
-
},
|
|
959
|
+
}, Vr = Xr, q = class we {
|
|
960
960
|
static {
|
|
961
|
-
|
|
961
|
+
x(this, "Context");
|
|
962
962
|
}
|
|
963
963
|
static store = _.store;
|
|
964
964
|
static events = _.events;
|
|
@@ -981,15 +981,15 @@ var Gr = class {
|
|
|
981
981
|
return e;
|
|
982
982
|
}
|
|
983
983
|
constructor(e) {
|
|
984
|
-
e =
|
|
985
|
-
const t = new Proxy(this,
|
|
986
|
-
t.root = t, t.reflect = new
|
|
987
|
-
const i = /* @__PURE__ */
|
|
984
|
+
e = Re(this.constructor, e), this[_.store] = /* @__PURE__ */ Object.create(null), this[_.isolate] = /* @__PURE__ */ Object.create(null), this[_.internal] = /* @__PURE__ */ Object.create(null), this[_.intercept] = /* @__PURE__ */ Object.create(null);
|
|
985
|
+
const t = new Proxy(this, Ve.handler);
|
|
986
|
+
t.root = t, t.reflect = new Ve(t), t.registry = new Vr(t, e), t.lifecycle = new Yr(t);
|
|
987
|
+
const i = /* @__PURE__ */ x((n) => {
|
|
988
988
|
if (n) {
|
|
989
989
|
i(Object.getPrototypeOf(n));
|
|
990
990
|
for (const s of Object.getOwnPropertyNames(n)) {
|
|
991
991
|
const o = n[s].prototype?.constructor;
|
|
992
|
-
o && (t[n[s].key] = new o(t, e),
|
|
992
|
+
o && (t[n[s].key] = new o(t, e), N(t[n[s].key], "ctx", t));
|
|
993
993
|
}
|
|
994
994
|
}
|
|
995
995
|
}, "attach");
|
|
@@ -1024,10 +1024,10 @@ var Gr = class {
|
|
|
1024
1024
|
return i[e] = t, this.extend({ [_.intercept]: i });
|
|
1025
1025
|
}
|
|
1026
1026
|
};
|
|
1027
|
-
|
|
1028
|
-
var he = class
|
|
1027
|
+
q.prototype[q.internal] = /* @__PURE__ */ Object.create(null);
|
|
1028
|
+
var he = class Kt {
|
|
1029
1029
|
static {
|
|
1030
|
-
|
|
1030
|
+
x(this, "Service");
|
|
1031
1031
|
}
|
|
1032
1032
|
static setup = _.setup;
|
|
1033
1033
|
static invoke = _.invoke;
|
|
@@ -1044,13 +1044,13 @@ var he = class Wt {
|
|
|
1044
1044
|
config;
|
|
1045
1045
|
constructor(...e) {
|
|
1046
1046
|
let t, i, n, s;
|
|
1047
|
-
|
|
1047
|
+
q.is(e[0]) ? (t = e[0], typeof e[1] == "string" ? (i = e[1], n = e[2]) : s = e[1]) : s = e[0], i ??= this.constructor[_.provide], n ??= this.constructor[_.immediate];
|
|
1048
1048
|
let o = this;
|
|
1049
1049
|
const a = {
|
|
1050
1050
|
associate: i,
|
|
1051
1051
|
property: "ctx"
|
|
1052
1052
|
};
|
|
1053
|
-
return o[_.invoke] && (o =
|
|
1053
|
+
return o[_.invoke] && (o = Xe(i, lt(Object.getPrototypeOf(this), Function.prototype), a)), t ? o.ctx = t : o[_.setup](), o.name = i, o.config = s, N(o, _.tracker, a), o.ctx.provide(i), o.ctx.runtime.name = i, n && (t ? o[_.expose] = i : o.ctx.set(i, o)), o.ctx.on("ready", async () => {
|
|
1054
1054
|
await Promise.resolve(), await o.start(), n || o.ctx.set(i, o);
|
|
1055
1055
|
}), o.ctx.on("dispose", () => o.stop()), o;
|
|
1056
1056
|
}
|
|
@@ -1058,11 +1058,11 @@ var he = class Wt {
|
|
|
1058
1058
|
return e[_.isolate][this.name] === this.ctx[_.isolate][this.name];
|
|
1059
1059
|
}
|
|
1060
1060
|
[_.setup]() {
|
|
1061
|
-
this.ctx = new
|
|
1061
|
+
this.ctx = new q();
|
|
1062
1062
|
}
|
|
1063
1063
|
[_.extend](e) {
|
|
1064
1064
|
let t;
|
|
1065
|
-
return this[
|
|
1065
|
+
return this[Kt.invoke] ? t = Xe(this.name, this, this[_.tracker]) : t = Object.create(this), Object.assign(t, e);
|
|
1066
1066
|
}
|
|
1067
1067
|
static [Symbol.hasInstance](e) {
|
|
1068
1068
|
let t = e.constructor;
|
|
@@ -1072,9 +1072,9 @@ var he = class Wt {
|
|
|
1072
1072
|
}
|
|
1073
1073
|
return !1;
|
|
1074
1074
|
}
|
|
1075
|
-
},
|
|
1075
|
+
}, Qr = Object.defineProperty, Jr = Object.getOwnPropertyNames, O = (r, e) => Qr(r, "name", { value: e, configurable: !0 }), Zr = (r, e) => function() {
|
|
1076
1076
|
return e || (0, r[Jr(r)[0]])((e = { exports: {} }).exports, e), e.exports;
|
|
1077
|
-
},
|
|
1077
|
+
}, ei = Zr({
|
|
1078
1078
|
"src/index.ts"(r, e) {
|
|
1079
1079
|
var t = Symbol.for("schemastery"), i = Symbol.for("ValidationError");
|
|
1080
1080
|
globalThis.__schemastery_index__ ??= 0;
|
|
@@ -1165,7 +1165,7 @@ var he = class Wt {
|
|
|
1165
1165
|
const h = s(this);
|
|
1166
1166
|
return h.meta.badges ||= [], h.meta.badges.push({ text: "experimental", type: "warning" }), h;
|
|
1167
1167
|
}, "experimental"), s.prototype.pattern = /* @__PURE__ */ O(function(h) {
|
|
1168
|
-
const l = s(this), d =
|
|
1168
|
+
const l = s(this), d = Nt(h, ["source", "flags"]);
|
|
1169
1169
|
return l.meta = { ...l.meta, pattern: d }, l;
|
|
1170
1170
|
}, "pattern"), s.prototype.simplify = /* @__PURE__ */ O(function(h) {
|
|
1171
1171
|
if (ce(h, this.meta.default, this.type === "dict")) return null;
|
|
@@ -1196,7 +1196,7 @@ var he = class Wt {
|
|
|
1196
1196
|
}
|
|
1197
1197
|
return h;
|
|
1198
1198
|
}, "simplify"), s.prototype.toString = /* @__PURE__ */ O(function(h) {
|
|
1199
|
-
return
|
|
1199
|
+
return L[this.type]?.(this, h) ?? `Schema<${this.type}>`;
|
|
1200
1200
|
}, "toString"), s.prototype.role = /* @__PURE__ */ O(function(f, h) {
|
|
1201
1201
|
const l = s(this);
|
|
1202
1202
|
return l.meta = { ...l.meta, role: f, extra: h }, l;
|
|
@@ -1220,7 +1220,7 @@ var he = class Wt {
|
|
|
1220
1220
|
for (; S?.type === "intersect" && T(E); )
|
|
1221
1221
|
S = S.list[0], E = S?.meta.default;
|
|
1222
1222
|
if (T(E)) return [h];
|
|
1223
|
-
h =
|
|
1223
|
+
h = Le(E);
|
|
1224
1224
|
}
|
|
1225
1225
|
const v = p[l.type];
|
|
1226
1226
|
if (!v) throw new n(`unsupported type "${l.type}"`, d);
|
|
@@ -1284,12 +1284,12 @@ var he = class Wt {
|
|
|
1284
1284
|
s.is(ArrayBuffer),
|
|
1285
1285
|
s.is(SharedArrayBuffer),
|
|
1286
1286
|
s.transform(s.any(), (l, d) => {
|
|
1287
|
-
if (
|
|
1287
|
+
if (J.isSource(l)) return J.fromSource(l);
|
|
1288
1288
|
throw new n(`expected ArrayBufferSource but got ${l}`, d);
|
|
1289
1289
|
}, !0),
|
|
1290
1290
|
...h ? [s.transform(s.string(), (l, d) => {
|
|
1291
1291
|
try {
|
|
1292
|
-
return h === "base64" ?
|
|
1292
|
+
return h === "base64" ? J.fromBase64(l) : J.fromHex(l);
|
|
1293
1293
|
} catch (m) {
|
|
1294
1294
|
throw new n(m.message, d);
|
|
1295
1295
|
}
|
|
@@ -1388,7 +1388,7 @@ var he = class Wt {
|
|
|
1388
1388
|
if (!Array.isArray(f)) throw new n(`expected array but got ${f}`, d);
|
|
1389
1389
|
return y(f.length, l, "array length", d, !T(h.meta.default)), [f.map((m, v) => b(f, v, h, d))];
|
|
1390
1390
|
}), s.extend("dict", (f, { inner: h, sKey: l }, d, m) => {
|
|
1391
|
-
if (!
|
|
1391
|
+
if (!Ce(f)) throw new n(`expected object but got ${f}`, d);
|
|
1392
1392
|
const v = {};
|
|
1393
1393
|
for (const S in f) {
|
|
1394
1394
|
let E;
|
|
@@ -1406,18 +1406,18 @@ var he = class Wt {
|
|
|
1406
1406
|
const m = h.map((v, S) => b(f, S, v, l));
|
|
1407
1407
|
return d ? [m] : (m.push(...f.slice(h.length)), [m]);
|
|
1408
1408
|
});
|
|
1409
|
-
function
|
|
1409
|
+
function R(f, h) {
|
|
1410
1410
|
for (const l in h)
|
|
1411
1411
|
l in f || (f[l] = h[l]);
|
|
1412
1412
|
}
|
|
1413
|
-
O(
|
|
1414
|
-
if (!
|
|
1413
|
+
O(R, "merge"), s.extend("object", (f, { dict: h }, l, d) => {
|
|
1414
|
+
if (!Ce(f)) throw new n(`expected object but got ${f}`, l);
|
|
1415
1415
|
const m = {};
|
|
1416
1416
|
for (const v in h) {
|
|
1417
1417
|
const S = b(f, v, h[v], l);
|
|
1418
1418
|
(!T(S) || v in f) && (m[v] = S);
|
|
1419
1419
|
}
|
|
1420
|
-
return d ||
|
|
1420
|
+
return d || R(m, f), [m];
|
|
1421
1421
|
}), s.extend("union", (f, { list: h, toString: l }, d, m) => {
|
|
1422
1422
|
for (const v of h)
|
|
1423
1423
|
try {
|
|
@@ -1437,19 +1437,19 @@ var he = class Wt {
|
|
|
1437
1437
|
if (typeof v != typeof E)
|
|
1438
1438
|
throw new n(`expected ${l()} but got ${JSON.stringify(f)}`, d);
|
|
1439
1439
|
if (typeof E == "object")
|
|
1440
|
-
|
|
1440
|
+
R(v ??= {}, E);
|
|
1441
1441
|
else if (v !== E)
|
|
1442
1442
|
throw new n(`expected ${l()} but got ${JSON.stringify(f)}`, d);
|
|
1443
1443
|
}
|
|
1444
1444
|
}
|
|
1445
|
-
return !m &&
|
|
1445
|
+
return !m && Ce(f) && R(v, f), [v];
|
|
1446
1446
|
}), s.extend("transform", (f, { inner: h, callback: l, preserve: d }, m) => {
|
|
1447
1447
|
const [v, S = f] = s.resolve(f, h, m, !0);
|
|
1448
1448
|
return d ? [l(v)] : [l(v), l(S)];
|
|
1449
1449
|
});
|
|
1450
|
-
var
|
|
1451
|
-
function
|
|
1452
|
-
|
|
1450
|
+
var L = {};
|
|
1451
|
+
function $(f, h, l) {
|
|
1452
|
+
L[f] = l, Object.assign(s, {
|
|
1453
1453
|
[f](...d) {
|
|
1454
1454
|
const m = new s({ type: f });
|
|
1455
1455
|
return h.forEach((v, S) => {
|
|
@@ -1489,13 +1489,13 @@ var he = class Wt {
|
|
|
1489
1489
|
}
|
|
1490
1490
|
});
|
|
1491
1491
|
}
|
|
1492
|
-
O(
|
|
1492
|
+
O($, "defineMethod"), $("is", ["constructor"], ({ constructor: f }) => typeof f == "function" ? f.name : f), $("any", [], () => "any"), $("never", [], () => "never"), $("const", ["value"], ({ value: f }) => typeof f == "string" ? JSON.stringify(f) : f), $("string", [], () => "string"), $("number", [], () => "number"), $("boolean", [], () => "boolean"), $("bitset", ["bits"], () => "bitset"), $("function", [], () => "function"), $("array", ["inner"], ({ inner: f }) => `${f.toString(!0)}[]`), $("dict", ["inner", "sKey"], ({ inner: f, sKey: h }) => `{ [key: ${h.toString()}]: ${f.toString()} }`), $("tuple", ["list"], ({ list: f }) => `[${f.map((h) => h.toString()).join(", ")}]`), $("object", ["dict"], ({ dict: f }) => Object.keys(f).length === 0 ? "{}" : `{ ${Object.entries(f).map(([h, l]) => `${h}${l.meta.required ? "" : "?"}: ${l.toString()}`).join(", ")} }`), $("union", ["list"], ({ list: f }, h) => {
|
|
1493
1493
|
const l = f.map(({ toString: d }) => d()).join(" | ");
|
|
1494
1494
|
return h ? `(${l})` : l;
|
|
1495
|
-
}),
|
|
1495
|
+
}), $("intersect", ["list"], ({ list: f }) => `${f.map((h) => h.toString(!0)).join(" & ")}`), $("transform", ["inner", "callback", "preserve"], ({ inner: f }, h) => f.toString(h)), e.exports = s;
|
|
1496
1496
|
}
|
|
1497
1497
|
});
|
|
1498
|
-
const
|
|
1498
|
+
const Ze = ei();
|
|
1499
1499
|
/**
|
|
1500
1500
|
* @inpageedit/logger
|
|
1501
1501
|
*
|
|
@@ -1504,17 +1504,17 @@ const Qe = Zr();
|
|
|
1504
1504
|
* @author dragon-fish <dragon-fish@qq.com>
|
|
1505
1505
|
* @license MIT
|
|
1506
1506
|
*/
|
|
1507
|
-
var
|
|
1508
|
-
const
|
|
1509
|
-
|
|
1510
|
-
const
|
|
1511
|
-
function
|
|
1507
|
+
var Wt = /* @__PURE__ */ ((r) => (r[r.debug = -1] = "debug", r[r.log = 0] = "log", r[r.info = 1] = "info", r[r.warn = 2] = "warn", r[r.error = 3] = "error", r[r.silent = 4] = "silent", r))(Wt || {});
|
|
1508
|
+
const et = globalThis || window, tt = Symbol.for("__IPE_LOGGER_COLOR_MAP__");
|
|
1509
|
+
et[tt] || (et[tt] = /* @__PURE__ */ new Map());
|
|
1510
|
+
const We = et[tt];
|
|
1511
|
+
function Pe(r) {
|
|
1512
1512
|
let e = 2166136261;
|
|
1513
1513
|
for (let t = 0; t < r.length; t++)
|
|
1514
1514
|
e ^= r.charCodeAt(t), e = (e >>> 0) * 16777619;
|
|
1515
1515
|
return e >>> 0;
|
|
1516
1516
|
}
|
|
1517
|
-
const
|
|
1517
|
+
const Et = [
|
|
1518
1518
|
[350, 360],
|
|
1519
1519
|
[0, 15],
|
|
1520
1520
|
[15, 30],
|
|
@@ -1526,8 +1526,8 @@ const Ot = [
|
|
|
1526
1526
|
[140, 160],
|
|
1527
1527
|
[160, 180]
|
|
1528
1528
|
];
|
|
1529
|
-
function
|
|
1530
|
-
const t =
|
|
1529
|
+
function ti(r, e) {
|
|
1530
|
+
const t = Et.length, i = Pe(r) % t, [n, s] = Et[i], o = s - n, a = Pe(r + ":" + e), c = n + a % (o || 1), u = Pe(r + ":s"), p = Pe(r + ":l");
|
|
1531
1531
|
let y, w;
|
|
1532
1532
|
if (e === "name")
|
|
1533
1533
|
y = 62 + u % 18, w = 30 + p % 12;
|
|
@@ -1539,11 +1539,11 @@ function ei(r, e) {
|
|
|
1539
1539
|
}
|
|
1540
1540
|
function Ie(r, e) {
|
|
1541
1541
|
if (e)
|
|
1542
|
-
return
|
|
1543
|
-
const t =
|
|
1542
|
+
return We.set(r, e), e;
|
|
1543
|
+
const t = We.get(r);
|
|
1544
1544
|
if (t) return t;
|
|
1545
|
-
const i = r.startsWith("name:") ? "name" : "group", n =
|
|
1546
|
-
return
|
|
1545
|
+
const i = r.startsWith("name:") ? "name" : "group", n = ti(r, i);
|
|
1546
|
+
return We.set(r, n), n;
|
|
1547
1547
|
}
|
|
1548
1548
|
/**
|
|
1549
1549
|
* @inpageedit/logger
|
|
@@ -1565,13 +1565,13 @@ function Ie(r, e) {
|
|
|
1565
1565
|
* logger.success('User created successfully')
|
|
1566
1566
|
* ```
|
|
1567
1567
|
*/
|
|
1568
|
-
let
|
|
1568
|
+
let ri = class Yt {
|
|
1569
1569
|
/**
|
|
1570
1570
|
* Note: constructor returns a callable Proxy so that you can do `logger('group')`.
|
|
1571
1571
|
*/
|
|
1572
1572
|
constructor(e = {}) {
|
|
1573
1573
|
this._custom = (t) => {
|
|
1574
|
-
if (!this._enabled(t.level)) return
|
|
1574
|
+
if (!this._enabled(t.level)) return Ot;
|
|
1575
1575
|
const [i, n] = this._prefix(t.label);
|
|
1576
1576
|
return this._consoleMethod(t.method).bind(console, i, ...n);
|
|
1577
1577
|
}, this._name = e.name, this._nameColor = e.color, this._groupPath = e._groupPath ? [...e._groupPath] : [], this._dynamicLevels = { ...e._dynamicLevels }, this._levelRef = e._levelRef ?? {
|
|
@@ -1580,7 +1580,7 @@ let ti = class Gt {
|
|
|
1580
1580
|
}, this._name && Ie(`name:${this._name}`, this._nameColor), this._installBuiltinLevels();
|
|
1581
1581
|
for (const t of Object.keys(this._dynamicLevels))
|
|
1582
1582
|
this._installLevelGetter(t, this._dynamicLevels[t]);
|
|
1583
|
-
return
|
|
1583
|
+
return ni(this);
|
|
1584
1584
|
}
|
|
1585
1585
|
// ---------- public API ----------
|
|
1586
1586
|
get level() {
|
|
@@ -1591,7 +1591,7 @@ let ti = class Gt {
|
|
|
1591
1591
|
}
|
|
1592
1592
|
/** Create a sub-logger with a group label */
|
|
1593
1593
|
group(e, t) {
|
|
1594
|
-
return e && Ie(`group:${e}`, t?.color), new
|
|
1594
|
+
return e && Ie(`group:${e}`, t?.color), new Yt({
|
|
1595
1595
|
name: this._name,
|
|
1596
1596
|
color: this._nameColor,
|
|
1597
1597
|
_groupPath: [...this._groupPath, e],
|
|
@@ -1630,8 +1630,8 @@ let ti = class Gt {
|
|
|
1630
1630
|
});
|
|
1631
1631
|
}
|
|
1632
1632
|
_method(e) {
|
|
1633
|
-
const t =
|
|
1634
|
-
if (!this._enabled(t.level)) return
|
|
1633
|
+
const t = ii[e];
|
|
1634
|
+
if (!this._enabled(t.level)) return Ot;
|
|
1635
1635
|
const [i, n] = this._prefix(t.label);
|
|
1636
1636
|
return this._consoleMethod(e).bind(console, i, ...n);
|
|
1637
1637
|
}
|
|
@@ -1658,15 +1658,15 @@ let ti = class Gt {
|
|
|
1658
1658
|
return [i, t];
|
|
1659
1659
|
}
|
|
1660
1660
|
};
|
|
1661
|
-
const
|
|
1662
|
-
}, Rt = "color:inherit; background:transparent; text-decoration:none;",
|
|
1661
|
+
const Ot = () => {
|
|
1662
|
+
}, Rt = "color:inherit; background:transparent; text-decoration:none;", ii = {
|
|
1663
1663
|
debug: { level: -1, label: "", method: "debug" },
|
|
1664
1664
|
log: { level: 0, label: "", method: "log" },
|
|
1665
1665
|
info: { level: 1, label: "[I]", method: "info" },
|
|
1666
1666
|
warn: { level: 2, label: "[W]", method: "warn" },
|
|
1667
1667
|
error: { level: 3, label: "[E]", method: "error" }
|
|
1668
1668
|
};
|
|
1669
|
-
function
|
|
1669
|
+
function ni(r) {
|
|
1670
1670
|
const e = function(t, i) {
|
|
1671
1671
|
return r.group(t, i);
|
|
1672
1672
|
};
|
|
@@ -1685,29 +1685,28 @@ function ii(r) {
|
|
|
1685
1685
|
}
|
|
1686
1686
|
});
|
|
1687
1687
|
}
|
|
1688
|
-
function
|
|
1689
|
-
return new
|
|
1688
|
+
function si(r) {
|
|
1689
|
+
return new ri(r);
|
|
1690
1690
|
}
|
|
1691
1691
|
var Y = /* @__PURE__ */ ((r) => (r.BODY_USED = "BODY_USED", r.NO_BODY_READER = "NO_BODY_READER", r.TIMEOUT = "TIMEOUT", r.NETWORK_ERROR = "NETWORK_ERROR", r.BODY_NOT_ALLOWED = "BODY_NOT_ALLOWED", r.HOOK_CONTEXT_CHANGED = "HOOK_CONTEXT_CHANGED", r.ABORTED_BY_HOOK = "ABORTED_BY_HOOK", r.INVALID_HOOK_CALLBACK = "INVALID_HOOK_CALLBACK", r.UNEXPECTED_HOOK_RETURN = "UNEXPECTED_HOOK_RETURN", r))(Y || {});
|
|
1692
|
-
let F = class
|
|
1692
|
+
let F = class Gt extends Error {
|
|
1693
1693
|
constructor(e, t, i, n) {
|
|
1694
1694
|
super(t, n), this.code = e, this.context = i;
|
|
1695
1695
|
}
|
|
1696
1696
|
name = "FexiosError";
|
|
1697
1697
|
static is(e) {
|
|
1698
|
-
return e?.constructor ===
|
|
1698
|
+
return e?.constructor === Gt;
|
|
1699
1699
|
}
|
|
1700
|
-
}
|
|
1701
|
-
class ht extends F {
|
|
1700
|
+
}, oi = class Xt extends F {
|
|
1702
1701
|
constructor(e, t, i) {
|
|
1703
1702
|
super(t.statusText, e, void 0, i), this.response = t;
|
|
1704
1703
|
}
|
|
1705
1704
|
name = "FexiosResponseError";
|
|
1706
1705
|
static is(e) {
|
|
1707
|
-
return e?.constructor ===
|
|
1706
|
+
return e?.constructor === Xt;
|
|
1708
1707
|
}
|
|
1709
|
-
}
|
|
1710
|
-
function
|
|
1708
|
+
};
|
|
1709
|
+
function ai(r, e = 2048) {
|
|
1711
1710
|
if (!(r instanceof Uint8Array))
|
|
1712
1711
|
throw new TypeError("Input must be a Uint8Array");
|
|
1713
1712
|
if (r.length === 0)
|
|
@@ -1716,23 +1715,23 @@ function si(r, e = 2048) {
|
|
|
1716
1715
|
Math.max(r.length, 256),
|
|
1717
1716
|
e
|
|
1718
1717
|
), i = r.slice(0, t);
|
|
1719
|
-
if (
|
|
1718
|
+
if (ci(i))
|
|
1720
1719
|
return !1;
|
|
1721
|
-
const n =
|
|
1720
|
+
const n = li(i);
|
|
1722
1721
|
if (n.nullByteRatio > 0.05 || n.highByteRatio > 0.95)
|
|
1723
1722
|
return !1;
|
|
1724
1723
|
const s = ["utf-8", "utf-16le", "utf-16be", "iso-8859-1"];
|
|
1725
1724
|
let o = -1, a = !1;
|
|
1726
1725
|
for (const c of s)
|
|
1727
1726
|
try {
|
|
1728
|
-
const u = new TextDecoder(c, { fatal: !0 }).decode(i), p =
|
|
1727
|
+
const u = new TextDecoder(c, { fatal: !0 }).decode(i), p = ui(u);
|
|
1729
1728
|
p > o && (o = p, a = p > 0.7);
|
|
1730
1729
|
} catch {
|
|
1731
1730
|
continue;
|
|
1732
1731
|
}
|
|
1733
1732
|
return a;
|
|
1734
1733
|
}
|
|
1735
|
-
function
|
|
1734
|
+
function ci(r) {
|
|
1736
1735
|
if (r.length < 4) return !1;
|
|
1737
1736
|
const e = [
|
|
1738
1737
|
[137, 80, 78, 71],
|
|
@@ -1772,7 +1771,7 @@ function oi(r) {
|
|
|
1772
1771
|
}
|
|
1773
1772
|
return !1;
|
|
1774
1773
|
}
|
|
1775
|
-
function
|
|
1774
|
+
function li(r) {
|
|
1776
1775
|
let e = 0, t = 0, i = 0;
|
|
1777
1776
|
for (const n of r)
|
|
1778
1777
|
n === 0 && e++, n > 127 && t++, (n < 32 && n !== 9 && n !== 10 && n !== 13 || n === 127) && i++;
|
|
@@ -1782,23 +1781,23 @@ function ai(r) {
|
|
|
1782
1781
|
controlCharRatio: i / r.length
|
|
1783
1782
|
};
|
|
1784
1783
|
}
|
|
1785
|
-
function
|
|
1784
|
+
function ui(r) {
|
|
1786
1785
|
if (r.length === 0) return 1;
|
|
1787
1786
|
let e = 1, t = 0;
|
|
1788
1787
|
for (let n = 0; n < r.length; n++) {
|
|
1789
1788
|
const s = r[n].charCodeAt(0);
|
|
1790
|
-
s >= 32 && s <= 126 || s === 9 || s === 10 || s === 13 || s === 32 ? t++ : s > 127 && s < 65534 ? !
|
|
1789
|
+
s >= 32 && s <= 126 || s === 9 || s === 10 || s === 13 || s === 32 ? t++ : s > 127 && s < 65534 ? !hi(s) && !fi(s) && t++ : e -= 0.1;
|
|
1791
1790
|
}
|
|
1792
1791
|
const i = t / r.length;
|
|
1793
|
-
return e *= i,
|
|
1792
|
+
return e *= i, di(r) && (e *= 1.1), Math.max(0, Math.min(1, e));
|
|
1794
1793
|
}
|
|
1795
|
-
function
|
|
1794
|
+
function hi(r) {
|
|
1796
1795
|
return r >= 0 && r <= 31 || r >= 127 && r <= 159;
|
|
1797
1796
|
}
|
|
1798
|
-
function
|
|
1797
|
+
function fi(r) {
|
|
1799
1798
|
return r >= 57344 && r <= 63743 || r >= 983040 && r <= 1048573 || r >= 1048576 && r <= 1114109;
|
|
1800
1799
|
}
|
|
1801
|
-
function
|
|
1800
|
+
function di(r) {
|
|
1802
1801
|
return [
|
|
1803
1802
|
/\b\w+\b/,
|
|
1804
1803
|
// Words
|
|
@@ -1851,13 +1850,13 @@ let be = class {
|
|
|
1851
1850
|
statusText;
|
|
1852
1851
|
headers;
|
|
1853
1852
|
};
|
|
1854
|
-
async function
|
|
1853
|
+
async function $t(r, e, t) {
|
|
1855
1854
|
if (r.bodyUsed)
|
|
1856
1855
|
throw new F(
|
|
1857
1856
|
Y.BODY_USED,
|
|
1858
1857
|
"Response body has already been used or locked"
|
|
1859
1858
|
);
|
|
1860
|
-
const i = r.headers.get("content-type") || "", n = Number(r.headers.get("content-length")) || 0, s = (a, c) => c === "json" || a.startsWith("application/json"), o = (a, c, u) => u === "blob" || a.startsWith("image/") && !a.startsWith("image/svg") || a.startsWith("video/") || a.startsWith("audio/") || !
|
|
1859
|
+
const i = r.headers.get("content-type") || "", n = Number(r.headers.get("content-length")) || 0, s = (a, c) => c === "json" || a.startsWith("application/json"), o = (a, c, u) => u === "blob" || a.startsWith("image/") && !a.startsWith("image/svg") || a.startsWith("video/") || a.startsWith("audio/") || !ai(c);
|
|
1861
1860
|
if ((r.status === 101 || r.status === 426 || r.headers.get("upgrade")) && typeof globalThis.WebSocket < "u") {
|
|
1862
1861
|
const a = new WebSocket(r.url);
|
|
1863
1862
|
return await new Promise((c, u) => {
|
|
@@ -1915,14 +1914,14 @@ async function Pt(r, e, t) {
|
|
|
1915
1914
|
}
|
|
1916
1915
|
if (typeof u.data > "u" && (u.data = c.length > 0 ? c : void 0), u.ok)
|
|
1917
1916
|
return u;
|
|
1918
|
-
throw new
|
|
1917
|
+
throw new oi(
|
|
1919
1918
|
`Request failed with status code ${r.status}`,
|
|
1920
1919
|
u
|
|
1921
1920
|
);
|
|
1922
1921
|
}
|
|
1923
1922
|
}
|
|
1924
1923
|
}
|
|
1925
|
-
var
|
|
1924
|
+
var De;
|
|
1926
1925
|
((r) => {
|
|
1927
1926
|
r.makeSearchParams = (n) => {
|
|
1928
1927
|
if (!n)
|
|
@@ -1944,15 +1943,15 @@ var Ne;
|
|
|
1944
1943
|
if (typeof p == "object" && p.constructor === Object) {
|
|
1945
1944
|
for (const [y, w] of Object.entries(p)) {
|
|
1946
1945
|
if (w == null) continue;
|
|
1947
|
-
const g = y.endsWith("[]"), b = g ? y.slice(0, -2) : y,
|
|
1946
|
+
const g = y.endsWith("[]"), b = g ? y.slice(0, -2) : y, R = `${u}[${b}]`;
|
|
1948
1947
|
if (g) {
|
|
1949
|
-
const
|
|
1948
|
+
const L = `${R}[]`;
|
|
1950
1949
|
if (Array.isArray(w))
|
|
1951
|
-
for (const
|
|
1952
|
-
else typeof w == "object" && w !== null && w.constructor === Object ? c(`${
|
|
1950
|
+
for (const $ of w) o(L, $?.toString());
|
|
1951
|
+
else typeof w == "object" && w !== null && w.constructor === Object ? c(`${R}[]`, w) : o(L, w?.toString());
|
|
1953
1952
|
} else if (Array.isArray(w))
|
|
1954
|
-
for (const
|
|
1955
|
-
else typeof w == "object" && w !== null && w.constructor === Object ? c(
|
|
1953
|
+
for (const L of w) o(R, L?.toString());
|
|
1954
|
+
else typeof w == "object" && w !== null && w.constructor === Object ? c(R, w) : a(R, w?.toString());
|
|
1956
1955
|
}
|
|
1957
1956
|
return;
|
|
1958
1957
|
}
|
|
@@ -2039,7 +2038,7 @@ var Ne;
|
|
|
2039
2038
|
V(c) && V(a) ? i(c, a) : n[o] = e(a);
|
|
2040
2039
|
}
|
|
2041
2040
|
}
|
|
2042
|
-
})(
|
|
2041
|
+
})(De || (De = {}));
|
|
2043
2042
|
const Vt = function(r) {
|
|
2044
2043
|
const e = this.constructor.prototype, t = Reflect.get(e, r, e);
|
|
2045
2044
|
function i(...n) {
|
|
@@ -2144,7 +2143,7 @@ var Se;
|
|
|
2144
2143
|
return i;
|
|
2145
2144
|
};
|
|
2146
2145
|
})(Se || (Se = {}));
|
|
2147
|
-
let
|
|
2146
|
+
let rt = class D extends Vt {
|
|
2148
2147
|
static FINAL_SYMBOL = Symbol("FEXIOS_FINAL_CONTEXT");
|
|
2149
2148
|
static NORMALIZED_SYMBOL = Symbol("FEXIOS_NORMALIZED_QUERY");
|
|
2150
2149
|
baseConfigs;
|
|
@@ -2175,7 +2174,7 @@ let tt = class N extends Vt {
|
|
|
2175
2174
|
"trace"
|
|
2176
2175
|
];
|
|
2177
2176
|
constructor(e = {}) {
|
|
2178
|
-
super("request"), this.baseConfigs = _e(
|
|
2177
|
+
super("request"), this.baseConfigs = _e(D.DEFAULT_CONFIGS, e), D.ALL_METHODS.forEach(
|
|
2179
2178
|
(t) => this.createMethodShortcut(t.toLowerCase())
|
|
2180
2179
|
);
|
|
2181
2180
|
}
|
|
@@ -2184,8 +2183,8 @@ let tt = class N extends Vt {
|
|
|
2184
2183
|
if (typeof e == "string" || e instanceof URL ? i.url = e.toString() : typeof e == "object" && (i = _e(e, i)), i = await this.emit("beforeInit", i, {
|
|
2185
2184
|
shouldAdjustRequestParams: !0,
|
|
2186
2185
|
shouldHandleShortCircuitResponse: !0
|
|
2187
|
-
}), i[
|
|
2188
|
-
if (
|
|
2186
|
+
}), i[D.FINAL_SYMBOL]) return i;
|
|
2187
|
+
if (D.METHODS_WITHOUT_BODY.includes(
|
|
2189
2188
|
i.method?.toLocaleLowerCase()
|
|
2190
2189
|
) && i.body)
|
|
2191
2190
|
throw new F(
|
|
@@ -2199,7 +2198,7 @@ let tt = class N extends Vt {
|
|
|
2199
2198
|
requestOptionsOverridesURLSearchParams: !0,
|
|
2200
2199
|
preRequestOptionsOverridesURLSearchParams: !0,
|
|
2201
2200
|
postRequestOptionsOverridesURLSearchParams: !0
|
|
2202
|
-
}), i[
|
|
2201
|
+
}), i[D.FINAL_SYMBOL]) return i;
|
|
2203
2202
|
let n;
|
|
2204
2203
|
const s = {};
|
|
2205
2204
|
if (typeof i.body < "u" && i.body !== null && (i.body instanceof Blob || i.body instanceof FormData || i.body instanceof URLSearchParams ? n = i.body : typeof i.body == "object" && i.body !== null ? (n = JSON.stringify(i.body), i.headers = this.mergeHeaders(i.headers, {
|
|
@@ -2211,11 +2210,11 @@ let tt = class N extends Vt {
|
|
|
2211
2210
|
shouldHandleShortCircuitResponse: !0,
|
|
2212
2211
|
preAdjust: !0,
|
|
2213
2212
|
postRequestOptionsOverridesURLSearchParams: !0
|
|
2214
|
-
}), i[
|
|
2213
|
+
}), i[D.FINAL_SYMBOL]) return i;
|
|
2215
2214
|
const o = i.abortController || globalThis.AbortController ? new AbortController() : void 0, a = i.baseURL || this.baseConfigs.baseURL || globalThis.location?.href || "http://localhost", c = new URL(
|
|
2216
2215
|
i.url.toString(),
|
|
2217
2216
|
a
|
|
2218
|
-
), u =
|
|
2217
|
+
), u = De.makeURL(
|
|
2219
2218
|
c,
|
|
2220
2219
|
i.query,
|
|
2221
2220
|
c.hash
|
|
@@ -2234,14 +2233,14 @@ let tt = class N extends Vt {
|
|
|
2234
2233
|
});
|
|
2235
2234
|
if (i.rawRequest = p, i = await this.emit("beforeActualFetch", i, {
|
|
2236
2235
|
shouldHandleShortCircuitResponse: !0
|
|
2237
|
-
}), i[
|
|
2236
|
+
}), i[D.FINAL_SYMBOL]) return i;
|
|
2238
2237
|
const y = i.timeout || this.baseConfigs.timeout || 60 * 1e3;
|
|
2239
2238
|
if (i.url.startsWith("ws"))
|
|
2240
2239
|
try {
|
|
2241
2240
|
const g = new WebSocket(i.url);
|
|
2242
|
-
return await new Promise((b,
|
|
2243
|
-
const
|
|
2244
|
-
|
|
2241
|
+
return await new Promise((b, R) => {
|
|
2242
|
+
const L = setTimeout(() => {
|
|
2243
|
+
R(
|
|
2245
2244
|
new F(
|
|
2246
2245
|
Y.TIMEOUT,
|
|
2247
2246
|
`WebSocket connection timed out after ${y}ms`,
|
|
@@ -2250,20 +2249,20 @@ let tt = class N extends Vt {
|
|
|
2250
2249
|
);
|
|
2251
2250
|
}, y);
|
|
2252
2251
|
g.onopen = () => {
|
|
2253
|
-
clearTimeout(
|
|
2254
|
-
}, g.onerror = (
|
|
2255
|
-
clearTimeout(
|
|
2252
|
+
clearTimeout(L), b();
|
|
2253
|
+
}, g.onerror = ($) => {
|
|
2254
|
+
clearTimeout(L), R(
|
|
2256
2255
|
new F(
|
|
2257
2256
|
Y.NETWORK_ERROR,
|
|
2258
2257
|
"WebSocket connection failed",
|
|
2259
2258
|
i
|
|
2260
2259
|
)
|
|
2261
2260
|
);
|
|
2262
|
-
}, g.onclose = (
|
|
2263
|
-
|
|
2261
|
+
}, g.onclose = ($) => {
|
|
2262
|
+
$.code !== 1e3 && (clearTimeout(L), R(
|
|
2264
2263
|
new F(
|
|
2265
2264
|
Y.NETWORK_ERROR,
|
|
2266
|
-
`WebSocket closed with code ${
|
|
2265
|
+
`WebSocket closed with code ${$.code}`,
|
|
2267
2266
|
i
|
|
2268
2267
|
)
|
|
2269
2268
|
));
|
|
@@ -2292,24 +2291,24 @@ let tt = class N extends Vt {
|
|
|
2292
2291
|
i
|
|
2293
2292
|
) : new F(Y.NETWORK_ERROR, b.message, i);
|
|
2294
2293
|
});
|
|
2295
|
-
return w && clearTimeout(w), i.rawResponse = g, i.response = await
|
|
2294
|
+
return w && clearTimeout(w), i.rawResponse = g, i.response = await $t(
|
|
2296
2295
|
g,
|
|
2297
2296
|
i.responseType,
|
|
2298
|
-
(b,
|
|
2299
|
-
t?.onProgress?.(b,
|
|
2297
|
+
(b, R) => {
|
|
2298
|
+
t?.onProgress?.(b, R);
|
|
2300
2299
|
}
|
|
2301
2300
|
), i.data = i.response.data, i.headers = i.response.headers, this.emit("afterResponse", i);
|
|
2302
2301
|
} catch (g) {
|
|
2303
2302
|
throw w && clearTimeout(w), g;
|
|
2304
2303
|
}
|
|
2305
2304
|
}
|
|
2306
|
-
mergeQueries =
|
|
2305
|
+
mergeQueries = De.mergeQueries;
|
|
2307
2306
|
mergeHeaders = Se.mergeHeaders;
|
|
2308
2307
|
normalizeContext(e, t = {}) {
|
|
2309
2308
|
const i = e, n = i.baseURL || this.baseConfigs.baseURL || globalThis.location?.href || "http://localhost", s = new URL(
|
|
2310
2309
|
n,
|
|
2311
2310
|
globalThis.location?.href || "http://localhost"
|
|
2312
|
-
), o = new URL(i.url.toString(), s), a = !!i[
|
|
2311
|
+
), o = new URL(i.url.toString(), s), a = !!i[D.NORMALIZED_SYMBOL];
|
|
2313
2312
|
i.baseURL = s ? s.origin : o.origin;
|
|
2314
2313
|
let c;
|
|
2315
2314
|
a ? c = t.requestOptionsOverridesURLSearchParams ? this.mergeQueries({}, o.search, i.query) : this.mergeQueries({}, i.query, o.search) : (c = t.requestOptionsOverridesURLSearchParams ? this.mergeQueries(
|
|
@@ -2322,7 +2321,7 @@ let tt = class N extends Vt {
|
|
|
2322
2321
|
this.baseConfigs.query,
|
|
2323
2322
|
i.query,
|
|
2324
2323
|
o.search
|
|
2325
|
-
), i[
|
|
2324
|
+
), i[D.NORMALIZED_SYMBOL] = !0), i.query = c;
|
|
2326
2325
|
const u = new URL(o);
|
|
2327
2326
|
return u.search = "", i.url = u.toString(), i;
|
|
2328
2327
|
}
|
|
@@ -2358,18 +2357,18 @@ let tt = class N extends Vt {
|
|
|
2358
2357
|
t
|
|
2359
2358
|
);
|
|
2360
2359
|
if (y instanceof Response) {
|
|
2361
|
-
const w = y, g = { ...t, rawResponse: w }, b = await
|
|
2360
|
+
const w = y, g = { ...t, rawResponse: w }, b = await $t(
|
|
2362
2361
|
w,
|
|
2363
2362
|
t.responseType,
|
|
2364
|
-
(
|
|
2365
|
-
t.onProgress?.(
|
|
2363
|
+
(R, L) => {
|
|
2364
|
+
t.onProgress?.(R, L);
|
|
2366
2365
|
}
|
|
2367
2366
|
);
|
|
2368
2367
|
if (g.response = b, g.data = b.data, g.headers = b.headers, e !== "afterResponse") {
|
|
2369
|
-
const
|
|
2370
|
-
return
|
|
2368
|
+
const R = await this.emit("afterResponse", g);
|
|
2369
|
+
return R[D.FINAL_SYMBOL] = !0, R;
|
|
2371
2370
|
} else
|
|
2372
|
-
return g[
|
|
2371
|
+
return g[D.FINAL_SYMBOL] = !0, g;
|
|
2373
2372
|
} else if (typeof y == "object" && y[c] === c)
|
|
2374
2373
|
t = y;
|
|
2375
2374
|
else {
|
|
@@ -2395,14 +2394,14 @@ let tt = class N extends Vt {
|
|
|
2395
2394
|
b = JSON.parse(p);
|
|
2396
2395
|
} catch {
|
|
2397
2396
|
}
|
|
2398
|
-
const
|
|
2397
|
+
const R = t.query || {}, L = this.mergeQueries(
|
|
2399
2398
|
b,
|
|
2400
2399
|
g.search,
|
|
2401
|
-
|
|
2400
|
+
R
|
|
2402
2401
|
);
|
|
2403
|
-
t.query =
|
|
2404
|
-
const
|
|
2405
|
-
|
|
2402
|
+
t.query = L;
|
|
2403
|
+
const $ = new URL(g);
|
|
2404
|
+
$.search = "", t.url = $.toString();
|
|
2406
2405
|
} catch {
|
|
2407
2406
|
}
|
|
2408
2407
|
delete t[c], s++;
|
|
@@ -2443,7 +2442,7 @@ let tt = class N extends Vt {
|
|
|
2443
2442
|
};
|
|
2444
2443
|
createMethodShortcut(e) {
|
|
2445
2444
|
return Reflect.defineProperty(this, e, {
|
|
2446
|
-
get: () => (t, i, n) => (
|
|
2445
|
+
get: () => (t, i, n) => (D.METHODS_WITHOUT_BODY.includes(
|
|
2447
2446
|
e.toLocaleLowerCase()
|
|
2448
2447
|
) ? n = i : (n = n || {}, n.body = i), this.request(t, {
|
|
2449
2448
|
...n,
|
|
@@ -2452,14 +2451,14 @@ let tt = class N extends Vt {
|
|
|
2452
2451
|
}), this;
|
|
2453
2452
|
}
|
|
2454
2453
|
extends(e) {
|
|
2455
|
-
const t = new
|
|
2454
|
+
const t = new D(_e(this.baseConfigs, e));
|
|
2456
2455
|
return t.hooks = [...this.hooks], t._plugins = new Map(this._plugins), t._plugins.forEach(async (i) => {
|
|
2457
2456
|
await t.plugin(i);
|
|
2458
2457
|
}), t;
|
|
2459
2458
|
}
|
|
2460
|
-
create =
|
|
2459
|
+
create = D.create;
|
|
2461
2460
|
static create(e) {
|
|
2462
|
-
return new
|
|
2461
|
+
return new D(e);
|
|
2463
2462
|
}
|
|
2464
2463
|
_plugins = /* @__PURE__ */ new Map();
|
|
2465
2464
|
async plugin(e) {
|
|
@@ -2467,7 +2466,7 @@ let tt = class N extends Vt {
|
|
|
2467
2466
|
if (this._plugins.has(e.name))
|
|
2468
2467
|
return this;
|
|
2469
2468
|
const t = await e.install(this);
|
|
2470
|
-
if (this._plugins.set(e.name, e), t instanceof
|
|
2469
|
+
if (this._plugins.set(e.name, e), t instanceof D)
|
|
2471
2470
|
return t;
|
|
2472
2471
|
}
|
|
2473
2472
|
return this;
|
|
@@ -2485,10 +2484,10 @@ let tt = class N extends Vt {
|
|
|
2485
2484
|
* @license MIT
|
|
2486
2485
|
* @author dragon-fish <dragon-fish@qq.com>
|
|
2487
2486
|
*/
|
|
2488
|
-
const
|
|
2487
|
+
const pi = rt.create, At = pi();
|
|
2489
2488
|
/* v8 ignore else -- @preserve */
|
|
2490
2489
|
typeof globalThis < "u" ? globalThis.fexios = At : typeof window < "u" && (window.fexios = At);
|
|
2491
|
-
var
|
|
2490
|
+
var Ne;
|
|
2492
2491
|
((r) => {
|
|
2493
2492
|
function e(i) {
|
|
2494
2493
|
return Array.isArray(i) ? i.join("|") : typeof i == "boolean" || i === null ? i ? "1" : void 0 : typeof i == "number" ? "" + i : i;
|
|
@@ -2511,9 +2510,9 @@ var De;
|
|
|
2511
2510
|
}), s;
|
|
2512
2511
|
}
|
|
2513
2512
|
r.normalizeBody = t;
|
|
2514
|
-
})(
|
|
2515
|
-
var
|
|
2516
|
-
class
|
|
2513
|
+
})(Ne || (Ne = {}));
|
|
2514
|
+
var xe = /* @__PURE__ */ ((r) => (r.HTTP_ERROR = "HTTP_ERROR", r.LOGIN_FAILED = "LOGIN_FAILED", r.LOGIN_RETRY_LIMIT_EXCEEDED = "LOGIN_RETRY_LIMIT_EXCEEDED", r.TOKEN_RETRY_LIMIT_EXCEEDED = "TOKEN_RETRY_LIMIT_EXCEEDED", r))(xe || {});
|
|
2515
|
+
class z extends Error {
|
|
2517
2516
|
constructor(e, t = "", i) {
|
|
2518
2517
|
super(), this.code = e, this.message = t, this.cause = i, this.name = "WikiSaikouError";
|
|
2519
2518
|
}
|
|
@@ -2521,9 +2520,9 @@ class H extends Error {
|
|
|
2521
2520
|
return e instanceof this && (t === void 0 || e.code === t);
|
|
2522
2521
|
}
|
|
2523
2522
|
}
|
|
2524
|
-
let pe = class
|
|
2523
|
+
let pe = class Qt extends Error {
|
|
2525
2524
|
constructor(e, t) {
|
|
2526
|
-
super(), this.errors = e, this.cause = t, this.name = "MediaWikiApiError", this.errors =
|
|
2525
|
+
super(), this.errors = e, this.cause = t, this.name = "MediaWikiApiError", this.errors = Qt.normalizeErrors(e), this.message = e.map((i) => i.text).filter(Boolean).join(`
|
|
2527
2526
|
`), this.code = this.isBadTokenError() ? "badtoken" : this.errors[0]?.code || "Unknown Error";
|
|
2528
2527
|
}
|
|
2529
2528
|
get firstError() {
|
|
@@ -2571,8 +2570,8 @@ let pe = class Jt extends Error {
|
|
|
2571
2570
|
}
|
|
2572
2571
|
}
|
|
2573
2572
|
r.isBadTokenError = n;
|
|
2574
|
-
})(
|
|
2575
|
-
const
|
|
2573
|
+
})(z || (z = {}));
|
|
2574
|
+
const Pt = Symbol.for("__FEXIOS_SAIKOU__");
|
|
2576
2575
|
/**
|
|
2577
2576
|
* FexiosSaikou
|
|
2578
2577
|
*
|
|
@@ -2587,18 +2586,18 @@ const It = Symbol.for("__FEXIOS_SAIKOU__");
|
|
|
2587
2586
|
* @param {string|URL} payload create a new FexiosSaikou instance with the given baseURL
|
|
2588
2587
|
* @param {Fexios} payload or make the given Fexios instance a FexiosSaikou instance
|
|
2589
2588
|
*/
|
|
2590
|
-
function
|
|
2591
|
-
const e = r instanceof
|
|
2589
|
+
function Jt(r) {
|
|
2590
|
+
const e = r instanceof rt ? r : new rt({
|
|
2592
2591
|
baseURL: r instanceof URL ? r.toString() : String(r),
|
|
2593
2592
|
responseType: "json"
|
|
2594
2593
|
});
|
|
2595
|
-
return e[
|
|
2594
|
+
return e[Pt] || (Reflect.defineProperty(e, Pt, {
|
|
2596
2595
|
get: () => !0,
|
|
2597
2596
|
enumerable: !1,
|
|
2598
2597
|
configurable: !1
|
|
2599
2598
|
}), e._tokens = /* @__PURE__ */ new Map(), e.on("afterResponse", (t) => {
|
|
2600
2599
|
const { data: i, rawRequest: n } = t, s = n?.headers.get("x-mw-token-name");
|
|
2601
|
-
s &&
|
|
2600
|
+
s && z.isBadTokenError(i) && e._tokens.delete(s);
|
|
2602
2601
|
const o = i?.query?.tokens;
|
|
2603
2602
|
o && typeof o == "object" && Object.entries(o).forEach(([c, u]) => {
|
|
2604
2603
|
typeof u == "string" && e._tokens.set(c.replace(/token$/i, "").toLowerCase(), u);
|
|
@@ -2610,9 +2609,9 @@ function Qt(r) {
|
|
|
2610
2609
|
return t;
|
|
2611
2610
|
if (t.body === void 0 || t.body === null)
|
|
2612
2611
|
return t.body = void 0, t;
|
|
2613
|
-
const i = t.body =
|
|
2612
|
+
const i = t.body = Ne.normalizeBody(t.body), n = new URLSearchParams(t.query);
|
|
2614
2613
|
return i.has("format") && n.delete("format"), i.has("formatversion") && n.delete("formatversion"), i.has("action") && n.delete("action"), i.has("origin") && (n.set("origin", "" + i.get("origin")), i.delete("origin")), t.query = Object.fromEntries(n.entries()), t;
|
|
2615
|
-
}), e.on("beforeInit", (t) => (t.query =
|
|
2614
|
+
}), e.on("beforeInit", (t) => (t.query = Ne.normalizeBody(t.query) || {}, t)), e.on("beforeRequest", (t) => {
|
|
2616
2615
|
const i = new URL(t.url), n = i.searchParams;
|
|
2617
2616
|
if (globalThis.location && (!n.has("origin") && location.origin !== i.origin ? (n.set("origin", location.origin), e.baseConfigs.credentials = "include", e.baseConfigs.mode = "cors") : location.origin === i.origin && (n.delete("origin"), e.baseConfigs.credentials = void 0, e.baseConfigs.mode = void 0)), i.searchParams.has("origin")) {
|
|
2618
2617
|
const s = encodeURIComponent(
|
|
@@ -2642,7 +2641,7 @@ const ae = (r, ...e) => {
|
|
|
2642
2641
|
t(c) && t(a) ? n[o] = ae(c, a) : n[o] = i(a);
|
|
2643
2642
|
}
|
|
2644
2643
|
return n;
|
|
2645
|
-
},
|
|
2644
|
+
}, mi = (r, e, t) => {
|
|
2646
2645
|
let i = { ...Zt.DEFAULT_CONFIGS };
|
|
2647
2646
|
if (typeof r == "string" ? i = ae(i, {
|
|
2648
2647
|
baseURL: r,
|
|
@@ -2655,10 +2654,10 @@ const ae = (r, ...e) => {
|
|
|
2655
2654
|
if (typeof i.baseURL != "string")
|
|
2656
2655
|
throw new Error("baseURL is required");
|
|
2657
2656
|
return i;
|
|
2658
|
-
},
|
|
2659
|
-
},
|
|
2657
|
+
}, gi = () => {
|
|
2658
|
+
}, yi = async (r, e) => {
|
|
2660
2659
|
let t = 0;
|
|
2661
|
-
const { retry: i = 3, onRetry: n =
|
|
2660
|
+
const { retry: i = 3, onRetry: n = gi, shouldRetry: s = () => !0 } = e;
|
|
2662
2661
|
let o;
|
|
2663
2662
|
do
|
|
2664
2663
|
try {
|
|
@@ -2681,12 +2680,12 @@ const ae = (r, ...e) => {
|
|
|
2681
2680
|
const ve = class {
|
|
2682
2681
|
constructor(e, t, i) {
|
|
2683
2682
|
this.version = "7.1.2", this.token = this.getToken;
|
|
2684
|
-
const n = this.config =
|
|
2683
|
+
const n = this.config = mi(
|
|
2685
2684
|
e,
|
|
2686
2685
|
t,
|
|
2687
2686
|
i
|
|
2688
2687
|
);
|
|
2689
|
-
this.request =
|
|
2688
|
+
this.request = Jt(n.baseURL);
|
|
2690
2689
|
}
|
|
2691
2690
|
setBaseURL(e) {
|
|
2692
2691
|
return this.config.baseURL = e, this.request.baseConfigs.baseURL = e, this;
|
|
@@ -2731,14 +2730,14 @@ const ve = class {
|
|
|
2731
2730
|
const t = await e();
|
|
2732
2731
|
return this.handleApiResponse(t);
|
|
2733
2732
|
} catch (t) {
|
|
2734
|
-
throw this.config.throwOnApiError &&
|
|
2735
|
-
|
|
2733
|
+
throw this.config.throwOnApiError && z.includesMediaWikiApiError(t) ? new pe(
|
|
2734
|
+
z.extractMediaWikiApiErrors(t),
|
|
2736
2735
|
t
|
|
2737
2736
|
) : t;
|
|
2738
2737
|
}
|
|
2739
2738
|
}
|
|
2740
2739
|
throwIfApiError(e) {
|
|
2741
|
-
const t =
|
|
2740
|
+
const t = z.extractMediaWikiApiErrors(e);
|
|
2742
2741
|
if (t.length > 0)
|
|
2743
2742
|
throw new pe(t, e);
|
|
2744
2743
|
}
|
|
@@ -2770,12 +2769,12 @@ const ve = class {
|
|
|
2770
2769
|
fexiosOptions: a
|
|
2771
2770
|
} = i || {};
|
|
2772
2771
|
if (s < 1)
|
|
2773
|
-
throw new
|
|
2774
|
-
|
|
2772
|
+
throw new z(
|
|
2773
|
+
xe.TOKEN_RETRY_LIMIT_EXCEEDED,
|
|
2775
2774
|
"The limit of the number of times to automatically re-acquire the token has been exceeded"
|
|
2776
2775
|
);
|
|
2777
2776
|
let c = 0;
|
|
2778
|
-
return
|
|
2777
|
+
return yi(
|
|
2779
2778
|
async () => {
|
|
2780
2779
|
const u = await this.getToken(
|
|
2781
2780
|
e,
|
|
@@ -2791,12 +2790,12 @@ const ve = class {
|
|
|
2791
2790
|
headers: { "x-mw-token-name": e }
|
|
2792
2791
|
})
|
|
2793
2792
|
);
|
|
2794
|
-
if (
|
|
2793
|
+
if (z.isBadTokenError(p.data))
|
|
2795
2794
|
throw p;
|
|
2796
2795
|
return p;
|
|
2797
2796
|
} catch (p) {
|
|
2798
|
-
throw
|
|
2799
|
-
|
|
2797
|
+
throw z.isBadTokenError(p) || p?.ok === !1 || pe.is(p) ? p : new z(
|
|
2798
|
+
xe.HTTP_ERROR,
|
|
2800
2799
|
"Network/transport or SDK-internal error (not a MediaWiki API error)",
|
|
2801
2800
|
p
|
|
2802
2801
|
);
|
|
@@ -2807,11 +2806,11 @@ const ve = class {
|
|
|
2807
2806
|
onRetry: (u, p) => {
|
|
2808
2807
|
c = p + 1;
|
|
2809
2808
|
},
|
|
2810
|
-
shouldRetry: (u) =>
|
|
2809
|
+
shouldRetry: (u) => z.isBadTokenError(u) || u?.ok === !1
|
|
2811
2810
|
}
|
|
2812
2811
|
).catch((u) => {
|
|
2813
|
-
throw
|
|
2814
|
-
|
|
2812
|
+
throw z.isBadTokenError(u) || u?.ok === !1 ? new z(
|
|
2813
|
+
xe.TOKEN_RETRY_LIMIT_EXCEEDED,
|
|
2815
2814
|
"Retry attempts for acquiring/using token exhausted",
|
|
2816
2815
|
u
|
|
2817
2816
|
) : u;
|
|
@@ -2846,7 +2845,7 @@ ve.INIT_DEFAULT_PARAMS = {
|
|
|
2846
2845
|
},
|
|
2847
2846
|
defaultParams: ve.INIT_DEFAULT_PARAMS,
|
|
2848
2847
|
throwOnApiError: !1
|
|
2849
|
-
}, ve.createRequestHandler =
|
|
2848
|
+
}, ve.createRequestHandler = Jt;
|
|
2850
2849
|
let Zt = ve;
|
|
2851
2850
|
/**
|
|
2852
2851
|
* WikiSaikou
|
|
@@ -2854,7 +2853,7 @@ let Zt = ve;
|
|
|
2854
2853
|
* @author Dragon-Fish <dragon-fish@qq.com>
|
|
2855
2854
|
* @license MIT
|
|
2856
2855
|
*/
|
|
2857
|
-
let
|
|
2856
|
+
let wi = class extends Zt {
|
|
2858
2857
|
async clientLogin(e, t, i) {
|
|
2859
2858
|
i ||= {}, !i.logincontinue && !i.loginreturnurl && (i.loginreturnurl = location?.origin);
|
|
2860
2859
|
const n = await this.postWithToken(
|
|
@@ -2871,17 +2870,17 @@ let gi = class extends Zt {
|
|
|
2871
2870
|
);
|
|
2872
2871
|
if (n?.data?.clientlogin?.status === "PASS")
|
|
2873
2872
|
return n.data.clientlogin;
|
|
2874
|
-
throw new
|
|
2875
|
-
|
|
2873
|
+
throw new z(
|
|
2874
|
+
xe.LOGIN_FAILED,
|
|
2876
2875
|
n.data.clientlogin.message,
|
|
2877
2876
|
n
|
|
2878
2877
|
);
|
|
2879
2878
|
}
|
|
2880
2879
|
};
|
|
2881
|
-
class
|
|
2880
|
+
class bi {
|
|
2882
2881
|
constructor(e, t = {}) {
|
|
2883
2882
|
this.ctx = e, location?.href && t?.baseURL?.toString()?.startsWith("/") && (t.baseURL = new URL(t.baseURL, location.origin));
|
|
2884
|
-
const i = new
|
|
2883
|
+
const i = new wi({
|
|
2885
2884
|
baseURL: t.baseURL.toString(),
|
|
2886
2885
|
fexiosConfigs: {
|
|
2887
2886
|
headers: {
|
|
@@ -2895,17 +2894,17 @@ class yi {
|
|
|
2895
2894
|
e.set("api", i);
|
|
2896
2895
|
}
|
|
2897
2896
|
}
|
|
2898
|
-
var
|
|
2897
|
+
var vi = Object.create, ft = Object.defineProperty, _i = Object.getOwnPropertyDescriptor, er = (r, e) => (e = Symbol[r]) ? e : Symbol.for("Symbol." + r), tr = (r) => {
|
|
2899
2898
|
throw TypeError(r);
|
|
2900
|
-
},
|
|
2899
|
+
}, Si = (r, e, t) => e in r ? ft(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, xi = (r, e) => ft(r, "name", { value: e, configurable: !0 }), ki = (r) => [, , , vi(r?.[er("metadata")] ?? null)], Ei = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"], rr = (r) => r !== void 0 && typeof r != "function" ? tr("Function expected") : r, Oi = (r, e, t, i, n) => ({ kind: Ei[r], name: e, metadata: i, addInitializer: (s) => t._ ? tr("Already initialized") : n.push(rr(s || null)) }), Ri = (r, e) => Si(e, er("metadata"), r[3]), $i = (r, e, t, i) => {
|
|
2901
2900
|
for (var n = 0, s = r[e >> 1], o = s && s.length; n < o; n++) s[n].call(t);
|
|
2902
2901
|
return i;
|
|
2903
|
-
},
|
|
2904
|
-
var o, a, c, u = e & 7, p = !1, y = 0, w = r[y] || (r[y] = []), g = u && (n = n.prototype, u < 5 && (u > 3 || !p) &&
|
|
2905
|
-
|
|
2902
|
+
}, Ai = (r, e, t, i, n, s) => {
|
|
2903
|
+
var o, a, c, u = e & 7, p = !1, y = 0, w = r[y] || (r[y] = []), g = u && (n = n.prototype, u < 5 && (u > 3 || !p) && _i(n, t));
|
|
2904
|
+
xi(n, t);
|
|
2906
2905
|
for (var b = i.length - 1; b >= 0; b--)
|
|
2907
|
-
c =
|
|
2908
|
-
return
|
|
2906
|
+
c = Oi(u, t, a = {}, r[3], w), o = (0, i[b])(n, c), a._ = 1, rr(o) && (n = o);
|
|
2907
|
+
return Ri(r, n), g && ft(n, t, g), p ? u ^ 4 ? s : g : n;
|
|
2909
2908
|
}, ir, dt, nr;
|
|
2910
2909
|
ir = [le(["wiki", "wikiTitle"])];
|
|
2911
2910
|
class Ue extends (nr = he) {
|
|
@@ -2965,10 +2964,10 @@ class Ue extends (nr = he) {
|
|
|
2965
2964
|
return this.params.get("action") || "view";
|
|
2966
2965
|
}
|
|
2967
2966
|
}
|
|
2968
|
-
dt =
|
|
2969
|
-
Ue =
|
|
2970
|
-
|
|
2971
|
-
class
|
|
2967
|
+
dt = ki(nr);
|
|
2968
|
+
Ue = Ai(dt, 0, "CurrentPageService", ir, Ue);
|
|
2969
|
+
$i(dt, 1, Ue);
|
|
2970
|
+
class Pi extends he {
|
|
2972
2971
|
constructor(e) {
|
|
2973
2972
|
super(e, "resourceLoader", !0), this.ctx = e;
|
|
2974
2973
|
}
|
|
@@ -3003,11 +3002,11 @@ class Ri extends he {
|
|
|
3003
3002
|
return e.startsWith("http") || e.startsWith("//") ? e : import.meta.resolve(e);
|
|
3004
3003
|
}
|
|
3005
3004
|
}
|
|
3006
|
-
const
|
|
3007
|
-
function
|
|
3005
|
+
const qe = Object.keys;
|
|
3006
|
+
function Ii(r) {
|
|
3008
3007
|
return typeof r == "boolean";
|
|
3009
3008
|
}
|
|
3010
|
-
function
|
|
3009
|
+
function Ti(r) {
|
|
3011
3010
|
return r && typeof r.nodeType == "number";
|
|
3012
3011
|
}
|
|
3013
3012
|
function pt(r) {
|
|
@@ -3022,21 +3021,21 @@ function ue(r) {
|
|
|
3022
3021
|
function Ee(r) {
|
|
3023
3022
|
return typeof r == "function";
|
|
3024
3023
|
}
|
|
3025
|
-
function
|
|
3024
|
+
function Ci(r) {
|
|
3026
3025
|
return !!(r && r.isComponent);
|
|
3027
3026
|
}
|
|
3028
|
-
function
|
|
3027
|
+
function Li(r) {
|
|
3029
3028
|
return ue(r) && typeof r.length == "number" && typeof r.nodeType != "number";
|
|
3030
3029
|
}
|
|
3031
|
-
function
|
|
3030
|
+
function it(r, e) {
|
|
3032
3031
|
if (r)
|
|
3033
|
-
for (const t of
|
|
3032
|
+
for (const t of qe(r))
|
|
3034
3033
|
e(r[t], t);
|
|
3035
3034
|
}
|
|
3036
|
-
function
|
|
3035
|
+
function ji(r) {
|
|
3037
3036
|
return ue(r) && "current" in r;
|
|
3038
3037
|
}
|
|
3039
|
-
const
|
|
3038
|
+
const nt = {
|
|
3040
3039
|
animationIterationCount: 0,
|
|
3041
3040
|
borderImageOutset: 0,
|
|
3042
3041
|
borderImageSlice: 0,
|
|
@@ -3081,30 +3080,30 @@ const it = {
|
|
|
3081
3080
|
strokeOpacity: 0,
|
|
3082
3081
|
strokeWidth: 0
|
|
3083
3082
|
};
|
|
3084
|
-
function
|
|
3083
|
+
function Di(r, e) {
|
|
3085
3084
|
return r + e.charAt(0).toUpperCase() + e.substring(1);
|
|
3086
3085
|
}
|
|
3087
|
-
const
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3086
|
+
const Ni = ["Webkit", "ms", "Moz", "O"];
|
|
3087
|
+
qe(nt).forEach((r) => {
|
|
3088
|
+
Ni.forEach((e) => {
|
|
3089
|
+
nt[Di(e, r)] = 0;
|
|
3091
3090
|
});
|
|
3092
3091
|
});
|
|
3093
|
-
const
|
|
3092
|
+
const Ui = Symbol.for("jsx-dom:type");
|
|
3094
3093
|
var or = /* @__PURE__ */ function(r) {
|
|
3095
3094
|
return r.ShadowRoot = "ShadowRoot", r;
|
|
3096
3095
|
}(or || {});
|
|
3097
|
-
function
|
|
3098
|
-
return r != null && r[
|
|
3096
|
+
function Mi(r) {
|
|
3097
|
+
return r != null && r[Ui] === or.ShadowRoot;
|
|
3099
3098
|
}
|
|
3100
|
-
const
|
|
3099
|
+
const Bi = "http://www.w3.org/2000/svg", Hi = "http://www.w3.org/1999/xlink", Fi = "http://www.w3.org/XML/1998/namespace";
|
|
3101
3100
|
function ar(r) {
|
|
3102
|
-
return !
|
|
3101
|
+
return !Ii(r) && r != null;
|
|
3103
3102
|
}
|
|
3104
|
-
function
|
|
3105
|
-
return Array.isArray(r) ? r.map(
|
|
3103
|
+
function st(r) {
|
|
3104
|
+
return Array.isArray(r) ? r.map(st).filter(Boolean).join(" ") : ue(r) ? Symbol.iterator in r ? st(Array.from(r)) : qe(r).filter((e) => r[e]).join(" ") : ar(r) ? "" + r : "";
|
|
3106
3105
|
}
|
|
3107
|
-
const
|
|
3106
|
+
const zi = {
|
|
3108
3107
|
animate: 0,
|
|
3109
3108
|
circle: 0,
|
|
3110
3109
|
clipPath: 0,
|
|
@@ -3159,12 +3158,12 @@ const Fi = {
|
|
|
3159
3158
|
tspan: 0,
|
|
3160
3159
|
use: 0,
|
|
3161
3160
|
view: 0
|
|
3162
|
-
},
|
|
3163
|
-
function
|
|
3161
|
+
}, qi = /^(a(ll|t|u)|base[FP]|c(al|lipPathU|on)|di|ed|ex|filter[RU]|g(lyphR|r)|ke|l(en|im)|ma(rker[HUW]|s)|n|pat|pr|point[^e]|re[^n]|s[puy]|st[^or]|ta|textL|vi|xC|y|z)/;
|
|
3162
|
+
function Ki(r) {
|
|
3164
3163
|
const e = document.createDocumentFragment();
|
|
3165
|
-
return
|
|
3164
|
+
return Ke(r.children, e), e;
|
|
3166
3165
|
}
|
|
3167
|
-
function
|
|
3166
|
+
function Wi(r, e, t) {
|
|
3168
3167
|
e = {
|
|
3169
3168
|
...e,
|
|
3170
3169
|
children: t
|
|
@@ -3172,15 +3171,15 @@ function qi(r, e, t) {
|
|
|
3172
3171
|
const i = new r(e), n = i.render();
|
|
3173
3172
|
return "ref" in e && mt(e.ref, i), n;
|
|
3174
3173
|
}
|
|
3175
|
-
function
|
|
3174
|
+
function A(r, e) {
|
|
3176
3175
|
let { children: t, ...i } = e;
|
|
3177
|
-
!i.namespaceURI &&
|
|
3176
|
+
!i.namespaceURI && zi[r] === 0 && (i = {
|
|
3178
3177
|
...i,
|
|
3179
|
-
namespaceURI:
|
|
3178
|
+
namespaceURI: Bi
|
|
3180
3179
|
});
|
|
3181
3180
|
let n;
|
|
3182
3181
|
if (pt(r)) {
|
|
3183
|
-
if (n = i.namespaceURI ? document.createElementNS(i.namespaceURI, r) : document.createElement(r),
|
|
3182
|
+
if (n = i.namespaceURI ? document.createElementNS(i.namespaceURI, r) : document.createElement(r), Xi(i, n), Ke(t, n), n instanceof window.HTMLSelectElement && i.value != null)
|
|
3184
3183
|
if (i.multiple === !0 && Array.isArray(i.value)) {
|
|
3185
3184
|
const s = i.value.map((o) => String(o));
|
|
3186
3185
|
n.querySelectorAll("option").forEach(
|
|
@@ -3193,7 +3192,7 @@ function P(r, e) {
|
|
|
3193
3192
|
ue(r.defaultProps) && (i = {
|
|
3194
3193
|
...r.defaultProps,
|
|
3195
3194
|
...i
|
|
3196
|
-
}), n =
|
|
3195
|
+
}), n = Ci(r) ? Wi(r, i, t) : r({
|
|
3197
3196
|
...i,
|
|
3198
3197
|
children: t
|
|
3199
3198
|
});
|
|
@@ -3202,39 +3201,39 @@ function P(r, e) {
|
|
|
3202
3201
|
return n;
|
|
3203
3202
|
}
|
|
3204
3203
|
function mt(r, e) {
|
|
3205
|
-
|
|
3204
|
+
ji(r) ? r.current = e : Ee(r) && r(e);
|
|
3206
3205
|
}
|
|
3207
|
-
function
|
|
3208
|
-
if (
|
|
3209
|
-
|
|
3206
|
+
function Ke(r, e) {
|
|
3207
|
+
if (Li(r))
|
|
3208
|
+
Yi(r, e);
|
|
3210
3209
|
else if (pt(r) || sr(r))
|
|
3211
|
-
|
|
3210
|
+
Ye(document.createTextNode(r), e);
|
|
3212
3211
|
else if (r === null)
|
|
3213
|
-
|
|
3214
|
-
else if (
|
|
3215
|
-
|
|
3216
|
-
else if (
|
|
3212
|
+
Ye(document.createComment(""), e);
|
|
3213
|
+
else if (Ti(r))
|
|
3214
|
+
Ye(r, e);
|
|
3215
|
+
else if (Mi(r)) {
|
|
3217
3216
|
const t = e.attachShadow(r.attr);
|
|
3218
|
-
|
|
3217
|
+
Ke(r.children, t), mt(r.ref, t);
|
|
3219
3218
|
}
|
|
3220
3219
|
}
|
|
3221
|
-
function
|
|
3220
|
+
function Yi(r, e) {
|
|
3222
3221
|
for (const t of [...r])
|
|
3223
|
-
|
|
3222
|
+
Ke(t, e);
|
|
3224
3223
|
return e;
|
|
3225
3224
|
}
|
|
3226
|
-
function
|
|
3225
|
+
function Ye(r, e) {
|
|
3227
3226
|
e instanceof window.HTMLTemplateElement ? e.content.appendChild(r) : e.appendChild(r);
|
|
3228
3227
|
}
|
|
3229
3228
|
function Te(r, e) {
|
|
3230
3229
|
return r.replace(/[A-Z]/g, (t) => e + t.toLowerCase());
|
|
3231
3230
|
}
|
|
3232
3231
|
function cr(r, e) {
|
|
3233
|
-
e == null || e === !1 || (Array.isArray(e) ? e.forEach((t) => cr(r, t)) : pt(e) ? r.setAttribute("style", e) : ue(e) &&
|
|
3234
|
-
i.indexOf("-") === 0 ? r.style.setProperty(i, t) : sr(t) &&
|
|
3232
|
+
e == null || e === !1 || (Array.isArray(e) ? e.forEach((t) => cr(r, t)) : pt(e) ? r.setAttribute("style", e) : ue(e) && it(e, (t, i) => {
|
|
3233
|
+
i.indexOf("-") === 0 ? r.style.setProperty(i, t) : sr(t) && nt[i] !== 0 ? r.style[i] = t + "px" : r.style[i] = t;
|
|
3235
3234
|
}));
|
|
3236
3235
|
}
|
|
3237
|
-
function
|
|
3236
|
+
function Gi(r, e, t) {
|
|
3238
3237
|
switch (r) {
|
|
3239
3238
|
case "xlinkActuate":
|
|
3240
3239
|
case "xlinkArcrole":
|
|
@@ -3243,7 +3242,7 @@ function Wi(r, e, t) {
|
|
|
3243
3242
|
case "xlinkShow":
|
|
3244
3243
|
case "xlinkTitle":
|
|
3245
3244
|
case "xlinkType":
|
|
3246
|
-
|
|
3245
|
+
It(t, Hi, Te(r, ":"), e);
|
|
3247
3246
|
return;
|
|
3248
3247
|
case "xmlnsXlink":
|
|
3249
3248
|
fe(t, Te(r, ":"), e);
|
|
@@ -3251,7 +3250,7 @@ function Wi(r, e, t) {
|
|
|
3251
3250
|
case "xmlBase":
|
|
3252
3251
|
case "xmlLang":
|
|
3253
3252
|
case "xmlSpace":
|
|
3254
|
-
|
|
3253
|
+
It(t, Fi, Te(r, ":"), e);
|
|
3255
3254
|
return;
|
|
3256
3255
|
}
|
|
3257
3256
|
switch (r) {
|
|
@@ -3259,7 +3258,7 @@ function Wi(r, e, t) {
|
|
|
3259
3258
|
fe(t, "for", e);
|
|
3260
3259
|
return;
|
|
3261
3260
|
case "dataset":
|
|
3262
|
-
|
|
3261
|
+
it(e, (i, n) => {
|
|
3263
3262
|
i != null && (t.dataset[n] = i);
|
|
3264
3263
|
});
|
|
3265
3264
|
return;
|
|
@@ -3284,7 +3283,7 @@ function Wi(r, e, t) {
|
|
|
3284
3283
|
return;
|
|
3285
3284
|
case "class":
|
|
3286
3285
|
case "className":
|
|
3287
|
-
Ee(e) ? e(t) : fe(t, "class",
|
|
3286
|
+
Ee(e) ? e(t) : fe(t, "class", st(e));
|
|
3288
3287
|
return;
|
|
3289
3288
|
case "ref":
|
|
3290
3289
|
case "namespaceURI":
|
|
@@ -3294,7 +3293,7 @@ function Wi(r, e, t) {
|
|
|
3294
3293
|
return;
|
|
3295
3294
|
case "on":
|
|
3296
3295
|
case "onCapture":
|
|
3297
|
-
|
|
3296
|
+
it(e, (i, n) => {
|
|
3298
3297
|
t.addEventListener(n, i, r === "onCapture");
|
|
3299
3298
|
});
|
|
3300
3299
|
return;
|
|
@@ -3316,22 +3315,22 @@ function Wi(r, e, t) {
|
|
|
3316
3315
|
i in window ? s = i.substring(2) : s = i[2] + r.slice(3), t.addEventListener(s, e);
|
|
3317
3316
|
}
|
|
3318
3317
|
}
|
|
3319
|
-
} else ue(e) ? t[r] = e : e === !0 ? fe(t, r, "") : e !== !1 && e != null && (t instanceof SVGElement && !
|
|
3318
|
+
} else ue(e) ? t[r] = e : e === !0 ? fe(t, r, "") : e !== !1 && e != null && (t instanceof SVGElement && !qi.test(r) ? fe(t, Te(r, "-"), e) : fe(t, r, e));
|
|
3320
3319
|
}
|
|
3321
3320
|
function fe(r, e, t) {
|
|
3322
3321
|
r.setAttribute(e, t);
|
|
3323
3322
|
}
|
|
3324
|
-
function
|
|
3323
|
+
function It(r, e, t, i) {
|
|
3325
3324
|
r.setAttributeNS(e, t, i);
|
|
3326
3325
|
}
|
|
3327
|
-
function
|
|
3328
|
-
for (const t of
|
|
3329
|
-
|
|
3326
|
+
function Xi(r, e) {
|
|
3327
|
+
for (const t of qe(r))
|
|
3328
|
+
Gi(t, r[t], e);
|
|
3330
3329
|
return e;
|
|
3331
3330
|
}
|
|
3332
3331
|
var gt = /* @__PURE__ */ ((r) => (r.Init = "modal.init", r.BeforeShow = "modal.beforeShow", r.Show = "modal.show", r.BeforeClose = "modal.beforeClose", r.Close = "modal.close", r.Destroy = "modal.destroy", r.ToastShow = "toast.show", r.ToastClose = "toast.close", r))(gt || {});
|
|
3333
|
-
let
|
|
3334
|
-
const
|
|
3332
|
+
let Vi = 0;
|
|
3333
|
+
const Tt = (r) => `${r}-${++Vi}`;
|
|
3335
3334
|
function ye(r) {
|
|
3336
3335
|
return r instanceof Node ? r : document.createTextNode(String(r));
|
|
3337
3336
|
}
|
|
@@ -3358,8 +3357,8 @@ function U(r, e = {}) {
|
|
|
3358
3357
|
for (const [i, n] of Object.entries(e.attrs)) t.setAttribute(i, n);
|
|
3359
3358
|
return t;
|
|
3360
3359
|
}
|
|
3361
|
-
const
|
|
3362
|
-
function
|
|
3360
|
+
const Qi = typeof navigator < "u" && /Mac|iPhone|iPad|iPod/i.test(navigator.platform), lr = ["ctrl", "alt", "shift", "meta"];
|
|
3361
|
+
function Ji(r) {
|
|
3363
3362
|
if (!r) return null;
|
|
3364
3363
|
const e = String(r).trim().toLowerCase().split(/[+\-\s]+/g).filter(Boolean), t = [];
|
|
3365
3364
|
let i = null;
|
|
@@ -3385,7 +3384,7 @@ function Vi(r) {
|
|
|
3385
3384
|
continue;
|
|
3386
3385
|
}
|
|
3387
3386
|
if (a === "mod") {
|
|
3388
|
-
n(
|
|
3387
|
+
n(Qi ? "meta" : "ctrl");
|
|
3389
3388
|
continue;
|
|
3390
3389
|
}
|
|
3391
3390
|
a === "esc" && (a = "escape"), a === "return" && (a = "enter"), (a === "space" || a === "spacebar") && (a = "space"), i = a;
|
|
@@ -3393,7 +3392,7 @@ function Vi(r) {
|
|
|
3393
3392
|
const s = lr.filter((o) => t.includes(o));
|
|
3394
3393
|
return !i || i === "" ? s.length ? s.join("+") : null : s.length ? `${s.join("+")}+${i}` : i;
|
|
3395
3394
|
}
|
|
3396
|
-
function
|
|
3395
|
+
function Zi(r) {
|
|
3397
3396
|
const e = [];
|
|
3398
3397
|
r.ctrlKey && e.push("ctrl"), r.altKey && e.push("alt"), r.shiftKey && e.push("shift"), r.metaKey && e.push("meta");
|
|
3399
3398
|
let t = r.key;
|
|
@@ -3401,7 +3400,7 @@ function Ji(r) {
|
|
|
3401
3400
|
const i = (t.length, t.toLowerCase()), n = lr.filter((s) => e.includes(s));
|
|
3402
3401
|
return n.length ? `${n.join("+")}+${i}` : i;
|
|
3403
3402
|
}
|
|
3404
|
-
class
|
|
3403
|
+
class en {
|
|
3405
3404
|
constructor() {
|
|
3406
3405
|
this.zBase = 1e3, this.stack = [];
|
|
3407
3406
|
}
|
|
@@ -3434,23 +3433,10 @@ class Qi {
|
|
|
3434
3433
|
document.body.classList.remove("ipe-modal-no-scroll");
|
|
3435
3434
|
}
|
|
3436
3435
|
}
|
|
3437
|
-
const B = new
|
|
3438
|
-
class
|
|
3436
|
+
const B = new en();
|
|
3437
|
+
class Me {
|
|
3439
3438
|
constructor(e = {}) {
|
|
3440
|
-
this.backdropId =
|
|
3441
|
-
className: "",
|
|
3442
|
-
sizeClass: "auto",
|
|
3443
|
-
center: !0,
|
|
3444
|
-
fitScreen: !1,
|
|
3445
|
-
closeIcon: !0,
|
|
3446
|
-
bodyScroll: !1,
|
|
3447
|
-
// lock body scroll by default
|
|
3448
|
-
outSideClose: !0,
|
|
3449
|
-
backdrop: !0,
|
|
3450
|
-
animation: !1,
|
|
3451
|
-
// no transitions by default
|
|
3452
|
-
animationSpeed: 200
|
|
3453
|
-
}, this._hooks = [], this.startCloseTimer = (t) => {
|
|
3439
|
+
this.backdropId = Tt("ipe-modal-backdrop"), this.modalId = Tt("ipe-modal"), this.numberId = this.modalId.split("-")[1], this._isDestroyed = !1, this.pluginName = "normalModal", this.buttonElsLeft = [], this.buttonElsRight = [], this.keyMap = /* @__PURE__ */ new Map(), this.isOpen = !1, this.isToast = !1, this.isDragging = !1, this.dragStartX = 0, this.dragStartY = 0, this.modalStartX = 0, this.modalStartY = 0, this.Event = gt, this._hooks = [], this.startCloseTimer = (t) => {
|
|
3454
3440
|
this.stopCloseTimer(), this.closeTimer = window.setTimeout(() => this.close(), t);
|
|
3455
3441
|
}, this.stopCloseTimer = () => {
|
|
3456
3442
|
this.closeTimer && window.clearTimeout(this.closeTimer), this.closeTimer = void 0;
|
|
@@ -3466,11 +3452,35 @@ class yt {
|
|
|
3466
3452
|
t.classList.remove("is-dragging"), i.style.animation = "none", requestAnimationFrame(() => {
|
|
3467
3453
|
this.applyAnimation(!0);
|
|
3468
3454
|
});
|
|
3469
|
-
}, this.options = { ...
|
|
3455
|
+
}, this.options = { ...Me.DEFAULT_OPTIONS, ...e }, this.options.backdrop === !1 && e.bodyScroll === void 0 && (this.options.bodyScroll = !0);
|
|
3470
3456
|
}
|
|
3471
3457
|
get isDestroyed() {
|
|
3472
3458
|
return this._isDestroyed;
|
|
3473
3459
|
}
|
|
3460
|
+
static {
|
|
3461
|
+
this.DEFAULT_OPTIONS = {
|
|
3462
|
+
className: "",
|
|
3463
|
+
sizeClass: "auto",
|
|
3464
|
+
center: !0,
|
|
3465
|
+
fitScreen: !1,
|
|
3466
|
+
closeIcon: !0,
|
|
3467
|
+
bodyScroll: !1,
|
|
3468
|
+
outSideClose: !0,
|
|
3469
|
+
backdrop: !0,
|
|
3470
|
+
animation: {
|
|
3471
|
+
show: "ipe-modal-fade-in",
|
|
3472
|
+
hide: "ipe-modal-fade-out"
|
|
3473
|
+
},
|
|
3474
|
+
animationSpeed: 200
|
|
3475
|
+
};
|
|
3476
|
+
}
|
|
3477
|
+
static extends(e = {}) {
|
|
3478
|
+
return class extends this {
|
|
3479
|
+
constructor(t = {}) {
|
|
3480
|
+
super({ ...e, ...t });
|
|
3481
|
+
}
|
|
3482
|
+
};
|
|
3483
|
+
}
|
|
3474
3484
|
// ------------------------------ lifecycle ------------------------------ //
|
|
3475
3485
|
init() {
|
|
3476
3486
|
if (this.$modal) return this;
|
|
@@ -3486,9 +3496,9 @@ class yt {
|
|
|
3486
3496
|
});
|
|
3487
3497
|
if (i.modal = this, !e) {
|
|
3488
3498
|
i.classList.add("no-backdrop");
|
|
3489
|
-
const g = window.pageYOffset || document.documentElement.scrollTop, b = window.pageXOffset || document.documentElement.scrollLeft,
|
|
3499
|
+
const g = window.pageYOffset || document.documentElement.scrollTop, b = window.pageXOffset || document.documentElement.scrollLeft, R = window.innerWidth;
|
|
3490
3500
|
i.style.top = `${g + 60}px`, this.once("modal.show", () => {
|
|
3491
|
-
i.style.left = `${b +
|
|
3501
|
+
i.style.left = `${b + R / 2 - i.offsetWidth / 2}px`;
|
|
3492
3502
|
});
|
|
3493
3503
|
}
|
|
3494
3504
|
const n = U("div", {
|
|
@@ -3512,7 +3522,7 @@ class yt {
|
|
|
3512
3522
|
typeof this.options.onClickClose == "function" ? this.options.onClickClose(this) === !1 && (b = !1) : this.options.onClickClose === !1 && (b = !1), b && this.close();
|
|
3513
3523
|
}), c.appendChild(g);
|
|
3514
3524
|
}
|
|
3515
|
-
s.append(a, c),
|
|
3525
|
+
s.append(a, c), this.options.draggable && e && (this.options.draggable = !1), this.options.draggable && (s.style.cursor = "move", s.style.userSelect = "none", s.addEventListener("pointerdown", this.onDragStart.bind(this)), i.classList.add("is-draggable"));
|
|
3516
3526
|
const u = U("div", { className: "ipe-modal-modal__content" }), p = U("div", { className: "ipe-modal-modal__footer" }), y = U("div", {
|
|
3517
3527
|
className: "ipe-modal-modal__buttons ipe-modal-modal__buttons--left"
|
|
3518
3528
|
}), w = U("div", {
|
|
@@ -3520,6 +3530,8 @@ class yt {
|
|
|
3520
3530
|
});
|
|
3521
3531
|
return p.append(y, w), n.append(s, u, p), i.appendChild(n), this.$backdrop = t, this.$modal = i, this.$window = n, this.$header = s, this.$title = a, this.$icons = c, this.$content = u, this.$footer = p, this.$buttonsLeft = y, this.$buttonsRight = w, this.options.title && this.setTitle(this.options.title), this.options.content && this.setContent(this.options.content), this.options.buttons?.length ? this.setButtons(this.options.buttons) : p.style.display = "none", this.options.center && this.$modal.classList.add("is-centered"), this.options.fitScreen && this.$modal.classList.add("is-fullscreen"), this.options.iconButtons && this.$header.classList.add("has-icon-buttons"), this.options.className && this.$window.classList.add(...this.options.className.split(/[\s\.#+]+/g).filter(Boolean)), typeof this.options.fixedHeight == "number" ? this.$window.style.height = `${Math.max(0, this.options.fixedHeight)}px` : this.options.fixedHeight === !0 && this.$window.classList.add("is-fixed-height"), t && t.addEventListener("pointerdown", (g) => {
|
|
3522
3532
|
this.options.outSideClose && g.target === t && this.close();
|
|
3533
|
+
}), this.options.draggable && n.addEventListener("pointerdown", (g) => {
|
|
3534
|
+
g.target && n.contains(g.target) && this.bringToFront();
|
|
3523
3535
|
}), this.onKeyDown = this.onKeyDown.bind(this), this.emit(
|
|
3524
3536
|
"modal.init"
|
|
3525
3537
|
/* Init */
|
|
@@ -3680,7 +3692,7 @@ class yt {
|
|
|
3680
3692
|
if (e.keyPress) {
|
|
3681
3693
|
const s = String(e.keyPress).split(/[\,\|]+/g).map((o) => o.trim()).filter(Boolean);
|
|
3682
3694
|
for (const o of s) {
|
|
3683
|
-
const a =
|
|
3695
|
+
const a = Ji(o);
|
|
3684
3696
|
a && this.keyMap.set(a, i);
|
|
3685
3697
|
}
|
|
3686
3698
|
}
|
|
@@ -3769,7 +3781,7 @@ class yt {
|
|
|
3769
3781
|
const i = e.ctrlKey || e.altKey || e.metaKey, n = e.target;
|
|
3770
3782
|
if (!i && (n && ["INPUT", "TEXTAREA"].includes(n.tagName) || n.contentEditable === "true"))
|
|
3771
3783
|
return;
|
|
3772
|
-
const s =
|
|
3784
|
+
const s = Zi(e), o = this.keyMap.get(s);
|
|
3773
3785
|
if (o) {
|
|
3774
3786
|
e.preventDefault(), o.click();
|
|
3775
3787
|
return;
|
|
@@ -3807,7 +3819,7 @@ class yt {
|
|
|
3807
3819
|
/** Show as toast (no backdrop, container stack). */
|
|
3808
3820
|
showToast(e) {
|
|
3809
3821
|
this.$window || this.init();
|
|
3810
|
-
const t =
|
|
3822
|
+
const t = tn(e.position ?? "top right"), i = this.get$window();
|
|
3811
3823
|
this.isToast = !0, i.style.pointerEvents = "auto", this.applyAnimation(!0), t.appendChild(i);
|
|
3812
3824
|
const n = (typeof this.options.closeAfter == "number" ? this.options.closeAfter : this.options.closeAfter?.time) ?? 3e3, s = (typeof this.options.closeAfter == "number" ? !0 : this.options.closeAfter?.resetOnHover) ?? !0;
|
|
3813
3825
|
return n > 0 && (this.startCloseTimer(n), s && (i.addEventListener("mouseenter", this.stopCloseTimer), i.addEventListener("mouseleave", () => this.startCloseTimer(n)))), this.isOpen = !0, this.options.onShow?.(this), oe.push(this), this.emit(
|
|
@@ -3841,7 +3853,7 @@ class yt {
|
|
|
3841
3853
|
return B.closeAll(e, t), [...oe].forEach((s) => {
|
|
3842
3854
|
const o = s.modalId, a = n.size ? n.has(s.pluginName) : !0, c = i.has(o);
|
|
3843
3855
|
a && !c && s.close();
|
|
3844
|
-
}), B.top() ?? new
|
|
3856
|
+
}), B.top() ?? new Me();
|
|
3845
3857
|
}
|
|
3846
3858
|
static removeAll() {
|
|
3847
3859
|
B.removeAll(), [...oe].forEach((e) => e.destroy());
|
|
@@ -3865,7 +3877,8 @@ class yt {
|
|
|
3865
3877
|
}
|
|
3866
3878
|
static confirm(e, t) {
|
|
3867
3879
|
e.title ??= "Confirm", e.content ??= "Are you sure you want to perform this action?";
|
|
3868
|
-
const i = e.okBtn ?? { label: "OK", className: "is-primary is-ghost" }, n = e.cancelBtn ?? { label: "Cancel", className: "is-danger is-ghost" }
|
|
3880
|
+
const i = e.okBtn ?? { label: "OK", className: "is-primary is-ghost" }, n = e.cancelBtn ?? { label: "Cancel", className: "is-danger is-ghost" };
|
|
3881
|
+
return new this({
|
|
3869
3882
|
sizeClass: "dialog",
|
|
3870
3883
|
...e,
|
|
3871
3884
|
buttons: [
|
|
@@ -3873,24 +3886,25 @@ class yt {
|
|
|
3873
3886
|
label: n.label,
|
|
3874
3887
|
className: n.className,
|
|
3875
3888
|
keyPress: "n",
|
|
3876
|
-
method: () =>
|
|
3889
|
+
method: (s, o) => {
|
|
3890
|
+
t?.(!1, o, s), o.close();
|
|
3891
|
+
}
|
|
3877
3892
|
},
|
|
3878
3893
|
{
|
|
3879
3894
|
label: i.label,
|
|
3880
3895
|
className: i.className,
|
|
3881
3896
|
keyPress: "y",
|
|
3882
|
-
method: (o) => {
|
|
3883
|
-
t?.(o, s),
|
|
3897
|
+
method: (s, o) => {
|
|
3898
|
+
t?.(!0, o, s), s.defaultPrevented || o.close();
|
|
3884
3899
|
}
|
|
3885
3900
|
}
|
|
3886
3901
|
]
|
|
3887
|
-
});
|
|
3888
|
-
return s.init().show();
|
|
3902
|
+
}).init().show();
|
|
3889
3903
|
}
|
|
3890
3904
|
static getDefaultNotifyIcon(e) {
|
|
3891
3905
|
switch (e) {
|
|
3892
3906
|
case "success":
|
|
3893
|
-
return /* @__PURE__ */
|
|
3907
|
+
return /* @__PURE__ */ A(
|
|
3894
3908
|
"svg",
|
|
3895
3909
|
{
|
|
3896
3910
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -3900,13 +3914,13 @@ class yt {
|
|
|
3900
3914
|
fill: "currentColor",
|
|
3901
3915
|
class: "icon icon-tabler icons-tabler-filled icon-tabler-circle-check",
|
|
3902
3916
|
children: [
|
|
3903
|
-
/* @__PURE__ */
|
|
3904
|
-
/* @__PURE__ */
|
|
3917
|
+
/* @__PURE__ */ A("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
|
|
3918
|
+
/* @__PURE__ */ A("path", { d: "M17 3.34a10 10 0 1 1 -14.995 8.984l-.005 -.324l.005 -.324a10 10 0 0 1 14.995 -8.336zm-1.293 5.953a1 1 0 0 0 -1.32 -.083l-.094 .083l-3.293 3.292l-1.293 -1.292l-.094 -.083a1 1 0 0 0 -1.403 1.403l.083 .094l2 2l.094 .083a1 1 0 0 0 1.226 0l.094 -.083l4 -4l.083 -.094a1 1 0 0 0 -.083 -1.32z" })
|
|
3905
3919
|
]
|
|
3906
3920
|
}
|
|
3907
3921
|
);
|
|
3908
3922
|
case "error":
|
|
3909
|
-
return /* @__PURE__ */
|
|
3923
|
+
return /* @__PURE__ */ A(
|
|
3910
3924
|
"svg",
|
|
3911
3925
|
{
|
|
3912
3926
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -3916,13 +3930,13 @@ class yt {
|
|
|
3916
3930
|
fill: "currentColor",
|
|
3917
3931
|
class: "icon icon-tabler icons-tabler-filled icon-tabler-alert-triangle",
|
|
3918
3932
|
children: [
|
|
3919
|
-
/* @__PURE__ */
|
|
3920
|
-
/* @__PURE__ */
|
|
3933
|
+
/* @__PURE__ */ A("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
|
|
3934
|
+
/* @__PURE__ */ A("path", { d: "M12 1.67c.955 0 1.845 .467 2.39 1.247l.105 .16l8.114 13.548a2.914 2.914 0 0 1 -2.307 4.363l-.195 .008h-16.225a2.914 2.914 0 0 1 -2.582 -4.2l.099 -.185l8.11 -13.538a2.914 2.914 0 0 1 2.491 -1.403zm.01 13.33l-.127 .007a1 1 0 0 0 0 1.986l.117 .007l.127 -.007a1 1 0 0 0 0 -1.986l-.117 -.007zm-.01 -7a1 1 0 0 0 -.993 .883l-.007 .117v4l.007 .117a1 1 0 0 0 1.986 0l.007 -.117v-4l-.007 -.117a1 1 0 0 0 -.993 -.883z" })
|
|
3921
3935
|
]
|
|
3922
3936
|
}
|
|
3923
3937
|
);
|
|
3924
3938
|
case "warning":
|
|
3925
|
-
return /* @__PURE__ */
|
|
3939
|
+
return /* @__PURE__ */ A(
|
|
3926
3940
|
"svg",
|
|
3927
3941
|
{
|
|
3928
3942
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -3932,13 +3946,13 @@ class yt {
|
|
|
3932
3946
|
fill: "currentColor",
|
|
3933
3947
|
class: "icon icon-tabler icons-tabler-filled icon-tabler-alert-circle",
|
|
3934
3948
|
children: [
|
|
3935
|
-
/* @__PURE__ */
|
|
3936
|
-
/* @__PURE__ */
|
|
3949
|
+
/* @__PURE__ */ A("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
|
|
3950
|
+
/* @__PURE__ */ A("path", { d: "M12 2c5.523 0 10 4.477 10 10a10 10 0 0 1 -19.995 .324l-.005 -.324l.004 -.28c.148 -5.393 4.566 -9.72 9.996 -9.72zm.01 13l-.127 .007a1 1 0 0 0 0 1.986l.117 .007l.127 -.007a1 1 0 0 0 0 -1.986l-.117 -.007zm-.01 -8a1 1 0 0 0 -.993 .883l-.007 .117v4l.007 .117a1 1 0 0 0 1.986 0l.007 -.117v-4l-.007 -.117a1 1 0 0 0 -.993 -.883z" })
|
|
3937
3951
|
]
|
|
3938
3952
|
}
|
|
3939
3953
|
);
|
|
3940
3954
|
case "info":
|
|
3941
|
-
return /* @__PURE__ */
|
|
3955
|
+
return /* @__PURE__ */ A(
|
|
3942
3956
|
"svg",
|
|
3943
3957
|
{
|
|
3944
3958
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -3948,13 +3962,13 @@ class yt {
|
|
|
3948
3962
|
fill: "currentColor",
|
|
3949
3963
|
class: "icon icon-tabler icons-tabler-filled icon-tabler-info-circle",
|
|
3950
3964
|
children: [
|
|
3951
|
-
/* @__PURE__ */
|
|
3952
|
-
/* @__PURE__ */
|
|
3965
|
+
/* @__PURE__ */ A("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
|
|
3966
|
+
/* @__PURE__ */ A("path", { d: "M12 2c5.523 0 10 4.477 10 10a10 10 0 0 1 -19.995 .324l-.005 -.324l.004 -.28c.148 -5.393 4.566 -9.72 9.996 -9.72zm0 9h-1l-.117 .007a1 1 0 0 0 0 1.986l.117 .007v3l.007 .117a1 1 0 0 0 .876 .876l.117 .007h1l.117 -.007a1 1 0 0 0 .876 -.876l.007 -.117l-.007 -.117a1 1 0 0 0 -.764 -.857l-.112 -.02l-.117 -.006v-3l-.007 -.117a1 1 0 0 0 -.876 -.876l-.117 -.007zm.01 -3l-.127 .007a1 1 0 0 0 0 1.986l.117 .007l.127 -.007a1 1 0 0 0 0 -1.986l-.117 -.007z" })
|
|
3953
3967
|
]
|
|
3954
3968
|
}
|
|
3955
3969
|
);
|
|
3956
3970
|
case "dialog":
|
|
3957
|
-
return /* @__PURE__ */
|
|
3971
|
+
return /* @__PURE__ */ A(
|
|
3958
3972
|
"svg",
|
|
3959
3973
|
{
|
|
3960
3974
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -3968,16 +3982,16 @@ class yt {
|
|
|
3968
3982
|
"stroke-linejoin": "round",
|
|
3969
3983
|
class: "icon icon-tabler icons-tabler-outline icon-tabler-message-dots",
|
|
3970
3984
|
children: [
|
|
3971
|
-
/* @__PURE__ */
|
|
3972
|
-
/* @__PURE__ */
|
|
3973
|
-
/* @__PURE__ */
|
|
3974
|
-
/* @__PURE__ */
|
|
3975
|
-
/* @__PURE__ */
|
|
3985
|
+
/* @__PURE__ */ A("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
|
|
3986
|
+
/* @__PURE__ */ A("path", { d: "M12 11v.01" }),
|
|
3987
|
+
/* @__PURE__ */ A("path", { d: "M8 11v.01" }),
|
|
3988
|
+
/* @__PURE__ */ A("path", { d: "M16 11v.01" }),
|
|
3989
|
+
/* @__PURE__ */ A("path", { d: "M18 4a3 3 0 0 1 3 3v8a3 3 0 0 1 -3 3h-5l-5 3v-3h-2a3 3 0 0 1 -3 -3v-8a3 3 0 0 1 3 -3z" })
|
|
3976
3990
|
]
|
|
3977
3991
|
}
|
|
3978
3992
|
);
|
|
3979
3993
|
case "confirm":
|
|
3980
|
-
return /* @__PURE__ */
|
|
3994
|
+
return /* @__PURE__ */ A(
|
|
3981
3995
|
"svg",
|
|
3982
3996
|
{
|
|
3983
3997
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -3987,8 +4001,8 @@ class yt {
|
|
|
3987
4001
|
fill: "currentColor",
|
|
3988
4002
|
class: "icon icon-tabler icons-tabler-filled icon-tabler-copy-check",
|
|
3989
4003
|
children: [
|
|
3990
|
-
/* @__PURE__ */
|
|
3991
|
-
/* @__PURE__ */
|
|
4004
|
+
/* @__PURE__ */ A("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
|
|
4005
|
+
/* @__PURE__ */ A("path", { d: "M18.333 6a3.667 3.667 0 0 1 3.667 3.667v8.666a3.667 3.667 0 0 1 -3.667 3.667h-8.666a3.667 3.667 0 0 1 -3.667 -3.667v-8.666a3.667 3.667 0 0 1 3.667 -3.667zm-3.333 -4c1.094 0 1.828 .533 2.374 1.514a1 1 0 1 1 -1.748 .972c-.221 -.398 -.342 -.486 -.626 -.486h-10c-.548 0 -1 .452 -1 1v9.998c0 .32 .154 .618 .407 .805l.1 .065a1 1 0 1 1 -.99 1.738a3 3 0 0 1 -1.517 -2.606v-10c0 -1.652 1.348 -3 3 -3zm1.293 9.293l-3.293 3.292l-1.293 -1.292a1 1 0 0 0 -1.414 1.414l2 2a1 1 0 0 0 1.414 0l4 -4a1 1 0 0 0 -1.414 -1.414" })
|
|
3992
4006
|
]
|
|
3993
4007
|
}
|
|
3994
4008
|
);
|
|
@@ -4002,13 +4016,13 @@ class yt {
|
|
|
4002
4016
|
t.title = a[0].toUpperCase() + a.slice(1).toLowerCase();
|
|
4003
4017
|
}
|
|
4004
4018
|
const n = t.icon ?? this.getDefaultNotifyIcon(e);
|
|
4005
|
-
n && (n instanceof Element && n.classList.add("ipe-modal-notify-icon"), t.title = /* @__PURE__ */
|
|
4019
|
+
n && (n instanceof Element && n.classList.add("ipe-modal-notify-icon"), t.title = /* @__PURE__ */ A(Ki, { children: [
|
|
4006
4020
|
n,
|
|
4007
4021
|
t.title
|
|
4008
|
-
] })), t.okBtn && (t.okBtn.label ??= "OK", t.okBtn.className ??= "is-primary is-
|
|
4009
|
-
i?.(!0),
|
|
4010
|
-
}), t.cancelBtn && (t.cancelBtn.label ??= "Cancel", t.cancelBtn.className ??= "is-danger is-
|
|
4011
|
-
i?.(!1),
|
|
4022
|
+
] })), e === "confirm" && (typeof t.closeAfter > "u" && (t.closeAfter = 0), t.okBtn || (t.okBtn = { label: "OK" })), t.okBtn && (typeof t.okBtn != "object" && (t.okBtn = { label: "OK" }), t.okBtn.label ??= "OK", t.okBtn.className ??= "is-primary is-text ok-btn", t.okBtn.method = (a, c) => {
|
|
4023
|
+
i?.(!0, c, a), c.close();
|
|
4024
|
+
}), t.cancelBtn && (typeof t.cancelBtn != "object" && (t.cancelBtn = { label: "Cancel" }), t.cancelBtn.label ??= "Cancel", t.cancelBtn.className ??= "is-danger is-text cancel-btn", t.cancelBtn.method = (a, c) => {
|
|
4025
|
+
i?.(!1, c, a), c.close();
|
|
4012
4026
|
}), t.buttons = [t.cancelBtn, t.okBtn, ...t.buttons ?? []].filter(
|
|
4013
4027
|
Boolean
|
|
4014
4028
|
);
|
|
@@ -4021,10 +4035,6 @@ class yt {
|
|
|
4021
4035
|
closeIcon: !0,
|
|
4022
4036
|
outSideClose: !1,
|
|
4023
4037
|
bodyScroll: !0,
|
|
4024
|
-
animation: t.animation ?? {
|
|
4025
|
-
show: "fadeIn",
|
|
4026
|
-
hide: "fadeOut"
|
|
4027
|
-
},
|
|
4028
4038
|
buttons: t.buttons ?? []
|
|
4029
4039
|
});
|
|
4030
4040
|
return o.setPluginName("toast"), o.showToast({
|
|
@@ -4033,7 +4043,7 @@ class yt {
|
|
|
4033
4043
|
}
|
|
4034
4044
|
}
|
|
4035
4045
|
const oe = [];
|
|
4036
|
-
function
|
|
4046
|
+
function tn(r = "top right") {
|
|
4037
4047
|
const e = "ipe-modal-toast-container", t = `${e}-${r.replace(/[\s-\.|\/]+/g, "-")}`;
|
|
4038
4048
|
let i = document.getElementById(t);
|
|
4039
4049
|
return i || (i = U("div", {
|
|
@@ -4041,7 +4051,7 @@ function Zi(r = "top right") {
|
|
|
4041
4051
|
attrs: { id: t, "data-position": r }
|
|
4042
4052
|
}), document.body.appendChild(i)), i;
|
|
4043
4053
|
}
|
|
4044
|
-
class
|
|
4054
|
+
class C extends Me {
|
|
4045
4055
|
constructor(e = {}) {
|
|
4046
4056
|
e.className ||= "", e.className += " theme-ipe", e.modalAnimation ||= {
|
|
4047
4057
|
show: "ipe-modal-fade-in",
|
|
@@ -4056,7 +4066,7 @@ class L extends yt {
|
|
|
4056
4066
|
this._tmpDisabledActiveInputs = t, t.forEach((i) => {
|
|
4057
4067
|
i.disabled = !0;
|
|
4058
4068
|
}), this.get$content().append(
|
|
4059
|
-
/* @__PURE__ */
|
|
4069
|
+
/* @__PURE__ */ H(
|
|
4060
4070
|
"div",
|
|
4061
4071
|
{
|
|
4062
4072
|
id: "ipe-modalLoadingWrapper",
|
|
@@ -4072,7 +4082,7 @@ class L extends yt {
|
|
|
4072
4082
|
backgroundColor: "rgba(255, 255, 255, 0.5)",
|
|
4073
4083
|
zIndex: 2e3
|
|
4074
4084
|
},
|
|
4075
|
-
children: /* @__PURE__ */
|
|
4085
|
+
children: /* @__PURE__ */ H(Er, { style: { width: "80%", maxWidth: "800px" } })
|
|
4076
4086
|
}
|
|
4077
4087
|
)
|
|
4078
4088
|
);
|
|
@@ -4085,10 +4095,10 @@ class L extends yt {
|
|
|
4085
4095
|
}
|
|
4086
4096
|
}
|
|
4087
4097
|
}
|
|
4088
|
-
class
|
|
4098
|
+
class rn {
|
|
4089
4099
|
constructor(e) {
|
|
4090
|
-
this.ctx = e, this.IPEModal =
|
|
4091
|
-
|
|
4100
|
+
this.ctx = e, this.IPEModal = C, this.IPEModalEvent = gt, this.show = C.show.bind(C), this.createObject = C.createObject.bind(C), this.close = C.close.bind(C), this.closeAll = C.closeAll.bind(C), this.removeAll = C.removeAll.bind(C), this.dialog = C.dialog.bind(C), this.confirm = C.confirm.bind(C), this.notify = C.notify.bind(C), e.set("modal", this), e.on("dispose", () => {
|
|
4101
|
+
C.closeAll();
|
|
4092
4102
|
});
|
|
4093
4103
|
}
|
|
4094
4104
|
}
|
|
@@ -4121,132 +4131,162 @@ const ur = (r) => {
|
|
|
4121
4131
|
n.set(o, a);
|
|
4122
4132
|
return i.search = n.toString(), i.hash = "", i;
|
|
4123
4133
|
};
|
|
4124
|
-
var
|
|
4134
|
+
var nn = Object.create, yt = Object.defineProperty, sn = Object.getOwnPropertyDescriptor, fr = (r, e) => (e = Symbol[r]) ? e : Symbol.for("Symbol." + r), dr = (r) => {
|
|
4125
4135
|
throw TypeError(r);
|
|
4126
|
-
},
|
|
4136
|
+
}, on = (r, e, t) => e in r ? yt(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, an = (r, e) => yt(r, "name", { value: e, configurable: !0 }), cn = (r) => [, , , nn(r?.[fr("metadata")] ?? null)], ln = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"], pr = (r) => r !== void 0 && typeof r != "function" ? dr("Function expected") : r, un = (r, e, t, i, n) => ({ kind: ln[r], name: e, metadata: i, addInitializer: (s) => t._ ? dr("Already initialized") : n.push(pr(s || null)) }), hn = (r, e) => on(e, fr("metadata"), r[3]), fn = (r, e, t, i) => {
|
|
4127
4137
|
for (var n = 0, s = r[e >> 1], o = s && s.length; n < o; n++) s[n].call(t);
|
|
4128
4138
|
return i;
|
|
4129
|
-
},
|
|
4130
|
-
var o, a, c, u = e & 7, p = !1, y = 0, w = r[y] || (r[y] = []), g = u && (n = n.prototype, u < 5 && (u > 3 || !p) &&
|
|
4131
|
-
|
|
4139
|
+
}, dn = (r, e, t, i, n, s) => {
|
|
4140
|
+
var o, a, c, u = e & 7, p = !1, y = 0, w = r[y] || (r[y] = []), g = u && (n = n.prototype, u < 5 && (u > 3 || !p) && sn(n, t));
|
|
4141
|
+
an(n, t);
|
|
4132
4142
|
for (var b = i.length - 1; b >= 0; b--)
|
|
4133
|
-
c =
|
|
4134
|
-
return
|
|
4135
|
-
}, mr,
|
|
4143
|
+
c = un(u, t, a = {}, r[3], w), o = (0, i[b])(n, c), a._ = 1, pr(o) && (n = o);
|
|
4144
|
+
return hn(r, n), g && yt(n, t, g), p ? u ^ 4 ? s : g : n;
|
|
4145
|
+
}, mr, wt, gr;
|
|
4136
4146
|
mr = [le(["api", "storage"])];
|
|
4137
|
-
class
|
|
4147
|
+
class Be extends (gr = he) {
|
|
4138
4148
|
constructor(e) {
|
|
4139
|
-
super(e, "wiki", !1), this.ctx = e, this._data =
|
|
4140
|
-
|
|
4141
|
-
|
|
4142
|
-
|
|
4143
|
-
|
|
4149
|
+
super(e, "wiki", !1), this.ctx = e, this._data = {}, this.CACHE_VERSION = 3, this.CACHE_TTL = {
|
|
4150
|
+
siteinfo: 1e3 * 60 * 60 * 24 * 3,
|
|
4151
|
+
// 3 days
|
|
4152
|
+
userinfo: 1e3 * 60 * 30
|
|
4153
|
+
// 30 minutes
|
|
4154
|
+
}, this.QUERY_DATA = {
|
|
4155
|
+
siteinfo: {
|
|
4156
|
+
meta: "siteinfo",
|
|
4157
|
+
siprop: "general|specialpagealiases|namespacealiases|namespaces|magicwords"
|
|
4158
|
+
},
|
|
4159
|
+
userinfo: { meta: "userinfo", uiprop: "groups|rights|blockinfo|options" }
|
|
4160
|
+
}, this.CACHE_DB = void 0, this.mwConfig = {
|
|
4144
4161
|
get: (t, i) => window?.mw?.config?.get?.(t, i) ?? i,
|
|
4145
4162
|
has: (t) => window?.mw?.config?.exists?.(t) ?? !1,
|
|
4146
4163
|
get values() {
|
|
4147
4164
|
return window?.mw?.config?.values || {};
|
|
4148
4165
|
}
|
|
4149
|
-
}, this.
|
|
4166
|
+
}, this.CACHE_DB = e.storage.createDatabse(
|
|
4167
|
+
"wiki-metadata",
|
|
4168
|
+
1 / 0,
|
|
4169
|
+
this.CACHE_VERSION
|
|
4170
|
+
);
|
|
4171
|
+
}
|
|
4172
|
+
get logger() {
|
|
4173
|
+
return this.ctx.logger("WIKI_METADATA");
|
|
4150
4174
|
}
|
|
4151
4175
|
get api() {
|
|
4152
4176
|
return this.ctx.api;
|
|
4153
4177
|
}
|
|
4154
4178
|
async start() {
|
|
4155
|
-
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
const t = await this.fetchFromApi();
|
|
4160
|
-
this.saveToCache(t), this._data = t, this.logger.debug("Fetched from API");
|
|
4161
|
-
}
|
|
4162
|
-
this.logger.info("loaded", this._data), this.ctx.set("getUrl", this.getUrl.bind(this)), this.ctx.set("getSciprtUrl", this.getSciprtUrl.bind(this)), this.ctx.set("getMainpageUrl", this.getMainpageUrl.bind(this)), this.ctx.inject(["preferences"], (t) => {
|
|
4163
|
-
t.preferences.registerCustomConfig(
|
|
4179
|
+
await Promise.all(
|
|
4180
|
+
Object.keys(this.QUERY_DATA).map((e) => this.initData(e))
|
|
4181
|
+
), this.ctx.set("getUrl", this.getUrl.bind(this)), this.ctx.set("getSciprtUrl", this.getSciprtUrl.bind(this)), this.ctx.set("getMainpageUrl", this.getMainpageUrl.bind(this)), this.ctx.inject(["preferences"], (e) => {
|
|
4182
|
+
e.preferences.registerCustomConfig(
|
|
4164
4183
|
"WikiMetadataService",
|
|
4165
|
-
|
|
4166
|
-
WikiMetadataService:
|
|
4167
|
-
/* @__PURE__ */
|
|
4168
|
-
/* @__PURE__ */
|
|
4169
|
-
/* @__PURE__ */
|
|
4170
|
-
/* @__PURE__ */
|
|
4171
|
-
/* @__PURE__ */
|
|
4184
|
+
Ze.object({
|
|
4185
|
+
WikiMetadataService: Ze.const(
|
|
4186
|
+
/* @__PURE__ */ H("div", { children: [
|
|
4187
|
+
/* @__PURE__ */ H("h3", { children: "Wiki Informations" }),
|
|
4188
|
+
/* @__PURE__ */ H("ul", { children: [
|
|
4189
|
+
/* @__PURE__ */ H("li", { children: [
|
|
4190
|
+
/* @__PURE__ */ H("strong", { children: "Site:" }),
|
|
4172
4191
|
" ",
|
|
4173
4192
|
this.general.sitename,
|
|
4174
4193
|
" (",
|
|
4175
4194
|
this.landingPageUrl,
|
|
4176
4195
|
")"
|
|
4177
4196
|
] }),
|
|
4178
|
-
/* @__PURE__ */
|
|
4179
|
-
/* @__PURE__ */
|
|
4197
|
+
/* @__PURE__ */ H("li", { children: [
|
|
4198
|
+
/* @__PURE__ */ H("strong", { children: "User" }),
|
|
4180
4199
|
": ",
|
|
4181
4200
|
this.userInfo.name,
|
|
4182
4201
|
" (ID: ",
|
|
4183
4202
|
this.userInfo.id,
|
|
4184
4203
|
")"
|
|
4185
4204
|
] }),
|
|
4186
|
-
/* @__PURE__ */
|
|
4187
|
-
/* @__PURE__ */
|
|
4205
|
+
/* @__PURE__ */ H("li", { children: [
|
|
4206
|
+
/* @__PURE__ */ H("strong", { children: "Groups" }),
|
|
4188
4207
|
": ",
|
|
4189
4208
|
this.userGroups.join(", ") || "None"
|
|
4190
4209
|
] })
|
|
4191
4210
|
] }),
|
|
4192
|
-
/* @__PURE__ */
|
|
4193
|
-
"button",
|
|
4194
|
-
|
|
4195
|
-
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
4211
|
+
/* @__PURE__ */ H("div", { children: [
|
|
4212
|
+
/* @__PURE__ */ H("p", { style: { fontStyle: "italic" }, children: "If the information shown above is incorrect (for example, the user is not you), click the button below." }),
|
|
4213
|
+
/* @__PURE__ */ H(
|
|
4214
|
+
"button",
|
|
4215
|
+
{
|
|
4216
|
+
className: "btn danger",
|
|
4217
|
+
onClick: (t) => {
|
|
4218
|
+
t.preventDefault(), Promise.all(
|
|
4219
|
+
Object.keys(this.QUERY_DATA).map(
|
|
4220
|
+
(i) => this.invalidateCache(i)
|
|
4221
|
+
)
|
|
4222
|
+
).then(() => {
|
|
4223
|
+
window.location.reload();
|
|
4224
|
+
});
|
|
4225
|
+
},
|
|
4226
|
+
children: "🧹 Clear caches & Reload"
|
|
4227
|
+
}
|
|
4228
|
+
)
|
|
4229
|
+
] })
|
|
4203
4230
|
] })
|
|
4204
4231
|
).role("raw-html")
|
|
4205
4232
|
}).description("WikiMetadataService"),
|
|
4206
4233
|
"general"
|
|
4207
4234
|
);
|
|
4208
|
-
});
|
|
4235
|
+
}), this.logger.info("All initialized", this._data);
|
|
4236
|
+
}
|
|
4237
|
+
async initData(e, t = !1) {
|
|
4238
|
+
const i = t ? null : await this.fetchFromCache(e);
|
|
4239
|
+
if (i)
|
|
4240
|
+
return this._data[e] = i, this.logger.debug("Using cached", e, i), i;
|
|
4241
|
+
{
|
|
4242
|
+
const n = await this.fetchFromApi(e);
|
|
4243
|
+
return this.saveToCache(e, n), this._data[e] = n, this.logger.debug("Fetched from API", e, n), n;
|
|
4244
|
+
}
|
|
4209
4245
|
}
|
|
4210
|
-
|
|
4211
|
-
return this.ctx.api.config.baseURL
|
|
4246
|
+
getCacheKey(e) {
|
|
4247
|
+
return `${e}:${new URL(this.ctx.api.config.baseURL).pathname.replace(/^\//, "")}`;
|
|
4212
4248
|
}
|
|
4213
|
-
async fetchFromApi() {
|
|
4249
|
+
async fetchFromApi(e) {
|
|
4214
4250
|
return this.api.get({
|
|
4215
4251
|
action: "query",
|
|
4216
|
-
...this.
|
|
4217
|
-
}).then(({ data:
|
|
4218
|
-
if (typeof
|
|
4219
|
-
throw new Error("Invalid
|
|
4220
|
-
return e.query;
|
|
4221
|
-
}).catch((
|
|
4222
|
-
}
|
|
4223
|
-
async fetchFromCache() {
|
|
4224
|
-
const
|
|
4225
|
-
return
|
|
4226
|
-
}
|
|
4227
|
-
async saveToCache(e) {
|
|
4228
|
-
const
|
|
4229
|
-
return this.
|
|
4230
|
-
}
|
|
4231
|
-
async invalidateCache() {
|
|
4232
|
-
const
|
|
4233
|
-
return this.
|
|
4234
|
-
}
|
|
4235
|
-
// shortcuts
|
|
4252
|
+
...this.QUERY_DATA[e]
|
|
4253
|
+
}).then(({ data: t }) => {
|
|
4254
|
+
if (typeof t?.query != "object" || t.query === null)
|
|
4255
|
+
throw new Error("Invalid query data", { cause: t });
|
|
4256
|
+
return e === "siteinfo" ? t.query : t.query?.[e] || t.query;
|
|
4257
|
+
}).catch((t) => (this.logger.error("Failed to fetch", t), Promise.reject(t)));
|
|
4258
|
+
}
|
|
4259
|
+
async fetchFromCache(e) {
|
|
4260
|
+
const t = this.getCacheKey(e);
|
|
4261
|
+
return await this.CACHE_DB.get(t, this.CACHE_TTL[e]);
|
|
4262
|
+
}
|
|
4263
|
+
async saveToCache(e, t) {
|
|
4264
|
+
const i = this.getCacheKey(e);
|
|
4265
|
+
return this.CACHE_DB.set(i, t);
|
|
4266
|
+
}
|
|
4267
|
+
async invalidateCache(e) {
|
|
4268
|
+
const t = this.getCacheKey(e);
|
|
4269
|
+
return this.CACHE_DB.delete(t);
|
|
4270
|
+
}
|
|
4271
|
+
// ====== shortcuts ======
|
|
4236
4272
|
get _raw() {
|
|
4237
4273
|
return this._data;
|
|
4238
4274
|
}
|
|
4275
|
+
// siteInfo
|
|
4276
|
+
get siteInfo() {
|
|
4277
|
+
return this._data.siteinfo;
|
|
4278
|
+
}
|
|
4239
4279
|
get general() {
|
|
4240
|
-
return this.
|
|
4280
|
+
return this.siteInfo.general;
|
|
4241
4281
|
}
|
|
4242
4282
|
get specialPageAliases() {
|
|
4243
|
-
return this.
|
|
4283
|
+
return this.siteInfo.specialpagealiases;
|
|
4244
4284
|
}
|
|
4245
4285
|
get namespaceAliases() {
|
|
4246
|
-
return this.
|
|
4286
|
+
return this.siteInfo.namespacealiases;
|
|
4247
4287
|
}
|
|
4248
4288
|
get namespaces() {
|
|
4249
|
-
return this.
|
|
4289
|
+
return this.siteInfo.namespaces;
|
|
4250
4290
|
}
|
|
4251
4291
|
get namespaceMap() {
|
|
4252
4292
|
const e = Object.values(this.namespaces).map((t) => ({
|
|
@@ -4259,8 +4299,9 @@ class Me extends (gr = he) {
|
|
|
4259
4299
|
}), e;
|
|
4260
4300
|
}
|
|
4261
4301
|
get magicWords() {
|
|
4262
|
-
return this.
|
|
4302
|
+
return this.siteInfo.magicwords;
|
|
4263
4303
|
}
|
|
4304
|
+
// userInfo
|
|
4264
4305
|
get userInfo() {
|
|
4265
4306
|
return this._data.userinfo;
|
|
4266
4307
|
}
|
|
@@ -4339,7 +4380,7 @@ class Me extends (gr = he) {
|
|
|
4339
4380
|
}
|
|
4340
4381
|
/** Get mainpage URL */
|
|
4341
4382
|
getMainpageUrl(e) {
|
|
4342
|
-
return hr(this.
|
|
4383
|
+
return hr(this.siteInfo.general.base, e).toString();
|
|
4343
4384
|
}
|
|
4344
4385
|
getUrl(e, t) {
|
|
4345
4386
|
const i = ur(t);
|
|
@@ -4372,9 +4413,9 @@ class Me extends (gr = he) {
|
|
|
4372
4413
|
} : null;
|
|
4373
4414
|
}
|
|
4374
4415
|
}
|
|
4375
|
-
|
|
4376
|
-
|
|
4377
|
-
|
|
4416
|
+
wt = cn(gr);
|
|
4417
|
+
Be = dn(wt, 0, "WikiMetadataService", mr, Be);
|
|
4418
|
+
fn(wt, 1, Be);
|
|
4378
4419
|
var I;
|
|
4379
4420
|
((r) => {
|
|
4380
4421
|
function e(l) {
|
|
@@ -4454,27 +4495,27 @@ var I;
|
|
|
4454
4495
|
return v;
|
|
4455
4496
|
const M = v.version + 1;
|
|
4456
4497
|
v.close();
|
|
4457
|
-
const re = new Promise((ie,
|
|
4498
|
+
const re = new Promise((ie, K) => {
|
|
4458
4499
|
const j = indexedDB.open(l, M);
|
|
4459
4500
|
j.onupgradeneeded = () => {
|
|
4460
|
-
const
|
|
4501
|
+
const P = j.result;
|
|
4461
4502
|
let G;
|
|
4462
|
-
if (
|
|
4503
|
+
if (P.objectStoreNames.contains(d) ? G = j.transaction.objectStore(d) : G = P.createObjectStore(d, {
|
|
4463
4504
|
keyPath: m.keyPath ?? void 0,
|
|
4464
4505
|
autoIncrement: !!m.autoIncrement
|
|
4465
4506
|
}), m.indexes && m.indexes.length > 0)
|
|
4466
|
-
for (const { name:
|
|
4467
|
-
G.indexNames.contains(
|
|
4507
|
+
for (const { name: $e, keyPath: W, options: Ae } of m.indexes)
|
|
4508
|
+
G.indexNames.contains($e) || G.createIndex($e, W, Ae);
|
|
4468
4509
|
}, j.onsuccess = () => {
|
|
4469
|
-
const
|
|
4470
|
-
|
|
4510
|
+
const P = j.result;
|
|
4511
|
+
P.onversionchange = () => {
|
|
4471
4512
|
try {
|
|
4472
|
-
|
|
4513
|
+
P.close();
|
|
4473
4514
|
} finally {
|
|
4474
4515
|
t.delete(l);
|
|
4475
4516
|
}
|
|
4476
|
-
}, ie(
|
|
4477
|
-
}, j.onerror = () =>
|
|
4517
|
+
}, ie(P);
|
|
4518
|
+
}, j.onerror = () => K(j.error), j.onblocked = () => {
|
|
4478
4519
|
};
|
|
4479
4520
|
});
|
|
4480
4521
|
return t.set(l, re), re;
|
|
@@ -4492,44 +4533,44 @@ var I;
|
|
|
4492
4533
|
async function g(l, d, m, v = {}) {
|
|
4493
4534
|
const { dbName: S, storeName: E } = l, M = v.attempts ?? 2, re = v.baseDelayMs ?? 16;
|
|
4494
4535
|
let ie;
|
|
4495
|
-
for (let
|
|
4536
|
+
for (let K = 0; K <= M; K++)
|
|
4496
4537
|
try {
|
|
4497
|
-
|
|
4538
|
+
K === 0 && await y(S, E);
|
|
4498
4539
|
const j = await a(S);
|
|
4499
|
-
let
|
|
4540
|
+
let P;
|
|
4500
4541
|
try {
|
|
4501
|
-
|
|
4502
|
-
} catch (
|
|
4503
|
-
if (o(
|
|
4504
|
-
await c(S), await s(re * (1 <<
|
|
4542
|
+
P = j.transaction(E, d);
|
|
4543
|
+
} catch (W) {
|
|
4544
|
+
if (o(W) && K < M) {
|
|
4545
|
+
await c(S), await s(re * (1 << K)), ie = W;
|
|
4505
4546
|
continue;
|
|
4506
4547
|
}
|
|
4507
|
-
throw
|
|
4548
|
+
throw W;
|
|
4508
4549
|
}
|
|
4509
|
-
const G =
|
|
4510
|
-
|
|
4550
|
+
const G = P.objectStore(E), $e = new Promise((W, Ae) => {
|
|
4551
|
+
P.oncomplete = () => W(), P.onerror = () => Ae(P.error), P.onabort = () => Ae(P.error);
|
|
4511
4552
|
});
|
|
4512
4553
|
try {
|
|
4513
|
-
const
|
|
4514
|
-
return await
|
|
4515
|
-
} catch (
|
|
4516
|
-
if (o(
|
|
4554
|
+
const W = await m(G);
|
|
4555
|
+
return await $e, W;
|
|
4556
|
+
} catch (W) {
|
|
4557
|
+
if (o(W) && K < M) {
|
|
4517
4558
|
try {
|
|
4518
|
-
|
|
4559
|
+
P.abort();
|
|
4519
4560
|
} catch {
|
|
4520
4561
|
}
|
|
4521
|
-
await c(S), await s(re * (1 <<
|
|
4562
|
+
await c(S), await s(re * (1 << K)), ie = W;
|
|
4522
4563
|
continue;
|
|
4523
4564
|
}
|
|
4524
4565
|
try {
|
|
4525
|
-
|
|
4566
|
+
P.abort();
|
|
4526
4567
|
} catch {
|
|
4527
4568
|
}
|
|
4528
|
-
throw
|
|
4569
|
+
throw W;
|
|
4529
4570
|
}
|
|
4530
4571
|
} catch (j) {
|
|
4531
|
-
if (o(j) &&
|
|
4532
|
-
await c(S), await s(re * (1 <<
|
|
4572
|
+
if (o(j) && K < M) {
|
|
4573
|
+
await c(S), await s(re * (1 << K)), ie = j;
|
|
4533
4574
|
continue;
|
|
4534
4575
|
}
|
|
4535
4576
|
throw j;
|
|
@@ -4544,27 +4585,27 @@ var I;
|
|
|
4544
4585
|
});
|
|
4545
4586
|
}
|
|
4546
4587
|
r.get = b;
|
|
4547
|
-
async function
|
|
4588
|
+
async function R(l, d, m) {
|
|
4548
4589
|
return g(l, "readwrite", async (v) => {
|
|
4549
4590
|
const S = v.put(m, d);
|
|
4550
4591
|
await e(S);
|
|
4551
4592
|
});
|
|
4552
4593
|
}
|
|
4553
|
-
r.set =
|
|
4554
|
-
async function
|
|
4594
|
+
r.set = R;
|
|
4595
|
+
async function L(l, d) {
|
|
4555
4596
|
return g(l, "readwrite", async (m) => {
|
|
4556
4597
|
const v = m.delete(d);
|
|
4557
4598
|
await e(v);
|
|
4558
4599
|
});
|
|
4559
4600
|
}
|
|
4560
|
-
r.del =
|
|
4561
|
-
async function
|
|
4601
|
+
r.del = L;
|
|
4602
|
+
async function $(l) {
|
|
4562
4603
|
return g(l, "readwrite", async (d) => {
|
|
4563
4604
|
const m = d.clear();
|
|
4564
4605
|
await e(m);
|
|
4565
4606
|
});
|
|
4566
4607
|
}
|
|
4567
|
-
r.clear =
|
|
4608
|
+
r.clear = $;
|
|
4568
4609
|
function f(l, d = 100) {
|
|
4569
4610
|
return {
|
|
4570
4611
|
[Symbol.asyncIterator]() {
|
|
@@ -4576,17 +4617,17 @@ var I;
|
|
|
4576
4617
|
/* open */
|
|
4577
4618
|
!0
|
|
4578
4619
|
);
|
|
4579
|
-
await new Promise((ie,
|
|
4620
|
+
await new Promise((ie, K) => {
|
|
4580
4621
|
let j = 0;
|
|
4581
|
-
const
|
|
4582
|
-
|
|
4583
|
-
const G =
|
|
4622
|
+
const P = M.openCursor(re, "next");
|
|
4623
|
+
P.onsuccess = () => {
|
|
4624
|
+
const G = P.result;
|
|
4584
4625
|
if (!G || j >= d) {
|
|
4585
4626
|
ie();
|
|
4586
4627
|
return;
|
|
4587
4628
|
}
|
|
4588
4629
|
m.push([G.key, G.value]), S = G.key, j++, G.continue();
|
|
4589
|
-
},
|
|
4630
|
+
}, P.onerror = () => K(P.error);
|
|
4590
4631
|
}), m.length === 0 && (v = !0);
|
|
4591
4632
|
}));
|
|
4592
4633
|
};
|
|
@@ -4623,7 +4664,7 @@ var I;
|
|
|
4623
4664
|
* @author dragon-fish <dragon-fish@qq.com>
|
|
4624
4665
|
* @license MIT
|
|
4625
4666
|
*/
|
|
4626
|
-
class
|
|
4667
|
+
class pn {
|
|
4627
4668
|
constructor(e, t, i = {}) {
|
|
4628
4669
|
this.dbName = e, this.storeName = t, this.iterBatch = (i.iterBatch ?? 100) | 0, this.retry = i.retry, this.inlineKey = !!i.ensure?.keyPath, this.idbStoreHandle = I.createStore(e, t, i.ensure ?? {});
|
|
4629
4670
|
}
|
|
@@ -4740,7 +4781,7 @@ class fn {
|
|
|
4740
4781
|
t,
|
|
4741
4782
|
"readwrite",
|
|
4742
4783
|
async (i) => {
|
|
4743
|
-
for await (const [n, s] of
|
|
4784
|
+
for await (const [n, s] of Lt(e)) {
|
|
4744
4785
|
const o = this.inlineKey ? i.put(s) : i.put(s, n);
|
|
4745
4786
|
await I.promisifyRequest(o);
|
|
4746
4787
|
}
|
|
@@ -4754,7 +4795,7 @@ class fn {
|
|
|
4754
4795
|
t,
|
|
4755
4796
|
"readwrite",
|
|
4756
4797
|
async (i) => {
|
|
4757
|
-
for await (const n of
|
|
4798
|
+
for await (const n of Lt(e)) {
|
|
4758
4799
|
const s = i.delete(n);
|
|
4759
4800
|
await I.promisifyRequest(s);
|
|
4760
4801
|
}
|
|
@@ -4770,16 +4811,16 @@ class fn {
|
|
|
4770
4811
|
await I.closeDatabase(this.dbName);
|
|
4771
4812
|
}
|
|
4772
4813
|
}
|
|
4773
|
-
function
|
|
4814
|
+
function Lt(r) {
|
|
4774
4815
|
return r[Symbol.asyncIterator] ? r : {
|
|
4775
4816
|
async *[Symbol.asyncIterator]() {
|
|
4776
4817
|
for (const e of r) yield e;
|
|
4777
4818
|
}
|
|
4778
4819
|
};
|
|
4779
4820
|
}
|
|
4780
|
-
class
|
|
4821
|
+
class mn {
|
|
4781
4822
|
constructor(e, t, i = 1 / 0, n) {
|
|
4782
|
-
this.dbName = e, this.storeName = t, this.ttl = i, this.version = n, this.db = new
|
|
4823
|
+
this.dbName = e, this.storeName = t, this.ttl = i, this.version = n, this.db = new pn(e, t), this.keys = this.db.keys.bind(this.db), this.values = this.db.values.bind(this.db), this.entries = this.db.entries.bind(this.db), typeof this.ttl != "number" && (this.ttl = Number(this.ttl)), (isNaN(this.ttl) || this.ttl <= 0) && (this.ttl = 1 / 0);
|
|
4783
4824
|
}
|
|
4784
4825
|
async get(e, t = this.ttl, i) {
|
|
4785
4826
|
const n = await this.loadFromDB(e), s = this.checkIfExpired(n, t);
|
|
@@ -4840,16 +4881,16 @@ class dn {
|
|
|
4840
4881
|
return await this.db.clear(), this;
|
|
4841
4882
|
}
|
|
4842
4883
|
}
|
|
4843
|
-
class
|
|
4884
|
+
class gn extends he {
|
|
4844
4885
|
constructor(e) {
|
|
4845
4886
|
super(e, "storage", !1);
|
|
4846
4887
|
}
|
|
4847
4888
|
createDatabse(e, t, i) {
|
|
4848
|
-
return new
|
|
4889
|
+
return new mn("InPageEdit", e, t, i);
|
|
4849
4890
|
}
|
|
4850
4891
|
}
|
|
4851
4892
|
var yr = /* @__PURE__ */ ((r) => (r.preferences = "preferences", r.watch = "watch", r.unwatch = "unwatch", r.nochange = "nochange", r))(yr || {});
|
|
4852
|
-
function
|
|
4893
|
+
function yn(r) {
|
|
4853
4894
|
class e {
|
|
4854
4895
|
constructor(i, n = !0) {
|
|
4855
4896
|
this._loaded = n, this.api = r, i.revisions?.forEach((s) => {
|
|
@@ -5040,9 +5081,9 @@ function mn(r) {
|
|
|
5040
5081
|
}
|
|
5041
5082
|
return e;
|
|
5042
5083
|
}
|
|
5043
|
-
class
|
|
5084
|
+
class wn extends he {
|
|
5044
5085
|
constructor(e) {
|
|
5045
|
-
super(e, "wikiPage", !0), this.ctx = e, this.WikiPage =
|
|
5086
|
+
super(e, "wikiPage", !0), this.ctx = e, this.WikiPage = yn(this.ctx.api);
|
|
5046
5087
|
}
|
|
5047
5088
|
static {
|
|
5048
5089
|
this.inject = ["api"];
|
|
@@ -5063,7 +5104,7 @@ class gn extends he {
|
|
|
5063
5104
|
return this.WikiPage.newBlankPage(e);
|
|
5064
5105
|
}
|
|
5065
5106
|
}
|
|
5066
|
-
const
|
|
5107
|
+
const jt = /* @__PURE__ */ new WeakMap(), Q = {
|
|
5067
5108
|
toDBKey: (r) => r.replace(/ /g, "_"),
|
|
5068
5109
|
toNormalText: (r) => r.replace(/_/g, " "),
|
|
5069
5110
|
ensureCase: (r, e) => e === "first-letter" ? r.charAt(0).toUpperCase() + r.slice(1) : r
|
|
@@ -5139,8 +5180,8 @@ const Nt = /* @__PURE__ */ new WeakMap(), J = {
|
|
|
5139
5180
|
subpages: !1
|
|
5140
5181
|
})
|
|
5141
5182
|
};
|
|
5142
|
-
function
|
|
5143
|
-
const e =
|
|
5183
|
+
function bn(r) {
|
|
5184
|
+
const e = jt.get(r);
|
|
5144
5185
|
if (e)
|
|
5145
5186
|
return e;
|
|
5146
5187
|
const t = X.buildIndex(r), i = me.buildSpecialPageIndex(r);
|
|
@@ -5205,10 +5246,10 @@ function yn(r) {
|
|
|
5205
5246
|
);
|
|
5206
5247
|
if (a) {
|
|
5207
5248
|
const c = this.#e.includes("/") ? this.#e.substring(this.#e.indexOf("/")) : "", u = a + c;
|
|
5208
|
-
return
|
|
5249
|
+
return Q.ensureCase(Q.toDBKey(u), o.case);
|
|
5209
5250
|
}
|
|
5210
5251
|
}
|
|
5211
|
-
return
|
|
5252
|
+
return Q.ensureCase(Q.toDBKey(this.#e), o.case);
|
|
5212
5253
|
}
|
|
5213
5254
|
getMainText() {
|
|
5214
5255
|
const o = this.getNamespaceInfo();
|
|
@@ -5219,10 +5260,10 @@ function yn(r) {
|
|
|
5219
5260
|
);
|
|
5220
5261
|
if (a) {
|
|
5221
5262
|
const c = this.#e.includes("/") ? this.#e.substring(this.#e.indexOf("/")) : "", u = a + c;
|
|
5222
|
-
return
|
|
5263
|
+
return Q.ensureCase(Q.toNormalText(u), o.case);
|
|
5223
5264
|
}
|
|
5224
5265
|
}
|
|
5225
|
-
return
|
|
5266
|
+
return Q.ensureCase(Q.toNormalText(this.#e), o.case);
|
|
5226
5267
|
}
|
|
5227
5268
|
getMainRootText() {
|
|
5228
5269
|
return this.getMainText().split("/")[0];
|
|
@@ -5241,7 +5282,7 @@ function yn(r) {
|
|
|
5241
5282
|
}
|
|
5242
5283
|
getNamespaceDBKey() {
|
|
5243
5284
|
const o = this.getNamespaceInfo();
|
|
5244
|
-
return
|
|
5285
|
+
return Q.ensureCase(Q.toDBKey(this.getNamespaceText()), o.case);
|
|
5245
5286
|
}
|
|
5246
5287
|
getSubjectPage() {
|
|
5247
5288
|
if (X.isTalkPage(this.#t)) {
|
|
@@ -5300,11 +5341,11 @@ function yn(r) {
|
|
|
5300
5341
|
};
|
|
5301
5342
|
}
|
|
5302
5343
|
}
|
|
5303
|
-
return
|
|
5344
|
+
return jt.set(r, n), n;
|
|
5304
5345
|
}
|
|
5305
|
-
class
|
|
5346
|
+
class bt extends he {
|
|
5306
5347
|
constructor(e) {
|
|
5307
|
-
super(e, "wikiTitle", !0), this.ctx = e, this.logger = this.ctx.logger("WikiTitleService"), this._cachedTitles = /* @__PURE__ */ new Map(), this.wiki = this.ctx.wiki, this.wikiBaseUrl = this.wiki.baseUrl, this.wikiArticlePath = this.wiki.articlePath.replace("$1", ""), this.wikiArticleBaseUrl = this.wiki.articleBaseUrl.replace("$1", ""), this.wikiIndexPhpUrl = this.wiki.getSciprtUrl("index.php"), this.Title =
|
|
5348
|
+
super(e, "wikiTitle", !0), this.ctx = e, this.logger = this.ctx.logger("WikiTitleService"), this._cachedTitles = /* @__PURE__ */ new Map(), this.wiki = this.ctx.wiki, this.wikiBaseUrl = this.wiki.baseUrl, this.wikiArticlePath = this.wiki.articlePath.replace("$1", ""), this.wikiArticleBaseUrl = this.wiki.articleBaseUrl.replace("$1", ""), this.wikiIndexPhpUrl = this.wiki.getSciprtUrl("index.php"), this.Title = bn(this.ctx.wiki.siteInfo);
|
|
5308
5349
|
}
|
|
5309
5350
|
static {
|
|
5310
5351
|
this.inject = ["wiki"];
|
|
@@ -5328,7 +5369,7 @@ class vt extends he {
|
|
|
5328
5369
|
throw new Error("Invalid id or kind", { cause: e });
|
|
5329
5370
|
if (!t && this._cachedTitles.has(`${a}:${o}`))
|
|
5330
5371
|
return await this._cachedTitles.get(`${a}:${o}`);
|
|
5331
|
-
const { promise: c, resolve: u, reject: p } =
|
|
5372
|
+
const { promise: c, resolve: u, reject: p } = ot();
|
|
5332
5373
|
this._cachedTitles.set(`${a}:${o}`, c);
|
|
5333
5374
|
try {
|
|
5334
5375
|
const { wikiPage: y } = await this.ctx.useScope(["wikiPage"]);
|
|
@@ -5391,13 +5432,14 @@ class vt extends he {
|
|
|
5391
5432
|
}
|
|
5392
5433
|
isWikiLink(e) {
|
|
5393
5434
|
return e.startsWith(this.wikiArticleBaseUrl) || e.startsWith(this.wikiIndexPhpUrl) || // Some servers allow index.php to be omitted
|
|
5394
|
-
e.startsWith(`${this.wikiBaseUrl}/?`)
|
|
5435
|
+
e.startsWith(`${this.wikiBaseUrl}/?`) || // It's the landing page
|
|
5436
|
+
e === this.ctx.wiki.landingPageUrl;
|
|
5395
5437
|
}
|
|
5396
5438
|
static {
|
|
5397
5439
|
this.REG_SKIPPED_HREF = /^(#|javascript:|vbscript:|file:)/i;
|
|
5398
5440
|
}
|
|
5399
5441
|
validateHrefAttr(e) {
|
|
5400
|
-
return typeof e != "string" ? !1 : !
|
|
5442
|
+
return typeof e != "string" ? !1 : !bt.REG_SKIPPED_HREF.test(e);
|
|
5401
5443
|
}
|
|
5402
5444
|
parseWikiLink(e) {
|
|
5403
5445
|
if (!e || typeof e == "string" && !this.validateHrefAttr(e))
|
|
@@ -5436,26 +5478,26 @@ class vt extends he {
|
|
|
5436
5478
|
};
|
|
5437
5479
|
}
|
|
5438
5480
|
}
|
|
5439
|
-
const
|
|
5440
|
-
async function
|
|
5441
|
-
return
|
|
5481
|
+
const vn = (r) => typeof r == "function";
|
|
5482
|
+
async function _n(r) {
|
|
5483
|
+
return vn(r) ? await r() : r;
|
|
5442
5484
|
}
|
|
5443
|
-
var
|
|
5485
|
+
var Sn = Object.create, vt = Object.defineProperty, xn = Object.getOwnPropertyDescriptor, wr = (r, e) => (e = Symbol[r]) ? e : Symbol.for("Symbol." + r), br = (r) => {
|
|
5444
5486
|
throw TypeError(r);
|
|
5445
|
-
},
|
|
5487
|
+
}, kn = (r, e, t) => e in r ? vt(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, En = (r, e) => vt(r, "name", { value: e, configurable: !0 }), On = (r) => [, , , Sn(r?.[wr("metadata")] ?? null)], Rn = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"], vr = (r) => r !== void 0 && typeof r != "function" ? br("Function expected") : r, $n = (r, e, t, i, n) => ({ kind: Rn[r], name: e, metadata: i, addInitializer: (s) => t._ ? br("Already initialized") : n.push(vr(s || null)) }), An = (r, e) => kn(e, wr("metadata"), r[3]), Pn = (r, e, t, i) => {
|
|
5446
5488
|
for (var n = 0, s = r[e >> 1], o = s && s.length; n < o; n++) s[n].call(t);
|
|
5447
5489
|
return i;
|
|
5448
|
-
},
|
|
5449
|
-
var o, a, c, u = e & 7, p = !1, y = 0, w = r[y] || (r[y] = []), g = u && (n = n.prototype, u < 5 && (u > 3 || !p) &&
|
|
5450
|
-
|
|
5490
|
+
}, In = (r, e, t, i, n, s) => {
|
|
5491
|
+
var o, a, c, u = e & 7, p = !1, y = 0, w = r[y] || (r[y] = []), g = u && (n = n.prototype, u < 5 && (u > 3 || !p) && xn(n, t));
|
|
5492
|
+
En(n, t);
|
|
5451
5493
|
for (var b = i.length - 1; b >= 0; b--)
|
|
5452
|
-
c =
|
|
5453
|
-
return
|
|
5454
|
-
}, _r,
|
|
5494
|
+
c = $n(u, t, a = {}, r[3], w), o = (0, i[b])(n, c), a._ = 1, vr(o) && (n = o);
|
|
5495
|
+
return An(r, n), g && vt(n, t, g), p ? u ^ 4 ? s : g : n;
|
|
5496
|
+
}, _r, _t, Sr;
|
|
5455
5497
|
_r = [le(["storage"])];
|
|
5456
|
-
class
|
|
5498
|
+
class He extends (Sr = he) {
|
|
5457
5499
|
constructor(e) {
|
|
5458
|
-
super(e, "preferences", !0), this.ctx = e, this.db = void 0, this.customRegistries = [], this.categoryDefinitions = [], this._defaultPreferences = {}, this.db = e.storage.createDatabse("preferences", 1 / 0);
|
|
5500
|
+
super(e, "preferences", !0), this.ctx = e, this.db = void 0, this.customRegistries = [], this.categoryDefinitions = [], this._defaultPreferences = {}, e.set("prefs", this), this.db = e.storage.createDatabse("preferences", 1 / 0);
|
|
5459
5501
|
}
|
|
5460
5502
|
get logger() {
|
|
5461
5503
|
return this.ctx.logger("PREFERENCES");
|
|
@@ -5477,7 +5519,7 @@ class Be extends (Sr = he) {
|
|
|
5477
5519
|
return this.logger.debug(e, `(fallback value: ${n})`), n;
|
|
5478
5520
|
};
|
|
5479
5521
|
const i = await this.db.get(e, void 0);
|
|
5480
|
-
return i !== null ? i : await
|
|
5522
|
+
return i !== null ? i : await _n(t);
|
|
5481
5523
|
}
|
|
5482
5524
|
getDefaultValue(e) {
|
|
5483
5525
|
return this._defaultPreferences[e] ??= this.loadDefaultConfigs()[e];
|
|
@@ -5486,6 +5528,17 @@ class Be extends (Sr = he) {
|
|
|
5486
5528
|
const i = this.getDefaultValue(e);
|
|
5487
5529
|
return t === i ? this.db.delete(e) : this.db.set(e, t);
|
|
5488
5530
|
}
|
|
5531
|
+
async setMany(e) {
|
|
5532
|
+
const t = this.loadDefaultConfigs(), i = Object.fromEntries(
|
|
5533
|
+
Object.entries(e).filter(([n, s]) => {
|
|
5534
|
+
const o = t[n];
|
|
5535
|
+
return s !== void 0 && s !== o;
|
|
5536
|
+
})
|
|
5537
|
+
);
|
|
5538
|
+
return await Promise.all(
|
|
5539
|
+
Object.entries(i).map(([n, s]) => this.set(n, s))
|
|
5540
|
+
), i;
|
|
5541
|
+
}
|
|
5489
5542
|
/**
|
|
5490
5543
|
* 获取全部注册的配置项,以及正在生效的值
|
|
5491
5544
|
*/
|
|
@@ -5496,13 +5549,17 @@ class Be extends (Sr = he) {
|
|
|
5496
5549
|
return e;
|
|
5497
5550
|
}
|
|
5498
5551
|
/**
|
|
5499
|
-
*
|
|
5552
|
+
* Get exportable configurations
|
|
5553
|
+
* - exclude values that are the same as the default value
|
|
5554
|
+
* - exclude invalid or undefined values
|
|
5555
|
+
* - sort by keys
|
|
5500
5556
|
*/
|
|
5501
|
-
async
|
|
5502
|
-
|
|
5503
|
-
|
|
5557
|
+
async getExportableRecord(e) {
|
|
5558
|
+
e ??= await this.getAll();
|
|
5559
|
+
const t = this.loadDefaultConfigs(), i = {};
|
|
5560
|
+
return Object.entries(t).sort(([n], [s]) => n.localeCompare(s)).forEach(([n, s]) => {
|
|
5504
5561
|
const o = e[n];
|
|
5505
|
-
o !== s && (i[n] = o);
|
|
5562
|
+
o !== void 0 && o !== s && (i[n] = o);
|
|
5506
5563
|
}), i;
|
|
5507
5564
|
}
|
|
5508
5565
|
loadDefaultConfigs() {
|
|
@@ -5546,10 +5603,10 @@ class Be extends (Sr = he) {
|
|
|
5546
5603
|
return this.categoryDefinitions;
|
|
5547
5604
|
}
|
|
5548
5605
|
}
|
|
5549
|
-
|
|
5550
|
-
|
|
5551
|
-
|
|
5552
|
-
var Fe = /* @__PURE__ */ ((r) => (r.ANALYTICS_API_BASE = "https://analytics.ipe.wiki/api", r.ANALYTICS_DASH_URL = "https://analytics.ipe.wiki", r.GITHUB_URL = "https://github.com/inpageedit/inpageedit-next", r.HOME_URL = "https://www.ipe.wiki/", r.UPDATE_LOGS_URL = "https://www.ipe.wiki/changelogs/", r))(Fe || {});
|
|
5606
|
+
_t = On(Sr);
|
|
5607
|
+
He = In(_t, 0, "PreferencesService", _r, He);
|
|
5608
|
+
Pn(_t, 1, He);
|
|
5609
|
+
var Fe = /* @__PURE__ */ ((r) => (r.ANALYTICS_API_BASE = "https://analytics.ipe.wiki/api/v6", r.ANALYTICS_DASH_URL = "https://analytics.ipe.wiki", r.GITHUB_URL = "https://github.com/inpageedit/inpageedit-next", r.HOME_URL = "https://www.ipe.wiki/", r.UPDATE_LOGS_URL = "https://www.ipe.wiki/changelogs/", r))(Fe || {});
|
|
5553
5610
|
/**
|
|
5554
5611
|
* ✏️ InPageEdit NEXT
|
|
5555
5612
|
*
|
|
@@ -5560,11 +5617,11 @@ var Fe = /* @__PURE__ */ ((r) => (r.ANALYTICS_API_BASE = "https://analytics.ipe.
|
|
|
5560
5617
|
* @see https://github.com/inpageedit/inpageedit-next
|
|
5561
5618
|
* @see https://www.ipe.wiki/
|
|
5562
5619
|
*/
|
|
5563
|
-
class ge extends
|
|
5620
|
+
class ge extends q {
|
|
5564
5621
|
constructor(e) {
|
|
5565
5622
|
super({
|
|
5566
5623
|
name: "InPageEdit"
|
|
5567
|
-
}), this.version = "0.
|
|
5624
|
+
}), this.version = "0.11.1", this.Endpoints = Fe, this.schema = Ze, this.config = _e(ge.DEFAULT_CONFIG, e), this.logger = si({
|
|
5568
5625
|
name: "IPE",
|
|
5569
5626
|
color: "#33aaff",
|
|
5570
5627
|
level: this.config.logLevel
|
|
@@ -5574,12 +5631,12 @@ class ge extends z {
|
|
|
5574
5631
|
this.DEFAULT_CONFIG = {
|
|
5575
5632
|
apiConfigs: {},
|
|
5576
5633
|
legacyPreferences: {},
|
|
5577
|
-
logLevel:
|
|
5634
|
+
logLevel: Wt.info,
|
|
5578
5635
|
autoloadStyles: !0
|
|
5579
5636
|
};
|
|
5580
5637
|
}
|
|
5581
5638
|
async #e() {
|
|
5582
|
-
this.plugin(
|
|
5639
|
+
this.plugin(bi, this.config.apiConfigs), this.plugin(Ue), this.plugin(Pi), this.plugin(rn), this.plugin(He), this.plugin(gn), this.plugin(Be), this.plugin(wn), this.plugin(bt), this.#t([
|
|
5583
5640
|
"api",
|
|
5584
5641
|
"currentPage",
|
|
5585
5642
|
"resourceLoader",
|
|
@@ -5606,23 +5663,24 @@ class ge extends z {
|
|
|
5606
5663
|
// TODO: 这里不应该硬编码,暂时先这样
|
|
5607
5664
|
async #r() {
|
|
5608
5665
|
[
|
|
5609
|
-
import("./index-
|
|
5666
|
+
import("./index-CfgnJ51A.js").then(({ PluginAnalytics: t }) => t),
|
|
5667
|
+
import("./index-D5J7RU5I.js").then(
|
|
5610
5668
|
({ PluginInArticleLinks: t }) => t
|
|
5611
5669
|
),
|
|
5612
|
-
import("./index-
|
|
5670
|
+
import("./index-Cx4qgCJK.js").then(
|
|
5613
5671
|
({ PluginPreferencesUI: t }) => t
|
|
5614
5672
|
),
|
|
5615
|
-
import("./index-
|
|
5616
|
-
import("./index-
|
|
5617
|
-
import("./index-
|
|
5618
|
-
import("./index-
|
|
5673
|
+
import("./index-U2RPZk8N.js").then(({ PluginQuickEdit: t }) => t),
|
|
5674
|
+
import("./index-MhNAv9Vf.js").then(({ PluginQuickDelete: t }) => t),
|
|
5675
|
+
import("./index-VnRKIVau.js").then(({ PluginQuickMove: t }) => t),
|
|
5676
|
+
import("./index-BQzuJxBO.js").then(
|
|
5619
5677
|
({ PluginQuickPreview: t }) => t
|
|
5620
5678
|
),
|
|
5621
|
-
import("./index-
|
|
5622
|
-
import("./index-
|
|
5679
|
+
import("./index-etJXONAj.js").then(({ PluginQuickDiff: t }) => t),
|
|
5680
|
+
import("./index-CBszdxJJ.js").then(
|
|
5623
5681
|
({ PluginQuickRedirect: t }) => t
|
|
5624
5682
|
),
|
|
5625
|
-
import("./index-
|
|
5683
|
+
import("./index-BNDyaWnI.js").then(({ PluginToolbox: t }) => t)
|
|
5626
5684
|
].forEach(async (t) => {
|
|
5627
5685
|
this.plugin(await t);
|
|
5628
5686
|
});
|
|
@@ -5634,19 +5692,22 @@ class ge extends z {
|
|
|
5634
5692
|
});
|
|
5635
5693
|
}
|
|
5636
5694
|
async useScope(e) {
|
|
5637
|
-
const { promise: t, resolve: i } =
|
|
5695
|
+
const { promise: t, resolve: i } = ot();
|
|
5638
5696
|
return this.inject(e, (n) => {
|
|
5639
5697
|
i(n);
|
|
5640
5698
|
}), t;
|
|
5641
5699
|
}
|
|
5642
5700
|
}
|
|
5643
|
-
function
|
|
5701
|
+
function xr(r) {
|
|
5644
5702
|
return r.charAt(0).toLowerCase() + r.slice(1);
|
|
5645
5703
|
}
|
|
5646
|
-
function
|
|
5647
|
-
return
|
|
5704
|
+
function Mn(r) {
|
|
5705
|
+
return xr(r).replace(/_/g, "-").replace(/.[A-Z]+/g, (e) => e[0] + "-" + e.slice(1).toLowerCase());
|
|
5706
|
+
}
|
|
5707
|
+
function Tn(r) {
|
|
5708
|
+
return xr(r).replace(/-/g, "_").replace(/.[A-Z]+/g, (e) => e[0] + "_" + e.slice(1).toLowerCase());
|
|
5648
5709
|
}
|
|
5649
|
-
class
|
|
5710
|
+
class Bn {
|
|
5650
5711
|
constructor(e, t = void 0, i) {
|
|
5651
5712
|
this.ctx = e, this.disposeHandlers = [], this.name = i || "", this.config = t || {};
|
|
5652
5713
|
const { promise: n, resolve: s, reject: o } = Promise.withResolvers();
|
|
@@ -5687,7 +5748,7 @@ class Un {
|
|
|
5687
5748
|
this.disposeHandlers = this.disposeHandlers.filter((t) => t !== e);
|
|
5688
5749
|
}
|
|
5689
5750
|
set name(e) {
|
|
5690
|
-
this.#e =
|
|
5751
|
+
this.#e = Tn(e).toUpperCase();
|
|
5691
5752
|
}
|
|
5692
5753
|
get name() {
|
|
5693
5754
|
return this.#e;
|
|
@@ -5700,12 +5761,12 @@ window.RLQ ||= [];
|
|
|
5700
5761
|
window.__IPE_MODULES__ ||= [];
|
|
5701
5762
|
Ln("InPageEdit#autoload", () => {
|
|
5702
5763
|
const r = kr();
|
|
5703
|
-
r &&
|
|
5764
|
+
r && Cn({
|
|
5704
5765
|
baseURL: r,
|
|
5705
5766
|
CoreClass: ge
|
|
5706
5767
|
});
|
|
5707
5768
|
});
|
|
5708
|
-
async function
|
|
5769
|
+
async function Cn(r = { baseURL: kr(), CoreClass: ge }) {
|
|
5709
5770
|
const { baseURL: e, CoreClass: t } = r;
|
|
5710
5771
|
typeof window?.ipe?.stop == "function" && await window.ipe.stop();
|
|
5711
5772
|
const i = window.InPageEdit || {}, n = new t({
|
|
@@ -5754,14 +5815,17 @@ function Ln(r, e) {
|
|
|
5754
5815
|
return window[t] ? !1 : (window[t] = !0, e(), !0);
|
|
5755
5816
|
}
|
|
5756
5817
|
export {
|
|
5757
|
-
|
|
5758
|
-
|
|
5818
|
+
Wt as $,
|
|
5819
|
+
Bn as B,
|
|
5820
|
+
Fe as E,
|
|
5759
5821
|
le as I,
|
|
5760
|
-
|
|
5822
|
+
Ze as S,
|
|
5761
5823
|
yr as W,
|
|
5762
|
-
|
|
5763
|
-
|
|
5764
|
-
|
|
5765
|
-
|
|
5824
|
+
ot as a,
|
|
5825
|
+
he as b,
|
|
5826
|
+
ge as c,
|
|
5827
|
+
si as d,
|
|
5828
|
+
ri as m,
|
|
5829
|
+
Mn as p
|
|
5766
5830
|
};
|
|
5767
|
-
//# sourceMappingURL=index-
|
|
5831
|
+
//# sourceMappingURL=index-BUI2IX49.js.map
|