@wix/bookings 1.0.1741 → 1.0.1743
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-booking-checkout-context/runtime.d.ts +2784 -0
- package/_sdk-exports/context-booking-checkout-context/runtime.js +2 -0
- package/_sdk-exports/context-categories-context/runtime.d.ts +144 -0
- package/_sdk-exports/context-categories-context/runtime.js +1 -0
- package/_sdk-exports/context-locations-context/runtime.d.ts +282 -0
- package/_sdk-exports/context-locations-context/runtime.js +1 -0
- package/_sdk-exports/context-service-addons-context/runtime.d.ts +264 -0
- package/_sdk-exports/context-service-addons-context/runtime.js +1 -0
- package/_sdk-exports/context-service-context/runtime.d.ts +3667 -0
- package/_sdk-exports/context-service-context/runtime.js +2 -0
- package/_sdk-exports/context-services-context/runtime.d.ts +2863 -0
- package/_sdk-exports/context-services-context/runtime.js +2 -0
- package/_sdk-exports/context-time-slots-context/runtime.d.ts +660 -0
- package/_sdk-exports/context-time-slots-context/runtime.js +2 -0
- package/build/cjs/context-booking-checkout-context.d.ts +2784 -0
- package/build/cjs/context-booking-checkout-context.js +3940 -0
- package/build/cjs/context-booking-checkout-context.js.map +1 -0
- package/build/cjs/context-categories-context.d.ts +144 -0
- package/build/cjs/context-categories-context.js +1188 -0
- package/build/cjs/context-categories-context.js.map +1 -0
- package/build/cjs/context-locations-context.d.ts +282 -0
- package/build/cjs/context-locations-context.js +1252 -0
- package/build/cjs/context-locations-context.js.map +1 -0
- package/build/cjs/context-service-addons-context.d.ts +264 -0
- package/build/cjs/context-service-addons-context.js +1324 -0
- package/build/cjs/context-service-addons-context.js.map +1 -0
- package/build/cjs/context-service-context.d.ts +3667 -0
- package/build/cjs/context-service-context.js +5336 -0
- package/build/cjs/context-service-context.js.map +1 -0
- package/build/cjs/context-services-context.d.ts +2863 -0
- package/build/cjs/context-services-context.js +2203 -0
- package/build/cjs/context-services-context.js.map +1 -0
- package/build/cjs/context-time-slots-context.d.ts +660 -0
- package/build/cjs/context-time-slots-context.js +2822 -0
- package/build/cjs/context-time-slots-context.js.map +1 -0
- package/build/es/context-booking-checkout-context.d.mts +2784 -0
- package/build/es/context-booking-checkout-context.mjs +3898 -0
- package/build/es/context-booking-checkout-context.mjs.map +1 -0
- package/build/es/context-categories-context.d.mts +144 -0
- package/build/es/context-categories-context.mjs +1157 -0
- package/build/es/context-categories-context.mjs.map +1 -0
- package/build/es/context-locations-context.d.mts +282 -0
- package/build/es/context-locations-context.mjs +1221 -0
- package/build/es/context-locations-context.mjs.map +1 -0
- package/build/es/context-service-addons-context.d.mts +264 -0
- package/build/es/context-service-addons-context.mjs +1294 -0
- package/build/es/context-service-addons-context.mjs.map +1 -0
- package/build/es/context-service-context.d.mts +3667 -0
- package/build/es/context-service-context.mjs +5304 -0
- package/build/es/context-service-context.mjs.map +1 -0
- package/build/es/context-services-context.d.mts +2863 -0
- package/build/es/context-services-context.mjs +2172 -0
- package/build/es/context-services-context.mjs.map +1 -0
- package/build/es/context-time-slots-context.d.mts +660 -0
- package/build/es/context-time-slots-context.mjs +2792 -0
- package/build/es/context-time-slots-context.mjs.map +1 -0
- package/build/internal/cjs/context-booking-checkout-context.d.ts +2784 -0
- package/build/internal/cjs/context-categories-context.d.ts +144 -0
- package/build/internal/cjs/context-locations-context.d.ts +282 -0
- package/build/internal/cjs/context-service-addons-context.d.ts +264 -0
- package/build/internal/cjs/context-service-context.d.ts +3667 -0
- package/build/internal/cjs/context-services-context.d.ts +2863 -0
- package/build/internal/cjs/context-time-slots-context.d.ts +660 -0
- package/build/internal/es/context-booking-checkout-context.d.mts +2784 -0
- package/build/internal/es/context-categories-context.d.mts +144 -0
- package/build/internal/es/context-locations-context.d.mts +282 -0
- package/build/internal/es/context-service-addons-context.d.mts +264 -0
- package/build/internal/es/context-service-context.d.mts +3667 -0
- package/build/internal/es/context-services-context.d.mts +2863 -0
- package/build/internal/es/context-time-slots-context.d.mts +660 -0
- package/context/booking-checkout-context/package.json +3 -0
- package/context/categories-context/package.json +3 -0
- package/context/locations-context/package.json +3 -0
- package/context/service-addons-context/package.json +3 -0
- package/context/service-context/package.json +3 -0
- package/context/services-context/package.json +3 -0
- package/context/time-slots-context/package.json +3 -0
- package/package.json +69 -8
|
@@ -0,0 +1,2792 @@
|
|
|
1
|
+
// _sdk-exports/context-time-slots-context/runtime.js
|
|
2
|
+
import { Component as e, Suspense as t, createContext as n, useCallback as r, useContext as i, useEffect as a, useMemo as o, useRef as s, useState as c, useSyncExternalStore as l } from "react";
|
|
3
|
+
import { useServiceContext as u } from "@wix/bookings/context/service-context";
|
|
4
|
+
import { useGetService as d, useService as f } from "@wix/services-manager-react";
|
|
5
|
+
import { jsx as p } from "react/jsx-runtime";
|
|
6
|
+
var m = {};
|
|
7
|
+
function h(e2, t2 = false, n2 = (e3) => e3) {
|
|
8
|
+
return () => ({ __type: `event-definition`, type: e2, isDomainEvent: t2, transformations: n2 });
|
|
9
|
+
}
|
|
10
|
+
var g = (e2) => {
|
|
11
|
+
switch (e2) {
|
|
12
|
+
case `get`:
|
|
13
|
+
case `GET`:
|
|
14
|
+
return `GET`;
|
|
15
|
+
case `post`:
|
|
16
|
+
case `POST`:
|
|
17
|
+
return `POST`;
|
|
18
|
+
case `put`:
|
|
19
|
+
case `PUT`:
|
|
20
|
+
return `PUT`;
|
|
21
|
+
case `delete`:
|
|
22
|
+
case `DELETE`:
|
|
23
|
+
return `DELETE`;
|
|
24
|
+
case `patch`:
|
|
25
|
+
case `PATCH`:
|
|
26
|
+
return `PATCH`;
|
|
27
|
+
case `head`:
|
|
28
|
+
case `HEAD`:
|
|
29
|
+
return `HEAD`;
|
|
30
|
+
case `options`:
|
|
31
|
+
case `OPTIONS`:
|
|
32
|
+
return `OPTIONS`;
|
|
33
|
+
default:
|
|
34
|
+
throw Error(`Unknown method: ${e2}`);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
var _ = (e2) => (t2) => async (n2) => {
|
|
38
|
+
let r2, i2 = (t3) => {
|
|
39
|
+
if (r2 = e2(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
|
+
let { method: i3, url: a2, params: o2 } = r2;
|
|
41
|
+
return { ...r2, method: g(i3), url: a2, data: r2.data, params: o2 };
|
|
42
|
+
};
|
|
43
|
+
try {
|
|
44
|
+
let e3 = await t2.request(i2);
|
|
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 = e3.data;
|
|
47
|
+
return n3.forEach((t3) => {
|
|
48
|
+
t3 && (a2 = t3(e3.data, e3.headers));
|
|
49
|
+
}), a2;
|
|
50
|
+
} catch (e3) {
|
|
51
|
+
throw typeof e3 == `object` && e3 && `response` in e3 && typeof e3.response == `object` && e3.response !== null && `data` in e3.response ? e3.response.data : e3;
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
var v = (e2) => e2.__isAmbassador ? true : !!e2().__isAmbassador;
|
|
55
|
+
var y = `__metadata`;
|
|
56
|
+
var b = `edge.wixapis.com`;
|
|
57
|
+
var x = class extends Error {
|
|
58
|
+
message;
|
|
59
|
+
response;
|
|
60
|
+
constructor(e2, t2) {
|
|
61
|
+
super(e2), this.message = e2, this.response = t2;
|
|
62
|
+
}
|
|
63
|
+
async details() {
|
|
64
|
+
let e2 = await this.response.json();
|
|
65
|
+
return S(this.response.status, e2?.message, e2?.details, { requestId: this.response.headers.get(`X-Wix-Request-Id`), details: e2 });
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
var S = (e2, t2, n2, r2) => ({ details: { ...!n2?.validationError && { applicationError: { description: t2, code: e2, data: r2 } }, ...n2 }, message: t2, requestId: r2?.requestId });
|
|
69
|
+
var C = (e2) => e2?.method && [`post`, `put`, `patch`].includes(e2.method.toLocaleLowerCase()) && e2.body ? { "Content-Type": `application/json` } : {};
|
|
70
|
+
var w = (e2) => e2 && typeof e2 == `object` && !Array.isArray(e2);
|
|
71
|
+
var T = (e2) => e2.__type === `host`;
|
|
72
|
+
function ee(e2, t2) {
|
|
73
|
+
return e2.create(t2);
|
|
74
|
+
}
|
|
75
|
+
var E = `x-wix-bi-gateway`;
|
|
76
|
+
function D(e2, t2, n2) {
|
|
77
|
+
return { [E]: te({ environment: `js-sdk${n2 ? `-${n2}` : ``}`, "package-name": e2.packageName ?? t2?.PACKAGE_NAME, "method-fqn": e2.methodFqn, entity: e2.entityFqdn }) };
|
|
78
|
+
}
|
|
79
|
+
function te(e2) {
|
|
80
|
+
return Object.entries(e2).filter(([e3, t2]) => !!t2).map(([e3, t2]) => `${e3}=${t2}`).join(`,`);
|
|
81
|
+
}
|
|
82
|
+
function ne(e2) {
|
|
83
|
+
let t2 = globalThis.__wix_context__, n2 = { client: m.client, elevatedClient: m.elevatedClient }, r2;
|
|
84
|
+
globalThis.__wix_context__ = void 0, m.client = void 0, m.elevatedClient = void 0, typeof $wixContext < `u` && (r2 = { client: $wixContext?.client, elevatedClient: $wixContext?.elevatedClient }, delete $wixContext.client, delete $wixContext.elevatedClient);
|
|
85
|
+
try {
|
|
86
|
+
return e2();
|
|
87
|
+
} finally {
|
|
88
|
+
globalThis.__wix_context__ = t2, m.client = n2.client, m.elevatedClient = n2.elevatedClient, typeof $wixContext < `u` && ($wixContext.client = r2.client, $wixContext.elevatedClient = r2.elevatedClient);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
var O = { id: `_id`, createdDate: `_createdDate`, updatedDate: `_updatedDate` };
|
|
92
|
+
function k(e2) {
|
|
93
|
+
return j(e2).map((e3) => e3.toLocaleUpperCase()).join(`_`);
|
|
94
|
+
}
|
|
95
|
+
var re = /([\p{Ll}\d])(\p{Lu})/gu;
|
|
96
|
+
var ie = /(\p{Lu})([\p{Lu}][\p{Ll}])/gu;
|
|
97
|
+
var A = `$1\0$2`;
|
|
98
|
+
var ae = /[^\p{L}\d]+/giu;
|
|
99
|
+
function j(e2) {
|
|
100
|
+
let t2 = e2.trim();
|
|
101
|
+
t2 = t2.replace(re, A).replace(ie, A), t2 = t2.replace(ae, `\0`);
|
|
102
|
+
let n2 = 0, r2 = t2.length;
|
|
103
|
+
for (; t2.charAt(n2) === `\0`; ) n2++;
|
|
104
|
+
if (n2 === r2) return [];
|
|
105
|
+
for (; t2.charAt(r2 - 1) === `\0`; ) r2--;
|
|
106
|
+
return t2.slice(n2, r2).split(/\0/g);
|
|
107
|
+
}
|
|
108
|
+
var oe = (e2) => `validationError` in (e2.response?.data?.details ?? {});
|
|
109
|
+
var M = (e2) => `applicationError` in (e2.response?.data?.details ?? {});
|
|
110
|
+
var se = (e2) => (e2.response?.status ?? -1) >= 400 && (e2.response?.status ?? -1) < 500;
|
|
111
|
+
function N(e2, t2 = { explicitPathsToArguments: {}, spreadPathsToArguments: {}, singleArgumentUnchanged: false }, n2 = []) {
|
|
112
|
+
if (typeof e2 != `object` || !e2) throw e2;
|
|
113
|
+
if (oe(e2)) return ce(e2, t2, n2);
|
|
114
|
+
if (M(e2)) return ue(e2);
|
|
115
|
+
if (se(e2)) {
|
|
116
|
+
let t3 = e2.response?.status, n3 = e2.response?.statusText ?? `UNKNOWN`, r2 = e2.response?.data?.message ?? n3, i2 = { applicationError: { description: n3, code: k(n3), data: {} }, requestId: e2.requestId };
|
|
117
|
+
return le(e2, { message: JSON.stringify({ message: r2, details: i2 }, null, 2), extraProperties: { details: i2, status: t3 } });
|
|
118
|
+
}
|
|
119
|
+
return de(e2);
|
|
120
|
+
}
|
|
121
|
+
var ce = (e2, t2, n2) => {
|
|
122
|
+
let r2 = e2.response?.data, i2 = e2.requestId, { fieldViolations: a2 } = r2.details.validationError, o2 = fe(t2, a2, n2)?.sort((e3, t3) => e3.field < t3.field ? -1 : 1), s2 = `INVALID_ARGUMENT: ${o2?.map(({ field: e3, description: t3 }) => `"${e3}" ${t3}`)?.join(`, `)}`, c2 = { validationError: { fieldViolations: o2 }, requestId: i2 };
|
|
123
|
+
return le(e2, { message: JSON.stringify({ message: s2, details: c2 }, null, 2), extraProperties: { details: c2, status: e2.response?.status, requestId: i2 } });
|
|
124
|
+
};
|
|
125
|
+
var le = (e2, { message: t2, extraProperties: n2 }) => Object.assign(e2, { ...n2, message: t2 });
|
|
126
|
+
var ue = (e2) => {
|
|
127
|
+
let t2 = e2.response?.status, n2 = e2.response?.statusText ?? `UNKNOWN`, r2 = e2.response?.data?.message ?? n2, i2 = e2.response?.data?.details?.applicationError?.description ?? n2, a2 = e2.response?.data?.details?.applicationError?.code ?? k(n2), o2 = e2.response?.data?.details?.applicationError?.data ?? {}, s2 = r2 === i2 ? r2 : `${r2}: ${i2}`, c2 = { applicationError: { description: i2, code: a2, data: o2 }, requestId: e2.requestId };
|
|
128
|
+
return le(e2, { message: JSON.stringify({ message: s2, details: c2 }, null, 2), extraProperties: { details: c2, status: t2, requestId: e2.requestId } });
|
|
129
|
+
};
|
|
130
|
+
var de = (e2) => le(e2, { message: e2.requestId ? `System error occurred, request-id: ${e2.requestId}` : `System error occurred: ${JSON.stringify(e2)}`, extraProperties: { requestId: e2.requestId, status: e2.response?.status, code: k(e2.response?.statusText ?? `UNKNOWN`), ...!e2.response && { runtimeError: e2 } } });
|
|
131
|
+
var fe = ({ spreadPathsToArguments: e2, explicitPathsToArguments: t2, singleArgumentUnchanged: n2 }, r2, i2) => {
|
|
132
|
+
let a2 = { ...e2, ...t2 }, o2 = Object.keys(a2);
|
|
133
|
+
return r2?.filter((e3) => !r2.some((t3) => t3.field.length > e3.field.length && t3.field.startsWith(e3.field) && o2.includes(t3.field))).map((e3) => {
|
|
134
|
+
let r3 = t2[e3.field];
|
|
135
|
+
if (r3) return { ...e3, field: pe(r3, i2) };
|
|
136
|
+
let s2 = o2?.sort((e4, t3) => t3.length - e4.length)?.find((t3) => e3.field.startsWith(t3));
|
|
137
|
+
if (s2) {
|
|
138
|
+
let t3 = a2[s2];
|
|
139
|
+
if (t3) return { ...e3, field: e3.field.replace(s2, pe(t3, i2)) };
|
|
140
|
+
}
|
|
141
|
+
return n2 ? { ...e3, field: `${i2[0]}.${e3.field}` } : e3;
|
|
142
|
+
});
|
|
143
|
+
};
|
|
144
|
+
var pe = (e2, t2) => {
|
|
145
|
+
let n2 = P(e2);
|
|
146
|
+
return n2 == null ? e2 : e2.replace(`$[${n2}]`, t2[n2]);
|
|
147
|
+
};
|
|
148
|
+
var P = (e2) => {
|
|
149
|
+
let t2 = e2.match(/\$\[(?<argIndex>\d+)\]/);
|
|
150
|
+
return t2 && t2.groups && Number(t2.groups.argIndex);
|
|
151
|
+
};
|
|
152
|
+
function me(e2, t2, n2, r2, i2, a2, o2, s2, c2, l2, u2) {
|
|
153
|
+
return ne(() => e2({ request: async (e3) => {
|
|
154
|
+
let i3 = e3({ host: s2?.HTTPHost || `www.wixapis.com` }), a3 = i3;
|
|
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 ? b : o3}${a3.url}`;
|
|
157
|
+
a3.params && a3.params.toString() && (u3 += `?${a3.params.toString()}`);
|
|
158
|
+
try {
|
|
159
|
+
let e4 = D(i3, t2, c2), o4 = { method: a3.method, ...a3.data && { body: JSON.stringify(a3.data) }, headers: { ...e4 } }, s3 = await n2(u3, o4);
|
|
160
|
+
if (s3.status !== 200) {
|
|
161
|
+
let e5 = null;
|
|
162
|
+
try {
|
|
163
|
+
e5 = await s3.json();
|
|
164
|
+
} catch {
|
|
165
|
+
}
|
|
166
|
+
let t3 = ge(s3.status, e5?.message ?? s3.statusText, e5?.details, { requestId: s3.headers.get(`X-Wix-Request-Id`), details: e5 }), n3 = N(t3);
|
|
167
|
+
throw r2?.handleError(n3, { requestOptions: { url: a3.url, method: a3.method, entityFqdn: i3.entityFqdn, methodFqn: i3.methodFqn } }), t3;
|
|
168
|
+
}
|
|
169
|
+
let l3 = await s3.json();
|
|
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 (e4) {
|
|
172
|
+
throw e4.message?.includes(`fetch is not defined`) && console.error(`Node.js v18+ is required`), e4;
|
|
173
|
+
}
|
|
174
|
+
}, fetchWithAuth: n2, wixAPIFetch: i2, getActiveToken: a2, getAuthHeaders: o2 }, { validateRequestSchema: u2 }));
|
|
175
|
+
}
|
|
176
|
+
var he = class extends Error {
|
|
177
|
+
response;
|
|
178
|
+
requestId;
|
|
179
|
+
constructor(e2) {
|
|
180
|
+
super(), this.response = e2.response, this.requestId = e2.requestId;
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
var ge = (e2, t2, n2, r2) => new he({ response: { data: { details: { ...!n2?.validationError && { applicationError: { description: t2, code: e2, data: r2 } }, ...n2 }, message: t2 }, status: e2 }, requestId: r2?.requestId });
|
|
184
|
+
var F = `.`;
|
|
185
|
+
function _e(e2, t2, n2) {
|
|
186
|
+
if (e2 == null) throw Error(`Cannot set value on null or undefined`);
|
|
187
|
+
let r2 = ve(t2), i2 = e2;
|
|
188
|
+
for (let e3 = 0; e3 < r2.length; e3++) {
|
|
189
|
+
let t3 = r2[e3];
|
|
190
|
+
if (e3 === r2.length - 1) {
|
|
191
|
+
i2[t3] = n2;
|
|
192
|
+
break;
|
|
193
|
+
}
|
|
194
|
+
let a2 = r2[e3 + 1];
|
|
195
|
+
(!(t3 in i2) || i2[t3] == null || typeof i2[t3] != `object` || i2[t3] === null) && (i2[t3] = typeof a2 == `number` ? [] : {}), i2 = i2[t3];
|
|
196
|
+
}
|
|
197
|
+
return e2;
|
|
198
|
+
}
|
|
199
|
+
function ve(e2) {
|
|
200
|
+
return Array.isArray(e2) ? e2 : e2.split(F).map((e3) => ye(e3) ? Number(e3) : e3);
|
|
201
|
+
}
|
|
202
|
+
function ye(e2) {
|
|
203
|
+
return /^\d+$/.test(e2);
|
|
204
|
+
}
|
|
205
|
+
function be(e2) {
|
|
206
|
+
let t2 = {};
|
|
207
|
+
for (let [n2, r2] of Object.entries(e2)) xe(n2) || _e(t2, ve(n2), r2);
|
|
208
|
+
return t2;
|
|
209
|
+
}
|
|
210
|
+
function xe(e2) {
|
|
211
|
+
return e2 === `__proto__` || e2 === `constructor` || e2 === `prototype`;
|
|
212
|
+
}
|
|
213
|
+
var Se = class {
|
|
214
|
+
BRACKET_PATTERN = /\[(\d+)\]/g;
|
|
215
|
+
NUMERIC_PATTERN = /^\d+$/;
|
|
216
|
+
ESCAPED_DOT_PATTERN = /\\\./g;
|
|
217
|
+
ESCAPED_LEFT_BRACKET_PATTERN = /\\\[/g;
|
|
218
|
+
ESCAPED_RIGHT_BRACKET_PATTERN = /\\\]/g;
|
|
219
|
+
SPLIT_PATTERN = /\.|\[(\d+)\]/g;
|
|
220
|
+
DOT_BEFORE_BRACKET_PATTERN = /\.\[/g;
|
|
221
|
+
ESCAPED_DOT_PLACEHOLDER = `__DOT__`;
|
|
222
|
+
ESCAPED_RIGHT_BRACKET_PLACEHOLDER = `__RB__`;
|
|
223
|
+
ESCAPED_LEFT_BRACKET_PLACEHOLDER = `__LB__`;
|
|
224
|
+
modifiedFields;
|
|
225
|
+
cleanedModifiedFields;
|
|
226
|
+
constructor(e2) {
|
|
227
|
+
this.modifiedFields = e2;
|
|
228
|
+
}
|
|
229
|
+
replaceEscapedCharacters(e2) {
|
|
230
|
+
return e2.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
|
+
}
|
|
232
|
+
restoreEscapedCharacters(e2) {
|
|
233
|
+
return e2.replace(this.ESCAPED_DOT_PLACEHOLDER, `\\.`).replace(this.ESCAPED_RIGHT_BRACKET_PLACEHOLDER, `\\]`).replace(this.ESCAPED_LEFT_BRACKET_PLACEHOLDER, `\\[`);
|
|
234
|
+
}
|
|
235
|
+
unflatten() {
|
|
236
|
+
return this.cleanedModifiedFields = Object.fromEntries(Object.entries(this.modifiedFields).map(([e2, t2]) => [this.replaceEscapedCharacters(this.bracketToDotNotation(e2)), t2])), be(this.cleanedModifiedFields);
|
|
237
|
+
}
|
|
238
|
+
flatten(e2) {
|
|
239
|
+
let t2 = {};
|
|
240
|
+
for (let n2 of Object.keys(this.cleanedModifiedFields)) {
|
|
241
|
+
let r2 = this.splitPath(n2), i2 = this.navigatePath(e2, r2);
|
|
242
|
+
t2 = { ...t2, ...i2 };
|
|
243
|
+
}
|
|
244
|
+
return Object.fromEntries(Object.entries(t2).map(([e3, t3]) => [this.restoreEscapedCharacters(e3), t3]));
|
|
245
|
+
}
|
|
246
|
+
splitPath(e2) {
|
|
247
|
+
let t2 = [], n2 = 0, r2 = Array.from(e2.matchAll(this.SPLIT_PATTERN));
|
|
248
|
+
for (let i2 of r2) i2.index > n2 && t2.push(e2.substring(n2, i2.index)), i2[1] && t2.push(i2[1]), n2 = i2.index + i2[0].length;
|
|
249
|
+
return n2 < e2.length && t2.push(e2.substring(n2)), t2;
|
|
250
|
+
}
|
|
251
|
+
navigatePath(e2, t2) {
|
|
252
|
+
let n2 = e2, r2 = [], i2 = (e3) => {
|
|
253
|
+
if (!Array.isArray(n2)) throw Error(`Expected array at path ${this.buildPathString(r2)}, but got ${typeof n2}`);
|
|
254
|
+
r2.push(`[${e3}]`), n2 = n2[parseInt(e3, 10)];
|
|
255
|
+
}, a2 = (e3, t3) => {
|
|
256
|
+
let i3 = e3 in O ? O[e3] : void 0;
|
|
257
|
+
if (i3 && i3 in t3) {
|
|
258
|
+
r2.push(i3), n2 = t3[i3];
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
let a3 = Ee(e3);
|
|
262
|
+
if (a3 && a3 in t3) {
|
|
263
|
+
r2.push(a3), n2 = t3[a3];
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
throw Error(`Cannot find key '${e3}' or its transformations at path ${this.buildPathString(r2)}`);
|
|
267
|
+
}, o2 = (e3, t3) => {
|
|
268
|
+
r2.push(e3), n2 = t3[e3];
|
|
269
|
+
};
|
|
270
|
+
for (let e3 of t2) {
|
|
271
|
+
if (this.NUMERIC_PATTERN.test(e3)) {
|
|
272
|
+
i2(e3);
|
|
273
|
+
continue;
|
|
274
|
+
}
|
|
275
|
+
if (typeof n2 != `object` || !n2) throw Error(`Cannot access property '${e3}' on ${typeof n2} at path ${this.buildPathString(r2)}`);
|
|
276
|
+
let t3 = n2;
|
|
277
|
+
if (e3 in n2) {
|
|
278
|
+
o2(e3, t3);
|
|
279
|
+
continue;
|
|
280
|
+
}
|
|
281
|
+
a2(e3, t3);
|
|
282
|
+
}
|
|
283
|
+
return { [this.buildPathString(r2)]: n2 };
|
|
284
|
+
}
|
|
285
|
+
buildPathString(e2) {
|
|
286
|
+
return e2.join(`.`).replace(this.DOT_BEFORE_BRACKET_PATTERN, `[`);
|
|
287
|
+
}
|
|
288
|
+
bracketToDotNotation(e2) {
|
|
289
|
+
return e2.replace(this.BRACKET_PATTERN, (t2, n2, r2) => r2 > 0 && e2[r2 - 1] === `\\` ? t2 : `.` + n2);
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
function Ce(e2, t2) {
|
|
293
|
+
let n2 = e2?.modifiedFields;
|
|
294
|
+
if (!n2) return null;
|
|
295
|
+
let r2 = we(n2);
|
|
296
|
+
if (!r2) return null;
|
|
297
|
+
let { unflattenedModifiedFields: i2, modifiedFieldsManipulator: a2 } = r2;
|
|
298
|
+
e2 = { ...e2, modifiedFields: i2 };
|
|
299
|
+
let o2 = t2(e2), s2 = o2?.modifiedFields;
|
|
300
|
+
if (!s2) return null;
|
|
301
|
+
let c2 = Te(s2, a2);
|
|
302
|
+
return c2 === null ? null : (o2.modifiedFields = c2, o2);
|
|
303
|
+
}
|
|
304
|
+
function we(e2) {
|
|
305
|
+
if (typeof e2 == `object` && e2 && !Array.isArray(e2)) try {
|
|
306
|
+
let t2 = new Se(e2);
|
|
307
|
+
return { unflattenedModifiedFields: t2.unflatten(), modifiedFieldsManipulator: t2 };
|
|
308
|
+
} catch {
|
|
309
|
+
return null;
|
|
310
|
+
}
|
|
311
|
+
return null;
|
|
312
|
+
}
|
|
313
|
+
function Te(e2, t2) {
|
|
314
|
+
if (typeof e2 == `object` && e2 && !Array.isArray(e2)) try {
|
|
315
|
+
return t2.flatten(e2);
|
|
316
|
+
} catch {
|
|
317
|
+
return null;
|
|
318
|
+
}
|
|
319
|
+
return null;
|
|
320
|
+
}
|
|
321
|
+
function Ee(e2) {
|
|
322
|
+
return e2.replace(/[-_\s]+(.)?/g, (e3, t2) => t2 ? t2.toUpperCase() : ``).replace(/^./, (e3) => e3.toLowerCase());
|
|
323
|
+
}
|
|
324
|
+
function De() {
|
|
325
|
+
return { emit(e2, ...t2) {
|
|
326
|
+
for (let n2 = 0, r2 = this.events[e2] || [], i2 = r2.length; n2 < i2; n2++) r2[n2](...t2);
|
|
327
|
+
}, events: {}, on(e2, t2) {
|
|
328
|
+
return (this.events[e2] ||= []).push(t2), () => {
|
|
329
|
+
this.events[e2] = this.events[e2]?.filter((e3) => t2 !== e3);
|
|
330
|
+
};
|
|
331
|
+
} };
|
|
332
|
+
}
|
|
333
|
+
var Oe = (e2) => e2.__type === `event-definition`;
|
|
334
|
+
function ke(e2, t2, n2, r2) {
|
|
335
|
+
let i2;
|
|
336
|
+
if (e2.isDomainEvent) {
|
|
337
|
+
let { deletedEvent: e3, actionEvent: t3, createdEvent: a3, updatedEvent: o3, ...s3 } = n2, c2 = { ...r2, ...s3 };
|
|
338
|
+
i2 = e3 ? e3?.deletedEntity ? { entity: e3?.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
|
+
} else i2 = { data: n2, metadata: r2 };
|
|
340
|
+
let a2 = e2.transformations ?? ((e3) => e3), o2 = i2, s2 = i2;
|
|
341
|
+
if (s2.modifiedFields) {
|
|
342
|
+
let e3 = s2.modifiedFields;
|
|
343
|
+
if (typeof e3 == `object` && e3 && !Array.isArray(e3)) {
|
|
344
|
+
o2 = structuredClone(i2);
|
|
345
|
+
let e4 = Ce(s2, a2);
|
|
346
|
+
if (e4) return t2(e4);
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
return t2(a2(o2));
|
|
350
|
+
}
|
|
351
|
+
function Ae(e2) {
|
|
352
|
+
let t2 = /* @__PURE__ */ new Map(), n2 = De();
|
|
353
|
+
return { initModule(e3) {
|
|
354
|
+
return (r2) => {
|
|
355
|
+
let i2 = t2.get(e3.type) ?? [];
|
|
356
|
+
i2.push({ eventDefinition: e3, handler: r2 }), t2.set(e3.type, i2), n2.emit(`registered`, e3);
|
|
357
|
+
};
|
|
358
|
+
}, client: { ...n2, getRegisteredEvents: () => t2, async process(e3, n3 = { expectedEvents: [] }) {
|
|
359
|
+
let { eventType: r2, identity: i2, instanceId: a2, payload: o2, accountInfo: s2 } = await this.parseJWT(e3), c2 = [...n3.expectedEvents, ...Array.from(t2.keys()).map((e4) => ({ type: e4 }))];
|
|
360
|
+
if (c2.length > 0 && !c2.some(({ type: e4 }) => e4 === r2)) throw Error(`Unexpected event type: ${r2}. Expected one of: ${c2.map((e4) => e4.type).join(`, `)}`);
|
|
361
|
+
let l2 = t2.get(r2) ?? [];
|
|
362
|
+
return await Promise.all(l2.map(({ eventDefinition: e4, handler: t3 }) => ke(e4, t3, o2, { instanceId: a2, identity: i2, accountInfo: s2 }))), { instanceId: a2, eventType: r2, payload: o2, identity: i2, accountInfo: s2 };
|
|
363
|
+
}, async processRequest(e3, t3) {
|
|
364
|
+
let n3 = await e3.text();
|
|
365
|
+
return this.process(n3, t3);
|
|
366
|
+
}, async parseJWT(t3) {
|
|
367
|
+
let n3 = e2();
|
|
368
|
+
if (!n3.decodeJWT) throw Error(`decodeJWT is not supported by the authentication strategy`);
|
|
369
|
+
let { decoded: r2, valid: i2 } = await n3.decodeJWT(t3);
|
|
370
|
+
if (!i2) throw Error(`JWT is not valid`);
|
|
371
|
+
if (typeof r2.data != `string`) throw Error(`Unexpected type of JWT data: expected string, got ${typeof r2.data}`);
|
|
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
|
+
return { instanceId: c2, eventType: o2, payload: JSON.parse(a2.data), identity: l2, accountInfo: s2 };
|
|
374
|
+
}, async parseRequest(e3) {
|
|
375
|
+
let t3 = await e3.text();
|
|
376
|
+
return this.parseJWT(t3);
|
|
377
|
+
}, async executeHandlers(e3) {
|
|
378
|
+
let n3 = Array.from(t2.keys()).map((e4) => ({ type: e4 }));
|
|
379
|
+
if (n3.length > 0 && !n3.some(({ type: t3 }) => t3 === e3.eventType)) throw Error(`Unexpected event type: ${e3.eventType}. Expected one of: ${n3.map((e4) => e4.type).join(`, `)}`);
|
|
380
|
+
let r2 = t2.get(e3.eventType) ?? [];
|
|
381
|
+
await Promise.all(r2.map(({ eventDefinition: t3, handler: n4 }) => ke(t3, n4, e3.payload, { instanceId: e3.instanceId, identity: e3.identity })));
|
|
382
|
+
}, apps: { AppInstalled: h(`AppInstalled`)(), AppRemoved: h(`AppRemoved`)() } } };
|
|
383
|
+
}
|
|
384
|
+
var je = (e2) => e2.__type === `service-plugin-definition`;
|
|
385
|
+
function Me(e2) {
|
|
386
|
+
let t2 = /* @__PURE__ */ new Map(), n2 = De();
|
|
387
|
+
return { initModule(e3) {
|
|
388
|
+
return (r2) => {
|
|
389
|
+
let i2 = t2.get(e3.componentType.toLowerCase()) ?? [];
|
|
390
|
+
i2.push({ servicePluginDefinition: e3, implementation: r2 }), t2.set(e3.componentType.toLowerCase(), i2), n2.emit(`registered`, e3);
|
|
391
|
+
};
|
|
392
|
+
}, client: { ...n2, getRegisteredServicePlugins: () => t2, async parseJWT(t3) {
|
|
393
|
+
let n3 = e2();
|
|
394
|
+
if (!n3.decodeJWT) throw Error(`decodeJWT is not supported by the authentication strategy`);
|
|
395
|
+
let { decoded: r2, valid: i2 } = await n3.decodeJWT(t3, true);
|
|
396
|
+
if (!i2) throw Error(`JWT is not valid`);
|
|
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
|
+
return r2.data;
|
|
399
|
+
}, async process(e3) {
|
|
400
|
+
let t3 = await this.parseJWT(e3.body);
|
|
401
|
+
return this.executeHandler(t3, e3.url);
|
|
402
|
+
}, async parseRequest(e3) {
|
|
403
|
+
let t3 = await e3.text();
|
|
404
|
+
return this.parseJWT(t3);
|
|
405
|
+
}, async processRequest(e3) {
|
|
406
|
+
let t3 = await this.parseRequest(e3);
|
|
407
|
+
return this.processParsedRequest(t3, e3.url);
|
|
408
|
+
}, async processParsedRequest(e3, t3) {
|
|
409
|
+
try {
|
|
410
|
+
let n3 = await this.executeHandler(e3, t3);
|
|
411
|
+
return Response.json(n3);
|
|
412
|
+
} catch (e4) {
|
|
413
|
+
if (e4.errorType === `SPI` && e4.applicationCode && e4.httpCode) return Response.json({ applicationError: { code: e4.applicationCode, data: e4.data } }, { status: e4.httpCode });
|
|
414
|
+
throw e4;
|
|
415
|
+
}
|
|
416
|
+
}, async executeHandler(e3, n3) {
|
|
417
|
+
let r2 = e3.metadata.appExtensionType.toLowerCase(), i2 = t2.get(r2) ?? [];
|
|
418
|
+
if (i2.length === 0) throw Error(`No service plugin implementations found for component type ${r2}`);
|
|
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((e4) => n3.endsWith(e4.primaryHttpMappingPath));
|
|
421
|
+
if (!s2) throw Error(`Unexpect request: request url did not match any method: ` + n3);
|
|
422
|
+
let c2 = a2[s2.name];
|
|
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(e3)));
|
|
425
|
+
} } };
|
|
426
|
+
}
|
|
427
|
+
var Ne = `X-Wix-Consistent`;
|
|
428
|
+
function Pe(e2) {
|
|
429
|
+
let t2 = e2.headers || { Authorization: `` }, n2 = { getAuthHeaders: (e3) => Promise.resolve({ headers: {} }) }, r2 = e2.auth, i2 = typeof r2 == `function` ? r2 : () => r2 ?? n2, a2 = () => i2().getAuthHeaders(e2.host), o2 = () => e2.fetch ?? fetch, s2 = async (n3, r3) => {
|
|
430
|
+
let i3 = o2(), s3 = await a2(), c3 = { ...r3?.headers ?? {}, ...s3.headers, ...e2.host?.essentials?.passThroughHeaders, ...t2[`X-Wix-Consistent`] ? { [Ne]: t2[Ne] } : {} }, l3 = e2.host?.getErrorHandler?.();
|
|
431
|
+
try {
|
|
432
|
+
if (typeof n3 == `string` || n3 instanceof URL) {
|
|
433
|
+
let e3 = await i3(n3, { ...r3, headers: c3 });
|
|
434
|
+
l3?.handleError(e3, { requestOptions: { url: n3.toString(), method: r3?.method } });
|
|
435
|
+
let a3 = Fe(e3);
|
|
436
|
+
return a3 && (t2[Ne] = a3), e3;
|
|
437
|
+
}
|
|
438
|
+
{
|
|
439
|
+
for (let [e4, t3] of Object.entries(c3)) typeof t3 == `string` && n3.headers.set(e4, t3);
|
|
440
|
+
let e3 = await i3(n3, r3);
|
|
441
|
+
l3?.handleError(e3, { requestOptions: { url: n3.url, method: r3?.method } });
|
|
442
|
+
let a3 = Fe(e3);
|
|
443
|
+
return a3 && (t2[Ne] = a3), e3;
|
|
444
|
+
}
|
|
445
|
+
} catch (e3) {
|
|
446
|
+
throw l3?.handleError(e3, { requestOptions: { url: typeof n3 == `string` || n3 instanceof URL ? n3.toString() : n3.url, method: r3?.method } }), e3;
|
|
447
|
+
}
|
|
448
|
+
}, { client: c2, initModule: l2 } = Me(i2), { client: u2, initModule: d2 } = Ae(i2), f2 = async (n3, r3) => {
|
|
449
|
+
let i3 = o2(), s3 = await a2(), c3 = C(r3), l3 = await i3(n3, { ...r3, headers: { ...c3, ...t2, ...s3?.headers, ...r3?.headers, ...e2.host?.essentials?.passThroughHeaders, ...t2[`X-Wix-Consistent`] ? { [Ne]: t2[Ne] } : {} } }), u3 = Fe(l3);
|
|
450
|
+
return u3 && (t2[Ne] = u3), l3;
|
|
451
|
+
}, p2 = (t3, n3) => {
|
|
452
|
+
if (Oe(t3)) return d2(t3);
|
|
453
|
+
if (je(t3)) return l2(t3);
|
|
454
|
+
if (T(t3) && e2.host) return ee(t3, e2.host);
|
|
455
|
+
if (typeof t3 == `function`) {
|
|
456
|
+
if (`__type` in t3 && t3.__type === `wix_spi_error`) return t3;
|
|
457
|
+
let r3 = e2.host?.apiBaseUrl ?? `www.wixapis.com`, o3 = e2.useCDN === void 0 ? i2().shouldUseCDN : e2.useCDN;
|
|
458
|
+
return me(ne(() => v(t3)) ? _(t3) : t3, n3 ?? {}, f2, e2.host?.getErrorHandler?.(), (e3, t4) => {
|
|
459
|
+
let n4 = new URL(e3, `https://${r3}`);
|
|
460
|
+
return n4.host = r3, n4.protocol = `https`, f2(n4.toString(), t4);
|
|
461
|
+
}, i2().getActiveToken, async () => a2(), { HTTPHost: r3 }, e2.host?.name, o3, e2.validateRequestSchema);
|
|
462
|
+
}
|
|
463
|
+
return w(t3) ? Object.fromEntries(Object.entries(t3).map(([e3, n4]) => [e3, p2(n4, t3[y])])) : t3;
|
|
464
|
+
}, h2 = (e3) => {
|
|
465
|
+
for (let n3 in e3) t2[n3] = e3[n3];
|
|
466
|
+
};
|
|
467
|
+
return { ...e2.modules ? p2(e2.modules) : {}, get auth() {
|
|
468
|
+
let t3 = i2();
|
|
469
|
+
return t3.getAuthHeaders = t3.getAuthHeaders.bind(void 0, e2.host), t3;
|
|
470
|
+
}, setHeaders: h2, use: p2, enableContext(e3, t3 = { elevated: false }) {
|
|
471
|
+
e3 === `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 ? m.elevatedClient = this : m.client = this;
|
|
472
|
+
}, fetch: (t3, n3) => {
|
|
473
|
+
let r3 = e2.host?.apiBaseUrl ?? `www.wixapis.com`, i3 = new URL(t3, `https://${r3}`);
|
|
474
|
+
return i3.host = r3, i3.protocol = `https`, f2(i3.toString(), n3);
|
|
475
|
+
}, fetchWithAuth: s2, async graphql(t3, n3, r3 = { apiVersion: `alpha` }) {
|
|
476
|
+
let i3 = e2?.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 x(`GraphQL request failed with status ${a3.status}`, a3);
|
|
478
|
+
let { data: o3, errors: s3 } = await a3.json();
|
|
479
|
+
return { data: o3 ?? {}, errors: s3 };
|
|
480
|
+
}, webhooks: u2, servicePlugins: c2 };
|
|
481
|
+
}
|
|
482
|
+
function Fe(e2) {
|
|
483
|
+
return e2.headers?.get(`X-Wix-Consistent`) ?? e2.headers?.get(`x-wix-consistent`);
|
|
484
|
+
}
|
|
485
|
+
var Ie = { _id: `id`, _createdDate: `createdDate`, _updatedDate: `updatedDate` };
|
|
486
|
+
var Le = { id: `_id`, createdDate: `_createdDate`, updatedDate: `_updatedDate` };
|
|
487
|
+
function Re(e2, t2) {
|
|
488
|
+
return e2?.split(`.`).map((e3) => t2?.[e3] ?? e3).join(`.`);
|
|
489
|
+
}
|
|
490
|
+
var ze = `sort.fieldName`;
|
|
491
|
+
function Be(e2, t2, n2) {
|
|
492
|
+
return (e2 === ze || e2.endsWith(`.${ze}`)) && typeof t2 == `string` ? Re(t2, n2) : t2;
|
|
493
|
+
}
|
|
494
|
+
function Ve(e2, t2, n2) {
|
|
495
|
+
let r2 = (e3) => n2.includes(e3), i2 = (e3, n3) => {
|
|
496
|
+
if (Array.isArray(e3)) e3.forEach((e4) => {
|
|
497
|
+
i2(e4, n3);
|
|
498
|
+
});
|
|
499
|
+
else if (typeof e3 == `object` && e3) {
|
|
500
|
+
let a2 = e3;
|
|
501
|
+
Object.keys(a2).forEach((e4) => {
|
|
502
|
+
let o2 = n3 === `` ? e4 : `${n3}.${e4}`;
|
|
503
|
+
if (r2(o2)) return;
|
|
504
|
+
let s2 = I(e4, t2);
|
|
505
|
+
s2 !== e4 && !(s2 in a2) && (a2[s2] = a2[e4], delete a2[e4]), a2[s2] = Be(o2, a2[s2], t2), i2(a2[s2], o2);
|
|
506
|
+
});
|
|
507
|
+
}
|
|
508
|
+
};
|
|
509
|
+
return i2(e2, ``), e2;
|
|
510
|
+
}
|
|
511
|
+
function I(e2, t2) {
|
|
512
|
+
let n2;
|
|
513
|
+
return n2 = e2.includes(`.`) ? e2.split(`.`).map((e3) => t2[e3] ?? e3).join(`.`) : t2[e2] ?? e2, n2;
|
|
514
|
+
}
|
|
515
|
+
function He(e2, t2 = []) {
|
|
516
|
+
return Ve(e2, Ie, t2);
|
|
517
|
+
}
|
|
518
|
+
function L(e2, t2 = []) {
|
|
519
|
+
return Ve(e2, Le, t2);
|
|
520
|
+
}
|
|
521
|
+
function Ue(e2) {
|
|
522
|
+
return e2?.toISOString();
|
|
523
|
+
}
|
|
524
|
+
function We(e2) {
|
|
525
|
+
return e2 ? new Date(e2) : void 0;
|
|
526
|
+
}
|
|
527
|
+
var Ge = /* @__PURE__ */ new WeakMap();
|
|
528
|
+
function Ke() {
|
|
529
|
+
return { leaves: void 0, fields: void 0, mapFields: void 0, anyField: void 0 };
|
|
530
|
+
}
|
|
531
|
+
function qe(e2, t2) {
|
|
532
|
+
let n2 = e2.get(t2);
|
|
533
|
+
return n2 || (n2 = Ke(), e2.set(t2, n2)), n2;
|
|
534
|
+
}
|
|
535
|
+
function Je(e2, t2) {
|
|
536
|
+
return t2 === `*` ? (e2.anyField ??= Ke(), e2.anyField) : t2.endsWith(`{}`) ? (e2.mapFields ??= /* @__PURE__ */ new Map(), qe(e2.mapFields, t2.slice(0, -2))) : (e2.fields ??= /* @__PURE__ */ new Map(), qe(e2.fields, t2));
|
|
537
|
+
}
|
|
538
|
+
function Ye(e2) {
|
|
539
|
+
let t2 = Ke();
|
|
540
|
+
for (let n2 of e2) {
|
|
541
|
+
let e3 = n2.path.split(`.`).reduce(Je, t2);
|
|
542
|
+
e3.leaves ??= [], e3.leaves.push(n2);
|
|
543
|
+
}
|
|
544
|
+
return t2;
|
|
545
|
+
}
|
|
546
|
+
function R(e2) {
|
|
547
|
+
let t2 = Ge.get(e2);
|
|
548
|
+
return t2 || (t2 = Ye(e2), Ge.set(e2, t2)), t2;
|
|
549
|
+
}
|
|
550
|
+
function Xe(e2) {
|
|
551
|
+
return typeof e2 == `object` && !!e2;
|
|
552
|
+
}
|
|
553
|
+
function Ze(e2, { isRepeated: t2, isMap: n2 }, r2) {
|
|
554
|
+
return t2 ? Array.isArray(e2) ? e2.map(r2) : e2 : n2 ? Xe(e2) ? Object.fromEntries(Object.entries(e2).map(([e3, t3]) => [e3, r2(t3)])) : e2 : r2(e2);
|
|
555
|
+
}
|
|
556
|
+
function Qe(e2, t2, n2) {
|
|
557
|
+
Xe(e2) && tt(e2, t2, n2);
|
|
558
|
+
}
|
|
559
|
+
function $e(e2, t2, n2) {
|
|
560
|
+
for (let [r2, i2] of t2) {
|
|
561
|
+
if (!(r2 in e2)) continue;
|
|
562
|
+
if (i2.leaves) for (let t4 of i2.leaves) e2[r2] = Ze(e2[r2], t4, n2);
|
|
563
|
+
let t3 = e2[r2];
|
|
564
|
+
Array.isArray(t3) ? t3.forEach((e3) => Qe(e3, i2, n2)) : Qe(t3, i2, n2);
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
function et(e2, t2, n2) {
|
|
568
|
+
for (let [r2, i2] of t2) {
|
|
569
|
+
let t3 = e2[r2];
|
|
570
|
+
Xe(t3) && Object.values(t3).forEach((e3) => Qe(e3, i2, n2));
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
function tt(e2, { fields: t2, mapFields: n2, anyField: r2 }, i2) {
|
|
574
|
+
t2 && $e(e2, t2, i2), n2 && et(e2, n2, i2), r2 && Object.values(e2).forEach((e3) => Qe(e3, r2, i2));
|
|
575
|
+
}
|
|
576
|
+
function nt(e2, t2) {
|
|
577
|
+
if (!Xe(e2)) return e2;
|
|
578
|
+
for (let { paths: n2, transformFn: r2 } of t2) tt(e2, R(n2), r2);
|
|
579
|
+
return e2;
|
|
580
|
+
}
|
|
581
|
+
function rt(e2) {
|
|
582
|
+
return ct(e2).map((e3) => e3.toLocaleUpperCase()).join(`_`);
|
|
583
|
+
}
|
|
584
|
+
var it = /([\p{Ll}\d])(\p{Lu})/gu;
|
|
585
|
+
var at = /(\p{Lu})([\p{Lu}][\p{Ll}])/gu;
|
|
586
|
+
var ot = `$1\0$2`;
|
|
587
|
+
var st = /[^\p{L}\d]+/giu;
|
|
588
|
+
function ct(e2) {
|
|
589
|
+
let t2 = e2.trim();
|
|
590
|
+
t2 = t2.replace(it, ot).replace(at, ot), t2 = t2.replace(st, `\0`);
|
|
591
|
+
let n2 = 0, r2 = t2.length;
|
|
592
|
+
for (; t2.charAt(n2) === `\0`; ) n2++;
|
|
593
|
+
if (n2 === r2) return [];
|
|
594
|
+
for (; t2.charAt(r2 - 1) === `\0`; ) r2--;
|
|
595
|
+
return t2.slice(n2, r2).split(/\0/g);
|
|
596
|
+
}
|
|
597
|
+
var lt = (e2) => `validationError` in (e2.response?.data?.details ?? {});
|
|
598
|
+
var ut = (e2) => `applicationError` in (e2.response?.data?.details ?? {});
|
|
599
|
+
var dt = (e2) => (e2.response?.status ?? -1) >= 400 && (e2.response?.status ?? -1) < 500;
|
|
600
|
+
function ft(e2, t2 = { explicitPathsToArguments: {}, spreadPathsToArguments: {}, singleArgumentUnchanged: false }, n2 = []) {
|
|
601
|
+
if (typeof e2 != `object` || !e2) throw e2;
|
|
602
|
+
if (lt(e2)) return pt(e2, t2, n2);
|
|
603
|
+
if (ut(e2)) return ht(e2);
|
|
604
|
+
if (dt(e2)) {
|
|
605
|
+
let t3 = e2.response?.status, n3 = e2.response?.statusText ?? `UNKNOWN`, r2 = e2.response?.data?.message ?? n3, i2 = { applicationError: { description: n3, code: rt(n3), data: {} }, requestId: e2.requestId };
|
|
606
|
+
return mt(e2, { message: JSON.stringify({ message: r2, details: i2 }, null, 2), extraProperties: { details: i2, status: t3 } });
|
|
607
|
+
}
|
|
608
|
+
return z(e2);
|
|
609
|
+
}
|
|
610
|
+
var pt = (e2, t2, n2) => {
|
|
611
|
+
let r2 = e2.response?.data, i2 = e2.requestId, { fieldViolations: a2 } = r2.details.validationError, o2 = gt(t2, a2, n2)?.sort((e3, t3) => e3.field < t3.field ? -1 : 1), s2 = `INVALID_ARGUMENT: ${o2?.map(({ field: e3, description: t3 }) => `"${e3}" ${t3}`)?.join(`, `)}`, c2 = { validationError: { fieldViolations: o2 }, requestId: i2 };
|
|
612
|
+
return mt(e2, { message: JSON.stringify({ message: s2, details: c2 }, null, 2), extraProperties: { details: c2, status: e2.response?.status, requestId: i2 } });
|
|
613
|
+
};
|
|
614
|
+
var mt = (e2, { message: t2, extraProperties: n2 }) => Object.assign(e2, { ...n2, message: t2 });
|
|
615
|
+
var ht = (e2) => {
|
|
616
|
+
let t2 = e2.response?.status, n2 = e2.response?.statusText ?? `UNKNOWN`, r2 = e2.response?.data?.message ?? n2, i2 = e2.response?.data?.details?.applicationError?.description ?? n2, a2 = e2.response?.data?.details?.applicationError?.code ?? rt(n2), o2 = e2.response?.data?.details?.applicationError?.data ?? {}, s2 = r2 === i2 ? r2 : `${r2}: ${i2}`, c2 = { applicationError: { description: i2, code: a2, data: o2 }, requestId: e2.requestId };
|
|
617
|
+
return mt(e2, { message: JSON.stringify({ message: s2, details: c2 }, null, 2), extraProperties: { details: c2, status: t2, requestId: e2.requestId } });
|
|
618
|
+
};
|
|
619
|
+
var z = (e2) => mt(e2, { message: e2.requestId ? `System error occurred, request-id: ${e2.requestId}` : `System error occurred: ${JSON.stringify(e2)}`, extraProperties: { requestId: e2.requestId, status: e2.response?.status, code: rt(e2.response?.statusText ?? `UNKNOWN`), ...!e2.response && { runtimeError: e2 } } });
|
|
620
|
+
var gt = ({ spreadPathsToArguments: e2, explicitPathsToArguments: t2, singleArgumentUnchanged: n2 }, r2, i2) => {
|
|
621
|
+
let a2 = { ...e2, ...t2 }, o2 = Object.keys(a2);
|
|
622
|
+
return r2?.filter((e3) => !r2.some((t3) => t3.field.length > e3.field.length && t3.field.startsWith(e3.field) && o2.includes(t3.field))).map((e3) => {
|
|
623
|
+
let r3 = t2[e3.field];
|
|
624
|
+
if (r3) return { ...e3, field: _t(r3, i2) };
|
|
625
|
+
let s2 = o2?.sort((e4, t3) => t3.length - e4.length)?.find((t3) => e3.field.startsWith(t3));
|
|
626
|
+
if (s2) {
|
|
627
|
+
let t3 = a2[s2];
|
|
628
|
+
if (t3) return { ...e3, field: e3.field.replace(s2, _t(t3, i2)) };
|
|
629
|
+
}
|
|
630
|
+
return n2 ? { ...e3, field: `${i2[0]}.${e3.field}` } : e3;
|
|
631
|
+
});
|
|
632
|
+
};
|
|
633
|
+
var _t = (e2, t2) => {
|
|
634
|
+
let n2 = vt(e2);
|
|
635
|
+
return n2 == null ? e2 : e2.replace(`$[${n2}]`, t2[n2]);
|
|
636
|
+
};
|
|
637
|
+
var vt = (e2) => {
|
|
638
|
+
let t2 = e2.match(/\$\[(?<argIndex>\d+)\]/);
|
|
639
|
+
return t2 && t2.groups && Number(t2.groups.argIndex);
|
|
640
|
+
};
|
|
641
|
+
function yt() {
|
|
642
|
+
let e2 = typeof $wixContext < `u` && $wixContext.initWixModules ? $wixContext.initWixModules : globalThis.__wix_context__ !== void 0 && globalThis.__wix_context__.initWixModules ? globalThis.__wix_context__.initWixModules : void 0;
|
|
643
|
+
if (e2) return { initWixModules(t3, n3) {
|
|
644
|
+
return bt(() => e2(t3, n3));
|
|
645
|
+
}, fetchWithAuth() {
|
|
646
|
+
throw Error(`fetchWithAuth is not available in this context`);
|
|
647
|
+
}, graphql() {
|
|
648
|
+
throw Error(`graphql is not available in this context`);
|
|
649
|
+
} };
|
|
650
|
+
let t2 = typeof $wixContext < `u` ? $wixContext.client : m.client === void 0 ? globalThis.__wix_context__ === void 0 ? void 0 : globalThis.__wix_context__.client : m.client, n2 = typeof $wixContext < `u` ? $wixContext.elevatedClient : m.elevatedClient === void 0 ? globalThis.__wix_context__ === void 0 ? void 0 : globalThis.__wix_context__.elevatedClient : m.elevatedClient;
|
|
651
|
+
if (t2 || n2) return { initWixModules(e3, r2) {
|
|
652
|
+
if (r2) {
|
|
653
|
+
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`);
|
|
654
|
+
return bt(() => n2.use(e3));
|
|
655
|
+
}
|
|
656
|
+
if (!t2) throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);
|
|
657
|
+
return bt(() => t2.use(e3));
|
|
658
|
+
}, fetchWithAuth: (e3, n3) => {
|
|
659
|
+
if (!t2) throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);
|
|
660
|
+
return t2.fetchWithAuth(e3, n3);
|
|
661
|
+
}, getAuth() {
|
|
662
|
+
if (!t2) throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);
|
|
663
|
+
return t2.auth;
|
|
664
|
+
}, async graphql(e3, n3, r2) {
|
|
665
|
+
if (!t2) throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);
|
|
666
|
+
return t2.graphql(e3, n3, r2);
|
|
667
|
+
} };
|
|
668
|
+
}
|
|
669
|
+
function bt(e2) {
|
|
670
|
+
let t2 = globalThis.__wix_context__, n2 = { client: m.client, elevatedClient: m.elevatedClient }, r2;
|
|
671
|
+
globalThis.__wix_context__ = void 0, m.client = void 0, m.elevatedClient = void 0, typeof $wixContext < `u` && (r2 = { client: $wixContext?.client, elevatedClient: $wixContext?.elevatedClient }, delete $wixContext.client, delete $wixContext.elevatedClient);
|
|
672
|
+
try {
|
|
673
|
+
return e2();
|
|
674
|
+
} finally {
|
|
675
|
+
globalThis.__wix_context__ = t2, m.client = n2.client, m.elevatedClient = n2.elevatedClient, typeof $wixContext < `u` && ($wixContext.client = r2.client, $wixContext.elevatedClient = r2.elevatedClient);
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
function xt(e2, t2) {
|
|
679
|
+
return (...n2) => {
|
|
680
|
+
let r2 = yt();
|
|
681
|
+
return r2 ? r2.initWixModules(e2, t2).apply(void 0, n2) : e2.apply(void 0, n2);
|
|
682
|
+
};
|
|
683
|
+
}
|
|
684
|
+
function B(e2, t2 = false) {
|
|
685
|
+
return xt(e2, t2);
|
|
686
|
+
}
|
|
687
|
+
function St(e2, t2) {
|
|
688
|
+
let n2 = wt(e2), r2 = Object.entries(n2).some(([e3, t3]) => e3.includes(`.`) || Array.isArray(t3) && t3.some((e4) => typeof e4 == `object`));
|
|
689
|
+
return t2 && r2 ? new URLSearchParams({ ".r": Et(JSON.stringify(e2)) }) : Object.entries(n2).reduce((e3, [t3, n3]) => ((Array.isArray(n3) ? n3 : [n3]).forEach((r3) => {
|
|
690
|
+
r3 == null || Array.isArray(n3) && typeof r3 == `object` || e3.append(t3, r3);
|
|
691
|
+
}), e3), new URLSearchParams());
|
|
692
|
+
}
|
|
693
|
+
function Ct(e2) {
|
|
694
|
+
let t2 = V(Lt(e2.host), e2.domainToMappings);
|
|
695
|
+
return qt(Wt(e2.protoPath, e2.data || {}), t2);
|
|
696
|
+
}
|
|
697
|
+
function wt(e2, t2 = ``) {
|
|
698
|
+
let n2 = {};
|
|
699
|
+
return Object.entries(e2).forEach(([e3, r2]) => {
|
|
700
|
+
let i2 = typeof r2 == `object` && !!r2 && !Array.isArray(r2), a2 = Tt(t2, e3);
|
|
701
|
+
if (i2) {
|
|
702
|
+
let e4 = wt(r2, a2);
|
|
703
|
+
Object.assign(n2, e4);
|
|
704
|
+
} else n2[a2] = r2;
|
|
705
|
+
}), n2;
|
|
706
|
+
}
|
|
707
|
+
function Tt(e2, t2) {
|
|
708
|
+
return `${e2}${e2 ? `.` : ``}${t2}`;
|
|
709
|
+
}
|
|
710
|
+
var Et = (e2) => {
|
|
711
|
+
let t2 = new TextEncoder().encode(e2);
|
|
712
|
+
return (typeof btoa < `u` ? btoa(String.fromCodePoint(...t2)) : Buffer.from(e2, `utf-8`).toString(`base64`)).replace(/=/g, ``).replace(/\+/g, `-`).replace(/\//g, `_`);
|
|
713
|
+
};
|
|
714
|
+
var Dt = [`wix.com`, `editorx.com`];
|
|
715
|
+
var Ot = `_`;
|
|
716
|
+
var kt = `*.`;
|
|
717
|
+
var At = RegExp(`\\.(${Dt.join(`|`)})$`);
|
|
718
|
+
var jt = [`42.wixprod.net`, `uw2-edt-1.wixprod.net`, `virginia-edt.wixprod.net`];
|
|
719
|
+
var Mt = { "payments.base44.com": `manage.wix.com`, "create.editorx.com": `editor.editorx.com` };
|
|
720
|
+
var Nt = `dev.wix-code.com`;
|
|
721
|
+
var Pt = /{(.*)}/;
|
|
722
|
+
var Ft = RegExp(`\\.(${jt.join(`|`)})$`);
|
|
723
|
+
var It = RegExp(`.*\\.${Nt}$`);
|
|
724
|
+
function Lt(e2) {
|
|
725
|
+
return Rt(e2).replace(At, `._base_domain_`).replace(Ft, `._api_base_domain_`).replace(It, `*.dev.wix-code.com`);
|
|
726
|
+
}
|
|
727
|
+
function Rt(e2) {
|
|
728
|
+
return Mt[e2] ?? e2;
|
|
729
|
+
}
|
|
730
|
+
function V(e2, t2) {
|
|
731
|
+
let n2 = t2[e2];
|
|
732
|
+
if (n2) return n2;
|
|
733
|
+
let r2 = zt(e2, t2) ?? Bt(e2, t2);
|
|
734
|
+
if (!r2) {
|
|
735
|
+
if (Ht(e2)) {
|
|
736
|
+
let e3 = t2[Ut];
|
|
737
|
+
if (e3) return e3;
|
|
738
|
+
}
|
|
739
|
+
let n3 = t2[Ot];
|
|
740
|
+
if (n3) return n3;
|
|
741
|
+
}
|
|
742
|
+
return r2 ?? [];
|
|
743
|
+
}
|
|
744
|
+
function zt(e2, t2) {
|
|
745
|
+
return Object.entries(t2).find(([t3]) => {
|
|
746
|
+
let [, ...n2] = e2.split(`.`);
|
|
747
|
+
return n2.join(`.`) === t3;
|
|
748
|
+
})?.[1];
|
|
749
|
+
}
|
|
750
|
+
function Bt(e2, t2) {
|
|
751
|
+
let [n2] = Object.entries(t2).filter(([t3]) => Vt(e2, t3)).sort(([e3], [t3]) => t3.length - e3.length);
|
|
752
|
+
if (!n2) return;
|
|
753
|
+
let [, r2] = n2;
|
|
754
|
+
return r2;
|
|
755
|
+
}
|
|
756
|
+
function Vt(e2, t2) {
|
|
757
|
+
if (!t2.startsWith(kt)) return false;
|
|
758
|
+
let n2 = t2.slice(1);
|
|
759
|
+
return e2.length > n2.length && e2.endsWith(n2);
|
|
760
|
+
}
|
|
761
|
+
function Ht(e2) {
|
|
762
|
+
return !!e2.match(/\._base_domain_$/);
|
|
763
|
+
}
|
|
764
|
+
var Ut = `www._base_domain_`;
|
|
765
|
+
function Wt(e2, t2) {
|
|
766
|
+
return e2.split(`/`).map((e3) => Gt(e3, t2)).join(`/`);
|
|
767
|
+
}
|
|
768
|
+
function Gt(e2, t2) {
|
|
769
|
+
let n2 = e2.match(Pt) || [], r2 = n2[1];
|
|
770
|
+
return r2 ? Kt(t2, r2, e2, e2.replace(n2[0], ``)) : e2;
|
|
771
|
+
}
|
|
772
|
+
function Kt(e2, t2, n2, r2) {
|
|
773
|
+
let i2 = e2;
|
|
774
|
+
for (let e3 of t2.split(`.`)) {
|
|
775
|
+
if (!i2) return n2;
|
|
776
|
+
i2 = i2[e3];
|
|
777
|
+
}
|
|
778
|
+
return `${i2}${r2}`;
|
|
779
|
+
}
|
|
780
|
+
function qt(e2, t2) {
|
|
781
|
+
let n2 = t2?.find((t3) => e2.startsWith(t3.destPath));
|
|
782
|
+
return n2 ? n2.srcPath + e2.slice(n2.destPath.length) : e2;
|
|
783
|
+
}
|
|
784
|
+
function Jt(e2) {
|
|
785
|
+
return e2 === `NaN` ? NaN : e2 === `Infinity` ? 1 / 0 : e2 === `-Infinity` ? -1 / 0 : e2;
|
|
786
|
+
}
|
|
787
|
+
var Yt = `x-wix-linguist`;
|
|
788
|
+
var Xt = `00000000-0000-0000-0000-000000000000`;
|
|
789
|
+
var Zt = `false`;
|
|
790
|
+
var H = () => {
|
|
791
|
+
let e2 = $t(`language`), t2 = $t(`locale`);
|
|
792
|
+
if (e2) return { [Yt]: [e2, t2 || e2, Zt, Xt].join(`|`) };
|
|
793
|
+
};
|
|
794
|
+
function Qt() {
|
|
795
|
+
let e2 = null, t2 = null;
|
|
796
|
+
return { promise: new Promise((n2, r2) => {
|
|
797
|
+
e2 = n2, t2 = r2;
|
|
798
|
+
}), resolve: e2, reject: t2 };
|
|
799
|
+
}
|
|
800
|
+
var $t = (e2) => typeof window < `u` ? window.commonConfig?.[e2] : void 0;
|
|
801
|
+
var en = ({ createHost: e2 }) => ({ __type: `host`, create: (e3) => ({}), host: (t2) => {
|
|
802
|
+
let { applicationId: n2, componentId: r2 } = t2 ?? {}, i2 = typeof window < `u` ? window.wixEmbedsAPI : void 0, a2 = e2(t2), o2 = nn();
|
|
803
|
+
return { ...a2, apiBaseUrl: o2, getMonitoringClient: i2?.getMonitoringClientFunction?.(n2, r2), essentials: { language: $t(`language`), locale: $t(`locale`), get passThroughHeaders() {
|
|
804
|
+
return H();
|
|
805
|
+
} } };
|
|
806
|
+
}, auth: (e3) => {
|
|
807
|
+
let t2 = typeof window < `u` ? window.wixEmbedsAPI : void 0;
|
|
808
|
+
!e3 && tn() && (e3 = t2?.getAccessTokenFunction?.());
|
|
809
|
+
let n2 = false, { resolve: r2, promise: i2 } = Qt();
|
|
810
|
+
return { getAuthHeaders: async () => {
|
|
811
|
+
if (!e3 && n2 && (e3 = await i2), !e3) throw Error(`Failed to resolve auth token`);
|
|
812
|
+
return { headers: { Authorization: await e3() } };
|
|
813
|
+
}, getAccessTokenInjector: () => (n2 = true, (e4) => {
|
|
814
|
+
r2(e4);
|
|
815
|
+
}) };
|
|
816
|
+
} });
|
|
817
|
+
function tn() {
|
|
818
|
+
return typeof document < `u` && document.currentScript?.tagName === `SCRIPT`;
|
|
819
|
+
}
|
|
820
|
+
function nn() {
|
|
821
|
+
let e2 = (typeof window < `u` ? window.wixEmbedsAPI : void 0)?.getExternalBaseUrl?.();
|
|
822
|
+
if (!e2) return;
|
|
823
|
+
let t2 = new URL(e2);
|
|
824
|
+
return t2?.pathname && t2.pathname !== `/` ? `${t2.hostname}${t2.pathname}` : t2.hostname;
|
|
825
|
+
}
|
|
826
|
+
var rn = ({ clientSdk: e2, applicationId: t2 }) => ({ invoke: async ({ namespace: n2, method: r2, args: i2 }) => {
|
|
827
|
+
if (!e2) throw Error(`Wix Site SDK only works in a Wix site environment. Learn more: https://dev.wix.com/docs/sdk/host-modules/site/introduction`);
|
|
828
|
+
return e2.invoke({ namespace: n2, method: r2, args: i2, applicationId: t2, accessToken: `accessToken` });
|
|
829
|
+
}, getAccessToken: () => {
|
|
830
|
+
throw Error(`Not implemented`);
|
|
831
|
+
}, observeState: () => ({ disconnect: () => {
|
|
832
|
+
} }) });
|
|
833
|
+
var an = en({ createHost: function(e2) {
|
|
834
|
+
let t2 = (typeof $wixContext < `u` ? $wixContext.clientSdk : void 0) ?? e2?.clientSdk ?? (typeof window < `u` ? window?.clientSdk : void 0), { applicationId: n2 } = e2 || {};
|
|
835
|
+
if (!n2) throw Error(`"createHost" was called without a required field "applicationId"`);
|
|
836
|
+
return { channel: rn({ clientSdk: t2, applicationId: n2 }), close: () => {
|
|
837
|
+
} };
|
|
838
|
+
} });
|
|
839
|
+
var on = ((e2, t2) => {
|
|
840
|
+
let n2 = an.host({ applicationId: e2, componentId: t2 }), r2 = an.auth();
|
|
841
|
+
return Pe({ auth: r2, host: n2 }).enableContext(`module`), r2.getAccessTokenInjector();
|
|
842
|
+
})(`13d21c63-b5ec-5912-8397-c3a5ddb27a97`);
|
|
843
|
+
var sn = [`ANY_FEMALE`, `ANY_MALE`];
|
|
844
|
+
var cn = `3.7.8`;
|
|
845
|
+
var ln = cn;
|
|
846
|
+
var un = typeof Buffer == `function`;
|
|
847
|
+
var dn = typeof TextDecoder == `function` ? new TextDecoder() : void 0;
|
|
848
|
+
var fn = typeof TextEncoder == `function` ? new TextEncoder() : void 0;
|
|
849
|
+
var pn = Array.prototype.slice.call(`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=`);
|
|
850
|
+
var mn = ((e2) => {
|
|
851
|
+
let t2 = {};
|
|
852
|
+
return e2.forEach((e3, n2) => t2[e3] = n2), t2;
|
|
853
|
+
})(pn);
|
|
854
|
+
var hn = /^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/;
|
|
855
|
+
var U = String.fromCharCode.bind(String);
|
|
856
|
+
var gn = typeof Uint8Array.from == `function` ? Uint8Array.from.bind(Uint8Array) : (e2) => new Uint8Array(Array.prototype.slice.call(e2, 0));
|
|
857
|
+
var _n = (e2) => e2.replace(/=/g, ``).replace(/[+\/]/g, (e3) => e3 == `+` ? `-` : `_`);
|
|
858
|
+
var vn = (e2) => e2.replace(/[^A-Za-z0-9\+\/]/g, ``);
|
|
859
|
+
var yn = (e2) => {
|
|
860
|
+
let t2, n2, r2, i2, a2 = ``, o2 = e2.length % 3;
|
|
861
|
+
for (let o3 = 0; o3 < e2.length; ) {
|
|
862
|
+
if ((n2 = e2.charCodeAt(o3++)) > 255 || (r2 = e2.charCodeAt(o3++)) > 255 || (i2 = e2.charCodeAt(o3++)) > 255) throw TypeError(`invalid character found`);
|
|
863
|
+
t2 = n2 << 16 | r2 << 8 | i2, a2 += pn[t2 >> 18 & 63] + pn[t2 >> 12 & 63] + pn[t2 >> 6 & 63] + pn[t2 & 63];
|
|
864
|
+
}
|
|
865
|
+
return o2 ? a2.slice(0, o2 - 3) + `===`.substring(o2) : a2;
|
|
866
|
+
};
|
|
867
|
+
var bn = typeof btoa == `function` ? (e2) => btoa(e2) : un ? (e2) => Buffer.from(e2, `binary`).toString(`base64`) : yn;
|
|
868
|
+
var xn = un ? (e2) => Buffer.from(e2).toString(`base64`) : (e2) => {
|
|
869
|
+
let t2 = 4096, n2 = [];
|
|
870
|
+
for (let r2 = 0, i2 = e2.length; r2 < i2; r2 += t2) n2.push(U.apply(null, e2.subarray(r2, r2 + t2)));
|
|
871
|
+
return bn(n2.join(``));
|
|
872
|
+
};
|
|
873
|
+
var Sn = (e2, t2 = false) => t2 ? _n(xn(e2)) : xn(e2);
|
|
874
|
+
var Cn = (e2) => {
|
|
875
|
+
if (e2.length < 2) {
|
|
876
|
+
var t2 = e2.charCodeAt(0);
|
|
877
|
+
return t2 < 128 ? e2 : t2 < 2048 ? U(192 | t2 >>> 6) + U(128 | t2 & 63) : U(224 | t2 >>> 12 & 15) + U(128 | t2 >>> 6 & 63) + U(128 | t2 & 63);
|
|
878
|
+
}
|
|
879
|
+
var t2 = 65536 + (e2.charCodeAt(0) - 55296) * 1024 + (e2.charCodeAt(1) - 56320);
|
|
880
|
+
return U(240 | t2 >>> 18 & 7) + U(128 | t2 >>> 12 & 63) + U(128 | t2 >>> 6 & 63) + U(128 | t2 & 63);
|
|
881
|
+
};
|
|
882
|
+
var wn = /[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g;
|
|
883
|
+
var W = (e2) => e2.replace(wn, Cn);
|
|
884
|
+
var Tn = un ? (e2) => Buffer.from(e2, `utf8`).toString(`base64`) : fn ? (e2) => xn(fn.encode(e2)) : (e2) => bn(W(e2));
|
|
885
|
+
var En = (e2, t2 = false) => t2 ? _n(Tn(e2)) : Tn(e2);
|
|
886
|
+
var Dn = (e2) => En(e2, true);
|
|
887
|
+
var On = /[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g;
|
|
888
|
+
var kn = (e2) => {
|
|
889
|
+
switch (e2.length) {
|
|
890
|
+
case 4:
|
|
891
|
+
var t2 = ((7 & e2.charCodeAt(0)) << 18 | (63 & e2.charCodeAt(1)) << 12 | (63 & e2.charCodeAt(2)) << 6 | 63 & e2.charCodeAt(3)) - 65536;
|
|
892
|
+
return U((t2 >>> 10) + 55296) + U((t2 & 1023) + 56320);
|
|
893
|
+
case 3:
|
|
894
|
+
return U((15 & e2.charCodeAt(0)) << 12 | (63 & e2.charCodeAt(1)) << 6 | 63 & e2.charCodeAt(2));
|
|
895
|
+
default:
|
|
896
|
+
return U((31 & e2.charCodeAt(0)) << 6 | 63 & e2.charCodeAt(1));
|
|
897
|
+
}
|
|
898
|
+
};
|
|
899
|
+
var An = (e2) => e2.replace(On, kn);
|
|
900
|
+
var jn = (e2) => {
|
|
901
|
+
if (e2 = e2.replace(/\s+/g, ``), !hn.test(e2)) throw TypeError(`malformed base64.`);
|
|
902
|
+
e2 += `==`.slice(2 - (e2.length & 3));
|
|
903
|
+
let t2, n2, r2, i2 = [];
|
|
904
|
+
for (let a2 = 0; a2 < e2.length; ) t2 = mn[e2.charAt(a2++)] << 18 | mn[e2.charAt(a2++)] << 12 | (n2 = mn[e2.charAt(a2++)]) << 6 | (r2 = mn[e2.charAt(a2++)]), n2 === 64 ? i2.push(U(t2 >> 16 & 255)) : r2 === 64 ? i2.push(U(t2 >> 16 & 255, t2 >> 8 & 255)) : i2.push(U(t2 >> 16 & 255, t2 >> 8 & 255, t2 & 255));
|
|
905
|
+
return i2.join(``);
|
|
906
|
+
};
|
|
907
|
+
var Mn = typeof atob == `function` ? (e2) => atob(vn(e2)) : un ? (e2) => Buffer.from(e2, `base64`).toString(`binary`) : jn;
|
|
908
|
+
var Nn = un ? (e2) => gn(Buffer.from(e2, `base64`)) : (e2) => gn(Mn(e2).split(``).map((e3) => e3.charCodeAt(0)));
|
|
909
|
+
var Pn = (e2) => Nn(In(e2));
|
|
910
|
+
var Fn = un ? (e2) => Buffer.from(e2, `base64`).toString(`utf8`) : dn ? (e2) => dn.decode(Nn(e2)) : (e2) => An(Mn(e2));
|
|
911
|
+
var In = (e2) => vn(e2.replace(/[-_]/g, (e3) => e3 == `-` ? `+` : `/`));
|
|
912
|
+
var Ln = (e2) => Fn(In(e2));
|
|
913
|
+
var Rn = (e2) => {
|
|
914
|
+
if (typeof e2 != `string`) return false;
|
|
915
|
+
let t2 = e2.replace(/\s+/g, ``).replace(/={0,2}$/, ``);
|
|
916
|
+
return !/[^\s0-9a-zA-Z\+/]/.test(t2) || !/[^\s0-9a-zA-Z\-_]/.test(t2);
|
|
917
|
+
};
|
|
918
|
+
var zn = (e2) => ({ value: e2, enumerable: false, writable: true, configurable: true });
|
|
919
|
+
var Bn = function() {
|
|
920
|
+
let e2 = (e3, t2) => Object.defineProperty(String.prototype, e3, zn(t2));
|
|
921
|
+
e2(`fromBase64`, function() {
|
|
922
|
+
return Ln(this);
|
|
923
|
+
}), e2(`toBase64`, function(e3) {
|
|
924
|
+
return En(this, e3);
|
|
925
|
+
}), e2(`toBase64URI`, function() {
|
|
926
|
+
return En(this, true);
|
|
927
|
+
}), e2(`toBase64URL`, function() {
|
|
928
|
+
return En(this, true);
|
|
929
|
+
}), e2(`toUint8Array`, function() {
|
|
930
|
+
return Pn(this);
|
|
931
|
+
});
|
|
932
|
+
};
|
|
933
|
+
var Vn = function() {
|
|
934
|
+
let e2 = (e3, t2) => Object.defineProperty(Uint8Array.prototype, e3, zn(t2));
|
|
935
|
+
e2(`toBase64`, function(e3) {
|
|
936
|
+
return Sn(this, e3);
|
|
937
|
+
}), e2(`toBase64URI`, function() {
|
|
938
|
+
return Sn(this, true);
|
|
939
|
+
}), e2(`toBase64URL`, function() {
|
|
940
|
+
return Sn(this, true);
|
|
941
|
+
});
|
|
942
|
+
};
|
|
943
|
+
var Hn = { version: cn, VERSION: ln, atob: Mn, atobPolyfill: jn, btoa: bn, btoaPolyfill: yn, fromBase64: Ln, toBase64: En, encode: En, encodeURI: Dn, encodeURL: Dn, utob: W, btou: An, decode: Ln, isValid: Rn, fromUint8Array: Sn, toUint8Array: Pn, extendString: Bn, extendUint8Array: Vn, extendBuiltins: () => {
|
|
944
|
+
Bn(), Vn();
|
|
945
|
+
} };
|
|
946
|
+
var G = Uint8Array;
|
|
947
|
+
var Un = Uint16Array;
|
|
948
|
+
var Wn = Int32Array;
|
|
949
|
+
var Gn = new G([0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 0, 0, 0]);
|
|
950
|
+
var Kn = new G([0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 0, 0]);
|
|
951
|
+
var qn = new G([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);
|
|
952
|
+
var Jn = function(e2, t2) {
|
|
953
|
+
for (var n2 = new Un(31), r2 = 0; r2 < 31; ++r2) n2[r2] = t2 += 1 << e2[r2 - 1];
|
|
954
|
+
for (var i2 = new Wn(n2[30]), r2 = 1; r2 < 30; ++r2) for (var a2 = n2[r2]; a2 < n2[r2 + 1]; ++a2) i2[a2] = a2 - n2[r2] << 5 | r2;
|
|
955
|
+
return { b: n2, r: i2 };
|
|
956
|
+
};
|
|
957
|
+
var Yn = Jn(Gn, 2);
|
|
958
|
+
var Xn = Yn.b;
|
|
959
|
+
var Zn = Yn.r;
|
|
960
|
+
Xn[28] = 258, Zn[258] = 28;
|
|
961
|
+
var Qn = Jn(Kn, 0);
|
|
962
|
+
var $n = Qn.b;
|
|
963
|
+
Qn.r;
|
|
964
|
+
for (er = new Un(32768), K = 0; K < 32768; ++K) {
|
|
965
|
+
tr = (K & 43690) >> 1 | (K & 21845) << 1;
|
|
966
|
+
tr = (tr & 52428) >> 2 | (tr & 13107) << 2, tr = (tr & 61680) >> 4 | (tr & 3855) << 4, er[K] = ((tr & 65280) >> 8 | (tr & 255) << 8) >> 1;
|
|
967
|
+
}
|
|
968
|
+
var tr;
|
|
969
|
+
var er;
|
|
970
|
+
var K;
|
|
971
|
+
for (nr = function(e2, t2, n2) {
|
|
972
|
+
for (var r2 = e2.length, i2 = 0, a2 = new Un(t2); i2 < r2; ++i2) e2[i2] && ++a2[e2[i2] - 1];
|
|
973
|
+
var o2 = new Un(t2);
|
|
974
|
+
for (i2 = 1; i2 < t2; ++i2) o2[i2] = o2[i2 - 1] + a2[i2 - 1] << 1;
|
|
975
|
+
var s2;
|
|
976
|
+
if (n2) {
|
|
977
|
+
s2 = new Un(1 << t2);
|
|
978
|
+
var c2 = 15 - t2;
|
|
979
|
+
for (i2 = 0; i2 < r2; ++i2) if (e2[i2]) for (var l2 = i2 << 4 | e2[i2], u2 = t2 - e2[i2], d2 = o2[e2[i2] - 1]++ << u2, f2 = d2 | (1 << u2) - 1; d2 <= f2; ++d2) s2[er[d2] >> c2] = l2;
|
|
980
|
+
} else for (s2 = new Un(r2), i2 = 0; i2 < r2; ++i2) e2[i2] && (s2[i2] = er[o2[e2[i2] - 1]++] >> 15 - e2[i2]);
|
|
981
|
+
return s2;
|
|
982
|
+
}, rr = new G(288), K = 0; K < 144; ++K) rr[K] = 8;
|
|
983
|
+
var nr;
|
|
984
|
+
var rr;
|
|
985
|
+
var K;
|
|
986
|
+
for (K = 144; K < 256; ++K) rr[K] = 9;
|
|
987
|
+
var K;
|
|
988
|
+
for (K = 256; K < 280; ++K) rr[K] = 7;
|
|
989
|
+
var K;
|
|
990
|
+
for (K = 280; K < 288; ++K) rr[K] = 8;
|
|
991
|
+
var K;
|
|
992
|
+
for (ir = new G(32), K = 0; K < 32; ++K) ir[K] = 5;
|
|
993
|
+
var ir;
|
|
994
|
+
var K;
|
|
995
|
+
var ar = nr(rr, 9, 1);
|
|
996
|
+
var or = nr(ir, 5, 1);
|
|
997
|
+
var sr = function(e2) {
|
|
998
|
+
for (var t2 = e2[0], n2 = 1; n2 < e2.length; ++n2) e2[n2] > t2 && (t2 = e2[n2]);
|
|
999
|
+
return t2;
|
|
1000
|
+
};
|
|
1001
|
+
var q = function(e2, t2, n2) {
|
|
1002
|
+
var r2 = t2 / 8 | 0;
|
|
1003
|
+
return (e2[r2] | e2[r2 + 1] << 8) >> (t2 & 7) & n2;
|
|
1004
|
+
};
|
|
1005
|
+
var cr = function(e2, t2) {
|
|
1006
|
+
var n2 = t2 / 8 | 0;
|
|
1007
|
+
return (e2[n2] | e2[n2 + 1] << 8 | e2[n2 + 2] << 16) >> (t2 & 7);
|
|
1008
|
+
};
|
|
1009
|
+
var lr = function(e2) {
|
|
1010
|
+
return (e2 + 7) / 8 | 0;
|
|
1011
|
+
};
|
|
1012
|
+
var ur = function(e2, t2, n2) {
|
|
1013
|
+
return (t2 == null || t2 < 0) && (t2 = 0), (n2 == null || n2 > e2.length) && (n2 = e2.length), new G(e2.subarray(t2, n2));
|
|
1014
|
+
};
|
|
1015
|
+
var dr = [`unexpected EOF`, `invalid block type`, `invalid length/literal`, `invalid distance`, `stream finished`, `no stream handler`, , `no callback`, `invalid UTF-8 data`, `extra field too long`, `date not in range 1980-2099`, `filename too long`, `stream finishing`, `invalid zip data`];
|
|
1016
|
+
var J = function(e2, t2, n2) {
|
|
1017
|
+
var r2 = Error(t2 || dr[e2]);
|
|
1018
|
+
if (r2.code = e2, Error.captureStackTrace && Error.captureStackTrace(r2, J), !n2) throw r2;
|
|
1019
|
+
return r2;
|
|
1020
|
+
};
|
|
1021
|
+
var fr = function(e2, t2, n2, r2) {
|
|
1022
|
+
var i2 = e2.length, a2 = r2 ? r2.length : 0;
|
|
1023
|
+
if (!i2 || t2.f && !t2.l) return n2 || new G(0);
|
|
1024
|
+
var o2 = !n2, s2 = o2 || t2.i != 2, c2 = t2.i;
|
|
1025
|
+
o2 && (n2 = new G(i2 * 3));
|
|
1026
|
+
var l2 = function(e3) {
|
|
1027
|
+
var t3 = n2.length;
|
|
1028
|
+
if (e3 > t3) {
|
|
1029
|
+
var r3 = new G(Math.max(t3 * 2, e3));
|
|
1030
|
+
r3.set(n2), n2 = r3;
|
|
1031
|
+
}
|
|
1032
|
+
}, u2 = t2.f || 0, d2 = t2.p || 0, f2 = t2.b || 0, p2 = t2.l, m2 = t2.d, h2 = t2.m, g2 = t2.n, _2 = i2 * 8;
|
|
1033
|
+
do {
|
|
1034
|
+
if (!p2) {
|
|
1035
|
+
u2 = q(e2, d2, 1);
|
|
1036
|
+
var v2 = q(e2, d2 + 1, 3);
|
|
1037
|
+
if (d2 += 3, !v2) {
|
|
1038
|
+
var y2 = lr(d2) + 4, b2 = e2[y2 - 4] | e2[y2 - 3] << 8, x2 = y2 + b2;
|
|
1039
|
+
if (x2 > i2) {
|
|
1040
|
+
c2 && J(0);
|
|
1041
|
+
break;
|
|
1042
|
+
}
|
|
1043
|
+
s2 && l2(f2 + b2), n2.set(e2.subarray(y2, x2), f2), t2.b = f2 += b2, t2.p = d2 = x2 * 8, t2.f = u2;
|
|
1044
|
+
continue;
|
|
1045
|
+
}
|
|
1046
|
+
if (v2 == 1) p2 = ar, m2 = or, h2 = 9, g2 = 5;
|
|
1047
|
+
else if (v2 == 2) {
|
|
1048
|
+
var S2 = q(e2, d2, 31) + 257, C2 = q(e2, d2 + 10, 15) + 4, w2 = S2 + q(e2, d2 + 5, 31) + 1;
|
|
1049
|
+
d2 += 14;
|
|
1050
|
+
for (var T2 = new G(w2), ee2 = new G(19), E2 = 0; E2 < C2; ++E2) ee2[qn[E2]] = q(e2, d2 + E2 * 3, 7);
|
|
1051
|
+
d2 += C2 * 3;
|
|
1052
|
+
for (var D2 = sr(ee2), te2 = (1 << D2) - 1, ne2 = nr(ee2, D2, 1), E2 = 0; E2 < w2; ) {
|
|
1053
|
+
var O2 = ne2[q(e2, d2, te2)];
|
|
1054
|
+
d2 += O2 & 15;
|
|
1055
|
+
var y2 = O2 >> 4;
|
|
1056
|
+
if (y2 < 16) T2[E2++] = y2;
|
|
1057
|
+
else {
|
|
1058
|
+
var k2 = 0, re2 = 0;
|
|
1059
|
+
for (y2 == 16 ? (re2 = 3 + q(e2, d2, 3), d2 += 2, k2 = T2[E2 - 1]) : y2 == 17 ? (re2 = 3 + q(e2, d2, 7), d2 += 3) : y2 == 18 && (re2 = 11 + q(e2, d2, 127), d2 += 7); re2--; ) T2[E2++] = k2;
|
|
1060
|
+
}
|
|
1061
|
+
}
|
|
1062
|
+
var ie2 = T2.subarray(0, S2), A2 = T2.subarray(S2);
|
|
1063
|
+
h2 = sr(ie2), g2 = sr(A2), p2 = nr(ie2, h2, 1), m2 = nr(A2, g2, 1);
|
|
1064
|
+
} else J(1);
|
|
1065
|
+
if (d2 > _2) {
|
|
1066
|
+
c2 && J(0);
|
|
1067
|
+
break;
|
|
1068
|
+
}
|
|
1069
|
+
}
|
|
1070
|
+
s2 && l2(f2 + 131072);
|
|
1071
|
+
for (var ae2 = (1 << h2) - 1, j2 = (1 << g2) - 1, oe2 = d2; ; oe2 = d2) {
|
|
1072
|
+
var k2 = p2[cr(e2, d2) & ae2], M2 = k2 >> 4;
|
|
1073
|
+
if (d2 += k2 & 15, d2 > _2) {
|
|
1074
|
+
c2 && J(0);
|
|
1075
|
+
break;
|
|
1076
|
+
}
|
|
1077
|
+
if (k2 || J(2), M2 < 256) n2[f2++] = M2;
|
|
1078
|
+
else if (M2 == 256) {
|
|
1079
|
+
oe2 = d2, p2 = null;
|
|
1080
|
+
break;
|
|
1081
|
+
} else {
|
|
1082
|
+
var se2 = M2 - 254;
|
|
1083
|
+
if (M2 > 264) {
|
|
1084
|
+
var E2 = M2 - 257, N2 = Gn[E2];
|
|
1085
|
+
se2 = q(e2, d2, (1 << N2) - 1) + Xn[E2], d2 += N2;
|
|
1086
|
+
}
|
|
1087
|
+
var ce2 = m2[cr(e2, d2) & j2], le2 = ce2 >> 4;
|
|
1088
|
+
ce2 || J(3), d2 += ce2 & 15;
|
|
1089
|
+
var A2 = $n[le2];
|
|
1090
|
+
if (le2 > 3) {
|
|
1091
|
+
var N2 = Kn[le2];
|
|
1092
|
+
A2 += cr(e2, d2) & (1 << N2) - 1, d2 += N2;
|
|
1093
|
+
}
|
|
1094
|
+
if (d2 > _2) {
|
|
1095
|
+
c2 && J(0);
|
|
1096
|
+
break;
|
|
1097
|
+
}
|
|
1098
|
+
s2 && l2(f2 + 131072);
|
|
1099
|
+
var ue2 = f2 + se2;
|
|
1100
|
+
if (f2 < A2) {
|
|
1101
|
+
var de2 = a2 - A2, fe2 = Math.min(A2, ue2);
|
|
1102
|
+
for (de2 + f2 < 0 && J(3); f2 < fe2; ++f2) n2[f2] = r2[de2 + f2];
|
|
1103
|
+
}
|
|
1104
|
+
for (; f2 < ue2; ++f2) n2[f2] = n2[f2 - A2];
|
|
1105
|
+
}
|
|
1106
|
+
}
|
|
1107
|
+
t2.l = p2, t2.p = oe2, t2.b = f2, t2.f = u2, p2 && (u2 = 1, t2.m = h2, t2.d = m2, t2.n = g2);
|
|
1108
|
+
} while (!u2);
|
|
1109
|
+
return f2 != n2.length && o2 ? ur(n2, 0, f2) : n2.subarray(0, f2);
|
|
1110
|
+
};
|
|
1111
|
+
var pr = new G(0);
|
|
1112
|
+
var mr = function(e2) {
|
|
1113
|
+
(e2[0] != 31 || e2[1] != 139 || e2[2] != 8) && J(6, `invalid gzip data`);
|
|
1114
|
+
var t2 = e2[3], n2 = 10;
|
|
1115
|
+
t2 & 4 && (n2 += (e2[10] | e2[11] << 8) + 2);
|
|
1116
|
+
for (var r2 = (t2 >> 3 & 1) + (t2 >> 4 & 1); r2 > 0; r2 -= !e2[n2++]) ;
|
|
1117
|
+
return n2 + (t2 & 2);
|
|
1118
|
+
};
|
|
1119
|
+
var hr = function(e2) {
|
|
1120
|
+
var t2 = e2.length;
|
|
1121
|
+
return (e2[t2 - 4] | e2[t2 - 3] << 8 | e2[t2 - 2] << 16 | e2[t2 - 1] << 24) >>> 0;
|
|
1122
|
+
};
|
|
1123
|
+
function gr(e2, t2) {
|
|
1124
|
+
var n2 = mr(e2);
|
|
1125
|
+
return n2 + 8 > e2.length && J(6, `invalid gzip data`), fr(e2.subarray(n2, -8), { i: 2 }, t2 && t2.out || new G(hr(e2)), t2 && t2.dictionary);
|
|
1126
|
+
}
|
|
1127
|
+
var _r = typeof TextDecoder < `u` && new TextDecoder();
|
|
1128
|
+
try {
|
|
1129
|
+
_r.decode(pr, { stream: true });
|
|
1130
|
+
} catch {
|
|
1131
|
+
}
|
|
1132
|
+
var vr = /* @__PURE__ */ new Set([`APPOINTMENT`, `CLASS`, `COURSE`]);
|
|
1133
|
+
var yr = new Set(sn);
|
|
1134
|
+
function Y(e2) {
|
|
1135
|
+
return typeof e2 == `string` ? e2 : void 0;
|
|
1136
|
+
}
|
|
1137
|
+
function br(e2) {
|
|
1138
|
+
return typeof e2 == `number` && Number.isFinite(e2) ? e2 : void 0;
|
|
1139
|
+
}
|
|
1140
|
+
function xr(e2) {
|
|
1141
|
+
return typeof e2 == `boolean` ? e2 : void 0;
|
|
1142
|
+
}
|
|
1143
|
+
function Sr(e2) {
|
|
1144
|
+
if (Array.isArray(e2)) return e2.filter((e3) => typeof e3 == `string`);
|
|
1145
|
+
}
|
|
1146
|
+
function Cr(e2) {
|
|
1147
|
+
return typeof e2 == `object` && !!e2;
|
|
1148
|
+
}
|
|
1149
|
+
function wr(e2) {
|
|
1150
|
+
if (!Cr(e2)) return null;
|
|
1151
|
+
let t2 = Y(e2.t);
|
|
1152
|
+
if (t2 === void 0) return null;
|
|
1153
|
+
let n2 = { type: t2, ids: Sr(e2.d) ?? [] }, r2 = xr(e2.n);
|
|
1154
|
+
return r2 !== void 0 && (n2.anyResource = r2), n2;
|
|
1155
|
+
}
|
|
1156
|
+
function Tr(e2) {
|
|
1157
|
+
if (!Cr(e2)) return null;
|
|
1158
|
+
let t2 = br(e2.p), n2 = Sr(e2.h);
|
|
1159
|
+
if (t2 === void 0 && n2 === void 0) return null;
|
|
1160
|
+
let r2 = {};
|
|
1161
|
+
return t2 !== void 0 && (r2.numberOfParticipants = t2), n2 !== void 0 && (r2.choices = n2), r2;
|
|
1162
|
+
}
|
|
1163
|
+
function Er(e2) {
|
|
1164
|
+
if (!Cr(e2)) return null;
|
|
1165
|
+
let t2 = Y(e2.i), n2 = br(e2.q);
|
|
1166
|
+
return t2 === void 0 || n2 === void 0 ? null : { id: t2, quantity: n2 };
|
|
1167
|
+
}
|
|
1168
|
+
function Dr(e2, t2) {
|
|
1169
|
+
if (!Array.isArray(e2)) return;
|
|
1170
|
+
let n2 = e2.map(t2).filter((e3) => e3 !== null);
|
|
1171
|
+
return n2.length ? n2 : void 0;
|
|
1172
|
+
}
|
|
1173
|
+
function Or(e2) {
|
|
1174
|
+
if (!Cr(e2)) return null;
|
|
1175
|
+
let t2 = Y(e2.i);
|
|
1176
|
+
if (t2 === void 0) return null;
|
|
1177
|
+
let n2 = { serviceId: t2 }, r2 = Y(e2.g);
|
|
1178
|
+
r2 !== void 0 && (n2.slug = r2);
|
|
1179
|
+
let i2 = function(e3) {
|
|
1180
|
+
let t3 = Y(e3);
|
|
1181
|
+
if (t3 !== void 0 && vr.has(t3)) return t3;
|
|
1182
|
+
}(e2.y);
|
|
1183
|
+
i2 !== void 0 && (n2.serviceType = i2);
|
|
1184
|
+
let a2 = Y(e2.t0);
|
|
1185
|
+
a2 !== void 0 && (n2.slotStart = a2);
|
|
1186
|
+
let o2 = Y(e2.t1);
|
|
1187
|
+
o2 !== void 0 && (n2.slotEnd = o2);
|
|
1188
|
+
let s2 = Y(e2.e);
|
|
1189
|
+
s2 !== void 0 && (n2.eventId = s2);
|
|
1190
|
+
let c2 = Y(e2.c);
|
|
1191
|
+
c2 !== void 0 && (n2.scheduleId = c2);
|
|
1192
|
+
let l2 = Y(e2.k);
|
|
1193
|
+
l2 !== void 0 && (n2.sessionId = l2);
|
|
1194
|
+
let u2 = Y(e2.l);
|
|
1195
|
+
u2 !== void 0 && (n2.locationId = u2);
|
|
1196
|
+
let d2 = Y(e2.lt);
|
|
1197
|
+
d2 !== `BUSINESS` && d2 !== `CUSTOM` && d2 !== `CUSTOMER` || (n2.locationType = d2);
|
|
1198
|
+
let f2 = Dr(e2.r, wr);
|
|
1199
|
+
f2 && (n2.resources = f2);
|
|
1200
|
+
let p2 = Dr(e2.x, Tr);
|
|
1201
|
+
p2 && (n2.selectedVariants = p2);
|
|
1202
|
+
let m2 = Dr(e2.a, Er);
|
|
1203
|
+
m2 && (n2.addOns = m2);
|
|
1204
|
+
let h2 = Y(e2.dc);
|
|
1205
|
+
h2 && (n2.durationChoiceId = h2);
|
|
1206
|
+
let g2 = br(e2.dm);
|
|
1207
|
+
g2 !== void 0 && Number.isInteger(g2) && g2 > 0 && (n2.durationInMinutes = g2);
|
|
1208
|
+
let _2 = Y(e2.rg);
|
|
1209
|
+
return _2 !== void 0 && yr.has(_2) && (n2.requestedGender = _2), n2;
|
|
1210
|
+
}
|
|
1211
|
+
function kr(e2) {
|
|
1212
|
+
if (!Cr(e2)) return null;
|
|
1213
|
+
let t2 = Y(e2.m);
|
|
1214
|
+
if (t2 !== `single` && t2 !== `multi` || !Array.isArray(e2.s)) return null;
|
|
1215
|
+
let n2 = { mode: t2, services: e2.s.map(Or).filter((e3) => e3 !== null) }, r2 = Y(e2.z);
|
|
1216
|
+
return r2 !== void 0 && (n2.timezone = r2), true === xr(e2.cp) && (n2.wantsPromoCode = true), n2;
|
|
1217
|
+
}
|
|
1218
|
+
new TextEncoder();
|
|
1219
|
+
var Ar = new TextDecoder();
|
|
1220
|
+
function jr(e2) {
|
|
1221
|
+
if (!e2 || e2.length < 2) return null;
|
|
1222
|
+
try {
|
|
1223
|
+
let t2 = e2[0], n2 = Hn.toUint8Array(e2.slice(1)), r2;
|
|
1224
|
+
if (t2 === `1`) r2 = n2;
|
|
1225
|
+
else {
|
|
1226
|
+
if (t2 !== `2`) return null;
|
|
1227
|
+
r2 = gr(n2);
|
|
1228
|
+
}
|
|
1229
|
+
return kr(JSON.parse(Ar.decode(r2)));
|
|
1230
|
+
} catch {
|
|
1231
|
+
return null;
|
|
1232
|
+
}
|
|
1233
|
+
}
|
|
1234
|
+
function Mr(e2) {
|
|
1235
|
+
return e2;
|
|
1236
|
+
}
|
|
1237
|
+
var Nr = Mr(`@wix/site-service-pages`);
|
|
1238
|
+
function Pr(e2) {
|
|
1239
|
+
return e2;
|
|
1240
|
+
}
|
|
1241
|
+
var Fr = Pr;
|
|
1242
|
+
var Ir = Fr(`@wix/viewer-service-environment`);
|
|
1243
|
+
var Lr = Fr(`@wix/viewer-service-router`);
|
|
1244
|
+
function Rr(e2) {
|
|
1245
|
+
return e2;
|
|
1246
|
+
}
|
|
1247
|
+
var zr = Rr(`@wix/site-service-url`);
|
|
1248
|
+
function Br(e2) {
|
|
1249
|
+
return e2;
|
|
1250
|
+
}
|
|
1251
|
+
var Vr = Br(`@wix/site-service-renderer-configuration`);
|
|
1252
|
+
var Hr = `13d21c63-b5ec-5912-8397-c3a5ddb27a97`;
|
|
1253
|
+
var Ur = `shopping_cart`;
|
|
1254
|
+
var Wr = `thank_you_page`;
|
|
1255
|
+
var Gr = `1cd44cf8-756f-41c3-bd90-3e2ffcaf1155`;
|
|
1256
|
+
var Kr = function(e2) {
|
|
1257
|
+
return e2.BOOK_ONLINE = `bookingsBookOnline`, e2.SERVICE_PAGE = `bookingsServicePage`, e2.CALENDAR_PAGE = `bookingsCalendar`, e2.FORM_PAGE = `bookingsForm`, e2;
|
|
1258
|
+
}({});
|
|
1259
|
+
var qr = `{{(.*?)}}`;
|
|
1260
|
+
var Jr = `[{{}}]`;
|
|
1261
|
+
var Yr = `([^/]+)`;
|
|
1262
|
+
var Xr;
|
|
1263
|
+
(function(e2) {
|
|
1264
|
+
e2.product_page = `product_page`, e2.blog = `blog`, e2.post = `post`, e2.forum = `forum`, e2.group = `group`, e2.bookings = `Booking Service Page`, e2.challenges = `challenge_page`;
|
|
1265
|
+
})(Xr ||= {});
|
|
1266
|
+
var X;
|
|
1267
|
+
(function(e2) {
|
|
1268
|
+
e2.PRODUCT_PAGE = `wix.stores.sub_pages.product`, e2.BLOG_POST = `wix.blog.sub_pages.post`, e2.BLOG_POST_EDIT = `wix.blog.sub_pages.post.edit`, e2.BLOG_POST_PREVIEW = `wix.blog.sub_pages.post.preview`, e2.BLOG_CATEGORY = `wix.blog.sub_pages.category`, e2.FORUM_CATEGORY = `wix.forum.sub_pages.category`, e2.FORUM_CATEGORY_PAGINATION = `wix.forum.sub_pages.category.pagination`, e2.FORUM_CATEGORY_CREATE_POST = `wix.forum.sub_pages.category.create-post`, e2.FORUM_CATEGORY_CREATE_QUESTION = `wix.forum.sub_pages.category.create-question`, e2.FORUM_POST = `wix.forum.sub_pages.post`, e2.FORUM_POST_EDIT = `wix.forum.sub_pages.post.edit`, e2.FORUM_POST_PAGINATION = `wix.forum.sub_pages.post.pagination`, e2.FORUM_POST_DEEP_LINK_DATA = `wix.forum.sub_pages.post.deep-link-data`, e2.FORUM_POST_PAGINATION_AND_DEEP_LINK_DATA = `wix.forum.sub_pages.post.pagination-and-deep-link-data`, e2.GROUP = `wix.groups.sub_pages.group`, e2.GROUP_POST = `wix.groups.sub_pages.post`, e2.BOOKINGS_SERVICE = `wix.bookings.sub_pages.service_page`, e2.CHALLENGES_PAGE = `wix.online_programs.sub_pages.online_program`;
|
|
1269
|
+
})(X ||= {});
|
|
1270
|
+
var Zr = {};
|
|
1271
|
+
var Qr = (Zr[X.PRODUCT_PAGE] = { variables: [`slug`], required: [`slug`] }, Zr);
|
|
1272
|
+
var $r = `{{main-mapping}}`;
|
|
1273
|
+
var ei = {};
|
|
1274
|
+
var ti;
|
|
1275
|
+
var ni = (ei[X.BLOG_POST] = { variables: [`slug`], required: [`slug`], subMappings: (ti = {}, ti[X.BLOG_POST_EDIT] = { defaultMapping: `${$r}/edit` }, ti[X.BLOG_POST_PREVIEW] = { required: [`instance`], defaultMapping: `${$r}/preview/{{instance}}` }, ti) }, ei);
|
|
1276
|
+
var ri = {};
|
|
1277
|
+
var ii = (ri[X.BLOG_CATEGORY] = { variables: [`slug`], required: [`slug`], defaultPrefix: `categories` }, ri);
|
|
1278
|
+
var ai = {};
|
|
1279
|
+
var oi;
|
|
1280
|
+
var si;
|
|
1281
|
+
var ci = (ai[X.FORUM_POST] = { variables: [`categorySlug`, `postSlug`], required: [`categorySlug`, `postSlug`], subMappings: (oi = {}, oi[X.FORUM_POST_EDIT] = { defaultMapping: `${$r}/edit` }, oi[X.FORUM_POST_PAGINATION] = { required: [`page`], defaultMapping: `${$r}/p-{{page}}` }, oi[X.FORUM_POST_DEEP_LINK_DATA] = { required: [`deepLinkData`], defaultMapping: `${$r}/dl-{{deepLinkData}}` }, oi[X.FORUM_POST_PAGINATION_AND_DEEP_LINK_DATA] = { required: [`page`, `deepLinkData`], defaultMapping: `${$r}/p-{{page}}/dl-{{deepLinkData}}` }, oi) }, ai[X.FORUM_CATEGORY] = { variables: [`slug`], required: [`slug`], subMappings: (si = {}, si[X.FORUM_CATEGORY_CREATE_POST] = { defaultMapping: `${$r}/create-post` }, si[X.FORUM_CATEGORY_CREATE_QUESTION] = { defaultMapping: `${$r}/create-question` }, si[X.FORUM_CATEGORY_PAGINATION] = { required: [`page`], defaultMapping: `${$r}/p-{{page}}` }, si) }, ai);
|
|
1282
|
+
var li = {};
|
|
1283
|
+
var ui = (li[X.GROUP] = { variables: [`groupId`, `tabName`], required: [`groupId`, `tabName`] }, li[X.GROUP_POST] = { variables: [`groupId`, `tabName`, `postId`], required: [`groupId`, `tabName`, `postId`] }, li);
|
|
1284
|
+
var di = {};
|
|
1285
|
+
var fi = (di[X.BOOKINGS_SERVICE] = { variables: [`slug`], required: [`slug`], defaultPrefix: `service-page` }, di);
|
|
1286
|
+
var pi = {};
|
|
1287
|
+
var mi = (pi[X.CHALLENGES_PAGE] = { variables: [`slug`], required: [`slug`], defaultPrefix: `challenge-page` }, pi);
|
|
1288
|
+
var hi = {};
|
|
1289
|
+
var gi = (hi[Xr.product_page] = Qr, hi[Xr.post] = ni, hi[Xr.blog] = ii, hi[Xr.forum] = ci, hi[Xr.group] = ui, hi[Xr.bookings] = fi, hi[Xr.challenges] = mi, hi);
|
|
1290
|
+
var _i = function() {
|
|
1291
|
+
return _i = Object.assign || function(e2) {
|
|
1292
|
+
for (var t2, n2 = 1, r2 = arguments.length; n2 < r2; n2++) for (var i2 in t2 = arguments[n2], t2) Object.prototype.hasOwnProperty.call(t2, i2) && (e2[i2] = t2[i2]);
|
|
1293
|
+
return e2;
|
|
1294
|
+
}, _i.apply(this, arguments);
|
|
1295
|
+
};
|
|
1296
|
+
function vi(e2) {
|
|
1297
|
+
var t2 = typeof Symbol == `function` && Symbol.iterator, n2 = t2 && e2[t2], r2 = 0;
|
|
1298
|
+
if (n2) return n2.call(e2);
|
|
1299
|
+
if (e2 && typeof e2.length == `number`) return { next: function() {
|
|
1300
|
+
return e2 && r2 >= e2.length && (e2 = void 0), { value: e2 && e2[r2++], done: !e2 };
|
|
1301
|
+
} };
|
|
1302
|
+
throw TypeError(t2 ? `Object is not iterable.` : `Symbol.iterator is not defined.`);
|
|
1303
|
+
}
|
|
1304
|
+
function Z(e2, t2) {
|
|
1305
|
+
var n2 = typeof Symbol == `function` && e2[Symbol.iterator];
|
|
1306
|
+
if (!n2) return e2;
|
|
1307
|
+
var r2 = n2.call(e2), i2, a2 = [], o2;
|
|
1308
|
+
try {
|
|
1309
|
+
for (; (t2 === void 0 || t2-- > 0) && !(i2 = r2.next()).done; ) a2.push(i2.value);
|
|
1310
|
+
} catch (e3) {
|
|
1311
|
+
o2 = { error: e3 };
|
|
1312
|
+
} finally {
|
|
1313
|
+
try {
|
|
1314
|
+
i2 && !i2.done && (n2 = r2.return) && n2.call(r2);
|
|
1315
|
+
} finally {
|
|
1316
|
+
if (o2) throw o2.error;
|
|
1317
|
+
}
|
|
1318
|
+
}
|
|
1319
|
+
return a2;
|
|
1320
|
+
}
|
|
1321
|
+
function yi(e2, t2, n2) {
|
|
1322
|
+
if (n2 || arguments.length === 2) for (var r2 = 0, i2 = t2.length, a2; r2 < i2; r2++) (a2 || !(r2 in t2)) && (a2 ||= Array.prototype.slice.call(t2, 0, r2), a2[r2] = t2[r2]);
|
|
1323
|
+
return e2.concat(a2 || Array.prototype.slice.call(t2));
|
|
1324
|
+
}
|
|
1325
|
+
var bi = function(e2) {
|
|
1326
|
+
return Object.values(xi()).some(function(t2) {
|
|
1327
|
+
return !!t2?.subMappings?.[e2];
|
|
1328
|
+
});
|
|
1329
|
+
};
|
|
1330
|
+
var xi = function() {
|
|
1331
|
+
return Object.values(gi).reduce(function(e2, t2) {
|
|
1332
|
+
return _i(_i({}, e2), t2);
|
|
1333
|
+
}, {}) || {};
|
|
1334
|
+
};
|
|
1335
|
+
var Si = function(e2) {
|
|
1336
|
+
var t2 = xi()[e2];
|
|
1337
|
+
return !t2 && bi(e2) && console.warn(`You cannot get variables schema for subMappings key (${e2}).`), t2;
|
|
1338
|
+
};
|
|
1339
|
+
var Ci = function(e2) {
|
|
1340
|
+
return Object.entries(gi).filter(function(t2) {
|
|
1341
|
+
var n2 = Z(t2, 2)[1];
|
|
1342
|
+
return Object.keys(n2).includes(e2);
|
|
1343
|
+
}).map(function(e3) {
|
|
1344
|
+
return Z(e3, 1)[0];
|
|
1345
|
+
})[0];
|
|
1346
|
+
};
|
|
1347
|
+
var wi = function(e2) {
|
|
1348
|
+
return Object.entries(xi()).find(function(t2) {
|
|
1349
|
+
var n2 = Z(t2, 2);
|
|
1350
|
+
return n2[0], !!n2[1]?.subMappings?.[e2];
|
|
1351
|
+
});
|
|
1352
|
+
};
|
|
1353
|
+
var Ti = function(e2) {
|
|
1354
|
+
var t2 = [];
|
|
1355
|
+
if (bi(e2)) {
|
|
1356
|
+
var n2 = Z(wi(e2), 2);
|
|
1357
|
+
n2[0];
|
|
1358
|
+
var r2 = n2[1];
|
|
1359
|
+
t2.push.apply(t2, yi(yi([], Z(r2?.required || []), false), Z(r2?.subMappings?.[e2]?.required || []), false));
|
|
1360
|
+
} else t2.push.apply(t2, yi([], Z(Si(e2)?.required || []), false));
|
|
1361
|
+
return t2;
|
|
1362
|
+
};
|
|
1363
|
+
var Ei = function(e2, t2) {
|
|
1364
|
+
var n2;
|
|
1365
|
+
return t2 === void 0 && (t2 = ``), (n2 = e2?.main)?.find?.call(n2, function(e3) {
|
|
1366
|
+
return e3.key === t2;
|
|
1367
|
+
});
|
|
1368
|
+
};
|
|
1369
|
+
var Di = function(e2, t2) {
|
|
1370
|
+
return Error(`Url Mappings Error - [${e2}]: ${t2}`);
|
|
1371
|
+
};
|
|
1372
|
+
var Oi = Object.values(X);
|
|
1373
|
+
var ki = Di(`key`, `must be one of: ${Oi.toString()}`);
|
|
1374
|
+
var Ai = function(e2) {
|
|
1375
|
+
if (typeof e2 != `string` || !Oi.includes(e2)) return ki;
|
|
1376
|
+
};
|
|
1377
|
+
var ji = Di(`itemData`, `must be on object with string as value, for example: { "slug": "shoes" }`);
|
|
1378
|
+
var Mi = function(e2) {
|
|
1379
|
+
if (typeof e2 != `object` || !e2 || !Object.values(e2).every(function(e3) {
|
|
1380
|
+
return typeof e3 == `string`;
|
|
1381
|
+
}) || Array.isArray(e2)) return ji;
|
|
1382
|
+
};
|
|
1383
|
+
var Ni = Di(`itemData`, `must have required variables, for example: { "slug": "shoes" }`);
|
|
1384
|
+
var Pi = function(e2, t2) {
|
|
1385
|
+
try {
|
|
1386
|
+
var n2 = Ti(e2);
|
|
1387
|
+
if (!n2.every(function(e3) {
|
|
1388
|
+
return !!t2[e3];
|
|
1389
|
+
}) || !n2.length) throw Error();
|
|
1390
|
+
} catch {
|
|
1391
|
+
return Ni;
|
|
1392
|
+
}
|
|
1393
|
+
};
|
|
1394
|
+
var Fi = function(e2) {
|
|
1395
|
+
var t2 = e2.key, n2 = e2.itemData;
|
|
1396
|
+
return [Ai(t2), Mi(n2), Pi(t2, n2)].find(Boolean);
|
|
1397
|
+
};
|
|
1398
|
+
var Ii = function(e2) {
|
|
1399
|
+
return function(t2) {
|
|
1400
|
+
var n2 = new RegExp(Jr, `g`), r2 = t2.replace(n2, ``);
|
|
1401
|
+
return e2?.[r2];
|
|
1402
|
+
};
|
|
1403
|
+
};
|
|
1404
|
+
var Li = function(e2, t2, n2, r2) {
|
|
1405
|
+
e2 === void 0 && (e2 = { main: [] }), r2 === void 0 && (r2 = {});
|
|
1406
|
+
var i2 = Fi({ key: t2, itemData: n2 });
|
|
1407
|
+
if (i2) throw i2;
|
|
1408
|
+
var a2 = (Ei(e2, t2) || {}).mapping, o2 = (r2 || {}).baseUrl;
|
|
1409
|
+
if (o2 ??= ``, o2 = o2.endsWith(`/`) ? o2?.slice(0, -1) : o2, a2 && typeof a2 == `string`) {
|
|
1410
|
+
var s2 = new RegExp(qr, `g`), c2 = a2.replace(s2, Ii(n2));
|
|
1411
|
+
return o2.concat(`/${c2}`);
|
|
1412
|
+
}
|
|
1413
|
+
};
|
|
1414
|
+
var Ri = /[.*+?^$()|]/g;
|
|
1415
|
+
var zi = function(e2) {
|
|
1416
|
+
var t2 = e2.replace(Ri, `\\$&`).replace(new RegExp(qr, `g`), Yr);
|
|
1417
|
+
return RegExp(`^${t2}$`);
|
|
1418
|
+
};
|
|
1419
|
+
var Bi = function(e2, t2) {
|
|
1420
|
+
return e2 === void 0 && (e2 = []), e2.find(function(e3) {
|
|
1421
|
+
return zi(e3).test(t2);
|
|
1422
|
+
});
|
|
1423
|
+
};
|
|
1424
|
+
Di(`url`, `Url must be a string`);
|
|
1425
|
+
var Vi = function(e2) {
|
|
1426
|
+
return [` `, ` `, `
|
|
1427
|
+
`].every(function(t2) {
|
|
1428
|
+
return !e2?.includes?.call(e2, t2);
|
|
1429
|
+
});
|
|
1430
|
+
};
|
|
1431
|
+
var Hi = function(e2) {
|
|
1432
|
+
return e2?.length <= ea.MAX_URL_MAPPING_LENGTH;
|
|
1433
|
+
};
|
|
1434
|
+
var Ui = function(e2) {
|
|
1435
|
+
return e2?.split(`/`).every(Boolean);
|
|
1436
|
+
};
|
|
1437
|
+
var Wi = function(e2, t2) {
|
|
1438
|
+
var n2 = t2.urlMappingKey;
|
|
1439
|
+
return Ti(n2)?.every(function(t3) {
|
|
1440
|
+
return e2?.includes(`{{${t3}}}`);
|
|
1441
|
+
});
|
|
1442
|
+
};
|
|
1443
|
+
var Gi = function(e2) {
|
|
1444
|
+
return (e2.match(new RegExp(qr, `g`))?.length || 0) <= 1;
|
|
1445
|
+
};
|
|
1446
|
+
var Ki = function(e2) {
|
|
1447
|
+
return e2?.split(`/`).every(Gi);
|
|
1448
|
+
};
|
|
1449
|
+
var qi = function(e2) {
|
|
1450
|
+
return [e2.publishedPrefix, e2.savedPrefix].filter(Boolean);
|
|
1451
|
+
};
|
|
1452
|
+
var Ji = function(e2, t2) {
|
|
1453
|
+
return t2 === void 0 && (t2 = []), function(n2, r2) {
|
|
1454
|
+
var i2 = n2.split(`/`), a2 = n2 === r2;
|
|
1455
|
+
if (i2.length < 1 || a2) return true;
|
|
1456
|
+
var o2 = Z(r2.split(`/`), 1)[0], s2 = Z(i2, 1)[0];
|
|
1457
|
+
return t2.includes(s2) ? true : e2.every(function(e3) {
|
|
1458
|
+
return e3 === o2 || e3 !== s2;
|
|
1459
|
+
});
|
|
1460
|
+
};
|
|
1461
|
+
};
|
|
1462
|
+
var Yi = function(e2, t2) {
|
|
1463
|
+
var n2 = t2.pathPrefixes;
|
|
1464
|
+
return Ji(Object.values(n2).map(function(e3) {
|
|
1465
|
+
return e3.publishedPrefix;
|
|
1466
|
+
}).filter(Boolean), qi(t2.pathPrefix))(e2, t2.defaultMapping.defaultPublished);
|
|
1467
|
+
};
|
|
1468
|
+
var Xi = function(e2, t2) {
|
|
1469
|
+
var n2 = t2.urlMappingKey, r2 = t2.urlMappings;
|
|
1470
|
+
return !Bi(r2.main?.filter(function(e3) {
|
|
1471
|
+
return n2 !== e3.key;
|
|
1472
|
+
}).map(function(e3) {
|
|
1473
|
+
return e3.mapping;
|
|
1474
|
+
}), e2);
|
|
1475
|
+
};
|
|
1476
|
+
var Zi = function(e2) {
|
|
1477
|
+
e2 = e2.replace(new RegExp(qr, `ig`), ``);
|
|
1478
|
+
var t2 = new RegExp(/[^\]_.~!*'();:@&=+$,<>\\#^%?`"]/, `g`), n2 = !/(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff]|[\u0023-\u0039]\ufe0f?\u20e3|\u3299|\u3297|\u303d|\u3030|\u24c2|\ud83c[\udd70-\udd71]|\ud83c[\udd7e-\udd7f]|\ud83c\udd8e|\ud83c[\udd91-\udd9a]|\ud83c[\udde6-\uddff]|[\ud83c[\ude01-\ude02]|\ud83c\ude1a|\ud83c\ude2f|[\ud83c[\ude32-\ude3a]|[\ud83c[\ude50-\ude51]|\u203c|\u2049|[\u25aa-\u25ab]|\u25b6|\u25c0|[\u25fb-\u25fe]|\u00a9|\u00ae|\u2122|\u2139|\ud83c\udc04|[\u2600-\u26FF]|\u2b05|\u2b06|\u2b07|\u2b1b|\u2b1c|\u2b50|\u2b55|\u231a|\u231b|\u2328|\u23cf|[\u23e9-\u23f3]|[\u23f8-\u23fa]|\ud83c\udccf|\u2934|\u2935|[\u2190-\u21ff])/g.test(e2), r2 = !e2.replace(t2, ``);
|
|
1479
|
+
return n2 && r2;
|
|
1480
|
+
};
|
|
1481
|
+
var Qi = function(e2) {
|
|
1482
|
+
var t2 = Z(e2, 1)[0], n2 = e2.slice(-1);
|
|
1483
|
+
return t2 !== `/` && n2 !== `/`;
|
|
1484
|
+
};
|
|
1485
|
+
var $i = function(e2, t2) {
|
|
1486
|
+
var n2 = t2.pathPrefixes;
|
|
1487
|
+
return Ji(Object.values(n2).map(function(e3) {
|
|
1488
|
+
return e3.savedPrefix;
|
|
1489
|
+
}).filter(Boolean), qi(t2.pathPrefix))(e2, t2.defaultMapping.defaultSaved);
|
|
1490
|
+
};
|
|
1491
|
+
var Q;
|
|
1492
|
+
(function(e2) {
|
|
1493
|
+
e2.MAX_LENGTH_ERROR = `MAX_LENGTH_ERROR`, e2.NO_SPACES_ERROR = `NO_SPACES_ERROR`, e2.NO_EMPTY_SEGMENT_ERROR = `NO_EMPTY_SEGMENT_ERROR`, e2.CONTAIN_MAIN_VARIABLE_ERROR = `CONTAIN_MAIN_VARIABLE_ERROR`, e2.ONLY_ONE_VARIABLE_PER_SEGMENT_ERROR = `ONLY_ONE_VARIABLE_PER_SEGMENT_ERROR`, e2.ONLY_UNIQUE_PUBLISHED_URL_ERROR = `ONLY_UNIQUE_PUBLISHED_URL_ERROR`, e2.ONLY_UNIQUE_SAVED_URL_ERROR = `ONLY_UNIQUE_SAVED_URL_ERROR`, e2.ONLY_UNIQUE_MAPPING_ERROR = `ONLY_UNIQUE_MAPPING_ERROR`, e2.NO_INVALID_CHARACTERS_ERROR = `NO_INVALID_CHARACTERS_ERROR`, e2.NO_STARTING_OR_ENDING_SLASH_ERROR = `NO_STARTING_OR_ENDING_SLASH_ERROR`;
|
|
1494
|
+
})(Q ||= {});
|
|
1495
|
+
var ea = function() {
|
|
1496
|
+
function e2(e3) {
|
|
1497
|
+
var t2 = e3.urlMappingKey, n2 = e3.pathPrefixes, r2 = e3.urlMappings, i2 = this;
|
|
1498
|
+
this.initValidators = function() {
|
|
1499
|
+
i2.validators = [[Hi, Q.MAX_LENGTH_ERROR], [Vi, Q.NO_SPACES_ERROR], [Qi, Q.NO_STARTING_OR_ENDING_SLASH_ERROR], [Ui, Q.NO_EMPTY_SEGMENT_ERROR], [Zi, Q.NO_INVALID_CHARACTERS_ERROR], [Wi, Q.CONTAIN_MAIN_VARIABLE_ERROR], [Ki, Q.ONLY_ONE_VARIABLE_PER_SEGMENT_ERROR], [Yi, Q.ONLY_UNIQUE_PUBLISHED_URL_ERROR], [$i, Q.ONLY_UNIQUE_SAVED_URL_ERROR], [Xi, Q.ONLY_UNIQUE_MAPPING_ERROR]];
|
|
1500
|
+
}, this.urlMappings = r2, this.pathPrefixes = n2, this.urlMappingKey = t2, this.pathPrefix = this.getPathPrefix(), this.defaultMapping = ta(t2, this.pathPrefix), this.initValidators();
|
|
1501
|
+
}
|
|
1502
|
+
return e2.prototype.getPathPrefix = function() {
|
|
1503
|
+
var t2 = Ci(this.urlMappingKey);
|
|
1504
|
+
if (!t2) throw bi(this.urlMappingKey) ? Error(`Url Mapper Validator Error: Validator does not support sub mapping, please use the main url mapping key`) : Error(`Url Mapper Validator Error: Url mapping key is not supported (${this.urlMappingKey})`);
|
|
1505
|
+
return this.pathPrefixes[t2] || e2.FALLBACK_PATH_PREFIX;
|
|
1506
|
+
}, Object.defineProperty(e2.prototype, "validatorProps", { get: function() {
|
|
1507
|
+
var e3 = this;
|
|
1508
|
+
return { urlMappingKey: e3.urlMappingKey, urlMappings: e3.urlMappings, pathPrefix: e3.pathPrefix, pathPrefixes: e3.pathPrefixes, defaultMapping: e3.defaultMapping };
|
|
1509
|
+
}, enumerable: false, configurable: true }), e2.prototype.validate = function(e3) {
|
|
1510
|
+
var t2, n2;
|
|
1511
|
+
try {
|
|
1512
|
+
for (var r2 = vi(this.validators), i2 = r2.next(); !i2.done; i2 = r2.next()) {
|
|
1513
|
+
var a2 = Z(i2.value, 2), o2 = a2[0], s2 = a2[1], c2 = !!o2(e3, this.validatorProps);
|
|
1514
|
+
if (!c2) return { isValid: c2, error: s2 };
|
|
1515
|
+
}
|
|
1516
|
+
} catch (e4) {
|
|
1517
|
+
t2 = { error: e4 };
|
|
1518
|
+
} finally {
|
|
1519
|
+
try {
|
|
1520
|
+
i2 && !i2.done && (n2 = r2.return) && n2.call(r2);
|
|
1521
|
+
} finally {
|
|
1522
|
+
if (t2) throw t2.error;
|
|
1523
|
+
}
|
|
1524
|
+
}
|
|
1525
|
+
return { isValid: true };
|
|
1526
|
+
}, e2.errorArray = Object.values(Q), e2.MAX_URL_MAPPING_LENGTH = 1e3, e2.FALLBACK_PATH_PREFIX = `unknown`, e2;
|
|
1527
|
+
}();
|
|
1528
|
+
var ta = function(e2, t2) {
|
|
1529
|
+
var n2 = xi()[e2] || { required: [`slug`] }, r2 = n2.required, i2 = n2.defaultPrefix, a2 = {};
|
|
1530
|
+
return t2 && typeof t2 == `object` ? (a2.savedPrefix = t2.savedPrefix ?? ``, a2.publishedPrefix = t2.publishedPrefix ?? ``) : (a2.savedPrefix = ea.FALLBACK_PATH_PREFIX, a2.publishedPrefix = ea.FALLBACK_PATH_PREFIX), { defaultSaved: yi([a2.savedPrefix, i2], Z(r2?.map(function(e3) {
|
|
1531
|
+
return `{{${e3}}}`;
|
|
1532
|
+
})), false).filter(Boolean).join(`/`), defaultPublished: yi([a2.publishedPrefix, i2], Z(r2?.map(function(e3) {
|
|
1533
|
+
return `{{${e3}}}`;
|
|
1534
|
+
})), false).filter(Boolean).join(`/`) };
|
|
1535
|
+
};
|
|
1536
|
+
function na(e2, t2) {
|
|
1537
|
+
return t2 ? Li(e2, X.BOOKINGS_SERVICE, { slug: t2 }, { baseUrl: `` }) : void 0;
|
|
1538
|
+
}
|
|
1539
|
+
var ra = [{ path: `bookingPolicyViolations.earliestBookingDate` }];
|
|
1540
|
+
var ia = [{ path: `timeSlots.bookingPolicyViolations.earliestBookingDate` }];
|
|
1541
|
+
function aa(e2) {
|
|
1542
|
+
return Ct(Object.assign(e2, { domainToMappings: { "www.wixapis.com": [{ srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }], "*.dev.wix-code.com": [{ srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }], "manage._base_domain_": [{ srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }], "www._base_domain_": [{ srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }], _: [{ srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/_api/service-availability/v2/time-slots/event`, destPath: `/v2/time-slots/event` }], "editor._base_domain_": [{ srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/time-slots/event`, destPath: `/v2/time-slots/event` }], "blocks._base_domain_": [{ srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/time-slots/event`, destPath: `/v2/time-slots/event` }], "create.editorx": [{ srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/time-slots/event`, destPath: `/v2/time-slots/event` }], "editor.wixapps.net": [{ srcPath: `/_api/service-availability/v2/time-slots/event`, destPath: `/v2/time-slots/event` }] } }));
|
|
1543
|
+
}
|
|
1544
|
+
var oa = `@wix/auto_sdk_bookings_availability-time-slots`;
|
|
1545
|
+
function sa(e2) {
|
|
1546
|
+
function t2({ host: t3 }) {
|
|
1547
|
+
let n2 = nt(e2, [{ transformFn: Ue, paths: ra }]);
|
|
1548
|
+
return { entityFqdn: `wix.bookings.availability.v2.time_slot`, method: `POST`, methodFqn: `com.wixpress.bookings.availability.v2.AvailabilityTimeSlots.ListAvailabilityTimeSlots`, packageName: oa, migrationOptions: { optInTransformResponse: true }, url: aa({ protoPath: `/v2/time-slots`, data: n2, host: t3 }), data: n2, transformResponse: (e3) => nt(e3, [{ transformFn: We, paths: ia }]) };
|
|
1549
|
+
}
|
|
1550
|
+
return t2;
|
|
1551
|
+
}
|
|
1552
|
+
async function ca(e2) {
|
|
1553
|
+
let { httpClient: t2, sideEffects: n2 } = arguments[1], r2 = sa(He({ serviceId: e2?.serviceId, fromLocalDate: e2?.fromLocalDate, toLocalDate: e2?.toLocalDate, timeZone: e2?.timeZone, locations: e2?.locations, includeResourceTypeIds: e2?.includeResourceTypeIds, bookable: e2?.bookable, bookingPolicyViolations: e2?.bookingPolicyViolations, timeSlotsPerDay: e2?.timeSlotsPerDay, cursorPaging: e2?.cursorPaging, customerChoices: e2?.customerChoices, resourceTypes: e2?.resourceTypes }));
|
|
1554
|
+
n2?.onSiteCall?.();
|
|
1555
|
+
try {
|
|
1556
|
+
let e3 = await t2.request(r2);
|
|
1557
|
+
return n2?.onSuccess?.(e3), L(e3.data);
|
|
1558
|
+
} catch (e3) {
|
|
1559
|
+
let t3 = ft(e3, { spreadPathsToArguments: {}, explicitPathsToArguments: { serviceId: `$[0].serviceId`, fromLocalDate: `$[0].fromLocalDate`, toLocalDate: `$[0].toLocalDate`, timeZone: `$[0].timeZone`, locations: `$[0].locations`, includeResourceTypeIds: `$[0].includeResourceTypeIds`, bookable: `$[0].bookable`, bookingPolicyViolations: `$[0].bookingPolicyViolations`, timeSlotsPerDay: `$[0].timeSlotsPerDay`, cursorPaging: `$[0].cursorPaging`, customerChoices: `$[0].customerChoices`, resourceTypes: `$[0].resourceTypes` }, singleArgumentUnchanged: false }, [`options`]);
|
|
1560
|
+
throw n2?.onError?.(e3), t3;
|
|
1561
|
+
}
|
|
1562
|
+
}
|
|
1563
|
+
function la(e2) {
|
|
1564
|
+
return (t2) => ca(t2, { httpClient: e2 });
|
|
1565
|
+
}
|
|
1566
|
+
var ua = B(la);
|
|
1567
|
+
var da = [{ path: `bookingPolicyViolations.earliestBookingDate` }];
|
|
1568
|
+
var fa = [{ path: `timeSlots.bookingPolicyViolations.earliestBookingDate` }, { path: `schedulesInfo.firstSessionStart` }, { path: `schedulesInfo.lastSessionEnd` }, { path: `schedulesInfo.enrollmentViolations.earliestBookingDate` }];
|
|
1569
|
+
function pa(e2) {
|
|
1570
|
+
return Ct(Object.assign(e2, { domainToMappings: { "www.wixapis.com": [{ srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }], "*.dev.wix-code.com": [{ srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }], "manage._base_domain_": [{ srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }], "www._base_domain_": [{ srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }], _: [{ srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/_api/service-availability/v2/time-slots/event`, destPath: `/v2/time-slots/event` }], "editor._base_domain_": [{ srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/time-slots/event`, destPath: `/v2/time-slots/event` }], "blocks._base_domain_": [{ srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/time-slots/event`, destPath: `/v2/time-slots/event` }], "create.editorx": [{ srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/time-slots/event`, destPath: `/v2/time-slots/event` }], "editor.wixapps.net": [{ srcPath: `/_api/service-availability/v2/time-slots/event`, destPath: `/v2/time-slots/event` }] } }));
|
|
1571
|
+
}
|
|
1572
|
+
var ma = `@wix/auto_sdk_bookings_event-time-slots`;
|
|
1573
|
+
function ha(e2) {
|
|
1574
|
+
function t2({ host: t3 }) {
|
|
1575
|
+
let n2 = nt(e2, [{ transformFn: Ue, paths: da }]);
|
|
1576
|
+
return { entityFqdn: `wix.bookings.availability.v2.time_slot`, method: `POST`, methodFqn: `com.wixpress.bookings.availability.v2.EventTimeSlots.ListEventTimeSlots`, packageName: ma, migrationOptions: { optInTransformResponse: true }, url: pa({ protoPath: `/v2/time-slots/event`, data: n2, host: t3 }), data: n2, transformResponse: (e3) => nt(e3, [{ transformFn: We, paths: fa }]) };
|
|
1577
|
+
}
|
|
1578
|
+
return t2;
|
|
1579
|
+
}
|
|
1580
|
+
async function ga(e2) {
|
|
1581
|
+
let { httpClient: t2, sideEffects: n2 } = arguments[1], r2 = ha(He({ fromLocalDate: e2?.fromLocalDate, toLocalDate: e2?.toLocalDate, timeZone: e2?.timeZone, serviceIds: e2?.serviceIds, includeNonBookable: e2?.includeNonBookable, minBookableCapacity: e2?.minBookableCapacity, eventFilter: e2?.eventFilter, maxSlotsPerDay: e2?.maxSlotsPerDay, cursorPaging: e2?.cursorPaging, bookingPolicyViolations: e2?.bookingPolicyViolations }));
|
|
1582
|
+
n2?.onSiteCall?.();
|
|
1583
|
+
try {
|
|
1584
|
+
let e3 = await t2.request(r2);
|
|
1585
|
+
return n2?.onSuccess?.(e3), L(e3.data);
|
|
1586
|
+
} catch (e3) {
|
|
1587
|
+
let t3 = ft(e3, { spreadPathsToArguments: {}, explicitPathsToArguments: { fromLocalDate: `$[0].fromLocalDate`, toLocalDate: `$[0].toLocalDate`, timeZone: `$[0].timeZone`, serviceIds: `$[0].serviceIds`, includeNonBookable: `$[0].includeNonBookable`, minBookableCapacity: `$[0].minBookableCapacity`, eventFilter: `$[0].eventFilter`, maxSlotsPerDay: `$[0].maxSlotsPerDay`, cursorPaging: `$[0].cursorPaging`, bookingPolicyViolations: `$[0].bookingPolicyViolations` }, singleArgumentUnchanged: false }, [`options`]);
|
|
1588
|
+
throw n2?.onError?.(e3), t3;
|
|
1589
|
+
}
|
|
1590
|
+
}
|
|
1591
|
+
function _a(e2) {
|
|
1592
|
+
return (t2) => ga(t2, { httpClient: e2 });
|
|
1593
|
+
}
|
|
1594
|
+
var va = B(_a);
|
|
1595
|
+
var ya = [{ path: `bookingPolicyViolations.earliestBookingDate` }];
|
|
1596
|
+
var ba = [{ path: `timeSlots.bookingPolicyViolations.earliestBookingDate` }];
|
|
1597
|
+
function xa(e2) {
|
|
1598
|
+
return Ct(Object.assign(e2, { domainToMappings: { "www.wixapis.com": [{ srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }], "*.dev.wix-code.com": [{ srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }], "manage._base_domain_": [{ srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }], "www._base_domain_": [{ srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }], _: [{ srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/_api/service-availability/v2/time-slots/event`, destPath: `/v2/time-slots/event` }], "editor._base_domain_": [{ srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/time-slots/event`, destPath: `/v2/time-slots/event` }], "blocks._base_domain_": [{ srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/time-slots/event`, destPath: `/v2/time-slots/event` }], "create.editorx": [{ srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/time-slots/event`, destPath: `/v2/time-slots/event` }], "editor.wixapps.net": [{ srcPath: `/_api/service-availability/v2/time-slots/event`, destPath: `/v2/time-slots/event` }] } }));
|
|
1599
|
+
}
|
|
1600
|
+
var Sa = `@wix/auto_sdk_bookings_multi-service-availability-time-slots`;
|
|
1601
|
+
function Ca(e2) {
|
|
1602
|
+
function t2({ host: t3 }) {
|
|
1603
|
+
let n2 = nt(e2, [{ transformFn: Ue, paths: ya }]);
|
|
1604
|
+
return { entityFqdn: `wix.bookings.availability.v2.time_slot`, method: `POST`, methodFqn: `com.wixpress.bookings.availability.v2.MultiServiceAvailabilityTimeSlots.ListMultiServiceAvailabilityTimeSlots`, packageName: Sa, migrationOptions: { optInTransformResponse: true }, url: xa({ protoPath: `/v2/multi-service-time-slots`, data: n2, host: t3 }), data: n2, transformResponse: (e3) => nt(e3, [{ transformFn: We, paths: ba }]) };
|
|
1605
|
+
}
|
|
1606
|
+
return t2;
|
|
1607
|
+
}
|
|
1608
|
+
async function wa(e2) {
|
|
1609
|
+
let { httpClient: t2, sideEffects: n2 } = arguments[1], r2 = Ca(He({ services: e2?.services, fromLocalDate: e2?.fromLocalDate, toLocalDate: e2?.toLocalDate, timeZone: e2?.timeZone, location: e2?.location, bookable: e2?.bookable, bookingPolicyViolations: e2?.bookingPolicyViolations, timeSlotsPerDay: e2?.timeSlotsPerDay, cursorPaging: e2?.cursorPaging }));
|
|
1610
|
+
n2?.onSiteCall?.();
|
|
1611
|
+
try {
|
|
1612
|
+
let e3 = await t2.request(r2);
|
|
1613
|
+
return n2?.onSuccess?.(e3), L(e3.data);
|
|
1614
|
+
} catch (e3) {
|
|
1615
|
+
let t3 = ft(e3, { spreadPathsToArguments: {}, explicitPathsToArguments: { services: `$[0].services`, fromLocalDate: `$[0].fromLocalDate`, toLocalDate: `$[0].toLocalDate`, timeZone: `$[0].timeZone`, location: `$[0].location`, bookable: `$[0].bookable`, bookingPolicyViolations: `$[0].bookingPolicyViolations`, timeSlotsPerDay: `$[0].timeSlotsPerDay`, cursorPaging: `$[0].cursorPaging` }, singleArgumentUnchanged: false }, [`options`]);
|
|
1616
|
+
throw n2?.onError?.(e3), t3;
|
|
1617
|
+
}
|
|
1618
|
+
}
|
|
1619
|
+
function Ta(e2) {
|
|
1620
|
+
return (t2) => wa(t2, { httpClient: e2 });
|
|
1621
|
+
}
|
|
1622
|
+
var Ea = B(Ta);
|
|
1623
|
+
var Da = ((e2) => (e2.UNKNOWN = `UNKNOWN`, e2.CUSTOM = `CUSTOM`, e2.STAFF_MEMBER = `STAFF_MEMBER`, e2.DURATION = `DURATION`, e2.DATE_TIME = `DATE_TIME`, e2.NUMBER_OF_PARTICIPANTS = `NUMBER_OF_PARTICIPANTS`, e2.LOCATION = `LOCATION`, e2.DURATION_RANGE = `DURATION_RANGE`, e2))(Da || {});
|
|
1624
|
+
var Oa = ((e2) => (e2.APPOINTMENT = `APPOINTMENT`, e2.CLASS = `CLASS`, e2.COURSE = `COURSE`, e2))(Oa || {});
|
|
1625
|
+
var ka = ((e2) => (e2.CUSTOM = `CUSTOM`, e2.BUSINESS = `BUSINESS`, e2.CUSTOMER = `CUSTOMER`, e2))(ka || {});
|
|
1626
|
+
var Aa = [{ path: `timeSlotsConfiguration.createdDate` }, { path: `timeSlotsConfiguration.updatedDate` }];
|
|
1627
|
+
function ja(e2) {
|
|
1628
|
+
return Ct(Object.assign(e2, { domainToMappings: { _: [{ srcPath: `/_api/time-slots-config`, destPath: `` }], "manage._base_domain_": [{ srcPath: `/_api/time-slots-config`, destPath: `` }], "editor._base_domain_": [{ srcPath: `/_api/time-slots-config`, destPath: `` }], "blocks._base_domain_": [{ srcPath: `/_api/time-slots-config`, destPath: `` }], "create.editorx": [{ srcPath: `/_api/time-slots-config`, destPath: `` }], "apps._base_domain_": [{ srcPath: `/_api/time-slots-config`, destPath: `` }], "*.dev.wix-code.com": [{ srcPath: `/_api/time-slots-config`, destPath: `` }], "www.wixapis.com": [{ srcPath: `/_api/time-slots-config`, destPath: `` }] } }));
|
|
1629
|
+
}
|
|
1630
|
+
var Ma = `@wix/auto_sdk_bookings_time-slots-configuration`;
|
|
1631
|
+
function Na(e2) {
|
|
1632
|
+
function t2({ host: t3 }) {
|
|
1633
|
+
return { entityFqdn: `wix.bookings.timeslots_configuration.v1.time_slots_configuration`, method: `GET`, methodFqn: `wix.bookings.timeslots.configuration.v1.TimeSlotsConfigurationService.GetTimeSlotsConfigurationByAppId`, packageName: Ma, migrationOptions: { optInTransformResponse: true }, url: ja({ protoPath: `/v1/time-slots-configurations/app/{appId}`, data: e2, host: t3 }), params: St(e2), transformResponse: (e3) => nt(e3, [{ transformFn: We, paths: Aa }]) };
|
|
1634
|
+
}
|
|
1635
|
+
return t2;
|
|
1636
|
+
}
|
|
1637
|
+
async function Pa(e2) {
|
|
1638
|
+
let { httpClient: t2, sideEffects: n2 } = arguments[1], r2 = Na(He({ appId: e2 }));
|
|
1639
|
+
n2?.onSiteCall?.();
|
|
1640
|
+
try {
|
|
1641
|
+
let e3 = await t2.request(r2);
|
|
1642
|
+
return n2?.onSuccess?.(e3), L(e3.data);
|
|
1643
|
+
} catch (e3) {
|
|
1644
|
+
let t3 = ft(e3, { spreadPathsToArguments: {}, explicitPathsToArguments: { appId: `$[0]` }, singleArgumentUnchanged: false }, [`appId`]);
|
|
1645
|
+
throw n2?.onError?.(e3), t3;
|
|
1646
|
+
}
|
|
1647
|
+
}
|
|
1648
|
+
function Fa(e2) {
|
|
1649
|
+
return (t2) => Pa(t2, { httpClient: e2 });
|
|
1650
|
+
}
|
|
1651
|
+
var Ia = B(Fa);
|
|
1652
|
+
var La = [{ path: `bookingsSettings.createdDate` }, { path: `bookingsSettings.updatedDate` }];
|
|
1653
|
+
var Ra = [{ path: `bookingsSettings.siteProperties.address.coordinates.latitude` }, { path: `bookingsSettings.siteProperties.address.coordinates.longitude` }];
|
|
1654
|
+
function za(e2) {
|
|
1655
|
+
return Ct(Object.assign(e2, { domainToMappings: { "manage._base_domain_": [{ srcPath: `/_api/bookings-settings`, destPath: `` }], "dev._base_domain_": [{ srcPath: `/_api/bookings-settings`, destPath: `` }], "*.dev.wix-code.com": [{ srcPath: `/_api/bookings-settings`, destPath: `` }], "www.wixapis.com": [{ srcPath: `/_api/bookings-settings`, destPath: `` }], _: [{ srcPath: `/_api/bookings-settings`, destPath: `` }], "api._api_base_domain_": [{ srcPath: `/bookings-settings`, destPath: `` }], "editor._base_domain_": [{ srcPath: `/_api/bookings-settings`, destPath: `` }], "blocks._base_domain_": [{ srcPath: `/_api/bookings-settings`, destPath: `` }], "create.editorx": [{ srcPath: `/_api/bookings-settings`, destPath: `` }], "editor.wixapps.net": [{ srcPath: `/_api/bookings-settings`, destPath: `` }], "www._base_domain_": [{ srcPath: `/_api/bookings-settings`, destPath: `` }] } }));
|
|
1656
|
+
}
|
|
1657
|
+
var Ba = `@wix/auto_sdk_bookings_bookings-settings`;
|
|
1658
|
+
function Va(e2) {
|
|
1659
|
+
function t2({ host: t3 }) {
|
|
1660
|
+
return { entityFqdn: `wix.bookings.v2.bookings_settings`, method: `GET`, methodFqn: `wix.bookings.settings.v2.BookingsSettingsService.GetBookingsSettings`, packageName: Ba, migrationOptions: { optInTransformResponse: true }, url: za({ protoPath: `/v2/settings`, data: e2, host: t3 }), params: St(e2), transformResponse: (e3) => nt(e3, [{ transformFn: We, paths: La }, { transformFn: Jt, paths: Ra }]), fallback: [{ method: `GET`, url: za({ protoPath: `/v2/settings`, data: e2, host: t3 }), params: St(e2) }] };
|
|
1661
|
+
}
|
|
1662
|
+
return t2;
|
|
1663
|
+
}
|
|
1664
|
+
var Ha = ((e2) => (e2.BUSINESS_TIME_ZONE = `BUSINESS_TIME_ZONE`, e2.CUSTOMER_TIME_ZONE = `CUSTOMER_TIME_ZONE`, e2))(Ha || {});
|
|
1665
|
+
async function Ua() {
|
|
1666
|
+
let { httpClient: e2, sideEffects: t2 } = arguments[0], n2 = Va(He({}));
|
|
1667
|
+
t2?.onSiteCall?.();
|
|
1668
|
+
try {
|
|
1669
|
+
let r2 = await e2.request(n2);
|
|
1670
|
+
return t2?.onSuccess?.(r2), L(r2.data)?.bookingsSettings;
|
|
1671
|
+
} catch (e3) {
|
|
1672
|
+
let n3 = ft(e3, { spreadPathsToArguments: {}, explicitPathsToArguments: {}, singleArgumentUnchanged: false }, []);
|
|
1673
|
+
throw t2?.onError?.(e3), n3;
|
|
1674
|
+
}
|
|
1675
|
+
}
|
|
1676
|
+
function Wa(e2) {
|
|
1677
|
+
return () => Ua({ httpClient: e2 });
|
|
1678
|
+
}
|
|
1679
|
+
var Ga = B(Wa);
|
|
1680
|
+
function Ka(e2) {
|
|
1681
|
+
return e2.business?._id ?? null;
|
|
1682
|
+
}
|
|
1683
|
+
function qa(e2) {
|
|
1684
|
+
return e2.business?.name ?? null;
|
|
1685
|
+
}
|
|
1686
|
+
function Ja(e2) {
|
|
1687
|
+
return (e2?.locations ?? []).filter((e3) => e3.type === ka.BUSINESS).map((e3) => ({ id: Ka(e3) ?? ``, label: qa(e3) ?? `` })).filter((e3) => e3.id !== ``).sort((e3, t2) => e3.label.localeCompare(t2.label));
|
|
1688
|
+
}
|
|
1689
|
+
var Ya = (e2) => e2 === Oa.APPOINTMENT;
|
|
1690
|
+
var Xa = (e2) => e2 === Oa.CLASS;
|
|
1691
|
+
var Za = (e2) => e2 === Oa.COURSE;
|
|
1692
|
+
var Qa = { category: `category`, location: `location`, page: `page`, blob: `b`, resource: `resource`, referral: `referral`, timezone: `timezone`, bookingId: `bookingId`, token: `token`, rescheduleRedirectUrl: `rescheduleRedirectUrl` };
|
|
1693
|
+
function $a(e2) {
|
|
1694
|
+
if (!e2) return null;
|
|
1695
|
+
let t2 = ao(e2).map((e3) => e3.id), n2 = { ...e2.durationChoiceId ? { durationChoiceId: e2.durationChoiceId } : {}, ...e2.durationInMinutes ? { durationInMinutes: e2.durationInMinutes } : {}, ...t2.length ? { addOnIds: t2 } : {}, ...e2.requestedGender ? { requestedGender: { gender: e2.requestedGender } } : {} };
|
|
1696
|
+
return Object.keys(n2).length ? n2 : null;
|
|
1697
|
+
}
|
|
1698
|
+
function eo(e2) {
|
|
1699
|
+
return (e2?.services.length ?? 0) > 1;
|
|
1700
|
+
}
|
|
1701
|
+
var to = (e2) => ({ valid: false, reason: e2 });
|
|
1702
|
+
function no(e2) {
|
|
1703
|
+
let t2 = e2?.services ?? [];
|
|
1704
|
+
if (!eo(e2) || t2.some((e3) => !e3.serviceId)) return to(`too-few-services`);
|
|
1705
|
+
if (t2.some((e3) => e3.serviceType && e3.serviceType !== `APPOINTMENT`)) return to(`not-appointment`);
|
|
1706
|
+
let n2 = t2[0].locationType ?? `BUSINESS`, r2 = t2[0].locationId ?? null;
|
|
1707
|
+
if (t2.some((e3) => (e3.locationType ?? `BUSINESS`) !== n2 || (e3.locationId ?? null) !== r2)) return to(`location-mixed`);
|
|
1708
|
+
if (r2 && n2 !== `BUSINESS`) return to(`location-id-not-business`);
|
|
1709
|
+
let i2 = t2.map((e3) => ({ serviceId: e3.serviceId, staff: io(e3), customerChoices: $a(e3) }));
|
|
1710
|
+
return { valid: true, locationId: r2, locationType: n2, services: i2, requestKey: JSON.stringify([n2, r2, i2]) };
|
|
1711
|
+
}
|
|
1712
|
+
var ro = `staff`;
|
|
1713
|
+
function io(e2) {
|
|
1714
|
+
let t2 = e2.resources?.find((e3) => e3.type === ro);
|
|
1715
|
+
if (!t2) return null;
|
|
1716
|
+
let n2 = t2.ids[0];
|
|
1717
|
+
return n2 ? { anyResource: false, staffMemberId: n2 } : t2.anyResource ? { anyResource: true } : null;
|
|
1718
|
+
}
|
|
1719
|
+
function ao(e2) {
|
|
1720
|
+
return e2.addOns ?? [];
|
|
1721
|
+
}
|
|
1722
|
+
function oo(e2, t2) {
|
|
1723
|
+
let n2 = e2(t2);
|
|
1724
|
+
return n2 ? n2.replace(/\/$/, ``) || `/` : null;
|
|
1725
|
+
}
|
|
1726
|
+
function so(e2, t2, n2) {
|
|
1727
|
+
let r2 = e2(t2);
|
|
1728
|
+
return !r2 || !n2 ? null : `${r2.replace(/\/$/, ``)}/${n2}`;
|
|
1729
|
+
}
|
|
1730
|
+
function co(e2, t2) {
|
|
1731
|
+
switch (e2) {
|
|
1732
|
+
case `servicePage`:
|
|
1733
|
+
return (t2.slug ? t2.buildCustomServiceUrl(t2.slug) : void 0) ?? so(t2.appSectionUrl, Kr.SERVICE_PAGE, t2.slug);
|
|
1734
|
+
case `bookingCalendar`:
|
|
1735
|
+
return t2.isMultiService ? oo(t2.appSectionUrl, Kr.CALENDAR_PAGE) : so(t2.appSectionUrl, Kr.CALENDAR_PAGE, t2.slug);
|
|
1736
|
+
case `bookingForm`:
|
|
1737
|
+
return t2.serviceId ? so(t2.appSectionUrl, Kr.FORM_PAGE, t2.slug) : null;
|
|
1738
|
+
default:
|
|
1739
|
+
return null;
|
|
1740
|
+
}
|
|
1741
|
+
}
|
|
1742
|
+
var lo = (e2, t2) => t2 === `/` ? e2 : new URL(`.${t2}`, `${e2}/`).href;
|
|
1743
|
+
var uo = (e2, t2, n2) => n2 ? `.${t2}` : fo(e2, t2);
|
|
1744
|
+
var fo = (e2, t2) => e2 ? lo(e2, t2) : t2;
|
|
1745
|
+
var po = () => {
|
|
1746
|
+
let e2 = f(Ir), t2 = f(zr), n2 = t2.siteUrl.replace(/\/$/, ``), i2 = f(Lr), a2 = f(Vr), o2 = d(), s2 = r(async (t3) => {
|
|
1747
|
+
let r2 = uo(n2, t3, e2.getPreviewMode());
|
|
1748
|
+
await i2.navigateTo({ href: r2 });
|
|
1749
|
+
}, [e2, n2, i2]), c2 = r(async ({ href: e3, target: t3 }) => {
|
|
1750
|
+
await i2.navigateTo({ href: e3, target: t3 });
|
|
1751
|
+
}, [i2]), l2 = r((e3) => fo(n2, e3), [n2]), u2 = r((e3) => t2.appSectionRelativeUrl(Hr, e3), [t2]), p2 = r((e3) => na(a2.urlMappings, e3), [a2]), m2 = r((e3, t3) => co(e3, { ...t3, appSectionUrl: u2, buildCustomServiceUrl: p2 }), [u2, p2]), h2 = r((e3, t3) => {
|
|
1752
|
+
let r2 = m2(e3, t3);
|
|
1753
|
+
return r2 && n2 ? lo(n2, r2) : null;
|
|
1754
|
+
}, [m2, n2]), g2 = r((e3, t3) => {
|
|
1755
|
+
let n3 = m2(e3, t3);
|
|
1756
|
+
n3 && s2(n3);
|
|
1757
|
+
}, [m2, s2]), _2 = r(() => u2(Kr.FORM_PAGE) || void 0, [u2]), v2 = r((e3) => Object.values(o2(Nr).pages).some((t3) => t3.appPageId === e3 && (!t3.appDefinitionId || t3.appDefinitionId === `1380b703-ce81-ff05-f115-39571d94dfcd`)) && t2.appSectionRelativeUrl(`1380b703-ce81-ff05-f115-39571d94dfcd`, e3) || void 0, [t2, o2]);
|
|
1758
|
+
return { navigate: s2, navigateToHref: c2, resolvePath: m2, toHref: l2, resolveAbsoluteUrl: h2, navigateTo: g2, getBookingFormPath: _2, getCartPagePath: r(() => v2(Ur), [v2]), getThankYouPagePath: r((e3) => {
|
|
1759
|
+
let t3 = v2(Wr);
|
|
1760
|
+
return t3 ? `${t3}/${e3}?origin=bookings` : void 0;
|
|
1761
|
+
}, [v2]) };
|
|
1762
|
+
};
|
|
1763
|
+
function mo(e2) {
|
|
1764
|
+
return e2?.details?.applicationError?.code;
|
|
1765
|
+
}
|
|
1766
|
+
function ho() {
|
|
1767
|
+
let e2 = typeof $wixContext < `u` && $wixContext.initWixModules ? $wixContext.initWixModules : globalThis.__wix_context__ !== void 0 && globalThis.__wix_context__.initWixModules ? globalThis.__wix_context__.initWixModules : void 0;
|
|
1768
|
+
if (e2) return { initWixModules(t3, n3) {
|
|
1769
|
+
return go(() => e2(t3, n3));
|
|
1770
|
+
}, fetchWithAuth() {
|
|
1771
|
+
throw Error(`fetchWithAuth is not available in this context`);
|
|
1772
|
+
}, graphql() {
|
|
1773
|
+
throw Error(`graphql is not available in this context`);
|
|
1774
|
+
} };
|
|
1775
|
+
let t2 = typeof $wixContext < `u` ? $wixContext.client : m.client === void 0 ? globalThis.__wix_context__ === void 0 ? void 0 : globalThis.__wix_context__.client : m.client, n2 = typeof $wixContext < `u` ? $wixContext.elevatedClient : m.elevatedClient === void 0 ? globalThis.__wix_context__ === void 0 ? void 0 : globalThis.__wix_context__.elevatedClient : m.elevatedClient;
|
|
1776
|
+
if (t2 || n2) return { initWixModules(e3, r2) {
|
|
1777
|
+
if (r2) {
|
|
1778
|
+
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`);
|
|
1779
|
+
return go(() => n2.use(e3));
|
|
1780
|
+
}
|
|
1781
|
+
if (!t2) throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);
|
|
1782
|
+
return go(() => t2.use(e3));
|
|
1783
|
+
}, fetchWithAuth: (e3, n3) => {
|
|
1784
|
+
if (!t2) throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);
|
|
1785
|
+
return t2.fetchWithAuth(e3, n3);
|
|
1786
|
+
}, getAuth() {
|
|
1787
|
+
if (!t2) throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);
|
|
1788
|
+
return t2.auth;
|
|
1789
|
+
}, async graphql(e3, n3, r2) {
|
|
1790
|
+
if (!t2) throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);
|
|
1791
|
+
return t2.graphql(e3, n3, r2);
|
|
1792
|
+
} };
|
|
1793
|
+
}
|
|
1794
|
+
function go(e2) {
|
|
1795
|
+
let t2 = globalThis.__wix_context__, n2 = { client: m.client, elevatedClient: m.elevatedClient }, r2;
|
|
1796
|
+
globalThis.__wix_context__ = void 0, m.client = void 0, m.elevatedClient = void 0, typeof $wixContext < `u` && (r2 = { client: $wixContext?.client, elevatedClient: $wixContext?.elevatedClient }, delete $wixContext.client, delete $wixContext.elevatedClient);
|
|
1797
|
+
try {
|
|
1798
|
+
return e2();
|
|
1799
|
+
} finally {
|
|
1800
|
+
globalThis.__wix_context__ = t2, m.client = n2.client, m.elevatedClient = n2.elevatedClient, typeof $wixContext < `u` && ($wixContext.client = r2.client, $wixContext.elevatedClient = r2.elevatedClient);
|
|
1801
|
+
}
|
|
1802
|
+
}
|
|
1803
|
+
function _o(e2, t2) {
|
|
1804
|
+
return { ...e2, ...Object.fromEntries(t2.map((t3) => [t3, (...n2) => {
|
|
1805
|
+
let r2 = ho();
|
|
1806
|
+
if (!r2) throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);
|
|
1807
|
+
return r2.initWixModules(e2)[t3].apply(void 0, n2);
|
|
1808
|
+
}])) };
|
|
1809
|
+
}
|
|
1810
|
+
function vo(e2) {
|
|
1811
|
+
return _o({ __type: `host`, create: (t2) => Object.entries(e2).reduce((e3, [n2, r2]) => ({ ...e3, [n2]: r2(t2) }), {}) }, Object.keys(e2));
|
|
1812
|
+
}
|
|
1813
|
+
var yo = class {
|
|
1814
|
+
constructor(e2) {
|
|
1815
|
+
this.message = e2, this.captureException = () => {
|
|
1816
|
+
console.error(this.message);
|
|
1817
|
+
}, this.captureMessage = () => {
|
|
1818
|
+
console.error(this.message);
|
|
1819
|
+
}, this.startSpan = (e3, t2) => (console.error(this.message), t2(void 0)), this.startSpanManual = () => (console.error(this.message), { end: () => {
|
|
1820
|
+
}, fail: () => {
|
|
1821
|
+
} }), this.endSpanManual = () => {
|
|
1822
|
+
console.error(this.message);
|
|
1823
|
+
}, this.addBreadcrumb = () => {
|
|
1824
|
+
console.error(this.message);
|
|
1825
|
+
};
|
|
1826
|
+
}
|
|
1827
|
+
};
|
|
1828
|
+
var bo = (e2) => new yo(e2);
|
|
1829
|
+
var xo = vo({ getMonitoringClient: (e2) => () => e2.getMonitoringClient ? e2.getMonitoringClient() : bo(`Host monitoring client is not available on the current host. Make sure to use an updated version of the host initialization package.`) });
|
|
1830
|
+
var So = { 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` };
|
|
1831
|
+
function Co(e2) {
|
|
1832
|
+
try {
|
|
1833
|
+
let t2 = xo.getMonitoringClient?.();
|
|
1834
|
+
return t2 && typeof t2[e2] == `function` ? t2 : null;
|
|
1835
|
+
} catch {
|
|
1836
|
+
return null;
|
|
1837
|
+
}
|
|
1838
|
+
}
|
|
1839
|
+
function wo(e2, { feature: t2, action: n2, level: r2 = `error`, contexts: i2 }) {
|
|
1840
|
+
let a2 = Co(`captureException`);
|
|
1841
|
+
if (!a2) return;
|
|
1842
|
+
let o2 = e2 instanceof Error ? e2 : Error(String(e2));
|
|
1843
|
+
a2.captureException(o2, { level: r2, tags: { feature: t2, action: n2 }, ...i2 ? { contexts: i2 } : {} });
|
|
1844
|
+
}
|
|
1845
|
+
var To = (e2) => {
|
|
1846
|
+
let t2 = (e3) => e3 < 10 ? `0${e3}` : `${e3}`;
|
|
1847
|
+
return `${e2.getFullYear()}-${t2(e2.getMonth() + 1)}-${t2(e2.getDate())}`;
|
|
1848
|
+
};
|
|
1849
|
+
var $ = (e2) => /* @__PURE__ */ new Date(`${e2}T00:00:00`);
|
|
1850
|
+
var Eo = (e2, t2) => new Intl.DateTimeFormat(`en-CA`, { year: `numeric`, month: `2-digit`, day: `2-digit`, ...t2 ? { timeZone: t2 } : {} }).format(e2);
|
|
1851
|
+
var Do = (e2) => `${To(e2)}T00:00:00`;
|
|
1852
|
+
var Oo = (e2) => `${To(e2)}T23:59:59`;
|
|
1853
|
+
function ko(e2, t2) {
|
|
1854
|
+
return `${Eo(e2, t2)}T${new Intl.DateTimeFormat(`en-GB`, { timeZone: t2, hourCycle: `h23`, hour: `2-digit`, minute: `2-digit`, second: `2-digit` }).format(e2)}`;
|
|
1855
|
+
}
|
|
1856
|
+
var Ao = /^\d{4}-\d{2}-\d{2}$/;
|
|
1857
|
+
var jo = 864e5;
|
|
1858
|
+
function Mo(e2) {
|
|
1859
|
+
if (typeof e2 != `string` || !Ao.test(e2)) return false;
|
|
1860
|
+
let t2 = $(e2);
|
|
1861
|
+
return !Number.isNaN(t2.getTime()) && To(t2) === e2;
|
|
1862
|
+
}
|
|
1863
|
+
function No(e2) {
|
|
1864
|
+
if (!e2 || typeof e2 != `object`) return false;
|
|
1865
|
+
let { startDate: t2, endDate: n2 } = e2;
|
|
1866
|
+
return Mo(t2) && Mo(n2) && t2 <= n2;
|
|
1867
|
+
}
|
|
1868
|
+
function Po(e2, t2) {
|
|
1869
|
+
let n2 = $(e2);
|
|
1870
|
+
return n2.setDate(n2.getDate() + t2), To(n2);
|
|
1871
|
+
}
|
|
1872
|
+
function Fo({ startDate: e2, endDate: t2 }) {
|
|
1873
|
+
let n2 = $(t2).getTime() - $(e2).getTime();
|
|
1874
|
+
return Math.round(n2 / jo) + 1;
|
|
1875
|
+
}
|
|
1876
|
+
function Io(e2) {
|
|
1877
|
+
let t2 = $(e2), n2 = new Date(t2.getFullYear(), t2.getMonth(), 1), r2 = new Date(t2.getFullYear(), t2.getMonth() + 1, 0);
|
|
1878
|
+
return { startDate: To(n2), endDate: To(r2) };
|
|
1879
|
+
}
|
|
1880
|
+
function Lo(e2) {
|
|
1881
|
+
let t2 = Io(e2.startDate);
|
|
1882
|
+
return t2.startDate === e2.startDate && t2.endDate === e2.endDate;
|
|
1883
|
+
}
|
|
1884
|
+
function Ro(e2, t2) {
|
|
1885
|
+
if (Lo(e2)) {
|
|
1886
|
+
let n3 = $(e2.startDate);
|
|
1887
|
+
return Io(To(new Date(n3.getFullYear(), n3.getMonth() + t2, 1)));
|
|
1888
|
+
}
|
|
1889
|
+
let n2 = t2 * Fo(e2);
|
|
1890
|
+
return { startDate: Po(e2.startDate, n2), endDate: Po(e2.endDate, n2) };
|
|
1891
|
+
}
|
|
1892
|
+
function zo(e2, t2) {
|
|
1893
|
+
return e2 >= t2.startDate && e2 <= t2.endDate;
|
|
1894
|
+
}
|
|
1895
|
+
function Bo(e2) {
|
|
1896
|
+
let t2 = $(e2), n2 = new Date(t2.getFullYear(), t2.getMonth() + 2, 0).getDate(), r2 = Math.min(t2.getDate(), n2);
|
|
1897
|
+
return To(new Date(t2.getFullYear(), t2.getMonth() + 1, r2));
|
|
1898
|
+
}
|
|
1899
|
+
function Vo(e2) {
|
|
1900
|
+
let t2 = [], n2 = e2.startDate;
|
|
1901
|
+
for (; n2 <= e2.endDate; ) {
|
|
1902
|
+
let r2 = Po(Bo(n2), -1), i2 = r2 < e2.endDate ? r2 : e2.endDate;
|
|
1903
|
+
t2.push({ startDate: n2, endDate: i2 }), n2 = Po(i2, 1);
|
|
1904
|
+
}
|
|
1905
|
+
return t2;
|
|
1906
|
+
}
|
|
1907
|
+
function Ho({ allowGenderSelection: e2, staffSelectionStrategy: t2 }) {
|
|
1908
|
+
return e2 && t2 !== `CUSTOMER_CANNOT_CHOOSE`;
|
|
1909
|
+
}
|
|
1910
|
+
async function Uo() {
|
|
1911
|
+
let e2 = await Ia(Hr);
|
|
1912
|
+
return { businessTimeZone: e2.timeSlotsConfiguration?.displayTimeZone?.timeZone || null, staffSelectionStrategy: e2.timeSlotsConfiguration?.staffSelection?.strategy ?? null, allowGenderSelection: e2.timeSlotsConfiguration?.staffSelection?.allowGenderSelection ?? false };
|
|
1913
|
+
}
|
|
1914
|
+
function Wo(e2) {
|
|
1915
|
+
let t2 = e2.location?._id || (e2.location?.locationType ? `${e2.location.locationType}:${e2.location.formattedAddress ?? ``}` : ``);
|
|
1916
|
+
return `${e2.localStartDate ?? ``}|${e2.localEndDate ?? ``}|${t2}`;
|
|
1917
|
+
}
|
|
1918
|
+
function Go(e2) {
|
|
1919
|
+
return e2.availableResources?.[0]?.resources?.[0]?._id ?? null;
|
|
1920
|
+
}
|
|
1921
|
+
function Ko(e2) {
|
|
1922
|
+
return `${Wo(e2)}|${Go(e2) ?? ``}`;
|
|
1923
|
+
}
|
|
1924
|
+
function qo(e2) {
|
|
1925
|
+
let t2 = /* @__PURE__ */ new Map();
|
|
1926
|
+
for (let n2 of e2) {
|
|
1927
|
+
let e3 = Wo(n2), r2 = t2.get(e3);
|
|
1928
|
+
r2 ? r2.push(n2) : t2.set(e3, [n2]);
|
|
1929
|
+
}
|
|
1930
|
+
return [...t2.values()].map((e3) => {
|
|
1931
|
+
if (e3.length === 1) return e3[0];
|
|
1932
|
+
let t3 = e3.filter((e4) => e4.bookable), n2 = t3.length ? t3 : e3;
|
|
1933
|
+
return { ...n2[0], availableResources: n2.flatMap((e4) => e4.availableResources ?? []) };
|
|
1934
|
+
});
|
|
1935
|
+
}
|
|
1936
|
+
function Jo(e2) {
|
|
1937
|
+
return e2 ? { locations: [{ _id: e2, locationType: `BUSINESS` }] } : {};
|
|
1938
|
+
}
|
|
1939
|
+
function Yo(e2) {
|
|
1940
|
+
return e2 ? { resourceTypes: [{ resourceTypeId: Gr, resourceIds: [e2] }] } : {};
|
|
1941
|
+
}
|
|
1942
|
+
function Xo(e2) {
|
|
1943
|
+
let { requestedGender: t2, ...n2 } = e2;
|
|
1944
|
+
return Object.keys(n2).length ? n2 : void 0;
|
|
1945
|
+
}
|
|
1946
|
+
function Zo(e2, t2) {
|
|
1947
|
+
if (!e2) return {};
|
|
1948
|
+
let n2 = t2 ? Xo(e2) : e2;
|
|
1949
|
+
return n2 ? { customerChoices: n2 } : {};
|
|
1950
|
+
}
|
|
1951
|
+
var Qo = `REQUESTED_GENDER_NOT_ALLOWED`;
|
|
1952
|
+
function $o(e2) {
|
|
1953
|
+
return mo(e2) === Qo;
|
|
1954
|
+
}
|
|
1955
|
+
var es = false;
|
|
1956
|
+
var ts = /* @__PURE__ */ new Set();
|
|
1957
|
+
function ns() {
|
|
1958
|
+
return es;
|
|
1959
|
+
}
|
|
1960
|
+
function rs(e2) {
|
|
1961
|
+
return ts.add(e2), () => ts.delete(e2);
|
|
1962
|
+
}
|
|
1963
|
+
function is() {
|
|
1964
|
+
es || (es = true, ts.forEach((e2) => e2()));
|
|
1965
|
+
}
|
|
1966
|
+
async function as(e2) {
|
|
1967
|
+
let { customerChoices: t2, ...n2 } = e2, r2 = (e3) => {
|
|
1968
|
+
let t3 = Xo(e3);
|
|
1969
|
+
return ua({ ...n2, ...t3 ? { customerChoices: t3 } : {} });
|
|
1970
|
+
};
|
|
1971
|
+
if (es && t2?.requestedGender) return r2(t2);
|
|
1972
|
+
try {
|
|
1973
|
+
return await ua(e2);
|
|
1974
|
+
} catch (e3) {
|
|
1975
|
+
if (!t2?.requestedGender || !$o(e3)) throw e3;
|
|
1976
|
+
return wo(e3, { feature: So.timeSlots, action: `requested-gender-rejected`, level: `warning` }), is(), r2(t2);
|
|
1977
|
+
}
|
|
1978
|
+
}
|
|
1979
|
+
function os(e2, t2, n2) {
|
|
1980
|
+
return { ...e2 ? { "location.id": e2 } : {}, ...t2 ? { "resources.id": { $hasSome: [t2] } } : {}, ...n2 ? { remainingCapacity: { $gte: n2 } } : {} };
|
|
1981
|
+
}
|
|
1982
|
+
async function ss(e2) {
|
|
1983
|
+
let t2 = await va(e2);
|
|
1984
|
+
return { timeSlots: t2.timeSlots ?? [], timeZone: t2.timeZone ?? null, nextCursor: t2.pagingMetadata?.cursors?.next || null };
|
|
1985
|
+
}
|
|
1986
|
+
function cs({ serviceId: e2, serviceType: t2, fromLocalDate: n2, toLocalDate: r2, timeZone: i2, locationId: a2, staffId: o2, onlyAvailableSlots: s2 = false, customerChoices: c2, minRemainingCapacity: l2, timeSlotsPerDay: u2, limit: d2, cursor: f2 }) {
|
|
1987
|
+
return Ya(t2) ? ls({ serviceId: e2, fromLocalDate: n2, toLocalDate: r2, timeZone: i2, locationId: a2, staffId: o2, onlyAvailableSlots: s2, customerChoices: c2, timeSlotsPerDay: u2, limit: d2, cursor: f2 }) : ss({ serviceIds: [e2], fromLocalDate: n2, ...r2 ? { toLocalDate: r2 } : {}, ...i2 ? { timeZone: i2 } : {}, includeNonBookable: !s2, eventFilter: { type: t2, ...os(a2, o2, l2) }, cursorPaging: { limit: d2, ...f2 ? { cursor: f2 } : {} } });
|
|
1988
|
+
}
|
|
1989
|
+
async function ls({ serviceId: e2, fromLocalDate: t2, toLocalDate: n2, timeZone: r2, locationId: i2, staffId: a2, onlyAvailableSlots: o2, customerChoices: s2, timeSlotsPerDay: c2, limit: l2, cursor: u2 }) {
|
|
1990
|
+
let d2 = await as({ serviceId: e2, fromLocalDate: t2, ...n2 ? { toLocalDate: n2 } : {}, ...r2 ? { timeZone: r2 } : {}, ...o2 ? { bookable: true } : {}, ...Jo(i2), ...Yo(a2), ...Zo(s2, a2), includeResourceTypeIds: [Gr], ...c2 == null ? {} : { timeSlotsPerDay: c2 }, cursorPaging: { limit: l2, ...u2 ? { cursor: u2 } : {} } });
|
|
1991
|
+
return { timeSlots: d2.timeSlots ?? [], timeZone: d2.timeZone ?? null, nextCursor: d2.cursorPagingMetadata?.cursors?.next || null };
|
|
1992
|
+
}
|
|
1993
|
+
var us = 6;
|
|
1994
|
+
var ds = 864e5;
|
|
1995
|
+
function fs(e2) {
|
|
1996
|
+
let t2 = e2 ? $(e2) : new Date(Date.now()), n2 = new Date(t2.getFullYear(), t2.getMonth() + us + 1, 1), r2 = new Date(n2.getTime() - ds);
|
|
1997
|
+
return { fromLocalDate: Do(t2), toLocalDate: Oo(r2) };
|
|
1998
|
+
}
|
|
1999
|
+
async function ps({ serviceId: e2, serviceType: t2, timeZone: n2, limit: r2, onlyAvailableSlots: i2 = true, fromDate: a2, locationId: o2, staffId: s2, customerChoices: c2, minRemainingCapacity: l2 }) {
|
|
2000
|
+
let { fromLocalDate: u2, toLocalDate: d2 } = fs(a2);
|
|
2001
|
+
if (Xa(t2) || Za(t2)) {
|
|
2002
|
+
let a3 = { ...Za(t2) ? { type: `COURSE` } : {}, ...os(o2, s2, l2) }, c3 = await ss({ serviceIds: [e2], fromLocalDate: u2, toLocalDate: d2, ...n2 ? { timeZone: n2 } : {}, includeNonBookable: !i2, ...Object.keys(a3).length ? { eventFilter: a3 } : {}, ...r2 == null ? {} : { cursorPaging: { limit: r2 } } });
|
|
2003
|
+
return { timeSlots: c3.timeSlots, timeZone: c3.timeZone };
|
|
2004
|
+
}
|
|
2005
|
+
let f2 = await as({ serviceId: e2, fromLocalDate: u2, toLocalDate: d2, ...n2 ? { timeZone: n2 } : {}, ...i2 ? { bookable: true } : {}, ...Jo(o2), ...Yo(s2), ...Zo(c2, s2), includeResourceTypeIds: [Gr], ...r2 == null ? {} : { cursorPaging: { limit: r2 } } });
|
|
2006
|
+
return { timeSlots: f2.timeSlots ?? [], timeZone: f2.timeZone ?? null };
|
|
2007
|
+
}
|
|
2008
|
+
var ms = 1e3;
|
|
2009
|
+
async function hs({ serviceId: e2, serviceType: t2, date: n2, timeZone: r2, onlyAvailableSlots: i2, locationId: a2, staffId: o2, customerChoices: s2, minRemainingCapacity: c2, fromLocalDate: l2, toLocalDate: u2 }) {
|
|
2010
|
+
let d2 = `${n2}T00:00:00`, f2 = `${n2}T23:59:59`, p2 = Za(t2) ? `COURSE` : Xa(t2) ? `CLASS` : `APPOINTMENT`, m2 = [], h2 = null, g2;
|
|
2011
|
+
do {
|
|
2012
|
+
let t3 = await cs({ serviceId: e2, serviceType: p2, fromLocalDate: l2 && l2 > d2 ? l2 : d2, toLocalDate: u2 && u2 < f2 ? u2 : f2, timeZone: r2, locationId: a2, staffId: o2, onlyAvailableSlots: i2, customerChoices: s2, minRemainingCapacity: c2, limit: ms, cursor: g2 });
|
|
2013
|
+
m2.push(...t3.timeSlots), h2 = t3.timeZone ?? h2, g2 = t3.nextCursor ?? void 0;
|
|
2014
|
+
} while (g2);
|
|
2015
|
+
return { timeSlots: m2, timeZone: h2 };
|
|
2016
|
+
}
|
|
2017
|
+
function gs(e2) {
|
|
2018
|
+
return { slotStart: e2.localStartDate, slotEnd: e2.localEndDate, eventId: e2.eventInfo?.eventId, scheduleId: e2.scheduleId ?? void 0, locationId: e2.location?._id ?? void 0, locationType: e2.location?.locationType ?? void 0 };
|
|
2019
|
+
}
|
|
2020
|
+
function _s(e2) {
|
|
2021
|
+
return e2?.options?.values?.[0]?.type === Da.STAFF_MEMBER;
|
|
2022
|
+
}
|
|
2023
|
+
function vs(e2) {
|
|
2024
|
+
let t2 = e2;
|
|
2025
|
+
if (t2.__state || (t2.__state = { status: `pending` }, t2.then((e3) => {
|
|
2026
|
+
t2.__state = { status: `fulfilled`, value: e3 };
|
|
2027
|
+
}, (e3) => {
|
|
2028
|
+
t2.__state = { status: `rejected`, reason: e3 };
|
|
2029
|
+
})), t2.__state.status === `fulfilled`) return t2.__state.value;
|
|
2030
|
+
throw t2.__state.status === `rejected` ? t2.__state.reason : t2;
|
|
2031
|
+
}
|
|
2032
|
+
function ys(e2) {
|
|
2033
|
+
let t2 = Promise.resolve(e2);
|
|
2034
|
+
return t2.__state = { status: `fulfilled`, value: e2 }, t2;
|
|
2035
|
+
}
|
|
2036
|
+
function bs(e2) {
|
|
2037
|
+
return e2;
|
|
2038
|
+
}
|
|
2039
|
+
var xs = bs(`@wix/site-service-warmup-data`);
|
|
2040
|
+
function Ss() {
|
|
2041
|
+
try {
|
|
2042
|
+
return d();
|
|
2043
|
+
} catch {
|
|
2044
|
+
return null;
|
|
2045
|
+
}
|
|
2046
|
+
}
|
|
2047
|
+
function Cs(e2) {
|
|
2048
|
+
try {
|
|
2049
|
+
return e2 ? e2(xs) : null;
|
|
2050
|
+
} catch {
|
|
2051
|
+
return null;
|
|
2052
|
+
}
|
|
2053
|
+
}
|
|
2054
|
+
function ws() {
|
|
2055
|
+
let e2 = Cs(Ss()), t2 = typeof window > `u`;
|
|
2056
|
+
return { scope: e2 ?? void 0, get: async (n2) => {
|
|
2057
|
+
if (t2 || !e2) return null;
|
|
2058
|
+
try {
|
|
2059
|
+
return await e2.get(n2);
|
|
2060
|
+
} catch (e3) {
|
|
2061
|
+
return wo(e3, { feature: So.warmup, action: `read`, level: `warning`, contexts: { warmup: { key: n2 } } }), null;
|
|
2062
|
+
}
|
|
2063
|
+
}, set: (n2, r2) => {
|
|
2064
|
+
if (t2 && e2) try {
|
|
2065
|
+
e2.set(n2, r2);
|
|
2066
|
+
} catch {
|
|
2067
|
+
}
|
|
2068
|
+
} };
|
|
2069
|
+
}
|
|
2070
|
+
var Ts = `bookings-uou`;
|
|
2071
|
+
function Es() {
|
|
2072
|
+
return `${Ts}:bookings-settings`;
|
|
2073
|
+
}
|
|
2074
|
+
function Ds() {
|
|
2075
|
+
return `${Ts}:time-slots-configuration`;
|
|
2076
|
+
}
|
|
2077
|
+
var Os = 5e3;
|
|
2078
|
+
var ks = 100;
|
|
2079
|
+
var As = `wix-warmup-data`;
|
|
2080
|
+
var js = null;
|
|
2081
|
+
function Ms(e2) {
|
|
2082
|
+
if (typeof document < `u`) try {
|
|
2083
|
+
let t2 = document.getElementById(As)?.textContent;
|
|
2084
|
+
return t2 ? (js?.text !== t2 && (js = { text: t2, data: JSON.parse(t2).builderComponentsWarmupData ?? {} }), js.data[e2] ?? void 0) : void 0;
|
|
2085
|
+
} catch {
|
|
2086
|
+
return;
|
|
2087
|
+
}
|
|
2088
|
+
}
|
|
2089
|
+
var Ns = () => ({ promises: /* @__PURE__ */ new Map(), invalidatedWarmup: /* @__PURE__ */ new Set() });
|
|
2090
|
+
var Ps = Ns();
|
|
2091
|
+
var Fs = /* @__PURE__ */ new WeakMap();
|
|
2092
|
+
var Is = /* @__PURE__ */ new WeakMap();
|
|
2093
|
+
function Ls(e2) {
|
|
2094
|
+
if (!e2) return Ps;
|
|
2095
|
+
let t2 = Fs.get(e2);
|
|
2096
|
+
return t2 || (t2 = Ns(), Fs.set(e2, t2)), t2;
|
|
2097
|
+
}
|
|
2098
|
+
function Rs({ key: e2, warmupData: t2, fetchData: n2, refresh: r2 = false }) {
|
|
2099
|
+
if (e2 === null) return n2();
|
|
2100
|
+
if (typeof window > `u`) {
|
|
2101
|
+
let r3 = () => n2().then((n3) => (t2.set(e2, n3), n3)), { scope: i3 } = t2;
|
|
2102
|
+
if (!i3) return r3();
|
|
2103
|
+
let a3 = Is.get(i3);
|
|
2104
|
+
a3 || (a3 = /* @__PURE__ */ new Map(), Is.set(i3, a3));
|
|
2105
|
+
let o3 = a3.get(e2);
|
|
2106
|
+
if (o3) return o3;
|
|
2107
|
+
let s3 = r3();
|
|
2108
|
+
return a3.set(e2, s3), s3.catch(() => a3.delete(e2)), s3;
|
|
2109
|
+
}
|
|
2110
|
+
let i2 = Ls(t2.scope), a2 = Date.now();
|
|
2111
|
+
for (let [e3, t3] of i2.promises) t3.expiresAt <= a2 && i2.promises.delete(e3);
|
|
2112
|
+
let o2 = i2.promises.get(e2);
|
|
2113
|
+
if (o2 && !r2) return o2.promise;
|
|
2114
|
+
r2 && i2.invalidatedWarmup.add(e2);
|
|
2115
|
+
let s2 = !i2.invalidatedWarmup.has(e2);
|
|
2116
|
+
if (s2) {
|
|
2117
|
+
let t3 = Ms(e2);
|
|
2118
|
+
if (t3 !== void 0) {
|
|
2119
|
+
let n3 = ys(t3);
|
|
2120
|
+
return i2.promises.set(e2, { promise: n3, expiresAt: a2 + Os }), n3;
|
|
2121
|
+
}
|
|
2122
|
+
}
|
|
2123
|
+
let c2 = (async () => {
|
|
2124
|
+
if (s2) {
|
|
2125
|
+
let n3 = await t2.get(e2);
|
|
2126
|
+
if (n3 != null) return n3;
|
|
2127
|
+
}
|
|
2128
|
+
return n2();
|
|
2129
|
+
})();
|
|
2130
|
+
i2.promises.size >= ks && i2.promises.delete(i2.promises.keys().next().value);
|
|
2131
|
+
let l2 = { promise: c2, expiresAt: 1 / 0 };
|
|
2132
|
+
return i2.promises.set(e2, l2), c2.then(() => {
|
|
2133
|
+
l2.expiresAt = Date.now() + Os;
|
|
2134
|
+
}, () => {
|
|
2135
|
+
i2.promises.get(e2) === l2 && i2.promises.delete(e2);
|
|
2136
|
+
}), c2;
|
|
2137
|
+
}
|
|
2138
|
+
var zs = { displayTimeZonePolicy: { basedOn: Ha.BUSINESS_TIME_ZONE, customerCanChange: false }, multiServiceAppointmentsEnabled: false };
|
|
2139
|
+
async function Bs() {
|
|
2140
|
+
try {
|
|
2141
|
+
let e2 = await Ga();
|
|
2142
|
+
return { displayTimeZonePolicy: { basedOn: e2.displayTimeZone?.basedOn ?? Ha.BUSINESS_TIME_ZONE, customerCanChange: e2.displayTimeZone?.customerCanChange ?? false }, multiServiceAppointmentsEnabled: e2.multiServiceAppointments?.enabled ?? false };
|
|
2143
|
+
} catch (e2) {
|
|
2144
|
+
return wo(e2, { feature: So.bookingsSettings, action: `fetch-bookings-settings`, level: `warning` }), zs;
|
|
2145
|
+
}
|
|
2146
|
+
}
|
|
2147
|
+
var Vs = { isLoading: true };
|
|
2148
|
+
var Hs = n(null);
|
|
2149
|
+
var Us = `useBookingsSettingsContext must be used within BookingsSettingsProvider`;
|
|
2150
|
+
function Ws() {
|
|
2151
|
+
let e2 = i(Hs);
|
|
2152
|
+
if (!e2) throw Error(Us);
|
|
2153
|
+
return e2;
|
|
2154
|
+
}
|
|
2155
|
+
function Gs(e2) {
|
|
2156
|
+
return e2.basedOn === Ha.CUSTOMER_TIME_ZONE ? Intl.DateTimeFormat().resolvedOptions().timeZone : void 0;
|
|
2157
|
+
}
|
|
2158
|
+
function Ks() {
|
|
2159
|
+
let e2 = Ws();
|
|
2160
|
+
return e2.isLoading ? void 0 : Gs(e2.displayTimeZonePolicy);
|
|
2161
|
+
}
|
|
2162
|
+
function qs({ settingsPromise: e2, children: t2 }) {
|
|
2163
|
+
let n2 = vs(e2), r2 = o(() => ({ isLoading: false, ...n2 }), [n2]);
|
|
2164
|
+
return p(Hs.Provider, { value: r2, children: t2 });
|
|
2165
|
+
}
|
|
2166
|
+
function Js({ bookingsSettings: e2, children: n2 }) {
|
|
2167
|
+
let r2 = ws(), [i2] = c(() => e2 ? null : Rs({ key: Es(), warmupData: r2, fetchData: Bs }));
|
|
2168
|
+
return e2 ? p(Hs.Provider, { value: { isLoading: false, ...e2 }, children: n2 }) : p(t, { fallback: p(Hs.Provider, { value: Vs, children: n2 }), children: p(qs, { settingsPromise: i2, children: n2 }) });
|
|
2169
|
+
}
|
|
2170
|
+
var Ys = 1e3;
|
|
2171
|
+
var Xs = class extends e {
|
|
2172
|
+
state = { hasError: false };
|
|
2173
|
+
static getDerivedStateFromError() {
|
|
2174
|
+
return { hasError: true };
|
|
2175
|
+
}
|
|
2176
|
+
componentDidCatch(e2, t2) {
|
|
2177
|
+
wo(e2, { feature: this.props.feature ?? `service`, action: `render`, contexts: { react: { componentStack: t2.componentStack } } });
|
|
2178
|
+
}
|
|
2179
|
+
render() {
|
|
2180
|
+
return this.state.hasError ? this.props.fallback : this.props.children;
|
|
2181
|
+
}
|
|
2182
|
+
};
|
|
2183
|
+
var Zs = `appSectionParams`;
|
|
2184
|
+
function Qs(e2) {
|
|
2185
|
+
let t2 = e2.searchParams.get(Zs);
|
|
2186
|
+
if (t2 === null) return e2;
|
|
2187
|
+
let n2 = new URL(e2);
|
|
2188
|
+
n2.searchParams.delete(Zs);
|
|
2189
|
+
for (let [e3, r2] of Object.entries($s(t2))) typeof r2 == `string` && !n2.searchParams.has(e3) && n2.searchParams.set(e3, r2);
|
|
2190
|
+
return n2;
|
|
2191
|
+
}
|
|
2192
|
+
function $s(e2) {
|
|
2193
|
+
try {
|
|
2194
|
+
let t2 = JSON.parse(e2);
|
|
2195
|
+
return t2 && typeof t2 == `object` && !Array.isArray(t2) ? t2 : {};
|
|
2196
|
+
} catch {
|
|
2197
|
+
return {};
|
|
2198
|
+
}
|
|
2199
|
+
}
|
|
2200
|
+
var ec = `bookings-uou:url-change`;
|
|
2201
|
+
var tc = (e2) => {
|
|
2202
|
+
let t2 = new URL(e2);
|
|
2203
|
+
return t2.searchParams.sort(), t2.href;
|
|
2204
|
+
};
|
|
2205
|
+
function nc(e2, { disableScrollToTop: t2, skipHistory: n2 } = {}) {
|
|
2206
|
+
let r2 = globalThis.window;
|
|
2207
|
+
if (!r2?.history) return;
|
|
2208
|
+
let i2 = new URL(r2.location.href);
|
|
2209
|
+
if (tc(i2) === tc(e2)) return;
|
|
2210
|
+
let a2 = { scrollY: r2.scrollY };
|
|
2211
|
+
if (n2) r2.history.replaceState(a2, ``, e2.href);
|
|
2212
|
+
else {
|
|
2213
|
+
r2.history.replaceState(a2, ``, i2.href);
|
|
2214
|
+
try {
|
|
2215
|
+
r2.history.pushState(t2 ? a2 : null, ``, e2.href);
|
|
2216
|
+
} catch {
|
|
2217
|
+
return;
|
|
2218
|
+
}
|
|
2219
|
+
}
|
|
2220
|
+
r2.dispatchEvent(new Event(ec));
|
|
2221
|
+
}
|
|
2222
|
+
function rc(e2) {
|
|
2223
|
+
let t2 = globalThis.window;
|
|
2224
|
+
return t2 ? (t2.addEventListener(ec, e2), t2.addEventListener(`popstate`, e2), () => {
|
|
2225
|
+
t2.removeEventListener(ec, e2), t2.removeEventListener(`popstate`, e2);
|
|
2226
|
+
}) : () => {
|
|
2227
|
+
};
|
|
2228
|
+
}
|
|
2229
|
+
var ic = (e2) => {
|
|
2230
|
+
try {
|
|
2231
|
+
return decodeURIComponent(e2);
|
|
2232
|
+
} catch {
|
|
2233
|
+
return e2;
|
|
2234
|
+
}
|
|
2235
|
+
};
|
|
2236
|
+
function ac(e2, t2) {
|
|
2237
|
+
let n2 = t2 ? new URL(t2).pathname : `/`;
|
|
2238
|
+
return `./${ic(new URL(e2).pathname.replace(n2, ``).replace(/^\/|\/$/g, ``))}`;
|
|
2239
|
+
}
|
|
2240
|
+
function oc() {
|
|
2241
|
+
let e2 = f(zr), t2 = r(() => e2.currentUrl, [e2]), n2 = l(rc, t2, t2), i2 = o(() => Qs(new URL(n2)), [n2]), a2 = e2.siteUrl.replace(/\/$/, ``);
|
|
2242
|
+
return { pathname: i2.pathname, search: i2.search, searchParams: i2.searchParams, href: i2.href, getParsedUrl: () => Qs(new URL(e2.currentUrl)), getRelativeUrl: () => ac(e2.currentUrl, a2), getExternalBaseUrl: () => a2, pushUrl: nc };
|
|
2243
|
+
}
|
|
2244
|
+
var sc = Fr(`@wix/viewer-service-business-logger`);
|
|
2245
|
+
function cc(e2) {
|
|
2246
|
+
return { evid: 32, src: 16, endpoint: ``, params: e2 };
|
|
2247
|
+
}
|
|
2248
|
+
function lc(e2) {
|
|
2249
|
+
return { evid: 33, src: 16, endpoint: ``, params: e2 };
|
|
2250
|
+
}
|
|
2251
|
+
function uc(e2) {
|
|
2252
|
+
return { evid: 34, src: 16, endpoint: ``, params: e2 };
|
|
2253
|
+
}
|
|
2254
|
+
var dc = { 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` };
|
|
2255
|
+
Kr.BOOK_ONLINE;
|
|
2256
|
+
var fc = `new_bookings_server`;
|
|
2257
|
+
var pc = { TIMEZONE_PICKER: `timezone_picker`, TIME_PICKER: `time_picker`, BOOKING_DETAILS: `booking_details`, RESCHEDULE_DIALOG: `reschedule_dialog` };
|
|
2258
|
+
var mc = { DROPDOWN: `dropdown`, TIME_SLOT: `time_slot`, EXPAND: `expand`, COLLAPSE: `collapse` };
|
|
2259
|
+
var hc = (e2) => {
|
|
2260
|
+
let t2 = f(sc);
|
|
2261
|
+
return r((n2) => {
|
|
2262
|
+
t2.reportBi({ widget_name: e2, bookingsPlatform: fc, is_over_editor: false, ...n2.params, src: n2.src, evid: n2.evid }, { endpoint: n2.endpoint });
|
|
2263
|
+
}, [t2, e2]);
|
|
2264
|
+
};
|
|
2265
|
+
var gc = (e2, t2 = true) => {
|
|
2266
|
+
let n2 = hc(e2), { getParsedUrl: r2 } = oc(), i2 = s(false);
|
|
2267
|
+
a(() => {
|
|
2268
|
+
t2 && !i2.current && (i2.current = true, n2(cc({ referralInfo: r2().searchParams.get(Qa.referral) ?? void 0 })));
|
|
2269
|
+
}, [t2, n2, r2]);
|
|
2270
|
+
};
|
|
2271
|
+
function _c(e2) {
|
|
2272
|
+
return { evid: 596, src: 16, endpoint: `wixboost-ugc`, params: e2 };
|
|
2273
|
+
}
|
|
2274
|
+
function vc(e2, t2) {
|
|
2275
|
+
let n2 = new Intl.DateTimeFormat(`en-US`, { timeZone: t2, hourCycle: `h23`, year: `numeric`, month: `2-digit`, day: `2-digit`, hour: `2-digit`, minute: `2-digit`, second: `2-digit` }).formatToParts(new Date(e2)), r2 = {};
|
|
2276
|
+
for (let e3 of n2) e3.type !== `literal` && (r2[e3.type] = Number(e3.value));
|
|
2277
|
+
return Date.UTC(r2.year, r2.month - 1, r2.day, r2.hour, r2.minute, r2.second) - e2;
|
|
2278
|
+
}
|
|
2279
|
+
function yc(e2, t2) {
|
|
2280
|
+
let n2 = e2.match(/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2}))?/);
|
|
2281
|
+
if (!n2) return null;
|
|
2282
|
+
let [, r2, i2, a2, o2, s2, c2] = n2, l2 = Date.UTC(Number(r2), Number(i2) - 1, Number(a2), Number(o2), Number(s2), c2 ? Number(c2) : 0);
|
|
2283
|
+
if (Number.isNaN(l2)) return null;
|
|
2284
|
+
try {
|
|
2285
|
+
let e3 = l2 - vc(l2, t2);
|
|
2286
|
+
return new Date(l2 - vc(e3, t2));
|
|
2287
|
+
} catch {
|
|
2288
|
+
return null;
|
|
2289
|
+
}
|
|
2290
|
+
}
|
|
2291
|
+
function bc({ start: e2, end: t2, timeZone: n2, ...r2 }) {
|
|
2292
|
+
let i2 = (e3) => e3 && n2 ? yc(e3, n2)?.getTime() : void 0;
|
|
2293
|
+
return uc({ bookingsServiceId: r2.serviceId, serviceType: r2.serviceType, startTime: i2(e2), endTime: i2(t2), isEligibleForFlowCompletion: r2.isEligibleForFlowCompletion });
|
|
2294
|
+
}
|
|
2295
|
+
function xc({ nextAvailableSlotsCount: e2, isLoading: t2, hasError: n2, children: r2 }) {
|
|
2296
|
+
let i2 = n2 ? `loadFailed` : null, a2 = { selectedDate: null, daysAvailabilityRange: null, daysAvailability: [], daysAvailabilityLoading: false, daysAvailabilityHasError: false, timeSlotsLoading: t2, timeSlotsErrorCode: i2, selectDate: async () => {
|
|
2297
|
+
}, setDaysAvailabilityRange: async () => {
|
|
2298
|
+
}, nextDaysAvailabilityRange: async () => {
|
|
2299
|
+
}, previousDaysAvailabilityRange: async () => {
|
|
2300
|
+
}, goToNextAvailableDate: async () => `cancelled`, canChangeTimeZone: false, isMultiService: false, hasValidSchedulingInput: false, availabilityRequestKey: null, needsServiceChoice: false, isRescheduling: u(true)?.reschedule != null, rescheduleValidUntil: null, staffFilterOptions: [], locationFilterOptions: [], selectedStaffFilter: null, requestedGender: null, genderSelectionAllowed: false, selectedLocationFilter: null, setStaffFilter: () => {
|
|
2301
|
+
}, setLocationFilter: () => {
|
|
2302
|
+
}, isComplete: false, isSelectionValidated: false, timeSlots: [], isLoading: t2, hasError: n2, errorCode: i2, businessTimeZone: null, setTimeZone: () => {
|
|
2303
|
+
}, currentTimeSlotsPage: 1, hasNextTimeSlotsPage: false, hasPreviousTimeSlotsPage: false, nextTimeSlotsPage: async () => {
|
|
2304
|
+
}, loadUpcomingTimeSlots: async () => {
|
|
2305
|
+
}, upcomingTimeSlotsRequested: false, previousTimeSlotsPage: () => {
|
|
2306
|
+
}, nextAvailableSlotsCount: e2, timeZone: null, staffFromSlots: [], selectedResourceId: null, setSelectedResource: () => {
|
|
2307
|
+
}, canAutoAssignStaff: false, selectedTimeSlot: null, selectTimeSlot: () => {
|
|
2308
|
+
}, navigateToBookingForm: () => {
|
|
2309
|
+
}, timeSlotLimitPerDay: null, expandedDates: /* @__PURE__ */ new Set(), daysWithMore: /* @__PURE__ */ new Set(), loadingDate: null, loadAllTimeSlotsForDay: async () => {
|
|
2310
|
+
} };
|
|
2311
|
+
return p(xl.Provider, { value: a2, children: r2 });
|
|
2312
|
+
}
|
|
2313
|
+
function Sc({ nextAvailableSlotsCount: e2, children: t2 }) {
|
|
2314
|
+
return p(xc, { nextAvailableSlotsCount: e2, isLoading: true, hasError: false, children: t2 });
|
|
2315
|
+
}
|
|
2316
|
+
function Cc({ nextAvailableSlotsCount: e2, children: t2 }) {
|
|
2317
|
+
return p(xc, { nextAvailableSlotsCount: e2, isLoading: false, hasError: true, children: t2 });
|
|
2318
|
+
}
|
|
2319
|
+
var wc = 1e3;
|
|
2320
|
+
function Tc(e2, t2) {
|
|
2321
|
+
let n2 = /* @__PURE__ */ new Map();
|
|
2322
|
+
for (let e3 of t2) {
|
|
2323
|
+
let t3 = e3.localStartDate?.slice(0, 10);
|
|
2324
|
+
t3 && (e3.bookable ? n2.set(t3, `available`) : n2.has(t3) || n2.set(t3, `unavailable`));
|
|
2325
|
+
}
|
|
2326
|
+
let r2 = [], i2 = Fo(e2);
|
|
2327
|
+
for (let t3 = 0; t3 < i2; t3 += 1) {
|
|
2328
|
+
let i3 = Po(e2.startDate, t3);
|
|
2329
|
+
r2.push({ date: i3, availability: n2.get(i3) ?? `none` });
|
|
2330
|
+
}
|
|
2331
|
+
return r2;
|
|
2332
|
+
}
|
|
2333
|
+
function Ec(e2) {
|
|
2334
|
+
return { fromLocalDate: Do($(e2.startDate)), toLocalDate: Oo($(e2.endDate)) };
|
|
2335
|
+
}
|
|
2336
|
+
async function Dc(e2, t2, n2, r2, i2, a2) {
|
|
2337
|
+
return (await as({ serviceId: e2, ...Ec(n2), timeZone: t2, ...Jo(r2), ...Yo(i2), ...Zo(a2, i2), timeSlotsPerDay: 1, cursorPaging: { limit: Math.min(Fo(n2), wc) } })).timeSlots ?? [];
|
|
2338
|
+
}
|
|
2339
|
+
async function Oc(e2, t2, n2, r2, i2, a2) {
|
|
2340
|
+
return (await ss({ serviceIds: [e2], ...Ec(n2), timeZone: t2, includeNonBookable: true, eventFilter: { type: `CLASS`, ...os(r2, i2, a2) }, maxSlotsPerDay: 1, cursorPaging: { limit: Math.min(Fo(n2), wc) } })).timeSlots;
|
|
2341
|
+
}
|
|
2342
|
+
async function kc({ serviceId: e2, serviceType: t2, range: n2, fromDate: r2, timeZone: i2, locationId: a2, staffId: o2, customerChoices: s2, minRemainingCapacity: c2 }) {
|
|
2343
|
+
if (Za(t2) || n2.endDate < r2) return Tc(n2, []);
|
|
2344
|
+
let l2 = { startDate: n2.startDate < r2 ? r2 : n2.startDate, endDate: n2.endDate }, u2 = Xa(t2) ? Vo(l2) : [l2];
|
|
2345
|
+
return Tc(n2, (await Promise.all(u2.map((n3) => Xa(t2) ? Oc(e2, i2, n3, a2, o2, c2) : Dc(e2, i2, n3, a2, o2, s2)))).flat());
|
|
2346
|
+
}
|
|
2347
|
+
function Ac({ serviceId: e2, staff: t2, customerChoices: n2 }) {
|
|
2348
|
+
let r2 = t2 && !t2.anyResource ? t2.staffMemberId : void 0;
|
|
2349
|
+
return { serviceId: e2, ...Zo(n2, r2), ...t2?.anyResource ? {} : { includeResourceTypeIds: [Gr] }, ...r2 ? { resourceTypes: [{ resourceTypeId: Gr, resourceIds: [r2] }] } : {} };
|
|
2350
|
+
}
|
|
2351
|
+
function jc({ services: e2, locationId: t2, locationType: n2, timeZone: r2 }) {
|
|
2352
|
+
return { services: e2.map(Ac), timeZone: r2, location: { ...t2 ? { _id: t2 } : {}, locationType: n2 } };
|
|
2353
|
+
}
|
|
2354
|
+
function Mc(e2) {
|
|
2355
|
+
let { customerChoices: t2, ...n2 } = e2, r2 = t2 ? Xo(t2) : void 0;
|
|
2356
|
+
return r2 ? { ...n2, customerChoices: r2 } : n2;
|
|
2357
|
+
}
|
|
2358
|
+
async function Nc(e2) {
|
|
2359
|
+
let t2 = e2.services ?? [], n2 = () => Ea({ ...e2, services: t2.map(Mc) }), r2 = t2.some((e3) => e3.customerChoices?.requestedGender);
|
|
2360
|
+
if (r2 && ns()) return n2();
|
|
2361
|
+
try {
|
|
2362
|
+
return await Ea(e2);
|
|
2363
|
+
} catch (e3) {
|
|
2364
|
+
if (!r2 || !$o(e3)) throw e3;
|
|
2365
|
+
return wo(e3, { feature: So.timeSlots, action: `requested-gender-rejected`, level: `warning` }), is(), n2();
|
|
2366
|
+
}
|
|
2367
|
+
}
|
|
2368
|
+
var Pc = 1e3;
|
|
2369
|
+
async function Fc({ range: e2, fromDate: t2, ...n2 }) {
|
|
2370
|
+
if (e2.endDate < t2) return Tc(e2, []);
|
|
2371
|
+
let r2 = { startDate: e2.startDate < t2 ? t2 : e2.startDate, endDate: e2.endDate };
|
|
2372
|
+
return Tc(e2, (await Nc({ ...jc(n2), fromLocalDate: Do($(r2.startDate)), toLocalDate: Oo($(r2.endDate)), timeSlotsPerDay: 1, cursorPaging: { limit: Math.min(Fo(r2), Pc) } })).timeSlots ?? []);
|
|
2373
|
+
}
|
|
2374
|
+
async function Ic({ date: e2, onlyAvailableSlots: t2, fromLocalDate: n2, ...r2 }) {
|
|
2375
|
+
let i2 = `${e2}T00:00:00`, a2 = [], o2 = null, s2;
|
|
2376
|
+
do {
|
|
2377
|
+
let c2 = await Nc({ ...jc(r2), fromLocalDate: n2 && n2 > i2 ? n2 : i2, toLocalDate: `${e2}T23:59:59`, ...t2 ? { bookable: true } : {}, cursorPaging: { limit: Pc, ...s2 ? { cursor: s2 } : {} } });
|
|
2378
|
+
a2.push(...c2.timeSlots ?? []), o2 = c2.timeZone ?? o2, s2 = c2.cursorPagingMetadata?.cursors?.next || void 0;
|
|
2379
|
+
} while (s2);
|
|
2380
|
+
return { timeSlots: a2, timeZone: o2 };
|
|
2381
|
+
}
|
|
2382
|
+
async function Lc({ fromDate: e2, ...t2 }) {
|
|
2383
|
+
let n2 = await Nc({ ...jc(t2), ...fs(e2), bookable: true, cursorPaging: { limit: 1 } });
|
|
2384
|
+
return { timeSlots: n2.timeSlots ?? [], timeZone: n2.timeZone ?? null };
|
|
2385
|
+
}
|
|
2386
|
+
var Rc = [];
|
|
2387
|
+
function zc({ enabled: e2, serviceId: t2, serviceType: n2, multiServiceRequest: i2, timeZone: l2, today: u2, locationId: d2, staffId: f2, loadInitially: p2, customerChoices: m2, minRemainingCapacity: h2, onlyAvailableSlots: g2 }) {
|
|
2388
|
+
let [_2, v2] = c(null), [y2, b2] = c(p2), [x2, S2] = c(Rc), [C2, w2] = c(false), [T2, ee2] = c(false), E2 = s(0);
|
|
2389
|
+
a(() => {
|
|
2390
|
+
_2 === null && u2 && v2(Io(u2));
|
|
2391
|
+
}, [_2, u2]), a(() => {
|
|
2392
|
+
if (!y2 || !e2 || !(t2 || i2) || !l2 || !u2 || !_2 || !i2 && Za(n2)) return;
|
|
2393
|
+
let r2 = ++E2.current;
|
|
2394
|
+
return w2(true), (i2 ? Fc({ ...i2, range: _2, fromDate: u2, timeZone: l2 }) : kc({ serviceId: t2, serviceType: n2, range: _2, fromDate: u2, timeZone: l2, locationId: d2 ?? void 0, staffId: f2 ?? void 0, customerChoices: m2, minRemainingCapacity: h2 })).then((e3) => {
|
|
2395
|
+
r2 === E2.current && (S2(e3), ee2(false), w2(false));
|
|
2396
|
+
}).catch((e3) => {
|
|
2397
|
+
r2 === E2.current && (wo(e3, { feature: So.timeSlots, action: `fetch-days-availability`, level: `warning` }), ee2(true), w2(false));
|
|
2398
|
+
}), () => {
|
|
2399
|
+
r2 === E2.current && (E2.current += 1);
|
|
2400
|
+
};
|
|
2401
|
+
}, [y2, e2, t2, n2, i2, l2, u2, _2, d2, f2, m2, h2]);
|
|
2402
|
+
let D2 = r(async (e3) => {
|
|
2403
|
+
No(e3) && (v2(e3), b2(true));
|
|
2404
|
+
}, []), te2 = r(async () => {
|
|
2405
|
+
v2((e3) => e3 && Ro(e3, 1)), b2(true);
|
|
2406
|
+
}, []), ne2 = r(async () => {
|
|
2407
|
+
v2((e3) => e3 && Ro(e3, -1)), b2(true);
|
|
2408
|
+
}, []);
|
|
2409
|
+
return { range: _2, daysAvailability: o(() => g2 ? x2.map((e3) => e3.availability === `unavailable` ? { ...e3, availability: `none` } : e3) : x2, [x2, g2]), isLoading: C2, hasError: T2, setRange: D2, nextRange: te2, previousRange: ne2 };
|
|
2410
|
+
}
|
|
2411
|
+
function Bc({ enabled: e2, serviceId: t2, serviceType: n2, multiServiceRequest: i2, timeZone: o2, today: l2, locationId: u2, staffId: d2, customerChoices: f2, minRemainingCapacity: p2, onlyAvailableSlots: m2, serviceLoading: h2 }) {
|
|
2412
|
+
let [g2, _2] = c(null), [v2, y2] = c(0), [b2, x2] = c(null), [S2, C2] = c(null), [w2, T2] = c(null), [ee2, E2] = c(false), D2 = s(0), te2 = s(0), ne2 = s(0), O2 = r(() => {
|
|
2413
|
+
te2.current += 1, E2(false);
|
|
2414
|
+
}, []);
|
|
2415
|
+
a(() => {
|
|
2416
|
+
O2();
|
|
2417
|
+
}, [e2, t2, n2, i2, o2, u2, d2, f2, p2, O2]);
|
|
2418
|
+
let k2 = e2 && !h2 && !t2 && !i2;
|
|
2419
|
+
a(() => {
|
|
2420
|
+
k2 && (C2(null), T2(null));
|
|
2421
|
+
}, [k2]), a(() => {
|
|
2422
|
+
if (!g2) return;
|
|
2423
|
+
if (k2) {
|
|
2424
|
+
_2(null);
|
|
2425
|
+
return;
|
|
2426
|
+
}
|
|
2427
|
+
if (!e2 || !(t2 || i2) || !o2) return;
|
|
2428
|
+
if (l2 && g2.date < l2) {
|
|
2429
|
+
_2(null);
|
|
2430
|
+
return;
|
|
2431
|
+
}
|
|
2432
|
+
if (!i2 && Za(n2)) {
|
|
2433
|
+
_2(null);
|
|
2434
|
+
return;
|
|
2435
|
+
}
|
|
2436
|
+
let r2 = ko(new Date(Date.now()), o2), a2 = ++D2.current;
|
|
2437
|
+
x2(null), C2(null), T2(null);
|
|
2438
|
+
let s2 = r2.slice(0, 10) === g2.date ? r2 : void 0;
|
|
2439
|
+
return (i2 ? Ic({ ...i2, date: g2.date, timeZone: o2, onlyAvailableSlots: m2, fromLocalDate: s2 }) : hs({ serviceId: t2, serviceType: n2, date: g2.date, timeZone: o2, onlyAvailableSlots: m2, locationId: u2 ?? void 0, staffId: d2 ?? void 0, customerChoices: f2, minRemainingCapacity: p2, fromLocalDate: s2 })).then((e3) => {
|
|
2440
|
+
a2 === D2.current && x2({ timeSlots: e3.timeSlots, timeZone: e3.timeZone ?? o2 });
|
|
2441
|
+
}).catch((e3) => {
|
|
2442
|
+
a2 === D2.current && (wo(e3, { feature: So.timeSlots, action: `fetch-day-time-slots`, level: `warning` }), C2(`timeSlotsLoadFailed`));
|
|
2443
|
+
}), () => {
|
|
2444
|
+
a2 === D2.current && (D2.current += 1);
|
|
2445
|
+
};
|
|
2446
|
+
}, [g2, v2, e2, t2, h2, n2, i2, o2, l2, u2, d2, f2, p2, m2]);
|
|
2447
|
+
let re2 = r(async (e3) => {
|
|
2448
|
+
!i2 && Za(n2) || !Mo(e3) || l2 && e3 < l2 || (O2(), y2((e4) => e4 + 1), _2({ kind: `day`, date: e3 }));
|
|
2449
|
+
}, [n2, i2, l2, O2]), ie2 = g2?.date ?? null, A2 = r(async () => {
|
|
2450
|
+
let r2 = !!(t2 || i2);
|
|
2451
|
+
if (!i2 && Za(n2) || !e2 || !r2 || !o2) return { outcome: `none` };
|
|
2452
|
+
let a2 = D2.current, s2 = ++te2.current, c2 = ++ne2.current, m3 = () => a2 === D2.current && s2 === te2.current;
|
|
2453
|
+
E2(true), T2(null);
|
|
2454
|
+
try {
|
|
2455
|
+
let e3 = ie2 ?? l2 ?? void 0, r3 = i2 ? await Lc({ ...i2, timeZone: o2, fromDate: e3 }) : await ps({ serviceId: t2, serviceType: n2, timeZone: o2, limit: 1, onlyAvailableSlots: true, fromDate: e3, locationId: u2 ?? void 0, staffId: d2 ?? void 0, customerChoices: f2, minRemainingCapacity: p2 });
|
|
2456
|
+
if (!m3()) return { outcome: `cancelled` };
|
|
2457
|
+
let a3 = r3.timeSlots[0]?.localStartDate?.slice(0, 10) ?? null;
|
|
2458
|
+
return a3 ? { outcome: `found`, date: a3 } : { outcome: `none` };
|
|
2459
|
+
} catch (e3) {
|
|
2460
|
+
return m3() ? (wo(e3, { feature: So.timeSlots, action: `find-next-available-date`, level: `warning` }), T2(`timeSlotsLoadFailed`), { outcome: `error` }) : { outcome: `cancelled` };
|
|
2461
|
+
} finally {
|
|
2462
|
+
c2 === ne2.current && E2(false);
|
|
2463
|
+
}
|
|
2464
|
+
}, [e2, t2, n2, i2, o2, l2, u2, d2, f2, p2, ie2]), ae2 = w2 ?? S2;
|
|
2465
|
+
return { query: g2, selectedDate: ie2, timeSlots: b2?.timeSlots ?? null, timeZone: b2?.timeZone ?? null, isLoading: ee2 || g2 !== null && b2 === null && S2 === null, error: ae2, selectDate: re2, findNextAvailableDate: A2 };
|
|
2466
|
+
}
|
|
2467
|
+
function Vc(e2, t2) {
|
|
2468
|
+
return t2 === void 0 ? false : !e2 || new Date(e2).getTime() <= t2;
|
|
2469
|
+
}
|
|
2470
|
+
function Hc({ serviceId: e2, serviceType: t2, lastSessionEnd: n2, timeZone: r2, now: i2, onlyAvailableSlots: a2, locationId: o2, staffId: s2, timeSlotLimitPerDay: c2, customerChoices: l2, minRemainingCapacity: u2 }) {
|
|
2471
|
+
let d2 = { serviceId: e2, onlyAvailableSlots: a2, locationId: o2 ?? void 0, staffId: s2 ?? void 0, timeZone: r2, fromLocalDate: ko(new Date(i2), r2) };
|
|
2472
|
+
return Xa(t2) ? { ...d2, serviceType: `CLASS`, minRemainingCapacity: u2 } : Za(t2) ? !n2 || Vc(n2, i2) ? void 0 : { ...d2, serviceType: `COURSE`, toLocalDate: ko(new Date(n2), r2) } : { ...d2, serviceType: `APPOINTMENT`, toLocalDate: fs().toLocalDate, timeSlotsPerDay: c2 + 1, customerChoices: l2 };
|
|
2473
|
+
}
|
|
2474
|
+
function Uc({ isAppointment: e2, staffOnSlotCount: t2, hasStaffFilter: n2, hasRequestedGender: r2, hasStaffPricedVariants: i2, staffSelectionStrategy: a2 }) {
|
|
2475
|
+
return e2 && t2 > 1 && !n2 && !i2 && (a2 !== `CUSTOMER_MUST_CHOOSE` || r2);
|
|
2476
|
+
}
|
|
2477
|
+
function Wc(e2, t2) {
|
|
2478
|
+
return e2.length ? e2.length === 1 ? { anyResource: false, staffMemberId: e2[0] } : t2 ? { anyResource: true } : null : null;
|
|
2479
|
+
}
|
|
2480
|
+
function Gc(e2, t2, n2) {
|
|
2481
|
+
return t2 && !t2.anyResource && e2.includes(t2.staffMemberId) ? { isComplete: true, resourceId: t2.staffMemberId } : t2?.anyResource && n2 ? { isComplete: true, resourceId: void 0 } : e2.length <= 1 ? { isComplete: true, resourceId: e2[0] } : { isComplete: n2, resourceId: void 0 };
|
|
2482
|
+
}
|
|
2483
|
+
var Kc = { staff: null, requestedGender: null, locationId: null };
|
|
2484
|
+
function qc({ entry: e2, appointmentLike: t2, staffChoiceHidden: n2, staffPriced: r2, staffSelectionStrategy: i2, genderAllowed: a2, staffMemberIds: o2, locationIds: s2 }) {
|
|
2485
|
+
if (!e2) return Kc;
|
|
2486
|
+
let c2 = e2.locationId && s2.includes(e2.locationId) ? e2.locationId : null, l2 = t2 && !n2 ? io(e2) : null;
|
|
2487
|
+
if (!l2) return { ...Kc, locationId: c2 };
|
|
2488
|
+
if (!l2.anyResource) return o2.includes(l2.staffMemberId) ? { staff: l2, requestedGender: null, locationId: c2 } : { ...Kc, locationId: c2 };
|
|
2489
|
+
let u2 = a2 ? e2.requestedGender ?? null : null;
|
|
2490
|
+
return o2.length > 1 && !r2 && (i2 !== `CUSTOMER_MUST_CHOOSE` || u2 !== null) ? { staff: l2, requestedGender: u2, locationId: c2 } : { ...Kc, locationId: c2 };
|
|
2491
|
+
}
|
|
2492
|
+
var Jc = [];
|
|
2493
|
+
function Yc({ sessions: e2, dayQuery: t2, daySlots: n2, staffFilter: r2, appointmentLike: i2, limitPerDay: a2, expandedDates: o2 }) {
|
|
2494
|
+
let s2 = il(al(e2, r2)), c2 = n2 ? al(i2 ? qo(n2) : n2, r2) : Jc;
|
|
2495
|
+
return { rows: t2 ? c2 : ol(s2, a2, o2), slotIdOf: t2 ? Wo : Ko, daysWithMore: rl(s2, a2, o2) };
|
|
2496
|
+
}
|
|
2497
|
+
function Xc({ rows: e2, slotIdOf: t2 }, n2) {
|
|
2498
|
+
return [...e2.filter((e3) => t2(e3) === n2)].sort((e3, t3) => nl(t3) - nl(e3))[0] ?? null;
|
|
2499
|
+
}
|
|
2500
|
+
function Zc(e2, t2, n2, r2) {
|
|
2501
|
+
return { slotId: n2(e2), slotStartTime: e2.localStartDate ?? null, slotEndTime: e2.localEndDate ?? null, bookable: e2.bookable ?? false, totalCapacity: e2.totalCapacity ?? null, remainingCapacity: e2.remainingCapacity ?? null, bookableCapacity: e2.bookableCapacity ?? null, eventId: e2.eventInfo?.eventId ?? null, eventTitle: e2.eventInfo?.eventTitle ?? null, waitlistCapacity: e2.eventInfo?.waitingList?.remainingCapacity ?? null, locationId: e2.location?._id ?? null, locationName: e2.location?.name || e2.location?.formattedAddress || null, durationMinutes: tl(e2, t2), isAllDay: e2.allDay ?? false, staff: r2 ? [] : Qc(e2) };
|
|
2502
|
+
}
|
|
2503
|
+
function Qc(e2) {
|
|
2504
|
+
let t2 = /* @__PURE__ */ new Map();
|
|
2505
|
+
for (let n2 of e2.availableResources ?? []) if (n2.resourceTypeId === `1cd44cf8-756f-41c3-bd90-3e2ffcaf1155`) for (let e3 of n2.resources ?? []) e3._id && !t2.has(e3._id) && t2.set(e3._id, e3.name ?? ``);
|
|
2506
|
+
return [...t2].map(([e3, t3]) => ({ staffMemberId: e3, name: t3 }));
|
|
2507
|
+
}
|
|
2508
|
+
function $c(e2) {
|
|
2509
|
+
let t2 = Qc(e2);
|
|
2510
|
+
if (t2.length) return t2.length === 1 ? t2[0].staffMemberId : null;
|
|
2511
|
+
}
|
|
2512
|
+
function el(e2) {
|
|
2513
|
+
return Qc(e2).map((e3) => e3.staffMemberId);
|
|
2514
|
+
}
|
|
2515
|
+
function tl(e2, t2) {
|
|
2516
|
+
if (!e2.localStartDate || !e2.localEndDate) return null;
|
|
2517
|
+
let n2 = e2.allDay ? `UTC` : t2 ?? `UTC`, r2 = yc(e2.localStartDate, n2), i2 = yc(e2.localEndDate, n2);
|
|
2518
|
+
return !r2 || !i2 || i2 < r2 ? null : Math.round((i2.getTime() - r2.getTime()) / 6e4);
|
|
2519
|
+
}
|
|
2520
|
+
function nl(e2) {
|
|
2521
|
+
let t2 = e2.bookableCapacity ?? e2.remainingCapacity;
|
|
2522
|
+
return (e2.eventInfo?.waitingList?.remainingCapacity ?? 0) > 0 && (t2 ?? 0) <= 0 ? 1 : e2.bookable ? 2 : 0;
|
|
2523
|
+
}
|
|
2524
|
+
function rl(e2, t2, n2) {
|
|
2525
|
+
let r2 = /* @__PURE__ */ new Map();
|
|
2526
|
+
for (let t3 of e2) {
|
|
2527
|
+
let e3 = (t3.localStartDate ?? ``).slice(0, 10);
|
|
2528
|
+
r2.set(e3, (r2.get(e3) ?? 0) + 1);
|
|
2529
|
+
}
|
|
2530
|
+
return new Set([...r2].filter(([e3, r3]) => r3 > t2 && !n2.has(e3)).map(([e3]) => e3));
|
|
2531
|
+
}
|
|
2532
|
+
function il(e2) {
|
|
2533
|
+
return e2.flatMap((e3) => {
|
|
2534
|
+
let t2 = e3.availableResources?.find((e4) => e4.resourceTypeId === Gr), n2 = t2?.resources ?? [];
|
|
2535
|
+
return n2.length <= 1 ? [e3] : n2.map((n3) => ({ ...e3, availableResources: [{ ...t2, resources: [n3] }] }));
|
|
2536
|
+
});
|
|
2537
|
+
}
|
|
2538
|
+
function al(e2, t2) {
|
|
2539
|
+
return t2 ? e2.map((e3) => ({ ...e3, availableResources: e3.availableResources?.map((e4) => e4.resourceTypeId === `1cd44cf8-756f-41c3-bd90-3e2ffcaf1155` ? { ...e4, resources: e4.resources?.filter((e5) => e5._id === t2) } : e4) })) : e2;
|
|
2540
|
+
}
|
|
2541
|
+
function ol(e2, t2, n2) {
|
|
2542
|
+
let r2 = /* @__PURE__ */ new Map();
|
|
2543
|
+
return e2.filter((e3) => {
|
|
2544
|
+
let i2 = (e3.localStartDate ?? ``).slice(0, 10);
|
|
2545
|
+
if (n2.has(i2)) return true;
|
|
2546
|
+
let a2 = r2.get(i2) ?? 0;
|
|
2547
|
+
return r2.set(i2, a2 + 1), a2 < t2;
|
|
2548
|
+
});
|
|
2549
|
+
}
|
|
2550
|
+
async function sl() {
|
|
2551
|
+
try {
|
|
2552
|
+
return await Uo();
|
|
2553
|
+
} catch (e2) {
|
|
2554
|
+
return wo(e2, { feature: So.timeSlots, action: `fetch-business-time-zone`, level: `warning` }), { businessTimeZone: null, staffSelectionStrategy: void 0, allowGenderSelection: false };
|
|
2555
|
+
}
|
|
2556
|
+
}
|
|
2557
|
+
function cl(e2) {
|
|
2558
|
+
return Rs({ key: Ds(), warmupData: e2, fetchData: sl });
|
|
2559
|
+
}
|
|
2560
|
+
function ll(e2) {
|
|
2561
|
+
return (e2.localStartDate ?? ``).slice(0, 10);
|
|
2562
|
+
}
|
|
2563
|
+
var ul = [];
|
|
2564
|
+
function dl(e2, t2) {
|
|
2565
|
+
let { serviceId: n2 = ``, serviceType: r2 = `CLASS`, fromLocalDate: i2 = ``, toLocalDate: o2, timeZone: l2, locationId: u2, staffId: d2, onlyAvailableSlots: f2 = false, customerChoices: p2, minRemainingCapacity: m2, timeSlotsPerDay: h2 } = t2 ?? {}, [g2, _2] = c([]), [v2, y2] = c([]), [b2, x2] = c(1), [S2, C2] = c(!!n2), [w2, T2] = c(null), [ee2, E2] = c(null), [D2, te2] = c(/* @__PURE__ */ new Set()), [ne2, O2] = c(null), k2 = s(null), re2 = s(null);
|
|
2566
|
+
a(() => {
|
|
2567
|
+
if (_2([]), y2([]), x2(1), E2(null), T2(null), te2(/* @__PURE__ */ new Set()), O2(null), C2(!!n2), !n2) return;
|
|
2568
|
+
let t3 = false, a2 = false, s2 = [], c2 = [];
|
|
2569
|
+
async function g3(g4) {
|
|
2570
|
+
if (t3 || a2) return;
|
|
2571
|
+
if (s2[g4 - 1]) {
|
|
2572
|
+
T2(null), x2(g4);
|
|
2573
|
+
return;
|
|
2574
|
+
}
|
|
2575
|
+
let v4 = g4 === 1 ? void 0 : c2[g4 - 2];
|
|
2576
|
+
if (g4 === 1 || v4) {
|
|
2577
|
+
a2 = true, T2(null), C2(true);
|
|
2578
|
+
try {
|
|
2579
|
+
let a3 = [], b3 = null, S3 = v4 ?? void 0, C3 = /* @__PURE__ */ new Set();
|
|
2580
|
+
do {
|
|
2581
|
+
S3 && C3.add(S3);
|
|
2582
|
+
let s3 = await cs({ serviceId: n2, serviceType: r2, fromLocalDate: i2, toLocalDate: o2, timeZone: l2, locationId: u2, staffId: d2, onlyAvailableSlots: f2, customerChoices: p2, minRemainingCapacity: m2, timeSlotsPerDay: h2, limit: e2, cursor: S3 });
|
|
2583
|
+
if (t3) return;
|
|
2584
|
+
if (a3.push(...s3.timeSlots), b3 = s3.nextCursor, b3 && C3.has(b3)) throw Error(`The session API repeated a page cursor`);
|
|
2585
|
+
S3 = b3 ?? void 0, E2(s3.timeZone ?? l2 ?? null);
|
|
2586
|
+
} while (a3.length === 0 && b3 !== null);
|
|
2587
|
+
s2 = [...s2, a3], c2 = [...c2, b3], _2(s2), y2(c2), (g4 === 1 || a3.length > 0) && x2(g4);
|
|
2588
|
+
} catch (e3) {
|
|
2589
|
+
if (t3) return;
|
|
2590
|
+
wo(e3, { feature: So.sessions, action: `fetch-page` }), T2(e3 instanceof Error ? e3.message : `Failed to load sessions`);
|
|
2591
|
+
} finally {
|
|
2592
|
+
a2 = false, t3 || C2(false);
|
|
2593
|
+
}
|
|
2594
|
+
}
|
|
2595
|
+
}
|
|
2596
|
+
async function v3(e3) {
|
|
2597
|
+
if (!(t3 || a2)) {
|
|
2598
|
+
if (h2 == null) {
|
|
2599
|
+
te2((t4) => /* @__PURE__ */ new Set([...t4, e3]));
|
|
2600
|
+
return;
|
|
2601
|
+
}
|
|
2602
|
+
a2 = true, O2(e3), T2(null);
|
|
2603
|
+
try {
|
|
2604
|
+
let a3 = await hs({ serviceId: n2, serviceType: r2, date: e3, timeZone: l2, onlyAvailableSlots: f2, locationId: u2, staffId: d2, customerChoices: p2, minRemainingCapacity: m2, fromLocalDate: i2, toLocalDate: o2 });
|
|
2605
|
+
if (t3) return;
|
|
2606
|
+
let c3 = a3.timeSlots.filter((t4) => ll(t4) === e3), h3 = Math.max(0, s2.findIndex((t4) => t4.some((t5) => ll(t5) === e3)));
|
|
2607
|
+
s2 = s2.map((t4, n3) => {
|
|
2608
|
+
let r3 = t4.filter((t5) => ll(t5) !== e3);
|
|
2609
|
+
return n3 === h3 ? [...r3, ...c3] : r3;
|
|
2610
|
+
}), _2(s2), te2((t4) => /* @__PURE__ */ new Set([...t4, e3]));
|
|
2611
|
+
} catch (e4) {
|
|
2612
|
+
if (t3) return;
|
|
2613
|
+
wo(e4, { feature: So.sessions, action: `fetch-day` }), T2(e4 instanceof Error ? e4.message : `Failed to load sessions`);
|
|
2614
|
+
} finally {
|
|
2615
|
+
a2 = false, t3 || O2(null);
|
|
2616
|
+
}
|
|
2617
|
+
}
|
|
2618
|
+
}
|
|
2619
|
+
return k2.current = g3, re2.current = v3, g3(1), () => {
|
|
2620
|
+
t3 = true, k2.current = null, re2.current = null;
|
|
2621
|
+
};
|
|
2622
|
+
}, [n2, r2, i2, o2, l2, u2, d2, f2, p2, m2, h2, e2]);
|
|
2623
|
+
let ie2 = [...g2[b2 - 1] ?? ul].sort((e3, t3) => (e3.localStartDate ?? ``).localeCompare(t3.localStartDate ?? ``)), A2 = g2[b2], ae2 = A2 ? A2.length > 0 : v2[b2 - 1] != null, j2 = b2 > 1;
|
|
2624
|
+
async function oe2() {
|
|
2625
|
+
ae2 && !S2 && await k2.current?.(b2 + 1);
|
|
2626
|
+
}
|
|
2627
|
+
function M2() {
|
|
2628
|
+
j2 && !S2 && k2.current?.(b2 - 1);
|
|
2629
|
+
}
|
|
2630
|
+
async function se2(e3) {
|
|
2631
|
+
S2 || ne2 !== null || D2.has(e3) || await re2.current?.(e3);
|
|
2632
|
+
}
|
|
2633
|
+
return { isLoadingPage: S2, firstPageSettled: g2.length > 0 || w2 !== null, error: w2, timeZone: ee2, sessions: ie2, pageSize: e2, currentPage: b2, hasNextPage: ae2, hasPreviousPage: j2, nextPage: oe2, previousPage: M2, expandedDates: D2, loadingDate: ne2, loadAllSessionsForDay: se2 };
|
|
2634
|
+
}
|
|
2635
|
+
var fl = (e2) => e2?.onlineBooking?.enabled === true;
|
|
2636
|
+
function pl(e2) {
|
|
2637
|
+
return !!e2?._id;
|
|
2638
|
+
}
|
|
2639
|
+
function ml(e2, t2) {
|
|
2640
|
+
return e2 ? e2.anyResource ? t2 ?? `` : e2.staffMemberId : null;
|
|
2641
|
+
}
|
|
2642
|
+
var hl = [];
|
|
2643
|
+
var gl = [];
|
|
2644
|
+
var _l = sn.map((e2) => ({ id: e2, gender: e2 }));
|
|
2645
|
+
var vl = { isSelectionValidated: false };
|
|
2646
|
+
var yl = () => {
|
|
2647
|
+
};
|
|
2648
|
+
var bl = async () => {
|
|
2649
|
+
};
|
|
2650
|
+
var xl = n(null);
|
|
2651
|
+
function Sl() {
|
|
2652
|
+
let e2 = i(xl);
|
|
2653
|
+
if (!e2) throw Error(`useTimeSlotsContext must be used within TimeSlotsContextProvider`);
|
|
2654
|
+
return e2;
|
|
2655
|
+
}
|
|
2656
|
+
function Cl(e2, t2, n2) {
|
|
2657
|
+
e2 ? t2() : n2();
|
|
2658
|
+
}
|
|
2659
|
+
var wl = { loginRequired: `rescheduleLoginRequired`, notFound: `rescheduleNotFound`, accessDenied: `rescheduleAccessDenied`, failed: `rescheduleNotFound`, wrongService: `rescheduleNotFound`, notReschedulable: `rescheduleNotReschedulable` };
|
|
2660
|
+
function Tl(e2 = 3) {
|
|
2661
|
+
return Math.min(Math.max(e2, 1), Ys);
|
|
2662
|
+
}
|
|
2663
|
+
function El(e2) {
|
|
2664
|
+
let { isLoading: n2, bookingsSettingsLoading: r2 } = u();
|
|
2665
|
+
gc(dc.TIME_SLOTS, !n2 && !r2);
|
|
2666
|
+
let i2 = ws(), [a2] = c(() => cl(i2));
|
|
2667
|
+
return p(Js, { children: p(t, { fallback: p(Sc, { nextAvailableSlotsCount: Tl(e2.nextAvailableSlotsCount), children: e2.children }), children: p(Ol, { ...e2, configurationPromise: a2 }) }) });
|
|
2668
|
+
}
|
|
2669
|
+
function Dl(e2) {
|
|
2670
|
+
let [t2, n2] = c({ serviceId: e2, key: 0 });
|
|
2671
|
+
return e2 !== t2.serviceId && n2({ serviceId: e2, key: t2.serviceId ? t2.key + 1 : t2.key }), t2.key;
|
|
2672
|
+
}
|
|
2673
|
+
function Ol({ onlyAvailableSlots: e2 = true, nextAvailableSlotsCount: t2 = 3, loadDaysAvailabilityInitially: n2 = false, timeSlotLimitPerDay: r2 = 100, configurationPromise: i2, children: o2 }) {
|
|
2674
|
+
let s2 = Ws().isLoading, { searchParams: d2 } = oc(), { reschedule: f2 } = u(), [m2] = c(() => ({ locationId: d2.get(Qa.location), staffId: d2.get(Qa.resource), timeZone: (f2 ? void 0 : jr(d2.get(Qa.blob))?.timezone) ?? d2.get(Qa.timezone) })), [h2, g2] = c(m2.timeZone), _2 = Tl(t2), [v2, y2] = c(false);
|
|
2675
|
+
a(() => y2(true), []);
|
|
2676
|
+
let b2 = v2 && !s2, x2 = vs(i2), S2 = l(rs, ns, () => false), { serviceId: C2 } = u(), w2 = Dl(C2), T2 = Number.isFinite(r2) ? Math.max(1, Math.floor(r2)) : 100;
|
|
2677
|
+
return p(Xs, { fallback: p(Cc, { nextAvailableSlotsCount: _2, children: o2 }), feature: So.timeSlots, children: p(kl, { onlyAvailableSlots: e2, selectedTimeZone: h2, setSelectedTimeZone: g2, enabled: b2, nextAvailableSlotsCount: _2, loadDaysAvailabilityInitially: n2, timeSlotLimitPerDay: T2, landingLocationId: m2.locationId, landingStaffId: m2.staffId, businessTimeZone: x2.businessTimeZone, staffSelectionStrategy: x2.staffSelectionStrategy, allowGenderSelection: x2.allowGenderSelection, requestedGenderRejected: S2, children: o2 }) }, w2);
|
|
2678
|
+
}
|
|
2679
|
+
function kl({ onlyAvailableSlots: e2, selectedTimeZone: t2, setSelectedTimeZone: n2, enabled: i2, nextAvailableSlotsCount: l2, loadDaysAvailabilityInitially: d2, timeSlotLimitPerDay: f2, landingLocationId: m2, landingStaffId: h2, businessTimeZone: g2, staffSelectionStrategy: _2, allowGenderSelection: v2, requestedGenderRejected: y2, children: b2 }) {
|
|
2680
|
+
let { service: x2, serviceId: S2, serviceType: C2, setSlot: w2, clearSlot: T2, setMultiServiceSlot: ee2, clearMultiServiceSlot: E2, draftRevision: D2, navigateToMultiServiceForm: te2, selection: ne2, selectStaffMember: O2, clearSelection: k2, clearStaffMember: re2, withSelectionParam: ie2, staffMembers: A2, serviceOptionsAndVariants: ae2, isLoading: j2, hasError: oe2, multiServiceAppointmentServices: M2 = gl, reschedule: se2 } = u(), N2 = se2 != null, ce2 = N2 && se2.status !== `ready`, le2 = N2 && se2.status === `loading`, ue2 = N2 ? wl[se2.status] : void 0, de2 = ce2 ? null : se2?.booking ?? null, fe2 = de2 ? se2.validUntil : null, pe2 = pl(x2) && !fl(x2), P2 = pe2 || ce2 ? null : S2, me2 = oc(), he2 = N2 ? null : me2.searchParams.get(Qa.blob), ge2 = o(() => no(jr(he2)), [he2]), F2 = !S2 && !j2 && !oe2 && (ge2.valid || ge2.reason !== `too-few-services`), _e2 = F2 && ge2.valid && M2.some((e3) => !fl(e3) && ge2.services.some((t3) => t3.serviceId === e3._id)), ve2 = pe2 || _e2, ye2 = F2 && ge2.valid && !_e2 ? ge2.requestKey : null, be2 = o(() => ye2 && ge2.valid ? { services: ge2.services, locationId: ge2.locationId, locationType: ge2.locationType } : null, [ye2]), xe2 = !!P2 || be2 !== null, Se2 = P2 || ye2, Ce2 = i2 && !j2 && !oe2 && !xe2 && !le2, we2 = Ks(), Te2 = Ws(), { navigate: Ee2, resolvePath: De2 } = po(), [Oe2, ke2] = c(null), [Ae2, je2] = c(false), Me2 = s([]), Ne2 = s(false), Pe2 = r(() => (je2(true), Ne2.current ? Promise.resolve() : new Promise((e3) => {
|
|
2681
|
+
Me2.current.push(e3);
|
|
2682
|
+
})), []), Fe2 = i2 ? Intl.DateTimeFormat().resolvedOptions().timeZone : null, Ie2 = Ja(x2), Le2 = s(null), Re2 = io(ne2), ze2 = s(Re2);
|
|
2683
|
+
ze2.current = Re2;
|
|
2684
|
+
let Be2 = Re2 && !Re2.anyResource ? Re2.staffMemberId : null, Ve2 = ne2.requestedGender ?? null, I2 = !Xa(C2) && !Za(C2), He2 = I2 && !F2 && _s(ae2), L2 = F2 || I2 && _2 === `CUSTOMER_CANNOT_CHOOSE`, Ue2 = _2 !== void 0, We2 = Ho({ allowGenderSelection: v2, staffSelectionStrategy: _2 ?? null }) && I2 && !F2 && !He2, Ge2 = We2 && !y2, Ke2 = o(() => P2 ? jr(he2)?.services.find((e3) => e3.serviceId === P2) ?? null : null, [he2, P2]), qe2 = (A2 ?? []).map((e3) => e3.staffMemberId).join(`,`), Je2 = Ie2.map((e3) => e3.id).join(`,`), Ye2 = o(() => qc({ entry: Ke2, appointmentLike: I2, staffChoiceHidden: L2, staffPriced: He2, staffSelectionStrategy: _2, genderAllowed: Ge2, staffMemberIds: qe2.split(`,`), locationIds: Je2.split(`,`) }), [Ke2, I2, L2, He2, _2, Ge2, qe2, Je2]), R2 = Ye2.staff, Xe2 = Ye2.locationId, Ze2 = L2 || R2 !== null, [Qe2, $e2] = c(null), [et2, tt2] = c(m2 !== null || N2), nt2 = (e3) => !!e3 && Ie2.some((t3) => t3.id === e3), rt2 = de2?.locationId ?? null, it2 = Qe2 ?? (et2 ? nt2(rt2) ? rt2 : m2 : null), at2 = Xe2 ?? (nt2(it2) ? it2 : null), ot2 = o(() => Xe2 ? [] : Ie2.map((e3) => ({ id: e3.id, name: e3.label })), [x2, Xe2]), st2 = o(() => Ze2 ? [] : (A2 ?? []).filter((e3) => e3.name).map((e3) => ({ id: e3.staffMemberId, name: e3.name ?? ``, gender: null })), [A2, Ze2]), ct2 = I2 && !Ue2 ? hl : st2, lt2 = Ge2 && ct2.length > 1, ut2 = o(() => lt2 ? [..._l, ...ct2] : ct2, [lt2, ct2]), [dt2, ft2] = c(null), [pt2, mt2] = c(h2 !== null), ht2 = dt2 ?? (pt2 ? h2 : null), z2 = R2 ? R2.anyResource ? null : R2.staffMemberId : ht2 !== null && st2.some((e3) => e3.id === ht2) ? ht2 : null, gt2 = Re2?.anyResource ? Ve2 : null, [_t2, vt2] = c(gt2), [yt2, bt2] = c(gt2);
|
|
2685
|
+
!y2 && Re2?.anyResource && Ve2 !== yt2 && (bt2(Ve2), vt2(Ve2));
|
|
2686
|
+
let xt2 = R2 ? Ye2.requestedGender : We2 && ct2.length > 1 && z2 === null ? _t2 : null, B2 = y2 ? null : xt2, St2 = r((e3) => {
|
|
2687
|
+
ze2.current = e3, e3 ? e3.anyResource ? k2(B2 ?? void 0) : O2(e3.staffMemberId) : re2();
|
|
2688
|
+
}, [re2, k2, O2, B2]), Ct2 = r((e3) => St2(e3 ? { anyResource: false, staffMemberId: e3 } : { anyResource: true }), [St2]), wt2 = (de2?.addOnIds ?? []).filter((e3) => x2?.addOnGroups?.some((t3) => t3.addOnIds?.includes(e3))), Tt2 = de2 && Xa(C2) ? de2.participants : null, Et2 = I2 ? $a(ne2) : null, { addOnIds: Dt2, ...Ot2 } = Et2 ?? {}, kt2 = I2 && de2 ? wt2.length ? { ...Ot2, addOnIds: wt2 } : Ot2 : Et2, At2 = kt2 ? Xo(kt2) : void 0, jt2 = JSON.stringify(xt2 ? { ...At2, requestedGender: { gender: xt2 } } : At2 ?? null), Mt2 = o(() => JSON.parse(jt2), [jt2]), Nt2 = R2?.anyResource === true, Pt2 = r((e3) => Nt2 || _2 !== void 0 && Uc({ isAppointment: I2, staffOnSlotCount: e3, hasStaffFilter: z2 !== null, hasRequestedGender: B2 !== null, hasStaffPricedVariants: He2, staffSelectionStrategy: _2 }), [Nt2, I2, _2, z2, B2, He2]), Ft2 = r((e3) => R2 ?? (L2 ? null : e3), [R2, L2]), It2 = r((e3) => {
|
|
2689
|
+
let t3 = e3 === null ? null : ut2.find((t4) => t4.id === e3);
|
|
2690
|
+
t3 !== void 0 && (mt2(false), ft2(t3 && !t3.gender ? t3.id : null), vt2(t3?.gender ?? null));
|
|
2691
|
+
}, [ut2]), Lt2 = r((e3) => {
|
|
2692
|
+
(e3 === null || Ie2.some((t3) => t3.id === e3)) && (tt2(false), $e2(e3));
|
|
2693
|
+
}, [x2]), Rt2 = !!(i2 && !Te2.isLoading && Te2.displayTimeZonePolicy.customerCanChange && g2 && Fe2 && g2 !== Fe2), V2 = i2 ? Rt2 && t2 && (t2 === g2 || t2 === Fe2) ? t2 : we2 ?? g2 ?? Fe2 : null, zt2 = r((e3) => {
|
|
2694
|
+
Rt2 && (e3 === g2 || e3 === Fe2) && n2(e3);
|
|
2695
|
+
}, [Rt2, g2, Fe2, n2]), Bt2 = o(() => i2 && !j2 && xe2 ? Date.now() : void 0, [i2, j2, P2, be2, V2]), Vt2 = Bt2 !== void 0 && V2 ? Eo(new Date(Bt2), V2) : null, { range: Ht2, daysAvailability: Ut2, isLoading: Wt2, hasError: Gt2, setRange: Kt2, nextRange: qt2, previousRange: Jt2 } = zc({ enabled: i2, serviceId: P2, serviceType: C2, multiServiceRequest: be2, timeZone: V2, today: Vt2, locationId: at2, staffId: z2, customerChoices: Mt2, minRemainingCapacity: Tt2, loadInitially: d2, onlyAvailableSlots: e2 }), Yt2 = fe2?.slice(0, 10) ?? null, Xt2 = o(() => Yt2 ? Ut2.map((e3) => e3.date > Yt2 ? { ...e3, availability: `none` } : e3) : Ut2, [Ut2, Yt2]), Zt2 = fe2 && V2 ? ko(new Date(fe2), V2) : null, { query: H2, selectedDate: Qt2, timeSlots: $t2, isLoading: en2, error: tn2, selectDate: nn2, findNextAvailableDate: rn2 } = Bc({ enabled: i2, serviceId: P2, serviceType: C2, multiServiceRequest: be2, timeZone: V2, today: Vt2, locationId: at2, staffId: z2, customerChoices: Mt2, minRemainingCapacity: Tt2, onlyAvailableSlots: e2, serviceLoading: j2 }), an2 = s(true), on2 = s(null);
|
|
2696
|
+
a(() => {
|
|
2697
|
+
if (an2.current) {
|
|
2698
|
+
an2.current = false;
|
|
2699
|
+
return;
|
|
2700
|
+
}
|
|
2701
|
+
ke2(null), Le2.current && Cl(P2, T2, E2), Le2.current = null, on2.current = null;
|
|
2702
|
+
}, [H2, be2, V2, at2, z2, Mt2, Tt2, e2, l2, f2, D2]);
|
|
2703
|
+
let sn2 = r(async () => {
|
|
2704
|
+
let e3 = await rn2();
|
|
2705
|
+
return e3.outcome === `found` ? Yt2 && e3.date > Yt2 ? `none` : (await Promise.all([nn2(e3.date), Ht2 && zo(e3.date, Ht2) ? Promise.resolve() : Kt2(Io(e3.date))]), `found`) : e3.outcome;
|
|
2706
|
+
}, [rn2, Yt2, nn2, Ht2, Kt2]), cn2 = !!(i2 && !j2 && xe2 && V2 && Vt2), ln2 = i2 && !j2 && !xe2, [un2, dn2] = c(false), [fn2, pn2] = c(0), mn2 = s(false), hn2 = s([]), U2 = s(0), gn2 = r(() => {
|
|
2707
|
+
dn2(false);
|
|
2708
|
+
let e3 = hn2.current;
|
|
2709
|
+
return hn2.current = [], e3;
|
|
2710
|
+
}, []), _n2 = r(() => {
|
|
2711
|
+
U2.current += 1, gn2().forEach((e3) => e3(`cancelled`));
|
|
2712
|
+
}, [gn2]), vn2 = r((e3) => (_n2(), nn2(e3)), [_n2, nn2]), yn2 = r((e3) => {
|
|
2713
|
+
let t3 = U2.current;
|
|
2714
|
+
mn2.current = true, sn2().then((n3) => {
|
|
2715
|
+
mn2.current = false, n3 === `cancelled` && t3 === U2.current ? (hn2.current.unshift(...e3), dn2(true)) : e3.forEach((e4) => e4(n3)), pn2((e4) => e4 + 1);
|
|
2716
|
+
});
|
|
2717
|
+
}, [sn2]), bn2 = r(() => ln2 ? Promise.resolve(`none`) : new Promise((e3) => {
|
|
2718
|
+
if (cn2 && !mn2.current) {
|
|
2719
|
+
yn2([...gn2(), e3]);
|
|
2720
|
+
return;
|
|
2721
|
+
}
|
|
2722
|
+
hn2.current.push(e3), dn2(true);
|
|
2723
|
+
}), [ln2, cn2, yn2, gn2]);
|
|
2724
|
+
a(() => {
|
|
2725
|
+
if (un2 && !mn2.current) {
|
|
2726
|
+
if (ln2) {
|
|
2727
|
+
gn2().forEach((e3) => e3(`none`));
|
|
2728
|
+
return;
|
|
2729
|
+
}
|
|
2730
|
+
cn2 && yn2(gn2());
|
|
2731
|
+
}
|
|
2732
|
+
}, [un2, fn2, cn2, ln2, yn2, gn2]);
|
|
2733
|
+
let xn2 = x2?.schedule?.lastSessionEnd, Sn2 = I2 || Xa(C2) || Za(C2) && !Vc(xn2, Bt2), Cn2 = !!(Ae2 && i2 && !j2 && P2 && V2 && Bt2 !== void 0), wn2 = Cn2 && P2 && V2 && Bt2 !== void 0 ? Hc({ serviceId: P2, serviceType: C2, lastSessionEnd: xn2, timeZone: V2, now: Bt2, onlyAvailableSlots: e2, locationId: at2, staffId: z2, timeSlotLimitPerDay: f2, customerChoices: Mt2, minRemainingCapacity: Tt2 }) : void 0, W2 = dl(l2, wn2), Tn2 = Ae2 && P2 && Sn2 && !(Ae2 && P2 && Sn2 && (!i2 || j2)) && !V2, En2 = ve2 ? `onlineBookingOff` : ue2 ?? (W2.error === null ? Tn2 ? `timeZoneMissing` : null : `upcomingSlotsLoadFailed`), Dn2 = H2 !== null, On2 = o(() => Yc({ sessions: W2.sessions, dayQuery: Dn2, daySlots: $t2, staffFilter: z2, appointmentLike: I2, limitPerDay: f2, expandedDates: W2.expandedDates }), [W2.sessions, Dn2, $t2, z2, I2, f2, W2.expandedDates]), { slotIdOf: kn2 } = On2, An2 = Ae2 && (wn2 ? W2.firstPageSettled : Cn2 || i2 && !j2 && !P2 || Tn2);
|
|
2734
|
+
Ne2.current = An2, a(() => {
|
|
2735
|
+
if (!An2) return;
|
|
2736
|
+
let e3 = Me2.current;
|
|
2737
|
+
Me2.current = [], e3.forEach((e4) => e4());
|
|
2738
|
+
}, [An2]);
|
|
2739
|
+
let jn2 = Ae2 && !An2 || W2.isLoadingPage, Mn2 = En2 !== null, Nn2 = H2 ? en2 : jn2 || en2 || !i2 || xe2 && !V2 || un2 || le2, Pn2 = H2 ? tn2 : tn2 ?? En2, Fn2 = H2 ? tn2 !== null : Mn2 || tn2 !== null, In2 = hc(dc.TIME_SLOTS), Ln2 = s(false), Rn2 = r((e3, t3) => {
|
|
2740
|
+
if (!t3.bookable) {
|
|
2741
|
+
on2.current = null;
|
|
2742
|
+
return;
|
|
2743
|
+
}
|
|
2744
|
+
if (e3 === on2.current) return;
|
|
2745
|
+
on2.current = e3;
|
|
2746
|
+
let n3 = P2 ?? t3.serviceId ?? t3.nestedTimeSlots?.[0]?.serviceId ?? void 0, r2 = C2 ?? M2.find((e4) => e4._id === n3)?.type ?? void 0;
|
|
2747
|
+
!Ln2.current && !N2 && In2(lc({ bookingsServiceId: n3, serviceType: r2, isEligibleForFlowCompletion: true })), Ln2.current = true, In2(_c({ component: pc.TIME_PICKER, element: mc.TIME_SLOT, properties: JSON.stringify({ selectedTime: t3.localStartDate }) }));
|
|
2748
|
+
}, [In2, P2, C2, M2, N2]), zn2 = r((e3) => {
|
|
2749
|
+
if (e3 === null) {
|
|
2750
|
+
let e4 = Le2.current !== null;
|
|
2751
|
+
Le2.current = null, on2.current = null, ke2(null), e4 && Cl(P2, T2, E2);
|
|
2752
|
+
return;
|
|
2753
|
+
}
|
|
2754
|
+
let t3 = Xc(On2, e3);
|
|
2755
|
+
if (!t3) return;
|
|
2756
|
+
if (F2) {
|
|
2757
|
+
if (!ee2(t3.nestedTimeSlots ?? [], V2 ?? void 0)) return;
|
|
2758
|
+
Le2.current = t3, ke2(t3), Rn2(e3, t3);
|
|
2759
|
+
return;
|
|
2760
|
+
}
|
|
2761
|
+
Le2.current = t3, ke2(t3), Rn2(e3, t3);
|
|
2762
|
+
let n3 = el(t3);
|
|
2763
|
+
if (w2(gs(t3), { staffId: I2 ? void 0 : $c(t3), timezone: V2 ?? void 0, bookable: t3.bookable, staffChoiceRequired: I2 && Ue2 && !L2 && n3.length > 1 && !Pt2(n3.length), rescheduleStaffId: I2 && (_2 !== `CUSTOMER_MAY_CHOOSE` || !Pt2(n3.length)) ? n3[0] : void 0 }), !I2) return;
|
|
2764
|
+
let r2 = ze2.current, i3;
|
|
2765
|
+
i3 = R2 || (z2 && n3.includes(z2) ? { anyResource: false, staffMemberId: z2 } : B2 !== null && Pt2(n3.length) ? { anyResource: true } : Wc(n3, Ue2 && Pt2(n3.length))), ml(i3, B2) !== ml(r2, Ve2) && St2(i3);
|
|
2766
|
+
}, [F2, P2, T2, E2, ee2, w2, On2, Rn2, V2, I2, Ue2, _2, Pt2, R2, z2, B2, Ve2, St2]), Bn2 = r(() => {
|
|
2767
|
+
let e3 = Le2.current;
|
|
2768
|
+
if (!e3 || N2) return;
|
|
2769
|
+
if (F2) {
|
|
2770
|
+
te2(In2);
|
|
2771
|
+
return;
|
|
2772
|
+
}
|
|
2773
|
+
if (!P2) return;
|
|
2774
|
+
let t3;
|
|
2775
|
+
if (I2) {
|
|
2776
|
+
let n4 = el(e3), r2 = Gc(n4, Ft2(ze2.current), Pt2(n4.length));
|
|
2777
|
+
t3 = (r2.isComplete ? r2.resourceId : n4[0]) ?? (n4.length ? null : void 0);
|
|
2778
|
+
}
|
|
2779
|
+
let n3 = De2(`bookingForm`, { slug: x2?.mainSlug?.name ?? null, serviceId: P2 });
|
|
2780
|
+
e3.bookable && In2(bc({ serviceId: P2, serviceType: C2 ?? void 0, start: e3.localStartDate, end: e3.localEndDate, timeZone: V2 ?? void 0, isEligibleForFlowCompletion: !!n3 })), n3 && Ee2(ie2(n3, { handoff: true, staffId: t3 }));
|
|
2781
|
+
}, [In2, F2, te2, V2, P2, C2, x2, I2, Ft2, Pt2, Ee2, De2, ie2, N2]), Vn2 = Oe2 ? el(Oe2) : null, Hn2 = Vn2 ? F2 || !I2 || Gc(Vn2, Ft2(Re2), Pt2(Vn2.length)).isComplete : false, G2 = Vn2 ? Pt2(Vn2.length) : false, Un2 = o(() => !Oe2 || Ze2 ? [] : Qc(Oe2).map((e3) => ({ staffMemberId: e3.staffMemberId, name: e3.name || null, image: null, isSelected: e3.staffMemberId === Be2 })), [Oe2, Ze2, Be2]), Wn2 = o(() => ({ ...vl, isMultiService: F2, hasValidSchedulingInput: xe2, availabilityRequestKey: Se2, needsServiceChoice: Ce2, isRescheduling: N2, rescheduleValidUntil: Zt2, businessTimeZone: g2, canChangeTimeZone: Rt2, setTimeZone: zt2, locationFilterOptions: ot2, selectedLocationFilter: at2, setLocationFilter: Lt2, staffFilterOptions: ut2, selectedStaffFilter: z2, setStaffFilter: It2, requestedGender: B2, genderSelectionAllowed: Ge2, currentTimeSlotsPage: H2 ? 1 : W2.currentPage, hasNextTimeSlotsPage: !H2 && W2.hasNextPage, hasPreviousTimeSlotsPage: !H2 && W2.hasPreviousPage, nextTimeSlotsPage: H2 ? bl : W2.nextPage, loadUpcomingTimeSlots: Pe2, upcomingTimeSlotsRequested: Ae2, previousTimeSlotsPage: H2 ? yl : W2.previousPage, timeSlots: On2.rows.map((e3) => Zc(e3, V2, kn2, L2)), isLoading: Nn2, hasError: Fn2, errorCode: Pn2, selectedDate: Qt2, daysAvailabilityRange: Ht2, daysAvailability: Xt2, daysAvailabilityLoading: Wt2, daysAvailabilityHasError: Gt2, timeSlotsLoading: Nn2, timeSlotsErrorCode: Pn2, selectDate: vn2, setDaysAvailabilityRange: Kt2, nextDaysAvailabilityRange: qt2, previousDaysAvailabilityRange: Jt2, goToNextAvailableDate: bn2, nextAvailableSlotsCount: l2, timeZone: V2, staffFromSlots: Un2, selectedResourceId: Be2, setSelectedResource: Ct2, canAutoAssignStaff: G2, isComplete: Hn2, selectedTimeSlot: Oe2 ? Zc(Oe2, V2, kn2, L2) : null, selectTimeSlot: zn2, navigateToBookingForm: Bn2, timeSlotLimitPerDay: f2, expandedDates: W2.expandedDates, daysWithMore: On2.daysWithMore, loadingDate: W2.loadingDate, loadAllTimeSlotsForDay: W2.loadAllSessionsForDay }), [F2, xe2, Se2, Ce2, N2, Zt2, g2, V2, Rt2, zt2, W2, Pe2, Ae2, ot2, at2, Lt2, ut2, z2, It2, B2, Ge2, H2, Nn2, Pn2, Fn2, On2, Qt2, Ht2, Xt2, Wt2, Gt2, vn2, Kt2, qt2, Jt2, bn2, l2, Un2, Be2, Ct2, G2, Hn2, Oe2, zn2, Bn2, f2, kn2, L2]);
|
|
2782
|
+
return p(xl.Provider, { value: Wn2, children: b2 });
|
|
2783
|
+
}
|
|
2784
|
+
var Al = on;
|
|
2785
|
+
export {
|
|
2786
|
+
El as TimeSlotsContextProvider,
|
|
2787
|
+
El as default,
|
|
2788
|
+
Al as injectAccessTokenGetter,
|
|
2789
|
+
xl as timeSlotsContext,
|
|
2790
|
+
Sl as useTimeSlotsContext
|
|
2791
|
+
};
|
|
2792
|
+
//# sourceMappingURL=context-time-slots-context.mjs.map
|