@prosopo/provider-mock 2.7.18 → 2.7.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,35 @@
1
1
  # @prosopo/provider-mock
2
2
 
3
+ ## 2.7.20
4
+ ### Patch Changes
5
+
6
+ - Updated dependencies [9e4e7ca]
7
+ - @prosopo/provider@3.2.2
8
+
9
+ ## 2.7.19
10
+ ### Patch Changes
11
+
12
+ - 3573f0b: fix npm scripts bundle command
13
+ - 3573f0b: build using vite, typecheck using tsc
14
+ - efd8102: Add tests for unwrap error helper
15
+ - 3573f0b: standardise all vite based npm scripts for bundling
16
+ - Updated dependencies [2f0c830]
17
+ - Updated dependencies [52dbf21]
18
+ - Updated dependencies [93d5e50]
19
+ - Updated dependencies [3573f0b]
20
+ - Updated dependencies [3573f0b]
21
+ - Updated dependencies [efd8102]
22
+ - Updated dependencies [93d5e50]
23
+ - Updated dependencies [63519d7]
24
+ - Updated dependencies [f29fc7e]
25
+ - Updated dependencies [3573f0b]
26
+ - Updated dependencies [2d0dd8a]
27
+ - @prosopo/provider@3.2.1
28
+ - @prosopo/types@3.0.4
29
+ - @prosopo/api-express-router@3.0.4
30
+ - @prosopo/common@3.1.0
31
+ - @prosopo/config@3.1.1
32
+
3
33
  ## 2.7.18
4
34
  ### Patch Changes
5
35
 
package/dist/api.js CHANGED
@@ -1,72 +1,80 @@
1
1
  import { ProsopoApiError, getLogger } from "@prosopo/common";
2
2
  import { getJA4 } from "@prosopo/provider";
3
- import { ClientApiPaths, VerifySolutionBody, decodeProcaptchaOutput, } from "@prosopo/types";
3
+ import { ClientApiPaths, VerifySolutionBody, decodeProcaptchaOutput } from "@prosopo/types";
4
4
  import express from "express";
5
5
  import { JA4Database } from "./db.js";
