@inpageedit/core 0.16.0 → 0.16.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/InPageEdit.js +2 -2
  2. package/dist/{PluginImagesUsed-BVyvFA1_.js → PluginImagesUsed-DnPDXczO.js} +2 -2
  3. package/dist/{PluginImagesUsed-BVyvFA1_.js.map → PluginImagesUsed-DnPDXczO.js.map} +1 -1
  4. package/dist/{PluginPrefSync-CUKkx4Qk.js → PluginPrefSync-CDTFyM8g.js} +2 -2
  5. package/dist/{PluginPrefSync-CUKkx4Qk.js.map → PluginPrefSync-CDTFyM8g.js.map} +1 -1
  6. package/dist/{PluginStoreApp-CoOAw1fr.js → PluginStoreApp-Bng4DFBZ.js} +2 -2
  7. package/dist/{PluginStoreApp-CoOAw1fr.js.map → PluginStoreApp-Bng4DFBZ.js.map} +1 -1
  8. package/dist/{PluginTemplatesUsed-CdjT1wR4.js → PluginTemplatesUsed-oM_VzfbH.js} +2 -2
  9. package/dist/{PluginTemplatesUsed-CdjT1wR4.js.map → PluginTemplatesUsed-oM_VzfbH.js.map} +1 -1
  10. package/dist/core.js +2 -2
  11. package/dist/{index-BPTMltVf.js → index-1sZXko-X.js} +2 -2
  12. package/dist/{index-BPTMltVf.js.map → index-1sZXko-X.js.map} +1 -1
  13. package/dist/{index-Dm2vgYkZ.js → index-42B3CrSO.js} +2 -2
  14. package/dist/{index-Dm2vgYkZ.js.map → index-42B3CrSO.js.map} +1 -1
  15. package/dist/{index-1tsXE6ax.js → index-BBUv7Lv6.js} +2 -2
  16. package/dist/{index-1tsXE6ax.js.map → index-BBUv7Lv6.js.map} +1 -1
  17. package/dist/{index-BYlcHc-O.js → index-BcTomMXW.js} +3 -3
  18. package/dist/{index-BYlcHc-O.js.map → index-BcTomMXW.js.map} +1 -1
  19. package/dist/{index-bQ0CVu3l.js → index-BllIuJSJ.js} +3 -3
  20. package/dist/{index-bQ0CVu3l.js.map → index-BllIuJSJ.js.map} +1 -1
  21. package/dist/{index-CAtPo7xJ.js → index-Bn6y0Eln.js} +2 -2
  22. package/dist/{index-CAtPo7xJ.js.map → index-Bn6y0Eln.js.map} +1 -1
  23. package/dist/index-C0spLL-i.js +1661 -0
  24. package/dist/index-C0spLL-i.js.map +1 -0
  25. package/dist/{index-DZa9mxN4.js → index-CMmEZcB1.js} +2 -2
  26. package/dist/{index-DZa9mxN4.js.map → index-CMmEZcB1.js.map} +1 -1
  27. package/dist/{index-B32tFyLB.js → index-CN7r2e0P.js} +3 -3
  28. package/dist/{index-B32tFyLB.js.map → index-CN7r2e0P.js.map} +1 -1
  29. package/dist/{index-CVCy0wPP.js → index-CkSHCMRN.js} +2 -2
  30. package/dist/{index-CVCy0wPP.js.map → index-CkSHCMRN.js.map} +1 -1
  31. package/dist/{index-QnWieXQc.js → index-D7rUF8vA.js} +584 -569
  32. package/dist/index-D7rUF8vA.js.map +1 -0
  33. package/dist/{index-ygc4AMy4.js → index-DlCbsA25.js} +3 -3
  34. package/dist/{index-ygc4AMy4.js.map → index-DlCbsA25.js.map} +1 -1
  35. package/dist/{index-C4qm_X_A.js → index-TG_MTC9y.js} +2 -2
  36. package/dist/{index-C4qm_X_A.js.map → index-TG_MTC9y.js.map} +1 -1
  37. package/dist/{index-NWWeW3tX.js → index-mf_pX14E.js} +2 -2
  38. package/dist/{index-NWWeW3tX.js.map → index-mf_pX14E.js.map} +1 -1
  39. package/dist/index.d.ts +37383 -1361
  40. package/dist/index.js +2 -2
  41. package/dist/models/index.js +1 -1
  42. package/dist/plugins/index.js +12 -12
  43. package/dist/services/index.js +1 -1
  44. package/lib/index.umd.js +20 -20
  45. package/lib/index.umd.js.map +1 -1
  46. package/package.json +14 -14
  47. package/dist/index-CYfkwXRf.js +0 -1631
  48. package/dist/index-CYfkwXRf.js.map +0 -1
  49. package/dist/index-QnWieXQc.js.map +0 -1
