@prosopo/cli 3.8.15 → 3.8.18

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.
@@ -1,8 +1,8 @@
1
- import { n as e, t } from "./i18next-CzgfK_Ir.js";
2
- import { i as n, l as r, r as i, s as a } from "./provider.cli.bundle.js";
1
+ import { t as e } from "./i18SharedOptions-CRkwRXkj.js";
2
+ import { c as t, i as n, o as r, r as i, s as a } from "./provider.cli.bundle.js";
3
3
  import o from "node:path";
4
4
  //#region ../locale/dist/util.js
5
- var s = () => !!(typeof window < "u" && window.document && window.document.createElement), c = () => !s(), l = /* @__PURE__ */ n(((e) => {
5
+ var s = () => !!(typeof window < "u" && window.document && window.document.createElement), c = () => !s(), l = /* @__PURE__ */ r(((e) => {
6
6
  Object.defineProperty(e, "__esModule", { value: !0 }), e.debounce = p, e.defaults = c, e.getPath = _, e.interpolate = y, e.interpolatePath = b, e.isSafeLangSegment = u, e.isSafeNsSegment = d, e.isSafePathSegment = void 0, e.pushPath = g, e.setPath = h;
7
7
  function t(e, t) {
8
8
  var r = typeof Symbol < "u" && e[Symbol.iterator] || e["@@iterator"];
@@ -155,7 +155,7 @@ var s = () => !!(typeof window < "u" && window.document && window.document.creat
155
155
  });
156
156
  return r ? null : i;
157
157
  }
158
- })), u = /* @__PURE__ */ n(((e, t) => {
158
+ })), u = /* @__PURE__ */ r(((e, t) => {
159
159
  Object.defineProperty(e, "__esModule", { value: !0 }), e.default = void 0;
160
160
  function n(e, t) {
161
161
  var n = typeof Symbol < "u" && e[Symbol.iterator] || e["@@iterator"];
@@ -978,7 +978,7 @@ var s = () => !!(typeof window < "u" && window.document && window.document.creat
978
978
  }
979
979
  }
980
980
  }, t.exports = e.default;
981
- })), d = /* @__PURE__ */ n(((e) => {
981
+ })), d = /* @__PURE__ */ r(((e) => {
982
982
  Object.defineProperty(e, "__esModule", { value: !0 }), e.SyntaxKind = e.ScanError = e.ParseErrorCode = void 0, e.applyEdits = ae, e.findNodeAtOffset = e.findNodeAtLocation = e.createScanner = void 0, e.format = re, e.getNodeValue = e.getNodePath = e.getLocation = void 0, e.modify = ie, e.parseTree = e.parse = void 0, e.printParseErrorCode = ne, e.visit = e.stripComments = void 0;
983
983
  function t(e, t) {
984
984
  var n = Object.keys(e);
@@ -2048,7 +2048,7 @@ var s = () => !!(typeof window < "u" && window.document && window.document.creat
2048
2048
  }
2049
2049
  return e;
2050
2050
  }
2051
- })), f = /* @__PURE__ */ n(((e) => {
2051
+ })), f = /* @__PURE__ */ r(((e) => {
2052
2052
  Object.defineProperty(e, "__esModule", { value: !0 }), e.types = e.safeLoadAll = e.safeLoad = e.safeDump = e.loadAll = e.load = e.dump = e.default = e.YAMLException = e.Type = e.Schema = e.JSON_SCHEMA = e.FAILSAFE_SCHEMA = e.DEFAULT_SCHEMA = e.CORE_SCHEMA = void 0;
2053
2053
  function t(e) {
2054
2054
  "@babel/helpers - typeof";
@@ -3114,11 +3114,11 @@ var s = () => !!(typeof window < "u" && window.document && window.document.creat
3114
3114
  safeLoadAll: e.safeLoadAll = Un("safeLoadAll", "loadAll"),
3115
3115
  safeDump: e.safeDump = Un("safeDump", "dump")
3116
3116
  };
3117
- })), p = /* @__PURE__ */ n(((e, t) => {
3117
+ })), p = /* @__PURE__ */ r(((e, t) => {
3118
3118
  Object.defineProperty(e, "__esModule", { value: !0 }), e.default = void 0, e.default = function(e) {
3119
3119
  if (!(e.indexOf(".") < 0)) return `.${e.split(".").pop()}`;
3120
3120
  }, t.exports = e.default;
3121
- })), m = /* @__PURE__ */ n(((e, t) => {
3121
+ })), m = /* @__PURE__ */ r(((e, t) => {
3122
3122
  Object.defineProperty(e, "__esModule", { value: !0 }), e.readFile = E, e.readFileSync = T;
3123
3123
  var n = s(u()), r = d(), i = s(f()), o = s(p());
3124
3124
  function s(e) {
@@ -3227,7 +3227,7 @@ var s = () => !!(typeof window < "u" && window.document && window.document.creat
3227
3227
  }).catch(a);
3228
3228
  });
3229
3229
  }
3230
- })), h = /* @__PURE__ */ n(((e, t) => {
3230
+ })), h = /* @__PURE__ */ r(((e, t) => {
3231
3231
  Object.defineProperty(e, "__esModule", { value: !0 }), e.removeFile = j, e.removeFileSync = A, e.writeFile = k, e.writeFileSync = O;
3232
3232
  var n = o(u()), r = o(f()), i = o(p());
3233
3233
  function o(e) {
@@ -3329,7 +3329,7 @@ var s = () => !!(typeof window < "u" && window.document && window.document.creat
3329
3329
  function j(e) {
3330
3330
  return (c ? E : s ? S : v)(e);
3331
3331
  }
3332
- })), g = /* @__PURE__ */ r((/* @__PURE__ */ n(((e, t) => {
3332
+ })), g = /* @__PURE__ */ t((/* @__PURE__ */ r(((e, t) => {
3333
3333
  Object.defineProperty(e, "__esModule", { value: !0 }), e.default = void 0;
3334
3334
  var n = l(), r = m(), i = h();
3335
3335
  function a(e) {
@@ -3535,24 +3535,24 @@ var s = () => !!(typeof window < "u" && window.document && window.document.creat
3535
3535
  }();
3536
3536
  p.type = "backend", e.default = p, t.exports = e.default;
3537
3537
  })))(), 1), _ = `${o.dirname(import.meta.url)}/locales/{{lng}}/{{ns}}.json`.replace("file://", "");
3538
- function v(n) {
3539
- if (!t.isInitialized && c()) {
3538
+ function v(t) {
3539
+ if (!n.isInitialized && c()) {
3540
3540
  let r = new i(null, { order: [
3541
3541
  "header",
3542
3542
  "query",
3543
3543
  "cookie"
3544
3544
  ] });
3545
- t.use(g.default).use(r).init({
3545
+ n.use(g.default).use(r).init({
3546
3546
  ...e,
3547
3547
  ns: ["translation"],
3548
3548
  backend: { loadPath: _ }
3549
3549
  });
3550
3550
  let a = !1;
3551
- t.on("loaded", () => {
3552
- a || (a = !0, n?.(t));
3551
+ n.on("loaded", () => {
3552
+ a || (a = !0, t?.(n));
3553
3553
  });
3554
- } else n?.(t);
3555
- return t;
3554
+ } else t?.(n);
3555
+ return n;
3556
3556
  }
3557
3557
  //#endregion
3558
3558
  export { v as default, v as initializeI18n };
@@ -0,0 +1,106 @@
1
+ import { t as e } from "./i18SharedOptions-CRkwRXkj.js";
2
+ import { a as t } from "./provider.cli.bundle.js";
3
+ //#region ../locale/dist/i18nFrontend.js
4
+ var n = "translation", r = e.fallbackLng, i = "i18nextLng", a = "i18next", o = 10080 * 60, s = 1e4, c = e.supportedLngs, l = (e) => {
5
+ let t = import.meta.url;
6
+ return `${t.slice(0, t.lastIndexOf("/"))}/locales/${e}/${n}.json`;
7
+ }, u = (e) => {
8
+ if (!e) return;
9
+ if (c.includes(e)) return e;
10
+ let t = e.split("-")[0];
11
+ return t && c.includes(t) ? t : void 0;
12
+ }, d = () => {
13
+ try {
14
+ let e = document.cookie.match(RegExp(`(?:^|; )${a}=([^;]*)`));
15
+ return e?.[1] ? decodeURIComponent(e[1]) : void 0;
16
+ } catch {
17
+ return;
18
+ }
19
+ }, f = () => {
20
+ try {
21
+ return localStorage.getItem(i) ?? void 0;
22
+ } catch {
23
+ return;
24
+ }
25
+ }, p = () => {
26
+ try {
27
+ return navigator.languages?.length ? navigator.languages : [navigator.language];
28
+ } catch {
29
+ return [];
30
+ }
31
+ }, m = (e) => {
32
+ try {
33
+ localStorage.setItem(i, e);
34
+ } catch {}
35
+ try {
36
+ document.cookie = `${a}=${encodeURIComponent(e)};max-age=${o};path=/`;
37
+ } catch {}
38
+ }, h = () => {
39
+ let e = [
40
+ d(),
41
+ f(),
42
+ ...p()
43
+ ];
44
+ for (let t of e) {
45
+ let e = u(t);
46
+ if (e) return e;
47
+ }
48
+ return r;
49
+ }, g = async (e) => {
50
+ let n = new AbortController(), r = setTimeout(() => n.abort(), s);
51
+ try {
52
+ let r = await fetch(l(e), { signal: n.signal });
53
+ if (!r.ok) return {};
54
+ let i = await r.json();
55
+ return typeof i == "object" && i ? t(i) : {};
56
+ } catch {
57
+ return {};
58
+ } finally {
59
+ clearTimeout(r);
60
+ }
61
+ }, _ = (e, t) => t ? e.replace(/\{\{(\w+)\}\}/g, (e, n) => n in t ? String(t[n]) : e) : e, v = (e) => {
62
+ let t = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), a = u(e) ?? h(), o = !1, s = (e) => {
63
+ for (let t of i.get(e) ?? []) t();
64
+ }, c = async (e) => {
65
+ let n = [.../* @__PURE__ */ new Set([e, r])].filter((e) => !t.has(e));
66
+ await Promise.all(n.map(async (e) => {
67
+ t.set(e, await g(e));
68
+ }));
69
+ }, l = (e, n) => t.get(e)?.[n];
70
+ m(a);
71
+ let d = c(a).then(() => {
72
+ o = !0, s("initialized"), s("loaded");
73
+ }), f = {
74
+ get language() {
75
+ return a;
76
+ },
77
+ get isInitialized() {
78
+ return o;
79
+ },
80
+ t: (e, t) => _(l(a, e) ?? l(r, e) ?? t?.defaultValue ?? e, t),
81
+ hasLoadedNamespace: (e) => e === n && t.has(a),
82
+ changeLanguage: async (e) => {
83
+ let t = u(e) ?? r;
84
+ return t !== a && (a = t, m(t), await c(t), s("loaded"), s("languageChanged")), f;
85
+ },
86
+ on: (e, t) => {
87
+ let n = i.get(e) ?? /* @__PURE__ */ new Set();
88
+ n.add(t), i.set(e, n);
89
+ },
90
+ off: (e, t) => {
91
+ i.get(e)?.delete(t);
92
+ },
93
+ ready: async () => (await d, f)
94
+ };
95
+ return f;
96
+ }, y;
97
+ function b(e, t) {
98
+ if (y) e?.(y);
99
+ else {
100
+ let n = v(t);
101
+ y = n, n.ready().then(() => e?.(n));
102
+ }
103
+ return y;
104
+ }
105
+ //#endregion
106
+ export { b as default, b as initializeI18n };