@inpageedit/core 0.14.0 → 0.14.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 (44) hide show
  1. package/README.md +13 -4
  2. package/dist/{BasePlugin-CU8beLYu.js → BasePlugin-YOi2_vUo.js} +2 -2
  3. package/dist/{BasePlugin-CU8beLYu.js.map → BasePlugin-YOi2_vUo.js.map} +1 -1
  4. package/dist/{PluginPrefSync-B-gPsC2n.js → PluginPrefSync-jTNlRQE-.js} +3 -3
  5. package/dist/{PluginPrefSync-B-gPsC2n.js.map → PluginPrefSync-jTNlRQE-.js.map} +1 -1
  6. package/dist/{PluginStoreApp-CDteVCBG.js → PluginStoreApp-CGNxKXAN.js} +2 -2
  7. package/dist/{PluginStoreApp-CDteVCBG.js.map → PluginStoreApp-CGNxKXAN.js.map} +1 -1
  8. package/dist/{Preferences-85Q9FAmb.js → Preferences-BF2fcXrn.js} +140 -132
  9. package/dist/Preferences-BF2fcXrn.js.map +1 -0
  10. package/dist/{index-DjPpAyfE.js → index-3NZkG2a3.js} +3 -3
  11. package/dist/{index-DjPpAyfE.js.map → index-3NZkG2a3.js.map} +1 -1
  12. package/dist/{index-DGtq21uW.js → index-BBNseJXG.js} +3 -3
  13. package/dist/{index-DGtq21uW.js.map → index-BBNseJXG.js.map} +1 -1
  14. package/dist/{index-CVTBg5O9.js → index-Bb0FiU2c.js} +3 -3
  15. package/dist/{index-CVTBg5O9.js.map → index-Bb0FiU2c.js.map} +1 -1
  16. package/dist/{index-19CgGBI0.js → index-BgkZW91u.js} +234 -231
  17. package/dist/index-BgkZW91u.js.map +1 -0
  18. package/dist/{index-Ci82vLXg.js → index-BrYKe18j.js} +4 -4
  19. package/dist/index-BrYKe18j.js.map +1 -0
  20. package/dist/index-D-fW3ESK.js +195 -0
  21. package/dist/index-D-fW3ESK.js.map +1 -0
  22. package/dist/{index-CQr1DJ8n.js → index-D6zFqL2u.js} +4 -4
  23. package/dist/index-D6zFqL2u.js.map +1 -0
  24. package/dist/{index-BrtFJ-M0.js → index-D97lUU3h.js} +3 -3
  25. package/dist/{index-BrtFJ-M0.js.map → index-D97lUU3h.js.map} +1 -1
  26. package/dist/{index-BKIf3i0I.js → index-DELHsLHS.js} +5 -5
  27. package/dist/{index-BKIf3i0I.js.map → index-DELHsLHS.js.map} +1 -1
  28. package/dist/{index-D3iZhRMJ.js → index-DTHY5rAO.js} +4 -4
  29. package/dist/{index-D3iZhRMJ.js.map → index-DTHY5rAO.js.map} +1 -1
  30. package/dist/{index-DXL7teb0.js → index-DmLoihN1.js} +4 -4
  31. package/dist/{index-DXL7teb0.js.map → index-DmLoihN1.js.map} +1 -1
  32. package/dist/index.d.ts +46 -20
  33. package/dist/index.js +5 -5
  34. package/dist/plugins/index.js +10 -10
  35. package/dist/services/index.js +1 -1
  36. package/lib/index.umd.js +10 -10
  37. package/lib/index.umd.js.map +1 -1
  38. package/package.json +1 -1
  39. package/dist/Preferences-85Q9FAmb.js.map +0 -1
  40. package/dist/index-19CgGBI0.js.map +0 -1
  41. package/dist/index-CQr1DJ8n.js.map +0 -1
  42. package/dist/index-Ci82vLXg.js.map +0 -1
  43. package/dist/index-rpiO9fpc.js +0 -145
  44. package/dist/index-rpiO9fpc.js.map +0 -1
@@ -1,7 +1,7 @@
1
1
  import { useMemoryStorage as $t, createWikiPageModel as Rt, createWikiTitleModel as xt } from "./models/index.js";
2
- import { c as I, I as ne, S as m, d as je, p as H, R as Lt, E as Fe, g as At } from "./Preferences-85Q9FAmb.js";
3
- import { j as k, P as Tt } from "./index-CM_6yF2v.js";
4
- var qe = /* @__PURE__ */ ((r) => (r[r.debug = -1] = "debug", r[r.log = 0] = "log", r[r.info = 1] = "info", r[r.warn = 2] = "warn", r[r.error = 3] = "error", r[r.silent = 4] = "silent", r))(qe || {});
2
+ import { c as I, I as ne, S as m, d as je, h as Lt, p as H, R as At, E as qe, i as Tt } from "./Preferences-BF2fcXrn.js";
3
+ import { j as k, P as Ct } from "./index-CM_6yF2v.js";
4
+ var Fe = /* @__PURE__ */ ((r) => (r[r.debug = -1] = "debug", r[r.log = 0] = "log", r[r.info = 1] = "info", r[r.warn = 2] = "warn", r[r.error = 3] = "error", r[r.silent = 4] = "silent", r))(Fe || {});
5
5
  const he = globalThis || window, ue = Symbol.for("__IPE_LOGGER_COLOR_MAP__");
6
6
  he[ue] || (he[ue] = /* @__PURE__ */ new Map());
7
7
  const le = he[ue];
@@ -42,7 +42,7 @@ function X(r, e) {
42
42
  const i = r.startsWith("name:") ? "name" : "group", s = Ot(r, i);
43
43
  return le.set(r, s), s;
44
44
  }
45
- let Ct = class He {
45
+ let It = class He {
46
46
  /**
47
47
  * Note: constructor returns a callable Proxy so that you can do `logger('group')`.
48
48
  */
@@ -57,7 +57,7 @@ let Ct = class He {
57
57
  }, this._name && X(`name:${this._name}`, this._nameColor), this._installBuiltinLevels();
58
58
  for (const t of Object.keys(this._dynamicLevels))
59
59
  this._installLevelGetter(t, this._dynamicLevels[t]);
60
- return Pt(this);
60
+ return Dt(this);
61
61
  }
62
62
  // ---------- public API ----------
63
63
  get level() {
@@ -107,7 +107,7 @@ let Ct = class He {
107
107
  });
108
108
  }
109
109
  _method(e) {
110
- const t = It[e];
110
+ const t = Pt[e];
111
111
  if (!this._enabled(t.level)) return Te;
112
112
  const [i, s] = this._prefix(t.label);
113
113
  return this._consoleMethod(e).bind(console, i, ...s);
@@ -125,25 +125,25 @@ let Ct = class He {
125
125
  const s = X(`name:${this._name}`, this._nameColor);
126
126
  i += `%c${this._name}%c`, t.push(
127
127
  `background:${s}; color:#fff; padding:1px 4px; border-radius:2px; font-weight:700;`,
128
- Oe
128
+ Ce
129
129
  );
130
130
  }
131
131
  if (e && (i += ` ${e}`), this._groupPath.length) {
132
132
  const s = this._groupPath.join("/"), n = X(`group:${s}`);
133
- i += ` %c${s}%c`, t.push(`color:${n}; text-decoration: underline;`, Oe);
133
+ i += ` %c${s}%c`, t.push(`color:${n}; text-decoration: underline;`, Ce);
134
134
  }
135
135
  return [i, t];
136
136
  }
137
137
  };
138
138
  const Te = () => {
139
- }, Oe = "color:inherit; background:transparent; text-decoration:none;", It = {
139
+ }, Ce = "color:inherit; background:transparent; text-decoration:none;", Pt = {
140
140
  debug: { level: -1, label: "", method: "debug" },
141
141
  log: { level: 0, label: "", method: "log" },
142
142
  info: { level: 1, label: "[I]", method: "info" },
143
143
  warn: { level: 2, label: "[W]", method: "warn" },
144
144
  error: { level: 3, label: "[E]", method: "error" }
145
145
  };
146
- function Pt(r) {
146
+ function Dt(r) {
147
147
  const e = function(t, i) {
148
148
  return r.group(t, i);
149
149
  };
@@ -162,8 +162,8 @@ function Pt(r) {
162
162
  }
163
163
  });
164
164
  }
