@inpageedit/core 0.10.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -2
- package/dist/PluginPrefSync-PIoKRRu2.js +254 -0
- package/dist/PluginPrefSync-PIoKRRu2.js.map +1 -0
- package/dist/__test__/utils/constants.d.ts +3 -2
- package/dist/constants/endpoints.d.ts +1 -1
- package/dist/{index-BR6gK_ki.js → index-B5vDBMEh.js} +44 -38
- package/dist/index-B5vDBMEh.js.map +1 -0
- package/dist/{index-BnAhw94L.js → index-BP-e8PeH.js} +2 -2
- package/dist/{index-BnAhw94L.js.map → index-BP-e8PeH.js.map} +1 -1
- package/dist/{index-ByzgI28q.js → index-BVkdBJNf.js} +6 -2
- package/dist/index-BVkdBJNf.js.map +1 -0
- package/dist/{index-eOIVMf9E.js → index-BjwVNZ_h.js} +46 -35
- package/dist/index-BjwVNZ_h.js.map +1 -0
- package/dist/{index-Cx-YiN1j.js → index-BzCqww16.js} +22 -21
- package/dist/index-BzCqww16.js.map +1 -0
- package/dist/index-CFb1PSJg.js +185 -0
- package/dist/index-CFb1PSJg.js.map +1 -0
- package/dist/{index-ByJfEsN8.js → index-D7NpqwUe.js} +148 -110
- package/dist/index-D7NpqwUe.js.map +1 -0
- package/dist/{index-Z-_kjibx.js → index-DFPN4uYd.js} +757 -698
- package/dist/index-DFPN4uYd.js.map +1 -0
- package/dist/index-DGOY4X1J.js +4912 -0
- package/dist/{index-DqJUIV2e.js.map → index-DGOY4X1J.js.map} +1 -1
- package/dist/{index-CAiGct8U.js → index-DKDtc9IF.js} +42 -42
- package/dist/index-DKDtc9IF.js.map +1 -0
- package/dist/index-DkQLtTG0.js +211 -0
- package/dist/index-DkQLtTG0.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/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,19 +2510,18 @@ 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
|
+
let z = class 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
|
}
|
|
2520
2519
|
static is(e, t) {
|
|
2521
2520
|
return e instanceof this && (t === void 0 || e.code === t);
|
|
2522
2521
|
}
|
|
2523
|
-
}
|
|
2524
|
-
let pe = class Jt extends Error {
|
|
2522
|
+
}, pe = class Qt extends Error {
|
|
2525
2523
|
constructor(e, t) {
|
|
2526
|
-
super(), this.errors = e, this.cause = t, this.name = "MediaWikiApiError", this.errors =
|
|
2524
|
+
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
2525
|
`), this.code = this.isBadTokenError() ? "badtoken" : this.errors[0]?.code || "Unknown Error";
|
|
2528
2526
|
}
|
|
2529
2527
|
get firstError() {
|
|
@@ -2571,8 +2569,8 @@ let pe = class Jt extends Error {
|
|
|
2571
2569
|
}
|
|
2572
2570
|
}
|
|
2573
2571
|
r.isBadTokenError = n;
|
|
2574
|
-
})(
|
|
2575
|
-
const
|
|
2572
|
+
})(z || (z = {}));
|
|
2573
|
+
const Pt = Symbol.for("__FEXIOS_SAIKOU__");
|
|
2576
2574
|
/**
|
|
2577
2575
|
* FexiosSaikou
|
|
2578
2576
|
*
|
|
@@ -2587,18 +2585,18 @@ const It = Symbol.for("__FEXIOS_SAIKOU__");
|
|
|
2587
2585
|
* @param {string|URL} payload create a new FexiosSaikou instance with the given baseURL
|
|
2588
2586
|
* @param {Fexios} payload or make the given Fexios instance a FexiosSaikou instance
|
|
2589
2587
|
*/
|
|
2590
|
-
function
|
|
2591
|
-
const e = r instanceof
|
|
2588
|
+
function Jt(r) {
|
|
2589
|
+
const e = r instanceof rt ? r : new rt({
|
|
2592
2590
|
baseURL: r instanceof URL ? r.toString() : String(r),
|
|
2593
2591
|
responseType: "json"
|
|
2594
2592
|
});
|
|
2595
|
-
return e[
|
|
2593
|
+
return e[Pt] || (Reflect.defineProperty(e, Pt, {
|
|
2596
2594
|
get: () => !0,
|
|
2597
2595
|
enumerable: !1,
|
|
2598
2596
|
configurable: !1
|
|
2599
2597
|
}), e._tokens = /* @__PURE__ */ new Map(), e.on("afterResponse", (t) => {
|
|
2600
2598
|
const { data: i, rawRequest: n } = t, s = n?.headers.get("x-mw-token-name");
|
|
2601
|
-
s &&
|
|
2599
|
+
s && z.isBadTokenError(i) && e._tokens.delete(s);
|
|
2602
2600
|
const o = i?.query?.tokens;
|
|
2603
2601
|
o && typeof o == "object" && Object.entries(o).forEach(([c, u]) => {
|
|
2604
2602
|
typeof u == "string" && e._tokens.set(c.replace(/token$/i, "").toLowerCase(), u);
|
|
@@ -2610,9 +2608,9 @@ function Qt(r) {
|
|
|
2610
2608
|
return t;
|
|
2611
2609
|
if (t.body === void 0 || t.body === null)
|
|
2612
2610
|
return t.body = void 0, t;
|
|
2613
|
-
const i = t.body =
|
|
2611
|
+
const i = t.body = Ne.normalizeBody(t.body), n = new URLSearchParams(t.query);
|
|
2614
2612
|
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 =
|
|
2613
|
+
}), e.on("beforeInit", (t) => (t.query = Ne.normalizeBody(t.query) || {}, t)), e.on("beforeRequest", (t) => {
|
|
2616
2614
|
const i = new URL(t.url), n = i.searchParams;
|
|
2617
2615
|
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
2616
|
const s = encodeURIComponent(
|
|
@@ -2642,7 +2640,7 @@ const ae = (r, ...e) => {
|
|
|
2642
2640
|
t(c) && t(a) ? n[o] = ae(c, a) : n[o] = i(a);
|
|
2643
2641
|
}
|
|
2644
2642
|
return n;
|
|
2645
|
-
},
|
|
2643
|
+
}, mi = (r, e, t) => {
|
|
2646
2644
|
let i = { ...Zt.DEFAULT_CONFIGS };
|
|
2647
2645
|
if (typeof r == "string" ? i = ae(i, {
|
|
2648
2646
|
baseURL: r,
|
|
@@ -2655,10 +2653,10 @@ const ae = (r, ...e) => {
|
|
|
2655
2653
|
if (typeof i.baseURL != "string")
|
|
2656
2654
|
throw new Error("baseURL is required");
|
|
2657
2655
|
return i;
|
|
2658
|
-
},
|
|
2659
|
-
},
|
|
2656
|
+
}, gi = () => {
|
|
2657
|
+
}, yi = async (r, e) => {
|
|
2660
2658
|
let t = 0;
|
|
2661
|
-
const { retry: i = 3, onRetry: n =
|
|
2659
|
+
const { retry: i = 3, onRetry: n = gi, shouldRetry: s = () => !0 } = e;
|
|
2662
2660
|
let o;
|
|
2663
2661
|
do
|
|
2664
2662
|
try {
|
|
@@ -2681,12 +2679,12 @@ const ae = (r, ...e) => {
|
|
|
2681
2679
|
const ve = class {
|
|
2682
2680
|
constructor(e, t, i) {
|
|
2683
2681
|
this.version = "7.1.2", this.token = this.getToken;
|
|
2684
|
-
const n = this.config =
|
|
2682
|
+
const n = this.config = mi(
|
|
2685
2683
|
e,
|
|
2686
2684
|
t,
|
|
2687
2685
|
i
|
|
2688
2686
|
);
|
|
2689
|
-
this.request =
|
|
2687
|
+
this.request = Jt(n.baseURL);
|
|
2690
2688
|
}
|
|
2691
2689
|
setBaseURL(e) {
|
|
2692
2690
|
return this.config.baseURL = e, this.request.baseConfigs.baseURL = e, this;
|
|
@@ -2731,14 +2729,14 @@ const ve = class {
|
|
|
2731
2729
|
const t = await e();
|
|
2732
2730
|
return this.handleApiResponse(t);
|
|
2733
2731
|
} catch (t) {
|
|
2734
|
-
throw this.config.throwOnApiError &&
|
|
2735
|
-
|
|
2732
|
+
throw this.config.throwOnApiError && z.includesMediaWikiApiError(t) ? new pe(
|
|
2733
|
+
z.extractMediaWikiApiErrors(t),
|
|
2736
2734
|
t
|
|
2737
2735
|
) : t;
|
|
2738
2736
|
}
|
|
2739
2737
|
}
|
|
2740
2738
|
throwIfApiError(e) {
|
|
2741
|
-
const t =
|
|
2739
|
+
const t = z.extractMediaWikiApiErrors(e);
|
|
2742
2740
|
if (t.length > 0)
|
|
2743
2741
|
throw new pe(t, e);
|
|
2744
2742
|
}
|
|
@@ -2770,12 +2768,12 @@ const ve = class {
|
|
|
2770
2768
|
fexiosOptions: a
|
|
2771
2769
|
} = i || {};
|
|
2772
2770
|
if (s < 1)
|
|
2773
|
-
throw new
|
|
2774
|
-
|
|
2771
|
+
throw new z(
|
|
2772
|
+
xe.TOKEN_RETRY_LIMIT_EXCEEDED,
|
|
2775
2773
|
"The limit of the number of times to automatically re-acquire the token has been exceeded"
|
|
2776
2774
|
);
|
|
2777
2775
|
let c = 0;
|
|
2778
|
-
return
|
|
2776
|
+
return yi(
|
|
2779
2777
|
async () => {
|
|
2780
2778
|
const u = await this.getToken(
|
|
2781
2779
|
e,
|
|
@@ -2791,12 +2789,12 @@ const ve = class {
|
|
|
2791
2789
|
headers: { "x-mw-token-name": e }
|
|
2792
2790
|
})
|
|
2793
2791
|
);
|
|
2794
|
-
if (
|
|
2792
|
+
if (z.isBadTokenError(p.data))
|
|
2795
2793
|
throw p;
|
|
2796
2794
|
return p;
|
|
2797
2795
|
} catch (p) {
|
|
2798
|
-
throw
|
|
2799
|
-
|
|
2796
|
+
throw z.isBadTokenError(p) || p?.ok === !1 || pe.is(p) ? p : new z(
|
|
2797
|
+
xe.HTTP_ERROR,
|
|
2800
2798
|
"Network/transport or SDK-internal error (not a MediaWiki API error)",
|
|
2801
2799
|
p
|
|
2802
2800
|
);
|
|
@@ -2807,11 +2805,11 @@ const ve = class {
|
|
|
2807
2805
|
onRetry: (u, p) => {
|
|
2808
2806
|
c = p + 1;
|
|
2809
2807
|
},
|
|
2810
|
-
shouldRetry: (u) =>
|
|
2808
|
+
shouldRetry: (u) => z.isBadTokenError(u) || u?.ok === !1
|
|
2811
2809
|
}
|
|
2812
2810
|
).catch((u) => {
|
|
2813
|
-
throw
|
|
2814
|
-
|
|
2811
|
+
throw z.isBadTokenError(u) || u?.ok === !1 ? new z(
|
|
2812
|
+
xe.TOKEN_RETRY_LIMIT_EXCEEDED,
|
|
2815
2813
|
"Retry attempts for acquiring/using token exhausted",
|
|
2816
2814
|
u
|
|
2817
2815
|
) : u;
|
|
@@ -2846,7 +2844,7 @@ ve.INIT_DEFAULT_PARAMS = {
|
|
|
2846
2844
|
},
|
|
2847
2845
|
defaultParams: ve.INIT_DEFAULT_PARAMS,
|
|
2848
2846
|
throwOnApiError: !1
|
|
2849
|
-
}, ve.createRequestHandler =
|
|
2847
|
+
}, ve.createRequestHandler = Jt;
|
|
2850
2848
|
let Zt = ve;
|
|
2851
2849
|
/**
|
|
2852
2850
|
* WikiSaikou
|
|
@@ -2854,7 +2852,7 @@ let Zt = ve;
|
|
|
2854
2852
|
* @author Dragon-Fish <dragon-fish@qq.com>
|
|
2855
2853
|
* @license MIT
|
|
2856
2854
|
*/
|
|
2857
|
-
let
|
|
2855
|
+
let wi = class extends Zt {
|
|
2858
2856
|
async clientLogin(e, t, i) {
|
|
2859
2857
|
i ||= {}, !i.logincontinue && !i.loginreturnurl && (i.loginreturnurl = location?.origin);
|
|
2860
2858
|
const n = await this.postWithToken(
|
|
@@ -2871,17 +2869,17 @@ let gi = class extends Zt {
|
|
|
2871
2869
|
);
|
|
2872
2870
|
if (n?.data?.clientlogin?.status === "PASS")
|
|
2873
2871
|
return n.data.clientlogin;
|
|
2874
|
-
throw new
|
|
2875
|
-
|
|
2872
|
+
throw new z(
|
|
2873
|
+
xe.LOGIN_FAILED,
|
|
2876
2874
|
n.data.clientlogin.message,
|
|
2877
2875
|
n
|
|
2878
2876
|
);
|
|
2879
2877
|
}
|
|
2880
2878
|
};
|
|
2881
|
-
class
|
|
2879
|
+
class bi {
|
|
2882
2880
|
constructor(e, t = {}) {
|
|
2883
2881
|
this.ctx = e, location?.href && t?.baseURL?.toString()?.startsWith("/") && (t.baseURL = new URL(t.baseURL, location.origin));
|
|
2884
|
-
const i = new
|
|
2882
|
+
const i = new wi({
|
|
2885
2883
|
baseURL: t.baseURL.toString(),
|
|
2886
2884
|
fexiosConfigs: {
|
|
2887
2885
|
headers: {
|
|
@@ -2895,17 +2893,17 @@ class yi {
|
|
|
2895
2893
|
e.set("api", i);
|
|
2896
2894
|
}
|
|
2897
2895
|
}
|
|
2898
|
-
var
|
|
2896
|
+
var vi = Object.create, ft = Object.defineProperty, _i = Object.getOwnPropertyDescriptor, er = (r, e) => (e = Symbol[r]) ? e : Symbol.for("Symbol." + r), tr = (r) => {
|
|
2899
2897
|
throw TypeError(r);
|
|
2900
|
-
},
|
|
2898
|
+
}, 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
2899
|
for (var n = 0, s = r[e >> 1], o = s && s.length; n < o; n++) s[n].call(t);
|
|
2902
2900
|
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
|
-
|
|
2901
|
+
}, Ai = (r, e, t, i, n, s) => {
|
|
2902
|
+
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));
|
|
2903
|
+
xi(n, t);
|
|
2906
2904
|
for (var b = i.length - 1; b >= 0; b--)
|
|
2907
|
-
c =
|
|
2908
|
-
return
|
|
2905
|
+
c = Oi(u, t, a = {}, r[3], w), o = (0, i[b])(n, c), a._ = 1, rr(o) && (n = o);
|
|
2906
|
+
return Ri(r, n), g && ft(n, t, g), p ? u ^ 4 ? s : g : n;
|
|
2909
2907
|
}, ir, dt, nr;
|
|
2910
2908
|
ir = [le(["wiki", "wikiTitle"])];
|
|
2911
2909
|
class Ue extends (nr = he) {
|
|
@@ -2965,10 +2963,10 @@ class Ue extends (nr = he) {
|
|
|
2965
2963
|
return this.params.get("action") || "view";
|
|
2966
2964
|
}
|
|
2967
2965
|
}
|
|
2968
|
-
dt =
|
|
2969
|
-
Ue =
|
|
2970
|
-
|
|
2971
|
-
class
|
|
2966
|
+
dt = ki(nr);
|
|
2967
|
+
Ue = Ai(dt, 0, "CurrentPageService", ir, Ue);
|
|
2968
|
+
$i(dt, 1, Ue);
|
|
2969
|
+
class Pi extends he {
|
|
2972
2970
|
constructor(e) {
|
|
2973
2971
|
super(e, "resourceLoader", !0), this.ctx = e;
|
|
2974
2972
|
}
|
|
@@ -3003,11 +3001,11 @@ class Ri extends he {
|
|
|
3003
3001
|
return e.startsWith("http") || e.startsWith("//") ? e : import.meta.resolve(e);
|
|
3004
3002
|
}
|
|
3005
3003
|
}
|
|
3006
|
-
const
|
|
3007
|
-
function
|
|
3004
|
+
const qe = Object.keys;
|
|
3005
|
+
function Ii(r) {
|
|
3008
3006
|
return typeof r == "boolean";
|
|
3009
3007
|
}
|
|
3010
|
-
function
|
|
3008
|
+
function Ti(r) {
|
|
3011
3009
|
return r && typeof r.nodeType == "number";
|
|
3012
3010
|
}
|
|
3013
3011
|
function pt(r) {
|
|
@@ -3022,21 +3020,21 @@ function ue(r) {
|
|
|
3022
3020
|
function Ee(r) {
|
|
3023
3021
|
return typeof r == "function";
|
|
3024
3022
|
}
|
|
3025
|
-
function
|
|
3023
|
+
function Ci(r) {
|
|
3026
3024
|
return !!(r && r.isComponent);
|
|
3027
3025
|
}
|
|
3028
|
-
function
|
|
3026
|
+
function Li(r) {
|
|
3029
3027
|
return ue(r) && typeof r.length == "number" && typeof r.nodeType != "number";
|
|
3030
3028
|
}
|
|
3031
|
-
function
|
|
3029
|
+
function it(r, e) {
|
|
3032
3030
|
if (r)
|
|
3033
|
-
for (const t of
|
|
3031
|
+
for (const t of qe(r))
|
|
3034
3032
|
e(r[t], t);
|
|
3035
3033
|
}
|
|
3036
|
-
function
|
|
3034
|
+
function ji(r) {
|
|
3037
3035
|
return ue(r) && "current" in r;
|
|
3038
3036
|
}
|
|
3039
|
-
const
|
|
3037
|
+
const nt = {
|
|
3040
3038
|
animationIterationCount: 0,
|
|
3041
3039
|
borderImageOutset: 0,
|
|
3042
3040
|
borderImageSlice: 0,
|
|
@@ -3081,30 +3079,30 @@ const it = {
|
|
|
3081
3079
|
strokeOpacity: 0,
|
|
3082
3080
|
strokeWidth: 0
|
|
3083
3081
|
};
|
|
3084
|
-
function
|
|
3082
|
+
function Di(r, e) {
|
|
3085
3083
|
return r + e.charAt(0).toUpperCase() + e.substring(1);
|
|
3086
3084
|
}
|
|
3087
|
-
const
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3085
|
+
const Ni = ["Webkit", "ms", "Moz", "O"];
|
|
3086
|
+
qe(nt).forEach((r) => {
|
|
3087
|
+
Ni.forEach((e) => {
|
|
3088
|
+
nt[Di(e, r)] = 0;
|
|
3091
3089
|
});
|
|
3092
3090
|
});
|
|
3093
|
-
const
|
|
3091
|
+
const Ui = Symbol.for("jsx-dom:type");
|
|
3094
3092
|
var or = /* @__PURE__ */ function(r) {
|
|
3095
3093
|
return r.ShadowRoot = "ShadowRoot", r;
|
|
3096
3094
|
}(or || {});
|
|
3097
|
-
function
|
|
3098
|
-
return r != null && r[
|
|
3095
|
+
function Mi(r) {
|
|
3096
|
+
return r != null && r[Ui] === or.ShadowRoot;
|
|
3099
3097
|
}
|
|
3100
|
-
const
|
|
3098
|
+
const Bi = "http://www.w3.org/2000/svg", Hi = "http://www.w3.org/1999/xlink", Fi = "http://www.w3.org/XML/1998/namespace";
|
|
3101
3099
|
function ar(r) {
|
|
3102
|
-
return !
|
|
3100
|
+
return !Ii(r) && r != null;
|
|
3103
3101
|
}
|
|
3104
|
-
function
|
|
3105
|
-
return Array.isArray(r) ? r.map(
|
|
3102
|
+
function st(r) {
|
|
3103
|
+
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
3104
|
}
|
|
3107
|
-
const
|
|
3105
|
+
const zi = {
|
|
3108
3106
|
animate: 0,
|
|
3109
3107
|
circle: 0,
|
|
3110
3108
|
clipPath: 0,
|
|
@@ -3159,12 +3157,12 @@ const Fi = {
|
|
|
3159
3157
|
tspan: 0,
|
|
3160
3158
|
use: 0,
|
|
3161
3159
|
view: 0
|
|
3162
|
-
},
|
|
3163
|
-
function
|
|
3160
|
+
}, 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)/;
|
|
3161
|
+
function Ki(r) {
|
|
3164
3162
|
const e = document.createDocumentFragment();
|
|
3165
|
-
return
|
|
3163
|
+
return Ke(r.children, e), e;
|
|
3166
3164
|
}
|
|
3167
|
-
function
|
|
3165
|
+
function Wi(r, e, t) {
|
|
3168
3166
|
e = {
|
|
3169
3167
|
...e,
|
|
3170
3168
|
children: t
|
|
@@ -3172,15 +3170,15 @@ function qi(r, e, t) {
|
|
|
3172
3170
|
const i = new r(e), n = i.render();
|
|
3173
3171
|
return "ref" in e && mt(e.ref, i), n;
|
|
3174
3172
|
}
|
|
3175
|
-
function
|
|
3173
|
+
function A(r, e) {
|
|
3176
3174
|
let { children: t, ...i } = e;
|
|
3177
|
-
!i.namespaceURI &&
|
|
3175
|
+
!i.namespaceURI && zi[r] === 0 && (i = {
|
|
3178
3176
|
...i,
|
|
3179
|
-
namespaceURI:
|
|
3177
|
+
namespaceURI: Bi
|
|
3180
3178
|
});
|
|
3181
3179
|
let n;
|
|
3182
3180
|
if (pt(r)) {
|
|
3183
|
-
if (n = i.namespaceURI ? document.createElementNS(i.namespaceURI, r) : document.createElement(r),
|
|
3181
|
+
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
3182
|
if (i.multiple === !0 && Array.isArray(i.value)) {
|
|
3185
3183
|
const s = i.value.map((o) => String(o));
|
|
3186
3184
|
n.querySelectorAll("option").forEach(
|
|
@@ -3193,7 +3191,7 @@ function P(r, e) {
|
|
|
3193
3191
|
ue(r.defaultProps) && (i = {
|
|
3194
3192
|
...r.defaultProps,
|
|
3195
3193
|
...i
|
|
3196
|
-
}), n =
|
|
3194
|
+
}), n = Ci(r) ? Wi(r, i, t) : r({
|
|
3197
3195
|
...i,
|
|
3198
3196
|
children: t
|
|
3199
3197
|
});
|
|
@@ -3202,39 +3200,39 @@ function P(r, e) {
|
|
|
3202
3200
|
return n;
|
|
3203
3201
|
}
|
|
3204
3202
|
function mt(r, e) {
|
|
3205
|
-
|
|
3203
|
+
ji(r) ? r.current = e : Ee(r) && r(e);
|
|
3206
3204
|
}
|
|
3207
|
-
function
|
|
3208
|
-
if (
|
|
3209
|
-
|
|
3205
|
+
function Ke(r, e) {
|
|
3206
|
+
if (Li(r))
|
|
3207
|
+
Yi(r, e);
|
|
3210
3208
|
else if (pt(r) || sr(r))
|
|
3211
|
-
|
|
3209
|
+
Ye(document.createTextNode(r), e);
|
|
3212
3210
|
else if (r === null)
|
|
3213
|
-
|
|
3214
|
-
else if (
|
|
3215
|
-
|
|
3216
|
-
else if (
|
|
3211
|
+
Ye(document.createComment(""), e);
|
|
3212
|
+
else if (Ti(r))
|
|
3213
|
+
Ye(r, e);
|
|
3214
|
+
else if (Mi(r)) {
|
|
3217
3215
|
const t = e.attachShadow(r.attr);
|
|
3218
|
-
|
|
3216
|
+
Ke(r.children, t), mt(r.ref, t);
|
|
3219
3217
|
}
|
|
3220
3218
|
}
|
|
3221
|
-
function
|
|
3219
|
+
function Yi(r, e) {
|
|
3222
3220
|
for (const t of [...r])
|
|
3223
|
-
|
|
3221
|
+
Ke(t, e);
|
|
3224
3222
|
return e;
|
|
3225
3223
|
}
|
|
3226
|
-
function
|
|
3224
|
+
function Ye(r, e) {
|
|
3227
3225
|
e instanceof window.HTMLTemplateElement ? e.content.appendChild(r) : e.appendChild(r);
|
|
3228
3226
|
}
|
|
3229
3227
|
function Te(r, e) {
|
|
3230
3228
|
return r.replace(/[A-Z]/g, (t) => e + t.toLowerCase());
|
|
3231
3229
|
}
|
|
3232
3230
|
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) &&
|
|
3231
|
+
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) => {
|
|
3232
|
+
i.indexOf("-") === 0 ? r.style.setProperty(i, t) : sr(t) && nt[i] !== 0 ? r.style[i] = t + "px" : r.style[i] = t;
|
|
3235
3233
|
}));
|
|
3236
3234
|
}
|
|
3237
|
-
function
|
|
3235
|
+
function Gi(r, e, t) {
|
|
3238
3236
|
switch (r) {
|
|
3239
3237
|
case "xlinkActuate":
|
|
3240
3238
|
case "xlinkArcrole":
|
|
@@ -3243,7 +3241,7 @@ function Wi(r, e, t) {
|
|
|
3243
3241
|
case "xlinkShow":
|
|
3244
3242
|
case "xlinkTitle":
|
|
3245
3243
|
case "xlinkType":
|
|
3246
|
-
|
|
3244
|
+
It(t, Hi, Te(r, ":"), e);
|
|
3247
3245
|
return;
|
|
3248
3246
|
case "xmlnsXlink":
|
|
3249
3247
|
fe(t, Te(r, ":"), e);
|
|
@@ -3251,7 +3249,7 @@ function Wi(r, e, t) {
|
|
|
3251
3249
|
case "xmlBase":
|
|
3252
3250
|
case "xmlLang":
|
|
3253
3251
|
case "xmlSpace":
|
|
3254
|
-
|
|
3252
|
+
It(t, Fi, Te(r, ":"), e);
|
|
3255
3253
|
return;
|
|
3256
3254
|
}
|
|
3257
3255
|
switch (r) {
|
|
@@ -3259,7 +3257,7 @@ function Wi(r, e, t) {
|
|
|
3259
3257
|
fe(t, "for", e);
|
|
3260
3258
|
return;
|
|
3261
3259
|
case "dataset":
|
|
3262
|
-
|
|
3260
|
+
it(e, (i, n) => {
|
|
3263
3261
|
i != null && (t.dataset[n] = i);
|
|
3264
3262
|
});
|
|
3265
3263
|
return;
|
|
@@ -3284,7 +3282,7 @@ function Wi(r, e, t) {
|
|
|
3284
3282
|
return;
|
|
3285
3283
|
case "class":
|
|
3286
3284
|
case "className":
|
|
3287
|
-
Ee(e) ? e(t) : fe(t, "class",
|
|
3285
|
+
Ee(e) ? e(t) : fe(t, "class", st(e));
|
|
3288
3286
|
return;
|
|
3289
3287
|
case "ref":
|
|
3290
3288
|
case "namespaceURI":
|
|
@@ -3294,7 +3292,7 @@ function Wi(r, e, t) {
|
|
|
3294
3292
|
return;
|
|
3295
3293
|
case "on":
|
|
3296
3294
|
case "onCapture":
|
|
3297
|
-
|
|
3295
|
+
it(e, (i, n) => {
|
|
3298
3296
|
t.addEventListener(n, i, r === "onCapture");
|
|
3299
3297
|
});
|
|
3300
3298
|
return;
|
|
@@ -3316,22 +3314,22 @@ function Wi(r, e, t) {
|
|
|
3316
3314
|
i in window ? s = i.substring(2) : s = i[2] + r.slice(3), t.addEventListener(s, e);
|
|
3317
3315
|
}
|
|
3318
3316
|
}
|
|
3319
|
-
} else ue(e) ? t[r] = e : e === !0 ? fe(t, r, "") : e !== !1 && e != null && (t instanceof SVGElement && !
|
|
3317
|
+
} 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
3318
|
}
|
|
3321
3319
|
function fe(r, e, t) {
|
|
3322
3320
|
r.setAttribute(e, t);
|
|
3323
3321
|
}
|
|
3324
|
-
function
|
|
3322
|
+
function It(r, e, t, i) {
|
|
3325
3323
|
r.setAttributeNS(e, t, i);
|
|
3326
3324
|
}
|
|
3327
|
-
function
|
|
3328
|
-
for (const t of
|
|
3329
|
-
|
|
3325
|
+
function Xi(r, e) {
|
|
3326
|
+
for (const t of qe(r))
|
|
3327
|
+
Gi(t, r[t], e);
|
|
3330
3328
|
return e;
|
|
3331
3329
|
}
|
|
3332
3330
|
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
|
|
3331
|
+
let Vi = 0;
|
|
3332
|
+
const Tt = (r) => `${r}-${++Vi}`;
|
|
3335
3333
|
function ye(r) {
|
|
3336
3334
|
return r instanceof Node ? r : document.createTextNode(String(r));
|
|
3337
3335
|
}
|
|
@@ -3358,8 +3356,8 @@ function U(r, e = {}) {
|
|
|
3358
3356
|
for (const [i, n] of Object.entries(e.attrs)) t.setAttribute(i, n);
|
|
3359
3357
|
return t;
|
|
3360
3358
|
}
|
|
3361
|
-
const
|
|
3362
|
-
function
|
|
3359
|
+
const Qi = typeof navigator < "u" && /Mac|iPhone|iPad|iPod/i.test(navigator.platform), lr = ["ctrl", "alt", "shift", "meta"];
|
|
3360
|
+
function Ji(r) {
|
|
3363
3361
|
if (!r) return null;
|
|
3364
3362
|
const e = String(r).trim().toLowerCase().split(/[+\-\s]+/g).filter(Boolean), t = [];
|
|
3365
3363
|
let i = null;
|
|
@@ -3385,7 +3383,7 @@ function Vi(r) {
|
|
|
3385
3383
|
continue;
|
|
3386
3384
|
}
|
|
3387
3385
|
if (a === "mod") {
|
|
3388
|
-
n(
|
|
3386
|
+
n(Qi ? "meta" : "ctrl");
|
|
3389
3387
|
continue;
|
|
3390
3388
|
}
|
|
3391
3389
|
a === "esc" && (a = "escape"), a === "return" && (a = "enter"), (a === "space" || a === "spacebar") && (a = "space"), i = a;
|
|
@@ -3393,7 +3391,7 @@ function Vi(r) {
|
|
|
3393
3391
|
const s = lr.filter((o) => t.includes(o));
|
|
3394
3392
|
return !i || i === "" ? s.length ? s.join("+") : null : s.length ? `${s.join("+")}+${i}` : i;
|
|
3395
3393
|
}
|
|
3396
|
-
function
|
|
3394
|
+
function Zi(r) {
|
|
3397
3395
|
const e = [];
|
|
3398
3396
|
r.ctrlKey && e.push("ctrl"), r.altKey && e.push("alt"), r.shiftKey && e.push("shift"), r.metaKey && e.push("meta");
|
|
3399
3397
|
let t = r.key;
|
|
@@ -3401,7 +3399,7 @@ function Ji(r) {
|
|
|
3401
3399
|
const i = (t.length, t.toLowerCase()), n = lr.filter((s) => e.includes(s));
|
|
3402
3400
|
return n.length ? `${n.join("+")}+${i}` : i;
|
|
3403
3401
|
}
|
|
3404
|
-
class
|
|
3402
|
+
class en {
|
|
3405
3403
|
constructor() {
|
|
3406
3404
|
this.zBase = 1e3, this.stack = [];
|
|
3407
3405
|
}
|
|
@@ -3434,23 +3432,10 @@ class Qi {
|
|
|
3434
3432
|
document.body.classList.remove("ipe-modal-no-scroll");
|
|
3435
3433
|
}
|
|
3436
3434
|
}
|
|
3437
|
-
const B = new
|
|
3438
|
-
class
|
|
3435
|
+
const B = new en();
|
|
3436
|
+
class Me {
|
|
3439
3437
|
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) => {
|
|
3438
|
+
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
3439
|
this.stopCloseTimer(), this.closeTimer = window.setTimeout(() => this.close(), t);
|
|
3455
3440
|
}, this.stopCloseTimer = () => {
|
|
3456
3441
|
this.closeTimer && window.clearTimeout(this.closeTimer), this.closeTimer = void 0;
|
|
@@ -3466,11 +3451,35 @@ class yt {
|
|
|
3466
3451
|
t.classList.remove("is-dragging"), i.style.animation = "none", requestAnimationFrame(() => {
|
|
3467
3452
|
this.applyAnimation(!0);
|
|
3468
3453
|
});
|
|
3469
|
-
}, this.options = { ...
|
|
3454
|
+
}, this.options = { ...Me.DEFAULT_OPTIONS, ...e }, this.options.backdrop === !1 && e.bodyScroll === void 0 && (this.options.bodyScroll = !0);
|
|
3470
3455
|
}
|
|
3471
3456
|
get isDestroyed() {
|
|
3472
3457
|
return this._isDestroyed;
|
|
3473
3458
|
}
|
|
3459
|
+
static {
|
|
3460
|
+
this.DEFAULT_OPTIONS = {
|
|
3461
|
+
className: "",
|
|
3462
|
+
sizeClass: "auto",
|
|
3463
|
+
center: !0,
|
|
3464
|
+
fitScreen: !1,
|
|
3465
|
+
closeIcon: !0,
|
|
3466
|
+
bodyScroll: !1,
|
|
3467
|
+
outSideClose: !0,
|
|
3468
|
+
backdrop: !0,
|
|
3469
|
+
animation: {
|
|
3470
|
+
show: "ipe-modal-fade-in",
|
|
3471
|
+
hide: "ipe-modal-fade-out"
|
|
3472
|
+
},
|
|
3473
|
+
animationSpeed: 200
|
|
3474
|
+
};
|
|
3475
|
+
}
|
|
3476
|
+
static extends(e = {}) {
|
|
3477
|
+
return class extends this {
|
|
3478
|
+
constructor(t = {}) {
|
|
3479
|
+
super({ ...e, ...t });
|
|
3480
|
+
}
|
|
3481
|
+
};
|
|
3482
|
+
}
|
|
3474
3483
|
// ------------------------------ lifecycle ------------------------------ //
|
|
3475
3484
|
init() {
|
|
3476
3485
|
if (this.$modal) return this;
|
|
@@ -3486,9 +3495,9 @@ class yt {
|
|
|
3486
3495
|
});
|
|
3487
3496
|
if (i.modal = this, !e) {
|
|
3488
3497
|
i.classList.add("no-backdrop");
|
|
3489
|
-
const g = window.pageYOffset || document.documentElement.scrollTop, b = window.pageXOffset || document.documentElement.scrollLeft,
|
|
3498
|
+
const g = window.pageYOffset || document.documentElement.scrollTop, b = window.pageXOffset || document.documentElement.scrollLeft, R = window.innerWidth;
|
|
3490
3499
|
i.style.top = `${g + 60}px`, this.once("modal.show", () => {
|
|
3491
|
-
i.style.left = `${b +
|
|
3500
|
+
i.style.left = `${b + R / 2 - i.offsetWidth / 2}px`;
|
|
3492
3501
|
});
|
|
3493
3502
|
}
|
|
3494
3503
|
const n = U("div", {
|
|
@@ -3680,7 +3689,7 @@ class yt {
|
|
|
3680
3689
|
if (e.keyPress) {
|
|
3681
3690
|
const s = String(e.keyPress).split(/[\,\|]+/g).map((o) => o.trim()).filter(Boolean);
|
|
3682
3691
|
for (const o of s) {
|
|
3683
|
-
const a =
|
|
3692
|
+
const a = Ji(o);
|
|
3684
3693
|
a && this.keyMap.set(a, i);
|
|
3685
3694
|
}
|
|
3686
3695
|
}
|
|
@@ -3769,7 +3778,7 @@ class yt {
|
|
|
3769
3778
|
const i = e.ctrlKey || e.altKey || e.metaKey, n = e.target;
|
|
3770
3779
|
if (!i && (n && ["INPUT", "TEXTAREA"].includes(n.tagName) || n.contentEditable === "true"))
|
|
3771
3780
|
return;
|
|
3772
|
-
const s =
|
|
3781
|
+
const s = Zi(e), o = this.keyMap.get(s);
|
|
3773
3782
|
if (o) {
|
|
3774
3783
|
e.preventDefault(), o.click();
|
|
3775
3784
|
return;
|
|
@@ -3807,7 +3816,7 @@ class yt {
|
|
|
3807
3816
|
/** Show as toast (no backdrop, container stack). */
|
|
3808
3817
|
showToast(e) {
|
|
3809
3818
|
this.$window || this.init();
|
|
3810
|
-
const t =
|
|
3819
|
+
const t = tn(e.position ?? "top right"), i = this.get$window();
|
|
3811
3820
|
this.isToast = !0, i.style.pointerEvents = "auto", this.applyAnimation(!0), t.appendChild(i);
|
|
3812
3821
|
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
3822
|
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 +3850,7 @@ class yt {
|
|
|
3841
3850
|
return B.closeAll(e, t), [...oe].forEach((s) => {
|
|
3842
3851
|
const o = s.modalId, a = n.size ? n.has(s.pluginName) : !0, c = i.has(o);
|
|
3843
3852
|
a && !c && s.close();
|
|
3844
|
-
}), B.top() ?? new
|
|
3853
|
+
}), B.top() ?? new Me();
|
|
3845
3854
|
}
|
|
3846
3855
|
static removeAll() {
|
|
3847
3856
|
B.removeAll(), [...oe].forEach((e) => e.destroy());
|
|
@@ -3865,7 +3874,8 @@ class yt {
|
|
|
3865
3874
|
}
|
|
3866
3875
|
static confirm(e, t) {
|
|
3867
3876
|
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" }
|
|
3877
|
+
const i = e.okBtn ?? { label: "OK", className: "is-primary is-ghost" }, n = e.cancelBtn ?? { label: "Cancel", className: "is-danger is-ghost" };
|
|
3878
|
+
return new this({
|
|
3869
3879
|
sizeClass: "dialog",
|
|
3870
3880
|
...e,
|
|
3871
3881
|
buttons: [
|
|
@@ -3873,24 +3883,25 @@ class yt {
|
|
|
3873
3883
|
label: n.label,
|
|
3874
3884
|
className: n.className,
|
|
3875
3885
|
keyPress: "n",
|
|
3876
|
-
method: () =>
|
|
3886
|
+
method: (s, o) => {
|
|
3887
|
+
t?.(!1, o, s), o.close();
|
|
3888
|
+
}
|
|
3877
3889
|
},
|
|
3878
3890
|
{
|
|
3879
3891
|
label: i.label,
|
|
3880
3892
|
className: i.className,
|
|
3881
3893
|
keyPress: "y",
|
|
3882
|
-
method: (o) => {
|
|
3883
|
-
t?.(o, s),
|
|
3894
|
+
method: (s, o) => {
|
|
3895
|
+
t?.(!0, o, s), s.defaultPrevented || o.close();
|
|
3884
3896
|
}
|
|
3885
3897
|
}
|
|
3886
3898
|
]
|
|
3887
|
-
});
|
|
3888
|
-
return s.init().show();
|
|
3899
|
+
}).init().show();
|
|
3889
3900
|
}
|
|
3890
3901
|
static getDefaultNotifyIcon(e) {
|
|
3891
3902
|
switch (e) {
|
|
3892
3903
|
case "success":
|
|
3893
|
-
return /* @__PURE__ */
|
|
3904
|
+
return /* @__PURE__ */ A(
|
|
3894
3905
|
"svg",
|
|
3895
3906
|
{
|
|
3896
3907
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -3900,13 +3911,13 @@ class yt {
|
|
|
3900
3911
|
fill: "currentColor",
|
|
3901
3912
|
class: "icon icon-tabler icons-tabler-filled icon-tabler-circle-check",
|
|
3902
3913
|
children: [
|
|
3903
|
-
/* @__PURE__ */
|
|
3904
|
-
/* @__PURE__ */
|
|
3914
|
+
/* @__PURE__ */ A("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
|
|
3915
|
+
/* @__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
3916
|
]
|
|
3906
3917
|
}
|
|
3907
3918
|
);
|
|
3908
3919
|
case "error":
|
|
3909
|
-
return /* @__PURE__ */
|
|
3920
|
+
return /* @__PURE__ */ A(
|
|
3910
3921
|
"svg",
|
|
3911
3922
|
{
|
|
3912
3923
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -3916,13 +3927,13 @@ class yt {
|
|
|
3916
3927
|
fill: "currentColor",
|
|
3917
3928
|
class: "icon icon-tabler icons-tabler-filled icon-tabler-alert-triangle",
|
|
3918
3929
|
children: [
|
|
3919
|
-
/* @__PURE__ */
|
|
3920
|
-
/* @__PURE__ */
|
|
3930
|
+
/* @__PURE__ */ A("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
|
|
3931
|
+
/* @__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
3932
|
]
|
|
3922
3933
|
}
|
|
3923
3934
|
);
|
|
3924
3935
|
case "warning":
|
|
3925
|
-
return /* @__PURE__ */
|
|
3936
|
+
return /* @__PURE__ */ A(
|
|
3926
3937
|
"svg",
|
|
3927
3938
|
{
|
|
3928
3939
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -3932,13 +3943,13 @@ class yt {
|
|
|
3932
3943
|
fill: "currentColor",
|
|
3933
3944
|
class: "icon icon-tabler icons-tabler-filled icon-tabler-alert-circle",
|
|
3934
3945
|
children: [
|
|
3935
|
-
/* @__PURE__ */
|
|
3936
|
-
/* @__PURE__ */
|
|
3946
|
+
/* @__PURE__ */ A("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
|
|
3947
|
+
/* @__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
3948
|
]
|
|
3938
3949
|
}
|
|
3939
3950
|
);
|
|
3940
3951
|
case "info":
|
|
3941
|
-
return /* @__PURE__ */
|
|
3952
|
+
return /* @__PURE__ */ A(
|
|
3942
3953
|
"svg",
|
|
3943
3954
|
{
|
|
3944
3955
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -3948,13 +3959,13 @@ class yt {
|
|
|
3948
3959
|
fill: "currentColor",
|
|
3949
3960
|
class: "icon icon-tabler icons-tabler-filled icon-tabler-info-circle",
|
|
3950
3961
|
children: [
|
|
3951
|
-
/* @__PURE__ */
|
|
3952
|
-
/* @__PURE__ */
|
|
3962
|
+
/* @__PURE__ */ A("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
|
|
3963
|
+
/* @__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
3964
|
]
|
|
3954
3965
|
}
|
|
3955
3966
|
);
|
|
3956
3967
|
case "dialog":
|
|
3957
|
-
return /* @__PURE__ */
|
|
3968
|
+
return /* @__PURE__ */ A(
|
|
3958
3969
|
"svg",
|
|
3959
3970
|
{
|
|
3960
3971
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -3968,16 +3979,16 @@ class yt {
|
|
|
3968
3979
|
"stroke-linejoin": "round",
|
|
3969
3980
|
class: "icon icon-tabler icons-tabler-outline icon-tabler-message-dots",
|
|
3970
3981
|
children: [
|
|
3971
|
-
/* @__PURE__ */
|
|
3972
|
-
/* @__PURE__ */
|
|
3973
|
-
/* @__PURE__ */
|
|
3974
|
-
/* @__PURE__ */
|
|
3975
|
-
/* @__PURE__ */
|
|
3982
|
+
/* @__PURE__ */ A("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
|
|
3983
|
+
/* @__PURE__ */ A("path", { d: "M12 11v.01" }),
|
|
3984
|
+
/* @__PURE__ */ A("path", { d: "M8 11v.01" }),
|
|
3985
|
+
/* @__PURE__ */ A("path", { d: "M16 11v.01" }),
|
|
3986
|
+
/* @__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
3987
|
]
|
|
3977
3988
|
}
|
|
3978
3989
|
);
|
|
3979
3990
|
case "confirm":
|
|
3980
|
-
return /* @__PURE__ */
|
|
3991
|
+
return /* @__PURE__ */ A(
|
|
3981
3992
|
"svg",
|
|
3982
3993
|
{
|
|
3983
3994
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -3987,8 +3998,8 @@ class yt {
|
|
|
3987
3998
|
fill: "currentColor",
|
|
3988
3999
|
class: "icon icon-tabler icons-tabler-filled icon-tabler-copy-check",
|
|
3989
4000
|
children: [
|
|
3990
|
-
/* @__PURE__ */
|
|
3991
|
-
/* @__PURE__ */
|
|
4001
|
+
/* @__PURE__ */ A("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
|
|
4002
|
+
/* @__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
4003
|
]
|
|
3993
4004
|
}
|
|
3994
4005
|
);
|
|
@@ -4002,13 +4013,13 @@ class yt {
|
|
|
4002
4013
|
t.title = a[0].toUpperCase() + a.slice(1).toLowerCase();
|
|
4003
4014
|
}
|
|
4004
4015
|
const n = t.icon ?? this.getDefaultNotifyIcon(e);
|
|
4005
|
-
n && (n instanceof Element && n.classList.add("ipe-modal-notify-icon"), t.title = /* @__PURE__ */
|
|
4016
|
+
n && (n instanceof Element && n.classList.add("ipe-modal-notify-icon"), t.title = /* @__PURE__ */ A(Ki, { children: [
|
|
4006
4017
|
n,
|
|
4007
4018
|
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),
|
|
4019
|
+
] })), 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) => {
|
|
4020
|
+
i?.(!0, c, a), c.close();
|
|
4021
|
+
}), 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) => {
|
|
4022
|
+
i?.(!1, c, a), c.close();
|
|
4012
4023
|
}), t.buttons = [t.cancelBtn, t.okBtn, ...t.buttons ?? []].filter(
|
|
4013
4024
|
Boolean
|
|
4014
4025
|
);
|
|
@@ -4021,10 +4032,6 @@ class yt {
|
|
|
4021
4032
|
closeIcon: !0,
|
|
4022
4033
|
outSideClose: !1,
|
|
4023
4034
|
bodyScroll: !0,
|
|
4024
|
-
animation: t.animation ?? {
|
|
4025
|
-
show: "fadeIn",
|
|
4026
|
-
hide: "fadeOut"
|
|
4027
|
-
},
|
|
4028
4035
|
buttons: t.buttons ?? []
|
|
4029
4036
|
});
|
|
4030
4037
|
return o.setPluginName("toast"), o.showToast({
|
|
@@ -4033,7 +4040,7 @@ class yt {
|
|
|
4033
4040
|
}
|
|
4034
4041
|
}
|
|
4035
4042
|
const oe = [];
|
|
4036
|
-
function
|
|
4043
|
+
function tn(r = "top right") {
|
|
4037
4044
|
const e = "ipe-modal-toast-container", t = `${e}-${r.replace(/[\s-\.|\/]+/g, "-")}`;
|
|
4038
4045
|
let i = document.getElementById(t);
|
|
4039
4046
|
return i || (i = U("div", {
|
|
@@ -4041,7 +4048,7 @@ function Zi(r = "top right") {
|
|
|
4041
4048
|
attrs: { id: t, "data-position": r }
|
|
4042
4049
|
}), document.body.appendChild(i)), i;
|
|
4043
4050
|
}
|
|
4044
|
-
class
|
|
4051
|
+
class C extends Me {
|
|
4045
4052
|
constructor(e = {}) {
|
|
4046
4053
|
e.className ||= "", e.className += " theme-ipe", e.modalAnimation ||= {
|
|
4047
4054
|
show: "ipe-modal-fade-in",
|
|
@@ -4056,7 +4063,7 @@ class L extends yt {
|
|
|
4056
4063
|
this._tmpDisabledActiveInputs = t, t.forEach((i) => {
|
|
4057
4064
|
i.disabled = !0;
|
|
4058
4065
|
}), this.get$content().append(
|
|
4059
|
-
/* @__PURE__ */
|
|
4066
|
+
/* @__PURE__ */ H(
|
|
4060
4067
|
"div",
|
|
4061
4068
|
{
|
|
4062
4069
|
id: "ipe-modalLoadingWrapper",
|
|
@@ -4072,7 +4079,7 @@ class L extends yt {
|
|
|
4072
4079
|
backgroundColor: "rgba(255, 255, 255, 0.5)",
|
|
4073
4080
|
zIndex: 2e3
|
|
4074
4081
|
},
|
|
4075
|
-
children: /* @__PURE__ */
|
|
4082
|
+
children: /* @__PURE__ */ H(Er, { style: { width: "80%", maxWidth: "800px" } })
|
|
4076
4083
|
}
|
|
4077
4084
|
)
|
|
4078
4085
|
);
|
|
@@ -4085,10 +4092,10 @@ class L extends yt {
|
|
|
4085
4092
|
}
|
|
4086
4093
|
}
|
|
4087
4094
|
}
|
|
4088
|
-
class
|
|
4095
|
+
class rn {
|
|
4089
4096
|
constructor(e) {
|
|
4090
|
-
this.ctx = e, this.IPEModal =
|
|
4091
|
-
|
|
4097
|
+
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", () => {
|
|
4098
|
+
C.closeAll();
|
|
4092
4099
|
});
|
|
4093
4100
|
}
|
|
4094
4101
|
}
|
|
@@ -4121,132 +4128,161 @@ const ur = (r) => {
|
|
|
4121
4128
|
n.set(o, a);
|
|
4122
4129
|
return i.search = n.toString(), i.hash = "", i;
|
|
4123
4130
|
};
|
|
4124
|
-
var
|
|
4131
|
+
var nn = Object.create, yt = Object.defineProperty, sn = Object.getOwnPropertyDescriptor, fr = (r, e) => (e = Symbol[r]) ? e : Symbol.for("Symbol." + r), dr = (r) => {
|
|
4125
4132
|
throw TypeError(r);
|
|
4126
|
-
},
|
|
4133
|
+
}, 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
4134
|
for (var n = 0, s = r[e >> 1], o = s && s.length; n < o; n++) s[n].call(t);
|
|
4128
4135
|
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
|
-
|
|
4136
|
+
}, dn = (r, e, t, i, n, s) => {
|
|
4137
|
+
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));
|
|
4138
|
+
an(n, t);
|
|
4132
4139
|
for (var b = i.length - 1; b >= 0; b--)
|
|
4133
|
-
c =
|
|
4134
|
-
return
|
|
4135
|
-
}, mr,
|
|
4140
|
+
c = un(u, t, a = {}, r[3], w), o = (0, i[b])(n, c), a._ = 1, pr(o) && (n = o);
|
|
4141
|
+
return hn(r, n), g && yt(n, t, g), p ? u ^ 4 ? s : g : n;
|
|
4142
|
+
}, mr, wt, gr;
|
|
4136
4143
|
mr = [le(["api", "storage"])];
|
|
4137
|
-
class
|
|
4144
|
+
class Be extends (gr = he) {
|
|
4138
4145
|
constructor(e) {
|
|
4139
|
-
super(e, "wiki", !1), this.ctx = e, this._data =
|
|
4140
|
-
|
|
4141
|
-
|
|
4142
|
-
|
|
4143
|
-
|
|
4146
|
+
super(e, "wiki", !1), this.ctx = e, this._data = {}, this.CACHE_VERSION = 3, this.CACHE_TTL = {
|
|
4147
|
+
siteinfo: 1e3 * 60 * 60 * 24 * 3,
|
|
4148
|
+
// 3 days
|
|
4149
|
+
userinfo: 1e3 * 60 * 30
|
|
4150
|
+
// 30 minutes
|
|
4151
|
+
}, this.QUERY_DATA = {
|
|
4152
|
+
siteinfo: {
|
|
4153
|
+
meta: "siteinfo",
|
|
4154
|
+
siprop: "general|specialpagealiases|namespacealiases|namespaces|magicwords"
|
|
4155
|
+
},
|
|
4156
|
+
userinfo: { meta: "userinfo", uiprop: "groups|rights|blockinfo|options" }
|
|
4157
|
+
}, this.CACHE_DB = void 0, this.mwConfig = {
|
|
4144
4158
|
get: (t, i) => window?.mw?.config?.get?.(t, i) ?? i,
|
|
4145
4159
|
has: (t) => window?.mw?.config?.exists?.(t) ?? !1,
|
|
4146
4160
|
get values() {
|
|
4147
4161
|
return window?.mw?.config?.values || {};
|
|
4148
4162
|
}
|
|
4149
|
-
}, this.
|
|
4163
|
+
}, this.CACHE_DB = e.storage.createDatabse(
|
|
4164
|
+
"wiki-metadata",
|
|
4165
|
+
1 / 0,
|
|
4166
|
+
this.CACHE_VERSION
|
|
4167
|
+
);
|
|
4168
|
+
}
|
|
4169
|
+
get logger() {
|
|
4170
|
+
return this.ctx.logger("WIKI_METADATA");
|
|
4150
4171
|
}
|
|
4151
4172
|
get api() {
|
|
4152
4173
|
return this.ctx.api;
|
|
4153
4174
|
}
|
|
4154
4175
|
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(
|
|
4176
|
+
await Promise.all(
|
|
4177
|
+
Object.keys(this.QUERY_DATA).map((e) => this.initData(e))
|
|
4178
|
+
), 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) => {
|
|
4179
|
+
e.preferences.registerCustomConfig(
|
|
4164
4180
|
"WikiMetadataService",
|
|
4165
|
-
|
|
4166
|
-
WikiMetadataService:
|
|
4167
|
-
/* @__PURE__ */
|
|
4168
|
-
/* @__PURE__ */
|
|
4169
|
-
/* @__PURE__ */
|
|
4170
|
-
/* @__PURE__ */
|
|
4171
|
-
/* @__PURE__ */
|
|
4181
|
+
Ze.object({
|
|
4182
|
+
WikiMetadataService: Ze.const(
|
|
4183
|
+
/* @__PURE__ */ H("div", { children: [
|
|
4184
|
+
/* @__PURE__ */ H("h3", { children: "Wiki Informations" }),
|
|
4185
|
+
/* @__PURE__ */ H("ul", { children: [
|
|
4186
|
+
/* @__PURE__ */ H("li", { children: [
|
|
4187
|
+
/* @__PURE__ */ H("strong", { children: "Site:" }),
|
|
4172
4188
|
" ",
|
|
4173
4189
|
this.general.sitename,
|
|
4174
4190
|
" (",
|
|
4175
4191
|
this.landingPageUrl,
|
|
4176
4192
|
")"
|
|
4177
4193
|
] }),
|
|
4178
|
-
/* @__PURE__ */
|
|
4179
|
-
/* @__PURE__ */
|
|
4194
|
+
/* @__PURE__ */ H("li", { children: [
|
|
4195
|
+
/* @__PURE__ */ H("strong", { children: "User" }),
|
|
4180
4196
|
": ",
|
|
4181
4197
|
this.userInfo.name,
|
|
4182
4198
|
" (ID: ",
|
|
4183
4199
|
this.userInfo.id,
|
|
4184
4200
|
")"
|
|
4185
4201
|
] }),
|
|
4186
|
-
/* @__PURE__ */
|
|
4187
|
-
/* @__PURE__ */
|
|
4202
|
+
/* @__PURE__ */ H("li", { children: [
|
|
4203
|
+
/* @__PURE__ */ H("strong", { children: "Groups" }),
|
|
4188
4204
|
": ",
|
|
4189
4205
|
this.userGroups.join(", ") || "None"
|
|
4190
4206
|
] })
|
|
4191
4207
|
] }),
|
|
4192
|
-
/* @__PURE__ */
|
|
4193
|
-
"button",
|
|
4194
|
-
|
|
4195
|
-
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
4208
|
+
/* @__PURE__ */ H("div", { children: [
|
|
4209
|
+
/* @__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." }),
|
|
4210
|
+
/* @__PURE__ */ H(
|
|
4211
|
+
"button",
|
|
4212
|
+
{
|
|
4213
|
+
onClick: (t) => {
|
|
4214
|
+
t.preventDefault(), Promise.all(
|
|
4215
|
+
Object.keys(this.QUERY_DATA).map(
|
|
4216
|
+
(i) => this.invalidateCache(i)
|
|
4217
|
+
)
|
|
4218
|
+
).then(() => {
|
|
4219
|
+
window.location.reload();
|
|
4220
|
+
});
|
|
4221
|
+
},
|
|
4222
|
+
children: "🧹 Clear caches & Reload"
|
|
4223
|
+
}
|
|
4224
|
+
)
|
|
4225
|
+
] })
|
|
4203
4226
|
] })
|
|
4204
4227
|
).role("raw-html")
|
|
4205
4228
|
}).description("WikiMetadataService"),
|
|
4206
4229
|
"general"
|
|
4207
4230
|
);
|
|
4208
|
-
});
|
|
4231
|
+
}), this.logger.info("All initialized", this._data);
|
|
4232
|
+
}
|
|
4233
|
+
async initData(e, t = !1) {
|
|
4234
|
+
const i = t ? null : await this.fetchFromCache(e);
|
|
4235
|
+
if (i)
|
|
4236
|
+
return this._data[e] = i, this.logger.debug("Using cached", e, i), i;
|
|
4237
|
+
{
|
|
4238
|
+
const n = await this.fetchFromApi(e);
|
|
4239
|
+
return this.saveToCache(e, n), this._data[e] = n, this.logger.debug("Fetched from API", e, n), n;
|
|
4240
|
+
}
|
|
4209
4241
|
}
|
|
4210
|
-
|
|
4211
|
-
return this.ctx.api.config.baseURL
|
|
4242
|
+
getCacheKey(e) {
|
|
4243
|
+
return `${e}:${new URL(this.ctx.api.config.baseURL).pathname.replace(/^\//, "")}`;
|
|
4212
4244
|
}
|
|
4213
|
-
async fetchFromApi() {
|
|
4245
|
+
async fetchFromApi(e) {
|
|
4214
4246
|
return this.api.get({
|
|
4215
4247
|
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
|
|
4248
|
+
...this.QUERY_DATA[e]
|
|
4249
|
+
}).then(({ data: t }) => {
|
|
4250
|
+
if (typeof t?.query != "object" || t.query === null)
|
|
4251
|
+
throw new Error("Invalid query data", { cause: t });
|
|
4252
|
+
return e === "siteinfo" ? t.query : t.query?.[e] || t.query;
|
|
4253
|
+
}).catch((t) => (this.logger.error("Failed to fetch", t), Promise.reject(t)));
|
|
4254
|
+
}
|
|
4255
|
+
async fetchFromCache(e) {
|
|
4256
|
+
const t = this.getCacheKey(e);
|
|
4257
|
+
return await this.CACHE_DB.get(t, this.CACHE_TTL[e]);
|
|
4258
|
+
}
|
|
4259
|
+
async saveToCache(e, t) {
|
|
4260
|
+
const i = this.getCacheKey(e);
|
|
4261
|
+
return this.CACHE_DB.set(i, t);
|
|
4262
|
+
}
|
|
4263
|
+
async invalidateCache(e) {
|
|
4264
|
+
const t = this.getCacheKey(e);
|
|
4265
|
+
return this.CACHE_DB.delete(t);
|
|
4266
|
+
}
|
|
4267
|
+
// ====== shortcuts ======
|
|
4236
4268
|
get _raw() {
|
|
4237
4269
|
return this._data;
|
|
4238
4270
|
}
|
|
4271
|
+
// siteInfo
|
|
4272
|
+
get siteInfo() {
|
|
4273
|
+
return this._data.siteinfo;
|
|
4274
|
+
}
|
|
4239
4275
|
get general() {
|
|
4240
|
-
return this.
|
|
4276
|
+
return this.siteInfo.general;
|
|
4241
4277
|
}
|
|
4242
4278
|
get specialPageAliases() {
|
|
4243
|
-
return this.
|
|
4279
|
+
return this.siteInfo.specialpagealiases;
|
|
4244
4280
|
}
|
|
4245
4281
|
get namespaceAliases() {
|
|
4246
|
-
return this.
|
|
4282
|
+
return this.siteInfo.namespacealiases;
|
|
4247
4283
|
}
|
|
4248
4284
|
get namespaces() {
|
|
4249
|
-
return this.
|
|
4285
|
+
return this.siteInfo.namespaces;
|
|
4250
4286
|
}
|
|
4251
4287
|
get namespaceMap() {
|
|
4252
4288
|
const e = Object.values(this.namespaces).map((t) => ({
|
|
@@ -4259,8 +4295,9 @@ class Me extends (gr = he) {
|
|
|
4259
4295
|
}), e;
|
|
4260
4296
|
}
|
|
4261
4297
|
get magicWords() {
|
|
4262
|
-
return this.
|
|
4298
|
+
return this.siteInfo.magicwords;
|
|
4263
4299
|
}
|
|
4300
|
+
// userInfo
|
|
4264
4301
|
get userInfo() {
|
|
4265
4302
|
return this._data.userinfo;
|
|
4266
4303
|
}
|
|
@@ -4339,7 +4376,7 @@ class Me extends (gr = he) {
|
|
|
4339
4376
|
}
|
|
4340
4377
|
/** Get mainpage URL */
|
|
4341
4378
|
getMainpageUrl(e) {
|
|
4342
|
-
return hr(this.
|
|
4379
|
+
return hr(this.siteInfo.general.base, e).toString();
|
|
4343
4380
|
}
|
|
4344
4381
|
getUrl(e, t) {
|
|
4345
4382
|
const i = ur(t);
|
|
@@ -4372,9 +4409,9 @@ class Me extends (gr = he) {
|
|
|
4372
4409
|
} : null;
|
|
4373
4410
|
}
|
|
4374
4411
|
}
|
|
4375
|
-
|
|
4376
|
-
|
|
4377
|
-
|
|
4412
|
+
wt = cn(gr);
|
|
4413
|
+
Be = dn(wt, 0, "WikiMetadataService", mr, Be);
|
|
4414
|
+
fn(wt, 1, Be);
|
|
4378
4415
|
var I;
|
|
4379
4416
|
((r) => {
|
|
4380
4417
|
function e(l) {
|
|
@@ -4454,27 +4491,27 @@ var I;
|
|
|
4454
4491
|
return v;
|
|
4455
4492
|
const M = v.version + 1;
|
|
4456
4493
|
v.close();
|
|
4457
|
-
const re = new Promise((ie,
|
|
4494
|
+
const re = new Promise((ie, K) => {
|
|
4458
4495
|
const j = indexedDB.open(l, M);
|
|
4459
4496
|
j.onupgradeneeded = () => {
|
|
4460
|
-
const
|
|
4497
|
+
const P = j.result;
|
|
4461
4498
|
let G;
|
|
4462
|
-
if (
|
|
4499
|
+
if (P.objectStoreNames.contains(d) ? G = j.transaction.objectStore(d) : G = P.createObjectStore(d, {
|
|
4463
4500
|
keyPath: m.keyPath ?? void 0,
|
|
4464
4501
|
autoIncrement: !!m.autoIncrement
|
|
4465
4502
|
}), m.indexes && m.indexes.length > 0)
|
|
4466
|
-
for (const { name:
|
|
4467
|
-
G.indexNames.contains(
|
|
4503
|
+
for (const { name: $e, keyPath: W, options: Ae } of m.indexes)
|
|
4504
|
+
G.indexNames.contains($e) || G.createIndex($e, W, Ae);
|
|
4468
4505
|
}, j.onsuccess = () => {
|
|
4469
|
-
const
|
|
4470
|
-
|
|
4506
|
+
const P = j.result;
|
|
4507
|
+
P.onversionchange = () => {
|
|
4471
4508
|
try {
|
|
4472
|
-
|
|
4509
|
+
P.close();
|
|
4473
4510
|
} finally {
|
|
4474
4511
|
t.delete(l);
|
|
4475
4512
|
}
|
|
4476
|
-
}, ie(
|
|
4477
|
-
}, j.onerror = () =>
|
|
4513
|
+
}, ie(P);
|
|
4514
|
+
}, j.onerror = () => K(j.error), j.onblocked = () => {
|
|
4478
4515
|
};
|
|
4479
4516
|
});
|
|
4480
4517
|
return t.set(l, re), re;
|
|
@@ -4492,44 +4529,44 @@ var I;
|
|
|
4492
4529
|
async function g(l, d, m, v = {}) {
|
|
4493
4530
|
const { dbName: S, storeName: E } = l, M = v.attempts ?? 2, re = v.baseDelayMs ?? 16;
|
|
4494
4531
|
let ie;
|
|
4495
|
-
for (let
|
|
4532
|
+
for (let K = 0; K <= M; K++)
|
|
4496
4533
|
try {
|
|
4497
|
-
|
|
4534
|
+
K === 0 && await y(S, E);
|
|
4498
4535
|
const j = await a(S);
|
|
4499
|
-
let
|
|
4536
|
+
let P;
|
|
4500
4537
|
try {
|
|
4501
|
-
|
|
4502
|
-
} catch (
|
|
4503
|
-
if (o(
|
|
4504
|
-
await c(S), await s(re * (1 <<
|
|
4538
|
+
P = j.transaction(E, d);
|
|
4539
|
+
} catch (W) {
|
|
4540
|
+
if (o(W) && K < M) {
|
|
4541
|
+
await c(S), await s(re * (1 << K)), ie = W;
|
|
4505
4542
|
continue;
|
|
4506
4543
|
}
|
|
4507
|
-
throw
|
|
4544
|
+
throw W;
|
|
4508
4545
|
}
|
|
4509
|
-
const G =
|
|
4510
|
-
|
|
4546
|
+
const G = P.objectStore(E), $e = new Promise((W, Ae) => {
|
|
4547
|
+
P.oncomplete = () => W(), P.onerror = () => Ae(P.error), P.onabort = () => Ae(P.error);
|
|
4511
4548
|
});
|
|
4512
4549
|
try {
|
|
4513
|
-
const
|
|
4514
|
-
return await
|
|
4515
|
-
} catch (
|
|
4516
|
-
if (o(
|
|
4550
|
+
const W = await m(G);
|
|
4551
|
+
return await $e, W;
|
|
4552
|
+
} catch (W) {
|
|
4553
|
+
if (o(W) && K < M) {
|
|
4517
4554
|
try {
|
|
4518
|
-
|
|
4555
|
+
P.abort();
|
|
4519
4556
|
} catch {
|
|
4520
4557
|
}
|
|
4521
|
-
await c(S), await s(re * (1 <<
|
|
4558
|
+
await c(S), await s(re * (1 << K)), ie = W;
|
|
4522
4559
|
continue;
|
|
4523
4560
|
}
|
|
4524
4561
|
try {
|
|
4525
|
-
|
|
4562
|
+
P.abort();
|
|
4526
4563
|
} catch {
|
|
4527
4564
|
}
|
|
4528
|
-
throw
|
|
4565
|
+
throw W;
|
|
4529
4566
|
}
|
|
4530
4567
|
} catch (j) {
|
|
4531
|
-
if (o(j) &&
|
|
4532
|
-
await c(S), await s(re * (1 <<
|
|
4568
|
+
if (o(j) && K < M) {
|
|
4569
|
+
await c(S), await s(re * (1 << K)), ie = j;
|
|
4533
4570
|
continue;
|
|
4534
4571
|
}
|
|
4535
4572
|
throw j;
|
|
@@ -4544,27 +4581,27 @@ var I;
|
|
|
4544
4581
|
});
|
|
4545
4582
|
}
|
|
4546
4583
|
r.get = b;
|
|
4547
|
-
async function
|
|
4584
|
+
async function R(l, d, m) {
|
|
4548
4585
|
return g(l, "readwrite", async (v) => {
|
|
4549
4586
|
const S = v.put(m, d);
|
|
4550
4587
|
await e(S);
|
|
4551
4588
|
});
|
|
4552
4589
|
}
|
|
4553
|
-
r.set =
|
|
4554
|
-
async function
|
|
4590
|
+
r.set = R;
|
|
4591
|
+
async function L(l, d) {
|
|
4555
4592
|
return g(l, "readwrite", async (m) => {
|
|
4556
4593
|
const v = m.delete(d);
|
|
4557
4594
|
await e(v);
|
|
4558
4595
|
});
|
|
4559
4596
|
}
|
|
4560
|
-
r.del =
|
|
4561
|
-
async function
|
|
4597
|
+
r.del = L;
|
|
4598
|
+
async function $(l) {
|
|
4562
4599
|
return g(l, "readwrite", async (d) => {
|
|
4563
4600
|
const m = d.clear();
|
|
4564
4601
|
await e(m);
|
|
4565
4602
|
});
|
|
4566
4603
|
}
|
|
4567
|
-
r.clear =
|
|
4604
|
+
r.clear = $;
|
|
4568
4605
|
function f(l, d = 100) {
|
|
4569
4606
|
return {
|
|
4570
4607
|
[Symbol.asyncIterator]() {
|
|
@@ -4576,17 +4613,17 @@ var I;
|
|
|
4576
4613
|
/* open */
|
|
4577
4614
|
!0
|
|
4578
4615
|
);
|
|
4579
|
-
await new Promise((ie,
|
|
4616
|
+
await new Promise((ie, K) => {
|
|
4580
4617
|
let j = 0;
|
|
4581
|
-
const
|
|
4582
|
-
|
|
4583
|
-
const G =
|
|
4618
|
+
const P = M.openCursor(re, "next");
|
|
4619
|
+
P.onsuccess = () => {
|
|
4620
|
+
const G = P.result;
|
|
4584
4621
|
if (!G || j >= d) {
|
|
4585
4622
|
ie();
|
|
4586
4623
|
return;
|
|
4587
4624
|
}
|
|
4588
4625
|
m.push([G.key, G.value]), S = G.key, j++, G.continue();
|
|
4589
|
-
},
|
|
4626
|
+
}, P.onerror = () => K(P.error);
|
|
4590
4627
|
}), m.length === 0 && (v = !0);
|
|
4591
4628
|
}));
|
|
4592
4629
|
};
|
|
@@ -4623,7 +4660,7 @@ var I;
|
|
|
4623
4660
|
* @author dragon-fish <dragon-fish@qq.com>
|
|
4624
4661
|
* @license MIT
|
|
4625
4662
|
*/
|
|
4626
|
-
class
|
|
4663
|
+
class pn {
|
|
4627
4664
|
constructor(e, t, i = {}) {
|
|
4628
4665
|
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
4666
|
}
|
|
@@ -4740,7 +4777,7 @@ class fn {
|
|
|
4740
4777
|
t,
|
|
4741
4778
|
"readwrite",
|
|
4742
4779
|
async (i) => {
|
|
4743
|
-
for await (const [n, s] of
|
|
4780
|
+
for await (const [n, s] of Lt(e)) {
|
|
4744
4781
|
const o = this.inlineKey ? i.put(s) : i.put(s, n);
|
|
4745
4782
|
await I.promisifyRequest(o);
|
|
4746
4783
|
}
|
|
@@ -4754,7 +4791,7 @@ class fn {
|
|
|
4754
4791
|
t,
|
|
4755
4792
|
"readwrite",
|
|
4756
4793
|
async (i) => {
|
|
4757
|
-
for await (const n of
|
|
4794
|
+
for await (const n of Lt(e)) {
|
|
4758
4795
|
const s = i.delete(n);
|
|
4759
4796
|
await I.promisifyRequest(s);
|
|
4760
4797
|
}
|
|
@@ -4770,16 +4807,16 @@ class fn {
|
|
|
4770
4807
|
await I.closeDatabase(this.dbName);
|
|
4771
4808
|
}
|
|
4772
4809
|
}
|
|
4773
|
-
function
|
|
4810
|
+
function Lt(r) {
|
|
4774
4811
|
return r[Symbol.asyncIterator] ? r : {
|
|
4775
4812
|
async *[Symbol.asyncIterator]() {
|
|
4776
4813
|
for (const e of r) yield e;
|
|
4777
4814
|
}
|
|
4778
4815
|
};
|
|
4779
4816
|
}
|
|
4780
|
-
class
|
|
4817
|
+
class mn {
|
|
4781
4818
|
constructor(e, t, i = 1 / 0, n) {
|
|
4782
|
-
this.dbName = e, this.storeName = t, this.ttl = i, this.version = n, this.db = new
|
|
4819
|
+
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
4820
|
}
|
|
4784
4821
|
async get(e, t = this.ttl, i) {
|
|
4785
4822
|
const n = await this.loadFromDB(e), s = this.checkIfExpired(n, t);
|
|
@@ -4840,16 +4877,16 @@ class dn {
|
|
|
4840
4877
|
return await this.db.clear(), this;
|
|
4841
4878
|
}
|
|
4842
4879
|
}
|
|
4843
|
-
class
|
|
4880
|
+
class gn extends he {
|
|
4844
4881
|
constructor(e) {
|
|
4845
4882
|
super(e, "storage", !1);
|
|
4846
4883
|
}
|
|
4847
4884
|
createDatabse(e, t, i) {
|
|
4848
|
-
return new
|
|
4885
|
+
return new mn("InPageEdit", e, t, i);
|
|
4849
4886
|
}
|
|
4850
4887
|
}
|
|
4851
4888
|
var yr = /* @__PURE__ */ ((r) => (r.preferences = "preferences", r.watch = "watch", r.unwatch = "unwatch", r.nochange = "nochange", r))(yr || {});
|
|
4852
|
-
function
|
|
4889
|
+
function yn(r) {
|
|
4853
4890
|
class e {
|
|
4854
4891
|
constructor(i, n = !0) {
|
|
4855
4892
|
this._loaded = n, this.api = r, i.revisions?.forEach((s) => {
|
|
@@ -5040,9 +5077,9 @@ function mn(r) {
|
|
|
5040
5077
|
}
|
|
5041
5078
|
return e;
|
|
5042
5079
|
}
|
|
5043
|
-
class
|
|
5080
|
+
class wn extends he {
|
|
5044
5081
|
constructor(e) {
|
|
5045
|
-
super(e, "wikiPage", !0), this.ctx = e, this.WikiPage =
|
|
5082
|
+
super(e, "wikiPage", !0), this.ctx = e, this.WikiPage = yn(this.ctx.api);
|
|
5046
5083
|
}
|
|
5047
5084
|
static {
|
|
5048
5085
|
this.inject = ["api"];
|
|
@@ -5063,7 +5100,7 @@ class gn extends he {
|
|
|
5063
5100
|
return this.WikiPage.newBlankPage(e);
|
|
5064
5101
|
}
|
|
5065
5102
|
}
|
|
5066
|
-
const
|
|
5103
|
+
const jt = /* @__PURE__ */ new WeakMap(), Q = {
|
|
5067
5104
|
toDBKey: (r) => r.replace(/ /g, "_"),
|
|
5068
5105
|
toNormalText: (r) => r.replace(/_/g, " "),
|
|
5069
5106
|
ensureCase: (r, e) => e === "first-letter" ? r.charAt(0).toUpperCase() + r.slice(1) : r
|
|
@@ -5139,8 +5176,8 @@ const Nt = /* @__PURE__ */ new WeakMap(), J = {
|
|
|
5139
5176
|
subpages: !1
|
|
5140
5177
|
})
|
|
5141
5178
|
};
|
|
5142
|
-
function
|
|
5143
|
-
const e =
|
|
5179
|
+
function bn(r) {
|
|
5180
|
+
const e = jt.get(r);
|
|
5144
5181
|
if (e)
|
|
5145
5182
|
return e;
|
|
5146
5183
|
const t = X.buildIndex(r), i = me.buildSpecialPageIndex(r);
|
|
@@ -5205,10 +5242,10 @@ function yn(r) {
|
|
|
5205
5242
|
);
|
|
5206
5243
|
if (a) {
|
|
5207
5244
|
const c = this.#e.includes("/") ? this.#e.substring(this.#e.indexOf("/")) : "", u = a + c;
|
|
5208
|
-
return
|
|
5245
|
+
return Q.ensureCase(Q.toDBKey(u), o.case);
|
|
5209
5246
|
}
|
|
5210
5247
|
}
|
|
5211
|
-
return
|
|
5248
|
+
return Q.ensureCase(Q.toDBKey(this.#e), o.case);
|
|
5212
5249
|
}
|
|
5213
5250
|
getMainText() {
|
|
5214
5251
|
const o = this.getNamespaceInfo();
|
|
@@ -5219,10 +5256,10 @@ function yn(r) {
|
|
|
5219
5256
|
);
|
|
5220
5257
|
if (a) {
|
|
5221
5258
|
const c = this.#e.includes("/") ? this.#e.substring(this.#e.indexOf("/")) : "", u = a + c;
|
|
5222
|
-
return
|
|
5259
|
+
return Q.ensureCase(Q.toNormalText(u), o.case);
|
|
5223
5260
|
}
|
|
5224
5261
|
}
|
|
5225
|
-
return
|
|
5262
|
+
return Q.ensureCase(Q.toNormalText(this.#e), o.case);
|
|
5226
5263
|
}
|
|
5227
5264
|
getMainRootText() {
|
|
5228
5265
|
return this.getMainText().split("/")[0];
|
|
@@ -5241,7 +5278,7 @@ function yn(r) {
|
|
|
5241
5278
|
}
|
|
5242
5279
|
getNamespaceDBKey() {
|
|
5243
5280
|
const o = this.getNamespaceInfo();
|
|
5244
|
-
return
|
|
5281
|
+
return Q.ensureCase(Q.toDBKey(this.getNamespaceText()), o.case);
|
|
5245
5282
|
}
|
|
5246
5283
|
getSubjectPage() {
|
|
5247
5284
|
if (X.isTalkPage(this.#t)) {
|
|
@@ -5300,11 +5337,11 @@ function yn(r) {
|
|
|
5300
5337
|
};
|
|
5301
5338
|
}
|
|
5302
5339
|
}
|
|
5303
|
-
return
|
|
5340
|
+
return jt.set(r, n), n;
|
|
5304
5341
|
}
|
|
5305
|
-
class
|
|
5342
|
+
class bt extends he {
|
|
5306
5343
|
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 =
|
|
5344
|
+
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
5345
|
}
|
|
5309
5346
|
static {
|
|
5310
5347
|
this.inject = ["wiki"];
|
|
@@ -5328,7 +5365,7 @@ class vt extends he {
|
|
|
5328
5365
|
throw new Error("Invalid id or kind", { cause: e });
|
|
5329
5366
|
if (!t && this._cachedTitles.has(`${a}:${o}`))
|
|
5330
5367
|
return await this._cachedTitles.get(`${a}:${o}`);
|
|
5331
|
-
const { promise: c, resolve: u, reject: p } =
|
|
5368
|
+
const { promise: c, resolve: u, reject: p } = ot();
|
|
5332
5369
|
this._cachedTitles.set(`${a}:${o}`, c);
|
|
5333
5370
|
try {
|
|
5334
5371
|
const { wikiPage: y } = await this.ctx.useScope(["wikiPage"]);
|
|
@@ -5397,7 +5434,7 @@ class vt extends he {
|
|
|
5397
5434
|
this.REG_SKIPPED_HREF = /^(#|javascript:|vbscript:|file:)/i;
|
|
5398
5435
|
}
|
|
5399
5436
|
validateHrefAttr(e) {
|
|
5400
|
-
return typeof e != "string" ? !1 : !
|
|
5437
|
+
return typeof e != "string" ? !1 : !bt.REG_SKIPPED_HREF.test(e);
|
|
5401
5438
|
}
|
|
5402
5439
|
parseWikiLink(e) {
|
|
5403
5440
|
if (!e || typeof e == "string" && !this.validateHrefAttr(e))
|
|
@@ -5436,26 +5473,26 @@ class vt extends he {
|
|
|
5436
5473
|
};
|
|
5437
5474
|
}
|
|
5438
5475
|
}
|
|
5439
|
-
const
|
|
5440
|
-
async function
|
|
5441
|
-
return
|
|
5476
|
+
const vn = (r) => typeof r == "function";
|
|
5477
|
+
async function _n(r) {
|
|
5478
|
+
return vn(r) ? await r() : r;
|
|
5442
5479
|
}
|
|
5443
|
-
var
|
|
5480
|
+
var Sn = Object.create, vt = Object.defineProperty, xn = Object.getOwnPropertyDescriptor, wr = (r, e) => (e = Symbol[r]) ? e : Symbol.for("Symbol." + r), br = (r) => {
|
|
5444
5481
|
throw TypeError(r);
|
|
5445
|
-
},
|
|
5482
|
+
}, 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
5483
|
for (var n = 0, s = r[e >> 1], o = s && s.length; n < o; n++) s[n].call(t);
|
|
5447
5484
|
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
|
-
|
|
5485
|
+
}, In = (r, e, t, i, n, s) => {
|
|
5486
|
+
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));
|
|
5487
|
+
En(n, t);
|
|
5451
5488
|
for (var b = i.length - 1; b >= 0; b--)
|
|
5452
|
-
c =
|
|
5453
|
-
return
|
|
5454
|
-
}, _r,
|
|
5489
|
+
c = $n(u, t, a = {}, r[3], w), o = (0, i[b])(n, c), a._ = 1, vr(o) && (n = o);
|
|
5490
|
+
return An(r, n), g && vt(n, t, g), p ? u ^ 4 ? s : g : n;
|
|
5491
|
+
}, _r, _t, Sr;
|
|
5455
5492
|
_r = [le(["storage"])];
|
|
5456
|
-
class
|
|
5493
|
+
class He extends (Sr = he) {
|
|
5457
5494
|
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);
|
|
5495
|
+
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
5496
|
}
|
|
5460
5497
|
get logger() {
|
|
5461
5498
|
return this.ctx.logger("PREFERENCES");
|
|
@@ -5477,7 +5514,7 @@ class Be extends (Sr = he) {
|
|
|
5477
5514
|
return this.logger.debug(e, `(fallback value: ${n})`), n;
|
|
5478
5515
|
};
|
|
5479
5516
|
const i = await this.db.get(e, void 0);
|
|
5480
|
-
return i !== null ? i : await
|
|
5517
|
+
return i !== null ? i : await _n(t);
|
|
5481
5518
|
}
|
|
5482
5519
|
getDefaultValue(e) {
|
|
5483
5520
|
return this._defaultPreferences[e] ??= this.loadDefaultConfigs()[e];
|
|
@@ -5486,6 +5523,17 @@ class Be extends (Sr = he) {
|
|
|
5486
5523
|
const i = this.getDefaultValue(e);
|
|
5487
5524
|
return t === i ? this.db.delete(e) : this.db.set(e, t);
|
|
5488
5525
|
}
|
|
5526
|
+
async setMany(e) {
|
|
5527
|
+
const t = this.loadDefaultConfigs(), i = Object.fromEntries(
|
|
5528
|
+
Object.entries(e).filter(([n, s]) => {
|
|
5529
|
+
const o = t[n];
|
|
5530
|
+
return s !== void 0 && s !== o;
|
|
5531
|
+
})
|
|
5532
|
+
);
|
|
5533
|
+
return await Promise.all(
|
|
5534
|
+
Object.entries(i).map(([n, s]) => this.set(n, s))
|
|
5535
|
+
), i;
|
|
5536
|
+
}
|
|
5489
5537
|
/**
|
|
5490
5538
|
* 获取全部注册的配置项,以及正在生效的值
|
|
5491
5539
|
*/
|
|
@@ -5496,13 +5544,17 @@ class Be extends (Sr = he) {
|
|
|
5496
5544
|
return e;
|
|
5497
5545
|
}
|
|
5498
5546
|
/**
|
|
5499
|
-
*
|
|
5547
|
+
* Get exportable configurations
|
|
5548
|
+
* - exclude values that are the same as the default value
|
|
5549
|
+
* - exclude invalid or undefined values
|
|
5550
|
+
* - sort by keys
|
|
5500
5551
|
*/
|
|
5501
|
-
async
|
|
5502
|
-
|
|
5503
|
-
|
|
5552
|
+
async getExportableRecord(e) {
|
|
5553
|
+
e ??= await this.getAll();
|
|
5554
|
+
const t = this.loadDefaultConfigs(), i = {};
|
|
5555
|
+
return Object.entries(t).sort(([n], [s]) => n.localeCompare(s)).forEach(([n, s]) => {
|
|
5504
5556
|
const o = e[n];
|
|
5505
|
-
o !== s && (i[n] = o);
|
|
5557
|
+
o !== void 0 && o !== s && (i[n] = o);
|
|
5506
5558
|
}), i;
|
|
5507
5559
|
}
|
|
5508
5560
|
loadDefaultConfigs() {
|
|
@@ -5546,10 +5598,10 @@ class Be extends (Sr = he) {
|
|
|
5546
5598
|
return this.categoryDefinitions;
|
|
5547
5599
|
}
|
|
5548
5600
|
}
|
|
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 || {});
|
|
5601
|
+
_t = On(Sr);
|
|
5602
|
+
He = In(_t, 0, "PreferencesService", _r, He);
|
|
5603
|
+
Pn(_t, 1, He);
|
|
5604
|
+
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
5605
|
/**
|
|
5554
5606
|
* ✏️ InPageEdit NEXT
|
|
5555
5607
|
*
|
|
@@ -5560,11 +5612,11 @@ var Fe = /* @__PURE__ */ ((r) => (r.ANALYTICS_API_BASE = "https://analytics.ipe.
|
|
|
5560
5612
|
* @see https://github.com/inpageedit/inpageedit-next
|
|
5561
5613
|
* @see https://www.ipe.wiki/
|
|
5562
5614
|
*/
|
|
5563
|
-
class ge extends
|
|
5615
|
+
class ge extends q {
|
|
5564
5616
|
constructor(e) {
|
|
5565
5617
|
super({
|
|
5566
5618
|
name: "InPageEdit"
|
|
5567
|
-
}), this.version = "0.
|
|
5619
|
+
}), this.version = "0.11.0", this.Endpoints = Fe, this.schema = Ze, this.config = _e(ge.DEFAULT_CONFIG, e), this.logger = si({
|
|
5568
5620
|
name: "IPE",
|
|
5569
5621
|
color: "#33aaff",
|
|
5570
5622
|
level: this.config.logLevel
|
|
@@ -5574,12 +5626,12 @@ class ge extends z {
|
|
|
5574
5626
|
this.DEFAULT_CONFIG = {
|
|
5575
5627
|
apiConfigs: {},
|
|
5576
5628
|
legacyPreferences: {},
|
|
5577
|
-
logLevel:
|
|
5629
|
+
logLevel: Wt.info,
|
|
5578
5630
|
autoloadStyles: !0
|
|
5579
5631
|
};
|
|
5580
5632
|
}
|
|
5581
5633
|
async #e() {
|
|
5582
|
-
this.plugin(
|
|
5634
|
+
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
5635
|
"api",
|
|
5584
5636
|
"currentPage",
|
|
5585
5637
|
"resourceLoader",
|
|
@@ -5606,23 +5658,24 @@ class ge extends z {
|
|
|
5606
5658
|
// TODO: 这里不应该硬编码,暂时先这样
|
|
5607
5659
|
async #r() {
|
|
5608
5660
|
[
|
|
5609
|
-
import("./index-
|
|
5661
|
+
import("./index-CFb1PSJg.js").then(({ PluginAnalytics: t }) => t),
|
|
5662
|
+
import("./index-DkQLtTG0.js").then(
|
|
5610
5663
|
({ PluginInArticleLinks: t }) => t
|
|
5611
5664
|
),
|
|
5612
|
-
import("./index-
|
|
5665
|
+
import("./index-DGOY4X1J.js").then(
|
|
5613
5666
|
({ PluginPreferencesUI: t }) => t
|
|
5614
5667
|
),
|
|
5615
|
-
import("./index-
|
|
5616
|
-
import("./index-
|
|
5617
|
-
import("./index-
|
|
5618
|
-
import("./index-
|
|
5668
|
+
import("./index-D7NpqwUe.js").then(({ PluginQuickEdit: t }) => t),
|
|
5669
|
+
import("./index-BVkdBJNf.js").then(({ PluginQuickDelete: t }) => t),
|
|
5670
|
+
import("./index-DKDtc9IF.js").then(({ PluginQuickMove: t }) => t),
|
|
5671
|
+
import("./index-BP-e8PeH.js").then(
|
|
5619
5672
|
({ PluginQuickPreview: t }) => t
|
|
5620
5673
|
),
|
|
5621
|
-
import("./index-
|
|
5622
|
-
import("./index-
|
|
5674
|
+
import("./index-BjwVNZ_h.js").then(({ PluginQuickDiff: t }) => t),
|
|
5675
|
+
import("./index-BzCqww16.js").then(
|
|
5623
5676
|
({ PluginQuickRedirect: t }) => t
|
|
5624
5677
|
),
|
|
5625
|
-
import("./index-
|
|
5678
|
+
import("./index-B5vDBMEh.js").then(({ PluginToolbox: t }) => t)
|
|
5626
5679
|
].forEach(async (t) => {
|
|
5627
5680
|
this.plugin(await t);
|
|
5628
5681
|
});
|
|
@@ -5634,19 +5687,22 @@ class ge extends z {
|
|
|
5634
5687
|
});
|
|
5635
5688
|
}
|
|
5636
5689
|
async useScope(e) {
|
|
5637
|
-
const { promise: t, resolve: i } =
|
|
5690
|
+
const { promise: t, resolve: i } = ot();
|
|
5638
5691
|
return this.inject(e, (n) => {
|
|
5639
5692
|
i(n);
|
|
5640
5693
|
}), t;
|
|
5641
5694
|
}
|
|
5642
5695
|
}
|
|
5643
|
-
function
|
|
5696
|
+
function xr(r) {
|
|
5644
5697
|
return r.charAt(0).toLowerCase() + r.slice(1);
|
|
5645
5698
|
}
|
|
5646
|
-
function
|
|
5647
|
-
return
|
|
5699
|
+
function Bn(r) {
|
|
5700
|
+
return xr(r).replace(/_/g, "-").replace(/.[A-Z]+/g, (e) => e[0] + "-" + e.slice(1).toLowerCase());
|
|
5701
|
+
}
|
|
5702
|
+
function Tn(r) {
|
|
5703
|
+
return xr(r).replace(/-/g, "_").replace(/.[A-Z]+/g, (e) => e[0] + "_" + e.slice(1).toLowerCase());
|
|
5648
5704
|
}
|
|
5649
|
-
class
|
|
5705
|
+
class Hn {
|
|
5650
5706
|
constructor(e, t = void 0, i) {
|
|
5651
5707
|
this.ctx = e, this.disposeHandlers = [], this.name = i || "", this.config = t || {};
|
|
5652
5708
|
const { promise: n, resolve: s, reject: o } = Promise.withResolvers();
|
|
@@ -5687,7 +5743,7 @@ class Un {
|
|
|
5687
5743
|
this.disposeHandlers = this.disposeHandlers.filter((t) => t !== e);
|
|
5688
5744
|
}
|
|
5689
5745
|
set name(e) {
|
|
5690
|
-
this.#e =
|
|
5746
|
+
this.#e = Tn(e).toUpperCase();
|
|
5691
5747
|
}
|
|
5692
5748
|
get name() {
|
|
5693
5749
|
return this.#e;
|
|
@@ -5700,12 +5756,12 @@ window.RLQ ||= [];
|
|
|
5700
5756
|
window.__IPE_MODULES__ ||= [];
|
|
5701
5757
|
Ln("InPageEdit#autoload", () => {
|
|
5702
5758
|
const r = kr();
|
|
5703
|
-
r &&
|
|
5759
|
+
r && Cn({
|
|
5704
5760
|
baseURL: r,
|
|
5705
5761
|
CoreClass: ge
|
|
5706
5762
|
});
|
|
5707
5763
|
});
|
|
5708
|
-
async function
|
|
5764
|
+
async function Cn(r = { baseURL: kr(), CoreClass: ge }) {
|
|
5709
5765
|
const { baseURL: e, CoreClass: t } = r;
|
|
5710
5766
|
typeof window?.ipe?.stop == "function" && await window.ipe.stop();
|
|
5711
5767
|
const i = window.InPageEdit || {}, n = new t({
|
|
@@ -5754,14 +5810,17 @@ function Ln(r, e) {
|
|
|
5754
5810
|
return window[t] ? !1 : (window[t] = !0, e(), !0);
|
|
5755
5811
|
}
|
|
5756
5812
|
export {
|
|
5757
|
-
|
|
5758
|
-
|
|
5813
|
+
Wt as $,
|
|
5814
|
+
Hn as B,
|
|
5815
|
+
Fe as E,
|
|
5759
5816
|
le as I,
|
|
5760
|
-
|
|
5817
|
+
Ze as S,
|
|
5761
5818
|
yr as W,
|
|
5762
|
-
|
|
5763
|
-
|
|
5764
|
-
|
|
5765
|
-
|
|
5819
|
+
ot as a,
|
|
5820
|
+
he as b,
|
|
5821
|
+
ge as c,
|
|
5822
|
+
si as d,
|
|
5823
|
+
ri as m,
|
|
5824
|
+
Bn as p
|
|
5766
5825
|
};
|
|
5767
|
-
//# sourceMappingURL=index-
|
|
5826
|
+
//# sourceMappingURL=index-DFPN4uYd.js.map
|