@wix/blog 1.0.704 → 1.0.705
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/_sdk-exports/context-blog-feed/runtime.d.ts +2 -2
- package/_sdk-exports/context-post/runtime.d.ts +21 -7
- package/_sdk-exports/context-post-by-slug/runtime.js +3 -3
- package/_sdk-exports/context-post-list-item/runtime.d.ts +3 -3
- package/_sdk-exports/context-post-list-item/runtime.js +2 -2
- package/_sdk-exports/context-related-posts/runtime.js +2 -2
- package/build/cjs/context-blog-feed.d.ts +2 -2
- package/build/cjs/context-post-by-slug.js +18 -18
- package/build/cjs/context-post-by-slug.js.map +1 -1
- package/build/cjs/context-post-list-item.d.ts +3 -3
- package/build/cjs/context-post-list-item.js +0 -2
- package/build/cjs/context-post-list-item.js.map +1 -1
- package/build/cjs/context-post.d.ts +21 -7
- package/build/cjs/context-related-posts.js +10 -3
- package/build/cjs/context-related-posts.js.map +1 -1
- package/build/es/context-blog-feed.d.mts +2 -2
- package/build/es/context-post-by-slug.mjs +18 -18
- package/build/es/context-post-by-slug.mjs.map +1 -1
- package/build/es/context-post-list-item.d.mts +3 -3
- package/build/es/context-post-list-item.mjs +0 -1
- package/build/es/context-post-list-item.mjs.map +1 -1
- package/build/es/context-post.d.mts +21 -7
- package/build/es/context-related-posts.mjs +10 -3
- package/build/es/context-related-posts.mjs.map +1 -1
- package/build/internal/cjs/context-blog-feed.d.ts +2 -2
- package/build/internal/cjs/context-post-list-item.d.ts +3 -3
- package/build/internal/cjs/context-post.d.ts +21 -7
- package/build/internal/es/context-blog-feed.d.mts +2 -2
- package/build/internal/es/context-post-list-item.d.mts +3 -3
- package/build/internal/es/context-post.d.mts +21 -7
- package/package.json +2 -14
- package/_sdk-exports/context-post-item/runtime.d.ts +0 -508
- package/_sdk-exports/context-post-item/runtime.js +0 -5
- package/build/cjs/context-post-item.d.ts +0 -508
- package/build/cjs/context-post-item.js +0 -3698
- package/build/cjs/context-post-item.js.map +0 -1
- package/build/es/context-post-item.d.mts +0 -508
- package/build/es/context-post-item.mjs +0 -3657
- package/build/es/context-post-item.mjs.map +0 -1
- package/build/internal/cjs/context-post-item.d.ts +0 -508
- package/build/internal/es/context-post-item.d.mts +0 -508
- package/context/post-item/package.json +0 -3
- package/post-item-context-provider/package.json +0 -3
|
@@ -1,3657 +0,0 @@
|
|
|
1
|
-
// _sdk-exports/context-post-item/runtime.js
|
|
2
|
-
import e from "@wix/blog/post-context-provider";
|
|
3
|
-
import { createContext as t, createElement as n, startTransition as r, useCallback as i, useContext as a, useEffect as o, useMemo as s, useRef as c, useState as l } from "react";
|
|
4
|
-
import { useService as u } from "@wix/services-manager-react";
|
|
5
|
-
import { Fragment as d, jsx as f } from "react/jsx-runtime";
|
|
6
|
-
var p = Object.defineProperty;
|
|
7
|
-
var m = (e6, t2) => {
|
|
8
|
-
let n2 = {};
|
|
9
|
-
for (var r2 in e6) p(n2, r2, { get: e6[r2], enumerable: true });
|
|
10
|
-
return t2 || p(n2, Symbol.toStringTag, { value: `Module` }), n2;
|
|
11
|
-
};
|
|
12
|
-
var h = {};
|
|
13
|
-
function g(e6, t2 = false, n2 = (e7) => e7) {
|
|
14
|
-
return () => ({ __type: `event-definition`, type: e6, isDomainEvent: t2, transformations: n2 });
|
|
15
|
-
}
|
|
16
|
-
var _ = (e6) => {
|
|
17
|
-
switch (e6) {
|
|
18
|
-
case `get`:
|
|
19
|
-
case `GET`:
|
|
20
|
-
return `GET`;
|
|
21
|
-
case `post`:
|
|
22
|
-
case `POST`:
|
|
23
|
-
return `POST`;
|
|
24
|
-
case `put`:
|
|
25
|
-
case `PUT`:
|
|
26
|
-
return `PUT`;
|
|
27
|
-
case `delete`:
|
|
28
|
-
case `DELETE`:
|
|
29
|
-
return `DELETE`;
|
|
30
|
-
case `patch`:
|
|
31
|
-
case `PATCH`:
|
|
32
|
-
return `PATCH`;
|
|
33
|
-
case `head`:
|
|
34
|
-
case `HEAD`:
|
|
35
|
-
return `HEAD`;
|
|
36
|
-
case `options`:
|
|
37
|
-
case `OPTIONS`:
|
|
38
|
-
return `OPTIONS`;
|
|
39
|
-
default:
|
|
40
|
-
throw Error(`Unknown method: ${e6}`);
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
var v = (e6) => (t2) => async (n2) => {
|
|
44
|
-
let r2, i2 = (t3) => {
|
|
45
|
-
if (r2 = e6(n2)(t3), r2.url === void 0) throw Error(`Url was not successfully created for this request, please reach out to support channels for assistance.`);
|
|
46
|
-
let { method: i3, url: a2, params: o2 } = r2;
|
|
47
|
-
return { ...r2, method: _(i3), url: a2, data: r2.data, params: o2 };
|
|
48
|
-
};
|
|
49
|
-
try {
|
|
50
|
-
let e7 = await t2.request(i2);
|
|
51
|
-
if (r2 === void 0) throw Error(`Request options were not created for this request, please reach out to support channels for assistance.`);
|
|
52
|
-
let n3 = Array.isArray(r2.transformResponse) ? r2.transformResponse : [r2.transformResponse], a2 = e7.data;
|
|
53
|
-
return n3.forEach((t3) => {
|
|
54
|
-
t3 && (a2 = t3(e7.data, e7.headers));
|
|
55
|
-
}), a2;
|
|
56
|
-
} catch (e7) {
|
|
57
|
-
throw typeof e7 == `object` && e7 && `response` in e7 && typeof e7.response == `object` && e7.response !== null && `data` in e7.response ? e7.response.data : e7;
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
var y = (e6) => e6.__isAmbassador ? true : !!e6().__isAmbassador;
|
|
61
|
-
var b = `__metadata`;
|
|
62
|
-
var x = `edge.wixapis.com`;
|
|
63
|
-
var S = class extends Error {
|
|
64
|
-
message;
|
|
65
|
-
response;
|
|
66
|
-
constructor(e6, t2) {
|
|
67
|
-
super(e6), this.message = e6, this.response = t2;
|
|
68
|
-
}
|
|
69
|
-
async details() {
|
|
70
|
-
let e6 = await this.response.json();
|
|
71
|
-
return C(this.response.status, e6?.message, e6?.details, { requestId: this.response.headers.get(`X-Wix-Request-Id`), details: e6 });
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
var C = (e6, t2, n2, r2) => ({ details: { ...!n2?.validationError && { applicationError: { description: t2, code: e6, data: r2 } }, ...n2 }, message: t2, requestId: r2?.requestId });
|
|
75
|
-
var ee = (e6) => e6?.method && [`post`, `put`, `patch`].includes(e6.method.toLocaleLowerCase()) && e6.body ? { "Content-Type": `application/json` } : {};
|
|
76
|
-
var w = (e6) => e6 && typeof e6 == `object` && !Array.isArray(e6);
|
|
77
|
-
var T = (e6) => e6.__type === `host`;
|
|
78
|
-
function te(e6, t2) {
|
|
79
|
-
return e6.create(t2);
|
|
80
|
-
}
|
|
81
|
-
var ne = `x-wix-bi-gateway`;
|
|
82
|
-
function re(e6, t2, n2) {
|
|
83
|
-
return { [ne]: ie({ environment: `js-sdk${n2 ? `-${n2}` : ``}`, "package-name": e6.packageName ?? t2?.PACKAGE_NAME, "method-fqn": e6.methodFqn, entity: e6.entityFqdn }) };
|
|
84
|
-
}
|
|
85
|
-
function ie(e6) {
|
|
86
|
-
return Object.entries(e6).filter(([e7, t2]) => !!t2).map(([e7, t2]) => `${e7}=${t2}`).join(`,`);
|
|
87
|
-
}
|
|
88
|
-
function ae(e6) {
|
|
89
|
-
let t2 = globalThis.__wix_context__, n2 = { client: h.client, elevatedClient: h.elevatedClient }, r2;
|
|
90
|
-
globalThis.__wix_context__ = void 0, h.client = void 0, h.elevatedClient = void 0, typeof $wixContext < `u` && (r2 = { client: $wixContext?.client, elevatedClient: $wixContext?.elevatedClient }, delete $wixContext.client, delete $wixContext.elevatedClient);
|
|
91
|
-
try {
|
|
92
|
-
return e6();
|
|
93
|
-
} finally {
|
|
94
|
-
globalThis.__wix_context__ = t2, h.client = n2.client, h.elevatedClient = n2.elevatedClient, typeof $wixContext < `u` && ($wixContext.client = r2.client, $wixContext.elevatedClient = r2.elevatedClient);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
var oe = { id: `_id`, createdDate: `_createdDate`, updatedDate: `_updatedDate` };
|
|
98
|
-
function se(e6) {
|
|
99
|
-
return fe(e6).map((e7) => e7.toLocaleUpperCase()).join(`_`);
|
|
100
|
-
}
|
|
101
|
-
var ce = /([\p{Ll}\d])(\p{Lu})/gu;
|
|
102
|
-
var le = /(\p{Lu})([\p{Lu}][\p{Ll}])/gu;
|
|
103
|
-
var ue = `$1\0$2`;
|
|
104
|
-
var de = /[^\p{L}\d]+/giu;
|
|
105
|
-
function fe(e6) {
|
|
106
|
-
let t2 = e6.trim();
|
|
107
|
-
t2 = t2.replace(ce, ue).replace(le, ue), t2 = t2.replace(de, `\0`);
|
|
108
|
-
let n2 = 0, r2 = t2.length;
|
|
109
|
-
for (; t2.charAt(n2) === `\0`; ) n2++;
|
|
110
|
-
if (n2 === r2) return [];
|
|
111
|
-
for (; t2.charAt(r2 - 1) === `\0`; ) r2--;
|
|
112
|
-
return t2.slice(n2, r2).split(/\0/g);
|
|
113
|
-
}
|
|
114
|
-
var pe = (e6) => `validationError` in (e6.response?.data?.details ?? {});
|
|
115
|
-
var me = (e6) => `applicationError` in (e6.response?.data?.details ?? {});
|
|
116
|
-
var he = (e6) => (e6.response?.status ?? -1) >= 400 && (e6.response?.status ?? -1) < 500;
|
|
117
|
-
function ge(e6, t2 = { explicitPathsToArguments: {}, spreadPathsToArguments: {}, singleArgumentUnchanged: false }, n2 = []) {
|
|
118
|
-
if (typeof e6 != `object` || !e6) throw e6;
|
|
119
|
-
if (pe(e6)) return _e(e6, t2, n2);
|
|
120
|
-
if (me(e6)) return ye(e6);
|
|
121
|
-
if (he(e6)) {
|
|
122
|
-
let t3 = e6.response?.status, n3 = e6.response?.statusText ?? `UNKNOWN`, r2 = e6.response?.data?.message ?? n3, i2 = { applicationError: { description: n3, code: se(n3), data: {} }, requestId: e6.requestId };
|
|
123
|
-
return ve(e6, { message: JSON.stringify({ message: r2, details: i2 }, null, 2), extraProperties: { details: i2, status: t3 } });
|
|
124
|
-
}
|
|
125
|
-
return be(e6);
|
|
126
|
-
}
|
|
127
|
-
var _e = (e6, t2, n2) => {
|
|
128
|
-
let r2 = e6.response?.data, i2 = e6.requestId, { fieldViolations: a2 } = r2.details.validationError, o2 = xe(t2, a2, n2)?.sort((e7, t3) => e7.field < t3.field ? -1 : 1), s2 = `INVALID_ARGUMENT: ${o2?.map(({ field: e7, description: t3 }) => `"${e7}" ${t3}`)?.join(`, `)}`, c2 = { validationError: { fieldViolations: o2 }, requestId: i2 };
|
|
129
|
-
return ve(e6, { message: JSON.stringify({ message: s2, details: c2 }, null, 2), extraProperties: { details: c2, status: e6.response?.status, requestId: i2 } });
|
|
130
|
-
};
|
|
131
|
-
var ve = (e6, { message: t2, extraProperties: n2 }) => Object.assign(e6, { ...n2, message: t2 });
|
|
132
|
-
var ye = (e6) => {
|
|
133
|
-
let t2 = e6.response?.status, n2 = e6.response?.statusText ?? `UNKNOWN`, r2 = e6.response?.data?.message ?? n2, i2 = e6.response?.data?.details?.applicationError?.description ?? n2, a2 = e6.response?.data?.details?.applicationError?.code ?? se(n2), o2 = e6.response?.data?.details?.applicationError?.data ?? {}, s2 = r2 === i2 ? r2 : `${r2}: ${i2}`, c2 = { applicationError: { description: i2, code: a2, data: o2 }, requestId: e6.requestId };
|
|
134
|
-
return ve(e6, { message: JSON.stringify({ message: s2, details: c2 }, null, 2), extraProperties: { details: c2, status: t2, requestId: e6.requestId } });
|
|
135
|
-
};
|
|
136
|
-
var be = (e6) => ve(e6, { message: e6.requestId ? `System error occurred, request-id: ${e6.requestId}` : `System error occurred: ${JSON.stringify(e6)}`, extraProperties: { requestId: e6.requestId, status: e6.response?.status, code: se(e6.response?.statusText ?? `UNKNOWN`), ...!e6.response && { runtimeError: e6 } } });
|
|
137
|
-
var xe = ({ spreadPathsToArguments: e6, explicitPathsToArguments: t2, singleArgumentUnchanged: n2 }, r2, i2) => {
|
|
138
|
-
let a2 = { ...e6, ...t2 }, o2 = Object.keys(a2);
|
|
139
|
-
return r2?.filter((e7) => !r2.some((t3) => t3.field.length > e7.field.length && t3.field.startsWith(e7.field) && o2.includes(t3.field))).map((e7) => {
|
|
140
|
-
let r3 = t2[e7.field];
|
|
141
|
-
if (r3) return { ...e7, field: Se(r3, i2) };
|
|
142
|
-
let s2 = o2?.sort((e8, t3) => t3.length - e8.length)?.find((t3) => e7.field.startsWith(t3));
|
|
143
|
-
if (s2) {
|
|
144
|
-
let t3 = a2[s2];
|
|
145
|
-
if (t3) return { ...e7, field: e7.field.replace(s2, Se(t3, i2)) };
|
|
146
|
-
}
|
|
147
|
-
return n2 ? { ...e7, field: `${i2[0]}.${e7.field}` } : e7;
|
|
148
|
-
});
|
|
149
|
-
};
|
|
150
|
-
var Se = (e6, t2) => {
|
|
151
|
-
let n2 = Ce(e6);
|
|
152
|
-
return n2 == null ? e6 : e6.replace(`$[${n2}]`, t2[n2]);
|
|
153
|
-
};
|
|
154
|
-
var Ce = (e6) => {
|
|
155
|
-
let t2 = e6.match(/\$\[(?<argIndex>\d+)\]/);
|
|
156
|
-
return t2 && t2.groups && Number(t2.groups.argIndex);
|
|
157
|
-
};
|
|
158
|
-
function we(e6, t2, n2, r2, i2, a2, o2, s2, c2, l2, u2) {
|
|
159
|
-
return ae(() => e6({ request: async (e7) => {
|
|
160
|
-
let i3 = e7({ host: s2?.HTTPHost || `www.wixapis.com` }), a3 = i3;
|
|
161
|
-
a3.method === `GET` && a3.fallback?.length && (a3.params?.toString().length ?? 0) > 4e3 && (a3 = i3.fallback[0]);
|
|
162
|
-
let o3 = s2?.HTTPHost ?? `www.wixapis.com`, u3 = `https://${l2 ? x : o3}${a3.url}`;
|
|
163
|
-
a3.params && a3.params.toString() && (u3 += `?${a3.params.toString()}`);
|
|
164
|
-
try {
|
|
165
|
-
let e8 = re(i3, t2, c2), o4 = { method: a3.method, ...a3.data && { body: JSON.stringify(a3.data) }, headers: { ...e8 } }, s3 = await n2(u3, o4);
|
|
166
|
-
if (s3.status !== 200) {
|
|
167
|
-
let e9 = null;
|
|
168
|
-
try {
|
|
169
|
-
e9 = await s3.json();
|
|
170
|
-
} catch {
|
|
171
|
-
}
|
|
172
|
-
let t3 = Ee(s3.status, e9?.message ?? s3.statusText, e9?.details, { requestId: s3.headers.get(`X-Wix-Request-Id`), details: e9 }), n3 = ge(t3);
|
|
173
|
-
throw r2?.handleError(n3, { requestOptions: { url: a3.url, method: a3.method, entityFqdn: i3.entityFqdn, methodFqn: i3.methodFqn } }), t3;
|
|
174
|
-
}
|
|
175
|
-
let l3 = await s3.json();
|
|
176
|
-
return { data: a3.migrationOptions?.optInTransformResponse && a3.transformResponse ? Array.isArray(a3.transformResponse) ? a3.transformResponse[0](l3) : a3.transformResponse(l3) : l3, headers: s3.headers, status: s3.status, statusText: s3.statusText };
|
|
177
|
-
} catch (e8) {
|
|
178
|
-
throw e8.message?.includes(`fetch is not defined`) && console.error(`Node.js v18+ is required`), e8;
|
|
179
|
-
}
|
|
180
|
-
}, fetchWithAuth: n2, wixAPIFetch: i2, getActiveToken: a2, getAuthHeaders: o2 }, { validateRequestSchema: u2 }));
|
|
181
|
-
}
|
|
182
|
-
var Te = class extends Error {
|
|
183
|
-
response;
|
|
184
|
-
requestId;
|
|
185
|
-
constructor(e6) {
|
|
186
|
-
super(), this.response = e6.response, this.requestId = e6.requestId;
|
|
187
|
-
}
|
|
188
|
-
};
|
|
189
|
-
var Ee = (e6, t2, n2, r2) => new Te({ response: { data: { details: { ...!n2?.validationError && { applicationError: { description: t2, code: e6, data: r2 } }, ...n2 }, message: t2 }, status: e6 }, requestId: r2?.requestId });
|
|
190
|
-
var De = `.`;
|
|
191
|
-
function Oe(e6, t2, n2) {
|
|
192
|
-
if (e6 == null) throw Error(`Cannot set value on null or undefined`);
|
|
193
|
-
let r2 = ke(t2), i2 = e6;
|
|
194
|
-
for (let e7 = 0; e7 < r2.length; e7++) {
|
|
195
|
-
let t3 = r2[e7];
|
|
196
|
-
if (e7 === r2.length - 1) {
|
|
197
|
-
i2[t3] = n2;
|
|
198
|
-
break;
|
|
199
|
-
}
|
|
200
|
-
let a2 = r2[e7 + 1];
|
|
201
|
-
(!(t3 in i2) || i2[t3] == null || typeof i2[t3] != `object` || i2[t3] === null) && (i2[t3] = typeof a2 == `number` ? [] : {}), i2 = i2[t3];
|
|
202
|
-
}
|
|
203
|
-
return e6;
|
|
204
|
-
}
|
|
205
|
-
function ke(e6) {
|
|
206
|
-
return Array.isArray(e6) ? e6 : e6.split(De).map((e7) => Ae(e7) ? Number(e7) : e7);
|
|
207
|
-
}
|
|
208
|
-
function Ae(e6) {
|
|
209
|
-
return /^\d+$/.test(e6);
|
|
210
|
-
}
|
|
211
|
-
function je(e6) {
|
|
212
|
-
let t2 = {};
|
|
213
|
-
for (let [n2, r2] of Object.entries(e6)) Me(n2) || Oe(t2, ke(n2), r2);
|
|
214
|
-
return t2;
|
|
215
|
-
}
|
|
216
|
-
function Me(e6) {
|
|
217
|
-
return e6 === `__proto__` || e6 === `constructor` || e6 === `prototype`;
|
|
218
|
-
}
|
|
219
|
-
var Ne = class {
|
|
220
|
-
BRACKET_PATTERN = /\[(\d+)\]/g;
|
|
221
|
-
NUMERIC_PATTERN = /^\d+$/;
|
|
222
|
-
ESCAPED_DOT_PATTERN = /\\\./g;
|
|
223
|
-
ESCAPED_LEFT_BRACKET_PATTERN = /\\\[/g;
|
|
224
|
-
ESCAPED_RIGHT_BRACKET_PATTERN = /\\\]/g;
|
|
225
|
-
SPLIT_PATTERN = /\.|\[(\d+)\]/g;
|
|
226
|
-
DOT_BEFORE_BRACKET_PATTERN = /\.\[/g;
|
|
227
|
-
ESCAPED_DOT_PLACEHOLDER = `__DOT__`;
|
|
228
|
-
ESCAPED_RIGHT_BRACKET_PLACEHOLDER = `__RB__`;
|
|
229
|
-
ESCAPED_LEFT_BRACKET_PLACEHOLDER = `__LB__`;
|
|
230
|
-
modifiedFields;
|
|
231
|
-
cleanedModifiedFields;
|
|
232
|
-
constructor(e6) {
|
|
233
|
-
this.modifiedFields = e6;
|
|
234
|
-
}
|
|
235
|
-
replaceEscapedCharacters(e6) {
|
|
236
|
-
return e6.replace(this.ESCAPED_DOT_PATTERN, this.ESCAPED_DOT_PLACEHOLDER).replace(this.ESCAPED_LEFT_BRACKET_PATTERN, this.ESCAPED_LEFT_BRACKET_PLACEHOLDER).replace(this.ESCAPED_RIGHT_BRACKET_PATTERN, this.ESCAPED_RIGHT_BRACKET_PLACEHOLDER);
|
|
237
|
-
}
|
|
238
|
-
restoreEscapedCharacters(e6) {
|
|
239
|
-
return e6.replace(this.ESCAPED_DOT_PLACEHOLDER, `\\.`).replace(this.ESCAPED_RIGHT_BRACKET_PLACEHOLDER, `\\]`).replace(this.ESCAPED_LEFT_BRACKET_PLACEHOLDER, `\\[`);
|
|
240
|
-
}
|
|
241
|
-
unflatten() {
|
|
242
|
-
return this.cleanedModifiedFields = Object.fromEntries(Object.entries(this.modifiedFields).map(([e6, t2]) => [this.replaceEscapedCharacters(this.bracketToDotNotation(e6)), t2])), je(this.cleanedModifiedFields);
|
|
243
|
-
}
|
|
244
|
-
flatten(e6) {
|
|
245
|
-
let t2 = {};
|
|
246
|
-
for (let n2 of Object.keys(this.cleanedModifiedFields)) {
|
|
247
|
-
let r2 = this.splitPath(n2), i2 = this.navigatePath(e6, r2);
|
|
248
|
-
t2 = { ...t2, ...i2 };
|
|
249
|
-
}
|
|
250
|
-
return Object.fromEntries(Object.entries(t2).map(([e7, t3]) => [this.restoreEscapedCharacters(e7), t3]));
|
|
251
|
-
}
|
|
252
|
-
splitPath(e6) {
|
|
253
|
-
let t2 = [], n2 = 0, r2 = Array.from(e6.matchAll(this.SPLIT_PATTERN));
|
|
254
|
-
for (let i2 of r2) i2.index > n2 && t2.push(e6.substring(n2, i2.index)), i2[1] && t2.push(i2[1]), n2 = i2.index + i2[0].length;
|
|
255
|
-
return n2 < e6.length && t2.push(e6.substring(n2)), t2;
|
|
256
|
-
}
|
|
257
|
-
navigatePath(e6, t2) {
|
|
258
|
-
let n2 = e6, r2 = [], i2 = (e7) => {
|
|
259
|
-
if (!Array.isArray(n2)) throw Error(`Expected array at path ${this.buildPathString(r2)}, but got ${typeof n2}`);
|
|
260
|
-
r2.push(`[${e7}]`), n2 = n2[parseInt(e7, 10)];
|
|
261
|
-
}, a2 = (e7, t3) => {
|
|
262
|
-
let i3 = e7 in oe ? oe[e7] : void 0;
|
|
263
|
-
if (i3 && i3 in t3) {
|
|
264
|
-
r2.push(i3), n2 = t3[i3];
|
|
265
|
-
return;
|
|
266
|
-
}
|
|
267
|
-
let a3 = Le(e7);
|
|
268
|
-
if (a3 && a3 in t3) r2.push(a3), n2 = t3[a3];
|
|
269
|
-
else throw Error(`Cannot find key '${e7}' or its transformations at path ${this.buildPathString(r2)}`);
|
|
270
|
-
}, o2 = (e7, t3) => {
|
|
271
|
-
r2.push(e7), n2 = t3[e7];
|
|
272
|
-
};
|
|
273
|
-
for (let e7 of t2) {
|
|
274
|
-
if (this.NUMERIC_PATTERN.test(e7)) {
|
|
275
|
-
i2(e7);
|
|
276
|
-
continue;
|
|
277
|
-
}
|
|
278
|
-
if (typeof n2 != `object` || !n2) throw Error(`Cannot access property '${e7}' on ${typeof n2} at path ${this.buildPathString(r2)}`);
|
|
279
|
-
let t3 = n2;
|
|
280
|
-
e7 in n2 ? o2(e7, t3) : a2(e7, t3);
|
|
281
|
-
}
|
|
282
|
-
return { [this.buildPathString(r2)]: n2 };
|
|
283
|
-
}
|
|
284
|
-
buildPathString(e6) {
|
|
285
|
-
return e6.join(`.`).replace(this.DOT_BEFORE_BRACKET_PATTERN, `[`);
|
|
286
|
-
}
|
|
287
|
-
bracketToDotNotation(e6) {
|
|
288
|
-
return e6.replace(this.BRACKET_PATTERN, (t2, n2, r2) => r2 > 0 && e6[r2 - 1] === `\\` ? t2 : `.` + n2);
|
|
289
|
-
}
|
|
290
|
-
};
|
|
291
|
-
function Pe(e6, t2) {
|
|
292
|
-
let n2 = e6?.modifiedFields;
|
|
293
|
-
if (!n2) return null;
|
|
294
|
-
let r2 = Fe(n2);
|
|
295
|
-
if (!r2) return null;
|
|
296
|
-
let { unflattenedModifiedFields: i2, modifiedFieldsManipulator: a2 } = r2;
|
|
297
|
-
e6 = { ...e6, modifiedFields: i2 };
|
|
298
|
-
let o2 = t2(e6), s2 = o2?.modifiedFields;
|
|
299
|
-
if (!s2) return null;
|
|
300
|
-
let c2 = Ie(s2, a2);
|
|
301
|
-
return c2 === null ? null : (o2.modifiedFields = c2, o2);
|
|
302
|
-
}
|
|
303
|
-
function Fe(e6) {
|
|
304
|
-
if (typeof e6 == `object` && e6 && !Array.isArray(e6)) try {
|
|
305
|
-
let t2 = new Ne(e6);
|
|
306
|
-
return { unflattenedModifiedFields: t2.unflatten(), modifiedFieldsManipulator: t2 };
|
|
307
|
-
} catch {
|
|
308
|
-
return null;
|
|
309
|
-
}
|
|
310
|
-
return null;
|
|
311
|
-
}
|
|
312
|
-
function Ie(e6, t2) {
|
|
313
|
-
if (typeof e6 == `object` && e6 && !Array.isArray(e6)) try {
|
|
314
|
-
return t2.flatten(e6);
|
|
315
|
-
} catch {
|
|
316
|
-
return null;
|
|
317
|
-
}
|
|
318
|
-
return null;
|
|
319
|
-
}
|
|
320
|
-
function Le(e6) {
|
|
321
|
-
return e6.replace(/[-_\s]+(.)?/g, (e7, t2) => t2 ? t2.toUpperCase() : ``).replace(/^./, (e7) => e7.toLowerCase());
|
|
322
|
-
}
|
|
323
|
-
function Re() {
|
|
324
|
-
return { emit(e6, ...t2) {
|
|
325
|
-
for (let n2 = 0, r2 = this.events[e6] || [], i2 = r2.length; n2 < i2; n2++) r2[n2](...t2);
|
|
326
|
-
}, events: {}, on(e6, t2) {
|
|
327
|
-
return (this.events[e6] ||= []).push(t2), () => {
|
|
328
|
-
this.events[e6] = this.events[e6]?.filter((e7) => t2 !== e7);
|
|
329
|
-
};
|
|
330
|
-
} };
|
|
331
|
-
}
|
|
332
|
-
var ze = (e6) => e6.__type === `event-definition`;
|
|
333
|
-
function Be(e6, t2, n2, r2) {
|
|
334
|
-
let i2;
|
|
335
|
-
if (e6.isDomainEvent) {
|
|
336
|
-
let { deletedEvent: e7, actionEvent: t3, createdEvent: a3, updatedEvent: o3, ...s3 } = n2, c2 = { ...r2, ...s3 };
|
|
337
|
-
i2 = e7 ? e7?.deletedEntity ? { entity: e7?.deletedEntity, metadata: c2 } : { metadata: c2 } : t3 ? { data: t3.body, metadata: c2 } : o3 ? { entity: o3.currentEntity, metadata: c2, ...o3.modifiedFields ? { modifiedFields: o3.modifiedFields } : {} } : { entity: a3?.entity, metadata: c2 };
|
|
338
|
-
} else i2 = { data: n2, metadata: r2 };
|
|
339
|
-
let a2 = e6.transformations ?? ((e7) => e7), o2 = i2, s2 = i2;
|
|
340
|
-
if (s2.modifiedFields) {
|
|
341
|
-
let e7 = s2.modifiedFields;
|
|
342
|
-
if (typeof e7 == `object` && e7 && !Array.isArray(e7)) {
|
|
343
|
-
o2 = structuredClone(i2);
|
|
344
|
-
let e8 = Pe(s2, a2);
|
|
345
|
-
if (e8) return t2(e8);
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
return t2(a2(o2));
|
|
349
|
-
}
|
|
350
|
-
function Ve(e6) {
|
|
351
|
-
let t2 = /* @__PURE__ */ new Map(), n2 = Re();
|
|
352
|
-
return { initModule(e7) {
|
|
353
|
-
return (r2) => {
|
|
354
|
-
let i2 = t2.get(e7.type) ?? [];
|
|
355
|
-
i2.push({ eventDefinition: e7, handler: r2 }), t2.set(e7.type, i2), n2.emit(`registered`, e7);
|
|
356
|
-
};
|
|
357
|
-
}, client: { ...n2, getRegisteredEvents: () => t2, async process(e7, n3 = { expectedEvents: [] }) {
|
|
358
|
-
let { eventType: r2, identity: i2, instanceId: a2, payload: o2, accountInfo: s2 } = await this.parseJWT(e7), c2 = [...n3.expectedEvents, ...Array.from(t2.keys()).map((e8) => ({ type: e8 }))];
|
|
359
|
-
if (c2.length > 0 && !c2.some(({ type: e8 }) => e8 === r2)) throw Error(`Unexpected event type: ${r2}. Expected one of: ${c2.map((e8) => e8.type).join(`, `)}`);
|
|
360
|
-
let l2 = t2.get(r2) ?? [];
|
|
361
|
-
return await Promise.all(l2.map(({ eventDefinition: e8, handler: t3 }) => Be(e8, t3, o2, { instanceId: a2, identity: i2, accountInfo: s2 }))), { instanceId: a2, eventType: r2, payload: o2, identity: i2, accountInfo: s2 };
|
|
362
|
-
}, async processRequest(e7, t3) {
|
|
363
|
-
let n3 = await e7.text();
|
|
364
|
-
return this.process(n3, t3);
|
|
365
|
-
}, async parseJWT(t3) {
|
|
366
|
-
let n3 = e6();
|
|
367
|
-
if (!n3.decodeJWT) throw Error(`decodeJWT is not supported by the authentication strategy`);
|
|
368
|
-
let { decoded: r2, valid: i2 } = await n3.decodeJWT(t3);
|
|
369
|
-
if (!i2) throw Error(`JWT is not valid`);
|
|
370
|
-
if (typeof r2.data != `string`) throw Error(`Unexpected type of JWT data: expected string, got ${typeof r2.data}`);
|
|
371
|
-
let a2 = JSON.parse(r2.data), o2 = a2.eventType, s2 = a2.accountInfo, c2 = a2.instanceId, l2 = a2.identity ? JSON.parse(a2.identity) : void 0;
|
|
372
|
-
return { instanceId: c2, eventType: o2, payload: JSON.parse(a2.data), identity: l2, accountInfo: s2 };
|
|
373
|
-
}, async parseRequest(e7) {
|
|
374
|
-
let t3 = await e7.text();
|
|
375
|
-
return this.parseJWT(t3);
|
|
376
|
-
}, async executeHandlers(e7) {
|
|
377
|
-
let n3 = Array.from(t2.keys()).map((e8) => ({ type: e8 }));
|
|
378
|
-
if (n3.length > 0 && !n3.some(({ type: t3 }) => t3 === e7.eventType)) throw Error(`Unexpected event type: ${e7.eventType}. Expected one of: ${n3.map((e8) => e8.type).join(`, `)}`);
|
|
379
|
-
let r2 = t2.get(e7.eventType) ?? [];
|
|
380
|
-
await Promise.all(r2.map(({ eventDefinition: t3, handler: n4 }) => Be(t3, n4, e7.payload, { instanceId: e7.instanceId, identity: e7.identity })));
|
|
381
|
-
}, apps: { AppInstalled: g(`AppInstalled`)(), AppRemoved: g(`AppRemoved`)() } } };
|
|
382
|
-
}
|
|
383
|
-
var He = (e6) => e6.__type === `service-plugin-definition`;
|
|
384
|
-
function Ue(e6) {
|
|
385
|
-
let t2 = /* @__PURE__ */ new Map(), n2 = Re();
|
|
386
|
-
return { initModule(e7) {
|
|
387
|
-
return (r2) => {
|
|
388
|
-
let i2 = t2.get(e7.componentType.toLowerCase()) ?? [];
|
|
389
|
-
i2.push({ servicePluginDefinition: e7, implementation: r2 }), t2.set(e7.componentType.toLowerCase(), i2), n2.emit(`registered`, e7);
|
|
390
|
-
};
|
|
391
|
-
}, client: { ...n2, getRegisteredServicePlugins: () => t2, async parseJWT(t3) {
|
|
392
|
-
let n3 = e6();
|
|
393
|
-
if (!n3.decodeJWT) throw Error(`decodeJWT is not supported by the authentication strategy`);
|
|
394
|
-
let { decoded: r2, valid: i2 } = await n3.decodeJWT(t3, true);
|
|
395
|
-
if (!i2) throw Error(`JWT is not valid`);
|
|
396
|
-
if (typeof r2.data != `object` || r2.data === null || !(`metadata` in r2.data) || typeof r2.data.metadata != `object` || r2.data.metadata === null || !(`appExtensionType` in r2.data.metadata) || typeof r2.data.metadata.appExtensionType != `string`) throw Error(`Unexpected JWT data: expected object with metadata.appExtensionType string`);
|
|
397
|
-
return r2.data;
|
|
398
|
-
}, async process(e7) {
|
|
399
|
-
let t3 = await this.parseJWT(e7.body);
|
|
400
|
-
return this.executeHandler(t3, e7.url);
|
|
401
|
-
}, async parseRequest(e7) {
|
|
402
|
-
let t3 = await e7.text();
|
|
403
|
-
return this.parseJWT(t3);
|
|
404
|
-
}, async processRequest(e7) {
|
|
405
|
-
let t3 = await this.parseRequest(e7);
|
|
406
|
-
return this.processParsedRequest(t3, e7.url);
|
|
407
|
-
}, async processParsedRequest(e7, t3) {
|
|
408
|
-
try {
|
|
409
|
-
let n3 = await this.executeHandler(e7, t3);
|
|
410
|
-
return Response.json(n3);
|
|
411
|
-
} catch (e8) {
|
|
412
|
-
if (e8.errorType === `SPI` && e8.applicationCode && e8.httpCode) return Response.json({ applicationError: { code: e8.applicationCode, data: e8.data } }, { status: e8.httpCode });
|
|
413
|
-
throw e8;
|
|
414
|
-
}
|
|
415
|
-
}, async executeHandler(e7, n3) {
|
|
416
|
-
let r2 = e7.metadata.appExtensionType.toLowerCase(), i2 = t2.get(r2) ?? [];
|
|
417
|
-
if (i2.length === 0) throw Error(`No service plugin implementations found for component type ${r2}`);
|
|
418
|
-
if (i2.length > 1) throw Error(`Multiple service plugin implementations found for component type ${r2}. This is currently not supported`);
|
|
419
|
-
let { implementation: a2, servicePluginDefinition: o2 } = i2[0], s2 = o2.methods.find((e8) => n3.endsWith(e8.primaryHttpMappingPath));
|
|
420
|
-
if (!s2) throw Error(`Unexpect request: request url did not match any method: ` + n3);
|
|
421
|
-
let c2 = a2[s2.name];
|
|
422
|
-
if (!c2) throw Error(`Got request for service plugin method ${s2.name} but no implementation was provided. Available methods: ${Object.keys(a2).join(`, `)}`);
|
|
423
|
-
return s2.transformations.toREST(await c2(s2.transformations.fromREST(e7)));
|
|
424
|
-
} } };
|
|
425
|
-
}
|
|
426
|
-
var E = `X-Wix-Consistent`;
|
|
427
|
-
function We(e6) {
|
|
428
|
-
let t2 = e6.headers || { Authorization: `` }, n2 = { getAuthHeaders: (e7) => Promise.resolve({ headers: {} }) }, r2 = e6.auth, i2 = typeof r2 == `function` ? r2 : () => r2 ?? n2, a2 = () => i2().getAuthHeaders(e6.host), o2 = () => e6.fetch ?? fetch, s2 = async (n3, r3) => {
|
|
429
|
-
let i3 = o2(), s3 = await a2(), c3 = { ...r3?.headers ?? {}, ...s3.headers, ...e6.host?.essentials?.passThroughHeaders, ...t2[`X-Wix-Consistent`] ? { [E]: t2[E] } : {} }, l3 = e6.host?.getErrorHandler?.();
|
|
430
|
-
try {
|
|
431
|
-
if (typeof n3 == `string` || n3 instanceof URL) {
|
|
432
|
-
let e7 = await i3(n3, { ...r3, headers: c3 });
|
|
433
|
-
l3?.handleError(e7, { requestOptions: { url: n3.toString(), method: r3?.method } });
|
|
434
|
-
let a3 = Ge(e7);
|
|
435
|
-
return a3 && (t2[E] = a3), e7;
|
|
436
|
-
}
|
|
437
|
-
{
|
|
438
|
-
for (let [e8, t3] of Object.entries(c3)) typeof t3 == `string` && n3.headers.set(e8, t3);
|
|
439
|
-
let e7 = await i3(n3, r3);
|
|
440
|
-
l3?.handleError(e7, { requestOptions: { url: n3.url, method: r3?.method } });
|
|
441
|
-
let a3 = Ge(e7);
|
|
442
|
-
return a3 && (t2[E] = a3), e7;
|
|
443
|
-
}
|
|
444
|
-
} catch (e7) {
|
|
445
|
-
throw l3?.handleError(e7, { requestOptions: { url: typeof n3 == `string` || n3 instanceof URL ? n3.toString() : n3.url, method: r3?.method } }), e7;
|
|
446
|
-
}
|
|
447
|
-
}, { client: c2, initModule: l2 } = Ue(i2), { client: u2, initModule: d2 } = Ve(i2), f2 = async (n3, r3) => {
|
|
448
|
-
let i3 = o2(), s3 = await a2(), c3 = ee(r3), l3 = await i3(n3, { ...r3, headers: { ...c3, ...t2, ...s3?.headers, ...r3?.headers, ...e6.host?.essentials?.passThroughHeaders, ...t2[`X-Wix-Consistent`] ? { [E]: t2[E] } : {} } }), u3 = Ge(l3);
|
|
449
|
-
return u3 && (t2[E] = u3), l3;
|
|
450
|
-
}, p2 = (t3, n3) => {
|
|
451
|
-
if (ze(t3)) return d2(t3);
|
|
452
|
-
if (He(t3)) return l2(t3);
|
|
453
|
-
if (T(t3) && e6.host) return te(t3, e6.host);
|
|
454
|
-
if (typeof t3 == `function`) {
|
|
455
|
-
if (`__type` in t3 && t3.__type === `wix_spi_error`) return t3;
|
|
456
|
-
let r3 = e6.host?.apiBaseUrl ?? `www.wixapis.com`, o3 = e6.useCDN === void 0 ? i2().shouldUseCDN : e6.useCDN;
|
|
457
|
-
return we(ae(() => y(t3)) ? v(t3) : t3, n3 ?? {}, f2, e6.host?.getErrorHandler?.(), (e7, t4) => {
|
|
458
|
-
let n4 = new URL(e7, `https://${r3}`);
|
|
459
|
-
return n4.host = r3, n4.protocol = `https`, f2(n4.toString(), t4);
|
|
460
|
-
}, i2().getActiveToken, async () => a2(), { HTTPHost: r3 }, e6.host?.name, o3, e6.validateRequestSchema);
|
|
461
|
-
}
|
|
462
|
-
return w(t3) ? Object.fromEntries(Object.entries(t3).map(([e7, n4]) => [e7, p2(n4, t3[b])])) : t3;
|
|
463
|
-
}, m2 = (e7) => {
|
|
464
|
-
for (let n3 in e7) t2[n3] = e7[n3];
|
|
465
|
-
};
|
|
466
|
-
return { ...e6.modules ? p2(e6.modules) : {}, get auth() {
|
|
467
|
-
let t3 = i2();
|
|
468
|
-
return t3.getAuthHeaders = t3.getAuthHeaders.bind(void 0, e6.host), t3;
|
|
469
|
-
}, setHeaders: m2, use: p2, enableContext(e7, t3 = { elevated: false }) {
|
|
470
|
-
e7 === `global` ? globalThis.__wix_context__ == null ? t3.elevated ? globalThis.__wix_context__ = { elevatedClient: this } : globalThis.__wix_context__ = { client: this } : t3.elevated ? globalThis.__wix_context__.elevatedClient = this : globalThis.__wix_context__.client = this : t3.elevated ? h.elevatedClient = this : h.client = this;
|
|
471
|
-
}, fetch: (t3, n3) => {
|
|
472
|
-
let r3 = e6.host?.apiBaseUrl ?? `www.wixapis.com`, i3 = new URL(t3, `https://${r3}`);
|
|
473
|
-
return i3.host = r3, i3.protocol = `https`, f2(i3.toString(), n3);
|
|
474
|
-
}, fetchWithAuth: s2, async graphql(t3, n3, r3 = { apiVersion: `alpha` }) {
|
|
475
|
-
let i3 = e6?.host?.apiBaseUrl ?? `www.wixapis.com`, a3 = await f2(`https://${i3}/graphql/${r3.apiVersion}`, { method: `POST`, headers: { "Content-Type": `application/json` }, body: JSON.stringify({ query: t3, variables: n3 }) });
|
|
476
|
-
if (a3.status !== 200) throw new S(`GraphQL request failed with status ${a3.status}`, a3);
|
|
477
|
-
let { data: o3, errors: s3 } = await a3.json();
|
|
478
|
-
return { data: o3 ?? {}, errors: s3 };
|
|
479
|
-
}, webhooks: u2, servicePlugins: c2 };
|
|
480
|
-
}
|
|
481
|
-
function Ge(e6) {
|
|
482
|
-
return e6.headers?.get(`X-Wix-Consistent`) ?? e6.headers?.get(`x-wix-consistent`);
|
|
483
|
-
}
|
|
484
|
-
var Ke = { _id: `id`, _createdDate: `createdDate`, _updatedDate: `updatedDate` };
|
|
485
|
-
var qe = { id: `_id`, createdDate: `_createdDate`, updatedDate: `_updatedDate` };
|
|
486
|
-
var Je = `items`;
|
|
487
|
-
var Ye = `pagingMetadata`;
|
|
488
|
-
var Xe = Ke;
|
|
489
|
-
function Ze(e6, t2) {
|
|
490
|
-
return e6?.split(`.`).map((e7) => t2?.[e7] ?? e7).join(`.`);
|
|
491
|
-
}
|
|
492
|
-
var Qe = `sort.fieldName`;
|
|
493
|
-
function $e(e6, t2, n2) {
|
|
494
|
-
return (e6 === Qe || e6.endsWith(`.${Qe}`)) && typeof t2 == `string` ? Ze(t2, n2) : t2;
|
|
495
|
-
}
|
|
496
|
-
function et(e6, t2, n2) {
|
|
497
|
-
let r2 = (e7) => n2.includes(e7), i2 = (e7, n3) => {
|
|
498
|
-
if (Array.isArray(e7)) e7.forEach((e8) => {
|
|
499
|
-
i2(e8, n3);
|
|
500
|
-
});
|
|
501
|
-
else if (typeof e7 == `object` && e7) {
|
|
502
|
-
let a2 = e7;
|
|
503
|
-
Object.keys(a2).forEach((e8) => {
|
|
504
|
-
let o2 = n3 === `` ? e8 : `${n3}.${e8}`;
|
|
505
|
-
if (r2(o2)) return;
|
|
506
|
-
let s2 = tt(e8, t2);
|
|
507
|
-
s2 !== e8 && !(s2 in a2) && (a2[s2] = a2[e8], delete a2[e8]), a2[s2] = $e(o2, a2[s2], t2), i2(a2[s2], o2);
|
|
508
|
-
});
|
|
509
|
-
}
|
|
510
|
-
};
|
|
511
|
-
return i2(e6, ``), e6;
|
|
512
|
-
}
|
|
513
|
-
function tt(e6, t2) {
|
|
514
|
-
let n2;
|
|
515
|
-
return n2 = e6.includes(`.`) ? e6.split(`.`).map((e7) => t2[e7] ?? e7).join(`.`) : t2[e6] ?? e6, n2;
|
|
516
|
-
}
|
|
517
|
-
function D(e6, t2 = []) {
|
|
518
|
-
return et(e6, Ke, t2);
|
|
519
|
-
}
|
|
520
|
-
function O(e6, t2 = []) {
|
|
521
|
-
return et(e6, qe, t2);
|
|
522
|
-
}
|
|
523
|
-
function nt(e6) {
|
|
524
|
-
return e6?.toISOString();
|
|
525
|
-
}
|
|
526
|
-
function rt(e6) {
|
|
527
|
-
return e6 ? new Date(e6) : void 0;
|
|
528
|
-
}
|
|
529
|
-
var it = /* @__PURE__ */ new WeakMap();
|
|
530
|
-
function at() {
|
|
531
|
-
return { leaves: void 0, fields: void 0, mapFields: void 0, anyField: void 0 };
|
|
532
|
-
}
|
|
533
|
-
function ot(e6, t2) {
|
|
534
|
-
let n2 = e6.get(t2);
|
|
535
|
-
return n2 || (n2 = at(), e6.set(t2, n2)), n2;
|
|
536
|
-
}
|
|
537
|
-
function st(e6, t2) {
|
|
538
|
-
return t2 === `*` ? (e6.anyField ??= at(), e6.anyField) : t2.endsWith(`{}`) ? (e6.mapFields ??= /* @__PURE__ */ new Map(), ot(e6.mapFields, t2.slice(0, -2))) : (e6.fields ??= /* @__PURE__ */ new Map(), ot(e6.fields, t2));
|
|
539
|
-
}
|
|
540
|
-
function ct(e6) {
|
|
541
|
-
let t2 = at();
|
|
542
|
-
for (let n2 of e6) {
|
|
543
|
-
let e7 = n2.path.split(`.`).reduce(st, t2);
|
|
544
|
-
e7.leaves ??= [], e7.leaves.push(n2);
|
|
545
|
-
}
|
|
546
|
-
return t2;
|
|
547
|
-
}
|
|
548
|
-
function lt(e6) {
|
|
549
|
-
let t2 = it.get(e6);
|
|
550
|
-
return t2 || (t2 = ct(e6), it.set(e6, t2)), t2;
|
|
551
|
-
}
|
|
552
|
-
function k(e6) {
|
|
553
|
-
return typeof e6 == `object` && !!e6;
|
|
554
|
-
}
|
|
555
|
-
function ut(e6, { isRepeated: t2, isMap: n2 }, r2) {
|
|
556
|
-
return t2 ? Array.isArray(e6) ? e6.map(r2) : e6 : n2 ? k(e6) ? Object.fromEntries(Object.entries(e6).map(([e7, t3]) => [e7, r2(t3)])) : e6 : r2(e6);
|
|
557
|
-
}
|
|
558
|
-
function A(e6, t2, n2) {
|
|
559
|
-
k(e6) && pt(e6, t2, n2);
|
|
560
|
-
}
|
|
561
|
-
function dt(e6, t2, n2) {
|
|
562
|
-
for (let [r2, i2] of t2) {
|
|
563
|
-
if (!(r2 in e6)) continue;
|
|
564
|
-
if (i2.leaves) for (let t4 of i2.leaves) e6[r2] = ut(e6[r2], t4, n2);
|
|
565
|
-
let t3 = e6[r2];
|
|
566
|
-
Array.isArray(t3) ? t3.forEach((e7) => A(e7, i2, n2)) : A(t3, i2, n2);
|
|
567
|
-
}
|
|
568
|
-
}
|
|
569
|
-
function ft(e6, t2, n2) {
|
|
570
|
-
for (let [r2, i2] of t2) {
|
|
571
|
-
let t3 = e6[r2];
|
|
572
|
-
k(t3) && Object.values(t3).forEach((e7) => A(e7, i2, n2));
|
|
573
|
-
}
|
|
574
|
-
}
|
|
575
|
-
function pt(e6, { fields: t2, mapFields: n2, anyField: r2 }, i2) {
|
|
576
|
-
t2 && dt(e6, t2, i2), n2 && ft(e6, n2, i2), r2 && Object.values(e6).forEach((e7) => A(e7, r2, i2));
|
|
577
|
-
}
|
|
578
|
-
function j(e6, t2) {
|
|
579
|
-
if (!k(e6)) return e6;
|
|
580
|
-
for (let { paths: n2, transformFn: r2 } of t2) pt(e6, lt(n2), r2);
|
|
581
|
-
return e6;
|
|
582
|
-
}
|
|
583
|
-
function mt(e6) {
|
|
584
|
-
return yt(e6).map((e7) => e7.toLocaleUpperCase()).join(`_`);
|
|
585
|
-
}
|
|
586
|
-
var ht = /([\p{Ll}\d])(\p{Lu})/gu;
|
|
587
|
-
var gt = /(\p{Lu})([\p{Lu}][\p{Ll}])/gu;
|
|
588
|
-
var _t = `$1\0$2`;
|
|
589
|
-
var vt = /[^\p{L}\d]+/giu;
|
|
590
|
-
function yt(e6) {
|
|
591
|
-
let t2 = e6.trim();
|
|
592
|
-
t2 = t2.replace(ht, _t).replace(gt, _t), t2 = t2.replace(vt, `\0`);
|
|
593
|
-
let n2 = 0, r2 = t2.length;
|
|
594
|
-
for (; t2.charAt(n2) === `\0`; ) n2++;
|
|
595
|
-
if (n2 === r2) return [];
|
|
596
|
-
for (; t2.charAt(r2 - 1) === `\0`; ) r2--;
|
|
597
|
-
return t2.slice(n2, r2).split(/\0/g);
|
|
598
|
-
}
|
|
599
|
-
var bt = (e6) => `validationError` in (e6.response?.data?.details ?? {});
|
|
600
|
-
var xt = (e6) => `applicationError` in (e6.response?.data?.details ?? {});
|
|
601
|
-
var St = (e6) => (e6.response?.status ?? -1) >= 400 && (e6.response?.status ?? -1) < 500;
|
|
602
|
-
function M(e6, t2 = { explicitPathsToArguments: {}, spreadPathsToArguments: {}, singleArgumentUnchanged: false }, n2 = []) {
|
|
603
|
-
if (typeof e6 != `object` || !e6) throw e6;
|
|
604
|
-
if (bt(e6)) return Ct(e6, t2, n2);
|
|
605
|
-
if (xt(e6)) return wt(e6);
|
|
606
|
-
if (St(e6)) {
|
|
607
|
-
let t3 = e6.response?.status, n3 = e6.response?.statusText ?? `UNKNOWN`, r2 = e6.response?.data?.message ?? n3, i2 = { applicationError: { description: n3, code: mt(n3), data: {} }, requestId: e6.requestId };
|
|
608
|
-
return N(e6, { message: JSON.stringify({ message: r2, details: i2 }, null, 2), extraProperties: { details: i2, status: t3 } });
|
|
609
|
-
}
|
|
610
|
-
return Tt(e6);
|
|
611
|
-
}
|
|
612
|
-
var Ct = (e6, t2, n2) => {
|
|
613
|
-
let r2 = e6.response?.data, i2 = e6.requestId, { fieldViolations: a2 } = r2.details.validationError, o2 = Et(t2, a2, n2)?.sort((e7, t3) => e7.field < t3.field ? -1 : 1), s2 = `INVALID_ARGUMENT: ${o2?.map(({ field: e7, description: t3 }) => `"${e7}" ${t3}`)?.join(`, `)}`, c2 = { validationError: { fieldViolations: o2 }, requestId: i2 };
|
|
614
|
-
return N(e6, { message: JSON.stringify({ message: s2, details: c2 }, null, 2), extraProperties: { details: c2, status: e6.response?.status, requestId: i2 } });
|
|
615
|
-
};
|
|
616
|
-
var N = (e6, { message: t2, extraProperties: n2 }) => Object.assign(e6, { ...n2, message: t2 });
|
|
617
|
-
var wt = (e6) => {
|
|
618
|
-
let t2 = e6.response?.status, n2 = e6.response?.statusText ?? `UNKNOWN`, r2 = e6.response?.data?.message ?? n2, i2 = e6.response?.data?.details?.applicationError?.description ?? n2, a2 = e6.response?.data?.details?.applicationError?.code ?? mt(n2), o2 = e6.response?.data?.details?.applicationError?.data ?? {}, s2 = r2 === i2 ? r2 : `${r2}: ${i2}`, c2 = { applicationError: { description: i2, code: a2, data: o2 }, requestId: e6.requestId };
|
|
619
|
-
return N(e6, { message: JSON.stringify({ message: s2, details: c2 }, null, 2), extraProperties: { details: c2, status: t2, requestId: e6.requestId } });
|
|
620
|
-
};
|
|
621
|
-
var Tt = (e6) => N(e6, { message: e6.requestId ? `System error occurred, request-id: ${e6.requestId}` : `System error occurred: ${JSON.stringify(e6)}`, extraProperties: { requestId: e6.requestId, status: e6.response?.status, code: mt(e6.response?.statusText ?? `UNKNOWN`), ...!e6.response && { runtimeError: e6 } } });
|
|
622
|
-
var Et = ({ spreadPathsToArguments: e6, explicitPathsToArguments: t2, singleArgumentUnchanged: n2 }, r2, i2) => {
|
|
623
|
-
let a2 = { ...e6, ...t2 }, o2 = Object.keys(a2);
|
|
624
|
-
return r2?.filter((e7) => !r2.some((t3) => t3.field.length > e7.field.length && t3.field.startsWith(e7.field) && o2.includes(t3.field))).map((e7) => {
|
|
625
|
-
let r3 = t2[e7.field];
|
|
626
|
-
if (r3) return { ...e7, field: Dt(r3, i2) };
|
|
627
|
-
let s2 = o2?.sort((e8, t3) => t3.length - e8.length)?.find((t3) => e7.field.startsWith(t3));
|
|
628
|
-
if (s2) {
|
|
629
|
-
let t3 = a2[s2];
|
|
630
|
-
if (t3) return { ...e7, field: e7.field.replace(s2, Dt(t3, i2)) };
|
|
631
|
-
}
|
|
632
|
-
return n2 ? { ...e7, field: `${i2[0]}.${e7.field}` } : e7;
|
|
633
|
-
});
|
|
634
|
-
};
|
|
635
|
-
var Dt = (e6, t2) => {
|
|
636
|
-
let n2 = Ot(e6);
|
|
637
|
-
return n2 == null ? e6 : e6.replace(`$[${n2}]`, t2[n2]);
|
|
638
|
-
};
|
|
639
|
-
var Ot = (e6) => {
|
|
640
|
-
let t2 = e6.match(/\$\[(?<argIndex>\d+)\]/);
|
|
641
|
-
return t2 && t2.groups && Number(t2.groups.argIndex);
|
|
642
|
-
};
|
|
643
|
-
function kt() {
|
|
644
|
-
let e6 = typeof $wixContext < `u` && $wixContext.initWixModules ? $wixContext.initWixModules : globalThis.__wix_context__ !== void 0 && globalThis.__wix_context__.initWixModules ? globalThis.__wix_context__.initWixModules : void 0;
|
|
645
|
-
if (e6) return { initWixModules(t3, n3) {
|
|
646
|
-
return At(() => e6(t3, n3));
|
|
647
|
-
}, fetchWithAuth() {
|
|
648
|
-
throw Error(`fetchWithAuth is not available in this context`);
|
|
649
|
-
}, graphql() {
|
|
650
|
-
throw Error(`graphql is not available in this context`);
|
|
651
|
-
} };
|
|
652
|
-
let t2 = typeof $wixContext < `u` ? $wixContext.client : h.client === void 0 ? globalThis.__wix_context__ === void 0 ? void 0 : globalThis.__wix_context__.client : h.client, n2 = typeof $wixContext < `u` ? $wixContext.elevatedClient : h.elevatedClient === void 0 ? globalThis.__wix_context__ === void 0 ? void 0 : globalThis.__wix_context__.elevatedClient : h.elevatedClient;
|
|
653
|
-
if (t2 || n2) return { initWixModules(e7, r2) {
|
|
654
|
-
if (r2) {
|
|
655
|
-
if (!n2) throw Error(`An elevated client is required to use elevated modules. Make sure to initialize the Wix context with an elevated client before using elevated SDK modules`);
|
|
656
|
-
return At(() => n2.use(e7));
|
|
657
|
-
}
|
|
658
|
-
if (!t2) throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);
|
|
659
|
-
return At(() => t2.use(e7));
|
|
660
|
-
}, fetchWithAuth: (e7, n3) => {
|
|
661
|
-
if (!t2) throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);
|
|
662
|
-
return t2.fetchWithAuth(e7, n3);
|
|
663
|
-
}, getAuth() {
|
|
664
|
-
if (!t2) throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);
|
|
665
|
-
return t2.auth;
|
|
666
|
-
}, async graphql(e7, n3, r2) {
|
|
667
|
-
if (!t2) throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);
|
|
668
|
-
return t2.graphql(e7, n3, r2);
|
|
669
|
-
} };
|
|
670
|
-
}
|
|
671
|
-
function At(e6) {
|
|
672
|
-
let t2 = globalThis.__wix_context__, n2 = { client: h.client, elevatedClient: h.elevatedClient }, r2;
|
|
673
|
-
globalThis.__wix_context__ = void 0, h.client = void 0, h.elevatedClient = void 0, typeof $wixContext < `u` && (r2 = { client: $wixContext?.client, elevatedClient: $wixContext?.elevatedClient }, delete $wixContext.client, delete $wixContext.elevatedClient);
|
|
674
|
-
try {
|
|
675
|
-
return e6();
|
|
676
|
-
} finally {
|
|
677
|
-
globalThis.__wix_context__ = t2, h.client = n2.client, h.elevatedClient = n2.elevatedClient, typeof $wixContext < `u` && ($wixContext.client = r2.client, $wixContext.elevatedClient = r2.elevatedClient);
|
|
678
|
-
}
|
|
679
|
-
}
|
|
680
|
-
function jt(e6, t2) {
|
|
681
|
-
return (...n2) => {
|
|
682
|
-
let r2 = kt();
|
|
683
|
-
return r2 ? r2.initWixModules(e6, t2).apply(void 0, n2) : e6.apply(void 0, n2);
|
|
684
|
-
};
|
|
685
|
-
}
|
|
686
|
-
function Mt(e6, t2 = false) {
|
|
687
|
-
return jt(e6, t2);
|
|
688
|
-
}
|
|
689
|
-
function Nt(e6, t2) {
|
|
690
|
-
let n2 = Ft(e6), r2 = Object.entries(n2).some(([e7, t3]) => e7.includes(`.`) || Array.isArray(t3) && t3.some((e8) => typeof e8 == `object`));
|
|
691
|
-
return t2 && r2 ? new URLSearchParams({ ".r": Lt(JSON.stringify(e6)) }) : Object.entries(n2).reduce((e7, [t3, n3]) => ((Array.isArray(n3) ? n3 : [n3]).forEach((r3) => {
|
|
692
|
-
r3 == null || Array.isArray(n3) && typeof r3 == `object` || e7.append(t3, r3);
|
|
693
|
-
}), e7), new URLSearchParams());
|
|
694
|
-
}
|
|
695
|
-
function Pt(e6) {
|
|
696
|
-
let t2 = Xt(Jt(e6.host), e6.domainToMappings);
|
|
697
|
-
return on(nn(e6.protoPath, e6.data || {}), t2);
|
|
698
|
-
}
|
|
699
|
-
function Ft(e6, t2 = ``) {
|
|
700
|
-
let n2 = {};
|
|
701
|
-
return Object.entries(e6).forEach(([e7, r2]) => {
|
|
702
|
-
let i2 = typeof r2 == `object` && !!r2 && !Array.isArray(r2), a2 = It(t2, e7);
|
|
703
|
-
if (i2) {
|
|
704
|
-
let e8 = Ft(r2, a2);
|
|
705
|
-
Object.assign(n2, e8);
|
|
706
|
-
} else n2[a2] = r2;
|
|
707
|
-
}), n2;
|
|
708
|
-
}
|
|
709
|
-
function It(e6, t2) {
|
|
710
|
-
return `${e6}${e6 ? `.` : ``}${t2}`;
|
|
711
|
-
}
|
|
712
|
-
var Lt = (e6) => {
|
|
713
|
-
let t2 = new TextEncoder().encode(e6);
|
|
714
|
-
return (typeof btoa < `u` ? btoa(String.fromCodePoint(...t2)) : Buffer.from(e6, `utf-8`).toString(`base64`)).replace(/=/g, ``).replace(/\+/g, `-`).replace(/\//g, `_`);
|
|
715
|
-
};
|
|
716
|
-
var Rt = [`wix.com`, `editorx.com`];
|
|
717
|
-
var zt = `_`;
|
|
718
|
-
var Bt = `*.`;
|
|
719
|
-
var Vt = RegExp(`\\.(${Rt.join(`|`)})$`);
|
|
720
|
-
var Ht = [`42.wixprod.net`, `uw2-edt-1.wixprod.net`, `virginia-edt.wixprod.net`];
|
|
721
|
-
var Ut = { "payments.base44.com": `manage.wix.com`, "create.editorx.com": `editor.editorx.com` };
|
|
722
|
-
var Wt = `dev.wix-code.com`;
|
|
723
|
-
var Gt = /{(.*)}/;
|
|
724
|
-
var Kt = RegExp(`\\.(${Ht.join(`|`)})$`);
|
|
725
|
-
var qt = RegExp(`.*\\.${Wt}$`);
|
|
726
|
-
function Jt(e6) {
|
|
727
|
-
return Yt(e6).replace(Vt, `._base_domain_`).replace(Kt, `._api_base_domain_`).replace(qt, `*.dev.wix-code.com`);
|
|
728
|
-
}
|
|
729
|
-
function Yt(e6) {
|
|
730
|
-
return Ut[e6] ?? e6;
|
|
731
|
-
}
|
|
732
|
-
function Xt(e6, t2) {
|
|
733
|
-
let n2 = t2[e6];
|
|
734
|
-
if (n2) return n2;
|
|
735
|
-
let r2 = Zt(e6, t2) ?? Qt(e6, t2);
|
|
736
|
-
if (!r2) {
|
|
737
|
-
if (en(e6)) {
|
|
738
|
-
let e7 = t2[tn];
|
|
739
|
-
if (e7) return e7;
|
|
740
|
-
}
|
|
741
|
-
let n3 = t2[zt];
|
|
742
|
-
if (n3) return n3;
|
|
743
|
-
}
|
|
744
|
-
return r2 ?? [];
|
|
745
|
-
}
|
|
746
|
-
function Zt(e6, t2) {
|
|
747
|
-
return Object.entries(t2).find(([t3]) => {
|
|
748
|
-
let [, ...n2] = e6.split(`.`);
|
|
749
|
-
return n2.join(`.`) === t3;
|
|
750
|
-
})?.[1];
|
|
751
|
-
}
|
|
752
|
-
function Qt(e6, t2) {
|
|
753
|
-
let [n2] = Object.entries(t2).filter(([t3]) => $t(e6, t3)).sort(([e7], [t3]) => t3.length - e7.length);
|
|
754
|
-
if (!n2) return;
|
|
755
|
-
let [, r2] = n2;
|
|
756
|
-
return r2;
|
|
757
|
-
}
|
|
758
|
-
function $t(e6, t2) {
|
|
759
|
-
if (!t2.startsWith(Bt)) return false;
|
|
760
|
-
let n2 = t2.slice(1);
|
|
761
|
-
return e6.length > n2.length && e6.endsWith(n2);
|
|
762
|
-
}
|
|
763
|
-
function en(e6) {
|
|
764
|
-
return !!e6.match(/\._base_domain_$/);
|
|
765
|
-
}
|
|
766
|
-
var tn = `www._base_domain_`;
|
|
767
|
-
function nn(e6, t2) {
|
|
768
|
-
return e6.split(`/`).map((e7) => rn(e7, t2)).join(`/`);
|
|
769
|
-
}
|
|
770
|
-
function rn(e6, t2) {
|
|
771
|
-
let n2 = e6.match(Gt) || [], r2 = n2[1];
|
|
772
|
-
return r2 ? an(t2, r2, e6, e6.replace(n2[0], ``)) : e6;
|
|
773
|
-
}
|
|
774
|
-
function an(e6, t2, n2, r2) {
|
|
775
|
-
let i2 = e6;
|
|
776
|
-
for (let e7 of t2.split(`.`)) {
|
|
777
|
-
if (!i2) return n2;
|
|
778
|
-
i2 = i2[e7];
|
|
779
|
-
}
|
|
780
|
-
return `${i2}${r2}`;
|
|
781
|
-
}
|
|
782
|
-
function on(e6, t2) {
|
|
783
|
-
let n2 = t2?.find((t3) => e6.startsWith(t3.destPath));
|
|
784
|
-
return n2 ? n2.srcPath + e6.slice(n2.destPath.length) : e6;
|
|
785
|
-
}
|
|
786
|
-
function sn(e6) {
|
|
787
|
-
return e6 === `NaN` ? NaN : e6 === `Infinity` ? 1 / 0 : e6 === `-Infinity` ? -1 / 0 : e6;
|
|
788
|
-
}
|
|
789
|
-
var cn = `modulepreload`;
|
|
790
|
-
var ln = function(e6, t2) {
|
|
791
|
-
return new URL(e6, t2).href;
|
|
792
|
-
};
|
|
793
|
-
var un = {};
|
|
794
|
-
var dn = function(e6) {
|
|
795
|
-
return e6.pathname.endsWith(`.css`);
|
|
796
|
-
};
|
|
797
|
-
var fn = function(e6, t2, n2) {
|
|
798
|
-
if (t2 in e6) return e6[t2];
|
|
799
|
-
let r2 = n2();
|
|
800
|
-
if (!r2) {
|
|
801
|
-
e6[t2] = void 0;
|
|
802
|
-
return;
|
|
803
|
-
}
|
|
804
|
-
let i2 = r2.then(() => {
|
|
805
|
-
e6[t2] = void 0;
|
|
806
|
-
}, (n3) => {
|
|
807
|
-
throw e6[t2] = void 0, n3;
|
|
808
|
-
});
|
|
809
|
-
return e6[t2] = i2, i2;
|
|
810
|
-
};
|
|
811
|
-
var pn = function(e6, t2, n2) {
|
|
812
|
-
let r2 = Promise.resolve();
|
|
813
|
-
if (t2 && t2.length > 0) {
|
|
814
|
-
let o3 = function(e8) {
|
|
815
|
-
return Promise.all(e8.map((e9) => Promise.resolve(e9).then((e10) => ({ status: `fulfilled`, value: e10 }), (e10) => ({ status: `rejected`, reason: e10 }))));
|
|
816
|
-
}, s3 = function(e8) {
|
|
817
|
-
return import.meta.resolve ? new URL(import.meta.resolve(e8)) : new URL(e8, import.meta.url);
|
|
818
|
-
};
|
|
819
|
-
var o2 = o3, s2 = s3;
|
|
820
|
-
let e7, i3 = document.querySelector(`meta[property=csp-nonce]`), a2 = i3?.nonce || i3?.getAttribute(`nonce`);
|
|
821
|
-
r2 = o3(t2.map((t3) => {
|
|
822
|
-
t3 = ln(t3, n2);
|
|
823
|
-
let r3 = s3(t3), i4 = dn(r3);
|
|
824
|
-
return fn(un, r3.href, () => {
|
|
825
|
-
if (e7 === void 0) {
|
|
826
|
-
e7 = { all: /* @__PURE__ */ new Set(), styles: /* @__PURE__ */ new Set() };
|
|
827
|
-
let t5 = document.getElementsByTagName(`link`);
|
|
828
|
-
for (let n3 = t5.length - 1; n3 >= 0; n3--) {
|
|
829
|
-
let r4 = t5[n3];
|
|
830
|
-
e7.all.add(r4.href), r4.rel === `stylesheet` && e7.styles.add(r4.href);
|
|
831
|
-
}
|
|
832
|
-
}
|
|
833
|
-
if ((i4 ? e7.styles : e7.all).has(r3.href)) return;
|
|
834
|
-
let t4 = document.createElement(`link`);
|
|
835
|
-
if (t4.rel = i4 ? `stylesheet` : cn, i4 || (t4.as = `script`), t4.crossOrigin = ``, t4.href = r3.href, a2 && t4.setAttribute(`nonce`, a2), document.head.appendChild(t4), i4) return new Promise((e8, n3) => {
|
|
836
|
-
t4.addEventListener(`load`, e8), t4.addEventListener(`error`, () => n3(Error(`Unable to preload CSS for ${r3}`)));
|
|
837
|
-
});
|
|
838
|
-
});
|
|
839
|
-
}).filter((e8) => e8 !== void 0));
|
|
840
|
-
}
|
|
841
|
-
function i2(e7) {
|
|
842
|
-
let t3 = new Event(`vite:preloadError`, { cancelable: true });
|
|
843
|
-
if (t3.payload = e7, window.dispatchEvent(t3), !t3.defaultPrevented) throw e7;
|
|
844
|
-
}
|
|
845
|
-
return r2.then((t3) => {
|
|
846
|
-
for (let e7 of t3 || []) e7.status === `rejected` && i2(e7.reason);
|
|
847
|
-
return e6().catch(i2);
|
|
848
|
-
});
|
|
849
|
-
};
|
|
850
|
-
var mn = `x-wix-linguist`;
|
|
851
|
-
var hn = `00000000-0000-0000-0000-000000000000`;
|
|
852
|
-
var gn = `false`;
|
|
853
|
-
var _n = () => {
|
|
854
|
-
let e6 = bn(`language`), t2 = bn(`locale`);
|
|
855
|
-
if (e6) return { [mn]: [e6, t2 || e6, gn, hn].join(`|`) };
|
|
856
|
-
};
|
|
857
|
-
function vn() {
|
|
858
|
-
let e6 = null, t2 = null;
|
|
859
|
-
return { promise: new Promise((n2, r2) => {
|
|
860
|
-
e6 = n2, t2 = r2;
|
|
861
|
-
}), resolve: e6, reject: t2 };
|
|
862
|
-
}
|
|
863
|
-
var yn = () => (typeof window < `u` ? window.commonConfig : void 0) ?? globalThis.commonConfig;
|
|
864
|
-
var bn = (e6) => yn()?.[e6];
|
|
865
|
-
var xn = ({ createHost: e6 }) => ({ __type: `host`, create: (e7) => ({}), host: (t2) => {
|
|
866
|
-
let { applicationId: n2, componentId: r2 } = t2 ?? {}, i2 = typeof window < `u` ? window.wixEmbedsAPI : void 0, a2 = e6(t2), o2 = Cn();
|
|
867
|
-
return { ...a2, apiBaseUrl: o2, getMonitoringClient: i2?.getMonitoringClientFunction?.(n2, r2), essentials: { language: bn(`language`), locale: bn(`locale`), get passThroughHeaders() {
|
|
868
|
-
return _n();
|
|
869
|
-
} } };
|
|
870
|
-
}, auth: (e7) => {
|
|
871
|
-
let t2 = typeof window < `u` ? window.wixEmbedsAPI : void 0;
|
|
872
|
-
!e7 && Sn() && (e7 = t2?.getAccessTokenFunction?.());
|
|
873
|
-
let n2 = false, { resolve: r2, promise: i2 } = vn();
|
|
874
|
-
return { getAuthHeaders: async () => {
|
|
875
|
-
if (!e7 && n2 && (e7 = await i2), !e7) throw Error(`Failed to resolve auth token`);
|
|
876
|
-
return { headers: { Authorization: await e7() } };
|
|
877
|
-
}, getAccessTokenInjector: () => (n2 = true, (e8) => {
|
|
878
|
-
r2(e8);
|
|
879
|
-
}) };
|
|
880
|
-
} });
|
|
881
|
-
function Sn() {
|
|
882
|
-
return typeof document < `u` && document.currentScript?.tagName === `SCRIPT`;
|
|
883
|
-
}
|
|
884
|
-
function Cn() {
|
|
885
|
-
let e6 = (typeof window < `u` ? window.wixEmbedsAPI : void 0)?.getExternalBaseUrl?.();
|
|
886
|
-
if (!e6) return;
|
|
887
|
-
let t2 = new URL(e6);
|
|
888
|
-
return t2?.pathname && t2.pathname !== `/` ? `${t2.hostname}${t2.pathname}` : t2.hostname;
|
|
889
|
-
}
|
|
890
|
-
var wn = ({ clientSdk: e6, applicationId: t2 }) => ({ invoke: async ({ namespace: n2, method: r2, args: i2 }) => {
|
|
891
|
-
if (!e6) throw Error(`Wix Site SDK only works in a Wix site environment. Learn more: https://dev.wix.com/docs/sdk/host-modules/site/introduction`);
|
|
892
|
-
return e6.invoke({ namespace: n2, method: r2, args: i2, applicationId: t2, accessToken: `accessToken` });
|
|
893
|
-
}, getAccessToken: () => {
|
|
894
|
-
throw Error(`Not implemented`);
|
|
895
|
-
}, observeState: () => ({ disconnect: () => {
|
|
896
|
-
} }) });
|
|
897
|
-
var Tn = xn({ createHost: function(e6) {
|
|
898
|
-
let t2 = (typeof $wixContext < `u` ? $wixContext.clientSdk : void 0) ?? e6?.clientSdk ?? (typeof window < `u` ? window?.clientSdk : void 0), { applicationId: n2 } = e6 || {};
|
|
899
|
-
if (!n2) throw Error(`"createHost" was called without a required field "applicationId"`);
|
|
900
|
-
return { channel: wn({ clientSdk: t2, applicationId: n2 }), close: () => {
|
|
901
|
-
} };
|
|
902
|
-
} });
|
|
903
|
-
var En = (e6, t2) => {
|
|
904
|
-
let n2 = Tn.host({ applicationId: e6, componentId: t2 }), r2 = Tn.auth();
|
|
905
|
-
return We({ auth: r2, host: n2 }).enableContext(`module`), r2.getAccessTokenInjector();
|
|
906
|
-
};
|
|
907
|
-
var Dn = (e6) => En(`14bcded7-0066-7c35-14d7-466cb3f09103`, e6);
|
|
908
|
-
var On = { post: `post`, feed: `feed`, relatedPosts: `related-posts`, comments: `comments`, seo: `seo`, likes: `likes` };
|
|
909
|
-
var kn = (e6, t2) => e6 && typeof e6[t2] == `function` ? e6 : null;
|
|
910
|
-
function An(e6, t2, { feature: n2, action: r2, level: i2 = `error`, contexts: a2 }) {
|
|
911
|
-
let o2 = kn(e6, `captureException`);
|
|
912
|
-
if (!o2) return;
|
|
913
|
-
let s2 = t2 instanceof Error ? t2 : Error(String(t2));
|
|
914
|
-
o2.captureException(s2, { level: i2, tags: { feature: n2, action: r2 }, ...a2 ? { contexts: a2 } : {} });
|
|
915
|
-
}
|
|
916
|
-
function jn(e6) {
|
|
917
|
-
return Object.keys(e6).length === 1 && `$and` in e6 && Array.isArray(e6.$and);
|
|
918
|
-
}
|
|
919
|
-
function Mn(e6) {
|
|
920
|
-
return Object.keys(e6).length === 1 && `$or` in e6 && Array.isArray(e6.$or);
|
|
921
|
-
}
|
|
922
|
-
function Nn(e6) {
|
|
923
|
-
return Object.keys(e6).length === 1 && `$not` in e6 && typeof e6.$not == `object`;
|
|
924
|
-
}
|
|
925
|
-
function P(e6, t2) {
|
|
926
|
-
return e6 === void 0 || Object.keys(e6).length === 0 ? t2 : t2 === void 0 || Object.keys(t2).length === 0 ? e6 : { $and: [...jn(e6) ? e6.$and : [e6], ...jn(t2) ? t2.$and : [t2]] };
|
|
927
|
-
}
|
|
928
|
-
function Pn(e6, t2) {
|
|
929
|
-
return e6 === void 0 || Object.keys(e6).length === 0 ? t2 : t2 === void 0 || Object.keys(t2).length === 0 ? e6 : { $or: [...Mn(e6) ? e6.$or : [e6], ...Mn(t2) ? t2.$or : [t2]] };
|
|
930
|
-
}
|
|
931
|
-
function Fn(e6) {
|
|
932
|
-
if (e6 !== void 0 && Object.keys(e6).length !== 0) return Nn(e6) ? e6.$not : { $not: e6 };
|
|
933
|
-
}
|
|
934
|
-
var In = class {
|
|
935
|
-
_items;
|
|
936
|
-
_fetchNextPage;
|
|
937
|
-
_fetchPrevPage;
|
|
938
|
-
_originQuery;
|
|
939
|
-
_limit;
|
|
940
|
-
constructor({ items: e6, originQuery: t2, fetchNextPage: n2, fetchPrevPage: r2, limit: i2 }) {
|
|
941
|
-
this._items = e6, this._fetchNextPage = n2, this._fetchPrevPage = r2, this._originQuery = t2, this._limit = i2;
|
|
942
|
-
}
|
|
943
|
-
get items() {
|
|
944
|
-
return this._items;
|
|
945
|
-
}
|
|
946
|
-
get length() {
|
|
947
|
-
return this._items.length;
|
|
948
|
-
}
|
|
949
|
-
get pageSize() {
|
|
950
|
-
return this._limit;
|
|
951
|
-
}
|
|
952
|
-
get query() {
|
|
953
|
-
return this._originQuery;
|
|
954
|
-
}
|
|
955
|
-
async next() {
|
|
956
|
-
if (!this.hasNext()) throw Error(`No next page to fetch`);
|
|
957
|
-
return await this._fetchNextPage();
|
|
958
|
-
}
|
|
959
|
-
async prev() {
|
|
960
|
-
if (!this.hasPrev()) throw Error(`No previous page to fetch`);
|
|
961
|
-
return await this._fetchPrevPage();
|
|
962
|
-
}
|
|
963
|
-
};
|
|
964
|
-
var Ln = class extends In {
|
|
965
|
-
_nextCursor;
|
|
966
|
-
_prevCursor;
|
|
967
|
-
cursors;
|
|
968
|
-
constructor({ items: e6, originQuery: t2, fetchNextPage: n2, fetchPrevPage: r2, limit: i2, nextCursor: a2, prevCursor: o2 }) {
|
|
969
|
-
super({ items: e6, originQuery: t2, fetchNextPage: n2, fetchPrevPage: r2, limit: i2 }), this._nextCursor = a2, this._prevCursor = o2, this.cursors = { next: a2, prev: o2 };
|
|
970
|
-
}
|
|
971
|
-
hasNext() {
|
|
972
|
-
return !!this._nextCursor;
|
|
973
|
-
}
|
|
974
|
-
hasPrev() {
|
|
975
|
-
return !!this._prevCursor;
|
|
976
|
-
}
|
|
977
|
-
};
|
|
978
|
-
var Rn = class extends In {
|
|
979
|
-
_totalCount;
|
|
980
|
-
_offset;
|
|
981
|
-
_tooManyToCount;
|
|
982
|
-
constructor({ items: e6, fetchNextPage: t2, fetchPrevPage: n2, offset: r2, originQuery: i2, limit: a2, totalCount: o2, tooManyToCount: s2 }) {
|
|
983
|
-
super({ items: e6, fetchNextPage: t2, fetchPrevPage: n2, originQuery: i2, limit: a2 }), this._totalCount = o2, this._offset = r2, this._tooManyToCount = s2;
|
|
984
|
-
}
|
|
985
|
-
get currentPage() {
|
|
986
|
-
return this._limit === 0 ? void 0 : Math.floor(this._offset / this._limit);
|
|
987
|
-
}
|
|
988
|
-
get totalPages() {
|
|
989
|
-
return this._tooManyToCount || this._limit === 0 ? void 0 : Math.ceil(this._totalCount / this._limit);
|
|
990
|
-
}
|
|
991
|
-
get totalCount() {
|
|
992
|
-
return this._tooManyToCount ? void 0 : this._totalCount;
|
|
993
|
-
}
|
|
994
|
-
hasNext() {
|
|
995
|
-
return this._limit !== 0 && this.currentPage !== void 0 && this.totalPages !== void 0 && this.currentPage < this.totalPages - 1;
|
|
996
|
-
}
|
|
997
|
-
hasPrev() {
|
|
998
|
-
return !!(this._limit !== 0 && this.currentPage && this.currentPage > 0);
|
|
999
|
-
}
|
|
1000
|
-
};
|
|
1001
|
-
function zn(e6) {
|
|
1002
|
-
let t2 = (n2) => ({ query: n2, async find() {
|
|
1003
|
-
try {
|
|
1004
|
-
let r2 = e6.requestTransformer(e6.pagingMethod === `CURSOR` && n2.cursorPaging.cursor ? { cursorPaging: n2.cursorPaging } : n2), i2 = await e6.func(r2), { [Je]: a2, [Ye]: o2 } = e6.responseTransformer(i2);
|
|
1005
|
-
if (e6.pagingMethod === `OFFSET`) {
|
|
1006
|
-
let e7 = n2;
|
|
1007
|
-
return new Rn({ items: a2 ?? [], fetchNextPage: () => t2({ ...e7, paging: { offset: e7.paging.offset + e7.paging.limit, limit: e7.paging.limit } }).find(), fetchPrevPage: () => t2({ ...n2, paging: { offset: Math.max(e7.paging.offset - e7.paging.limit, 0), limit: e7.paging.limit } }).find(), offset: e7.paging.offset, limit: e7.paging.limit, totalCount: o2?.total, tooManyToCount: o2?.tooManyToCount, originQuery: this });
|
|
1008
|
-
}
|
|
1009
|
-
let s2 = n2.cursorPaging;
|
|
1010
|
-
return new Ln({ items: a2 ?? [], limit: s2.limit, originQuery: this, fetchNextPage: () => t2({ ...n2, cursorPaging: { cursor: o2?.cursors?.next ?? void 0, limit: s2.limit } }).find(), fetchPrevPage: () => t2({ ...n2, cursorPaging: { cursor: o2?.cursors?.prev ?? void 0, limit: s2.limit } }).find(), prevCursor: o2?.cursors?.prev ?? void 0, nextCursor: o2?.cursors?.next ?? void 0 });
|
|
1011
|
-
} catch (t3) {
|
|
1012
|
-
throw e6.errorTransformer(t3);
|
|
1013
|
-
}
|
|
1014
|
-
}, skipTo(e7) {
|
|
1015
|
-
return t2({ ...n2, cursorPaging: { cursor: e7, limit: n2.cursorPaging.limit } });
|
|
1016
|
-
}, eq(r2, i2) {
|
|
1017
|
-
let a2 = i2 === void 0 ? null : i2, o2 = { [F(e6.transformationPaths, r2)]: a2 };
|
|
1018
|
-
return t2({ ...n2, filter: P(n2.filter, o2) });
|
|
1019
|
-
}, ne(r2, i2) {
|
|
1020
|
-
let a2 = i2 === void 0 ? null : i2, o2 = { [F(e6.transformationPaths, r2)]: { $ne: a2 } };
|
|
1021
|
-
return t2({ ...n2, filter: P(n2.filter, o2) });
|
|
1022
|
-
}, ge(r2, i2) {
|
|
1023
|
-
let a2 = { [F(e6.transformationPaths, r2)]: { $gte: i2 } };
|
|
1024
|
-
return t2({ ...n2, filter: P(n2.filter, a2) });
|
|
1025
|
-
}, gt(r2, i2) {
|
|
1026
|
-
let a2 = { [F(e6.transformationPaths, r2)]: { $gt: i2 } };
|
|
1027
|
-
return t2({ ...n2, filter: P(n2.filter, a2) });
|
|
1028
|
-
}, le(r2, i2) {
|
|
1029
|
-
let a2 = { [F(e6.transformationPaths, r2)]: { $lte: i2 } };
|
|
1030
|
-
return t2({ ...n2, filter: P(n2.filter, a2) });
|
|
1031
|
-
}, lt(r2, i2) {
|
|
1032
|
-
let a2 = { [F(e6.transformationPaths, r2)]: { $lt: i2 } };
|
|
1033
|
-
return t2({ ...n2, filter: P(n2.filter, a2) });
|
|
1034
|
-
}, isNotEmpty(e7) {
|
|
1035
|
-
return this.ne(e7, null);
|
|
1036
|
-
}, isEmpty(e7) {
|
|
1037
|
-
return this.eq(e7, null);
|
|
1038
|
-
}, startsWith(r2, i2) {
|
|
1039
|
-
let a2 = { [F(e6.transformationPaths, r2)]: { $startsWith: i2 } };
|
|
1040
|
-
return t2({ ...n2, filter: P(n2.filter, a2) });
|
|
1041
|
-
}, endsWith(r2, i2) {
|
|
1042
|
-
let a2 = { [F(e6.transformationPaths, r2)]: { $endsWith: i2 } };
|
|
1043
|
-
return t2({ ...n2, filter: P(n2.filter, a2) });
|
|
1044
|
-
}, contains(r2, i2) {
|
|
1045
|
-
let a2 = { [F(e6.transformationPaths, r2)]: { $contains: i2 } };
|
|
1046
|
-
return t2({ ...n2, filter: P(n2.filter, a2) });
|
|
1047
|
-
}, hasSome(r2, ...i2) {
|
|
1048
|
-
let a2 = { [F(e6.transformationPaths, r2)]: { $hasSome: Array.isArray(i2[0]) ? i2[0] : i2 } };
|
|
1049
|
-
return t2({ ...n2, filter: P(n2.filter, a2) });
|
|
1050
|
-
}, hasAll(r2, ...i2) {
|
|
1051
|
-
let a2 = { [F(e6.transformationPaths, r2)]: { $hasAll: Array.isArray(i2[0]) ? i2[0] : i2 } };
|
|
1052
|
-
return t2({ ...n2, filter: P(n2.filter, a2) });
|
|
1053
|
-
}, between(e7, t3, n3) {
|
|
1054
|
-
return this.ge(e7, t3).lt(e7, n3);
|
|
1055
|
-
}, in(r2, i2) {
|
|
1056
|
-
let a2 = { [F(e6.transformationPaths, r2)]: { $in: i2 } };
|
|
1057
|
-
return t2({ ...n2, filter: P(n2.filter, a2) });
|
|
1058
|
-
}, exists(r2, i2 = true) {
|
|
1059
|
-
let a2 = { [F(e6.transformationPaths, r2)]: { $exists: i2 } };
|
|
1060
|
-
return t2({ ...n2, filter: P(n2.filter, a2) });
|
|
1061
|
-
}, or(e7) {
|
|
1062
|
-
return t2({ ...n2, filter: Pn(n2.filter, e7.query.filter) });
|
|
1063
|
-
}, and(e7) {
|
|
1064
|
-
return t2({ ...n2, filter: P(n2.filter, e7.query.filter) });
|
|
1065
|
-
}, not(e7) {
|
|
1066
|
-
return t2({ ...n2, filter: Fn(e7.query.filter) });
|
|
1067
|
-
}, ascending(...r2) {
|
|
1068
|
-
return t2({ ...n2, sort: [...n2.sort ?? [], ...r2.map((t3) => ({ fieldName: F(e6.transformationPaths, t3), order: `ASC` }))] });
|
|
1069
|
-
}, descending(...r2) {
|
|
1070
|
-
return t2({ ...n2, sort: [...n2.sort ?? [], ...r2.map((t3) => ({ fieldName: F(e6.transformationPaths, t3), order: `DESC` }))] });
|
|
1071
|
-
}, skip(e7) {
|
|
1072
|
-
return t2({ ...n2, paging: { offset: e7, limit: `limit` in n2.paging ? n2.paging.limit : 50 } });
|
|
1073
|
-
}, limit(r2) {
|
|
1074
|
-
if (e6.pagingMethod === `CURSOR`) {
|
|
1075
|
-
let e7 = n2;
|
|
1076
|
-
return t2({ ...n2, cursorPaging: { limit: r2, cursor: `cursor` in e7.cursorPaging ? e7.cursorPaging.cursor : void 0 } });
|
|
1077
|
-
}
|
|
1078
|
-
let i2 = n2;
|
|
1079
|
-
return t2({ ...n2, paging: { limit: r2, offset: `offset` in i2.paging ? i2.paging.offset : 0 } });
|
|
1080
|
-
} });
|
|
1081
|
-
return t2({ filter: {}, ...e6.pagingMethod === `OFFSET` ? { paging: { offset: 0, limit: 50 } } : { cursorPaging: { limit: 50 } } });
|
|
1082
|
-
}
|
|
1083
|
-
function F(e6, t2) {
|
|
1084
|
-
let n2 = Object.entries(e6).find(([e7]) => e7 === t2 || t2.startsWith(`${e7}.`))?.[0];
|
|
1085
|
-
return n2 ? t2.replace(n2, e6[n2]) : Ze(t2, { ...e6, ...Xe });
|
|
1086
|
-
}
|
|
1087
|
-
var Bn = `filter`;
|
|
1088
|
-
var Vn = `sort`;
|
|
1089
|
-
var Hn = `cursorPaging`;
|
|
1090
|
-
var Un = `paging`;
|
|
1091
|
-
var Wn = [Bn, Vn, Hn];
|
|
1092
|
-
var Gn = [Bn, Vn, Un];
|
|
1093
|
-
function Kn(e6, t2) {
|
|
1094
|
-
return !e6 || typeof e6 != `object` ? false : t2.some((t3) => e6.hasOwnProperty(t3));
|
|
1095
|
-
}
|
|
1096
|
-
function qn(e6) {
|
|
1097
|
-
return Kn(e6, Wn);
|
|
1098
|
-
}
|
|
1099
|
-
function Jn(e6) {
|
|
1100
|
-
return Kn(e6, Gn);
|
|
1101
|
-
}
|
|
1102
|
-
function Yn(e6) {
|
|
1103
|
-
let { hasOptionsParameter: t2 } = e6;
|
|
1104
|
-
return function(...n2) {
|
|
1105
|
-
return t2 ? Zn(n2, e6) : Xn(n2, e6);
|
|
1106
|
-
};
|
|
1107
|
-
}
|
|
1108
|
-
function Xn(e6, t2) {
|
|
1109
|
-
return e6.length === 0 ? t2.builderQueryFunction() : t2.typedQueryFunction(e6[0]);
|
|
1110
|
-
}
|
|
1111
|
-
function Zn(e6, t2) {
|
|
1112
|
-
switch (e6.length) {
|
|
1113
|
-
case 0:
|
|
1114
|
-
return t2.builderQueryFunction();
|
|
1115
|
-
case 1:
|
|
1116
|
-
return qn(e6[0]) || Jn(e6[0]) ? t2.typedQueryFunction(e6[0]) : t2.builderQueryFunction(e6[0]);
|
|
1117
|
-
default:
|
|
1118
|
-
return t2.typedQueryFunction(e6[0], e6[1]);
|
|
1119
|
-
}
|
|
1120
|
-
}
|
|
1121
|
-
var Qn = [{ path: `like.createdDate` }];
|
|
1122
|
-
var $n = [{ path: `likes.createdDate` }];
|
|
1123
|
-
function er(e6) {
|
|
1124
|
-
return Pt(Object.assign(e6, { domainToMappings: { _: [{ srcPath: `/_api/blog-like-service`, destPath: `` }], "api._api_base_domain_": [{ srcPath: `/blog-like-service`, destPath: `` }], "social-blog._base_domain_": [{ srcPath: `/_api/blog-like-service`, destPath: `` }], "manage._base_domain_": [{ srcPath: `/_api/blog-like-service`, destPath: `` }], "apps._base_domain_": [{ srcPath: `/_api/blog-like-service`, destPath: `` }], "www.wixapis.com": [{ srcPath: `/blog/v1/likes`, destPath: `/v1/likes` }], "*.dev.wix-code.com": [{ srcPath: `/blog/v1/likes`, destPath: `/v1/likes` }] } }));
|
|
1125
|
-
}
|
|
1126
|
-
var tr = `@wix/auto_sdk_blog_likes`;
|
|
1127
|
-
function nr(e6) {
|
|
1128
|
-
function t2({ host: t3 }) {
|
|
1129
|
-
let n2 = j(e6, [{ transformFn: nt, paths: Qn }]);
|
|
1130
|
-
return { entityFqdn: `wix.blog.v1.like`, method: `POST`, methodFqn: `wix.blog.v1.LikeService.CreateLike`, packageName: tr, migrationOptions: { optInTransformResponse: true }, url: er({ protoPath: `/v1/likes`, data: n2, host: t3 }), data: n2, transformResponse: (e7) => j(e7, [{ transformFn: rt, paths: Qn }]) };
|
|
1131
|
-
}
|
|
1132
|
-
return t2;
|
|
1133
|
-
}
|
|
1134
|
-
function rr(e6) {
|
|
1135
|
-
function t2({ host: t3 }) {
|
|
1136
|
-
return { entityFqdn: `wix.blog.v1.like`, method: `POST`, methodFqn: `wix.blog.v1.LikeService.QueryLikes`, packageName: tr, migrationOptions: { optInTransformResponse: true }, url: er({ protoPath: `/v1/likes/query`, data: e6, host: t3 }), data: e6, transformResponse: (e7) => j(e7, [{ transformFn: rt, paths: $n }]) };
|
|
1137
|
-
}
|
|
1138
|
-
return t2;
|
|
1139
|
-
}
|
|
1140
|
-
function ir(e6) {
|
|
1141
|
-
function t2({ host: t3 }) {
|
|
1142
|
-
return { entityFqdn: `wix.blog.v1.like`, method: `DELETE`, methodFqn: `wix.blog.v1.LikeService.DeleteLikeByFqdnAndEntityId`, packageName: tr, migrationOptions: { optInTransformResponse: true }, url: er({ protoPath: `/v1/likes/fqdn/{fqdn}/entity-id/{entityId}`, data: e6, host: t3 }), params: Nt(e6) };
|
|
1143
|
-
}
|
|
1144
|
-
return t2;
|
|
1145
|
-
}
|
|
1146
|
-
async function ar(e6) {
|
|
1147
|
-
let { httpClient: t2, sideEffects: n2 } = arguments[1], r2 = nr(D({ like: e6?.like }));
|
|
1148
|
-
n2?.onSiteCall?.();
|
|
1149
|
-
try {
|
|
1150
|
-
let e7 = await t2.request(r2);
|
|
1151
|
-
return n2?.onSuccess?.(e7), O(e7.data)?.like;
|
|
1152
|
-
} catch (e7) {
|
|
1153
|
-
let t3 = M(e7, { spreadPathsToArguments: {}, explicitPathsToArguments: { like: `$[0].like` }, singleArgumentUnchanged: false }, [`options`]);
|
|
1154
|
-
throw n2?.onError?.(e7), t3;
|
|
1155
|
-
}
|
|
1156
|
-
}
|
|
1157
|
-
function or() {
|
|
1158
|
-
let { httpClient: e6, sideEffects: t2 } = arguments[0];
|
|
1159
|
-
return zn({ func: async (n2) => {
|
|
1160
|
-
let r2 = rr(n2);
|
|
1161
|
-
t2?.onSiteCall?.();
|
|
1162
|
-
try {
|
|
1163
|
-
let n3 = await e6.request(r2);
|
|
1164
|
-
return t2?.onSuccess?.(n3), n3;
|
|
1165
|
-
} catch (e7) {
|
|
1166
|
-
throw t2?.onError?.(e7), e7;
|
|
1167
|
-
}
|
|
1168
|
-
}, requestTransformer: (e7) => {
|
|
1169
|
-
let t3 = [e7, {}];
|
|
1170
|
-
return D({ ...t3?.[1], query: t3?.[0] });
|
|
1171
|
-
}, responseTransformer: ({ data: e7 }) => {
|
|
1172
|
-
let t3 = O(j(e7, []));
|
|
1173
|
-
return { items: t3?.likes, pagingMetadata: t3?.pagingMetadata };
|
|
1174
|
-
}, errorTransformer: (e7) => {
|
|
1175
|
-
throw M(e7, { spreadPathsToArguments: {}, explicitPathsToArguments: { query: `$[0]` }, singleArgumentUnchanged: false });
|
|
1176
|
-
}, pagingMethod: `CURSOR`, transformationPaths: {} });
|
|
1177
|
-
}
|
|
1178
|
-
async function sr(e6) {
|
|
1179
|
-
let { httpClient: t2, sideEffects: n2 } = arguments[1], r2 = rr(D({ query: e6 }));
|
|
1180
|
-
n2?.onSiteCall?.();
|
|
1181
|
-
try {
|
|
1182
|
-
let e7 = await t2.request(r2);
|
|
1183
|
-
return n2?.onSuccess?.(e7), O(e7.data);
|
|
1184
|
-
} catch (e7) {
|
|
1185
|
-
let t3 = M(e7, { spreadPathsToArguments: {}, explicitPathsToArguments: { query: `$[0]` }, singleArgumentUnchanged: false }, [`query`]);
|
|
1186
|
-
throw n2?.onError?.(e7), t3;
|
|
1187
|
-
}
|
|
1188
|
-
}
|
|
1189
|
-
async function cr(e6) {
|
|
1190
|
-
let { httpClient: t2, sideEffects: n2 } = arguments[1], r2 = ir(D({ fqdn: e6?.fqdn, entityId: e6?.entityId }));
|
|
1191
|
-
n2?.onSiteCall?.();
|
|
1192
|
-
try {
|
|
1193
|
-
let e7 = await t2.request(r2);
|
|
1194
|
-
n2?.onSuccess?.(e7);
|
|
1195
|
-
} catch (e7) {
|
|
1196
|
-
let t3 = M(e7, { spreadPathsToArguments: {}, explicitPathsToArguments: { fqdn: `$[0].fqdn`, entityId: `$[0].entityId` }, singleArgumentUnchanged: false }, [`identifiers`]);
|
|
1197
|
-
throw n2?.onError?.(e7), t3;
|
|
1198
|
-
}
|
|
1199
|
-
}
|
|
1200
|
-
function lr(e6) {
|
|
1201
|
-
return (t2) => ar(t2, { httpClient: e6 });
|
|
1202
|
-
}
|
|
1203
|
-
function ur(e6) {
|
|
1204
|
-
return () => or({ httpClient: e6 });
|
|
1205
|
-
}
|
|
1206
|
-
function dr(e6) {
|
|
1207
|
-
return (t2) => sr(t2, { httpClient: e6 });
|
|
1208
|
-
}
|
|
1209
|
-
function fr(e6) {
|
|
1210
|
-
return (t2) => cr(t2, { httpClient: e6 });
|
|
1211
|
-
}
|
|
1212
|
-
function pr(e6) {
|
|
1213
|
-
let t2 = Yn({ builderQueryFunction: () => ur(e6)(), typedQueryFunction: (t3) => dr(e6)(t3), hasOptionsParameter: false });
|
|
1214
|
-
function n2(e7) {
|
|
1215
|
-
return t2(...arguments);
|
|
1216
|
-
}
|
|
1217
|
-
return n2;
|
|
1218
|
-
}
|
|
1219
|
-
var mr = Mt(lr);
|
|
1220
|
-
var hr = Mt(fr);
|
|
1221
|
-
var gr = Mt(pr);
|
|
1222
|
-
var _r = [{ path: `metrics.averageRating` }];
|
|
1223
|
-
function vr(e6) {
|
|
1224
|
-
return Pt(Object.assign(e6, { domainToMappings: { _: [{ srcPath: `/_api/communities-blog-node-api/v3/posts`, destPath: `/v3/posts` }], "apps._base_domain_": [{ srcPath: `/_api/communities-blog-node-api/v3/posts`, destPath: `/v3/posts` }], "www._base_domain_": [{ srcPath: `/_api/communities-blog-node-api/v3/posts`, destPath: `/v3/posts` }], "www.wixapis.com": [{ srcPath: `/v3/posts`, destPath: `/v3/posts` }, { srcPath: `/blog/v3/posts`, destPath: `/v3/posts` }, { srcPath: `/_api/v3/posts`, destPath: `/v3/posts` }], "manage._base_domain_": [{ srcPath: `/_api/communities-blog-node-api/v3/posts`, destPath: `/v3/posts` }, { srcPath: `/_api/post-service-api-proxy/v3/bulk/posts`, destPath: `/v3/bulk/posts` }], "*.dev.wix-code.com": [{ srcPath: `/_api/communities-blog-node-api/v3/posts`, destPath: `/v3/posts` }], "editor._base_domain_": [{ srcPath: `/_api/communities-blog-node-api/v3/posts`, destPath: `/v3/posts` }], "blocks._base_domain_": [{ srcPath: `/_api/communities-blog-node-api/v3/posts`, destPath: `/v3/posts` }], "create.editorx": [{ srcPath: `/_api/communities-blog-node-api/v3/posts`, destPath: `/v3/posts` }], "editor.wixapps.net": [{ srcPath: `/_api/communities-blog-node-api/v3/posts`, destPath: `/v3/posts` }], "dev._base_domain_": [{ srcPath: `/_api/communities-blog-node-api/v3/posts`, destPath: `/v3/posts` }] } }));
|
|
1225
|
-
}
|
|
1226
|
-
var yr = `@wix/auto_sdk_blog_posts`;
|
|
1227
|
-
function br(e6) {
|
|
1228
|
-
function t2({ host: t3 }) {
|
|
1229
|
-
return { entityFqdn: `wix.blog.v3.post`, method: `GET`, methodFqn: `com.wixpress.npm.communities.platformized.blog.v3.PostService.GetPostMetrics`, packageName: yr, migrationOptions: { optInTransformResponse: true }, url: vr({ protoPath: `/v3/posts/{postId}/metrics`, data: e6, host: t3 }), params: Nt(e6), transformResponse: (e7) => j(e7, [{ transformFn: sn, paths: _r }]) };
|
|
1230
|
-
}
|
|
1231
|
-
return t2;
|
|
1232
|
-
}
|
|
1233
|
-
async function xr(e6) {
|
|
1234
|
-
let { httpClient: t2, sideEffects: n2 } = arguments[1], r2 = br(D({ postId: e6 }, []));
|
|
1235
|
-
n2?.onSiteCall?.();
|
|
1236
|
-
try {
|
|
1237
|
-
let e7 = await t2.request(r2);
|
|
1238
|
-
return n2?.onSuccess?.(e7), O(e7.data, []);
|
|
1239
|
-
} catch (e7) {
|
|
1240
|
-
let t3 = M(e7, { spreadPathsToArguments: {}, explicitPathsToArguments: { postId: `$[0]` }, singleArgumentUnchanged: false }, [`postId`]);
|
|
1241
|
-
throw n2?.onError?.(e7), t3;
|
|
1242
|
-
}
|
|
1243
|
-
}
|
|
1244
|
-
function Sr(e6) {
|
|
1245
|
-
return (t2) => xr(t2, { httpClient: e6 });
|
|
1246
|
-
}
|
|
1247
|
-
var Cr = Mt(Sr);
|
|
1248
|
-
var wr = `wix.blog.v3.post`;
|
|
1249
|
-
var Tr = async (e6) => {
|
|
1250
|
-
await mr({ like: { entityId: e6, fqdn: wr } });
|
|
1251
|
-
};
|
|
1252
|
-
var Er = async (e6) => {
|
|
1253
|
-
await hr({ fqdn: wr, entityId: e6 });
|
|
1254
|
-
};
|
|
1255
|
-
var Dr = (e6) => typeof e6 == `number` ? e6 : void 0;
|
|
1256
|
-
var Or = async (e6) => {
|
|
1257
|
-
let [t2, n2] = await Promise.allSettled([gr().eq(`fqdn`, wr).eq(`entityId`, e6).limit(1).find(), Cr(e6)]), r2 = n2.status === `fulfilled` ? n2.value.metrics : void 0;
|
|
1258
|
-
return { liked: t2.status === `fulfilled` && t2.value.items.length > 0, likeCount: Dr(r2?.likes), viewCount: Dr(r2?.views), commentCount: Dr(r2?.comments) };
|
|
1259
|
-
};
|
|
1260
|
-
function I(e6) {
|
|
1261
|
-
return e6;
|
|
1262
|
-
}
|
|
1263
|
-
var kr = I(`@wix/site-service-editor-context`);
|
|
1264
|
-
var Ar = () => {
|
|
1265
|
-
try {
|
|
1266
|
-
return !!u(kr).previewMode;
|
|
1267
|
-
} catch {
|
|
1268
|
-
return false;
|
|
1269
|
-
}
|
|
1270
|
-
};
|
|
1271
|
-
var jr = I(`@wix/viewer-service-site-members`);
|
|
1272
|
-
var Mr = () => {
|
|
1273
|
-
try {
|
|
1274
|
-
return u(jr);
|
|
1275
|
-
} catch {
|
|
1276
|
-
return;
|
|
1277
|
-
}
|
|
1278
|
-
};
|
|
1279
|
-
var Nr = { liked: false, baselineLiked: false, freshLikeCount: void 0, viewCount: void 0, commentCount: void 0, isLikeCountLoaded: false };
|
|
1280
|
-
var L = `wix-blog:post-like-toggled`;
|
|
1281
|
-
var Pr = () => {
|
|
1282
|
-
let e6 = window;
|
|
1283
|
-
return e6[L] ??= /* @__PURE__ */ new Map();
|
|
1284
|
-
};
|
|
1285
|
-
var Fr = (e6) => {
|
|
1286
|
-
Pr().set(e6.postId, e6.liked), window.dispatchEvent(new CustomEvent(L, { detail: e6 }));
|
|
1287
|
-
};
|
|
1288
|
-
var Ir = (e6, t2) => ({ isLiked: e6.liked, likeCount: Math.max(0, (e6.freshLikeCount ?? t2) + Number(e6.liked) - Number(e6.baselineLiked)), isLikeCountLoaded: e6.isLikeCountLoaded, viewCount: e6.viewCount, commentCount: e6.commentCount });
|
|
1289
|
-
var Lr = (e6, t2, n2 = false, a2) => {
|
|
1290
|
-
let u2 = Ar() || n2, [d2, f2] = l(Nr), p2 = c(Nr), m2 = c(t2), h2 = c(/* @__PURE__ */ new Set()), g2 = c(false), _2 = c(false), v2 = c(void 0), y2 = Mr(), [b2, x2] = l(0);
|
|
1291
|
-
o(() => {
|
|
1292
|
-
let e7 = y2?.addMemberLoginListener?.(() => {
|
|
1293
|
-
Pr().clear(), x2((e8) => e8 + 1);
|
|
1294
|
-
});
|
|
1295
|
-
return () => {
|
|
1296
|
-
e7 !== void 0 && y2?.removeMemberLoginListener?.(e7);
|
|
1297
|
-
};
|
|
1298
|
-
}, [y2]);
|
|
1299
|
-
let S2 = i((e7) => {
|
|
1300
|
-
let t3 = p2.current, n3 = { ...t3, ...e7 };
|
|
1301
|
-
Object.keys(n3).every((e8) => n3[e8] === t3[e8]) || (p2.current = n3, h2.current.forEach((e8) => e8()), r(() => f2(n3)));
|
|
1302
|
-
}, []), C2 = s(() => ({ get: () => Ir(p2.current, m2.current), subscribe: (e7) => (h2.current.add(e7), () => {
|
|
1303
|
-
h2.current.delete(e7);
|
|
1304
|
-
}) }), []);
|
|
1305
|
-
o(() => {
|
|
1306
|
-
m2.current !== t2 && (m2.current = t2, h2.current.forEach((e7) => e7()));
|
|
1307
|
-
}, [t2]), o(() => {
|
|
1308
|
-
if (v2.current !== e6 && (v2.current = e6, S2(Nr)), _2.current = false, !e6 || u2) {
|
|
1309
|
-
S2({ isLikeCountLoaded: true });
|
|
1310
|
-
return;
|
|
1311
|
-
}
|
|
1312
|
-
let t3 = false;
|
|
1313
|
-
return Or(e6).then(({ liked: e7, likeCount: n3, viewCount: r2, commentCount: i2 }) => {
|
|
1314
|
-
t3 || S2({ isLikeCountLoaded: true, viewCount: r2, commentCount: i2, baselineLiked: e7, freshLikeCount: n3, ...!_2.current && { liked: e7 } });
|
|
1315
|
-
}).catch((n3) => {
|
|
1316
|
-
t3 || S2({ isLikeCountLoaded: true }), An(a2, n3, { feature: On.likes, action: `read-like-state`, level: `warning`, contexts: { likes: { postId: e6 } } });
|
|
1317
|
-
}), () => {
|
|
1318
|
-
t3 = true;
|
|
1319
|
-
};
|
|
1320
|
-
}, [e6, u2, a2, S2, b2]), o(() => {
|
|
1321
|
-
if (!e6) return;
|
|
1322
|
-
let t3 = (e7) => {
|
|
1323
|
-
_2.current = true, S2({ liked: e7 });
|
|
1324
|
-
}, n3 = Pr().get(e6);
|
|
1325
|
-
n3 !== void 0 && t3(n3);
|
|
1326
|
-
let r2 = (n4) => {
|
|
1327
|
-
let { detail: r3 } = n4;
|
|
1328
|
-
r3.postId === e6 && t3(r3.liked);
|
|
1329
|
-
};
|
|
1330
|
-
return window.addEventListener(L, r2), () => window.removeEventListener(L, r2);
|
|
1331
|
-
}, [e6, S2]);
|
|
1332
|
-
let ee2 = i(async (t3) => {
|
|
1333
|
-
if (!e6 || g2.current) return;
|
|
1334
|
-
_2.current = true;
|
|
1335
|
-
let n3 = !p2.current.liked;
|
|
1336
|
-
if (S2({ liked: n3 }), Fr({ postId: e6, liked: n3 }), !u2) {
|
|
1337
|
-
g2.current = true;
|
|
1338
|
-
try {
|
|
1339
|
-
await (n3 ? Tr(e6) : Er(e6));
|
|
1340
|
-
} catch (t4) {
|
|
1341
|
-
S2({ liked: !n3 }), Fr({ postId: e6, liked: !n3 }), An(a2, t4, { feature: On.likes, action: n3 ? `like-post` : `unlike-post`, contexts: { likes: { postId: e6 } } });
|
|
1342
|
-
} finally {
|
|
1343
|
-
g2.current = false;
|
|
1344
|
-
}
|
|
1345
|
-
}
|
|
1346
|
-
}, [e6, u2, a2, S2]);
|
|
1347
|
-
return { ...Ir(d2, t2), toggleLike: ee2, liveLikes: C2 };
|
|
1348
|
-
};
|
|
1349
|
-
var Rr = I(`@wix/site-service-locale`);
|
|
1350
|
-
var zr = () => {
|
|
1351
|
-
try {
|
|
1352
|
-
let { locale: e6, language: t2 } = u(Rr);
|
|
1353
|
-
return e6 || t2;
|
|
1354
|
-
} catch {
|
|
1355
|
-
return;
|
|
1356
|
-
}
|
|
1357
|
-
};
|
|
1358
|
-
var Br = () => {
|
|
1359
|
-
let e6 = /* @__PURE__ */ new Map();
|
|
1360
|
-
return { getOrInsert: (t2, n2) => (e6.has(t2) || e6.set(t2, n2().finally(() => {
|
|
1361
|
-
e6.delete(t2);
|
|
1362
|
-
})), e6.get(t2)) };
|
|
1363
|
-
};
|
|
1364
|
-
var Vr = async (e6) => {
|
|
1365
|
-
try {
|
|
1366
|
-
let { default: t2 } = await e6();
|
|
1367
|
-
return t2;
|
|
1368
|
-
} catch {
|
|
1369
|
-
return;
|
|
1370
|
-
}
|
|
1371
|
-
};
|
|
1372
|
-
var Hr = ({ isDev: e6, loadMessages: t2, loadDevMessages: n2 }) => {
|
|
1373
|
-
let r2 = Br(), i2 = async (r3) => {
|
|
1374
|
-
let [i3, a2] = await Promise.all([Vr(() => t2(r3)), !e6 || !n2 ? void 0 : Vr(() => n2(r3))]);
|
|
1375
|
-
if (i3 && a2) return { ...i3, ...a2 };
|
|
1376
|
-
if (i3) return i3;
|
|
1377
|
-
if (a2) return a2;
|
|
1378
|
-
throw Error(`No translation files found for ${r3}`);
|
|
1379
|
-
};
|
|
1380
|
-
return (e7) => r2.getOrInsert(e7, () => i2(e7));
|
|
1381
|
-
};
|
|
1382
|
-
var R = (e6) => typeof e6 == `string`;
|
|
1383
|
-
var z = () => {
|
|
1384
|
-
let e6, t2, n2 = new Promise((n3, r2) => {
|
|
1385
|
-
e6 = n3, t2 = r2;
|
|
1386
|
-
});
|
|
1387
|
-
return n2.resolve = e6, n2.reject = t2, n2;
|
|
1388
|
-
};
|
|
1389
|
-
var Ur = (e6) => e6 == null ? `` : String(e6);
|
|
1390
|
-
var Wr = (e6, t2, n2) => {
|
|
1391
|
-
e6.forEach((e7) => {
|
|
1392
|
-
t2[e7] && (n2[e7] = t2[e7]);
|
|
1393
|
-
});
|
|
1394
|
-
};
|
|
1395
|
-
var Gr = /###/g;
|
|
1396
|
-
var Kr = (e6) => e6 && e6.includes(`###`) ? e6.replace(Gr, `.`) : e6;
|
|
1397
|
-
var qr = (e6) => !e6 || R(e6);
|
|
1398
|
-
var B = (e6, t2, n2) => {
|
|
1399
|
-
let r2 = R(t2) ? t2.split(`.`) : t2, i2 = 0;
|
|
1400
|
-
for (; i2 < r2.length - 1; ) {
|
|
1401
|
-
if (qr(e6)) return {};
|
|
1402
|
-
let t3 = Kr(r2[i2]);
|
|
1403
|
-
!e6[t3] && n2 && (e6[t3] = new n2()), e6 = Object.prototype.hasOwnProperty.call(e6, t3) ? e6[t3] : {}, ++i2;
|
|
1404
|
-
}
|
|
1405
|
-
return qr(e6) ? {} : { obj: e6, k: Kr(r2[i2]) };
|
|
1406
|
-
};
|
|
1407
|
-
var Jr = (e6, t2, n2) => {
|
|
1408
|
-
let { obj: r2, k: i2 } = B(e6, t2, Object);
|
|
1409
|
-
if (r2 !== void 0 || t2.length === 1) {
|
|
1410
|
-
r2[i2] = n2;
|
|
1411
|
-
return;
|
|
1412
|
-
}
|
|
1413
|
-
let a2 = t2[t2.length - 1], o2 = t2.slice(0, t2.length - 1), s2 = B(e6, o2, Object);
|
|
1414
|
-
for (; s2.obj === void 0 && o2.length; ) a2 = `${o2[o2.length - 1]}.${a2}`, o2 = o2.slice(0, o2.length - 1), s2 = B(e6, o2, Object), s2?.obj && s2.obj[`${s2.k}.${a2}`] !== void 0 && (s2.obj = void 0);
|
|
1415
|
-
s2.obj[`${s2.k}.${a2}`] = n2;
|
|
1416
|
-
};
|
|
1417
|
-
var Yr = (e6, t2, n2, r2) => {
|
|
1418
|
-
let { obj: i2, k: a2 } = B(e6, t2, Object);
|
|
1419
|
-
i2[a2] = i2[a2] || [], i2[a2].push(n2);
|
|
1420
|
-
};
|
|
1421
|
-
var V = (e6, t2) => {
|
|
1422
|
-
let { obj: n2, k: r2 } = B(e6, t2);
|
|
1423
|
-
if (n2 && Object.prototype.hasOwnProperty.call(n2, r2)) return n2[r2];
|
|
1424
|
-
};
|
|
1425
|
-
var Xr = (e6, t2, n2) => {
|
|
1426
|
-
let r2 = V(e6, n2);
|
|
1427
|
-
return r2 === void 0 ? V(t2, n2) : r2;
|
|
1428
|
-
};
|
|
1429
|
-
var Zr = (e6, t2, n2) => {
|
|
1430
|
-
for (let r2 in t2) r2 !== `__proto__` && r2 !== `constructor` && (Object.prototype.hasOwnProperty.call(e6, r2) ? R(e6[r2]) || e6[r2] instanceof String || R(t2[r2]) || t2[r2] instanceof String ? n2 && (e6[r2] = t2[r2]) : Zr(e6[r2], t2[r2], n2) : e6[r2] = t2[r2]);
|
|
1431
|
-
return e6;
|
|
1432
|
-
};
|
|
1433
|
-
var H = (e6) => e6.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, `\\$&`);
|
|
1434
|
-
var Qr = { "&": `&`, "<": `<`, ">": `>`, '"': `"`, "'": `'`, "/": `/` };
|
|
1435
|
-
var $r = (e6) => R(e6) ? e6.replace(/[&<>"'\/]/g, (e7) => Qr[e7]) : e6;
|
|
1436
|
-
var ei = class {
|
|
1437
|
-
constructor(e6) {
|
|
1438
|
-
this.capacity = e6, this.regExpMap = /* @__PURE__ */ new Map(), this.regExpQueue = [];
|
|
1439
|
-
}
|
|
1440
|
-
getRegExp(e6) {
|
|
1441
|
-
let t2 = this.regExpMap.get(e6);
|
|
1442
|
-
if (t2 !== void 0) return t2;
|
|
1443
|
-
let n2 = new RegExp(e6);
|
|
1444
|
-
return this.regExpQueue.length === this.capacity && this.regExpMap.delete(this.regExpQueue.shift()), this.regExpMap.set(e6, n2), this.regExpQueue.push(e6), n2;
|
|
1445
|
-
}
|
|
1446
|
-
};
|
|
1447
|
-
var ti = [` `, `,`, `?`, `!`, `;`];
|
|
1448
|
-
var ni = new ei(20);
|
|
1449
|
-
var ri = (e6, t2, n2) => {
|
|
1450
|
-
t2 ||= ``, n2 ||= ``;
|
|
1451
|
-
let r2 = ti.filter((e7) => !t2.includes(e7) && !n2.includes(e7));
|
|
1452
|
-
if (r2.length === 0) return true;
|
|
1453
|
-
let i2 = ni.getRegExp(`(${r2.map((e7) => e7 === `?` ? `\\?` : e7).join(`|`)})`), a2 = !i2.test(e6);
|
|
1454
|
-
if (!a2) {
|
|
1455
|
-
let t3 = e6.indexOf(n2);
|
|
1456
|
-
t3 > 0 && !i2.test(e6.substring(0, t3)) && (a2 = true);
|
|
1457
|
-
}
|
|
1458
|
-
return a2;
|
|
1459
|
-
};
|
|
1460
|
-
var ii = (e6, t2, n2 = `.`) => {
|
|
1461
|
-
if (!e6) return;
|
|
1462
|
-
if (e6[t2]) return Object.prototype.hasOwnProperty.call(e6, t2) ? e6[t2] : void 0;
|
|
1463
|
-
let r2 = t2.split(n2), i2 = e6;
|
|
1464
|
-
for (let e7 = 0; e7 < r2.length; ) {
|
|
1465
|
-
if (!i2 || typeof i2 != `object`) return;
|
|
1466
|
-
let t3, a2 = ``;
|
|
1467
|
-
for (let o2 = e7; o2 < r2.length; ++o2) if (o2 !== e7 && (a2 += n2), a2 += r2[o2], t3 = i2[a2], t3 !== void 0) {
|
|
1468
|
-
if ([`string`, `number`, `boolean`].includes(typeof t3) && o2 < r2.length - 1) continue;
|
|
1469
|
-
e7 += o2 - e7 + 1;
|
|
1470
|
-
break;
|
|
1471
|
-
}
|
|
1472
|
-
i2 = t3;
|
|
1473
|
-
}
|
|
1474
|
-
return i2;
|
|
1475
|
-
};
|
|
1476
|
-
var U = (e6) => e6?.replace(/_/g, `-`);
|
|
1477
|
-
var ai = { type: `logger`, log(e6) {
|
|
1478
|
-
this.output(`log`, e6);
|
|
1479
|
-
}, warn(e6) {
|
|
1480
|
-
this.output(`warn`, e6);
|
|
1481
|
-
}, error(e6) {
|
|
1482
|
-
this.output(`error`, e6);
|
|
1483
|
-
}, output(e6, t2) {
|
|
1484
|
-
console?.[e6]?.apply?.(console, t2);
|
|
1485
|
-
} };
|
|
1486
|
-
var W = new class e2 {
|
|
1487
|
-
constructor(e6, t2 = {}) {
|
|
1488
|
-
this.init(e6, t2);
|
|
1489
|
-
}
|
|
1490
|
-
init(e6, t2 = {}) {
|
|
1491
|
-
this.prefix = t2.prefix || `i18next:`, this.logger = e6 || ai, this.options = t2, this.debug = t2.debug;
|
|
1492
|
-
}
|
|
1493
|
-
log(...e6) {
|
|
1494
|
-
return this.forward(e6, `log`, ``, true);
|
|
1495
|
-
}
|
|
1496
|
-
warn(...e6) {
|
|
1497
|
-
return this.forward(e6, `warn`, ``, true);
|
|
1498
|
-
}
|
|
1499
|
-
error(...e6) {
|
|
1500
|
-
return this.forward(e6, `error`, ``);
|
|
1501
|
-
}
|
|
1502
|
-
deprecate(...e6) {
|
|
1503
|
-
return this.forward(e6, `warn`, `WARNING DEPRECATED: `, true);
|
|
1504
|
-
}
|
|
1505
|
-
forward(e6, t2, n2, r2) {
|
|
1506
|
-
return r2 && !this.debug ? null : (e6 = e6.map((e7) => R(e7) ? e7.replace(/[\r\n\x00-\x1F\x7F]/g, ` `) : e7), R(e6[0]) && (e6[0] = `${n2}${this.prefix} ${e6[0]}`), this.logger[t2](e6));
|
|
1507
|
-
}
|
|
1508
|
-
create(t2) {
|
|
1509
|
-
return new e2(this.logger, { prefix: `${this.prefix}:${t2}:`, ...this.options });
|
|
1510
|
-
}
|
|
1511
|
-
clone(t2) {
|
|
1512
|
-
return t2 ||= this.options, t2.prefix = t2.prefix || this.prefix, new e2(this.logger, t2);
|
|
1513
|
-
}
|
|
1514
|
-
}();
|
|
1515
|
-
var G = class {
|
|
1516
|
-
constructor() {
|
|
1517
|
-
this.observers = {};
|
|
1518
|
-
}
|
|
1519
|
-
on(e6, t2) {
|
|
1520
|
-
return e6.split(` `).forEach((e7) => {
|
|
1521
|
-
this.observers[e7] || (this.observers[e7] = /* @__PURE__ */ new Map());
|
|
1522
|
-
let n2 = this.observers[e7].get(t2) || 0;
|
|
1523
|
-
this.observers[e7].set(t2, n2 + 1);
|
|
1524
|
-
}), this;
|
|
1525
|
-
}
|
|
1526
|
-
off(e6, t2) {
|
|
1527
|
-
this.observers[e6] && (t2 ? this.observers[e6].delete(t2) : delete this.observers[e6]);
|
|
1528
|
-
}
|
|
1529
|
-
once(e6, t2) {
|
|
1530
|
-
let n2 = (...r2) => {
|
|
1531
|
-
t2(...r2), this.off(e6, n2);
|
|
1532
|
-
};
|
|
1533
|
-
return this.on(e6, n2), this;
|
|
1534
|
-
}
|
|
1535
|
-
emit(e6, ...t2) {
|
|
1536
|
-
this.observers[e6] && Array.from(this.observers[e6].entries()).forEach(([e7, n2]) => {
|
|
1537
|
-
for (let r2 = 0; r2 < n2; r2++) e7(...t2);
|
|
1538
|
-
}), this.observers[`*`] && Array.from(this.observers[`*`].entries()).forEach(([n2, r2]) => {
|
|
1539
|
-
for (let i2 = 0; i2 < r2; i2++) n2(e6, ...t2);
|
|
1540
|
-
});
|
|
1541
|
-
}
|
|
1542
|
-
};
|
|
1543
|
-
var oi = /* @__PURE__ */ new WeakSet();
|
|
1544
|
-
var si = class extends G {
|
|
1545
|
-
constructor(e6, t2 = { ns: [`translation`], defaultNS: `translation` }) {
|
|
1546
|
-
super(), this.data = e6 || {}, this.options = t2, this.options.keySeparator === void 0 && (this.options.keySeparator = `.`), this.options.ignoreJSONStructure === void 0 && (this.options.ignoreJSONStructure = true);
|
|
1547
|
-
}
|
|
1548
|
-
addNamespaces(e6) {
|
|
1549
|
-
this.options.ns.includes(e6) || this.options.ns.push(e6);
|
|
1550
|
-
}
|
|
1551
|
-
removeNamespaces(e6) {
|
|
1552
|
-
let t2 = this.options.ns.indexOf(e6);
|
|
1553
|
-
t2 > -1 && this.options.ns.splice(t2, 1);
|
|
1554
|
-
}
|
|
1555
|
-
getResource(e6, t2, n2, r2 = {}) {
|
|
1556
|
-
let i2 = r2.keySeparator === void 0 ? this.options.keySeparator : r2.keySeparator, a2 = r2.ignoreJSONStructure === void 0 ? this.options.ignoreJSONStructure : r2.ignoreJSONStructure, o2;
|
|
1557
|
-
e6.includes(`.`) ? o2 = e6.split(`.`) : (o2 = [e6, t2], n2 && (Array.isArray(n2) ? o2.push(...n2) : R(n2) && i2 ? o2.push(...n2.split(i2)) : o2.push(n2)));
|
|
1558
|
-
let s2 = V(this.data, o2);
|
|
1559
|
-
return !s2 && !t2 && !n2 && e6.includes(`.`) && (e6 = o2[0], t2 = o2[1], n2 = o2.slice(2).join(`.`)), s2 || !a2 || !R(n2) ? s2 : ii(this.data?.[e6]?.[t2], n2, i2);
|
|
1560
|
-
}
|
|
1561
|
-
addResource(e6, t2, n2, r2, i2 = { silent: false }) {
|
|
1562
|
-
let a2 = i2.keySeparator === void 0 ? this.options.keySeparator : i2.keySeparator, o2 = [e6, t2];
|
|
1563
|
-
n2 && (o2 = o2.concat(a2 ? n2.split(a2) : n2)), e6.includes(`.`) && (o2 = e6.split(`.`), r2 = t2, t2 = o2[1]), this.addNamespaces(t2), Jr(this.data, o2, r2), i2.silent || this.emit(`added`, e6, t2, n2, r2);
|
|
1564
|
-
}
|
|
1565
|
-
addResources(e6, t2, n2, r2 = { silent: false }) {
|
|
1566
|
-
for (let r3 in n2) (R(n2[r3]) || Array.isArray(n2[r3])) && this.addResource(e6, t2, r3, n2[r3], { silent: true });
|
|
1567
|
-
r2.silent || this.emit(`added`, e6, t2, n2);
|
|
1568
|
-
}
|
|
1569
|
-
addResourceBundle(e6, t2, n2, r2, i2, a2 = { silent: false, skipCopy: false }) {
|
|
1570
|
-
let o2 = [e6, t2];
|
|
1571
|
-
e6.includes(`.`) && (o2 = e6.split(`.`), r2 = n2, n2 = t2, t2 = o2[1]), this.addNamespaces(t2);
|
|
1572
|
-
let s2 = V(this.data, o2) || {};
|
|
1573
|
-
a2.skipCopy || (n2 = JSON.parse(JSON.stringify(n2))), r2 ? Zr(s2, n2, i2) : s2 = { ...s2, ...n2 }, Jr(this.data, o2, s2), a2.silent || this.emit(`added`, e6, t2, n2);
|
|
1574
|
-
}
|
|
1575
|
-
removeResourceBundle(e6, t2) {
|
|
1576
|
-
this.hasResourceBundle(e6, t2) && delete this.data[e6][t2], this.removeNamespaces(t2), this.emit(`removed`, e6, t2);
|
|
1577
|
-
}
|
|
1578
|
-
hasResourceBundle(e6, t2) {
|
|
1579
|
-
return this.getResource(e6, t2) !== void 0;
|
|
1580
|
-
}
|
|
1581
|
-
getResourceBundle(e6, t2) {
|
|
1582
|
-
return t2 ||= this.options.defaultNS, this.getResource(e6, t2);
|
|
1583
|
-
}
|
|
1584
|
-
getDataByLanguage(e6) {
|
|
1585
|
-
return this.data[e6];
|
|
1586
|
-
}
|
|
1587
|
-
hasLanguageSomeTranslations(e6) {
|
|
1588
|
-
let t2 = this.getDataByLanguage(e6);
|
|
1589
|
-
return !!(t2 && Object.keys(t2) || []).find((e7) => {
|
|
1590
|
-
let n2 = t2[e7];
|
|
1591
|
-
return oi.has(n2) ? true : !n2 || Object.keys(n2).length === 0 ? false : (typeof n2 == `object` && oi.add(n2), true);
|
|
1592
|
-
});
|
|
1593
|
-
}
|
|
1594
|
-
toJSON() {
|
|
1595
|
-
return this.data;
|
|
1596
|
-
}
|
|
1597
|
-
};
|
|
1598
|
-
var ci = { processors: {}, addPostProcessor(e6) {
|
|
1599
|
-
this.processors[e6.name] = e6;
|
|
1600
|
-
}, handle(e6, t2, n2, r2, i2) {
|
|
1601
|
-
return e6.forEach((e7) => {
|
|
1602
|
-
t2 = this.processors[e7]?.process(t2, n2, r2, i2) ?? t2;
|
|
1603
|
-
}), t2;
|
|
1604
|
-
} };
|
|
1605
|
-
var li = Symbol(`i18next/PATH_KEY`);
|
|
1606
|
-
function ui() {
|
|
1607
|
-
let e6 = [], t2 = /* @__PURE__ */ Object.create(null), n2;
|
|
1608
|
-
return t2.get = (r2, i2) => (n2?.revoke?.(), i2 === li ? e6 : (e6.push(i2), n2 = Proxy.revocable(r2, t2), n2.proxy)), Proxy.revocable(/* @__PURE__ */ Object.create(null), t2).proxy;
|
|
1609
|
-
}
|
|
1610
|
-
function K(e6, t2) {
|
|
1611
|
-
let { [li]: n2 } = e6(ui()), r2 = t2?.keySeparator ?? `.`, i2 = t2?.nsSeparator ?? `:`, a2 = t2?.enableSelector === `strict`;
|
|
1612
|
-
if (n2.length > 1 && i2) {
|
|
1613
|
-
let e7 = t2?.ns, o2 = a2 ? Array.isArray(e7) ? e7 : e7 ? [e7] : null : Array.isArray(e7) ? e7 : null;
|
|
1614
|
-
if (o2 && (a2 ? o2 : o2.length > 1 ? o2.slice(1) : []).includes(n2[0])) return `${n2[0]}${i2}${n2.slice(1).join(r2)}`;
|
|
1615
|
-
}
|
|
1616
|
-
return n2.join(r2);
|
|
1617
|
-
}
|
|
1618
|
-
var di = (e6) => !R(e6) && typeof e6 != `boolean` && typeof e6 != `number`;
|
|
1619
|
-
var fi = class e3 extends G {
|
|
1620
|
-
constructor(e6, t2 = {}) {
|
|
1621
|
-
super(), Wr([`resourceStore`, `languageUtils`, `pluralResolver`, `interpolator`, `backendConnector`, `i18nFormat`, `utils`], e6, this), this.options = t2, this.options.keySeparator === void 0 && (this.options.keySeparator = `.`), this.logger = W.create(`translator`), this.checkedLoadedFor = {};
|
|
1622
|
-
}
|
|
1623
|
-
changeLanguage(e6) {
|
|
1624
|
-
e6 && (this.language = e6);
|
|
1625
|
-
}
|
|
1626
|
-
exists(e6, t2 = { interpolation: {} }) {
|
|
1627
|
-
let n2 = { ...t2 };
|
|
1628
|
-
if (e6 == null) return false;
|
|
1629
|
-
let r2 = this.resolve(e6, n2);
|
|
1630
|
-
if (r2?.res === void 0) return false;
|
|
1631
|
-
let i2 = di(r2.res);
|
|
1632
|
-
return !(n2.returnObjects === false && i2);
|
|
1633
|
-
}
|
|
1634
|
-
extractFromKey(e6, t2) {
|
|
1635
|
-
let n2 = t2.nsSeparator === void 0 ? this.options.nsSeparator : t2.nsSeparator;
|
|
1636
|
-
n2 === void 0 && (n2 = `:`);
|
|
1637
|
-
let r2 = t2.keySeparator === void 0 ? this.options.keySeparator : t2.keySeparator, i2 = t2.ns || this.options.defaultNS || [], a2 = n2 && e6.includes(n2), o2 = !this.options.userDefinedKeySeparator && !t2.keySeparator && !this.options.userDefinedNsSeparator && !t2.nsSeparator && !ri(e6, n2, r2);
|
|
1638
|
-
if (a2 && !o2) {
|
|
1639
|
-
let t3 = e6.match(this.interpolator.nestingRegexp);
|
|
1640
|
-
if (t3 && t3.length > 0) return { key: e6, namespaces: R(i2) ? [i2] : i2 };
|
|
1641
|
-
let a3 = e6.split(n2);
|
|
1642
|
-
(n2 !== r2 || n2 === r2 && this.options.ns.includes(a3[0])) && (i2 = a3.shift()), e6 = a3.join(r2);
|
|
1643
|
-
}
|
|
1644
|
-
return { key: e6, namespaces: R(i2) ? [i2] : i2 };
|
|
1645
|
-
}
|
|
1646
|
-
translate(t2, n2, r2) {
|
|
1647
|
-
let i2 = typeof n2 == `object` ? { ...n2 } : n2;
|
|
1648
|
-
if (typeof i2 != `object` && this.options.overloadTranslationOptionHandler && (i2 = this.options.overloadTranslationOptionHandler(arguments)), typeof i2 == `object` && (i2 = { ...i2 }), i2 ||= {}, t2 == null) return ``;
|
|
1649
|
-
typeof t2 == `function` && (t2 = K(t2, { ...this.options, ...i2 })), Array.isArray(t2) || (t2 = [String(t2)]), t2 = t2.map((e6) => typeof e6 == `function` ? K(e6, { ...this.options, ...i2 }) : String(e6));
|
|
1650
|
-
let a2 = i2.returnDetails === void 0 ? this.options.returnDetails : i2.returnDetails, o2 = i2.keySeparator === void 0 ? this.options.keySeparator : i2.keySeparator, { key: s2, namespaces: c2 } = this.extractFromKey(t2[t2.length - 1], i2), l2 = c2[c2.length - 1], u2 = i2.nsSeparator === void 0 ? this.options.nsSeparator : i2.nsSeparator;
|
|
1651
|
-
u2 === void 0 && (u2 = `:`);
|
|
1652
|
-
let d2 = i2.lng || this.language, f2 = i2.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
|
|
1653
|
-
if (d2?.toLowerCase() === `cimode`) return f2 ? a2 ? { res: `${l2}${u2}${s2}`, usedKey: s2, exactUsedKey: s2, usedLng: d2, usedNS: l2, usedParams: this.getUsedParamsDetails(i2) } : `${l2}${u2}${s2}` : a2 ? { res: s2, usedKey: s2, exactUsedKey: s2, usedLng: d2, usedNS: l2, usedParams: this.getUsedParamsDetails(i2) } : s2;
|
|
1654
|
-
let p2 = this.resolve(t2, i2), m2 = p2?.res, h2 = p2?.usedKey || s2, g2 = p2?.exactUsedKey || s2, _2 = [`[object Number]`, `[object Function]`, `[object RegExp]`], v2 = i2.joinArrays === void 0 ? this.options.joinArrays : i2.joinArrays, y2 = !this.i18nFormat || this.i18nFormat.handleAsObject, b2 = i2.count !== void 0 && !R(i2.count), x2 = e3.hasDefaultValue(i2), S2 = b2 ? this.pluralResolver.getSuffix(d2, i2.count, i2) : ``, C2 = i2.ordinal && b2 ? this.pluralResolver.getSuffix(d2, i2.count, { ordinal: false }) : ``, ee2 = b2 && !i2.ordinal && i2.count === 0, w2 = ee2 && i2[`defaultValue${this.options.pluralSeparator}zero`] || i2[`defaultValue${S2}`] || i2[`defaultValue${C2}`] || i2.defaultValue, T2 = m2;
|
|
1655
|
-
y2 && !m2 && x2 && (T2 = w2);
|
|
1656
|
-
let te2 = di(T2), ne2 = Object.prototype.toString.apply(T2);
|
|
1657
|
-
if (y2 && T2 && te2 && !_2.includes(ne2) && !(R(v2) && Array.isArray(T2))) {
|
|
1658
|
-
if (!i2.returnObjects && !this.options.returnObjects) {
|
|
1659
|
-
this.options.returnedObjectHandler || this.logger.warn(`accessing an object - but returnObjects options is not enabled!`);
|
|
1660
|
-
let e6 = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(h2, T2, { ...i2, ns: c2 }) : `key '${s2} (${this.language})' returned an object instead of string.`;
|
|
1661
|
-
return a2 ? (p2.res = e6, p2.usedParams = this.getUsedParamsDetails(i2), p2) : e6;
|
|
1662
|
-
}
|
|
1663
|
-
if (o2) {
|
|
1664
|
-
let e6 = Array.isArray(T2), t3 = e6 ? [] : {}, n3 = e6 ? g2 : h2;
|
|
1665
|
-
for (let e7 in T2) if (Object.prototype.hasOwnProperty.call(T2, e7)) {
|
|
1666
|
-
let r3 = `${n3}${o2}${e7}`;
|
|
1667
|
-
t3[e7] = x2 && !m2 ? this.translate(r3, { ...i2, defaultValue: di(w2) ? w2[e7] : void 0, joinArrays: false, ns: c2 }) : this.translate(r3, { ...i2, joinArrays: false, ns: c2 }), t3[e7] === r3 && (t3[e7] = T2[e7]);
|
|
1668
|
-
}
|
|
1669
|
-
m2 = t3;
|
|
1670
|
-
}
|
|
1671
|
-
} else if (y2 && R(v2) && Array.isArray(m2)) m2 = m2.join(v2), m2 &&= this.extendTranslation(m2, t2, i2, r2);
|
|
1672
|
-
else {
|
|
1673
|
-
let e6 = false, n3 = false;
|
|
1674
|
-
!this.isValidLookup(m2) && x2 && (e6 = true, m2 = w2), this.isValidLookup(m2) || (n3 = true, m2 = s2);
|
|
1675
|
-
let a3 = (i2.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && n3 ? void 0 : m2, c3 = x2 && w2 !== m2 && this.options.updateMissing;
|
|
1676
|
-
if (n3 || e6 || c3) {
|
|
1677
|
-
if (this.logger.log(c3 ? `updateKey` : `missingKey`, d2, l2, b2 && !c3 ? `${s2}${this.pluralResolver.getSuffix(d2, i2.count, i2)}` : s2, c3 ? w2 : m2), o2) {
|
|
1678
|
-
let e8 = this.resolve(s2, { ...i2, keySeparator: false });
|
|
1679
|
-
e8 && e8.res && this.logger.warn(`Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.`);
|
|
1680
|
-
}
|
|
1681
|
-
let e7 = [], t3 = this.languageUtils.getFallbackCodes(this.options.fallbackLng, i2.lng || this.language);
|
|
1682
|
-
if (this.options.saveMissingTo === `fallback` && t3 && t3[0]) for (let n5 = 0; n5 < t3.length; n5++) e7.push(t3[n5]);
|
|
1683
|
-
else this.options.saveMissingTo === `all` ? e7 = this.languageUtils.toResolveHierarchy(i2.lng || this.language) : e7.push(i2.lng || this.language);
|
|
1684
|
-
let n4 = (e8, t4, n5) => {
|
|
1685
|
-
let r3 = x2 && n5 !== m2 ? n5 : a3;
|
|
1686
|
-
this.options.missingKeyHandler ? this.options.missingKeyHandler(e8, l2, t4, r3, c3, i2) : this.backendConnector?.saveMissing && this.backendConnector.saveMissing(e8, l2, t4, r3, c3, i2), this.emit(`missingKey`, e8, l2, t4, m2);
|
|
1687
|
-
};
|
|
1688
|
-
this.options.saveMissing && (this.options.saveMissingPlurals && b2 ? e7.forEach((e8) => {
|
|
1689
|
-
let t4 = this.pluralResolver.getSuffixes(e8, i2);
|
|
1690
|
-
ee2 && i2[`defaultValue${this.options.pluralSeparator}zero`] && !t4.includes(`${this.options.pluralSeparator}zero`) && t4.push(`${this.options.pluralSeparator}zero`), t4.forEach((t5) => {
|
|
1691
|
-
n4([e8], s2 + t5, i2[`defaultValue${t5}`] || w2);
|
|
1692
|
-
});
|
|
1693
|
-
}) : n4(e7, s2, w2));
|
|
1694
|
-
}
|
|
1695
|
-
m2 = this.extendTranslation(m2, t2, i2, p2, r2), n3 && m2 === s2 && this.options.appendNamespaceToMissingKey && (m2 = `${l2}${u2}${s2}`), (n3 || e6) && this.options.parseMissingKeyHandler && (m2 = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${l2}${u2}${s2}` : s2, e6 ? m2 : void 0, i2));
|
|
1696
|
-
}
|
|
1697
|
-
return a2 ? (p2.res = m2, p2.usedParams = this.getUsedParamsDetails(i2), p2) : m2;
|
|
1698
|
-
}
|
|
1699
|
-
extendTranslation(e6, t2, n2, r2, i2) {
|
|
1700
|
-
if (this.i18nFormat?.parse) e6 = this.i18nFormat.parse(e6, { ...this.options.interpolation.defaultVariables, ...n2 }, n2.lng || this.language || r2.usedLng, r2.usedNS, r2.usedKey, { resolved: r2 });
|
|
1701
|
-
else if (!n2.skipInterpolation) {
|
|
1702
|
-
n2.interpolation && this.interpolator.init({ ...n2, interpolation: { ...this.options.interpolation, ...n2.interpolation } });
|
|
1703
|
-
let a3 = R(e6) && (n2?.interpolation?.skipOnVariables === void 0 ? this.options.interpolation.skipOnVariables : n2.interpolation.skipOnVariables), o3;
|
|
1704
|
-
if (a3) {
|
|
1705
|
-
let t3 = e6.match(this.interpolator.nestingRegexp);
|
|
1706
|
-
o3 = t3 && t3.length;
|
|
1707
|
-
}
|
|
1708
|
-
let s2 = n2.replace && !R(n2.replace) ? n2.replace : n2;
|
|
1709
|
-
if (this.options.interpolation.defaultVariables && (s2 = { ...this.options.interpolation.defaultVariables, ...s2 }), e6 = this.interpolator.interpolate(e6, s2, n2.lng || this.language || r2.usedLng, n2), a3) {
|
|
1710
|
-
let t3 = e6.match(this.interpolator.nestingRegexp), r3 = t3 && t3.length;
|
|
1711
|
-
o3 < r3 && (n2.nest = false);
|
|
1712
|
-
}
|
|
1713
|
-
!n2.lng && r2 && r2.res && (n2.lng = this.language || r2.usedLng), n2.nest !== false && (e6 = this.interpolator.nest(e6, (...e7) => i2?.[0] === e7[0] && !n2.context ? (this.logger.warn(`It seems you are nesting recursively key: ${e7[0]} in key: ${t2[0]}`), null) : this.translate(...e7, t2), n2)), n2.interpolation && this.interpolator.reset();
|
|
1714
|
-
}
|
|
1715
|
-
let a2 = n2.postProcess || this.options.postProcess, o2 = R(a2) ? [a2] : a2;
|
|
1716
|
-
return e6 != null && o2?.length && n2.applyPostProcessor !== false && (e6 = ci.handle(o2, e6, t2, this.options && this.options.postProcessPassResolved ? { i18nResolved: { ...r2, usedParams: this.getUsedParamsDetails(n2) }, ...n2 } : n2, this)), e6;
|
|
1717
|
-
}
|
|
1718
|
-
resolve(e6, t2 = {}) {
|
|
1719
|
-
let n2, r2, i2, a2, o2;
|
|
1720
|
-
return R(e6) && (e6 = [e6]), Array.isArray(e6) && (e6 = e6.map((e7) => typeof e7 == `function` ? K(e7, { ...this.options, ...t2 }) : e7)), e6.forEach((e7) => {
|
|
1721
|
-
if (this.isValidLookup(n2)) return;
|
|
1722
|
-
let s2 = this.extractFromKey(e7, t2), c2 = s2.key;
|
|
1723
|
-
r2 = c2;
|
|
1724
|
-
let l2 = s2.namespaces;
|
|
1725
|
-
this.options.fallbackNS && (l2 = l2.concat(this.options.fallbackNS));
|
|
1726
|
-
let u2 = t2.count !== void 0 && !R(t2.count), d2 = u2 && !t2.ordinal && t2.count === 0, f2 = t2.context !== void 0 && (R(t2.context) || typeof t2.context == `number`) && t2.context !== ``, p2 = t2.lngs ? t2.lngs : this.languageUtils.toResolveHierarchy(t2.lng || this.language, t2.fallbackLng);
|
|
1727
|
-
l2.forEach((e8) => {
|
|
1728
|
-
this.isValidLookup(n2) || (o2 = e8, !this.checkedLoadedFor[`${p2[0]}-${e8}`] && this.utils?.hasLoadedNamespace && !this.utils?.hasLoadedNamespace(o2) && (this.checkedLoadedFor[`${p2[0]}-${e8}`] = true, this.logger.warn(`key "${r2}" for languages "${p2.join(`, `)}" won't get resolved as namespace "${o2}" was not yet loaded`, `This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!`)), p2.forEach((r3) => {
|
|
1729
|
-
if (this.isValidLookup(n2)) return;
|
|
1730
|
-
a2 = r3;
|
|
1731
|
-
let o3 = [c2];
|
|
1732
|
-
if (this.i18nFormat?.addLookupKeys) this.i18nFormat.addLookupKeys(o3, c2, r3, e8, t2);
|
|
1733
|
-
else {
|
|
1734
|
-
let e9;
|
|
1735
|
-
u2 && (e9 = this.pluralResolver.getSuffix(r3, t2.count, t2));
|
|
1736
|
-
let n3 = `${this.options.pluralSeparator}zero`, i3 = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;
|
|
1737
|
-
if (u2 && (t2.ordinal && e9.startsWith(i3) && o3.push(c2 + e9.replace(i3, this.options.pluralSeparator)), o3.push(c2 + e9), d2 && o3.push(c2 + n3)), f2) {
|
|
1738
|
-
let r4 = `${c2}${this.options.contextSeparator || `_`}${t2.context}`;
|
|
1739
|
-
o3.push(r4), u2 && (t2.ordinal && e9.startsWith(i3) && o3.push(r4 + e9.replace(i3, this.options.pluralSeparator)), o3.push(r4 + e9), d2 && o3.push(r4 + n3));
|
|
1740
|
-
}
|
|
1741
|
-
}
|
|
1742
|
-
let s3;
|
|
1743
|
-
for (; s3 = o3.pop(); ) this.isValidLookup(n2) || (i2 = s3, n2 = this.getResource(r3, e8, s3, t2));
|
|
1744
|
-
}));
|
|
1745
|
-
});
|
|
1746
|
-
}), { res: n2, usedKey: r2, exactUsedKey: i2, usedLng: a2, usedNS: o2 };
|
|
1747
|
-
}
|
|
1748
|
-
isValidLookup(e6) {
|
|
1749
|
-
return e6 !== void 0 && !(!this.options.returnNull && e6 === null) && !(!this.options.returnEmptyString && e6 === ``);
|
|
1750
|
-
}
|
|
1751
|
-
getResource(e6, t2, n2, r2 = {}) {
|
|
1752
|
-
return this.i18nFormat?.getResource ? this.i18nFormat.getResource(e6, t2, n2, r2) : this.resourceStore.getResource(e6, t2, n2, r2);
|
|
1753
|
-
}
|
|
1754
|
-
getUsedParamsDetails(e6 = {}) {
|
|
1755
|
-
let t2 = [`defaultValue`, `ordinal`, `context`, `replace`, `lng`, `lngs`, `fallbackLng`, `ns`, `keySeparator`, `nsSeparator`, `returnObjects`, `returnDetails`, `joinArrays`, `postProcess`, `interpolation`], n2 = e6.replace && !R(e6.replace), r2 = n2 ? e6.replace : e6;
|
|
1756
|
-
if (n2 && e6.count !== void 0 && (r2 = { ...r2, count: e6.count }), this.options.interpolation.defaultVariables && (r2 = { ...this.options.interpolation.defaultVariables, ...r2 }), !n2) {
|
|
1757
|
-
r2 = { ...r2 };
|
|
1758
|
-
for (let e7 of t2) delete r2[e7];
|
|
1759
|
-
}
|
|
1760
|
-
return r2;
|
|
1761
|
-
}
|
|
1762
|
-
static hasDefaultValue(e6) {
|
|
1763
|
-
for (let t2 in e6) if (Object.prototype.hasOwnProperty.call(e6, t2) && t2.startsWith(`defaultValue`) && e6[t2] !== void 0) return true;
|
|
1764
|
-
return false;
|
|
1765
|
-
}
|
|
1766
|
-
};
|
|
1767
|
-
var pi = class {
|
|
1768
|
-
constructor(e6) {
|
|
1769
|
-
this.options = e6, this.supportedLngs = this.options.supportedLngs || false, this.logger = W.create(`languageUtils`), this.resolveHierarchyCache = {};
|
|
1770
|
-
}
|
|
1771
|
-
clearCache() {
|
|
1772
|
-
this.resolveHierarchyCache = {};
|
|
1773
|
-
}
|
|
1774
|
-
getScriptPartFromCode(e6) {
|
|
1775
|
-
if (e6 = U(e6), !e6 || !e6.includes(`-`)) return null;
|
|
1776
|
-
let t2 = e6.split(`-`);
|
|
1777
|
-
return t2.length === 2 || (t2.pop(), t2[t2.length - 1].toLowerCase() === `x`) ? null : this.formatLanguageCode(t2.join(`-`));
|
|
1778
|
-
}
|
|
1779
|
-
getLanguagePartFromCode(e6) {
|
|
1780
|
-
if (e6 = U(e6), !e6 || !e6.includes(`-`)) return e6;
|
|
1781
|
-
let t2 = e6.split(`-`);
|
|
1782
|
-
return this.formatLanguageCode(t2[0]);
|
|
1783
|
-
}
|
|
1784
|
-
formatLanguageCode(e6) {
|
|
1785
|
-
if (R(e6) && e6.includes(`-`)) {
|
|
1786
|
-
let t2;
|
|
1787
|
-
try {
|
|
1788
|
-
t2 = Intl.getCanonicalLocales(e6)[0];
|
|
1789
|
-
} catch {
|
|
1790
|
-
}
|
|
1791
|
-
return t2 && this.options.lowerCaseLng && (t2 = t2.toLowerCase()), t2 || (this.options.lowerCaseLng ? e6.toLowerCase() : e6);
|
|
1792
|
-
}
|
|
1793
|
-
return this.options.cleanCode || this.options.lowerCaseLng ? e6.toLowerCase() : e6;
|
|
1794
|
-
}
|
|
1795
|
-
isSupportedCode(e6) {
|
|
1796
|
-
return (this.options.load === `languageOnly` || this.options.nonExplicitSupportedLngs) && (e6 = this.getLanguagePartFromCode(e6)), !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.includes(e6);
|
|
1797
|
-
}
|
|
1798
|
-
getBestMatchFromCodes(e6) {
|
|
1799
|
-
if (!e6) return null;
|
|
1800
|
-
let t2;
|
|
1801
|
-
return e6.forEach((e7) => {
|
|
1802
|
-
if (t2) return;
|
|
1803
|
-
let n2 = this.formatLanguageCode(e7);
|
|
1804
|
-
(!this.options.supportedLngs || this.isSupportedCode(n2)) && (t2 = n2);
|
|
1805
|
-
}), !t2 && this.options.supportedLngs && e6.forEach((e7) => {
|
|
1806
|
-
if (t2) return;
|
|
1807
|
-
let n2 = this.getScriptPartFromCode(e7);
|
|
1808
|
-
if (this.isSupportedCode(n2)) return t2 = n2;
|
|
1809
|
-
let r2 = this.getLanguagePartFromCode(e7);
|
|
1810
|
-
if (this.isSupportedCode(r2)) return t2 = r2;
|
|
1811
|
-
t2 = this.options.supportedLngs.find((e8) => e8 === r2 ? true : !e8.includes(`-`) && !r2.includes(`-`) ? false : !!(e8.includes(`-`) && !r2.includes(`-`) && e8.slice(0, e8.indexOf(`-`)) === r2 || e8.startsWith(r2) && r2.length > 1));
|
|
1812
|
-
}), t2 ||= this.getFallbackCodes(this.options.fallbackLng)[0], t2;
|
|
1813
|
-
}
|
|
1814
|
-
getFallbackCodes(e6, t2) {
|
|
1815
|
-
if (!e6) return [];
|
|
1816
|
-
if (typeof e6 == `function` && (e6 = e6(t2)), R(e6) && (e6 = [e6]), Array.isArray(e6)) return e6;
|
|
1817
|
-
if (!t2) return e6.default || [];
|
|
1818
|
-
let n2 = e6[t2];
|
|
1819
|
-
return n2 ||= e6[this.getScriptPartFromCode(t2)], n2 ||= e6[this.formatLanguageCode(t2)], n2 ||= e6[this.getLanguagePartFromCode(t2)], n2 ||= e6.default, n2 || [];
|
|
1820
|
-
}
|
|
1821
|
-
toResolveHierarchy(e6, t2) {
|
|
1822
|
-
let n2 = this.options.fallbackLng, r2 = Array.isArray(n2) ? n2.join(`|`) : n2;
|
|
1823
|
-
r2 !== this._cachedFallbackLng && (this.resolveHierarchyCache = {}, this._cachedFallbackLng = r2);
|
|
1824
|
-
let i2 = t2 === void 0 || t2 === false || R(t2), a2 = t2 === void 0 && typeof this.options.fallbackLng == `function`, o2 = R(e6) && i2 && !a2, s2 = null;
|
|
1825
|
-
if (o2) {
|
|
1826
|
-
let n3;
|
|
1827
|
-
n3 = t2 === void 0 ? `undefined` : t2 === false ? `boolean:false` : `string:${t2}`, s2 = `${e6.length}:${e6}|${n3}`;
|
|
1828
|
-
}
|
|
1829
|
-
if (s2 !== null) {
|
|
1830
|
-
let e7 = this.resolveHierarchyCache[s2];
|
|
1831
|
-
if (e7 !== void 0) return e7.slice();
|
|
1832
|
-
}
|
|
1833
|
-
let c2 = this.getFallbackCodes((t2 === false ? [] : t2) || this.options.fallbackLng || [], e6), l2 = [], u2 = (e7) => {
|
|
1834
|
-
e7 && (this.isSupportedCode(e7) ? l2.push(e7) : this.logger.warn(`rejecting language code not found in supportedLngs: ${e7}`));
|
|
1835
|
-
};
|
|
1836
|
-
return R(e6) && (e6.includes(`-`) || e6.includes(`_`)) ? (this.options.load !== `languageOnly` && u2(this.formatLanguageCode(e6)), this.options.load !== `languageOnly` && this.options.load !== `currentOnly` && u2(this.getScriptPartFromCode(e6)), this.options.load !== `currentOnly` && u2(this.getLanguagePartFromCode(e6))) : R(e6) && u2(this.formatLanguageCode(e6)), c2.forEach((e7) => {
|
|
1837
|
-
l2.includes(e7) || u2(this.formatLanguageCode(e7));
|
|
1838
|
-
}), s2 === null ? l2 : (this.resolveHierarchyCache[s2] = l2, l2.slice());
|
|
1839
|
-
}
|
|
1840
|
-
};
|
|
1841
|
-
var mi = { zero: 0, one: 1, two: 2, few: 3, many: 4, other: 5 };
|
|
1842
|
-
var hi = { select: (e6) => e6 === 1 ? `one` : `other`, resolvedOptions: () => ({ pluralCategories: [`one`, `other`] }) };
|
|
1843
|
-
var gi = class {
|
|
1844
|
-
constructor(e6, t2 = {}) {
|
|
1845
|
-
this.languageUtils = e6, this.options = t2, this.logger = W.create(`pluralResolver`), this.pluralRulesCache = {};
|
|
1846
|
-
}
|
|
1847
|
-
clearCache() {
|
|
1848
|
-
this.pluralRulesCache = {};
|
|
1849
|
-
}
|
|
1850
|
-
getRule(e6, t2 = {}) {
|
|
1851
|
-
let n2 = U(e6 === `dev` ? `en` : e6), r2 = t2.ordinal ? `ordinal` : `cardinal`, i2 = JSON.stringify({ cleanedCode: n2, type: r2 });
|
|
1852
|
-
if (i2 in this.pluralRulesCache) return this.pluralRulesCache[i2];
|
|
1853
|
-
let a2;
|
|
1854
|
-
try {
|
|
1855
|
-
a2 = new Intl.PluralRules(n2, { type: r2 });
|
|
1856
|
-
} catch {
|
|
1857
|
-
if (typeof Intl > `u`) return this.logger.error(`No Intl support, please use an Intl polyfill!`), hi;
|
|
1858
|
-
if (!e6.match(/-|_/)) return hi;
|
|
1859
|
-
let n3 = this.languageUtils.getLanguagePartFromCode(e6);
|
|
1860
|
-
a2 = this.getRule(n3, t2);
|
|
1861
|
-
}
|
|
1862
|
-
return this.pluralRulesCache[i2] = a2, a2;
|
|
1863
|
-
}
|
|
1864
|
-
needsPlural(e6, t2 = {}) {
|
|
1865
|
-
let n2 = this.getRule(e6, t2);
|
|
1866
|
-
return n2 ||= this.getRule(`dev`, t2), n2?.resolvedOptions().pluralCategories.length > 1;
|
|
1867
|
-
}
|
|
1868
|
-
getPluralFormsOfKey(e6, t2, n2 = {}) {
|
|
1869
|
-
return this.getSuffixes(e6, n2).map((e7) => `${t2}${e7}`);
|
|
1870
|
-
}
|
|
1871
|
-
getSuffixes(e6, t2 = {}) {
|
|
1872
|
-
let n2 = this.getRule(e6, t2);
|
|
1873
|
-
return n2 ||= this.getRule(`dev`, t2), n2 ? n2.resolvedOptions().pluralCategories.sort((e7, t3) => mi[e7] - mi[t3]).map((e7) => `${this.options.prepend}${t2.ordinal ? `ordinal${this.options.prepend}` : ``}${e7}`) : [];
|
|
1874
|
-
}
|
|
1875
|
-
getSuffix(e6, t2, n2 = {}) {
|
|
1876
|
-
let r2 = this.getRule(e6, n2);
|
|
1877
|
-
return r2 ? `${this.options.prepend}${n2.ordinal ? `ordinal${this.options.prepend}` : ``}${r2.select(t2)}` : (this.logger.warn(`no plural rule found for: ${e6}`), this.getSuffix(`dev`, t2, n2));
|
|
1878
|
-
}
|
|
1879
|
-
};
|
|
1880
|
-
var _i = (e6, t2, n2, r2 = `.`, i2 = true) => {
|
|
1881
|
-
let a2 = Xr(e6, t2, n2);
|
|
1882
|
-
return !a2 && i2 && R(n2) && (a2 = ii(e6, n2, r2), a2 === void 0 && (a2 = ii(t2, n2, r2))), a2;
|
|
1883
|
-
};
|
|
1884
|
-
var vi = (e6) => e6.replace(/\$/g, `$$$$`);
|
|
1885
|
-
var yi = class {
|
|
1886
|
-
constructor(e6 = {}) {
|
|
1887
|
-
this.logger = W.create(`interpolator`), this.options = e6, this.format = e6?.interpolation?.format || ((e7) => e7), this.init(e6);
|
|
1888
|
-
}
|
|
1889
|
-
init(e6 = {}) {
|
|
1890
|
-
e6.interpolation ||= { escapeValue: true };
|
|
1891
|
-
let { escape: t2, escapeValue: n2, useRawValueToEscape: r2, prefix: i2, prefixEscaped: a2, suffix: o2, suffixEscaped: s2, formatSeparator: c2, unescapeSuffix: l2, unescapePrefix: u2, nestingPrefix: d2, nestingPrefixEscaped: f2, nestingSuffix: p2, nestingSuffixEscaped: m2, nestingOptionsSeparator: h2, maxReplaces: g2, alwaysFormat: _2 } = e6.interpolation;
|
|
1892
|
-
this.escape = t2 === void 0 ? $r : t2, this.escapeValue = n2 === void 0 || n2, this.useRawValueToEscape = r2 !== void 0 && r2, this.prefix = i2 ? H(i2) : a2 || `{{`, this.suffix = o2 ? H(o2) : s2 || `}}`, this.formatSeparator = c2 || `,`, this.unescapePrefix = l2 ? `` : u2 ? H(u2) : `-`, this.unescapeSuffix = this.unescapePrefix ? `` : l2 ? H(l2) : ``, this.nestingPrefix = d2 ? H(d2) : f2 || H(`$t(`), this.nestingSuffix = p2 ? H(p2) : m2 || H(`)`), this.nestingOptionsSeparator = h2 || `,`, this.maxReplaces = g2 || 1e3, this.alwaysFormat = _2 !== void 0 && _2, this.resetRegExp();
|
|
1893
|
-
}
|
|
1894
|
-
reset() {
|
|
1895
|
-
this.options && this.init(this.options);
|
|
1896
|
-
}
|
|
1897
|
-
resetRegExp() {
|
|
1898
|
-
let e6 = (e7, t2) => e7?.source === t2 ? (e7.lastIndex = 0, e7) : new RegExp(t2, `g`);
|
|
1899
|
-
this.regexp = e6(this.regexp, `${this.prefix}(.+?)${this.suffix}`), this.regexpUnescape = e6(this.regexpUnescape, `${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`), this.nestingRegexp = e6(this.nestingRegexp, `${this.nestingPrefix}((?:[^()"']|"[^"]*"|'[^']*'|\\((?:[^()"']|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`);
|
|
1900
|
-
}
|
|
1901
|
-
interpolate(e6, t2, n2, r2) {
|
|
1902
|
-
let i2, a2, o2, s2 = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {}, c2 = (e7) => {
|
|
1903
|
-
if (!e7.includes(this.formatSeparator)) {
|
|
1904
|
-
let i4 = _i(t2, s2, e7, this.options.keySeparator, this.options.ignoreJSONStructure);
|
|
1905
|
-
return this.alwaysFormat ? this.format(i4, void 0, n2, { ...r2, ...t2, interpolationkey: e7 }) : i4;
|
|
1906
|
-
}
|
|
1907
|
-
let i3 = e7.split(this.formatSeparator), a3 = i3.shift().trim(), o3 = i3.join(this.formatSeparator).trim();
|
|
1908
|
-
return this.format(_i(t2, s2, a3, this.options.keySeparator, this.options.ignoreJSONStructure), o3, n2, { ...r2, ...t2, interpolationkey: a3 });
|
|
1909
|
-
};
|
|
1910
|
-
this.resetRegExp(), !this.escapeValue && typeof e6 == `string` && /\$t\([^)]*\{[^}]*\{\{/.test(e6) && this.logger.warn(`nesting options string contains interpolated variables with escapeValue: false \u2014 if any of those values are attacker-controlled they can inject additional nesting options (e.g. redirect lng/ns). Sanitise untrusted input before passing it to t(), or keep escapeValue: true.`);
|
|
1911
|
-
let l2 = r2?.missingInterpolationHandler || this.options.missingInterpolationHandler, u2 = r2?.interpolation?.skipOnVariables === void 0 ? this.options.interpolation.skipOnVariables : r2.interpolation.skipOnVariables;
|
|
1912
|
-
return [{ regex: this.regexpUnescape, safeValue: (e7) => e7 }, { regex: this.regexp, safeValue: (e7) => this.escapeValue ? this.escape(e7) : e7 }].forEach((t3) => {
|
|
1913
|
-
for (o2 = 0; i2 = t3.regex.exec(e6); ) {
|
|
1914
|
-
let n3 = i2[1].trim();
|
|
1915
|
-
if (a2 = c2(n3), a2 === void 0) {
|
|
1916
|
-
if (typeof l2 == `function`) {
|
|
1917
|
-
let t4 = l2(e6, i2, r2);
|
|
1918
|
-
a2 = R(t4) ? t4 : ``;
|
|
1919
|
-
} else if (r2 && Object.prototype.hasOwnProperty.call(r2, n3)) a2 = ``;
|
|
1920
|
-
else if (u2) {
|
|
1921
|
-
a2 = i2[0];
|
|
1922
|
-
continue;
|
|
1923
|
-
} else this.logger.warn(`missed to pass in variable ${n3} for interpolating ${e6}`), a2 = ``;
|
|
1924
|
-
} else !R(a2) && !this.useRawValueToEscape && (a2 = Ur(a2));
|
|
1925
|
-
let s3 = t3.safeValue(a2);
|
|
1926
|
-
if (e6 = e6.replace(i2[0], vi(s3)), u2 ? (t3.regex.lastIndex += s3.length, t3.regex.lastIndex -= i2[0].length) : t3.regex.lastIndex = 0, o2++, o2 >= this.maxReplaces) break;
|
|
1927
|
-
}
|
|
1928
|
-
}), e6;
|
|
1929
|
-
}
|
|
1930
|
-
nest(e6, t2, n2 = {}) {
|
|
1931
|
-
let r2, i2, a2, o2 = (e7, t3) => {
|
|
1932
|
-
let n3 = this.nestingOptionsSeparator;
|
|
1933
|
-
if (!e7.includes(n3)) return e7;
|
|
1934
|
-
let r3 = e7.split(RegExp(`${H(n3)}[ ]*{`)), i3 = `{${r3[1]}`;
|
|
1935
|
-
e7 = r3[0], i3 = this.interpolate(i3, a2);
|
|
1936
|
-
let o3 = i3.match(/'/g), s3 = i3.match(/"/g);
|
|
1937
|
-
((o3?.length ?? 0) % 2 == 0 && !s3 || (s3?.length ?? 0) % 2 != 0) && (i3 = i3.replace(/'/g, `"`));
|
|
1938
|
-
try {
|
|
1939
|
-
a2 = JSON.parse(i3), t3 && (a2 = { ...t3, ...a2 });
|
|
1940
|
-
} catch (t4) {
|
|
1941
|
-
return this.logger.warn(`failed parsing options string in nesting for key ${e7}`, t4), `${e7}${n3}${i3}`;
|
|
1942
|
-
}
|
|
1943
|
-
return a2.defaultValue && a2.defaultValue.includes(this.prefix) && delete a2.defaultValue, e7;
|
|
1944
|
-
}, s2 = new RegExp(this.nestingRegexp), c2 = ``, l2 = 0;
|
|
1945
|
-
for (; r2 = s2.exec(e6); ) {
|
|
1946
|
-
let u2 = [];
|
|
1947
|
-
a2 = { ...n2 }, a2 = a2.replace && !R(a2.replace) ? a2.replace : a2, a2.applyPostProcessor = false, delete a2.defaultValue;
|
|
1948
|
-
let d2 = /{.*}/s.test(r2[1]) ? r2[1].lastIndexOf(`}`) + 1 : r2[1].indexOf(this.formatSeparator);
|
|
1949
|
-
if (d2 !== -1 && (u2 = r2[1].slice(d2).split(this.formatSeparator).map((e7) => e7.trim()).filter(Boolean), r2[1] = r2[1].slice(0, d2)), i2 = t2(o2.call(this, r2[1].trim(), a2), a2), i2 && r2[0] === e6 && !R(i2)) return i2;
|
|
1950
|
-
R(i2) || (i2 = Ur(i2)), i2 ||= (this.logger.warn(`missed to resolve ${r2[1]} for nesting ${e6}`), ``), u2.length && (i2 = u2.reduce((e7, t3) => this.format(e7, t3, n2.lng, { ...n2, interpolationkey: r2[1].trim() }), i2.trim())), c2 += e6.slice(l2, r2.index) + Ur(i2), l2 = s2.lastIndex, this.regexp.lastIndex = 0;
|
|
1951
|
-
}
|
|
1952
|
-
return l2 ? c2 + e6.slice(l2) : e6;
|
|
1953
|
-
}
|
|
1954
|
-
};
|
|
1955
|
-
var bi = (e6) => {
|
|
1956
|
-
let t2 = e6.toLowerCase().trim(), n2 = {};
|
|
1957
|
-
if (e6.includes(`(`)) {
|
|
1958
|
-
let r2 = e6.split(`(`);
|
|
1959
|
-
t2 = r2[0].toLowerCase().trim();
|
|
1960
|
-
let i2 = r2[1].slice(0, -1);
|
|
1961
|
-
t2 === `currency` && !i2.includes(`:`) ? n2.currency ||= i2.trim() : t2 === `relativetime` && !i2.includes(`:`) ? n2.range ||= i2.trim() : i2.split(`;`).forEach((e7) => {
|
|
1962
|
-
if (e7) {
|
|
1963
|
-
let [t3, ...r3] = e7.split(`:`), i3 = r3.join(`:`).trim().replace(/^'+|'+$/g, ``), a2 = t3.trim();
|
|
1964
|
-
n2[a2] || (n2[a2] = i3), i3 === `false` && (n2[a2] = false), i3 === `true` && (n2[a2] = true), isNaN(i3) || (n2[a2] = parseInt(i3, 10));
|
|
1965
|
-
}
|
|
1966
|
-
});
|
|
1967
|
-
}
|
|
1968
|
-
return { formatName: t2, formatOptions: n2 };
|
|
1969
|
-
};
|
|
1970
|
-
var xi = (e6) => {
|
|
1971
|
-
let t2 = {};
|
|
1972
|
-
return (n2, r2, i2) => {
|
|
1973
|
-
let a2 = i2;
|
|
1974
|
-
i2 && i2.interpolationkey && i2.formatParams && i2.formatParams[i2.interpolationkey] && i2[i2.interpolationkey] && (a2 = { ...a2, [i2.interpolationkey]: void 0 });
|
|
1975
|
-
let o2 = r2 + JSON.stringify(a2), s2 = t2[o2];
|
|
1976
|
-
return s2 || (s2 = e6(U(r2), i2), t2[o2] = s2), s2(n2);
|
|
1977
|
-
};
|
|
1978
|
-
};
|
|
1979
|
-
var Si = (e6) => (t2, n2, r2) => e6(U(n2), r2)(t2);
|
|
1980
|
-
var Ci = class {
|
|
1981
|
-
constructor(e6 = {}) {
|
|
1982
|
-
this.logger = W.create(`formatter`), this.options = e6, this.init(e6);
|
|
1983
|
-
}
|
|
1984
|
-
init(e6, t2 = { interpolation: {} }) {
|
|
1985
|
-
this.formatSeparator = t2.interpolation.formatSeparator || `,`;
|
|
1986
|
-
let n2 = t2.cacheInBuiltFormats ? xi : Si;
|
|
1987
|
-
this.formats = { number: n2((e7, t3) => {
|
|
1988
|
-
let n3 = new Intl.NumberFormat(e7, { ...t3 });
|
|
1989
|
-
return (e8) => n3.format(e8);
|
|
1990
|
-
}), currency: n2((e7, t3) => {
|
|
1991
|
-
let n3 = new Intl.NumberFormat(e7, { ...t3, style: `currency` });
|
|
1992
|
-
return (e8) => n3.format(e8);
|
|
1993
|
-
}), datetime: n2((e7, t3) => {
|
|
1994
|
-
let n3 = new Intl.DateTimeFormat(e7, { ...t3 });
|
|
1995
|
-
return (e8) => n3.format(e8);
|
|
1996
|
-
}), relativetime: n2((e7, t3) => {
|
|
1997
|
-
let n3 = new Intl.RelativeTimeFormat(e7, { ...t3 });
|
|
1998
|
-
return (e8) => n3.format(e8, t3.range || `day`);
|
|
1999
|
-
}), list: n2((e7, t3) => {
|
|
2000
|
-
let n3 = new Intl.ListFormat(e7, { ...t3 });
|
|
2001
|
-
return (e8) => n3.format(e8);
|
|
2002
|
-
}) };
|
|
2003
|
-
}
|
|
2004
|
-
add(e6, t2) {
|
|
2005
|
-
this.formats[e6.toLowerCase().trim()] = t2;
|
|
2006
|
-
}
|
|
2007
|
-
addCached(e6, t2) {
|
|
2008
|
-
this.formats[e6.toLowerCase().trim()] = xi(t2);
|
|
2009
|
-
}
|
|
2010
|
-
format(e6, t2, n2, r2 = {}) {
|
|
2011
|
-
if (!t2 || e6 == null) return e6;
|
|
2012
|
-
let i2 = t2.split(this.formatSeparator), a2 = [];
|
|
2013
|
-
for (let e7 = 0; e7 < i2.length; e7++) {
|
|
2014
|
-
let t3 = i2[e7];
|
|
2015
|
-
for (; t3.indexOf(`(`) > -1 && !t3.includes(`)`) && e7 + 1 < i2.length; ) t3 = `${t3}${this.formatSeparator}${i2[++e7]}`;
|
|
2016
|
-
a2.push(t3);
|
|
2017
|
-
}
|
|
2018
|
-
return a2.reduce((e7, t3) => {
|
|
2019
|
-
let { formatName: i3, formatOptions: a3 } = bi(t3);
|
|
2020
|
-
if (this.formats[i3]) {
|
|
2021
|
-
let t4 = e7;
|
|
2022
|
-
try {
|
|
2023
|
-
let o2 = r2?.formatParams?.[r2.interpolationkey] || {}, s2 = o2.locale || o2.lng || r2.locale || r2.lng || n2;
|
|
2024
|
-
t4 = this.formats[i3](e7, s2, { ...a3, ...r2, ...o2 });
|
|
2025
|
-
} catch (e8) {
|
|
2026
|
-
this.logger.warn(e8);
|
|
2027
|
-
}
|
|
2028
|
-
return t4;
|
|
2029
|
-
}
|
|
2030
|
-
return this.logger.warn(`there was no format function for ${i3}`), e7;
|
|
2031
|
-
}, e6);
|
|
2032
|
-
}
|
|
2033
|
-
};
|
|
2034
|
-
var wi = (e6, t2) => {
|
|
2035
|
-
e6.pending[t2] !== void 0 && (delete e6.pending[t2], e6.pendingCount--);
|
|
2036
|
-
};
|
|
2037
|
-
var Ti = class extends G {
|
|
2038
|
-
constructor(e6, t2, n2, r2 = {}) {
|
|
2039
|
-
super(), this.backend = e6, this.store = t2, this.services = n2, this.languageUtils = n2.languageUtils, this.options = r2, this.logger = W.create(`backendConnector`), this.waitingReads = [], this.maxParallelReads = r2.maxParallelReads || 10, this.readingCalls = 0, this.maxRetries = r2.maxRetries >= 0 ? r2.maxRetries : 5, this.retryTimeout = r2.retryTimeout >= 1 ? r2.retryTimeout : 350, this.state = {}, this.queue = [], this.backend?.init?.(n2, r2.backend, r2);
|
|
2040
|
-
}
|
|
2041
|
-
queueLoad(e6, t2, n2, r2) {
|
|
2042
|
-
let i2 = {}, a2 = {}, o2 = {}, s2 = {};
|
|
2043
|
-
return e6.forEach((e7) => {
|
|
2044
|
-
let r3 = true;
|
|
2045
|
-
t2.forEach((t3) => {
|
|
2046
|
-
let o3 = `${e7}|${t3}`;
|
|
2047
|
-
!n2.reload && this.store.hasResourceBundle(e7, t3) ? this.state[o3] = 2 : this.state[o3] < 0 || (this.state[o3] === 1 ? a2[o3] === void 0 && (a2[o3] = true) : (this.state[o3] = 1, r3 = false, a2[o3] === void 0 && (a2[o3] = true), i2[o3] === void 0 && (i2[o3] = true), s2[t3] === void 0 && (s2[t3] = true)));
|
|
2048
|
-
}), r3 || (o2[e7] = true);
|
|
2049
|
-
}), (Object.keys(i2).length || Object.keys(a2).length) && this.queue.push({ pending: a2, pendingCount: Object.keys(a2).length, loaded: {}, errors: [], callback: r2 }), { toLoad: Object.keys(i2), pending: Object.keys(a2), toLoadLanguages: Object.keys(o2), toLoadNamespaces: Object.keys(s2) };
|
|
2050
|
-
}
|
|
2051
|
-
loaded(e6, t2, n2) {
|
|
2052
|
-
let r2 = e6.split(`|`), i2 = r2[0], a2 = r2[1];
|
|
2053
|
-
t2 && this.emit(`failedLoading`, i2, a2, t2), !t2 && n2 && this.store.addResourceBundle(i2, a2, n2, void 0, void 0, { skipCopy: true }), this.state[e6] = t2 ? -1 : 2, t2 && n2 && (this.state[e6] = 0);
|
|
2054
|
-
let o2 = {};
|
|
2055
|
-
this.queue.forEach((n3) => {
|
|
2056
|
-
Yr(n3.loaded, [i2], a2), wi(n3, e6), t2 && n3.errors.push(t2), n3.pendingCount === 0 && !n3.done && (Object.keys(n3.loaded).forEach((e7) => {
|
|
2057
|
-
o2[e7] || (o2[e7] = {});
|
|
2058
|
-
let t3 = n3.loaded[e7];
|
|
2059
|
-
t3.length && t3.forEach((t4) => {
|
|
2060
|
-
o2[e7][t4] === void 0 && (o2[e7][t4] = true);
|
|
2061
|
-
});
|
|
2062
|
-
}), n3.done = true, n3.errors.length ? n3.callback(n3.errors) : n3.callback());
|
|
2063
|
-
}), this.emit(`loaded`, o2), this.queue = this.queue.filter((e7) => !e7.done);
|
|
2064
|
-
}
|
|
2065
|
-
read(e6, t2, n2, r2 = 0, i2 = this.retryTimeout, a2) {
|
|
2066
|
-
if (!e6.length) return a2(null, {});
|
|
2067
|
-
if (this.readingCalls >= this.maxParallelReads) {
|
|
2068
|
-
this.waitingReads.push({ lng: e6, ns: t2, fcName: n2, tried: r2, wait: i2, callback: a2 });
|
|
2069
|
-
return;
|
|
2070
|
-
}
|
|
2071
|
-
this.readingCalls++;
|
|
2072
|
-
let o2 = (o3, s3) => {
|
|
2073
|
-
if (this.readingCalls--, this.waitingReads.length > 0) {
|
|
2074
|
-
let e7 = this.waitingReads.shift();
|
|
2075
|
-
this.read(e7.lng, e7.ns, e7.fcName, e7.tried, e7.wait, e7.callback);
|
|
2076
|
-
}
|
|
2077
|
-
o3 && s3 && r2 < this.maxRetries ? setTimeout(() => {
|
|
2078
|
-
this.read(e6, t2, n2, r2 + 1, i2 * 2, a2);
|
|
2079
|
-
}, i2) : a2(o3, s3);
|
|
2080
|
-
}, s2 = this.backend[n2].bind(this.backend);
|
|
2081
|
-
if (s2.length === 2) try {
|
|
2082
|
-
let n3 = s2(e6, t2);
|
|
2083
|
-
n3 && typeof n3.then == `function` ? n3.then((e7) => o2(null, e7)).catch(o2) : o2(null, n3);
|
|
2084
|
-
} catch (e7) {
|
|
2085
|
-
o2(e7);
|
|
2086
|
-
}
|
|
2087
|
-
else return s2(e6, t2, o2);
|
|
2088
|
-
}
|
|
2089
|
-
prepareLoading(e6, t2, n2 = {}, r2) {
|
|
2090
|
-
if (!this.backend) return this.logger.warn(`No backend was added via i18next.use. Will not load resources.`), r2 && r2();
|
|
2091
|
-
R(e6) && (e6 = this.languageUtils.toResolveHierarchy(e6)), R(t2) && (t2 = [t2]);
|
|
2092
|
-
let i2 = this.queueLoad(e6, t2, n2, r2);
|
|
2093
|
-
if (!i2.toLoad.length) return i2.pending.length || r2(), null;
|
|
2094
|
-
i2.toLoad.forEach((e7) => {
|
|
2095
|
-
this.loadOne(e7);
|
|
2096
|
-
});
|
|
2097
|
-
}
|
|
2098
|
-
load(e6, t2, n2) {
|
|
2099
|
-
this.prepareLoading(e6, t2, {}, n2);
|
|
2100
|
-
}
|
|
2101
|
-
reload(e6, t2, n2) {
|
|
2102
|
-
this.prepareLoading(e6, t2, { reload: true }, n2);
|
|
2103
|
-
}
|
|
2104
|
-
loadOne(e6, t2 = ``) {
|
|
2105
|
-
let n2 = e6.split(`|`), r2 = n2[0], i2 = n2[1];
|
|
2106
|
-
this.read(r2, i2, `read`, void 0, void 0, (n3, a2) => {
|
|
2107
|
-
n3 && this.logger.warn(`${t2}loading namespace ${i2} for language ${r2} failed`, n3), !n3 && a2 && this.logger.log(`${t2}loaded namespace ${i2} for language ${r2}`, a2), this.loaded(e6, n3, a2);
|
|
2108
|
-
});
|
|
2109
|
-
}
|
|
2110
|
-
saveMissing(e6, t2, n2, r2, i2, a2 = {}, o2 = () => {
|
|
2111
|
-
}) {
|
|
2112
|
-
if (this.services?.utils?.hasLoadedNamespace && !this.services?.utils?.hasLoadedNamespace(t2)) this.logger.warn(`did not save key "${n2}" as the namespace "${t2}" was not yet loaded`, `This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!`);
|
|
2113
|
-
else if (n2 != null && n2 !== ``) {
|
|
2114
|
-
if (this.backend?.create) {
|
|
2115
|
-
let s2 = { ...a2, isUpdate: i2 }, c2 = this.backend.create.bind(this.backend);
|
|
2116
|
-
if (c2.length < 6) try {
|
|
2117
|
-
let i3;
|
|
2118
|
-
i3 = c2.length === 5 ? c2(e6, t2, n2, r2, s2) : c2(e6, t2, n2, r2), i3 && typeof i3.then == `function` ? i3.then((e7) => o2(null, e7)).catch(o2) : o2(null, i3);
|
|
2119
|
-
} catch (e7) {
|
|
2120
|
-
o2(e7);
|
|
2121
|
-
}
|
|
2122
|
-
else c2(e6, t2, n2, r2, o2, s2);
|
|
2123
|
-
}
|
|
2124
|
-
e6 && e6[0] && this.store.addResource(e6[0], t2, n2, r2);
|
|
2125
|
-
}
|
|
2126
|
-
}
|
|
2127
|
-
};
|
|
2128
|
-
var Ei = () => ({ debug: false, initAsync: true, ns: [`translation`], defaultNS: [`translation`], fallbackLng: [`dev`], fallbackNS: false, supportedLngs: false, nonExplicitSupportedLngs: false, load: `all`, preload: false, keySeparator: `.`, nsSeparator: `:`, pluralSeparator: `_`, contextSeparator: `_`, enableSelector: false, partialBundledLanguages: false, saveMissing: false, updateMissing: false, saveMissingTo: `fallback`, saveMissingPlurals: true, missingKeyHandler: false, missingInterpolationHandler: false, postProcess: false, postProcessPassResolved: false, returnNull: false, returnEmptyString: true, returnObjects: false, joinArrays: false, returnedObjectHandler: false, parseMissingKeyHandler: false, appendNamespaceToMissingKey: false, appendNamespaceToCIMode: false, overloadTranslationOptionHandler: (e6) => {
|
|
2129
|
-
let t2 = {};
|
|
2130
|
-
if (typeof e6[1] == `object` && (t2 = e6[1]), R(e6[1]) && (t2.defaultValue = e6[1]), R(e6[2]) && (t2.tDescription = e6[2]), typeof e6[2] == `object` || typeof e6[3] == `object`) {
|
|
2131
|
-
let n2 = e6[3] || e6[2];
|
|
2132
|
-
Object.keys(n2).forEach((e7) => {
|
|
2133
|
-
t2[e7] = n2[e7];
|
|
2134
|
-
});
|
|
2135
|
-
}
|
|
2136
|
-
return t2;
|
|
2137
|
-
}, interpolation: { escapeValue: true, prefix: `{{`, suffix: `}}`, formatSeparator: `,`, unescapePrefix: `-`, nestingPrefix: `$t(`, nestingSuffix: `)`, nestingOptionsSeparator: `,`, maxReplaces: 1e3, skipOnVariables: true }, cacheInBuiltFormats: true });
|
|
2138
|
-
var Di = (e6) => (R(e6.ns) && (e6.ns = [e6.ns]), R(e6.fallbackLng) && (e6.fallbackLng = [e6.fallbackLng]), R(e6.fallbackNS) && (e6.fallbackNS = [e6.fallbackNS]), e6.supportedLngs && !e6.supportedLngs.includes(`cimode`) && (e6.supportedLngs = e6.supportedLngs.concat([`cimode`])), e6);
|
|
2139
|
-
var q = () => {
|
|
2140
|
-
};
|
|
2141
|
-
var Oi = (e6) => {
|
|
2142
|
-
Object.getOwnPropertyNames(Object.getPrototypeOf(e6)).forEach((t2) => {
|
|
2143
|
-
typeof e6[t2] == `function` && (e6[t2] = e6[t2].bind(e6));
|
|
2144
|
-
});
|
|
2145
|
-
};
|
|
2146
|
-
var J = class e4 extends G {
|
|
2147
|
-
constructor(e6 = {}, t2) {
|
|
2148
|
-
if (super(), this.options = Di(e6), this.services = {}, this.logger = W, this.modules = { external: [] }, Oi(this), t2 && !this.isInitialized && !e6.isClone) {
|
|
2149
|
-
if (!this.options.initAsync) return this.init(e6, t2), this;
|
|
2150
|
-
setTimeout(() => {
|
|
2151
|
-
this.init(e6, t2);
|
|
2152
|
-
}, 0);
|
|
2153
|
-
}
|
|
2154
|
-
}
|
|
2155
|
-
init(e6 = {}, t2) {
|
|
2156
|
-
this.isInitializing = true, typeof e6 == `function` && (t2 = e6, e6 = {}), e6.defaultNS == null && e6.ns && (R(e6.ns) ? e6.defaultNS = e6.ns : e6.ns.includes(`translation`) || (e6.defaultNS = e6.ns[0]));
|
|
2157
|
-
let n2 = Ei();
|
|
2158
|
-
this.options = { ...n2, ...this.options, ...Di(e6) }, this.options.interpolation = { ...n2.interpolation, ...this.options.interpolation }, e6.keySeparator !== void 0 && (this.options.userDefinedKeySeparator = e6.keySeparator), e6.nsSeparator !== void 0 && (this.options.userDefinedNsSeparator = e6.nsSeparator), typeof this.options.overloadTranslationOptionHandler != `function` && (this.options.overloadTranslationOptionHandler = n2.overloadTranslationOptionHandler);
|
|
2159
|
-
let r2 = (e7) => e7 ? typeof e7 == `function` ? new e7() : e7 : null;
|
|
2160
|
-
if (!this.options.isClone) {
|
|
2161
|
-
this.modules.logger ? W.init(r2(this.modules.logger), this.options) : W.init(null, this.options);
|
|
2162
|
-
let e7;
|
|
2163
|
-
e7 = this.modules.formatter ? this.modules.formatter : Ci;
|
|
2164
|
-
let t3 = new pi(this.options);
|
|
2165
|
-
this.store = new si(this.options.resources, this.options);
|
|
2166
|
-
let n3 = this.services;
|
|
2167
|
-
n3.logger = W, n3.resourceStore = this.store, n3.languageUtils = t3, n3.pluralResolver = new gi(t3, { prepend: this.options.pluralSeparator }), e7 && (n3.formatter = r2(e7), n3.formatter.init && n3.formatter.init(n3, this.options), this.options.interpolation.format = n3.formatter.format.bind(n3.formatter)), n3.interpolator = new yi(this.options), n3.utils = { hasLoadedNamespace: this.hasLoadedNamespace.bind(this) }, n3.backendConnector = new Ti(r2(this.modules.backend), n3.resourceStore, n3, this.options), n3.backendConnector.on(`*`, (e8, ...t4) => {
|
|
2168
|
-
this.emit(e8, ...t4);
|
|
2169
|
-
}), this.modules.languageDetector && (n3.languageDetector = r2(this.modules.languageDetector), n3.languageDetector.init && n3.languageDetector.init(n3, this.options.detection, this.options)), this.modules.i18nFormat && (n3.i18nFormat = r2(this.modules.i18nFormat), n3.i18nFormat.init && n3.i18nFormat.init(this)), this.translator = new fi(this.services, this.options), this.translator.on(`*`, (e8, ...t4) => {
|
|
2170
|
-
this.emit(e8, ...t4);
|
|
2171
|
-
}), this.modules.external.forEach((e8) => {
|
|
2172
|
-
e8.init && e8.init(this);
|
|
2173
|
-
});
|
|
2174
|
-
}
|
|
2175
|
-
if (this.format = this.options.interpolation.format, t2 ||= q, this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
|
|
2176
|
-
let e7 = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
|
|
2177
|
-
e7.length > 0 && e7[0] !== `dev` && (this.options.lng = e7[0]);
|
|
2178
|
-
}
|
|
2179
|
-
!this.services.languageDetector && !this.options.lng && this.logger.warn(`init: no languageDetector is used and no lng is defined`), [`getResource`, `hasResourceBundle`, `getResourceBundle`, `getDataByLanguage`].forEach((e7) => {
|
|
2180
|
-
this[e7] = (...t3) => this.store[e7](...t3);
|
|
2181
|
-
}), [`addResource`, `addResources`, `addResourceBundle`, `removeResourceBundle`].forEach((e7) => {
|
|
2182
|
-
this[e7] = (...t3) => (this.store[e7](...t3), this);
|
|
2183
|
-
});
|
|
2184
|
-
let i2 = z(), a2 = () => {
|
|
2185
|
-
let e7 = (e8, n3) => {
|
|
2186
|
-
this.isInitializing = false, this.isInitialized && !this.initializedStoreOnce && this.logger.warn(`init: i18next is already initialized. You should call init just once!`), this.isInitialized = true, this.options.isClone || this.logger.log(`initialized`, this.options), this.emit(`initialized`, this.options), i2.resolve(n3), t2(e8, n3);
|
|
2187
|
-
};
|
|
2188
|
-
if ((this.languages || this.isLanguageChangingTo) && !this.isInitialized) return e7(null, this.t.bind(this));
|
|
2189
|
-
this.changeLanguage(this.options.lng, e7);
|
|
2190
|
-
};
|
|
2191
|
-
return this.options.resources || !this.options.initAsync ? a2() : setTimeout(a2, 0), i2;
|
|
2192
|
-
}
|
|
2193
|
-
loadResources(e6, t2 = q) {
|
|
2194
|
-
let n2 = t2, r2 = R(e6) ? e6 : this.language;
|
|
2195
|
-
if (typeof e6 == `function` && (n2 = e6), !this.options.resources || this.options.partialBundledLanguages) {
|
|
2196
|
-
if (r2?.toLowerCase() === `cimode` && (!this.options.preload || this.options.preload.length === 0)) return n2();
|
|
2197
|
-
let e7 = [], t3 = (t4) => {
|
|
2198
|
-
t4 && t4 !== `cimode` && this.services.languageUtils.toResolveHierarchy(t4).forEach((t5) => {
|
|
2199
|
-
t5 !== `cimode` && (e7.includes(t5) || e7.push(t5));
|
|
2200
|
-
});
|
|
2201
|
-
};
|
|
2202
|
-
r2 ? t3(r2) : this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach((e8) => t3(e8)), this.options.preload?.forEach?.((e8) => t3(e8)), this.services.backendConnector.load(e7, this.options.ns, (e8) => {
|
|
2203
|
-
!e8 && !this.resolvedLanguage && this.language && this.setResolvedLanguage(this.language), n2(e8);
|
|
2204
|
-
});
|
|
2205
|
-
} else n2(null);
|
|
2206
|
-
}
|
|
2207
|
-
reloadResources(e6, t2, n2) {
|
|
2208
|
-
let r2 = z();
|
|
2209
|
-
return typeof e6 == `function` && (n2 = e6, e6 = void 0), typeof t2 == `function` && (n2 = t2, t2 = void 0), e6 ||= this.languages, t2 ||= this.options.ns, n2 ||= q, this.services.backendConnector.reload(e6, t2, (e7) => {
|
|
2210
|
-
r2.resolve(), n2(e7);
|
|
2211
|
-
}), r2;
|
|
2212
|
-
}
|
|
2213
|
-
use(e6) {
|
|
2214
|
-
if (!e6) throw Error(`You are passing an undefined module! Please check the object you are passing to i18next.use()`);
|
|
2215
|
-
if (!e6.type) throw Error(`You are passing a wrong module! Please check the object you are passing to i18next.use()`);
|
|
2216
|
-
return e6.type === `backend` && (this.modules.backend = e6), (e6.type === `logger` || e6.log && e6.warn && e6.error) && (this.modules.logger = e6), e6.type === `languageDetector` && (this.modules.languageDetector = e6), e6.type === `i18nFormat` && (this.modules.i18nFormat = e6), e6.type === `postProcessor` && ci.addPostProcessor(e6), e6.type === `formatter` && (this.modules.formatter = e6), e6.type === `3rdParty` && this.modules.external.push(e6), this;
|
|
2217
|
-
}
|
|
2218
|
-
setResolvedLanguage(e6) {
|
|
2219
|
-
if (e6 && this.languages && ![`cimode`, `dev`].includes(e6)) {
|
|
2220
|
-
for (let e7 = 0; e7 < this.languages.length; e7++) {
|
|
2221
|
-
let t2 = this.languages[e7];
|
|
2222
|
-
if (![`cimode`, `dev`].includes(t2) && this.store.hasLanguageSomeTranslations(t2)) {
|
|
2223
|
-
this.resolvedLanguage = t2;
|
|
2224
|
-
break;
|
|
2225
|
-
}
|
|
2226
|
-
}
|
|
2227
|
-
!this.resolvedLanguage && !this.languages.includes(e6) && this.store.hasLanguageSomeTranslations(e6) && (this.resolvedLanguage = e6, this.languages.unshift(e6));
|
|
2228
|
-
}
|
|
2229
|
-
}
|
|
2230
|
-
changeLanguage(e6, t2) {
|
|
2231
|
-
this.isLanguageChangingTo = e6;
|
|
2232
|
-
let n2 = z();
|
|
2233
|
-
this.emit(`languageChanging`, e6);
|
|
2234
|
-
let r2 = (e7) => {
|
|
2235
|
-
this.language = e7, this.languages = this.services.languageUtils.toResolveHierarchy(e7), this.resolvedLanguage = void 0, this.setResolvedLanguage(e7);
|
|
2236
|
-
}, i2 = (i3, a3) => {
|
|
2237
|
-
a3 ? this.isLanguageChangingTo === e6 && (r2(a3), this.translator.changeLanguage(a3), this.isLanguageChangingTo = void 0, this.emit(`languageChanged`, a3), this.logger.log(`languageChanged`, a3)) : this.isLanguageChangingTo = void 0, n2.resolve((...e7) => this.t(...e7)), t2 && t2(i3, (...e7) => this.t(...e7));
|
|
2238
|
-
}, a2 = (t3) => {
|
|
2239
|
-
!e6 && !t3 && this.services.languageDetector && (t3 = []);
|
|
2240
|
-
let n3 = R(t3) ? t3 : t3 && t3[0], a3 = this.store.hasLanguageSomeTranslations(n3) ? n3 : this.services.languageUtils.getBestMatchFromCodes(R(t3) ? [t3] : t3);
|
|
2241
|
-
a3 && (this.language || r2(a3), this.translator.language || this.translator.changeLanguage(a3), this.services.languageDetector?.cacheUserLanguage?.(a3)), this.loadResources(a3, (e7) => {
|
|
2242
|
-
i2(e7, a3);
|
|
2243
|
-
});
|
|
2244
|
-
};
|
|
2245
|
-
return !e6 && this.services.languageDetector && !this.services.languageDetector.async ? a2(this.services.languageDetector.detect()) : !e6 && this.services.languageDetector && this.services.languageDetector.async ? this.services.languageDetector.detect.length === 0 ? this.services.languageDetector.detect().then(a2) : this.services.languageDetector.detect(a2) : a2(e6), n2;
|
|
2246
|
-
}
|
|
2247
|
-
getFixedT(e6, t2, n2, r2) {
|
|
2248
|
-
let i2 = r2?.scopeNs, a2 = (e7, t3, ...r3) => {
|
|
2249
|
-
let o2;
|
|
2250
|
-
o2 = typeof t3 == `object` ? { ...t3 } : this.options.overloadTranslationOptionHandler([e7, t3].concat(r3)), o2.lng = o2.lng || a2.lng, o2.lngs = o2.lngs || a2.lngs;
|
|
2251
|
-
let s2 = o2.ns !== void 0 && o2.ns !== null;
|
|
2252
|
-
o2.ns = o2.ns || a2.ns, o2.keyPrefix !== `` && (o2.keyPrefix = o2.keyPrefix || n2 || a2.keyPrefix);
|
|
2253
|
-
let c2 = { ...this.options, ...o2 };
|
|
2254
|
-
Array.isArray(i2) && !s2 && (c2.ns = i2), typeof o2.keyPrefix == `function` && (o2.keyPrefix = K(o2.keyPrefix, c2));
|
|
2255
|
-
let l2 = this.options.keySeparator || `.`, u2;
|
|
2256
|
-
return o2.keyPrefix && Array.isArray(e7) ? u2 = e7.map((e8) => (typeof e8 == `function` && (e8 = K(e8, c2)), `${o2.keyPrefix}${l2}${e8}`)) : (typeof e7 == `function` && (e7 = K(e7, c2)), u2 = o2.keyPrefix ? `${o2.keyPrefix}${l2}${e7}` : e7), this.t(u2, o2);
|
|
2257
|
-
};
|
|
2258
|
-
return R(e6) ? a2.lng = e6 : a2.lngs = e6, a2.ns = t2, a2.keyPrefix = n2, a2;
|
|
2259
|
-
}
|
|
2260
|
-
t(...e6) {
|
|
2261
|
-
return this.translator?.translate(...e6);
|
|
2262
|
-
}
|
|
2263
|
-
exists(...e6) {
|
|
2264
|
-
return this.translator?.exists(...e6);
|
|
2265
|
-
}
|
|
2266
|
-
setDefaultNamespace(e6) {
|
|
2267
|
-
this.options.defaultNS = e6;
|
|
2268
|
-
}
|
|
2269
|
-
hasLoadedNamespace(e6, t2 = {}) {
|
|
2270
|
-
if (!this.isInitialized) return this.logger.warn(`hasLoadedNamespace: i18next was not initialized`, this.languages), false;
|
|
2271
|
-
if (!this.languages || !this.languages.length) return this.logger.warn(`hasLoadedNamespace: i18n.languages were undefined or empty`, this.languages), false;
|
|
2272
|
-
let n2 = t2.lng || this.resolvedLanguage || this.languages[0], r2 = this.options ? this.options.fallbackLng : false, i2 = this.languages[this.languages.length - 1];
|
|
2273
|
-
if (n2.toLowerCase() === `cimode`) return true;
|
|
2274
|
-
let a2 = (e7, t3) => {
|
|
2275
|
-
let n3 = this.services.backendConnector.state[`${e7}|${t3}`];
|
|
2276
|
-
return n3 === -1 || n3 === 0 || n3 === 2;
|
|
2277
|
-
};
|
|
2278
|
-
if (t2.precheck) {
|
|
2279
|
-
let e7 = t2.precheck(this, a2);
|
|
2280
|
-
if (e7 !== void 0) return e7;
|
|
2281
|
-
}
|
|
2282
|
-
return !!(this.hasResourceBundle(n2, e6) || !this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages || a2(n2, e6) && (!r2 || a2(i2, e6)));
|
|
2283
|
-
}
|
|
2284
|
-
loadNamespaces(e6, t2) {
|
|
2285
|
-
let n2 = z();
|
|
2286
|
-
return this.options.ns ? (R(e6) && (e6 = [e6]), e6.forEach((e7) => {
|
|
2287
|
-
this.options.ns.includes(e7) || this.options.ns.push(e7);
|
|
2288
|
-
}), this.loadResources((e7) => {
|
|
2289
|
-
n2.resolve(), t2 && t2(e7);
|
|
2290
|
-
}), n2) : (t2 && t2(), Promise.resolve());
|
|
2291
|
-
}
|
|
2292
|
-
loadLanguages(e6, t2) {
|
|
2293
|
-
let n2 = z();
|
|
2294
|
-
R(e6) && (e6 = [e6]);
|
|
2295
|
-
let r2 = this.options.preload || [], i2 = e6.filter((e7) => !r2.includes(e7) && this.services.languageUtils.isSupportedCode(e7));
|
|
2296
|
-
return i2.length ? (this.options.preload = r2.concat(i2), this.loadResources((e7) => {
|
|
2297
|
-
n2.resolve(), t2 && t2(e7);
|
|
2298
|
-
}), n2) : (t2 && t2(), Promise.resolve());
|
|
2299
|
-
}
|
|
2300
|
-
dir(e6) {
|
|
2301
|
-
if (e6 ||= this.resolvedLanguage || (this.languages?.length > 0 ? this.languages[0] : this.language), !e6) return `rtl`;
|
|
2302
|
-
try {
|
|
2303
|
-
let t3 = new Intl.Locale(e6);
|
|
2304
|
-
if (t3 && t3.getTextInfo) {
|
|
2305
|
-
let e7 = t3.getTextInfo();
|
|
2306
|
-
if (e7 && e7.direction) return e7.direction;
|
|
2307
|
-
}
|
|
2308
|
-
} catch {
|
|
2309
|
-
}
|
|
2310
|
-
let t2 = `ar.shu.sqr.ssh.xaa.yhd.yud.aao.abh.abv.acm.acq.acw.acx.acy.adf.ads.aeb.aec.afb.ajp.apc.apd.arb.arq.ars.ary.arz.auz.avl.ayh.ayl.ayn.ayp.bbz.pga.he.iw.ps.pbt.pbu.pst.prp.prd.ug.ur.ydd.yds.yih.ji.yi.hbo.men.xmn.fa.jpr.peo.pes.prs.dv.sam.ckb`.split(`.`), n2 = this.services?.languageUtils || new pi(Ei());
|
|
2311
|
-
return e6.toLowerCase().indexOf(`-latn`) > 1 ? `ltr` : t2.includes(n2.getLanguagePartFromCode(e6)) || e6.toLowerCase().indexOf(`-arab`) > 1 ? `rtl` : `ltr`;
|
|
2312
|
-
}
|
|
2313
|
-
static createInstance(t2 = {}, n2) {
|
|
2314
|
-
let r2 = new e4(t2, n2);
|
|
2315
|
-
return r2.createInstance = e4.createInstance, r2;
|
|
2316
|
-
}
|
|
2317
|
-
cloneInstance(t2 = {}, n2 = q) {
|
|
2318
|
-
let r2 = t2.forkResourceStore;
|
|
2319
|
-
r2 && delete t2.forkResourceStore;
|
|
2320
|
-
let i2 = { ...this.options, ...t2, isClone: true }, a2 = new e4(i2);
|
|
2321
|
-
if ((t2.debug !== void 0 || t2.prefix !== void 0) && (a2.logger = a2.logger.clone(t2)), [`store`, `services`, `language`].forEach((e6) => {
|
|
2322
|
-
a2[e6] = this[e6];
|
|
2323
|
-
}), a2.services = { ...this.services }, a2.services.utils = { hasLoadedNamespace: a2.hasLoadedNamespace.bind(a2) }, r2 && (a2.store = new si(Object.keys(this.store.data).reduce((e6, t3) => (e6[t3] = { ...this.store.data[t3] }, e6[t3] = Object.keys(e6[t3]).reduce((n3, r3) => (n3[r3] = { ...e6[t3][r3] }, n3), e6[t3]), e6), {}), i2), a2.services.resourceStore = a2.store), t2.interpolation) {
|
|
2324
|
-
let e6 = { ...Ei().interpolation, ...this.options.interpolation, ...t2.interpolation }, n3 = { ...i2, interpolation: e6 };
|
|
2325
|
-
a2.services.interpolator = new yi(n3);
|
|
2326
|
-
}
|
|
2327
|
-
return a2.translator = new fi(a2.services, i2), a2.translator.on(`*`, (e6, ...t3) => {
|
|
2328
|
-
a2.emit(e6, ...t3);
|
|
2329
|
-
}), a2.init(i2, n2), a2.translator.options = i2, a2.translator.backendConnector.services.utils = { hasLoadedNamespace: a2.hasLoadedNamespace.bind(a2) }, a2;
|
|
2330
|
-
}
|
|
2331
|
-
toJSON() {
|
|
2332
|
-
return { options: this.options, store: this.store, language: this.language, languages: this.languages, resolvedLanguage: this.resolvedLanguage };
|
|
2333
|
-
}
|
|
2334
|
-
}.createInstance();
|
|
2335
|
-
J.createInstance, J.dir, J.init, J.loadResources, J.reloadResources, J.use, J.changeLanguage, J.getFixedT, J.t, J.exists, J.setDefaultNamespace, J.hasLoadedNamespace, J.loadNamespaces, J.loadLanguages;
|
|
2336
|
-
var ki = ({ locale: e6, asyncMessagesLoader: t2, messages: n2, useSuspense: r2 = false, disableAutoInit: i2 = false, bindI18n: a2 }, { icu: o2 } = {}) => {
|
|
2337
|
-
let s2 = { lng: e6, fallbackLng: `en`, keySeparator: false, react: { useSuspense: r2, bindI18n: a2 }, _polyfill: { isLoading: false } }, c2 = J.createInstance(i2 ? s2 : void 0);
|
|
2338
|
-
return o2 && c2.use(o2), t2 && c2.use({ type: `backend`, read: async (e7, n3, r3) => {
|
|
2339
|
-
try {
|
|
2340
|
-
return r3(null, await t2(e7));
|
|
2341
|
-
} catch (e8) {
|
|
2342
|
-
return r3(e8, null);
|
|
2343
|
-
}
|
|
2344
|
-
} }), n2 && (s2.resources = { [e6]: { translation: n2 } }), i2 || c2.init(s2), c2;
|
|
2345
|
-
};
|
|
2346
|
-
var Ai = [`__proto__`, `constructor`, `prototype`];
|
|
2347
|
-
function ji(e6, t2, n2) {
|
|
2348
|
-
function r2(e7) {
|
|
2349
|
-
return e7 && e7.indexOf(`###`) > -1 ? e7.replace(/###/g, `.`) : e7;
|
|
2350
|
-
}
|
|
2351
|
-
function i2() {
|
|
2352
|
-
return !e6 || typeof e6 == `string`;
|
|
2353
|
-
}
|
|
2354
|
-
for (var a2 = typeof t2 == `string` ? t2.split(`.`) : [].concat(t2); a2.length > 1; ) {
|
|
2355
|
-
if (i2()) return {};
|
|
2356
|
-
var o2 = r2(a2.shift());
|
|
2357
|
-
if (Ai.indexOf(o2) > -1) return {};
|
|
2358
|
-
!e6[o2] && n2 && (e6[o2] = new n2()), e6 = e6[o2];
|
|
2359
|
-
}
|
|
2360
|
-
if (i2()) return {};
|
|
2361
|
-
var s2 = r2(a2.shift());
|
|
2362
|
-
return Ai.indexOf(s2) > -1 ? {} : { obj: e6, k: s2 };
|
|
2363
|
-
}
|
|
2364
|
-
function Mi(e6, t2, n2) {
|
|
2365
|
-
var r2 = ji(e6, t2, Object), i2 = r2.obj, a2 = r2.k;
|
|
2366
|
-
i2 !== void 0 && (i2[a2] = n2);
|
|
2367
|
-
}
|
|
2368
|
-
function Ni(e6, t2) {
|
|
2369
|
-
var n2 = ji(e6, t2), r2 = n2.obj, i2 = n2.k;
|
|
2370
|
-
if (r2) return r2[i2];
|
|
2371
|
-
}
|
|
2372
|
-
var Pi = [];
|
|
2373
|
-
var Fi = Pi.forEach;
|
|
2374
|
-
var Ii = Pi.slice;
|
|
2375
|
-
function Li(e6) {
|
|
2376
|
-
return Fi.call(Ii.call(arguments, 1), function(t2) {
|
|
2377
|
-
if (t2) for (var n2 = 0, r2 = Object.keys(t2); n2 < r2.length; n2++) {
|
|
2378
|
-
var i2 = r2[n2];
|
|
2379
|
-
Ai.indexOf(i2) > -1 || e6[i2] === void 0 && (e6[i2] = t2[i2]);
|
|
2380
|
-
}
|
|
2381
|
-
}), e6;
|
|
2382
|
-
}
|
|
2383
|
-
function Ri(e6, t2) {
|
|
2384
|
-
let n2 = t2 && t2.cache ? t2.cache : Ji, r2 = t2 && t2.serializer ? t2.serializer : Ki;
|
|
2385
|
-
return (t2 && t2.strategy ? t2.strategy : Ui)(e6, { cache: n2, serializer: r2 });
|
|
2386
|
-
}
|
|
2387
|
-
function zi(e6) {
|
|
2388
|
-
return e6 == null || typeof e6 == `number` || typeof e6 == `boolean`;
|
|
2389
|
-
}
|
|
2390
|
-
function Bi(e6, t2, n2, r2) {
|
|
2391
|
-
let i2 = zi(r2) ? r2 : n2(r2), a2 = t2.get(i2);
|
|
2392
|
-
return a2 === void 0 && (a2 = e6.call(this, r2), t2.set(i2, a2)), a2;
|
|
2393
|
-
}
|
|
2394
|
-
function Vi(e6, t2, n2) {
|
|
2395
|
-
let r2 = Array.prototype.slice.call(arguments, 3), i2 = n2(r2), a2 = t2.get(i2);
|
|
2396
|
-
return a2 === void 0 && (a2 = e6.apply(this, r2), t2.set(i2, a2)), a2;
|
|
2397
|
-
}
|
|
2398
|
-
function Hi(e6, t2, n2, r2, i2) {
|
|
2399
|
-
return n2.bind(t2, e6, r2, i2);
|
|
2400
|
-
}
|
|
2401
|
-
function Ui(e6, t2) {
|
|
2402
|
-
let n2 = e6.length === 1 ? Bi : Vi;
|
|
2403
|
-
return Hi(e6, this, n2, t2.cache.create(), t2.serializer);
|
|
2404
|
-
}
|
|
2405
|
-
function Wi(e6, t2) {
|
|
2406
|
-
return Hi(e6, this, Vi, t2.cache.create(), t2.serializer);
|
|
2407
|
-
}
|
|
2408
|
-
function Gi(e6, t2) {
|
|
2409
|
-
return Hi(e6, this, Bi, t2.cache.create(), t2.serializer);
|
|
2410
|
-
}
|
|
2411
|
-
var Ki = function() {
|
|
2412
|
-
return JSON.stringify(arguments);
|
|
2413
|
-
};
|
|
2414
|
-
var qi = class {
|
|
2415
|
-
constructor() {
|
|
2416
|
-
this.cache = /* @__PURE__ */ Object.create(null);
|
|
2417
|
-
}
|
|
2418
|
-
get(e6) {
|
|
2419
|
-
return this.cache[e6];
|
|
2420
|
-
}
|
|
2421
|
-
set(e6, t2) {
|
|
2422
|
-
this.cache[e6] = t2;
|
|
2423
|
-
}
|
|
2424
|
-
};
|
|
2425
|
-
var Ji = { create: function() {
|
|
2426
|
-
return new qi();
|
|
2427
|
-
} };
|
|
2428
|
-
var Yi = { variadic: Wi, monadic: Gi };
|
|
2429
|
-
var Xi = /(?:[Eec]{1,6}|G{1,5}|[Qq]{1,5}|(?:[yYur]+|U{1,5})|[ML]{1,5}|d{1,2}|D{1,3}|F{1}|[abB]{1,5}|[hkHK]{1,2}|w{1,2}|W{1}|m{1,2}|s{1,2}|[zZOvVxX]{1,4})(?=([^']*'[^']*')*[^']*$)/g;
|
|
2430
|
-
function Zi(e6) {
|
|
2431
|
-
let t2 = {};
|
|
2432
|
-
return e6.replace(Xi, (e7) => {
|
|
2433
|
-
let n2 = e7.length;
|
|
2434
|
-
switch (e7[0]) {
|
|
2435
|
-
case `G`:
|
|
2436
|
-
t2.era = n2 === 4 ? `long` : n2 === 5 ? `narrow` : `short`;
|
|
2437
|
-
break;
|
|
2438
|
-
case `y`:
|
|
2439
|
-
t2.year = n2 === 2 ? `2-digit` : `numeric`;
|
|
2440
|
-
break;
|
|
2441
|
-
case `Y`:
|
|
2442
|
-
case `u`:
|
|
2443
|
-
case `U`:
|
|
2444
|
-
case `r`:
|
|
2445
|
-
throw RangeError("`Y/u/U/r` (year) patterns are not supported, use `y` instead");
|
|
2446
|
-
case `q`:
|
|
2447
|
-
case `Q`:
|
|
2448
|
-
throw RangeError("`q/Q` (quarter) patterns are not supported");
|
|
2449
|
-
case `M`:
|
|
2450
|
-
case `L`:
|
|
2451
|
-
t2.month = [`numeric`, `2-digit`, `short`, `long`, `narrow`][n2 - 1];
|
|
2452
|
-
break;
|
|
2453
|
-
case `w`:
|
|
2454
|
-
case `W`:
|
|
2455
|
-
throw RangeError("`w/W` (week) patterns are not supported");
|
|
2456
|
-
case `d`:
|
|
2457
|
-
t2.day = [`numeric`, `2-digit`][n2 - 1];
|
|
2458
|
-
break;
|
|
2459
|
-
case `D`:
|
|
2460
|
-
case `F`:
|
|
2461
|
-
case `g`:
|
|
2462
|
-
throw RangeError("`D/F/g` (day) patterns are not supported, use `d` instead");
|
|
2463
|
-
case `E`:
|
|
2464
|
-
t2.weekday = n2 === 4 ? `long` : n2 === 5 ? `narrow` : `short`;
|
|
2465
|
-
break;
|
|
2466
|
-
case `e`:
|
|
2467
|
-
if (n2 < 4) throw RangeError("`e..eee` (weekday) patterns are not supported");
|
|
2468
|
-
t2.weekday = [`short`, `long`, `narrow`, `short`][n2 - 3];
|
|
2469
|
-
break;
|
|
2470
|
-
case `c`:
|
|
2471
|
-
if (n2 < 4) throw RangeError("`c..ccc` (weekday) patterns are not supported");
|
|
2472
|
-
t2.weekday = [`short`, `long`, `narrow`, `short`][n2 - 3];
|
|
2473
|
-
break;
|
|
2474
|
-
case `a`:
|
|
2475
|
-
t2.hour12 = true;
|
|
2476
|
-
break;
|
|
2477
|
-
case `b`:
|
|
2478
|
-
case `B`:
|
|
2479
|
-
throw RangeError("`b/B` (period) patterns are not supported, use `a` instead");
|
|
2480
|
-
case `h`:
|
|
2481
|
-
t2.hourCycle = `h12`, t2.hour = [`numeric`, `2-digit`][n2 - 1];
|
|
2482
|
-
break;
|
|
2483
|
-
case `H`:
|
|
2484
|
-
t2.hourCycle = `h23`, t2.hour = [`numeric`, `2-digit`][n2 - 1];
|
|
2485
|
-
break;
|
|
2486
|
-
case `K`:
|
|
2487
|
-
t2.hourCycle = `h11`, t2.hour = [`numeric`, `2-digit`][n2 - 1];
|
|
2488
|
-
break;
|
|
2489
|
-
case `k`:
|
|
2490
|
-
t2.hourCycle = `h24`, t2.hour = [`numeric`, `2-digit`][n2 - 1];
|
|
2491
|
-
break;
|
|
2492
|
-
case `j`:
|
|
2493
|
-
case `J`:
|
|
2494
|
-
case `C`:
|
|
2495
|
-
throw RangeError("`j/J/C` (hour) patterns are not supported, use `h/H/K/k` instead");
|
|
2496
|
-
case `m`:
|
|
2497
|
-
t2.minute = [`numeric`, `2-digit`][n2 - 1];
|
|
2498
|
-
break;
|
|
2499
|
-
case `s`:
|
|
2500
|
-
t2.second = [`numeric`, `2-digit`][n2 - 1];
|
|
2501
|
-
break;
|
|
2502
|
-
case `S`:
|
|
2503
|
-
case `A`:
|
|
2504
|
-
throw RangeError("`S/A` (second) patterns are not supported, use `s` instead");
|
|
2505
|
-
case `z`:
|
|
2506
|
-
t2.timeZoneName = n2 < 4 ? `short` : `long`;
|
|
2507
|
-
break;
|
|
2508
|
-
case `Z`:
|
|
2509
|
-
case `O`:
|
|
2510
|
-
case `v`:
|
|
2511
|
-
case `V`:
|
|
2512
|
-
case `X`:
|
|
2513
|
-
case `x`:
|
|
2514
|
-
throw RangeError("`Z/O/v/V/X/x` (timeZone) patterns are not supported, use `z` instead");
|
|
2515
|
-
}
|
|
2516
|
-
return ``;
|
|
2517
|
-
}), t2;
|
|
2518
|
-
}
|
|
2519
|
-
var Qi = /[\t-\r \x85\u200E\u200F\u2028\u2029]/i;
|
|
2520
|
-
function $i(e6) {
|
|
2521
|
-
if (e6.length === 0) throw Error(`Number skeleton cannot be empty`);
|
|
2522
|
-
let t2 = e6.split(Qi).filter((e7) => e7.length > 0), n2 = [];
|
|
2523
|
-
for (let e7 of t2) {
|
|
2524
|
-
let t3 = e7.split(`/`);
|
|
2525
|
-
if (t3.length === 0) throw Error(`Invalid number skeleton`);
|
|
2526
|
-
let [r2, ...i2] = t3;
|
|
2527
|
-
for (let e8 of i2) if (e8.length === 0) throw Error(`Invalid number skeleton`);
|
|
2528
|
-
n2.push({ stem: r2, options: i2 });
|
|
2529
|
-
}
|
|
2530
|
-
return n2;
|
|
2531
|
-
}
|
|
2532
|
-
function ea(e6) {
|
|
2533
|
-
return e6.replace(/^(.*?)-/, ``);
|
|
2534
|
-
}
|
|
2535
|
-
var ta = /^\.(?:(0+)(\*)?|(#+)|(0+)(#+))$/g;
|
|
2536
|
-
var na = /^(@+)?(\+|#+)?[rs]?$/g;
|
|
2537
|
-
var ra = /(\*)(0+)|(#+)(0+)|(0+)/g;
|
|
2538
|
-
var ia = /^(0+)$/;
|
|
2539
|
-
function aa(e6) {
|
|
2540
|
-
let t2 = {};
|
|
2541
|
-
return e6[e6.length - 1] === `r` ? t2.roundingPriority = `morePrecision` : e6[e6.length - 1] === `s` && (t2.roundingPriority = `lessPrecision`), e6.replace(na, function(e7, n2, r2) {
|
|
2542
|
-
return typeof r2 == `string` ? r2 === `+` ? t2.minimumSignificantDigits = n2.length : n2[0] === `#` ? t2.maximumSignificantDigits = n2.length : (t2.minimumSignificantDigits = n2.length, t2.maximumSignificantDigits = n2.length + (typeof r2 == `string` ? r2.length : 0)) : (t2.minimumSignificantDigits = n2.length, t2.maximumSignificantDigits = n2.length), ``;
|
|
2543
|
-
}), t2;
|
|
2544
|
-
}
|
|
2545
|
-
function oa(e6) {
|
|
2546
|
-
switch (e6) {
|
|
2547
|
-
case `sign-auto`:
|
|
2548
|
-
return { signDisplay: `auto` };
|
|
2549
|
-
case `sign-accounting`:
|
|
2550
|
-
case `()`:
|
|
2551
|
-
return { currencySign: `accounting` };
|
|
2552
|
-
case `sign-always`:
|
|
2553
|
-
case `+!`:
|
|
2554
|
-
return { signDisplay: `always` };
|
|
2555
|
-
case `sign-accounting-always`:
|
|
2556
|
-
case `()!`:
|
|
2557
|
-
return { signDisplay: `always`, currencySign: `accounting` };
|
|
2558
|
-
case `sign-except-zero`:
|
|
2559
|
-
case `+?`:
|
|
2560
|
-
return { signDisplay: `exceptZero` };
|
|
2561
|
-
case `sign-accounting-except-zero`:
|
|
2562
|
-
case `()?`:
|
|
2563
|
-
return { signDisplay: `exceptZero`, currencySign: `accounting` };
|
|
2564
|
-
case `sign-never`:
|
|
2565
|
-
case `+_`:
|
|
2566
|
-
return { signDisplay: `never` };
|
|
2567
|
-
}
|
|
2568
|
-
}
|
|
2569
|
-
function sa(e6) {
|
|
2570
|
-
let t2;
|
|
2571
|
-
if (e6[0] === `E` && e6[1] === `E` ? (t2 = { notation: `engineering` }, e6 = e6.slice(2)) : e6[0] === `E` && (t2 = { notation: `scientific` }, e6 = e6.slice(1)), t2) {
|
|
2572
|
-
let n2 = e6.slice(0, 2);
|
|
2573
|
-
if (n2 === `+!` ? (t2.signDisplay = `always`, e6 = e6.slice(2)) : n2 === `+?` && (t2.signDisplay = `exceptZero`, e6 = e6.slice(2)), !ia.test(e6)) throw Error(`Malformed concise eng/scientific notation`);
|
|
2574
|
-
t2.minimumIntegerDigits = e6.length;
|
|
2575
|
-
}
|
|
2576
|
-
return t2;
|
|
2577
|
-
}
|
|
2578
|
-
function ca(e6) {
|
|
2579
|
-
return oa(e6) || {};
|
|
2580
|
-
}
|
|
2581
|
-
function la(e6) {
|
|
2582
|
-
let t2 = {};
|
|
2583
|
-
for (let n2 of e6) {
|
|
2584
|
-
switch (n2.stem) {
|
|
2585
|
-
case `percent`:
|
|
2586
|
-
case `%`:
|
|
2587
|
-
t2.style = `percent`;
|
|
2588
|
-
continue;
|
|
2589
|
-
case `%x100`:
|
|
2590
|
-
t2.style = `percent`, t2.scale = 100;
|
|
2591
|
-
continue;
|
|
2592
|
-
case `currency`:
|
|
2593
|
-
t2.style = `currency`, t2.currency = n2.options[0];
|
|
2594
|
-
continue;
|
|
2595
|
-
case `group-off`:
|
|
2596
|
-
case `,_`:
|
|
2597
|
-
t2.useGrouping = false;
|
|
2598
|
-
continue;
|
|
2599
|
-
case `precision-integer`:
|
|
2600
|
-
case `.`:
|
|
2601
|
-
t2.maximumFractionDigits = 0;
|
|
2602
|
-
continue;
|
|
2603
|
-
case `measure-unit`:
|
|
2604
|
-
case `unit`:
|
|
2605
|
-
t2.style = `unit`, t2.unit = ea(n2.options[0]);
|
|
2606
|
-
continue;
|
|
2607
|
-
case `compact-short`:
|
|
2608
|
-
case `K`:
|
|
2609
|
-
t2.notation = `compact`, t2.compactDisplay = `short`;
|
|
2610
|
-
continue;
|
|
2611
|
-
case `compact-long`:
|
|
2612
|
-
case `KK`:
|
|
2613
|
-
t2.notation = `compact`, t2.compactDisplay = `long`;
|
|
2614
|
-
continue;
|
|
2615
|
-
case `scientific`:
|
|
2616
|
-
t2 = { ...t2, notation: `scientific`, ...n2.options.reduce((e8, t3) => ({ ...e8, ...ca(t3) }), {}) };
|
|
2617
|
-
continue;
|
|
2618
|
-
case `engineering`:
|
|
2619
|
-
t2 = { ...t2, notation: `engineering`, ...n2.options.reduce((e8, t3) => ({ ...e8, ...ca(t3) }), {}) };
|
|
2620
|
-
continue;
|
|
2621
|
-
case `notation-simple`:
|
|
2622
|
-
t2.notation = `standard`;
|
|
2623
|
-
continue;
|
|
2624
|
-
case `unit-width-narrow`:
|
|
2625
|
-
t2.currencyDisplay = `narrowSymbol`, t2.unitDisplay = `narrow`;
|
|
2626
|
-
continue;
|
|
2627
|
-
case `unit-width-short`:
|
|
2628
|
-
t2.currencyDisplay = `code`, t2.unitDisplay = `short`;
|
|
2629
|
-
continue;
|
|
2630
|
-
case `unit-width-full-name`:
|
|
2631
|
-
t2.currencyDisplay = `name`, t2.unitDisplay = `long`;
|
|
2632
|
-
continue;
|
|
2633
|
-
case `unit-width-iso-code`:
|
|
2634
|
-
t2.currencyDisplay = `symbol`;
|
|
2635
|
-
continue;
|
|
2636
|
-
case `scale`:
|
|
2637
|
-
t2.scale = parseFloat(n2.options[0]);
|
|
2638
|
-
continue;
|
|
2639
|
-
case `rounding-mode-floor`:
|
|
2640
|
-
t2.roundingMode = `floor`;
|
|
2641
|
-
continue;
|
|
2642
|
-
case `rounding-mode-ceiling`:
|
|
2643
|
-
t2.roundingMode = `ceil`;
|
|
2644
|
-
continue;
|
|
2645
|
-
case `rounding-mode-down`:
|
|
2646
|
-
t2.roundingMode = `trunc`;
|
|
2647
|
-
continue;
|
|
2648
|
-
case `rounding-mode-up`:
|
|
2649
|
-
t2.roundingMode = `expand`;
|
|
2650
|
-
continue;
|
|
2651
|
-
case `rounding-mode-half-even`:
|
|
2652
|
-
t2.roundingMode = `halfEven`;
|
|
2653
|
-
continue;
|
|
2654
|
-
case `rounding-mode-half-down`:
|
|
2655
|
-
t2.roundingMode = `halfTrunc`;
|
|
2656
|
-
continue;
|
|
2657
|
-
case `rounding-mode-half-up`:
|
|
2658
|
-
t2.roundingMode = `halfExpand`;
|
|
2659
|
-
continue;
|
|
2660
|
-
case `integer-width`:
|
|
2661
|
-
if (n2.options.length > 1) throw RangeError(`integer-width stems only accept a single optional option`);
|
|
2662
|
-
n2.options[0].replace(ra, function(e8, n3, r3, i2, a2, o2) {
|
|
2663
|
-
if (n3) t2.minimumIntegerDigits = r3.length;
|
|
2664
|
-
else if (i2 && a2) throw Error(`We currently do not support maximum integer digits`);
|
|
2665
|
-
else if (o2) throw Error(`We currently do not support exact integer digits`);
|
|
2666
|
-
return ``;
|
|
2667
|
-
});
|
|
2668
|
-
continue;
|
|
2669
|
-
}
|
|
2670
|
-
if (ia.test(n2.stem)) {
|
|
2671
|
-
t2.minimumIntegerDigits = n2.stem.length;
|
|
2672
|
-
continue;
|
|
2673
|
-
}
|
|
2674
|
-
if (ta.test(n2.stem)) {
|
|
2675
|
-
if (n2.options.length > 1) throw RangeError(`Fraction-precision stems only accept a single optional option`);
|
|
2676
|
-
n2.stem.replace(ta, function(e9, n3, r3, i2, a2, o2) {
|
|
2677
|
-
return r3 === `*` ? t2.minimumFractionDigits = n3.length : i2 && i2[0] === `#` ? t2.maximumFractionDigits = i2.length : a2 && o2 ? (t2.minimumFractionDigits = a2.length, t2.maximumFractionDigits = a2.length + o2.length) : (t2.minimumFractionDigits = n3.length, t2.maximumFractionDigits = n3.length), ``;
|
|
2678
|
-
});
|
|
2679
|
-
let e8 = n2.options[0];
|
|
2680
|
-
e8 === `w` ? t2 = { ...t2, trailingZeroDisplay: `stripIfInteger` } : e8 && (t2 = { ...t2, ...aa(e8) });
|
|
2681
|
-
continue;
|
|
2682
|
-
}
|
|
2683
|
-
if (na.test(n2.stem)) {
|
|
2684
|
-
t2 = { ...t2, ...aa(n2.stem) };
|
|
2685
|
-
continue;
|
|
2686
|
-
}
|
|
2687
|
-
let e7 = oa(n2.stem);
|
|
2688
|
-
e7 && (t2 = { ...t2, ...e7 });
|
|
2689
|
-
let r2 = sa(n2.stem);
|
|
2690
|
-
r2 && (t2 = { ...t2, ...r2 });
|
|
2691
|
-
}
|
|
2692
|
-
return t2;
|
|
2693
|
-
}
|
|
2694
|
-
var ua = function(e6) {
|
|
2695
|
-
return e6[e6.EXPECT_ARGUMENT_CLOSING_BRACE = 1] = `EXPECT_ARGUMENT_CLOSING_BRACE`, e6[e6.EMPTY_ARGUMENT = 2] = `EMPTY_ARGUMENT`, e6[e6.MALFORMED_ARGUMENT = 3] = `MALFORMED_ARGUMENT`, e6[e6.EXPECT_ARGUMENT_TYPE = 4] = `EXPECT_ARGUMENT_TYPE`, e6[e6.INVALID_ARGUMENT_TYPE = 5] = `INVALID_ARGUMENT_TYPE`, e6[e6.EXPECT_ARGUMENT_STYLE = 6] = `EXPECT_ARGUMENT_STYLE`, e6[e6.INVALID_NUMBER_SKELETON = 7] = `INVALID_NUMBER_SKELETON`, e6[e6.INVALID_DATE_TIME_SKELETON = 8] = `INVALID_DATE_TIME_SKELETON`, e6[e6.EXPECT_NUMBER_SKELETON = 9] = `EXPECT_NUMBER_SKELETON`, e6[e6.EXPECT_DATE_TIME_SKELETON = 10] = `EXPECT_DATE_TIME_SKELETON`, e6[e6.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE = 11] = `UNCLOSED_QUOTE_IN_ARGUMENT_STYLE`, e6[e6.EXPECT_SELECT_ARGUMENT_OPTIONS = 12] = `EXPECT_SELECT_ARGUMENT_OPTIONS`, e6[e6.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE = 13] = `EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE`, e6[e6.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE = 14] = `INVALID_PLURAL_ARGUMENT_OFFSET_VALUE`, e6[e6.EXPECT_SELECT_ARGUMENT_SELECTOR = 15] = `EXPECT_SELECT_ARGUMENT_SELECTOR`, e6[e6.EXPECT_PLURAL_ARGUMENT_SELECTOR = 16] = `EXPECT_PLURAL_ARGUMENT_SELECTOR`, e6[e6.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT = 17] = `EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT`, e6[e6.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT = 18] = `EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT`, e6[e6.INVALID_PLURAL_ARGUMENT_SELECTOR = 19] = `INVALID_PLURAL_ARGUMENT_SELECTOR`, e6[e6.DUPLICATE_PLURAL_ARGUMENT_SELECTOR = 20] = `DUPLICATE_PLURAL_ARGUMENT_SELECTOR`, e6[e6.DUPLICATE_SELECT_ARGUMENT_SELECTOR = 21] = `DUPLICATE_SELECT_ARGUMENT_SELECTOR`, e6[e6.MISSING_OTHER_CLAUSE = 22] = `MISSING_OTHER_CLAUSE`, e6[e6.INVALID_TAG = 23] = `INVALID_TAG`, e6[e6.INVALID_TAG_NAME = 25] = `INVALID_TAG_NAME`, e6[e6.UNMATCHED_CLOSING_TAG = 26] = `UNMATCHED_CLOSING_TAG`, e6[e6.UNCLOSED_TAG = 27] = `UNCLOSED_TAG`, e6;
|
|
2696
|
-
}({});
|
|
2697
|
-
function da(e6) {
|
|
2698
|
-
return e6.type === 0;
|
|
2699
|
-
}
|
|
2700
|
-
function fa(e6) {
|
|
2701
|
-
return e6.type === 1;
|
|
2702
|
-
}
|
|
2703
|
-
function pa(e6) {
|
|
2704
|
-
return e6.type === 2;
|
|
2705
|
-
}
|
|
2706
|
-
function ma(e6) {
|
|
2707
|
-
return e6.type === 3;
|
|
2708
|
-
}
|
|
2709
|
-
function ha(e6) {
|
|
2710
|
-
return e6.type === 4;
|
|
2711
|
-
}
|
|
2712
|
-
function ga(e6) {
|
|
2713
|
-
return e6.type === 5;
|
|
2714
|
-
}
|
|
2715
|
-
function _a(e6) {
|
|
2716
|
-
return e6.type === 6;
|
|
2717
|
-
}
|
|
2718
|
-
function va(e6) {
|
|
2719
|
-
return e6.type === 7;
|
|
2720
|
-
}
|
|
2721
|
-
function ya(e6) {
|
|
2722
|
-
return e6.type === 8;
|
|
2723
|
-
}
|
|
2724
|
-
function ba(e6) {
|
|
2725
|
-
return !!(e6 && typeof e6 == `object` && e6.type === 0);
|
|
2726
|
-
}
|
|
2727
|
-
function xa(e6) {
|
|
2728
|
-
return !!(e6 && typeof e6 == `object` && e6.type === 1);
|
|
2729
|
-
}
|
|
2730
|
-
var Sa = /[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/;
|
|
2731
|
-
var Y = { "001": [`H`, `h`], 419: [`h`, `H`, `hB`, `hb`], AC: [`H`, `h`, `hb`, `hB`], AD: [`H`, `hB`], AE: [`h`, `hB`, `hb`, `H`], AF: [`H`, `hb`, `hB`, `h`], AG: [`h`, `hb`, `H`, `hB`], AI: [`H`, `h`, `hb`, `hB`], AL: [`h`, `H`, `hB`], AM: [`H`, `hB`], AO: [`H`, `hB`], AR: [`h`, `H`, `hB`, `hb`], AS: [`h`, `H`], AT: [`H`, `hB`], AU: [`h`, `hb`, `H`, `hB`], AW: [`H`, `hB`], AX: [`H`], AZ: [`H`, `hB`, `h`], BA: [`H`, `hB`, `h`], BB: [`h`, `hb`, `H`, `hB`], BD: [`h`, `hB`, `H`], BE: [`H`, `hB`], BF: [`H`, `hB`], BG: [`H`, `hB`, `h`], BH: [`h`, `hB`, `hb`, `H`], BI: [`H`, `h`], BJ: [`H`, `hB`], BL: [`H`, `hB`], BM: [`h`, `hb`, `H`, `hB`], BN: [`hb`, `hB`, `h`, `H`], BO: [`h`, `H`, `hB`, `hb`], BQ: [`H`], BR: [`H`, `hB`], BS: [`h`, `hb`, `H`, `hB`], BT: [`h`, `H`], BW: [`H`, `h`, `hb`, `hB`], BY: [`H`, `h`], BZ: [`H`, `h`, `hb`, `hB`], CA: [`h`, `hb`, `H`, `hB`], CC: [`H`, `h`, `hb`, `hB`], CD: [`hB`, `H`], CF: [`H`, `h`, `hB`], CG: [`H`, `hB`], CH: [`H`, `hB`, `h`], CI: [`H`, `hB`], CK: [`H`, `h`, `hb`, `hB`], CL: [`h`, `H`, `hB`, `hb`], CM: [`H`, `h`, `hB`], CN: [`H`, `hB`, `hb`, `h`], CO: [`h`, `H`, `hB`, `hb`], CP: [`H`], CR: [`h`, `H`, `hB`, `hb`], CU: [`h`, `H`, `hB`, `hb`], CV: [`H`, `hB`], CW: [`H`, `hB`], CX: [`H`, `h`, `hb`, `hB`], CY: [`h`, `H`, `hb`, `hB`], CZ: [`H`], DE: [`H`, `hB`], DG: [`H`, `h`, `hb`, `hB`], DJ: [`h`, `H`], DK: [`H`], DM: [`h`, `hb`, `H`, `hB`], DO: [`h`, `H`, `hB`, `hb`], DZ: [`h`, `hB`, `hb`, `H`], EA: [`H`, `h`, `hB`, `hb`], EC: [`h`, `H`, `hB`, `hb`], EE: [`H`, `hB`], EG: [`h`, `hB`, `hb`, `H`], EH: [`h`, `hB`, `hb`, `H`], ER: [`h`, `H`], ES: [`H`, `hB`, `h`, `hb`], ET: [`hB`, `hb`, `h`, `H`], FI: [`H`], FJ: [`h`, `hb`, `H`, `hB`], FK: [`H`, `h`, `hb`, `hB`], FM: [`h`, `hb`, `H`, `hB`], FO: [`H`, `h`], FR: [`H`, `hB`], GA: [`H`, `hB`], GB: [`H`, `h`, `hb`, `hB`], GD: [`h`, `hb`, `H`, `hB`], GE: [`H`, `hB`, `h`], GF: [`H`, `hB`], GG: [`H`, `h`, `hb`, `hB`], GH: [`h`, `H`], GI: [`H`, `h`, `hb`, `hB`], GL: [`H`, `h`], GM: [`h`, `hb`, `H`, `hB`], GN: [`H`, `hB`], GP: [`H`, `hB`], GQ: [`H`, `hB`, `h`, `hb`], GR: [`h`, `H`, `hb`, `hB`], GS: [`H`, `h`, `hb`, `hB`], GT: [`h`, `H`, `hB`, `hb`], GU: [`h`, `hb`, `H`, `hB`], GW: [`H`, `hB`], GY: [`h`, `hb`, `H`, `hB`], HK: [`h`, `hB`, `hb`, `H`], HN: [`h`, `H`, `hB`, `hb`], HR: [`H`, `hB`], HU: [`H`, `h`], IC: [`H`, `h`, `hB`, `hb`], ID: [`H`], IE: [`H`, `h`, `hb`, `hB`], IL: [`H`, `hB`], IM: [`H`, `h`, `hb`, `hB`], IN: [`h`, `H`], IO: [`H`, `h`, `hb`, `hB`], IQ: [`h`, `hB`, `hb`, `H`], IR: [`hB`, `H`], IS: [`H`], IT: [`H`, `hB`], JE: [`H`, `h`, `hb`, `hB`], JM: [`h`, `hb`, `H`, `hB`], JO: [`h`, `hB`, `hb`, `H`], JP: [`H`, `K`, `h`], KE: [`hB`, `hb`, `H`, `h`], KG: [`H`, `h`, `hB`, `hb`], KH: [`hB`, `h`, `H`, `hb`], KI: [`h`, `hb`, `H`, `hB`], KM: [`H`, `h`, `hB`, `hb`], KN: [`h`, `hb`, `H`, `hB`], KP: [`h`, `H`, `hB`, `hb`], KR: [`h`, `H`, `hB`, `hb`], KW: [`h`, `hB`, `hb`, `H`], KY: [`h`, `hb`, `H`, `hB`], KZ: [`H`, `hB`], LA: [`H`, `hb`, `hB`, `h`], LB: [`h`, `hB`, `hb`, `H`], LC: [`h`, `hb`, `H`, `hB`], LI: [`H`, `hB`, `h`], LK: [`H`, `h`, `hB`, `hb`], LR: [`h`, `hb`, `H`, `hB`], LS: [`h`, `H`], LT: [`H`, `h`, `hb`, `hB`], LU: [`H`, `h`, `hB`], LV: [`H`, `hB`, `hb`, `h`], LY: [`h`, `hB`, `hb`, `H`], MA: [`H`, `h`, `hB`, `hb`], MC: [`H`, `hB`], MD: [`H`, `hB`], ME: [`H`, `hB`, `h`], MF: [`H`, `hB`], MG: [`H`, `h`], MH: [`h`, `hb`, `H`, `hB`], MK: [`H`, `h`, `hb`, `hB`], ML: [`H`], MM: [`hB`, `hb`, `H`, `h`], MN: [`H`, `h`, `hb`, `hB`], MO: [`h`, `hB`, `hb`, `H`], MP: [`h`, `hb`, `H`, `hB`], MQ: [`H`, `hB`], MR: [`h`, `hB`, `hb`, `H`], MS: [`H`, `h`, `hb`, `hB`], MT: [`H`, `h`], MU: [`H`, `h`], MV: [`H`, `h`], MW: [`h`, `hb`, `H`, `hB`], MX: [`h`, `H`, `hB`, `hb`], MY: [`hb`, `hB`, `h`, `H`], MZ: [`H`, `hB`], NA: [`h`, `H`, `hB`, `hb`], NC: [`H`, `hB`], NE: [`H`], NF: [`H`, `h`, `hb`, `hB`], NG: [`H`, `h`, `hb`, `hB`], NI: [`h`, `H`, `hB`, `hb`], NL: [`H`, `hB`], NO: [`H`, `h`], NP: [`H`, `h`, `hB`], NR: [`H`, `h`, `hb`, `hB`], NU: [`H`, `h`, `hb`, `hB`], NZ: [`h`, `hb`, `H`, `hB`], OM: [`h`, `hB`, `hb`, `H`], PA: [`h`, `H`, `hB`, `hb`], PE: [`h`, `H`, `hB`, `hb`], PF: [`H`, `h`, `hB`], PG: [`h`, `H`], PH: [`h`, `hB`, `hb`, `H`], PK: [`h`, `hB`, `H`], PL: [`H`, `h`], PM: [`H`, `hB`], PN: [`H`, `h`, `hb`, `hB`], PR: [`h`, `H`, `hB`, `hb`], PS: [`h`, `hB`, `hb`, `H`], PT: [`H`, `hB`], PW: [`h`, `H`], PY: [`h`, `H`, `hB`, `hb`], QA: [`h`, `hB`, `hb`, `H`], RE: [`H`, `hB`], RO: [`H`, `hB`], RS: [`H`, `hB`, `h`], RU: [`H`], RW: [`H`, `h`], SA: [`h`, `hB`, `hb`, `H`], SB: [`h`, `hb`, `H`, `hB`], SC: [`H`, `h`, `hB`], SD: [`h`, `hB`, `hb`, `H`], SE: [`H`], SG: [`h`, `hb`, `H`, `hB`], SH: [`H`, `h`, `hb`, `hB`], SI: [`H`, `hB`], SJ: [`H`], SK: [`H`], SL: [`h`, `hb`, `H`, `hB`], SM: [`H`, `h`, `hB`], SN: [`H`, `h`, `hB`], SO: [`h`, `H`], SR: [`H`, `hB`], SS: [`h`, `hb`, `H`, `hB`], ST: [`H`, `hB`], SV: [`h`, `H`, `hB`, `hb`], SX: [`H`, `h`, `hb`, `hB`], SY: [`h`, `hB`, `hb`, `H`], SZ: [`h`, `hb`, `H`, `hB`], TA: [`H`, `h`, `hb`, `hB`], TC: [`h`, `hb`, `H`, `hB`], TD: [`h`, `H`, `hB`], TF: [`H`, `h`, `hB`], TG: [`H`, `hB`], TH: [`H`, `h`], TJ: [`H`, `h`], TL: [`H`, `hB`, `hb`, `h`], TM: [`H`, `h`], TN: [`h`, `hB`, `hb`, `H`], TO: [`h`, `H`], TR: [`H`, `hB`], TT: [`h`, `hb`, `H`, `hB`], TW: [`hB`, `hb`, `h`, `H`], TZ: [`hB`, `hb`, `H`, `h`], UA: [`H`, `hB`, `h`], UG: [`hB`, `hb`, `H`, `h`], UM: [`h`, `hb`, `H`, `hB`], US: [`h`, `hb`, `H`, `hB`], UY: [`h`, `H`, `hB`, `hb`], UZ: [`H`, `hB`, `h`], VA: [`H`, `h`, `hB`], VC: [`h`, `hb`, `H`, `hB`], VE: [`h`, `H`, `hB`, `hb`], VG: [`h`, `hb`, `H`, `hB`], VI: [`h`, `hb`, `H`, `hB`], VN: [`H`, `h`], VU: [`h`, `H`], WF: [`H`, `hB`], WS: [`h`, `H`], XK: [`H`, `hB`, `h`], YE: [`h`, `hB`, `hb`, `H`], YT: [`H`, `hB`], ZA: [`H`, `h`, `hb`, `hB`], ZM: [`h`, `hb`, `H`, `hB`], ZW: [`H`, `h`], "af-ZA": [`H`, `h`, `hB`, `hb`], "ar-001": [`h`, `hB`, `hb`, `H`], "ca-ES": [`H`, `h`, `hB`], "en-001": [`h`, `hb`, `H`, `hB`], "en-HK": [`h`, `hb`, `H`, `hB`], "en-IL": [`H`, `h`, `hb`, `hB`], "en-MY": [`h`, `hb`, `H`, `hB`], "es-BR": [`H`, `h`, `hB`, `hb`], "es-ES": [`H`, `h`, `hB`, `hb`], "es-GQ": [`H`, `h`, `hB`, `hb`], "fr-CA": [`H`, `h`, `hB`], "gl-ES": [`H`, `h`, `hB`], "gu-IN": [`hB`, `hb`, `h`, `H`], "hi-IN": [`hB`, `h`, `H`], "it-CH": [`H`, `h`, `hB`], "it-IT": [`H`, `h`, `hB`], "kn-IN": [`hB`, `h`, `H`], "ku-SY": [`H`, `hB`], "ml-IN": [`hB`, `h`, `H`], "mr-IN": [`hB`, `hb`, `h`, `H`], "pa-IN": [`hB`, `hb`, `h`, `H`], "ta-IN": [`hB`, `h`, `hb`, `H`], "te-IN": [`hB`, `h`, `H`], "zu-ZA": [`H`, `hB`, `hb`, `h`] };
|
|
2732
|
-
function Ca(e6, t2) {
|
|
2733
|
-
let n2 = ``;
|
|
2734
|
-
for (let r2 = 0; r2 < e6.length; r2++) {
|
|
2735
|
-
let i2 = e6.charAt(r2);
|
|
2736
|
-
if (i2 === `j`) {
|
|
2737
|
-
let a2 = 0;
|
|
2738
|
-
for (; r2 + 1 < e6.length && e6.charAt(r2 + 1) === i2; ) a2++, r2++;
|
|
2739
|
-
let o2 = 1 + (a2 & 1), s2 = a2 < 2 ? 1 : 3 + (a2 >> 1), c2 = wa(t2);
|
|
2740
|
-
for ((c2 == `H` || c2 == `k`) && (s2 = 0); s2-- > 0; ) n2 += `a`;
|
|
2741
|
-
for (; o2-- > 0; ) n2 = c2 + n2;
|
|
2742
|
-
} else n2 += i2 === `J` ? `H` : i2;
|
|
2743
|
-
}
|
|
2744
|
-
return n2;
|
|
2745
|
-
}
|
|
2746
|
-
function wa(e6) {
|
|
2747
|
-
let t2 = e6.hourCycle;
|
|
2748
|
-
if (t2 === void 0) {
|
|
2749
|
-
let n3 = e6;
|
|
2750
|
-
t2 = n3.getHourCycles?.()[0] ?? n3.hourCycles?.[0];
|
|
2751
|
-
}
|
|
2752
|
-
if (t2) switch (t2) {
|
|
2753
|
-
case `h24`:
|
|
2754
|
-
return `k`;
|
|
2755
|
-
case `h23`:
|
|
2756
|
-
return `H`;
|
|
2757
|
-
case `h12`:
|
|
2758
|
-
return `h`;
|
|
2759
|
-
case `h11`:
|
|
2760
|
-
return `K`;
|
|
2761
|
-
default:
|
|
2762
|
-
throw Error(`Invalid hourCycle`);
|
|
2763
|
-
}
|
|
2764
|
-
let n2 = e6.language, r2;
|
|
2765
|
-
return n2 !== `root` && (r2 = e6.maximize().region), (Y[`${n2}-${r2}`] || Y[r2 || ``] || Y[n2 || ``] || Y[`${n2}-001`] || Y[`001`])[0].charAt(0);
|
|
2766
|
-
}
|
|
2767
|
-
var Ta = RegExp(`^${Sa.source}*`);
|
|
2768
|
-
var Ea = RegExp(`${Sa.source}*$`);
|
|
2769
|
-
function X(e6, t2) {
|
|
2770
|
-
return { start: e6, end: t2 };
|
|
2771
|
-
}
|
|
2772
|
-
var Da = !!Object.fromEntries;
|
|
2773
|
-
var Oa = !!String.prototype.trimStart;
|
|
2774
|
-
var ka = !!String.prototype.trimEnd;
|
|
2775
|
-
var Aa = Da ? Object.fromEntries : function(e6) {
|
|
2776
|
-
let t2 = {};
|
|
2777
|
-
for (let [n2, r2] of e6) t2[n2] = r2;
|
|
2778
|
-
return t2;
|
|
2779
|
-
};
|
|
2780
|
-
var ja = Oa ? function(e6) {
|
|
2781
|
-
return e6.trimStart();
|
|
2782
|
-
} : function(e6) {
|
|
2783
|
-
return e6.replace(Ta, ``);
|
|
2784
|
-
};
|
|
2785
|
-
var Ma = ka ? function(e6) {
|
|
2786
|
-
return e6.trimEnd();
|
|
2787
|
-
} : function(e6) {
|
|
2788
|
-
return e6.replace(Ea, ``);
|
|
2789
|
-
};
|
|
2790
|
-
var Na = RegExp(`([^\\p{White_Space}\\p{Pattern_Syntax}]*)`, `yu`);
|
|
2791
|
-
function Pa(e6, t2) {
|
|
2792
|
-
return Na.lastIndex = t2, Na.exec(e6)[1] ?? ``;
|
|
2793
|
-
}
|
|
2794
|
-
function Fa(e6) {
|
|
2795
|
-
if (e6.length === 0) return null;
|
|
2796
|
-
let t2 = 1, n2 = 1;
|
|
2797
|
-
for (let r2 = 0; r2 < e6.length; ) {
|
|
2798
|
-
let i2 = e6.charCodeAt(r2);
|
|
2799
|
-
switch (i2) {
|
|
2800
|
-
case 35:
|
|
2801
|
-
case 39:
|
|
2802
|
-
case 60:
|
|
2803
|
-
case 123:
|
|
2804
|
-
case 125:
|
|
2805
|
-
return null;
|
|
2806
|
-
}
|
|
2807
|
-
if (i2 === 10) t2++, n2 = 1, r2++;
|
|
2808
|
-
else if (n2++, i2 >= 55296 && i2 <= 56319 && r2 + 1 < e6.length) {
|
|
2809
|
-
let t3 = e6.charCodeAt(r2 + 1);
|
|
2810
|
-
r2 += t3 >= 56320 && t3 <= 57343 ? 2 : 1;
|
|
2811
|
-
} else r2++;
|
|
2812
|
-
}
|
|
2813
|
-
return { offset: e6.length, line: t2, column: n2 };
|
|
2814
|
-
}
|
|
2815
|
-
var Ia = class {
|
|
2816
|
-
constructor(e6, t2 = {}) {
|
|
2817
|
-
this.message = e6, this.position = { offset: 0, line: 1, column: 1 }, this.ignoreTag = !!t2.ignoreTag, this.locale = t2.locale, this.requiresOtherClause = !!t2.requiresOtherClause, this.shouldParseSkeletons = !!t2.shouldParseSkeletons;
|
|
2818
|
-
}
|
|
2819
|
-
parse() {
|
|
2820
|
-
if (this.offset() !== 0) throw Error(`parser can only be used once`);
|
|
2821
|
-
if (this.message.length > 0) {
|
|
2822
|
-
let e6 = this.message.charCodeAt(0);
|
|
2823
|
-
if (e6 !== 35 && e6 !== 39 && e6 !== 60 && e6 !== 123 && e6 !== 125) {
|
|
2824
|
-
let e7 = Fa(this.message);
|
|
2825
|
-
if (e7) {
|
|
2826
|
-
let t2 = this.clonePosition();
|
|
2827
|
-
return this.position = e7, { val: [{ type: 0, value: this.message, location: X(t2, this.clonePosition()) }], err: null };
|
|
2828
|
-
}
|
|
2829
|
-
}
|
|
2830
|
-
}
|
|
2831
|
-
return this.parseMessage(0, ``, false);
|
|
2832
|
-
}
|
|
2833
|
-
parseMessage(e6, t2, n2) {
|
|
2834
|
-
let r2 = [];
|
|
2835
|
-
for (; !this.isEOF(); ) {
|
|
2836
|
-
let i2 = this.char();
|
|
2837
|
-
if (i2 === 123) {
|
|
2838
|
-
let t3 = this.parseArgument(e6, n2);
|
|
2839
|
-
if (t3.err) return t3;
|
|
2840
|
-
r2.push(t3.val);
|
|
2841
|
-
} else if (i2 === 125 && e6 > 0) break;
|
|
2842
|
-
else if (i2 === 35 && (t2 === `plural` || t2 === `selectordinal`)) {
|
|
2843
|
-
let e7 = this.clonePosition();
|
|
2844
|
-
this.bump(), r2.push({ type: 7, location: X(e7, this.clonePosition()) });
|
|
2845
|
-
} else if (i2 === 60 && !this.ignoreTag && this.peek() === 47) {
|
|
2846
|
-
if (n2) break;
|
|
2847
|
-
return this.error(26, X(this.clonePosition(), this.clonePosition()));
|
|
2848
|
-
} else if (i2 === 60 && !this.ignoreTag && La(this.peek() || 0)) {
|
|
2849
|
-
let n3 = this.parseTag(e6, t2);
|
|
2850
|
-
if (n3.err) return n3;
|
|
2851
|
-
r2.push(n3.val);
|
|
2852
|
-
} else {
|
|
2853
|
-
let n3 = this.parseLiteral(e6, t2);
|
|
2854
|
-
if (n3.err) return n3;
|
|
2855
|
-
r2.push(n3.val);
|
|
2856
|
-
}
|
|
2857
|
-
}
|
|
2858
|
-
return { val: r2, err: null };
|
|
2859
|
-
}
|
|
2860
|
-
parseTag(e6, t2) {
|
|
2861
|
-
let n2 = this.clonePosition();
|
|
2862
|
-
this.bump();
|
|
2863
|
-
let r2 = this.parseTagName();
|
|
2864
|
-
if (this.bumpSpace(), this.bumpIf(`/>`)) return { val: { type: 0, value: `<${r2}/>`, location: X(n2, this.clonePosition()) }, err: null };
|
|
2865
|
-
if (this.bumpIf(`>`)) {
|
|
2866
|
-
let i2 = this.parseMessage(e6 + 1, t2, true);
|
|
2867
|
-
if (i2.err) return i2;
|
|
2868
|
-
let a2 = i2.val, o2 = this.clonePosition();
|
|
2869
|
-
if (this.bumpIf(`</`)) {
|
|
2870
|
-
if (this.isEOF() || !La(this.char())) return this.error(23, X(o2, this.clonePosition()));
|
|
2871
|
-
let e7 = this.clonePosition();
|
|
2872
|
-
return r2 === this.parseTagName() ? (this.bumpSpace(), this.bumpIf(`>`) ? { val: { type: 8, value: r2, children: a2, location: X(n2, this.clonePosition()) }, err: null } : this.error(23, X(o2, this.clonePosition()))) : this.error(26, X(e7, this.clonePosition()));
|
|
2873
|
-
}
|
|
2874
|
-
return this.error(27, X(n2, this.clonePosition()));
|
|
2875
|
-
}
|
|
2876
|
-
return this.error(23, X(n2, this.clonePosition()));
|
|
2877
|
-
}
|
|
2878
|
-
parseTagName() {
|
|
2879
|
-
let e6 = this.offset();
|
|
2880
|
-
for (this.bump(); !this.isEOF() && za(this.char()); ) this.bump();
|
|
2881
|
-
return this.message.slice(e6, this.offset());
|
|
2882
|
-
}
|
|
2883
|
-
parseLiteral(e6, t2) {
|
|
2884
|
-
let n2 = this.clonePosition(), r2 = ``;
|
|
2885
|
-
for (; ; ) {
|
|
2886
|
-
let n3 = this.tryParseQuote(t2);
|
|
2887
|
-
if (n3) {
|
|
2888
|
-
r2 += n3;
|
|
2889
|
-
continue;
|
|
2890
|
-
}
|
|
2891
|
-
let i3 = this.tryParseUnquoted(e6, t2);
|
|
2892
|
-
if (i3) {
|
|
2893
|
-
r2 += i3;
|
|
2894
|
-
continue;
|
|
2895
|
-
}
|
|
2896
|
-
let a2 = this.tryParseLeftAngleBracket();
|
|
2897
|
-
if (a2) r2 += a2;
|
|
2898
|
-
else break;
|
|
2899
|
-
}
|
|
2900
|
-
let i2 = X(n2, this.clonePosition());
|
|
2901
|
-
return { val: { type: 0, value: r2, location: i2 }, err: null };
|
|
2902
|
-
}
|
|
2903
|
-
tryParseLeftAngleBracket() {
|
|
2904
|
-
return !this.isEOF() && this.char() === 60 && (this.ignoreTag || !Ra(this.peek() || 0)) ? (this.bump(), `<`) : null;
|
|
2905
|
-
}
|
|
2906
|
-
tryParseQuote(e6) {
|
|
2907
|
-
if (this.isEOF() || this.char() !== 39) return null;
|
|
2908
|
-
switch (this.peek()) {
|
|
2909
|
-
case 39:
|
|
2910
|
-
return this.bump(), this.bump(), `'`;
|
|
2911
|
-
case 123:
|
|
2912
|
-
case 60:
|
|
2913
|
-
case 62:
|
|
2914
|
-
case 125:
|
|
2915
|
-
break;
|
|
2916
|
-
case 35:
|
|
2917
|
-
if (e6 === `plural` || e6 === `selectordinal`) break;
|
|
2918
|
-
return null;
|
|
2919
|
-
default:
|
|
2920
|
-
return null;
|
|
2921
|
-
}
|
|
2922
|
-
this.bump();
|
|
2923
|
-
let t2 = [this.char()];
|
|
2924
|
-
for (this.bump(); !this.isEOF(); ) {
|
|
2925
|
-
let e7 = this.char();
|
|
2926
|
-
if (e7 === 39) {
|
|
2927
|
-
if (this.peek() === 39) t2.push(39), this.bump();
|
|
2928
|
-
else {
|
|
2929
|
-
this.bump();
|
|
2930
|
-
break;
|
|
2931
|
-
}
|
|
2932
|
-
} else t2.push(e7);
|
|
2933
|
-
this.bump();
|
|
2934
|
-
}
|
|
2935
|
-
return String.fromCodePoint(...t2);
|
|
2936
|
-
}
|
|
2937
|
-
tryParseUnquoted(e6, t2) {
|
|
2938
|
-
if (this.isEOF()) return null;
|
|
2939
|
-
let n2 = this.char();
|
|
2940
|
-
return n2 === 60 || n2 === 123 || n2 === 35 && (t2 === `plural` || t2 === `selectordinal`) || n2 === 125 && e6 > 0 ? null : (this.bump(), String.fromCodePoint(n2));
|
|
2941
|
-
}
|
|
2942
|
-
parseArgument(e6, t2) {
|
|
2943
|
-
let n2 = this.clonePosition();
|
|
2944
|
-
if (this.bump(), this.bumpSpace(), this.isEOF()) return this.error(1, X(n2, this.clonePosition()));
|
|
2945
|
-
if (this.char() === 125) return this.bump(), this.error(2, X(n2, this.clonePosition()));
|
|
2946
|
-
let r2 = this.parseIdentifierIfPossible().value;
|
|
2947
|
-
if (!r2) return this.error(3, X(n2, this.clonePosition()));
|
|
2948
|
-
if (this.bumpSpace(), this.isEOF()) return this.error(1, X(n2, this.clonePosition()));
|
|
2949
|
-
switch (this.char()) {
|
|
2950
|
-
case 125:
|
|
2951
|
-
return this.bump(), { val: { type: 1, value: r2, location: X(n2, this.clonePosition()) }, err: null };
|
|
2952
|
-
case 44:
|
|
2953
|
-
return this.bump(), this.bumpSpace(), this.isEOF() ? this.error(1, X(n2, this.clonePosition())) : this.parseArgumentOptions(e6, t2, r2, n2);
|
|
2954
|
-
default:
|
|
2955
|
-
return this.error(3, X(n2, this.clonePosition()));
|
|
2956
|
-
}
|
|
2957
|
-
}
|
|
2958
|
-
parseIdentifierIfPossible() {
|
|
2959
|
-
let e6 = this.clonePosition(), t2 = this.offset(), n2 = Pa(this.message, t2), r2 = t2 + n2.length;
|
|
2960
|
-
return this.bumpTo(r2), { value: n2, location: X(e6, this.clonePosition()) };
|
|
2961
|
-
}
|
|
2962
|
-
parseArgumentOptions(e6, t2, n2, r2) {
|
|
2963
|
-
let i2 = this.clonePosition(), a2 = this.parseIdentifierIfPossible().value, o2 = this.clonePosition();
|
|
2964
|
-
switch (a2) {
|
|
2965
|
-
case ``:
|
|
2966
|
-
return this.error(4, X(i2, o2));
|
|
2967
|
-
case `number`:
|
|
2968
|
-
case `date`:
|
|
2969
|
-
case `time`: {
|
|
2970
|
-
this.bumpSpace();
|
|
2971
|
-
let e7 = null;
|
|
2972
|
-
if (this.bumpIf(`,`)) {
|
|
2973
|
-
this.bumpSpace();
|
|
2974
|
-
let t4 = this.clonePosition(), n3 = this.parseSimpleArgStyleIfPossible();
|
|
2975
|
-
if (n3.err) return n3;
|
|
2976
|
-
let r3 = Ma(n3.val);
|
|
2977
|
-
if (r3.length === 0) return this.error(6, X(this.clonePosition(), this.clonePosition()));
|
|
2978
|
-
e7 = { style: r3, styleLocation: X(t4, this.clonePosition()) };
|
|
2979
|
-
}
|
|
2980
|
-
let t3 = this.tryParseArgumentClose(r2);
|
|
2981
|
-
if (t3.err) return t3;
|
|
2982
|
-
let i3 = X(r2, this.clonePosition());
|
|
2983
|
-
if (e7 && e7.style.startsWith(`::`)) {
|
|
2984
|
-
let t4 = ja(e7.style.slice(2));
|
|
2985
|
-
if (a2 === `number`) {
|
|
2986
|
-
let r3 = this.parseNumberSkeletonFromString(t4, e7.styleLocation);
|
|
2987
|
-
return r3.err ? r3 : { val: { type: 2, value: n2, location: i3, style: r3.val }, err: null };
|
|
2988
|
-
}
|
|
2989
|
-
{
|
|
2990
|
-
if (t4.length === 0) return this.error(10, i3);
|
|
2991
|
-
let r3 = t4;
|
|
2992
|
-
this.locale && (r3 = Ca(t4, this.locale));
|
|
2993
|
-
let o3 = { type: 1, pattern: r3, location: e7.styleLocation, parsedOptions: this.shouldParseSkeletons ? Zi(r3) : {} };
|
|
2994
|
-
return { val: { type: a2 === `date` ? 3 : 4, value: n2, location: i3, style: o3 }, err: null };
|
|
2995
|
-
}
|
|
2996
|
-
}
|
|
2997
|
-
return { val: { type: a2 === `number` ? 2 : a2 === `date` ? 3 : 4, value: n2, location: i3, style: e7?.style ?? null }, err: null };
|
|
2998
|
-
}
|
|
2999
|
-
case `plural`:
|
|
3000
|
-
case `selectordinal`:
|
|
3001
|
-
case `select`: {
|
|
3002
|
-
let i3 = this.clonePosition();
|
|
3003
|
-
if (this.bumpSpace(), !this.bumpIf(`,`)) return this.error(12, X(i3, { ...i3 }));
|
|
3004
|
-
this.bumpSpace();
|
|
3005
|
-
let o3 = this.parseIdentifierIfPossible(), s2 = 0;
|
|
3006
|
-
if (a2 !== `select` && o3.value === `offset`) {
|
|
3007
|
-
if (!this.bumpIf(`:`)) return this.error(13, X(this.clonePosition(), this.clonePosition()));
|
|
3008
|
-
this.bumpSpace();
|
|
3009
|
-
let e7 = this.tryParseDecimalInteger(13, 14);
|
|
3010
|
-
if (e7.err) return e7;
|
|
3011
|
-
this.bumpSpace(), o3 = this.parseIdentifierIfPossible(), s2 = e7.val;
|
|
3012
|
-
}
|
|
3013
|
-
let c2 = this.tryParsePluralOrSelectOptions(e6, a2, t2, o3);
|
|
3014
|
-
if (c2.err) return c2;
|
|
3015
|
-
let l2 = this.tryParseArgumentClose(r2);
|
|
3016
|
-
if (l2.err) return l2;
|
|
3017
|
-
let u2 = X(r2, this.clonePosition());
|
|
3018
|
-
return a2 === `select` ? { val: { type: 5, value: n2, options: Aa(c2.val), location: u2 }, err: null } : { val: { type: 6, value: n2, options: Aa(c2.val), offset: s2, pluralType: a2 === `plural` ? `cardinal` : `ordinal`, location: u2 }, err: null };
|
|
3019
|
-
}
|
|
3020
|
-
default:
|
|
3021
|
-
return this.error(5, X(i2, o2));
|
|
3022
|
-
}
|
|
3023
|
-
}
|
|
3024
|
-
tryParseArgumentClose(e6) {
|
|
3025
|
-
return this.isEOF() || this.char() !== 125 ? this.error(1, X(e6, this.clonePosition())) : (this.bump(), { val: true, err: null });
|
|
3026
|
-
}
|
|
3027
|
-
parseSimpleArgStyleIfPossible() {
|
|
3028
|
-
let e6 = 0, t2 = this.clonePosition();
|
|
3029
|
-
for (; !this.isEOF(); ) switch (this.char()) {
|
|
3030
|
-
case 39: {
|
|
3031
|
-
this.bump();
|
|
3032
|
-
let e7 = this.clonePosition();
|
|
3033
|
-
if (!this.bumpUntil(`'`)) return this.error(11, X(e7, this.clonePosition()));
|
|
3034
|
-
this.bump();
|
|
3035
|
-
break;
|
|
3036
|
-
}
|
|
3037
|
-
case 123:
|
|
3038
|
-
e6 += 1, this.bump();
|
|
3039
|
-
break;
|
|
3040
|
-
case 125:
|
|
3041
|
-
if (e6 > 0) --e6;
|
|
3042
|
-
else return { val: this.message.slice(t2.offset, this.offset()), err: null };
|
|
3043
|
-
break;
|
|
3044
|
-
default:
|
|
3045
|
-
this.bump();
|
|
3046
|
-
}
|
|
3047
|
-
return { val: this.message.slice(t2.offset, this.offset()), err: null };
|
|
3048
|
-
}
|
|
3049
|
-
parseNumberSkeletonFromString(e6, t2) {
|
|
3050
|
-
let n2 = [];
|
|
3051
|
-
try {
|
|
3052
|
-
n2 = $i(e6);
|
|
3053
|
-
} catch {
|
|
3054
|
-
return this.error(7, t2);
|
|
3055
|
-
}
|
|
3056
|
-
return { val: { type: 0, tokens: n2, location: t2, parsedOptions: this.shouldParseSkeletons ? la(n2) : {} }, err: null };
|
|
3057
|
-
}
|
|
3058
|
-
tryParsePluralOrSelectOptions(e6, t2, n2, r2) {
|
|
3059
|
-
let i2 = false, a2 = [], o2 = /* @__PURE__ */ new Set(), { value: s2, location: c2 } = r2;
|
|
3060
|
-
for (; ; ) {
|
|
3061
|
-
if (s2.length === 0) {
|
|
3062
|
-
let e7 = this.clonePosition();
|
|
3063
|
-
if (t2 !== `select` && this.bumpIf(`=`)) {
|
|
3064
|
-
let t3 = this.tryParseDecimalInteger(16, 19);
|
|
3065
|
-
if (t3.err) return t3;
|
|
3066
|
-
c2 = X(e7, this.clonePosition()), s2 = this.message.slice(e7.offset, this.offset());
|
|
3067
|
-
} else break;
|
|
3068
|
-
}
|
|
3069
|
-
if (o2.has(s2)) return this.error(t2 === `select` ? 21 : 20, c2);
|
|
3070
|
-
s2 === `other` && (i2 = true), this.bumpSpace();
|
|
3071
|
-
let r3 = this.clonePosition();
|
|
3072
|
-
if (!this.bumpIf(`{`)) return this.error(t2 === `select` ? 17 : 18, X(this.clonePosition(), this.clonePosition()));
|
|
3073
|
-
let l2 = this.parseMessage(e6 + 1, t2, n2);
|
|
3074
|
-
if (l2.err) return l2;
|
|
3075
|
-
let u2 = this.tryParseArgumentClose(r3);
|
|
3076
|
-
if (u2.err) return u2;
|
|
3077
|
-
a2.push([s2, { value: l2.val, location: X(r3, this.clonePosition()) }]), o2.add(s2), this.bumpSpace(), { value: s2, location: c2 } = this.parseIdentifierIfPossible();
|
|
3078
|
-
}
|
|
3079
|
-
return a2.length === 0 ? this.error(t2 === `select` ? 15 : 16, X(this.clonePosition(), this.clonePosition())) : this.requiresOtherClause && !i2 ? this.error(22, X(this.clonePosition(), this.clonePosition())) : { val: a2, err: null };
|
|
3080
|
-
}
|
|
3081
|
-
tryParseDecimalInteger(e6, t2) {
|
|
3082
|
-
let n2 = 1, r2 = this.clonePosition();
|
|
3083
|
-
this.bumpIf(`+`) || this.bumpIf(`-`) && (n2 = -1);
|
|
3084
|
-
let i2 = false, a2 = 0;
|
|
3085
|
-
for (; !this.isEOF(); ) {
|
|
3086
|
-
let e7 = this.char();
|
|
3087
|
-
if (e7 >= 48 && e7 <= 57) i2 = true, a2 = a2 * 10 + (e7 - 48), this.bump();
|
|
3088
|
-
else break;
|
|
3089
|
-
}
|
|
3090
|
-
let o2 = X(r2, this.clonePosition());
|
|
3091
|
-
return i2 ? (a2 *= n2, Number.isSafeInteger(a2) ? { val: a2, err: null } : this.error(t2, o2)) : this.error(e6, o2);
|
|
3092
|
-
}
|
|
3093
|
-
offset() {
|
|
3094
|
-
return this.position.offset;
|
|
3095
|
-
}
|
|
3096
|
-
isEOF() {
|
|
3097
|
-
return this.offset() === this.message.length;
|
|
3098
|
-
}
|
|
3099
|
-
clonePosition() {
|
|
3100
|
-
return { offset: this.position.offset, line: this.position.line, column: this.position.column };
|
|
3101
|
-
}
|
|
3102
|
-
char() {
|
|
3103
|
-
let e6 = this.position.offset;
|
|
3104
|
-
if (e6 >= this.message.length) throw Error(`out of bound`);
|
|
3105
|
-
let t2 = this.message.codePointAt(e6);
|
|
3106
|
-
if (t2 === void 0) throw Error(`Offset ${e6} is at invalid UTF-16 code unit boundary`);
|
|
3107
|
-
return t2;
|
|
3108
|
-
}
|
|
3109
|
-
error(e6, t2) {
|
|
3110
|
-
return { val: null, err: { kind: e6, message: this.message, location: t2 } };
|
|
3111
|
-
}
|
|
3112
|
-
bump() {
|
|
3113
|
-
if (this.isEOF()) return;
|
|
3114
|
-
let e6 = this.char();
|
|
3115
|
-
e6 === 10 ? (this.position.line += 1, this.position.column = 1, this.position.offset += 1) : (this.position.column += 1, this.position.offset += e6 < 65536 ? 1 : 2);
|
|
3116
|
-
}
|
|
3117
|
-
bumpIf(e6) {
|
|
3118
|
-
if (this.message.startsWith(e6, this.offset())) {
|
|
3119
|
-
for (let t2 = 0; t2 < e6.length; t2++) this.bump();
|
|
3120
|
-
return true;
|
|
3121
|
-
}
|
|
3122
|
-
return false;
|
|
3123
|
-
}
|
|
3124
|
-
bumpUntil(e6) {
|
|
3125
|
-
let t2 = this.offset(), n2 = this.message.indexOf(e6, t2);
|
|
3126
|
-
return n2 >= 0 ? (this.bumpTo(n2), true) : (this.bumpTo(this.message.length), false);
|
|
3127
|
-
}
|
|
3128
|
-
bumpTo(e6) {
|
|
3129
|
-
if (this.offset() > e6) throw Error(`targetOffset ${e6} must be greater than or equal to the current offset ${this.offset()}`);
|
|
3130
|
-
for (e6 = Math.min(e6, this.message.length); ; ) {
|
|
3131
|
-
let t2 = this.offset();
|
|
3132
|
-
if (t2 === e6) break;
|
|
3133
|
-
if (t2 > e6) throw Error(`targetOffset ${e6} is at invalid UTF-16 code unit boundary`);
|
|
3134
|
-
if (this.bump(), this.isEOF()) break;
|
|
3135
|
-
}
|
|
3136
|
-
}
|
|
3137
|
-
bumpSpace() {
|
|
3138
|
-
for (; !this.isEOF() && Ba(this.char()); ) this.bump();
|
|
3139
|
-
}
|
|
3140
|
-
peek() {
|
|
3141
|
-
if (this.isEOF()) return null;
|
|
3142
|
-
let e6 = this.char(), t2 = this.offset();
|
|
3143
|
-
return this.message.charCodeAt(t2 + (e6 >= 65536 ? 2 : 1)) ?? null;
|
|
3144
|
-
}
|
|
3145
|
-
};
|
|
3146
|
-
function La(e6) {
|
|
3147
|
-
return e6 >= 97 && e6 <= 122 || e6 >= 65 && e6 <= 90;
|
|
3148
|
-
}
|
|
3149
|
-
function Ra(e6) {
|
|
3150
|
-
return La(e6) || e6 === 47;
|
|
3151
|
-
}
|
|
3152
|
-
function za(e6) {
|
|
3153
|
-
return e6 === 45 || e6 === 46 || e6 >= 48 && e6 <= 57 || e6 === 95 || e6 >= 97 && e6 <= 122 || e6 >= 65 && e6 <= 90 || e6 == 183 || e6 >= 192 && e6 <= 214 || e6 >= 216 && e6 <= 246 || e6 >= 248 && e6 <= 893 || e6 >= 895 && e6 <= 8191 || e6 >= 8204 && e6 <= 8205 || e6 >= 8255 && e6 <= 8256 || e6 >= 8304 && e6 <= 8591 || e6 >= 11264 && e6 <= 12271 || e6 >= 12289 && e6 <= 55295 || e6 >= 63744 && e6 <= 64975 || e6 >= 65008 && e6 <= 65533 || e6 >= 65536 && e6 <= 983039;
|
|
3154
|
-
}
|
|
3155
|
-
function Ba(e6) {
|
|
3156
|
-
return e6 >= 9 && e6 <= 13 || e6 === 32 || e6 === 133 || e6 >= 8206 && e6 <= 8207 || e6 === 8232 || e6 === 8233;
|
|
3157
|
-
}
|
|
3158
|
-
function Va(e6) {
|
|
3159
|
-
e6.forEach((e7) => {
|
|
3160
|
-
if (delete e7.location, ga(e7) || _a(e7)) for (let t2 in e7.options) delete e7.options[t2].location, Va(e7.options[t2].value);
|
|
3161
|
-
else pa(e7) && ba(e7.style) || (ma(e7) || ha(e7)) && xa(e7.style) ? delete e7.style.location : ya(e7) && Va(e7.children);
|
|
3162
|
-
});
|
|
3163
|
-
}
|
|
3164
|
-
function Ha(e6, t2 = {}) {
|
|
3165
|
-
t2 = { shouldParseSkeletons: true, requiresOtherClause: true, ...t2 };
|
|
3166
|
-
let n2 = new Ia(e6, t2).parse();
|
|
3167
|
-
if (n2.err) {
|
|
3168
|
-
let e7 = SyntaxError(ua[n2.err.kind]);
|
|
3169
|
-
throw e7.location = n2.err.location, e7.originalMessage = n2.err.message, e7;
|
|
3170
|
-
}
|
|
3171
|
-
return t2?.captureLocation || Va(n2.val), n2.val;
|
|
3172
|
-
}
|
|
3173
|
-
var Ua = class extends Error {
|
|
3174
|
-
constructor(e6, t2, n2) {
|
|
3175
|
-
super(e6), this.code = t2, this.originalMessage = n2;
|
|
3176
|
-
}
|
|
3177
|
-
toString() {
|
|
3178
|
-
return `[formatjs Error: ${this.code}] ${this.message}`;
|
|
3179
|
-
}
|
|
3180
|
-
};
|
|
3181
|
-
var Wa = class extends Ua {
|
|
3182
|
-
constructor(e6, t2, n2, r2) {
|
|
3183
|
-
super(`Invalid values for "${e6}": "${t2}". Options are "${Object.keys(n2).join(`", "`)}"`, `INVALID_VALUE`, r2);
|
|
3184
|
-
}
|
|
3185
|
-
};
|
|
3186
|
-
var Ga = class extends Ua {
|
|
3187
|
-
constructor(e6, t2, n2) {
|
|
3188
|
-
super(`Value for "${e6}" must be of type ${t2}`, `INVALID_VALUE`, n2);
|
|
3189
|
-
}
|
|
3190
|
-
};
|
|
3191
|
-
var Ka = class extends Ua {
|
|
3192
|
-
constructor(e6, t2) {
|
|
3193
|
-
super(`The intl string context variable "${e6}" was not provided to the string "${t2}"`, `MISSING_VALUE`, t2);
|
|
3194
|
-
}
|
|
3195
|
-
};
|
|
3196
|
-
function qa(e6) {
|
|
3197
|
-
return e6.length < 2 ? e6 : e6.reduce((e7, t2) => {
|
|
3198
|
-
let n2 = e7[e7.length - 1];
|
|
3199
|
-
return !n2 || n2.type !== 0 || t2.type !== 0 ? e7.push(t2) : n2.value += t2.value, e7;
|
|
3200
|
-
}, []);
|
|
3201
|
-
}
|
|
3202
|
-
function Ja(e6) {
|
|
3203
|
-
return typeof e6 == `function`;
|
|
3204
|
-
}
|
|
3205
|
-
function Ya(e6, t2, n2, r2, i2, a2, o2) {
|
|
3206
|
-
if (e6.length === 1 && da(e6[0])) return [{ type: 0, value: e6[0].value }];
|
|
3207
|
-
let s2 = [];
|
|
3208
|
-
for (let c2 of e6) {
|
|
3209
|
-
if (da(c2)) {
|
|
3210
|
-
s2.push({ type: 0, value: c2.value });
|
|
3211
|
-
continue;
|
|
3212
|
-
}
|
|
3213
|
-
if (va(c2)) {
|
|
3214
|
-
typeof a2 == `number` && s2.push({ type: 0, value: n2.getNumberFormat(t2).format(a2) });
|
|
3215
|
-
continue;
|
|
3216
|
-
}
|
|
3217
|
-
let { value: e7 } = c2;
|
|
3218
|
-
if (!(i2 && e7 in i2)) throw new Ka(e7, o2);
|
|
3219
|
-
let l2 = i2[e7];
|
|
3220
|
-
if (fa(c2)) (!l2 || typeof l2 == `string` || typeof l2 == `number` || typeof l2 == `bigint`) && (l2 = typeof l2 == `string` || typeof l2 == `number` || typeof l2 == `bigint` ? String(l2) : ``), s2.push({ type: typeof l2 == `string` ? 0 : 1, value: l2 });
|
|
3221
|
-
else if (ma(c2)) {
|
|
3222
|
-
let e8 = typeof c2.style == `string` ? r2.date[c2.style] : xa(c2.style) ? c2.style.parsedOptions : void 0;
|
|
3223
|
-
s2.push({ type: 0, value: n2.getDateTimeFormat(t2, e8).format(l2) });
|
|
3224
|
-
} else if (ha(c2)) {
|
|
3225
|
-
let e8 = typeof c2.style == `string` ? r2.time[c2.style] : xa(c2.style) ? c2.style.parsedOptions : r2.time.medium;
|
|
3226
|
-
s2.push({ type: 0, value: n2.getDateTimeFormat(t2, e8).format(l2) });
|
|
3227
|
-
} else if (pa(c2)) {
|
|
3228
|
-
let e8 = typeof c2.style == `string` ? r2.number[c2.style] : ba(c2.style) ? c2.style.parsedOptions : void 0;
|
|
3229
|
-
if (e8 && e8.scale) {
|
|
3230
|
-
let t3 = e8.scale || 1;
|
|
3231
|
-
if (typeof l2 == `bigint`) {
|
|
3232
|
-
if (!Number.isInteger(t3)) throw TypeError(`Cannot apply fractional scale ${t3} to bigint value. Scale must be an integer when formatting bigint.`);
|
|
3233
|
-
l2 *= BigInt(t3);
|
|
3234
|
-
} else l2 *= t3;
|
|
3235
|
-
}
|
|
3236
|
-
s2.push({ type: 0, value: n2.getNumberFormat(t2, e8).format(l2) });
|
|
3237
|
-
} else {
|
|
3238
|
-
if (ya(c2)) {
|
|
3239
|
-
let { children: e8, value: l3 } = c2, u2 = i2[l3];
|
|
3240
|
-
if (!Ja(u2)) throw new Ga(l3, `function`, o2);
|
|
3241
|
-
let d2 = u2(Ya(e8, t2, n2, r2, i2, a2).map((e9) => e9.value));
|
|
3242
|
-
Array.isArray(d2) || (d2 = [d2]), s2.push(...d2.map((e9) => ({ type: typeof e9 == `string` ? 0 : 1, value: e9 })));
|
|
3243
|
-
}
|
|
3244
|
-
if (ga(c2)) {
|
|
3245
|
-
let e8 = l2, a3 = (Object.prototype.hasOwnProperty.call(c2.options, e8) ? c2.options[e8] : void 0) || c2.options.other;
|
|
3246
|
-
if (!a3) throw new Wa(c2.value, l2, Object.keys(c2.options), o2);
|
|
3247
|
-
s2.push(...Ya(a3.value, t2, n2, r2, i2));
|
|
3248
|
-
} else if (_a(c2)) {
|
|
3249
|
-
let e8 = `=${l2}`, a3 = Object.prototype.hasOwnProperty.call(c2.options, e8) ? c2.options[e8] : void 0;
|
|
3250
|
-
if (!a3) {
|
|
3251
|
-
if (!Intl.PluralRules) throw new Ua(`Intl.PluralRules is not available in this environment.
|
|
3252
|
-
Try polyfilling it using "@formatjs/intl-pluralrules"
|
|
3253
|
-
`, `MISSING_INTL_API`, o2);
|
|
3254
|
-
let e9 = typeof l2 == `bigint` ? Number(l2) : l2, r3 = n2.getPluralRules(t2, { type: c2.pluralType }).select(e9 - (c2.offset || 0));
|
|
3255
|
-
a3 = (Object.prototype.hasOwnProperty.call(c2.options, r3) ? c2.options[r3] : void 0) || c2.options.other;
|
|
3256
|
-
}
|
|
3257
|
-
if (!a3) throw new Wa(c2.value, l2, Object.keys(c2.options), o2);
|
|
3258
|
-
let u2 = typeof l2 == `bigint` ? Number(l2) : l2;
|
|
3259
|
-
s2.push(...Ya(a3.value, t2, n2, r2, i2, u2 - (c2.offset || 0)));
|
|
3260
|
-
}
|
|
3261
|
-
}
|
|
3262
|
-
}
|
|
3263
|
-
return qa(s2);
|
|
3264
|
-
}
|
|
3265
|
-
function Xa(e6, t2) {
|
|
3266
|
-
return t2 ? { ...e6, ...t2, ...Object.keys(e6).reduce((n2, r2) => (n2[r2] = { ...e6[r2], ...t2[r2] }, n2), {}) } : e6;
|
|
3267
|
-
}
|
|
3268
|
-
function Za(e6, t2) {
|
|
3269
|
-
return t2 ? Object.keys(e6).reduce((n2, r2) => (n2[r2] = Xa(e6[r2], t2[r2]), n2), { ...e6 }) : e6;
|
|
3270
|
-
}
|
|
3271
|
-
function Qa(e6) {
|
|
3272
|
-
return { create() {
|
|
3273
|
-
return { get(t2) {
|
|
3274
|
-
return e6[t2];
|
|
3275
|
-
}, set(t2, n2) {
|
|
3276
|
-
e6[t2] = n2;
|
|
3277
|
-
} };
|
|
3278
|
-
} };
|
|
3279
|
-
}
|
|
3280
|
-
function $a(e6 = { number: {}, dateTime: {}, pluralRules: {} }) {
|
|
3281
|
-
return { getNumberFormat: Ri((...e7) => new Intl.NumberFormat(...e7), { cache: Qa(e6.number), strategy: Yi.variadic }), getDateTimeFormat: Ri((...e7) => new Intl.DateTimeFormat(...e7), { cache: Qa(e6.dateTime), strategy: Yi.variadic }), getPluralRules: Ri((...e7) => new Intl.PluralRules(...e7), { cache: Qa(e6.pluralRules), strategy: Yi.variadic }) };
|
|
3282
|
-
}
|
|
3283
|
-
var eo = class e5 {
|
|
3284
|
-
constructor(t2, n2 = e5.defaultLocale, r2, i2) {
|
|
3285
|
-
if (this.formatterCache = { number: {}, dateTime: {}, pluralRules: {} }, this.format = (e6) => {
|
|
3286
|
-
let t3 = this.formatToParts(e6);
|
|
3287
|
-
if (t3.length === 1) return t3[0].value;
|
|
3288
|
-
let n3 = t3.reduce((e7, t4) => (!e7.length || t4.type !== 0 || typeof e7[e7.length - 1] != `string` ? e7.push(t4.value) : e7[e7.length - 1] += t4.value, e7), []);
|
|
3289
|
-
return n3.length <= 1 ? n3[0] || `` : n3;
|
|
3290
|
-
}, this.formatToParts = (e6) => Ya(this.ast, this.locales, this.formatters, this.formats, e6, void 0, this.message), this.resolvedOptions = () => ({ locale: this.resolvedLocale?.toString() || Intl.NumberFormat.supportedLocalesOf(this.locales)[0] }), this.getAst = () => this.ast, this.locales = n2, this.resolvedLocale = e5.resolveLocale(n2), typeof t2 == `string`) {
|
|
3291
|
-
if (this.message = t2, !e5.__parse) throw TypeError("IntlMessageFormat.__parse must be set to process `message` of type `string`");
|
|
3292
|
-
let { ...n3 } = i2 || {};
|
|
3293
|
-
this.ast = e5.__parse(t2, { ...n3, locale: this.resolvedLocale });
|
|
3294
|
-
} else this.ast = t2;
|
|
3295
|
-
if (!Array.isArray(this.ast)) throw TypeError(`A message must be provided as a String or AST.`);
|
|
3296
|
-
this.formats = Za(e5.formats, r2), this.formatters = i2 && i2.formatters || $a(this.formatterCache);
|
|
3297
|
-
}
|
|
3298
|
-
static {
|
|
3299
|
-
this.memoizedDefaultLocale = null;
|
|
3300
|
-
}
|
|
3301
|
-
static get defaultLocale() {
|
|
3302
|
-
return e5.memoizedDefaultLocale ||= new Intl.NumberFormat().resolvedOptions().locale, e5.memoizedDefaultLocale;
|
|
3303
|
-
}
|
|
3304
|
-
static {
|
|
3305
|
-
this.resolveLocale = (e6) => {
|
|
3306
|
-
if (Intl.Locale === void 0) return;
|
|
3307
|
-
let t2 = Intl.NumberFormat.supportedLocalesOf(e6);
|
|
3308
|
-
return t2.length > 0 ? new Intl.Locale(t2[0]) : new Intl.Locale(typeof e6 == `string` ? e6 : e6[0]);
|
|
3309
|
-
};
|
|
3310
|
-
}
|
|
3311
|
-
static {
|
|
3312
|
-
this.__parse = Ha;
|
|
3313
|
-
}
|
|
3314
|
-
static {
|
|
3315
|
-
this.formats = { number: { integer: { maximumFractionDigits: 0 }, currency: { style: `currency` }, percent: { style: `percent` } }, date: { short: { month: `numeric`, day: `numeric`, year: `2-digit` }, medium: { month: `short`, day: `numeric`, year: `numeric` }, long: { month: `long`, day: `numeric`, year: `numeric` }, full: { weekday: `long`, month: `long`, day: `numeric`, year: `numeric` } }, time: { short: { hour: `numeric`, minute: `numeric` }, medium: { hour: `numeric`, minute: `numeric`, second: `numeric` }, long: { hour: `numeric`, minute: `numeric`, second: `numeric`, timeZoneName: `short` }, full: { hour: `numeric`, minute: `numeric`, second: `numeric`, timeZoneName: `short` } } };
|
|
3316
|
-
}
|
|
3317
|
-
};
|
|
3318
|
-
function to(e6, t2) {
|
|
3319
|
-
return oo(e6) || ao(e6, t2) || ro(e6, t2) || no();
|
|
3320
|
-
}
|
|
3321
|
-
function no() {
|
|
3322
|
-
throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
3323
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
3324
|
-
}
|
|
3325
|
-
function ro(e6, t2) {
|
|
3326
|
-
if (e6) {
|
|
3327
|
-
if (typeof e6 == `string`) return io(e6, t2);
|
|
3328
|
-
var n2 = {}.toString.call(e6).slice(8, -1);
|
|
3329
|
-
return n2 === `Object` && e6.constructor && (n2 = e6.constructor.name), n2 === `Map` || n2 === `Set` ? Array.from(e6) : n2 === `Arguments` || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n2) ? io(e6, t2) : void 0;
|
|
3330
|
-
}
|
|
3331
|
-
}
|
|
3332
|
-
function io(e6, t2) {
|
|
3333
|
-
(t2 == null || t2 > e6.length) && (t2 = e6.length);
|
|
3334
|
-
for (var n2 = 0, r2 = Array(t2); n2 < t2; n2++) r2[n2] = e6[n2];
|
|
3335
|
-
return r2;
|
|
3336
|
-
}
|
|
3337
|
-
function ao(e6, t2) {
|
|
3338
|
-
var n2 = e6 == null ? null : typeof Symbol < `u` && e6[Symbol.iterator] || e6[`@@iterator`];
|
|
3339
|
-
if (n2 != null) {
|
|
3340
|
-
var r2, i2, a2, o2, s2 = [], c2 = true, l2 = false;
|
|
3341
|
-
try {
|
|
3342
|
-
if (a2 = (n2 = n2.call(e6)).next, t2 === 0) {
|
|
3343
|
-
if (Object(n2) !== n2) return;
|
|
3344
|
-
c2 = false;
|
|
3345
|
-
} else for (; !(c2 = (r2 = a2.call(n2)).done) && (s2.push(r2.value), s2.length !== t2); c2 = true) ;
|
|
3346
|
-
} catch (e7) {
|
|
3347
|
-
l2 = true, i2 = e7;
|
|
3348
|
-
} finally {
|
|
3349
|
-
try {
|
|
3350
|
-
if (!c2 && n2.return != null && (o2 = n2.return(), Object(o2) !== o2)) return;
|
|
3351
|
-
} finally {
|
|
3352
|
-
if (l2) throw i2;
|
|
3353
|
-
}
|
|
3354
|
-
}
|
|
3355
|
-
return s2;
|
|
3356
|
-
}
|
|
3357
|
-
}
|
|
3358
|
-
function oo(e6) {
|
|
3359
|
-
if (Array.isArray(e6)) return e6;
|
|
3360
|
-
}
|
|
3361
|
-
function Z(e6) {
|
|
3362
|
-
"@babel/helpers - typeof";
|
|
3363
|
-
return Z = typeof Symbol == `function` && typeof Symbol.iterator == `symbol` ? function(e7) {
|
|
3364
|
-
return typeof e7;
|
|
3365
|
-
} : function(e7) {
|
|
3366
|
-
return e7 && typeof Symbol == `function` && e7.constructor === Symbol && e7 !== Symbol.prototype ? `symbol` : typeof e7;
|
|
3367
|
-
}, Z(e6);
|
|
3368
|
-
}
|
|
3369
|
-
function so(e6, t2) {
|
|
3370
|
-
var n2 = Object.keys(e6);
|
|
3371
|
-
if (Object.getOwnPropertySymbols) {
|
|
3372
|
-
var r2 = Object.getOwnPropertySymbols(e6);
|
|
3373
|
-
t2 && (r2 = r2.filter(function(t3) {
|
|
3374
|
-
return Object.getOwnPropertyDescriptor(e6, t3).enumerable;
|
|
3375
|
-
})), n2.push.apply(n2, r2);
|
|
3376
|
-
}
|
|
3377
|
-
return n2;
|
|
3378
|
-
}
|
|
3379
|
-
function co(e6) {
|
|
3380
|
-
for (var t2 = 1; t2 < arguments.length; t2++) {
|
|
3381
|
-
var n2 = arguments[t2] == null ? {} : arguments[t2];
|
|
3382
|
-
t2 % 2 ? so(Object(n2), true).forEach(function(t3) {
|
|
3383
|
-
lo(e6, t3, n2[t3]);
|
|
3384
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e6, Object.getOwnPropertyDescriptors(n2)) : so(Object(n2)).forEach(function(t3) {
|
|
3385
|
-
Object.defineProperty(e6, t3, Object.getOwnPropertyDescriptor(n2, t3));
|
|
3386
|
-
});
|
|
3387
|
-
}
|
|
3388
|
-
return e6;
|
|
3389
|
-
}
|
|
3390
|
-
function lo(e6, t2, n2) {
|
|
3391
|
-
return (t2 = mo(t2)) in e6 ? Object.defineProperty(e6, t2, { value: n2, enumerable: true, configurable: true, writable: true }) : e6[t2] = n2, e6;
|
|
3392
|
-
}
|
|
3393
|
-
function uo(e6, t2) {
|
|
3394
|
-
if (!(e6 instanceof t2)) throw TypeError(`Cannot call a class as a function`);
|
|
3395
|
-
}
|
|
3396
|
-
function fo(e6, t2) {
|
|
3397
|
-
for (var n2 = 0; n2 < t2.length; n2++) {
|
|
3398
|
-
var r2 = t2[n2];
|
|
3399
|
-
r2.enumerable = r2.enumerable || false, r2.configurable = true, `value` in r2 && (r2.writable = true), Object.defineProperty(e6, mo(r2.key), r2);
|
|
3400
|
-
}
|
|
3401
|
-
}
|
|
3402
|
-
function po(e6, t2, n2) {
|
|
3403
|
-
return t2 && fo(e6.prototype, t2), n2 && fo(e6, n2), Object.defineProperty(e6, "prototype", { writable: false }), e6;
|
|
3404
|
-
}
|
|
3405
|
-
function mo(e6) {
|
|
3406
|
-
var t2 = ho(e6, `string`);
|
|
3407
|
-
return Z(t2) == `symbol` ? t2 : t2 + ``;
|
|
3408
|
-
}
|
|
3409
|
-
function ho(e6, t2) {
|
|
3410
|
-
if (Z(e6) != `object` || !e6) return e6;
|
|
3411
|
-
var n2 = e6[Symbol.toPrimitive];
|
|
3412
|
-
if (n2 !== void 0) {
|
|
3413
|
-
var r2 = n2.call(e6, t2 || `default`);
|
|
3414
|
-
if (Z(r2) != `object`) return r2;
|
|
3415
|
-
throw TypeError(`@@toPrimitive must return a primitive value.`);
|
|
3416
|
-
}
|
|
3417
|
-
return (t2 === `string` ? String : Number)(e6);
|
|
3418
|
-
}
|
|
3419
|
-
function go() {
|
|
3420
|
-
return { memoize: true, memoizeFallback: false, bindI18n: ``, bindI18nStore: ``, parseErrorHandler: function(e6, t2, n2, r2) {
|
|
3421
|
-
return n2;
|
|
3422
|
-
}, parseLngForICU: function(e6) {
|
|
3423
|
-
return e6;
|
|
3424
|
-
}, escapeVariables: false };
|
|
3425
|
-
}
|
|
3426
|
-
var _o = function() {
|
|
3427
|
-
function e6(t2) {
|
|
3428
|
-
uo(this, e6), this.type = `i18nFormat`, this.mem = {}, this.init(null, t2);
|
|
3429
|
-
}
|
|
3430
|
-
return po(e6, [{ key: `init`, value: function(e7, t2) {
|
|
3431
|
-
var n2 = this, r2 = e7 && e7.options && e7.options.i18nFormat || {};
|
|
3432
|
-
if (this.options = Li(r2, t2, this.options || {}, go()), this.formats = this.options.formats, e7) {
|
|
3433
|
-
var i2 = this.options, a2 = i2.bindI18n, o2 = i2.bindI18nStore, s2 = i2.memoize;
|
|
3434
|
-
e7.IntlMessageFormat = eo, e7.ICU = this, s2 && (a2 && e7.on(a2, function() {
|
|
3435
|
-
return n2.clearCache();
|
|
3436
|
-
}), o2 && e7.store.on(o2, function() {
|
|
3437
|
-
return n2.clearCache();
|
|
3438
|
-
}));
|
|
3439
|
-
}
|
|
3440
|
-
} }, { key: `addUserDefinedFormats`, value: function(e7) {
|
|
3441
|
-
this.formats = this.formats ? co(co({}, this.formats), e7) : e7;
|
|
3442
|
-
} }, { key: `parse`, value: function(e7, t2, n2, r2, i2, a2) {
|
|
3443
|
-
var o2 = a2 && a2.resolved && a2.resolved.res, s2 = this.options.memoize && `${n2}.${r2}.${i2.replace(/\./g, `###`)}`, c2;
|
|
3444
|
-
this.options.memoize && (c2 = Ni(this.mem, s2));
|
|
3445
|
-
try {
|
|
3446
|
-
return c2 || (c2 = new eo(e7, this.options.parseLngForICU(n2), this.formats, { ignoreTag: true }), this.options.memoize && (this.options.memoizeFallback || !a2 || o2) && Mi(this.mem, s2, c2)), c2.format(this.escapeVariableValues(t2));
|
|
3447
|
-
} catch (n3) {
|
|
3448
|
-
return this.options.parseErrorHandler(n3, i2, e7, t2);
|
|
3449
|
-
}
|
|
3450
|
-
} }, { key: `addLookupKeys`, value: function(e7, t2, n2, r2, i2) {
|
|
3451
|
-
return e7;
|
|
3452
|
-
} }, { key: `clearCache`, value: function() {
|
|
3453
|
-
this.mem = {};
|
|
3454
|
-
} }, { key: `escapeVariableValues`, value: function(e7) {
|
|
3455
|
-
if (!this.options.escapeVariables || !e7 || Z(e7) !== `object`) return e7;
|
|
3456
|
-
for (var t2 = {}, n2 = 0, r2 = Object.entries(e7); n2 < r2.length; n2++) {
|
|
3457
|
-
var i2 = to(r2[n2], 2), a2 = i2[0], o2 = i2[1];
|
|
3458
|
-
t2[a2] = typeof o2 == `string` ? o2.replace(/&/g, `&`).replace(/</g, `<`).replace(/>/g, `>`).replace(/"/g, `"`).replace(/'/g, `'`) : o2;
|
|
3459
|
-
}
|
|
3460
|
-
return t2;
|
|
3461
|
-
} }]), e6;
|
|
3462
|
-
}();
|
|
3463
|
-
_o.type = `i18nFormat`;
|
|
3464
|
-
function vo({ icuOptions: e6 = {}, ...t2 }) {
|
|
3465
|
-
let { parseErrorHandler: n2 = void 0 } = t2;
|
|
3466
|
-
return ki(t2, { icu: new _o({ parseErrorHandler: n2, bindI18n: t2.bindI18n, ...e6 }) });
|
|
3467
|
-
}
|
|
3468
|
-
var yo = (e6, t2, n2, r2) => {
|
|
3469
|
-
let i2 = [n2, { code: t2, ...r2 || {} }];
|
|
3470
|
-
if (e6?.services?.logger?.forward) return e6.services.logger.forward(i2, `warn`, `react-i18next::`, true);
|
|
3471
|
-
Q(i2[0]) && (i2[0] = `react-i18next:: ${i2[0]}`), e6?.services?.logger?.warn ? e6.services.logger.warn(...i2) : console?.warn && console.warn(...i2);
|
|
3472
|
-
};
|
|
3473
|
-
var bo = {};
|
|
3474
|
-
var xo = (e6, t2, n2, r2) => {
|
|
3475
|
-
Q(n2) && bo[n2] || (Q(n2) && (bo[n2] = /* @__PURE__ */ new Date()), yo(e6, t2, n2, r2));
|
|
3476
|
-
};
|
|
3477
|
-
var So = (e6, t2) => () => {
|
|
3478
|
-
if (e6.isInitialized) t2();
|
|
3479
|
-
else {
|
|
3480
|
-
let n2 = () => {
|
|
3481
|
-
setTimeout(() => {
|
|
3482
|
-
e6.off(`initialized`, n2);
|
|
3483
|
-
}, 0), t2();
|
|
3484
|
-
};
|
|
3485
|
-
e6.on(`initialized`, n2);
|
|
3486
|
-
}
|
|
3487
|
-
};
|
|
3488
|
-
var Co = (e6, t2, n2) => {
|
|
3489
|
-
e6.loadNamespaces(t2, So(e6, n2));
|
|
3490
|
-
};
|
|
3491
|
-
var wo = (e6, t2, n2, r2) => {
|
|
3492
|
-
if (Q(n2) && (n2 = [n2]), e6.options.preload && e6.options.preload.indexOf(t2) > -1) return Co(e6, n2, r2);
|
|
3493
|
-
n2.forEach((t3) => {
|
|
3494
|
-
e6.options.ns.indexOf(t3) < 0 && e6.options.ns.push(t3);
|
|
3495
|
-
}), e6.loadLanguages(t2, So(e6, r2));
|
|
3496
|
-
};
|
|
3497
|
-
var To = (e6, t2, n2 = {}) => !t2.languages || !t2.languages.length ? (xo(t2, `NO_LANGUAGES`, `i18n.languages were undefined or empty`, { languages: t2.languages }), true) : t2.hasLoadedNamespace(e6, { lng: n2.lng, precheck: (t3, r2) => {
|
|
3498
|
-
if (n2.bindI18n && n2.bindI18n.indexOf(`languageChanging`) > -1 && t3.services.backendConnector.backend && t3.isLanguageChangingTo && !r2(t3.isLanguageChangingTo, e6)) return false;
|
|
3499
|
-
} });
|
|
3500
|
-
var Q = (e6) => typeof e6 == `string`;
|
|
3501
|
-
var Eo = (e6) => typeof e6 == `object` && !!e6;
|
|
3502
|
-
var Do = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g;
|
|
3503
|
-
var Oo = { "&": `&`, "&": `&`, "<": `<`, "<": `<`, ">": `>`, ">": `>`, "'": `'`, "'": `'`, """: `"`, """: `"`, " ": ` `, " ": ` `, "©": `\xA9`, "©": `\xA9`, "®": `\xAE`, "®": `\xAE`, "…": `\u2026`, "…": `\u2026`, "/": `/`, "/": `/` };
|
|
3504
|
-
var ko = (e6) => Oo[e6];
|
|
3505
|
-
var Ao = { bindI18n: `languageChanged`, bindI18nStore: ``, transEmptyNodeValue: ``, transSupportBasicHtmlNodes: true, transWrapTextNodes: ``, transKeepBasicHtmlNodesFor: [`br`, `strong`, `i`, `p`], useSuspense: true, unescape: (e6) => e6.replace(Do, ko) };
|
|
3506
|
-
var jo = () => Ao;
|
|
3507
|
-
var Mo;
|
|
3508
|
-
var No = () => Mo;
|
|
3509
|
-
var Po = t();
|
|
3510
|
-
var Fo = class {
|
|
3511
|
-
constructor() {
|
|
3512
|
-
this.usedNamespaces = {};
|
|
3513
|
-
}
|
|
3514
|
-
addUsedNamespaces(e6) {
|
|
3515
|
-
e6.forEach((e7) => {
|
|
3516
|
-
this.usedNamespaces[e7] || (this.usedNamespaces[e7] = true);
|
|
3517
|
-
});
|
|
3518
|
-
}
|
|
3519
|
-
getUsedNamespaces() {
|
|
3520
|
-
return Object.keys(this.usedNamespaces);
|
|
3521
|
-
}
|
|
3522
|
-
};
|
|
3523
|
-
var Io = (e6, t2) => {
|
|
3524
|
-
let n2 = c();
|
|
3525
|
-
return o(() => {
|
|
3526
|
-
n2.current = t2 ? n2.current : e6;
|
|
3527
|
-
}, [e6, t2]), n2.current;
|
|
3528
|
-
};
|
|
3529
|
-
var Lo = (e6, t2, n2, r2) => e6.getFixedT(t2, n2, r2);
|
|
3530
|
-
var Ro = (e6, t2, n2, r2) => i(Lo(e6, t2, n2, r2), [e6, t2, n2, r2]);
|
|
3531
|
-
var zo = (e6, t2 = {}) => {
|
|
3532
|
-
let { i18n: n2 } = t2, { i18n: r2, defaultNS: i2 } = a(Po) || {}, s2 = n2 || r2 || No();
|
|
3533
|
-
if (s2 && !s2.reportNamespaces && (s2.reportNamespaces = new Fo()), !s2) {
|
|
3534
|
-
xo(s2, `NO_I18NEXT_INSTANCE`, `useTranslation: You will need to pass in an i18next instance by using initReactI18next`);
|
|
3535
|
-
let e7 = (e8, t4) => Q(t4) ? t4 : Eo(t4) && Q(t4.defaultValue) ? t4.defaultValue : Array.isArray(e8) ? e8[e8.length - 1] : e8, t3 = [e7, {}, false];
|
|
3536
|
-
return t3.t = e7, t3.i18n = {}, t3.ready = false, t3;
|
|
3537
|
-
}
|
|
3538
|
-
s2.options.react?.wait && xo(s2, `DEPRECATED_OPTION`, `useTranslation: It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.`);
|
|
3539
|
-
let u2 = { ...jo(), ...s2.options.react, ...t2 }, { useSuspense: d2, keyPrefix: f2 } = u2, p2 = e6 || i2 || s2.options?.defaultNS;
|
|
3540
|
-
p2 = Q(p2) ? [p2] : p2 || [`translation`], s2.reportNamespaces.addUsedNamespaces?.(p2);
|
|
3541
|
-
let m2 = (s2.isInitialized || s2.initializedStoreOnce) && p2.every((e7) => To(e7, s2, u2)), h2 = Ro(s2, t2.lng || null, u2.nsMode === `fallback` ? p2 : p2[0], f2), g2 = () => h2, _2 = () => Lo(s2, t2.lng || null, u2.nsMode === `fallback` ? p2 : p2[0], f2), [v2, y2] = l(g2), b2 = p2.join();
|
|
3542
|
-
t2.lng && (b2 = `${t2.lng}${b2}`);
|
|
3543
|
-
let x2 = Io(b2), S2 = c(true);
|
|
3544
|
-
o(() => {
|
|
3545
|
-
let { bindI18n: e7, bindI18nStore: n3 } = u2;
|
|
3546
|
-
S2.current = true, !m2 && !d2 && (t2.lng ? wo(s2, t2.lng, p2, () => {
|
|
3547
|
-
S2.current && y2(_2);
|
|
3548
|
-
}) : Co(s2, p2, () => {
|
|
3549
|
-
S2.current && y2(_2);
|
|
3550
|
-
})), m2 && x2 && x2 !== b2 && S2.current && y2(_2);
|
|
3551
|
-
let r3 = () => {
|
|
3552
|
-
S2.current && y2(_2);
|
|
3553
|
-
};
|
|
3554
|
-
return e7 && s2?.on(e7, r3), n3 && s2?.store.on(n3, r3), () => {
|
|
3555
|
-
S2.current = false, s2 && e7 && e7?.split(` `).forEach((e8) => s2.off(e8, r3)), n3 && s2 && n3.split(` `).forEach((e8) => s2.store.off(e8, r3));
|
|
3556
|
-
};
|
|
3557
|
-
}, [s2, b2]), o(() => {
|
|
3558
|
-
S2.current && m2 && y2(g2);
|
|
3559
|
-
}, [s2, f2, m2]);
|
|
3560
|
-
let C2 = [v2, s2, m2];
|
|
3561
|
-
if (C2.t = v2, C2.i18n = s2, C2.ready = m2, m2 || !m2 && !d2) return C2;
|
|
3562
|
-
throw new Promise((e7) => {
|
|
3563
|
-
t2.lng ? wo(s2, t2.lng, p2, () => e7()) : Co(s2, p2, () => e7());
|
|
3564
|
-
});
|
|
3565
|
-
};
|
|
3566
|
-
function Bo({ i18n: e6, defaultNS: t2, children: r2 }) {
|
|
3567
|
-
let i2 = s(() => ({ i18n: e6, defaultNS: t2 }), [e6, t2]);
|
|
3568
|
-
return n(Po.Provider, { value: i2 }, r2);
|
|
3569
|
-
}
|
|
3570
|
-
var Vo = I(`@wix/site-service-renderer-configuration`);
|
|
3571
|
-
var Ho = () => {
|
|
3572
|
-
let e6, t2;
|
|
3573
|
-
try {
|
|
3574
|
-
e6 = u(Vo).languageCode;
|
|
3575
|
-
} catch {
|
|
3576
|
-
}
|
|
3577
|
-
try {
|
|
3578
|
-
t2 = u(Rr).language;
|
|
3579
|
-
} catch {
|
|
3580
|
-
}
|
|
3581
|
-
return e6 || t2;
|
|
3582
|
-
};
|
|
3583
|
-
var Uo = `wix-warmup-data`;
|
|
3584
|
-
var Wo = null;
|
|
3585
|
-
function Go(e6) {
|
|
3586
|
-
if (typeof document < `u`) try {
|
|
3587
|
-
let t2 = document.getElementById(Uo)?.textContent;
|
|
3588
|
-
return t2 ? (Wo?.text !== t2 && (Wo = { text: t2, data: JSON.parse(t2).builderComponentsWarmupData ?? {} }), Wo.data[e6] ?? void 0) : void 0;
|
|
3589
|
-
} catch {
|
|
3590
|
-
return;
|
|
3591
|
-
}
|
|
3592
|
-
}
|
|
3593
|
-
var Ko = `blog-builder:i18n`;
|
|
3594
|
-
var qo = () => Go(Ko);
|
|
3595
|
-
var Jo = /* @__PURE__ */ new Map();
|
|
3596
|
-
function Yo(e6, t2) {
|
|
3597
|
-
let n2 = Jo.get(e6);
|
|
3598
|
-
if (n2) return n2;
|
|
3599
|
-
let r2 = qo(), i2 = r2?.locale === e6 ? r2.messages : void 0, a2 = vo({ locale: e6, useSuspense: true, ...i2 ? { messages: i2 } : { asyncMessagesLoader: t2 } });
|
|
3600
|
-
return Jo.set(e6, a2), a2;
|
|
3601
|
-
}
|
|
3602
|
-
var Xo = (e6, t2, n2) => {
|
|
3603
|
-
let r2 = t2.lastIndexOf(`?`), i2 = e6[r2 === -1 || r2 < t2.lastIndexOf(`/`) ? t2 : t2.slice(0, r2)];
|
|
3604
|
-
return i2 ? typeof i2 == `function` ? i2() : Promise.resolve(i2) : new Promise((e7, r3) => {
|
|
3605
|
-
(typeof queueMicrotask == `function` ? queueMicrotask : setTimeout)(r3.bind(null, Error(`Unknown variable dynamic import: ` + t2 + (t2.split(`/`).length === n2 ? `` : `. Note that variables only represent file names one level deep.`))));
|
|
3606
|
-
});
|
|
3607
|
-
};
|
|
3608
|
-
var Zo = (e6) => e6.split(`-`)[0] ?? e6;
|
|
3609
|
-
Hr({ isDev: false, loadMessages: (e6) => Xo(Object.assign({ "../assets/locale/messages_en.dev.json": () => pn(() => Promise.resolve().then(() => $o), void 0, import.meta.url), "../assets/locale/messages_en.json": () => pn(() => Promise.resolve().then(() => ts), void 0, import.meta.url) }), `../assets/locale/messages_${Zo(e6)}.json`, 4), loadDevMessages: (e6) => Xo(Object.assign({ "../assets/locale/messages_en.dev.json": () => pn(() => Promise.resolve().then(() => $o), void 0, import.meta.url) }), `../assets/locale/messages_${Zo(e6)}.dev.json`, 4) });
|
|
3610
|
-
function Qo(e6) {
|
|
3611
|
-
let t2 = Ho(), n2 = qo()?.locale ?? t2 ?? `en`;
|
|
3612
|
-
return { i18n: Yo(n2, e6), locale: n2 };
|
|
3613
|
-
}
|
|
3614
|
-
var $o = m({ default: () => es });
|
|
3615
|
-
var es = { "post.time-to-read": `{count, plural, one {# min read} other {# min read}}`, "post.view-count": `{count, plural, one {{formatted} view} other {{formatted} views}}`, "post.comment-count": `{count, plural, one {{formatted} comment} other {{formatted} comments}}`, "post.like-count": `{count, plural, one {{formatted} like} other {{formatted} likes}}`, "post-list.empty-state.title": `No posts yet`, "post-list.empty-state.description": `Once posts are published, they will appear here.`, "related-posts.empty-state.title": `No related posts yet`, "related-posts.empty-state.description": `Once more posts are published, they will appear here.`, "post-actions.like": `Like post`, "post-actions.unlike": `Unlike post`, "post-actions.share": `Share post`, "post-actions.share-dialog": `Share post`, "post-actions.link-copied": `Link copied`, "post-actions.copy-manually": `Copy the link below to share this post.`, "post-actions.link-label": `Post link`, "post-actions.copy-link": `Copy link`, "post-actions.close": `Close`, "post-counters.loading-likes": `Loading likes`, "cover-media.play": `Play video`, "cover-media.placeholder-alt": `Post cover image`, "post-comments.loading": `Loading comments\u2026`, "post-comments.no-post": `No post resolved for this URL yet.`, "post-comments.unavailable": `Comments are unavailable \u2014 no app instance.`, "post-comments.demo-notice": `Sample comments are shown while editing. Visitors will see real comments.`, "canvas.post-title": `Post Title`, "canvas.author-name": `Author Name`, "canvas.excerpt": `Share the key idea of your post here. This short summary shows on feed cards and in search results, and tells readers why the post is worth their time.`, "canvas.content": `This is where the full post appears. Write your story here, add images, galleries and video from the dashboard, and use headings and quotes to keep it easy to read.`, "canvas.category": `Category`, "canvas.category-numbered": `Category {number}`, "canvas.tag-numbered": `Tag {number}`, "canvas.author-photo-alt": `Author photo`, "category-header.all-posts": `All Posts` };
|
|
3616
|
-
var ts = m({ default: () => rs, title: () => ns });
|
|
3617
|
-
var ns = `My App`;
|
|
3618
|
-
var rs = { "canvas.category": `Category`, "post-list.empty-state.description": `Once posts are published, they will appear here.`, "canvas.tag-numbered": `Tag {number}`, "cover-media.play": `Play video`, "post-comments.unavailable": `Comments are unavailable \u2014 no app instance.`, "post-counters.loading-likes": `Loading likes`, "post-comments.loading": `Loading comments\u2026`, "post-actions.like": `Like post`, "canvas.content": `This is where the full post appears. Write your story here, add images, galleries and video from the dashboard, and use headings and quotes to keep it easy to read.`, "related-posts.empty-state.title": `No related posts yet`, "post.time-to-read": `{count, plural, one {# min read} other {# min read}}`, "post-actions.link-copied": `Link copied`, "category-header.all-posts": `All Posts`, "post-actions.copy-manually": `Copy the link below to share this post.`, "post-actions.copy-link": `Copy link`, "cover-media.placeholder-alt": `Post cover image`, "post-actions.link-label": `Post link`, "post-list.empty-state.title": `No posts yet`, "post-actions.share-dialog": `Share post`, "canvas.post-title": `Post Title`, "post-actions.unlike": `Unlike post`, "post-comments.no-post": `No post resolved for this URL yet.`, "post.like-count": `{count, plural, one {{formatted} like} other {{formatted} likes}}`, "canvas.category-numbered": `Category {number}`, "post.comment-count": `{count, plural, one {{formatted} comment} other {{formatted} comments}}`, "post-actions.share": `Share post`, "post.view-count": `{count, plural, one {{formatted} view} other {{formatted} views}}`, "post-actions.close": `Close`, "canvas.category-description": `Add a short description of this category so readers know what they will find here. It shows under the category title, above the posts.`, "canvas.author-photo-alt": `Author photo`, "canvas.author-name": `Author Name`, "post-comments.demo-notice": `Sample comments are shown while editing. Visitors will see real comments.`, title: ns, "related-posts.empty-state.description": `Once more posts are published, they will appear here.`, "canvas.excerpt": `Share the key idea of your post here. This short summary shows on feed cards and in search results, and tells readers why the post is worth their time.` };
|
|
3619
|
-
var is = Object.assign({ "../assets/locale/messages_en.dev.json": $o, "../assets/locale/messages_en.json": ts });
|
|
3620
|
-
var as = (e6, t2) => {
|
|
3621
|
-
let n2 = is[`../assets/locale/messages_${Zo(e6)}${t2}.json`];
|
|
3622
|
-
return n2 ? Promise.resolve(n2) : Promise.reject(Error(`no messages file`));
|
|
3623
|
-
};
|
|
3624
|
-
var os = Hr({ isDev: false, loadMessages: (e6) => as(e6, ``), loadDevMessages: (e6) => as(e6, `.dev`) });
|
|
3625
|
-
var ss = (e6, t2, n2) => typeof e6 != `number` || !Number.isFinite(e6) || e6 < 0 ? `` : new Intl.NumberFormat(n2, t2 === `compact` ? { notation: `compact`, maximumFractionDigits: 1 } : void 0).format(e6);
|
|
3626
|
-
var $ = { timeToRead: `post.time-to-read`, viewCount: `post.view-count`, commentCount: `post.comment-count`, likeCount: `post.like-count`, noPostsTitle: `post-list.empty-state.title`, noPostsDescription: `post-list.empty-state.description`, noRelatedPostsTitle: `related-posts.empty-state.title`, noRelatedPostsDescription: `related-posts.empty-state.description`, canvasPostTitle: `canvas.post-title`, canvasAuthorName: `canvas.author-name`, canvasExcerpt: `canvas.excerpt`, canvasContent: `canvas.content`, canvasCategory: `canvas.category`, canvasCategoryNumbered: `canvas.category-numbered`, canvasTagNumbered: `canvas.tag-numbered`, canvasCoverAlt: `cover-media.placeholder-alt`, canvasAuthorPhotoAlt: `canvas.author-photo-alt` };
|
|
3627
|
-
var cs = (e6, t2) => {
|
|
3628
|
-
let n2 = (n3) => (r2) => e6(n3, { count: r2, formatted: ss(r2, `full`, t2) });
|
|
3629
|
-
return { timeToRead: (t3) => e6($.timeToRead, { count: t3 }), viewCount: n2($.viewCount), commentCount: n2($.commentCount), likeCount: n2($.likeCount), noPostsEmptyState: () => ({ title: e6($.noPostsTitle), description: e6($.noPostsDescription) }), noRelatedPostsEmptyState: () => ({ title: e6($.noRelatedPostsTitle), description: e6($.noRelatedPostsDescription) }), canvas: { postTitle: () => e6($.canvasPostTitle), authorName: () => e6($.canvasAuthorName), excerpt: () => e6($.canvasExcerpt), content: () => e6($.canvasContent), category: () => e6($.canvasCategory), categoryNumbered: (t3) => e6($.canvasCategoryNumbered, { number: t3 }), tagNumbered: (t3) => e6($.canvasTagNumbered, { number: t3 }), coverAlt: () => e6($.canvasCoverAlt), authorPhotoAlt: () => e6($.canvasAuthorPhotoAlt) } };
|
|
3630
|
-
};
|
|
3631
|
-
var ls = (e6) => e6.replace(/&/g, `&`).replace(/</g, `<`).replace(/>/g, `>`).replace(/"/g, `"`).replace(/'/g, `'`);
|
|
3632
|
-
var us = (e6) => ({ text: e6, html: `<p>${ls(e6)}</p>`, linkList: [] });
|
|
3633
|
-
var ds = t(null);
|
|
3634
|
-
ds.displayName = `PostItemContext`;
|
|
3635
|
-
function fs() {
|
|
3636
|
-
return a(ds);
|
|
3637
|
-
}
|
|
3638
|
-
function ps({ postData: t2, children: n2 }) {
|
|
3639
|
-
let r2 = zr(), { t: i2, ready: a2 } = zo(void 0, { useSuspense: false }), o2 = s(() => cs(i2, r2), [i2, r2]), { isLiked: c2, likeCount: l2, isLikeCountLoaded: u2, viewCount: d2, commentCount: p2, toggleLike: m2, liveLikes: h2 } = Lr(t2.recentPostItem.slug ? t2._id : void 0, 0), g2 = s(() => ({ ...t2, isLiked: c2, isLikeCountLoaded: u2, toggleLike: m2, liveLikes: h2, likeCountValue: l2, viewCountValue: d2 ?? t2.initialViewCount, commentCountValue: p2 ?? t2.initialCommentCount, likeCount: us(a2 ? o2.likeCount(l2) : ``), viewCount: d2 === void 0 || !a2 ? t2.viewCount : us(o2.viewCount(d2)), commentCount: p2 === void 0 || !a2 ? t2.commentCount : us(o2.commentCount(p2)) }), [t2, c2, l2, u2, d2, p2, m2, h2, o2, a2]), _2 = s(() => ({ currentPostId: t2.recentPostItem.slug ? t2._id : void 0, categoryIds: void 0, relatedPostIds: void 0 }), [t2]), v2 = s(() => {
|
|
3640
|
-
let e6 = g2.itemCategoryLabel.text;
|
|
3641
|
-
return { title: g2.itemTitle, excerpt: g2.itemExcerpt, coverImage: g2.itemCoverImage, coverMedia: g2.itemCoverMedia, richContent: { nodes: [] }, authorName: g2.authorName, authorImage: g2.authorImage, timeToRead: g2.timeToRead, publishedDate: g2.itemPublishedDate, viewCount: g2.viewCount, commentCount: g2.commentCount, likeCount: g2.likeCount, postCategories: e6 ? [{ _id: e6, label: e6, itemCategoryLabel: g2.itemCategoryLabel, itemCategoryLink: void 0, categoryItem: { label: e6, slug: `` } }] : [], itemCategoryLabel: g2.itemCategoryLabel, postTags: [], hasCoverImage: g2.itemCoverMedia !== void 0 && g2.itemCoverImage !== void 0, hasExcerpt: !!g2.itemExcerpt.text.trim(), hasTags: false, publishedDateValue: g2.publishedDateValue, minutesToReadValue: g2.minutesToReadValue, viewCountValue: g2.viewCountValue, commentCountValue: g2.commentCountValue, isLiked: g2.isLiked, likeCountValue: g2.likeCountValue, isLikeCountLoaded: g2.isLikeCountLoaded, toggleLike: g2.toggleLike, liveLikes: g2.liveLikes, clockValue: g2.clockValue, postUrl: g2.itemLink?.href, itemLink: g2.itemLink, commentingEnabled: g2.commentingEnabled, relatedPostsSource: _2, isLoadingPost: false, hasError: false, isEmpty: false };
|
|
3642
|
-
}, [g2, _2]);
|
|
3643
|
-
return f(ds.Provider, { value: g2, children: f(e, { value: v2, children: n2 }) });
|
|
3644
|
-
}
|
|
3645
|
-
function ms({ postData: e6, children: t2 }) {
|
|
3646
|
-
let { i18n: n2 } = Qo(os);
|
|
3647
|
-
return e6 === void 0 ? f(d, { children: t2 }) : f(Bo, { i18n: n2, children: f(ps, { postData: e6, children: t2 }) });
|
|
3648
|
-
}
|
|
3649
|
-
var hs = Dn(`bd5dc6d6-7a0d-48d5-99da-457340ce6f2d`);
|
|
3650
|
-
export {
|
|
3651
|
-
ms as PostItemContextProvider,
|
|
3652
|
-
ms as default,
|
|
3653
|
-
hs as injectAccessTokenGetter,
|
|
3654
|
-
fs as usePostItemContext,
|
|
3655
|
-
fs as usePostListItemContext
|
|
3656
|
-
};
|
|
3657
|
-
//# sourceMappingURL=context-post-item.mjs.map
|