@@ -0,0 +1,1661 @@
1
+ function x(n) {
2
+ if (typeof globalThis.structuredClone == "function")
3
+ try {
4
+ return globalThis.structuredClone(n);
5
+ } catch {
6
+ }
7
+ return q(n, /* @__PURE__ */ new WeakMap());
8
+ }
9
+ function q(n, e) {
10
+ if (typeof n != "object" || n === null) return n;
11
+ const t = e.get(n);
12
+ if (t) return t;
13
+ if (n instanceof Date) return new Date(n.getTime());
14
+ if (n instanceof RegExp)
15
+ return new RegExp(n.source, n.flags);
16
+ if (n instanceof URL) return new URL(n.toString());
17
+ if (n instanceof URLSearchParams)
18
+ return new URLSearchParams(n.toString());
19
+ if (n instanceof ArrayBuffer) return n.slice(0);
20
+ if (ArrayBuffer.isView(n)) {
21
+ if (n instanceof DataView)
22
+ return new DataView(
23
+ n.buffer.slice(0),
24
+ n.byteOffset,
25
+ n.byteLength
26
+ );
27
+ const i = n, c = i.constructor;
28
+ return new c(i.buffer.slice(0), i.byteOffset, i.length);
29
+ }
30
+ if (n instanceof Map) {
31
+ const i = /* @__PURE__ */ new Map();
32
+ return e.set(n, i), n.forEach((c, l) => {
33
+ i.set(q(l, e), q(c, e));
34
+ }), i;
35
+ }
36
+ if (n instanceof Set) {
37
+ const i = /* @__PURE__ */ new Set();
38
+ return e.set(n, i), n.forEach((c) => i.add(q(c, e))), i;
39
+ }
40
+ if (Array.isArray(n)) {
41
+ const i = new Array(n.length);
42
+ e.set(n, i);
43
+ for (let c = 0; c < i.length; c++)
44
+ i[c] = q(n[c], e);
45
+ return i;
46
+ }
47
+ const s = Object.getPrototypeOf(n), r = Object.create(s);
48
+ e.set(n, r);
49
+ const o = Object.getOwnPropertyDescriptors(n);
50
+ for (const i of Reflect.ownKeys(o)) {
51
+ const c = o[i];
52
+ "value" in c && (c.value = q(c.value, e)), Object.defineProperty(r, i, c);
53
+ }
54
+ return r;
55
+ }
56
+ function S(n) {
57
+ if (typeof n != "object" || n === null)
58
+ return !1;
59
+ const e = Object.getPrototypeOf(n);
60
+ return e === Object.prototype || e === null;
61
+ }
62
+ const W = function(n) {
63
+ const e = this.constructor.prototype, t = Reflect.get(e, n, e);
64
+ function s(...r) {
65
+ return Reflect.apply(t, s, r);
66
+ }
67
+ Reflect.setPrototypeOf(s, e);
68
+ for (const r of Reflect.ownKeys(t)) {
69
+ const o = Reflect.getOwnPropertyDescriptor(t, r);
70
+ o && Reflect.defineProperty(s, r, o);
71
+ }
72
+ return s;
73
+ };
74
+ W.prototype = Object.create(Function.prototype);
75
+ const X = W;
76
+ function A(n, ...e) {
77
+ const t = x(n || {});
78
+ for (const s of e)
79
+ if (s != null)
80
+ for (const r of Reflect.ownKeys(s)) {
81
+ const o = s[r];
82
+ if (typeof o > "u") continue;
83
+ if (o === null) {
84
+ delete t[r];
85
+ continue;
86
+ }
87
+ const i = t[r];
88
+ S(i) && S(o) ? t[r] = A(i, o) : t[r] = x(o);
89
+ }
90
+ return t;
91
+ }
92
+ var R = /* @__PURE__ */ ((n) => (n.BODY_USED = "BODY_USED", n.NO_BODY_READER = "NO_BODY_READER", n.TIMEOUT = "TIMEOUT", n.NETWORK_ERROR = "NETWORK_ERROR", n.BODY_NOT_ALLOWED = "BODY_NOT_ALLOWED", n.HOOK_CONTEXT_CHANGED = "HOOK_CONTEXT_CHANGED", n.ABORTED_BY_HOOK = "ABORTED_BY_HOOK", n.INVALID_HOOK_CALLBACK = "INVALID_HOOK_CALLBACK", n.UNEXPECTED_HOOK_RETURN = "UNEXPECTED_HOOK_RETURN", n.UNSUPPORTED_RESPONSE_TYPE = "UNSUPPORTED_RESPONSE_TYPE", n.FEATURE_MOVED_TO_PLUGIN = "FEATURE_MOVED_TO_PLUGIN", n.BODY_TRANSFORM_ERROR = "BODY_TRANSFORM_ERROR", n))(R || {});
93
+ class y extends Error {
94
+ constructor(e, t, s, r) {
95
+ super(t, r), this.code = e, this.context = s;
96
+ }
97
+ name = "FexiosError";
98
+ static is(e, t) {
99
+ return !(e instanceof y) || e instanceof C ? !1 : t ? e.code === t : !0;
100
+ }
101
+ }
102
+ class C extends y {
103
+ constructor(e, t, s) {
104
+ super(t.statusText, e, void 0, s), this.response = t;
105
+ }
106
+ name = "FexiosResponseError";
107
+ static is(e) {
108
+ return e instanceof C;
109
+ }
110
+ }
111
+ var E;
112
+ ((n) => {
113
+ n.makeSearchParams = (s) => {
114
+ if (!s)
115
+ return new URLSearchParams();
116
+ if (s instanceof URLSearchParams)
117
+ return s;
118
+ if (typeof s != "object" || s?.constructor !== Object)
119
+ throw new TypeError("only plain object is supported");
120
+ const r = new URLSearchParams(), o = (l, a) => {
121
+ a != null && r.append(l, a);
122
+ }, i = (l, a) => {
123
+ a != null && r.set(l, a);
124
+ }, c = (l, a) => {
125
+ if (a != null) {
126
+ if (Array.isArray(a)) {
127
+ for (const f of a) o(l, f?.toString());
128
+ return;
129
+ }
130
+ if (typeof a == "object" && a.constructor === Object) {
131
+ for (const [f, u] of Object.entries(a)) {
132
+ if (u == null) continue;
133
+ const h = f.endsWith("[]"), d = h ? f.slice(0, -2) : f, p = `${l}[${d}]`;
134
+ if (h) {
135
+ const w = `${p}[]`;
136
+ if (Array.isArray(u))
137
+ for (const N of u) o(w, N?.toString());
138
+ else typeof u == "object" && u !== null && u.constructor === Object ? c(`${p}[]`, u) : o(w, u?.toString());
139
+ } else if (Array.isArray(u))
140
+ for (const w of u) o(p, w?.toString());
141
+ else typeof u == "object" && u !== null && u.constructor === Object ? c(p, u) : i(p, u?.toString());
142
+ }
143
+ return;
144
+ }
145
+ i(l, a?.toString());
146
+ }
147
+ };
148
+ for (const [l, a] of Object.entries(s))
149
+ c(l, a);
150
+ return r;
151
+ }, n.makeQueryString = (s) => (0, n.makeSearchParams)(s).toString(), n.makeURL = (s, r, o, i) => {
152
+ const c = typeof window < "u" && window.location?.origin || "http://localhost", l = typeof s == "string" ? new URL(s, i ?? c) : new URL(s), a = (0, n.toQueryRecord)(l.searchParams), f = (0, n.mergeQueries)(a, r || {}), u = (0, n.makeSearchParams)(f);
153
+ return l.search = u.toString(), typeof o < "u" && (l.hash = o), l;
154
+ }, n.toQueryRecord = (s) => {
155
+ typeof s == "string" && (s = (0, n.fromString)(s));
156
+ const r = {}, o = (c) => {
157
+ if (!c.includes("[")) return { path: [c], forceArray: !1 };
158
+ const a = [c.slice(0, c.indexOf("["))], f = /\[([^\]]*)\]/g;
159
+ let u, h = !1, d = !1;
160
+ for (; u = f.exec(c); )
161
+ u[1] === "" ? (h = !0, d = !0) : (a.push(u[1]), d = !1);
162
+ return h && d && (a[a.length - 1] = a[a.length - 1] + "[]"), { path: a, forceArray: h };
163
+ }, i = (c, l, a, f) => {
164
+ let u = c;
165
+ for (let h = 0; h < l.length; h++) {
166
+ const d = l[h];
167
+ h === l.length - 1 ? f ? u[d] === void 0 ? u[d] = [a] : Array.isArray(u[d]) ? u[d].push(a) : u[d] = [u[d], a] : u[d] === void 0 ? u[d] = a : Array.isArray(u[d]) ? u[d].push(a) : u[d] = [u[d], a] : ((u[d] === void 0 || typeof u[d] != "object" || Array.isArray(u[d])) && (u[d] = {}), u = u[d]);
168
+ }
169
+ };
170
+ for (const [c, l] of s.entries()) {
171
+ const { path: a, forceArray: f } = o(String(c));
172
+ i(r, a, l?.toString(), f);
173
+ }
174
+ return r;
175
+ }, n.fromString = (s) => {
176
+ const r = s.trim();
177
+ if (!r) return new URLSearchParams();
178
+ if (r.startsWith("?")) return new URLSearchParams(r.slice(1));
179
+ const o = r.indexOf("?");
180
+ if (o >= 0) {
181
+ const i = r.indexOf("#", o + 1), c = r.slice(o + 1, i >= 0 ? i : void 0);
182
+ return new URLSearchParams(c);
183
+ }
184
+ return new URLSearchParams(r);
185
+ }, n.mergeQueries = (...s) => {
186
+ const r = {};
187
+ for (const o of s)
188
+ o != null && t(r, e(o));
189
+ return r;
190
+ };
191
+ function e(s) {
192
+ if (!s) return {};
193
+ if (s instanceof URLSearchParams || s instanceof FormData || s instanceof Map)
194
+ return (0, n.toQueryRecord)(s);
195
+ if (typeof s == "string") return (0, n.toQueryRecord)((0, n.fromString)(s));
196
+ if (S(s)) return s;
197
+ throw new TypeError(
198
+ `unsupported type transformation, got: ${Object.prototype.toString.call(
199
+ s
200
+ )}`
201
+ );
202
+ }
203
+ function t(s, r) {
204
+ for (const [o, i] of Object.entries(r)) {
205
+ if (i === void 0) continue;
206
+ if (i === null) {
207
+ delete s[o];
208
+ continue;
209
+ }
210
+ const c = s[o];
211
+ S(c) && S(i) ? t(c, i) : s[o] = x(i);
212
+ }
213
+ }
214
+ })(E || (E = {}));
215
+ class Q {
216
+ constructor(e, t, s) {
217
+ this.rawResponse = e, this.data = t, this.responseType = s, ["ok", "status", "statusText", "headers", "url", "redirected"].forEach(
218
+ (r) => {
219
+ Reflect.defineProperty(this, r, {
220
+ get: () => e[r]
221
+ });
222
+ }
223
+ );
224
+ }
225
+ ok;
226
+ status;
227
+ statusText;
228
+ headers;
229
+ url;
230
+ redirected;
231
+ }
232
+ const H = (n) => {
233
+ const e = n.reduce((r, o) => r + o.length, 0), t = new Uint8Array(e);
234
+ let s = 0;
235
+ for (const r of n)
236
+ t.set(r, s), s += r.length;
237
+ return t;
238
+ };
239
+ async function J(n, e, t) {
240
+ const s = n.getReader();
241
+ if (!s)
242
+ throw new y(
243
+ R.NO_BODY_READER,
244
+ "Failed to get ReadableStream from response body"
245
+ );
246
+ const r = [];
247
+ let o = 0;
248
+ try {
249
+ for (; ; ) {
250
+ const { done: c, value: l } = await s.read();
251
+ if (c) break;
252
+ r.push(l), o += l.length, t && e > 0 && t(o / e, H(r));
253
+ }
254
+ } finally {
255
+ s.releaseLock?.();
256
+ }
257
+ const i = H(r);
258
+ return t?.(1, i), i;
259
+ }
260
+ const Z = (n) => {
261
+ if (n) {
262
+ if (n.includes("application/json") || n.endsWith("+json"))
263
+ return "json";
264
+ if (n.startsWith("text/")) return "text";
265
+ if (n.includes("multipart/form-data") || n.includes("application/x-www-form-urlencoded"))
266
+ return "form";
267
+ if (/^image\//.test(n) || /^video\//.test(n) || /^audio\//.test(n) || n.includes("application/pdf"))
268
+ return "blob";
269
+ if (n.includes("application/octet-stream") || n.includes("application/zip") || n.includes("application/x-tar") || n.includes("application/x-7z-compressed") || n.includes("application/x-gzip"))
270
+ return "arrayBuffer";
271
+ }
272
+ };
273
+ async function F(n, e, t, s, r) {
274
+ const o = n.clone(), i = n.headers.get("content-type")?.toLowerCase() ?? "", c = n.headers.get("content-length"), l = c ? Number(c) : 0, a = n.headers.get("upgrade")?.toLowerCase(), f = n.headers.get("connection")?.toLowerCase();
275
+ if (e === "ws" || e === "stream")
276
+ throw new y(
277
+ R.FEATURE_MOVED_TO_PLUGIN,
278
+ `responseType "${String(
279
+ e
280
+ )}" has been moved to plugins. Use "fexios/plugins" (fx.plugin(pluginWebSocket) / fx.plugin(pluginSSE)) and call fx.ws()/fx.sse() instead.`
281
+ );
282
+ if (a === "websocket" && f === "upgrade")
283
+ throw new y(
284
+ R.FEATURE_MOVED_TO_PLUGIN,
285
+ 'WebSocket upgrade response detected. WebSocket support has been moved to plugins. Please use "fexios/plugins" and call fx.ws().'
286
+ );
287
+ if (i.includes("text/event-stream"))
288
+ throw new y(
289
+ R.FEATURE_MOVED_TO_PLUGIN,
290
+ 'SSE (text/event-stream) response detected. SSE support has been moved to plugins. Please use "fexios/plugins" and call fx.sse().'
291
+ );
292
+ let u = e ?? Z(i) ?? "text";
293
+ const h = /\bcharset=([^;]+)/i.exec(i)?.[1]?.trim() || "utf-8", d = new TextDecoder(h);
294
+ let p;
295
+ try {
296
+ if (u === "form")
297
+ p = await o.formData();
298
+ else {
299
+ const m = await J(o.body, l, t);
300
+ if (u === "arrayBuffer")
301
+ p = m.buffer.slice(
302
+ m.byteOffset,
303
+ m.byteOffset + m.byteLength
304
+ );
305
+ else if (u === "blob")
306
+ p = new Blob([m], {
307
+ type: i || "application/octet-stream"
308
+ });
309
+ else if (u === "text") {
310
+ const T = d.decode(m);
311
+ if (e)
312
+ p = T;
313
+ else {
314
+ const L = T.trim();
315
+ if (L.startsWith("{") && L.endsWith("}") || L.startsWith("[") && L.endsWith("]"))
316
+ try {
317
+ p = JSON.parse(L), u = "json";
318
+ } catch {
319
+ p = T;
320
+ }
321
+ else
322
+ p = T;
323
+ }
324
+ } else if (u === "json") {
325
+ const T = d.decode(m);
326
+ p = T.length ? JSON.parse(T) : null;
327
+ } else
328
+ p = m;
329
+ }
330
+ } catch (m) {
331
+ if (!(m instanceof Error)) throw m;
332
+ try {
333
+ p = await o.text(), u = "text";
334
+ } catch {
335
+ throw new y(
336
+ R.BODY_TRANSFORM_ERROR,
337
+ `Failed to transform response body to ${u}`,
338
+ void 0,
339
+ { cause: m }
340
+ );
341
+ }
342
+ }
343
+ const w = new Q(
344
+ n,
345
+ p,
346
+ u
347
+ ), N = s?.(w);
348
+ if (typeof N == "boolean" ? N : !w.ok)
349
+ throw new C(w.statusText, w);
350
+ return w;
351
+ }
352
+ var k;
353
+ ((n) => {
354
+ n.makeHeaders = (e) => {
355
+ if (!e) return new Headers();
356
+ if (e instanceof Headers) return new Headers(e);
357
+ const t = new Headers();
358
+ if (e instanceof Map) {
359
+ for (const [s, r] of e.entries())
360
+ if (r != null)
361
+ if (Array.isArray(r))
362
+ for (const o of r)
363
+ o != null && t.append(s, String(o));
364
+ else
365
+ t.append(s, String(r));
366
+ return t;
367
+ }
368
+ if (S(e)) {
369
+ for (const [s, r] of Object.entries(e))
370
+ if (r != null)
371
+ if (Array.isArray(r))
372
+ for (const o of r)
373
+ o != null && t.append(s, String(o));
374
+ else
375
+ t.append(s, String(r));
376
+ return t;
377
+ }
378
+ throw new TypeError(
379
+ "only plain object, Map/ReadonlyMap, or Headers is supported"
380
+ );
381
+ }, n.toHeaderRecord = (e) => {
382
+ if (e instanceof Headers) {
383
+ const t = {};
384
+ return e.forEach((s, r) => {
385
+ t[r] = t[r] ? [...t[r], s] : [s];
386
+ }), t;
387
+ }
388
+ if (e instanceof Map) {
389
+ const t = {};
390
+ for (const [s, r] of e.entries())
391
+ if (r != null)
392
+ if (Array.isArray(r)) {
393
+ const o = r.filter((i) => i != null).map((i) => String(i));
394
+ o.length && (t[s] = (t[s] ?? []).concat(o));
395
+ } else {
396
+ const o = String(r);
397
+ t[s] = t[s] ? [...t[s], o] : [o];
398
+ }
399
+ return t;
400
+ }
401
+ throw new TypeError(
402
+ `unsupported type transformation, got: ${Object.prototype.toString.call(
403
+ e
404
+ )}`
405
+ );
406
+ }, n.mergeHeaders = (...e) => {
407
+ const t = new Headers(), s = (r) => {
408
+ for (const [o, i] of Object.entries(r))
409
+ if (i !== void 0) {
410
+ if (i === null) {
411
+ t.delete(o);
412
+ continue;
413
+ }
414
+ if (Array.isArray(i)) {
415
+ t.delete(o);
416
+ for (const c of i)
417
+ c != null && t.append(o, String(c));
418
+ } else
419
+ t.set(o, String(i));
420
+ }
421
+ };
422
+ for (const r of e) {
423
+ if (r == null) continue;
424
+ if (r instanceof Headers) {
425
+ r.forEach((i, c) => {
426
+ t.set(c, i);
427
+ });
428
+ continue;
429
+ }
430
+ if (S(r)) {
431
+ s(r);
432
+ continue;
433
+ }
434
+ const o = (0, n.toHeaderRecord)(r);
435
+ for (const [i, c] of Object.entries(o)) {
436
+ t.delete(i);
437
+ for (const l of c) t.append(i, l);
438
+ }
439
+ }
440
+ return t;
441
+ };
442
+ })(k || (k = {}));
443
+ class g extends X {
444
+ static version = "6.1.1";
445
+ static FINAL_SYMBOL = /* @__PURE__ */ Symbol("FEXIOS_FINAL_CONTEXT");
446
+ baseConfigs;
447
+ // for axios compatibility
448
+ get defaults() {
449
+ return this.baseConfigs;
450
+ }
451
+ set defaults(e) {
452
+ this.baseConfigs = e;
453
+ }
454
+ static DEFAULT_CONFIGS = {
455
+ baseURL: "",
456
+ timeout: 0,
457
+ credentials: void 0,
458
+ headers: {},
459
+ query: {},
460
+ responseType: void 0,
461
+ shouldThrow(e) {
462
+ return !e.ok;
463
+ },
464
+ fetch: globalThis.fetch
465
+ };
466
+ hooks = [];
467
+ static ALL_METHODS = [
468
+ "get",
469
+ "post",
470
+ "put",
471
+ "patch",
472
+ "delete",
473
+ "head",
474
+ "options",
475
+ "trace"
476
+ ];
477
+ static METHODS_WITHOUT_BODY = [
478
+ "get",
479
+ "head",
480
+ "options",
481
+ "trace"
482
+ ];
483
+ constructor(e = {}) {
484
+ super("request"), this.baseConfigs = A(g.DEFAULT_CONFIGS, e), g.ALL_METHODS.forEach(
485
+ (t) => this.createMethodShortcut(t.toLowerCase())
486
+ );
487
+ }
488
+ attachLegacyAliases(e) {
489
+ const t = () => e.request, s = () => e.runtime, r = (o, i) => {
490
+ try {
491
+ Object.defineProperty(e, o, { configurable: !0, ...i });
492
+ } catch {
493
+ }
494
+ };
495
+ r("url", {
496
+ get: () => t().url,
497
+ set: (o) => {
498
+ t().url = o?.toString?.() ?? String(o);
499
+ }
500
+ }), r("method", {
501
+ get: () => t().method,
502
+ set: (o) => t().method = o
503
+ }), r("headers", {
504
+ get: () => t().headers,
505
+ set: (o) => t().headers = o
506
+ }), r("query", { get: () => t().query, set: (o) => t().query = o }), r("body", { get: () => t().body, set: (o) => t().body = o }), r("baseURL", {
507
+ get: () => t().baseURL,
508
+ set: (o) => t().baseURL = o
509
+ }), r("timeout", {
510
+ get: () => t().timeout,
511
+ set: (o) => t().timeout = o
512
+ }), r("credentials", {
513
+ get: () => t().credentials,
514
+ set: (o) => t().credentials = o
515
+ }), r("cache", { get: () => t().cache, set: (o) => t().cache = o }), r("mode", { get: () => t().mode, set: (o) => t().mode = o }), r("fetch", { get: () => t().fetch, set: (o) => t().fetch = o }), r("shouldThrow", {
516
+ get: () => t().shouldThrow,
517
+ set: (o) => t().shouldThrow = o
518
+ }), r("responseType", {
519
+ get: () => t().responseType,
520
+ set: (o) => t().responseType = o
521
+ }), r("abortController", {
522
+ get: () => s().abortController,
523
+ set: (o) => s().abortController = o
524
+ }), r("onProgress", {
525
+ get: () => s().onProgress,
526
+ set: (o) => s().onProgress = o
527
+ }), r("customEnv", {
528
+ get: () => s().customEnv,
529
+ set: (o) => s().customEnv = o
530
+ }), r("rawRequest", {
531
+ get: () => t().rawRequest,
532
+ set: (o) => t().rawRequest = o
533
+ }), r("data", {
534
+ get: () => e.response ? e.response.data : void 0,
535
+ set: (o) => {
536
+ e.response && (e.response.data = o);
537
+ }
538
+ });
539
+ }
540
+ finalizeContext(e, t) {
541
+ const s = e.response, r = s?.rawResponse ?? e.rawResponse, o = e.request;
542
+ Object.defineProperties(e, {
543
+ url: { get: () => r?.url || t },
544
+ data: { get: () => s.data },
545
+ headers: { get: () => r.headers },
546
+ responseType: { get: () => s.responseType },
547
+ rawRequest: { get: () => o.rawRequest }
548
+ });
549
+ }
550
+ async request(e, t) {
551
+ const s = this;
552
+ let r = t || {};
553
+ typeof e == "string" || e instanceof URL ? r = { ...t || {}, url: e } : typeof e == "object" && (r = e);
554
+ const {
555
+ abortController: o,
556
+ onProgress: i,
557
+ customEnv: c,
558
+ ...l
559
+ } = r;
560
+ let a = {
561
+ get app() {
562
+ return s;
563
+ },
564
+ request: {
565
+ ...l,
566
+ url: r.url?.toString?.() ?? String(r.url)
567
+ },
568
+ runtime: {
569
+ abortController: o,
570
+ onProgress: i,
571
+ customEnv: c
572
+ },
573
+ response: void 0,
574
+ rawResponse: void 0,
575
+ // legacy fields are attached via defineProperty
576
+ url: "",
577
+ headers: {},
578
+ query: {}
579
+ };
580
+ if (this.attachLegacyAliases(a), a = await this.emit("beforeInit", a), a[g.FINAL_SYMBOL]) return a;
581
+ if ("customEnv" in this.baseConfigs && (a.runtime.customEnv = A(
582
+ {},
583
+ // ensure we don't mutate baseConfigs
584
+ this.baseConfigs.customEnv,
585
+ a.runtime.customEnv
586
+ )), a.request = this.applyDefaults(a.request), g.METHODS_WITHOUT_BODY.includes(
587
+ a.request.method?.toLocaleLowerCase?.()
588
+ ) && a.request.body)
589
+ throw new y(
590
+ R.BODY_NOT_ALLOWED,
591
+ `Request method "${a.request.method}" does not allow body`
592
+ );
593
+ if (a = await this.emit("beforeRequest", a), a[g.FINAL_SYMBOL]) return a;
594
+ let f;
595
+ const u = {}, h = a.request;
596
+ if (typeof h.body < "u" && h.body !== null && (h.body instanceof Blob || h.body instanceof FormData || h.body instanceof URLSearchParams ? f = h.body : typeof h.body == "object" && h.body !== null ? (f = JSON.stringify(h.body), h.headers = this.mergeHeaders(h.headers, {
597
+ "Content-Type": "application/json"
598
+ })) : f = h.body), !k.makeHeaders(h.headers || {}).get("content-type") && f && (f instanceof FormData || f instanceof URLSearchParams ? u["content-type"] = null : typeof f == "string" && typeof h.body == "object" ? u["content-type"] = "application/json" : f instanceof Blob && (u["content-type"] = f.type || "application/octet-stream")), h.body = f, a = await this.emit("afterBodyTransformed", a), a[g.FINAL_SYMBOL]) return a;
599
+ const p = a.runtime.abortController ?? (globalThis.AbortController ? new AbortController() : void 0), w = globalThis.location?.href || "http://localhost", N = new URL(
600
+ a.request.baseURL || this.baseConfigs.baseURL || w,
601
+ w
602
+ ), m = new URL(a.request.url, N), T = E.makeURL(
603
+ m,
604
+ a.request.query,
605
+ m.hash
606
+ // 保留 hash
607
+ ).toString(), L = new Request(T, {
608
+ method: a.request.method || "GET",
609
+ credentials: a.request.credentials,
610
+ cache: a.request.cache,
611
+ mode: a.request.mode,
612
+ headers: k.mergeHeaders(
613
+ this.baseConfigs.headers,
614
+ a.request.headers || {},
615
+ u
616
+ ),
617
+ body: a.request.body,
618
+ signal: p?.signal
619
+ });
620
+ if (a.request.rawRequest = L, a = await this.emit("beforeActualFetch", a), a[g.FINAL_SYMBOL]) return a;
621
+ const D = a.request.timeout ?? this.baseConfigs.timeout ?? 60 * 1e3, G = a.request.shouldThrow ?? this.baseConfigs.shouldThrow;
622
+ if (a.request.url.startsWith("ws") || a.request.responseType === "ws")
623
+ throw new y(
624
+ R.FEATURE_MOVED_TO_PLUGIN,
625
+ 'WebSocket support has been moved to plugins. Use "fexios/plugins" and call fx.ws() instead.',
626
+ a
627
+ );
628
+ if (a.request.responseType === "stream")
629
+ throw new y(
630
+ R.FEATURE_MOVED_TO_PLUGIN,
631
+ 'SSE support has been moved to plugins. Use "fexios/plugins" and call fx.sse() instead.',
632
+ a
633
+ );
634
+ let _;
635
+ try {
636
+ p && (_ = D > 0 ? setTimeout(() => {
637
+ p.abort();
638
+ }, D) : void 0);
639
+ const K = await (a.request.fetch || this.baseConfigs.fetch || globalThis.fetch)(a.request.rawRequest).catch(
640
+ (j) => {
641
+ throw _ && clearTimeout(_), p?.signal.aborted ? new y(
642
+ R.TIMEOUT,
643
+ `Request timed out after ${D}ms`,
644
+ a
645
+ ) : new y(
646
+ R.NETWORK_ERROR,
647
+ j.message,
648
+ a
649
+ );
650
+ }
651
+ );
652
+ return _ && clearTimeout(_), a.rawResponse = K, await this.emit("afterRawResponse", a), a[g.FINAL_SYMBOL] ? a : (a.response = await F(
653
+ K,
654
+ a.request.responseType,
655
+ (j, V) => {
656
+ a.runtime.onProgress?.(j, V);
657
+ },
658
+ G,
659
+ D
660
+ ), a.rawResponse = a.response.rawResponse, this.finalizeContext(a, T), this.emit("afterResponse", a));
661
+ } catch (B) {
662
+ throw _ && clearTimeout(_), B;
663
+ }
664
+ }
665
+ mergeQueries = E.mergeQueries;
666
+ mergeHeaders = k.mergeHeaders;
667
+ applyDefaults(e) {
668
+ const t = e, s = globalThis.location?.href || "http://localhost", r = t.baseURL || this.baseConfigs.baseURL || s, o = new URL(r, s), i = new URL(t.url.toString(), o), c = E.toQueryRecord(
669
+ o.searchParams
670
+ ), l = E.toQueryRecord(
671
+ i.searchParams
672
+ ), a = E.mergeQueries(
673
+ c,
674
+ l
675
+ );
676
+ i.search = E.makeSearchParams(a).toString(), t.url = i.toString();
677
+ const f = E.mergeQueries(
678
+ this.baseConfigs.query,
679
+ t.query
680
+ );
681
+ return t.query && this.restoreNulls(f, t.query), t.query = f, t;
682
+ }
683
+ restoreNulls(e, t) {
684
+ if (!(!t || typeof t != "object"))
685
+ for (const [s, r] of Object.entries(t))
686
+ r === null ? e[s] = null : S(r) && ((!e[s] || typeof e[s] != "object") && (e[s] = {}), this.restoreNulls(e[s], r));
687
+ }
688
+ async emit(e, t, s = {
689
+ shouldHandleShortCircuitResponse: !0
690
+ }) {
691
+ const r = this.hooks.filter((i) => i.event === e);
692
+ if (r.length === 0) return t;
693
+ const o = async (i, c) => {
694
+ const l = i;
695
+ if (l.rawResponse = c, !l.request?.rawRequest)
696
+ try {
697
+ l.request.rawRequest = new Request(l.request.url, {
698
+ method: l.request.method || "GET",
699
+ headers: l.request.headers,
700
+ body: l.request.body
701
+ });
702
+ } catch {
703
+ }
704
+ const a = await F(
705
+ c,
706
+ i.request?.responseType,
707
+ (f, u) => i.runtime?.onProgress?.(f, u),
708
+ i.request?.shouldThrow ?? this.baseConfigs.shouldThrow,
709
+ i.request?.timeout ?? this.baseConfigs.timeout ?? 60 * 1e3
710
+ );
711
+ if (l.response = a, l.rawResponse = a.rawResponse, this.finalizeContext(l, c.url || ""), e !== "afterResponse") {
712
+ const f = await this.emit("afterResponse", l);
713
+ return f[g.FINAL_SYMBOL] = !0, f;
714
+ } else
715
+ return l[g.FINAL_SYMBOL] = !0, l;
716
+ };
717
+ for (let i = 0; i < r.length; i++) {
718
+ const c = r[i], l = `${String(e)}#${c.action.name || `anonymous#${i}`}`, a = /* @__PURE__ */ Symbol("FEXIOS_HOOK_CTX_MARK");
719
+ try {
720
+ t[a] = a;
721
+ } catch {
722
+ }
723
+ const f = await c.action.call(this, t);
724
+ try {
725
+ delete t[a];
726
+ } catch {
727
+ }
728
+ if (f === !1)
729
+ throw new y(
730
+ R.ABORTED_BY_HOOK,
731
+ `Request aborted by hook "${l}"`,
732
+ t
733
+ );
734
+ if (f instanceof Response) {
735
+ if (s.shouldHandleShortCircuitResponse !== !1)
736
+ return o(t, f);
737
+ t.rawResponse = f;
738
+ } else f && typeof f == "object" && f[a] === a && (t = f);
739
+ }
740
+ return t;
741
+ }
742
+ on(e, t, s = !1) {
743
+ if (typeof t != "function")
744
+ throw new y(
745
+ R.INVALID_HOOK_CALLBACK,
746
+ `Hook should be a function, but got "${typeof t}"`
747
+ );
748
+ return this.hooks[s ? "unshift" : "push"]({
749
+ event: e,
750
+ action: t
751
+ }), this;
752
+ }
753
+ off(e, t) {
754
+ return e === "*" || !e ? this.hooks = this.hooks.filter((s) => s.action !== t) : this.hooks = this.hooks.filter(
755
+ (s) => s.event !== e || s.action !== t
756
+ ), this;
757
+ }
758
+ createInterceptor(e) {
759
+ return {
760
+ handlers: () => this.hooks.filter((t) => t.event === e).map((t) => t.action),
761
+ use: (t, s = !1) => this.on(e, t, s),
762
+ clear: () => {
763
+ this.hooks = this.hooks.filter((t) => t.event !== e);
764
+ }
765
+ };
766
+ }
767
+ interceptors = {
768
+ request: this.createInterceptor("beforeRequest"),
769
+ response: this.createInterceptor("afterResponse")
770
+ };
771
+ createMethodShortcut(e) {
772
+ return Reflect.defineProperty(this, e, {
773
+ get: () => (t, s, r) => (g.METHODS_WITHOUT_BODY.includes(
774
+ e.toLocaleLowerCase()
775
+ ) ? r = s : (r = r || {}, r.body = s), this.request(t, {
776
+ ...r,
777
+ method: e
778
+ }))
779
+ }), this;
780
+ }
781
+ extends(e) {
782
+ const t = new g(A(this.baseConfigs, e));
783
+ return t.hooks = [...this.hooks], t._plugins = new Map(this._plugins), t._plugins.forEach(async (s) => {
784
+ await t.plugin(s);
785
+ }), t;
786
+ }
787
+ create = g.create;
788
+ static create(e) {
789
+ return new g(e);
790
+ }
791
+ _plugins = /* @__PURE__ */ new Map();
792
+ plugin(e) {
793
+ if (typeof e?.name == "string" && typeof e?.install == "function") {
794
+ if (this._plugins.has(e.name))
795
+ return this;
796
+ const t = e.install(this);
797
+ if (this._plugins.set(e.name, e), t instanceof g)
798
+ return t;
799
+ }
800
+ return this;
801
+ }
802
+ uninstall(e) {
803
+ return typeof e == "string" && (e = this._plugins.get(e)), e && (e?.uninstall?.(this), this._plugins.delete(e.name)), this;
804
+ }
805
+ // 版本弃子们.jpg
806
+ /** @deprecated Use `mergeQueries` instead */
807
+ mergeQuery = this.mergeQueries;
808
+ }
809
+ const ee = g.create;
810
+ ee();
811
+ var v;
812
+ ((n) => {
813
+ function e(s) {
814
+ return Array.isArray(s) ? s.join("|") : typeof s == "boolean" || s === null ? s ? "1" : void 0 : typeof s == "number" ? "" + s : s;
815
+ }
816
+ n.normalizeParamValue = e;
817
+ function t(s) {
818
+ const r = (i) => i && (i instanceof URLSearchParams || i instanceof FormData);
819
+ if (s == null)
820
+ return;
821
+ const o = new FormData();
822
+ if (r(s))
823
+ return s.forEach((i, c) => {
824
+ const l = e(i);
825
+ l != null && o.append(c, l);
826
+ }), o;
827
+ if (S(s))
828
+ return Object.entries(s).forEach(([i, c]) => {
829
+ const l = e(c);
830
+ l != null && o.append(i, l);
831
+ }), o;
832
+ }
833
+ n.normalizeBody = t;
834
+ })(v || (v = {}));
835
+ var M = /* @__PURE__ */ ((n) => (n.HTTP_ERROR = "HTTP_ERROR", n.LOGIN_FAILED = "LOGIN_FAILED", n.LOGIN_RETRY_LIMIT_EXCEEDED = "LOGIN_RETRY_LIMIT_EXCEEDED", n.TOKEN_RETRY_LIMIT_EXCEEDED = "TOKEN_RETRY_LIMIT_EXCEEDED", n))(M || {});
836
+ class b extends Error {
837
+ constructor(e, t = "", s) {
838
+ super(), this.code = e, this.message = t, this.cause = s;
839
+ }
840
+ name = "WikiSaikouError";
841
+ static is(e, t) {
842
+ return e instanceof this && (t === void 0 || e.code === t);
843
+ }
844
+ }
845
+ class I extends Error {
846
+ constructor(e, t) {
847
+ super(), this.errors = e, this.cause = t, this.errors = I.normalizeErrors(e), this.message = e.map((s) => s.text).filter(Boolean).join(`
848
+ `), this.code = this.isBadTokenError() ? "badtoken" : this.errors[0]?.code || "Unknown Error";
849
+ }
850
+ name = "MediaWikiApiError";
851
+ code;
852
+ get firstError() {
853
+ return this.errors[0];
854
+ }
855
+ isBadTokenError() {
856
+ return this.errors.some((e) => e.code === "badtoken") || ["NeedToken", "WrongToken"].includes(this.cause?.data?.login?.result);
857
+ }
858
+ toString() {
859
+ return `[${this.name} ${this.code}]`;
860
+ }
861
+ static is(e) {
862
+ return e instanceof this;
863
+ }
864
+ static normalizeErrors(e) {
865
+ return Array.isArray(e) === !1 ? [] : e.filter((t) => typeof t == "object" && !!t?.code).map((t) => t.text ? t : t.info ? { ...t, text: t.info } : t["*"] ? { ...t, text: t["*"] } : { ...t, text: "" });
866
+ }
867
+ }
868
+ ((n) => {
869
+ function e(o) {
870
+ if (o == null) return;
871
+ if (o?.response?.data !== void 0) return o.response.data;
872
+ if (o?.data !== void 0) return o.data;
873
+ const i = o instanceof Error ? o.cause : void 0;
874
+ return i?.response?.data !== void 0 ? i.response.data : i?.data !== void 0 ? i.data : o || void 0;
875
+ }
876
+ function t(o) {
877
+ return s(o).length > 0;
878
+ }
879
+ n.includesMediaWikiApiError = t, n.normalizeMwApiErrors = I.normalizeErrors;
880
+ function s(o) {
881
+ let i = e(o);
882
+ if (typeof i != "object" || i === null)
883
+ return [];
884
+ const c = i?.error, l = i?.errors, a = [];
885
+ return c && a.push(c), Array.isArray(l) && a.push(...l), (0, n.normalizeMwApiErrors)(a);
886
+ }
887
+ n.extractMediaWikiApiErrors = s;
888
+ function r(o) {
889
+ if (I.is(o))
890
+ return o.isBadTokenError();
891
+ {
892
+ const i = s(o);
893
+ return new I(i).isBadTokenError();
894
+ }
895
+ }
896
+ n.isBadTokenError = r;
897
+ })(b || (b = {}));
898
+ const z = /* @__PURE__ */ Symbol.for("__FEXIOS_SAIKOU__");
899
+ function Y(n) {
900
+ const e = n instanceof g ? n : new g({
901
+ baseURL: n instanceof URL ? n.toString() : String(n),
902
+ responseType: "json"
903
+ });
904
+ return e[z] || (Reflect.defineProperty(e, z, {
905
+ get: () => !0,
906
+ enumerable: !1,
907
+ configurable: !1
908
+ }), e.on("beforeInit", (t) => {
909
+ if (t.request.method?.toLowerCase() !== "post")
910
+ return t;
911
+ if (t.request.body === void 0 || t.request.body === null)
912
+ return t.request.body = void 0, t;
913
+ const s = t.request.body = v.normalizeBody(
914
+ t.request.body
915
+ ), r = new URLSearchParams(t.request.query);
916
+ return s.has("format") && r.delete("format"), s.has("formatversion") && r.delete("formatversion"), s.has("action") && r.delete("action"), s.has("origin") && (r.set("origin", "" + s.get("origin")), s.delete("origin")), t.request.query = Object.fromEntries(r.entries()), t;
917
+ }), e.on("beforeInit", (t) => (t.request.query = E.mergeQueries(
918
+ {},
919
+ v.normalizeBody(t.request.query)
920
+ ), t)), e.on("beforeRequest", (t) => {
921
+ const s = new URL(t.request.url), r = E.mergeQueries(s.searchParams, t.query);
922
+ if (globalThis.location && (!r.origin && location.origin !== s.origin ? (r.origin = location.origin, e.baseConfigs.credentials = "include", e.baseConfigs.mode = "cors") : location.origin === s.origin && (delete r.origin, e.baseConfigs.credentials = void 0, e.baseConfigs.mode = void 0)), r.origin) {
923
+ const o = encodeURIComponent(r.origin).replace(/\./g, "%2E");
924
+ delete r.origin, t.request.query = r, t.request.url = `${s.origin}${s.pathname}?origin=${o}`;
925
+ } else
926
+ t.request.query = r;
927
+ return t;
928
+ }), e._tokens = /* @__PURE__ */ new Map(), e.on("afterResponse", (t) => {
929
+ const { data: s } = t, r = t.runtime.customEnv?.mwTokenName;
930
+ r && b.isBadTokenError(s) && e._tokens.delete(r);
931
+ const o = s?.query?.tokens;
932
+ o && typeof o == "object" && Object.entries(o).forEach(([c, l]) => {
933
+ typeof l == "string" && e._tokens.set(c.replace(/token$/i, "").toLowerCase(), l);
934
+ });
935
+ const i = s?.login?.token;
936
+ return typeof i == "string" && e._tokens.set("login", i), t;
937
+ })), e;
938
+ }
939
+ const te = (n, e, t) => {
940
+ let s = { ...ne.DEFAULT_CONFIGS };
941
+ if (typeof n == "string" ? s = A(s, {
942
+ baseURL: n,
943
+ fexiosConfigs: e || {},
944
+ defaultParams: t || {},
945
+ throwOnApiError: !1
946
+ // Set a default value for throwOnApiError
947
+ }) : typeof n == "object" && n !== null && (s = A(s, n)), !s.baseURL && typeof window == "object" && window.mediaWiki) {
948
+ const { wgServer: r, wgScriptPath: o } = window.mediaWiki?.config?.get(["wgServer", "wgScriptPath"]) || {};
949
+ typeof r == "string" && typeof o == "string" && (s.baseURL = `${r}${o}/api.php`);
950
+ }
951
+ if (typeof s.baseURL != "string")
952
+ throw new Error("baseURL is required");
953
+ return s;
954
+ }, se = () => {
955
+ }, re = async (n, e) => {
956
+ let t = 0;
957
+ const { retry: s = 3, onRetry: r = se, shouldRetry: o = () => !0 } = e;
958
+ let i;
959
+ do
960
+ try {
961
+ return await n();
962
+ } catch (c) {
963
+ if (i = c, o(c, t))
964
+ r(c, t), t++;
965
+ else
966
+ throw c;
967
+ }
968
+ while (t < s);
969
+ throw i || new Error("Retry failed");
970
+ };
971
+ class ne {
972
+ config;
973
+ version = "7.5.0";
974
+ request;
975
+ static INIT_DEFAULT_PARAMS = {
976
+ action: "query",
977
+ errorformat: "plaintext",
978
+ format: "json",
979
+ formatversion: 2
980
+ };
981
+ static DEFAULT_CONFIGS = {
982
+ baseURL: void 0,
983
+ fexiosConfigs: {
984
+ responseType: "json"
985
+ },
986
+ defaultParams: this.INIT_DEFAULT_PARAMS,
987
+ throwOnApiError: !1
988
+ };
989
+ constructor(e, t, s) {
990
+ const r = this.config = te(
991
+ e,
992
+ t,
993
+ s
994
+ );
995
+ this.request = Y(r.baseURL);
996
+ }
997
+ setBaseURL(e) {
998
+ return this.config.baseURL = e, this.request.baseConfigs.baseURL = e, this;
999
+ }
1000
+ /** Base methods encapsulation */
1001
+ async get(e, t) {
1002
+ const s = A(
1003
+ {},
1004
+ this.config.fexiosConfigs,
1005
+ {
1006
+ query: E.mergeQueries(
1007
+ this.config.defaultParams,
1008
+ e
1009
+ )
1010
+ },
1011
+ t
1012
+ );
1013
+ return this.runRequestWithApiErrorMapping(
1014
+ () => this.request.get("", s)
1015
+ );
1016
+ }
1017
+ async post(e, t) {
1018
+ return this.runRequestWithApiErrorMapping(
1019
+ () => this.request.post(
1020
+ "",
1021
+ e,
1022
+ A(
1023
+ {},
1024
+ this.config.fexiosConfigs,
1025
+ {
1026
+ query: this.config.defaultParams
1027
+ },
1028
+ t
1029
+ )
1030
+ )
1031
+ );
1032
+ }
1033
+ /**
1034
+ * Wrap a request to map non-2xx responses containing MediaWiki API error bodies
1035
+ * into MediaWikiApiError when throwOnApiError=true, and then pass 2xx responses
1036
+ * through handleApiResponse for unified processing.
1037
+ */
1038
+ async runRequestWithApiErrorMapping(e) {
1039
+ try {
1040
+ const t = await e();
1041
+ return this.handleApiResponse(t);
1042
+ } catch (t) {
1043
+ throw this.config.throwOnApiError && b.includesMediaWikiApiError(t) ? new I(
1044
+ b.extractMediaWikiApiErrors(t),
1045
+ t
1046
+ ) : t;
1047
+ }
1048
+ }
1049
+ throwIfApiError(e) {
1050
+ const t = b.extractMediaWikiApiErrors(e);
1051
+ if (t.length > 0)
1052
+ throw new I(t, e);
1053
+ }
1054
+ handleApiResponse(e) {
1055
+ return this.config.throwOnApiError && this.throwIfApiError(e.data), e;
1056
+ }
1057
+ /** Token Handler */
1058
+ get tokens() {
1059
+ return this.request._tokens;
1060
+ }
1061
+ async fetchTokens(e = ["csrf"]) {
1062
+ return this.config.fexiosConfigs.credentials = "include", await this.get({
1063
+ action: "query",
1064
+ meta: "tokens",
1065
+ type: e
1066
+ }), this.tokens;
1067
+ }
1068
+ async getToken(e = "csrf", t = !1) {
1069
+ return (!this.tokens.get(e) || t) && (this.tokens.delete(e), await this.fetchTokens([e])), this.tokens.get(e);
1070
+ }
1071
+ badToken(e) {
1072
+ return this.tokens.delete(e), this.tokens;
1073
+ }
1074
+ async postWithToken(e, t, s) {
1075
+ const {
1076
+ tokenName: r = "token",
1077
+ retry: o = 3,
1078
+ noCache: i = !1,
1079
+ fexiosOptions: c
1080
+ } = s || {};
1081
+ if (o < 1)
1082
+ throw new b(
1083
+ M.TOKEN_RETRY_LIMIT_EXCEEDED,
1084
+ "The limit of the number of times to automatically re-acquire the token has been exceeded"
1085
+ );
1086
+ let l = 0;
1087
+ return re(
1088
+ async () => {
1089
+ const a = await this.getToken(
1090
+ e,
1091
+ i || l > 0
1092
+ );
1093
+ try {
1094
+ const f = await this.post(
1095
+ {
1096
+ [r]: a,
1097
+ ...t
1098
+ },
1099
+ A(c || {}, {
1100
+ customEnv: {
1101
+ mwTokenName: e
1102
+ }
1103
+ })
1104
+ );
1105
+ if (b.isBadTokenError(f.data))
1106
+ throw f;
1107
+ return f;
1108
+ } catch (f) {
1109
+ throw b.isBadTokenError(f) || f?.ok === !1 || I.is(f) ? f : new b(
1110
+ M.HTTP_ERROR,
1111
+ "Network/transport or SDK-internal error (not a MediaWiki API error)",
1112
+ f
1113
+ );
1114
+ }
1115
+ },
1116
+ {
1117
+ retry: o,
1118
+ onRetry: (a, f) => {
1119
+ l = f + 1;
1120
+ },
1121
+ shouldRetry: (a) => b.isBadTokenError(a) || a?.ok === !1
1122
+ }
1123
+ ).catch((a) => {
1124
+ throw b.isBadTokenError(a) || a?.ok === !1 ? new b(
1125
+ M.TOKEN_RETRY_LIMIT_EXCEEDED,
1126
+ "Retry attempts for acquiring/using token exhausted",
1127
+ a
1128
+ ) : a;
1129
+ });
1130
+ }
1131
+ postWithEditToken(e) {
1132
+ return this.postWithToken("csrf", e);
1133
+ }
1134
+ // for backward compatibility
1135
+ /** @deprecated Use `this.config.baseURL` instead */
1136
+ get baseURL() {
1137
+ return this.config.baseURL;
1138
+ }
1139
+ /** @deprecated Use `this.config.defaultParams` instead */
1140
+ get defaultParams() {
1141
+ return this.config.defaultParams;
1142
+ }
1143
+ /** @deprecated Use `this.config.fexiosConfigs` instead */
1144
+ get defaultOptions() {
1145
+ return this.config.fexiosConfigs;
1146
+ }
1147
+ /** @deprecated Use `createFexiosSaikou` instead */
1148
+ static createRequestHandler = Y;
1149
+ /** @deprecated Use `this.getToken` instead */
1150
+ token = this.getToken;
1151
+ }
1152
+ class oe {
1153
+ constructor() {
1154
+ this.values = {};
1155
+ }
1156
+ get length() {
1157
+ return Object.keys(this.values).length;
1158
+ }
1159
+ clear() {
1160
+ this.values = {};
1161
+ }
1162
+ getItem(e) {
1163
+ return this.values[e] ?? null;
1164
+ }
1165
+ setItem(e, t) {
1166
+ this.values[e] = typeof t == "string" ? t : String(t);
1167
+ }
1168
+ removeItem(e) {
1169
+ delete this.values[e];
1170
+ }
1171
+ key(e) {
1172
+ return Object.keys(this.values)[e] ?? null;
1173
+ }
1174
+ }
1175
+ const ie = () => new Proxy(new oe(), {
1176
+ set(n, e, t) {
1177
+ return typeof e == "string" && n.setItem(e, t), !0;
1178
+ },
1179
+ get(n, e) {
1180
+ return typeof e == "string" && !(e in n) ? n.getItem(e) : Reflect.get(n, e);
1181
+ }
1182
+ });
1183
+ function ae(n) {
1184
+ class e {
1185
+ constructor(s, r = !0) {
1186
+ this._loaded = r, this.api = n, s.revisions?.forEach((o) => {
1187
+ typeof o?.slots?.main == "object" && Object.assign(o, o.slots.main);
1188
+ }), this.pageInfo = {
1189
+ ...e.DEFAULT_PAGE_INFO,
1190
+ ...s
1191
+ };
1192
+ }
1193
+ static {
1194
+ this.api = n;
1195
+ }
1196
+ static {
1197
+ this.DEFAULT_QUERY_PARAMS = {
1198
+ action: "query",
1199
+ prop: "info|templates|transcludedin|images|pageimages|revisions",
1200
+ inprop: "protection|url|varianttitles",
1201
+ intestactions: "edit|move|delete",
1202
+ tllimit: "max",
1203
+ tilimit: "max",
1204
+ imlimit: "max",
1205
+ piprop: "thumbnail|name|original",
1206
+ pithumbsize: "200",
1207
+ pilimit: "max",
1208
+ rvprop: "ids|timestamp|flags|comment|user|content",
1209
+ rvslots: "main"
1210
+ };
1211
+ }
1212
+ static {
1213
+ this.DEFAULT_PAGE_INFO = {
1214
+ pageid: 0,
1215
+ ns: 0,
1216
+ title: "",
1217
+ contentmodel: "wikitext",
1218
+ pagelanguage: "",
1219
+ pagelanguagehtmlcode: "",
1220
+ pagelanguagedir: "ltr",
1221
+ touched: (/* @__PURE__ */ new Date()).toISOString(),
1222
+ lastrevid: 0,
1223
+ length: 0,
1224
+ protection: [],
1225
+ restrictiontypes: [],
1226
+ fullurl: "",
1227
+ canonicalurl: "",
1228
+ editurl: "",
1229
+ varianttitles: {},
1230
+ actions: {
1231
+ edit: !0,
1232
+ move: !1,
1233
+ delete: !1
1234
+ },
1235
+ revisions: [],
1236
+ templates: [],
1237
+ images: []
1238
+ };
1239
+ }
1240
+ // Utils
1241
+ static async newFromApi(s) {
1242
+ const { data: r } = await this.api.get({
1243
+ ...e.DEFAULT_QUERY_PARAMS,
1244
+ ...s
1245
+ }), o = r?.query?.pages?.[0];
1246
+ if (!o || !o.title)
1247
+ throw new Error("Invalid page info", { cause: r });
1248
+ return new e(o, !0);
1249
+ }
1250
+ static newBlankPage(s = {}) {
1251
+ return new e(s, !1);
1252
+ }
1253
+ static async newFromAnyKind(s) {
1254
+ const { title: r, pageId: o, revisionId: i } = s || {};
1255
+ return i ? this.newFromApi({ revids: parseInt(i.toString(), 10) }) : o ? this.newFromApi({ pageids: parseInt(o.toString(), 10) }) : r ? this.newFromApi({ titles: r.toString() }) : null;
1256
+ }
1257
+ static async newBatchFromApi(s) {
1258
+ const { titles: r, pageids: o, revids: i, ...c } = s || {}, { data: l } = await this.api.post({
1259
+ ...e.DEFAULT_QUERY_PARAMS,
1260
+ titles: r?.join("|") ?? void 0,
1261
+ pageids: o?.join("|") ?? void 0,
1262
+ revids: i?.join("|") ?? void 0,
1263
+ ...c
1264
+ });
1265
+ return l?.query?.pages?.map((a) => new e(a, !0)) || [];
1266
+ }
1267
+ // Page actions
1268
+ async parse(s) {
1269
+ return this.api.post({
1270
+ action: "parse",
1271
+ page: this.pageInfo.title,
1272
+ prop: "text|langlinks|categories|links|templates|images|externallinks|sections|revid|displaytitle|iwlinks|properties|parsewarnings",
1273
+ ...s
1274
+ });
1275
+ }
1276
+ async preview(s, r) {
1277
+ return this.parse({
1278
+ action: "parse",
1279
+ page: void 0,
1280
+ title: this.title,
1281
+ text: s,
1282
+ pst: 1,
1283
+ preview: 1,
1284
+ disableeditsection: 1,
1285
+ disablelimitreport: 1,
1286
+ ...r
1287
+ });
1288
+ }
1289
+ async edit(s, r) {
1290
+ const o = await this.api.postWithEditToken({
1291
+ action: "edit",
1292
+ title: this.title,
1293
+ starttimestamp: this.pageInfo.touched,
1294
+ basetimestamp: this.revisions[0]?.timestamp,
1295
+ ...s,
1296
+ ...r
1297
+ });
1298
+ if (o.data?.edit?.result === "Success")
1299
+ return o;
1300
+ throw new I(
1301
+ [
1302
+ {
1303
+ module: "edit",
1304
+ code: "editfailure",
1305
+ text: "Unknown edit failure. Please try again.",
1306
+ docref: "https://www.mediawiki.org/wiki/API:Edit"
1307
+ }
1308
+ ],
1309
+ o
1310
+ );
1311
+ }
1312
+ async createOnly(s, r) {
1313
+ return this.edit(s, { createonly: 1, recreate: s.recreate, ...r });
1314
+ }
1315
+ async delete(s, r) {
1316
+ return this.api.postWithEditToken({
1317
+ action: "delete",
1318
+ title: this.pageInfo.title || void 0,
1319
+ pageid: this.pageInfo.pageid || void 0,
1320
+ reason: s,
1321
+ deletetalk: r?.deletetalk,
1322
+ ...r
1323
+ });
1324
+ }
1325
+ async moveTo(s, r, o) {
1326
+ return this.api.postWithEditToken({
1327
+ action: "move",
1328
+ from: this.pageInfo.title,
1329
+ to: s,
1330
+ reason: r,
1331
+ movetalk: 1,
1332
+ movesubpages: 1,
1333
+ ...o
1334
+ });
1335
+ }
1336
+ // === utilities ===
1337
+ userCan(s) {
1338
+ return !!this.pageInfo?.actions?.[s];
1339
+ }
1340
+ userCanEdit() {
1341
+ return this.userCan("edit");
1342
+ }
1343
+ async reloadSelfInfo() {
1344
+ const s = await e.newFromApi({
1345
+ pageids: this.pageInfo.pageid,
1346
+ titles: this.pageInfo.title
1347
+ }), r = (this.pageInfo.revisions || []).concat(s.revisions || []).sort((o, i) => o.revid - i.revid).reduce(
1348
+ (o, i) => (o.find((c) => c.revid === i.revid) || o.push(i), o),
1349
+ []
1350
+ );
1351
+ return this.pageInfo = s.pageInfo, this.pageInfo.revisions = r, this._loaded = !0, this;
1352
+ }
1353
+ // === sugar getters ===
1354
+ get pageid() {
1355
+ return this.pageInfo.pageid;
1356
+ }
1357
+ get title() {
1358
+ return this.pageInfo.title;
1359
+ }
1360
+ get ns() {
1361
+ return this.pageInfo.ns;
1362
+ }
1363
+ get contentmodel() {
1364
+ return this.pageInfo.contentmodel;
1365
+ }
1366
+ get fullurl() {
1367
+ return this.pageInfo.fullurl;
1368
+ }
1369
+ get canonicalurl() {
1370
+ return this.pageInfo.canonicalurl;
1371
+ }
1372
+ get editurl() {
1373
+ return this.pageInfo.editurl;
1374
+ }
1375
+ get revisions() {
1376
+ return this.pageInfo.revisions || [];
1377
+ }
1378
+ get lastrevid() {
1379
+ return this.pageInfo.lastrevid;
1380
+ }
1381
+ get templates() {
1382
+ return this.pageInfo.templates || [];
1383
+ }
1384
+ get images() {
1385
+ return this.pageInfo.images || [];
1386
+ }
1387
+ }
1388
+ return e;
1389
+ }
1390
+ const $ = /* @__PURE__ */ new WeakMap(), P = {
1391
+ toDBKey: (n) => n.replace(/ /g, "_"),
1392
+ toNormalText: (n) => n.replace(/_/g, " "),
1393
+ ensureCase: (n, e) => e === "first-letter" ? n.charAt(0).toUpperCase() + n.slice(1) : n
1394
+ }, U = {
1395
+ /**
1396
+ * 标准化特殊页面名称:转换为全小写
1397
+ */
1398
+ normalizeSpecialPageName: (n) => n.toLowerCase(),
1399
+ /**
1400
+ * 构建特殊页面别名索引
1401
+ */
1402
+ buildSpecialPageIndex: (n) => {
1403
+ const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
1404
+ for (const r of n.specialpagealiases) {
1405
+ const o = r.realname;
1406
+ e.set(o, o);
1407
+ const i = U.normalizeSpecialPageName(o);
1408
+ s.set(i, o);
1409
+ for (const c of r.aliases) {
1410
+ t.set(c, o);
1411
+ const l = U.normalizeSpecialPageName(c);
1412
+ s.set(l, o);
1413
+ }
1414
+ }
1415
+ return { byRealName: e, byAlias: t, byNormalized: s };
1416
+ },
1417
+ /**
1418
+ * 查找特殊页面的真实名称
1419
+ */
1420
+ findSpecialPageRealName: (n, e) => {
1421
+ const t = n.split("/")[0];
1422
+ let s = e.byRealName.get(t) ?? e.byAlias.get(t);
1423
+ if (s !== void 0)
1424
+ return s;
1425
+ const r = U.normalizeSpecialPageName(t);
1426
+ return e.byNormalized.get(r) ?? null;
1427
+ }
1428
+ }, O = {
1429
+ /**
1430
+ * 标准化命名空间文本:转换为全小写+下划线格式
1431
+ */
1432
+ normalizeNamespaceText: (n) => n.replace(/[_\s]+/g, "_").toLowerCase().replace(/^_+|_+$/g, ""),
1433
+ buildIndex: (n) => {
1434
+ const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
1435
+ for (const [o, i] of Object.entries(n.namespaces)) {
1436
+ const c = parseInt(o);
1437
+ e.set(i.name, c), t.set(i.canonical ?? "", c);
1438
+ const l = O.normalizeNamespaceText(i.name), a = O.normalizeNamespaceText(i.canonical ?? "");
1439
+ r.set(l, c), r.set(a, c);
1440
+ }
1441
+ for (const o of n.namespacealiases) {
1442
+ s.set(o.alias, o.id);
1443
+ const i = O.normalizeNamespaceText(o.alias);
1444
+ r.set(i, o.id);
1445
+ }
1446
+ return { byName: e, byCanonical: t, byAlias: s, byNormalized: r };
1447
+ },
1448
+ findNamespaceId: (n, e) => {
1449
+ let t = e.byName.get(n) ?? e.byCanonical.get(n) ?? e.byAlias.get(n);
1450
+ if (t !== void 0)
1451
+ return t;
1452
+ const s = O.normalizeNamespaceText(n);
1453
+ return e.byNormalized.get(s) ?? null;
1454
+ },
1455
+ isTalkPage: (n) => n % 2 === 1 && n > 0,
1456
+ getDefaultNamespaceInfo: (n) => ({
1457
+ id: n,
1458
+ name: "",
1459
+ canonical: "",
1460
+ case: "first-letter",
1461
+ content: !1,
1462
+ nonincludable: !1,
1463
+ subpages: !1
1464
+ })
1465
+ };
1466
+ function ce(n) {
1467
+ const e = $.get(n);
1468
+ if (e)
1469
+ return e;
1470
+ const t = O.buildIndex(n), s = U.buildSpecialPageIndex(n);
1471
+ class r {
1472
+ constructor(i, c) {
1473
+ if (this.newTitle = r.create.bind(r), this.toText = this.getPrefixedText.bind(this), this.toString = this.getPrefixedDBKey.bind(this), this.#t = i || "", this.#e = c ?? 0, c === void 0)
1474
+ this.fixNSByTitle();
1475
+ else {
1476
+ const l = this.parseTitlePrefix(this.#t);
1477
+ l && l.namespaceId === this.#e && (this.#t = l.mainTitle);
1478
+ }
1479
+ if (this.getMainText() === "")
1480
+ throw new Error("Invalid title");
1481
+ }
1482
+ static {
1483
+ this._meta = n;
1484
+ }
1485
+ static {
1486
+ this._namespaceIndex = t;
1487
+ }
1488
+ static {
1489
+ this._specialPageIndex = s;
1490
+ }
1491
+ /** 缓存的 main title,不包含命名空间前缀,大小写和空格状态不确定 */
1492
+ #t;
1493
+ /** 缓存的 namespace ID */
1494
+ #e;
1495
+ static create(i, c) {
1496
+ return new r(i, c);
1497
+ }
1498
+ /**
1499
+ * 解析标题前缀,返回匹配到的命名空间 ID 与剥离后的主标题
1500
+ */
1501
+ parseTitlePrefix(i) {
1502
+ const c = i.indexOf(":");
1503
+ if (c <= 0)
1504
+ return null;
1505
+ const l = i.substring(0, c), a = i.substring(c + 1), f = O.findNamespaceId(
1506
+ l,
1507
+ r._namespaceIndex
1508
+ );
1509
+ return f === null ? null : { namespaceId: f, mainTitle: a };
1510
+ }
1511
+ /**
1512
+ * 如果标题包含可识别命名空间,则采用该命名空间并剥离前缀
1513
+ */
1514
+ adoptNamespaceFromTitle() {
1515
+ const i = this.parseTitlePrefix(this.#t);
1516
+ i && (this.#t = i.mainTitle, this.#e = i.namespaceId);
1517
+ }
1518
+ fixNSByTitle() {
1519
+ const i = this.#t.indexOf(":");
1520
+ if (i !== -1) {
1521
+ if (i === 0) {
1522
+ this.#t = this.#t.substring(1);
1523
+ return;
1524
+ }
1525
+ this.adoptNamespaceFromTitle();
1526
+ }
1527
+ }
1528
+ getNamespaceInfo() {
1529
+ return r._meta.namespaces[this.#e] ?? O.getDefaultNamespaceInfo(this.#e);
1530
+ }
1531
+ /**
1532
+ * 若为特殊页面,返回解析后的真实主名(含子页面);否则返回 null
1533
+ */
1534
+ resolveSpecialFullTitle() {
1535
+ if (this.#e !== -1) return null;
1536
+ const i = U.findSpecialPageRealName(
1537
+ this.#t,
1538
+ r._specialPageIndex
1539
+ );
1540
+ if (!i) return null;
1541
+ const c = this.#t.includes("/") ? this.#t.substring(this.#t.indexOf("/")) : "";
1542
+ return i + c;
1543
+ }
1544
+ /**
1545
+ * 将主标题格式化为输出内容(文本或 DBKey),并做大小写规范化
1546
+ */
1547
+ formatMainForOutput(i) {
1548
+ const c = this.getNamespaceInfo(), a = this.resolveSpecialFullTitle() ?? this.#t, f = i === "db" ? P.toDBKey(a) : P.toNormalText(a);
1549
+ return P.ensureCase(f, c.case);
1550
+ }
1551
+ getMainDBKey() {
1552
+ return this.formatMainForOutput("db");
1553
+ }
1554
+ getMainText() {
1555
+ return this.formatMainForOutput("text");
1556
+ }
1557
+ getMainRootText() {
1558
+ return this.getMainText().split("/")[0];
1559
+ }
1560
+ getPrefixedDBKey() {
1561
+ return this.#e === 0 ? this.getMainDBKey() : `${this.getNamespaceDBKey()}:${this.getMainDBKey()}`;
1562
+ }
1563
+ getPrefixedText() {
1564
+ return this.#e === 0 ? this.getMainText() : `${this.getNamespaceText()}:${this.getMainText()}`;
1565
+ }
1566
+ getNamespaceId() {
1567
+ return this.#e;
1568
+ }
1569
+ getNamespaceText() {
1570
+ return this.getNamespaceInfo().name ?? "";
1571
+ }
1572
+ getNamespaceDBKey() {
1573
+ const i = this.getNamespaceInfo();
1574
+ return P.ensureCase(P.toDBKey(this.getNamespaceText()), i.case);
1575
+ }
1576
+ getSubjectPage() {
1577
+ if (O.isTalkPage(this.#e)) {
1578
+ const i = this.#e - 1;
1579
+ return new r(this.#t, i);
1580
+ }
1581
+ return this;
1582
+ }
1583
+ getTalkPage() {
1584
+ if (O.isTalkPage(this.#e))
1585
+ return this;
1586
+ if (this.#e < 0)
1587
+ return null;
1588
+ const i = this.#e + 1;
1589
+ return r._meta.namespaces[i.toString()] ? new r(this.#t, i) : null;
1590
+ }
1591
+ getURL(i) {
1592
+ const c = this.getPrefixedDBKey();
1593
+ return this.buildArticleURL(c, i);
1594
+ }
1595
+ /**
1596
+ * 构建文章 URL 并附加查询参数
1597
+ */
1598
+ buildArticleURL(i, c) {
1599
+ const a = r._meta.general.articlepath.replace("$1", i), f = new URL(a, location.origin);
1600
+ return c && (c instanceof URLSearchParams ? c : new URLSearchParams(c)).forEach((h, d) => {
1601
+ f.searchParams.set(d, h);
1602
+ }), f;
1603
+ }
1604
+ /**
1605
+ * 设置标题,重置当前实例的 dbkey 和 ns
1606
+ * 行为:
1607
+ * - 如果标题包含可识别的命名空间前缀,则以该前缀为准更新 ns,并移除前缀
1608
+ * - 如果标题前缀与当前 ns 相同,则仅移除冗余前缀并保留当前 ns
1609
+ * - 否则(无前缀),重置为主命名空间
1610
+ */
1611
+ setTitle(i) {
1612
+ this.#t = i;
1613
+ const c = this.#e;
1614
+ this.#e = 0;
1615
+ const l = this.parseTitlePrefix(this.#t);
1616
+ return l ? (c !== 0 && l.namespaceId === c ? (this.#t = l.mainTitle, this.#e = c) : (this.#t = l.mainTitle, this.#e = l.namespaceId), this) : this;
1617
+ }
1618
+ setMainText(i) {
1619
+ return this.#t = i, this;
1620
+ }
1621
+ setNamespaceText(i) {
1622
+ const c = O.findNamespaceId(i, r._namespaceIndex);
1623
+ return c !== null && (this.#e = c), this;
1624
+ }
1625
+ setNamespaceId(i) {
1626
+ return this.#e = i, this;
1627
+ }
1628
+ equals(i) {
1629
+ return typeof i == "string" && (i = new r(i)), this.getPrefixedDBKey() === i.getPrefixedDBKey();
1630
+ }
1631
+ isSpecial(i) {
1632
+ if (this.#e !== -1)
1633
+ return !1;
1634
+ const c = new r(i, -1);
1635
+ return this.getMainRootText() === c.getMainRootText();
1636
+ }
1637
+ toJSON() {
1638
+ return {
1639
+ ns: this.#e,
1640
+ text: this.getMainText(),
1641
+ title: this.getPrefixedText(),
1642
+ url: this.getURL().toString(),
1643
+ isSpecial: this.#e < 0
1644
+ };
1645
+ }
1646
+ }
1647
+ return $.set(n, r), r;
1648
+ }
1649
+ export {
1650
+ I as M,
1651
+ ne as W,
1652
+ ce as a,
1653
+ oe as b,
1654
+ ae as c,
1655
+ b as d,
1656
+ M as e,
1657
+ A as f,
1658
+ te as r,
1659
+ ie as u
1660
+ };
1661
+ //# sourceMappingURL=index-C0spLL-i.js.map