165
- function Dt(r) {
166
- return new Ct(r);
165
+ function Mt(r) {
166
+ return new It(r);
167
167
  }
168
168
  var x = /* @__PURE__ */ ((r) => (r.BODY_USED = "BODY_USED", r.NO_BODY_READER = "NO_BODY_READER", r.TIMEOUT = "TIMEOUT", r.NETWORK_ERROR = "NETWORK_ERROR", r.BODY_NOT_ALLOWED = "BODY_NOT_ALLOWED", r.HOOK_CONTEXT_CHANGED = "HOOK_CONTEXT_CHANGED", r.ABORTED_BY_HOOK = "ABORTED_BY_HOOK", r.INVALID_HOOK_CALLBACK = "INVALID_HOOK_CALLBACK", r.UNEXPECTED_HOOK_RETURN = "UNEXPECTED_HOOK_RETURN", r))(x || {});
169
169
  let $ = class Ke extends Error {
@@ -174,7 +174,7 @@ let $ = class Ke extends Error {
174
174
  static is(e) {
175
175
  return e?.constructor === Ke;
176
176
  }
177
- }, Mt = class We extends $ {
177
+ }, Ut = class We extends $ {
178
178
  constructor(e, t, i) {
179
179
  super(t.statusText, e, void 0, i), this.response = t;
180
180
  }
@@ -183,7 +183,7 @@ let $ = class Ke extends Error {
183
183
  return e?.constructor === We;
184
184
  }
185
185
  };
186
- function Ut(r, e = 2048) {
186
+ function Bt(r, e = 2048) {
187
187
  if (!(r instanceof Uint8Array))
188
188
  throw new TypeError("Input must be a Uint8Array");
189
189
  if (r.length === 0)
@@ -194,14 +194,14 @@ function Ut(r, e = 2048) {
194
194
  ), i = r.slice(0, t);
195
195
  if (Nt(i))
196
196
  return !1;
197
- const s = Bt(i);
197
+ const s = jt(i);
198
198
  if (s.nullByteRatio > 0.05 || s.highByteRatio > 0.95)
199
199
  return !1;
200
200
  const n = ["utf-8", "utf-16le", "utf-16be", "iso-8859-1"];
201
201
  let o = -1, a = !1;
202
202
  for (const c of n)
203
203
  try {
204
- const l = new TextDecoder(c, { fatal: !0 }).decode(i), h = jt(l);
204
+ const l = new TextDecoder(c, { fatal: !0 }).decode(i), h = qt(l);
205
205
  h > o && (o = h, a = h > 0.7);
206
206
  } catch {
207
207
  continue;
@@ -248,7 +248,7 @@ function Nt(r) {
248
248
  }
249
249
  return !1;
250
250
  }
251
- function Bt(r) {
251
+ function jt(r) {
252
252
  let e = 0, t = 0, i = 0;
253
253
  for (const s of r)
254
254
  s === 0 && e++, s > 127 && t++, (s < 32 && s !== 9 && s !== 10 && s !== 13 || s === 127) && i++;
@@ -258,23 +258,23 @@ function Bt(r) {
258
258
  controlCharRatio: i / r.length
259
259
  };
260
260
  }
261
- function jt(r) {
261
+ function qt(r) {
262
262
  if (r.length === 0) return 1;
263
263
  let e = 1, t = 0;
264
264
  for (let s = 0; s < r.length; s++) {
265
265
  const n = r[s].charCodeAt(0);
266
- n >= 32 && n <= 126 || n === 9 || n === 10 || n === 13 || n === 32 ? t++ : n > 127 && n < 65534 ? !Ft(n) && !qt(n) && t++ : e -= 0.1;
266
+ n >= 32 && n <= 126 || n === 9 || n === 10 || n === 13 || n === 32 ? t++ : n > 127 && n < 65534 ? !Ft(n) && !Ht(n) && t++ : e -= 0.1;
267
267
  }
268
268
  const i = t / r.length;
269
- return e *= i, Ht(r) && (e *= 1.1), Math.max(0, Math.min(1, e));
269
+ return e *= i, Kt(r) && (e *= 1.1), Math.max(0, Math.min(1, e));
270
270
  }
271
271
  function Ft(r) {
272
272
  return r >= 0 && r <= 31 || r >= 127 && r <= 159;
273
273
  }
274
- function qt(r) {
274
+ function Ht(r) {
275
275
  return r >= 57344 && r <= 63743 || r >= 983040 && r <= 1048573 || r >= 1048576 && r <= 1114109;
276
276
  }
277
- function Ht(r) {
277
+ function Kt(r) {
278
278
  return [
279
279
  /\b\w+\b/,
280
280
  // Words
@@ -316,7 +316,7 @@ const K = (r, ...e) => {
316
316
  }
317
317
  return i;
318
318
  };
319
- let F = class {
319
+ let q = class {
320
320
  constructor(e, t, i) {
321
321
  this.rawResponse = e, this.data = t, this.ok = e.ok, this.status = e.status, this.statusText = e.statusText, this.headers = e.headers, Object.entries(i || {}).forEach(([s, n]) => {
322
322
  this[s] = n;
@@ -327,18 +327,18 @@ let F = class {
327
327
  statusText;
328
328
  headers;
329
329
  };
330
- async function Ce(r, e, t) {
330
+ async function Oe(r, e, t) {
331
331
  if (r.bodyUsed)
332
332
  throw new $(
333
333
  x.BODY_USED,
334
334
  "Response body has already been used or locked"
335
335
  );
336
- const i = r.headers.get("content-type") || "", s = Number(r.headers.get("content-length")) || 0, n = (a, c) => c === "json" || a.startsWith("application/json"), o = (a, c, l) => l === "blob" || a.startsWith("image/") && !a.startsWith("image/svg") || a.startsWith("video/") || a.startsWith("audio/") || !Ut(c);
336
+ const i = r.headers.get("content-type") || "", s = Number(r.headers.get("content-length")) || 0, n = (a, c) => c === "json" || a.startsWith("application/json"), o = (a, c, l) => l === "blob" || a.startsWith("image/") && !a.startsWith("image/svg") || a.startsWith("video/") || a.startsWith("audio/") || !Bt(c);
337
337
  if ((r.status === 101 || r.status === 426 || r.headers.get("upgrade")) && typeof globalThis.WebSocket < "u") {
338
338
  const a = new WebSocket(r.url);
339
339
  return await new Promise((c, l) => {
340
340
  a.onopen = c, a.onerror = l;
341
- }), new F(r, a, {
341
+ }), new q(r, a, {
342
342
  ok: !0,
343
343
  status: 101,
344
344
  statusText: "Switching Protocols"
@@ -347,10 +347,10 @@ async function Ce(r, e, t) {
347
347
  const a = new EventSource(r.url);
348
348
  return await new Promise((c, l) => {
349
349
  a.onopen = c, a.onerror = l;
350
- }), new F(r, a);
350
+ }), new q(r, a);
351
351
  } else {
352
352
  if (e === "stream")
353
- return new F(
353
+ return new q(
354
354
  r,
355
355
  r.body
356
356
  );
@@ -370,7 +370,7 @@ async function Ce(r, e, t) {
370
370
  t(u, c);
371
371
  }
372
372
  }
373
- const l = new F(r, void 0);
373
+ const l = new q(r, void 0);
374
374
  if (e === "arrayBuffer")
375
375
  return l.data = c.buffer, l;
376
376
  if (n(i, e))
@@ -391,7 +391,7 @@ async function Ce(r, e, t) {
391
391
  }
392
392
  if (typeof l.data > "u" && (l.data = c.length > 0 ? c : void 0), l.ok)
393
393
  return l;
394
- throw new Mt(
394
+ throw new Ut(
395
395
  `Request failed with status code ${r.status}`,
396
396
  l
397
397
  );
@@ -744,7 +744,7 @@ let de = class _ extends ze {
744
744
  )
745
745
  ));
746
746
  };
747
- }), i.rawResponse = new Response(), i.response = new F(i.rawResponse, f, {
747
+ }), i.rawResponse = new Response(), i.response = new q(i.rawResponse, f, {
748
748
  ok: !0,
749
749
  status: 101,
750
750
  statusText: "Switching Protocols"
@@ -768,7 +768,7 @@ let de = class _ extends ze {
768
768
  i
769
769
  ) : new $(x.NETWORK_ERROR, g.message, i);
770
770
  });
771
- return u && clearTimeout(u), i.rawResponse = f, i.response = await Ce(
771
+ return u && clearTimeout(u), i.rawResponse = f, i.response = await Oe(
772
772
  f,
773
773
  i.responseType,
774
774
  (g, p) => {
@@ -834,7 +834,7 @@ let de = class _ extends ze {
834
834
  t
835
835
  );
836
836
  if (d instanceof Response) {
837
- const u = d, f = { ...t, rawResponse: u }, g = await Ce(
837
+ const u = d, f = { ...t, rawResponse: u }, g = await Oe(
838
838
  u,
839
839
  t.responseType,
840
840
  (p, y) => {
@@ -954,7 +954,7 @@ let de = class _ extends ze {
954
954
  /** @deprecated Use `mergeQueries` instead */
955
955
  mergeQuery = this.mergeQueries;
956
956
  };
957
- const Kt = de.create, Ie = Kt();
957
+ const Wt = de.create, Ie = Wt();
958
958
  typeof globalThis < "u" ? globalThis.fexios = Ie : typeof window < "u" && (window.fexios = Ie);
959
959
  var Z;
960
960
  ((r) => {
@@ -989,7 +989,7 @@ class R extends Error {
989
989
  return e instanceof this && (t === void 0 || e.code === t);
990
990
  }
991
991
  }
992
- let B = class Ge extends Error {
992
+ let N = class Ge extends Error {
993
993
  constructor(e, t) {
994
994
  super(), this.errors = e, this.cause = t, this.name = "MediaWikiApiError", this.errors = Ge.normalizeErrors(e), this.message = e.map((i) => i.text).filter(Boolean).join(`
995
995
  `), this.code = this.isBadTokenError() ? "badtoken" : this.errors[0]?.code || "Unknown Error";
@@ -1021,7 +1021,7 @@ let B = class Ge extends Error {
1021
1021
  function t(n) {
1022
1022
  return i(n).length > 0;
1023
1023
  }
1024
- r.includesMediaWikiApiError = t, r.normalizeMwApiErrors = B.normalizeErrors;
1024
+ r.includesMediaWikiApiError = t, r.normalizeMwApiErrors = N.normalizeErrors;
1025
1025
  function i(n) {
1026
1026
  let o = e(n);
1027
1027
  if (typeof o != "object" || o === null)
@@ -1031,11 +1031,11 @@ let B = class Ge extends Error {
1031
1031
  }
1032
1032
  r.extractMediaWikiApiErrors = i;
1033
1033
  function s(n) {
1034
- if (B.is(n))
1034
+ if (N.is(n))
1035
1035
  return n.isBadTokenError();
1036
1036
  {
1037
1037
  const o = i(n);
1038
- return new B(o).isBadTokenError();
1038
+ return new N(o).isBadTokenError();
1039
1039
  }
1040
1040
  }
1041
1041
  r.isBadTokenError = s;
@@ -1096,7 +1096,7 @@ const D = (r, ...e) => {
1096
1096
  t(c) && t(a) ? s[o] = D(c, a) : s[o] = i(a);
1097
1097
  }
1098
1098
  return s;
1099
- }, Wt = (r, e, t) => {
1099
+ }, zt = (r, e, t) => {
1100
1100
  let i = { ...Xe.DEFAULT_CONFIGS };
1101
1101
  if (typeof r == "string" ? i = D(i, {
1102
1102
  baseURL: r,
@@ -1109,10 +1109,10 @@ const D = (r, ...e) => {
1109
1109
  if (typeof i.baseURL != "string")
1110
1110
  throw new Error("baseURL is required");
1111
1111
  return i;
1112
- }, zt = () => {
1113
- }, Gt = async (r, e) => {
1112
+ }, Gt = () => {
1113
+ }, Yt = async (r, e) => {
1114
1114
  let t = 0;
1115
- const { retry: i = 3, onRetry: s = zt, shouldRetry: n = () => !0 } = e;
1115
+ const { retry: i = 3, onRetry: s = Gt, shouldRetry: n = () => !0 } = e;
1116
1116
  let o;
1117
1117
  do
1118
1118
  try {
@@ -1126,10 +1126,10 @@ const D = (r, ...e) => {
1126
1126
  while (t < i);
1127
1127
  throw o || new Error("Retry failed");
1128
1128
  };
1129
- const q = class {
1129
+ const F = class {
1130
1130
  constructor(e, t, i) {
1131
1131
  this.version = "7.1.2", this.token = this.getToken;
1132
- const s = this.config = Wt(
1132
+ const s = this.config = zt(
1133
1133
  e,
1134
1134
  t,
1135
1135
  i
@@ -1179,7 +1179,7 @@ const q = class {
1179
1179
  const t = await e();
1180
1180
  return this.handleApiResponse(t);
1181
1181
  } catch (t) {
1182
- throw this.config.throwOnApiError && R.includesMediaWikiApiError(t) ? new B(
1182
+ throw this.config.throwOnApiError && R.includesMediaWikiApiError(t) ? new N(
1183
1183
  R.extractMediaWikiApiErrors(t),
1184
1184
  t
1185
1185
  ) : t;
@@ -1188,7 +1188,7 @@ const q = class {
1188
1188
  throwIfApiError(e) {
1189
1189
  const t = R.extractMediaWikiApiErrors(e);
1190
1190
  if (t.length > 0)
1191
- throw new B(t, e);
1191
+ throw new N(t, e);
1192
1192
  }
1193
1193
  handleApiResponse(e) {
1194
1194
  return this.config.throwOnApiError && this.throwIfApiError(e.data), e;
@@ -1223,7 +1223,7 @@ const q = class {
1223
1223
  "The limit of the number of times to automatically re-acquire the token has been exceeded"
1224
1224
  );
1225
1225
  let c = 0;
1226
- return Gt(
1226
+ return Yt(
1227
1227
  async () => {
1228
1228
  const l = await this.getToken(
1229
1229
  e,
@@ -1243,7 +1243,7 @@ const q = class {
1243
1243
  throw h;
1244
1244
  return h;
1245
1245
  } catch (h) {
1246
- throw R.isBadTokenError(h) || h?.ok === !1 || B.is(h) ? h : new R(
1246
+ throw R.isBadTokenError(h) || h?.ok === !1 || N.is(h) ? h : new R(
1247
1247
  z.HTTP_ERROR,
1248
1248
  "Network/transport or SDK-internal error (not a MediaWiki API error)",
1249
1249
  h
@@ -1282,21 +1282,21 @@ const q = class {
1282
1282
  return this.config.fexiosConfigs;
1283
1283
  }
1284
1284
  };
1285
- q.INIT_DEFAULT_PARAMS = {
1285
+ F.INIT_DEFAULT_PARAMS = {
1286
1286
  action: "query",
1287
1287
  errorformat: "plaintext",
1288
1288
  format: "json",
1289
1289
  formatversion: 2
1290
- }, q.DEFAULT_CONFIGS = {
1290
+ }, F.DEFAULT_CONFIGS = {
1291
1291
  baseURL: void 0,
1292
1292
  fexiosConfigs: {
1293
1293
  responseType: "json"
1294
1294
  },
1295
- defaultParams: q.INIT_DEFAULT_PARAMS,
1295
+ defaultParams: F.INIT_DEFAULT_PARAMS,
1296
1296
  throwOnApiError: !1
1297
- }, q.createRequestHandler = Ye;
1298
- let Xe = q;
1299
- let Yt = class extends Xe {
1297
+ }, F.createRequestHandler = Ye;
1298
+ let Xe = F;
1299
+ let Xt = class extends Xe {
1300
1300
  async clientLogin(e, t, i) {
1301
1301
  i ||= {}, !i.logincontinue && !i.loginreturnurl && (i.loginreturnurl = location?.origin);
1302
1302
  const s = await this.postWithToken(
@@ -1320,10 +1320,10 @@ let Yt = class extends Xe {
1320
1320
  );
1321
1321
  }
1322
1322
  };
1323
- class Xt {
1323
+ class Qt {
1324
1324
  constructor(e, t = {}) {
1325
1325
  this.ctx = e, location?.href && t?.baseURL?.toString()?.startsWith("/") && (t.baseURL = new URL(t.baseURL, location.origin));
1326
- const i = new Yt({
1326
+ const i = new Xt({
1327
1327
  baseURL: t.baseURL.toString(),
1328
1328
  fexiosConfigs: {
1329
1329
  headers: {
@@ -1337,17 +1337,17 @@ class Xt {
1337
1337
  e.set("api", i);
1338
1338
  }
1339
1339
  }
1340
- var Qt = Object.create, me = Object.defineProperty, Vt = Object.getOwnPropertyDescriptor, Qe = (r, e) => (e = Symbol[r]) ? e : Symbol.for("Symbol." + r), Ve = (r) => {
1340
+ var Vt = Object.create, me = Object.defineProperty, Zt = Object.getOwnPropertyDescriptor, Qe = (r, e) => (e = Symbol[r]) ? e : Symbol.for("Symbol." + r), Ve = (r) => {
1341
1341
  throw TypeError(r);
1342
- }, Zt = (r, e, t) => e in r ? me(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, Jt = (r, e) => me(r, "name", { value: e, configurable: !0 }), ei = (r) => [, , , Qt(r?.[Qe("metadata")] ?? null)], ti = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"], Ze = (r) => r !== void 0 && typeof r != "function" ? Ve("Function expected") : r, ii = (r, e, t, i, s) => ({ kind: ti[r], name: e, metadata: i, addInitializer: (n) => t._ ? Ve("Already initialized") : s.push(Ze(n || null)) }), si = (r, e) => Zt(e, Qe("metadata"), r[3]), ri = (r, e, t, i) => {
1342
+ }, Jt = (r, e, t) => e in r ? me(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, ei = (r, e) => me(r, "name", { value: e, configurable: !0 }), ti = (r) => [, , , Vt(r?.[Qe("metadata")] ?? null)], ii = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"], Ze = (r) => r !== void 0 && typeof r != "function" ? Ve("Function expected") : r, si = (r, e, t, i, s) => ({ kind: ii[r], name: e, metadata: i, addInitializer: (n) => t._ ? Ve("Already initialized") : s.push(Ze(n || null)) }), ri = (r, e) => Jt(e, Qe("metadata"), r[3]), ni = (r, e, t, i) => {
1343
1343
  for (var s = 0, n = r[e >> 1], o = n && n.length; s < o; s++) n[s].call(t);
1344
1344
  return i;
1345
- }, ni = (r, e, t, i, s, n) => {
1346
- var o, a, c, l = e & 7, h = !1, d = 0, u = r[d] || (r[d] = []), f = l && (s = s.prototype, l < 5 && (l > 3 || !h) && Vt(s, t));
1347
- Jt(s, t);
1345
+ }, oi = (r, e, t, i, s, n) => {
1346
+ var o, a, c, l = e & 7, h = !1, d = 0, u = r[d] || (r[d] = []), f = l && (s = s.prototype, l < 5 && (l > 3 || !h) && Zt(s, t));
1347
+ ei(s, t);
1348
1348
  for (var g = i.length - 1; g >= 0; g--)
1349
- c = ii(l, t, a = {}, r[3], u), o = (0, i[g])(s, c), a._ = 1, Ze(o) && (s = o);
1350
- return si(r, s), f && me(s, t, f), h ? l ^ 4 ? n : f : s;
1349
+ c = si(l, t, a = {}, r[3], u), o = (0, i[g])(s, c), a._ = 1, Ze(o) && (s = o);
1350
+ return ri(r, s), f && me(s, t, f), h ? l ^ 4 ? n : f : s;
1351
1351
  }, Je, ye, et;
1352
1352
  Je = [ne(["wiki", "wikiTitle"])];
1353
1353
  class J extends (et = I) {
@@ -1407,10 +1407,10 @@ class J extends (et = I) {
1407
1407
  return this.params.get("action") || "view";
1408
1408
  }
1409
1409
  }
1410
- ye = ei(et);
1411
- J = ni(ye, 0, "CurrentPageService", Je, J);
1412
- ri(ye, 1, J);
1413
- class oi extends I {
1410
+ ye = ti(et);
1411
+ J = oi(ye, 0, "CurrentPageService", Je, J);
1412
+ ni(ye, 1, J);
1413
+ class ai extends I {
1414
1414
  constructor(e) {
1415
1415
  super(e, "resourceLoader", !0), this.ctx = e;
1416
1416
  }
@@ -1460,10 +1460,10 @@ class oi extends I {
1460
1460
  }
1461
1461
  }
1462
1462
  const oe = Object.keys;
1463
- function ai(r) {
1463
+ function li(r) {
1464
1464
  return typeof r == "boolean";
1465
1465
  }
1466
- function li(r) {
1466
+ function ci(r) {
1467
1467
  return r && typeof r.nodeType == "number";
1468
1468
  }
1469
1469
  function we(r) {
@@ -1478,10 +1478,10 @@ function M(r) {
1478
1478
  function G(r) {
1479
1479
  return typeof r == "function";
1480
1480
  }
1481
- function ci(r) {
1481
+ function hi(r) {
1482
1482
  return !!(r && r.isComponent);
1483
1483
  }
1484
- function hi(r) {
1484
+ function ui(r) {
1485
1485
  return M(r) && typeof r.length == "number" && typeof r.nodeType != "number";
1486
1486
  }
1487
1487
  function fe(r, e) {
@@ -1489,7 +1489,7 @@ function fe(r, e) {
1489
1489
  for (const t of oe(r))
1490
1490
  e(r[t], t);
1491
1491
  }
1492
- function ui(r) {
1492
+ function di(r) {
1493
1493
  return M(r) && "current" in r;
1494
1494
  }
1495
1495
  const ge = {
@@ -1537,30 +1537,30 @@ const ge = {
1537
1537
  strokeOpacity: 0,
1538
1538
  strokeWidth: 0
1539
1539
  };
1540
- function di(r, e) {
1540
+ function fi(r, e) {
1541
1541
  return r + e.charAt(0).toUpperCase() + e.substring(1);
1542
1542
  }
1543
- const fi = ["Webkit", "ms", "Moz", "O"];
1543
+ const gi = ["Webkit", "ms", "Moz", "O"];
1544
1544
  oe(ge).forEach((r) => {
1545
- fi.forEach((e) => {
1546
- ge[di(e, r)] = 0;
1545
+ gi.forEach((e) => {
1546
+ ge[fi(e, r)] = 0;
1547
1547
  });
1548
1548
  });
1549
- const gi = Symbol.for("jsx-dom:type");
1549
+ const pi = Symbol.for("jsx-dom:type");
1550
1550
  var it = /* @__PURE__ */ (function(r) {
1551
1551
  return r.ShadowRoot = "ShadowRoot", r;
1552
1552
  })(it || {});
1553
- function pi(r) {
1554
- return r != null && r[gi] === it.ShadowRoot;
1553
+ function mi(r) {
1554
+ return r != null && r[pi] === it.ShadowRoot;
1555
1555
  }
1556
- const mi = "http://www.w3.org/2000/svg", yi = "http://www.w3.org/1999/xlink", wi = "http://www.w3.org/XML/1998/namespace";
1556
+ const yi = "http://www.w3.org/2000/svg", wi = "http://www.w3.org/1999/xlink", bi = "http://www.w3.org/XML/1998/namespace";
1557
1557
  function st(r) {
1558
- return !ai(r) && r != null;
1558
+ return !li(r) && r != null;
1559
1559
  }
1560
1560
  function pe(r) {
1561
1561
  return Array.isArray(r) ? r.map(pe).filter(Boolean).join(" ") : M(r) ? Symbol.iterator in r ? pe(Array.from(r)) : oe(r).filter((e) => r[e]).join(" ") : st(r) ? "" + r : "";
1562
1562
  }
1563
- const bi = {
1563
+ const vi = {
1564
1564
  animate: 0,
1565
1565
  circle: 0,
1566
1566
  clipPath: 0,
@@ -1615,12 +1615,12 @@ const bi = {
1615
1615
  tspan: 0,
1616
1616
  use: 0,
1617
1617
  view: 0
1618
- }, vi = /^(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)/;
1619
- function _i(r) {
1618
+ }, _i = /^(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)/;
1619
+ function Si(r) {
1620
1620
  const e = document.createDocumentFragment();
1621
1621
  return ae(r.children, e), e;
1622
1622
  }
1623
- function Si(r, e, t) {
1623
+ function Ei(r, e, t) {
1624
1624
  e = {
1625
1625
  ...e,
1626
1626
  children: t
@@ -1630,13 +1630,13 @@ function Si(r, e, t) {
1630
1630
  }
1631
1631
  function w(r, e) {
1632
1632
  let { children: t, ...i } = e;
1633
- !i.namespaceURI && bi[r] === 0 && (i = {
1633
+ !i.namespaceURI && vi[r] === 0 && (i = {
1634
1634
  ...i,
1635
- namespaceURI: mi
1635
+ namespaceURI: yi
1636
1636
  });
1637
1637
  let s;
1638
1638
  if (we(r)) {
1639
- if (s = i.namespaceURI ? document.createElementNS(i.namespaceURI, r) : document.createElement(r), $i(i, s), ae(t, s), s instanceof window.HTMLSelectElement && i.value != null)
1639
+ if (s = i.namespaceURI ? document.createElementNS(i.namespaceURI, r) : document.createElement(r), Ri(i, s), ae(t, s), s instanceof window.HTMLSelectElement && i.value != null)
1640
1640
  if (i.multiple === !0 && Array.isArray(i.value)) {
1641
1641
  const n = i.value.map((o) => String(o));
1642
1642
  s.querySelectorAll("option").forEach(
@@ -1649,7 +1649,7 @@ function w(r, e) {
1649
1649
  M(r.defaultProps) && (i = {
1650
1650
  ...r.defaultProps,
1651
1651
  ...i
1652
- }), s = ci(r) ? Si(r, i, t) : r({
1652
+ }), s = hi(r) ? Ei(r, i, t) : r({
1653
1653
  ...i,
1654
1654
  children: t
1655
1655
  });
@@ -1658,23 +1658,23 @@ function w(r, e) {
1658
1658
  return s;
1659
1659
  }
1660
1660
  function be(r, e) {
1661
- ui(r) ? r.current = e : G(r) && r(e);
1661
+ di(r) ? r.current = e : G(r) && r(e);
1662
1662
  }
1663
1663
  function ae(r, e) {
1664
- if (hi(r))
1665
- Ei(r, e);
1664
+ if (ui(r))
1665
+ ki(r, e);
1666
1666
  else if (we(r) || tt(r))
1667
1667
  ce(document.createTextNode(r), e);
1668
1668
  else if (r === null)
1669
1669
  ce(document.createComment(""), e);
1670
- else if (li(r))
1670
+ else if (ci(r))
1671
1671
  ce(r, e);
1672
- else if (pi(r)) {
1672
+ else if (mi(r)) {
1673
1673
  const t = e.attachShadow(r.attr);
1674
1674
  ae(r.children, t), be(r.ref, t);
1675
1675
  }
1676
1676
  }
1677
- function Ei(r, e) {
1677
+ function ki(r, e) {
1678
1678
  for (const t of [...r])
1679
1679
  ae(t, e);
1680
1680
  return e;
@@ -1690,7 +1690,7 @@ function rt(r, e) {
1690
1690
  i.indexOf("-") === 0 ? r.style.setProperty(i, t) : tt(t) && ge[i] !== 0 ? r.style[i] = t + "px" : r.style[i] = t;
1691
1691
  }));
1692
1692
  }
1693
- function ki(r, e, t) {
1693
+ function $i(r, e, t) {
1694
1694
  switch (r) {
1695
1695
  case "xlinkActuate":
1696
1696
  case "xlinkArcrole":
@@ -1699,20 +1699,20 @@ function ki(r, e, t) {
1699
1699
  case "xlinkShow":
1700
1700
  case "xlinkTitle":
1701
1701
  case "xlinkType":
1702
- De(t, yi, Q(r, ":"), e);
1702
+ De(t, wi, Q(r, ":"), e);
1703
1703
  return;
1704
1704
  case "xmlnsXlink":
1705
- N(t, Q(r, ":"), e);
1705
+ B(t, Q(r, ":"), e);
1706
1706
  return;
1707
1707
  case "xmlBase":
1708
1708
  case "xmlLang":
1709
1709
  case "xmlSpace":
1710
- De(t, wi, Q(r, ":"), e);
1710
+ De(t, bi, Q(r, ":"), e);
1711
1711
  return;
1712
1712
  }
1713
1713
  switch (r) {
1714
1714
  case "htmlFor":
1715
- N(t, "for", e);
1715
+ B(t, "for", e);
1716
1716
  return;
1717
1717
  case "dataset":
1718
1718
  fe(e, (i, s) => {
@@ -1740,7 +1740,7 @@ function ki(r, e, t) {
1740
1740
  return;
1741
1741
  case "class":
1742
1742
  case "className":
1743
- G(e) ? e(t) : N(t, "class", pe(e));
1743
+ G(e) ? e(t) : B(t, "class", pe(e));
1744
1744
  return;
1745
1745
  case "ref":
1746
1746
  case "namespaceURI":
@@ -1772,22 +1772,22 @@ function ki(r, e, t) {
1772
1772
  i in window ? n = i.substring(2) : n = i[2] + r.slice(3), t.addEventListener(n, e);
1773
1773
  }
1774
1774
  }
1775
- } else M(e) ? t[r] = e : e === !0 ? N(t, r, "") : e !== !1 && e != null && (t instanceof SVGElement && !vi.test(r) ? N(t, Q(r, "-"), e) : N(t, r, e));
1775
+ } else M(e) ? t[r] = e : e === !0 ? B(t, r, "") : e !== !1 && e != null && (t instanceof SVGElement && !_i.test(r) ? B(t, Q(r, "-"), e) : B(t, r, e));
1776
1776
  }
1777
- function N(r, e, t) {
1777
+ function B(r, e, t) {
1778
1778
  r.setAttribute(e, t);
1779
1779
  }
1780
1780
  function De(r, e, t, i) {
1781
1781
  r.setAttributeNS(e, t, i);
1782
1782
  }
1783
- function $i(r, e) {
1783
+ function Ri(r, e) {
1784
1784
  for (const t of oe(r))
1785
- ki(t, r[t], e);
1785
+ $i(t, r[t], e);
1786
1786
  return e;
1787
1787
  }
1788
1788
  var ve = /* @__PURE__ */ ((r) => (r.Init = "modal.init", r.BeforeShow = "modal.beforeShow", r.Show = "modal.show", r.BeforeClose = "modal.beforeClose", r.Close = "modal.close", r.Destroy = "modal.destroy", r.ToastShow = "toast.show", r.ToastClose = "toast.close", r))(ve || {});
1789
- let Ri = 0;
1790
- const Me = (r) => `${r}-${++Ri}`;
1789
+ let xi = 0;
1790
+ const Me = (r) => `${r}-${++xi}`;
1791
1791
  function j(r) {
1792
1792
  return r instanceof Node ? r : document.createTextNode(String(r));
1793
1793
  }
@@ -1814,8 +1814,8 @@ function S(r, e = {}) {
1814
1814
  for (const [i, s] of Object.entries(e.attrs)) t.setAttribute(i, s);
1815
1815
  return t;
1816
1816
  }
1817
- const xi = typeof navigator < "u" && /Mac|iPhone|iPad|iPod/i.test(navigator.platform), nt = ["ctrl", "alt", "shift", "meta"];
1818
- function Li(r) {
1817
+ const Li = typeof navigator < "u" && /Mac|iPhone|iPad|iPod/i.test(navigator.platform), nt = ["ctrl", "alt", "shift", "meta"];
1818
+ function Ai(r) {
1819
1819
  if (!r) return null;
1820
1820
  const e = String(r).trim().toLowerCase().split(/[+\-\s]+/g).filter(Boolean), t = [];
1821
1821
  let i = null;
@@ -1841,7 +1841,7 @@ function Li(r) {
1841
1841
  continue;
1842
1842
  }
1843
1843
  if (a === "mod") {
1844
- s(xi ? "meta" : "ctrl");
1844
+ s(Li ? "meta" : "ctrl");
1845
1845
  continue;
1846
1846
  }
1847
1847
  a === "esc" && (a = "escape"), a === "return" && (a = "enter"), (a === "space" || a === "spacebar") && (a = "space"), i = a;
@@ -1849,7 +1849,7 @@ function Li(r) {
1849
1849
  const n = nt.filter((o) => t.includes(o));
1850
1850
  return !i || i === "" ? n.length ? n.join("+") : null : n.length ? `${n.join("+")}+${i}` : i;
1851
1851
  }
1852
- function Ai(r) {
1852
+ function Ti(r) {
1853
1853
  const e = [];
1854
1854
  r.ctrlKey && e.push("ctrl"), r.altKey && e.push("alt"), r.shiftKey && e.push("shift"), r.metaKey && e.push("meta");
1855
1855
  let t = r.key;
@@ -1857,7 +1857,7 @@ function Ai(r) {
1857
1857
  const i = (t.length, t.toLowerCase()), s = nt.filter((n) => e.includes(n));
1858
1858
  return s.length ? `${s.join("+")}+${i}` : i;
1859
1859
  }
1860
- class Ti {
1860
+ class Ci {
1861
1861
  constructor() {
1862
1862
  this.zBase = 1e3, this.stack = [];
1863
1863
  }
@@ -1890,7 +1890,7 @@ class Ti {
1890
1890
  document.body.classList.remove("ipe-modal-no-scroll");
1891
1891
  }
1892
1892
  }
1893
- const E = new Ti();
1893
+ const E = new Ci();
1894
1894
  class ee {
1895
1895
  constructor(e = {}) {
1896
1896
  this.backdropId = Me("ipe-modal-backdrop"), this.modalId = Me("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 = ve, this._hooks = [], this.startCloseTimer = (t) => {
@@ -2149,7 +2149,7 @@ class ee {
2149
2149
  if (e.keyPress) {
2150
2150
  const n = String(e.keyPress).split(/[\,\|]+/g).map((o) => o.trim()).filter(Boolean);
2151
2151
  for (const o of n) {
2152
- const a = Li(o);
2152
+ const a = Ai(o);
2153
2153
  a && this.keyMap.set(a, i);
2154
2154
  }
2155
2155
  }
@@ -2238,7 +2238,7 @@ class ee {
2238
2238
  const i = e.ctrlKey || e.altKey || e.metaKey, s = e.target;
2239
2239
  if (!i && (s && ["INPUT", "TEXTAREA"].includes(s.tagName) || s.contentEditable === "true"))
2240
2240
  return;
2241
- const n = Ai(e), o = this.keyMap.get(n);
2241
+ const n = Ti(e), o = this.keyMap.get(n);
2242
2242
  if (o) {
2243
2243
  e.preventDefault(), o.click();
2244
2244
  return;
@@ -2473,7 +2473,7 @@ class ee {
2473
2473
  t.title = a[0].toUpperCase() + a.slice(1).toLowerCase();
2474
2474
  }
2475
2475
  const s = t.icon ?? this.getDefaultNotifyIcon(e);
2476
- s && (s instanceof Element && s.classList.add("ipe-modal-notify-icon"), t.title = /* @__PURE__ */ w(_i, { children: [
2476
+ s && (s instanceof Element && s.classList.add("ipe-modal-notify-icon"), t.title = /* @__PURE__ */ w(Si, { children: [
2477
2477
  s,
2478
2478
  t.title
2479
2479
  ] })), e === "confirm" && (typeof t.closeAfter > "u" && (t.closeAfter = 0), t.okBtn || (t.okBtn = { label: "OK" })), t.okBtn && (typeof t.okBtn != "object" && (t.okBtn = { label: "OK" }), t.okBtn.label ??= "OK", t.okBtn.className ??= "is-primary is-text ok-btn", t.okBtn.method = (a, c) => {
@@ -2539,7 +2539,7 @@ class v extends ee {
2539
2539
  backgroundColor: "rgba(255, 255, 255, 0.5)",
2540
2540
  zIndex: 2e3
2541
2541
  },
2542
- children: /* @__PURE__ */ k(Tt, { style: { width: "80%", maxWidth: "800px" } })
2542
+ children: /* @__PURE__ */ k(Ct, { style: { width: "80%", maxWidth: "800px" } })
2543
2543
  }
2544
2544
  )
2545
2545
  );
@@ -2552,7 +2552,7 @@ class v extends ee {
2552
2552
  }
2553
2553
  }
2554
2554
  }
2555
- class Ci {
2555
+ class Ii {
2556
2556
  constructor(e) {
2557
2557
  this.ctx = e, this.IPEModal = v, this.IPEModalEvent = ve, this.show = v.show.bind(v), this.createObject = v.createObject.bind(v), this.close = v.close.bind(v), this.closeAll = v.closeAll.bind(v), this.removeAll = v.removeAll.bind(v), this.dialog = v.dialog.bind(v), this.confirm = v.confirm.bind(v), this.notify = v.notify.bind(v), e.set("modal", this), e.on("dispose", () => {
2558
2558
  v.closeAll();
@@ -2588,17 +2588,17 @@ const ot = (r) => {
2588
2588
  s.set(o, a);
2589
2589
  return i.search = s.toString(), i.hash = "", i;
2590
2590
  };
2591
- var Ii = Object.create, _e = Object.defineProperty, Pi = Object.getOwnPropertyDescriptor, lt = (r, e) => (e = Symbol[r]) ? e : Symbol.for("Symbol." + r), ct = (r) => {
2591
+ var Pi = Object.create, _e = Object.defineProperty, Di = Object.getOwnPropertyDescriptor, lt = (r, e) => (e = Symbol[r]) ? e : Symbol.for("Symbol." + r), ct = (r) => {
2592
2592
  throw TypeError(r);
2593
- }, Di = (r, e, t) => e in r ? _e(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, Mi = (r, e) => _e(r, "name", { value: e, configurable: !0 }), Ui = (r) => [, , , Ii(r?.[lt("metadata")] ?? null)], Ni = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"], ht = (r) => r !== void 0 && typeof r != "function" ? ct("Function expected") : r, Bi = (r, e, t, i, s) => ({ kind: Ni[r], name: e, metadata: i, addInitializer: (n) => t._ ? ct("Already initialized") : s.push(ht(n || null)) }), ji = (r, e) => Di(e, lt("metadata"), r[3]), Fi = (r, e, t, i) => {
2593
+ }, Mi = (r, e, t) => e in r ? _e(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, Ui = (r, e) => _e(r, "name", { value: e, configurable: !0 }), Bi = (r) => [, , , Pi(r?.[lt("metadata")] ?? null)], Ni = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"], ht = (r) => r !== void 0 && typeof r != "function" ? ct("Function expected") : r, ji = (r, e, t, i, s) => ({ kind: Ni[r], name: e, metadata: i, addInitializer: (n) => t._ ? ct("Already initialized") : s.push(ht(n || null)) }), qi = (r, e) => Mi(e, lt("metadata"), r[3]), Fi = (r, e, t, i) => {
2594
2594
  for (var s = 0, n = r[e >> 1], o = n && n.length; s < o; s++) n[s].call(t);
2595
2595
  return i;
2596
- }, qi = (r, e, t, i, s, n) => {
2597
- var o, a, c, l = e & 7, h = !1, d = 0, u = r[d] || (r[d] = []), f = l && (s = s.prototype, l < 5 && (l > 3 || !h) && Pi(s, t));
2598
- Mi(s, t);
2596
+ }, Hi = (r, e, t, i, s, n) => {
2597
+ var o, a, c, l = e & 7, h = !1, d = 0, u = r[d] || (r[d] = []), f = l && (s = s.prototype, l < 5 && (l > 3 || !h) && Di(s, t));
2598
+ Ui(s, t);
2599
2599
  for (var g = i.length - 1; g >= 0; g--)
2600
- c = Bi(l, t, a = {}, r[3], u), o = (0, i[g])(s, c), a._ = 1, ht(o) && (s = o);
2601
- return ji(r, s), f && _e(s, t, f), h ? l ^ 4 ? n : f : s;
2600
+ c = ji(l, t, a = {}, r[3], u), o = (0, i[g])(s, c), a._ = 1, ht(o) && (s = o);
2601
+ return qi(r, s), f && _e(s, t, f), h ? l ^ 4 ? n : f : s;
2602
2602
  }, ut, Se, dt;
2603
2603
  ut = [ne(["api", "storage"])];
2604
2604
  class te extends (dt = I) {
@@ -2635,7 +2635,7 @@ class te extends (dt = I) {
2635
2635
  async start() {
2636
2636
  await Promise.all(
2637
2637
  Object.keys(this.QUERY_DATA).map((e) => this.initData(e))
2638
- ), this.ctx.set("getUrl", this.getUrl.bind(this)), this.ctx.set("getSciprtUrl", this.getSciprtUrl.bind(this)), this.ctx.set("getMainpageUrl", this.getMainpageUrl.bind(this)), this.ctx.inject(["preferences", "$"], (e) => {
2638
+ ), this.ctx.on("clear-cache", this.onClearCache.bind(this)), this.ctx.set("getUrl", this.getUrl.bind(this)), this.ctx.set("getSciprtUrl", this.getSciprtUrl.bind(this)), this.ctx.set("getMainpageUrl", this.getMainpageUrl.bind(this)), this.ctx.inject(["preferences", "$"], (e) => {
2639
2639
  const t = e.$;
2640
2640
  e.preferences.registerCustomConfig(
2641
2641
  "WikiMetadataService",
@@ -2675,14 +2675,8 @@ class te extends (dt = I) {
2675
2675
  "button",
2676
2676
  {
2677
2677
  className: "btn danger",
2678
- onClick: (i) => {
2679
- i.preventDefault(), Promise.all(
2680
- Object.keys(this.QUERY_DATA).map(
2681
- (s) => this.invalidateCache(s)
2682
- )
2683
- ).then(() => {
2684
- window.location.reload();
2685
- });
2678
+ onClick: async (i) => {
2679
+ i.preventDefault(), await e.serial("clear-cache") || window.location.reload();
2686
2680
  },
2687
2681
  children: [
2688
2682
  "🧹 ",
@@ -2732,6 +2726,9 @@ class te extends (dt = I) {
2732
2726
  const t = this.getCacheKey(e);
2733
2727
  return this.CACHE_DB.delete(t);
2734
2728
  }
2729
+ async onClearCache() {
2730
+ await this.CACHE_DB.clear();
2731
+ }
2735
2732
  // ====== shortcuts ======
2736
2733
  get _raw() {
2737
2734
  return this._data;
@@ -2877,16 +2874,16 @@ class te extends (dt = I) {
2877
2874
  } : null;
2878
2875
  }
2879
2876
  }
2880
- Se = Ui(dt);
2881
- te = qi(Se, 0, "WikiMetadataService", ut, te);
2877
+ Se = Bi(dt);
2878
+ te = Hi(Se, 0, "WikiMetadataService", ut, te);
2882
2879
  Fi(Se, 1, te);
2883
- const Hi = (() => {
2880
+ const Ki = (() => {
2884
2881
  const r = Symbol.for("IPE.GlobalMemoryStorage");
2885
2882
  return r in globalThis || (globalThis[r] = $t()), globalThis[r];
2886
2883
  })();
2887
- class Ki {
2884
+ class Wi {
2888
2885
  constructor(e, t, i = 1 / 0, s, n = "localStorage") {
2889
- this.dbName = e, this.storeName = t, this.ttl = i, this.version = s, this.engine = n, typeof i != "number" && (this.ttl = Number(i)), (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 = Hi;
2886
+ this.dbName = e, this.storeName = t, this.ttl = i, this.version = s, this.engine = n, typeof i != "number" && (this.ttl = Number(i)), (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 = Ki;
2890
2887
  }
2891
2888
  // Key builder
2892
2889
  makeKey(e) {
@@ -3058,8 +3055,8 @@ var b;
3058
3055
  let u = !l.objectStoreNames.contains(h), f = [];
3059
3056
  if (!u && d?.indexes?.length) {
3060
3057
  const y = l.transaction(h, "readonly"), L = y.objectStore(h), U = new Set(Array.from(L.indexNames));
3061
- f = (d.indexes || []).filter((O) => !U.has(O.name)), await new Promise((O, Le) => {
3062
- y.oncomplete = () => O(), y.onabort = () => Le(y.error), y.onerror = () => Le(y.error);
3058
+ f = (d.indexes || []).filter((C) => !U.has(C.name)), await new Promise((C, Le) => {
3059
+ y.oncomplete = () => C(), y.onabort = () => Le(y.error), y.onerror = () => Le(y.error);
3063
3060
  });
3064
3061
  }
3065
3062
  if (!u && f.length === 0) return l;
@@ -3071,8 +3068,8 @@ var b;
3071
3068
  keyPath: d?.keyPath ?? void 0,
3072
3069
  autoIncrement: !!d?.autoIncrement
3073
3070
  });
3074
- for (const O of f)
3075
- U.indexNames.contains(O.name) || U.createIndex(O.name, O.keyPath, O.options);
3071
+ for (const C of f)
3072
+ U.indexNames.contains(C.name) || U.createIndex(C.name, C.keyPath, C.options);
3076
3073
  });
3077
3074
  return p.onversionchange = () => {
3078
3075
  try {
@@ -3112,7 +3109,7 @@ var b;
3112
3109
  }
3113
3110
  r.waitTx = c;
3114
3111
  })(b || (b = {}));
3115
- class Wi {
3112
+ class zi {
3116
3113
  constructor(e, t, i = {}) {
3117
3114
  this.dbName = e, this.storeName = t, this.options = i;
3118
3115
  }
@@ -3240,9 +3237,9 @@ class Wi {
3240
3237
  await b.closeConnection(this.dbName);
3241
3238
  }
3242
3239
  }
3243
- class zi {
3240
+ class Gi {
3244
3241
  constructor(e, t, i = 1 / 0, s) {
3245
- this.dbName = e, this.storeName = t, this.ttl = i, this.version = s, this.db = new Wi(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(() => {
3242
+ this.dbName = e, this.storeName = t, this.ttl = i, this.version = s, this.db = new zi(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(() => {
3246
3243
  });
3247
3244
  }
3248
3245
  async _clearExpiredEntries() {
@@ -3328,7 +3325,7 @@ class zi {
3328
3325
  return await this.db.clear(), this;
3329
3326
  }
3330
3327
  }
3331
- class Gi extends I {
3328
+ class Yi extends I {
3332
3329
  constructor(e, t) {
3333
3330
  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");
3334
3331
  }
@@ -3336,17 +3333,17 @@ class Gi extends I {
3336
3333
  const n = "indexedDB" in window && window.indexedDB !== null;
3337
3334
  switch (s === "indexedDB" && !n && (s = "localStorage"), s) {
3338
3335
  case "indexedDB":
3339
- return new zi(this.config.dbName, e, t, i);
3336
+ return new Gi(this.config.dbName, e, t, i);
3340
3337
  case "localStorage":
3341
3338
  case "sessionStorage":
3342
3339
  case "memory":
3343
- return new Ki(this.config.dbName, e, t, i, s);
3340
+ return new Wi(this.config.dbName, e, t, i, s);
3344
3341
  default:
3345
3342
  throw new Error(`Unsupported storage engine: ${s}`);
3346
3343
  }
3347
3344
  }
3348
3345
  }
3349
- class Yi extends I {
3346
+ class Xi extends I {
3350
3347
  constructor(e) {
3351
3348
  super(e, "wikiPage", !0), this.ctx = e, this.WikiPage = Rt(this.ctx.api);
3352
3349
  }
@@ -3504,21 +3501,17 @@ class Ee extends I {
3504
3501
  };
3505
3502
  }
3506
3503
  }
3507
- const Xi = (r) => typeof r == "function";
3508
- async function Qi(r) {
3509
- return Xi(r) ? await r() : r;
3510
- }
3511
- var Vi = Object.create, ke = Object.defineProperty, Zi = Object.getOwnPropertyDescriptor, ft = (r, e) => (e = Symbol[r]) ? e : Symbol.for("Symbol." + r), gt = (r) => {
3504
+ var Qi = Object.create, ke = Object.defineProperty, Vi = Object.getOwnPropertyDescriptor, ft = (r, e) => (e = Symbol[r]) ? e : Symbol.for("Symbol." + r), gt = (r) => {
3512
3505
  throw TypeError(r);
3513
- }, Ji = (r, e, t) => e in r ? ke(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, es = (r, e) => ke(r, "name", { value: e, configurable: !0 }), ts = (r) => [, , , Vi(r?.[ft("metadata")] ?? null)], is = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"], pt = (r) => r !== void 0 && typeof r != "function" ? gt("Function expected") : r, ss = (r, e, t, i, s) => ({ kind: is[r], name: e, metadata: i, addInitializer: (n) => t._ ? gt("Already initialized") : s.push(pt(n || null)) }), rs = (r, e) => Ji(e, ft("metadata"), r[3]), ns = (r, e, t, i) => {
3506
+ }, Zi = (r, e, t) => e in r ? ke(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, Ji = (r, e) => ke(r, "name", { value: e, configurable: !0 }), es = (r) => [, , , Qi(r?.[ft("metadata")] ?? null)], ts = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"], pt = (r) => r !== void 0 && typeof r != "function" ? gt("Function expected") : r, is = (r, e, t, i, s) => ({ kind: ts[r], name: e, metadata: i, addInitializer: (n) => t._ ? gt("Already initialized") : s.push(pt(n || null)) }), ss = (r, e) => Zi(e, ft("metadata"), r[3]), rs = (r, e, t, i) => {
3514
3507
  for (var s = 0, n = r[e >> 1], o = n && n.length; s < o; s++) n[s].call(t);
3515
3508
  return i;
3516
- }, os = (r, e, t, i, s, n) => {
3517
- var o, a, c, l = e & 7, h = !1, d = 0, u = r[d] || (r[d] = []), f = l && (s = s.prototype, l < 5 && (l > 3 || !h) && Zi(s, t));
3518
- es(s, t);
3509
+ }, ns = (r, e, t, i, s, n) => {
3510
+ var o, a, c, l = e & 7, h = !1, d = 0, u = r[d] || (r[d] = []), f = l && (s = s.prototype, l < 5 && (l > 3 || !h) && Vi(s, t));
3511
+ Ji(s, t);
3519
3512
  for (var g = i.length - 1; g >= 0; g--)
3520
- c = ss(l, t, a = {}, r[3], u), o = (0, i[g])(s, c), a._ = 1, pt(o) && (s = o);
3521
- return rs(r, s), f && ke(s, t, f), h ? l ^ 4 ? n : f : s;
3513
+ c = is(l, t, a = {}, r[3], u), o = (0, i[g])(s, c), a._ = 1, pt(o) && (s = o);
3514
+ return ss(r, s), f && ke(s, t, f), h ? l ^ 4 ? n : f : s;
3522
3515
  }, mt, $e, yt;
3523
3516
  mt = [ne(["storage", "wiki"])];
3524
3517
  class ie extends (yt = I) {
@@ -3542,7 +3535,7 @@ class ie extends (yt = I) {
3542
3535
  return this.logger.debug(e, `(fallback value: ${s})`), s;
3543
3536
  };
3544
3537
  const i = await this.db.get(e, void 0);
3545
- return i !== null ? i : await Qi(t);
3538
+ return i !== null ? i : await Lt(t);
3546
3539
  }
3547
3540
  /**
3548
3541
  * 获取全部注册的配置项以及最终生效的值
@@ -3634,18 +3627,18 @@ class ie extends (yt = I) {
3634
3627
  return t && this.logger.info(`Migrated ${t} preferences from master DB`), await e.clear(), await e?.db?.disconnect?.(), t;
3635
3628
  }
3636
3629
  }
3637
- $e = ts(yt);
3638
- ie = os($e, 0, "PreferencesService", mt, ie);
3639
- ns($e, 1, ie);
3640
- const wt = "", bt = "", as = /\\\{/g, ls = /\\\}/g, cs = new RegExp(wt, "g"), hs = new RegExp(bt, "g");
3641
- function Ne(r) {
3630
+ $e = es(yt);
3631
+ ie = ns($e, 0, "PreferencesService", mt, ie);
3632
+ rs($e, 1, ie);
3633
+ const wt = "", bt = "", os = /\\\{/g, as = /\\\}/g, ls = new RegExp(wt, "g"), cs = new RegExp(bt, "g");
3634
+ function Be(r) {
3642
3635
  const e = r ? { ...r } : void 0;
3643
- return (i, ...s) => us(e, i, ...s);
3636
+ return (i, ...s) => hs(e, i, ...s);
3644
3637
  }
3645
- function us(r, e, ...t) {
3638
+ function hs(r, e, ...t) {
3646
3639
  if (!e) return "";
3647
- let i = String(e).replace(as, wt).replace(ls, bt), s = {}, n = [];
3648
- t.length === 1 && Array.isArray(t[0]) ? n = t[0] : t.length === 1 && ds(t[0]) ? s = t[0] : t.length > 0 && (n = t);
3640
+ let i = String(e).replace(os, wt).replace(as, bt), s = {}, n = [];
3641
+ t.length === 1 && Array.isArray(t[0]) ? n = t[0] : t.length === 1 && us(t[0]) ? s = t[0] : t.length > 0 && (n = t);
3649
3642
  const o = /* @__PURE__ */ Object.create(null);
3650
3643
  if (n && n.length)
3651
3644
  for (let a = 0; a < n.length; a++)
@@ -3659,18 +3652,18 @@ function us(r, e, ...t) {
3659
3652
  const l = String(c).trim();
3660
3653
  if (!l) return "";
3661
3654
  try {
3662
- const h = fs(l, o);
3655
+ const h = ds(l, o);
3663
3656
  return h == null ? "" : String(h);
3664
3657
  } catch {
3665
3658
  return "";
3666
3659
  }
3667
- }), i.replace(cs, "{").replace(hs, "}");
3660
+ }), i.replace(ls, "{").replace(cs, "}");
3668
3661
  }
3669
- function ds(r) {
3662
+ function us(r) {
3670
3663
  return typeof r == "object" && r !== null && r.constructor === Object;
3671
3664
  }
3672
- const fs = gs();
3673
- function gs() {
3665
+ const ds = fs();
3666
+ function fs() {
3674
3667
  const r = /* @__PURE__ */ new Set([
3675
3668
  "eval",
3676
3669
  "Object",
@@ -3715,20 +3708,20 @@ function gs() {
3715
3708
  return e(t, s);
3716
3709
  };
3717
3710
  }
3718
- function C(r, e) {
3711
+ function O(r, e) {
3719
3712
  let t = r[0] ?? "";
3720
3713
  for (let i = 0; i < e.length; i++)
3721
3714
  t += String(e[i]) + (r[i + 1] ?? "");
3722
3715
  return t;
3723
3716
  }
3724
- class ps {
3717
+ class gs {
3725
3718
  constructor(e, t) {
3726
3719
  this.languages = /* @__PURE__ */ new Map(), this.currentLanguage = "en", this.missingKeys = /* @__PURE__ */ new Map(), this.usedKeys = /* @__PURE__ */ new Set();
3727
3720
  const i = t?.language || "en";
3728
- this.currentLanguage = i, this.interpolate = Ne(t?.globals), e && Object.keys(e).length && this.setLanguageData(i, e);
3721
+ this.currentLanguage = i, this.interpolate = Be(t?.globals), e && Object.keys(e).length && this.setLanguageData(i, e);
3729
3722
  }
3730
3723
  setGlobals(e) {
3731
- return this.interpolate = Ne(e), this;
3724
+ return this.interpolate = Be(e), this;
3732
3725
  }
3733
3726
  set(e, t) {
3734
3727
  const i = this.currentLanguage, s = this.ensureLanguageMap(i);
@@ -3799,12 +3792,12 @@ class ps {
3799
3792
  }
3800
3793
  $(...e) {
3801
3794
  if (Array.isArray(e[0]) && e[0]?.raw) {
3802
- const s = e[0], n = e.slice(1), o = C(s, n);
3795
+ const s = e[0], n = e.slice(1), o = O(s, n);
3803
3796
  return this.translate(o);
3804
3797
  }
3805
3798
  const i = e;
3806
3799
  return (s, ...n) => {
3807
- const o = C(s, n);
3800
+ const o = O(s, n);
3808
3801
  return this.translate(o, ...i);
3809
3802
  };
3810
3803
  }
@@ -3822,11 +3815,11 @@ class ps {
3822
3815
  }
3823
3816
  $raw(...e) {
3824
3817
  if (Array.isArray(e[0]) && e[0]?.raw) {
3825
- const i = e[0], s = e.slice(1), n = C(i, s);
3818
+ const i = e[0], s = e.slice(1), n = O(i, s);
3826
3819
  return this.translateRaw(n);
3827
3820
  }
3828
3821
  return (i, ...s) => {
3829
- const n = C(i, s);
3822
+ const n = O(i, s);
3830
3823
  return this.translateRaw(n);
3831
3824
  };
3832
3825
  }
@@ -3840,12 +3833,12 @@ class ps {
3840
3833
  }
3841
3834
  $$(...e) {
3842
3835
  if (Array.isArray(e[0]) && e[0]?.raw) {
3843
- const s = e[0], n = e.slice(1), o = C(s, n);
3836
+ const s = e[0], n = e.slice(1), o = O(s, n);
3844
3837
  return this.message(o);
3845
3838
  }
3846
3839
  const i = e;
3847
3840
  return (s, ...n) => {
3848
- const o = C(s, n);
3841
+ const o = O(s, n);
3849
3842
  return this.message(o, ...i);
3850
3843
  };
3851
3844
  }
@@ -3863,11 +3856,11 @@ class ps {
3863
3856
  }
3864
3857
  $$raw(...e) {
3865
3858
  if (Array.isArray(e[0]) && e[0].raw) {
3866
- const i = e[0], s = e.slice(1), n = C(i, s);
3859
+ const i = e[0], s = e.slice(1), n = O(i, s);
3867
3860
  return this.messageRaw(n);
3868
3861
  }
3869
3862
  return (i, ...s) => {
3870
- const n = C(i, s);
3863
+ const n = O(i, s);
3871
3864
  return this.messageRaw(n);
3872
3865
  };
3873
3866
  }
@@ -3915,19 +3908,19 @@ class ps {
3915
3908
  return e;
3916
3909
  }
3917
3910
  }
3918
- var ms = Object.create, Re = Object.defineProperty, ys = Object.getOwnPropertyDescriptor, vt = (r, e) => (e = Symbol[r]) ? e : Symbol.for("Symbol." + r), _t = (r) => {
3911
+ var ps = Object.create, Re = Object.defineProperty, ms = Object.getOwnPropertyDescriptor, vt = (r, e) => (e = Symbol[r]) ? e : Symbol.for("Symbol." + r), _t = (r) => {
3919
3912
  throw TypeError(r);
3920
- }, ws = (r, e, t) => e in r ? Re(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, bs = (r, e) => Re(r, "name", { value: e, configurable: !0 }), vs = (r) => [, , , ms(r?.[vt("metadata")] ?? null)], _s = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"], St = (r) => r !== void 0 && typeof r != "function" ? _t("Function expected") : r, Ss = (r, e, t, i, s) => ({ kind: _s[r], name: e, metadata: i, addInitializer: (n) => t._ ? _t("Already initialized") : s.push(St(n || null)) }), Es = (r, e) => ws(e, vt("metadata"), r[3]), ks = (r, e, t, i) => {
3913
+ }, ys = (r, e, t) => e in r ? Re(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, ws = (r, e) => Re(r, "name", { value: e, configurable: !0 }), bs = (r) => [, , , ps(r?.[vt("metadata")] ?? null)], vs = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"], St = (r) => r !== void 0 && typeof r != "function" ? _t("Function expected") : r, _s = (r, e, t, i, s) => ({ kind: vs[r], name: e, metadata: i, addInitializer: (n) => t._ ? _t("Already initialized") : s.push(St(n || null)) }), Ss = (r, e) => ys(e, vt("metadata"), r[3]), Es = (r, e, t, i) => {
3921
3914
  for (var s = 0, n = r[e >> 1], o = n && n.length; s < o; s++) n[s].call(t);
3922
3915
  return i;
3923
- }, $s = (r, e, t, i, s, n) => {
3924
- var o, a, c, l = e & 7, h = !1, d = 0, u = r[d] || (r[d] = []), f = l && (s = s.prototype, l < 5 && (l > 3 || !h) && ys(s, t));
3925
- bs(s, t);
3916
+ }, ks = (r, e, t, i, s, n) => {
3917
+ var o, a, c, l = e & 7, h = !1, d = 0, u = r[d] || (r[d] = []), f = l && (s = s.prototype, l < 5 && (l > 3 || !h) && ms(s, t));
3918
+ ws(s, t);
3926
3919
  for (var g = i.length - 1; g >= 0; g--)
3927
- c = Ss(l, t, a = {}, r[3], u), o = (0, i[g])(s, c), a._ = 1, St(o) && (s = o);
3928
- return Es(r, s), f && Re(s, t, f), h ? l ^ 4 ? n : f : s;
3920
+ c = _s(l, t, a = {}, r[3], u), o = (0, i[g])(s, c), a._ = 1, St(o) && (s = o);
3921
+ return Ss(r, s), f && Re(s, t, f), h ? l ^ 4 ? n : f : s;
3929
3922
  }, Et, xe, kt;
3930
- const Be = new m(
3923
+ const Ne = new m(
3931
3924
  m.object({
3932
3925
  manifest_version: m.const(1).required(),
3933
3926
  base_language: m.string().required(),
@@ -3936,6 +3929,8 @@ const Be = new m(
3936
3929
  m.object({
3937
3930
  file: m.string().required(),
3938
3931
  fallback: m.string(),
3932
+ iso_name: m.string(),
3933
+ endonym: m.string(),
3939
3934
  data: m.transform(
3940
3935
  m.dict(m.any()).default({}),
3941
3936
  (r) => Object.keys(r).length > 0 ? r : void 0
@@ -3944,16 +3939,16 @@ const Be = new m(
3944
3939
  ).required()
3945
3940
  })
3946
3941
  );
3947
- Et = [ne(["wiki", "preferences"]), Lt(
3942
+ Et = [ne(["wiki", "preferences"]), At(
3948
3943
  m.object({
3949
3944
  "i18n.index_url": m.string().description("I18n index URL (DO NOT CHANGE THIS) ").default(
3950
- Fe.I18N_INDEX_URL
3945
+ qe.I18N_INDEX_URL
3951
3946
  )
3952
3947
  }).description("").extra("category", "general")
3953
3948
  )];
3954
3949
  class se extends (kt = I) {
3955
3950
  constructor(e) {
3956
- 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 ps(
3951
+ 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 gs(
3957
3952
  {},
3958
3953
  {
3959
3954
  language: "",
@@ -3985,7 +3980,7 @@ class se extends (kt = I) {
3985
3980
  m.string().description("Custom language code")
3986
3981
  ]).description("UI language").default("@user")
3987
3982
  }).description("UI language")
3988
- );
3983
+ ), this.ctx.on("clear-cache", this.onClearCache.bind(this));
3989
3984
  const e = this._indexUrl = await this.ctx.preferences.get("i18n.index_url") || "";
3990
3985
  if (!e) {
3991
3986
  this.logger.error("I18n index URL is not set"), this.setupShortcuts();
@@ -4014,12 +4009,14 @@ class se extends (kt = I) {
4014
4009
  language: m.union([
4015
4010
  m.const("@user").description(this.$`Same as your personal language`),
4016
4011
  m.const("@site").description(this.$`Same as the site language`),
4017
- ...this.getAvailableLanguageCodes().map((n) => m.const(n).description(n))
4012
+ ...this.getAvailableLanguageCodes().map(
4013
+ ({ code: n, endonym: o, iso_name: a }) => m.const(n).description(o || a || n)
4014
+ )
4018
4015
  ]).default("@user")
4019
4016
  }).description(this.$`InPageEdit UI language`)
4020
4017
  ), this.setupShortcuts(), this.ctx.on("preferences/changed", async ({ changes: n }) => {
4021
4018
  if (!("language" in n)) return;
4022
- const o = this.normalizeLanguageCode(n.language);
4019
+ const o = this.normalizeLanguageCode(await this.ctx.preferences.get("language"));
4023
4020
  o && o !== this.language && await this.switchLanguage(o);
4024
4021
  });
4025
4022
  }
@@ -4060,7 +4057,10 @@ class se extends (kt = I) {
4060
4057
  */
4061
4058
  getAvailableLanguageCodes() {
4062
4059
  if (!this._indexCache) throw new Error("I18n index is not loaded");
4063
- return Object.entries(this._indexCache.languages).filter(([e, t]) => !t.fallback).reduce((e, [t, i]) => (e.push(t), e), []);
4060
+ return Object.entries(this._indexCache.languages).filter(([e, t]) => !t.fallback).reduce(
4061
+ (e, [t, i]) => (e.push({ code: t, ...i }), e),
4062
+ []
4063
+ );
4064
4064
  }
4065
4065
  findLanguageMeta(e, t) {
4066
4066
  const i = H(String(t)).toLowerCase(), s = e.languages[i];
@@ -4083,7 +4083,7 @@ class se extends (kt = I) {
4083
4083
  const s = await this.i18nIndexDB.get(e);
4084
4084
  if (s)
4085
4085
  try {
4086
- return Be(s);
4086
+ return Ne(s);
4087
4087
  } catch (n) {
4088
4088
  this.logger.error("Failed to parse cached i18n index", n), this.i18nIndexDB.delete(e);
4089
4089
  }
@@ -4093,7 +4093,7 @@ class se extends (kt = I) {
4093
4093
  }
4094
4094
  async fetchI18nIndex(e) {
4095
4095
  const t = await fetch(e).then((i) => i.json());
4096
- return Be(t);
4096
+ return Ne(t);
4097
4097
  }
4098
4098
  async ensureLanguageLoaded(e) {
4099
4099
  if (!this.manager || !this._indexCache) throw new Error("I18nManager is not initialized");
@@ -4128,15 +4128,18 @@ class se extends (kt = I) {
4128
4128
  clearMissingReport() {
4129
4129
  this.manager.clearMissingReport();
4130
4130
  }
4131
+ async onClearCache() {
4132
+ await this.i18nIndexDB.clear(), await this.i18nDataDB.clear();
4133
+ }
4131
4134
  }
4132
- xe = vs(kt);
4133
- se = $s(xe, 0, "I18nService", Et, se);
4134
- ks(xe, 1, se);
4135
- class re extends At {
4135
+ xe = bs(kt);
4136
+ se = ks(xe, 0, "I18nService", Et, se);
4137
+ Es(xe, 1, se);
4138
+ class re extends Tt {
4136
4139
  constructor(e) {
4137
4140
  super({
4138
4141
  name: "InPageEdit"
4139
- }), this.version = "0.14.0", this.Endpoints = Fe, this.schema = m, this.config = K(re.DEFAULT_CONFIG, e), this.logger = Dt({
4142
+ }), this.version = "0.14.1", this.Endpoints = qe, this.schema = m, this.config = K(re.DEFAULT_CONFIG, e), this.logger = Mt({
4140
4143
  name: "IPE",
4141
4144
  color: "#33aaff",
4142
4145
  level: this.config.logLevel
@@ -4146,7 +4149,7 @@ class re extends At {
4146
4149
  this.DEFAULT_CONFIG = {
4147
4150
  apiConfigs: {},
4148
4151
  legacyPreferences: {},
4149
- logLevel: qe.info,
4152
+ logLevel: Fe.info,
4150
4153
  storageNamespace: "InPageEdit",
4151
4154
  autoloadStyles: !0,
4152
4155
  autoInstallCorePlugins: !0
@@ -4156,7 +4159,7 @@ class re extends At {
4156
4159
  await this.#i(), this.config.autoInstallCorePlugins && this.#s(), this.#r();
4157
4160
  }
4158
4161
  async #i() {
4159
- this.plugin(se), this.plugin(Xt, this.config.apiConfigs), this.plugin(J), this.plugin(oi), this.plugin(Ci), this.plugin(ie), this.plugin(Gi, { dbName: this.config.storageNamespace }), this.plugin(te), this.plugin(Yi), this.plugin(Ee), this.#t([
4162
+ this.plugin(se), this.plugin(Qt, this.config.apiConfigs), this.plugin(J), this.plugin(ai), this.plugin(Ii), this.plugin(ie), this.plugin(Yi, { dbName: this.config.storageNamespace }), this.plugin(te), this.plugin(Xi), this.plugin(Ee), this.#t([
4160
4163
  "i18n",
4161
4164
  "$",
4162
4165
  "$$",
@@ -4186,24 +4189,24 @@ class re extends At {
4186
4189
  // TODO: 这里不应该硬编码,暂时先这样
4187
4190
  async #s() {
4188
4191
  [
4189
- import("./index-CVTBg5O9.js").then(({ PluginAnalytics: t }) => t),
4190
- import("./index-DGtq21uW.js").then(
4192
+ import("./index-Bb0FiU2c.js").then(({ PluginAnalytics: t }) => t),
4193
+ import("./index-BBNseJXG.js").then(
4191
4194
  ({ PluginInArticleLinks: t }) => t
4192
4195
  ),
4193
- import("./index-D3iZhRMJ.js").then(({ PluginPluginStore: t }) => t),
4194
- import("./index-BKIf3i0I.js").then(
4196
+ import("./index-DTHY5rAO.js").then(({ PluginPluginStore: t }) => t),
4197
+ import("./index-DELHsLHS.js").then(
4195
4198
  ({ PluginPreferencesUI: t }) => t
4196
4199
  ),
4197
- import("./index-DXL7teb0.js").then(({ PluginQuickEdit: t }) => t),
4198
- import("./index-Ci82vLXg.js").then(({ PluginQuickMove: t }) => t),
4199
- import("./index-DjPpAyfE.js").then(
4200
+ import("./index-DmLoihN1.js").then(({ PluginQuickEdit: t }) => t),
4201
+ import("./index-BrYKe18j.js").then(({ PluginQuickMove: t }) => t),
4202
+ import("./index-3NZkG2a3.js").then(
4200
4203
  ({ PluginQuickPreview: t }) => t
4201
4204
  ),
4202
- import("./index-BrtFJ-M0.js").then(({ PluginQuickDiff: t }) => t),
4203
- import("./index-CQr1DJ8n.js").then(
4205
+ import("./index-D97lUU3h.js").then(({ PluginQuickDiff: t }) => t),
4206
+ import("./index-D6zFqL2u.js").then(
4204
4207
  ({ PluginQuickRedirect: t }) => t
4205
4208
  ),
4206
- import("./index-rpiO9fpc.js").then(({ PluginToolbox: t }) => t)
4209
+ import("./index-D-fW3ESK.js").then(({ PluginToolbox: t }) => t)
4207
4210
  ].forEach(async (t) => {
4208
4211
  this.plugin(await t);
4209
4212
  });
@@ -4222,21 +4225,21 @@ class re extends At {
4222
4225
  }
4223
4226
  }
4224
4227
  export {
4225
- qe as $,
4226
- Xt as A,
4228
+ Fe as $,
4229
+ Qt as A,
4227
4230
  J as C,
4228
4231
  re as I,
4229
- Ci as M,
4232
+ Ii as M,
4230
4233
  ee as N,
4231
4234
  ve as P,
4232
- oi as R,
4233
- Dt as S,
4235
+ ai as R,
4236
+ Mt as S,
4234
4237
  te as W,
4235
- Gi as a,
4238
+ Yi as a,
4236
4239
  v as b,
4237
4240
  ie as c,
4238
- Yi as d,
4241
+ Xi as d,
4239
4242
  Ee as e,
4240
- Ct as m
4243
+ It as m
4241
4244
  };
4242
- //# sourceMappingURL=index-19CgGBI0.js.map
4245
+ //# sourceMappingURL=index-BgkZW91u.js.map