@inpageedit/core 0.16.0 → 0.17.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/dist/InPageEdit.js +2 -2
- package/dist/{PluginImagesUsed-BVyvFA1_.js → PluginImagesUsed-CD7t5kqv.js} +2 -2
- package/dist/{PluginImagesUsed-BVyvFA1_.js.map → PluginImagesUsed-CD7t5kqv.js.map} +1 -1
- package/dist/{PluginPrefSync-CUKkx4Qk.js → PluginPrefSync-DgKVDgiK.js} +2 -2
- package/dist/{PluginPrefSync-CUKkx4Qk.js.map → PluginPrefSync-DgKVDgiK.js.map} +1 -1
- package/dist/{PluginStoreApp-CoOAw1fr.js → PluginStoreApp-BwiAYQMA.js} +2 -2
- package/dist/{PluginStoreApp-CoOAw1fr.js.map → PluginStoreApp-BwiAYQMA.js.map} +1 -1
- package/dist/{PluginTemplatesUsed-CdjT1wR4.js → PluginTemplatesUsed-CmYn48Wd.js} +2 -2
- package/dist/{PluginTemplatesUsed-CdjT1wR4.js.map → PluginTemplatesUsed-CmYn48Wd.js.map} +1 -1
- package/dist/core.js +2 -2
- package/dist/{index-BYlcHc-O.js → index-5DLUhCA3.js} +3 -3
- package/dist/{index-BYlcHc-O.js.map → index-5DLUhCA3.js.map} +1 -1
- package/dist/{index-CVCy0wPP.js → index-B5UcAL5E.js} +2 -2
- package/dist/{index-CVCy0wPP.js.map → index-B5UcAL5E.js.map} +1 -1
- package/dist/{index-CAtPo7xJ.js → index-BMd6Bo6r.js} +101 -113
- package/dist/{index-CAtPo7xJ.js.map → index-BMd6Bo6r.js.map} +1 -1
- package/dist/{index-1tsXE6ax.js → index-BTLjDVvD.js} +2 -2
- package/dist/{index-1tsXE6ax.js.map → index-BTLjDVvD.js.map} +1 -1
- package/dist/{index-QnWieXQc.js → index-BfW7ObKf.js} +719 -638
- package/dist/index-BfW7ObKf.js.map +1 -0
- package/dist/{index-NWWeW3tX.js → index-BvHXETfl.js} +2 -2
- package/dist/{index-NWWeW3tX.js.map → index-BvHXETfl.js.map} +1 -1
- package/dist/index-C0spLL-i.js +1661 -0
- package/dist/index-C0spLL-i.js.map +1 -0
- package/dist/{index-bQ0CVu3l.js → index-C2_G8gLW.js} +3 -3
- package/dist/{index-bQ0CVu3l.js.map → index-C2_G8gLW.js.map} +1 -1
- package/dist/{index-Dm2vgYkZ.js → index-C4ncbyR6.js} +2 -2
- package/dist/{index-Dm2vgYkZ.js.map → index-C4ncbyR6.js.map} +1 -1
- package/dist/{index-BPTMltVf.js → index-CZ56EKIK.js} +2 -2
- package/dist/{index-BPTMltVf.js.map → index-CZ56EKIK.js.map} +1 -1
- package/dist/{index-ygc4AMy4.js → index-Cjyf3z1w.js} +3 -3
- package/dist/{index-ygc4AMy4.js.map → index-Cjyf3z1w.js.map} +1 -1
- package/dist/{index-C4qm_X_A.js → index-Dfp9Vp36.js} +2 -2
- package/dist/{index-C4qm_X_A.js.map → index-Dfp9Vp36.js.map} +1 -1
- package/dist/{index-B32tFyLB.js → index-s7aFr-gn.js} +3 -3
- package/dist/{index-B32tFyLB.js.map → index-s7aFr-gn.js.map} +1 -1
- package/dist/{index-DZa9mxN4.js → index-siZBRSp0.js} +2 -2
- package/dist/{index-DZa9mxN4.js.map → index-siZBRSp0.js.map} +1 -1
- package/dist/index.d.ts +37414 -1356
- package/dist/index.js +2 -2
- package/dist/models/index.js +1 -1
- package/dist/plugins/index.js +12 -12
- package/dist/services/index.js +14 -12
- package/dist/style.css +1 -1
- package/lib/index.umd.js +20 -20
- package/lib/index.umd.js.map +1 -1
- package/lib/style.css +1 -1
- package/package.json +14 -14
- package/dist/index-CYfkwXRf.js +0 -1631
- package/dist/index-CYfkwXRf.js.map +0 -1
- package/dist/index-QnWieXQc.js.map +0 -1
|
@@ -1,93 +1,93 @@
|
|
|
1
|
-
import { W as
|
|
2
|
-
import { j as
|
|
3
|
-
var
|
|
4
|
-
function
|
|
1
|
+
import { W as _i, d as xi, e as ki, r as Si, u as $i, c as Ei, a as Ai, f as Ci } from "./index-C0spLL-i.js";
|
|
2
|
+
import { j as N, P as Oi, p as _t } from "./Promise.withResolvers-C4chhLB1.js";
|
|
3
|
+
var Pi = Object.defineProperty, S = (i, e) => Pi(i, "name", { value: e, configurable: !0 });
|
|
4
|
+
function Ii() {
|
|
5
5
|
}
|
|
6
|
-
S(
|
|
6
|
+
S(Ii, "noop");
|
|
7
7
|
function I(i) {
|
|
8
8
|
return i == null;
|
|
9
9
|
}
|
|
10
10
|
S(I, "isNullable");
|
|
11
|
-
function
|
|
11
|
+
function Li(i) {
|
|
12
12
|
return !I(i);
|
|
13
13
|
}
|
|
14
|
-
S(
|
|
15
|
-
function
|
|
14
|
+
S(Li, "isNonNullable");
|
|
15
|
+
function he(i) {
|
|
16
16
|
return i && typeof i == "object" && !Array.isArray(i);
|
|
17
17
|
}
|
|
18
|
-
S(
|
|
19
|
-
function
|
|
18
|
+
S(he, "isPlainObject");
|
|
19
|
+
function xt(i, e) {
|
|
20
20
|
return Object.fromEntries(Object.entries(i).filter(([t, r]) => e(t, r)));
|
|
21
21
|
}
|
|
22
|
-
S(
|
|
23
|
-
function
|
|
22
|
+
S(xt, "filterKeys");
|
|
23
|
+
function K(i, e) {
|
|
24
24
|
return Object.fromEntries(Object.entries(i).map(([t, r]) => [t, e(r, t)]));
|
|
25
25
|
}
|
|
26
|
-
S(
|
|
27
|
-
function
|
|
26
|
+
S(K, "mapValues");
|
|
27
|
+
function kt(i, e, t) {
|
|
28
28
|
if (!e) return { ...i };
|
|
29
29
|
const r = {};
|
|
30
30
|
for (const n of e)
|
|
31
31
|
(t || i[n] !== void 0) && (r[n] = i[n]);
|
|
32
32
|
return r;
|
|
33
33
|
}
|
|
34
|
-
S(
|
|
35
|
-
function
|
|
34
|
+
S(kt, "pick");
|
|
35
|
+
function Ri(i, e) {
|
|
36
36
|
if (!e) return { ...i };
|
|
37
37
|
const t = { ...i };
|
|
38
38
|
for (const r of e)
|
|
39
39
|
Reflect.deleteProperty(t, r);
|
|
40
40
|
return t;
|
|
41
41
|
}
|
|
42
|
-
S(
|
|
42
|
+
S(Ri, "omit");
|
|
43
43
|
function j(i, e, t) {
|
|
44
44
|
return Object.defineProperty(i, e, { writable: !0, value: t, enumerable: !1 });
|
|
45
45
|
}
|
|
46
46
|
S(j, "defineProperty");
|
|
47
|
-
function
|
|
47
|
+
function ji(i, e) {
|
|
48
48
|
return e.every((t) => i.includes(t));
|
|
49
49
|
}
|
|
50
|
-
S(
|
|
51
|
-
function
|
|
50
|
+
S(ji, "contain");
|
|
51
|
+
function Di(i, e) {
|
|
52
52
|
return i.filter((t) => e.includes(t));
|
|
53
53
|
}
|
|
54
|
-
S(
|
|
55
|
-
function
|
|
54
|
+
S(Di, "intersection");
|
|
55
|
+
function Ti(i, e) {
|
|
56
56
|
return i.filter((t) => !e.includes(t));
|
|
57
57
|
}
|
|
58
|
-
S(
|
|
59
|
-
function
|
|
58
|
+
S(Ti, "difference");
|
|
59
|
+
function Ni(i, e) {
|
|
60
60
|
return Array.from(/* @__PURE__ */ new Set([...i, ...e]));
|
|
61
61
|
}
|
|
62
|
-
S(
|
|
63
|
-
function
|
|
62
|
+
S(Ni, "union");
|
|
63
|
+
function Mi(i) {
|
|
64
64
|
return [...new Set(i)];
|
|
65
65
|
}
|
|
66
|
-
S(
|
|
66
|
+
S(Mi, "deduplicate");
|
|
67
67
|
function W(i, e) {
|
|
68
68
|
const t = i?.indexOf(e);
|
|
69
69
|
return t >= 0 ? (i.splice(t, 1), !0) : !1;
|
|
70
70
|
}
|
|
71
71
|
S(W, "remove");
|
|
72
|
-
function
|
|
72
|
+
function Bi(i) {
|
|
73
73
|
return Array.isArray(i) ? i : I(i) ? [] : [i];
|
|
74
74
|
}
|
|
75
|
-
S(
|
|
75
|
+
S(Bi, "makeArray");
|
|
76
76
|
function G(i, e) {
|
|
77
77
|
return arguments.length === 1 ? (t) => G(i, t) : i in globalThis && e instanceof globalThis[i] || Object.prototype.toString.call(e).slice(8, -1) === i;
|
|
78
78
|
}
|
|
79
79
|
S(G, "is");
|
|
80
|
-
function
|
|
80
|
+
function se(i) {
|
|
81
81
|
return G("ArrayBuffer", i) || G("SharedArrayBuffer", i);
|
|
82
82
|
}
|
|
83
|
-
S(
|
|
84
|
-
function
|
|
85
|
-
return
|
|
83
|
+
S(se, "isArrayBufferLike");
|
|
84
|
+
function St(i) {
|
|
85
|
+
return se(i) || ArrayBuffer.isView(i);
|
|
86
86
|
}
|
|
87
|
-
S(
|
|
87
|
+
S(St, "isArrayBufferSource");
|
|
88
88
|
var B;
|
|
89
89
|
((i) => {
|
|
90
|
-
i.is =
|
|
90
|
+
i.is = se, i.isSource = St;
|
|
91
91
|
function e(o) {
|
|
92
92
|
return ArrayBuffer.isView(o) ? o.buffer.slice(o.byteOffset, o.byteOffset + o.byteLength) : o;
|
|
93
93
|
}
|
|
@@ -123,57 +123,57 @@ B.fromBase64;
|
|
|
123
123
|
B.toBase64;
|
|
124
124
|
B.fromHex;
|
|
125
125
|
B.toHex;
|
|
126
|
-
function
|
|
126
|
+
function ue(i, e = /* @__PURE__ */ new Map()) {
|
|
127
127
|
if (!i || typeof i != "object") return i;
|
|
128
128
|
if (G("Date", i)) return new Date(i.valueOf());
|
|
129
129
|
if (G("RegExp", i)) return new RegExp(i.source, i.flags);
|
|
130
|
-
if (
|
|
130
|
+
if (se(i)) return i.slice(0);
|
|
131
131
|
if (ArrayBuffer.isView(i)) return i.buffer.slice(i.byteOffset, i.byteOffset + i.byteLength);
|
|
132
132
|
const t = e.get(i);
|
|
133
133
|
if (t) return t;
|
|
134
134
|
if (Array.isArray(i)) {
|
|
135
135
|
const n = [];
|
|
136
136
|
return e.set(i, n), i.forEach((s, o) => {
|
|
137
|
-
n[o] = Reflect.apply(
|
|
137
|
+
n[o] = Reflect.apply(ue, null, [s, e]);
|
|
138
138
|
}), n;
|
|
139
139
|
}
|
|
140
140
|
const r = Object.create(Object.getPrototypeOf(i));
|
|
141
141
|
e.set(i, r);
|
|
142
142
|
for (const n of Reflect.ownKeys(i)) {
|
|
143
143
|
const s = { ...Reflect.getOwnPropertyDescriptor(i, n) };
|
|
144
|
-
"value" in s && (s.value = Reflect.apply(
|
|
144
|
+
"value" in s && (s.value = Reflect.apply(ue, null, [s.value, e])), Reflect.defineProperty(r, n, s);
|
|
145
145
|
}
|
|
146
146
|
return r;
|
|
147
147
|
}
|
|
148
|
-
S(
|
|
149
|
-
function
|
|
148
|
+
S(ue, "clone");
|
|
149
|
+
function Y(i, e, t) {
|
|
150
150
|
if (i === e || !t && I(i) && I(e)) return !0;
|
|
151
151
|
if (typeof i != typeof e || typeof i != "object" || !i || !e) return !1;
|
|
152
152
|
function r(n, s) {
|
|
153
153
|
return n(i) ? n(e) ? s(i, e) : !1 : n(e) ? !1 : void 0;
|
|
154
154
|
}
|
|
155
|
-
return S(r, "check"), r(Array.isArray, (n, s) => n.length === s.length && n.every((o, a) =>
|
|
155
|
+
return S(r, "check"), r(Array.isArray, (n, s) => n.length === s.length && n.every((o, a) => Y(o, s[a]))) ?? r(G("Date"), (n, s) => n.valueOf() === s.valueOf()) ?? r(G("RegExp"), (n, s) => n.source === s.source && n.flags === s.flags) ?? r(se, (n, s) => {
|
|
156
156
|
if (n.byteLength !== s.byteLength) return !1;
|
|
157
157
|
const o = new Uint8Array(n), a = new Uint8Array(s);
|
|
158
158
|
for (let f = 0; f < o.length; f++)
|
|
159
159
|
if (o[f] !== a[f]) return !1;
|
|
160
160
|
return !0;
|
|
161
|
-
}) ?? Object.keys({ ...i, ...e }).every((n) =>
|
|
161
|
+
}) ?? Object.keys({ ...i, ...e }).every((n) => Y(i[n], e[n], t));
|
|
162
162
|
}
|
|
163
|
-
S(
|
|
164
|
-
function
|
|
163
|
+
S(Y, "deepEqual");
|
|
164
|
+
function Ui(i) {
|
|
165
165
|
return i.charAt(0).toUpperCase() + i.slice(1);
|
|
166
166
|
}
|
|
167
|
-
S(
|
|
168
|
-
function
|
|
167
|
+
S(Ui, "capitalize");
|
|
168
|
+
function Fi(i) {
|
|
169
169
|
return i.charAt(0).toLowerCase() + i.slice(1);
|
|
170
170
|
}
|
|
171
|
-
S(
|
|
172
|
-
function
|
|
171
|
+
S(Fi, "uncapitalize");
|
|
172
|
+
function zi(i) {
|
|
173
173
|
return i.replace(/[_-][a-z]/g, (e) => e.slice(1).toUpperCase());
|
|
174
174
|
}
|
|
175
|
-
S(
|
|
176
|
-
function
|
|
175
|
+
S(zi, "camelCase");
|
|
176
|
+
function Be(i, e, t) {
|
|
177
177
|
const r = [];
|
|
178
178
|
let n = 0;
|
|
179
179
|
for (let s = 0; s < i.length; s++) {
|
|
@@ -189,28 +189,28 @@ function Me(i, e, t) {
|
|
|
189
189
|
}
|
|
190
190
|
return String.fromCharCode(...r);
|
|
191
191
|
}
|
|
192
|
-
S(
|
|
193
|
-
function
|
|
194
|
-
return
|
|
192
|
+
S(Be, "tokenize");
|
|
193
|
+
function Hi(i) {
|
|
194
|
+
return Be(i, [45, 95], 45);
|
|
195
195
|
}
|
|
196
|
-
S(
|
|
197
|
-
function
|
|
198
|
-
return
|
|
196
|
+
S(Hi, "paramCase");
|
|
197
|
+
function Ki(i) {
|
|
198
|
+
return Be(i, [45, 95], 95);
|
|
199
199
|
}
|
|
200
|
-
S(
|
|
201
|
-
function
|
|
200
|
+
S(Ki, "snakeCase");
|
|
201
|
+
function qi(i) {
|
|
202
202
|
return typeof i != "string" ? `[${i.toString()}]` : /^[a-z_$][\w$]*$/i.test(i) ? `.${i}` : `[${JSON.stringify(i)}]`;
|
|
203
203
|
}
|
|
204
|
-
S(
|
|
205
|
-
function
|
|
204
|
+
S(qi, "formatProperty");
|
|
205
|
+
function $t(i) {
|
|
206
206
|
return i.replace(/\/$/, "");
|
|
207
207
|
}
|
|
208
|
-
S(
|
|
209
|
-
function
|
|
210
|
-
return i.startsWith("/") || (i = "/" + i),
|
|
208
|
+
S($t, "trimSlash");
|
|
209
|
+
function Wi(i) {
|
|
210
|
+
return i.startsWith("/") || (i = "/" + i), $t(i);
|
|
211
211
|
}
|
|
212
|
-
S(
|
|
213
|
-
var
|
|
212
|
+
S(Wi, "sanitize");
|
|
213
|
+
var ct;
|
|
214
214
|
((i) => {
|
|
215
215
|
i.millisecond = 1, i.second = 1e3, i.minute = i.second * 60, i.hour = i.minute * 60, i.day = i.hour * 24, i.week = i.day * 7;
|
|
216
216
|
let e = (/* @__PURE__ */ new Date()).getTimezoneOffset();
|
|
@@ -261,8 +261,8 @@ var ot;
|
|
|
261
261
|
return g.replace("yyyy", w.getFullYear().toString()).replace("yy", w.getFullYear().toString().slice(2)).replace("MM", y(w.getMonth() + 1)).replace("dd", y(w.getDate())).replace("hh", y(w.getHours())).replace("mm", y(w.getMinutes())).replace("ss", y(w.getSeconds())).replace("SSS", y(w.getMilliseconds(), 3));
|
|
262
262
|
}
|
|
263
263
|
i.template = _, S(_, "template");
|
|
264
|
-
})(
|
|
265
|
-
var
|
|
264
|
+
})(ct || (ct = {}));
|
|
265
|
+
var Gi = Object.defineProperty, k = (i, e) => Gi(i, "name", { value: e, configurable: !0 }), b = {
|
|
266
266
|
// internal symbols
|
|
267
267
|
shadow: /* @__PURE__ */ Symbol.for("cordis.shadow"),
|
|
268
268
|
receiver: /* @__PURE__ */ Symbol.for("cordis.receiver"),
|
|
@@ -283,63 +283,63 @@ var qi = Object.defineProperty, k = (i, e) => qi(i, "name", { value: e, configur
|
|
|
283
283
|
tracker: /* @__PURE__ */ Symbol.for("cordis.tracker"),
|
|
284
284
|
provide: /* @__PURE__ */ Symbol.for("cordis.provide"),
|
|
285
285
|
immediate: /* @__PURE__ */ Symbol.for("cordis.immediate")
|
|
286
|
-
},
|
|
287
|
-
}.constructor,
|
|
286
|
+
}, Vi = function* () {
|
|
287
|
+
}.constructor, lt = async function* () {
|
|
288
288
|
}.constructor;
|
|
289
|
-
function
|
|
290
|
-
return !(!i.prototype || i instanceof
|
|
289
|
+
function Ue(i) {
|
|
290
|
+
return !(!i.prototype || i instanceof Vi || lt !== Function && i instanceof lt);
|
|
291
291
|
}
|
|
292
|
-
k(
|
|
293
|
-
function
|
|
292
|
+
k(Ue, "isConstructor");
|
|
293
|
+
function oe(i, e) {
|
|
294
294
|
const t = i.Config || i.schema;
|
|
295
295
|
return t && i.schema !== !1 && (e = t(e)), e ?? {};
|
|
296
296
|
}
|
|
297
|
-
k(
|
|
298
|
-
function
|
|
297
|
+
k(oe, "resolveConfig");
|
|
298
|
+
function Et(i) {
|
|
299
299
|
return [Map, Set, Date, Promise].some((e) => i instanceof e);
|
|
300
300
|
}
|
|
301
|
-
k(
|
|
302
|
-
function
|
|
301
|
+
k(Et, "isUnproxyable");
|
|
302
|
+
function Fe(i, e) {
|
|
303
303
|
if (i === Object.prototype) return e;
|
|
304
|
-
const t = Object.create(
|
|
304
|
+
const t = Object.create(Fe(Object.getPrototypeOf(i), e));
|
|
305
305
|
for (const r of Reflect.ownKeys(i))
|
|
306
306
|
Object.defineProperty(t, r, Object.getOwnPropertyDescriptor(i, r));
|
|
307
307
|
return t;
|
|
308
308
|
}
|
|
309
|
-
k(
|
|
310
|
-
function
|
|
309
|
+
k(Fe, "joinPrototype");
|
|
310
|
+
function ze(i) {
|
|
311
311
|
return i && (typeof i == "object" || typeof i == "function");
|
|
312
312
|
}
|
|
313
|
-
k(
|
|
313
|
+
k(ze, "isObject");
|
|
314
314
|
function U(i, e, t) {
|
|
315
|
-
if (!
|
|
315
|
+
if (!ze(e)) return e;
|
|
316
316
|
if (Object.hasOwn(e, b.shadow))
|
|
317
317
|
return Object.getPrototypeOf(e);
|
|
318
318
|
const r = e[b.tracker];
|
|
319
|
-
return r ?
|
|
319
|
+
return r ? _e(i, e, r, t) : e;
|
|
320
320
|
}
|
|
321
321
|
k(U, "getTraceable");
|
|
322
|
-
function
|
|
322
|
+
function re(i, e) {
|
|
323
323
|
return e ? new Proxy(i, {
|
|
324
324
|
get: /* @__PURE__ */ k((t, r, n) => r in e && r !== "constructor" ? Reflect.get(e, r, n) : Reflect.get(t, r, n), "get"),
|
|
325
325
|
set: /* @__PURE__ */ k((t, r, n, s) => r in e && r !== "constructor" ? Reflect.set(e, r, n, s) : Reflect.set(t, r, n, s), "set")
|
|
326
326
|
}) : i;
|
|
327
327
|
}
|
|
328
|
-
k(
|
|
329
|
-
function
|
|
330
|
-
return
|
|
328
|
+
k(re, "withProps");
|
|
329
|
+
function fe(i, e, t) {
|
|
330
|
+
return re(i, Object.defineProperty(/* @__PURE__ */ Object.create(null), e, {
|
|
331
331
|
value: t,
|
|
332
332
|
writable: !1
|
|
333
333
|
}));
|
|
334
334
|
}
|
|
335
|
-
k(
|
|
336
|
-
function
|
|
335
|
+
k(fe, "withProp");
|
|
336
|
+
function Ce(i, e, t, r) {
|
|
337
337
|
if (!t) return r;
|
|
338
338
|
const n = Reflect.getOwnPropertyDescriptor(e, t)?.value;
|
|
339
|
-
return n ?
|
|
339
|
+
return n ? fe(r, t, i.extend({ [b.shadow]: n })) : r;
|
|
340
340
|
}
|
|
341
|
-
k(
|
|
342
|
-
function
|
|
341
|
+
k(Ce, "createShadow");
|
|
342
|
+
function At(i, e, t, r) {
|
|
343
343
|
return new Proxy(e, {
|
|
344
344
|
apply: /* @__PURE__ */ k((n, s, o) => (s === t && (s = r), o = o.map((a) => typeof a != "function" || a[b.original] ? a : new Proxy(a, {
|
|
345
345
|
get: /* @__PURE__ */ k((f, u, p) => {
|
|
@@ -354,8 +354,8 @@ function St(i, e, t, r) {
|
|
|
354
354
|
})), U(i, Reflect.apply(n, s, o))), "apply")
|
|
355
355
|
});
|
|
356
356
|
}
|
|
357
|
-
k(
|
|
358
|
-
function
|
|
357
|
+
k(At, "createShadowMethod");
|
|
358
|
+
function _e(i, e, t, r) {
|
|
359
359
|
i[b.shadow] && (i = Object.getPrototypeOf(i));
|
|
360
360
|
const n = new Proxy(e, {
|
|
361
361
|
get: /* @__PURE__ */ k((s, o, a) => {
|
|
@@ -364,37 +364,37 @@ function ve(i, e, t, r) {
|
|
|
364
364
|
if (typeof o == "symbol")
|
|
365
365
|
return Reflect.get(s, o, a);
|
|
366
366
|
if (t.associate && i[b.internal][`${t.associate}.${o}`])
|
|
367
|
-
return Reflect.get(i, `${t.associate}.${o}`,
|
|
368
|
-
const f =
|
|
369
|
-
return p ?
|
|
367
|
+
return Reflect.get(i, `${t.associate}.${o}`, fe(i, b.receiver, a));
|
|
368
|
+
const f = Ce(i, s, t.property, a), u = Reflect.get(s, o, f), p = u?.[b.tracker];
|
|
369
|
+
return p ? _e(i, u, p) : !r && typeof u == "function" ? At(i, u, a, f) : u;
|
|
370
370
|
}, "get"),
|
|
371
371
|
set: /* @__PURE__ */ k((s, o, a, f) => {
|
|
372
372
|
if (o === b.original || o === t.property) return !1;
|
|
373
373
|
if (typeof o == "symbol")
|
|
374
374
|
return Reflect.set(s, o, a, f);
|
|
375
375
|
if (t.associate && i[b.internal][`${t.associate}.${o}`])
|
|
376
|
-
return Reflect.set(i, `${t.associate}.${o}`, a,
|
|
377
|
-
const u =
|
|
376
|
+
return Reflect.set(i, `${t.associate}.${o}`, a, fe(i, b.receiver, f));
|
|
377
|
+
const u = Ce(i, s, t.property, f);
|
|
378
378
|
return Reflect.set(s, o, a, u);
|
|
379
379
|
}, "set"),
|
|
380
|
-
apply: /* @__PURE__ */ k((s, o, a) =>
|
|
380
|
+
apply: /* @__PURE__ */ k((s, o, a) => He(n, s, o, a), "apply")
|
|
381
381
|
});
|
|
382
382
|
return n;
|
|
383
383
|
}
|
|
384
|
-
k(
|
|
385
|
-
function
|
|
384
|
+
k(_e, "createTraceable");
|
|
385
|
+
function He(i, e, t, r) {
|
|
386
386
|
return e[b.invoke] ? e[b.invoke].apply(i, r) : Reflect.apply(e, t, r);
|
|
387
387
|
}
|
|
388
|
-
k(
|
|
389
|
-
function
|
|
388
|
+
k(He, "applyTraceable");
|
|
389
|
+
function Oe(i, e, t) {
|
|
390
390
|
const r = /* @__PURE__ */ k(function(...n) {
|
|
391
|
-
const s =
|
|
392
|
-
return
|
|
391
|
+
const s = _e(r.ctx, r, t);
|
|
392
|
+
return He(s, r, this, n);
|
|
393
393
|
}, "self");
|
|
394
394
|
return j(r, "name", i), Object.setPrototypeOf(r, e);
|
|
395
395
|
}
|
|
396
|
-
k(
|
|
397
|
-
var
|
|
396
|
+
k(Oe, "createCallable");
|
|
397
|
+
var Yi = class Q {
|
|
398
398
|
constructor(e) {
|
|
399
399
|
this.ctx = e, j(this, b.tracker, {
|
|
400
400
|
associate: "reflect",
|
|
@@ -454,7 +454,7 @@ var Wi = class Q {
|
|
|
454
454
|
const o = this.ctx;
|
|
455
455
|
I(t) || (s = o.effect(() => () => {
|
|
456
456
|
o.set(e, void 0);
|
|
457
|
-
})),
|
|
457
|
+
})), Et(t) && o.emit(o, "internal/warning", new Error(`service ${e} is an unproxyable object, which may lead to unexpected behavior`));
|
|
458
458
|
const a = Object.create(o);
|
|
459
459
|
return a[b.filter] = (f) => o[b.isolate][e] === f[b.isolate][e], o.emit(a, "internal/before-service", e, t), o[b.store][r] = { value: t, source: o }, o.emit(a, "internal/service", e, n), s;
|
|
460
460
|
}
|
|
@@ -462,7 +462,7 @@ var Wi = class Q {
|
|
|
462
462
|
const n = this.ctx.root[b.internal];
|
|
463
463
|
if (e in n) return;
|
|
464
464
|
const s = Symbol(e);
|
|
465
|
-
n[e] = { type: "service", builtin: r }, this.ctx.root[b.isolate][e] = s,
|
|
465
|
+
n[e] = { type: "service", builtin: r }, this.ctx.root[b.isolate][e] = s, ze(t) && (this.ctx[b.store][s] = { value: t, source: null }, j(t, b.tracker, {
|
|
466
466
|
associate: e,
|
|
467
467
|
property: "ctx"
|
|
468
468
|
}));
|
|
@@ -486,11 +486,11 @@ var Wi = class Q {
|
|
|
486
486
|
get(f) {
|
|
487
487
|
const u = n(this);
|
|
488
488
|
if (I(u)) return u;
|
|
489
|
-
const p = f ?
|
|
489
|
+
const p = f ? re(f, u) : u, y = Reflect.get(u, o, p);
|
|
490
490
|
return typeof y != "function" ? y : y.bind(p ?? u);
|
|
491
491
|
},
|
|
492
492
|
set(f, u) {
|
|
493
|
-
const p = n(this), y = u ?
|
|
493
|
+
const p = n(this), y = u ? re(u, p) : p;
|
|
494
494
|
return Reflect.set(p, o, f, y);
|
|
495
495
|
}
|
|
496
496
|
}));
|
|
@@ -507,12 +507,12 @@ var Wi = class Q {
|
|
|
507
507
|
apply: /* @__PURE__ */ k((t, r, n) => t.apply(this.trace(r), n.map((s) => this.trace(s))), "apply")
|
|
508
508
|
});
|
|
509
509
|
}
|
|
510
|
-
},
|
|
511
|
-
function
|
|
510
|
+
}, Pe = Yi;
|
|
511
|
+
function Ie(i) {
|
|
512
512
|
return i !== null && i !== !1 && i !== void 0;
|
|
513
513
|
}
|
|
514
|
-
k(
|
|
515
|
-
var
|
|
514
|
+
k(Ie, "isBailed");
|
|
515
|
+
var Ji = class {
|
|
516
516
|
constructor(i) {
|
|
517
517
|
this.ctx = i, j(this, b.tracker, {
|
|
518
518
|
associate: "lifecycle",
|
|
@@ -525,11 +525,11 @@ var Gi = class {
|
|
|
525
525
|
return this.scope.disposables[s](r), j(r, "name", "event <dispose>"), () => W(this.scope.disposables, r);
|
|
526
526
|
if (t === "fork")
|
|
527
527
|
return this.scope.runtime.forkables[s](r), this.scope.collect("event <fork>", () => W(this.scope.runtime.forkables, r));
|
|
528
|
-
}),
|
|
528
|
+
}), M.static, i.scope);
|
|
529
529
|
for (const t of ["info", "error", "warning"])
|
|
530
530
|
j(this.on(`internal/${t}`, (r, ...n) => {
|
|
531
531
|
this._hooks[`internal/${t}`].length > 1;
|
|
532
|
-
}),
|
|
532
|
+
}), M.static, i.scope);
|
|
533
533
|
j(this.on("internal/before-service", function(t) {
|
|
534
534
|
for (const r of this.registry.values()) {
|
|
535
535
|
if (!r.inject[t]?.required) continue;
|
|
@@ -537,23 +537,23 @@ var Gi = class {
|
|
|
537
537
|
for (const s of n)
|
|
538
538
|
this[b.filter](s.ctx) && (s.updateStatus(), s.reset());
|
|
539
539
|
}
|
|
540
|
-
}, { global: !0 }),
|
|
540
|
+
}, { global: !0 }), M.static, i.scope), j(this.on("internal/service", function(t) {
|
|
541
541
|
for (const r of this.registry.values()) {
|
|
542
542
|
if (!r.inject[t]?.required) continue;
|
|
543
543
|
const n = r.isReusable ? r.children : [r];
|
|
544
544
|
for (const s of n)
|
|
545
545
|
this[b.filter](s.ctx) && s.start();
|
|
546
546
|
}
|
|
547
|
-
}, { global: !0 }),
|
|
547
|
+
}, { global: !0 }), M.static, i.scope);
|
|
548
548
|
const e = /* @__PURE__ */ k((t, r) => {
|
|
549
549
|
if (!t.runtime.plugin) return !1;
|
|
550
550
|
for (const n in t.runtime.inject)
|
|
551
|
-
if (r ===
|
|
551
|
+
if (r === Pe.resolveInject(t.ctx, n)[0]) return !0;
|
|
552
552
|
return e(t.parent.scope, r);
|
|
553
553
|
}, "checkInject");
|
|
554
554
|
j(this.on("internal/inject", function(t) {
|
|
555
555
|
return e(this.scope, t);
|
|
556
|
-
}, { global: !0 }),
|
|
556
|
+
}, { global: !0 }), M.static, i.scope);
|
|
557
557
|
}
|
|
558
558
|
static {
|
|
559
559
|
k(this, "Lifecycle");
|
|
@@ -567,7 +567,7 @@ var Gi = class {
|
|
|
567
567
|
}
|
|
568
568
|
filterHooks(i, e) {
|
|
569
569
|
return e = U(this.ctx, e), i.slice().filter((t) => {
|
|
570
|
-
const r = e?.[
|
|
570
|
+
const r = e?.[M.filter];
|
|
571
571
|
return t.global || !r || r.call(e, t.ctx);
|
|
572
572
|
});
|
|
573
573
|
}
|
|
@@ -585,11 +585,11 @@ var Gi = class {
|
|
|
585
585
|
}
|
|
586
586
|
async serial(...i) {
|
|
587
587
|
for await (const e of this.dispatch("serial", i))
|
|
588
|
-
if (
|
|
588
|
+
if (Ie(e)) return e;
|
|
589
589
|
}
|
|
590
590
|
bail(...i) {
|
|
591
591
|
for (const e of this.dispatch("bail", i))
|
|
592
|
-
if (
|
|
592
|
+
if (Ie(e)) return e;
|
|
593
593
|
}
|
|
594
594
|
register(i, e, t, r) {
|
|
595
595
|
const n = r.prepend ? "unshift" : "push";
|
|
@@ -625,9 +625,9 @@ var Gi = class {
|
|
|
625
625
|
async stop() {
|
|
626
626
|
this.isActive = !1, this.ctx.scope.reset();
|
|
627
627
|
}
|
|
628
|
-
},
|
|
628
|
+
}, Xi = Ji, Qi = /* @__PURE__ */ ((i) => (i[i.PENDING = 0] = "PENDING", i[i.LOADING = 1] = "LOADING", i[i.ACTIVE = 2] = "ACTIVE", i[i.FAILED = 3] = "FAILED", i[i.DISPOSED = 4] = "DISPOSED", i))(Qi || {}), Le = class Ct extends Error {
|
|
629
629
|
constructor(e, t) {
|
|
630
|
-
super(t ??
|
|
630
|
+
super(t ?? Ct.Code[e]), this.code = e;
|
|
631
631
|
}
|
|
632
632
|
static {
|
|
633
633
|
k(this, "CordisError");
|
|
@@ -637,8 +637,8 @@ var Gi = class {
|
|
|
637
637
|
i.Code = {
|
|
638
638
|
INACTIVE_EFFECT: "cannot create effect on inactive context"
|
|
639
639
|
};
|
|
640
|
-
})(
|
|
641
|
-
var
|
|
640
|
+
})(Le || (Le = {}));
|
|
641
|
+
var Ot = class {
|
|
642
642
|
constructor(i, e) {
|
|
643
643
|
this.parent = i, this.config = e, this.uid = i.registry ? i.registry.counter : 0, this.ctx = this.context = i.extend({ scope: this }), this.proxy = new Proxy({}, {
|
|
644
644
|
get: /* @__PURE__ */ k((t, r) => Reflect.get(this.config, r), "get")
|
|
@@ -664,11 +664,11 @@ var Et = class {
|
|
|
664
664
|
}
|
|
665
665
|
assertActive() {
|
|
666
666
|
if (!(this.uid !== null || this.isActive))
|
|
667
|
-
throw new
|
|
667
|
+
throw new Le("INACTIVE_EFFECT");
|
|
668
668
|
}
|
|
669
669
|
effect(i, e) {
|
|
670
670
|
this.assertActive();
|
|
671
|
-
const t =
|
|
671
|
+
const t = Ue(i) ? new i(this.ctx, e) : i(this.ctx, e);
|
|
672
672
|
let r = !1;
|
|
673
673
|
const n = typeof t == "function" ? t : t.dispose.bind(t), s = /* @__PURE__ */ k((...o) => {
|
|
674
674
|
if (!r)
|
|
@@ -706,7 +706,7 @@ var Et = class {
|
|
|
706
706
|
}
|
|
707
707
|
reset() {
|
|
708
708
|
this.isActive = !1, this.disposables = this.disposables.splice(0).filter((i) => {
|
|
709
|
-
if (this.uid !== null && i[
|
|
709
|
+
if (this.uid !== null && i[M.static] === this) return !0;
|
|
710
710
|
(async () => i())().catch((e) => {
|
|
711
711
|
this.context.emit(this.ctx, "internal/error", e);
|
|
712
712
|
});
|
|
@@ -730,7 +730,7 @@ var Et = class {
|
|
|
730
730
|
if (e || !this.config) return [!0, !0];
|
|
731
731
|
if (e === !1) return [!1, !1];
|
|
732
732
|
const t = /* @__PURE__ */ Object.create(null), r = /* @__PURE__ */ k((f) => {
|
|
733
|
-
const u = t[f] ??= !
|
|
733
|
+
const u = t[f] ??= !Y(this.config[f], i[f]);
|
|
734
734
|
return s ||= u, u;
|
|
735
735
|
}, "checkPropertyUpdate"), n = /* @__PURE__ */ new Set();
|
|
736
736
|
let s = !1, o = !1, a = this.runtime.isReactive || null;
|
|
@@ -754,13 +754,13 @@ var Et = class {
|
|
|
754
754
|
}
|
|
755
755
|
return [s, o];
|
|
756
756
|
}
|
|
757
|
-
},
|
|
757
|
+
}, Zi = class extends Ot {
|
|
758
758
|
constructor(i, e, t, r) {
|
|
759
759
|
super(i, t), this.runtime = e, this.dispose = j(i.scope.collect(`fork <${i.runtime.name}>`, () => {
|
|
760
760
|
this.uid = null, this.reset(), this.context.emit("internal/fork", this);
|
|
761
761
|
const n = W(e.disposables, this.dispose);
|
|
762
762
|
return W(e.children, this) && !e.children.length && i.registry.delete(e.plugin), n;
|
|
763
|
-
}),
|
|
763
|
+
}), M.static, e), e.children.push(this), e.disposables.push(this.dispose), this.context.emit("internal/fork", this), this.init(r);
|
|
764
764
|
}
|
|
765
765
|
static {
|
|
766
766
|
k(this, "ForkScope");
|
|
@@ -776,14 +776,14 @@ var Et = class {
|
|
|
776
776
|
if (r.config !== t) return;
|
|
777
777
|
let n;
|
|
778
778
|
try {
|
|
779
|
-
n =
|
|
779
|
+
n = oe(this.runtime.plugin, i);
|
|
780
780
|
} catch (a) {
|
|
781
781
|
return this.context.emit("internal/error", a), this.cancel(a);
|
|
782
782
|
}
|
|
783
783
|
const [s, o] = r.checkUpdate(n, e);
|
|
784
784
|
this.context.emit("internal/before-update", this, i), this.config = n, r.config = n, s && this.context.emit("internal/update", this, t), o && r.restart();
|
|
785
785
|
}
|
|
786
|
-
},
|
|
786
|
+
}, ht = class extends Ot {
|
|
787
787
|
constructor(i, e, t, r) {
|
|
788
788
|
super(i, t), this.plugin = e, e ? (this.setup(), this.init(r)) : (this.name = "root", this.isActive = !0);
|
|
789
789
|
}
|
|
@@ -803,7 +803,7 @@ var Et = class {
|
|
|
803
803
|
return this.forkables.length > 0;
|
|
804
804
|
}
|
|
805
805
|
fork(i, e, t) {
|
|
806
|
-
return new
|
|
806
|
+
return new Zi(i, this, e, t);
|
|
807
807
|
}
|
|
808
808
|
dispose() {
|
|
809
809
|
return this.uid = null, this.reset(), this.context.emit("internal/runtime", this), !0;
|
|
@@ -815,8 +815,8 @@ var Et = class {
|
|
|
815
815
|
apply = /* @__PURE__ */ k((i, e) => {
|
|
816
816
|
if (typeof this.plugin != "function")
|
|
817
817
|
return this.plugin.apply(i, e);
|
|
818
|
-
if (
|
|
819
|
-
const t = new this.plugin(i, e), r = t[
|
|
818
|
+
if (Ue(this.plugin)) {
|
|
819
|
+
const t = new this.plugin(i, e), r = t[M.expose];
|
|
820
820
|
return r && i.set(r, t), t.fork && this.forkables.push(t.fork.bind(t)), t;
|
|
821
821
|
} else
|
|
822
822
|
return this.plugin(i, e);
|
|
@@ -840,7 +840,7 @@ var Et = class {
|
|
|
840
840
|
const t = this.config;
|
|
841
841
|
let r;
|
|
842
842
|
try {
|
|
843
|
-
r =
|
|
843
|
+
r = oe(this.runtime.plugin || this.context.constructor, i);
|
|
844
844
|
} catch (a) {
|
|
845
845
|
return this.context.emit("internal/error", a), this.cancel(a);
|
|
846
846
|
}
|
|
@@ -848,10 +848,10 @@ var Et = class {
|
|
|
848
848
|
this.config = r, o && (this.context.emit("internal/before-update", o, i), o.config = r, n && this.context.emit("internal/update", o, t)), s && this.restart();
|
|
849
849
|
}
|
|
850
850
|
};
|
|
851
|
-
function
|
|
851
|
+
function Pt(i) {
|
|
852
852
|
return i && typeof i == "object" && typeof i.apply == "function";
|
|
853
853
|
}
|
|
854
|
-
k(
|
|
854
|
+
k(Pt, "isApplicable");
|
|
855
855
|
function F(i) {
|
|
856
856
|
return function(e, t) {
|
|
857
857
|
if (t.kind === "class")
|
|
@@ -861,7 +861,7 @@ function F(i) {
|
|
|
861
861
|
const r = this[b.tracker]?.property;
|
|
862
862
|
if (!r) throw new Error("missing context tracker");
|
|
863
863
|
this[r].inject(i, (n) => {
|
|
864
|
-
e.call(
|
|
864
|
+
e.call(re(this, { [r]: n }));
|
|
865
865
|
});
|
|
866
866
|
});
|
|
867
867
|
else
|
|
@@ -879,13 +879,13 @@ k(F, "Inject");
|
|
|
879
879
|
}
|
|
880
880
|
i.resolve = e, k(e, "resolve");
|
|
881
881
|
})(F || (F = {}));
|
|
882
|
-
var
|
|
882
|
+
var er = class {
|
|
883
883
|
constructor(i, e) {
|
|
884
884
|
this.ctx = i, j(this, b.tracker, {
|
|
885
885
|
associate: "registry",
|
|
886
886
|
property: "ctx"
|
|
887
887
|
}), this.context = i;
|
|
888
|
-
const t = new
|
|
888
|
+
const t = new ht(i, null, e);
|
|
889
889
|
i.scope = t, t.ctx = i, this.set(null, t);
|
|
890
890
|
}
|
|
891
891
|
static {
|
|
@@ -902,7 +902,7 @@ var Xi = class {
|
|
|
902
902
|
}
|
|
903
903
|
resolve(i, e = !1) {
|
|
904
904
|
if (i === null || typeof i == "function") return i;
|
|
905
|
-
if (
|
|
905
|
+
if (Pt(i)) return i.apply;
|
|
906
906
|
if (e) throw new Error('invalid plugin, expect function or object with an "apply" method, received ' + typeof i);
|
|
907
907
|
}
|
|
908
908
|
get(i) {
|
|
@@ -943,14 +943,14 @@ var Xi = class {
|
|
|
943
943
|
plugin(i, e, t) {
|
|
944
944
|
if (this.resolve(i, !0), this.ctx.scope.assertActive(), !t)
|
|
945
945
|
try {
|
|
946
|
-
e =
|
|
946
|
+
e = oe(i, e);
|
|
947
947
|
} catch (n) {
|
|
948
948
|
this.context.emit(this.ctx, "internal/error", n), t = n, e = null;
|
|
949
949
|
}
|
|
950
950
|
let r = this.get(i);
|
|
951
|
-
return r ? (r.isForkable || this.context.emit(this.ctx, "internal/warning", new Error(`duplicate plugin detected: ${i.name}`)), r.fork(this.ctx, e, t)) : (r = new
|
|
951
|
+
return r ? (r.isForkable || this.context.emit(this.ctx, "internal/warning", new Error(`duplicate plugin detected: ${i.name}`)), r.fork(this.ctx, e, t)) : (r = new ht(this.ctx, i, e, t), this.set(i, r), r.fork(this.ctx, e, t));
|
|
952
952
|
}
|
|
953
|
-
},
|
|
953
|
+
}, tr = er, M = class te {
|
|
954
954
|
static {
|
|
955
955
|
k(this, "Context");
|
|
956
956
|
}
|
|
@@ -965,19 +965,19 @@ var Xi = class {
|
|
|
965
965
|
static origin = "ctx";
|
|
966
966
|
static current = "ctx";
|
|
967
967
|
static is(e) {
|
|
968
|
-
return !!e?.[
|
|
968
|
+
return !!e?.[te.is];
|
|
969
969
|
}
|
|
970
970
|
static {
|
|
971
|
-
|
|
971
|
+
te.is[Symbol.toPrimitive] = () => /* @__PURE__ */ Symbol.for("cordis.is"), te.prototype[te.is] = !0;
|
|
972
972
|
}
|
|
973
973
|
/** @deprecated use `Service.traceable` instead */
|
|
974
974
|
static associate(e, t) {
|
|
975
975
|
return e;
|
|
976
976
|
}
|
|
977
977
|
constructor(e) {
|
|
978
|
-
e =
|
|
979
|
-
const t = new Proxy(this,
|
|
980
|
-
t.root = t, t.reflect = new
|
|
978
|
+
e = oe(this.constructor, e), this[b.store] = /* @__PURE__ */ Object.create(null), this[b.isolate] = /* @__PURE__ */ Object.create(null), this[b.internal] = /* @__PURE__ */ Object.create(null), this[b.intercept] = /* @__PURE__ */ Object.create(null);
|
|
979
|
+
const t = new Proxy(this, Pe.handler);
|
|
980
|
+
t.root = t, t.reflect = new Pe(t), t.registry = new tr(t, e), t.lifecycle = new Xi(t);
|
|
981
981
|
const r = /* @__PURE__ */ k((n) => {
|
|
982
982
|
if (n) {
|
|
983
983
|
r(Object.getPrototypeOf(n));
|
|
@@ -1018,8 +1018,8 @@ var Xi = class {
|
|
|
1018
1018
|
return r[e] = t, this.extend({ [b.intercept]: r });
|
|
1019
1019
|
}
|
|
1020
1020
|
};
|
|
1021
|
-
|
|
1022
|
-
var z = class
|
|
1021
|
+
M.prototype[M.internal] = /* @__PURE__ */ Object.create(null);
|
|
1022
|
+
var z = class It {
|
|
1023
1023
|
static {
|
|
1024
1024
|
k(this, "Service");
|
|
1025
1025
|
}
|
|
@@ -1038,13 +1038,13 @@ var z = class At {
|
|
|
1038
1038
|
config;
|
|
1039
1039
|
constructor(...e) {
|
|
1040
1040
|
let t, r, n, s;
|
|
1041
|
-
|
|
1041
|
+
M.is(e[0]) ? (t = e[0], typeof e[1] == "string" ? (r = e[1], n = e[2]) : s = e[1]) : s = e[0], r ??= this.constructor[b.provide], n ??= this.constructor[b.immediate];
|
|
1042
1042
|
let o = this;
|
|
1043
1043
|
const a = {
|
|
1044
1044
|
associate: r,
|
|
1045
1045
|
property: "ctx"
|
|
1046
1046
|
};
|
|
1047
|
-
return o[b.invoke] && (o =
|
|
1047
|
+
return o[b.invoke] && (o = Oe(r, Fe(Object.getPrototypeOf(this), Function.prototype), a)), t ? o.ctx = t : o[b.setup](), o.name = r, o.config = s, j(o, b.tracker, a), o.ctx.provide(r), o.ctx.runtime.name = r, n && (t ? o[b.expose] = r : o.ctx.set(r, o)), o.ctx.on("ready", async () => {
|
|
1048
1048
|
await Promise.resolve(), await o.start(), n || o.ctx.set(r, o);
|
|
1049
1049
|
}), o.ctx.on("dispose", () => o.stop()), o;
|
|
1050
1050
|
}
|
|
@@ -1052,11 +1052,11 @@ var z = class At {
|
|
|
1052
1052
|
return e[b.isolate][this.name] === this.ctx[b.isolate][this.name];
|
|
1053
1053
|
}
|
|
1054
1054
|
[b.setup]() {
|
|
1055
|
-
this.ctx = new
|
|
1055
|
+
this.ctx = new M();
|
|
1056
1056
|
}
|
|
1057
1057
|
[b.extend](e) {
|
|
1058
1058
|
let t;
|
|
1059
|
-
return this[
|
|
1059
|
+
return this[It.invoke] ? t = Oe(this.name, this, this[b.tracker]) : t = Object.create(this), Object.assign(t, e);
|
|
1060
1060
|
}
|
|
1061
1061
|
static [Symbol.hasInstance](e) {
|
|
1062
1062
|
let t = e.constructor;
|
|
@@ -1066,9 +1066,9 @@ var z = class At {
|
|
|
1066
1066
|
}
|
|
1067
1067
|
return !1;
|
|
1068
1068
|
}
|
|
1069
|
-
},
|
|
1070
|
-
return e || (0, i[
|
|
1071
|
-
},
|
|
1069
|
+
}, ir = Object.defineProperty, rr = Object.getOwnPropertyNames, E = (i, e) => ir(i, "name", { value: e, configurable: !0 }), nr = (i, e) => function() {
|
|
1070
|
+
return e || (0, i[rr(i)[0]])((e = { exports: {} }).exports, e), e.exports;
|
|
1071
|
+
}, sr = nr({
|
|
1072
1072
|
"src/index.ts"(i, e) {
|
|
1073
1073
|
var t = /* @__PURE__ */ Symbol.for("schemastery"), r = /* @__PURE__ */ Symbol.for("ValidationError");
|
|
1074
1074
|
globalThis.__schemastery_index__ ??= 0, globalThis.__schemastery_refs__ = void 0;
|
|
@@ -1095,10 +1095,10 @@ var z = class At {
|
|
|
1095
1095
|
return s.resolve(h, c, d)[0];
|
|
1096
1096
|
}, "schema");
|
|
1097
1097
|
if (l.refs) {
|
|
1098
|
-
const h =
|
|
1098
|
+
const h = K(l.refs, (m) => new s(m)), d = /* @__PURE__ */ E((m) => h[m], "getRef");
|
|
1099
1099
|
for (const m in h) {
|
|
1100
1100
|
const v = h[m];
|
|
1101
|
-
v.sKey = d(v.sKey), v.inner = d(v.inner), v.list = v.list && v.list.map(d), v.dict = v.dict &&
|
|
1101
|
+
v.sKey = d(v.sKey), v.inner = d(v.inner), v.list = v.list && v.list.map(d), v.dict = v.dict && K(v.dict, d);
|
|
1102
1102
|
}
|
|
1103
1103
|
return h[l.uid];
|
|
1104
1104
|
}
|
|
@@ -1134,11 +1134,11 @@ var z = class At {
|
|
|
1134
1134
|
}
|
|
1135
1135
|
E(a, "getInner");
|
|
1136
1136
|
function f(l) {
|
|
1137
|
-
return
|
|
1137
|
+
return xt(l ?? {}, (c) => !c.startsWith("$"));
|
|
1138
1138
|
}
|
|
1139
1139
|
E(f, "extractKeys"), s.prototype.i18n = /* @__PURE__ */ E(function(c) {
|
|
1140
1140
|
const h = s(this), d = o(h.meta.description, c);
|
|
1141
|
-
return Object.keys(d).length && (h.meta.description = d), h.dict && (h.dict =
|
|
1141
|
+
return Object.keys(d).length && (h.meta.description = d), h.dict && (h.dict = K(h.dict, (m, v) => m.i18n(K(c, (x) => a(x)?.[v] ?? x?.[v])))), h.list && (h.list = h.list.map((m, v) => m.i18n(K(c, (x = {}) => Array.isArray(a(x)) ? a(x)[v] : Array.isArray(x) ? x[v] : f(x))))), h.inner && (h.inner = h.inner.i18n(K(c, (m) => a(m) ? a(m) : f(m)))), h.sKey && (h.sKey = h.sKey.i18n(K(c, (m) => m?.$key))), h;
|
|
1142
1142
|
}, "i18n"), s.prototype.extra = /* @__PURE__ */ E(function(c, h) {
|
|
1143
1143
|
const d = s(this);
|
|
1144
1144
|
return d.meta = { ...d.meta, [c]: h }, d;
|
|
@@ -1157,10 +1157,10 @@ var z = class At {
|
|
|
1157
1157
|
const c = s(this);
|
|
1158
1158
|
return c.meta.badges ||= [], c.meta.badges.push({ text: "experimental", type: "warning" }), c;
|
|
1159
1159
|
}, "experimental"), s.prototype.pattern = /* @__PURE__ */ E(function(c) {
|
|
1160
|
-
const h = s(this), d =
|
|
1160
|
+
const h = s(this), d = kt(c, ["source", "flags"]);
|
|
1161
1161
|
return h.meta = { ...h.meta, pattern: d }, h;
|
|
1162
1162
|
}, "pattern"), s.prototype.simplify = /* @__PURE__ */ E(function(c) {
|
|
1163
|
-
if (
|
|
1163
|
+
if (Y(c, this.meta.default, this.type === "dict")) return null;
|
|
1164
1164
|
if (I(c)) return c;
|
|
1165
1165
|
if (this.type === "object" || this.type === "dict") {
|
|
1166
1166
|
const h = {};
|
|
@@ -1168,7 +1168,7 @@ var z = class At {
|
|
|
1168
1168
|
const v = (this.type === "object" ? this.dict[d] : this.inner)?.simplify(c[d]);
|
|
1169
1169
|
(this.type === "dict" || !I(v)) && (h[d] = v);
|
|
1170
1170
|
}
|
|
1171
|
-
return
|
|
1171
|
+
return Y(h, this.meta.default, this.type === "dict") ? null : h;
|
|
1172
1172
|
} else if (this.type === "array" || this.type === "tuple") {
|
|
1173
1173
|
const h = [];
|
|
1174
1174
|
return c.forEach((d, m) => {
|
|
@@ -1208,11 +1208,11 @@ var z = class At {
|
|
|
1208
1208
|
if (d.ignore?.(c, h)) return [c];
|
|
1209
1209
|
if (I(c) && h.type !== "lazy") {
|
|
1210
1210
|
if (h.meta.required) throw new n("missing required value", d);
|
|
1211
|
-
let x = h,
|
|
1212
|
-
for (; x?.type === "intersect" && I(
|
|
1213
|
-
x = x.list[0],
|
|
1214
|
-
if (I(
|
|
1215
|
-
c =
|
|
1211
|
+
let x = h, C = h.meta.default;
|
|
1212
|
+
for (; x?.type === "intersect" && I(C); )
|
|
1213
|
+
x = x.list[0], C = x?.meta.default;
|
|
1214
|
+
if (I(C)) return [c];
|
|
1215
|
+
c = ue(C);
|
|
1216
1216
|
}
|
|
1217
1217
|
const v = u[h.type];
|
|
1218
1218
|
if (!v) throw new n(`unsupported type "${h.type}"`, d);
|
|
@@ -1290,7 +1290,7 @@ var z = class At {
|
|
|
1290
1290
|
}, "arrayBuffer"), s.extend("lazy", (l, c, h, d) => (c.inner[t] || (c.inner = c.builder(), c.inner.meta = { ...c.meta, ...c.inner.meta }), s.resolve(l, c.inner, h, d))), s.extend("any", (l) => [l]), s.extend("never", (l, c, h) => {
|
|
1291
1291
|
throw new n(`expected nullable but got ${l}`, h);
|
|
1292
1292
|
}), s.extend("const", (l, { value: c }, h) => {
|
|
1293
|
-
if (
|
|
1293
|
+
if (Y(l, c)) return [c];
|
|
1294
1294
|
throw new n(`expected ${c} but got ${l}`, h);
|
|
1295
1295
|
});
|
|
1296
1296
|
function p(l, c, h, d, m = !1) {
|
|
@@ -1380,17 +1380,17 @@ var z = class At {
|
|
|
1380
1380
|
if (!Array.isArray(l)) throw new n(`expected array but got ${l}`, d);
|
|
1381
1381
|
return p(l.length, h, "array length", d, !I(c.meta.default)), [l.map((m, v) => g(l, v, c, d))];
|
|
1382
1382
|
}), s.extend("dict", (l, { inner: c, sKey: h }, d, m) => {
|
|
1383
|
-
if (!
|
|
1383
|
+
if (!he(l)) throw new n(`expected object but got ${l}`, d);
|
|
1384
1384
|
const v = {};
|
|
1385
1385
|
for (const x in l) {
|
|
1386
|
-
let
|
|
1386
|
+
let C;
|
|
1387
1387
|
try {
|
|
1388
|
-
|
|
1389
|
-
} catch (
|
|
1388
|
+
C = s.resolve(x, h, d)[0];
|
|
1389
|
+
} catch (Se) {
|
|
1390
1390
|
if (m) continue;
|
|
1391
|
-
throw
|
|
1391
|
+
throw Se;
|
|
1392
1392
|
}
|
|
1393
|
-
v[
|
|
1393
|
+
v[C] = g(l, x, c, d), l[C] = l[x], x !== C && delete l[x];
|
|
1394
1394
|
}
|
|
1395
1395
|
return [v];
|
|
1396
1396
|
}), s.extend("tuple", (l, { list: c }, h, d) => {
|
|
@@ -1403,7 +1403,7 @@ var z = class At {
|
|
|
1403
1403
|
h in l || (l[h] = c[h]);
|
|
1404
1404
|
}
|
|
1405
1405
|
E(w, "merge"), s.extend("object", (l, { dict: c }, h, d) => {
|
|
1406
|
-
if (!
|
|
1406
|
+
if (!he(l)) throw new n(`expected object but got ${l}`, h);
|
|
1407
1407
|
const m = {};
|
|
1408
1408
|
for (const v in c) {
|
|
1409
1409
|
const x = g(l, v, c[v], h);
|
|
@@ -1421,26 +1421,26 @@ var z = class At {
|
|
|
1421
1421
|
if (!c.length) return [l];
|
|
1422
1422
|
let v;
|
|
1423
1423
|
for (const x of c) {
|
|
1424
|
-
const
|
|
1425
|
-
if (!I(
|
|
1424
|
+
const C = s.resolve(l, x, d, !0)[0];
|
|
1425
|
+
if (!I(C))
|
|
1426
1426
|
if (I(v))
|
|
1427
|
-
v =
|
|
1427
|
+
v = C;
|
|
1428
1428
|
else {
|
|
1429
|
-
if (typeof v != typeof
|
|
1429
|
+
if (typeof v != typeof C)
|
|
1430
1430
|
throw new n(`expected ${h()} but got ${JSON.stringify(l)}`, d);
|
|
1431
|
-
if (typeof
|
|
1432
|
-
w(v ??= {},
|
|
1433
|
-
else if (v !==
|
|
1431
|
+
if (typeof C == "object")
|
|
1432
|
+
w(v ??= {}, C);
|
|
1433
|
+
else if (v !== C)
|
|
1434
1434
|
throw new n(`expected ${h()} but got ${JSON.stringify(l)}`, d);
|
|
1435
1435
|
}
|
|
1436
1436
|
}
|
|
1437
|
-
return !m &&
|
|
1437
|
+
return !m && he(l) && w(v, l), [v];
|
|
1438
1438
|
}), s.extend("transform", (l, { inner: c, callback: h, preserve: d }, m) => {
|
|
1439
1439
|
const [v, x = l] = s.resolve(l, c, m, !0);
|
|
1440
1440
|
return d ? [h(v)] : [h(v), h(x)];
|
|
1441
1441
|
});
|
|
1442
1442
|
var O = {};
|
|
1443
|
-
function
|
|
1443
|
+
function A(l, c, h) {
|
|
1444
1444
|
O[l] = h, Object.assign(s, {
|
|
1445
1445
|
[l](...d) {
|
|
1446
1446
|
const m = new s({ type: l });
|
|
@@ -1456,22 +1456,22 @@ var z = class At {
|
|
|
1456
1456
|
m.list = d[x].map(s.from);
|
|
1457
1457
|
break;
|
|
1458
1458
|
case "dict":
|
|
1459
|
-
m.dict =
|
|
1459
|
+
m.dict = K(d[x], s.from);
|
|
1460
1460
|
break;
|
|
1461
1461
|
case "bits": {
|
|
1462
1462
|
m.bits = {};
|
|
1463
|
-
for (const
|
|
1464
|
-
typeof d[x][
|
|
1463
|
+
for (const C in d[x])
|
|
1464
|
+
typeof d[x][C] == "number" && (m.bits[C] = d[x][C]);
|
|
1465
1465
|
break;
|
|
1466
1466
|
}
|
|
1467
1467
|
case "callback": {
|
|
1468
|
-
const
|
|
1469
|
-
|
|
1468
|
+
const C = m.callback = d[x];
|
|
1469
|
+
C.toJSON ||= () => C.toString();
|
|
1470
1470
|
break;
|
|
1471
1471
|
}
|
|
1472
1472
|
case "constructor": {
|
|
1473
|
-
const
|
|
1474
|
-
typeof
|
|
1473
|
+
const C = m.constructor = d[x];
|
|
1474
|
+
typeof C == "function" && (C.toJSON ||= () => C.name);
|
|
1475
1475
|
break;
|
|
1476
1476
|
}
|
|
1477
1477
|
default:
|
|
@@ -1481,24 +1481,24 @@ var z = class At {
|
|
|
1481
1481
|
}
|
|
1482
1482
|
});
|
|
1483
1483
|
}
|
|
1484
|
-
E(
|
|
1484
|
+
E(A, "defineMethod"), A("is", ["constructor"], ({ constructor: l }) => typeof l == "function" ? l.name : l), A("any", [], () => "any"), A("never", [], () => "never"), A("const", ["value"], ({ value: l }) => typeof l == "string" ? JSON.stringify(l) : l), A("string", [], () => "string"), A("number", [], () => "number"), A("boolean", [], () => "boolean"), A("bitset", ["bits"], () => "bitset"), A("function", [], () => "function"), A("array", ["inner"], ({ inner: l }) => `${l.toString(!0)}[]`), A("dict", ["inner", "sKey"], ({ inner: l, sKey: c }) => `{ [key: ${c.toString()}]: ${l.toString()} }`), A("tuple", ["list"], ({ list: l }) => `[${l.map((c) => c.toString()).join(", ")}]`), A("object", ["dict"], ({ dict: l }) => Object.keys(l).length === 0 ? "{}" : `{ ${Object.entries(l).map(([c, h]) => `${c}${h.meta.required ? "" : "?"}: ${h.toString()}`).join(", ")} }`), A("union", ["list"], ({ list: l }, c) => {
|
|
1485
1485
|
const h = l.map(({ toString: d }) => d()).join(" | ");
|
|
1486
1486
|
return c ? `(${h})` : h;
|
|
1487
|
-
}),
|
|
1487
|
+
}), A("intersect", ["list"], ({ list: l }) => `${l.map((c) => c.toString(!0)).join(" & ")}`), A("transform", ["inner", "callback", "preserve"], ({ inner: l }, c) => l.toString(c)), e.exports = s;
|
|
1488
1488
|
}
|
|
1489
1489
|
});
|
|
1490
|
-
const $ =
|
|
1491
|
-
var
|
|
1492
|
-
const
|
|
1493
|
-
|
|
1494
|
-
const
|
|
1495
|
-
function
|
|
1490
|
+
const $ = sr();
|
|
1491
|
+
var Lt = /* @__PURE__ */ ((i) => (i[i.debug = -1] = "debug", i[i.log = 0] = "log", i[i.info = 1] = "info", i[i.warn = 2] = "warn", i[i.error = 3] = "error", i[i.silent = 4] = "silent", i))(Lt || {});
|
|
1492
|
+
const Re = globalThis || window, je = /* @__PURE__ */ Symbol.for("__IPE_LOGGER_COLOR_MAP__");
|
|
1493
|
+
Re[je] || (Re[je] = /* @__PURE__ */ new Map());
|
|
1494
|
+
const $e = Re[je];
|
|
1495
|
+
function ae(i) {
|
|
1496
1496
|
let e = 2166136261;
|
|
1497
1497
|
for (let t = 0; t < i.length; t++)
|
|
1498
1498
|
e ^= i.charCodeAt(t), e = (e >>> 0) * 16777619;
|
|
1499
1499
|
return e >>> 0;
|
|
1500
1500
|
}
|
|
1501
|
-
const
|
|
1501
|
+
const ut = [
|
|
1502
1502
|
[350, 360],
|
|
1503
1503
|
[0, 15],
|
|
1504
1504
|
[15, 30],
|
|
@@ -1510,8 +1510,8 @@ const lt = [
|
|
|
1510
1510
|
[140, 160],
|
|
1511
1511
|
[160, 180]
|
|
1512
1512
|
];
|
|
1513
|
-
function
|
|
1514
|
-
const t =
|
|
1513
|
+
function or(i, e) {
|
|
1514
|
+
const t = ut.length, r = ae(i) % t, [n, s] = ut[r], o = s - n, a = ae(i + ":" + e), f = n + a % (o || 1), u = ae(i + ":s"), p = ae(i + ":l");
|
|
1515
1515
|
let y, _;
|
|
1516
1516
|
if (e === "name")
|
|
1517
1517
|
y = 62 + u % 18, _ = 30 + p % 12;
|
|
@@ -1521,30 +1521,30 @@ function rr(i, e) {
|
|
|
1521
1521
|
}
|
|
1522
1522
|
return `hsl(${f}, ${y}%, ${_}%)`;
|
|
1523
1523
|
}
|
|
1524
|
-
function
|
|
1524
|
+
function ce(i, e) {
|
|
1525
1525
|
if (e)
|
|
1526
|
-
return
|
|
1527
|
-
const t =
|
|
1526
|
+
return $e.set(i, e), e;
|
|
1527
|
+
const t = $e.get(i);
|
|
1528
1528
|
if (t) return t;
|
|
1529
|
-
const r = i.startsWith("name:") ? "name" : "group", n =
|
|
1530
|
-
return
|
|
1529
|
+
const r = i.startsWith("name:") ? "name" : "group", n = or(i, r);
|
|
1530
|
+
return $e.set(i, n), n;
|
|
1531
1531
|
}
|
|
1532
|
-
class
|
|
1532
|
+
class Ke {
|
|
1533
1533
|
/**
|
|
1534
1534
|
* Note: constructor returns a callable Proxy so that you can do `logger('group')`.
|
|
1535
1535
|
*/
|
|
1536
1536
|
constructor(e = {}) {
|
|
1537
1537
|
this._custom = (t) => {
|
|
1538
|
-
if (!this._enabled(t.level)) return
|
|
1538
|
+
if (!this._enabled(t.level)) return ft;
|
|
1539
1539
|
const [r, n] = this._prefix(t.label);
|
|
1540
1540
|
return this._consoleMethod(t.method).bind(console, r, ...n);
|
|
1541
1541
|
}, this._name = e.name, this._nameColor = e.color, this._groupPath = e._groupPath ? [...e._groupPath] : [], this._dynamicLevels = { ...e._dynamicLevels }, this._levelRef = e._levelRef ?? {
|
|
1542
1542
|
value: e.level ?? 1
|
|
1543
1543
|
/* info */
|
|
1544
|
-
}, this._name &&
|
|
1544
|
+
}, this._name && ce(`name:${this._name}`, this._nameColor), this._installBuiltinLevels();
|
|
1545
1545
|
for (const t of Object.keys(this._dynamicLevels))
|
|
1546
1546
|
this._installLevelGetter(t, this._dynamicLevels[t]);
|
|
1547
|
-
return
|
|
1547
|
+
return cr(this);
|
|
1548
1548
|
}
|
|
1549
1549
|
// ---------- public API ----------
|
|
1550
1550
|
get level() {
|
|
@@ -1555,7 +1555,7 @@ class ze {
|
|
|
1555
1555
|
}
|
|
1556
1556
|
/** Create a sub-logger with a group label */
|
|
1557
1557
|
group(e, t) {
|
|
1558
|
-
return e &&
|
|
1558
|
+
return e && ce(`group:${e}`, t?.color), new Ke({
|
|
1559
1559
|
name: this._name,
|
|
1560
1560
|
color: this._nameColor,
|
|
1561
1561
|
_groupPath: [...this._groupPath, e],
|
|
@@ -1594,8 +1594,8 @@ class ze {
|
|
|
1594
1594
|
});
|
|
1595
1595
|
}
|
|
1596
1596
|
_method(e) {
|
|
1597
|
-
const t =
|
|
1598
|
-
if (!this._enabled(t.level)) return
|
|
1597
|
+
const t = ar[e];
|
|
1598
|
+
if (!this._enabled(t.level)) return ft;
|
|
1599
1599
|
const [r, n] = this._prefix(t.label);
|
|
1600
1600
|
return this._consoleMethod(e).bind(console, r, ...n);
|
|
1601
1601
|
}
|
|
@@ -1609,28 +1609,28 @@ class ze {
|
|
|
1609
1609
|
const t = [];
|
|
1610
1610
|
let r = "";
|
|
1611
1611
|
if (this._name) {
|
|
1612
|
-
const n =
|
|
1612
|
+
const n = ce(`name:${this._name}`, this._nameColor);
|
|
1613
1613
|
r += `%c${this._name}%c`, t.push(
|
|
1614
1614
|
`background:${n}; color:#fff; padding:1px 4px; border-radius:2px; font-weight:700;`,
|
|
1615
|
-
|
|
1615
|
+
dt
|
|
1616
1616
|
);
|
|
1617
1617
|
}
|
|
1618
1618
|
if (e && (r += ` ${e}`), this._groupPath.length) {
|
|
1619
|
-
const n = this._groupPath.join("/"), s =
|
|
1620
|
-
r += ` %c${n}%c`, t.push(`color:${s}; text-decoration: underline;`,
|
|
1619
|
+
const n = this._groupPath.join("/"), s = ce(`group:${n}`);
|
|
1620
|
+
r += ` %c${n}%c`, t.push(`color:${s}; text-decoration: underline;`, dt);
|
|
1621
1621
|
}
|
|
1622
1622
|
return [r, t];
|
|
1623
1623
|
}
|
|
1624
1624
|
}
|
|
1625
|
-
const
|
|
1626
|
-
},
|
|
1625
|
+
const ft = () => {
|
|
1626
|
+
}, dt = "color:inherit; background:transparent; text-decoration:none;", ar = {
|
|
1627
1627
|
debug: { level: -1, label: "", method: "debug" },
|
|
1628
1628
|
log: { level: 0, label: "", method: "log" },
|
|
1629
1629
|
info: { level: 1, label: "[I]", method: "info" },
|
|
1630
1630
|
warn: { level: 2, label: "[W]", method: "warn" },
|
|
1631
1631
|
error: { level: 3, label: "[E]", method: "error" }
|
|
1632
1632
|
};
|
|
1633
|
-
function
|
|
1633
|
+
function cr(i) {
|
|
1634
1634
|
const e = function(t, r) {
|
|
1635
1635
|
return i.group(t, r);
|
|
1636
1636
|
};
|
|
@@ -1649,10 +1649,10 @@ function sr(i) {
|
|
|
1649
1649
|
}
|
|
1650
1650
|
});
|
|
1651
1651
|
}
|
|
1652
|
-
function
|
|
1653
|
-
return new
|
|
1652
|
+
function lr(i) {
|
|
1653
|
+
return new Ke(i);
|
|
1654
1654
|
}
|
|
1655
|
-
class
|
|
1655
|
+
class De extends _i {
|
|
1656
1656
|
async clientLogin(e, t, r) {
|
|
1657
1657
|
r ||= {}, !r.logincontinue && !r.loginreturnurl && (r.loginreturnurl = location?.origin);
|
|
1658
1658
|
const n = await this.postWithToken(
|
|
@@ -1669,16 +1669,16 @@ class Re extends wi {
|
|
|
1669
1669
|
);
|
|
1670
1670
|
if (n?.data?.clientlogin?.status === "PASS")
|
|
1671
1671
|
return n.data.clientlogin;
|
|
1672
|
-
throw new
|
|
1673
|
-
|
|
1672
|
+
throw new xi(
|
|
1673
|
+
ki.LOGIN_FAILED,
|
|
1674
1674
|
n.data.clientlogin.message,
|
|
1675
1675
|
n
|
|
1676
1676
|
);
|
|
1677
1677
|
}
|
|
1678
1678
|
}
|
|
1679
|
-
class
|
|
1679
|
+
class hr extends De {
|
|
1680
1680
|
constructor(e, t, r) {
|
|
1681
|
-
const n =
|
|
1681
|
+
const n = Si(
|
|
1682
1682
|
e,
|
|
1683
1683
|
{
|
|
1684
1684
|
credentials: "include",
|
|
@@ -1693,10 +1693,10 @@ class ar extends Re {
|
|
|
1693
1693
|
super(n);
|
|
1694
1694
|
}
|
|
1695
1695
|
}
|
|
1696
|
-
class
|
|
1696
|
+
class ur {
|
|
1697
1697
|
constructor(e, t = {}) {
|
|
1698
1698
|
this.ctx = e, this.options = t, this._apiClients = /* @__PURE__ */ new Map(), location?.href && t?.baseURL?.toString()?.startsWith("/") && (t.baseURL = new URL(t.baseURL, location.origin));
|
|
1699
|
-
const r = this.api = new
|
|
1699
|
+
const r = this.api = new De({
|
|
1700
1700
|
baseURL: t.baseURL.toString(),
|
|
1701
1701
|
fexiosConfigs: {
|
|
1702
1702
|
headers: {
|
|
@@ -1717,7 +1717,7 @@ class cr {
|
|
|
1717
1717
|
const n = t.origin === location.origin, s = {
|
|
1718
1718
|
baseURL: t.toString(),
|
|
1719
1719
|
throwOnApiError: !0
|
|
1720
|
-
}, o = n ? new
|
|
1720
|
+
}, o = n ? new De(s) : new hr(s);
|
|
1721
1721
|
o.request.on("beforeRequest", (a) => {
|
|
1722
1722
|
a.headers = o.request.mergeHeaders(a.headers, {
|
|
1723
1723
|
"x-api-user-agent": null,
|
|
@@ -1728,81 +1728,97 @@ class cr {
|
|
|
1728
1728
|
return this._apiClients.get(r);
|
|
1729
1729
|
}
|
|
1730
1730
|
}
|
|
1731
|
-
const
|
|
1732
|
-
var
|
|
1731
|
+
const pt = (i, e = document) => e.querySelector(i), vs = (i, e = document) => e.querySelectorAll(i);
|
|
1732
|
+
var fr = Object.create, qe = Object.defineProperty, dr = Object.getOwnPropertyDescriptor, Rt = (i, e) => (e = Symbol[i]) ? e : /* @__PURE__ */ Symbol.for("Symbol." + i), jt = (i) => {
|
|
1733
1733
|
throw TypeError(i);
|
|
1734
|
-
},
|
|
1734
|
+
}, pr = (i, e, t) => e in i ? qe(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t, gr = (i, e) => qe(i, "name", { value: e, configurable: !0 }), mr = (i) => [, , , fr(i?.[Rt("metadata")] ?? null)], yr = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"], Dt = (i) => i !== void 0 && typeof i != "function" ? jt("Function expected") : i, wr = (i, e, t, r, n) => ({ kind: yr[i], name: e, metadata: r, addInitializer: (s) => t._ ? jt("Already initialized") : n.push(Dt(s || null)) }), br = (i, e) => pr(e, Rt("metadata"), i[3]), vr = (i, e, t, r) => {
|
|
1735
1735
|
for (var n = 0, s = i[e >> 1], o = s && s.length; n < o; n++) s[n].call(t);
|
|
1736
1736
|
return r;
|
|
1737
|
-
},
|
|
1738
|
-
var o, a, f, u = e & 7, p = !1, y = 0, _ = i[y] || (i[y] = []), g = u && (n = n.prototype, u < 5 && (u > 3 || !p) &&
|
|
1739
|
-
|
|
1737
|
+
}, _r = (i, e, t, r, n, s) => {
|
|
1738
|
+
var o, a, f, u = e & 7, p = !1, y = 0, _ = i[y] || (i[y] = []), g = u && (n = n.prototype, u < 5 && (u > 3 || !p) && dr(n, t));
|
|
1739
|
+
gr(n, t);
|
|
1740
1740
|
for (var w = r.length - 1; w >= 0; w--)
|
|
1741
|
-
f =
|
|
1742
|
-
return
|
|
1743
|
-
},
|
|
1744
|
-
|
|
1745
|
-
class
|
|
1741
|
+
f = wr(u, t, a = {}, i[3], _), o = (0, r[w])(n, f), a._ = 1, Dt(o) && (n = o);
|
|
1742
|
+
return br(i, n), g && qe(n, t, g), p ? u ^ 4 ? s : g : n;
|
|
1743
|
+
}, Tt, We, Nt;
|
|
1744
|
+
Tt = [F(["wiki", "wikiTitle"])];
|
|
1745
|
+
let de = class Z extends (Nt = z) {
|
|
1746
1746
|
constructor(e) {
|
|
1747
|
-
super(e, "currentPage", !1), this.ctx = e, this.url = new URL(window.location.href), this.isMainPage = void 0, this.wikiTitle = void 0;
|
|
1747
|
+
super(e, "currentPage", !1), this.ctx = e, this.#e = this.#r.bind(this), this.url = new URL(window.location.href), this.isMainPage = void 0, this.wikiTitle = void 0;
|
|
1748
1748
|
}
|
|
1749
1749
|
get logger() {
|
|
1750
1750
|
return this.ctx.logger("CURRENT_PAGE");
|
|
1751
1751
|
}
|
|
1752
|
+
static {
|
|
1753
|
+
this.HISTORY_CHANGE_EVENT = "inpageedit:historychange";
|
|
1754
|
+
}
|
|
1755
|
+
static {
|
|
1756
|
+
this.POPSTATE_INJECTION_KEY = /* @__PURE__ */ Symbol.for(
|
|
1757
|
+
"inpageedit:currentpage:popstateinjection"
|
|
1758
|
+
);
|
|
1759
|
+
}
|
|
1752
1760
|
async start() {
|
|
1753
|
-
await this.#
|
|
1761
|
+
await this.#t(), this.#i(), window.addEventListener(Z.HISTORY_CHANGE_EVENT, this.#e), this.ctx.emit("current-page/popstate"), this.logger.info("initialized", this.wikiTitle);
|
|
1754
1762
|
}
|
|
1755
1763
|
stop() {
|
|
1756
|
-
window.removeEventListener(
|
|
1764
|
+
window.removeEventListener(Z.HISTORY_CHANGE_EVENT, this.#e);
|
|
1757
1765
|
}
|
|
1758
|
-
async #
|
|
1759
|
-
await this.#
|
|
1766
|
+
async #t() {
|
|
1767
|
+
await this.#s(), await this.#n();
|
|
1760
1768
|
}
|
|
1769
|
+
/**
|
|
1770
|
+
* @NOTE
|
|
1771
|
+
* Do not use event name 'popstate' to listen to history change,
|
|
1772
|
+
* because it will cause conflict with some SPA frameworks (e.g. vue-router).
|
|
1773
|
+
*/
|
|
1761
1774
|
#i() {
|
|
1762
|
-
const e =
|
|
1775
|
+
const e = Z.POPSTATE_INJECTION_KEY;
|
|
1763
1776
|
if (window[e])
|
|
1764
1777
|
return;
|
|
1765
1778
|
const t = history.pushState, r = history.replaceState;
|
|
1766
1779
|
history.pushState = function(n, s, o) {
|
|
1767
|
-
t.apply(this, [n, s, o]), window.dispatchEvent(new
|
|
1780
|
+
t.apply(this, [n, s, o]), window.dispatchEvent(new CustomEvent(Z.HISTORY_CHANGE_EVENT));
|
|
1768
1781
|
}, history.replaceState = function(n, s, o) {
|
|
1769
|
-
r.apply(this, [n, s, o]), window.dispatchEvent(new
|
|
1782
|
+
r.apply(this, [n, s, o]), window.dispatchEvent(new CustomEvent(Z.HISTORY_CHANGE_EVENT));
|
|
1770
1783
|
}, window[e] = !0;
|
|
1771
1784
|
}
|
|
1772
|
-
async #
|
|
1773
|
-
const
|
|
1774
|
-
this.url =
|
|
1785
|
+
async #r() {
|
|
1786
|
+
const e = this.url, t = new URL(window.location.href);
|
|
1787
|
+
this.url = t, (e.pathname !== t.pathname || e.searchParams.get("title") !== t.searchParams.get("title") || e.searchParams.get("curid") !== t.searchParams.get("curid")) && (await this.#t(), this.ctx.emit("current-page/popstate"), this.logger.info("location changed", t, this.wikiTitle));
|
|
1775
1788
|
}
|
|
1789
|
+
#e;
|
|
1776
1790
|
get params() {
|
|
1777
1791
|
return this.url.searchParams;
|
|
1778
1792
|
}
|
|
1779
1793
|
get canonicalUrl() {
|
|
1780
|
-
const e = (
|
|
1794
|
+
const e = (pt('link[rel="alternate"][hreflang="x-default"]') || pt('link[rel="canonical"]'))?.href;
|
|
1781
1795
|
let t = null;
|
|
1782
1796
|
return e && (t = new URL(e, location.origin)), Reflect.defineProperty(this, "canonicalUrl", {
|
|
1783
1797
|
get: () => t
|
|
1784
1798
|
}), t;
|
|
1785
1799
|
}
|
|
1786
|
-
async #
|
|
1787
|
-
|
|
1788
|
-
return Reflect.defineProperty(this, "isMainPage", {
|
|
1800
|
+
async #n() {
|
|
1801
|
+
let t = this.wikiTitle?.getMainDBKey() === this.ctx.wiki.mainPageName;
|
|
1802
|
+
return t = this.ctx.bail("current-page/resolve-main-page", t) ?? t, Reflect.defineProperty(this, "isMainPage", {
|
|
1789
1803
|
get: () => t
|
|
1790
1804
|
}), t;
|
|
1791
1805
|
}
|
|
1792
|
-
async #
|
|
1806
|
+
async #s() {
|
|
1793
1807
|
let e = null;
|
|
1794
|
-
return this.canonicalUrl ? e = await this.ctx.wikiTitle.newTitleFromUrl(this.canonicalUrl) : e = await this.ctx.wikiTitle.newTitleFromUrl(this.url), Object.freeze(e), Reflect.defineProperty(this, "wikiTitle", {
|
|
1808
|
+
return this.canonicalUrl ? e = await this.ctx.wikiTitle.newTitleFromUrl(this.canonicalUrl) : e = await this.ctx.wikiTitle.newTitleFromUrl(this.url), e = this.ctx.bail("current-page/resolve-title", e) ?? e, Object.freeze(e), Reflect.defineProperty(this, "wikiTitle", {
|
|
1795
1809
|
get: () => e
|
|
1796
1810
|
}), e;
|
|
1797
1811
|
}
|
|
1798
1812
|
get wikiAction() {
|
|
1799
|
-
|
|
1813
|
+
const e = this.params.get("action") || "view";
|
|
1814
|
+
return this.ctx.bail("current-page/resolve-action", e) ?? e;
|
|
1800
1815
|
}
|
|
1801
|
-
}
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1816
|
+
};
|
|
1817
|
+
We = mr(Nt);
|
|
1818
|
+
de = _r(We, 0, "CurrentPageService", Tt, de);
|
|
1819
|
+
vr(We, 1, de);
|
|
1820
|
+
let xr = de;
|
|
1821
|
+
class kr extends z {
|
|
1806
1822
|
constructor(e) {
|
|
1807
1823
|
super(e, "resourceLoader", !0), this.ctx = e;
|
|
1808
1824
|
}
|
|
@@ -1851,40 +1867,40 @@ class br extends z {
|
|
|
1851
1867
|
return e.startsWith("http") || e.startsWith("//") ? e : import.meta.resolve(e);
|
|
1852
1868
|
}
|
|
1853
1869
|
}
|
|
1854
|
-
const
|
|
1855
|
-
function
|
|
1870
|
+
const xe = Object.keys;
|
|
1871
|
+
function Sr(i) {
|
|
1856
1872
|
return typeof i == "boolean";
|
|
1857
1873
|
}
|
|
1858
|
-
function
|
|
1874
|
+
function $r(i) {
|
|
1859
1875
|
return i && typeof i.nodeType == "number";
|
|
1860
1876
|
}
|
|
1861
|
-
function
|
|
1877
|
+
function Ge(i) {
|
|
1862
1878
|
return typeof i == "string";
|
|
1863
1879
|
}
|
|
1864
|
-
function
|
|
1880
|
+
function Mt(i) {
|
|
1865
1881
|
return typeof i == "number";
|
|
1866
1882
|
}
|
|
1867
|
-
function
|
|
1868
|
-
return typeof i == "object" ? i !== null :
|
|
1883
|
+
function J(i) {
|
|
1884
|
+
return typeof i == "object" ? i !== null : ne(i);
|
|
1869
1885
|
}
|
|
1870
|
-
function
|
|
1886
|
+
function ne(i) {
|
|
1871
1887
|
return typeof i == "function";
|
|
1872
1888
|
}
|
|
1873
|
-
function
|
|
1889
|
+
function Er(i) {
|
|
1874
1890
|
return !!(i && i.isComponent);
|
|
1875
1891
|
}
|
|
1876
|
-
function
|
|
1877
|
-
return
|
|
1892
|
+
function Ar(i) {
|
|
1893
|
+
return J(i) && typeof i.length == "number" && typeof i.nodeType != "number";
|
|
1878
1894
|
}
|
|
1879
|
-
function
|
|
1895
|
+
function Te(i, e) {
|
|
1880
1896
|
if (i)
|
|
1881
|
-
for (const t of
|
|
1897
|
+
for (const t of xe(i))
|
|
1882
1898
|
e(i[t], t);
|
|
1883
1899
|
}
|
|
1884
|
-
function
|
|
1885
|
-
return
|
|
1900
|
+
function Cr(i) {
|
|
1901
|
+
return J(i) && "current" in i;
|
|
1886
1902
|
}
|
|
1887
|
-
const
|
|
1903
|
+
const Ne = {
|
|
1888
1904
|
animationIterationCount: 0,
|
|
1889
1905
|
borderImageOutset: 0,
|
|
1890
1906
|
borderImageSlice: 0,
|
|
@@ -1929,30 +1945,30 @@ const De = {
|
|
|
1929
1945
|
strokeOpacity: 0,
|
|
1930
1946
|
strokeWidth: 0
|
|
1931
1947
|
};
|
|
1932
|
-
function
|
|
1948
|
+
function Or(i, e) {
|
|
1933
1949
|
return i + e.charAt(0).toUpperCase() + e.substring(1);
|
|
1934
1950
|
}
|
|
1935
|
-
const
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1951
|
+
const Pr = ["Webkit", "ms", "Moz", "O"];
|
|
1952
|
+
xe(Ne).forEach((i) => {
|
|
1953
|
+
Pr.forEach((e) => {
|
|
1954
|
+
Ne[Or(e, i)] = 0;
|
|
1939
1955
|
});
|
|
1940
1956
|
});
|
|
1941
|
-
const
|
|
1942
|
-
var
|
|
1957
|
+
const Ir = /* @__PURE__ */ Symbol.for("jsx-dom:type");
|
|
1958
|
+
var Bt = /* @__PURE__ */ (function(i) {
|
|
1943
1959
|
return i.ShadowRoot = "ShadowRoot", i;
|
|
1944
|
-
})(
|
|
1945
|
-
function
|
|
1946
|
-
return i != null && i[
|
|
1960
|
+
})(Bt || {});
|
|
1961
|
+
function Lr(i) {
|
|
1962
|
+
return i != null && i[Ir] === Bt.ShadowRoot;
|
|
1947
1963
|
}
|
|
1948
|
-
const
|
|
1949
|
-
function
|
|
1950
|
-
return !
|
|
1964
|
+
const Rr = "http://www.w3.org/2000/svg", jr = "http://www.w3.org/1999/xlink", Dr = "http://www.w3.org/XML/1998/namespace";
|
|
1965
|
+
function Ut(i) {
|
|
1966
|
+
return !Sr(i) && i != null;
|
|
1951
1967
|
}
|
|
1952
|
-
function
|
|
1953
|
-
return Array.isArray(i) ? i.map(
|
|
1968
|
+
function Me(i) {
|
|
1969
|
+
return Array.isArray(i) ? i.map(Me).filter(Boolean).join(" ") : J(i) ? Symbol.iterator in i ? Me(Array.from(i)) : xe(i).filter((e) => i[e]).join(" ") : Ut(i) ? "" + i : "";
|
|
1954
1970
|
}
|
|
1955
|
-
const
|
|
1971
|
+
const Tr = {
|
|
1956
1972
|
animate: 0,
|
|
1957
1973
|
circle: 0,
|
|
1958
1974
|
clipPath: 0,
|
|
@@ -2007,28 +2023,28 @@ const Lr = {
|
|
|
2007
2023
|
tspan: 0,
|
|
2008
2024
|
use: 0,
|
|
2009
2025
|
view: 0
|
|
2010
|
-
},
|
|
2011
|
-
function
|
|
2026
|
+
}, Nr = /^(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)/;
|
|
2027
|
+
function Mr(i) {
|
|
2012
2028
|
const e = document.createDocumentFragment();
|
|
2013
|
-
return
|
|
2029
|
+
return ke(i.children, e), e;
|
|
2014
2030
|
}
|
|
2015
|
-
function
|
|
2031
|
+
function Br(i, e, t) {
|
|
2016
2032
|
e = {
|
|
2017
2033
|
...e,
|
|
2018
2034
|
children: t
|
|
2019
2035
|
};
|
|
2020
2036
|
const r = new i(e), n = r.render();
|
|
2021
|
-
return "ref" in e &&
|
|
2037
|
+
return "ref" in e && Ve(e.ref, r), n;
|
|
2022
2038
|
}
|
|
2023
2039
|
function P(i, e) {
|
|
2024
2040
|
let { children: t, ...r } = e;
|
|
2025
|
-
!r.namespaceURI &&
|
|
2041
|
+
!r.namespaceURI && Tr[i] === 0 && (r = {
|
|
2026
2042
|
...r,
|
|
2027
|
-
namespaceURI:
|
|
2043
|
+
namespaceURI: Rr
|
|
2028
2044
|
});
|
|
2029
2045
|
let n;
|
|
2030
|
-
if (
|
|
2031
|
-
if (n = r.namespaceURI ? document.createElementNS(r.namespaceURI, i) : document.createElement(i),
|
|
2046
|
+
if (Ge(i)) {
|
|
2047
|
+
if (n = r.namespaceURI ? document.createElementNS(r.namespaceURI, i) : document.createElement(i), zr(r, n), ke(t, n), n instanceof window.HTMLSelectElement && r.value != null)
|
|
2032
2048
|
if (r.multiple === !0 && Array.isArray(r.value)) {
|
|
2033
2049
|
const s = r.value.map((o) => String(o));
|
|
2034
2050
|
n.querySelectorAll("option").forEach(
|
|
@@ -2036,12 +2052,12 @@ function P(i, e) {
|
|
|
2036
2052
|
);
|
|
2037
2053
|
} else
|
|
2038
2054
|
n.value = r.value;
|
|
2039
|
-
|
|
2040
|
-
} else if (
|
|
2041
|
-
|
|
2055
|
+
Ve(r.ref, n);
|
|
2056
|
+
} else if (ne(i))
|
|
2057
|
+
J(i.defaultProps) && (r = {
|
|
2042
2058
|
...i.defaultProps,
|
|
2043
2059
|
...r
|
|
2044
|
-
}), n =
|
|
2060
|
+
}), n = Er(i) ? Br(i, r, t) : i({
|
|
2045
2061
|
...r,
|
|
2046
2062
|
children: t
|
|
2047
2063
|
});
|
|
@@ -2049,40 +2065,40 @@ function P(i, e) {
|
|
|
2049
2065
|
throw new TypeError(`Invalid JSX element type: ${i}`);
|
|
2050
2066
|
return n;
|
|
2051
2067
|
}
|
|
2052
|
-
function
|
|
2053
|
-
|
|
2068
|
+
function Ve(i, e) {
|
|
2069
|
+
Cr(i) ? i.current = e : ne(i) && i(e);
|
|
2054
2070
|
}
|
|
2055
|
-
function
|
|
2056
|
-
if (
|
|
2057
|
-
|
|
2058
|
-
else if (
|
|
2059
|
-
|
|
2071
|
+
function ke(i, e) {
|
|
2072
|
+
if (Ar(i))
|
|
2073
|
+
Ur(i, e);
|
|
2074
|
+
else if (Ge(i) || Mt(i))
|
|
2075
|
+
Ee(document.createTextNode(i), e);
|
|
2060
2076
|
else if (i === null)
|
|
2061
|
-
|
|
2062
|
-
else if (
|
|
2063
|
-
|
|
2064
|
-
else if (
|
|
2077
|
+
Ee(document.createComment(""), e);
|
|
2078
|
+
else if ($r(i))
|
|
2079
|
+
Ee(i, e);
|
|
2080
|
+
else if (Lr(i)) {
|
|
2065
2081
|
const t = e.attachShadow(i.attr);
|
|
2066
|
-
|
|
2082
|
+
ke(i.children, t), Ve(i.ref, t);
|
|
2067
2083
|
}
|
|
2068
2084
|
}
|
|
2069
|
-
function
|
|
2085
|
+
function Ur(i, e) {
|
|
2070
2086
|
for (const t of [...i])
|
|
2071
|
-
|
|
2087
|
+
ke(t, e);
|
|
2072
2088
|
return e;
|
|
2073
2089
|
}
|
|
2074
|
-
function
|
|
2090
|
+
function Ee(i, e) {
|
|
2075
2091
|
e instanceof window.HTMLTemplateElement ? e.content.appendChild(i) : e.appendChild(i);
|
|
2076
2092
|
}
|
|
2077
|
-
function
|
|
2093
|
+
function le(i, e) {
|
|
2078
2094
|
return i.replace(/[A-Z]/g, (t) => e + t.toLowerCase());
|
|
2079
2095
|
}
|
|
2080
|
-
function
|
|
2081
|
-
e == null || e === !1 || (Array.isArray(e) ? e.forEach((t) =>
|
|
2082
|
-
r.indexOf("-") === 0 ? i.style.setProperty(r, t) :
|
|
2096
|
+
function Ft(i, e) {
|
|
2097
|
+
e == null || e === !1 || (Array.isArray(e) ? e.forEach((t) => Ft(i, t)) : Ge(e) ? i.setAttribute("style", e) : J(e) && Te(e, (t, r) => {
|
|
2098
|
+
r.indexOf("-") === 0 ? i.style.setProperty(r, t) : Mt(t) && Ne[r] !== 0 ? i.style[r] = t + "px" : i.style[r] = t;
|
|
2083
2099
|
}));
|
|
2084
2100
|
}
|
|
2085
|
-
function
|
|
2101
|
+
function Fr(i, e, t) {
|
|
2086
2102
|
switch (i) {
|
|
2087
2103
|
case "xlinkActuate":
|
|
2088
2104
|
case "xlinkArcrole":
|
|
@@ -2091,15 +2107,15 @@ function Mr(i, e, t) {
|
|
|
2091
2107
|
case "xlinkShow":
|
|
2092
2108
|
case "xlinkTitle":
|
|
2093
2109
|
case "xlinkType":
|
|
2094
|
-
|
|
2110
|
+
gt(t, jr, le(i, ":"), e);
|
|
2095
2111
|
return;
|
|
2096
2112
|
case "xmlnsXlink":
|
|
2097
|
-
X(t,
|
|
2113
|
+
X(t, le(i, ":"), e);
|
|
2098
2114
|
return;
|
|
2099
2115
|
case "xmlBase":
|
|
2100
2116
|
case "xmlLang":
|
|
2101
2117
|
case "xmlSpace":
|
|
2102
|
-
|
|
2118
|
+
gt(t, Dr, le(i, ":"), e);
|
|
2103
2119
|
return;
|
|
2104
2120
|
}
|
|
2105
2121
|
switch (i) {
|
|
@@ -2107,17 +2123,17 @@ function Mr(i, e, t) {
|
|
|
2107
2123
|
X(t, "for", e);
|
|
2108
2124
|
return;
|
|
2109
2125
|
case "dataset":
|
|
2110
|
-
|
|
2126
|
+
Te(e, (r, n) => {
|
|
2111
2127
|
r != null && (t.dataset[n] = r);
|
|
2112
2128
|
});
|
|
2113
2129
|
return;
|
|
2114
2130
|
case "innerHTML":
|
|
2115
2131
|
case "innerText":
|
|
2116
2132
|
case "textContent":
|
|
2117
|
-
|
|
2133
|
+
Ut(e) && (t[i] = e);
|
|
2118
2134
|
return;
|
|
2119
2135
|
case "dangerouslySetInnerHTML":
|
|
2120
|
-
|
|
2136
|
+
J(e) && (t.innerHTML = e.__html);
|
|
2121
2137
|
return;
|
|
2122
2138
|
case "value":
|
|
2123
2139
|
if (e == null || t instanceof window.HTMLSelectElement)
|
|
@@ -2132,22 +2148,22 @@ function Mr(i, e, t) {
|
|
|
2132
2148
|
return;
|
|
2133
2149
|
case "class":
|
|
2134
2150
|
case "className":
|
|
2135
|
-
|
|
2151
|
+
ne(e) ? e(t) : X(t, "class", Me(e));
|
|
2136
2152
|
return;
|
|
2137
2153
|
case "ref":
|
|
2138
2154
|
case "namespaceURI":
|
|
2139
2155
|
return;
|
|
2140
2156
|
case "style":
|
|
2141
|
-
|
|
2157
|
+
Ft(t, e);
|
|
2142
2158
|
return;
|
|
2143
2159
|
case "on":
|
|
2144
2160
|
case "onCapture":
|
|
2145
|
-
|
|
2161
|
+
Te(e, (r, n) => {
|
|
2146
2162
|
t.addEventListener(n, r, i === "onCapture");
|
|
2147
2163
|
});
|
|
2148
2164
|
return;
|
|
2149
2165
|
}
|
|
2150
|
-
if (
|
|
2166
|
+
if (ne(e)) {
|
|
2151
2167
|
if (i[0] === "o" && i[1] === "n") {
|
|
2152
2168
|
let r = i.toLowerCase();
|
|
2153
2169
|
const n = r.endsWith("capture");
|
|
@@ -2164,30 +2180,30 @@ function Mr(i, e, t) {
|
|
|
2164
2180
|
r in window ? s = r.substring(2) : s = r[2] + i.slice(3), t.addEventListener(s, e);
|
|
2165
2181
|
}
|
|
2166
2182
|
}
|
|
2167
|
-
} else
|
|
2183
|
+
} else J(e) ? t[i] = e : e === !0 ? X(t, i, "") : e !== !1 && e != null && (t instanceof SVGElement && !Nr.test(i) ? X(t, le(i, "-"), e) : X(t, i, e));
|
|
2168
2184
|
}
|
|
2169
2185
|
function X(i, e, t) {
|
|
2170
2186
|
i.setAttribute(e, t);
|
|
2171
2187
|
}
|
|
2172
|
-
function
|
|
2188
|
+
function gt(i, e, t, r) {
|
|
2173
2189
|
i.setAttributeNS(e, t, r);
|
|
2174
2190
|
}
|
|
2175
|
-
function
|
|
2176
|
-
for (const t of
|
|
2177
|
-
|
|
2191
|
+
function zr(i, e) {
|
|
2192
|
+
for (const t of xe(i))
|
|
2193
|
+
Fr(t, i[t], e);
|
|
2178
2194
|
return e;
|
|
2179
2195
|
}
|
|
2180
|
-
var
|
|
2181
|
-
let
|
|
2182
|
-
const
|
|
2183
|
-
function
|
|
2196
|
+
var Ye = /* @__PURE__ */ ((i) => (i.Init = "modal.init", i.BeforeShow = "modal.beforeShow", i.Show = "modal.show", i.BeforeClose = "modal.beforeClose", i.Close = "modal.close", i.Destroy = "modal.destroy", i.ToastShow = "toast.show", i.ToastClose = "toast.close", i))(Ye || {});
|
|
2197
|
+
let Hr = 0;
|
|
2198
|
+
const mt = (i) => `${i}-${++Hr}`;
|
|
2199
|
+
function ee(i) {
|
|
2184
2200
|
return i instanceof Node ? i : document.createTextNode(String(i));
|
|
2185
2201
|
}
|
|
2186
|
-
function
|
|
2202
|
+
function H(i, e) {
|
|
2187
2203
|
if (!i) throw new Error(`${e ?? "Element"} not found`);
|
|
2188
2204
|
return i;
|
|
2189
2205
|
}
|
|
2190
|
-
function
|
|
2206
|
+
function yt(i) {
|
|
2191
2207
|
const e = [
|
|
2192
2208
|
"a[href]",
|
|
2193
2209
|
"button:not([disabled])",
|
|
@@ -2206,8 +2222,8 @@ function D(i, e = {}) {
|
|
|
2206
2222
|
for (const [r, n] of Object.entries(e.attrs)) t.setAttribute(r, n);
|
|
2207
2223
|
return t;
|
|
2208
2224
|
}
|
|
2209
|
-
const
|
|
2210
|
-
function
|
|
2225
|
+
const Kr = typeof navigator < "u" && /Mac|iPhone|iPad|iPod/i.test(navigator.platform), zt = ["ctrl", "alt", "shift", "meta"];
|
|
2226
|
+
function qr(i) {
|
|
2211
2227
|
if (!i) return null;
|
|
2212
2228
|
const e = String(i).trim().toLowerCase().split(/[+\-\s]+/g).filter(Boolean), t = [];
|
|
2213
2229
|
let r = null;
|
|
@@ -2233,23 +2249,23 @@ function Fr(i) {
|
|
|
2233
2249
|
continue;
|
|
2234
2250
|
}
|
|
2235
2251
|
if (a === "mod") {
|
|
2236
|
-
n(
|
|
2252
|
+
n(Kr ? "meta" : "ctrl");
|
|
2237
2253
|
continue;
|
|
2238
2254
|
}
|
|
2239
2255
|
a === "esc" && (a = "escape"), a === "return" && (a = "enter"), (a === "space" || a === "spacebar") && (a = "space"), r = a;
|
|
2240
2256
|
}
|
|
2241
|
-
const s =
|
|
2257
|
+
const s = zt.filter((o) => t.includes(o));
|
|
2242
2258
|
return !r || r === "" ? s.length ? s.join("+") : null : s.length ? `${s.join("+")}+${r}` : r;
|
|
2243
2259
|
}
|
|
2244
|
-
function
|
|
2260
|
+
function Wr(i) {
|
|
2245
2261
|
const e = [];
|
|
2246
2262
|
i.ctrlKey && e.push("ctrl"), i.altKey && e.push("alt"), i.shiftKey && e.push("shift"), i.metaKey && e.push("meta");
|
|
2247
2263
|
let t = i.key;
|
|
2248
2264
|
t === " " && (t = "space");
|
|
2249
|
-
const r = (t.length, t.toLowerCase()), n =
|
|
2265
|
+
const r = (t.length, t.toLowerCase()), n = zt.filter((s) => e.includes(s));
|
|
2250
2266
|
return n.length ? `${n.join("+")}+${r}` : r;
|
|
2251
2267
|
}
|
|
2252
|
-
class
|
|
2268
|
+
class Gr {
|
|
2253
2269
|
constructor() {
|
|
2254
2270
|
this.zBase = 1e3, this.stack = [];
|
|
2255
2271
|
}
|
|
@@ -2282,10 +2298,10 @@ class Kr {
|
|
|
2282
2298
|
document.body.classList.remove("ipe-modal-no-scroll");
|
|
2283
2299
|
}
|
|
2284
2300
|
}
|
|
2285
|
-
const T = new
|
|
2286
|
-
class
|
|
2301
|
+
const T = new Gr();
|
|
2302
|
+
class pe {
|
|
2287
2303
|
constructor(e = {}) {
|
|
2288
|
-
this.backdropId =
|
|
2304
|
+
this.backdropId = mt("ipe-modal-backdrop"), this.modalId = mt("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 = Ye, this._hooks = [], this.startCloseTimer = (t) => {
|
|
2289
2305
|
this.stopCloseTimer(), this.closeTimer = window.setTimeout(() => this.close(), t);
|
|
2290
2306
|
}, this.stopCloseTimer = () => {
|
|
2291
2307
|
this.closeTimer && window.clearTimeout(this.closeTimer), this.closeTimer = void 0;
|
|
@@ -2301,7 +2317,7 @@ class de {
|
|
|
2301
2317
|
t.classList.remove("is-dragging"), r.style.animation = "none", requestAnimationFrame(() => {
|
|
2302
2318
|
this.applyAnimation(!0);
|
|
2303
2319
|
});
|
|
2304
|
-
}, this.options = { ...
|
|
2320
|
+
}, this.options = { ...pe.DEFAULT_OPTIONS, ...e }, this.options.backdrop === !1 && e.bodyScroll === void 0 && (this.options.bodyScroll = !0);
|
|
2305
2321
|
}
|
|
2306
2322
|
get isDestroyed() {
|
|
2307
2323
|
return this._isDestroyed;
|
|
@@ -2377,7 +2393,7 @@ class de {
|
|
|
2377
2393
|
}), _ = D("div", {
|
|
2378
2394
|
className: "ipe-modal-modal__buttons ipe-modal-modal__buttons--right"
|
|
2379
2395
|
});
|
|
2380
|
-
return p.append(y, _), n.append(s, u, p), r.appendChild(n), this.$backdrop = t, this.$modal = r, this.$window = n, this.$header = s, this.$title = a, this.$icons = f, this.$content = u, this.$footer = p, this.$buttonsLeft = y, this.$buttonsRight = _, this.options.title && this.setTitle(this.options.title), this.options.content && this.setContent(this.options.content), this.options.buttons?.length ? this.setButtons(this.options.buttons) : p.style.display = "none", this.options.center && this.$modal.classList.add("is-centered"), this.options.fitScreen && this.$modal.classList.add("is-fullscreen"), this.options.iconButtons && this.$header.classList.add("has-icon-buttons"), this.options.className && this.$window.classList.add(...this.options.className.split(/[\s\.#+]+/g).filter(Boolean)), typeof this.options.fixedHeight == "number" ? this.$window.style.height = `${Math.max(0, this.options.fixedHeight)}px` : this.options.fixedHeight === !0 && this.$window.classList.add("is-fixed-height"), t && t.addEventListener("
|
|
2396
|
+
return p.append(y, _), n.append(s, u, p), r.appendChild(n), this.$backdrop = t, this.$modal = r, this.$window = n, this.$header = s, this.$title = a, this.$icons = f, this.$content = u, this.$footer = p, this.$buttonsLeft = y, this.$buttonsRight = _, this.options.title && this.setTitle(this.options.title), this.options.content && this.setContent(this.options.content), this.options.buttons?.length ? this.setButtons(this.options.buttons) : p.style.display = "none", this.options.center && this.$modal.classList.add("is-centered"), this.options.fitScreen && this.$modal.classList.add("is-fullscreen"), this.options.iconButtons && this.$header.classList.add("has-icon-buttons"), this.options.className && this.$window.classList.add(...this.options.className.split(/[\s\.#+]+/g).filter(Boolean)), typeof this.options.fixedHeight == "number" ? this.$window.style.height = `${Math.max(0, this.options.fixedHeight)}px` : this.options.fixedHeight === !0 && this.$window.classList.add("is-fixed-height"), t && t.addEventListener("pointerup", (g) => {
|
|
2381
2397
|
this.options.outSideClose && g.target === t && this.close();
|
|
2382
2398
|
}), this.options.draggable && n.addEventListener("pointerdown", (g) => {
|
|
2383
2399
|
g.target && n.contains(g.target) && this.bringToFront();
|
|
@@ -2463,34 +2479,34 @@ class de {
|
|
|
2463
2479
|
return this.$backdrop;
|
|
2464
2480
|
}
|
|
2465
2481
|
get$modal() {
|
|
2466
|
-
return
|
|
2482
|
+
return H(this.$modal, "modal");
|
|
2467
2483
|
}
|
|
2468
2484
|
get$window() {
|
|
2469
|
-
return
|
|
2485
|
+
return H(this.$window, "window");
|
|
2470
2486
|
}
|
|
2471
2487
|
get$header() {
|
|
2472
|
-
return
|
|
2488
|
+
return H(this.$header, "header");
|
|
2473
2489
|
}
|
|
2474
2490
|
get$title() {
|
|
2475
|
-
return
|
|
2491
|
+
return H(this.$title, "title");
|
|
2476
2492
|
}
|
|
2477
2493
|
get$content() {
|
|
2478
|
-
return
|
|
2494
|
+
return H(this.$content, "content");
|
|
2479
2495
|
}
|
|
2480
2496
|
get$icons() {
|
|
2481
|
-
return
|
|
2497
|
+
return H(this.$icons, "icons");
|
|
2482
2498
|
}
|
|
2483
2499
|
get$buttons(e) {
|
|
2484
|
-
return e === "leftButtons" ?
|
|
2500
|
+
return e === "leftButtons" ? H(this.$buttonsLeft, "leftButtons") : e === "rightButtons" ? H(this.$buttonsRight, "rightButtons") : H(this.$footer, "buttons");
|
|
2485
2501
|
}
|
|
2486
2502
|
// ------------------------------ content ------------------------------- //
|
|
2487
2503
|
setTitle(e) {
|
|
2488
2504
|
const t = this.get$title();
|
|
2489
|
-
return t.innerHTML = "", t.append(
|
|
2505
|
+
return t.innerHTML = "", t.append(ee(e)), this;
|
|
2490
2506
|
}
|
|
2491
2507
|
setContent(e, t = "replace") {
|
|
2492
2508
|
const r = this.get$content();
|
|
2493
|
-
return t === "replace" ? (r.innerHTML = "", r.append(
|
|
2509
|
+
return t === "replace" ? (r.innerHTML = "", r.append(ee(e))) : t === "append" ? r.append(ee(e)) : r.prepend(ee(e)), this;
|
|
2494
2510
|
}
|
|
2495
2511
|
setIcons(e) {
|
|
2496
2512
|
const t = this.get$icons();
|
|
@@ -2522,7 +2538,7 @@ class de {
|
|
|
2522
2538
|
generateButton(e) {
|
|
2523
2539
|
const t = e.type ?? "button", r = t === "link" ? D("a") : D("button", { attrs: { type: "button" } });
|
|
2524
2540
|
e.id && (r.id = e.id), r.className = `ipe-modal-btn ${e.className ?? ""}`.trim();
|
|
2525
|
-
const n =
|
|
2541
|
+
const n = ee(e.label ?? "OK");
|
|
2526
2542
|
if (r.append(n), t === "link" && e.href && (r.href = e.href), e.method && r.addEventListener("click", (s) => {
|
|
2527
2543
|
if (r._ipe_tmpDisabled) {
|
|
2528
2544
|
s.preventDefault(), s.stopPropagation();
|
|
@@ -2541,7 +2557,7 @@ class de {
|
|
|
2541
2557
|
if (e.keyPress) {
|
|
2542
2558
|
const s = String(e.keyPress).split(/[\,\|]+/g).map((o) => o.trim()).filter(Boolean);
|
|
2543
2559
|
for (const o of s) {
|
|
2544
|
-
const a =
|
|
2560
|
+
const a = qr(o);
|
|
2545
2561
|
a && this.keyMap.set(a, r);
|
|
2546
2562
|
}
|
|
2547
2563
|
}
|
|
@@ -2610,7 +2626,7 @@ class de {
|
|
|
2610
2626
|
return (!s.dispatchEvent(o) || o.defaultPrevented) && (n = !1), n;
|
|
2611
2627
|
}
|
|
2612
2628
|
focusFirst() {
|
|
2613
|
-
const e = this.get$modal(), t =
|
|
2629
|
+
const e = this.get$modal(), t = yt(e);
|
|
2614
2630
|
t.length ? t[0].focus() : e.focus({ preventScroll: !0 });
|
|
2615
2631
|
}
|
|
2616
2632
|
onKeyDown(e) {
|
|
@@ -2622,7 +2638,7 @@ class de {
|
|
|
2622
2638
|
const t = this.get$modal();
|
|
2623
2639
|
if (!t.contains(document.activeElement)) return;
|
|
2624
2640
|
if (e.key === "Tab") {
|
|
2625
|
-
const a =
|
|
2641
|
+
const a = yt(t);
|
|
2626
2642
|
if (!a.length) return;
|
|
2627
2643
|
const f = a[0], u = a[a.length - 1], p = document.activeElement;
|
|
2628
2644
|
e.shiftKey && p === f ? (e.preventDefault(), u.focus()) : !e.shiftKey && p === u && (e.preventDefault(), f.focus());
|
|
@@ -2630,7 +2646,7 @@ class de {
|
|
|
2630
2646
|
const r = e.ctrlKey || e.altKey || e.metaKey, n = e.target;
|
|
2631
2647
|
if (!r && (n && ["INPUT", "TEXTAREA"].includes(n.tagName) || n.contentEditable === "true"))
|
|
2632
2648
|
return;
|
|
2633
|
-
const s =
|
|
2649
|
+
const s = Wr(e), o = this.keyMap.get(s);
|
|
2634
2650
|
if (o) {
|
|
2635
2651
|
e.preventDefault(), o.click();
|
|
2636
2652
|
return;
|
|
@@ -2668,7 +2684,7 @@ class de {
|
|
|
2668
2684
|
/** Show as toast (no backdrop, container stack). */
|
|
2669
2685
|
showToast(e) {
|
|
2670
2686
|
this.$window || this.init();
|
|
2671
|
-
const t =
|
|
2687
|
+
const t = Vr(e.position ?? "top right"), r = this.get$window();
|
|
2672
2688
|
this.isToast = !0, r.style.pointerEvents = "auto", this.applyAnimation(!0), t.appendChild(r);
|
|
2673
2689
|
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;
|
|
2674
2690
|
return n > 0 && (this.startCloseTimer(n), s && (r.addEventListener("mouseenter", this.stopCloseTimer), r.addEventListener("mouseleave", () => this.startCloseTimer(n)))), this.isOpen = !0, this.options.onShow?.(this), V.push(this), this.emit(
|
|
@@ -2702,7 +2718,7 @@ class de {
|
|
|
2702
2718
|
return T.closeAll(e, t), [...V].forEach((s) => {
|
|
2703
2719
|
const o = s.modalId, a = n.size ? n.has(s.pluginName) : !0, f = r.has(o);
|
|
2704
2720
|
a && !f && s.close();
|
|
2705
|
-
}), T.top() ?? new
|
|
2721
|
+
}), T.top() ?? new pe();
|
|
2706
2722
|
}
|
|
2707
2723
|
static removeAll() {
|
|
2708
2724
|
T.removeAll(), [...V].forEach((e) => e.destroy());
|
|
@@ -2865,7 +2881,7 @@ class de {
|
|
|
2865
2881
|
t.title = a[0].toUpperCase() + a.slice(1).toLowerCase();
|
|
2866
2882
|
}
|
|
2867
2883
|
const n = t.icon ?? this.getDefaultNotifyIcon(e);
|
|
2868
|
-
n && (n instanceof Element && n.classList.add("ipe-modal-notify-icon"), t.title = /* @__PURE__ */ P(
|
|
2884
|
+
n && (n instanceof Element && n.classList.add("ipe-modal-notify-icon"), t.title = /* @__PURE__ */ P(Mr, { children: [
|
|
2869
2885
|
n,
|
|
2870
2886
|
t.title
|
|
2871
2887
|
] })), 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, f) => {
|
|
@@ -2892,7 +2908,7 @@ class de {
|
|
|
2892
2908
|
}
|
|
2893
2909
|
}
|
|
2894
2910
|
const V = [];
|
|
2895
|
-
function
|
|
2911
|
+
function Vr(i = "top right") {
|
|
2896
2912
|
const e = "ipe-modal-toast-container", t = `${e}-${i.replace(/[\s-\.|\/]+/g, "-")}`;
|
|
2897
2913
|
let r = document.getElementById(t);
|
|
2898
2914
|
return r || (r = D("div", {
|
|
@@ -2900,7 +2916,7 @@ function qr(i = "top right") {
|
|
|
2900
2916
|
attrs: { id: t, "data-position": i }
|
|
2901
2917
|
}), document.body.appendChild(r)), r;
|
|
2902
2918
|
}
|
|
2903
|
-
class R extends
|
|
2919
|
+
class R extends pe {
|
|
2904
2920
|
constructor(e = {}) {
|
|
2905
2921
|
e.className ||= "", e.className += " theme-ipe", e.modalAnimation ||= {
|
|
2906
2922
|
show: "ipe-modal-fade-in",
|
|
@@ -2915,7 +2931,7 @@ class R extends de {
|
|
|
2915
2931
|
this._tmpDisabledActiveInputs = t, t.forEach((r) => {
|
|
2916
2932
|
r.disabled = !0;
|
|
2917
2933
|
}), this.get$content().append(
|
|
2918
|
-
/* @__PURE__ */
|
|
2934
|
+
/* @__PURE__ */ N(
|
|
2919
2935
|
"div",
|
|
2920
2936
|
{
|
|
2921
2937
|
id: "ipe-modalLoadingWrapper",
|
|
@@ -2931,7 +2947,7 @@ class R extends de {
|
|
|
2931
2947
|
backgroundColor: "rgba(255, 255, 255, 0.5)",
|
|
2932
2948
|
zIndex: 2e3
|
|
2933
2949
|
},
|
|
2934
|
-
children: /* @__PURE__ */
|
|
2950
|
+
children: /* @__PURE__ */ N(Oi, { style: { width: "80%", maxWidth: "800px" } })
|
|
2935
2951
|
}
|
|
2936
2952
|
)
|
|
2937
2953
|
);
|
|
@@ -2944,14 +2960,14 @@ class R extends de {
|
|
|
2944
2960
|
}
|
|
2945
2961
|
}
|
|
2946
2962
|
}
|
|
2947
|
-
class
|
|
2963
|
+
class Yr {
|
|
2948
2964
|
constructor(e) {
|
|
2949
|
-
this.ctx = e, this.IPEModal = R, this.IPEModalEvent =
|
|
2965
|
+
this.ctx = e, this.IPEModal = R, this.IPEModalEvent = Ye, this.show = R.show.bind(R), this.createObject = R.createObject.bind(R), this.close = R.close.bind(R), this.closeAll = R.closeAll.bind(R), this.removeAll = R.removeAll.bind(R), this.dialog = R.dialog.bind(R), this.confirm = R.confirm.bind(R), this.notify = R.notify.bind(R), e.set("modal", this), e.on("dispose", () => {
|
|
2950
2966
|
R.closeAll();
|
|
2951
2967
|
});
|
|
2952
2968
|
}
|
|
2953
2969
|
}
|
|
2954
|
-
const
|
|
2970
|
+
const Ht = (i) => {
|
|
2955
2971
|
if (!i)
|
|
2956
2972
|
return new URLSearchParams();
|
|
2957
2973
|
if (i instanceof URLSearchParams)
|
|
@@ -2974,26 +2990,26 @@ const Ut = (i) => {
|
|
|
2974
2990
|
e.set(t, r?.toString());
|
|
2975
2991
|
}
|
|
2976
2992
|
return e;
|
|
2977
|
-
},
|
|
2978
|
-
const r = typeof i == "string" ? new URL(i, window?.location?.origin) : new URL(i), n = new URLSearchParams(r.search), s =
|
|
2993
|
+
}, Kt = (i, e, t) => {
|
|
2994
|
+
const r = typeof i == "string" ? new URL(i, window?.location?.origin) : new URL(i), n = new URLSearchParams(r.search), s = Ht(e);
|
|
2979
2995
|
for (const [o, a] of s.entries())
|
|
2980
2996
|
n.set(o, a);
|
|
2981
2997
|
return r.search = n.toString(), r.hash = "", r;
|
|
2982
2998
|
};
|
|
2983
|
-
var
|
|
2999
|
+
var Jr = Object.create, Je = Object.defineProperty, Xr = Object.getOwnPropertyDescriptor, qt = (i, e) => (e = Symbol[i]) ? e : /* @__PURE__ */ Symbol.for("Symbol." + i), Wt = (i) => {
|
|
2984
3000
|
throw TypeError(i);
|
|
2985
|
-
},
|
|
3001
|
+
}, Qr = (i, e, t) => e in i ? Je(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t, Zr = (i, e) => Je(i, "name", { value: e, configurable: !0 }), en = (i) => [, , , Jr(i?.[qt("metadata")] ?? null)], tn = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"], Gt = (i) => i !== void 0 && typeof i != "function" ? Wt("Function expected") : i, rn = (i, e, t, r, n) => ({ kind: tn[i], name: e, metadata: r, addInitializer: (s) => t._ ? Wt("Already initialized") : n.push(Gt(s || null)) }), nn = (i, e) => Qr(e, qt("metadata"), i[3]), sn = (i, e, t, r) => {
|
|
2986
3002
|
for (var n = 0, s = i[e >> 1], o = s && s.length; n < o; n++) s[n].call(t);
|
|
2987
3003
|
return r;
|
|
2988
|
-
},
|
|
2989
|
-
var o, a, f, u = e & 7, p = !1, y = 0, _ = i[y] || (i[y] = []), g = u && (n = n.prototype, u < 5 && (u > 3 || !p) &&
|
|
2990
|
-
|
|
3004
|
+
}, on = (i, e, t, r, n, s) => {
|
|
3005
|
+
var o, a, f, u = e & 7, p = !1, y = 0, _ = i[y] || (i[y] = []), g = u && (n = n.prototype, u < 5 && (u > 3 || !p) && Xr(n, t));
|
|
3006
|
+
Zr(n, t);
|
|
2991
3007
|
for (var w = r.length - 1; w >= 0; w--)
|
|
2992
|
-
f =
|
|
2993
|
-
return
|
|
2994
|
-
},
|
|
2995
|
-
|
|
2996
|
-
class
|
|
3008
|
+
f = rn(u, t, a = {}, i[3], _), o = (0, r[w])(n, f), a._ = 1, Gt(o) && (n = o);
|
|
3009
|
+
return nn(i, n), g && Je(n, t, g), p ? u ^ 4 ? s : g : n;
|
|
3010
|
+
}, Vt, Xe, Yt;
|
|
3011
|
+
Vt = [F(["api", "storage"])];
|
|
3012
|
+
class ge extends (Yt = z) {
|
|
2997
3013
|
constructor(e) {
|
|
2998
3014
|
super(e, "wiki", !1), this.ctx = e, this._data = {}, this.CACHE_VERSION = 4, this.CACHE_TTL = {
|
|
2999
3015
|
siteinfo: 1e3 * 60 * 60 * 24 * 3,
|
|
@@ -3034,11 +3050,11 @@ class pe extends (Wt = z) {
|
|
|
3034
3050
|
"WikiMetadataService",
|
|
3035
3051
|
$.object({
|
|
3036
3052
|
WikiMetadataService: $.const(
|
|
3037
|
-
/* @__PURE__ */
|
|
3038
|
-
/* @__PURE__ */
|
|
3039
|
-
/* @__PURE__ */
|
|
3040
|
-
/* @__PURE__ */
|
|
3041
|
-
/* @__PURE__ */
|
|
3053
|
+
/* @__PURE__ */ N("div", { children: [
|
|
3054
|
+
/* @__PURE__ */ N("h3", { children: t`Wiki Informations` }),
|
|
3055
|
+
/* @__PURE__ */ N("ul", { children: [
|
|
3056
|
+
/* @__PURE__ */ N("li", { children: [
|
|
3057
|
+
/* @__PURE__ */ N("strong", { children: [
|
|
3042
3058
|
t`Site`,
|
|
3043
3059
|
":"
|
|
3044
3060
|
] }),
|
|
@@ -3048,23 +3064,23 @@ class pe extends (Wt = z) {
|
|
|
3048
3064
|
this.landingPageUrl,
|
|
3049
3065
|
")"
|
|
3050
3066
|
] }),
|
|
3051
|
-
/* @__PURE__ */
|
|
3052
|
-
/* @__PURE__ */
|
|
3067
|
+
/* @__PURE__ */ N("li", { children: [
|
|
3068
|
+
/* @__PURE__ */ N("strong", { children: t`User` }),
|
|
3053
3069
|
": ",
|
|
3054
3070
|
this.userInfo.name,
|
|
3055
3071
|
" (ID: ",
|
|
3056
3072
|
this.userInfo.id,
|
|
3057
3073
|
")"
|
|
3058
3074
|
] }),
|
|
3059
|
-
/* @__PURE__ */
|
|
3060
|
-
/* @__PURE__ */
|
|
3075
|
+
/* @__PURE__ */ N("li", { children: [
|
|
3076
|
+
/* @__PURE__ */ N("strong", { children: t`Groups` }),
|
|
3061
3077
|
": ",
|
|
3062
3078
|
this.userGroups.join(", ") || "None"
|
|
3063
3079
|
] })
|
|
3064
3080
|
] }),
|
|
3065
|
-
/* @__PURE__ */
|
|
3066
|
-
/* @__PURE__ */
|
|
3067
|
-
/* @__PURE__ */
|
|
3081
|
+
/* @__PURE__ */ N("div", { children: [
|
|
3082
|
+
/* @__PURE__ */ N("p", { style: { fontStyle: "italic" }, children: t`If the information shown above is incorrect (for example, the user is not you), click the button below.` }),
|
|
3083
|
+
/* @__PURE__ */ N(
|
|
3068
3084
|
"button",
|
|
3069
3085
|
{
|
|
3070
3086
|
className: "btn danger",
|
|
@@ -3238,10 +3254,10 @@ class pe extends (Wt = z) {
|
|
|
3238
3254
|
}
|
|
3239
3255
|
/** Get mainpage URL */
|
|
3240
3256
|
getMainpageUrl(e) {
|
|
3241
|
-
return
|
|
3257
|
+
return Kt(this.siteInfo.general.base, e).toString();
|
|
3242
3258
|
}
|
|
3243
3259
|
getUrl(e, t) {
|
|
3244
|
-
const r =
|
|
3260
|
+
const r = Ht(t);
|
|
3245
3261
|
let n;
|
|
3246
3262
|
return typeof e == "string" && e !== "" ? n = new URL(`${this.articleBaseUrl.replace("$1", e)}`) : typeof e == "number" ? (r.set("curid", e.toString()), n = new URL(this.getSciprtUrl("index"))) : n = new URL(this.getSciprtUrl("index")), n.search = r.toString(), n.toString();
|
|
3247
3263
|
}
|
|
@@ -3271,16 +3287,16 @@ class pe extends (Wt = z) {
|
|
|
3271
3287
|
} : null;
|
|
3272
3288
|
}
|
|
3273
3289
|
}
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
const
|
|
3290
|
+
Xe = en(Yt);
|
|
3291
|
+
ge = on(Xe, 0, "WikiMetadataService", Vt, ge);
|
|
3292
|
+
sn(Xe, 1, ge);
|
|
3293
|
+
const an = (() => {
|
|
3278
3294
|
const i = /* @__PURE__ */ Symbol.for("IPE.GlobalMemoryStorage");
|
|
3279
|
-
return i in globalThis || (globalThis[i] =
|
|
3295
|
+
return i in globalThis || (globalThis[i] = $i()), globalThis[i];
|
|
3280
3296
|
})();
|
|
3281
|
-
class
|
|
3297
|
+
class cn {
|
|
3282
3298
|
constructor(e, t, r = 1 / 0, n, s = "localStorage") {
|
|
3283
|
-
this.dbName = e, this.storeName = t, this.ttl = r, this.version = n, this.engine = s, typeof r != "number" && (this.ttl = Number(r)), (isNaN(this.ttl) || this.ttl <= 0) && (this.ttl = 1 / 0), this.engine === "localStorage" && "localStorage" in window ? this.db = window.localStorage : this.engine === "sessionStorage" && "sessionStorage" in window ? this.db = window.sessionStorage : this.db =
|
|
3299
|
+
this.dbName = e, this.storeName = t, this.ttl = r, this.version = n, this.engine = s, typeof r != "number" && (this.ttl = Number(r)), (isNaN(this.ttl) || this.ttl <= 0) && (this.ttl = 1 / 0), this.engine === "localStorage" && "localStorage" in window ? this.db = window.localStorage : this.engine === "sessionStorage" && "sessionStorage" in window ? this.db = window.sessionStorage : this.db = an;
|
|
3284
3300
|
}
|
|
3285
3301
|
// Key builder
|
|
3286
3302
|
makeKey(e) {
|
|
@@ -3430,8 +3446,8 @@ var L;
|
|
|
3430
3446
|
const w = indexedDB.open(u, p);
|
|
3431
3447
|
w.onupgradeneeded = () => {
|
|
3432
3448
|
try {
|
|
3433
|
-
const O = w.result,
|
|
3434
|
-
y?.(O,
|
|
3449
|
+
const O = w.result, A = w.transaction;
|
|
3450
|
+
y?.(O, A);
|
|
3435
3451
|
} catch (O) {
|
|
3436
3452
|
g(O);
|
|
3437
3453
|
}
|
|
@@ -3451,17 +3467,17 @@ var L;
|
|
|
3451
3467
|
async function n(u, p, y) {
|
|
3452
3468
|
let _ = !u.objectStoreNames.contains(p), g = [];
|
|
3453
3469
|
if (!_ && y?.indexes?.length) {
|
|
3454
|
-
const
|
|
3470
|
+
const A = u.transaction(p, "readonly"), l = A.objectStore(p), c = new Set(Array.from(l.indexNames));
|
|
3455
3471
|
g = (y.indexes || []).filter((h) => !c.has(h.name)), await new Promise((h, d) => {
|
|
3456
|
-
|
|
3472
|
+
A.oncomplete = () => h(), A.onabort = () => d(A.error), A.onerror = () => d(A.error);
|
|
3457
3473
|
});
|
|
3458
3474
|
}
|
|
3459
3475
|
if (!_ && g.length === 0) return u;
|
|
3460
3476
|
const w = u.version + 1;
|
|
3461
3477
|
u.close();
|
|
3462
|
-
const O = await r(u.name, w, (
|
|
3478
|
+
const O = await r(u.name, w, (A, l) => {
|
|
3463
3479
|
let c;
|
|
3464
|
-
|
|
3480
|
+
A.objectStoreNames.contains(p) ? c = l.objectStore(p) : c = A.createObjectStore(p, {
|
|
3465
3481
|
keyPath: y?.keyPath ?? void 0,
|
|
3466
3482
|
autoIncrement: !!y?.autoIncrement
|
|
3467
3483
|
});
|
|
@@ -3506,7 +3522,7 @@ var L;
|
|
|
3506
3522
|
}
|
|
3507
3523
|
i.waitTx = f;
|
|
3508
3524
|
})(L || (L = {}));
|
|
3509
|
-
class
|
|
3525
|
+
class ln {
|
|
3510
3526
|
constructor(e, t, r = {}) {
|
|
3511
3527
|
this.dbName = e, this.storeName = t, this.options = r;
|
|
3512
3528
|
}
|
|
@@ -3634,9 +3650,9 @@ class sn {
|
|
|
3634
3650
|
await L.closeConnection(this.dbName);
|
|
3635
3651
|
}
|
|
3636
3652
|
}
|
|
3637
|
-
class
|
|
3653
|
+
class hn {
|
|
3638
3654
|
constructor(e, t, r = 1 / 0, n) {
|
|
3639
|
-
this.dbName = e, this.storeName = t, this.ttl = r, this.version = n, this.db = new
|
|
3655
|
+
this.dbName = e, this.storeName = t, this.ttl = r, this.version = n, this.db = new ln(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), this._clearExpiredEntries().catch(() => {
|
|
3640
3656
|
});
|
|
3641
3657
|
}
|
|
3642
3658
|
async _clearExpiredEntries() {
|
|
@@ -3722,7 +3738,7 @@ class on {
|
|
|
3722
3738
|
return await this.db.clear(), this;
|
|
3723
3739
|
}
|
|
3724
3740
|
}
|
|
3725
|
-
class
|
|
3741
|
+
class un extends z {
|
|
3726
3742
|
constructor(e, t) {
|
|
3727
3743
|
super(e, "storage", !1), this.config = t, this.kv = this.createDatabase("key-val", 0, 1, "indexedDB"), this.simpleKV = this.createDatabase("~", 0, 1, "localStorage"), this.memoryKV = this.createDatabase("~", 0, 1, "memory");
|
|
3728
3744
|
}
|
|
@@ -3730,82 +3746,145 @@ class an extends z {
|
|
|
3730
3746
|
const s = "indexedDB" in window && window.indexedDB !== null;
|
|
3731
3747
|
switch (n === "indexedDB" && !s && (n = "localStorage"), n) {
|
|
3732
3748
|
case "indexedDB":
|
|
3733
|
-
return new
|
|
3749
|
+
return new hn(this.config.dbName, e, t, r);
|
|
3734
3750
|
case "localStorage":
|
|
3735
3751
|
case "sessionStorage":
|
|
3736
3752
|
case "memory":
|
|
3737
|
-
return new
|
|
3753
|
+
return new cn(this.config.dbName, e, t, r, n);
|
|
3738
3754
|
default:
|
|
3739
3755
|
throw new Error(`Unsupported storage engine: ${n}`);
|
|
3740
3756
|
}
|
|
3741
3757
|
}
|
|
3742
3758
|
}
|
|
3743
|
-
function
|
|
3759
|
+
function Jt(i) {
|
|
3744
3760
|
return function(e) {
|
|
3745
3761
|
return e.PreferencesSchema = i, e;
|
|
3746
3762
|
};
|
|
3747
3763
|
}
|
|
3748
|
-
|
|
3764
|
+
function wt(i) {
|
|
3765
|
+
return i === "html" ? [document.documentElement] : i === "body" ? [document.body] : [document.documentElement, document.body];
|
|
3766
|
+
}
|
|
3767
|
+
function Ae(i, e) {
|
|
3768
|
+
return i.some((t) => e.some((r) => t.classList.contains(r)));
|
|
3769
|
+
}
|
|
3770
|
+
function fn(i) {
|
|
3771
|
+
const e = i.target ?? "both", t = i.systemClasses ?? [];
|
|
3772
|
+
let r = null, n = null, s = null;
|
|
3773
|
+
return {
|
|
3774
|
+
name: i.name,
|
|
3775
|
+
match() {
|
|
3776
|
+
return Ae([document.documentElement, document.body], i.skinClasses);
|
|
3777
|
+
},
|
|
3778
|
+
getCurrentTheme() {
|
|
3779
|
+
const o = wt(e);
|
|
3780
|
+
return Ae(o, i.darkClasses) || t.length > 0 && Ae(o, t) && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
3781
|
+
},
|
|
3782
|
+
startObserving(o) {
|
|
3783
|
+
this.stopObserving(), r = new MutationObserver(o);
|
|
3784
|
+
for (const a of wt(e))
|
|
3785
|
+
r.observe(a, { attributes: !0, attributeFilter: ["class"] });
|
|
3786
|
+
t.length > 0 && (n = window.matchMedia("(prefers-color-scheme: dark)"), s = o, n.addEventListener("change", s));
|
|
3787
|
+
},
|
|
3788
|
+
stopObserving() {
|
|
3789
|
+
r?.disconnect(), r = null, n && s && (n.removeEventListener("change", s), n = null, s = null);
|
|
3790
|
+
}
|
|
3791
|
+
};
|
|
3792
|
+
}
|
|
3793
|
+
const dn = [
|
|
3794
|
+
{
|
|
3795
|
+
name: "MoeSkin",
|
|
3796
|
+
skinClasses: ["skin-moeskin"],
|
|
3797
|
+
darkClasses: ["dark"],
|
|
3798
|
+
target: "html"
|
|
3799
|
+
},
|
|
3800
|
+
{
|
|
3801
|
+
name: "Fandom Desktop",
|
|
3802
|
+
skinClasses: ["skin-fandomdesktop"],
|
|
3803
|
+
darkClasses: ["theme-fandomdesktop-dark"]
|
|
3804
|
+
},
|
|
3805
|
+
{
|
|
3806
|
+
name: "Fandom Mobile",
|
|
3807
|
+
skinClasses: ["skin-fandommobile"],
|
|
3808
|
+
darkClasses: ["theme-fandommobile-dark"]
|
|
3809
|
+
},
|
|
3810
|
+
{
|
|
3811
|
+
name: "Vector 2022",
|
|
3812
|
+
skinClasses: ["skin-vector-2022"],
|
|
3813
|
+
darkClasses: ["skin-theme-clientpref-night"],
|
|
3814
|
+
systemClasses: ["skin-theme-clientpref-os"],
|
|
3815
|
+
target: "html"
|
|
3816
|
+
},
|
|
3817
|
+
{
|
|
3818
|
+
name: "Citizen",
|
|
3819
|
+
skinClasses: ["skin-citizen"],
|
|
3820
|
+
darkClasses: ["skin-theme-clientpref-night"],
|
|
3821
|
+
systemClasses: ["skin-theme-clientpref-os"],
|
|
3822
|
+
target: "html"
|
|
3823
|
+
}
|
|
3824
|
+
];
|
|
3825
|
+
var pn = Object.create, Qe = Object.defineProperty, gn = Object.getOwnPropertyDescriptor, Xt = (i, e) => (e = Symbol[i]) ? e : /* @__PURE__ */ Symbol.for("Symbol." + i), Qt = (i) => {
|
|
3749
3826
|
throw TypeError(i);
|
|
3750
|
-
},
|
|
3827
|
+
}, mn = (i, e, t) => e in i ? Qe(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t, yn = (i, e) => Qe(i, "name", { value: e, configurable: !0 }), wn = (i) => [, , , pn(i?.[Xt("metadata")] ?? null)], bn = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"], Zt = (i) => i !== void 0 && typeof i != "function" ? Qt("Function expected") : i, vn = (i, e, t, r, n) => ({ kind: bn[i], name: e, metadata: r, addInitializer: (s) => t._ ? Qt("Already initialized") : n.push(Zt(s || null)) }), _n = (i, e) => mn(e, Xt("metadata"), i[3]), xn = (i, e, t, r) => {
|
|
3751
3828
|
for (var n = 0, s = i[e >> 1], o = s && s.length; n < o; n++) s[n].call(t);
|
|
3752
3829
|
return r;
|
|
3753
|
-
},
|
|
3754
|
-
var o, a, f, u = e & 7, p = !1, y = 0, _ = i[y] || (i[y] = []), g = u && (n = n.prototype, u < 5 && (u > 3 || !p) &&
|
|
3755
|
-
|
|
3830
|
+
}, kn = (i, e, t, r, n, s) => {
|
|
3831
|
+
var o, a, f, u = e & 7, p = !1, y = 0, _ = i[y] || (i[y] = []), g = u && (n = n.prototype, u < 5 && (u > 3 || !p) && gn(n, t));
|
|
3832
|
+
yn(n, t);
|
|
3756
3833
|
for (var w = r.length - 1; w >= 0; w--)
|
|
3757
|
-
f =
|
|
3758
|
-
return
|
|
3759
|
-
},
|
|
3760
|
-
|
|
3834
|
+
f = vn(u, t, a = {}, i[3], _), o = (0, r[w])(n, f), a._ = 1, Zt(o) && (n = o);
|
|
3835
|
+
return _n(i, n), g && Qe(n, t, g), p ? u ^ 4 ? s : g : n;
|
|
3836
|
+
}, ei, Ze, ti;
|
|
3837
|
+
ei = [F(["preferences"]), Jt(
|
|
3761
3838
|
$.object({
|
|
3762
3839
|
theme: $.union([
|
|
3763
3840
|
$.const("auto").description("Follow system"),
|
|
3764
3841
|
$.const("light").description("Light mode"),
|
|
3765
3842
|
$.const("dark").description("Dark mode"),
|
|
3766
|
-
$.const("
|
|
3843
|
+
$.const("site").description("Follow site theme")
|
|
3767
3844
|
]).default("auto").description("Theme preference")
|
|
3768
3845
|
}).description("Theme settings").extra("category", "general")
|
|
3769
3846
|
)];
|
|
3770
|
-
class
|
|
3847
|
+
class me extends (ti = z) {
|
|
3771
3848
|
constructor(e) {
|
|
3772
|
-
super(e, "theme", !1), this.ctx = e, this._mediaQueryList = null, this.
|
|
3849
|
+
super(e, "theme", !1), this.ctx = e, this._mediaQueryList = null, this.adapters = [], this.activeAdapter = null, this._handleSystemThemeChange = this._onSystemThemeChange.bind(this);
|
|
3773
3850
|
}
|
|
3774
3851
|
async start() {
|
|
3775
|
-
this._mediaQueryList = window.matchMedia("(prefers-color-scheme: dark)"), this._mediaQueryList.addEventListener("change", this._handleSystemThemeChange)
|
|
3852
|
+
this._mediaQueryList = window.matchMedia("(prefers-color-scheme: dark)"), this._mediaQueryList.addEventListener("change", this._handleSystemThemeChange);
|
|
3853
|
+
for (const e of dn)
|
|
3854
|
+
this.registerSiteThemeAdapter(fn(e));
|
|
3855
|
+
await this.applyTheme(), this.ctx.on("preferences/changed", async ({ changes: e }) => {
|
|
3776
3856
|
"theme" in e && await this.applyTheme();
|
|
3777
3857
|
});
|
|
3778
3858
|
}
|
|
3779
3859
|
stop() {
|
|
3780
|
-
this._mediaQueryList && this._mediaQueryList.removeEventListener("change", this._handleSystemThemeChange), this.
|
|
3860
|
+
this._mediaQueryList && this._mediaQueryList.removeEventListener("change", this._handleSystemThemeChange), this.activeAdapter?.stopObserving();
|
|
3781
3861
|
}
|
|
3782
|
-
|
|
3783
|
-
|
|
3862
|
+
/**
|
|
3863
|
+
* Register a site theme adapter. Returns a dispose function to unregister it.
|
|
3864
|
+
* Custom adapters take priority over previously registered (built-in) ones.
|
|
3865
|
+
*/
|
|
3866
|
+
registerSiteThemeAdapter(e) {
|
|
3867
|
+
return this.adapters.unshift(e), this.resolveActiveAdapter(), this.applyTheme(), () => {
|
|
3868
|
+
this.adapters = this.adapters.filter((t) => t !== e), this.activeAdapter === e && (e.stopObserving(), this.activeAdapter = null, this.resolveActiveAdapter()), this.applyTheme();
|
|
3869
|
+
};
|
|
3870
|
+
}
|
|
3871
|
+
resolveActiveAdapter() {
|
|
3872
|
+
this.activeAdapter = this.adapters.find((e) => e.match()) ?? null;
|
|
3784
3873
|
}
|
|
3785
|
-
async
|
|
3874
|
+
async _onSystemThemeChange() {
|
|
3786
3875
|
await this.applyTheme();
|
|
3787
3876
|
}
|
|
3788
3877
|
async applyTheme() {
|
|
3789
3878
|
const e = await this.ctx.preferences.get("theme") || "auto";
|
|
3790
|
-
this.
|
|
3879
|
+
this.updateSiteObserver(e);
|
|
3791
3880
|
const t = this.getTheme(e);
|
|
3792
3881
|
this.applyThemeClass(t), this.ctx.emit("theme/changed", { ctx: this.ctx, theme: t });
|
|
3793
3882
|
}
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
e === "fandom" ? this._observer?.observe(document.body, {
|
|
3797
|
-
attributes: !0,
|
|
3798
|
-
attributeFilter: ["class"]
|
|
3799
|
-
}) : this._observer?.disconnect();
|
|
3883
|
+
updateSiteObserver(e) {
|
|
3884
|
+
e === "site" && this.activeAdapter ? this.activeAdapter.startObserving(() => this.applyTheme()) : this.activeAdapter?.stopObserving();
|
|
3800
3885
|
}
|
|
3801
3886
|
getTheme(e) {
|
|
3802
|
-
|
|
3803
|
-
return this._mediaQueryList?.matches ? "dark" : "light";
|
|
3804
|
-
if (e === "fandom") {
|
|
3805
|
-
const t = document.body;
|
|
3806
|
-
return t.classList.contains("theme-fandomdesktop-dark") || t.classList.contains("theme-fandommobile-dark") ? "dark" : "light";
|
|
3807
|
-
}
|
|
3808
|
-
return e;
|
|
3887
|
+
return e === "auto" ? this._mediaQueryList?.matches ? "dark" : "light" : e === "site" ? this.activeAdapter ? this.activeAdapter.getCurrentTheme() : this._mediaQueryList?.matches ? "dark" : "light" : e;
|
|
3809
3888
|
}
|
|
3810
3889
|
applyThemeClass(e) {
|
|
3811
3890
|
const t = document.body;
|
|
@@ -3815,12 +3894,12 @@ class ge extends (Qt = z) {
|
|
|
3815
3894
|
return document.body.classList.contains("ipe-theme-dark") ? "dark" : "light";
|
|
3816
3895
|
}
|
|
3817
3896
|
}
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
class
|
|
3897
|
+
Ze = wn(ti);
|
|
3898
|
+
me = kn(Ze, 0, "ThemeService", ei, me);
|
|
3899
|
+
xn(Ze, 1, me);
|
|
3900
|
+
class Sn extends z {
|
|
3822
3901
|
constructor(e) {
|
|
3823
|
-
super(e, "wikiPage", !0), this.ctx = e, this.WikiPage =
|
|
3902
|
+
super(e, "wikiPage", !0), this.ctx = e, this.WikiPage = Ei(this.ctx.api);
|
|
3824
3903
|
}
|
|
3825
3904
|
static {
|
|
3826
3905
|
this.inject = ["api"];
|
|
@@ -3841,9 +3920,9 @@ class wn extends z {
|
|
|
3841
3920
|
return this.WikiPage.newBlankPage(e);
|
|
3842
3921
|
}
|
|
3843
3922
|
}
|
|
3844
|
-
class
|
|
3923
|
+
class et extends z {
|
|
3845
3924
|
constructor(e) {
|
|
3846
|
-
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 =
|
|
3925
|
+
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 = Ai(this.ctx.wiki.siteInfo);
|
|
3847
3926
|
}
|
|
3848
3927
|
static {
|
|
3849
3928
|
this.inject = ["wiki", "wikiPage"];
|
|
@@ -3867,7 +3946,7 @@ class Qe extends z {
|
|
|
3867
3946
|
throw new Error("Invalid id or kind", { cause: e });
|
|
3868
3947
|
if (!t && this._cachedTitles.has(`${a}:${o}`))
|
|
3869
3948
|
return await this._cachedTitles.get(`${a}:${o}`);
|
|
3870
|
-
const { promise: f, resolve: u, reject: p } =
|
|
3949
|
+
const { promise: f, resolve: u, reject: p } = _t();
|
|
3871
3950
|
this._cachedTitles.set(`${a}:${o}`, f);
|
|
3872
3951
|
try {
|
|
3873
3952
|
const { wikiPage: y } = this.ctx;
|
|
@@ -3937,12 +4016,12 @@ class Qe extends z {
|
|
|
3937
4016
|
this.REG_SKIPPED_HREF = /^(#|javascript:|vbscript:|file:)/i;
|
|
3938
4017
|
}
|
|
3939
4018
|
validateHrefAttr(e) {
|
|
3940
|
-
return typeof e != "string" ? !1 : !
|
|
4019
|
+
return typeof e != "string" ? !1 : !et.REG_SKIPPED_HREF.test(e);
|
|
3941
4020
|
}
|
|
3942
4021
|
parseWikiLink(e) {
|
|
3943
4022
|
if (!e || typeof e == "string" && !this.validateHrefAttr(e))
|
|
3944
4023
|
return null;
|
|
3945
|
-
const t =
|
|
4024
|
+
const t = Kt(e);
|
|
3946
4025
|
if (!this.isWikiLink(t.toString()))
|
|
3947
4026
|
return null;
|
|
3948
4027
|
const r = t.searchParams, n = t.hash.replace("#", ""), s = r.get("action") || "view", o = r.get("title") || "", a = parseInt(r.get("curid") || "0", 10), f = parseInt(r.get("oldid") || "0", 10);
|
|
@@ -3976,27 +4055,27 @@ class Qe extends z {
|
|
|
3976
4055
|
};
|
|
3977
4056
|
}
|
|
3978
4057
|
}
|
|
3979
|
-
const
|
|
3980
|
-
async function
|
|
3981
|
-
return
|
|
4058
|
+
const ii = (i) => typeof i == "function";
|
|
4059
|
+
async function $n(i) {
|
|
4060
|
+
return ii(i) ? await i() : i;
|
|
3982
4061
|
}
|
|
3983
|
-
function
|
|
3984
|
-
return
|
|
4062
|
+
function _s(i) {
|
|
4063
|
+
return ii(i) ? i() : i;
|
|
3985
4064
|
}
|
|
3986
|
-
var
|
|
4065
|
+
var En = Object.create, tt = Object.defineProperty, An = Object.getOwnPropertyDescriptor, ri = (i, e) => (e = Symbol[i]) ? e : /* @__PURE__ */ Symbol.for("Symbol." + i), ni = (i) => {
|
|
3987
4066
|
throw TypeError(i);
|
|
3988
|
-
},
|
|
4067
|
+
}, Cn = (i, e, t) => e in i ? tt(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t, On = (i, e) => tt(i, "name", { value: e, configurable: !0 }), Pn = (i) => [, , , En(i?.[ri("metadata")] ?? null)], In = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"], si = (i) => i !== void 0 && typeof i != "function" ? ni("Function expected") : i, Ln = (i, e, t, r, n) => ({ kind: In[i], name: e, metadata: r, addInitializer: (s) => t._ ? ni("Already initialized") : n.push(si(s || null)) }), Rn = (i, e) => Cn(e, ri("metadata"), i[3]), jn = (i, e, t, r) => {
|
|
3989
4068
|
for (var n = 0, s = i[e >> 1], o = s && s.length; n < o; n++) s[n].call(t);
|
|
3990
4069
|
return r;
|
|
3991
|
-
},
|
|
3992
|
-
var o, a, f, u = e & 7, p = !1, y = 0, _ = i[y] || (i[y] = []), g = u && (n = n.prototype, u < 5 && (u > 3 || !p) &&
|
|
3993
|
-
|
|
4070
|
+
}, Dn = (i, e, t, r, n, s) => {
|
|
4071
|
+
var o, a, f, u = e & 7, p = !1, y = 0, _ = i[y] || (i[y] = []), g = u && (n = n.prototype, u < 5 && (u > 3 || !p) && An(n, t));
|
|
4072
|
+
On(n, t);
|
|
3994
4073
|
for (var w = r.length - 1; w >= 0; w--)
|
|
3995
|
-
f =
|
|
3996
|
-
return
|
|
3997
|
-
},
|
|
3998
|
-
|
|
3999
|
-
class
|
|
4074
|
+
f = Ln(u, t, a = {}, i[3], _), o = (0, r[w])(n, f), a._ = 1, si(o) && (n = o);
|
|
4075
|
+
return Rn(i, n), g && tt(n, t, g), p ? u ^ 4 ? s : g : n;
|
|
4076
|
+
}, oi, it, ai;
|
|
4077
|
+
oi = [F(["storage", "wiki"])];
|
|
4078
|
+
class ye extends (ai = z) {
|
|
4000
4079
|
constructor(e) {
|
|
4001
4080
|
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.createDatabase(`preferences:${e.wiki.userInfo.id}`, 1 / 0);
|
|
4002
4081
|
try {
|
|
@@ -4017,7 +4096,7 @@ class me extends (ni = z) {
|
|
|
4017
4096
|
return this.logger.debug(e, `(fallback value: ${n})`), n;
|
|
4018
4097
|
};
|
|
4019
4098
|
const r = await this.db.get(e, void 0);
|
|
4020
|
-
return r !== null ? r : await
|
|
4099
|
+
return r !== null ? r : await $n(t);
|
|
4021
4100
|
}
|
|
4022
4101
|
/**
|
|
4023
4102
|
* 获取全部注册的配置项以及最终生效的值
|
|
@@ -4080,7 +4159,7 @@ class me extends (ni = z) {
|
|
|
4080
4159
|
getConfigRegistries(e) {
|
|
4081
4160
|
return Array.from(this.ctx.registry.entries()).map(([t]) => t === null ? {
|
|
4082
4161
|
name: "@root",
|
|
4083
|
-
schema:
|
|
4162
|
+
schema: ve?.PreferencesSchema || null
|
|
4084
4163
|
} : {
|
|
4085
4164
|
name: t.name,
|
|
4086
4165
|
schema: t?.PreferencesSchema || null
|
|
@@ -4109,19 +4188,19 @@ class me extends (ni = z) {
|
|
|
4109
4188
|
return t && this.logger.info(`Migrated ${t} preferences from master DB`), await e.clear(), await e?.db?.disconnect?.(), t;
|
|
4110
4189
|
}
|
|
4111
4190
|
}
|
|
4112
|
-
|
|
4113
|
-
|
|
4114
|
-
|
|
4115
|
-
var
|
|
4116
|
-
const
|
|
4117
|
-
function
|
|
4191
|
+
it = Pn(ai);
|
|
4192
|
+
ye = Dn(it, 0, "PreferencesService", oi, ye);
|
|
4193
|
+
jn(it, 1, ye);
|
|
4194
|
+
var rt = /* @__PURE__ */ ((i) => (i.ANALYTICS_API_BASE = "https://analytics.ipe.wiki/api/v6", i.ANALYTICS_DASH_URL = "https://analytics.ipe.wiki", i.GITHUB_URL = "https://github.com/inpageedit/inpageedit-next", i.GITHUB_OWNER = "inpageedit", i.GITHUB_REPO = "inpageedit-next", i.HOME_URL = "https://www.ipe.wiki/", i.UPDATE_LOGS_URL = "https://www.ipe.wiki/changelogs/", i.PLUGIN_REGISTRY_URL = "https://registry.ipe.wiki/registry.v1.json", i.I18N_INDEX_URL = "https://registry.ipe.wiki/i18n/index.json", i.QQ_GROUP_ID = "1026023666", i))(rt || {});
|
|
4195
|
+
const ci = "", li = "", Tn = /\\\{/g, Nn = /\\\}/g, Mn = new RegExp(ci, "g"), Bn = new RegExp(li, "g");
|
|
4196
|
+
function bt(i) {
|
|
4118
4197
|
const e = i ? { ...i } : void 0;
|
|
4119
|
-
return (r, ...n) =>
|
|
4198
|
+
return (r, ...n) => Un(e, r, ...n);
|
|
4120
4199
|
}
|
|
4121
|
-
function
|
|
4200
|
+
function Un(i, e, ...t) {
|
|
4122
4201
|
if (!e) return "";
|
|
4123
|
-
let r = String(e).replace(
|
|
4124
|
-
t.length === 1 && Array.isArray(t[0]) ? s = t[0] : t.length === 1 &&
|
|
4202
|
+
let r = String(e).replace(Tn, ci).replace(Nn, li), n = {}, s = [];
|
|
4203
|
+
t.length === 1 && Array.isArray(t[0]) ? s = t[0] : t.length === 1 && Fn(t[0]) ? n = t[0] : t.length > 0 && (s = t);
|
|
4125
4204
|
const o = /* @__PURE__ */ Object.create(null);
|
|
4126
4205
|
if (s && s.length)
|
|
4127
4206
|
for (let a = 0; a < s.length; a++)
|
|
@@ -4135,18 +4214,18 @@ function jn(i, e, ...t) {
|
|
|
4135
4214
|
const u = String(f).trim();
|
|
4136
4215
|
if (!u) return "";
|
|
4137
4216
|
try {
|
|
4138
|
-
const p =
|
|
4217
|
+
const p = zn(u, o);
|
|
4139
4218
|
return p == null ? "" : String(p);
|
|
4140
4219
|
} catch {
|
|
4141
4220
|
return "";
|
|
4142
4221
|
}
|
|
4143
|
-
}), r.replace(
|
|
4222
|
+
}), r.replace(Mn, "{").replace(Bn, "}");
|
|
4144
4223
|
}
|
|
4145
|
-
function
|
|
4224
|
+
function Fn(i) {
|
|
4146
4225
|
return typeof i == "object" && i !== null && i.constructor === Object;
|
|
4147
4226
|
}
|
|
4148
|
-
const
|
|
4149
|
-
function
|
|
4227
|
+
const zn = Hn();
|
|
4228
|
+
function Hn() {
|
|
4150
4229
|
const i = /* @__PURE__ */ new Set([
|
|
4151
4230
|
"eval",
|
|
4152
4231
|
"Object",
|
|
@@ -4191,29 +4270,29 @@ function Mn() {
|
|
|
4191
4270
|
return e(t, n);
|
|
4192
4271
|
};
|
|
4193
4272
|
}
|
|
4194
|
-
function
|
|
4273
|
+
function hi(i) {
|
|
4195
4274
|
return i.charAt(0).toLowerCase() + i.slice(1);
|
|
4196
4275
|
}
|
|
4197
|
-
function
|
|
4198
|
-
return
|
|
4276
|
+
function ie(i) {
|
|
4277
|
+
return hi(i).replace(/_/g, "-").replace(/.[A-Z]+/g, (e) => e[0] + "-" + e.slice(1).toLowerCase());
|
|
4199
4278
|
}
|
|
4200
|
-
function
|
|
4201
|
-
return
|
|
4279
|
+
function xs(i) {
|
|
4280
|
+
return hi(i).replace(/-/g, "_").replace(/.[A-Z]+/g, (e) => e[0] + "_" + e.slice(1).toLowerCase());
|
|
4202
4281
|
}
|
|
4203
|
-
function
|
|
4282
|
+
function q(i, e) {
|
|
4204
4283
|
let t = i[0] ?? "";
|
|
4205
4284
|
for (let r = 0; r < e.length; r++)
|
|
4206
4285
|
t += String(e[r]) + (i[r + 1] ?? "");
|
|
4207
4286
|
return t;
|
|
4208
4287
|
}
|
|
4209
|
-
class
|
|
4288
|
+
class Kn {
|
|
4210
4289
|
constructor(e, t) {
|
|
4211
4290
|
this.languages = /* @__PURE__ */ new Map(), this.currentLanguage = "en", this.missingKeys = /* @__PURE__ */ new Map(), this.usedKeys = /* @__PURE__ */ new Set();
|
|
4212
4291
|
const r = t?.language || "en";
|
|
4213
|
-
this.currentLanguage = r, this.interpolate =
|
|
4292
|
+
this.currentLanguage = r, this.interpolate = bt(t?.globals), e && Object.keys(e).length && this.setLanguageData(r, e);
|
|
4214
4293
|
}
|
|
4215
4294
|
setGlobals(e) {
|
|
4216
|
-
return this.interpolate =
|
|
4295
|
+
return this.interpolate = bt(e), this;
|
|
4217
4296
|
}
|
|
4218
4297
|
set(e, t) {
|
|
4219
4298
|
const r = this.currentLanguage, n = this.ensureLanguageMap(r);
|
|
@@ -4227,20 +4306,20 @@ class Nn {
|
|
|
4227
4306
|
return this;
|
|
4228
4307
|
}
|
|
4229
4308
|
setLanguageData(e, t) {
|
|
4230
|
-
e =
|
|
4309
|
+
e = ie(e).toLowerCase();
|
|
4231
4310
|
const r = this.ensureLanguageMap(e), n = this.toStringRecord(t);
|
|
4232
4311
|
for (const [s, o] of Object.entries(n))
|
|
4233
4312
|
r.set(s, o);
|
|
4234
4313
|
return this;
|
|
4235
4314
|
}
|
|
4236
4315
|
setLanguage(e) {
|
|
4237
|
-
return e =
|
|
4316
|
+
return e = ie(e).toLowerCase(), this.currentLanguage = e, this;
|
|
4238
4317
|
}
|
|
4239
4318
|
getLanguage() {
|
|
4240
4319
|
return this.currentLanguage;
|
|
4241
4320
|
}
|
|
4242
4321
|
hasLanguage(e) {
|
|
4243
|
-
e =
|
|
4322
|
+
e = ie(e).toLowerCase();
|
|
4244
4323
|
const t = this.languages.get(e);
|
|
4245
4324
|
return t && Object.keys(t).length > 0;
|
|
4246
4325
|
}
|
|
@@ -4284,12 +4363,12 @@ class Nn {
|
|
|
4284
4363
|
}
|
|
4285
4364
|
$(...e) {
|
|
4286
4365
|
if (Array.isArray(e[0]) && e[0]?.raw) {
|
|
4287
|
-
const n = e[0], s = e.slice(1), o =
|
|
4366
|
+
const n = e[0], s = e.slice(1), o = q(n, s);
|
|
4288
4367
|
return this.translate(o);
|
|
4289
4368
|
}
|
|
4290
4369
|
const r = e;
|
|
4291
4370
|
return (n, ...s) => {
|
|
4292
|
-
const o =
|
|
4371
|
+
const o = q(n, s);
|
|
4293
4372
|
return this.translate(o, ...r);
|
|
4294
4373
|
};
|
|
4295
4374
|
}
|
|
@@ -4307,11 +4386,11 @@ class Nn {
|
|
|
4307
4386
|
}
|
|
4308
4387
|
$raw(...e) {
|
|
4309
4388
|
if (Array.isArray(e[0]) && e[0]?.raw) {
|
|
4310
|
-
const r = e[0], n = e.slice(1), s =
|
|
4389
|
+
const r = e[0], n = e.slice(1), s = q(r, n);
|
|
4311
4390
|
return this.translateRaw(s);
|
|
4312
4391
|
}
|
|
4313
4392
|
return (r, ...n) => {
|
|
4314
|
-
const s =
|
|
4393
|
+
const s = q(r, n);
|
|
4315
4394
|
return this.translateRaw(s);
|
|
4316
4395
|
};
|
|
4317
4396
|
}
|
|
@@ -4325,12 +4404,12 @@ class Nn {
|
|
|
4325
4404
|
}
|
|
4326
4405
|
$$(...e) {
|
|
4327
4406
|
if (Array.isArray(e[0]) && e[0]?.raw) {
|
|
4328
|
-
const n = e[0], s = e.slice(1), o =
|
|
4407
|
+
const n = e[0], s = e.slice(1), o = q(n, s);
|
|
4329
4408
|
return this.message(o);
|
|
4330
4409
|
}
|
|
4331
4410
|
const r = e;
|
|
4332
4411
|
return (n, ...s) => {
|
|
4333
|
-
const o =
|
|
4412
|
+
const o = q(n, s);
|
|
4334
4413
|
return this.message(o, ...r);
|
|
4335
4414
|
};
|
|
4336
4415
|
}
|
|
@@ -4348,11 +4427,11 @@ class Nn {
|
|
|
4348
4427
|
}
|
|
4349
4428
|
$$raw(...e) {
|
|
4350
4429
|
if (Array.isArray(e[0]) && e[0].raw) {
|
|
4351
|
-
const r = e[0], n = e.slice(1), s =
|
|
4430
|
+
const r = e[0], n = e.slice(1), s = q(r, n);
|
|
4352
4431
|
return this.messageRaw(s);
|
|
4353
4432
|
}
|
|
4354
4433
|
return (r, ...n) => {
|
|
4355
|
-
const s =
|
|
4434
|
+
const s = q(r, n);
|
|
4356
4435
|
return this.messageRaw(s);
|
|
4357
4436
|
};
|
|
4358
4437
|
}
|
|
@@ -4400,19 +4479,19 @@ class Nn {
|
|
|
4400
4479
|
return e;
|
|
4401
4480
|
}
|
|
4402
4481
|
}
|
|
4403
|
-
var
|
|
4482
|
+
var qn = Object.create, nt = Object.defineProperty, Wn = Object.getOwnPropertyDescriptor, ui = (i, e) => (e = Symbol[i]) ? e : /* @__PURE__ */ Symbol.for("Symbol." + i), fi = (i) => {
|
|
4404
4483
|
throw TypeError(i);
|
|
4405
|
-
},
|
|
4484
|
+
}, Gn = (i, e, t) => e in i ? nt(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t, Vn = (i, e) => nt(i, "name", { value: e, configurable: !0 }), Yn = (i) => [, , , qn(i?.[ui("metadata")] ?? null)], Jn = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"], di = (i) => i !== void 0 && typeof i != "function" ? fi("Function expected") : i, Xn = (i, e, t, r, n) => ({ kind: Jn[i], name: e, metadata: r, addInitializer: (s) => t._ ? fi("Already initialized") : n.push(di(s || null)) }), Qn = (i, e) => Gn(e, ui("metadata"), i[3]), Zn = (i, e, t, r) => {
|
|
4406
4485
|
for (var n = 0, s = i[e >> 1], o = s && s.length; n < o; n++) s[n].call(t);
|
|
4407
4486
|
return r;
|
|
4408
|
-
},
|
|
4409
|
-
var o, a, f, u = e & 7, p = !1, y = 0, _ = i[y] || (i[y] = []), g = u && (n = n.prototype, u < 5 && (u > 3 || !p) &&
|
|
4410
|
-
|
|
4487
|
+
}, es = (i, e, t, r, n, s) => {
|
|
4488
|
+
var o, a, f, u = e & 7, p = !1, y = 0, _ = i[y] || (i[y] = []), g = u && (n = n.prototype, u < 5 && (u > 3 || !p) && Wn(n, t));
|
|
4489
|
+
Vn(n, t);
|
|
4411
4490
|
for (var w = r.length - 1; w >= 0; w--)
|
|
4412
|
-
f =
|
|
4413
|
-
return
|
|
4414
|
-
},
|
|
4415
|
-
const
|
|
4491
|
+
f = Xn(u, t, a = {}, i[3], _), o = (0, r[w])(n, f), a._ = 1, di(o) && (n = o);
|
|
4492
|
+
return Qn(i, n), g && nt(n, t, g), p ? u ^ 4 ? s : g : n;
|
|
4493
|
+
}, pi, st, gi;
|
|
4494
|
+
const vt = new $(
|
|
4416
4495
|
$.object({
|
|
4417
4496
|
manifest_version: $.const(1).required(),
|
|
4418
4497
|
base_language: $.string().required(),
|
|
@@ -4431,16 +4510,16 @@ const yt = new $(
|
|
|
4431
4510
|
).required()
|
|
4432
4511
|
})
|
|
4433
4512
|
);
|
|
4434
|
-
|
|
4513
|
+
pi = [F(["wiki", "preferences"]), Jt(
|
|
4435
4514
|
$.object({
|
|
4436
4515
|
"i18n.index_url": $.string().description("I18n index URL (DO NOT CHANGE THIS) ").default(
|
|
4437
|
-
|
|
4516
|
+
rt.I18N_INDEX_URL
|
|
4438
4517
|
)
|
|
4439
4518
|
}).description("").extra("category", "general")
|
|
4440
4519
|
)];
|
|
4441
|
-
class
|
|
4520
|
+
class we extends (gi = z) {
|
|
4442
4521
|
constructor(e) {
|
|
4443
|
-
super(e, "i18n", !1), this.ctx = e, this.logger = void 0, this._indexUrl = void 0, this._indexCache = null, this.manager = void 0, this.i18nIndexDB = void 0, this.i18nDataDB = void 0, this.$ = void 0, this.$raw = void 0, this.$$ = void 0, this.$$raw = void 0, this.logger = this.ctx.logger("I18nService"), this.manager = new
|
|
4522
|
+
super(e, "i18n", !1), this.ctx = e, this.logger = void 0, this._indexUrl = void 0, this._indexCache = null, this.manager = void 0, this.i18nIndexDB = void 0, this.i18nDataDB = void 0, this.$ = void 0, this.$raw = void 0, this.$$ = void 0, this.$$raw = void 0, this.logger = this.ctx.logger("I18nService"), this.manager = new Kn(
|
|
4444
4523
|
{},
|
|
4445
4524
|
{
|
|
4446
4525
|
language: "",
|
|
@@ -4519,7 +4598,7 @@ class ye extends (fi = z) {
|
|
|
4519
4598
|
this.ctx.set("$", this.manager.$.bind(this.manager)), this.ctx.set("$raw", this.manager.$raw.bind(this.manager)), this.ctx.set("$$", this.manager.$$.bind(this.manager)), this.ctx.set("$$raw", this.manager.$$raw.bind(this.manager));
|
|
4520
4599
|
}
|
|
4521
4600
|
normalizeLanguageCode(e) {
|
|
4522
|
-
return !e || typeof e != "string" ? "en" : (e === "@user" && (e = this.ctx.wiki.userInfo.options.language || "en"), e === "@site" && (e = this.ctx.wiki.siteInfo.general.lang || "en"),
|
|
4601
|
+
return !e || typeof e != "string" ? "en" : (e === "@user" && (e = this.ctx.wiki.userInfo.options.language || "en"), e === "@site" && (e = this.ctx.wiki.siteInfo.general.lang || "en"), ie(String(e)).toLowerCase());
|
|
4523
4602
|
}
|
|
4524
4603
|
get language() {
|
|
4525
4604
|
return this.manager.getLanguage();
|
|
@@ -4557,7 +4636,7 @@ class ye extends (fi = z) {
|
|
|
4557
4636
|
);
|
|
4558
4637
|
}
|
|
4559
4638
|
findLanguageMeta(e, t) {
|
|
4560
|
-
const r =
|
|
4639
|
+
const r = ie(String(t)).toLowerCase(), n = e.languages[r];
|
|
4561
4640
|
if (n)
|
|
4562
4641
|
return {
|
|
4563
4642
|
code: r,
|
|
@@ -4577,7 +4656,7 @@ class ye extends (fi = z) {
|
|
|
4577
4656
|
const n = await this.i18nIndexDB.get(e);
|
|
4578
4657
|
if (n)
|
|
4579
4658
|
try {
|
|
4580
|
-
return
|
|
4659
|
+
return vt(n);
|
|
4581
4660
|
} catch (s) {
|
|
4582
4661
|
this.logger.error("Failed to parse cached i18n index", s), this.i18nIndexDB.delete(e);
|
|
4583
4662
|
}
|
|
@@ -4587,7 +4666,7 @@ class ye extends (fi = z) {
|
|
|
4587
4666
|
}
|
|
4588
4667
|
async fetchI18nIndex(e) {
|
|
4589
4668
|
const t = await fetch(e).then((r) => r.json());
|
|
4590
|
-
return
|
|
4669
|
+
return vt(t);
|
|
4591
4670
|
}
|
|
4592
4671
|
async ensureLanguageLoaded(e) {
|
|
4593
4672
|
if (!this.manager || !this._indexCache) throw new Error("I18nManager is not initialized");
|
|
@@ -4626,18 +4705,18 @@ class ye extends (fi = z) {
|
|
|
4626
4705
|
await this.i18nIndexDB.clear(), await this.i18nDataDB.clear();
|
|
4627
4706
|
}
|
|
4628
4707
|
}
|
|
4629
|
-
|
|
4630
|
-
|
|
4631
|
-
|
|
4632
|
-
const
|
|
4633
|
-
function
|
|
4634
|
-
if (typeof i == "string") return
|
|
4708
|
+
st = Yn(gi);
|
|
4709
|
+
we = es(st, 0, "I18nService", pi, we);
|
|
4710
|
+
Zn(st, 1, we);
|
|
4711
|
+
const ts = new TextEncoder();
|
|
4712
|
+
function is(i) {
|
|
4713
|
+
if (typeof i == "string") return ts.encode(i);
|
|
4635
4714
|
if (i instanceof ArrayBuffer) return new Uint8Array(i);
|
|
4636
4715
|
if (ArrayBuffer.isView(i))
|
|
4637
4716
|
return new Uint8Array(i.buffer, i.byteOffset, i.byteLength);
|
|
4638
4717
|
throw new TypeError("Unsupported input type");
|
|
4639
4718
|
}
|
|
4640
|
-
function
|
|
4719
|
+
function rs(i) {
|
|
4641
4720
|
let e = "";
|
|
4642
4721
|
for (let t = 0; t < i.length; t++) {
|
|
4643
4722
|
const r = i[t].toString(16).padStart(2, "0");
|
|
@@ -4645,10 +4724,10 @@ function Xn(i) {
|
|
|
4645
4724
|
}
|
|
4646
4725
|
return e;
|
|
4647
4726
|
}
|
|
4648
|
-
function
|
|
4727
|
+
function ns(i, e) {
|
|
4649
4728
|
return i << e | i >>> 32 - e;
|
|
4650
4729
|
}
|
|
4651
|
-
const
|
|
4730
|
+
const ss = [
|
|
4652
4731
|
7,
|
|
4653
4732
|
12,
|
|
4654
4733
|
17,
|
|
@@ -4713,42 +4792,42 @@ const Zn = [
|
|
|
4713
4792
|
10,
|
|
4714
4793
|
15,
|
|
4715
4794
|
21
|
|
4716
|
-
],
|
|
4717
|
-
function
|
|
4718
|
-
const e =
|
|
4795
|
+
], os = new Array(64).fill(0).map((i, e) => Math.floor(Math.abs(Math.sin(e + 1)) * 2 ** 32) >>> 0);
|
|
4796
|
+
function as(i) {
|
|
4797
|
+
const e = is(i), t = (56 - (e.length + 1) % 64 + 64) % 64, r = e.length + 1 + t + 8, n = new Uint8Array(r);
|
|
4719
4798
|
n.set(e, 0), n[e.length] = 128;
|
|
4720
4799
|
const s = e.length, o = s << 3 >>> 0, a = s >>> 29 >>> 0, f = new DataView(n.buffer);
|
|
4721
4800
|
f.setUint32(r - 8, o, !0), f.setUint32(r - 4, a, !0);
|
|
4722
4801
|
let u = 1732584193, p = 4023233417, y = 2562383102, _ = 271733878;
|
|
4723
4802
|
const g = new Uint32Array(16);
|
|
4724
|
-
for (let
|
|
4725
|
-
for (let m = 0; m < 16; m++) g[m] = f.getUint32(
|
|
4803
|
+
for (let A = 0; A < n.length; A += 64) {
|
|
4804
|
+
for (let m = 0; m < 16; m++) g[m] = f.getUint32(A + m * 4, !0);
|
|
4726
4805
|
let l = u, c = p, h = y, d = _;
|
|
4727
4806
|
for (let m = 0; m < 64; m++) {
|
|
4728
4807
|
let v, x;
|
|
4729
4808
|
m < 16 ? (v = c & h | ~c & d, x = m) : m < 32 ? (v = d & c | ~d & h, x = (5 * m + 1) % 16) : m < 48 ? (v = c ^ h ^ d, x = (3 * m + 5) % 16) : (v = h ^ (c | ~d), x = 7 * m % 16);
|
|
4730
|
-
const
|
|
4731
|
-
d = h, h = c, c = c +
|
|
4809
|
+
const C = d, Se = l + v + os[m] + g[x] >>> 0;
|
|
4810
|
+
d = h, h = c, c = c + ns(Se, ss[m]) >>> 0, l = C;
|
|
4732
4811
|
}
|
|
4733
4812
|
u = u + l >>> 0, p = p + c >>> 0, y = y + h >>> 0, _ = _ + d >>> 0;
|
|
4734
4813
|
}
|
|
4735
4814
|
const w = new Uint8Array(16), O = new DataView(w.buffer);
|
|
4736
4815
|
return O.setUint32(0, u, !0), O.setUint32(4, p, !0), O.setUint32(8, y, !0), O.setUint32(12, _, !0), w;
|
|
4737
4816
|
}
|
|
4738
|
-
var
|
|
4817
|
+
var cs = Object.create, ot = Object.defineProperty, ls = Object.getOwnPropertyDescriptor, mi = (i, e) => (e = Symbol[i]) ? e : /* @__PURE__ */ Symbol.for("Symbol." + i), yi = (i) => {
|
|
4739
4818
|
throw TypeError(i);
|
|
4740
|
-
},
|
|
4819
|
+
}, hs = (i, e, t) => e in i ? ot(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t, us = (i, e) => ot(i, "name", { value: e, configurable: !0 }), fs = (i) => [, , , cs(i?.[mi("metadata")] ?? null)], ds = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"], wi = (i) => i !== void 0 && typeof i != "function" ? yi("Function expected") : i, ps = (i, e, t, r, n) => ({ kind: ds[i], name: e, metadata: r, addInitializer: (s) => t._ ? yi("Already initialized") : n.push(wi(s || null)) }), gs = (i, e) => hs(e, mi("metadata"), i[3]), ms = (i, e, t, r) => {
|
|
4741
4820
|
for (var n = 0, s = i[e >> 1], o = s && s.length; n < o; n++) s[n].call(t);
|
|
4742
4821
|
return r;
|
|
4743
|
-
},
|
|
4744
|
-
var o, a, f, u = e & 7, p = !1, y = 0, _ = i[y] || (i[y] = []), g = u && (n = n.prototype, u < 5 && (u > 3 || !p) &&
|
|
4745
|
-
|
|
4822
|
+
}, ys = (i, e, t, r, n, s) => {
|
|
4823
|
+
var o, a, f, u = e & 7, p = !1, y = 0, _ = i[y] || (i[y] = []), g = u && (n = n.prototype, u < 5 && (u > 3 || !p) && ls(n, t));
|
|
4824
|
+
us(n, t);
|
|
4746
4825
|
for (var w = r.length - 1; w >= 0; w--)
|
|
4747
|
-
f =
|
|
4748
|
-
return
|
|
4749
|
-
},
|
|
4750
|
-
|
|
4751
|
-
class
|
|
4826
|
+
f = ps(u, t, a = {}, i[3], _), o = (0, r[w])(n, f), a._ = 1, wi(o) && (n = o);
|
|
4827
|
+
return gs(i, n), g && ot(n, t, g), p ? u ^ 4 ? s : g : n;
|
|
4828
|
+
}, bi, at, vi;
|
|
4829
|
+
bi = [F(["wiki", "wikiTitle", "wikiPage", "apiService"])];
|
|
4830
|
+
class be extends (vi = z) {
|
|
4752
4831
|
constructor(e) {
|
|
4753
4832
|
super(e, "wikiFile", !0), this.ctx = e;
|
|
4754
4833
|
}
|
|
@@ -4756,7 +4835,7 @@ class we extends (yi = z) {
|
|
|
4756
4835
|
return this.ctx.wiki.fileRepos || [];
|
|
4757
4836
|
}
|
|
4758
4837
|
get defaultFileRepo() {
|
|
4759
|
-
return this.fileRepos[0];
|
|
4838
|
+
return this.localFileRepo || this.fileRepos[0];
|
|
4760
4839
|
}
|
|
4761
4840
|
get localFileRepo() {
|
|
4762
4841
|
return this.fileRepos.find((e) => e.local);
|
|
@@ -4770,7 +4849,7 @@ class we extends (yi = z) {
|
|
|
4770
4849
|
return e.getMainDBKey().split("/").pop() || "";
|
|
4771
4850
|
}
|
|
4772
4851
|
getHashPath(e, t = 2) {
|
|
4773
|
-
const r = this.getFileName(e), n =
|
|
4852
|
+
const r = this.getFileName(e), n = rs(as(r));
|
|
4774
4853
|
let s = [];
|
|
4775
4854
|
for (let o = 1; o <= t; o++)
|
|
4776
4855
|
s.push(n.slice(0, o));
|
|
@@ -4797,34 +4876,34 @@ class we extends (yi = z) {
|
|
|
4797
4876
|
);
|
|
4798
4877
|
}
|
|
4799
4878
|
}
|
|
4800
|
-
|
|
4801
|
-
|
|
4802
|
-
|
|
4803
|
-
class
|
|
4879
|
+
at = fs(vi);
|
|
4880
|
+
be = ys(at, 0, "WikiFileService", bi, be);
|
|
4881
|
+
ms(at, 1, be);
|
|
4882
|
+
class ve extends M {
|
|
4804
4883
|
constructor(e) {
|
|
4805
4884
|
super({
|
|
4806
4885
|
name: "InPageEdit"
|
|
4807
|
-
}), this.version = "0.
|
|
4886
|
+
}), this.version = "0.17.0", this.Endpoints = rt, this.schema = $, this.config = Ci(ve.DEFAULT_CONFIG, e), this.logger = lr({
|
|
4808
4887
|
name: "IPE",
|
|
4809
4888
|
color: "#33aaff",
|
|
4810
4889
|
level: this.config.logLevel
|
|
4811
|
-
}), this.#
|
|
4890
|
+
}), this.#t();
|
|
4812
4891
|
}
|
|
4813
4892
|
static {
|
|
4814
4893
|
this.DEFAULT_CONFIG = {
|
|
4815
4894
|
apiConfigs: {},
|
|
4816
4895
|
legacyPreferences: {},
|
|
4817
|
-
logLevel:
|
|
4896
|
+
logLevel: Lt.info,
|
|
4818
4897
|
storageNamespace: "InPageEdit",
|
|
4819
4898
|
autoloadStyles: !0,
|
|
4820
4899
|
autoInstallCorePlugins: !0
|
|
4821
4900
|
};
|
|
4822
4901
|
}
|
|
4823
|
-
async #
|
|
4824
|
-
await this.#i(), this.config.autoInstallCorePlugins && this.#
|
|
4902
|
+
async #t() {
|
|
4903
|
+
await this.#i(), this.config.autoInstallCorePlugins && this.#e(), this.#n();
|
|
4825
4904
|
}
|
|
4826
4905
|
async #i() {
|
|
4827
|
-
this.plugin(
|
|
4906
|
+
this.plugin(we), this.plugin(ur, this.config.apiConfigs), this.plugin(xr), this.plugin(kr), this.plugin(Yr), this.plugin(ye), this.plugin(un, { dbName: this.config.storageNamespace }), this.plugin(me), this.plugin(be), this.plugin(ge), this.plugin(Sn), this.plugin(et), this.#r([
|
|
4828
4907
|
"i18n",
|
|
4829
4908
|
"$",
|
|
4830
4909
|
"$$",
|
|
@@ -4844,37 +4923,37 @@ class be extends N {
|
|
|
4844
4923
|
"getMainpageUrl"
|
|
4845
4924
|
]);
|
|
4846
4925
|
}
|
|
4847
|
-
#
|
|
4926
|
+
#r(e) {
|
|
4848
4927
|
if (!Array.isArray(e) || e.length === 0) return this;
|
|
4849
4928
|
for (const t of e) {
|
|
4850
|
-
const r = this[
|
|
4929
|
+
const r = this[ve.internal][t];
|
|
4851
4930
|
r?.type === "service" && (r.builtin = !0);
|
|
4852
4931
|
}
|
|
4853
4932
|
return this;
|
|
4854
4933
|
}
|
|
4855
4934
|
// TODO: 这里不应该硬编码,暂时先这样
|
|
4856
|
-
async #
|
|
4935
|
+
async #e() {
|
|
4857
4936
|
[
|
|
4858
|
-
import("./index-
|
|
4859
|
-
import("./index-
|
|
4937
|
+
import("./index-BvHXETfl.js").then(({ PluginAnalytics: t }) => t),
|
|
4938
|
+
import("./index-CZ56EKIK.js").then(
|
|
4860
4939
|
({ PluginInArticleLinks: t }) => t
|
|
4861
4940
|
),
|
|
4862
|
-
import("./index-
|
|
4863
|
-
import("./index-
|
|
4941
|
+
import("./index-C2_G8gLW.js").then(({ PluginPluginStore: t }) => t),
|
|
4942
|
+
import("./index-5DLUhCA3.js").then(
|
|
4864
4943
|
({ PluginPreferencesUI: t }) => t
|
|
4865
4944
|
),
|
|
4866
|
-
import("./index-
|
|
4867
|
-
import("./index-
|
|
4868
|
-
import("./index-
|
|
4945
|
+
import("./index-s7aFr-gn.js").then(({ PluginQuickEdit: t }) => t),
|
|
4946
|
+
import("./index-B5UcAL5E.js").then(({ PluginQuickMove: t }) => t),
|
|
4947
|
+
import("./index-siZBRSp0.js").then(
|
|
4869
4948
|
({ PluginQuickPreview: t }) => t
|
|
4870
4949
|
),
|
|
4871
|
-
import("./index-
|
|
4872
|
-
import("./index-
|
|
4950
|
+
import("./index-C4ncbyR6.js").then(({ PluginQuickDiff: t }) => t),
|
|
4951
|
+
import("./index-BTLjDVvD.js").then(
|
|
4873
4952
|
({ PluginQuickRedirect: t }) => t
|
|
4874
4953
|
),
|
|
4875
|
-
import("./index-
|
|
4876
|
-
import("./index-
|
|
4877
|
-
import("./index-
|
|
4954
|
+
import("./index-BMd6Bo6r.js").then(({ PluginQuickUpload: t }) => t),
|
|
4955
|
+
import("./index-Cjyf3z1w.js").then(({ PluginQuickUsage: t }) => t),
|
|
4956
|
+
import("./index-Dfp9Vp36.js").then(({ PluginToolbox: t }) => t)
|
|
4878
4957
|
].forEach(async (t) => {
|
|
4879
4958
|
this.plugin(await t);
|
|
4880
4959
|
});
|
|
@@ -4886,47 +4965,49 @@ class be extends N {
|
|
|
4886
4965
|
});
|
|
4887
4966
|
}
|
|
4888
4967
|
async withInject(e) {
|
|
4889
|
-
const { promise: t, resolve: r } =
|
|
4968
|
+
const { promise: t, resolve: r } = _t();
|
|
4890
4969
|
return this.inject(e, (n) => {
|
|
4891
4970
|
r(n);
|
|
4892
4971
|
}), t;
|
|
4893
4972
|
}
|
|
4894
4973
|
}
|
|
4895
4974
|
export {
|
|
4896
|
-
|
|
4897
|
-
|
|
4898
|
-
|
|
4899
|
-
|
|
4900
|
-
|
|
4901
|
-
|
|
4902
|
-
|
|
4903
|
-
|
|
4904
|
-
|
|
4905
|
-
|
|
4975
|
+
Lt as $,
|
|
4976
|
+
ur as A,
|
|
4977
|
+
dn as B,
|
|
4978
|
+
Le as C,
|
|
4979
|
+
rt as E,
|
|
4980
|
+
Zi as F,
|
|
4981
|
+
ve as I,
|
|
4982
|
+
ht as M,
|
|
4983
|
+
pe as N,
|
|
4984
|
+
Ye as P,
|
|
4985
|
+
Jt as R,
|
|
4906
4986
|
$ as S,
|
|
4907
|
-
|
|
4908
|
-
|
|
4987
|
+
me as T,
|
|
4988
|
+
be as W,
|
|
4909
4989
|
F as a,
|
|
4910
|
-
|
|
4911
|
-
|
|
4990
|
+
Ot as b,
|
|
4991
|
+
Qi as c,
|
|
4912
4992
|
z as d,
|
|
4913
|
-
|
|
4914
|
-
|
|
4915
|
-
|
|
4916
|
-
|
|
4917
|
-
|
|
4918
|
-
|
|
4919
|
-
|
|
4993
|
+
Xi as e,
|
|
4994
|
+
lr as f,
|
|
4995
|
+
_s as g,
|
|
4996
|
+
vs as h,
|
|
4997
|
+
xs as i,
|
|
4998
|
+
un as j,
|
|
4999
|
+
xr as k,
|
|
4920
5000
|
R as l,
|
|
4921
|
-
|
|
4922
|
-
|
|
4923
|
-
|
|
4924
|
-
|
|
4925
|
-
|
|
4926
|
-
|
|
5001
|
+
Ke as m,
|
|
5002
|
+
Yr as n,
|
|
5003
|
+
ye as o,
|
|
5004
|
+
ie as p,
|
|
5005
|
+
pt as q,
|
|
5006
|
+
kr as r,
|
|
4927
5007
|
b as s,
|
|
4928
|
-
|
|
4929
|
-
|
|
4930
|
-
|
|
5008
|
+
ge as t,
|
|
5009
|
+
fn as u,
|
|
5010
|
+
Sn as v,
|
|
5011
|
+
et as w
|
|
4931
5012
|
};
|
|
4932
|
-
//# sourceMappingURL=index-
|
|
5013
|
+
//# sourceMappingURL=index-BfW7ObKf.js.map
|