@wix/bookings 1.0.1771 → 1.0.1773
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-categories/runtime.js +2 -2
- package/_sdk-exports/context-locations/runtime.js +2 -2
- package/_sdk-exports/context-service/runtime.js +3 -3
- package/_sdk-exports/context-service-addons/runtime.js +2 -2
- package/_sdk-exports/context-services/runtime.js +3 -3
- package/build/cjs/context-categories.js +1774 -632
- package/build/cjs/context-categories.js.map +1 -1
- package/build/cjs/context-locations.js +1812 -670
- package/build/cjs/context-locations.js.map +1 -1
- package/build/cjs/context-service-addons.js +1858 -716
- package/build/cjs/context-service-addons.js.map +1 -1
- package/build/cjs/context-service.js +4413 -3286
- package/build/cjs/context-service.js.map +1 -1
- package/build/cjs/context-services.js +2410 -1268
- package/build/cjs/context-services.js.map +1 -1
- package/build/es/context-categories.mjs +1774 -632
- package/build/es/context-categories.mjs.map +1 -1
- package/build/es/context-locations.mjs +1812 -670
- package/build/es/context-locations.mjs.map +1 -1
- package/build/es/context-service-addons.mjs +1858 -716
- package/build/es/context-service-addons.mjs.map +1 -1
- package/build/es/context-service.mjs +4413 -3286
- package/build/es/context-service.mjs.map +1 -1
- package/build/es/context-services.mjs +2411 -1269
- package/build/es/context-services.mjs.map +1 -1
- package/package.json +3 -3
|
@@ -4,11 +4,11 @@ import { useServiceContext as l } from "@wix/bookings/context/service";
|
|
|
4
4
|
import { useGetService as u, useService as d } from "@wix/services-manager-react";
|
|
5
5
|
import { jsx as f } from "react/jsx-runtime";
|
|
6
6
|
var p = {};
|
|
7
|
-
function m(
|
|
8
|
-
return () => ({ __type: `event-definition`, type:
|
|
7
|
+
function m(e5, t2 = false, n2 = (e6) => e6) {
|
|
8
|
+
return () => ({ __type: `event-definition`, type: e5, isDomainEvent: t2, transformations: n2 });
|
|
9
9
|
}
|
|
10
|
-
var h = (
|
|
11
|
-
switch (
|
|
10
|
+
var h = (e5) => {
|
|
11
|
+
switch (e5) {
|
|
12
12
|
case `get`:
|
|
13
13
|
case `GET`:
|
|
14
14
|
return `GET`;
|
|
@@ -31,186 +31,186 @@ var h = (e2) => {
|
|
|
31
31
|
case `OPTIONS`:
|
|
32
32
|
return `OPTIONS`;
|
|
33
33
|
default:
|
|
34
|
-
throw Error(`Unknown method: ${
|
|
34
|
+
throw Error(`Unknown method: ${e5}`);
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
|
-
var g = (
|
|
37
|
+
var g = (e5) => (t2) => async (n2) => {
|
|
38
38
|
let r2, i2 = (t3) => {
|
|
39
|
-
if (r2 =
|
|
39
|
+
if (r2 = e5(n2)(t3), r2.url === void 0) throw Error(`Url was not successfully created for this request, please reach out to support channels for assistance.`);
|
|
40
40
|
let { method: i3, url: a2, params: o2 } = r2;
|
|
41
41
|
return { ...r2, method: h(i3), url: a2, data: r2.data, params: o2 };
|
|
42
42
|
};
|
|
43
43
|
try {
|
|
44
|
-
let
|
|
44
|
+
let e6 = await t2.request(i2);
|
|
45
45
|
if (r2 === void 0) throw Error(`Request options were not created for this request, please reach out to support channels for assistance.`);
|
|
46
|
-
let n3 = Array.isArray(r2.transformResponse) ? r2.transformResponse : [r2.transformResponse], a2 =
|
|
46
|
+
let n3 = Array.isArray(r2.transformResponse) ? r2.transformResponse : [r2.transformResponse], a2 = e6.data;
|
|
47
47
|
return n3.forEach((t3) => {
|
|
48
|
-
t3 && (a2 = t3(
|
|
48
|
+
t3 && (a2 = t3(e6.data, e6.headers));
|
|
49
49
|
}), a2;
|
|
50
|
-
} catch (
|
|
51
|
-
throw typeof
|
|
50
|
+
} catch (e6) {
|
|
51
|
+
throw typeof e6 == `object` && e6 && `response` in e6 && typeof e6.response == `object` && e6.response !== null && `data` in e6.response ? e6.response.data : e6;
|
|
52
52
|
}
|
|
53
53
|
};
|
|
54
|
-
var _ = (
|
|
54
|
+
var _ = (e5) => e5.__isAmbassador ? true : !!e5().__isAmbassador;
|
|
55
55
|
var v = `__metadata`;
|
|
56
|
-
var
|
|
57
|
-
var
|
|
56
|
+
var y = `edge.wixapis.com`;
|
|
57
|
+
var b = class extends Error {
|
|
58
58
|
message;
|
|
59
59
|
response;
|
|
60
|
-
constructor(
|
|
61
|
-
super(
|
|
60
|
+
constructor(e5, t2) {
|
|
61
|
+
super(e5), this.message = e5, this.response = t2;
|
|
62
62
|
}
|
|
63
63
|
async details() {
|
|
64
|
-
let
|
|
65
|
-
return
|
|
64
|
+
let e5 = await this.response.json();
|
|
65
|
+
return x(this.response.status, e5?.message, e5?.details, { requestId: this.response.headers.get(`X-Wix-Request-Id`), details: e5 });
|
|
66
66
|
}
|
|
67
67
|
};
|
|
68
|
-
var
|
|
69
|
-
var
|
|
70
|
-
var
|
|
71
|
-
var
|
|
72
|
-
function
|
|
73
|
-
return
|
|
68
|
+
var x = (e5, t2, n2, r2) => ({ details: { ...!n2?.validationError && { applicationError: { description: t2, code: e5, data: r2 } }, ...n2 }, message: t2, requestId: r2?.requestId });
|
|
69
|
+
var ee = (e5) => e5?.method && [`post`, `put`, `patch`].includes(e5.method.toLocaleLowerCase()) && e5.body ? { "Content-Type": `application/json` } : {};
|
|
70
|
+
var te = (e5) => e5 && typeof e5 == `object` && !Array.isArray(e5);
|
|
71
|
+
var ne = (e5) => e5.__type === `host`;
|
|
72
|
+
function S(e5, t2) {
|
|
73
|
+
return e5.create(t2);
|
|
74
74
|
}
|
|
75
|
-
var
|
|
76
|
-
function
|
|
77
|
-
return { [
|
|
75
|
+
var C = `x-wix-bi-gateway`;
|
|
76
|
+
function re(e5, t2, n2) {
|
|
77
|
+
return { [C]: ie({ environment: `js-sdk${n2 ? `-${n2}` : ``}`, "package-name": e5.packageName ?? t2?.PACKAGE_NAME, "method-fqn": e5.methodFqn, entity: e5.entityFqdn }) };
|
|
78
78
|
}
|
|
79
|
-
function
|
|
80
|
-
return Object.entries(
|
|
79
|
+
function ie(e5) {
|
|
80
|
+
return Object.entries(e5).filter(([e6, t2]) => !!t2).map(([e6, t2]) => `${e6}=${t2}`).join(`,`);
|
|
81
81
|
}
|
|
82
|
-
function
|
|
82
|
+
function ae(e5) {
|
|
83
83
|
let t2 = globalThis.__wix_context__, n2 = { client: p.client, elevatedClient: p.elevatedClient }, r2;
|
|
84
84
|
globalThis.__wix_context__ = void 0, p.client = void 0, p.elevatedClient = void 0, typeof $wixContext < `u` && (r2 = { client: $wixContext?.client, elevatedClient: $wixContext?.elevatedClient }, delete $wixContext.client, delete $wixContext.elevatedClient);
|
|
85
85
|
try {
|
|
86
|
-
return
|
|
86
|
+
return e5();
|
|
87
87
|
} finally {
|
|
88
88
|
globalThis.__wix_context__ = t2, p.client = n2.client, p.elevatedClient = n2.elevatedClient, typeof $wixContext < `u` && ($wixContext.client = r2.client, $wixContext.elevatedClient = r2.elevatedClient);
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
|
-
var
|
|
92
|
-
function
|
|
93
|
-
return
|
|
94
|
-
}
|
|
95
|
-
var
|
|
96
|
-
var
|
|
97
|
-
var
|
|
98
|
-
var
|
|
99
|
-
function
|
|
100
|
-
let t2 =
|
|
101
|
-
t2 = t2.replace(
|
|
91
|
+
var oe = { id: `_id`, createdDate: `_createdDate`, updatedDate: `_updatedDate` };
|
|
92
|
+
function se(e5) {
|
|
93
|
+
return fe(e5).map((e6) => e6.toLocaleUpperCase()).join(`_`);
|
|
94
|
+
}
|
|
95
|
+
var ce = /([\p{Ll}\d])(\p{Lu})/gu;
|
|
96
|
+
var le = /(\p{Lu})([\p{Lu}][\p{Ll}])/gu;
|
|
97
|
+
var ue = `$1\0$2`;
|
|
98
|
+
var de = /[^\p{L}\d]+/giu;
|
|
99
|
+
function fe(e5) {
|
|
100
|
+
let t2 = e5.trim();
|
|
101
|
+
t2 = t2.replace(ce, ue).replace(le, ue), t2 = t2.replace(de, `\0`);
|
|
102
102
|
let n2 = 0, r2 = t2.length;
|
|
103
103
|
for (; t2.charAt(n2) === `\0`; ) n2++;
|
|
104
104
|
if (n2 === r2) return [];
|
|
105
105
|
for (; t2.charAt(r2 - 1) === `\0`; ) r2--;
|
|
106
106
|
return t2.slice(n2, r2).split(/\0/g);
|
|
107
107
|
}
|
|
108
|
-
var
|
|
109
|
-
var
|
|
110
|
-
var
|
|
111
|
-
function
|
|
112
|
-
if (typeof
|
|
113
|
-
if (
|
|
114
|
-
if (
|
|
115
|
-
if (
|
|
116
|
-
let t3 =
|
|
117
|
-
return
|
|
118
|
-
}
|
|
119
|
-
return
|
|
120
|
-
}
|
|
121
|
-
var
|
|
122
|
-
let r2 =
|
|
123
|
-
return
|
|
108
|
+
var pe = (e5) => `validationError` in (e5.response?.data?.details ?? {});
|
|
109
|
+
var me = (e5) => `applicationError` in (e5.response?.data?.details ?? {});
|
|
110
|
+
var he = (e5) => (e5.response?.status ?? -1) >= 400 && (e5.response?.status ?? -1) < 500;
|
|
111
|
+
function ge(e5, t2 = { explicitPathsToArguments: {}, spreadPathsToArguments: {}, singleArgumentUnchanged: false }, n2 = []) {
|
|
112
|
+
if (typeof e5 != `object` || !e5) throw e5;
|
|
113
|
+
if (pe(e5)) return _e(e5, t2, n2);
|
|
114
|
+
if (me(e5)) return ve(e5);
|
|
115
|
+
if (he(e5)) {
|
|
116
|
+
let t3 = e5.response?.status, n3 = e5.response?.statusText ?? `UNKNOWN`, r2 = e5.response?.data?.message ?? n3, i2 = { applicationError: { description: n3, code: se(n3), data: {} }, requestId: e5.requestId };
|
|
117
|
+
return w(e5, { message: JSON.stringify({ message: r2, details: i2 }, null, 2), extraProperties: { details: i2, status: t3 } });
|
|
118
|
+
}
|
|
119
|
+
return ye(e5);
|
|
120
|
+
}
|
|
121
|
+
var _e = (e5, t2, n2) => {
|
|
122
|
+
let r2 = e5.response?.data, i2 = e5.requestId, { fieldViolations: a2 } = r2.details.validationError, o2 = be(t2, a2, n2)?.sort((e6, t3) => e6.field < t3.field ? -1 : 1), s2 = `INVALID_ARGUMENT: ${o2?.map(({ field: e6, description: t3 }) => `"${e6}" ${t3}`)?.join(`, `)}`, c2 = { validationError: { fieldViolations: o2 }, requestId: i2 };
|
|
123
|
+
return w(e5, { message: JSON.stringify({ message: s2, details: c2 }, null, 2), extraProperties: { details: c2, status: e5.response?.status, requestId: i2 } });
|
|
124
124
|
};
|
|
125
|
-
var
|
|
126
|
-
var
|
|
127
|
-
let t2 =
|
|
128
|
-
return
|
|
125
|
+
var w = (e5, { message: t2, extraProperties: n2 }) => Object.assign(e5, { ...n2, message: t2 });
|
|
126
|
+
var ve = (e5) => {
|
|
127
|
+
let t2 = e5.response?.status, n2 = e5.response?.statusText ?? `UNKNOWN`, r2 = e5.response?.data?.message ?? n2, i2 = e5.response?.data?.details?.applicationError?.description ?? n2, a2 = e5.response?.data?.details?.applicationError?.code ?? se(n2), o2 = e5.response?.data?.details?.applicationError?.data ?? {}, s2 = r2 === i2 ? r2 : `${r2}: ${i2}`, c2 = { applicationError: { description: i2, code: a2, data: o2 }, requestId: e5.requestId };
|
|
128
|
+
return w(e5, { message: JSON.stringify({ message: s2, details: c2 }, null, 2), extraProperties: { details: c2, status: t2, requestId: e5.requestId } });
|
|
129
129
|
};
|
|
130
|
-
var
|
|
131
|
-
var
|
|
132
|
-
let a2 = { ...
|
|
133
|
-
return r2?.filter((
|
|
134
|
-
let r3 = t2[
|
|
135
|
-
if (r3) return { ...
|
|
136
|
-
let s2 = o2?.sort((
|
|
130
|
+
var ye = (e5) => w(e5, { message: e5.requestId ? `System error occurred, request-id: ${e5.requestId}` : `System error occurred: ${JSON.stringify(e5)}`, extraProperties: { requestId: e5.requestId, status: e5.response?.status, code: se(e5.response?.statusText ?? `UNKNOWN`), ...!e5.response && { runtimeError: e5 } } });
|
|
131
|
+
var be = ({ spreadPathsToArguments: e5, explicitPathsToArguments: t2, singleArgumentUnchanged: n2 }, r2, i2) => {
|
|
132
|
+
let a2 = { ...e5, ...t2 }, o2 = Object.keys(a2);
|
|
133
|
+
return r2?.filter((e6) => !r2.some((t3) => t3.field.length > e6.field.length && t3.field.startsWith(e6.field) && o2.includes(t3.field))).map((e6) => {
|
|
134
|
+
let r3 = t2[e6.field];
|
|
135
|
+
if (r3) return { ...e6, field: xe(r3, i2) };
|
|
136
|
+
let s2 = o2?.sort((e7, t3) => t3.length - e7.length)?.find((t3) => e6.field.startsWith(t3));
|
|
137
137
|
if (s2) {
|
|
138
138
|
let t3 = a2[s2];
|
|
139
|
-
if (t3) return { ...
|
|
139
|
+
if (t3) return { ...e6, field: e6.field.replace(s2, xe(t3, i2)) };
|
|
140
140
|
}
|
|
141
|
-
return n2 ? { ...
|
|
141
|
+
return n2 ? { ...e6, field: `${i2[0]}.${e6.field}` } : e6;
|
|
142
142
|
});
|
|
143
143
|
};
|
|
144
|
-
var
|
|
145
|
-
let n2 =
|
|
146
|
-
return n2 == null ?
|
|
144
|
+
var xe = (e5, t2) => {
|
|
145
|
+
let n2 = Se(e5);
|
|
146
|
+
return n2 == null ? e5 : e5.replace(`$[${n2}]`, t2[n2]);
|
|
147
147
|
};
|
|
148
|
-
var
|
|
149
|
-
let t2 =
|
|
148
|
+
var Se = (e5) => {
|
|
149
|
+
let t2 = e5.match(/\$\[(?<argIndex>\d+)\]/);
|
|
150
150
|
return t2 && t2.groups && Number(t2.groups.argIndex);
|
|
151
151
|
};
|
|
152
|
-
function
|
|
153
|
-
return
|
|
154
|
-
let i3 =
|
|
152
|
+
function Ce(e5, t2, n2, r2, i2, a2, o2, s2, c2, l2, u2) {
|
|
153
|
+
return ae(() => e5({ request: async (e6) => {
|
|
154
|
+
let i3 = e6({ host: s2?.HTTPHost || `www.wixapis.com` }), a3 = i3;
|
|
155
155
|
a3.method === `GET` && a3.fallback?.length && (a3.params?.toString().length ?? 0) > 4e3 && (a3 = i3.fallback[0]);
|
|
156
|
-
let o3 = s2?.HTTPHost ?? `www.wixapis.com`, u3 = `https://${l2 ?
|
|
156
|
+
let o3 = s2?.HTTPHost ?? `www.wixapis.com`, u3 = `https://${l2 ? y : o3}${a3.url}`;
|
|
157
157
|
a3.params && a3.params.toString() && (u3 += `?${a3.params.toString()}`);
|
|
158
158
|
try {
|
|
159
|
-
let
|
|
159
|
+
let e7 = re(i3, t2, c2), o4 = { method: a3.method, ...a3.data && { body: JSON.stringify(a3.data) }, headers: { ...e7 } }, s3 = await n2(u3, o4);
|
|
160
160
|
if (s3.status !== 200) {
|
|
161
|
-
let
|
|
161
|
+
let e8 = null;
|
|
162
162
|
try {
|
|
163
|
-
|
|
163
|
+
e8 = await s3.json();
|
|
164
164
|
} catch {
|
|
165
165
|
}
|
|
166
|
-
let t3 =
|
|
166
|
+
let t3 = Te(s3.status, e8?.message ?? s3.statusText, e8?.details, { requestId: s3.headers.get(`X-Wix-Request-Id`), details: e8 }), n3 = ge(t3);
|
|
167
167
|
throw r2?.handleError(n3, { requestOptions: { url: a3.url, method: a3.method, entityFqdn: i3.entityFqdn, methodFqn: i3.methodFqn } }), t3;
|
|
168
168
|
}
|
|
169
169
|
let l3 = await s3.json();
|
|
170
170
|
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 };
|
|
171
|
-
} catch (
|
|
172
|
-
throw
|
|
171
|
+
} catch (e7) {
|
|
172
|
+
throw e7.message?.includes(`fetch is not defined`) && console.error(`Node.js v18+ is required`), e7;
|
|
173
173
|
}
|
|
174
174
|
}, fetchWithAuth: n2, wixAPIFetch: i2, getActiveToken: a2, getAuthHeaders: o2 }, { validateRequestSchema: u2 }));
|
|
175
175
|
}
|
|
176
|
-
var
|
|
176
|
+
var we = class extends Error {
|
|
177
177
|
response;
|
|
178
178
|
requestId;
|
|
179
|
-
constructor(
|
|
180
|
-
super(), this.response =
|
|
179
|
+
constructor(e5) {
|
|
180
|
+
super(), this.response = e5.response, this.requestId = e5.requestId;
|
|
181
181
|
}
|
|
182
182
|
};
|
|
183
|
-
var
|
|
184
|
-
var
|
|
185
|
-
function
|
|
186
|
-
if (
|
|
187
|
-
let r2 =
|
|
188
|
-
for (let
|
|
189
|
-
let t3 = r2[
|
|
190
|
-
if (
|
|
183
|
+
var Te = (e5, t2, n2, r2) => new we({ response: { data: { details: { ...!n2?.validationError && { applicationError: { description: t2, code: e5, data: r2 } }, ...n2 }, message: t2 }, status: e5 }, requestId: r2?.requestId });
|
|
184
|
+
var Ee = `.`;
|
|
185
|
+
function De(e5, t2, n2) {
|
|
186
|
+
if (e5 == null) throw Error(`Cannot set value on null or undefined`);
|
|
187
|
+
let r2 = Oe(t2), i2 = e5;
|
|
188
|
+
for (let e6 = 0; e6 < r2.length; e6++) {
|
|
189
|
+
let t3 = r2[e6];
|
|
190
|
+
if (e6 === r2.length - 1) {
|
|
191
191
|
i2[t3] = n2;
|
|
192
192
|
break;
|
|
193
193
|
}
|
|
194
|
-
let a2 = r2[
|
|
194
|
+
let a2 = r2[e6 + 1];
|
|
195
195
|
(!(t3 in i2) || i2[t3] == null || typeof i2[t3] != `object` || i2[t3] === null) && (i2[t3] = typeof a2 == `number` ? [] : {}), i2 = i2[t3];
|
|
196
196
|
}
|
|
197
|
-
return
|
|
197
|
+
return e5;
|
|
198
198
|
}
|
|
199
|
-
function
|
|
200
|
-
return Array.isArray(
|
|
199
|
+
function Oe(e5) {
|
|
200
|
+
return Array.isArray(e5) ? e5 : e5.split(Ee).map((e6) => ke(e6) ? Number(e6) : e6);
|
|
201
201
|
}
|
|
202
|
-
function
|
|
203
|
-
return /^\d+$/.test(
|
|
202
|
+
function ke(e5) {
|
|
203
|
+
return /^\d+$/.test(e5);
|
|
204
204
|
}
|
|
205
|
-
function
|
|
205
|
+
function Ae(e5) {
|
|
206
206
|
let t2 = {};
|
|
207
|
-
for (let [n2, r2] of Object.entries(
|
|
207
|
+
for (let [n2, r2] of Object.entries(e5)) je(n2) || De(t2, Oe(n2), r2);
|
|
208
208
|
return t2;
|
|
209
209
|
}
|
|
210
|
-
function
|
|
211
|
-
return
|
|
210
|
+
function je(e5) {
|
|
211
|
+
return e5 === `__proto__` || e5 === `constructor` || e5 === `prototype`;
|
|
212
212
|
}
|
|
213
|
-
var
|
|
213
|
+
var Me = class {
|
|
214
214
|
BRACKET_PATTERN = /\[(\d+)\]/g;
|
|
215
215
|
NUMERIC_PATTERN = /^\d+$/;
|
|
216
216
|
ESCAPED_DOT_PATTERN = /\\\./g;
|
|
@@ -223,702 +223,1823 @@ var Pe = class {
|
|
|
223
223
|
ESCAPED_LEFT_BRACKET_PLACEHOLDER = `__LB__`;
|
|
224
224
|
modifiedFields;
|
|
225
225
|
cleanedModifiedFields;
|
|
226
|
-
constructor(
|
|
227
|
-
this.modifiedFields =
|
|
226
|
+
constructor(e5) {
|
|
227
|
+
this.modifiedFields = e5;
|
|
228
228
|
}
|
|
229
|
-
replaceEscapedCharacters(
|
|
230
|
-
return
|
|
229
|
+
replaceEscapedCharacters(e5) {
|
|
230
|
+
return e5.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);
|
|
231
231
|
}
|
|
232
|
-
restoreEscapedCharacters(
|
|
233
|
-
return
|
|
232
|
+
restoreEscapedCharacters(e5) {
|
|
233
|
+
return e5.replace(this.ESCAPED_DOT_PLACEHOLDER, `\\.`).replace(this.ESCAPED_RIGHT_BRACKET_PLACEHOLDER, `\\]`).replace(this.ESCAPED_LEFT_BRACKET_PLACEHOLDER, `\\[`);
|
|
234
234
|
}
|
|
235
235
|
unflatten() {
|
|
236
|
-
return this.cleanedModifiedFields = Object.fromEntries(Object.entries(this.modifiedFields).map(([
|
|
236
|
+
return this.cleanedModifiedFields = Object.fromEntries(Object.entries(this.modifiedFields).map(([e5, t2]) => [this.replaceEscapedCharacters(this.bracketToDotNotation(e5)), t2])), Ae(this.cleanedModifiedFields);
|
|
237
237
|
}
|
|
238
|
-
flatten(
|
|
238
|
+
flatten(e5) {
|
|
239
239
|
let t2 = {};
|
|
240
240
|
for (let n2 of Object.keys(this.cleanedModifiedFields)) {
|
|
241
|
-
let r2 = this.splitPath(n2), i2 = this.navigatePath(
|
|
241
|
+
let r2 = this.splitPath(n2), i2 = this.navigatePath(e5, r2);
|
|
242
242
|
t2 = { ...t2, ...i2 };
|
|
243
243
|
}
|
|
244
|
-
return Object.fromEntries(Object.entries(t2).map(([
|
|
244
|
+
return Object.fromEntries(Object.entries(t2).map(([e6, t3]) => [this.restoreEscapedCharacters(e6), t3]));
|
|
245
245
|
}
|
|
246
|
-
splitPath(
|
|
247
|
-
let t2 = [], n2 = 0, r2 = Array.from(
|
|
248
|
-
for (let i2 of r2) i2.index > n2 && t2.push(
|
|
249
|
-
return n2 <
|
|
246
|
+
splitPath(e5) {
|
|
247
|
+
let t2 = [], n2 = 0, r2 = Array.from(e5.matchAll(this.SPLIT_PATTERN));
|
|
248
|
+
for (let i2 of r2) i2.index > n2 && t2.push(e5.substring(n2, i2.index)), i2[1] && t2.push(i2[1]), n2 = i2.index + i2[0].length;
|
|
249
|
+
return n2 < e5.length && t2.push(e5.substring(n2)), t2;
|
|
250
250
|
}
|
|
251
|
-
navigatePath(
|
|
252
|
-
let n2 =
|
|
251
|
+
navigatePath(e5, t2) {
|
|
252
|
+
let n2 = e5, r2 = [], i2 = (e6) => {
|
|
253
253
|
if (!Array.isArray(n2)) throw Error(`Expected array at path ${this.buildPathString(r2)}, but got ${typeof n2}`);
|
|
254
|
-
r2.push(`[${
|
|
255
|
-
}, a2 = (
|
|
256
|
-
let i3 =
|
|
254
|
+
r2.push(`[${e6}]`), n2 = n2[parseInt(e6, 10)];
|
|
255
|
+
}, a2 = (e6, t3) => {
|
|
256
|
+
let i3 = e6 in oe ? oe[e6] : void 0;
|
|
257
257
|
if (i3 && i3 in t3) {
|
|
258
258
|
r2.push(i3), n2 = t3[i3];
|
|
259
259
|
return;
|
|
260
260
|
}
|
|
261
|
-
let a3 =
|
|
261
|
+
let a3 = Ie(e6);
|
|
262
262
|
if (a3 && a3 in t3) {
|
|
263
263
|
r2.push(a3), n2 = t3[a3];
|
|
264
264
|
return;
|
|
265
265
|
}
|
|
266
|
-
throw Error(`Cannot find key '${
|
|
267
|
-
}, o2 = (
|
|
268
|
-
r2.push(
|
|
266
|
+
throw Error(`Cannot find key '${e6}' or its transformations at path ${this.buildPathString(r2)}`);
|
|
267
|
+
}, o2 = (e6, t3) => {
|
|
268
|
+
r2.push(e6), n2 = t3[e6];
|
|
269
269
|
};
|
|
270
|
-
for (let
|
|
271
|
-
if (this.NUMERIC_PATTERN.test(
|
|
272
|
-
i2(
|
|
270
|
+
for (let e6 of t2) {
|
|
271
|
+
if (this.NUMERIC_PATTERN.test(e6)) {
|
|
272
|
+
i2(e6);
|
|
273
273
|
continue;
|
|
274
274
|
}
|
|
275
|
-
if (typeof n2 != `object` || !n2) throw Error(`Cannot access property '${
|
|
275
|
+
if (typeof n2 != `object` || !n2) throw Error(`Cannot access property '${e6}' on ${typeof n2} at path ${this.buildPathString(r2)}`);
|
|
276
276
|
let t3 = n2;
|
|
277
|
-
if (
|
|
278
|
-
o2(
|
|
277
|
+
if (e6 in n2) {
|
|
278
|
+
o2(e6, t3);
|
|
279
279
|
continue;
|
|
280
280
|
}
|
|
281
|
-
a2(
|
|
281
|
+
a2(e6, t3);
|
|
282
282
|
}
|
|
283
283
|
return { [this.buildPathString(r2)]: n2 };
|
|
284
284
|
}
|
|
285
|
-
buildPathString(
|
|
286
|
-
return
|
|
285
|
+
buildPathString(e5) {
|
|
286
|
+
return e5.join(`.`).replace(this.DOT_BEFORE_BRACKET_PATTERN, `[`);
|
|
287
287
|
}
|
|
288
|
-
bracketToDotNotation(
|
|
289
|
-
return
|
|
288
|
+
bracketToDotNotation(e5) {
|
|
289
|
+
return e5.replace(this.BRACKET_PATTERN, (t2, n2, r2) => r2 > 0 && e5[r2 - 1] === `\\` ? t2 : `.` + n2);
|
|
290
290
|
}
|
|
291
291
|
};
|
|
292
|
-
function
|
|
293
|
-
let n2 =
|
|
292
|
+
function Ne(e5, t2) {
|
|
293
|
+
let n2 = e5?.modifiedFields;
|
|
294
294
|
if (!n2) return null;
|
|
295
|
-
let r2 =
|
|
295
|
+
let r2 = Pe(n2);
|
|
296
296
|
if (!r2) return null;
|
|
297
297
|
let { unflattenedModifiedFields: i2, modifiedFieldsManipulator: a2 } = r2;
|
|
298
|
-
|
|
299
|
-
let o2 = t2(
|
|
298
|
+
e5 = { ...e5, modifiedFields: i2 };
|
|
299
|
+
let o2 = t2(e5), s2 = o2?.modifiedFields;
|
|
300
300
|
if (!s2) return null;
|
|
301
|
-
let c2 =
|
|
301
|
+
let c2 = Fe(s2, a2);
|
|
302
302
|
return c2 === null ? null : (o2.modifiedFields = c2, o2);
|
|
303
303
|
}
|
|
304
|
-
function
|
|
305
|
-
if (typeof
|
|
306
|
-
let t2 = new
|
|
304
|
+
function Pe(e5) {
|
|
305
|
+
if (typeof e5 == `object` && e5 && !Array.isArray(e5)) try {
|
|
306
|
+
let t2 = new Me(e5);
|
|
307
307
|
return { unflattenedModifiedFields: t2.unflatten(), modifiedFieldsManipulator: t2 };
|
|
308
308
|
} catch {
|
|
309
309
|
return null;
|
|
310
310
|
}
|
|
311
311
|
return null;
|
|
312
312
|
}
|
|
313
|
-
function
|
|
314
|
-
if (typeof
|
|
315
|
-
return t2.flatten(
|
|
313
|
+
function Fe(e5, t2) {
|
|
314
|
+
if (typeof e5 == `object` && e5 && !Array.isArray(e5)) try {
|
|
315
|
+
return t2.flatten(e5);
|
|
316
316
|
} catch {
|
|
317
317
|
return null;
|
|
318
318
|
}
|
|
319
319
|
return null;
|
|
320
320
|
}
|
|
321
|
-
function
|
|
322
|
-
return
|
|
321
|
+
function Ie(e5) {
|
|
322
|
+
return e5.replace(/[-_\s]+(.)?/g, (e6, t2) => t2 ? t2.toUpperCase() : ``).replace(/^./, (e6) => e6.toLowerCase());
|
|
323
323
|
}
|
|
324
|
-
function
|
|
325
|
-
return { emit(
|
|
326
|
-
for (let n2 = 0, r2 = this.events[
|
|
327
|
-
}, events: {}, on(
|
|
328
|
-
return (this.events[
|
|
329
|
-
this.events[
|
|
324
|
+
function Le() {
|
|
325
|
+
return { emit(e5, ...t2) {
|
|
326
|
+
for (let n2 = 0, r2 = this.events[e5] || [], i2 = r2.length; n2 < i2; n2++) r2[n2](...t2);
|
|
327
|
+
}, events: {}, on(e5, t2) {
|
|
328
|
+
return (this.events[e5] ||= []).push(t2), () => {
|
|
329
|
+
this.events[e5] = this.events[e5]?.filter((e6) => t2 !== e6);
|
|
330
330
|
};
|
|
331
331
|
} };
|
|
332
332
|
}
|
|
333
|
-
var
|
|
334
|
-
function
|
|
333
|
+
var Re = (e5) => e5.__type === `event-definition`;
|
|
334
|
+
function ze(e5, t2, n2, r2) {
|
|
335
335
|
let i2;
|
|
336
|
-
if (
|
|
337
|
-
let { deletedEvent:
|
|
338
|
-
i2 =
|
|
336
|
+
if (e5.isDomainEvent) {
|
|
337
|
+
let { deletedEvent: e6, actionEvent: t3, createdEvent: a3, updatedEvent: o3, ...s3 } = n2, c2 = { ...r2, ...s3 };
|
|
338
|
+
i2 = e6 ? e6?.deletedEntity ? { entity: e6?.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 };
|
|
339
339
|
} else i2 = { data: n2, metadata: r2 };
|
|
340
|
-
let a2 =
|
|
340
|
+
let a2 = e5.transformations ?? ((e6) => e6), o2 = i2, s2 = i2;
|
|
341
341
|
if (s2.modifiedFields) {
|
|
342
|
-
let
|
|
343
|
-
if (typeof
|
|
342
|
+
let e6 = s2.modifiedFields;
|
|
343
|
+
if (typeof e6 == `object` && e6 && !Array.isArray(e6)) {
|
|
344
344
|
o2 = structuredClone(i2);
|
|
345
|
-
let
|
|
346
|
-
if (
|
|
345
|
+
let e7 = Ne(s2, a2);
|
|
346
|
+
if (e7) return t2(e7);
|
|
347
347
|
}
|
|
348
348
|
}
|
|
349
349
|
return t2(a2(o2));
|
|
350
350
|
}
|
|
351
|
-
function Be(
|
|
352
|
-
let t2 = /* @__PURE__ */ new Map(), n2 =
|
|
353
|
-
return { initModule(
|
|
351
|
+
function Be(e5) {
|
|
352
|
+
let t2 = /* @__PURE__ */ new Map(), n2 = Le();
|
|
353
|
+
return { initModule(e6) {
|
|
354
354
|
return (r2) => {
|
|
355
|
-
let i2 = t2.get(
|
|
356
|
-
i2.push({ eventDefinition:
|
|
355
|
+
let i2 = t2.get(e6.type) ?? [];
|
|
356
|
+
i2.push({ eventDefinition: e6, handler: r2 }), t2.set(e6.type, i2), n2.emit(`registered`, e6);
|
|
357
357
|
};
|
|
358
|
-
}, client: { ...n2, getRegisteredEvents: () => t2, async process(
|
|
359
|
-
let { eventType: r2, identity: i2, instanceId: a2, payload: o2, accountInfo: s2 } = await this.parseJWT(
|
|
360
|
-
if (c2.length > 0 && !c2.some(({ type:
|
|
358
|
+
}, client: { ...n2, getRegisteredEvents: () => t2, async process(e6, n3 = { expectedEvents: [] }) {
|
|
359
|
+
let { eventType: r2, identity: i2, instanceId: a2, payload: o2, accountInfo: s2 } = await this.parseJWT(e6), c2 = [...n3.expectedEvents, ...Array.from(t2.keys()).map((e7) => ({ type: e7 }))];
|
|
360
|
+
if (c2.length > 0 && !c2.some(({ type: e7 }) => e7 === r2)) throw Error(`Unexpected event type: ${r2}. Expected one of: ${c2.map((e7) => e7.type).join(`, `)}`);
|
|
361
361
|
let l2 = t2.get(r2) ?? [];
|
|
362
|
-
return await Promise.all(l2.map(({ eventDefinition:
|
|
363
|
-
}, async processRequest(
|
|
364
|
-
let n3 = await
|
|
362
|
+
return await Promise.all(l2.map(({ eventDefinition: e7, handler: t3 }) => ze(e7, t3, o2, { instanceId: a2, identity: i2, accountInfo: s2 }))), { instanceId: a2, eventType: r2, payload: o2, identity: i2, accountInfo: s2 };
|
|
363
|
+
}, async processRequest(e6, t3) {
|
|
364
|
+
let n3 = await e6.text();
|
|
365
365
|
return this.process(n3, t3);
|
|
366
366
|
}, async parseJWT(t3) {
|
|
367
|
-
let n3 =
|
|
367
|
+
let n3 = e5();
|
|
368
368
|
if (!n3.decodeJWT) throw Error(`decodeJWT is not supported by the authentication strategy`);
|
|
369
369
|
let { decoded: r2, valid: i2 } = await n3.decodeJWT(t3);
|
|
370
370
|
if (!i2) throw Error(`JWT is not valid`);
|
|
371
371
|
if (typeof r2.data != `string`) throw Error(`Unexpected type of JWT data: expected string, got ${typeof r2.data}`);
|
|
372
372
|
let a2 = JSON.parse(r2.data), o2 = a2.eventType, s2 = a2.accountInfo, c2 = a2.instanceId, l2 = a2.identity ? JSON.parse(a2.identity) : void 0;
|
|
373
373
|
return { instanceId: c2, eventType: o2, payload: JSON.parse(a2.data), identity: l2, accountInfo: s2 };
|
|
374
|
-
}, async parseRequest(
|
|
375
|
-
let t3 = await
|
|
374
|
+
}, async parseRequest(e6) {
|
|
375
|
+
let t3 = await e6.text();
|
|
376
376
|
return this.parseJWT(t3);
|
|
377
|
-
}, async executeHandlers(
|
|
378
|
-
let n3 = Array.from(t2.keys()).map((
|
|
379
|
-
if (n3.length > 0 && !n3.some(({ type: t3 }) => t3 ===
|
|
380
|
-
let r2 = t2.get(
|
|
381
|
-
await Promise.all(r2.map(({ eventDefinition: t3, handler: n4 }) =>
|
|
377
|
+
}, async executeHandlers(e6) {
|
|
378
|
+
let n3 = Array.from(t2.keys()).map((e7) => ({ type: e7 }));
|
|
379
|
+
if (n3.length > 0 && !n3.some(({ type: t3 }) => t3 === e6.eventType)) throw Error(`Unexpected event type: ${e6.eventType}. Expected one of: ${n3.map((e7) => e7.type).join(`, `)}`);
|
|
380
|
+
let r2 = t2.get(e6.eventType) ?? [];
|
|
381
|
+
await Promise.all(r2.map(({ eventDefinition: t3, handler: n4 }) => ze(t3, n4, e6.payload, { instanceId: e6.instanceId, identity: e6.identity })));
|
|
382
382
|
}, apps: { AppInstalled: m(`AppInstalled`)(), AppRemoved: m(`AppRemoved`)() } } };
|
|
383
383
|
}
|
|
384
|
-
var Ve = (
|
|
385
|
-
function He(
|
|
386
|
-
let t2 = /* @__PURE__ */ new Map(), n2 =
|
|
387
|
-
return { initModule(
|
|
384
|
+
var Ve = (e5) => e5.__type === `service-plugin-definition`;
|
|
385
|
+
function He(e5) {
|
|
386
|
+
let t2 = /* @__PURE__ */ new Map(), n2 = Le();
|
|
387
|
+
return { initModule(e6) {
|
|
388
388
|
return (r2) => {
|
|
389
|
-
let i2 = t2.get(
|
|
390
|
-
i2.push({ servicePluginDefinition:
|
|
389
|
+
let i2 = t2.get(e6.componentType.toLowerCase()) ?? [];
|
|
390
|
+
i2.push({ servicePluginDefinition: e6, implementation: r2 }), t2.set(e6.componentType.toLowerCase(), i2), n2.emit(`registered`, e6);
|
|
391
391
|
};
|
|
392
392
|
}, client: { ...n2, getRegisteredServicePlugins: () => t2, async parseJWT(t3) {
|
|
393
|
-
let n3 =
|
|
393
|
+
let n3 = e5();
|
|
394
394
|
if (!n3.decodeJWT) throw Error(`decodeJWT is not supported by the authentication strategy`);
|
|
395
395
|
let { decoded: r2, valid: i2 } = await n3.decodeJWT(t3, true);
|
|
396
396
|
if (!i2) throw Error(`JWT is not valid`);
|
|
397
397
|
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`);
|
|
398
398
|
return r2.data;
|
|
399
|
-
}, async process(
|
|
400
|
-
let t3 = await this.parseJWT(
|
|
401
|
-
return this.executeHandler(t3,
|
|
402
|
-
}, async parseRequest(
|
|
403
|
-
let t3 = await
|
|
399
|
+
}, async process(e6) {
|
|
400
|
+
let t3 = await this.parseJWT(e6.body);
|
|
401
|
+
return this.executeHandler(t3, e6.url);
|
|
402
|
+
}, async parseRequest(e6) {
|
|
403
|
+
let t3 = await e6.text();
|
|
404
404
|
return this.parseJWT(t3);
|
|
405
|
-
}, async processRequest(
|
|
406
|
-
let t3 = await this.parseRequest(
|
|
407
|
-
return this.processParsedRequest(t3,
|
|
408
|
-
}, async processParsedRequest(
|
|
405
|
+
}, async processRequest(e6) {
|
|
406
|
+
let t3 = await this.parseRequest(e6);
|
|
407
|
+
return this.processParsedRequest(t3, e6.url);
|
|
408
|
+
}, async processParsedRequest(e6, t3) {
|
|
409
409
|
try {
|
|
410
|
-
let n3 = await this.executeHandler(
|
|
410
|
+
let n3 = await this.executeHandler(e6, t3);
|
|
411
411
|
return Response.json(n3);
|
|
412
|
-
} catch (
|
|
413
|
-
if (
|
|
414
|
-
throw
|
|
412
|
+
} catch (e7) {
|
|
413
|
+
if (e7.errorType === `SPI` && e7.applicationCode && e7.httpCode) return Response.json({ applicationError: { code: e7.applicationCode, data: e7.data } }, { status: e7.httpCode });
|
|
414
|
+
throw e7;
|
|
415
415
|
}
|
|
416
|
-
}, async executeHandler(
|
|
417
|
-
let r2 =
|
|
416
|
+
}, async executeHandler(e6, n3) {
|
|
417
|
+
let r2 = e6.metadata.appExtensionType.toLowerCase(), i2 = t2.get(r2) ?? [];
|
|
418
418
|
if (i2.length === 0) throw Error(`No service plugin implementations found for component type ${r2}`);
|
|
419
419
|
if (i2.length > 1) throw Error(`Multiple service plugin implementations found for component type ${r2}. This is currently not supported`);
|
|
420
|
-
let { implementation: a2, servicePluginDefinition: o2 } = i2[0], s2 = o2.methods.find((
|
|
420
|
+
let { implementation: a2, servicePluginDefinition: o2 } = i2[0], s2 = o2.methods.find((e7) => n3.endsWith(e7.primaryHttpMappingPath));
|
|
421
421
|
if (!s2) throw Error(`Unexpect request: request url did not match any method: ` + n3);
|
|
422
422
|
let c2 = a2[s2.name];
|
|
423
423
|
if (!c2) throw Error(`Got request for service plugin method ${s2.name} but no implementation was provided. Available methods: ${Object.keys(a2).join(`, `)}`);
|
|
424
|
-
return s2.transformations.toREST(await c2(s2.transformations.fromREST(
|
|
424
|
+
return s2.transformations.toREST(await c2(s2.transformations.fromREST(e6)));
|
|
425
425
|
} } };
|
|
426
426
|
}
|
|
427
427
|
var T = `X-Wix-Consistent`;
|
|
428
|
-
function Ue(
|
|
429
|
-
let t2 =
|
|
430
|
-
let i3 = o2(), s3 = await a2(), c3 = { ...r3?.headers ?? {}, ...s3.headers, ...
|
|
428
|
+
function Ue(e5) {
|
|
429
|
+
let t2 = e5.headers || { Authorization: `` }, n2 = { getAuthHeaders: (e6) => Promise.resolve({ headers: {} }) }, r2 = e5.auth, i2 = typeof r2 == `function` ? r2 : () => r2 ?? n2, a2 = () => i2().getAuthHeaders(e5.host), o2 = () => e5.fetch ?? fetch, s2 = async (n3, r3) => {
|
|
430
|
+
let i3 = o2(), s3 = await a2(), c3 = { ...r3?.headers ?? {}, ...s3.headers, ...e5.host?.essentials?.passThroughHeaders, ...t2[`X-Wix-Consistent`] ? { [T]: t2[T] } : {} }, l3 = e5.host?.getErrorHandler?.();
|
|
431
431
|
try {
|
|
432
432
|
if (typeof n3 == `string` || n3 instanceof URL) {
|
|
433
|
-
let
|
|
434
|
-
l3?.handleError(
|
|
435
|
-
let a3 = E(
|
|
436
|
-
return a3 && (t2[T] = a3),
|
|
433
|
+
let e6 = await i3(n3, { ...r3, headers: c3 });
|
|
434
|
+
l3?.handleError(e6, { requestOptions: { url: n3.toString(), method: r3?.method } });
|
|
435
|
+
let a3 = E(e6);
|
|
436
|
+
return a3 && (t2[T] = a3), e6;
|
|
437
437
|
}
|
|
438
438
|
{
|
|
439
|
-
for (let [
|
|
440
|
-
let
|
|
441
|
-
l3?.handleError(
|
|
442
|
-
let a3 = E(
|
|
443
|
-
return a3 && (t2[T] = a3),
|
|
439
|
+
for (let [e7, t3] of Object.entries(c3)) typeof t3 == `string` && n3.headers.set(e7, t3);
|
|
440
|
+
let e6 = await i3(n3, r3);
|
|
441
|
+
l3?.handleError(e6, { requestOptions: { url: n3.url, method: r3?.method } });
|
|
442
|
+
let a3 = E(e6);
|
|
443
|
+
return a3 && (t2[T] = a3), e6;
|
|
444
444
|
}
|
|
445
|
-
} catch (
|
|
446
|
-
throw l3?.handleError(
|
|
445
|
+
} catch (e6) {
|
|
446
|
+
throw l3?.handleError(e6, { requestOptions: { url: typeof n3 == `string` || n3 instanceof URL ? n3.toString() : n3.url, method: r3?.method } }), e6;
|
|
447
447
|
}
|
|
448
448
|
}, { client: c2, initModule: l2 } = He(i2), { client: u2, initModule: d2 } = Be(i2), f2 = async (n3, r3) => {
|
|
449
|
-
let i3 = o2(), s3 = await a2(), c3 =
|
|
449
|
+
let i3 = o2(), s3 = await a2(), c3 = ee(r3), l3 = await i3(n3, { ...r3, headers: { ...c3, ...t2, ...s3?.headers, ...r3?.headers, ...e5.host?.essentials?.passThroughHeaders, ...t2[`X-Wix-Consistent`] ? { [T]: t2[T] } : {} } }), u3 = E(l3);
|
|
450
450
|
return u3 && (t2[T] = u3), l3;
|
|
451
451
|
}, m2 = (t3, n3) => {
|
|
452
|
-
if (
|
|
452
|
+
if (Re(t3)) return d2(t3);
|
|
453
453
|
if (Ve(t3)) return l2(t3);
|
|
454
|
-
if (
|
|
454
|
+
if (ne(t3) && e5.host) return S(t3, e5.host);
|
|
455
455
|
if (typeof t3 == `function`) {
|
|
456
456
|
if (`__type` in t3 && t3.__type === `wix_spi_error`) return t3;
|
|
457
|
-
let r3 =
|
|
458
|
-
return
|
|
459
|
-
let n4 = new URL(
|
|
457
|
+
let r3 = e5.host?.apiBaseUrl ?? `www.wixapis.com`, o3 = e5.useCDN === void 0 ? i2().shouldUseCDN : e5.useCDN;
|
|
458
|
+
return Ce(ae(() => _(t3)) ? g(t3) : t3, n3 ?? {}, f2, e5.host?.getErrorHandler?.(), (e6, t4) => {
|
|
459
|
+
let n4 = new URL(e6, `https://${r3}`);
|
|
460
460
|
return n4.host = r3, n4.protocol = `https`, f2(n4.toString(), t4);
|
|
461
|
-
}, i2().getActiveToken, async () => a2(), { HTTPHost: r3 },
|
|
461
|
+
}, i2().getActiveToken, async () => a2(), { HTTPHost: r3 }, e5.host?.name, o3, e5.validateRequestSchema);
|
|
462
462
|
}
|
|
463
|
-
return
|
|
464
|
-
}, h2 = (
|
|
465
|
-
for (let n3 in
|
|
463
|
+
return te(t3) ? Object.fromEntries(Object.entries(t3).map(([e6, n4]) => [e6, m2(n4, t3[v])])) : t3;
|
|
464
|
+
}, h2 = (e6) => {
|
|
465
|
+
for (let n3 in e6) t2[n3] = e6[n3];
|
|
466
466
|
};
|
|
467
|
-
return { ...
|
|
467
|
+
return { ...e5.modules ? m2(e5.modules) : {}, get auth() {
|
|
468
468
|
let t3 = i2();
|
|
469
|
-
return t3.getAuthHeaders = t3.getAuthHeaders.bind(void 0,
|
|
470
|
-
}, setHeaders: h2, use: m2, enableContext(
|
|
471
|
-
|
|
469
|
+
return t3.getAuthHeaders = t3.getAuthHeaders.bind(void 0, e5.host), t3;
|
|
470
|
+
}, setHeaders: h2, use: m2, enableContext(e6, t3 = { elevated: false }) {
|
|
471
|
+
e6 === `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 ? p.elevatedClient = this : p.client = this;
|
|
472
472
|
}, fetch: (t3, n3) => {
|
|
473
|
-
let r3 =
|
|
473
|
+
let r3 = e5.host?.apiBaseUrl ?? `www.wixapis.com`, i3 = new URL(t3, `https://${r3}`);
|
|
474
474
|
return i3.host = r3, i3.protocol = `https`, f2(i3.toString(), n3);
|
|
475
475
|
}, fetchWithAuth: s2, async graphql(t3, n3, r3 = { apiVersion: `alpha` }) {
|
|
476
|
-
let i3 =
|
|
477
|
-
if (a3.status !== 200) throw new
|
|
476
|
+
let i3 = e5?.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 }) });
|
|
477
|
+
if (a3.status !== 200) throw new b(`GraphQL request failed with status ${a3.status}`, a3);
|
|
478
478
|
let { data: o3, errors: s3 } = await a3.json();
|
|
479
479
|
return { data: o3 ?? {}, errors: s3 };
|
|
480
480
|
}, webhooks: u2, servicePlugins: c2 };
|
|
481
481
|
}
|
|
482
|
-
function E(
|
|
483
|
-
return
|
|
482
|
+
function E(e5) {
|
|
483
|
+
return e5.headers?.get(`X-Wix-Consistent`) ?? e5.headers?.get(`x-wix-consistent`);
|
|
484
484
|
}
|
|
485
485
|
var We = { _id: `id`, _createdDate: `createdDate`, _updatedDate: `updatedDate` };
|
|
486
486
|
var Ge = { id: `_id`, createdDate: `_createdDate`, updatedDate: `_updatedDate` };
|
|
487
|
-
function Ke(
|
|
488
|
-
return
|
|
487
|
+
function Ke(e5, t2) {
|
|
488
|
+
return e5?.split(`.`).map((e6) => t2?.[e6] ?? e6).join(`.`);
|
|
489
489
|
}
|
|
490
490
|
var qe = `sort.fieldName`;
|
|
491
|
-
function Je(
|
|
492
|
-
return (
|
|
491
|
+
function Je(e5, t2, n2) {
|
|
492
|
+
return (e5 === qe || e5.endsWith(`.${qe}`)) && typeof t2 == `string` ? Ke(t2, n2) : t2;
|
|
493
493
|
}
|
|
494
|
-
function Ye(
|
|
495
|
-
let r2 = (
|
|
496
|
-
if (Array.isArray(
|
|
497
|
-
i2(
|
|
494
|
+
function Ye(e5, t2, n2) {
|
|
495
|
+
let r2 = (e6) => n2.includes(e6), i2 = (e6, n3) => {
|
|
496
|
+
if (Array.isArray(e6)) e6.forEach((e7) => {
|
|
497
|
+
i2(e7, n3);
|
|
498
498
|
});
|
|
499
|
-
else if (typeof
|
|
500
|
-
let a2 =
|
|
501
|
-
Object.keys(a2).forEach((
|
|
502
|
-
let o2 = n3 === `` ?
|
|
499
|
+
else if (typeof e6 == `object` && e6) {
|
|
500
|
+
let a2 = e6;
|
|
501
|
+
Object.keys(a2).forEach((e7) => {
|
|
502
|
+
let o2 = n3 === `` ? e7 : `${n3}.${e7}`;
|
|
503
503
|
if (r2(o2)) return;
|
|
504
|
-
let s2 = Xe(
|
|
505
|
-
s2 !==
|
|
504
|
+
let s2 = Xe(e7, t2);
|
|
505
|
+
s2 !== e7 && !(s2 in a2) && (a2[s2] = a2[e7], delete a2[e7]), a2[s2] = Je(o2, a2[s2], t2), i2(a2[s2], o2);
|
|
506
506
|
});
|
|
507
507
|
}
|
|
508
508
|
};
|
|
509
|
-
return i2(
|
|
509
|
+
return i2(e5, ``), e5;
|
|
510
510
|
}
|
|
511
|
-
function Xe(
|
|
511
|
+
function Xe(e5, t2) {
|
|
512
512
|
let n2;
|
|
513
|
-
return n2 =
|
|
513
|
+
return n2 = e5.includes(`.`) ? e5.split(`.`).map((e6) => t2[e6] ?? e6).join(`.`) : t2[e5] ?? e5, n2;
|
|
514
514
|
}
|
|
515
|
-
function Ze(
|
|
516
|
-
return Ye(
|
|
515
|
+
function Ze(e5, t2 = []) {
|
|
516
|
+
return Ye(e5, We, t2);
|
|
517
517
|
}
|
|
518
|
-
function Qe(
|
|
519
|
-
return Ye(
|
|
518
|
+
function Qe(e5, t2 = []) {
|
|
519
|
+
return Ye(e5, Ge, t2);
|
|
520
520
|
}
|
|
521
|
-
function $e(
|
|
522
|
-
return
|
|
521
|
+
function $e(e5) {
|
|
522
|
+
return e5 ? new Date(e5) : void 0;
|
|
523
523
|
}
|
|
524
524
|
var et = /* @__PURE__ */ new WeakMap();
|
|
525
|
-
function
|
|
525
|
+
function tt() {
|
|
526
526
|
return { leaves: void 0, fields: void 0, mapFields: void 0, anyField: void 0 };
|
|
527
527
|
}
|
|
528
|
-
function
|
|
529
|
-
let n2 =
|
|
530
|
-
return n2 || (n2 =
|
|
528
|
+
function nt(e5, t2) {
|
|
529
|
+
let n2 = e5.get(t2);
|
|
530
|
+
return n2 || (n2 = tt(), e5.set(t2, n2)), n2;
|
|
531
531
|
}
|
|
532
|
-
function
|
|
533
|
-
return t2 === `*` ? (
|
|
532
|
+
function rt(e5, t2) {
|
|
533
|
+
return t2 === `*` ? (e5.anyField ??= tt(), e5.anyField) : t2.endsWith(`{}`) ? (e5.mapFields ??= /* @__PURE__ */ new Map(), nt(e5.mapFields, t2.slice(0, -2))) : (e5.fields ??= /* @__PURE__ */ new Map(), nt(e5.fields, t2));
|
|
534
534
|
}
|
|
535
|
-
function
|
|
536
|
-
let t2 =
|
|
537
|
-
for (let n2 of
|
|
538
|
-
let
|
|
539
|
-
|
|
535
|
+
function it(e5) {
|
|
536
|
+
let t2 = tt();
|
|
537
|
+
for (let n2 of e5) {
|
|
538
|
+
let e6 = n2.path.split(`.`).reduce(rt, t2);
|
|
539
|
+
e6.leaves ??= [], e6.leaves.push(n2);
|
|
540
540
|
}
|
|
541
541
|
return t2;
|
|
542
542
|
}
|
|
543
|
-
function
|
|
544
|
-
let t2 = et.get(
|
|
545
|
-
return t2 || (t2 =
|
|
543
|
+
function at(e5) {
|
|
544
|
+
let t2 = et.get(e5);
|
|
545
|
+
return t2 || (t2 = it(e5), et.set(e5, t2)), t2;
|
|
546
546
|
}
|
|
547
|
-
function
|
|
548
|
-
return typeof
|
|
547
|
+
function D(e5) {
|
|
548
|
+
return typeof e5 == `object` && !!e5;
|
|
549
549
|
}
|
|
550
|
-
function
|
|
551
|
-
return t2 ? Array.isArray(
|
|
550
|
+
function ot(e5, { isRepeated: t2, isMap: n2 }, r2) {
|
|
551
|
+
return t2 ? Array.isArray(e5) ? e5.map(r2) : e5 : n2 ? D(e5) ? Object.fromEntries(Object.entries(e5).map(([e6, t3]) => [e6, r2(t3)])) : e5 : r2(e5);
|
|
552
552
|
}
|
|
553
|
-
function
|
|
554
|
-
|
|
553
|
+
function O(e5, t2, n2) {
|
|
554
|
+
D(e5) && lt(e5, t2, n2);
|
|
555
555
|
}
|
|
556
|
-
function
|
|
556
|
+
function st(e5, t2, n2) {
|
|
557
557
|
for (let [r2, i2] of t2) {
|
|
558
|
-
if (!(r2 in
|
|
559
|
-
if (i2.leaves) for (let t4 of i2.leaves)
|
|
560
|
-
let t3 =
|
|
561
|
-
Array.isArray(t3) ? t3.forEach((
|
|
558
|
+
if (!(r2 in e5)) continue;
|
|
559
|
+
if (i2.leaves) for (let t4 of i2.leaves) e5[r2] = ot(e5[r2], t4, n2);
|
|
560
|
+
let t3 = e5[r2];
|
|
561
|
+
Array.isArray(t3) ? t3.forEach((e6) => O(e6, i2, n2)) : O(t3, i2, n2);
|
|
562
562
|
}
|
|
563
563
|
}
|
|
564
|
-
function
|
|
564
|
+
function ct(e5, t2, n2) {
|
|
565
565
|
for (let [r2, i2] of t2) {
|
|
566
|
-
let t3 =
|
|
567
|
-
|
|
566
|
+
let t3 = e5[r2];
|
|
567
|
+
D(t3) && Object.values(t3).forEach((e6) => O(e6, i2, n2));
|
|
568
568
|
}
|
|
569
569
|
}
|
|
570
|
-
function
|
|
571
|
-
t2 &&
|
|
570
|
+
function lt(e5, { fields: t2, mapFields: n2, anyField: r2 }, i2) {
|
|
571
|
+
t2 && st(e5, t2, i2), n2 && ct(e5, n2, i2), r2 && Object.values(e5).forEach((e6) => O(e6, r2, i2));
|
|
572
572
|
}
|
|
573
|
-
function
|
|
574
|
-
if (!
|
|
575
|
-
for (let { paths: n2, transformFn: r2 } of t2)
|
|
576
|
-
return
|
|
573
|
+
function ut(e5, t2) {
|
|
574
|
+
if (!D(e5)) return e5;
|
|
575
|
+
for (let { paths: n2, transformFn: r2 } of t2) lt(e5, at(n2), r2);
|
|
576
|
+
return e5;
|
|
577
577
|
}
|
|
578
|
-
function
|
|
579
|
-
return
|
|
578
|
+
function dt(e5) {
|
|
579
|
+
return gt(e5).map((e6) => e6.toLocaleUpperCase()).join(`_`);
|
|
580
580
|
}
|
|
581
|
-
var
|
|
582
|
-
var
|
|
583
|
-
var
|
|
584
|
-
var
|
|
585
|
-
function
|
|
586
|
-
let t2 =
|
|
587
|
-
t2 = t2.replace(
|
|
581
|
+
var ft = /([\p{Ll}\d])(\p{Lu})/gu;
|
|
582
|
+
var pt = /(\p{Lu})([\p{Lu}][\p{Ll}])/gu;
|
|
583
|
+
var mt = `$1\0$2`;
|
|
584
|
+
var ht = /[^\p{L}\d]+/giu;
|
|
585
|
+
function gt(e5) {
|
|
586
|
+
let t2 = e5.trim();
|
|
587
|
+
t2 = t2.replace(ft, mt).replace(pt, mt), t2 = t2.replace(ht, `\0`);
|
|
588
588
|
let n2 = 0, r2 = t2.length;
|
|
589
589
|
for (; t2.charAt(n2) === `\0`; ) n2++;
|
|
590
590
|
if (n2 === r2) return [];
|
|
591
591
|
for (; t2.charAt(r2 - 1) === `\0`; ) r2--;
|
|
592
592
|
return t2.slice(n2, r2).split(/\0/g);
|
|
593
593
|
}
|
|
594
|
-
var
|
|
595
|
-
var
|
|
596
|
-
var
|
|
597
|
-
function
|
|
598
|
-
if (typeof
|
|
599
|
-
if (
|
|
600
|
-
if (
|
|
601
|
-
if (
|
|
602
|
-
let t3 =
|
|
603
|
-
return
|
|
604
|
-
}
|
|
605
|
-
return
|
|
606
|
-
}
|
|
607
|
-
var
|
|
608
|
-
let r2 =
|
|
609
|
-
return
|
|
594
|
+
var _t = (e5) => `validationError` in (e5.response?.data?.details ?? {});
|
|
595
|
+
var vt = (e5) => `applicationError` in (e5.response?.data?.details ?? {});
|
|
596
|
+
var yt = (e5) => (e5.response?.status ?? -1) >= 400 && (e5.response?.status ?? -1) < 500;
|
|
597
|
+
function bt(e5, t2 = { explicitPathsToArguments: {}, spreadPathsToArguments: {}, singleArgumentUnchanged: false }, n2 = []) {
|
|
598
|
+
if (typeof e5 != `object` || !e5) throw e5;
|
|
599
|
+
if (_t(e5)) return xt(e5, t2, n2);
|
|
600
|
+
if (vt(e5)) return St(e5);
|
|
601
|
+
if (yt(e5)) {
|
|
602
|
+
let t3 = e5.response?.status, n3 = e5.response?.statusText ?? `UNKNOWN`, r2 = e5.response?.data?.message ?? n3, i2 = { applicationError: { description: n3, code: dt(n3), data: {} }, requestId: e5.requestId };
|
|
603
|
+
return k(e5, { message: JSON.stringify({ message: r2, details: i2 }, null, 2), extraProperties: { details: i2, status: t3 } });
|
|
604
|
+
}
|
|
605
|
+
return Ct(e5);
|
|
606
|
+
}
|
|
607
|
+
var xt = (e5, t2, n2) => {
|
|
608
|
+
let r2 = e5.response?.data, i2 = e5.requestId, { fieldViolations: a2 } = r2.details.validationError, o2 = wt(t2, a2, n2)?.sort((e6, t3) => e6.field < t3.field ? -1 : 1), s2 = `INVALID_ARGUMENT: ${o2?.map(({ field: e6, description: t3 }) => `"${e6}" ${t3}`)?.join(`, `)}`, c2 = { validationError: { fieldViolations: o2 }, requestId: i2 };
|
|
609
|
+
return k(e5, { message: JSON.stringify({ message: s2, details: c2 }, null, 2), extraProperties: { details: c2, status: e5.response?.status, requestId: i2 } });
|
|
610
610
|
};
|
|
611
|
-
var
|
|
612
|
-
var
|
|
613
|
-
let t2 =
|
|
614
|
-
return
|
|
611
|
+
var k = (e5, { message: t2, extraProperties: n2 }) => Object.assign(e5, { ...n2, message: t2 });
|
|
612
|
+
var St = (e5) => {
|
|
613
|
+
let t2 = e5.response?.status, n2 = e5.response?.statusText ?? `UNKNOWN`, r2 = e5.response?.data?.message ?? n2, i2 = e5.response?.data?.details?.applicationError?.description ?? n2, a2 = e5.response?.data?.details?.applicationError?.code ?? dt(n2), o2 = e5.response?.data?.details?.applicationError?.data ?? {}, s2 = r2 === i2 ? r2 : `${r2}: ${i2}`, c2 = { applicationError: { description: i2, code: a2, data: o2 }, requestId: e5.requestId };
|
|
614
|
+
return k(e5, { message: JSON.stringify({ message: s2, details: c2 }, null, 2), extraProperties: { details: c2, status: t2, requestId: e5.requestId } });
|
|
615
615
|
};
|
|
616
|
-
var
|
|
617
|
-
var
|
|
618
|
-
let a2 = { ...
|
|
619
|
-
return r2?.filter((
|
|
620
|
-
let r3 = t2[
|
|
621
|
-
if (r3) return { ...
|
|
622
|
-
let s2 = o2?.sort((
|
|
616
|
+
var Ct = (e5) => k(e5, { message: e5.requestId ? `System error occurred, request-id: ${e5.requestId}` : `System error occurred: ${JSON.stringify(e5)}`, extraProperties: { requestId: e5.requestId, status: e5.response?.status, code: dt(e5.response?.statusText ?? `UNKNOWN`), ...!e5.response && { runtimeError: e5 } } });
|
|
617
|
+
var wt = ({ spreadPathsToArguments: e5, explicitPathsToArguments: t2, singleArgumentUnchanged: n2 }, r2, i2) => {
|
|
618
|
+
let a2 = { ...e5, ...t2 }, o2 = Object.keys(a2);
|
|
619
|
+
return r2?.filter((e6) => !r2.some((t3) => t3.field.length > e6.field.length && t3.field.startsWith(e6.field) && o2.includes(t3.field))).map((e6) => {
|
|
620
|
+
let r3 = t2[e6.field];
|
|
621
|
+
if (r3) return { ...e6, field: Tt(r3, i2) };
|
|
622
|
+
let s2 = o2?.sort((e7, t3) => t3.length - e7.length)?.find((t3) => e6.field.startsWith(t3));
|
|
623
623
|
if (s2) {
|
|
624
624
|
let t3 = a2[s2];
|
|
625
|
-
if (t3) return { ...
|
|
625
|
+
if (t3) return { ...e6, field: e6.field.replace(s2, Tt(t3, i2)) };
|
|
626
626
|
}
|
|
627
|
-
return n2 ? { ...
|
|
627
|
+
return n2 ? { ...e6, field: `${i2[0]}.${e6.field}` } : e6;
|
|
628
628
|
});
|
|
629
629
|
};
|
|
630
|
-
var
|
|
631
|
-
let n2 =
|
|
632
|
-
return n2 == null ?
|
|
630
|
+
var Tt = (e5, t2) => {
|
|
631
|
+
let n2 = Et(e5);
|
|
632
|
+
return n2 == null ? e5 : e5.replace(`$[${n2}]`, t2[n2]);
|
|
633
633
|
};
|
|
634
|
-
var
|
|
635
|
-
let t2 =
|
|
634
|
+
var Et = (e5) => {
|
|
635
|
+
let t2 = e5.match(/\$\[(?<argIndex>\d+)\]/);
|
|
636
636
|
return t2 && t2.groups && Number(t2.groups.argIndex);
|
|
637
637
|
};
|
|
638
|
-
function
|
|
639
|
-
let
|
|
640
|
-
if (
|
|
641
|
-
return
|
|
638
|
+
function Dt() {
|
|
639
|
+
let e5 = typeof $wixContext < `u` && $wixContext.initWixModules ? $wixContext.initWixModules : globalThis.__wix_context__ !== void 0 && globalThis.__wix_context__.initWixModules ? globalThis.__wix_context__.initWixModules : void 0;
|
|
640
|
+
if (e5) return { initWixModules(t3, n3) {
|
|
641
|
+
return Ot(() => e5(t3, n3));
|
|
642
642
|
}, fetchWithAuth() {
|
|
643
643
|
throw Error(`fetchWithAuth is not available in this context`);
|
|
644
644
|
}, graphql() {
|
|
645
645
|
throw Error(`graphql is not available in this context`);
|
|
646
646
|
} };
|
|
647
647
|
let t2 = typeof $wixContext < `u` ? $wixContext.client : p.client === void 0 ? globalThis.__wix_context__ === void 0 ? void 0 : globalThis.__wix_context__.client : p.client, n2 = typeof $wixContext < `u` ? $wixContext.elevatedClient : p.elevatedClient === void 0 ? globalThis.__wix_context__ === void 0 ? void 0 : globalThis.__wix_context__.elevatedClient : p.elevatedClient;
|
|
648
|
-
if (t2 || n2) return { initWixModules(
|
|
648
|
+
if (t2 || n2) return { initWixModules(e6, r2) {
|
|
649
649
|
if (r2) {
|
|
650
650
|
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`);
|
|
651
|
-
return
|
|
651
|
+
return Ot(() => n2.use(e6));
|
|
652
652
|
}
|
|
653
653
|
if (!t2) throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);
|
|
654
|
-
return
|
|
655
|
-
}, fetchWithAuth: (
|
|
654
|
+
return Ot(() => t2.use(e6));
|
|
655
|
+
}, fetchWithAuth: (e6, n3) => {
|
|
656
656
|
if (!t2) throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);
|
|
657
|
-
return t2.fetchWithAuth(
|
|
657
|
+
return t2.fetchWithAuth(e6, n3);
|
|
658
658
|
}, getAuth() {
|
|
659
659
|
if (!t2) throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);
|
|
660
660
|
return t2.auth;
|
|
661
|
-
}, async graphql(
|
|
661
|
+
}, async graphql(e6, n3, r2) {
|
|
662
662
|
if (!t2) throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);
|
|
663
|
-
return t2.graphql(
|
|
663
|
+
return t2.graphql(e6, n3, r2);
|
|
664
664
|
} };
|
|
665
665
|
}
|
|
666
|
-
function
|
|
666
|
+
function Ot(e5) {
|
|
667
667
|
let t2 = globalThis.__wix_context__, n2 = { client: p.client, elevatedClient: p.elevatedClient }, r2;
|
|
668
668
|
globalThis.__wix_context__ = void 0, p.client = void 0, p.elevatedClient = void 0, typeof $wixContext < `u` && (r2 = { client: $wixContext?.client, elevatedClient: $wixContext?.elevatedClient }, delete $wixContext.client, delete $wixContext.elevatedClient);
|
|
669
669
|
try {
|
|
670
|
-
return
|
|
670
|
+
return e5();
|
|
671
671
|
} finally {
|
|
672
672
|
globalThis.__wix_context__ = t2, p.client = n2.client, p.elevatedClient = n2.elevatedClient, typeof $wixContext < `u` && ($wixContext.client = r2.client, $wixContext.elevatedClient = r2.elevatedClient);
|
|
673
673
|
}
|
|
674
674
|
}
|
|
675
|
-
function
|
|
675
|
+
function kt(e5, t2) {
|
|
676
676
|
return (...n2) => {
|
|
677
|
-
let r2 =
|
|
678
|
-
return r2 ? r2.initWixModules(
|
|
677
|
+
let r2 = Dt();
|
|
678
|
+
return r2 ? r2.initWixModules(e5, t2).apply(void 0, n2) : e5.apply(void 0, n2);
|
|
679
679
|
};
|
|
680
680
|
}
|
|
681
|
-
function
|
|
682
|
-
return
|
|
683
|
-
}
|
|
684
|
-
function
|
|
685
|
-
let t2 =
|
|
686
|
-
return
|
|
687
|
-
}
|
|
688
|
-
var
|
|
689
|
-
var
|
|
690
|
-
var
|
|
691
|
-
var
|
|
692
|
-
var
|
|
693
|
-
var
|
|
694
|
-
var
|
|
695
|
-
var
|
|
696
|
-
var
|
|
697
|
-
var
|
|
698
|
-
function
|
|
699
|
-
return
|
|
700
|
-
}
|
|
701
|
-
function
|
|
702
|
-
return
|
|
703
|
-
}
|
|
704
|
-
function
|
|
705
|
-
let n2 = t2[
|
|
681
|
+
function At(e5, t2 = false) {
|
|
682
|
+
return kt(e5, t2);
|
|
683
|
+
}
|
|
684
|
+
function jt(e5) {
|
|
685
|
+
let t2 = Wt(Ht(e5.host), e5.domainToMappings);
|
|
686
|
+
return $t(Xt(e5.protoPath, e5.data || {}), t2);
|
|
687
|
+
}
|
|
688
|
+
var Mt = [`wix.com`, `editorx.com`];
|
|
689
|
+
var Nt = `_`;
|
|
690
|
+
var Pt = `*.`;
|
|
691
|
+
var Ft = RegExp(`\\.(${Mt.join(`|`)})$`);
|
|
692
|
+
var It = [`42.wixprod.net`, `uw2-edt-1.wixprod.net`, `virginia-edt.wixprod.net`];
|
|
693
|
+
var Lt = { "payments.base44.com": `manage.wix.com`, "create.editorx.com": `editor.editorx.com` };
|
|
694
|
+
var Rt = `dev.wix-code.com`;
|
|
695
|
+
var zt = /{(.*)}/;
|
|
696
|
+
var Bt = RegExp(`\\.(${It.join(`|`)})$`);
|
|
697
|
+
var Vt = RegExp(`.*\\.${Rt}$`);
|
|
698
|
+
function Ht(e5) {
|
|
699
|
+
return Ut(e5).replace(Ft, `._base_domain_`).replace(Bt, `._api_base_domain_`).replace(Vt, `*.dev.wix-code.com`);
|
|
700
|
+
}
|
|
701
|
+
function Ut(e5) {
|
|
702
|
+
return Lt[e5] ?? e5;
|
|
703
|
+
}
|
|
704
|
+
function Wt(e5, t2) {
|
|
705
|
+
let n2 = t2[e5];
|
|
706
706
|
if (n2) return n2;
|
|
707
|
-
let r2 =
|
|
707
|
+
let r2 = Gt(e5, t2) ?? Kt(e5, t2);
|
|
708
708
|
if (!r2) {
|
|
709
|
-
if (
|
|
710
|
-
let
|
|
711
|
-
if (
|
|
709
|
+
if (Jt(e5)) {
|
|
710
|
+
let e6 = t2[Yt];
|
|
711
|
+
if (e6) return e6;
|
|
712
712
|
}
|
|
713
|
-
let n3 = t2[
|
|
713
|
+
let n3 = t2[Nt];
|
|
714
714
|
if (n3) return n3;
|
|
715
715
|
}
|
|
716
716
|
return r2 ?? [];
|
|
717
717
|
}
|
|
718
|
-
function
|
|
718
|
+
function Gt(e5, t2) {
|
|
719
719
|
return Object.entries(t2).find(([t3]) => {
|
|
720
|
-
let [, ...n2] =
|
|
720
|
+
let [, ...n2] = e5.split(`.`);
|
|
721
721
|
return n2.join(`.`) === t3;
|
|
722
722
|
})?.[1];
|
|
723
723
|
}
|
|
724
|
-
function
|
|
725
|
-
let [n2] = Object.entries(t2).filter(([t3]) =>
|
|
724
|
+
function Kt(e5, t2) {
|
|
725
|
+
let [n2] = Object.entries(t2).filter(([t3]) => qt(e5, t3)).sort(([e6], [t3]) => t3.length - e6.length);
|
|
726
726
|
if (!n2) return;
|
|
727
727
|
let [, r2] = n2;
|
|
728
728
|
return r2;
|
|
729
729
|
}
|
|
730
|
-
function
|
|
731
|
-
if (!t2.startsWith(
|
|
730
|
+
function qt(e5, t2) {
|
|
731
|
+
if (!t2.startsWith(Pt)) return false;
|
|
732
732
|
let n2 = t2.slice(1);
|
|
733
|
-
return
|
|
733
|
+
return e5.length > n2.length && e5.endsWith(n2);
|
|
734
734
|
}
|
|
735
|
-
function
|
|
736
|
-
return !!
|
|
735
|
+
function Jt(e5) {
|
|
736
|
+
return !!e5.match(/\._base_domain_$/);
|
|
737
737
|
}
|
|
738
|
-
var
|
|
739
|
-
function
|
|
740
|
-
return
|
|
738
|
+
var Yt = `www._base_domain_`;
|
|
739
|
+
function Xt(e5, t2) {
|
|
740
|
+
return e5.split(`/`).map((e6) => Zt(e6, t2)).join(`/`);
|
|
741
741
|
}
|
|
742
|
-
function
|
|
743
|
-
let n2 =
|
|
744
|
-
return r2 ?
|
|
742
|
+
function Zt(e5, t2) {
|
|
743
|
+
let n2 = e5.match(zt) || [], r2 = n2[1];
|
|
744
|
+
return r2 ? Qt(t2, r2, e5, e5.replace(n2[0], ``)) : e5;
|
|
745
745
|
}
|
|
746
|
-
function
|
|
747
|
-
let i2 =
|
|
748
|
-
for (let
|
|
746
|
+
function Qt(e5, t2, n2, r2) {
|
|
747
|
+
let i2 = e5;
|
|
748
|
+
for (let e6 of t2.split(`.`)) {
|
|
749
749
|
if (!i2) return n2;
|
|
750
|
-
i2 = i2[
|
|
750
|
+
i2 = i2[e6];
|
|
751
751
|
}
|
|
752
752
|
return `${i2}${r2}`;
|
|
753
753
|
}
|
|
754
|
-
function
|
|
755
|
-
let n2 = t2?.find((t3) =>
|
|
756
|
-
return n2 ? n2.srcPath +
|
|
754
|
+
function $t(e5, t2) {
|
|
755
|
+
let n2 = t2?.find((t3) => e5.startsWith(t3.destPath));
|
|
756
|
+
return n2 ? n2.srcPath + e5.slice(n2.destPath.length) : e5;
|
|
757
|
+
}
|
|
758
|
+
var A;
|
|
759
|
+
(function(e5) {
|
|
760
|
+
e5.QUERY_PARAM = `QUERY_PARAM`, e5.SUBDOMAIN = `SUBDOMAIN`, e5.SUBDIRECTORY = `SUBDIRECTORY`;
|
|
761
|
+
})(A ||= {});
|
|
762
|
+
var en = { cs: `\u010Ce\u0161tina`, da: `Dansk`, de: `Deutsch`, en: `English`, es: `Espa\xF1ol`, fr: `Fran\xE7ais`, hi: `\u0939\u093F\u0928\u094D\u0926\u0940`, id: `Bahasa Indonesia`, it: `Italiano`, ja: `\u65E5\u672C\u8A9E`, ko: `\uD55C\uAD6D\uC5B4`, nl: `Nederlands`, no: `Norsk`, pl: `Polski`, pt: `Portugu\xEAs`, ru: `\u0420\u0443\u0441\u0441\u043A\u0438\u0439`, sv: `Svenska`, th: `\u0E44\u0E17\u0E22`, tr: `T\xFCrk\xE7e`, uk: `\u0423\u043A\u0440\u0430\u0457\u043D\u0441\u044C\u043A\u0430`, vi: `Ti\u1EBFng Vi\u1EC7t`, zh: `\u7E41\u9AD4\u4E2D\u6587`, sq: `Shqip`, am: `\u12A0\u121B\u122D\u129B`, ar: `\u0627\u0644\u0639\u0631\u0628\u064A\u0629`, hy: `\u0540\u0561\u0575\u0565\u0580\u0565\u0576`, az: `Az\u0259rbaycan dili`, eu: `Euskara`, be: `\u0411\u0435\u043B\u0430\u0440\u0443\u0441\u043A\u0430\u044F`, bn: `\u09AC\u09BE\u0982\u09B2\u09BE`, bs: `Bosanski`, bg: `\u0411\u044A\u043B\u0433\u0430\u0440\u0441\u043A\u0438`, ca: `Catal\xE0`, ny: `ChiChe\u0175a`, co: `Corsu`, hr: `Hrvatski`, et: `Eesti`, fj: `Vosa Vakaviti`, fi: `Suomi`, ga: `Gaeilge`, gl: `Galego`, ka: `\u10E5\u10D0\u10E0\u10D7\u10E3\u10DA\u10D8`, el: `\u0395\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AC`, gu: `\u0A97\u0AC1\u0A9C\u0AB0\u0ABE\u0AA4\u0AC0`, ht: `Krey\xF2l Ayisyen`, ha: `Hausa`, he: `\u05E2\u05D1\u05E8\u05D9\u05EA`, hu: `Magyar`, is: `\xCDslenska`, ig: `Igbo`, kn: `\u0C95\u0CA8\u0CCD\u0CA8\u0CA1`, kk: `\u049A\u0430\u0437\u0430\u049B \u0442\u0456\u043B\u0456`, km: `\u1797\u17B6\u179F\u17B6\u1781\u17D2\u1798\u17C2\u179A`, ku: `Kurd\xEE`, ky: `\u041A\u044B\u0440\u0433\u044B\u0437\u0447\u0430`, lb: `L\xEBtzebuergesch`, lo: `\u0EA5\u0EB2\u0EA7`, la: `Latina`, lv: `Latvie\u0161u`, lt: `Lietuvi\u0173`, mk: `\u041C\u0430\u043A\u0435\u0434\u043E\u043D\u0441\u043A\u0438`, mg: `Malagasy`, ms: `Bahasa Melayu`, ml: `\u0D2E\u0D32\u0D2F\u0D3E\u0D33\u0D02`, mt: `Malti`, mn: `\u041C\u043E\u043D\u0433\u043E\u043B`, ne: `\u0928\u0947\u092A\u093E\u0932\u0940`, ps: `\u067E\u069A\u062A\u0648`, fa: `\u0641\u0627\u0631\u0633\u06CC`, ro: `Rom\xE2n\u0103`, sm: `Gagana Samoa`, sr: `\u0421\u0440\u043F\u0441\u043A\u0438`, sn: `Shona`, sd: `\u0633\u0646\u068C\u064A`, si: `\u0DC3\u0DD2\u0D82\u0DC4\u0DBD`, sk: `Sloven\u010Dina`, sl: `Sloven\u0161\u010Dina`, so: `Soomaaliga`, su: `Basa Sunda`, sw: `Kiswahili`, tl: `Filipino`, tg: `\u0422\u043E\u04B7\u0438\u043A\u04E3`, ta: `\u0BA4\u0BAE\u0BBF\u0BB4\u0BCD`, te: `\u0C24\u0C46\u0C32\u0C41\u0C17\u0C41`, tk: `T\xFCrkmen`, ur: `\u0627\u0631\u062F\u0648`, uz: `O'zbek`, cy: `Cymraeg`, xh: `isiXhosa`, yi: `\u05D9\u05D9\u05B4\u05D3\u05D9\u05E9`, yo: `Yor\xF9b\xE1`, zu: `isiZulu`, kl: `Kalaallisut`, fo: `F\xF8royskt`, ln: `Ling\xE1la`, mi: `M\u0101ori`, mr: `\u092E\u0930\u093E\u0920\u0940`, my: `\u1019\u103C\u1014\u103A\u1019\u102C`, se: `S\xE1megiella`, ug: `\u0626\u06C7\u064A\u063A\u06C7\u0631\u0686\u06D5`, qu: `Runa Simi`, aa: `Afar`, ab: `\u0410\u04A7\u0441\u0443\u0430`, ae: `Avestan`, ak: `Akan`, an: `Aragon\xE9s`, as: `\u0985\u09B8\u09AE\u09C0\u09AF\u09BC\u09BE`, av: `\u0410\u0432\u0430\u0440`, ay: `Aymar aru`, ba: `\u0411\u0430\u0448\u04A1\u043E\u0440\u0442\u0441\u0430`, bh: `\u092D\u094B\u091C\u092A\u0941\u0930\u0940`, bi: `Bislama`, bm: `Bamanankan`, bo: `\u0F56\u0F7C\u0F51\u0F0B\u0F66\u0F90\u0F51\u0F0B`, br: `Brezhoneg`, ce: `\u041D\u043E\u0445\u0447\u0438\u0439\u043D`, ch: `Chamoru`, cr: `\u14C0\u1426\u1403\u152D\u140D\u140F\u1423`, cu: `\u0426\u0440\u044C\u043A\u044A\u0432\u044C\u043D\u043E\u0441\u043B\u043E\u0432\u0463\u043D\u044C\u0441\u043A\u044A`, cv: `\u0427\u04D1\u0432\u0430\u0448\u043B\u0430`, dv: `\u078B\u07A8\u0788\u07AC\u0780\u07A8\u0784\u07A6\u0790\u07B0`, dz: `\u0F62\u0FAB\u0F7C\u0F44\u0F0B\u0F41`, ee: `E\u028Begbe`, eo: `Esperanto`, ff: `Fulah`, fy: `Frysk`, gd: `G\xE0idhlig`, gn: `Ava\xF1e'\u1EBD`, gv: `Gaelg`, ho: `Hiri Motu`, hz: `Otjiherero`, ia: `Interlingua`, ie: `Interlingue`, ii: `\uA188\uA320\uA259`, ik: `I\xF1upiaq`, io: `Ido`, iu: `\u1403\u14C4\u1483\u144E\u1450\u1466`, jv: `Basa Jawa`, ki: `Gikuyu`, kr: `Kanuri`, ks: `\u06A9\u0672\u0634\u064F\u0631`, kw: `Kernewek`, lg: `Luganda`, li: `Limburgs`, lu: `Tshiluba`, mh: `Kajin M\u0327aje\u013C`, na: `Dorerin Naoero`, nb: `Norsk Bokm\xE5l`, nd: `isiNdebele`, ng: `Oshiwambo`, nn: `Norsk Nynorsk`, nr: `isiNdebele (South)`, nv: `Din\xE9 Bizaad`, oc: `Occitan`, oj: `Anishinaabemowin`, om: `Afaan Oromoo`, or: `\u0B13\u0B21\u0B3C\u0B3F\u0B06`, os: `\u0418\u0440\u043E\u043D`, pa: `\u0A2A\u0A70\u0A1C\u0A3E\u0A2C\u0A40`, pi: `\u{11005}\u{1102F}\u{11022}`, rm: `Rumantsch`, rn: `Ikirundi`, rw: `Kinyarwanda`, sa: `\u0938\u0902\u0938\u094D\u0915\u0943\u0924\u092E\u094D`, sc: `Sardu`, sg: `S\xE4ng\xF6`, ss: `SiSwati`, st: `Sesotho`, ti: `\u1275\u130D\u122D\u129B`, tn: `Setswana`, to: `Faka Tonga`, ts: `Xitsonga`, tt: `\u0422\u0430\u0442\u0430\u0440\u0447\u0430`, tw: `Twi`, ty: `Reo Tahiti`, ve: `Tshiven\u1E13a`, vo: `Volap\xFCk`, wa: `Walon`, wo: `Wolof`, za: `Sa\u026F cue\u014B\u0185` };
|
|
763
|
+
var tn = (e5, t2) => {
|
|
764
|
+
e5.searchParams.set(`lang`, t2);
|
|
765
|
+
};
|
|
766
|
+
var nn = (e5, t2) => {
|
|
767
|
+
let n2 = e5.hostname.split(`.`);
|
|
768
|
+
n2[0] === `www` && (n2 = n2.slice(1)), n2 = [t2, ...n2], e5.hostname = n2.join(`.`);
|
|
769
|
+
};
|
|
770
|
+
var rn = (e5, t2) => {
|
|
771
|
+
e5.pathname = `/${t2}${e5.pathname}`;
|
|
772
|
+
};
|
|
773
|
+
var an = (e5, t2) => {
|
|
774
|
+
if (!t2.languageCode || !t2?.resolutionMethod) return e5;
|
|
775
|
+
let n2 = new URL(e5);
|
|
776
|
+
return (t2?.resolutionMethod === `QUERY_PARAM` ? tn : t2?.resolutionMethod === `SUBDOMAIN` ? nn : rn)(n2, t2.languageCode), n2.href;
|
|
777
|
+
};
|
|
778
|
+
var on = (e5, t2) => {
|
|
779
|
+
if (!e5?.length) return e5;
|
|
780
|
+
let n2;
|
|
781
|
+
try {
|
|
782
|
+
n2 = new URL(e5);
|
|
783
|
+
} catch {
|
|
784
|
+
return e5;
|
|
785
|
+
}
|
|
786
|
+
n2.searchParams.delete(`lang`);
|
|
787
|
+
let r2 = n2.pathname.split(`/`)[1]?.toLowerCase();
|
|
788
|
+
if (t2.includes(r2 ?? ``)) {
|
|
789
|
+
let e6 = n2.pathname.split(`/`);
|
|
790
|
+
e6.splice(1, 1), n2.pathname = e6.join(`/`);
|
|
791
|
+
}
|
|
792
|
+
let i2 = n2.hostname.split(`.`)[0]?.toLowerCase();
|
|
793
|
+
if (t2.includes(i2 ?? ``)) {
|
|
794
|
+
let e6 = n2.hostname.split(`.`);
|
|
795
|
+
e6.shift(), n2.hostname = e6.join(`.`);
|
|
796
|
+
}
|
|
797
|
+
return n2.href;
|
|
798
|
+
};
|
|
799
|
+
function sn() {
|
|
800
|
+
let e5 = cn();
|
|
801
|
+
return e5 ? ln(e5) : [];
|
|
802
|
+
}
|
|
803
|
+
function cn() {
|
|
804
|
+
let e5 = typeof globals < `u` ? globals?.$ns?.[`wix-window`]?.multilingual : void 0, t2 = typeof window < `u` ? window?.essentials?.multilingual : void 0;
|
|
805
|
+
return e5 ?? t2 ?? globalThis?.__wix_site_metadata__?.multilingual;
|
|
806
|
+
}
|
|
807
|
+
function ln(e5) {
|
|
808
|
+
try {
|
|
809
|
+
if (e5?.supportedLanguages?.length) {
|
|
810
|
+
let t2 = e5.supportedLanguages, n2 = t2.map((e6) => e6.languageCode).filter(Boolean), r2 = e5.cleanUrl ?? pn(n2);
|
|
811
|
+
return t2.map((e6) => ({ id: e6.languageCode, displayName: un(e6), regionalFormat: [e6.locale?.languageCode, e6.locale?.country].filter(Boolean).join(`-`), url: dn(e6, r2), primary: e6.isPrimary, resolutionMethod: e6.resolutionMethod }));
|
|
812
|
+
}
|
|
813
|
+
if (e5?.siteLanguages?.length) {
|
|
814
|
+
let t2 = e5.siteLanguages, n2 = pn(t2.map((e6) => e6.languageCode).filter(Boolean));
|
|
815
|
+
return t2.map((e6) => ({ id: e6.languageCode, displayName: un(e6), regionalFormat: e6.locale, url: dn(e6, n2), primary: e6.isPrimaryLanguage, resolutionMethod: e6.resolutionMethod ? fn(e6.resolutionMethod) : void 0 }));
|
|
816
|
+
}
|
|
817
|
+
} catch (e6) {
|
|
818
|
+
return console.warn(`[Multilingual Manager] listSupportedLanguages failed`, e6), [];
|
|
819
|
+
}
|
|
820
|
+
return console.warn(`[Multilingual Manager] listSupportedLanguages is not available`), [];
|
|
821
|
+
}
|
|
822
|
+
function un(e5) {
|
|
823
|
+
let t2 = en[e5.languageCode];
|
|
824
|
+
if (t2) return t2;
|
|
825
|
+
let n2 = e5.name ?? e5.countryCode;
|
|
826
|
+
if (n2) return n2;
|
|
827
|
+
}
|
|
828
|
+
function dn(e5, t2) {
|
|
829
|
+
if (e5.url || !t2 || !e5.resolutionMethod) return e5.url;
|
|
830
|
+
if (e5.languageCode) try {
|
|
831
|
+
return an(t2, { languageCode: e5.languageCode, countryCode: e5.countryCode, resolutionMethod: fn(e5.resolutionMethod), locale: { languageCode: e5.languageCode, country: e5.countryCode } });
|
|
832
|
+
} catch (e6) {
|
|
833
|
+
console.warn(`[Multilingual Manager] buildUrlForLanguage failed`, e6);
|
|
834
|
+
return;
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
function fn(e5) {
|
|
838
|
+
switch (e5) {
|
|
839
|
+
case `QUERY_PARAM`:
|
|
840
|
+
case `QueryParam`:
|
|
841
|
+
return A.QUERY_PARAM;
|
|
842
|
+
case `SUBDOMAIN`:
|
|
843
|
+
case `Subdomain`:
|
|
844
|
+
return A.SUBDOMAIN;
|
|
845
|
+
case `SUBDIRECTORY`:
|
|
846
|
+
case `Subdirectory`:
|
|
847
|
+
return A.SUBDIRECTORY;
|
|
848
|
+
default:
|
|
849
|
+
return;
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
function pn(e5) {
|
|
853
|
+
let t2 = typeof window < `u` && window.location?.href ? window.location.href : ``;
|
|
854
|
+
try {
|
|
855
|
+
return on(t2, e5);
|
|
856
|
+
} catch (e6) {
|
|
857
|
+
return console.warn(`[Multilingual Manager] cleanCurrentUrl failed`, e6), t2;
|
|
858
|
+
}
|
|
757
859
|
}
|
|
758
|
-
var
|
|
759
|
-
var
|
|
760
|
-
var
|
|
761
|
-
var
|
|
762
|
-
let
|
|
763
|
-
if (
|
|
860
|
+
var mn = `x-wix-linguist`;
|
|
861
|
+
var hn = `00000000-0000-0000-0000-000000000000`;
|
|
862
|
+
var gn = `false`;
|
|
863
|
+
var _n = () => {
|
|
864
|
+
let e5 = j(`language`), t2 = j(`locale`);
|
|
865
|
+
if (e5) return { [mn]: [e5, t2 || e5, gn, hn].join(`|`) };
|
|
764
866
|
};
|
|
765
|
-
function
|
|
766
|
-
let
|
|
867
|
+
function vn() {
|
|
868
|
+
let e5 = null, t2 = null;
|
|
767
869
|
return { promise: new Promise((n2, r2) => {
|
|
768
|
-
|
|
769
|
-
}), resolve:
|
|
770
|
-
}
|
|
771
|
-
var
|
|
772
|
-
var
|
|
773
|
-
var
|
|
774
|
-
let { applicationId: n2, componentId: r2 } = t2 ?? {}, i2 = typeof window < `u` ? window.wixEmbedsAPI : void 0, a2 =
|
|
775
|
-
return { ...a2, apiBaseUrl: o2, getMonitoringClient: i2?.getMonitoringClientFunction?.(n2, r2), essentials: { language:
|
|
776
|
-
return
|
|
870
|
+
e5 = n2, t2 = r2;
|
|
871
|
+
}), resolve: e5, reject: t2 };
|
|
872
|
+
}
|
|
873
|
+
var yn = () => (typeof window < `u` ? window.commonConfig : void 0) ?? globalThis.commonConfig;
|
|
874
|
+
var j = (e5) => yn()?.[e5];
|
|
875
|
+
var bn = ({ createHost: e5 }) => ({ __type: `host`, create: (e6) => ({}), host: (t2) => {
|
|
876
|
+
let { applicationId: n2, componentId: r2 } = t2 ?? {}, i2 = typeof window < `u` ? window.wixEmbedsAPI : void 0, a2 = e5(t2), o2 = Sn();
|
|
877
|
+
return { ...a2, apiBaseUrl: o2, getMonitoringClient: i2?.getMonitoringClientFunction?.(n2, r2), essentials: { language: j(`language`), locale: j(`locale`), get passThroughHeaders() {
|
|
878
|
+
return _n();
|
|
777
879
|
} } };
|
|
778
|
-
}, auth: (
|
|
880
|
+
}, auth: (e6) => {
|
|
779
881
|
let t2 = typeof window < `u` ? window.wixEmbedsAPI : void 0;
|
|
780
|
-
!
|
|
781
|
-
let n2 = false, { resolve: r2, promise: i2 } =
|
|
882
|
+
!e6 && xn() && (e6 = t2?.getAccessTokenFunction?.());
|
|
883
|
+
let n2 = false, { resolve: r2, promise: i2 } = vn();
|
|
782
884
|
return { getAuthHeaders: async () => {
|
|
783
|
-
if (!
|
|
784
|
-
return { headers: { Authorization: await
|
|
785
|
-
}, getAccessTokenInjector: () => (n2 = true, (
|
|
786
|
-
r2(
|
|
885
|
+
if (!e6 && n2 && (e6 = await i2), !e6) throw Error(`Failed to resolve auth token`);
|
|
886
|
+
return { headers: { Authorization: await e6() } };
|
|
887
|
+
}, getAccessTokenInjector: () => (n2 = true, (e7) => {
|
|
888
|
+
r2(e7);
|
|
787
889
|
}) };
|
|
788
890
|
} });
|
|
789
|
-
function
|
|
891
|
+
function xn() {
|
|
790
892
|
return typeof document < `u` && document.currentScript?.tagName === `SCRIPT`;
|
|
791
893
|
}
|
|
792
|
-
function
|
|
793
|
-
let
|
|
794
|
-
if (!
|
|
795
|
-
let t2 = new URL(
|
|
894
|
+
function Sn() {
|
|
895
|
+
let e5 = (typeof window < `u` ? window.wixEmbedsAPI : void 0)?.getExternalBaseUrl?.();
|
|
896
|
+
if (!e5) return;
|
|
897
|
+
let t2 = new URL(e5);
|
|
796
898
|
return t2?.pathname && t2.pathname !== `/` ? `${t2.hostname}${t2.pathname}` : t2.hostname;
|
|
797
899
|
}
|
|
798
|
-
var
|
|
799
|
-
if (!
|
|
800
|
-
return
|
|
900
|
+
var Cn = ({ clientSdk: e5, applicationId: t2 }) => ({ invoke: async ({ namespace: n2, method: r2, args: i2 }) => {
|
|
901
|
+
if (!e5) throw Error(`Wix Site SDK only works in a Wix site environment. Learn more: https://dev.wix.com/docs/sdk/host-modules/site/introduction`);
|
|
902
|
+
return e5.invoke({ namespace: n2, method: r2, args: i2, applicationId: t2, accessToken: `accessToken` });
|
|
801
903
|
}, getAccessToken: () => {
|
|
802
904
|
throw Error(`Not implemented`);
|
|
803
905
|
}, observeState: () => ({ disconnect: () => {
|
|
804
906
|
} }) });
|
|
805
|
-
var
|
|
806
|
-
let t2 = (typeof $wixContext < `u` ? $wixContext.clientSdk : void 0) ??
|
|
907
|
+
var wn = bn({ createHost: function(e5) {
|
|
908
|
+
let t2 = (typeof $wixContext < `u` ? $wixContext.clientSdk : void 0) ?? e5?.clientSdk ?? (typeof window < `u` ? window?.clientSdk : void 0), { applicationId: n2 } = e5 || {};
|
|
807
909
|
if (!n2) throw Error(`"createHost" was called without a required field "applicationId"`);
|
|
808
|
-
return { channel:
|
|
910
|
+
return { channel: Cn({ clientSdk: t2, applicationId: n2 }), close: () => {
|
|
809
911
|
} };
|
|
810
912
|
} });
|
|
811
|
-
var
|
|
812
|
-
let n2 =
|
|
913
|
+
var Tn = (e5, t2) => {
|
|
914
|
+
let n2 = wn.host({ applicationId: e5, componentId: t2 }), r2 = wn.auth();
|
|
813
915
|
return Ue({ auth: r2, host: n2 }).enableContext(`module`), r2.getAccessTokenInjector();
|
|
814
916
|
};
|
|
815
|
-
var
|
|
816
|
-
function
|
|
817
|
-
for (let n2 of
|
|
818
|
-
let
|
|
819
|
-
if (
|
|
917
|
+
var En = (e5) => Tn(`13d21c63-b5ec-5912-8397-c3a5ddb27a97`, e5);
|
|
918
|
+
function M(e5, t2) {
|
|
919
|
+
for (let n2 of e5) {
|
|
920
|
+
let e6 = n2.addOns.find((e7) => e7.addOnId === t2);
|
|
921
|
+
if (e6) return { group: n2, addOn: e6 };
|
|
820
922
|
}
|
|
821
923
|
return null;
|
|
822
924
|
}
|
|
823
|
-
function
|
|
824
|
-
return
|
|
925
|
+
function Dn(e5, t2) {
|
|
926
|
+
return M(e5, t2)?.addOn ?? null;
|
|
825
927
|
}
|
|
826
|
-
function
|
|
827
|
-
return t2.filter((t3) =>
|
|
928
|
+
function N(e5, t2) {
|
|
929
|
+
return t2.filter((t3) => M(e5, t3.id) !== null);
|
|
828
930
|
}
|
|
829
|
-
function
|
|
830
|
-
return n2.filter((n3) =>
|
|
931
|
+
function On(e5, t2, n2) {
|
|
932
|
+
return n2.filter((n3) => M(e5, n3.id)?.group === t2).length;
|
|
831
933
|
}
|
|
832
|
-
function
|
|
833
|
-
return !
|
|
934
|
+
function kn(e5, t2) {
|
|
935
|
+
return !e5.maxNumberOfAddOns || t2 < e5.maxNumberOfAddOns;
|
|
834
936
|
}
|
|
835
|
-
function
|
|
836
|
-
return
|
|
837
|
-
let r2 =
|
|
838
|
-
return { ...n2, addOns: n2.addOns.map((
|
|
839
|
-
let n3 = t2.find((t3) => t3.id ===
|
|
840
|
-
return { ...
|
|
841
|
-
}), selectedCount: r2, canSelectMore:
|
|
937
|
+
function An(e5, t2) {
|
|
938
|
+
return e5.map((n2) => {
|
|
939
|
+
let r2 = On(e5, n2, t2);
|
|
940
|
+
return { ...n2, addOns: n2.addOns.map((e6) => {
|
|
941
|
+
let n3 = t2.find((t3) => t3.id === e6.addOnId)?.quantity ?? 0;
|
|
942
|
+
return { ...e6, isSelected: n3 > 0, selectedQuantity: n3 };
|
|
943
|
+
}), selectedCount: r2, canSelectMore: kn(n2, r2) };
|
|
842
944
|
});
|
|
843
945
|
}
|
|
844
|
-
function
|
|
845
|
-
let r2 =
|
|
846
|
-
return r2 ? t2.some((
|
|
946
|
+
function jn(e5, t2, n2) {
|
|
947
|
+
let r2 = M(e5, n2);
|
|
948
|
+
return r2 ? t2.some((e6) => e6.id === n2) ? true : kn(r2.group, On(e5, r2.group, t2)) : false;
|
|
847
949
|
}
|
|
848
|
-
function
|
|
849
|
-
let n2 =
|
|
950
|
+
function Mn(e5, t2) {
|
|
951
|
+
let n2 = e5.maxQuantity ?? 1;
|
|
850
952
|
return Number.isFinite(t2) ? Math.min(Math.max(Math.trunc(t2), 0), n2) : 0;
|
|
851
953
|
}
|
|
852
|
-
var
|
|
853
|
-
function
|
|
854
|
-
return
|
|
954
|
+
var Nn = { category: `category`, location: `location`, page: `page`, blob: `b`, resource: `resource`, referral: `referral`, timezone: `timezone`, bookingId: `bookingId`, token: `token`, rescheduleRedirectUrl: `rescheduleRedirectUrl` };
|
|
955
|
+
function P(e5) {
|
|
956
|
+
return e5.addOns ?? [];
|
|
855
957
|
}
|
|
856
|
-
function
|
|
857
|
-
let n2 = { ...
|
|
958
|
+
function Pn(e5, t2) {
|
|
959
|
+
let n2 = { ...e5 };
|
|
858
960
|
return t2.length ? n2.addOns = t2 : delete n2.addOns, n2;
|
|
859
961
|
}
|
|
860
|
-
function
|
|
861
|
-
let n2 =
|
|
862
|
-
return
|
|
962
|
+
function Fn(e5, t2) {
|
|
963
|
+
let n2 = P(e5);
|
|
964
|
+
return Pn(e5, n2.some((e6) => e6.id === t2) ? n2.filter((e6) => e6.id !== t2) : [...n2, { id: t2, quantity: 1 }]);
|
|
863
965
|
}
|
|
864
|
-
function
|
|
865
|
-
let r2 =
|
|
866
|
-
return n2 <= 0 ?
|
|
966
|
+
function In(e5, t2, n2) {
|
|
967
|
+
let r2 = P(e5);
|
|
968
|
+
return n2 <= 0 ? Pn(e5, r2.filter((e6) => e6.id !== t2)) : Pn(e5, r2.some((e6) => e6.id === t2) ? r2.map((e6) => e6.id === t2 ? { ...e6, quantity: n2 } : e6) : [...r2, { id: t2, quantity: n2 }]);
|
|
867
969
|
}
|
|
868
|
-
function
|
|
869
|
-
let
|
|
870
|
-
if (
|
|
871
|
-
return
|
|
970
|
+
function Ln() {
|
|
971
|
+
let e5 = typeof $wixContext < `u` && $wixContext.initWixModules ? $wixContext.initWixModules : globalThis.__wix_context__ !== void 0 && globalThis.__wix_context__.initWixModules ? globalThis.__wix_context__.initWixModules : void 0;
|
|
972
|
+
if (e5) return { initWixModules(t3, n3) {
|
|
973
|
+
return Rn(() => e5(t3, n3));
|
|
872
974
|
}, fetchWithAuth() {
|
|
873
975
|
throw Error(`fetchWithAuth is not available in this context`);
|
|
874
976
|
}, graphql() {
|
|
875
977
|
throw Error(`graphql is not available in this context`);
|
|
876
978
|
} };
|
|
877
979
|
let t2 = typeof $wixContext < `u` ? $wixContext.client : p.client === void 0 ? globalThis.__wix_context__ === void 0 ? void 0 : globalThis.__wix_context__.client : p.client, n2 = typeof $wixContext < `u` ? $wixContext.elevatedClient : p.elevatedClient === void 0 ? globalThis.__wix_context__ === void 0 ? void 0 : globalThis.__wix_context__.elevatedClient : p.elevatedClient;
|
|
878
|
-
if (t2 || n2) return { initWixModules(
|
|
980
|
+
if (t2 || n2) return { initWixModules(e6, r2) {
|
|
879
981
|
if (r2) {
|
|
880
982
|
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`);
|
|
881
|
-
return
|
|
983
|
+
return Rn(() => n2.use(e6));
|
|
882
984
|
}
|
|
883
985
|
if (!t2) throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);
|
|
884
|
-
return
|
|
885
|
-
}, fetchWithAuth: (
|
|
986
|
+
return Rn(() => t2.use(e6));
|
|
987
|
+
}, fetchWithAuth: (e6, n3) => {
|
|
886
988
|
if (!t2) throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);
|
|
887
|
-
return t2.fetchWithAuth(
|
|
989
|
+
return t2.fetchWithAuth(e6, n3);
|
|
888
990
|
}, getAuth() {
|
|
889
991
|
if (!t2) throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);
|
|
890
992
|
return t2.auth;
|
|
891
|
-
}, async graphql(
|
|
993
|
+
}, async graphql(e6, n3, r2) {
|
|
892
994
|
if (!t2) throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);
|
|
893
|
-
return t2.graphql(
|
|
995
|
+
return t2.graphql(e6, n3, r2);
|
|
894
996
|
} };
|
|
895
997
|
}
|
|
896
|
-
function
|
|
998
|
+
function Rn(e5) {
|
|
897
999
|
let t2 = globalThis.__wix_context__, n2 = { client: p.client, elevatedClient: p.elevatedClient }, r2;
|
|
898
1000
|
globalThis.__wix_context__ = void 0, p.client = void 0, p.elevatedClient = void 0, typeof $wixContext < `u` && (r2 = { client: $wixContext?.client, elevatedClient: $wixContext?.elevatedClient }, delete $wixContext.client, delete $wixContext.elevatedClient);
|
|
899
1001
|
try {
|
|
900
|
-
return
|
|
1002
|
+
return e5();
|
|
901
1003
|
} finally {
|
|
902
1004
|
globalThis.__wix_context__ = t2, p.client = n2.client, p.elevatedClient = n2.elevatedClient, typeof $wixContext < `u` && ($wixContext.client = r2.client, $wixContext.elevatedClient = r2.elevatedClient);
|
|
903
1005
|
}
|
|
904
1006
|
}
|
|
905
|
-
function
|
|
906
|
-
return { ...
|
|
907
|
-
let r2 =
|
|
1007
|
+
function zn(e5, t2) {
|
|
1008
|
+
return { ...e5, ...Object.fromEntries(t2.map((t3) => [t3, (...n2) => {
|
|
1009
|
+
let r2 = Ln();
|
|
908
1010
|
if (!r2) throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);
|
|
909
|
-
return r2.initWixModules(
|
|
1011
|
+
return r2.initWixModules(e5)[t3].apply(void 0, n2);
|
|
910
1012
|
}])) };
|
|
911
1013
|
}
|
|
912
|
-
function
|
|
913
|
-
return
|
|
1014
|
+
function Bn(e5) {
|
|
1015
|
+
return zn({ __type: `host`, create: (t2) => Object.entries(e5).reduce((e6, [n2, r2]) => ({ ...e6, [n2]: r2(t2) }), {}) }, Object.keys(e5));
|
|
1016
|
+
}
|
|
1017
|
+
var F = (e5) => typeof e5 == `string`;
|
|
1018
|
+
var I = () => {
|
|
1019
|
+
let e5, t2, n2 = new Promise((n3, r2) => {
|
|
1020
|
+
e5 = n3, t2 = r2;
|
|
1021
|
+
});
|
|
1022
|
+
return n2.resolve = e5, n2.reject = t2, n2;
|
|
1023
|
+
};
|
|
1024
|
+
var Vn = (e5) => e5 == null ? `` : `` + e5;
|
|
1025
|
+
var Hn = (e5, t2, n2) => {
|
|
1026
|
+
e5.forEach((e6) => {
|
|
1027
|
+
t2[e6] && (n2[e6] = t2[e6]);
|
|
1028
|
+
});
|
|
1029
|
+
};
|
|
1030
|
+
var Un = /###/g;
|
|
1031
|
+
var Wn = (e5) => e5 && e5.indexOf(`###`) > -1 ? e5.replace(Un, `.`) : e5;
|
|
1032
|
+
var Gn = (e5) => !e5 || F(e5);
|
|
1033
|
+
var L = (e5, t2, n2) => {
|
|
1034
|
+
let r2 = F(t2) ? t2.split(`.`) : t2, i2 = 0;
|
|
1035
|
+
for (; i2 < r2.length - 1; ) {
|
|
1036
|
+
if (Gn(e5)) return {};
|
|
1037
|
+
let t3 = Wn(r2[i2]);
|
|
1038
|
+
!e5[t3] && n2 && (e5[t3] = new n2()), e5 = Object.prototype.hasOwnProperty.call(e5, t3) ? e5[t3] : {}, ++i2;
|
|
1039
|
+
}
|
|
1040
|
+
return Gn(e5) ? {} : { obj: e5, k: Wn(r2[i2]) };
|
|
1041
|
+
};
|
|
1042
|
+
var Kn = (e5, t2, n2) => {
|
|
1043
|
+
let { obj: r2, k: i2 } = L(e5, t2, Object);
|
|
1044
|
+
if (r2 !== void 0 || t2.length === 1) {
|
|
1045
|
+
r2[i2] = n2;
|
|
1046
|
+
return;
|
|
1047
|
+
}
|
|
1048
|
+
let a2 = t2[t2.length - 1], o2 = t2.slice(0, t2.length - 1), s2 = L(e5, o2, Object);
|
|
1049
|
+
for (; s2.obj === void 0 && o2.length; ) a2 = `${o2[o2.length - 1]}.${a2}`, o2 = o2.slice(0, o2.length - 1), s2 = L(e5, o2, Object), s2?.obj && s2.obj[`${s2.k}.${a2}`] !== void 0 && (s2.obj = void 0);
|
|
1050
|
+
s2.obj[`${s2.k}.${a2}`] = n2;
|
|
1051
|
+
};
|
|
1052
|
+
var qn = (e5, t2, n2, r2) => {
|
|
1053
|
+
let { obj: i2, k: a2 } = L(e5, t2, Object);
|
|
1054
|
+
i2[a2] = i2[a2] || [], i2[a2].push(n2);
|
|
1055
|
+
};
|
|
1056
|
+
var R = (e5, t2) => {
|
|
1057
|
+
let { obj: n2, k: r2 } = L(e5, t2);
|
|
1058
|
+
if (n2 && Object.prototype.hasOwnProperty.call(n2, r2)) return n2[r2];
|
|
1059
|
+
};
|
|
1060
|
+
var Jn = (e5, t2, n2) => {
|
|
1061
|
+
let r2 = R(e5, n2);
|
|
1062
|
+
return r2 === void 0 ? R(t2, n2) : r2;
|
|
1063
|
+
};
|
|
1064
|
+
var Yn = (e5, t2, n2) => {
|
|
1065
|
+
for (let r2 in t2) r2 !== `__proto__` && r2 !== `constructor` && (r2 in e5 ? F(e5[r2]) || e5[r2] instanceof String || F(t2[r2]) || t2[r2] instanceof String ? n2 && (e5[r2] = t2[r2]) : Yn(e5[r2], t2[r2], n2) : e5[r2] = t2[r2]);
|
|
1066
|
+
return e5;
|
|
1067
|
+
};
|
|
1068
|
+
var z = (e5) => e5.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, `\\$&`);
|
|
1069
|
+
var Xn = { "&": `&`, "<": `<`, ">": `>`, '"': `"`, "'": `'`, "/": `/` };
|
|
1070
|
+
var Zn = (e5) => F(e5) ? e5.replace(/[&<>"'\/]/g, (e6) => Xn[e6]) : e5;
|
|
1071
|
+
var Qn = class {
|
|
1072
|
+
constructor(e5) {
|
|
1073
|
+
this.capacity = e5, this.regExpMap = /* @__PURE__ */ new Map(), this.regExpQueue = [];
|
|
1074
|
+
}
|
|
1075
|
+
getRegExp(e5) {
|
|
1076
|
+
let t2 = this.regExpMap.get(e5);
|
|
1077
|
+
if (t2 !== void 0) return t2;
|
|
1078
|
+
let n2 = new RegExp(e5);
|
|
1079
|
+
return this.regExpQueue.length === this.capacity && this.regExpMap.delete(this.regExpQueue.shift()), this.regExpMap.set(e5, n2), this.regExpQueue.push(e5), n2;
|
|
1080
|
+
}
|
|
1081
|
+
};
|
|
1082
|
+
var $n = [` `, `,`, `?`, `!`, `;`];
|
|
1083
|
+
var er = new Qn(20);
|
|
1084
|
+
var tr = (e5, t2, n2) => {
|
|
1085
|
+
t2 ||= ``, n2 ||= ``;
|
|
1086
|
+
let r2 = $n.filter((e6) => t2.indexOf(e6) < 0 && n2.indexOf(e6) < 0);
|
|
1087
|
+
if (r2.length === 0) return true;
|
|
1088
|
+
let i2 = er.getRegExp(`(${r2.map((e6) => e6 === `?` ? `\\?` : e6).join(`|`)})`), a2 = !i2.test(e5);
|
|
1089
|
+
if (!a2) {
|
|
1090
|
+
let t3 = e5.indexOf(n2);
|
|
1091
|
+
t3 > 0 && !i2.test(e5.substring(0, t3)) && (a2 = true);
|
|
1092
|
+
}
|
|
1093
|
+
return a2;
|
|
1094
|
+
};
|
|
1095
|
+
var B = (e5, t2, n2 = `.`) => {
|
|
1096
|
+
if (!e5) return;
|
|
1097
|
+
if (e5[t2]) return Object.prototype.hasOwnProperty.call(e5, t2) ? e5[t2] : void 0;
|
|
1098
|
+
let r2 = t2.split(n2), i2 = e5;
|
|
1099
|
+
for (let e6 = 0; e6 < r2.length; ) {
|
|
1100
|
+
if (!i2 || typeof i2 != `object`) return;
|
|
1101
|
+
let t3, a2 = ``;
|
|
1102
|
+
for (let o2 = e6; o2 < r2.length; ++o2) if (o2 !== e6 && (a2 += n2), a2 += r2[o2], t3 = i2[a2], t3 !== void 0) {
|
|
1103
|
+
if ([`string`, `number`, `boolean`].indexOf(typeof t3) > -1 && o2 < r2.length - 1) continue;
|
|
1104
|
+
e6 += o2 - e6 + 1;
|
|
1105
|
+
break;
|
|
1106
|
+
}
|
|
1107
|
+
i2 = t3;
|
|
1108
|
+
}
|
|
1109
|
+
return i2;
|
|
1110
|
+
};
|
|
1111
|
+
var V = (e5) => e5?.replace(/_/g, `-`);
|
|
1112
|
+
var nr = { type: `logger`, log(e5) {
|
|
1113
|
+
this.output(`log`, e5);
|
|
1114
|
+
}, warn(e5) {
|
|
1115
|
+
this.output(`warn`, e5);
|
|
1116
|
+
}, error(e5) {
|
|
1117
|
+
this.output(`error`, e5);
|
|
1118
|
+
}, output(e5, t2) {
|
|
1119
|
+
console?.[e5]?.apply?.(console, t2);
|
|
1120
|
+
} };
|
|
1121
|
+
var H = new class e2 {
|
|
1122
|
+
constructor(e5, t2 = {}) {
|
|
1123
|
+
this.init(e5, t2);
|
|
1124
|
+
}
|
|
1125
|
+
init(e5, t2 = {}) {
|
|
1126
|
+
this.prefix = t2.prefix || `i18next:`, this.logger = e5 || nr, this.options = t2, this.debug = t2.debug;
|
|
1127
|
+
}
|
|
1128
|
+
log(...e5) {
|
|
1129
|
+
return this.forward(e5, `log`, ``, true);
|
|
1130
|
+
}
|
|
1131
|
+
warn(...e5) {
|
|
1132
|
+
return this.forward(e5, `warn`, ``, true);
|
|
1133
|
+
}
|
|
1134
|
+
error(...e5) {
|
|
1135
|
+
return this.forward(e5, `error`, ``);
|
|
1136
|
+
}
|
|
1137
|
+
deprecate(...e5) {
|
|
1138
|
+
return this.forward(e5, `warn`, `WARNING DEPRECATED: `, true);
|
|
1139
|
+
}
|
|
1140
|
+
forward(e5, t2, n2, r2) {
|
|
1141
|
+
return r2 && !this.debug ? null : (F(e5[0]) && (e5[0] = `${n2}${this.prefix} ${e5[0]}`), this.logger[t2](e5));
|
|
1142
|
+
}
|
|
1143
|
+
create(t2) {
|
|
1144
|
+
return new e2(this.logger, { prefix: `${this.prefix}:${t2}:`, ...this.options });
|
|
1145
|
+
}
|
|
1146
|
+
clone(t2) {
|
|
1147
|
+
return t2 ||= this.options, t2.prefix = t2.prefix || this.prefix, new e2(this.logger, t2);
|
|
1148
|
+
}
|
|
1149
|
+
}();
|
|
1150
|
+
var U = class {
|
|
1151
|
+
constructor() {
|
|
1152
|
+
this.observers = {};
|
|
1153
|
+
}
|
|
1154
|
+
on(e5, t2) {
|
|
1155
|
+
return e5.split(` `).forEach((e6) => {
|
|
1156
|
+
this.observers[e6] || (this.observers[e6] = /* @__PURE__ */ new Map());
|
|
1157
|
+
let n2 = this.observers[e6].get(t2) || 0;
|
|
1158
|
+
this.observers[e6].set(t2, n2 + 1);
|
|
1159
|
+
}), this;
|
|
1160
|
+
}
|
|
1161
|
+
off(e5, t2) {
|
|
1162
|
+
if (this.observers[e5]) {
|
|
1163
|
+
if (!t2) {
|
|
1164
|
+
delete this.observers[e5];
|
|
1165
|
+
return;
|
|
1166
|
+
}
|
|
1167
|
+
this.observers[e5].delete(t2);
|
|
1168
|
+
}
|
|
1169
|
+
}
|
|
1170
|
+
emit(e5, ...t2) {
|
|
1171
|
+
this.observers[e5] && Array.from(this.observers[e5].entries()).forEach(([e6, n2]) => {
|
|
1172
|
+
for (let r2 = 0; r2 < n2; r2++) e6(...t2);
|
|
1173
|
+
}), this.observers[`*`] && Array.from(this.observers[`*`].entries()).forEach(([n2, r2]) => {
|
|
1174
|
+
for (let i2 = 0; i2 < r2; i2++) n2.apply(n2, [e5, ...t2]);
|
|
1175
|
+
});
|
|
1176
|
+
}
|
|
1177
|
+
};
|
|
1178
|
+
var rr = class extends U {
|
|
1179
|
+
constructor(e5, t2 = { ns: [`translation`], defaultNS: `translation` }) {
|
|
1180
|
+
super(), this.data = e5 || {}, this.options = t2, this.options.keySeparator === void 0 && (this.options.keySeparator = `.`), this.options.ignoreJSONStructure === void 0 && (this.options.ignoreJSONStructure = true);
|
|
1181
|
+
}
|
|
1182
|
+
addNamespaces(e5) {
|
|
1183
|
+
this.options.ns.indexOf(e5) < 0 && this.options.ns.push(e5);
|
|
1184
|
+
}
|
|
1185
|
+
removeNamespaces(e5) {
|
|
1186
|
+
let t2 = this.options.ns.indexOf(e5);
|
|
1187
|
+
t2 > -1 && this.options.ns.splice(t2, 1);
|
|
1188
|
+
}
|
|
1189
|
+
getResource(e5, t2, n2, r2 = {}) {
|
|
1190
|
+
let i2 = r2.keySeparator === void 0 ? this.options.keySeparator : r2.keySeparator, a2 = r2.ignoreJSONStructure === void 0 ? this.options.ignoreJSONStructure : r2.ignoreJSONStructure, o2;
|
|
1191
|
+
e5.indexOf(`.`) > -1 ? o2 = e5.split(`.`) : (o2 = [e5, t2], n2 && (Array.isArray(n2) ? o2.push(...n2) : F(n2) && i2 ? o2.push(...n2.split(i2)) : o2.push(n2)));
|
|
1192
|
+
let s2 = R(this.data, o2);
|
|
1193
|
+
return !s2 && !t2 && !n2 && e5.indexOf(`.`) > -1 && (e5 = o2[0], t2 = o2[1], n2 = o2.slice(2).join(`.`)), s2 || !a2 || !F(n2) ? s2 : B(this.data?.[e5]?.[t2], n2, i2);
|
|
1194
|
+
}
|
|
1195
|
+
addResource(e5, t2, n2, r2, i2 = { silent: false }) {
|
|
1196
|
+
let a2 = i2.keySeparator === void 0 ? this.options.keySeparator : i2.keySeparator, o2 = [e5, t2];
|
|
1197
|
+
n2 && (o2 = o2.concat(a2 ? n2.split(a2) : n2)), e5.indexOf(`.`) > -1 && (o2 = e5.split(`.`), r2 = t2, t2 = o2[1]), this.addNamespaces(t2), Kn(this.data, o2, r2), i2.silent || this.emit(`added`, e5, t2, n2, r2);
|
|
1198
|
+
}
|
|
1199
|
+
addResources(e5, t2, n2, r2 = { silent: false }) {
|
|
1200
|
+
for (let r3 in n2) (F(n2[r3]) || Array.isArray(n2[r3])) && this.addResource(e5, t2, r3, n2[r3], { silent: true });
|
|
1201
|
+
r2.silent || this.emit(`added`, e5, t2, n2);
|
|
1202
|
+
}
|
|
1203
|
+
addResourceBundle(e5, t2, n2, r2, i2, a2 = { silent: false, skipCopy: false }) {
|
|
1204
|
+
let o2 = [e5, t2];
|
|
1205
|
+
e5.indexOf(`.`) > -1 && (o2 = e5.split(`.`), r2 = n2, n2 = t2, t2 = o2[1]), this.addNamespaces(t2);
|
|
1206
|
+
let s2 = R(this.data, o2) || {};
|
|
1207
|
+
a2.skipCopy || (n2 = JSON.parse(JSON.stringify(n2))), r2 ? Yn(s2, n2, i2) : s2 = { ...s2, ...n2 }, Kn(this.data, o2, s2), a2.silent || this.emit(`added`, e5, t2, n2);
|
|
1208
|
+
}
|
|
1209
|
+
removeResourceBundle(e5, t2) {
|
|
1210
|
+
this.hasResourceBundle(e5, t2) && delete this.data[e5][t2], this.removeNamespaces(t2), this.emit(`removed`, e5, t2);
|
|
1211
|
+
}
|
|
1212
|
+
hasResourceBundle(e5, t2) {
|
|
1213
|
+
return this.getResource(e5, t2) !== void 0;
|
|
1214
|
+
}
|
|
1215
|
+
getResourceBundle(e5, t2) {
|
|
1216
|
+
return t2 ||= this.options.defaultNS, this.getResource(e5, t2);
|
|
1217
|
+
}
|
|
1218
|
+
getDataByLanguage(e5) {
|
|
1219
|
+
return this.data[e5];
|
|
1220
|
+
}
|
|
1221
|
+
hasLanguageSomeTranslations(e5) {
|
|
1222
|
+
let t2 = this.getDataByLanguage(e5);
|
|
1223
|
+
return !!(t2 && Object.keys(t2) || []).find((e6) => t2[e6] && Object.keys(t2[e6]).length > 0);
|
|
1224
|
+
}
|
|
1225
|
+
toJSON() {
|
|
1226
|
+
return this.data;
|
|
1227
|
+
}
|
|
1228
|
+
};
|
|
1229
|
+
var ir = { processors: {}, addPostProcessor(e5) {
|
|
1230
|
+
this.processors[e5.name] = e5;
|
|
1231
|
+
}, handle(e5, t2, n2, r2, i2) {
|
|
1232
|
+
return e5.forEach((e6) => {
|
|
1233
|
+
t2 = this.processors[e6]?.process(t2, n2, r2, i2) ?? t2;
|
|
1234
|
+
}), t2;
|
|
1235
|
+
} };
|
|
1236
|
+
var ar = Symbol(`i18next/PATH_KEY`);
|
|
1237
|
+
function or() {
|
|
1238
|
+
let e5 = [], t2 = /* @__PURE__ */ Object.create(null), n2;
|
|
1239
|
+
return t2.get = (r2, i2) => (n2?.revoke?.(), i2 === ar ? e5 : (e5.push(i2), n2 = Proxy.revocable(r2, t2), n2.proxy)), Proxy.revocable(/* @__PURE__ */ Object.create(null), t2).proxy;
|
|
1240
|
+
}
|
|
1241
|
+
function W(e5, t2) {
|
|
1242
|
+
let { [ar]: n2 } = e5(or()), r2 = t2?.keySeparator ?? `.`, i2 = t2?.nsSeparator ?? `:`;
|
|
1243
|
+
if (n2.length > 1 && i2) {
|
|
1244
|
+
let e6 = t2?.ns, a2 = Array.isArray(e6) ? e6 : null;
|
|
1245
|
+
if (a2 && a2.length > 1 && a2.slice(1).includes(n2[0])) return `${n2[0]}${i2}${n2.slice(1).join(r2)}`;
|
|
1246
|
+
}
|
|
1247
|
+
return n2.join(r2);
|
|
1248
|
+
}
|
|
1249
|
+
var sr = {};
|
|
1250
|
+
var cr = (e5) => !F(e5) && typeof e5 != `boolean` && typeof e5 != `number`;
|
|
1251
|
+
var lr = class e3 extends U {
|
|
1252
|
+
constructor(e5, t2 = {}) {
|
|
1253
|
+
super(), Hn([`resourceStore`, `languageUtils`, `pluralResolver`, `interpolator`, `backendConnector`, `i18nFormat`, `utils`], e5, this), this.options = t2, this.options.keySeparator === void 0 && (this.options.keySeparator = `.`), this.logger = H.create(`translator`);
|
|
1254
|
+
}
|
|
1255
|
+
changeLanguage(e5) {
|
|
1256
|
+
e5 && (this.language = e5);
|
|
1257
|
+
}
|
|
1258
|
+
exists(e5, t2 = { interpolation: {} }) {
|
|
1259
|
+
let n2 = { ...t2 };
|
|
1260
|
+
if (e5 == null) return false;
|
|
1261
|
+
let r2 = this.resolve(e5, n2);
|
|
1262
|
+
if (r2?.res === void 0) return false;
|
|
1263
|
+
let i2 = cr(r2.res);
|
|
1264
|
+
return !(n2.returnObjects === false && i2);
|
|
1265
|
+
}
|
|
1266
|
+
extractFromKey(e5, t2) {
|
|
1267
|
+
let n2 = t2.nsSeparator === void 0 ? this.options.nsSeparator : t2.nsSeparator;
|
|
1268
|
+
n2 === void 0 && (n2 = `:`);
|
|
1269
|
+
let r2 = t2.keySeparator === void 0 ? this.options.keySeparator : t2.keySeparator, i2 = t2.ns || this.options.defaultNS || [], a2 = n2 && e5.indexOf(n2) > -1, o2 = !this.options.userDefinedKeySeparator && !t2.keySeparator && !this.options.userDefinedNsSeparator && !t2.nsSeparator && !tr(e5, n2, r2);
|
|
1270
|
+
if (a2 && !o2) {
|
|
1271
|
+
let t3 = e5.match(this.interpolator.nestingRegexp);
|
|
1272
|
+
if (t3 && t3.length > 0) return { key: e5, namespaces: F(i2) ? [i2] : i2 };
|
|
1273
|
+
let a3 = e5.split(n2);
|
|
1274
|
+
(n2 !== r2 || n2 === r2 && this.options.ns.indexOf(a3[0]) > -1) && (i2 = a3.shift()), e5 = a3.join(r2);
|
|
1275
|
+
}
|
|
1276
|
+
return { key: e5, namespaces: F(i2) ? [i2] : i2 };
|
|
1277
|
+
}
|
|
1278
|
+
translate(t2, n2, r2) {
|
|
1279
|
+
let i2 = typeof n2 == `object` ? { ...n2 } : n2;
|
|
1280
|
+
if (typeof i2 != `object` && this.options.overloadTranslationOptionHandler && (i2 = this.options.overloadTranslationOptionHandler(arguments)), typeof i2 == `object` && (i2 = { ...i2 }), i2 ||= {}, t2 == null) return ``;
|
|
1281
|
+
typeof t2 == `function` && (t2 = W(t2, { ...this.options, ...i2 })), Array.isArray(t2) || (t2 = [String(t2)]), t2 = t2.map((e5) => typeof e5 == `function` ? W(e5, { ...this.options, ...i2 }) : String(e5));
|
|
1282
|
+
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;
|
|
1283
|
+
u2 === void 0 && (u2 = `:`);
|
|
1284
|
+
let d2 = i2.lng || this.language, f2 = i2.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
|
|
1285
|
+
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;
|
|
1286
|
+
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 && !F(i2.count), x2 = e3.hasDefaultValue(i2), ee2 = b2 ? this.pluralResolver.getSuffix(d2, i2.count, i2) : ``, te2 = i2.ordinal && b2 ? this.pluralResolver.getSuffix(d2, i2.count, { ordinal: false }) : ``, ne2 = b2 && !i2.ordinal && i2.count === 0, S2 = ne2 && i2[`defaultValue${this.options.pluralSeparator}zero`] || i2[`defaultValue${ee2}`] || i2[`defaultValue${te2}`] || i2.defaultValue, C2 = m2;
|
|
1287
|
+
y2 && !m2 && x2 && (C2 = S2);
|
|
1288
|
+
let re2 = cr(C2), ie2 = Object.prototype.toString.apply(C2);
|
|
1289
|
+
if (y2 && C2 && re2 && _2.indexOf(ie2) < 0 && !(F(v2) && Array.isArray(C2))) {
|
|
1290
|
+
if (!i2.returnObjects && !this.options.returnObjects) {
|
|
1291
|
+
this.options.returnedObjectHandler || this.logger.warn(`accessing an object - but returnObjects options is not enabled!`);
|
|
1292
|
+
let e5 = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(h2, C2, { ...i2, ns: c2 }) : `key '${s2} (${this.language})' returned an object instead of string.`;
|
|
1293
|
+
return a2 ? (p2.res = e5, p2.usedParams = this.getUsedParamsDetails(i2), p2) : e5;
|
|
1294
|
+
}
|
|
1295
|
+
if (o2) {
|
|
1296
|
+
let e5 = Array.isArray(C2), t3 = e5 ? [] : {}, n3 = e5 ? g2 : h2;
|
|
1297
|
+
for (let e6 in C2) if (Object.prototype.hasOwnProperty.call(C2, e6)) {
|
|
1298
|
+
let r3 = `${n3}${o2}${e6}`;
|
|
1299
|
+
t3[e6] = x2 && !m2 ? this.translate(r3, { ...i2, defaultValue: cr(S2) ? S2[e6] : void 0, joinArrays: false, ns: c2 }) : this.translate(r3, { ...i2, joinArrays: false, ns: c2 }), t3[e6] === r3 && (t3[e6] = C2[e6]);
|
|
1300
|
+
}
|
|
1301
|
+
m2 = t3;
|
|
1302
|
+
}
|
|
1303
|
+
} else if (y2 && F(v2) && Array.isArray(m2)) m2 = m2.join(v2), m2 &&= this.extendTranslation(m2, t2, i2, r2);
|
|
1304
|
+
else {
|
|
1305
|
+
let e5 = false, n3 = false;
|
|
1306
|
+
!this.isValidLookup(m2) && x2 && (e5 = true, m2 = S2), this.isValidLookup(m2) || (n3 = true, m2 = s2);
|
|
1307
|
+
let a3 = (i2.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && n3 ? void 0 : m2, c3 = x2 && S2 !== m2 && this.options.updateMissing;
|
|
1308
|
+
if (n3 || e5 || c3) {
|
|
1309
|
+
if (this.logger.log(c3 ? `updateKey` : `missingKey`, d2, l2, s2, c3 ? S2 : m2), o2) {
|
|
1310
|
+
let e7 = this.resolve(s2, { ...i2, keySeparator: false });
|
|
1311
|
+
e7 && e7.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.`);
|
|
1312
|
+
}
|
|
1313
|
+
let e6 = [], t3 = this.languageUtils.getFallbackCodes(this.options.fallbackLng, i2.lng || this.language);
|
|
1314
|
+
if (this.options.saveMissingTo === `fallback` && t3 && t3[0]) for (let n5 = 0; n5 < t3.length; n5++) e6.push(t3[n5]);
|
|
1315
|
+
else this.options.saveMissingTo === `all` ? e6 = this.languageUtils.toResolveHierarchy(i2.lng || this.language) : e6.push(i2.lng || this.language);
|
|
1316
|
+
let n4 = (e7, t4, n5) => {
|
|
1317
|
+
let r3 = x2 && n5 !== m2 ? n5 : a3;
|
|
1318
|
+
this.options.missingKeyHandler ? this.options.missingKeyHandler(e7, l2, t4, r3, c3, i2) : this.backendConnector?.saveMissing && this.backendConnector.saveMissing(e7, l2, t4, r3, c3, i2), this.emit(`missingKey`, e7, l2, t4, m2);
|
|
1319
|
+
};
|
|
1320
|
+
this.options.saveMissing && (this.options.saveMissingPlurals && b2 ? e6.forEach((e7) => {
|
|
1321
|
+
let t4 = this.pluralResolver.getSuffixes(e7, i2);
|
|
1322
|
+
ne2 && i2[`defaultValue${this.options.pluralSeparator}zero`] && t4.indexOf(`${this.options.pluralSeparator}zero`) < 0 && t4.push(`${this.options.pluralSeparator}zero`), t4.forEach((t5) => {
|
|
1323
|
+
n4([e7], s2 + t5, i2[`defaultValue${t5}`] || S2);
|
|
1324
|
+
});
|
|
1325
|
+
}) : n4(e6, s2, S2));
|
|
1326
|
+
}
|
|
1327
|
+
m2 = this.extendTranslation(m2, t2, i2, p2, r2), n3 && m2 === s2 && this.options.appendNamespaceToMissingKey && (m2 = `${l2}${u2}${s2}`), (n3 || e5) && this.options.parseMissingKeyHandler && (m2 = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${l2}${u2}${s2}` : s2, e5 ? m2 : void 0, i2));
|
|
1328
|
+
}
|
|
1329
|
+
return a2 ? (p2.res = m2, p2.usedParams = this.getUsedParamsDetails(i2), p2) : m2;
|
|
1330
|
+
}
|
|
1331
|
+
extendTranslation(e5, t2, n2, r2, i2) {
|
|
1332
|
+
if (this.i18nFormat?.parse) e5 = this.i18nFormat.parse(e5, { ...this.options.interpolation.defaultVariables, ...n2 }, n2.lng || this.language || r2.usedLng, r2.usedNS, r2.usedKey, { resolved: r2 });
|
|
1333
|
+
else if (!n2.skipInterpolation) {
|
|
1334
|
+
n2.interpolation && this.interpolator.init({ ...n2, interpolation: { ...this.options.interpolation, ...n2.interpolation } });
|
|
1335
|
+
let a3 = F(e5) && (n2?.interpolation?.skipOnVariables === void 0 ? this.options.interpolation.skipOnVariables : n2.interpolation.skipOnVariables), o3;
|
|
1336
|
+
if (a3) {
|
|
1337
|
+
let t3 = e5.match(this.interpolator.nestingRegexp);
|
|
1338
|
+
o3 = t3 && t3.length;
|
|
1339
|
+
}
|
|
1340
|
+
let s2 = n2.replace && !F(n2.replace) ? n2.replace : n2;
|
|
1341
|
+
if (this.options.interpolation.defaultVariables && (s2 = { ...this.options.interpolation.defaultVariables, ...s2 }), e5 = this.interpolator.interpolate(e5, s2, n2.lng || this.language || r2.usedLng, n2), a3) {
|
|
1342
|
+
let t3 = e5.match(this.interpolator.nestingRegexp), r3 = t3 && t3.length;
|
|
1343
|
+
o3 < r3 && (n2.nest = false);
|
|
1344
|
+
}
|
|
1345
|
+
!n2.lng && r2 && r2.res && (n2.lng = this.language || r2.usedLng), n2.nest !== false && (e5 = this.interpolator.nest(e5, (...e6) => i2?.[0] === e6[0] && !n2.context ? (this.logger.warn(`It seems you are nesting recursively key: ${e6[0]} in key: ${t2[0]}`), null) : this.translate(...e6, t2), n2)), n2.interpolation && this.interpolator.reset();
|
|
1346
|
+
}
|
|
1347
|
+
let a2 = n2.postProcess || this.options.postProcess, o2 = F(a2) ? [a2] : a2;
|
|
1348
|
+
return e5 != null && o2?.length && n2.applyPostProcessor !== false && (e5 = ir.handle(o2, e5, t2, this.options && this.options.postProcessPassResolved ? { i18nResolved: { ...r2, usedParams: this.getUsedParamsDetails(n2) }, ...n2 } : n2, this)), e5;
|
|
1349
|
+
}
|
|
1350
|
+
resolve(e5, t2 = {}) {
|
|
1351
|
+
let n2, r2, i2, a2, o2;
|
|
1352
|
+
return F(e5) && (e5 = [e5]), Array.isArray(e5) && (e5 = e5.map((e6) => typeof e6 == `function` ? W(e6, { ...this.options, ...t2 }) : e6)), e5.forEach((e6) => {
|
|
1353
|
+
if (this.isValidLookup(n2)) return;
|
|
1354
|
+
let s2 = this.extractFromKey(e6, t2), c2 = s2.key;
|
|
1355
|
+
r2 = c2;
|
|
1356
|
+
let l2 = s2.namespaces;
|
|
1357
|
+
this.options.fallbackNS && (l2 = l2.concat(this.options.fallbackNS));
|
|
1358
|
+
let u2 = t2.count !== void 0 && !F(t2.count), d2 = u2 && !t2.ordinal && t2.count === 0, f2 = t2.context !== void 0 && (F(t2.context) || typeof t2.context == `number`) && t2.context !== ``, p2 = t2.lngs ? t2.lngs : this.languageUtils.toResolveHierarchy(t2.lng || this.language, t2.fallbackLng);
|
|
1359
|
+
l2.forEach((e7) => {
|
|
1360
|
+
this.isValidLookup(n2) || (o2 = e7, !sr[`${p2[0]}-${e7}`] && this.utils?.hasLoadedNamespace && !this.utils?.hasLoadedNamespace(o2) && (sr[`${p2[0]}-${e7}`] = 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) => {
|
|
1361
|
+
if (this.isValidLookup(n2)) return;
|
|
1362
|
+
a2 = r3;
|
|
1363
|
+
let o3 = [c2];
|
|
1364
|
+
if (this.i18nFormat?.addLookupKeys) this.i18nFormat.addLookupKeys(o3, c2, r3, e7, t2);
|
|
1365
|
+
else {
|
|
1366
|
+
let e8;
|
|
1367
|
+
u2 && (e8 = this.pluralResolver.getSuffix(r3, t2.count, t2));
|
|
1368
|
+
let n3 = `${this.options.pluralSeparator}zero`, i3 = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;
|
|
1369
|
+
if (u2 && (t2.ordinal && e8.indexOf(i3) === 0 && o3.push(c2 + e8.replace(i3, this.options.pluralSeparator)), o3.push(c2 + e8), d2 && o3.push(c2 + n3)), f2) {
|
|
1370
|
+
let r4 = `${c2}${this.options.contextSeparator || `_`}${t2.context}`;
|
|
1371
|
+
o3.push(r4), u2 && (t2.ordinal && e8.indexOf(i3) === 0 && o3.push(r4 + e8.replace(i3, this.options.pluralSeparator)), o3.push(r4 + e8), d2 && o3.push(r4 + n3));
|
|
1372
|
+
}
|
|
1373
|
+
}
|
|
1374
|
+
let s3;
|
|
1375
|
+
for (; s3 = o3.pop(); ) this.isValidLookup(n2) || (i2 = s3, n2 = this.getResource(r3, e7, s3, t2));
|
|
1376
|
+
}));
|
|
1377
|
+
});
|
|
1378
|
+
}), { res: n2, usedKey: r2, exactUsedKey: i2, usedLng: a2, usedNS: o2 };
|
|
1379
|
+
}
|
|
1380
|
+
isValidLookup(e5) {
|
|
1381
|
+
return e5 !== void 0 && !(!this.options.returnNull && e5 === null) && !(!this.options.returnEmptyString && e5 === ``);
|
|
1382
|
+
}
|
|
1383
|
+
getResource(e5, t2, n2, r2 = {}) {
|
|
1384
|
+
return this.i18nFormat?.getResource ? this.i18nFormat.getResource(e5, t2, n2, r2) : this.resourceStore.getResource(e5, t2, n2, r2);
|
|
1385
|
+
}
|
|
1386
|
+
getUsedParamsDetails(e5 = {}) {
|
|
1387
|
+
let t2 = [`defaultValue`, `ordinal`, `context`, `replace`, `lng`, `lngs`, `fallbackLng`, `ns`, `keySeparator`, `nsSeparator`, `returnObjects`, `returnDetails`, `joinArrays`, `postProcess`, `interpolation`], n2 = e5.replace && !F(e5.replace), r2 = n2 ? e5.replace : e5;
|
|
1388
|
+
if (n2 && e5.count !== void 0 && (r2.count = e5.count), this.options.interpolation.defaultVariables && (r2 = { ...this.options.interpolation.defaultVariables, ...r2 }), !n2) {
|
|
1389
|
+
r2 = { ...r2 };
|
|
1390
|
+
for (let e6 of t2) delete r2[e6];
|
|
1391
|
+
}
|
|
1392
|
+
return r2;
|
|
1393
|
+
}
|
|
1394
|
+
static hasDefaultValue(e5) {
|
|
1395
|
+
for (let t2 in e5) if (Object.prototype.hasOwnProperty.call(e5, t2) && t2.substring(0, 12) === `defaultValue` && e5[t2] !== void 0) return true;
|
|
1396
|
+
return false;
|
|
1397
|
+
}
|
|
1398
|
+
};
|
|
1399
|
+
var ur = class {
|
|
1400
|
+
constructor(e5) {
|
|
1401
|
+
this.options = e5, this.supportedLngs = this.options.supportedLngs || false, this.logger = H.create(`languageUtils`);
|
|
1402
|
+
}
|
|
1403
|
+
getScriptPartFromCode(e5) {
|
|
1404
|
+
if (e5 = V(e5), !e5 || e5.indexOf(`-`) < 0) return null;
|
|
1405
|
+
let t2 = e5.split(`-`);
|
|
1406
|
+
return t2.length === 2 || (t2.pop(), t2[t2.length - 1].toLowerCase() === `x`) ? null : this.formatLanguageCode(t2.join(`-`));
|
|
1407
|
+
}
|
|
1408
|
+
getLanguagePartFromCode(e5) {
|
|
1409
|
+
if (e5 = V(e5), !e5 || e5.indexOf(`-`) < 0) return e5;
|
|
1410
|
+
let t2 = e5.split(`-`);
|
|
1411
|
+
return this.formatLanguageCode(t2[0]);
|
|
1412
|
+
}
|
|
1413
|
+
formatLanguageCode(e5) {
|
|
1414
|
+
if (F(e5) && e5.indexOf(`-`) > -1) {
|
|
1415
|
+
let t2;
|
|
1416
|
+
try {
|
|
1417
|
+
t2 = Intl.getCanonicalLocales(e5)[0];
|
|
1418
|
+
} catch {
|
|
1419
|
+
}
|
|
1420
|
+
return t2 && this.options.lowerCaseLng && (t2 = t2.toLowerCase()), t2 || (this.options.lowerCaseLng ? e5.toLowerCase() : e5);
|
|
1421
|
+
}
|
|
1422
|
+
return this.options.cleanCode || this.options.lowerCaseLng ? e5.toLowerCase() : e5;
|
|
1423
|
+
}
|
|
1424
|
+
isSupportedCode(e5) {
|
|
1425
|
+
return (this.options.load === `languageOnly` || this.options.nonExplicitSupportedLngs) && (e5 = this.getLanguagePartFromCode(e5)), !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.indexOf(e5) > -1;
|
|
1426
|
+
}
|
|
1427
|
+
getBestMatchFromCodes(e5) {
|
|
1428
|
+
if (!e5) return null;
|
|
1429
|
+
let t2;
|
|
1430
|
+
return e5.forEach((e6) => {
|
|
1431
|
+
if (t2) return;
|
|
1432
|
+
let n2 = this.formatLanguageCode(e6);
|
|
1433
|
+
(!this.options.supportedLngs || this.isSupportedCode(n2)) && (t2 = n2);
|
|
1434
|
+
}), !t2 && this.options.supportedLngs && e5.forEach((e6) => {
|
|
1435
|
+
if (t2) return;
|
|
1436
|
+
let n2 = this.getScriptPartFromCode(e6);
|
|
1437
|
+
if (this.isSupportedCode(n2)) return t2 = n2;
|
|
1438
|
+
let r2 = this.getLanguagePartFromCode(e6);
|
|
1439
|
+
if (this.isSupportedCode(r2)) return t2 = r2;
|
|
1440
|
+
t2 = this.options.supportedLngs.find((e7) => {
|
|
1441
|
+
if (e7 === r2 || !(e7.indexOf(`-`) < 0 && r2.indexOf(`-`) < 0) && (e7.indexOf(`-`) > 0 && r2.indexOf(`-`) < 0 && e7.substring(0, e7.indexOf(`-`)) === r2 || e7.indexOf(r2) === 0 && r2.length > 1)) return e7;
|
|
1442
|
+
});
|
|
1443
|
+
}), t2 ||= this.getFallbackCodes(this.options.fallbackLng)[0], t2;
|
|
1444
|
+
}
|
|
1445
|
+
getFallbackCodes(e5, t2) {
|
|
1446
|
+
if (!e5) return [];
|
|
1447
|
+
if (typeof e5 == `function` && (e5 = e5(t2)), F(e5) && (e5 = [e5]), Array.isArray(e5)) return e5;
|
|
1448
|
+
if (!t2) return e5.default || [];
|
|
1449
|
+
let n2 = e5[t2];
|
|
1450
|
+
return n2 ||= e5[this.getScriptPartFromCode(t2)], n2 ||= e5[this.formatLanguageCode(t2)], n2 ||= e5[this.getLanguagePartFromCode(t2)], n2 ||= e5.default, n2 || [];
|
|
1451
|
+
}
|
|
1452
|
+
toResolveHierarchy(e5, t2) {
|
|
1453
|
+
let n2 = this.getFallbackCodes((t2 === false ? [] : t2) || this.options.fallbackLng || [], e5), r2 = [], i2 = (e6) => {
|
|
1454
|
+
e6 && (this.isSupportedCode(e6) ? r2.push(e6) : this.logger.warn(`rejecting language code not found in supportedLngs: ${e6}`));
|
|
1455
|
+
};
|
|
1456
|
+
return F(e5) && (e5.indexOf(`-`) > -1 || e5.indexOf(`_`) > -1) ? (this.options.load !== `languageOnly` && i2(this.formatLanguageCode(e5)), this.options.load !== `languageOnly` && this.options.load !== `currentOnly` && i2(this.getScriptPartFromCode(e5)), this.options.load !== `currentOnly` && i2(this.getLanguagePartFromCode(e5))) : F(e5) && i2(this.formatLanguageCode(e5)), n2.forEach((e6) => {
|
|
1457
|
+
r2.indexOf(e6) < 0 && i2(this.formatLanguageCode(e6));
|
|
1458
|
+
}), r2;
|
|
1459
|
+
}
|
|
1460
|
+
};
|
|
1461
|
+
var dr = { zero: 0, one: 1, two: 2, few: 3, many: 4, other: 5 };
|
|
1462
|
+
var fr = { select: (e5) => e5 === 1 ? `one` : `other`, resolvedOptions: () => ({ pluralCategories: [`one`, `other`] }) };
|
|
1463
|
+
var pr = class {
|
|
1464
|
+
constructor(e5, t2 = {}) {
|
|
1465
|
+
this.languageUtils = e5, this.options = t2, this.logger = H.create(`pluralResolver`), this.pluralRulesCache = {};
|
|
1466
|
+
}
|
|
1467
|
+
clearCache() {
|
|
1468
|
+
this.pluralRulesCache = {};
|
|
1469
|
+
}
|
|
1470
|
+
getRule(e5, t2 = {}) {
|
|
1471
|
+
let n2 = V(e5 === `dev` ? `en` : e5), r2 = t2.ordinal ? `ordinal` : `cardinal`, i2 = JSON.stringify({ cleanedCode: n2, type: r2 });
|
|
1472
|
+
if (i2 in this.pluralRulesCache) return this.pluralRulesCache[i2];
|
|
1473
|
+
let a2;
|
|
1474
|
+
try {
|
|
1475
|
+
a2 = new Intl.PluralRules(n2, { type: r2 });
|
|
1476
|
+
} catch {
|
|
1477
|
+
if (typeof Intl > `u`) return this.logger.error(`No Intl support, please use an Intl polyfill!`), fr;
|
|
1478
|
+
if (!e5.match(/-|_/)) return fr;
|
|
1479
|
+
let n3 = this.languageUtils.getLanguagePartFromCode(e5);
|
|
1480
|
+
a2 = this.getRule(n3, t2);
|
|
1481
|
+
}
|
|
1482
|
+
return this.pluralRulesCache[i2] = a2, a2;
|
|
1483
|
+
}
|
|
1484
|
+
needsPlural(e5, t2 = {}) {
|
|
1485
|
+
let n2 = this.getRule(e5, t2);
|
|
1486
|
+
return n2 ||= this.getRule(`dev`, t2), n2?.resolvedOptions().pluralCategories.length > 1;
|
|
1487
|
+
}
|
|
1488
|
+
getPluralFormsOfKey(e5, t2, n2 = {}) {
|
|
1489
|
+
return this.getSuffixes(e5, n2).map((e6) => `${t2}${e6}`);
|
|
1490
|
+
}
|
|
1491
|
+
getSuffixes(e5, t2 = {}) {
|
|
1492
|
+
let n2 = this.getRule(e5, t2);
|
|
1493
|
+
return n2 ||= this.getRule(`dev`, t2), n2 ? n2.resolvedOptions().pluralCategories.sort((e6, t3) => dr[e6] - dr[t3]).map((e6) => `${this.options.prepend}${t2.ordinal ? `ordinal${this.options.prepend}` : ``}${e6}`) : [];
|
|
1494
|
+
}
|
|
1495
|
+
getSuffix(e5, t2, n2 = {}) {
|
|
1496
|
+
let r2 = this.getRule(e5, n2);
|
|
1497
|
+
return r2 ? `${this.options.prepend}${n2.ordinal ? `ordinal${this.options.prepend}` : ``}${r2.select(t2)}` : (this.logger.warn(`no plural rule found for: ${e5}`), this.getSuffix(`dev`, t2, n2));
|
|
1498
|
+
}
|
|
1499
|
+
};
|
|
1500
|
+
var mr = (e5, t2, n2, r2 = `.`, i2 = true) => {
|
|
1501
|
+
let a2 = Jn(e5, t2, n2);
|
|
1502
|
+
return !a2 && i2 && F(n2) && (a2 = B(e5, n2, r2), a2 === void 0 && (a2 = B(t2, n2, r2))), a2;
|
|
1503
|
+
};
|
|
1504
|
+
var hr = (e5) => e5.replace(/\$/g, `$$$$`);
|
|
1505
|
+
var gr = class {
|
|
1506
|
+
constructor(e5 = {}) {
|
|
1507
|
+
this.logger = H.create(`interpolator`), this.options = e5, this.format = e5?.interpolation?.format || ((e6) => e6), this.init(e5);
|
|
1508
|
+
}
|
|
1509
|
+
init(e5 = {}) {
|
|
1510
|
+
e5.interpolation ||= { escapeValue: true };
|
|
1511
|
+
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 } = e5.interpolation;
|
|
1512
|
+
this.escape = t2 === void 0 ? Zn : t2, this.escapeValue = n2 === void 0 || n2, this.useRawValueToEscape = r2 !== void 0 && r2, this.prefix = i2 ? z(i2) : a2 || `{{`, this.suffix = o2 ? z(o2) : s2 || `}}`, this.formatSeparator = c2 || `,`, this.unescapePrefix = l2 ? `` : u2 || `-`, this.unescapeSuffix = this.unescapePrefix ? `` : l2 || ``, this.nestingPrefix = d2 ? z(d2) : f2 || z(`$t(`), this.nestingSuffix = p2 ? z(p2) : m2 || z(`)`), this.nestingOptionsSeparator = h2 || `,`, this.maxReplaces = g2 || 1e3, this.alwaysFormat = _2 !== void 0 && _2, this.resetRegExp();
|
|
1513
|
+
}
|
|
1514
|
+
reset() {
|
|
1515
|
+
this.options && this.init(this.options);
|
|
1516
|
+
}
|
|
1517
|
+
resetRegExp() {
|
|
1518
|
+
let e5 = (e6, t2) => e6?.source === t2 ? (e6.lastIndex = 0, e6) : new RegExp(t2, `g`);
|
|
1519
|
+
this.regexp = e5(this.regexp, `${this.prefix}(.+?)${this.suffix}`), this.regexpUnescape = e5(this.regexpUnescape, `${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`), this.nestingRegexp = e5(this.nestingRegexp, `${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`);
|
|
1520
|
+
}
|
|
1521
|
+
interpolate(e5, t2, n2, r2) {
|
|
1522
|
+
let i2, a2, o2, s2 = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {}, c2 = (e6) => {
|
|
1523
|
+
if (e6.indexOf(this.formatSeparator) < 0) {
|
|
1524
|
+
let i4 = mr(t2, s2, e6, this.options.keySeparator, this.options.ignoreJSONStructure);
|
|
1525
|
+
return this.alwaysFormat ? this.format(i4, void 0, n2, { ...r2, ...t2, interpolationkey: e6 }) : i4;
|
|
1526
|
+
}
|
|
1527
|
+
let i3 = e6.split(this.formatSeparator), a3 = i3.shift().trim(), o3 = i3.join(this.formatSeparator).trim();
|
|
1528
|
+
return this.format(mr(t2, s2, a3, this.options.keySeparator, this.options.ignoreJSONStructure), o3, n2, { ...r2, ...t2, interpolationkey: a3 });
|
|
1529
|
+
};
|
|
1530
|
+
this.resetRegExp();
|
|
1531
|
+
let l2 = r2?.missingInterpolationHandler || this.options.missingInterpolationHandler, u2 = r2?.interpolation?.skipOnVariables === void 0 ? this.options.interpolation.skipOnVariables : r2.interpolation.skipOnVariables;
|
|
1532
|
+
return [{ regex: this.regexpUnescape, safeValue: (e6) => hr(e6) }, { regex: this.regexp, safeValue: (e6) => this.escapeValue ? hr(this.escape(e6)) : hr(e6) }].forEach((t3) => {
|
|
1533
|
+
for (o2 = 0; i2 = t3.regex.exec(e5); ) {
|
|
1534
|
+
let n3 = i2[1].trim();
|
|
1535
|
+
if (a2 = c2(n3), a2 === void 0) {
|
|
1536
|
+
if (typeof l2 == `function`) {
|
|
1537
|
+
let t4 = l2(e5, i2, r2);
|
|
1538
|
+
a2 = F(t4) ? t4 : ``;
|
|
1539
|
+
} else if (r2 && Object.prototype.hasOwnProperty.call(r2, n3)) a2 = ``;
|
|
1540
|
+
else if (u2) {
|
|
1541
|
+
a2 = i2[0];
|
|
1542
|
+
continue;
|
|
1543
|
+
} else this.logger.warn(`missed to pass in variable ${n3} for interpolating ${e5}`), a2 = ``;
|
|
1544
|
+
} else !F(a2) && !this.useRawValueToEscape && (a2 = Vn(a2));
|
|
1545
|
+
let s3 = t3.safeValue(a2);
|
|
1546
|
+
if (e5 = e5.replace(i2[0], s3), u2 ? (t3.regex.lastIndex += a2.length, t3.regex.lastIndex -= i2[0].length) : t3.regex.lastIndex = 0, o2++, o2 >= this.maxReplaces) break;
|
|
1547
|
+
}
|
|
1548
|
+
}), e5;
|
|
1549
|
+
}
|
|
1550
|
+
nest(e5, t2, n2 = {}) {
|
|
1551
|
+
let r2, i2, a2, o2 = (e6, t3) => {
|
|
1552
|
+
let n3 = this.nestingOptionsSeparator;
|
|
1553
|
+
if (e6.indexOf(n3) < 0) return e6;
|
|
1554
|
+
let r3 = e6.split(RegExp(`${z(n3)}[ ]*{`)), i3 = `{${r3[1]}`;
|
|
1555
|
+
e6 = r3[0], i3 = this.interpolate(i3, a2);
|
|
1556
|
+
let o3 = i3.match(/'/g), s2 = i3.match(/"/g);
|
|
1557
|
+
((o3?.length ?? 0) % 2 == 0 && !s2 || (s2?.length ?? 0) % 2 != 0) && (i3 = i3.replace(/'/g, `"`));
|
|
1558
|
+
try {
|
|
1559
|
+
a2 = JSON.parse(i3), t3 && (a2 = { ...t3, ...a2 });
|
|
1560
|
+
} catch (t4) {
|
|
1561
|
+
return this.logger.warn(`failed parsing options string in nesting for key ${e6}`, t4), `${e6}${n3}${i3}`;
|
|
1562
|
+
}
|
|
1563
|
+
return a2.defaultValue && a2.defaultValue.indexOf(this.prefix) > -1 && delete a2.defaultValue, e6;
|
|
1564
|
+
};
|
|
1565
|
+
for (; r2 = this.nestingRegexp.exec(e5); ) {
|
|
1566
|
+
let s2 = [];
|
|
1567
|
+
a2 = { ...n2 }, a2 = a2.replace && !F(a2.replace) ? a2.replace : a2, a2.applyPostProcessor = false, delete a2.defaultValue;
|
|
1568
|
+
let c2 = /{.*}/.test(r2[1]) ? r2[1].lastIndexOf(`}`) + 1 : r2[1].indexOf(this.formatSeparator);
|
|
1569
|
+
if (c2 !== -1 && (s2 = r2[1].slice(c2).split(this.formatSeparator).map((e6) => e6.trim()).filter(Boolean), r2[1] = r2[1].slice(0, c2)), i2 = t2(o2.call(this, r2[1].trim(), a2), a2), i2 && r2[0] === e5 && !F(i2)) return i2;
|
|
1570
|
+
F(i2) || (i2 = Vn(i2)), i2 ||= (this.logger.warn(`missed to resolve ${r2[1]} for nesting ${e5}`), ``), s2.length && (i2 = s2.reduce((e6, t3) => this.format(e6, t3, n2.lng, { ...n2, interpolationkey: r2[1].trim() }), i2.trim())), e5 = e5.replace(r2[0], i2), this.regexp.lastIndex = 0;
|
|
1571
|
+
}
|
|
1572
|
+
return e5;
|
|
1573
|
+
}
|
|
1574
|
+
};
|
|
1575
|
+
var _r = (e5) => {
|
|
1576
|
+
let t2 = e5.toLowerCase().trim(), n2 = {};
|
|
1577
|
+
if (e5.indexOf(`(`) > -1) {
|
|
1578
|
+
let r2 = e5.split(`(`);
|
|
1579
|
+
t2 = r2[0].toLowerCase().trim();
|
|
1580
|
+
let i2 = r2[1].substring(0, r2[1].length - 1);
|
|
1581
|
+
t2 === `currency` && i2.indexOf(`:`) < 0 ? n2.currency ||= i2.trim() : t2 === `relativetime` && i2.indexOf(`:`) < 0 ? n2.range ||= i2.trim() : i2.split(`;`).forEach((e6) => {
|
|
1582
|
+
if (e6) {
|
|
1583
|
+
let [t3, ...r3] = e6.split(`:`), i3 = r3.join(`:`).trim().replace(/^'+|'+$/g, ``), a2 = t3.trim();
|
|
1584
|
+
n2[a2] || (n2[a2] = i3), i3 === `false` && (n2[a2] = false), i3 === `true` && (n2[a2] = true), isNaN(i3) || (n2[a2] = parseInt(i3, 10));
|
|
1585
|
+
}
|
|
1586
|
+
});
|
|
1587
|
+
}
|
|
1588
|
+
return { formatName: t2, formatOptions: n2 };
|
|
1589
|
+
};
|
|
1590
|
+
var vr = (e5) => {
|
|
1591
|
+
let t2 = {};
|
|
1592
|
+
return (n2, r2, i2) => {
|
|
1593
|
+
let a2 = i2;
|
|
1594
|
+
i2 && i2.interpolationkey && i2.formatParams && i2.formatParams[i2.interpolationkey] && i2[i2.interpolationkey] && (a2 = { ...a2, [i2.interpolationkey]: void 0 });
|
|
1595
|
+
let o2 = r2 + JSON.stringify(a2), s2 = t2[o2];
|
|
1596
|
+
return s2 || (s2 = e5(V(r2), i2), t2[o2] = s2), s2(n2);
|
|
1597
|
+
};
|
|
1598
|
+
};
|
|
1599
|
+
var yr = (e5) => (t2, n2, r2) => e5(V(n2), r2)(t2);
|
|
1600
|
+
var br = class {
|
|
1601
|
+
constructor(e5 = {}) {
|
|
1602
|
+
this.logger = H.create(`formatter`), this.options = e5, this.init(e5);
|
|
1603
|
+
}
|
|
1604
|
+
init(e5, t2 = { interpolation: {} }) {
|
|
1605
|
+
this.formatSeparator = t2.interpolation.formatSeparator || `,`;
|
|
1606
|
+
let n2 = t2.cacheInBuiltFormats ? vr : yr;
|
|
1607
|
+
this.formats = { number: n2((e6, t3) => {
|
|
1608
|
+
let n3 = new Intl.NumberFormat(e6, { ...t3 });
|
|
1609
|
+
return (e7) => n3.format(e7);
|
|
1610
|
+
}), currency: n2((e6, t3) => {
|
|
1611
|
+
let n3 = new Intl.NumberFormat(e6, { ...t3, style: `currency` });
|
|
1612
|
+
return (e7) => n3.format(e7);
|
|
1613
|
+
}), datetime: n2((e6, t3) => {
|
|
1614
|
+
let n3 = new Intl.DateTimeFormat(e6, { ...t3 });
|
|
1615
|
+
return (e7) => n3.format(e7);
|
|
1616
|
+
}), relativetime: n2((e6, t3) => {
|
|
1617
|
+
let n3 = new Intl.RelativeTimeFormat(e6, { ...t3 });
|
|
1618
|
+
return (e7) => n3.format(e7, t3.range || `day`);
|
|
1619
|
+
}), list: n2((e6, t3) => {
|
|
1620
|
+
let n3 = new Intl.ListFormat(e6, { ...t3 });
|
|
1621
|
+
return (e7) => n3.format(e7);
|
|
1622
|
+
}) };
|
|
1623
|
+
}
|
|
1624
|
+
add(e5, t2) {
|
|
1625
|
+
this.formats[e5.toLowerCase().trim()] = t2;
|
|
1626
|
+
}
|
|
1627
|
+
addCached(e5, t2) {
|
|
1628
|
+
this.formats[e5.toLowerCase().trim()] = vr(t2);
|
|
1629
|
+
}
|
|
1630
|
+
format(e5, t2, n2, r2 = {}) {
|
|
1631
|
+
let i2 = t2.split(this.formatSeparator);
|
|
1632
|
+
if (i2.length > 1 && i2[0].indexOf(`(`) > 1 && i2[0].indexOf(`)`) < 0 && i2.find((e6) => e6.indexOf(`)`) > -1)) {
|
|
1633
|
+
let e6 = i2.findIndex((e7) => e7.indexOf(`)`) > -1);
|
|
1634
|
+
i2[0] = [i2[0], ...i2.splice(1, e6)].join(this.formatSeparator);
|
|
1635
|
+
}
|
|
1636
|
+
return i2.reduce((e6, t3) => {
|
|
1637
|
+
let { formatName: i3, formatOptions: a2 } = _r(t3);
|
|
1638
|
+
if (this.formats[i3]) {
|
|
1639
|
+
let t4 = e6;
|
|
1640
|
+
try {
|
|
1641
|
+
let o2 = r2?.formatParams?.[r2.interpolationkey] || {}, s2 = o2.locale || o2.lng || r2.locale || r2.lng || n2;
|
|
1642
|
+
t4 = this.formats[i3](e6, s2, { ...a2, ...r2, ...o2 });
|
|
1643
|
+
} catch (e7) {
|
|
1644
|
+
this.logger.warn(e7);
|
|
1645
|
+
}
|
|
1646
|
+
return t4;
|
|
1647
|
+
}
|
|
1648
|
+
return this.logger.warn(`there was no format function for ${i3}`), e6;
|
|
1649
|
+
}, e5);
|
|
1650
|
+
}
|
|
1651
|
+
};
|
|
1652
|
+
var xr = (e5, t2) => {
|
|
1653
|
+
e5.pending[t2] !== void 0 && (delete e5.pending[t2], e5.pendingCount--);
|
|
1654
|
+
};
|
|
1655
|
+
var Sr = class extends U {
|
|
1656
|
+
constructor(e5, t2, n2, r2 = {}) {
|
|
1657
|
+
super(), this.backend = e5, this.store = t2, this.services = n2, this.languageUtils = n2.languageUtils, this.options = r2, this.logger = H.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);
|
|
1658
|
+
}
|
|
1659
|
+
queueLoad(e5, t2, n2, r2) {
|
|
1660
|
+
let i2 = {}, a2 = {}, o2 = {}, s2 = {};
|
|
1661
|
+
return e5.forEach((e6) => {
|
|
1662
|
+
let r3 = true;
|
|
1663
|
+
t2.forEach((t3) => {
|
|
1664
|
+
let o3 = `${e6}|${t3}`;
|
|
1665
|
+
!n2.reload && this.store.hasResourceBundle(e6, 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)));
|
|
1666
|
+
}), r3 || (o2[e6] = true);
|
|
1667
|
+
}), (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) };
|
|
1668
|
+
}
|
|
1669
|
+
loaded(e5, t2, n2) {
|
|
1670
|
+
let r2 = e5.split(`|`), i2 = r2[0], a2 = r2[1];
|
|
1671
|
+
t2 && this.emit(`failedLoading`, i2, a2, t2), !t2 && n2 && this.store.addResourceBundle(i2, a2, n2, void 0, void 0, { skipCopy: true }), this.state[e5] = t2 ? -1 : 2, t2 && n2 && (this.state[e5] = 0);
|
|
1672
|
+
let o2 = {};
|
|
1673
|
+
this.queue.forEach((n3) => {
|
|
1674
|
+
qn(n3.loaded, [i2], a2), xr(n3, e5), t2 && n3.errors.push(t2), n3.pendingCount === 0 && !n3.done && (Object.keys(n3.loaded).forEach((e6) => {
|
|
1675
|
+
o2[e6] || (o2[e6] = {});
|
|
1676
|
+
let t3 = n3.loaded[e6];
|
|
1677
|
+
t3.length && t3.forEach((t4) => {
|
|
1678
|
+
o2[e6][t4] === void 0 && (o2[e6][t4] = true);
|
|
1679
|
+
});
|
|
1680
|
+
}), n3.done = true, n3.errors.length ? n3.callback(n3.errors) : n3.callback());
|
|
1681
|
+
}), this.emit(`loaded`, o2), this.queue = this.queue.filter((e6) => !e6.done);
|
|
1682
|
+
}
|
|
1683
|
+
read(e5, t2, n2, r2 = 0, i2 = this.retryTimeout, a2) {
|
|
1684
|
+
if (!e5.length) return a2(null, {});
|
|
1685
|
+
if (this.readingCalls >= this.maxParallelReads) {
|
|
1686
|
+
this.waitingReads.push({ lng: e5, ns: t2, fcName: n2, tried: r2, wait: i2, callback: a2 });
|
|
1687
|
+
return;
|
|
1688
|
+
}
|
|
1689
|
+
this.readingCalls++;
|
|
1690
|
+
let o2 = (o3, s3) => {
|
|
1691
|
+
if (this.readingCalls--, this.waitingReads.length > 0) {
|
|
1692
|
+
let e6 = this.waitingReads.shift();
|
|
1693
|
+
this.read(e6.lng, e6.ns, e6.fcName, e6.tried, e6.wait, e6.callback);
|
|
1694
|
+
}
|
|
1695
|
+
if (o3 && s3 && r2 < this.maxRetries) {
|
|
1696
|
+
setTimeout(() => {
|
|
1697
|
+
this.read.call(this, e5, t2, n2, r2 + 1, i2 * 2, a2);
|
|
1698
|
+
}, i2);
|
|
1699
|
+
return;
|
|
1700
|
+
}
|
|
1701
|
+
a2(o3, s3);
|
|
1702
|
+
}, s2 = this.backend[n2].bind(this.backend);
|
|
1703
|
+
if (s2.length === 2) {
|
|
1704
|
+
try {
|
|
1705
|
+
let n3 = s2(e5, t2);
|
|
1706
|
+
n3 && typeof n3.then == `function` ? n3.then((e6) => o2(null, e6)).catch(o2) : o2(null, n3);
|
|
1707
|
+
} catch (e6) {
|
|
1708
|
+
o2(e6);
|
|
1709
|
+
}
|
|
1710
|
+
return;
|
|
1711
|
+
}
|
|
1712
|
+
return s2(e5, t2, o2);
|
|
1713
|
+
}
|
|
1714
|
+
prepareLoading(e5, t2, n2 = {}, r2) {
|
|
1715
|
+
if (!this.backend) return this.logger.warn(`No backend was added via i18next.use. Will not load resources.`), r2 && r2();
|
|
1716
|
+
F(e5) && (e5 = this.languageUtils.toResolveHierarchy(e5)), F(t2) && (t2 = [t2]);
|
|
1717
|
+
let i2 = this.queueLoad(e5, t2, n2, r2);
|
|
1718
|
+
if (!i2.toLoad.length) return i2.pending.length || r2(), null;
|
|
1719
|
+
i2.toLoad.forEach((e6) => {
|
|
1720
|
+
this.loadOne(e6);
|
|
1721
|
+
});
|
|
1722
|
+
}
|
|
1723
|
+
load(e5, t2, n2) {
|
|
1724
|
+
this.prepareLoading(e5, t2, {}, n2);
|
|
1725
|
+
}
|
|
1726
|
+
reload(e5, t2, n2) {
|
|
1727
|
+
this.prepareLoading(e5, t2, { reload: true }, n2);
|
|
1728
|
+
}
|
|
1729
|
+
loadOne(e5, t2 = ``) {
|
|
1730
|
+
let n2 = e5.split(`|`), r2 = n2[0], i2 = n2[1];
|
|
1731
|
+
this.read(r2, i2, `read`, void 0, void 0, (n3, a2) => {
|
|
1732
|
+
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(e5, n3, a2);
|
|
1733
|
+
});
|
|
1734
|
+
}
|
|
1735
|
+
saveMissing(e5, t2, n2, r2, i2, a2 = {}, o2 = () => {
|
|
1736
|
+
}) {
|
|
1737
|
+
if (this.services?.utils?.hasLoadedNamespace && !this.services?.utils?.hasLoadedNamespace(t2)) {
|
|
1738
|
+
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!!!`);
|
|
1739
|
+
return;
|
|
1740
|
+
}
|
|
1741
|
+
if (n2 != null && n2 !== ``) {
|
|
1742
|
+
if (this.backend?.create) {
|
|
1743
|
+
let s2 = { ...a2, isUpdate: i2 }, c2 = this.backend.create.bind(this.backend);
|
|
1744
|
+
if (c2.length < 6) try {
|
|
1745
|
+
let i3;
|
|
1746
|
+
i3 = c2.length === 5 ? c2(e5, t2, n2, r2, s2) : c2(e5, t2, n2, r2), i3 && typeof i3.then == `function` ? i3.then((e6) => o2(null, e6)).catch(o2) : o2(null, i3);
|
|
1747
|
+
} catch (e6) {
|
|
1748
|
+
o2(e6);
|
|
1749
|
+
}
|
|
1750
|
+
else c2(e5, t2, n2, r2, o2, s2);
|
|
1751
|
+
}
|
|
1752
|
+
e5 && e5[0] && this.store.addResource(e5[0], t2, n2, r2);
|
|
1753
|
+
}
|
|
1754
|
+
}
|
|
1755
|
+
};
|
|
1756
|
+
var Cr = () => ({ debug: false, initAsync: true, ns: [`translation`], defaultNS: [`translation`], fallbackLng: [`dev`], fallbackNS: false, supportedLngs: false, nonExplicitSupportedLngs: false, load: `all`, preload: false, simplifyPluralSuffix: true, keySeparator: `.`, nsSeparator: `:`, pluralSeparator: `_`, contextSeparator: `_`, 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: (e5) => {
|
|
1757
|
+
let t2 = {};
|
|
1758
|
+
if (typeof e5[1] == `object` && (t2 = e5[1]), F(e5[1]) && (t2.defaultValue = e5[1]), F(e5[2]) && (t2.tDescription = e5[2]), typeof e5[2] == `object` || typeof e5[3] == `object`) {
|
|
1759
|
+
let n2 = e5[3] || e5[2];
|
|
1760
|
+
Object.keys(n2).forEach((e6) => {
|
|
1761
|
+
t2[e6] = n2[e6];
|
|
1762
|
+
});
|
|
1763
|
+
}
|
|
1764
|
+
return t2;
|
|
1765
|
+
}, interpolation: { escapeValue: true, format: (e5) => e5, prefix: `{{`, suffix: `}}`, formatSeparator: `,`, unescapePrefix: `-`, nestingPrefix: `$t(`, nestingSuffix: `)`, nestingOptionsSeparator: `,`, maxReplaces: 1e3, skipOnVariables: true }, cacheInBuiltFormats: true });
|
|
1766
|
+
var wr = (e5) => (F(e5.ns) && (e5.ns = [e5.ns]), F(e5.fallbackLng) && (e5.fallbackLng = [e5.fallbackLng]), F(e5.fallbackNS) && (e5.fallbackNS = [e5.fallbackNS]), e5.supportedLngs?.indexOf?.(`cimode`) < 0 && (e5.supportedLngs = e5.supportedLngs.concat([`cimode`])), typeof e5.initImmediate == `boolean` && (e5.initAsync = e5.initImmediate), e5);
|
|
1767
|
+
var G = () => {
|
|
1768
|
+
};
|
|
1769
|
+
var Tr = (e5) => {
|
|
1770
|
+
Object.getOwnPropertyNames(Object.getPrototypeOf(e5)).forEach((t2) => {
|
|
1771
|
+
typeof e5[t2] == `function` && (e5[t2] = e5[t2].bind(e5));
|
|
1772
|
+
});
|
|
1773
|
+
};
|
|
1774
|
+
var Er = `__i18next_supportNoticeShown`;
|
|
1775
|
+
var Dr = () => !!(typeof globalThis < `u` && globalThis[Er] || typeof process < `u` && {}.I18NEXT_NO_SUPPORT_NOTICE || typeof process < `u`);
|
|
1776
|
+
var Or = () => {
|
|
1777
|
+
typeof globalThis < `u` && (globalThis[Er] = true);
|
|
1778
|
+
};
|
|
1779
|
+
var kr = (e5) => !!(e5?.modules?.backend?.name?.indexOf(`Locize`) > 0 || e5?.modules?.backend?.constructor?.name?.indexOf(`Locize`) > 0 || e5?.options?.backend?.backends && e5.options.backend.backends.some((e6) => e6?.name?.indexOf(`Locize`) > 0 || e6?.constructor?.name?.indexOf(`Locize`) > 0) || e5?.options?.backend?.projectId || e5?.options?.backend?.backendOptions && e5.options.backend.backendOptions.some((e6) => e6?.projectId));
|
|
1780
|
+
var K = class e4 extends U {
|
|
1781
|
+
constructor(e5 = {}, t2) {
|
|
1782
|
+
if (super(), this.options = wr(e5), this.services = {}, this.logger = H, this.modules = { external: [] }, Tr(this), t2 && !this.isInitialized && !e5.isClone) {
|
|
1783
|
+
if (!this.options.initAsync) return this.init(e5, t2), this;
|
|
1784
|
+
setTimeout(() => {
|
|
1785
|
+
this.init(e5, t2);
|
|
1786
|
+
}, 0);
|
|
1787
|
+
}
|
|
1788
|
+
}
|
|
1789
|
+
init(e5 = {}, t2) {
|
|
1790
|
+
this.isInitializing = true, typeof e5 == `function` && (t2 = e5, e5 = {}), e5.defaultNS == null && e5.ns && (F(e5.ns) ? e5.defaultNS = e5.ns : e5.ns.indexOf(`translation`) < 0 && (e5.defaultNS = e5.ns[0]));
|
|
1791
|
+
let n2 = Cr();
|
|
1792
|
+
this.options = { ...n2, ...this.options, ...wr(e5) }, this.options.interpolation = { ...n2.interpolation, ...this.options.interpolation }, e5.keySeparator !== void 0 && (this.options.userDefinedKeySeparator = e5.keySeparator), e5.nsSeparator !== void 0 && (this.options.userDefinedNsSeparator = e5.nsSeparator), typeof this.options.overloadTranslationOptionHandler != `function` && (this.options.overloadTranslationOptionHandler = n2.overloadTranslationOptionHandler), this.options.showSupportNotice !== false && !kr(this) && !Dr() && (typeof console < `u` && console.info !== void 0 && console.info(`\u{1F310} i18next is made possible by our own product, Locize \u2014 consider powering your project with managed localization (AI, CDN, integrations): https://locize.com \u{1F499}`), Or());
|
|
1793
|
+
let r2 = (e6) => e6 ? typeof e6 == `function` ? new e6() : e6 : null;
|
|
1794
|
+
if (!this.options.isClone) {
|
|
1795
|
+
this.modules.logger ? H.init(r2(this.modules.logger), this.options) : H.init(null, this.options);
|
|
1796
|
+
let e6;
|
|
1797
|
+
e6 = this.modules.formatter ? this.modules.formatter : br;
|
|
1798
|
+
let t3 = new ur(this.options);
|
|
1799
|
+
this.store = new rr(this.options.resources, this.options);
|
|
1800
|
+
let i3 = this.services;
|
|
1801
|
+
i3.logger = H, i3.resourceStore = this.store, i3.languageUtils = t3, i3.pluralResolver = new pr(t3, { prepend: this.options.pluralSeparator, simplifyPluralSuffix: this.options.simplifyPluralSuffix }), this.options.interpolation.format && this.options.interpolation.format !== n2.interpolation.format && this.logger.deprecate(`init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting`), e6 && (!this.options.interpolation.format || this.options.interpolation.format === n2.interpolation.format) && (i3.formatter = r2(e6), i3.formatter.init && i3.formatter.init(i3, this.options), this.options.interpolation.format = i3.formatter.format.bind(i3.formatter)), i3.interpolator = new gr(this.options), i3.utils = { hasLoadedNamespace: this.hasLoadedNamespace.bind(this) }, i3.backendConnector = new Sr(r2(this.modules.backend), i3.resourceStore, i3, this.options), i3.backendConnector.on(`*`, (e7, ...t4) => {
|
|
1802
|
+
this.emit(e7, ...t4);
|
|
1803
|
+
}), this.modules.languageDetector && (i3.languageDetector = r2(this.modules.languageDetector), i3.languageDetector.init && i3.languageDetector.init(i3, this.options.detection, this.options)), this.modules.i18nFormat && (i3.i18nFormat = r2(this.modules.i18nFormat), i3.i18nFormat.init && i3.i18nFormat.init(this)), this.translator = new lr(this.services, this.options), this.translator.on(`*`, (e7, ...t4) => {
|
|
1804
|
+
this.emit(e7, ...t4);
|
|
1805
|
+
}), this.modules.external.forEach((e7) => {
|
|
1806
|
+
e7.init && e7.init(this);
|
|
1807
|
+
});
|
|
1808
|
+
}
|
|
1809
|
+
if (this.format = this.options.interpolation.format, t2 ||= G, this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
|
|
1810
|
+
let e6 = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
|
|
1811
|
+
e6.length > 0 && e6[0] !== `dev` && (this.options.lng = e6[0]);
|
|
1812
|
+
}
|
|
1813
|
+
!this.services.languageDetector && !this.options.lng && this.logger.warn(`init: no languageDetector is used and no lng is defined`), [`getResource`, `hasResourceBundle`, `getResourceBundle`, `getDataByLanguage`].forEach((e6) => {
|
|
1814
|
+
this[e6] = (...t3) => this.store[e6](...t3);
|
|
1815
|
+
}), [`addResource`, `addResources`, `addResourceBundle`, `removeResourceBundle`].forEach((e6) => {
|
|
1816
|
+
this[e6] = (...t3) => (this.store[e6](...t3), this);
|
|
1817
|
+
});
|
|
1818
|
+
let i2 = I(), a2 = () => {
|
|
1819
|
+
let e6 = (e7, n3) => {
|
|
1820
|
+
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(e7, n3);
|
|
1821
|
+
};
|
|
1822
|
+
if (this.languages && !this.isInitialized) return e6(null, this.t.bind(this));
|
|
1823
|
+
this.changeLanguage(this.options.lng, e6);
|
|
1824
|
+
};
|
|
1825
|
+
return this.options.resources || !this.options.initAsync ? a2() : setTimeout(a2, 0), i2;
|
|
1826
|
+
}
|
|
1827
|
+
loadResources(e5, t2 = G) {
|
|
1828
|
+
let n2 = t2, r2 = F(e5) ? e5 : this.language;
|
|
1829
|
+
if (typeof e5 == `function` && (n2 = e5), !this.options.resources || this.options.partialBundledLanguages) {
|
|
1830
|
+
if (r2?.toLowerCase() === `cimode` && (!this.options.preload || this.options.preload.length === 0)) return n2();
|
|
1831
|
+
let e6 = [], t3 = (t4) => {
|
|
1832
|
+
t4 && t4 !== `cimode` && this.services.languageUtils.toResolveHierarchy(t4).forEach((t5) => {
|
|
1833
|
+
t5 !== `cimode` && e6.indexOf(t5) < 0 && e6.push(t5);
|
|
1834
|
+
});
|
|
1835
|
+
};
|
|
1836
|
+
r2 ? t3(r2) : this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach((e7) => t3(e7)), this.options.preload?.forEach?.((e7) => t3(e7)), this.services.backendConnector.load(e6, this.options.ns, (e7) => {
|
|
1837
|
+
!e7 && !this.resolvedLanguage && this.language && this.setResolvedLanguage(this.language), n2(e7);
|
|
1838
|
+
});
|
|
1839
|
+
} else n2(null);
|
|
1840
|
+
}
|
|
1841
|
+
reloadResources(e5, t2, n2) {
|
|
1842
|
+
let r2 = I();
|
|
1843
|
+
return typeof e5 == `function` && (n2 = e5, e5 = void 0), typeof t2 == `function` && (n2 = t2, t2 = void 0), e5 ||= this.languages, t2 ||= this.options.ns, n2 ||= G, this.services.backendConnector.reload(e5, t2, (e6) => {
|
|
1844
|
+
r2.resolve(), n2(e6);
|
|
1845
|
+
}), r2;
|
|
1846
|
+
}
|
|
1847
|
+
use(e5) {
|
|
1848
|
+
if (!e5) throw Error(`You are passing an undefined module! Please check the object you are passing to i18next.use()`);
|
|
1849
|
+
if (!e5.type) throw Error(`You are passing a wrong module! Please check the object you are passing to i18next.use()`);
|
|
1850
|
+
return e5.type === `backend` && (this.modules.backend = e5), (e5.type === `logger` || e5.log && e5.warn && e5.error) && (this.modules.logger = e5), e5.type === `languageDetector` && (this.modules.languageDetector = e5), e5.type === `i18nFormat` && (this.modules.i18nFormat = e5), e5.type === `postProcessor` && ir.addPostProcessor(e5), e5.type === `formatter` && (this.modules.formatter = e5), e5.type === `3rdParty` && this.modules.external.push(e5), this;
|
|
1851
|
+
}
|
|
1852
|
+
setResolvedLanguage(e5) {
|
|
1853
|
+
if (e5 && this.languages && !([`cimode`, `dev`].indexOf(e5) > -1)) {
|
|
1854
|
+
for (let e6 = 0; e6 < this.languages.length; e6++) {
|
|
1855
|
+
let t2 = this.languages[e6];
|
|
1856
|
+
if (!([`cimode`, `dev`].indexOf(t2) > -1) && this.store.hasLanguageSomeTranslations(t2)) {
|
|
1857
|
+
this.resolvedLanguage = t2;
|
|
1858
|
+
break;
|
|
1859
|
+
}
|
|
1860
|
+
}
|
|
1861
|
+
!this.resolvedLanguage && this.languages.indexOf(e5) < 0 && this.store.hasLanguageSomeTranslations(e5) && (this.resolvedLanguage = e5, this.languages.unshift(e5));
|
|
1862
|
+
}
|
|
1863
|
+
}
|
|
1864
|
+
changeLanguage(e5, t2) {
|
|
1865
|
+
this.isLanguageChangingTo = e5;
|
|
1866
|
+
let n2 = I();
|
|
1867
|
+
this.emit(`languageChanging`, e5);
|
|
1868
|
+
let r2 = (e6) => {
|
|
1869
|
+
this.language = e6, this.languages = this.services.languageUtils.toResolveHierarchy(e6), this.resolvedLanguage = void 0, this.setResolvedLanguage(e6);
|
|
1870
|
+
}, i2 = (i3, a3) => {
|
|
1871
|
+
a3 ? this.isLanguageChangingTo === e5 && (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((...e6) => this.t(...e6)), t2 && t2(i3, (...e6) => this.t(...e6));
|
|
1872
|
+
}, a2 = (t3) => {
|
|
1873
|
+
!e5 && !t3 && this.services.languageDetector && (t3 = []);
|
|
1874
|
+
let n3 = F(t3) ? t3 : t3 && t3[0], a3 = this.store.hasLanguageSomeTranslations(n3) ? n3 : this.services.languageUtils.getBestMatchFromCodes(F(t3) ? [t3] : t3);
|
|
1875
|
+
a3 && (this.language || r2(a3), this.translator.language || this.translator.changeLanguage(a3), this.services.languageDetector?.cacheUserLanguage?.(a3)), this.loadResources(a3, (e6) => {
|
|
1876
|
+
i2(e6, a3);
|
|
1877
|
+
});
|
|
1878
|
+
};
|
|
1879
|
+
return !e5 && this.services.languageDetector && !this.services.languageDetector.async ? a2(this.services.languageDetector.detect()) : !e5 && 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(e5), n2;
|
|
1880
|
+
}
|
|
1881
|
+
getFixedT(e5, t2, n2) {
|
|
1882
|
+
let r2 = (e6, t3, ...i2) => {
|
|
1883
|
+
let a2;
|
|
1884
|
+
a2 = typeof t3 == `object` ? { ...t3 } : this.options.overloadTranslationOptionHandler([e6, t3].concat(i2)), a2.lng = a2.lng || r2.lng, a2.lngs = a2.lngs || r2.lngs, a2.ns = a2.ns || r2.ns, a2.keyPrefix !== `` && (a2.keyPrefix = a2.keyPrefix || n2 || r2.keyPrefix);
|
|
1885
|
+
let o2 = { ...this.options, ...a2 };
|
|
1886
|
+
typeof a2.keyPrefix == `function` && (a2.keyPrefix = W(a2.keyPrefix, o2));
|
|
1887
|
+
let s2 = this.options.keySeparator || `.`, c2;
|
|
1888
|
+
return a2.keyPrefix && Array.isArray(e6) ? c2 = e6.map((e7) => (typeof e7 == `function` && (e7 = W(e7, o2)), `${a2.keyPrefix}${s2}${e7}`)) : (typeof e6 == `function` && (e6 = W(e6, o2)), c2 = a2.keyPrefix ? `${a2.keyPrefix}${s2}${e6}` : e6), this.t(c2, a2);
|
|
1889
|
+
};
|
|
1890
|
+
return F(e5) ? r2.lng = e5 : r2.lngs = e5, r2.ns = t2, r2.keyPrefix = n2, r2;
|
|
1891
|
+
}
|
|
1892
|
+
t(...e5) {
|
|
1893
|
+
return this.translator?.translate(...e5);
|
|
1894
|
+
}
|
|
1895
|
+
exists(...e5) {
|
|
1896
|
+
return this.translator?.exists(...e5);
|
|
1897
|
+
}
|
|
1898
|
+
setDefaultNamespace(e5) {
|
|
1899
|
+
this.options.defaultNS = e5;
|
|
1900
|
+
}
|
|
1901
|
+
hasLoadedNamespace(e5, t2 = {}) {
|
|
1902
|
+
if (!this.isInitialized) return this.logger.warn(`hasLoadedNamespace: i18next was not initialized`, this.languages), false;
|
|
1903
|
+
if (!this.languages || !this.languages.length) return this.logger.warn(`hasLoadedNamespace: i18n.languages were undefined or empty`, this.languages), false;
|
|
1904
|
+
let n2 = t2.lng || this.resolvedLanguage || this.languages[0], r2 = this.options ? this.options.fallbackLng : false, i2 = this.languages[this.languages.length - 1];
|
|
1905
|
+
if (n2.toLowerCase() === `cimode`) return true;
|
|
1906
|
+
let a2 = (e6, t3) => {
|
|
1907
|
+
let n3 = this.services.backendConnector.state[`${e6}|${t3}`];
|
|
1908
|
+
return n3 === -1 || n3 === 0 || n3 === 2;
|
|
1909
|
+
};
|
|
1910
|
+
if (t2.precheck) {
|
|
1911
|
+
let e6 = t2.precheck(this, a2);
|
|
1912
|
+
if (e6 !== void 0) return e6;
|
|
1913
|
+
}
|
|
1914
|
+
return !!(this.hasResourceBundle(n2, e5) || !this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages || a2(n2, e5) && (!r2 || a2(i2, e5)));
|
|
1915
|
+
}
|
|
1916
|
+
loadNamespaces(e5, t2) {
|
|
1917
|
+
let n2 = I();
|
|
1918
|
+
return this.options.ns ? (F(e5) && (e5 = [e5]), e5.forEach((e6) => {
|
|
1919
|
+
this.options.ns.indexOf(e6) < 0 && this.options.ns.push(e6);
|
|
1920
|
+
}), this.loadResources((e6) => {
|
|
1921
|
+
n2.resolve(), t2 && t2(e6);
|
|
1922
|
+
}), n2) : (t2 && t2(), Promise.resolve());
|
|
1923
|
+
}
|
|
1924
|
+
loadLanguages(e5, t2) {
|
|
1925
|
+
let n2 = I();
|
|
1926
|
+
F(e5) && (e5 = [e5]);
|
|
1927
|
+
let r2 = this.options.preload || [], i2 = e5.filter((e6) => r2.indexOf(e6) < 0 && this.services.languageUtils.isSupportedCode(e6));
|
|
1928
|
+
return i2.length ? (this.options.preload = r2.concat(i2), this.loadResources((e6) => {
|
|
1929
|
+
n2.resolve(), t2 && t2(e6);
|
|
1930
|
+
}), n2) : (t2 && t2(), Promise.resolve());
|
|
1931
|
+
}
|
|
1932
|
+
dir(e5) {
|
|
1933
|
+
if (e5 ||= this.resolvedLanguage || (this.languages?.length > 0 ? this.languages[0] : this.language), !e5) return `rtl`;
|
|
1934
|
+
try {
|
|
1935
|
+
let t3 = new Intl.Locale(e5);
|
|
1936
|
+
if (t3 && t3.getTextInfo) {
|
|
1937
|
+
let e6 = t3.getTextInfo();
|
|
1938
|
+
if (e6 && e6.direction) return e6.direction;
|
|
1939
|
+
}
|
|
1940
|
+
} catch {
|
|
1941
|
+
}
|
|
1942
|
+
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 ur(Cr());
|
|
1943
|
+
return e5.toLowerCase().indexOf(`-latn`) > 1 ? `ltr` : t2.indexOf(n2.getLanguagePartFromCode(e5)) > -1 || e5.toLowerCase().indexOf(`-arab`) > 1 ? `rtl` : `ltr`;
|
|
1944
|
+
}
|
|
1945
|
+
static createInstance(t2 = {}, n2) {
|
|
1946
|
+
let r2 = new e4(t2, n2);
|
|
1947
|
+
return r2.createInstance = e4.createInstance, r2;
|
|
1948
|
+
}
|
|
1949
|
+
cloneInstance(t2 = {}, n2 = G) {
|
|
1950
|
+
let r2 = t2.forkResourceStore;
|
|
1951
|
+
r2 && delete t2.forkResourceStore;
|
|
1952
|
+
let i2 = { ...this.options, ...t2, isClone: true }, a2 = new e4(i2);
|
|
1953
|
+
if ((t2.debug !== void 0 || t2.prefix !== void 0) && (a2.logger = a2.logger.clone(t2)), [`store`, `services`, `language`].forEach((e5) => {
|
|
1954
|
+
a2[e5] = this[e5];
|
|
1955
|
+
}), a2.services = { ...this.services }, a2.services.utils = { hasLoadedNamespace: a2.hasLoadedNamespace.bind(a2) }, r2 && (a2.store = new rr(Object.keys(this.store.data).reduce((e5, t3) => (e5[t3] = { ...this.store.data[t3] }, e5[t3] = Object.keys(e5[t3]).reduce((n3, r3) => (n3[r3] = { ...e5[t3][r3] }, n3), e5[t3]), e5), {}), i2), a2.services.resourceStore = a2.store), t2.interpolation) {
|
|
1956
|
+
let e5 = { ...Cr().interpolation, ...this.options.interpolation, ...t2.interpolation }, n3 = { ...i2, interpolation: e5 };
|
|
1957
|
+
a2.services.interpolator = new gr(n3);
|
|
1958
|
+
}
|
|
1959
|
+
return a2.translator = new lr(a2.services, i2), a2.translator.on(`*`, (e5, ...t3) => {
|
|
1960
|
+
a2.emit(e5, ...t3);
|
|
1961
|
+
}), a2.init(i2, n2), a2.translator.options = i2, a2.translator.backendConnector.services.utils = { hasLoadedNamespace: a2.hasLoadedNamespace.bind(a2) }, a2;
|
|
1962
|
+
}
|
|
1963
|
+
toJSON() {
|
|
1964
|
+
return { options: this.options, store: this.store, language: this.language, languages: this.languages, resolvedLanguage: this.resolvedLanguage };
|
|
1965
|
+
}
|
|
1966
|
+
}.createInstance();
|
|
1967
|
+
K.createInstance, K.dir, K.init, K.loadResources, K.reloadResources, K.use, K.changeLanguage, K.getFixedT, K.t, K.exists, K.setDefaultNamespace, K.hasLoadedNamespace, K.loadNamespaces, K.loadLanguages;
|
|
1968
|
+
var Ar = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g;
|
|
1969
|
+
var jr = { "&": `&`, "&": `&`, "<": `<`, "<": `<`, ">": `>`, ">": `>`, "'": `'`, "'": `'`, """: `"`, """: `"`, " ": ` `, " ": ` `, "©": `\xA9`, "©": `\xA9`, "®": `\xAE`, "®": `\xAE`, "…": `\u2026`, "…": `\u2026`, "/": `/`, "/": `/` };
|
|
1970
|
+
var Mr = (e5) => jr[e5];
|
|
1971
|
+
var Nr = { bindI18n: `languageChanged`, bindI18nStore: ``, transEmptyNodeValue: ``, transSupportBasicHtmlNodes: true, transWrapTextNodes: ``, transKeepBasicHtmlNodesFor: [`br`, `strong`, `i`, `p`], useSuspense: true, unescape: (e5) => e5.replace(Ar, Mr), transDefaultProps: void 0 };
|
|
1972
|
+
var Pr = (e5 = {}) => {
|
|
1973
|
+
Nr = { ...Nr, ...e5 };
|
|
1974
|
+
};
|
|
1975
|
+
var Fr = { type: `3rdParty`, init(e5) {
|
|
1976
|
+
Pr(e5.options.react);
|
|
1977
|
+
} };
|
|
1978
|
+
var q = /* @__PURE__ */ new Map();
|
|
1979
|
+
var Ir = 500;
|
|
1980
|
+
var J;
|
|
1981
|
+
function Lr() {
|
|
1982
|
+
if (J === void 0) try {
|
|
1983
|
+
J = new Intl.NumberFormat(`en-US`, { useGrouping: false, maximumFractionDigits: 0 }).format(`9007199254740993`) === `9007199254740993`;
|
|
1984
|
+
} catch {
|
|
1985
|
+
J = false;
|
|
1986
|
+
}
|
|
1987
|
+
return J;
|
|
1988
|
+
}
|
|
1989
|
+
var Rr = 15;
|
|
1990
|
+
function zr(e5) {
|
|
1991
|
+
if (!(typeof e5 != `string` || Lr()) && e5.replace(/[^0-9]/g, ``).replace(/^0+/, ``).length > Rr) throw Error(`Cannot format the amount '${e5}' exactly: this runtime's Intl implementation predates ES2023 string support and would lose precision. Use a runtime with ES2023 Intl support (for example Node 20+), or pass a value within 15 significant digits.`);
|
|
1992
|
+
}
|
|
1993
|
+
function Br(e5, t2, n2) {
|
|
1994
|
+
return `${e5}|${t2}|${Object.entries(n2).filter(([, e6]) => e6 !== void 0).sort(([e6], [t3]) => e6 < t3 ? -1 : 1).map(([e6, t3]) => `${e6}=${String(t3)}`).join(`&`)}`;
|
|
1995
|
+
}
|
|
1996
|
+
function Vr(e5, t2, n2) {
|
|
1997
|
+
let r2 = Br(e5, t2, n2), i2 = q.get(r2);
|
|
1998
|
+
return i2 || (i2 = new Intl.NumberFormat(e5, { ...n2, style: `currency`, currency: t2 }), q.size >= Ir && q.clear(), q.set(r2, i2)), i2;
|
|
1999
|
+
}
|
|
2000
|
+
function Hr(e5, { value: t2, currency: n2 }, r2 = {}) {
|
|
2001
|
+
return zr(t2), Vr(e5, n2, r2).format(t2);
|
|
2002
|
+
}
|
|
2003
|
+
function Ur(e5, { value: t2, currency: n2 }, r2 = {}) {
|
|
2004
|
+
return zr(t2), Vr(e5, n2, r2).formatToParts(t2);
|
|
914
2005
|
}
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
2006
|
+
function Wr(e5) {
|
|
2007
|
+
return sn().find((e6) => e6.primary)?.id ?? e5;
|
|
2008
|
+
}
|
|
2009
|
+
function Gr(e5, t2) {
|
|
2010
|
+
let { locale: n2, ...r2 } = t2 ?? {}, i2 = n2 ?? e5.essentials?.locale;
|
|
2011
|
+
if (!i2) throw Error(`Host locale is not available on the current host. Make sure to use an updated version of the host initialization package.`);
|
|
2012
|
+
return { locale: i2, formatOptions: r2 };
|
|
2013
|
+
}
|
|
2014
|
+
var Kr = Bn({ getLanguage: (e5) => () => {
|
|
2015
|
+
let t2 = e5.essentials?.language;
|
|
2016
|
+
if (!t2) throw Error(`Host language is not available on the current host. Make sure to use an updated version of the host initialization package.`);
|
|
2017
|
+
return t2;
|
|
2018
|
+
}, getLocale: (e5) => () => {
|
|
2019
|
+
let t2 = e5.essentials?.locale;
|
|
2020
|
+
if (!t2) throw Error(`Host locale is not available on the current host. Make sure to use an updated version of the host initialization package.`);
|
|
2021
|
+
return t2;
|
|
2022
|
+
}, formatCurrency: (e5) => (t2, n2) => {
|
|
2023
|
+
let { locale: r2, formatOptions: i2 } = Gr(e5, n2);
|
|
2024
|
+
return Hr(r2, t2, i2);
|
|
2025
|
+
}, formatCurrencyToParts: (e5) => (t2, n2) => {
|
|
2026
|
+
let { locale: r2, formatOptions: i2 } = Gr(e5, n2);
|
|
2027
|
+
return Ur(r2, t2, i2);
|
|
2028
|
+
}, getTranslationFunction: (e5) => () => {
|
|
2029
|
+
let t2 = e5.translations?.();
|
|
2030
|
+
if (!t2) throw Error(`Host translation resources are not available.`);
|
|
2031
|
+
let n2 = K.createInstance(), r2 = Wr(e5.essentials?.language) || `en`, i2 = { lng: e5.essentials?.language || r2, fallbackLng: r2, resources: t2 };
|
|
2032
|
+
return n2.use(Fr).init(i2, (e6) => {
|
|
2033
|
+
if (e6) throw e6;
|
|
2034
|
+
}), n2.t.bind(n2);
|
|
2035
|
+
} });
|
|
2036
|
+
var qr = class {
|
|
2037
|
+
constructor(e5) {
|
|
2038
|
+
this.message = e5, this.captureException = () => {
|
|
918
2039
|
console.error(this.message);
|
|
919
2040
|
}, this.captureMessage = () => {
|
|
920
2041
|
console.error(this.message);
|
|
921
|
-
}, this.startSpan = (
|
|
2042
|
+
}, this.startSpan = (e6, t2) => (console.error(this.message), t2(void 0)), this.startSpanManual = () => (console.error(this.message), { end: () => {
|
|
922
2043
|
}, fail: () => {
|
|
923
2044
|
} }), this.endSpanManual = () => {
|
|
924
2045
|
console.error(this.message);
|
|
@@ -927,364 +2048,385 @@ var _n = class {
|
|
|
927
2048
|
};
|
|
928
2049
|
}
|
|
929
2050
|
};
|
|
930
|
-
var
|
|
931
|
-
var
|
|
932
|
-
var
|
|
933
|
-
function
|
|
2051
|
+
var Jr = (e5) => new qr(e5);
|
|
2052
|
+
var Yr = Bn({ getMonitoringClient: (e5) => () => e5.getMonitoringClient ? e5.getMonitoringClient() : Jr(`Host monitoring client is not available on the current host. Make sure to use an updated version of the host initialization package.`) });
|
|
2053
|
+
var Y = { service: `service`, services: `services`, categories: `categories`, locations: `locations`, sessions: `sessions`, timeSlots: `time-slots`, serviceAddOns: `service-addons`, bookingsSettings: `bookings-settings`, serviceCta: `service-cta`, preferences: `preferences`, bookingSummary: `booking-summary`, bookingCheckout: `booking-checkout`, formValues: `form-values`, paymentOptions: `payment-options`, seo: `seo`, warmup: `warmup`, reschedule: `reschedule` };
|
|
2054
|
+
function Xr(e5) {
|
|
934
2055
|
try {
|
|
935
|
-
let t2 =
|
|
936
|
-
return t2 && typeof t2[
|
|
2056
|
+
let t2 = Yr.getMonitoringClient?.();
|
|
2057
|
+
return t2 && typeof t2[e5] == `function` ? t2 : null;
|
|
937
2058
|
} catch {
|
|
938
2059
|
return null;
|
|
939
2060
|
}
|
|
940
2061
|
}
|
|
941
|
-
function
|
|
942
|
-
let a2 =
|
|
2062
|
+
function Zr(e5, { feature: t2, action: n2, level: r2 = `error`, contexts: i2 }) {
|
|
2063
|
+
let a2 = Xr(`captureException`);
|
|
943
2064
|
if (!a2) return;
|
|
944
|
-
let o2 =
|
|
2065
|
+
let o2 = e5 instanceof Error ? e5 : Error(String(e5));
|
|
945
2066
|
a2.captureException(o2, { level: r2, tags: { feature: t2, action: n2 }, ...i2 ? { contexts: i2 } : {} });
|
|
946
2067
|
}
|
|
947
|
-
function
|
|
948
|
-
let i2 =
|
|
2068
|
+
function Qr(e5, { feature: t2, tags: n2 }, r2) {
|
|
2069
|
+
let i2 = Xr(`startSpanManual`);
|
|
949
2070
|
if (!i2) return r2;
|
|
950
|
-
let a2 = i2.startSpanManual({ name:
|
|
951
|
-
return r2.then(() => a2.end(), (
|
|
2071
|
+
let a2 = i2.startSpanManual({ name: e5, tags: { feature: t2, ...n2 } });
|
|
2072
|
+
return r2.then(() => a2.end(), (e6) => a2.fail(e6)), r2;
|
|
952
2073
|
}
|
|
953
|
-
var
|
|
2074
|
+
var $r = class extends e {
|
|
954
2075
|
state = { hasError: false };
|
|
955
2076
|
static getDerivedStateFromError() {
|
|
956
2077
|
return { hasError: true };
|
|
957
2078
|
}
|
|
958
|
-
componentDidCatch(
|
|
959
|
-
|
|
2079
|
+
componentDidCatch(e5, t2) {
|
|
2080
|
+
Zr(e5, { feature: this.props.feature ?? `service`, action: `render`, contexts: { react: { componentStack: t2.componentStack } } });
|
|
960
2081
|
}
|
|
961
2082
|
render() {
|
|
962
2083
|
return this.state.hasError ? this.props.fallback : this.props.children;
|
|
963
2084
|
}
|
|
964
2085
|
};
|
|
965
|
-
function
|
|
966
|
-
let t2 =
|
|
967
|
-
if (t2.__state || (t2.__state = { status: `pending` }, t2.then((
|
|
968
|
-
t2.__state = { status: `fulfilled`, value:
|
|
969
|
-
}, (
|
|
970
|
-
t2.__state = { status: `rejected`, reason:
|
|
2086
|
+
function ei(e5) {
|
|
2087
|
+
let t2 = e5;
|
|
2088
|
+
if (t2.__state || (t2.__state = { status: `pending` }, t2.then((e6) => {
|
|
2089
|
+
t2.__state = { status: `fulfilled`, value: e6 };
|
|
2090
|
+
}, (e6) => {
|
|
2091
|
+
t2.__state = { status: `rejected`, reason: e6 };
|
|
971
2092
|
})), t2.__state.status === `fulfilled`) return t2.__state.value;
|
|
972
2093
|
throw t2.__state.status === `rejected` ? t2.__state.reason : t2;
|
|
973
2094
|
}
|
|
974
|
-
function
|
|
975
|
-
let t2 = Promise.resolve(
|
|
976
|
-
return t2.__state = { status: `fulfilled`, value:
|
|
2095
|
+
function X(e5) {
|
|
2096
|
+
let t2 = Promise.resolve(e5);
|
|
2097
|
+
return t2.__state = { status: `fulfilled`, value: e5 }, t2;
|
|
977
2098
|
}
|
|
978
|
-
var
|
|
979
|
-
function
|
|
980
|
-
let r2 =
|
|
981
|
-
r2 || (r2 = /* @__PURE__ */ new WeakMap(),
|
|
2099
|
+
var ti = /* @__PURE__ */ new WeakMap();
|
|
2100
|
+
function ni(e5, t2, n2) {
|
|
2101
|
+
let r2 = ti.get(e5);
|
|
2102
|
+
r2 || (r2 = /* @__PURE__ */ new WeakMap(), ti.set(e5, r2));
|
|
982
2103
|
let i2 = r2.get(t2);
|
|
983
2104
|
i2 || (i2 = /* @__PURE__ */ new WeakMap(), r2.set(t2, i2));
|
|
984
2105
|
let a2 = i2.get(n2);
|
|
985
2106
|
if (!a2) {
|
|
986
|
-
let r3 =
|
|
987
|
-
a2 = r3.__state?.status === `fulfilled` ?
|
|
2107
|
+
let r3 = e5;
|
|
2108
|
+
a2 = r3.__state?.status === `fulfilled` ? X(t2(r3.__state.value)) : r3.__state?.status === `rejected` ? X(n2(r3.__state.reason)) : e5.then(t2, n2), i2.set(n2, a2);
|
|
988
2109
|
}
|
|
989
2110
|
return a2;
|
|
990
2111
|
}
|
|
991
|
-
function
|
|
992
|
-
return
|
|
2112
|
+
function Z(e5) {
|
|
2113
|
+
return e5;
|
|
993
2114
|
}
|
|
994
|
-
var
|
|
995
|
-
function
|
|
2115
|
+
var ri = Z(`@wix/site-service-warmup-data`);
|
|
2116
|
+
function ii() {
|
|
996
2117
|
try {
|
|
997
2118
|
return u();
|
|
998
2119
|
} catch {
|
|
999
2120
|
return null;
|
|
1000
2121
|
}
|
|
1001
2122
|
}
|
|
1002
|
-
function
|
|
2123
|
+
function ai(e5) {
|
|
1003
2124
|
try {
|
|
1004
|
-
return
|
|
2125
|
+
return e5 ? e5(ri) : null;
|
|
1005
2126
|
} catch {
|
|
1006
2127
|
return null;
|
|
1007
2128
|
}
|
|
1008
2129
|
}
|
|
1009
|
-
function
|
|
1010
|
-
let
|
|
1011
|
-
return { scope:
|
|
1012
|
-
if (t2 || !
|
|
2130
|
+
function oi() {
|
|
2131
|
+
let e5 = ai(ii()), t2 = typeof window > `u`;
|
|
2132
|
+
return { scope: e5 ?? void 0, get: async (n2) => {
|
|
2133
|
+
if (t2 || !e5) return null;
|
|
1013
2134
|
try {
|
|
1014
|
-
return await
|
|
1015
|
-
} catch (
|
|
1016
|
-
return
|
|
2135
|
+
return await e5.get(n2);
|
|
2136
|
+
} catch (e6) {
|
|
2137
|
+
return Zr(e6, { feature: Y.warmup, action: `read`, level: `warning`, contexts: { warmup: { key: n2 } } }), null;
|
|
1017
2138
|
}
|
|
1018
2139
|
}, set: (n2, r2) => {
|
|
1019
|
-
if (t2 &&
|
|
1020
|
-
|
|
2140
|
+
if (t2 && e5) try {
|
|
2141
|
+
e5.set(n2, r2);
|
|
1021
2142
|
} catch {
|
|
1022
2143
|
}
|
|
1023
2144
|
} };
|
|
1024
2145
|
}
|
|
1025
|
-
var
|
|
1026
|
-
var
|
|
1027
|
-
var
|
|
1028
|
-
function
|
|
1029
|
-
|
|
2146
|
+
var si = Z(`@wix/site-service-locale`);
|
|
2147
|
+
var ci = Z;
|
|
2148
|
+
var li = ci(`@wix/viewer-service-multilingual`);
|
|
2149
|
+
function ui() {
|
|
2150
|
+
try {
|
|
2151
|
+
return Kr.getLanguage() ?? `en`;
|
|
2152
|
+
} catch {
|
|
2153
|
+
return `en`;
|
|
2154
|
+
}
|
|
2155
|
+
}
|
|
2156
|
+
function di(e5) {
|
|
2157
|
+
try {
|
|
2158
|
+
return d(e5);
|
|
2159
|
+
} catch {
|
|
2160
|
+
return null;
|
|
2161
|
+
}
|
|
2162
|
+
}
|
|
2163
|
+
function fi() {
|
|
2164
|
+
let e5 = di(si), t2 = di(li);
|
|
2165
|
+
return t2?.multilingualEnabled && t2.currentLocale?.languageCode || e5?.language || ui();
|
|
2166
|
+
}
|
|
2167
|
+
var pi = [];
|
|
2168
|
+
var mi = [];
|
|
2169
|
+
var hi = `useServiceAddOnsContext must be used within ServiceAddOnsContextProvider`;
|
|
2170
|
+
function gi({ isLoading: e5, hasError: t2, children: n2 }) {
|
|
2171
|
+
let r2 = { addOnGroups: pi, selected: mi, isLoading: e5, hasError: t2, toggleAddOn: () => {
|
|
1030
2172
|
}, setAddOnQuantity: () => {
|
|
1031
2173
|
} };
|
|
1032
2174
|
return f($.Provider, { value: r2, children: n2 });
|
|
1033
2175
|
}
|
|
1034
|
-
function
|
|
1035
|
-
return f(
|
|
2176
|
+
function _i({ children: e5 }) {
|
|
2177
|
+
return f(gi, { isLoading: true, hasError: false, children: e5 });
|
|
1036
2178
|
}
|
|
1037
|
-
function
|
|
1038
|
-
return f(
|
|
2179
|
+
function vi({ children: e5 }) {
|
|
2180
|
+
return f(gi, { isLoading: false, hasError: true, children: e5 });
|
|
1039
2181
|
}
|
|
1040
|
-
function
|
|
1041
|
-
if (!
|
|
2182
|
+
function yi(e5) {
|
|
2183
|
+
if (!e5) return;
|
|
1042
2184
|
let t2 = ``;
|
|
1043
|
-
return (
|
|
2185
|
+
return (e5.filename || e5.altText) && (t2 = `/${encodeURIComponent(e5.filename || e5.altText)}`), e5.id ? `wix:image://v1/${e5.id}${t2}#originWidth=${e5.width}&originHeight=${e5.height}` : e5.url;
|
|
1044
2186
|
}
|
|
1045
|
-
var
|
|
1046
|
-
function
|
|
1047
|
-
return
|
|
2187
|
+
var bi = [{ path: `addOnGroupsDetails.addOns.mainMedia.image.urlExpirationDate` }];
|
|
2188
|
+
function xi(e5) {
|
|
2189
|
+
return jt(Object.assign(e5, { domainToMappings: { "*.dev.wix-code.com": [{ srcPath: `/_api/services-2`, destPath: `` }, { srcPath: `/_api/bookings/v2/services`, destPath: `/v2/services` }], "www.wixapis.com": [{ srcPath: `/_api/bookings/v2/services`, destPath: `/v2/services` }, { srcPath: `/bookings/v2/services`, destPath: `/v2/services` }, { srcPath: `/bookings/v2/bulk/services`, destPath: `/v2/bulk/services` }, { srcPath: `/bookings/services/v2/bulk/services`, destPath: `/v2/bulk/services` }], "manage._base_domain_": [{ srcPath: `/_api/bookings/v2/services`, destPath: `/v2/services` }, { srcPath: `/_api/bookings/v2/bulk/services`, destPath: `/v2/bulk/services` }], "editor._base_domain_": [{ srcPath: `/_api/bookings/v2/services`, destPath: `/v2/services` }, { srcPath: `/_api/bookings/v2/bulk/services`, destPath: `/v2/bulk/services` }], "blocks._base_domain_": [{ srcPath: `/_api/bookings/v2/services`, destPath: `/v2/services` }, { srcPath: `/_api/bookings/v2/bulk/services`, destPath: `/v2/bulk/services` }], "create.editorx": [{ srcPath: `/_api/bookings/v2/services`, destPath: `/v2/services` }, { srcPath: `/_api/bookings/v2/bulk/services`, destPath: `/v2/bulk/services` }], _: [{ srcPath: `/_api/bookings/v2/services`, destPath: `/v2/services` }], "www._base_domain_": [{ srcPath: `/_api/bookings/v2/services`, destPath: `/v2/services` }], "bo._base_domain_": [{ srcPath: `/_api/bookings/v2/services`, destPath: `/v2/services` }], "wixbo.ai": [{ srcPath: `/_api/bookings/v2/services`, destPath: `/v2/services` }], "wix-bo.com": [{ srcPath: `/_api/bookings/v2/services`, destPath: `/v2/services` }], "editor.wixapps.net": [{ srcPath: `/_api/bookings/v2/services`, destPath: `/v2/services` }], "api._api_base_domain_": [{ srcPath: `/services-2`, destPath: `` }] } }));
|
|
1048
2190
|
}
|
|
1049
|
-
var
|
|
1050
|
-
function
|
|
2191
|
+
var Si = `@wix/auto_sdk_bookings_services`;
|
|
2192
|
+
function Ci(e5) {
|
|
1051
2193
|
function t2({ host: t3 }) {
|
|
1052
|
-
return { entityFqdn: `wix.bookings.services.v2.service`, method: `POST`, methodFqn: `wix.bookings.services.v2.AddOnGroupsService.ListAddOnGroupsByServiceId`, packageName:
|
|
2194
|
+
return { entityFqdn: `wix.bookings.services.v2.service`, method: `POST`, methodFqn: `wix.bookings.services.v2.AddOnGroupsService.ListAddOnGroupsByServiceId`, packageName: Si, migrationOptions: { optInTransformResponse: true }, url: xi({ protoPath: `/v2/services/add-on-groups/list-add-on-groups-by-service-id`, data: e5, host: t3 }), data: e5, transformResponse: (e6) => ut(e6, [{ transformFn: $e, paths: bi }]) };
|
|
1053
2195
|
}
|
|
1054
2196
|
return t2;
|
|
1055
2197
|
}
|
|
1056
|
-
var
|
|
1057
|
-
async function
|
|
1058
|
-
let { httpClient: n2, sideEffects: r2 } = arguments[2], i2 =
|
|
2198
|
+
var wi = [{ path: `addOnGroupsDetails.addOns.mainMedia.image` }];
|
|
2199
|
+
async function Ti(e5, t2) {
|
|
2200
|
+
let { httpClient: n2, sideEffects: r2 } = arguments[2], i2 = Ci(Ze({ serviceId: e5, groupIds: t2?.groupIds }));
|
|
1059
2201
|
r2?.onSiteCall?.();
|
|
1060
2202
|
try {
|
|
1061
|
-
let
|
|
1062
|
-
return r2?.onSuccess?.(
|
|
1063
|
-
} catch (
|
|
1064
|
-
let t3 =
|
|
1065
|
-
throw r2?.onError?.(
|
|
2203
|
+
let e6 = await n2.request(i2);
|
|
2204
|
+
return r2?.onSuccess?.(e6), Qe(ut(e6.data, [{ transformFn: yi, paths: wi }]));
|
|
2205
|
+
} catch (e6) {
|
|
2206
|
+
let t3 = bt(e6, { spreadPathsToArguments: {}, explicitPathsToArguments: { serviceId: `$[0]`, groupIds: `$[1].groupIds` }, singleArgumentUnchanged: false }, [`serviceId`, `options`]);
|
|
2207
|
+
throw r2?.onError?.(e6), t3;
|
|
1066
2208
|
}
|
|
1067
2209
|
}
|
|
1068
|
-
function
|
|
1069
|
-
return (t2, n2) =>
|
|
2210
|
+
function Ei(e5) {
|
|
2211
|
+
return (t2, n2) => Ti(t2, n2, { httpClient: e5 });
|
|
1070
2212
|
}
|
|
1071
|
-
var
|
|
1072
|
-
function
|
|
1073
|
-
let n2 =
|
|
2213
|
+
var Di = At(Ei);
|
|
2214
|
+
function Oi(e5, t2) {
|
|
2215
|
+
let n2 = e5?.value, r2 = e5?.currency;
|
|
1074
2216
|
if (n2 == null || !r2) return null;
|
|
1075
2217
|
let i2 = Number(n2);
|
|
1076
2218
|
if (!Number.isFinite(i2)) return null;
|
|
1077
2219
|
let a2 = i2 % 1 == 0 ? 0 : 2;
|
|
1078
2220
|
return new Intl.NumberFormat(t2, { style: `currency`, currency: r2, currencyDisplay: `symbol`, maximumFractionDigits: a2, minimumFractionDigits: a2 }).format(i2).replace(/\p{Zs}/gu, `\xA0`);
|
|
1079
2221
|
}
|
|
1080
|
-
async function
|
|
1081
|
-
return (await
|
|
2222
|
+
async function ki(e5) {
|
|
2223
|
+
return (await Di(e5)).addOnGroupsDetails ?? [];
|
|
1082
2224
|
}
|
|
1083
|
-
function
|
|
1084
|
-
let n2 =
|
|
1085
|
-
return { addOnId:
|
|
2225
|
+
function Ai(e5, t2) {
|
|
2226
|
+
let n2 = e5.price?.value == null ? null : Number(e5.price.value);
|
|
2227
|
+
return { addOnId: e5.addOnId ?? null, addOnName: e5.nameTranslated ?? e5.name ?? null, addOnPrice: Oi(e5.price, t2), addOnPriceValue: n2 != null && Number.isFinite(n2) ? n2 : null, addOnCurrency: e5.price?.currency ?? null, durationInMinutes: e5.durationInMinutes ?? null, maxQuantity: e5.maxQuantity ?? null, isSelected: false, selectedQuantity: 0 };
|
|
1086
2228
|
}
|
|
1087
|
-
function
|
|
1088
|
-
return
|
|
2229
|
+
function ji(e5, t2) {
|
|
2230
|
+
return e5.map((e6) => ({ groupId: e6.groupId ?? null, groupName: e6.groupNameTranslated ?? e6.groupName ?? null, prompt: e6.promptTranslated ?? e6.prompt ?? null, maxNumberOfAddOns: e6.maxNumberOfAddOns ?? null, addOns: (e6.addOns ?? []).map((e7) => Ai(e7, t2)), selectedCount: 0, canSelectMore: true }));
|
|
1089
2231
|
}
|
|
1090
|
-
var
|
|
1091
|
-
function
|
|
1092
|
-
return `${
|
|
2232
|
+
var Mi = `bookings-uou`;
|
|
2233
|
+
function Ni(e5, t2, n2) {
|
|
2234
|
+
return `${Mi}:${e5}:addons:${t2}:${n2}`;
|
|
1093
2235
|
}
|
|
1094
|
-
var
|
|
1095
|
-
var
|
|
1096
|
-
var
|
|
1097
|
-
var
|
|
1098
|
-
function
|
|
2236
|
+
var Pi = 5e3;
|
|
2237
|
+
var Fi = 100;
|
|
2238
|
+
var Ii = `wix-warmup-data`;
|
|
2239
|
+
var Li = null;
|
|
2240
|
+
function Ri(e5) {
|
|
1099
2241
|
if (typeof document < `u`) try {
|
|
1100
|
-
let t2 = document.getElementById(
|
|
1101
|
-
return t2 ? (
|
|
2242
|
+
let t2 = document.getElementById(Ii)?.textContent;
|
|
2243
|
+
return t2 ? (Li?.text !== t2 && (Li = { text: t2, data: JSON.parse(t2).builderComponentsWarmupData ?? {} }), Li.data[e5] ?? void 0) : void 0;
|
|
1102
2244
|
} catch {
|
|
1103
2245
|
return;
|
|
1104
2246
|
}
|
|
1105
2247
|
}
|
|
1106
|
-
var
|
|
1107
|
-
var
|
|
1108
|
-
var
|
|
1109
|
-
var
|
|
1110
|
-
function
|
|
1111
|
-
if (!
|
|
1112
|
-
let t2 =
|
|
1113
|
-
return t2 || (t2 =
|
|
1114
|
-
}
|
|
1115
|
-
function
|
|
1116
|
-
if (
|
|
2248
|
+
var zi = () => ({ promises: /* @__PURE__ */ new Map(), invalidatedWarmup: /* @__PURE__ */ new Set() });
|
|
2249
|
+
var Bi = zi();
|
|
2250
|
+
var Vi = /* @__PURE__ */ new WeakMap();
|
|
2251
|
+
var Hi = /* @__PURE__ */ new WeakMap();
|
|
2252
|
+
function Ui(e5) {
|
|
2253
|
+
if (!e5) return Bi;
|
|
2254
|
+
let t2 = Vi.get(e5);
|
|
2255
|
+
return t2 || (t2 = zi(), Vi.set(e5, t2)), t2;
|
|
2256
|
+
}
|
|
2257
|
+
function Wi({ key: e5, warmupData: t2, fetchData: n2, refresh: r2 = false }) {
|
|
2258
|
+
if (e5 === null) return n2();
|
|
1117
2259
|
if (typeof window > `u`) {
|
|
1118
|
-
let r3 = () => n2().then((n3) => (t2.set(
|
|
2260
|
+
let r3 = () => n2().then((n3) => (t2.set(e5, n3), n3)), { scope: i3 } = t2;
|
|
1119
2261
|
if (!i3) return r3();
|
|
1120
|
-
let a3 =
|
|
1121
|
-
a3 || (a3 = /* @__PURE__ */ new Map(),
|
|
1122
|
-
let o3 = a3.get(
|
|
2262
|
+
let a3 = Hi.get(i3);
|
|
2263
|
+
a3 || (a3 = /* @__PURE__ */ new Map(), Hi.set(i3, a3));
|
|
2264
|
+
let o3 = a3.get(e5);
|
|
1123
2265
|
if (o3) return o3;
|
|
1124
2266
|
let s3 = r3();
|
|
1125
|
-
return a3.set(
|
|
2267
|
+
return a3.set(e5, s3), s3.catch(() => a3.delete(e5)), s3;
|
|
1126
2268
|
}
|
|
1127
|
-
let i2 =
|
|
1128
|
-
for (let [
|
|
1129
|
-
let o2 = i2.promises.get(
|
|
2269
|
+
let i2 = Ui(t2.scope), a2 = Date.now();
|
|
2270
|
+
for (let [e6, t3] of i2.promises) t3.expiresAt <= a2 && i2.promises.delete(e6);
|
|
2271
|
+
let o2 = i2.promises.get(e5);
|
|
1130
2272
|
if (o2 && !r2) return o2.promise;
|
|
1131
|
-
r2 && i2.invalidatedWarmup.add(
|
|
1132
|
-
let s2 = !i2.invalidatedWarmup.has(
|
|
2273
|
+
r2 && i2.invalidatedWarmup.add(e5);
|
|
2274
|
+
let s2 = !i2.invalidatedWarmup.has(e5);
|
|
1133
2275
|
if (s2) {
|
|
1134
|
-
let t3 =
|
|
2276
|
+
let t3 = Ri(e5);
|
|
1135
2277
|
if (t3 !== void 0) {
|
|
1136
|
-
let n3 =
|
|
1137
|
-
return i2.promises.set(
|
|
2278
|
+
let n3 = X(t3);
|
|
2279
|
+
return i2.promises.set(e5, { promise: n3, expiresAt: a2 + Pi }), n3;
|
|
1138
2280
|
}
|
|
1139
2281
|
}
|
|
1140
2282
|
let c2 = (async () => {
|
|
1141
2283
|
if (s2) {
|
|
1142
|
-
let n3 = await t2.get(
|
|
2284
|
+
let n3 = await t2.get(e5);
|
|
1143
2285
|
if (n3 != null) return n3;
|
|
1144
2286
|
}
|
|
1145
2287
|
return n2();
|
|
1146
2288
|
})();
|
|
1147
|
-
i2.promises.size >=
|
|
2289
|
+
i2.promises.size >= Fi && i2.promises.delete(i2.promises.keys().next().value);
|
|
1148
2290
|
let l2 = { promise: c2, expiresAt: 1 / 0 };
|
|
1149
|
-
return i2.promises.set(
|
|
1150
|
-
l2.expiresAt = Date.now() +
|
|
2291
|
+
return i2.promises.set(e5, l2), c2.then(() => {
|
|
2292
|
+
l2.expiresAt = Date.now() + Pi;
|
|
1151
2293
|
}, () => {
|
|
1152
|
-
i2.promises.get(
|
|
2294
|
+
i2.promises.get(e5) === l2 && i2.promises.delete(e5);
|
|
1153
2295
|
}), c2;
|
|
1154
2296
|
}
|
|
1155
|
-
function
|
|
1156
|
-
return
|
|
1157
|
-
throw
|
|
2297
|
+
function Gi(e5, t2) {
|
|
2298
|
+
return Qr(`service-addons-context-load`, { feature: Y.serviceAddOns, tags: { serviceId: e5 } }, ki(e5)).then((e6) => ji(e6, t2), (t3) => {
|
|
2299
|
+
throw Zr(t3, { feature: Y.serviceAddOns, action: `fetch-add-on-groups`, level: `warning`, contexts: { service: { serviceId: e5 } } }), t3;
|
|
1158
2300
|
});
|
|
1159
2301
|
}
|
|
1160
|
-
function
|
|
1161
|
-
return
|
|
1162
|
-
}
|
|
1163
|
-
var
|
|
1164
|
-
function
|
|
1165
|
-
return { evid: 32, src: 16, endpoint: ``, params:
|
|
1166
|
-
}
|
|
1167
|
-
var
|
|
1168
|
-
var
|
|
1169
|
-
function
|
|
1170
|
-
let t2 =
|
|
1171
|
-
if (t2 === null) return
|
|
1172
|
-
let n2 = new URL(
|
|
1173
|
-
n2.searchParams.delete(
|
|
1174
|
-
for (let [
|
|
2302
|
+
function Ki({ serviceId: e5, locale: t2, language: n2, warmupData: r2 }) {
|
|
2303
|
+
return Wi({ key: Ni(n2, e5, t2), warmupData: r2, fetchData: () => Gi(e5, t2) });
|
|
2304
|
+
}
|
|
2305
|
+
var qi = ci(`@wix/site-service-business-logger`);
|
|
2306
|
+
function Ji(e5) {
|
|
2307
|
+
return { evid: 32, src: 16, endpoint: ``, params: e5 };
|
|
2308
|
+
}
|
|
2309
|
+
var Yi = Z(`@wix/site-service-url`);
|
|
2310
|
+
var Xi = `appSectionParams`;
|
|
2311
|
+
function Zi(e5) {
|
|
2312
|
+
let t2 = e5.searchParams.get(Xi);
|
|
2313
|
+
if (t2 === null) return e5;
|
|
2314
|
+
let n2 = new URL(e5);
|
|
2315
|
+
n2.searchParams.delete(Xi);
|
|
2316
|
+
for (let [e6, r2] of Object.entries(Qi(t2))) typeof r2 == `string` && !n2.searchParams.has(e6) && n2.searchParams.set(e6, r2);
|
|
1175
2317
|
return n2;
|
|
1176
2318
|
}
|
|
1177
|
-
function
|
|
2319
|
+
function Qi(e5) {
|
|
1178
2320
|
try {
|
|
1179
|
-
let t2 = JSON.parse(
|
|
2321
|
+
let t2 = JSON.parse(e5);
|
|
1180
2322
|
return t2 && typeof t2 == `object` && !Array.isArray(t2) ? t2 : {};
|
|
1181
2323
|
} catch {
|
|
1182
2324
|
return {};
|
|
1183
2325
|
}
|
|
1184
2326
|
}
|
|
1185
2327
|
var Q = `bookings-uou:url-change`;
|
|
1186
|
-
var
|
|
1187
|
-
let t2 = new URL(
|
|
2328
|
+
var $i = (e5) => {
|
|
2329
|
+
let t2 = new URL(e5);
|
|
1188
2330
|
return t2.searchParams.sort(), t2.href;
|
|
1189
2331
|
};
|
|
1190
|
-
function
|
|
2332
|
+
function ea(e5, { disableScrollToTop: t2, skipHistory: n2 } = {}) {
|
|
1191
2333
|
let r2 = globalThis.window;
|
|
1192
2334
|
if (!r2?.history) return;
|
|
1193
2335
|
let i2 = new URL(r2.location.href);
|
|
1194
|
-
if (
|
|
2336
|
+
if ($i(i2) === $i(e5)) return;
|
|
1195
2337
|
let a2 = { scrollY: r2.scrollY };
|
|
1196
|
-
if (n2) r2.history.replaceState(a2, ``,
|
|
2338
|
+
if (n2) r2.history.replaceState(a2, ``, e5.href);
|
|
1197
2339
|
else {
|
|
1198
2340
|
r2.history.replaceState(a2, ``, i2.href);
|
|
1199
2341
|
try {
|
|
1200
|
-
r2.history.pushState(t2 ? a2 : null, ``,
|
|
2342
|
+
r2.history.pushState(t2 ? a2 : null, ``, e5.href);
|
|
1201
2343
|
} catch {
|
|
1202
2344
|
return;
|
|
1203
2345
|
}
|
|
1204
2346
|
}
|
|
1205
2347
|
r2.dispatchEvent(new Event(Q));
|
|
1206
2348
|
}
|
|
1207
|
-
function
|
|
2349
|
+
function ta(e5) {
|
|
1208
2350
|
let t2 = globalThis.window;
|
|
1209
|
-
return t2 ? (t2.addEventListener(Q,
|
|
1210
|
-
t2.removeEventListener(Q,
|
|
2351
|
+
return t2 ? (t2.addEventListener(Q, e5), t2.addEventListener(`popstate`, e5), () => {
|
|
2352
|
+
t2.removeEventListener(Q, e5), t2.removeEventListener(`popstate`, e5);
|
|
1211
2353
|
}) : () => {
|
|
1212
2354
|
};
|
|
1213
2355
|
}
|
|
1214
|
-
var
|
|
2356
|
+
var na = (e5) => {
|
|
1215
2357
|
try {
|
|
1216
|
-
return decodeURIComponent(
|
|
2358
|
+
return decodeURIComponent(e5);
|
|
1217
2359
|
} catch {
|
|
1218
|
-
return
|
|
2360
|
+
return e5;
|
|
1219
2361
|
}
|
|
1220
2362
|
};
|
|
1221
|
-
function
|
|
2363
|
+
function ra(e5, t2) {
|
|
1222
2364
|
let n2 = t2 ? new URL(t2).pathname : `/`;
|
|
1223
|
-
return `./${
|
|
2365
|
+
return `./${na(new URL(e5).pathname.replace(n2, ``).replace(/^\/|\/$/g, ``))}`;
|
|
1224
2366
|
}
|
|
1225
|
-
function
|
|
1226
|
-
let
|
|
1227
|
-
return { pathname: i2.pathname, search: i2.search, searchParams: i2.searchParams, href: i2.href, getParsedUrl: () =>
|
|
2367
|
+
function ia() {
|
|
2368
|
+
let e5 = d(Yi), t2 = r(() => e5.currentUrl, [e5]), n2 = c(ta, t2, t2), i2 = o(() => Zi(new URL(n2)), [n2]), a2 = e5.siteUrl.replace(/\/$/, ``);
|
|
2369
|
+
return { pathname: i2.pathname, search: i2.search, searchParams: i2.searchParams, href: i2.href, getParsedUrl: () => Zi(new URL(e5.currentUrl)), getRelativeUrl: () => ra(e5.currentUrl, a2), getExternalBaseUrl: () => a2, pushUrl: ea };
|
|
1228
2370
|
}
|
|
1229
|
-
var
|
|
1230
|
-
return
|
|
2371
|
+
var aa = function(e5) {
|
|
2372
|
+
return e5.BOOK_ONLINE = `bookingsBookOnline`, e5.SERVICE_PAGE = `bookingsServicePage`, e5.CALENDAR_PAGE = `bookingsCalendar`, e5.FORM_PAGE = `bookingsForm`, e5;
|
|
1231
2373
|
}({});
|
|
1232
|
-
var
|
|
1233
|
-
|
|
1234
|
-
var
|
|
1235
|
-
var
|
|
1236
|
-
let { reportBi: t2 } = d(
|
|
2374
|
+
var oa = { SERVICES: `services_context`, SERVICE: `service_context`, TIME_SLOTS: `time_slots_context`, BOOKING_CHECKOUT: `booking_checkout_context`, CATEGORIES: `categories_context`, LOCATIONS: `locations_context`, SERVICE_ADD_ONS: `service_addons_context`, PREFERENCES: `preferences_context` };
|
|
2375
|
+
aa.BOOK_ONLINE;
|
|
2376
|
+
var sa = `new_bookings_server`;
|
|
2377
|
+
var ca = (e5) => {
|
|
2378
|
+
let { reportBi: t2 } = d(qi);
|
|
1237
2379
|
return r((n2) => {
|
|
1238
|
-
t2({ widget_name:
|
|
1239
|
-
}, [t2,
|
|
2380
|
+
t2({ widget_name: e5, bookingsPlatform: sa, is_over_editor: false, ...n2.params, src: n2.src, evid: n2.evid }, { endpoint: n2.endpoint });
|
|
2381
|
+
}, [t2, e5]);
|
|
1240
2382
|
};
|
|
1241
|
-
var
|
|
1242
|
-
let n2 =
|
|
2383
|
+
var la = (e5, t2 = true) => {
|
|
2384
|
+
let n2 = ca(e5), { getParsedUrl: r2 } = ia(), i2 = s(false);
|
|
1243
2385
|
a(() => {
|
|
1244
|
-
t2 && !i2.current && (i2.current = true, n2(
|
|
2386
|
+
t2 && !i2.current && (i2.current = true, n2(Ji({ referralInfo: r2().searchParams.get(Nn.referral) ?? void 0 })));
|
|
1245
2387
|
}, [t2, n2, r2]);
|
|
1246
2388
|
};
|
|
1247
|
-
var
|
|
1248
|
-
var
|
|
1249
|
-
var
|
|
2389
|
+
var ua = X({ addOnGroups: pi, hasError: false });
|
|
2390
|
+
var da = (e5) => ({ addOnGroups: e5, hasError: false });
|
|
2391
|
+
var fa = () => ({ addOnGroups: pi, hasError: true });
|
|
1250
2392
|
var $ = n(null);
|
|
1251
|
-
function
|
|
1252
|
-
let
|
|
1253
|
-
if (!
|
|
1254
|
-
return
|
|
2393
|
+
function pa() {
|
|
2394
|
+
let e5 = i($);
|
|
2395
|
+
if (!e5) throw Error(hi);
|
|
2396
|
+
return e5;
|
|
1255
2397
|
}
|
|
1256
|
-
function
|
|
1257
|
-
let { addOnGroups: l2, hasError: u2 } =
|
|
2398
|
+
function ma({ addOnsPromise: e5, isLoading: t2, pickedAddOns: n2, forwardToggleAddOn: i2, forwardSetAddOnQuantity: a2, children: c2 }) {
|
|
2399
|
+
let { addOnGroups: l2, hasError: u2 } = ei(e5), d2 = o(() => N(l2, n2), [l2, n2]), p2 = o(() => An(l2, d2), [l2, d2]), m2 = s({ source: n2, picks: n2 });
|
|
1258
2400
|
m2.current.source !== n2 && (m2.current = { source: n2, picks: n2 });
|
|
1259
|
-
let h2 = (
|
|
2401
|
+
let h2 = (e6) => {
|
|
1260
2402
|
let t3 = m2.current;
|
|
1261
|
-
t3.picks =
|
|
2403
|
+
t3.picks = P(e6({ serviceId: ``, addOns: t3.picks }));
|
|
1262
2404
|
}, g2 = r(() => {
|
|
1263
|
-
let
|
|
1264
|
-
return
|
|
1265
|
-
}, [l2, a2]), _2 = r((
|
|
1266
|
-
let n3 =
|
|
1267
|
-
!t2 &&
|
|
1268
|
-
}, [t2, l2, g2, i2]), v2 = r((
|
|
1269
|
-
let r2 = t2 ? null :
|
|
2405
|
+
let e6 = m2.current, t3 = N(l2, e6.picks);
|
|
2406
|
+
return e6.picks.filter((e7) => !t3.includes(e7)).forEach((e7) => a2(e7.id, 0)), e6.picks = t3, t3;
|
|
2407
|
+
}, [l2, a2]), _2 = r((e6) => {
|
|
2408
|
+
let n3 = N(l2, m2.current.picks);
|
|
2409
|
+
!t2 && jn(l2, n3, e6) && (g2(), i2(e6), h2((t3) => Fn(t3, e6)));
|
|
2410
|
+
}, [t2, l2, g2, i2]), v2 = r((e6, n3) => {
|
|
2411
|
+
let r2 = t2 ? null : Dn(l2, e6);
|
|
1270
2412
|
if (!r2) return;
|
|
1271
|
-
let i3 =
|
|
1272
|
-
s2 === o2 || o2 === 0 && !
|
|
1273
|
-
}, [t2, l2, g2, a2]),
|
|
1274
|
-
return f($.Provider, { value:
|
|
2413
|
+
let i3 = N(l2, m2.current.picks), o2 = i3.find((t3) => t3.id === e6)?.quantity ?? 0, s2 = Mn(r2, n3);
|
|
2414
|
+
s2 === o2 || o2 === 0 && !jn(l2, i3, e6) || (g2(), a2(e6, s2), h2((t3) => In(t3, e6, s2)));
|
|
2415
|
+
}, [t2, l2, g2, a2]), y2 = o(() => ({ addOnGroups: p2, selected: d2, isLoading: t2, hasError: u2, toggleAddOn: _2, setAddOnQuantity: v2 }), [p2, d2, t2, u2, _2, v2]);
|
|
2416
|
+
return f($.Provider, { value: y2, children: c2 });
|
|
1275
2417
|
}
|
|
1276
|
-
function
|
|
2418
|
+
function ha({ children: e5 }) {
|
|
1277
2419
|
let { service: n2, serviceId: r2, hasAddOns: i2, locale: a2, isLoading: s2, bookingsSettingsLoading: c2, selection: u2, toggleAddOn: d2, setAddOnQuantity: p2 } = l();
|
|
1278
|
-
|
|
1279
|
-
let m2 = o(() =>
|
|
1280
|
-
return f(
|
|
2420
|
+
la(oa.SERVICE_ADD_ONS, !s2 && !c2);
|
|
2421
|
+
let m2 = o(() => P(u2), [u2]), h2 = oi(), g2 = fi(), _2 = n2 && i2 && r2 ? r2 : null, v2 = o(() => _2 ? ni(Ki({ serviceId: _2, locale: a2, language: g2, warmupData: h2 }), da, fa) : ua, [_2, a2, g2]), y2 = !_2 && !!s2;
|
|
2422
|
+
return f($r, { fallback: f(vi, { children: e5 }), feature: Y.serviceAddOns, children: f(t, { fallback: f(_i, { children: e5 }), children: f(ma, { addOnsPromise: v2, isLoading: y2, pickedAddOns: m2, forwardToggleAddOn: d2, forwardSetAddOnQuantity: p2, children: e5 }) }) });
|
|
1281
2423
|
}
|
|
1282
|
-
var
|
|
2424
|
+
var ga = En(`bcc1b809-bde5-4d7d-a7bb-89831fe5ccb8`);
|
|
1283
2425
|
export {
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
2426
|
+
ha as ServiceAddOnsContextProvider,
|
|
2427
|
+
ha as default,
|
|
2428
|
+
ga as injectAccessTokenGetter,
|
|
1287
2429
|
$ as serviceAddOnsContext,
|
|
1288
|
-
|
|
2430
|
+
pa as useServiceAddOnsContext
|
|
1289
2431
|
};
|
|
1290
2432
|
//# sourceMappingURL=context-service-addons.mjs.map
|