6
- export function prosopoRouter() {
7
- const router = express.Router();
8
- const db = new JA4Database(process.env.MONGO_URL || "mongodb://localhost:27017", process.env.MONGO_DBNAME || "client", process.env.MONGO_AUTH_SOURCE || "admin");
9
- router.post(ClientApiPaths.VerifyImageCaptchaSolutionDapp, async (req, res, next) => {
10
- let body;
11
- try {
12
- body = VerifySolutionBody.parse(req.body);
6
+ function prosopoRouter() {
7
+ const router = express.Router();
8
+ const db = new JA4Database(
9
+ process.env.MONGO_URL || "mongodb://localhost:27017",
10
+ process.env.MONGO_DBNAME || "client",
11
+ process.env.MONGO_AUTH_SOURCE || "admin"
12
+ );
13
+ router.post(
14
+ ClientApiPaths.VerifyImageCaptchaSolutionDapp,
15
+ async (req, res, next) => {
16
+ let body;
17
+ try {
18
+ body = VerifySolutionBody.parse(req.body);
19
+ } catch (err) {
20
+ return next(
21
+ new ProsopoApiError("CAPTCHA.PARSE_ERROR", {
22
+ context: { error: err, code: 400 },
23
+ logLevel: "info"
24
+ })
25
+ );
26
+ }
27
+ try {
28
+ const { token } = body;
29
+ const { user, dapp, commitmentId } = decodeProcaptchaOutput(token);
30
+ const testCommitmentId = "0x123456789test";
31
+ const testAccount = "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY";
32
+ const testDapp = "5C4hrfjw9DjXZTzV3MwzrrAr9P1MJhSrvWGWqi1eSuyUpnhM";
33
+ let statusMessage = "API.USER_NOT_VERIFIED";
34
+ let approved = false;
35
+ if (user && user === testAccount || commitmentId && commitmentId === testCommitmentId || dapp && dapp === testDapp) {
36
+ approved = true;
37
+ statusMessage = "API.USER_VERIFIED";
38
+ return res.json({
39
+ status: req.t(statusMessage),
40
+ verified: approved,
41
+ commitmentId: testCommitmentId
42
+ });
13
43
  }
14
- catch (err) {
15
- return next(new ProsopoApiError("CAPTCHA.PARSE_ERROR", {
16
- context: { error: err, code: 400 },
17
- logLevel: "info",
18
- }));
19
- }
20
- try {
21
- const { token } = body;
22
- const { user, dapp, commitmentId } = decodeProcaptchaOutput(token);
23
- const testCommitmentId = "0x123456789test";
24
- const testAccount = "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY";
25
- const testDapp = "5C4hrfjw9DjXZTzV3MwzrrAr9P1MJhSrvWGWqi1eSuyUpnhM";
26
- let statusMessage = "API.USER_NOT_VERIFIED";
27
- let approved = false;
28
- if ((user && user === testAccount) ||
29
- (commitmentId && commitmentId === testCommitmentId) ||
30
- (dapp && dapp === testDapp)) {
31
- approved = true;
32
- statusMessage = "API.USER_VERIFIED";
33
- return res.json({
34
- status: req.t(statusMessage),
35
- verified: approved,
36
- commitmentId: testCommitmentId,
37
- });
38
- }
39
- return res.json({
40
- status: req.t(statusMessage),
41
- verified: false,
42
- });
43
- }
44
- catch (err) {
45
- return next(new ProsopoApiError("API.UNKNOWN", {
46
- context: { error: err, code: 500 },
47
- }));
48
- }
49
- });
50
- router.get("/test", async (req, res) => {
51
- try {
52
- const logger = getLogger("info", import.meta.url);
53
- const ja4PlusFingerprint = await getJA4(req.headers, logger);
54
- await db.connect();
55
- await db.addOrUpdateJA4Record({
56
- ja4_fingerprint: ja4PlusFingerprint.ja4PlusFingerprint,
57
- user_agent_string: req.headers["user-agent"] || "",
58
- });
59
- await db.close();
60
- return res.json({
61
- ja4: ja4PlusFingerprint.ja4PlusFingerprint,
62
- ua: req.headers["user-agent"],
63
- });
64
- }
65
- catch (e) {
66
- console.error("Error parsing ClientHello:", e);
67
- return res.status(500).send("Error parsing ClientHello.");
68
- }
69
- });
70
- return router;
44
+ return res.json({
45
+ status: req.t(statusMessage),
46
+ verified: false
47
+ });
48
+ } catch (err) {
49
+ return next(
50
+ new ProsopoApiError("API.UNKNOWN", {
51
+ context: { error: err, code: 500 }
52
+ })
53
+ );
54
+ }
55
+ }
56
+ );
57
+ router.get("/test", async (req, res) => {
58
+ try {
59
+ const logger = getLogger("info", import.meta.url);
60
+ const ja4PlusFingerprint = await getJA4(req.headers, logger);
61
+ await db.connect();
62
+ await db.addOrUpdateJA4Record({
63
+ ja4_fingerprint: ja4PlusFingerprint.ja4PlusFingerprint,
64
+ user_agent_string: req.headers["user-agent"] || ""
65
+ });
66
+ await db.close();
67
+ return res.json({
68
+ ja4: ja4PlusFingerprint.ja4PlusFingerprint,
69
+ ua: req.headers["user-agent"]
70
+ });
71
+ } catch (e) {
72
+ console.error("Error parsing ClientHello:", e);
73
+ return res.status(500).send("Error parsing ClientHello.");
74
+ }
75
+ });
76
+ return router;
71
77
  }
72
- //# sourceMappingURL=api.js.map
78
+ export {
79
+ prosopoRouter
80
+ };
@@ -34,7 +34,9 @@ const et = {
34
34
  ukrainian: "uk",
35
35
  vietnamese: "vi",
36
36
  chinese: "zh-CN"
37
- }, Tu = ku.enum(Object.values(et)), Iu = () => !!(typeof window < "u" && window.document && window.document.createElement), Pu = () => !Iu(), le = (m) => typeof m == "string", mn = () => {
37
+ }, Tu = ku.enum(
38
+ Object.values(et)
39
+ ), Iu = () => !!(typeof window < "u" && window.document && window.document.createElement), Pu = () => !Iu(), le = (m) => typeof m == "string", An = () => {
38
40
  let m, n;
39
41
  const t = new Promise((a, l) => {
40
42
  m = a, n = l;
@@ -1199,7 +1201,7 @@ class vn extends Rn {
1199
1201
  return n.store[b](...arguments), n;
1200
1202
  };
1201
1203
  });
1202
- const y = mn(), C = () => {
1204
+ const y = An(), C = () => {
1203
1205
  const b = (j, E) => {
1204
1206
  this.isInitializing = !1, this.isInitialized && !this.initializedStoreOnce && this.logger.warn("init: i18next is already initialized. You should call init just once!"), this.isInitialized = !0, this.options.isClone || this.logger.log("initialized", this.options), this.emit("initialized", this.options), y.resolve(E), a(j, E);
1205
1207
  };
@@ -1226,7 +1228,7 @@ class vn extends Rn {
1226
1228
  a(null);
1227
1229
  }
1228
1230
  reloadResources(n, t, a) {
1229
- const l = mn();
1231
+ const l = An();
1230
1232
  return typeof n == "function" && (a = n, n = void 0), typeof t == "function" && (a = t, t = void 0), n || (n = this.languages), t || (t = this.options.ns), a || (a = wn), this.services.backendConnector.reload(n, t, (c) => {
1231
1233
  l.resolve(), a(c);
1232
1234
  }), l;
@@ -1249,7 +1251,7 @@ class vn extends Rn {
1249
1251
  changeLanguage(n, t) {
1250
1252
  var a = this;
1251
1253
  this.isLanguageChangingTo = n;
1252
- const l = mn();
1254
+ const l = An();
1253
1255
  this.emit("languageChanging", n);
1254
1256
  const c = (y) => {
1255
1257
  this.language = y, this.languages = this.services.languageUtils.toResolveHierarchy(y), this.resolvedLanguage = void 0, this.setResolvedLanguage(y);
@@ -1319,7 +1321,7 @@ class vn extends Rn {
1319
1321
  return !!(this.hasResourceBundle(a, n) || !this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages || d(a, n) && (!l || d(c, n)));
1320
1322
  }
1321
1323
  loadNamespaces(n, t) {
1322
- const a = mn();
1324
+ const a = An();
1323
1325
  return this.options.ns ? (le(n) && (n = [n]), n.forEach((l) => {
1324
1326
  this.options.ns.indexOf(l) < 0 && this.options.ns.push(l);
1325
1327
  }), this.loadResources((l) => {
@@ -1327,7 +1329,7 @@ class vn extends Rn {
1327
1329
  }), a) : (t && t(), Promise.resolve());
1328
1330
  }
1329
1331
  loadLanguages(n, t) {
1330
- const a = mn();
1332
+ const a = An();
1331
1333
  le(n) && (n = [n]);
1332
1334
  const l = this.options.preload || [], c = n.filter((d) => l.indexOf(d) < 0 && this.services.languageUtils.isSupportedCode(d));
1333
1335
  return c.length ? (this.options.preload = l.concat(c), this.loadResources((d) => {
@@ -1384,8 +1386,8 @@ class vn extends Rn {
1384
1386
  };
1385
1387
  }
1386
1388
  }
1387
- const An = vn.createInstance();
1388
- An.createInstance = vn.createInstance;
1389
+ const cn = vn.createInstance();
1390
+ cn.createInstance = vn.createInstance;
1389
1391
  const ei = {
1390
1392
  debug: process.env.PROSOPO_LOG_LEVEL === "debug",
1391
1393
  fallbackLng: Tu.enum.en,
@@ -1900,7 +1902,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1900
1902
  throw Ae(A());
1901
1903
  case "\u2028":
1902
1904
  case "\u2029":
1903
- cn(G);
1905
+ pn(G);
1904
1906
  break;
1905
1907
  case void 0:
1906
1908
  throw Ae(A());
@@ -2170,7 +2172,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
2170
2172
  function en() {
2171
2173
  return I -= 5, Ge("JSON5: invalid identifier character at ".concat(T, ":").concat(I));
2172
2174
  }
2173
- function cn(i) {
2175
+ function pn(i) {
2174
2176
  console.warn("JSON5: '".concat(rn(i), "' in strings is not valid ECMAScript; consider escaping"));
2175
2177
  }
2176
2178
  function rn(i) {
@@ -2299,8 +2301,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
2299
2301
  _ !== "" && (ne += " "), ne += Oe, ve.push(ne);
2300
2302
  }
2301
2303
  }
2302
- } catch (pn) {
2303
- he.e(pn);
2304
+ } catch (hn) {
2305
+ he.e(hn);
2304
2306
  } finally {
2305
2307
  he.f();
2306
2308
  }
@@ -2369,7 +2371,7 @@ function ri() {
2369
2371
  if (zr) return de;
2370
2372
  zr = 1, Object.defineProperty(de, "__esModule", {
2371
2373
  value: !0
2372
- }), de.SyntaxKind = de.ScanError = de.ParseErrorCode = void 0, de.applyEdits = Ge, de.findNodeAtOffset = de.findNodeAtLocation = de.createScanner = void 0, de.format = cn, de.getNodeValue = de.getNodePath = de.getLocation = void 0, de.modify = rn, de.parseTree = de.parse = void 0, de.printParseErrorCode = en, de.visit = de.stripComments = void 0;
2374
+ }), de.SyntaxKind = de.ScanError = de.ParseErrorCode = void 0, de.applyEdits = Ge, de.findNodeAtOffset = de.findNodeAtLocation = de.createScanner = void 0, de.format = pn, de.getNodeValue = de.getNodePath = de.getLocation = void 0, de.modify = rn, de.parseTree = de.parse = void 0, de.printParseErrorCode = en, de.visit = de.stripComments = void 0;
2373
2375
  function m(u, x) {
2374
2376
  var D = Object.keys(u);
2375
2377
  if (Object.getOwnPropertySymbols) {
@@ -3380,8 +3382,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
3380
3382
  else {
3381
3383
  if (D === void 0)
3382
3384
  return [];
3383
- var je = "".concat(JSON.stringify(L), ": ").concat(JSON.stringify(D)), Fe = i.getInsertionIndex ? i.getInsertionIndex(R.children.map(function(pn) {
3384
- return pn.children[0].value;
3385
+ var je = "".concat(JSON.stringify(L), ": ").concat(JSON.stringify(D)), Fe = i.getInsertionIndex ? i.getInsertionIndex(R.children.map(function(hn) {
3386
+ return hn.children[0].value;
3385
3387
  })) : R.children.length, Le;
3386
3388
  if (Fe > 0) {
3387
3389
  var xe = R.children[Fe - 1];
@@ -3559,7 +3561,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
3559
3561
  }
3560
3562
  return "<unknown ParseErrorCode>";
3561
3563
  }
3562
- function cn(u, x, D) {
3564
+ function pn(u, x, D) {
3563
3565
  return ee(u, x, D);
3564
3566
  }
3565
3567
  function rn(u, x, D, i) {
@@ -3827,7 +3829,7 @@ function ut() {
3827
3829
  },
3828
3830
  defaultStyle: "lowercase"
3829
3831
  });
3830
- function cn(e) {
3832
+ function pn(e) {
3831
3833
  return 48 <= e && e <= 57 || 65 <= e && e <= 70 || 97 <= e && e <= 102;
3832
3834
  }
3833
3835
  function rn(e) {
@@ -3853,7 +3855,7 @@ function ut() {
3853
3855
  if (s === "x") {
3854
3856
  for (o++; o < r; o++)
3855
3857
  if (s = e[o], s !== "_") {
3856
- if (!cn(e.charCodeAt(o))) return !1;
3858
+ if (!pn(e.charCodeAt(o))) return !1;
3857
3859
  f = !0;
3858
3860
  }
3859
3861
  return f && s !== "_";
@@ -4067,7 +4069,7 @@ function ut() {
4067
4069
  }
4068
4070
  return !0;
4069
4071
  }
4070
- function pn(e) {
4072
+ function hn(e) {
4071
4073
  if (e === null) return [];
4072
4074
  var r, o, f, s, g, p = e;
4073
4075
  for (g = new Array(p.length), r = 0, o = p.length; r < o; r += 1)
@@ -4077,7 +4079,7 @@ function ut() {
4077
4079
  var Gn = new z("tag:yaml.org,2002:pairs", {
4078
4080
  kind: "sequence",
4079
4081
  resolve: Ue,
4080
- construct: pn
4082
+ construct: hn
4081
4083
  }), at = Object.prototype.hasOwnProperty;
4082
4084
  function ot(e) {
4083
4085
  if (e === null) return !0;
@@ -4520,7 +4522,7 @@ function ut() {
4520
4522
  var kt = St, Lt = Ot, pr = {
4521
4523
  loadAll: kt,
4522
4524
  load: Lt
4523
- }, hr = Object.prototype.toString, dr = Object.prototype.hasOwnProperty, Un = 65279, Nt = 9, hn = 10, Tt = 13, It = 32, Pt = 33, jt = 34, Hn = 35, Rt = 37, _t = 38, Mt = 39, $t = 42, gr = 44, Vt = 45, xn = 58, Ut = 61, Ht = 62, Yt = 63, Kt = 64, Dr = 91, mr = 93, qt = 96, Ar = 123, zt = 124, Fr = 125, $e = {};
4525
+ }, hr = Object.prototype.toString, dr = Object.prototype.hasOwnProperty, Un = 65279, Nt = 9, dn = 10, Tt = 13, It = 32, Pt = 33, jt = 34, Hn = 35, Rt = 37, _t = 38, Mt = 39, $t = 42, gr = 44, Vt = 45, xn = 58, Ut = 61, Ht = 62, Yt = 63, Kt = 64, Dr = 91, mr = 93, qt = 96, Ar = 123, zt = 124, Fr = 125, $e = {};
4524
4526
  $e[0] = "\\0", $e[7] = "\\a", $e[8] = "\\b", $e[9] = "\\t", $e[10] = "\\n", $e[11] = "\\v", $e[12] = "\\f", $e[13] = "\\r", $e[27] = "\\e", $e[34] = '\\"', $e[92] = "\\\\", $e[133] = "\\N", $e[160] = "\\_", $e[8232] = "\\L", $e[8233] = "\\P";
4525
4527
  var Jt = ["y", "Y", "yes", "Yes", "YES", "on", "On", "ON", "n", "N", "no", "No", "NO", "off", "Off", "OFF"], Wt = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;
4526
4528
  function Gt(e, r) {
@@ -4542,9 +4544,9 @@ function ut() {
4542
4544
  throw new I("code point within a string may not be greater than 0xFFFFFFFF");
4543
4545
  return "\\" + o + w.repeat("0", f - r.length) + r;
4544
4546
  }
4545
- var Zt = 1, dn = 2;
4547
+ var Zt = 1, gn = 2;
4546
4548
  function Xt(e) {
4547
- this.schema = e.schema || _n, this.indent = Math.max(1, e.indent || 2), this.noArrayIndent = e.noArrayIndent || !1, this.skipInvalid = e.skipInvalid || !1, this.flowLevel = w.isNothing(e.flowLevel) ? -1 : e.flowLevel, this.styleMap = Gt(this.schema, e.styles || null), this.sortKeys = e.sortKeys || !1, this.lineWidth = e.lineWidth || 80, this.noRefs = e.noRefs || !1, this.noCompatMode = e.noCompatMode || !1, this.condenseFlow = e.condenseFlow || !1, this.quotingType = e.quotingType === '"' ? dn : Zt, this.forceQuotes = e.forceQuotes || !1, this.replacer = typeof e.replacer == "function" ? e.replacer : null, this.implicitTypes = this.schema.compiledImplicit, this.explicitTypes = this.schema.compiledExplicit, this.tag = null, this.result = "", this.duplicates = [], this.usedDuplicates = null;
4549
+ this.schema = e.schema || _n, this.indent = Math.max(1, e.indent || 2), this.noArrayIndent = e.noArrayIndent || !1, this.skipInvalid = e.skipInvalid || !1, this.flowLevel = w.isNothing(e.flowLevel) ? -1 : e.flowLevel, this.styleMap = Gt(this.schema, e.styles || null), this.sortKeys = e.sortKeys || !1, this.lineWidth = e.lineWidth || 80, this.noRefs = e.noRefs || !1, this.noCompatMode = e.noCompatMode || !1, this.condenseFlow = e.condenseFlow || !1, this.quotingType = e.quotingType === '"' ? gn : Zt, this.forceQuotes = e.forceQuotes || !1, this.replacer = typeof e.replacer == "function" ? e.replacer : null, this.implicitTypes = this.schema.compiledImplicit, this.explicitTypes = this.schema.compiledExplicit, this.tag = null, this.result = "", this.duplicates = [], this.usedDuplicates = null;
4548
4550
  }
4549
4551
  function vr(e, r) {
4550
4552
  for (var o = w.repeat(" ", r), f = 0, s = -1, g = "", p, F = e.length; f < F; )
@@ -4567,23 +4569,23 @@ function ut() {
4567
4569
  function Bn(e) {
4568
4570
  return e === It || e === Nt;
4569
4571
  }
4570
- function gn(e) {
4572
+ function Dn(e) {
4571
4573
  return 32 <= e && e <= 126 || 161 <= e && e <= 55295 && e !== 8232 && e !== 8233 || 57344 <= e && e <= 65533 && e !== Un || 65536 <= e && e <= 1114111;
4572
4574
  }
4573
4575
  function Er(e) {
4574
- return gn(e) && e !== Un && e !== Tt && e !== hn;
4576
+ return Dn(e) && e !== Un && e !== Tt && e !== dn;
4575
4577
  }
4576
4578
  function yr(e, r, o) {
4577
4579
  var f = Er(e), s = f && !Bn(e);
4578
4580
  return (o ? f : f && e !== gr && e !== Dr && e !== mr && e !== Ar && e !== Fr) && e !== Hn && !(r === xn && !s) || Er(r) && !Bn(r) && e === Hn || r === xn && s;
4579
4581
  }
4580
4582
  function nu(e) {
4581
- return gn(e) && e !== Un && !Bn(e) && e !== Vt && e !== Yt && e !== xn && e !== gr && e !== Dr && e !== mr && e !== Ar && e !== Fr && e !== Hn && e !== _t && e !== $t && e !== Pt && e !== zt && e !== Ut && e !== Ht && e !== Mt && e !== jt && e !== Rt && e !== Kt && e !== qt;
4583
+ return Dn(e) && e !== Un && !Bn(e) && e !== Vt && e !== Yt && e !== xn && e !== gr && e !== Dr && e !== mr && e !== Ar && e !== Fr && e !== Hn && e !== _t && e !== $t && e !== Pt && e !== zt && e !== Ut && e !== Ht && e !== Mt && e !== jt && e !== Rt && e !== Kt && e !== qt;
4582
4584
  }
4583
4585
  function ru(e) {
4584
4586
  return !Bn(e) && e !== xn;
4585
4587
  }
4586
- function Dn(e, r) {
4588
+ function mn(e, r) {
4587
4589
  var o = e.charCodeAt(r), f;
4588
4590
  return o >= 55296 && o <= 56319 && r + 1 < e.length && (f = e.charCodeAt(r + 1), f >= 56320 && f <= 57343) ? (o - 55296) * 1024 + f - 56320 + 65536 : o;
4589
4591
  }
@@ -4593,31 +4595,31 @@ function ut() {
4593
4595
  }
4594
4596
  var br = 1, Kn = 2, xr = 3, Br = 4, sn = 5;
4595
4597
  function tu(e, r, o, f, s, g, p, F) {
4596
- var S, V = 0, Z = null, U = !1, ue = !1, ie = f !== -1, me = -1, we = nu(Dn(e, 0)) && ru(Dn(e, e.length - 1));
4598
+ var S, V = 0, Z = null, U = !1, ue = !1, ie = f !== -1, me = -1, we = nu(mn(e, 0)) && ru(mn(e, e.length - 1));
4597
4599
  if (r || p)
4598
4600
  for (S = 0; S < e.length; V >= 65536 ? S += 2 : S++) {
4599
- if (V = Dn(e, S), !gn(V))
4601
+ if (V = mn(e, S), !Dn(V))
4600
4602
  return sn;
4601
4603
  we = we && yr(V, Z, F), Z = V;
4602
4604
  }
4603
4605
  else {
4604
4606
  for (S = 0; S < e.length; V >= 65536 ? S += 2 : S++) {
4605
- if (V = Dn(e, S), V === hn)
4607
+ if (V = mn(e, S), V === dn)
4606
4608
  U = !0, ie && (ue = ue || S - me - 1 > f && e[me + 1] !== " ", me = S);
4607
- else if (!gn(V))
4609
+ else if (!Dn(V))
4608
4610
  return sn;
4609
4611
  we = we && yr(V, Z, F), Z = V;
4610
4612
  }
4611
4613
  ue = ue || ie && S - me - 1 > f && e[me + 1] !== " ";
4612
4614
  }
4613
- return !U && !ue ? we && !p && !s(e) ? br : g === dn ? sn : Kn : o > 9 && Cr(e) ? sn : p ? g === dn ? sn : Kn : ue ? Br : xr;
4615
+ return !U && !ue ? we && !p && !s(e) ? br : g === gn ? sn : Kn : o > 9 && Cr(e) ? sn : p ? g === gn ? sn : Kn : ue ? Br : xr;
4614
4616
  }
4615
4617
  function uu(e, r, o, f, s) {
4616
4618
  e.dump = function() {
4617
4619
  if (r.length === 0)
4618
- return e.quotingType === dn ? '""' : "''";
4620
+ return e.quotingType === gn ? '""' : "''";
4619
4621
  if (!e.noCompatMode && (Jt.indexOf(r) !== -1 || Wt.test(r)))
4620
- return e.quotingType === dn ? '"' + r + '"' : "'" + r + "'";
4622
+ return e.quotingType === gn ? '"' + r + '"' : "'" + r + "'";
4621
4623
  var g = e.indent * Math.max(1, o), p = e.lineWidth === -1 ? -1 : Math.max(Math.min(e.lineWidth, 40), e.lineWidth - g), F = f || e.flowLevel > -1 && o >= e.flowLevel;
4622
4624
  function S(V) {
4623
4625
  return eu(e, V);
@@ -4674,7 +4676,7 @@ function ut() {
4674
4676
  }
4675
4677
  function au(e) {
4676
4678
  for (var r = "", o = 0, f, s = 0; s < e.length; o >= 65536 ? s += 2 : s++)
4677
- o = Dn(e, s), f = $e[o], !f && gn(o) ? (r += e[s], o >= 65536 && (r += e[s + 1])) : r += f || Qt(o);
4679
+ o = mn(e, s), f = $e[o], !f && Dn(o) ? (r += e[s], o >= 65536 && (r += e[s + 1])) : r += f || Qt(o);
4678
4680
  return r;
4679
4681
  }
4680
4682
  function ou(e, r, o) {
@@ -4686,7 +4688,7 @@ function ut() {
4686
4688
  function kr(e, r, o, f) {
4687
4689
  var s = "", g = e.tag, p, F, S;
4688
4690
  for (p = 0, F = o.length; p < F; p += 1)
4689
- S = o[p], e.replacer && (S = e.replacer.call(o, String(p), S)), (We(e, r + 1, S, !0, !0, !1, !0) || typeof S > "u" && We(e, r + 1, null, !0, !0, !1, !0)) && ((!f || s !== "") && (s += Yn(e, r)), e.dump && hn === e.dump.charCodeAt(0) ? s += "-" : s += "- ", s += e.dump);
4691
+ S = o[p], e.replacer && (S = e.replacer.call(o, String(p), S)), (We(e, r + 1, S, !0, !0, !1, !0) || typeof S > "u" && We(e, r + 1, null, !0, !0, !1, !0)) && ((!f || s !== "") && (s += Yn(e, r)), e.dump && dn === e.dump.charCodeAt(0) ? s += "-" : s += "- ", s += e.dump);
4690
4692
  e.tag = g, e.dump = s || "[]";
4691
4693
  }
4692
4694
  function su(e, r, o) {
@@ -4704,7 +4706,7 @@ function ut() {
4704
4706
  else if (e.sortKeys)
4705
4707
  throw new I("sortKeys must be a boolean or a function");
4706
4708
  for (F = 0, S = p.length; F < S; F += 1)
4707
- ue = "", (!f || s !== "") && (ue += Yn(e, r)), V = p[F], Z = o[V], e.replacer && (Z = e.replacer.call(o, V, Z)), We(e, r + 1, V, !0, !0, !0) && (U = e.tag !== null && e.tag !== "?" || e.dump && e.dump.length > 1024, U && (e.dump && hn === e.dump.charCodeAt(0) ? ue += "?" : ue += "? "), ue += e.dump, U && (ue += Yn(e, r)), We(e, r + 1, Z, !0, U) && (e.dump && hn === e.dump.charCodeAt(0) ? ue += ":" : ue += ": ", ue += e.dump, s += ue));
4709
+ ue = "", (!f || s !== "") && (ue += Yn(e, r)), V = p[F], Z = o[V], e.replacer && (Z = e.replacer.call(o, V, Z)), We(e, r + 1, V, !0, !0, !0) && (U = e.tag !== null && e.tag !== "?" || e.dump && e.dump.length > 1024, U && (e.dump && dn === e.dump.charCodeAt(0) ? ue += "?" : ue += "? "), ue += e.dump, U && (ue += Yn(e, r)), We(e, r + 1, Z, !0, U) && (e.dump && dn === e.dump.charCodeAt(0) ? ue += ":" : ue += ": ", ue += e.dump, s += ue));
4708
4710
  e.tag = g, e.dump = s || "{}";
4709
4711
  }
4710
4712
  function Lr(e, r, o) {
@@ -5266,23 +5268,26 @@ function ii() {
5266
5268
  }(Sn, Sn.exports)), Sn.exports;
5267
5269
  }
5268
5270
  var ai = /* @__PURE__ */ ii();
5269
- const oi = /* @__PURE__ */ Lu(ai), si = `${Ou.dirname(import.meta.url)}/locales/{{lng}}/{{ns}}.json`.replace("file://", "");
5270
- function pi() {
5271
- if (!An.isInitialized && Pu()) {
5272
- const m = new Nu(null, {
5271
+ const oi = /* @__PURE__ */ Lu(ai), si = `${Ou.dirname(import.meta.url)}/locales/{{lng}}/{{ns}}.json`.replace(
5272
+ "file://",
5273
+ ""
5274
+ );
5275
+ function pi(m) {
5276
+ if (!cn.isInitialized && Pu()) {
5277
+ const n = new Nu(null, {
5273
5278
  order: ["header", "query", "cookie"]
5274
5279
  });
5275
- An.use(oi).use(m).init({
5280
+ cn.use(oi).use(n).init({
5276
5281
  ...ei,
5277
5282
  ns: ["translation"],
5278
5283
  backend: {
5279
5284
  loadPath: si
5280
5285
  }
5281
- }), An.on("loaded", () => {
5282
- console.log("i18n backend loaded");
5286
+ }), cn.on("loaded", () => {
5287
+ m?.(cn);
5283
5288
  });
5284
5289
  }
5285
- return An;
5290
+ return cn;
5286
5291
  }
5287
5292
  export {
5288
5293
  pi as default,