@wix/bookings 1.0.1757 → 1.0.1758

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.
@@ -71,7 +71,7 @@ var v = (e2) => {
71
71
  throw Error(`Unknown method: ${e2}`);
72
72
  }
73
73
  };
74
- var ee = (e2) => (t2) => async (n2) => {
74
+ var y = (e2) => (t2) => async (n2) => {
75
75
  let r2, i2 = (t3) => {
76
76
  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.`);
77
77
  let { method: i3, url: a2, params: o2 } = r2;
@@ -88,7 +88,7 @@ var ee = (e2) => (t2) => async (n2) => {
88
88
  throw typeof e3 == `object` && e3 && `response` in e3 && typeof e3.response == `object` && e3.response !== null && `data` in e3.response ? e3.response.data : e3;
89
89
  }
90
90
  };
91
- var y = (e2) => e2.__isAmbassador ? true : !!e2().__isAmbassador;
91
+ var ee = (e2) => e2.__isAmbassador ? true : !!e2().__isAmbassador;
92
92
  var b = `__metadata`;
93
93
  var te = `edge.wixapis.com`;
94
94
  var ne = class extends Error {
@@ -104,19 +104,19 @@ var ne = class extends Error {
104
104
  };
105
105
  var x = (e2, t2, n2, r2) => ({ details: { ...!n2?.validationError && { applicationError: { description: t2, code: e2, data: r2 } }, ...n2 }, message: t2, requestId: r2?.requestId });
106
106
  var S = (e2) => e2?.method && [`post`, `put`, `patch`].includes(e2.method.toLocaleLowerCase()) && e2.body ? { "Content-Type": `application/json` } : {};
107
- var re = (e2) => e2 && typeof e2 == `object` && !Array.isArray(e2);
108
- var ie = (e2) => e2.__type === `host`;
109
- function C(e2, t2) {
107
+ var C = (e2) => e2 && typeof e2 == `object` && !Array.isArray(e2);
108
+ var re = (e2) => e2.__type === `host`;
109
+ function ie(e2, t2) {
110
110
  return e2.create(t2);
111
111
  }
112
- var ae = `x-wix-bi-gateway`;
113
- function oe(e2, t2, n2) {
114
- return { [ae]: se({ environment: `js-sdk${n2 ? `-${n2}` : ``}`, "package-name": e2.packageName ?? t2?.PACKAGE_NAME, "method-fqn": e2.methodFqn, entity: e2.entityFqdn }) };
112
+ var w = `x-wix-bi-gateway`;
113
+ function ae(e2, t2, n2) {
114
+ return { [w]: oe({ environment: `js-sdk${n2 ? `-${n2}` : ``}`, "package-name": e2.packageName ?? t2?.PACKAGE_NAME, "method-fqn": e2.methodFqn, entity: e2.entityFqdn }) };
115
115
  }
116
- function se(e2) {
116
+ function oe(e2) {
117
117
  return Object.entries(e2).filter(([e3, t2]) => !!t2).map(([e3, t2]) => `${e3}=${t2}`).join(`,`);
118
118
  }
119
- function w(e2) {
119
+ function T(e2) {
120
120
  let t2 = globalThis.__wix_context__, n2 = { client: g.client, elevatedClient: g.elevatedClient }, r2;
121
121
  globalThis.__wix_context__ = void 0, g.client = void 0, g.elevatedClient = void 0, typeof $wixContext < `u` && (r2 = { client: $wixContext?.client, elevatedClient: $wixContext?.elevatedClient }, delete $wixContext.client, delete $wixContext.elevatedClient);
122
122
  try {
@@ -125,82 +125,82 @@ function w(e2) {
125
125
  globalThis.__wix_context__ = t2, g.client = n2.client, g.elevatedClient = n2.elevatedClient, typeof $wixContext < `u` && ($wixContext.client = r2.client, $wixContext.elevatedClient = r2.elevatedClient);
126
126
  }
127
127
  }
128
- var T = { id: `_id`, createdDate: `_createdDate`, updatedDate: `_updatedDate` };
129
- function ce(e2) {
130
- return O(e2).map((e3) => e3.toLocaleUpperCase()).join(`_`);
128
+ var E = { id: `_id`, createdDate: `_createdDate`, updatedDate: `_updatedDate` };
129
+ function se(e2) {
130
+ return fe(e2).map((e3) => e3.toLocaleUpperCase()).join(`_`);
131
131
  }
132
- var E = /([\p{Ll}\d])(\p{Lu})/gu;
132
+ var ce = /([\p{Ll}\d])(\p{Lu})/gu;
133
133
  var le = /(\p{Lu})([\p{Lu}][\p{Ll}])/gu;
134
- var D = `$1\0$2`;
135
- var ue = /[^\p{L}\d]+/giu;
136
- function O(e2) {
134
+ var ue = `$1\0$2`;
135
+ var de = /[^\p{L}\d]+/giu;
136
+ function fe(e2) {
137
137
  let t2 = e2.trim();
138
- t2 = t2.replace(E, D).replace(le, D), t2 = t2.replace(ue, `\0`);
138
+ t2 = t2.replace(ce, ue).replace(le, ue), t2 = t2.replace(de, `\0`);
139
139
  let n2 = 0, r2 = t2.length;
140
140
  for (; t2.charAt(n2) === `\0`; ) n2++;
141
141
  if (n2 === r2) return [];
142
142
  for (; t2.charAt(r2 - 1) === `\0`; ) r2--;
143
143
  return t2.slice(n2, r2).split(/\0/g);
144
144
  }
145
- var de = (e2) => `validationError` in (e2.response?.data?.details ?? {});
146
- var k = (e2) => `applicationError` in (e2.response?.data?.details ?? {});
147
- var fe = (e2) => (e2.response?.status ?? -1) >= 400 && (e2.response?.status ?? -1) < 500;
148
- function pe(e2, t2 = { explicitPathsToArguments: {}, spreadPathsToArguments: {}, singleArgumentUnchanged: false }, n2 = []) {
145
+ var D = (e2) => `validationError` in (e2.response?.data?.details ?? {});
146
+ var O = (e2) => `applicationError` in (e2.response?.data?.details ?? {});
147
+ var pe = (e2) => (e2.response?.status ?? -1) >= 400 && (e2.response?.status ?? -1) < 500;
148
+ function me(e2, t2 = { explicitPathsToArguments: {}, spreadPathsToArguments: {}, singleArgumentUnchanged: false }, n2 = []) {
149
149
  if (typeof e2 != `object` || !e2) throw e2;
150
- if (de(e2)) return me(e2, t2, n2);
151
- if (k(e2)) return ge(e2);
152
- if (fe(e2)) {
153
- let t3 = e2.response?.status, n3 = e2.response?.statusText ?? `UNKNOWN`, r2 = e2.response?.data?.message ?? n3, i2 = { applicationError: { description: n3, code: ce(n3), data: {} }, requestId: e2.requestId };
154
- return he(e2, { message: JSON.stringify({ message: r2, details: i2 }, null, 2), extraProperties: { details: i2, status: t3 } });
150
+ if (D(e2)) return he(e2, t2, n2);
151
+ if (O(e2)) return _e(e2);
152
+ if (pe(e2)) {
153
+ let t3 = e2.response?.status, n3 = e2.response?.statusText ?? `UNKNOWN`, r2 = e2.response?.data?.message ?? n3, i2 = { applicationError: { description: n3, code: se(n3), data: {} }, requestId: e2.requestId };
154
+ return ge(e2, { message: JSON.stringify({ message: r2, details: i2 }, null, 2), extraProperties: { details: i2, status: t3 } });
155
155
  }
156
- return _e(e2);
156
+ return ve(e2);
157
157
  }
158
- var me = (e2, t2, n2) => {
159
- let r2 = e2.response?.data, i2 = e2.requestId, { fieldViolations: a2 } = r2.details.validationError, o2 = ve(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 };
160
- return he(e2, { message: JSON.stringify({ message: s2, details: c2 }, null, 2), extraProperties: { details: c2, status: e2.response?.status, requestId: i2 } });
158
+ var he = (e2, t2, n2) => {
159
+ let r2 = e2.response?.data, i2 = e2.requestId, { fieldViolations: a2 } = r2.details.validationError, o2 = ye(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 };
160
+ return ge(e2, { message: JSON.stringify({ message: s2, details: c2 }, null, 2), extraProperties: { details: c2, status: e2.response?.status, requestId: i2 } });
161
161
  };
162
- var he = (e2, { message: t2, extraProperties: n2 }) => Object.assign(e2, { ...n2, message: t2 });
163
- var ge = (e2) => {
164
- 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 ?? ce(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 };
165
- return he(e2, { message: JSON.stringify({ message: s2, details: c2 }, null, 2), extraProperties: { details: c2, status: t2, requestId: e2.requestId } });
162
+ var ge = (e2, { message: t2, extraProperties: n2 }) => Object.assign(e2, { ...n2, message: t2 });
163
+ var _e = (e2) => {
164
+ 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 ?? se(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 };
165
+ return ge(e2, { message: JSON.stringify({ message: s2, details: c2 }, null, 2), extraProperties: { details: c2, status: t2, requestId: e2.requestId } });
166
166
  };
167
- var _e = (e2) => he(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: ce(e2.response?.statusText ?? `UNKNOWN`), ...!e2.response && { runtimeError: e2 } } });
168
- var ve = ({ spreadPathsToArguments: e2, explicitPathsToArguments: t2, singleArgumentUnchanged: n2 }, r2, i2) => {
167
+ var ve = (e2) => ge(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: se(e2.response?.statusText ?? `UNKNOWN`), ...!e2.response && { runtimeError: e2 } } });
168
+ var ye = ({ spreadPathsToArguments: e2, explicitPathsToArguments: t2, singleArgumentUnchanged: n2 }, r2, i2) => {
169
169
  let a2 = { ...e2, ...t2 }, o2 = Object.keys(a2);
170
170
  return r2?.filter((e3) => !r2.some((t3) => t3.field.length > e3.field.length && t3.field.startsWith(e3.field) && o2.includes(t3.field))).map((e3) => {
171
171
  let r3 = t2[e3.field];
172
- if (r3) return { ...e3, field: A(r3, i2) };
172
+ if (r3) return { ...e3, field: be(r3, i2) };
173
173
  let s2 = o2?.sort((e4, t3) => t3.length - e4.length)?.find((t3) => e3.field.startsWith(t3));
174
174
  if (s2) {
175
175
  let t3 = a2[s2];
176
- if (t3) return { ...e3, field: e3.field.replace(s2, A(t3, i2)) };
176
+ if (t3) return { ...e3, field: e3.field.replace(s2, be(t3, i2)) };
177
177
  }
178
178
  return n2 ? { ...e3, field: `${i2[0]}.${e3.field}` } : e3;
179
179
  });
180
180
  };
181
- var A = (e2, t2) => {
182
- let n2 = ye(e2);
181
+ var be = (e2, t2) => {
182
+ let n2 = k(e2);
183
183
  return n2 == null ? e2 : e2.replace(`$[${n2}]`, t2[n2]);
184
184
  };
185
- var ye = (e2) => {
185
+ var k = (e2) => {
186
186
  let t2 = e2.match(/\$\[(?<argIndex>\d+)\]/);
187
187
  return t2 && t2.groups && Number(t2.groups.argIndex);
188
188
  };
189
- function be(e2, t2, n2, r2, i2, a2, o2, s2, c2, l2, u2) {
190
- return w(() => e2({ request: async (e3) => {
189
+ function xe(e2, t2, n2, r2, i2, a2, o2, s2, c2, l2, u2) {
190
+ return T(() => e2({ request: async (e3) => {
191
191
  let i3 = e3({ host: s2?.HTTPHost || `www.wixapis.com` }), a3 = i3;
192
192
  a3.method === `GET` && a3.fallback?.length && (a3.params?.toString().length ?? 0) > 4e3 && (a3 = i3.fallback[0]);
193
193
  let o3 = s2?.HTTPHost ?? `www.wixapis.com`, u3 = `https://${l2 ? te : o3}${a3.url}`;
194
194
  a3.params && a3.params.toString() && (u3 += `?${a3.params.toString()}`);
195
195
  try {
196
- let e4 = oe(i3, t2, c2), o4 = { method: a3.method, ...a3.data && { body: JSON.stringify(a3.data) }, headers: { ...e4 } }, s3 = await n2(u3, o4);
196
+ let e4 = ae(i3, t2, c2), o4 = { method: a3.method, ...a3.data && { body: JSON.stringify(a3.data) }, headers: { ...e4 } }, s3 = await n2(u3, o4);
197
197
  if (s3.status !== 200) {
198
198
  let e5 = null;
199
199
  try {
200
200
  e5 = await s3.json();
201
201
  } catch {
202
202
  }
203
- let t3 = Se(s3.status, e5?.message ?? s3.statusText, e5?.details, { requestId: s3.headers.get(`X-Wix-Request-Id`), details: e5 }), n3 = pe(t3);
203
+ let t3 = Ce(s3.status, e5?.message ?? s3.statusText, e5?.details, { requestId: s3.headers.get(`X-Wix-Request-Id`), details: e5 }), n3 = me(t3);
204
204
  throw r2?.handleError(n3, { requestOptions: { url: a3.url, method: a3.method, entityFqdn: i3.entityFqdn, methodFqn: i3.methodFqn } }), t3;
205
205
  }
206
206
  let l3 = await s3.json();
@@ -210,18 +210,18 @@ function be(e2, t2, n2, r2, i2, a2, o2, s2, c2, l2, u2) {
210
210
  }
211
211
  }, fetchWithAuth: n2, wixAPIFetch: i2, getActiveToken: a2, getAuthHeaders: o2 }, { validateRequestSchema: u2 }));
212
212
  }
213
- var xe = class extends Error {
213
+ var Se = class extends Error {
214
214
  response;
215
215
  requestId;
216
216
  constructor(e2) {
217
217
  super(), this.response = e2.response, this.requestId = e2.requestId;
218
218
  }
219
219
  };
220
- var Se = (e2, t2, n2, r2) => new xe({ response: { data: { details: { ...!n2?.validationError && { applicationError: { description: t2, code: e2, data: r2 } }, ...n2 }, message: t2 }, status: e2 }, requestId: r2?.requestId });
221
- var Ce = `.`;
222
- function we(e2, t2, n2) {
220
+ var Ce = (e2, t2, n2, r2) => new Se({ response: { data: { details: { ...!n2?.validationError && { applicationError: { description: t2, code: e2, data: r2 } }, ...n2 }, message: t2 }, status: e2 }, requestId: r2?.requestId });
221
+ var we = `.`;
222
+ function Te(e2, t2, n2) {
223
223
  if (e2 == null) throw Error(`Cannot set value on null or undefined`);
224
- let r2 = Te(t2), i2 = e2;
224
+ let r2 = Ee(t2), i2 = e2;
225
225
  for (let e3 = 0; e3 < r2.length; e3++) {
226
226
  let t3 = r2[e3];
227
227
  if (e3 === r2.length - 1) {
@@ -233,21 +233,21 @@ function we(e2, t2, n2) {
233
233
  }
234
234
  return e2;
235
235
  }
236
- function Te(e2) {
237
- return Array.isArray(e2) ? e2 : e2.split(Ce).map((e3) => Ee(e3) ? Number(e3) : e3);
238
- }
239
236
  function Ee(e2) {
240
- return /^\d+$/.test(e2);
237
+ return Array.isArray(e2) ? e2 : e2.split(we).map((e3) => De(e3) ? Number(e3) : e3);
241
238
  }
242
239
  function De(e2) {
240
+ return /^\d+$/.test(e2);
241
+ }
242
+ function Oe(e2) {
243
243
  let t2 = {};
244
- for (let [n2, r2] of Object.entries(e2)) Oe(n2) || we(t2, Te(n2), r2);
244
+ for (let [n2, r2] of Object.entries(e2)) ke(n2) || Te(t2, Ee(n2), r2);
245
245
  return t2;
246
246
  }
247
- function Oe(e2) {
247
+ function ke(e2) {
248
248
  return e2 === `__proto__` || e2 === `constructor` || e2 === `prototype`;
249
249
  }
250
- var ke = class {
250
+ var Ae = class {
251
251
  BRACKET_PATTERN = /\[(\d+)\]/g;
252
252
  NUMERIC_PATTERN = /^\d+$/;
253
253
  ESCAPED_DOT_PATTERN = /\\\./g;
@@ -270,7 +270,7 @@ var ke = class {
270
270
  return e2.replace(this.ESCAPED_DOT_PLACEHOLDER, `\\.`).replace(this.ESCAPED_RIGHT_BRACKET_PLACEHOLDER, `\\]`).replace(this.ESCAPED_LEFT_BRACKET_PLACEHOLDER, `\\[`);
271
271
  }
272
272
  unflatten() {
273
- return this.cleanedModifiedFields = Object.fromEntries(Object.entries(this.modifiedFields).map(([e2, t2]) => [this.replaceEscapedCharacters(this.bracketToDotNotation(e2)), t2])), De(this.cleanedModifiedFields);
273
+ return this.cleanedModifiedFields = Object.fromEntries(Object.entries(this.modifiedFields).map(([e2, t2]) => [this.replaceEscapedCharacters(this.bracketToDotNotation(e2)), t2])), Oe(this.cleanedModifiedFields);
274
274
  }
275
275
  flatten(e2) {
276
276
  let t2 = {};
@@ -290,12 +290,12 @@ var ke = class {
290
290
  if (!Array.isArray(n2)) throw Error(`Expected array at path ${this.buildPathString(r2)}, but got ${typeof n2}`);
291
291
  r2.push(`[${e3}]`), n2 = n2[parseInt(e3, 10)];
292
292
  }, a2 = (e3, t3) => {
293
- let i3 = e3 in T ? T[e3] : void 0;
293
+ let i3 = e3 in E ? E[e3] : void 0;
294
294
  if (i3 && i3 in t3) {
295
295
  r2.push(i3), n2 = t3[i3];
296
296
  return;
297
297
  }
298
- let a3 = Ne(e3);
298
+ let a3 = Pe(e3);
299
299
  if (a3 && a3 in t3) {
300
300
  r2.push(a3), n2 = t3[a3];
301
301
  return;
@@ -326,28 +326,28 @@ var ke = class {
326
326
  return e2.replace(this.BRACKET_PATTERN, (t2, n2, r2) => r2 > 0 && e2[r2 - 1] === `\\` ? t2 : `.` + n2);
327
327
  }
328
328
  };
329
- function Ae(e2, t2) {
329
+ function je(e2, t2) {
330
330
  let n2 = e2?.modifiedFields;
331
331
  if (!n2) return null;
332
- let r2 = je(n2);
332
+ let r2 = Me(n2);
333
333
  if (!r2) return null;
334
334
  let { unflattenedModifiedFields: i2, modifiedFieldsManipulator: a2 } = r2;
335
335
  e2 = { ...e2, modifiedFields: i2 };
336
336
  let o2 = t2(e2), s2 = o2?.modifiedFields;
337
337
  if (!s2) return null;
338
- let c2 = Me(s2, a2);
338
+ let c2 = Ne(s2, a2);
339
339
  return c2 === null ? null : (o2.modifiedFields = c2, o2);
340
340
  }
341
- function je(e2) {
341
+ function Me(e2) {
342
342
  if (typeof e2 == `object` && e2 && !Array.isArray(e2)) try {
343
- let t2 = new ke(e2);
343
+ let t2 = new Ae(e2);
344
344
  return { unflattenedModifiedFields: t2.unflatten(), modifiedFieldsManipulator: t2 };
345
345
  } catch {
346
346
  return null;
347
347
  }
348
348
  return null;
349
349
  }
350
- function Me(e2, t2) {
350
+ function Ne(e2, t2) {
351
351
  if (typeof e2 == `object` && e2 && !Array.isArray(e2)) try {
352
352
  return t2.flatten(e2);
353
353
  } catch {
@@ -355,10 +355,10 @@ function Me(e2, t2) {
355
355
  }
356
356
  return null;
357
357
  }
358
- function Ne(e2) {
358
+ function Pe(e2) {
359
359
  return e2.replace(/[-_\s]+(.)?/g, (e3, t2) => t2 ? t2.toUpperCase() : ``).replace(/^./, (e3) => e3.toLowerCase());
360
360
  }
361
- function Pe() {
361
+ function Fe() {
362
362
  return { emit(e2, ...t2) {
363
363
  for (let n2 = 0, r2 = this.events[e2] || [], i2 = r2.length; n2 < i2; n2++) r2[n2](...t2);
364
364
  }, events: {}, on(e2, t2) {
@@ -367,8 +367,8 @@ function Pe() {
367
367
  };
368
368
  } };
369
369
  }
370
- var Fe = (e2) => e2.__type === `event-definition`;
371
- function Ie(e2, t2, n2, r2) {
370
+ var Ie = (e2) => e2.__type === `event-definition`;
371
+ function Le(e2, t2, n2, r2) {
372
372
  let i2;
373
373
  if (e2.isDomainEvent) {
374
374
  let { deletedEvent: e3, actionEvent: t3, createdEvent: a3, updatedEvent: o3, ...s3 } = n2, c2 = { ...r2, ...s3 };
@@ -379,14 +379,14 @@ function Ie(e2, t2, n2, r2) {
379
379
  let e3 = s2.modifiedFields;
380
380
  if (typeof e3 == `object` && e3 && !Array.isArray(e3)) {
381
381
  o2 = structuredClone(i2);
382
- let e4 = Ae(s2, a2);
382
+ let e4 = je(s2, a2);
383
383
  if (e4) return t2(e4);
384
384
  }
385
385
  }
386
386
  return t2(a2(o2));
387
387
  }
388
- function Le(e2) {
389
- let t2 = /* @__PURE__ */ new Map(), n2 = Pe();
388
+ function Re(e2) {
389
+ let t2 = /* @__PURE__ */ new Map(), n2 = Fe();
390
390
  return { initModule(e3) {
391
391
  return (r2) => {
392
392
  let i2 = t2.get(e3.type) ?? [];
@@ -396,7 +396,7 @@ function Le(e2) {
396
396
  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 }))];
397
397
  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(`, `)}`);
398
398
  let l2 = t2.get(r2) ?? [];
399
- return await Promise.all(l2.map(({ eventDefinition: e4, handler: t3 }) => Ie(e4, t3, o2, { instanceId: a2, identity: i2, accountInfo: s2 }))), { instanceId: a2, eventType: r2, payload: o2, identity: i2, accountInfo: s2 };
399
+ return await Promise.all(l2.map(({ eventDefinition: e4, handler: t3 }) => Le(e4, t3, o2, { instanceId: a2, identity: i2, accountInfo: s2 }))), { instanceId: a2, eventType: r2, payload: o2, identity: i2, accountInfo: s2 };
400
400
  }, async processRequest(e3, t3) {
401
401
  let n3 = await e3.text();
402
402
  return this.process(n3, t3);
@@ -415,12 +415,12 @@ function Le(e2) {
415
415
  let n3 = Array.from(t2.keys()).map((e4) => ({ type: e4 }));
416
416
  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(`, `)}`);
417
417
  let r2 = t2.get(e3.eventType) ?? [];
418
- await Promise.all(r2.map(({ eventDefinition: t3, handler: n4 }) => Ie(t3, n4, e3.payload, { instanceId: e3.instanceId, identity: e3.identity })));
418
+ await Promise.all(r2.map(({ eventDefinition: t3, handler: n4 }) => Le(t3, n4, e3.payload, { instanceId: e3.instanceId, identity: e3.identity })));
419
419
  }, apps: { AppInstalled: _(`AppInstalled`)(), AppRemoved: _(`AppRemoved`)() } } };
420
420
  }
421
- var Re = (e2) => e2.__type === `service-plugin-definition`;
422
- function ze(e2) {
423
- let t2 = /* @__PURE__ */ new Map(), n2 = Pe();
421
+ var ze = (e2) => e2.__type === `service-plugin-definition`;
422
+ function Be(e2) {
423
+ let t2 = /* @__PURE__ */ new Map(), n2 = Fe();
424
424
  return { initModule(e3) {
425
425
  return (r2) => {
426
426
  let i2 = t2.get(e3.componentType.toLowerCase()) ?? [];
@@ -461,43 +461,43 @@ function ze(e2) {
461
461
  return s2.transformations.toREST(await c2(s2.transformations.fromREST(e3)));
462
462
  } } };
463
463
  }
464
- var Be = `X-Wix-Consistent`;
464
+ var A = `X-Wix-Consistent`;
465
465
  function Ve(e2) {
466
466
  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) => {
467
- let i3 = o2(), s3 = await a2(), c3 = { ...r3?.headers ?? {}, ...s3.headers, ...e2.host?.essentials?.passThroughHeaders, ...t2[`X-Wix-Consistent`] ? { [Be]: t2[Be] } : {} }, l3 = e2.host?.getErrorHandler?.();
467
+ let i3 = o2(), s3 = await a2(), c3 = { ...r3?.headers ?? {}, ...s3.headers, ...e2.host?.essentials?.passThroughHeaders, ...t2[`X-Wix-Consistent`] ? { [A]: t2[A] } : {} }, l3 = e2.host?.getErrorHandler?.();
468
468
  try {
469
469
  if (typeof n3 == `string` || n3 instanceof URL) {
470
470
  let e3 = await i3(n3, { ...r3, headers: c3 });
471
471
  l3?.handleError(e3, { requestOptions: { url: n3.toString(), method: r3?.method } });
472
472
  let a3 = He(e3);
473
- return a3 && (t2[Be] = a3), e3;
473
+ return a3 && (t2[A] = a3), e3;
474
474
  }
475
475
  {
476
476
  for (let [e4, t3] of Object.entries(c3)) typeof t3 == `string` && n3.headers.set(e4, t3);
477
477
  let e3 = await i3(n3, r3);
478
478
  l3?.handleError(e3, { requestOptions: { url: n3.url, method: r3?.method } });
479
479
  let a3 = He(e3);
480
- return a3 && (t2[Be] = a3), e3;
480
+ return a3 && (t2[A] = a3), e3;
481
481
  }
482
482
  } catch (e3) {
483
483
  throw l3?.handleError(e3, { requestOptions: { url: typeof n3 == `string` || n3 instanceof URL ? n3.toString() : n3.url, method: r3?.method } }), e3;
484
484
  }
485
- }, { client: c2, initModule: l2 } = ze(i2), { client: u2, initModule: d2 } = Le(i2), f2 = async (n3, r3) => {
486
- let i3 = o2(), s3 = await a2(), c3 = S(r3), l3 = await i3(n3, { ...r3, headers: { ...c3, ...t2, ...s3?.headers, ...r3?.headers, ...e2.host?.essentials?.passThroughHeaders, ...t2[`X-Wix-Consistent`] ? { [Be]: t2[Be] } : {} } }), u3 = He(l3);
487
- return u3 && (t2[Be] = u3), l3;
485
+ }, { client: c2, initModule: l2 } = Be(i2), { client: u2, initModule: d2 } = Re(i2), f2 = async (n3, r3) => {
486
+ let i3 = o2(), s3 = await a2(), c3 = S(r3), l3 = await i3(n3, { ...r3, headers: { ...c3, ...t2, ...s3?.headers, ...r3?.headers, ...e2.host?.essentials?.passThroughHeaders, ...t2[`X-Wix-Consistent`] ? { [A]: t2[A] } : {} } }), u3 = He(l3);
487
+ return u3 && (t2[A] = u3), l3;
488
488
  }, p2 = (t3, n3) => {
489
- if (Fe(t3)) return d2(t3);
490
- if (Re(t3)) return l2(t3);
491
- if (ie(t3) && e2.host) return C(t3, e2.host);
489
+ if (Ie(t3)) return d2(t3);
490
+ if (ze(t3)) return l2(t3);
491
+ if (re(t3) && e2.host) return ie(t3, e2.host);
492
492
  if (typeof t3 == `function`) {
493
493
  if (`__type` in t3 && t3.__type === `wix_spi_error`) return t3;
494
494
  let r3 = e2.host?.apiBaseUrl ?? `www.wixapis.com`, o3 = e2.useCDN === void 0 ? i2().shouldUseCDN : e2.useCDN;
495
- return be(w(() => y(t3)) ? ee(t3) : t3, n3 ?? {}, f2, e2.host?.getErrorHandler?.(), (e3, t4) => {
495
+ return xe(T(() => ee(t3)) ? y(t3) : t3, n3 ?? {}, f2, e2.host?.getErrorHandler?.(), (e3, t4) => {
496
496
  let n4 = new URL(e3, `https://${r3}`);
497
497
  return n4.host = r3, n4.protocol = `https`, f2(n4.toString(), t4);
498
498
  }, i2().getActiveToken, async () => a2(), { HTTPHost: r3 }, e2.host?.name, o3, e2.validateRequestSchema);
499
499
  }
500
- return re(t3) ? Object.fromEntries(Object.entries(t3).map(([e3, n4]) => [e3, p2(n4, t3[b])])) : t3;
500
+ return C(t3) ? Object.fromEntries(Object.entries(t3).map(([e3, n4]) => [e3, p2(n4, t3[b])])) : t3;
501
501
  }, m2 = (e3) => {
502
502
  for (let n3 in e3) t2[n3] = e3[n3];
503
503
  };
@@ -3842,32 +3842,32 @@ var jh = function(e2, t2, n2, r2) {
3842
3842
  u2 = Th(e2, d2, 1);
3843
3843
  var v2 = Th(e2, d2 + 1, 3);
3844
3844
  if (d2 += 3, !v2) {
3845
- var ee2 = Dh(d2) + 4, y2 = e2[ee2 - 4] | e2[ee2 - 3] << 8, b2 = ee2 + y2;
3845
+ var y2 = Dh(d2) + 4, ee2 = e2[y2 - 4] | e2[y2 - 3] << 8, b2 = y2 + ee2;
3846
3846
  if (b2 > i2) {
3847
3847
  c2 && Ah(0);
3848
3848
  break;
3849
3849
  }
3850
- s2 && l2(f2 + y2), n2.set(e2.subarray(ee2, b2), f2), t2.b = f2 += y2, t2.p = d2 = b2 * 8, t2.f = u2;
3850
+ s2 && l2(f2 + ee2), n2.set(e2.subarray(y2, b2), f2), t2.b = f2 += ee2, t2.p = d2 = b2 * 8, t2.f = u2;
3851
3851
  continue;
3852
3852
  }
3853
3853
  if (v2 == 1) p2 = xh, m2 = Ch, h2 = 9, g2 = 5;
3854
3854
  else if (v2 == 2) {
3855
3855
  var te2 = Th(e2, d2, 31) + 257, ne2 = Th(e2, d2 + 10, 15) + 4, x2 = te2 + Th(e2, d2 + 5, 31) + 1;
3856
3856
  d2 += 14;
3857
- for (var S2 = new nh(x2), re2 = new nh(19), ie2 = 0; ie2 < ne2; ++ie2) re2[sh[ie2]] = Th(e2, d2 + ie2 * 3, 7);
3857
+ for (var S2 = new nh(x2), C2 = new nh(19), re2 = 0; re2 < ne2; ++re2) C2[sh[re2]] = Th(e2, d2 + re2 * 3, 7);
3858
3858
  d2 += ne2 * 3;
3859
- for (var C2 = wh(re2), ae2 = (1 << C2) - 1, oe2 = _h(re2, C2, 1), ie2 = 0; ie2 < x2; ) {
3860
- var se2 = oe2[Th(e2, d2, ae2)];
3861
- d2 += se2 & 15;
3862
- var ee2 = se2 >> 4;
3863
- if (ee2 < 16) S2[ie2++] = ee2;
3859
+ for (var ie2 = wh(C2), w2 = (1 << ie2) - 1, ae2 = _h(C2, ie2, 1), re2 = 0; re2 < x2; ) {
3860
+ var oe2 = ae2[Th(e2, d2, w2)];
3861
+ d2 += oe2 & 15;
3862
+ var y2 = oe2 >> 4;
3863
+ if (y2 < 16) S2[re2++] = y2;
3864
3864
  else {
3865
- var w2 = 0, T2 = 0;
3866
- for (ee2 == 16 ? (T2 = 3 + Th(e2, d2, 3), d2 += 2, w2 = S2[ie2 - 1]) : ee2 == 17 ? (T2 = 3 + Th(e2, d2, 7), d2 += 3) : ee2 == 18 && (T2 = 11 + Th(e2, d2, 127), d2 += 7); T2--; ) S2[ie2++] = w2;
3865
+ var T2 = 0, E2 = 0;
3866
+ for (y2 == 16 ? (E2 = 3 + Th(e2, d2, 3), d2 += 2, T2 = S2[re2 - 1]) : y2 == 17 ? (E2 = 3 + Th(e2, d2, 7), d2 += 3) : y2 == 18 && (E2 = 11 + Th(e2, d2, 127), d2 += 7); E2--; ) S2[re2++] = T2;
3867
3867
  }
3868
3868
  }
3869
- var ce2 = S2.subarray(0, te2), E2 = S2.subarray(te2);
3870
- h2 = wh(ce2), g2 = wh(E2), p2 = _h(ce2, h2, 1), m2 = _h(E2, g2, 1);
3869
+ var se2 = S2.subarray(0, te2), ce2 = S2.subarray(te2);
3870
+ h2 = wh(se2), g2 = wh(ce2), p2 = _h(se2, h2, 1), m2 = _h(ce2, g2, 1);
3871
3871
  } else Ah(1);
3872
3872
  if (d2 > _2) {
3873
3873
  c2 && Ah(0);
@@ -3875,43 +3875,43 @@ var jh = function(e2, t2, n2, r2) {
3875
3875
  }
3876
3876
  }
3877
3877
  s2 && l2(f2 + 131072);
3878
- for (var le2 = (1 << h2) - 1, D2 = (1 << g2) - 1, ue2 = d2; ; ue2 = d2) {
3879
- var w2 = p2[Eh(e2, d2) & le2], O2 = w2 >> 4;
3880
- if (d2 += w2 & 15, d2 > _2) {
3878
+ for (var le2 = (1 << h2) - 1, ue2 = (1 << g2) - 1, de2 = d2; ; de2 = d2) {
3879
+ var T2 = p2[Eh(e2, d2) & le2], fe2 = T2 >> 4;
3880
+ if (d2 += T2 & 15, d2 > _2) {
3881
3881
  c2 && Ah(0);
3882
3882
  break;
3883
3883
  }
3884
- if (w2 || Ah(2), O2 < 256) n2[f2++] = O2;
3885
- else if (O2 == 256) {
3886
- ue2 = d2, p2 = null;
3884
+ if (T2 || Ah(2), fe2 < 256) n2[f2++] = fe2;
3885
+ else if (fe2 == 256) {
3886
+ de2 = d2, p2 = null;
3887
3887
  break;
3888
3888
  } else {
3889
- var de2 = O2 - 254;
3890
- if (O2 > 264) {
3891
- var ie2 = O2 - 257, k2 = ah[ie2];
3892
- de2 = Th(e2, d2, (1 << k2) - 1) + uh[ie2], d2 += k2;
3889
+ var D2 = fe2 - 254;
3890
+ if (fe2 > 264) {
3891
+ var re2 = fe2 - 257, O2 = ah[re2];
3892
+ D2 = Th(e2, d2, (1 << O2) - 1) + uh[re2], d2 += O2;
3893
3893
  }
3894
- var fe2 = m2[Eh(e2, d2) & D2], pe2 = fe2 >> 4;
3895
- fe2 || Ah(3), d2 += fe2 & 15;
3896
- var E2 = ph[pe2];
3897
- if (pe2 > 3) {
3898
- var k2 = oh[pe2];
3899
- E2 += Eh(e2, d2) & (1 << k2) - 1, d2 += k2;
3894
+ var pe2 = m2[Eh(e2, d2) & ue2], me2 = pe2 >> 4;
3895
+ pe2 || Ah(3), d2 += pe2 & 15;
3896
+ var ce2 = ph[me2];
3897
+ if (me2 > 3) {
3898
+ var O2 = oh[me2];
3899
+ ce2 += Eh(e2, d2) & (1 << O2) - 1, d2 += O2;
3900
3900
  }
3901
3901
  if (d2 > _2) {
3902
3902
  c2 && Ah(0);
3903
3903
  break;
3904
3904
  }
3905
3905
  s2 && l2(f2 + 131072);
3906
- var me2 = f2 + de2;
3907
- if (f2 < E2) {
3908
- var he2 = a2 - E2, ge2 = Math.min(E2, me2);
3909
- for (he2 + f2 < 0 && Ah(3); f2 < ge2; ++f2) n2[f2] = r2[he2 + f2];
3906
+ var he2 = f2 + D2;
3907
+ if (f2 < ce2) {
3908
+ var ge2 = a2 - ce2, _e2 = Math.min(ce2, he2);
3909
+ for (ge2 + f2 < 0 && Ah(3); f2 < _e2; ++f2) n2[f2] = r2[ge2 + f2];
3910
3910
  }
3911
- for (; f2 < me2; ++f2) n2[f2] = n2[f2 - E2];
3911
+ for (; f2 < he2; ++f2) n2[f2] = n2[f2 - ce2];
3912
3912
  }
3913
3913
  }
3914
- t2.l = p2, t2.p = ue2, t2.b = f2, t2.f = u2, p2 && (u2 = 1, t2.m = h2, t2.d = m2, t2.n = g2);
3914
+ t2.l = p2, t2.p = de2, t2.b = f2, t2.f = u2, p2 && (u2 = 1, t2.m = h2, t2.d = m2, t2.n = g2);
3915
3915
  } while (!u2);
3916
3916
  return f2 != n2.length && o2 ? Oh(n2, 0, f2) : n2.subarray(0, f2);
3917
3917
  };
@@ -3950,12 +3950,12 @@ var Ph = function(e2, t2) {
3950
3950
  else break;
3951
3951
  }
3952
3952
  for (h2 >>= g2; h2 > 0; ) {
3953
- var ee2 = a2[r2].s;
3954
- p2[ee2] < t2 ? h2 -= 1 << t2 - p2[ee2]++ - 1 : ++r2;
3953
+ var y2 = a2[r2].s;
3954
+ p2[y2] < t2 ? h2 -= 1 << t2 - p2[y2]++ - 1 : ++r2;
3955
3955
  }
3956
3956
  for (; r2 >= 0 && h2; --r2) {
3957
- var y2 = a2[r2].s;
3958
- p2[y2] == t2 && (--p2[y2], ++h2);
3957
+ var ee2 = a2[r2].s;
3958
+ p2[ee2] == t2 && (--p2[ee2], ++h2);
3959
3959
  }
3960
3960
  m2 = t2;
3961
3961
  }
@@ -3994,33 +3994,33 @@ var Rh = function(e2, t2, n2) {
3994
3994
  };
3995
3995
  var zh = function(e2, t2, n2, r2, i2, a2, o2, s2, c2, l2, u2) {
3996
3996
  Mh(t2, u2++, n2), ++i2[256];
3997
- for (var d2 = Ph(i2, 15), f2 = d2.t, p2 = d2.l, m2 = Ph(a2, 15), h2 = m2.t, g2 = m2.l, _2 = Ih(f2), v2 = _2.c, ee2 = _2.n, y2 = Ih(h2), b2 = y2.c, te2 = y2.n, ne2 = new rh(19), x2 = 0; x2 < v2.length; ++x2) ++ne2[v2[x2] & 31];
3997
+ for (var d2 = Ph(i2, 15), f2 = d2.t, p2 = d2.l, m2 = Ph(a2, 15), h2 = m2.t, g2 = m2.l, _2 = Ih(f2), v2 = _2.c, y2 = _2.n, ee2 = Ih(h2), b2 = ee2.c, te2 = ee2.n, ne2 = new rh(19), x2 = 0; x2 < v2.length; ++x2) ++ne2[v2[x2] & 31];
3998
3998
  for (var x2 = 0; x2 < b2.length; ++x2) ++ne2[b2[x2] & 31];
3999
- for (var S2 = Ph(ne2, 7), re2 = S2.t, ie2 = S2.l, C2 = 19; C2 > 4 && !re2[sh[C2 - 1]]; --C2) ;
4000
- var ae2 = l2 + 5 << 3, oe2 = Lh(i2, vh) + Lh(a2, yh) + o2, se2 = Lh(i2, f2) + Lh(a2, h2) + o2 + 14 + 3 * C2 + Lh(ne2, re2) + 2 * ne2[16] + 3 * ne2[17] + 7 * ne2[18];
4001
- if (c2 >= 0 && ae2 <= oe2 && ae2 <= se2) return Rh(t2, u2, e2.subarray(c2, c2 + l2));
4002
- var w2, T2, ce2, E2;
4003
- if (Mh(t2, u2, 1 + (se2 < oe2)), u2 += 2, se2 < oe2) {
4004
- w2 = _h(f2, p2, 0), T2 = f2, ce2 = _h(h2, g2, 0), E2 = h2;
4005
- var le2 = _h(re2, ie2, 0);
4006
- Mh(t2, u2, ee2 - 257), Mh(t2, u2 + 5, te2 - 1), Mh(t2, u2 + 10, C2 - 4), u2 += 14;
4007
- for (var x2 = 0; x2 < C2; ++x2) Mh(t2, u2 + 3 * x2, re2[sh[x2]]);
4008
- u2 += 3 * C2;
4009
- for (var D2 = [v2, b2], ue2 = 0; ue2 < 2; ++ue2) for (var O2 = D2[ue2], x2 = 0; x2 < O2.length; ++x2) {
4010
- var de2 = O2[x2] & 31;
4011
- Mh(t2, u2, le2[de2]), u2 += re2[de2], de2 > 15 && (Mh(t2, u2, O2[x2] >> 5 & 127), u2 += O2[x2] >> 12);
3999
+ for (var S2 = Ph(ne2, 7), C2 = S2.t, re2 = S2.l, ie2 = 19; ie2 > 4 && !C2[sh[ie2 - 1]]; --ie2) ;
4000
+ var w2 = l2 + 5 << 3, ae2 = Lh(i2, vh) + Lh(a2, yh) + o2, oe2 = Lh(i2, f2) + Lh(a2, h2) + o2 + 14 + 3 * ie2 + Lh(ne2, C2) + 2 * ne2[16] + 3 * ne2[17] + 7 * ne2[18];
4001
+ if (c2 >= 0 && w2 <= ae2 && w2 <= oe2) return Rh(t2, u2, e2.subarray(c2, c2 + l2));
4002
+ var T2, E2, se2, ce2;
4003
+ if (Mh(t2, u2, 1 + (oe2 < ae2)), u2 += 2, oe2 < ae2) {
4004
+ T2 = _h(f2, p2, 0), E2 = f2, se2 = _h(h2, g2, 0), ce2 = h2;
4005
+ var le2 = _h(C2, re2, 0);
4006
+ Mh(t2, u2, y2 - 257), Mh(t2, u2 + 5, te2 - 1), Mh(t2, u2 + 10, ie2 - 4), u2 += 14;
4007
+ for (var x2 = 0; x2 < ie2; ++x2) Mh(t2, u2 + 3 * x2, C2[sh[x2]]);
4008
+ u2 += 3 * ie2;
4009
+ for (var ue2 = [v2, b2], de2 = 0; de2 < 2; ++de2) for (var fe2 = ue2[de2], x2 = 0; x2 < fe2.length; ++x2) {
4010
+ var D2 = fe2[x2] & 31;
4011
+ Mh(t2, u2, le2[D2]), u2 += C2[D2], D2 > 15 && (Mh(t2, u2, fe2[x2] >> 5 & 127), u2 += fe2[x2] >> 12);
4012
4012
  }
4013
- } else w2 = bh, T2 = vh, ce2 = Sh, E2 = yh;
4013
+ } else T2 = bh, E2 = vh, se2 = Sh, ce2 = yh;
4014
4014
  for (var x2 = 0; x2 < s2; ++x2) {
4015
- var k2 = r2[x2];
4016
- if (k2 > 255) {
4017
- var de2 = k2 >> 18 & 31;
4018
- Nh(t2, u2, w2[de2 + 257]), u2 += T2[de2 + 257], de2 > 7 && (Mh(t2, u2, k2 >> 23 & 31), u2 += ah[de2]);
4019
- var fe2 = k2 & 31;
4020
- Nh(t2, u2, ce2[fe2]), u2 += E2[fe2], fe2 > 3 && (Nh(t2, u2, k2 >> 5 & 8191), u2 += oh[fe2]);
4021
- } else Nh(t2, u2, w2[k2]), u2 += T2[k2];
4022
- }
4023
- return Nh(t2, u2, w2[256]), u2 + T2[256];
4015
+ var O2 = r2[x2];
4016
+ if (O2 > 255) {
4017
+ var D2 = O2 >> 18 & 31;
4018
+ Nh(t2, u2, T2[D2 + 257]), u2 += E2[D2 + 257], D2 > 7 && (Mh(t2, u2, O2 >> 23 & 31), u2 += ah[D2]);
4019
+ var pe2 = O2 & 31;
4020
+ Nh(t2, u2, se2[pe2]), u2 += ce2[pe2], pe2 > 3 && (Nh(t2, u2, O2 >> 5 & 8191), u2 += oh[pe2]);
4021
+ } else Nh(t2, u2, T2[O2]), u2 += E2[O2];
4022
+ }
4023
+ return Nh(t2, u2, T2[256]), u2 + E2[256];
4024
4024
  };
4025
4025
  var Bh = new ih([65540, 131080, 131088, 131104, 262176, 1048704, 1048832, 2114560, 2117632]);
4026
4026
  var Vh = new nh(0);
@@ -4028,44 +4028,44 @@ var Hh = function(e2, t2, n2, r2, i2, a2) {
4028
4028
  var o2 = a2.z || e2.length, s2 = new nh(r2 + o2 + 5 * (1 + Math.ceil(o2 / 7e3)) + i2), c2 = s2.subarray(r2, s2.length - i2), l2 = a2.l, u2 = (a2.r || 0) & 7;
4029
4029
  if (t2) {
4030
4030
  u2 && (c2[0] = a2.r >> 3);
4031
- for (var d2 = Bh[t2 - 1], f2 = d2 >> 13, p2 = d2 & 8191, m2 = (1 << n2) - 1, h2 = a2.p || new rh(32768), g2 = a2.h || new rh(m2 + 1), _2 = Math.ceil(n2 / 3), v2 = 2 * _2, ee2 = function(t3) {
4031
+ for (var d2 = Bh[t2 - 1], f2 = d2 >> 13, p2 = d2 & 8191, m2 = (1 << n2) - 1, h2 = a2.p || new rh(32768), g2 = a2.h || new rh(m2 + 1), _2 = Math.ceil(n2 / 3), v2 = 2 * _2, y2 = function(t3) {
4032
4032
  return (e2[t3] ^ e2[t3 + 1] << _2 ^ e2[t3 + 2] << v2) & m2;
4033
- }, y2 = new ih(25e3), b2 = new rh(288), te2 = new rh(32), ne2 = 0, x2 = 0, S2 = a2.i || 0, re2 = 0, ie2 = a2.w || 0, C2 = 0; S2 + 2 < o2; ++S2) {
4034
- var ae2 = ee2(S2), oe2 = S2 & 32767, se2 = g2[ae2];
4035
- if (h2[oe2] = se2, g2[ae2] = oe2, ie2 <= S2) {
4036
- var w2 = o2 - S2;
4037
- if ((ne2 > 7e3 || re2 > 24576) && (w2 > 423 || !l2)) {
4038
- u2 = zh(e2, c2, 0, y2, b2, te2, x2, re2, C2, S2 - C2, u2), re2 = ne2 = x2 = 0, C2 = S2;
4039
- for (var T2 = 0; T2 < 286; ++T2) b2[T2] = 0;
4040
- for (var T2 = 0; T2 < 30; ++T2) te2[T2] = 0;
4033
+ }, ee2 = new ih(25e3), b2 = new rh(288), te2 = new rh(32), ne2 = 0, x2 = 0, S2 = a2.i || 0, C2 = 0, re2 = a2.w || 0, ie2 = 0; S2 + 2 < o2; ++S2) {
4034
+ var w2 = y2(S2), ae2 = S2 & 32767, oe2 = g2[w2];
4035
+ if (h2[ae2] = oe2, g2[w2] = ae2, re2 <= S2) {
4036
+ var T2 = o2 - S2;
4037
+ if ((ne2 > 7e3 || C2 > 24576) && (T2 > 423 || !l2)) {
4038
+ u2 = zh(e2, c2, 0, ee2, b2, te2, x2, C2, ie2, S2 - ie2, u2), C2 = ne2 = x2 = 0, ie2 = S2;
4039
+ for (var E2 = 0; E2 < 286; ++E2) b2[E2] = 0;
4040
+ for (var E2 = 0; E2 < 30; ++E2) te2[E2] = 0;
4041
4041
  }
4042
- var ce2 = 2, E2 = 0, le2 = p2, D2 = oe2 - se2 & 32767;
4043
- if (w2 > 2 && ae2 == ee2(S2 - D2)) for (var ue2 = Math.min(f2, w2) - 1, O2 = Math.min(32767, S2), de2 = Math.min(258, w2); D2 <= O2 && --le2 && oe2 != se2; ) {
4044
- if (e2[S2 + ce2] == e2[S2 + ce2 - D2]) {
4045
- for (var k2 = 0; k2 < de2 && e2[S2 + k2] == e2[S2 + k2 - D2]; ++k2) ;
4046
- if (k2 > ce2) {
4047
- if (ce2 = k2, E2 = D2, k2 > ue2) break;
4048
- for (var fe2 = Math.min(D2, k2 - 2), pe2 = 0, T2 = 0; T2 < fe2; ++T2) {
4049
- var me2 = S2 - D2 + T2 & 32767, he2 = me2 - h2[me2] & 32767;
4050
- he2 > pe2 && (pe2 = he2, se2 = me2);
4042
+ var se2 = 2, ce2 = 0, le2 = p2, ue2 = ae2 - oe2 & 32767;
4043
+ if (T2 > 2 && w2 == y2(S2 - ue2)) for (var de2 = Math.min(f2, T2) - 1, fe2 = Math.min(32767, S2), D2 = Math.min(258, T2); ue2 <= fe2 && --le2 && ae2 != oe2; ) {
4044
+ if (e2[S2 + se2] == e2[S2 + se2 - ue2]) {
4045
+ for (var O2 = 0; O2 < D2 && e2[S2 + O2] == e2[S2 + O2 - ue2]; ++O2) ;
4046
+ if (O2 > se2) {
4047
+ if (se2 = O2, ce2 = ue2, O2 > de2) break;
4048
+ for (var pe2 = Math.min(ue2, O2 - 2), me2 = 0, E2 = 0; E2 < pe2; ++E2) {
4049
+ var he2 = S2 - ue2 + E2 & 32767, ge2 = he2 - h2[he2] & 32767;
4050
+ ge2 > me2 && (me2 = ge2, oe2 = he2);
4051
4051
  }
4052
4052
  }
4053
4053
  }
4054
- oe2 = se2, se2 = h2[oe2], D2 += oe2 - se2 & 32767;
4054
+ ae2 = oe2, oe2 = h2[ae2], ue2 += ae2 - oe2 & 32767;
4055
4055
  }
4056
- if (E2) {
4057
- y2[re2++] = 268435456 | dh[ce2] << 18 | mh[E2];
4058
- var ge2 = dh[ce2] & 31, _e2 = mh[E2] & 31;
4059
- x2 += ah[ge2] + oh[_e2], ++b2[257 + ge2], ++te2[_e2], ie2 = S2 + ce2, ++ne2;
4060
- } else y2[re2++] = e2[S2], ++b2[e2[S2]];
4056
+ if (ce2) {
4057
+ ee2[C2++] = 268435456 | dh[se2] << 18 | mh[ce2];
4058
+ var _e2 = dh[se2] & 31, ve2 = mh[ce2] & 31;
4059
+ x2 += ah[_e2] + oh[ve2], ++b2[257 + _e2], ++te2[ve2], re2 = S2 + se2, ++ne2;
4060
+ } else ee2[C2++] = e2[S2], ++b2[e2[S2]];
4061
4061
  }
4062
4062
  }
4063
- for (S2 = Math.max(S2, ie2); S2 < o2; ++S2) y2[re2++] = e2[S2], ++b2[e2[S2]];
4064
- u2 = zh(e2, c2, l2, y2, b2, te2, x2, re2, C2, S2 - C2, u2), l2 || (a2.r = u2 & 7 | c2[u2 / 8 | 0] << 3, u2 -= 7, a2.h = g2, a2.p = h2, a2.i = S2, a2.w = ie2);
4063
+ for (S2 = Math.max(S2, re2); S2 < o2; ++S2) ee2[C2++] = e2[S2], ++b2[e2[S2]];
4064
+ u2 = zh(e2, c2, l2, ee2, b2, te2, x2, C2, ie2, S2 - ie2, u2), l2 || (a2.r = u2 & 7 | c2[u2 / 8 | 0] << 3, u2 -= 7, a2.h = g2, a2.p = h2, a2.i = S2, a2.w = re2);
4065
4065
  } else {
4066
4066
  for (var S2 = a2.w || 0; S2 < o2 + l2; S2 += 65535) {
4067
- var ve2 = S2 + 65535;
4068
- ve2 >= o2 && (c2[u2 / 8 | 0] = l2, ve2 = o2), u2 = Rh(c2, u2 + 1, e2.subarray(S2, ve2));
4067
+ var ye2 = S2 + 65535;
4068
+ ye2 >= o2 && (c2[u2 / 8 | 0] = l2, ye2 = o2), u2 = Rh(c2, u2 + 1, e2.subarray(S2, ye2));
4069
4069
  }
4070
4070
  a2.i = o2;
4071
4071
  }
@@ -4904,8 +4904,8 @@ function gy({ bookingsSettings: e2, children: n2 }) {
4904
4904
  let r2 = g_(), [i2] = (0, import_react.useState)(() => e2 ? null : P_({ key: C_(), warmupData: r2, fetchData: oy }));
4905
4905
  return e2 ? (0, import_jsx_runtime.jsx)(cy.Provider, { value: { isLoading: false, ...e2 }, children: n2 }) : (0, import_jsx_runtime.jsx)(import_react.Suspense, { fallback: (0, import_jsx_runtime.jsx)(cy.Provider, { value: sy, children: n2 }), children: (0, import_jsx_runtime.jsx)(hy, { settingsPromise: i2, children: n2 }) });
4906
4906
  }
4907
- function _y({ isLoading: e2, hasError: t2, bookingsSettingsLoading: n2, rescheduleRequest: r2 = null, children: i2 }) {
4908
- let a2 = r2 ? { status: `loading`, booking: null, validUntil: null } : null, o2 = { service: null, serviceName: null, serviceDescription: null, serviceTagLine: null, serviceDefaultDuration: null, serviceImage: null, serviceSlug: null, servicePageLink: null, serviceId: null, serviceType: null, servicePrice: tm, isVariedService: false, serviceOptionsAndVariants: null, pricingOption: null, isLoadingServiceOptionsAndVariants: e2, hasAddOns: false, isConferenceEnabled: false, offeredDays: [], courseAvailability: null, courseStartDate: null, courseEndDate: null, staffMembers: [], coverImage: void 0, gallery: [], serviceLocations: [], policyDescription: null, serviceBookability: { state: Ip.AVAILABLE, isAvailableForBooking: false, bookingOpensAt: null }, displayTimeZone: `UTC`, isAvailableForBooking: () => false, hasPolicyDescription: () => false, hasCoverImage: () => false, hasGalleryImages: () => false, isVariantDuration: () => false, isLoading: e2, hasError: t2, locale: `en-US`, selectStaffMember: () => {
4907
+ function _y({ isLoading: e2, hasError: t2, bookingsSettingsLoading: n2, rescheduleRequest: r2 = null, editingSurface: i2 = false, children: a2 }) {
4908
+ let o2 = r2 ? { status: `loading`, booking: null, validUntil: null } : null, s2 = { service: null, serviceName: null, serviceDescription: null, serviceTagLine: null, serviceDefaultDuration: null, serviceImage: null, serviceSlug: null, servicePageLink: null, serviceId: null, serviceType: null, servicePrice: tm, isVariedService: false, serviceOptionsAndVariants: null, pricingOption: null, isLoadingServiceOptionsAndVariants: e2, hasAddOns: false, isConferenceEnabled: false, offeredDays: [], courseAvailability: null, courseStartDate: null, courseEndDate: null, staffMembers: [], coverImage: void 0, gallery: [], serviceLocations: [], policyDescription: null, serviceBookability: { state: Ip.AVAILABLE, isAvailableForBooking: false, bookingOpensAt: null }, displayTimeZone: `UTC`, isAvailableForBooking: () => false, hasPolicyDescription: () => false, hasCoverImage: () => false, hasGalleryImages: () => false, isVariantDuration: () => false, isLoading: e2, hasError: t2, locale: `en-US`, selectStaffMember: () => {
4909
4909
  }, clearSelection: () => {
4910
4910
  }, clearStaffMember: () => {
4911
4911
  }, selection: Dg(``), selectionTimezone: void 0, setVariant: () => {
@@ -4918,16 +4918,16 @@ function _y({ isLoading: e2, hasError: t2, bookingsSettingsLoading: n2, reschedu
4918
4918
  }, draftRevision: 0, wantsPromoCode: false, setWantsPromoCode: () => {
4919
4919
  }, withSelectionParam: (e3) => e3, serviceCtaState: Jp.BOOK, navigateToNextPage: () => {
4920
4920
  }, navigateToMultiServiceForm: () => {
4921
- }, resolveNextPageHref: () => null, isNavigating: false, openPreferences: () => Promise.resolve(), multiServiceAppointmentsEnabled: false, isMultiServiceAppointment: false, multiServiceAppointmentServices: [], multiServiceAppointmentSelections: [], multiServiceAppointmentOptionsAndVariants: {}, multiServiceAppointmentVariantsStatus: `ready`, bookingsSettingsLoading: n2, reschedule: a2, rescheduleBooking: async () => ({ outcome: `failed` }), goHomeAfterReschedule: () => {
4921
+ }, resolveNextPageHref: () => null, isNavigating: false, editingSurface: i2, openPreferences: () => Promise.resolve(), multiServiceAppointmentsEnabled: false, isMultiServiceAppointment: false, multiServiceAppointmentServices: [], multiServiceAppointmentSelections: [], multiServiceAppointmentOptionsAndVariants: {}, multiServiceAppointmentVariantsStatus: `ready`, bookingsSettingsLoading: n2, reschedule: o2, rescheduleBooking: async () => ({ outcome: `failed` }), goHomeAfterReschedule: () => {
4922
4922
  }, canRescheduleToPick: false };
4923
- return (0, import_jsx_runtime.jsx)(Xy.Provider, { value: o2, children: i2 });
4923
+ return (0, import_jsx_runtime.jsx)(Xy.Provider, { value: s2, children: a2 });
4924
4924
  }
4925
- function vy({ rescheduleRequest: e2, children: t2 }) {
4926
- return (0, import_jsx_runtime.jsx)(fy, { children: (0, import_jsx_runtime.jsx)(_y, { isLoading: true, hasError: false, bookingsSettingsLoading: true, rescheduleRequest: e2, children: t2 }) });
4925
+ function vy({ rescheduleRequest: e2, editingSurface: t2, children: n2 }) {
4926
+ return (0, import_jsx_runtime.jsx)(fy, { children: (0, import_jsx_runtime.jsx)(_y, { isLoading: true, hasError: false, bookingsSettingsLoading: true, rescheduleRequest: e2, editingSurface: t2, children: n2 }) });
4927
4927
  }
4928
- function yy({ rescheduleRequest: e2, children: t2 }) {
4929
- let n2 = dy();
4930
- return (0, import_jsx_runtime.jsx)(_y, { isLoading: false, hasError: true, bookingsSettingsLoading: n2, rescheduleRequest: e2, children: t2 });
4928
+ function yy({ rescheduleRequest: e2, editingSurface: t2, children: n2 }) {
4929
+ let r2 = dy();
4930
+ return (0, import_jsx_runtime.jsx)(_y, { isLoading: false, hasError: true, bookingsSettingsLoading: r2, rescheduleRequest: e2, editingSurface: t2, children: n2 });
4931
4931
  }
4932
4932
  var { RateType: by } = Xo;
4933
4933
  function xy(e2, t2) {
@@ -5112,203 +5112,203 @@ var pb = () => ({ ...ub(), isMultiServiceAppointment: true });
5112
5112
  var mb = [];
5113
5113
  var hb = [];
5114
5114
  var gb = {};
5115
- function _b({ servicePromise: e2, refreshSignal: n2, injected: r2, rescheduleRequest: i2 = null, bookingsSettings: a2, children: o2 }) {
5116
- return (0, import_jsx_runtime.jsx)(import_react.Suspense, { fallback: (0, import_jsx_runtime.jsx)(vy, { rescheduleRequest: i2, children: o2 }), children: (0, import_jsx_runtime.jsx)(gy, { bookingsSettings: a2, children: (0, import_jsx_runtime.jsx)(va, { fallback: (0, import_jsx_runtime.jsx)(yy, { rescheduleRequest: i2, children: o2 }), feature: ma.service, children: (0, import_jsx_runtime.jsx)(xb, { servicePromise: e2, refreshSignal: n2, injected: r2, rescheduleRequest: i2, children: o2 }) }) }) });
5115
+ function _b({ servicePromise: e2, refreshSignal: n2, injected: r2, rescheduleRequest: i2 = null, editingSurface: a2 = false, bookingsSettings: o2, children: s2 }) {
5116
+ return (0, import_jsx_runtime.jsx)(import_react.Suspense, { fallback: (0, import_jsx_runtime.jsx)(vy, { rescheduleRequest: i2, editingSurface: a2, children: s2 }), children: (0, import_jsx_runtime.jsx)(gy, { bookingsSettings: o2, children: (0, import_jsx_runtime.jsx)(va, { fallback: (0, import_jsx_runtime.jsx)(yy, { rescheduleRequest: i2, editingSurface: a2, children: s2 }), feature: ma.service, children: (0, import_jsx_runtime.jsx)(xb, { servicePromise: e2, refreshSignal: n2, injected: r2, rescheduleRequest: i2, editingSurface: a2, children: s2 }) }) }) });
5117
5117
  }
5118
5118
  var vb = (e2) => e2 ?? void 0;
5119
5119
  var yb = () => void 0;
5120
5120
  function bb(e2, t2) {
5121
5121
  ga(e2, { feature: ma.service, action: `fetch-service-variants`, level: `warning`, contexts: { service: { serviceId: t2 } } });
5122
5122
  }
5123
- function xb({ servicePromise: e2, refreshSignal: t2 = 0, injected: n2, rescheduleRequest: a2 = null, children: u2 }) {
5124
- let d2 = n2 ? null : e2 ? ja(e2) : null, f2 = n2?.service ?? d2?.service ?? null, m2 = d2?.hasError ?? false, h2 = d2?.isMultiServiceAppointment ?? false, g2 = d2?.multiServiceAppointmentServices ?? mb, _2 = f_(), { navigate: v2, navigateToHref: ee2, resolvePath: y2, toHref: b2, getBookingFormPath: te2 } = ny(), ne2 = Ry(), x2 = ff(nf.SERVICE), { getParsedUrl: S2, pushUrl: re2, searchParams: ie2 } = Aa(), C2 = (0, import_react.useRef)(S2);
5125
- C2.current = S2;
5123
+ function xb({ servicePromise: e2, refreshSignal: t2 = 0, injected: n2, rescheduleRequest: a2 = null, editingSurface: u2 = false, children: d2 }) {
5124
+ let f2 = n2 ? null : e2 ? ja(e2) : null, m2 = n2?.service ?? f2?.service ?? null, h2 = f2?.hasError ?? false, g2 = f2?.isMultiServiceAppointment ?? false, _2 = f2?.multiServiceAppointmentServices ?? mb, v2 = f_(), { navigate: y2, navigateToHref: ee2, resolvePath: b2, toHref: te2, getBookingFormPath: ne2 } = ny(), x2 = Ry(), S2 = ff(nf.SERVICE), { getParsedUrl: C2, pushUrl: re2, searchParams: ie2 } = Aa(), w2 = (0, import_react.useRef)(C2);
5125
+ w2.current = C2;
5126
5126
  let ae2 = (0, import_react.useRef)(re2);
5127
5127
  ae2.current = re2;
5128
- let oe2 = g_(), se2 = (0, import_react.useRef)(oe2);
5129
- se2.current = oe2;
5130
- let [w2, T2] = (0, import_react.useState)(Gy), ce2 = Hy(), E2 = (e3, t3) => a2 ? Dg(e3) : nb(e3, t3), le2 = (0, import_react.useRef)(E2);
5131
- le2.current = E2;
5132
- let [D2, ue2] = (0, import_react.useState)(() => E2(f2?._id ?? ``, S2().searchParams)), O2 = (0, import_react.useRef)(D2), de2 = (0, import_react.useRef)(void 0), k2 = (0, import_react.useRef)(true), fe2 = (0, import_react.useRef)(false), pe2 = (0, import_react.useRef)(null), [me2, he2] = (0, import_react.useState)(null), ge2 = (0, import_react.useRef)(me2), [_e2, ve2] = (0, import_react.useState)(0), A2 = f2?._id ?? null, ye2 = (0, import_react.useMemo)(() => {
5128
+ let oe2 = g_(), T2 = (0, import_react.useRef)(oe2);
5129
+ T2.current = oe2;
5130
+ let [E2, se2] = (0, import_react.useState)(Gy), ce2 = Hy(), le2 = (e3, t3) => a2 ? Dg(e3) : nb(e3, t3), ue2 = (0, import_react.useRef)(le2);
5131
+ ue2.current = le2;
5132
+ let [de2, fe2] = (0, import_react.useState)(() => le2(m2?._id ?? ``, C2().searchParams)), D2 = (0, import_react.useRef)(de2), O2 = (0, import_react.useRef)(void 0), pe2 = (0, import_react.useRef)(true), me2 = (0, import_react.useRef)(false), he2 = (0, import_react.useRef)(null), [ge2, _e2] = (0, import_react.useState)(null), ve2 = (0, import_react.useRef)(ge2), [ye2, be2] = (0, import_react.useState)(0), k2 = m2?._id ?? null, xe2 = (0, import_react.useMemo)(() => {
5133
5133
  if (!a2) return null;
5134
- let { booking: e3 } = w2;
5135
- if (w2.status !== `ready` || !e3) return { ...w2 };
5136
- let t3 = e3.kind === `other` ? `notReschedulable` : e3.serviceId === A2 ? `ready` : `wrongService`;
5137
- return { ...w2, status: t3 };
5138
- }, [a2, w2, A2]), be2 = f2?.schedule?._id ?? null, xe2 = f2?.type ?? null, Se2 = (0, import_react.useMemo)(() => {
5139
- if (!f2) return null;
5140
- let e3 = y2(`servicePage`, { slug: f2.mainSlug?.name ?? null, serviceId: f2._id ?? null });
5141
- return e3 ? { href: b2(e3), target: `_self` } : null;
5142
- }, [f2, y2, b2]), [Ce2, we2] = (0, import_react.useState)(ab), Te2 = n2 ? n2.masterEvents : Ce2, Ee2 = my(), De2 = uy(), Oe2 = De2.isLoading, ke2 = !De2.isLoading && De2.multiServiceAppointmentsEnabled;
5134
+ let { booking: e3 } = E2;
5135
+ if (E2.status !== `ready` || !e3) return { ...E2 };
5136
+ let t3 = e3.kind === `other` ? `notReschedulable` : e3.serviceId === k2 ? `ready` : `wrongService`;
5137
+ return { ...E2, status: t3 };
5138
+ }, [a2, E2, k2]), Se2 = m2?.schedule?._id ?? null, Ce2 = m2?.type ?? null, we2 = (0, import_react.useMemo)(() => {
5139
+ if (!m2) return null;
5140
+ let e3 = b2(`servicePage`, { slug: m2.mainSlug?.name ?? null, serviceId: m2._id ?? null });
5141
+ return e3 ? { href: te2(e3), target: `_self` } : null;
5142
+ }, [m2, b2, te2]), [Te2, Ee2] = (0, import_react.useState)(ab), De2 = n2 ? n2.masterEvents : Te2, Oe2 = my(), ke2 = uy(), Ae2 = ke2.isLoading, je2 = !ke2.isLoading && ke2.multiServiceAppointmentsEnabled;
5143
5143
  (0, import_react.useEffect)(() => {
5144
- if (!a2 || Oe2) return;
5144
+ if (!a2 || Ae2) return;
5145
5145
  let e3 = false, t3 = Yy(a2, ce2, (t4) => {
5146
- e3 || T2(t4);
5146
+ e3 || se2(t4);
5147
5147
  });
5148
5148
  return () => {
5149
5149
  e3 = true, t3();
5150
5150
  };
5151
- }, [a2, Oe2, ce2]);
5152
- let Ae2 = !n2 && !!f2 && Md(f2), je2 = Ae2 && A2 ? x_(A2, t2) : null, Me2 = (typeof window > `u` && je2 && A2 && oe2.scope && !Oe2 ? ja(Pa(P_({ key: je2, warmupData: oe2, fetchData: () => Lf(A2).catch((e3) => (bb(e3, A2), null)) }), vb, yb)) : void 0) ?? (je2 ? O_(je2) : void 0), [Ne2, Pe2] = (0, import_react.useState)(() => Me2 ?? null), [Fe2, Ie2] = (0, import_react.useState)(() => Me2 ? je2 : null), Le2 = je2 !== null && Fe2 !== je2, Re2 = n2 ? n2.serviceOptionsAndVariants : Ae2 ? Ne2 : null;
5151
+ }, [a2, Ae2, ce2]);
5152
+ let Me2 = !n2 && !!m2 && Md(m2), Ne2 = Me2 && k2 ? x_(k2, t2) : null, Pe2 = (typeof window > `u` && Ne2 && k2 && oe2.scope && !Ae2 ? ja(Pa(P_({ key: Ne2, warmupData: oe2, fetchData: () => Lf(k2).catch((e3) => (bb(e3, k2), null)) }), vb, yb)) : void 0) ?? (Ne2 ? O_(Ne2) : void 0), [Fe2, Ie2] = (0, import_react.useState)(() => Pe2 ?? null), [Le2, Re2] = (0, import_react.useState)(() => Pe2 ? Ne2 : null), ze2 = Ne2 !== null && Le2 !== Ne2, Be2 = n2 ? n2.serviceOptionsAndVariants : Me2 ? Fe2 : null;
5153
5153
  (0, import_react.useEffect)(() => {
5154
5154
  if (n2) return;
5155
- let e3 = be2 && !kd(xe2) ? be2 : null;
5156
- if ((!e3 || Oe2) && we2((e4) => e4.length === 0 ? e4 : ab), Oe2) return;
5157
- let i2 = Ae2 ? A2 : null;
5155
+ let e3 = Se2 && !kd(Ce2) ? Se2 : null;
5156
+ if ((!e3 || Ae2) && Ee2((e4) => e4.length === 0 ? e4 : ab), Ae2) return;
5157
+ let i2 = Me2 ? k2 : null;
5158
5158
  if (!e3 && !i2) return;
5159
- let a3 = false, o2 = e3 ? Ff([e3], Ee2).catch(() => ab) : Promise.resolve(ab), s2 = i2 ? P_({ key: x_(i2, t2), warmupData: se2.current, fetchData: () => Lf(i2) }).catch((e4) => {
5159
+ let a3 = false, o2 = e3 ? Ff([e3], Oe2).catch(() => ab) : Promise.resolve(ab), s2 = i2 ? P_({ key: x_(i2, t2), warmupData: T2.current, fetchData: () => Lf(i2) }).catch((e4) => {
5160
5160
  bb(e4, i2);
5161
5161
  }) : Promise.resolve(void 0);
5162
5162
  return Promise.all([o2, s2]).then(([e4, t3]) => {
5163
5163
  a3 || (0, import_react.startTransition)(() => {
5164
- we2(e4), t3 !== void 0 && Pe2(t3), Ie2(je2);
5164
+ Ee2(e4), t3 !== void 0 && Ie2(t3), Re2(Ne2);
5165
5165
  });
5166
5166
  }), () => {
5167
5167
  a3 = true;
5168
5168
  };
5169
- }, [n2, be2, xe2, Ee2, Oe2, Ae2, A2, je2]);
5170
- let ze2 = a2 ? null : ie2.get(Y.blob), Be2 = (0, import_react.useMemo)(() => JSON.stringify([...new Set((Sg(ze2)?.services ?? []).filter((e3) => Vg(e3).length > 0).map(({ serviceId: e3 }) => e3))].sort()), [ze2]), Ve2 = (0, import_react.useMemo)(() => {
5171
- let e3 = new Set(JSON.parse(Be2));
5172
- return [...new Set(g2.filter(Md).flatMap(({ _id: t3 }) => t3 && e3.has(t3) ? [t3] : []))];
5173
- }, [g2, Be2]), He2 = (0, import_react.useMemo)(() => ({ serviceIds: Ve2, refreshSignal: t2 }), [Ve2, t2]), [Ue2, We2] = (0, import_react.useState)(null), Ge2 = Ue2?.request === He2 ? Ue2 : null, Ke2 = Ge2?.data ?? gb, j2 = Ve2.length === 0 ? `ready` : Oe2 || !Ge2 ? `loading` : Ge2.data && Ve2.every((e3) => Ge2.data?.[e3]) ? `ready` : `error`;
5169
+ }, [n2, Se2, Ce2, Oe2, Ae2, Me2, k2, Ne2]);
5170
+ let A2 = a2 ? null : ie2.get(Y.blob), Ve2 = (0, import_react.useMemo)(() => JSON.stringify([...new Set((Sg(A2)?.services ?? []).filter((e3) => Vg(e3).length > 0).map(({ serviceId: e3 }) => e3))].sort()), [A2]), He2 = (0, import_react.useMemo)(() => {
5171
+ let e3 = new Set(JSON.parse(Ve2));
5172
+ return [...new Set(_2.filter(Md).flatMap(({ _id: t3 }) => t3 && e3.has(t3) ? [t3] : []))];
5173
+ }, [_2, Ve2]), Ue2 = (0, import_react.useMemo)(() => ({ serviceIds: He2, refreshSignal: t2 }), [He2, t2]), [We2, Ge2] = (0, import_react.useState)(null), Ke2 = We2?.request === Ue2 ? We2 : null, j2 = Ke2?.data ?? gb, M2 = He2.length === 0 ? `ready` : Ae2 || !Ke2 ? `loading` : Ke2.data && He2.every((e3) => Ke2.data?.[e3]) ? `ready` : `error`;
5174
5174
  (0, import_react.useEffect)(() => {
5175
- let { serviceIds: e3, refreshSignal: t3 } = He2;
5176
- if (Oe2 || e3.length === 0) return;
5175
+ let { serviceIds: e3, refreshSignal: t3 } = Ue2;
5176
+ if (Ae2 || e3.length === 0) return;
5177
5177
  let n3 = false;
5178
- return P_({ key: S_(e3, t3), warmupData: se2.current, fetchData: () => zf(e3) }).catch((e4) => (ga(e4, { feature: ma.service, action: `fetch-multi-service-variants`, level: `warning` }), null)).then((e4) => {
5179
- n3 || (0, import_react.startTransition)(() => We2({ request: He2, data: e4 }));
5178
+ return P_({ key: S_(e3, t3), warmupData: T2.current, fetchData: () => zf(e3) }).catch((e4) => (ga(e4, { feature: ma.service, action: `fetch-multi-service-variants`, level: `warning` }), null)).then((e4) => {
5179
+ n3 || (0, import_react.startTransition)(() => Ge2({ request: Ue2, data: e4 }));
5180
5180
  }), () => {
5181
5181
  n3 = true;
5182
5182
  };
5183
- }, [Oe2, He2]);
5184
- let M2 = om({ service: f2, masterEvents: Te2, locale: _2, timeZone: Ee2, now: __() }), N2 = cb(M2), qe2 = (0, import_react.useMemo)(() => M2, [f2, Te2, _2, Ee2, N2]), Je2 = (0, import_react.useRef)(null);
5183
+ }, [Ae2, Ue2]);
5184
+ let N2 = om({ service: m2, masterEvents: De2, locale: v2, timeZone: Oe2, now: __() }), qe2 = cb(N2), Je2 = (0, import_react.useMemo)(() => N2, [m2, De2, v2, Oe2, qe2]), Ye2 = (0, import_react.useRef)(null);
5185
5185
  (0, import_react.useEffect)(() => {
5186
- if (Je2.current !== null) {
5187
- let e3 = le2.current(f2?._id ?? ``, C2.current().searchParams);
5188
- O2.current = e3, k2.current = true, fe2.current = false, pe2.current = null, ue2(e3);
5186
+ if (Ye2.current !== null) {
5187
+ let e3 = ue2.current(m2?._id ?? ``, w2.current().searchParams);
5188
+ D2.current = e3, pe2.current = true, me2.current = false, he2.current = null, fe2(e3);
5189
5189
  }
5190
- Je2.current = A2;
5191
- }, [A2]);
5192
- let Ye2 = (0, import_react.useRef)(ze2);
5190
+ Ye2.current = k2;
5191
+ }, [k2]);
5192
+ let Xe2 = (0, import_react.useRef)(A2);
5193
5193
  (0, import_react.useEffect)(() => {
5194
- if (ze2 === Ye2.current) return;
5195
- Ye2.current = ze2;
5196
- let e3 = le2.current(A2 ?? ``, C2.current().searchParams);
5197
- O2.current = e3, k2.current = true, fe2.current = false, pe2.current = null, ue2(e3), ge2.current = null, he2(null), ve2((e4) => e4 + 1);
5198
- }, [ze2, A2]);
5199
- let Xe2 = (0, import_react.useRef)({});
5200
- Xe2.current = { serviceType: f2?.type ?? void 0, scheduleId: jd(f2?.type) || Ad(f2?.type) ? f2?.schedule?._id ?? void 0 : void 0 };
5201
- let Ze2 = (0, import_react.useCallback)((e3, t3) => Tg(e3, { currentUrl: C2.current(), entries: [Ig(t3?.staffId === void 0 ? O2.current : Rg(O2.current, t3.staffId), Xe2.current)], policy: t3?.handoff ? `handoff` : `inPlace`, timezone: de2.current }), []), Qe2 = (0, import_react.useCallback)((e3) => {
5202
- let t3 = e3(O2.current);
5203
- O2.current = t3, ue2(t3);
5204
- }, []), $e2 = (0, import_react.useCallback)((e3) => {
5205
- Qe2(e3);
5206
- let t3 = C2.current(), n3 = e3(nb(A2 ?? ``, t3.searchParams)), r2 = Tg(`${t3.pathname}${t3.search}${t3.hash}`, { currentUrl: t3, entries: [Ig(n3, Xe2.current)], policy: `inPlace` }), i2 = new URL(r2, t3);
5207
- Ye2.current = i2.searchParams.get(Y.blob), ae2.current(i2, { disableScrollToTop: true, skipHistory: true });
5208
- }, [Qe2, A2]), et2 = Sg(ze2)?.wantsPromoCode === true, tt2 = (0, import_react.useCallback)((e3) => {
5209
- let t3 = C2.current(), n3 = Sg(t3.searchParams.get(Y.blob));
5194
+ if (A2 === Xe2.current) return;
5195
+ Xe2.current = A2;
5196
+ let e3 = ue2.current(k2 ?? ``, w2.current().searchParams);
5197
+ D2.current = e3, pe2.current = true, me2.current = false, he2.current = null, fe2(e3), ve2.current = null, _e2(null), be2((e4) => e4 + 1);
5198
+ }, [A2, k2]);
5199
+ let Ze2 = (0, import_react.useRef)({});
5200
+ Ze2.current = { serviceType: m2?.type ?? void 0, scheduleId: jd(m2?.type) || Ad(m2?.type) ? m2?.schedule?._id ?? void 0 : void 0 };
5201
+ let Qe2 = (0, import_react.useCallback)((e3, t3) => Tg(e3, { currentUrl: w2.current(), entries: [Ig(t3?.staffId === void 0 ? D2.current : Rg(D2.current, t3.staffId), Ze2.current)], policy: t3?.handoff ? `handoff` : `inPlace`, timezone: O2.current }), []), $e2 = (0, import_react.useCallback)((e3) => {
5202
+ let t3 = e3(D2.current);
5203
+ D2.current = t3, fe2(t3);
5204
+ }, []), et2 = (0, import_react.useCallback)((e3) => {
5205
+ $e2(e3);
5206
+ let t3 = w2.current(), n3 = e3(nb(k2 ?? ``, t3.searchParams)), r2 = Tg(`${t3.pathname}${t3.search}${t3.hash}`, { currentUrl: t3, entries: [Ig(n3, Ze2.current)], policy: `inPlace` }), i2 = new URL(r2, t3);
5207
+ Xe2.current = i2.searchParams.get(Y.blob), ae2.current(i2, { disableScrollToTop: true, skipHistory: true });
5208
+ }, [$e2, k2]), tt2 = Sg(A2)?.wantsPromoCode === true, nt2 = (0, import_react.useCallback)((e3) => {
5209
+ let t3 = w2.current(), n3 = Sg(t3.searchParams.get(Y.blob));
5210
5210
  if (!n3) return;
5211
5211
  let r2 = new URL(jg(`${t3.pathname}${t3.search}${t3.hash}`, Pg(n3, e3)), t3);
5212
- Ye2.current = r2.searchParams.get(Y.blob), ae2.current(r2, { disableScrollToTop: true, skipHistory: true });
5213
- }, []), nt2 = Kf(Re2), P2 = (0, import_react.useCallback)((e3, t3) => nt2 ? Hg(e3, t3 ? [t3] : []) : e3, [nt2]), F2 = (0, import_react.useCallback)((e3) => Qe2((t3) => P2(Rg(t3, e3), e3)), [Qe2, P2]), rt2 = (0, import_react.useCallback)(() => Qe2((e3) => P2(Bg(e3), null)), [Qe2, P2]), I2 = (0, import_react.useCallback)((e3) => Qe2((t3) => P2(zg(t3, e3), null)), [Qe2, P2]), it2 = (0, import_react.useCallback)((e3) => $e2((t3) => Hg(t3, e3)), [$e2]), at2 = (0, import_react.useMemo)(() => ob(f2), [f2]), ot2 = (0, import_react.useMemo)(() => qf(Re2, { locale: _2, staffMembers: f2 ? Jf(f2) : [], businessLocations: Dd(f2) }), [Re2, _2, f2]), st2 = (0, import_react.useMemo)(() => new Set(qf(Re2, { locale: _2 })?.choices.flatMap((e3) => e3.choiceId ? [e3.choiceId] : []) ?? []), [Re2, _2]), ct2 = (0, import_react.useCallback)((e3) => {
5214
- let t3 = Object.entries(e3).filter(([e4, t4]) => st2.has(e4) && Number.isFinite(t4));
5212
+ Xe2.current = r2.searchParams.get(Y.blob), ae2.current(r2, { disableScrollToTop: true, skipHistory: true });
5213
+ }, []), P2 = Kf(Be2), F2 = (0, import_react.useCallback)((e3, t3) => P2 ? Hg(e3, t3 ? [t3] : []) : e3, [P2]), rt2 = (0, import_react.useCallback)((e3) => $e2((t3) => F2(Rg(t3, e3), e3)), [$e2, F2]), I2 = (0, import_react.useCallback)(() => $e2((e3) => F2(Bg(e3), null)), [$e2, F2]), it2 = (0, import_react.useCallback)((e3) => $e2((t3) => F2(zg(t3, e3), null)), [$e2, F2]), at2 = (0, import_react.useCallback)((e3) => et2((t3) => Hg(t3, e3)), [et2]), ot2 = (0, import_react.useMemo)(() => ob(m2), [m2]), st2 = (0, import_react.useMemo)(() => qf(Be2, { locale: v2, staffMembers: m2 ? Jf(m2) : [], businessLocations: Dd(m2) }), [Be2, v2, m2]), ct2 = (0, import_react.useMemo)(() => new Set(qf(Be2, { locale: v2 })?.choices.flatMap((e3) => e3.choiceId ? [e3.choiceId] : []) ?? []), [Be2, v2]), lt2 = (0, import_react.useCallback)((e3) => {
5214
+ let t3 = Object.entries(e3).filter(([e4, t4]) => ct2.has(e4) && Number.isFinite(t4));
5215
5215
  if (!t3.length) return;
5216
5216
  let n3 = (e4) => {
5217
- let n4 = Kg(e4, st2), r2 = ([e5, t4]) => t4 <= Ug(n4, e5), i2 = [...t3.filter(r2), ...t3.filter((e5) => !r2(e5))];
5217
+ let n4 = Kg(e4, ct2), r2 = ([e5, t4]) => t4 <= Ug(n4, e5), i2 = [...t3.filter(r2), ...t3.filter((e5) => !r2(e5))];
5218
5218
  for (let [e5, t4] of i2) {
5219
- let r3 = Ug(n4, e5), i3 = sb(t4, { previous: r3, others: Wg(n4) - r3 }, at2);
5219
+ let r3 = Ug(n4, e5), i3 = sb(t4, { previous: r3, others: Wg(n4) - r3 }, ot2);
5220
5220
  i3 !== r3 && (n4 = Gg(n4, e5, i3));
5221
5221
  }
5222
5222
  return n4;
5223
5223
  };
5224
- n3(O2.current) !== O2.current && $e2(n3);
5225
- }, [st2, at2, $e2]), lt2 = (0, import_react.useCallback)((e3) => $e2((t3) => Yg(t3, e3)), [$e2]), ut2 = (0, import_react.useCallback)((e3, t3) => $e2((n3) => Xg(n3, e3, t3)), [$e2]), dt2 = (0, import_react.useCallback)((e3, t3) => {
5226
- t3?.timezone && (de2.current = t3.timezone), k2.current = t3?.bookable ?? true, fe2.current = t3?.staffChoiceRequired ?? false, pe2.current = t3?.rescheduleStaffId ?? null, Qe2((n3) => {
5224
+ n3(D2.current) !== D2.current && et2(n3);
5225
+ }, [ct2, ot2, et2]), ut2 = (0, import_react.useCallback)((e3) => et2((t3) => Yg(t3, e3)), [et2]), dt2 = (0, import_react.useCallback)((e3, t3) => et2((n3) => Xg(n3, e3, t3)), [et2]), ft2 = (0, import_react.useCallback)((e3, t3) => {
5226
+ t3?.timezone && (O2.current = t3.timezone), pe2.current = t3?.bookable ?? true, me2.current = t3?.staffChoiceRequired ?? false, he2.current = t3?.rescheduleStaffId ?? null, $e2((n3) => {
5227
5227
  let r2 = $g(n3, e3);
5228
5228
  return t3?.staffId === void 0 ? r2 : Rg(r2, t3.staffId);
5229
5229
  });
5230
- }, [Qe2]), ft2 = (0, import_react.useCallback)(() => {
5231
- k2.current = true, fe2.current = false, pe2.current = null;
5232
- let e3 = le2.current(A2 ?? ``, C2.current().searchParams);
5233
- Qe2((t3) => {
5230
+ }, [$e2]), pt2 = (0, import_react.useCallback)(() => {
5231
+ pe2.current = true, me2.current = false, he2.current = null;
5232
+ let e3 = ue2.current(k2 ?? ``, w2.current().searchParams);
5233
+ $e2((t3) => {
5234
5234
  let n3 = t_(t3, e3);
5235
- if (!nt2) return n3;
5235
+ if (!P2) return n3;
5236
5236
  let { selectedVariants: r2, durationChoiceId: i2, ...a3 } = n3;
5237
5237
  return { ...a3, ...e3.selectedVariants ? { selectedVariants: e3.selectedVariants } : {}, ...e3.durationChoiceId ? { durationChoiceId: e3.durationChoiceId } : {} };
5238
5238
  });
5239
- }, [Qe2, A2, nt2]), pt2 = (0, import_react.useCallback)((e3) => {
5240
- let t3 = ge2.current ?? Sg(C2.current().searchParams.get(Y.blob)), n3 = t3 && e3(t3);
5241
- return n3 ? (ge2.current = n3, he2(n3), true) : false;
5242
- }, []), mt2 = (0, import_react.useCallback)((e3, t3) => pt2((n3) => n_(n3, e3, t3, Jd())), [pt2]), ht2 = (0, import_react.useCallback)(() => {
5243
- pt2(i_);
5244
- }, [pt2]), gt2 = qe2.serviceCtaState, _t2 = (0, import_react.useMemo)(() => h2 ? (me2 ?? Sg(ze2))?.services ?? hb : hb, [h2, me2, ze2]), vt2 = (0, import_react.useMemo)(() => h2 ? ib(me2 ?? Sg(ze2), te2()) : null, [h2, me2, ze2, te2]), yt2 = (0, import_react.useCallback)((e3) => {
5245
- if (h2) return vt2 ? b2(vt2) : null;
5246
- let t3 = qv({ actionState: gt2, serviceType: f2?.type ?? null, config: e3 ?? Kv });
5247
- if (Jv(t3, f2?.type ?? null, D2)) return null;
5248
- let n3 = y2(t3, { slug: f2?.mainSlug?.name ?? null, serviceId: f2?._id ?? null });
5249
- return n3 ? b2(n3) : null;
5250
- }, [h2, vt2, gt2, f2, D2, y2, b2]), bt2 = _m(), [xt2, St2] = (0, import_react.useState)(false), Ct2 = (0, import_react.useRef)(false), wt2 = (0, import_react.useCallback)(() => {
5251
- Ct2.current = false, St2(false);
5239
+ }, [$e2, k2, P2]), mt2 = (0, import_react.useCallback)((e3) => {
5240
+ let t3 = ve2.current ?? Sg(w2.current().searchParams.get(Y.blob)), n3 = t3 && e3(t3);
5241
+ return n3 ? (ve2.current = n3, _e2(n3), true) : false;
5242
+ }, []), ht2 = (0, import_react.useCallback)((e3, t3) => mt2((n3) => n_(n3, e3, t3, Jd())), [mt2]), gt2 = (0, import_react.useCallback)(() => {
5243
+ mt2(i_);
5244
+ }, [mt2]), _t2 = Je2.serviceCtaState, vt2 = (0, import_react.useMemo)(() => g2 ? (ge2 ?? Sg(A2))?.services ?? hb : hb, [g2, ge2, A2]), yt2 = (0, import_react.useMemo)(() => g2 ? ib(ge2 ?? Sg(A2), ne2()) : null, [g2, ge2, A2, ne2]), bt2 = (0, import_react.useCallback)((e3) => {
5245
+ if (g2) return yt2 ? te2(yt2) : null;
5246
+ let t3 = qv({ actionState: _t2, serviceType: m2?.type ?? null, config: e3 ?? Kv });
5247
+ if (Jv(t3, m2?.type ?? null, de2)) return null;
5248
+ let n3 = b2(t3, { slug: m2?.mainSlug?.name ?? null, serviceId: m2?._id ?? null });
5249
+ return n3 ? te2(n3) : null;
5250
+ }, [g2, yt2, _t2, m2, de2, b2, te2]), xt2 = _m(), [St2, Ct2] = (0, import_react.useState)(false), wt2 = (0, import_react.useRef)(false), Tt2 = (0, import_react.useCallback)(() => {
5251
+ wt2.current = false, Ct2(false);
5252
5252
  }, []);
5253
- ry(wt2);
5254
- let Tt2 = (0, import_react.useCallback)((e3) => {
5255
- Ct2.current = true, St2(true);
5256
- let t3 = C2.current(), n3 = new URL(b2(e3), t3).pathname === t3.pathname;
5257
- v2(e3).then(() => {
5258
- (n3 || C2.current().href !== t3.href) && wt2();
5253
+ ry(Tt2);
5254
+ let Et2 = (0, import_react.useCallback)((e3) => {
5255
+ wt2.current = true, Ct2(true);
5256
+ let t3 = w2.current(), n3 = new URL(te2(e3), t3).pathname === t3.pathname;
5257
+ y2(e3).then(() => {
5258
+ (n3 || w2.current().href !== t3.href) && Tt2();
5259
5259
  }, (e4) => {
5260
- ga(e4, { feature: ma.serviceCta, action: `navigateToNextPage` }), wt2();
5260
+ ga(e4, { feature: ma.serviceCta, action: `navigateToNextPage` }), Tt2();
5261
5261
  });
5262
- }, [v2, wt2, b2]), Et2 = (0, import_react.useCallback)(() => bt2.open(pm(s_({ service: f2, pricingOption: ot2 ?? void 0, selection: rb(A2 ?? ``, C2.current().searchParams), multiServiceAppointmentsEnabled: ke2 }))), [bt2, f2, ot2, A2, ke2]), Dt2 = (0, import_react.useCallback)((e3) => {
5263
- if (Ct2.current) return;
5264
- let t3 = ge2.current ?? Sg(C2.current().searchParams.get(Y.blob)), n3 = ib(t3, te2());
5262
+ }, [y2, Tt2, te2]), Dt2 = (0, import_react.useCallback)(() => xt2.open(pm(s_({ service: m2, pricingOption: st2 ?? void 0, selection: rb(k2 ?? ``, w2.current().searchParams), multiServiceAppointmentsEnabled: je2 }))), [xt2, m2, st2, k2, je2]), Ot2 = (0, import_react.useCallback)((e3) => {
5263
+ if (wt2.current) return;
5264
+ let t3 = ve2.current ?? Sg(w2.current().searchParams.get(Y.blob)), n3 = ib(t3, ne2());
5265
5265
  if (n3) {
5266
- for (let n4 of t3?.services ?? []) e3(yf({ serviceId: n4.serviceId, serviceType: n4.serviceType ?? g2.find(({ _id: e4 }) => e4 === n4.serviceId)?.type ?? void 0, start: n4.slotStart, end: n4.slotEnd, timeZone: t3?.timezone ?? void 0, isEligibleForFlowCompletion: true }));
5267
- Tt2(n3);
5266
+ for (let n4 of t3?.services ?? []) e3(yf({ serviceId: n4.serviceId, serviceType: n4.serviceType ?? _2.find(({ _id: e4 }) => e4 === n4.serviceId)?.type ?? void 0, start: n4.slotStart, end: n4.slotEnd, timeZone: t3?.timezone ?? void 0, isEligibleForFlowCompletion: true }));
5267
+ Et2(n3);
5268
5268
  }
5269
- }, [te2, g2, Tt2]), Ot2 = (0, import_react.useCallback)((e3, t3 = af.WIDGET_BUTTON) => {
5270
- if (Ct2.current || a2) return;
5271
- if (h2) {
5272
- Dt2(x2);
5269
+ }, [ne2, _2, Et2]), kt2 = (0, import_react.useCallback)((e3, t3 = af.WIDGET_BUTTON) => {
5270
+ if (wt2.current || a2) return;
5271
+ if (g2) {
5272
+ Ot2(S2);
5273
5273
  return;
5274
5274
  }
5275
- let n3 = qv({ actionState: gt2, serviceType: f2?.type ?? null, config: e3 ?? Kv });
5276
- if (Jv(n3, f2?.type ?? null, O2.current)) return;
5277
- let r2 = y2(n3, { slug: f2?.mainSlug?.name ?? null, serviceId: f2?._id ?? null }), i2 = n3 === `bookingForm` && !jd(f2?.type ?? null);
5278
- if (n3 !== `servicePage` && !i2 && x2($d({ bookingsServiceId: f2?._id ?? void 0, serviceType: f2?.type ?? void 0, isEligibleForFlowCompletion: !!r2 })), i2 && k2.current && x2(yf({ serviceId: f2?._id ?? void 0, serviceType: f2?.type ?? void 0, start: O2.current.slotStart, end: O2.current.slotEnd, timeZone: de2.current ?? Sg(ze2)?.timezone ?? Ee2, isEligibleForFlowCompletion: !!r2 })), x2(Zd({ service_id: f2?._id ?? void 0, destination: of[n3] })), !r2) return;
5279
- x2(mf({ service_id: f2?._id ?? void 0, type: f2?.type ?? void 0, isPendingApproval: f2 ? Nd(f2) : void 0, referralInfo: t3, actionName: sf[n3] }));
5275
+ let n3 = qv({ actionState: _t2, serviceType: m2?.type ?? null, config: e3 ?? Kv });
5276
+ if (Jv(n3, m2?.type ?? null, D2.current)) return;
5277
+ let r2 = b2(n3, { slug: m2?.mainSlug?.name ?? null, serviceId: m2?._id ?? null }), i2 = n3 === `bookingForm` && !jd(m2?.type ?? null);
5278
+ if (n3 !== `servicePage` && !i2 && S2($d({ bookingsServiceId: m2?._id ?? void 0, serviceType: m2?.type ?? void 0, isEligibleForFlowCompletion: !!r2 })), i2 && pe2.current && S2(yf({ serviceId: m2?._id ?? void 0, serviceType: m2?.type ?? void 0, start: D2.current.slotStart, end: D2.current.slotEnd, timeZone: O2.current ?? Sg(A2)?.timezone ?? Oe2, isEligibleForFlowCompletion: !!r2 })), S2(Zd({ service_id: m2?._id ?? void 0, destination: of[n3] })), !r2) return;
5279
+ S2(mf({ service_id: m2?._id ?? void 0, type: m2?.type ?? void 0, isPendingApproval: m2 ? Nd(m2) : void 0, referralInfo: t3, actionName: sf[n3] }));
5280
5280
  let o2 = n3 === `bookingForm`;
5281
- if (!o2 && !Ng(O2.current)) {
5282
- Tt2(Fg(r2, C2.current()));
5281
+ if (!o2 && !Ng(D2.current)) {
5282
+ Et2(Fg(r2, w2.current()));
5283
5283
  return;
5284
5284
  }
5285
- Tt2(Ze2(r2, { handoff: o2 }));
5286
- }, [a2, h2, Dt2, ze2, gt2, f2, Ee2, y2, Tt2, Ze2, x2]), kt2 = () => ({ bookable: k2.current, staffChoiceRequired: fe2.current, timezone: de2.current ?? Ee2 ?? `UTC`, validUntil: ye2?.validUntil ?? null }), At2 = (0, import_react.useRef)(kt2);
5287
- At2.current = kt2;
5288
- let jt2 = (0, import_react.useCallback)(async () => {
5289
- let e3 = ye2?.status === `ready` ? ye2.booking : null;
5290
- if (!ye2 || !a2 || !e3 || !Wy(O2.current, At2.current())) return { outcome: `failed` };
5291
- x2(gf({ component: lf.RESCHEDULE_DIALOG, element: uf.CONFIRM_BUTTON })), x2(tf({ action: cf, pageName: uf.CONFIRM_BUTTON, referralInfo: C2.current().searchParams.get(Y.referral) ?? void 0 }));
5292
- let t3 = Ig(O2.current, Xe2.current), n3;
5285
+ Et2(Qe2(r2, { handoff: o2 }));
5286
+ }, [a2, g2, Ot2, A2, _t2, m2, Oe2, b2, Et2, Qe2, S2]), At2 = () => ({ bookable: pe2.current, staffChoiceRequired: me2.current, timezone: O2.current ?? Oe2 ?? `UTC`, validUntil: xe2?.validUntil ?? null }), jt2 = (0, import_react.useRef)(At2);
5287
+ jt2.current = At2;
5288
+ let Mt2 = (0, import_react.useCallback)(async () => {
5289
+ let e3 = xe2?.status === `ready` ? xe2.booking : null;
5290
+ if (!xe2 || !a2 || !e3 || !Wy(D2.current, jt2.current())) return { outcome: `failed` };
5291
+ S2(gf({ component: lf.RESCHEDULE_DIALOG, element: uf.CONFIRM_BUTTON })), S2(tf({ action: cf, pageName: uf.CONFIRM_BUTTON, referralInfo: w2.current().searchParams.get(Y.referral) ?? void 0 }));
5292
+ let t3 = Ig(D2.current, Ze2.current), n3;
5293
5293
  try {
5294
- n3 = await Iy({ booking: e3, slot: Dy(t3, de2.current ?? null, e3, pe2.current), token: a2.token });
5294
+ n3 = await Iy({ booking: e3, slot: Dy(t3, O2.current ?? null, e3, he2.current), token: a2.token });
5295
5295
  } catch (e4) {
5296
5296
  return ga(e4, { feature: ma.reschedule, action: `reschedule-booking` }), { outcome: `failed` };
5297
5297
  }
5298
- x2(hf({ bookingId: e3.bookingId }));
5298
+ S2(hf({ bookingId: e3.bookingId }));
5299
5299
  let r2 = { outcome: `succeeded`, ...n3 };
5300
5300
  if (a2.fromManageBookingPage) return r2;
5301
- let i2 = Uy(a2.redirectUrl), o2 = i2 ? null : ne2();
5301
+ let i2 = Uy(a2.redirectUrl), o2 = i2 ? null : x2();
5302
5302
  if (!i2 && !o2) return r2;
5303
5303
  try {
5304
- return i2 ? await ee2({ href: i2 }) : o2 && await v2(o2), { outcome: `navigated` };
5304
+ return i2 ? await ee2({ href: i2 }) : o2 && await y2(o2), { outcome: `navigated` };
5305
5305
  } catch (e4) {
5306
5306
  return ga(e4, { feature: ma.reschedule, action: `return-after-reschedule` }), r2;
5307
5307
  }
5308
- }, [ye2, a2, ne2, v2, ee2, x2]), Mt2 = Wy(D2, kt2()), Nt2 = (0, import_react.useCallback)(() => {
5309
- x2(tf({ component: uf.GO_TO_HOMEPAGE_BUTTON, action: cf, pageName: df })), v2(`/`).catch((e3) => ga(e3, { feature: ma.reschedule, action: `go-home` }));
5310
- }, [v2, x2]), { serviceBookability: Pt2, policyDescription: Ft2, coverImage: It2 } = qe2, Lt2 = (0, import_react.useCallback)(() => Pt2.isAvailableForBooking, [Pt2]), Rt2 = (0, import_react.useCallback)(() => !!Ft2, [Ft2]), zt2 = (0, import_react.useCallback)(() => !!It2, [It2]), Bt2 = (0, import_react.useCallback)(() => Ap(f2), [f2]), Vt2 = (0, import_react.useCallback)(() => !!f2 && lm(f2), [f2]), Ht2 = (0, import_react.useMemo)(() => ({ ...qe2, service: f2, servicePageLink: Se2, serviceOptionsAndVariants: Re2, pricingOption: ot2, isLoadingServiceOptionsAndVariants: Le2, isAvailableForBooking: Lt2, hasPolicyDescription: Rt2, hasCoverImage: zt2, hasGalleryImages: Bt2, isVariantDuration: Vt2, isLoading: false, hasError: m2, locale: _2, selectStaffMember: F2, clearSelection: I2, clearStaffMember: rt2, selection: D2, selectionTimezone: de2.current ?? Ee2, setVariant: it2, setVariantCounts: ct2, maxParticipantsPerBooking: at2.max, toggleAddOn: lt2, setAddOnQuantity: ut2, setSlot: dt2, clearSlot: ft2, setMultiServiceSlot: mt2, clearMultiServiceSlot: ht2, draftRevision: _e2, wantsPromoCode: et2, setWantsPromoCode: tt2, withSelectionParam: Ze2, navigateToNextPage: Ot2, navigateToMultiServiceForm: Dt2, resolveNextPageHref: yt2, isNavigating: xt2, openPreferences: Et2, multiServiceAppointmentsEnabled: ke2, isMultiServiceAppointment: h2, multiServiceAppointmentServices: g2, multiServiceAppointmentSelections: _t2, multiServiceAppointmentOptionsAndVariants: Ke2, multiServiceAppointmentVariantsStatus: j2, bookingsSettingsLoading: Oe2, reschedule: ye2, rescheduleBooking: jt2, goHomeAfterReschedule: Nt2, canRescheduleToPick: Mt2 }), [qe2, f2, Se2, Re2, ot2, Le2, Lt2, Rt2, zt2, Bt2, Vt2, m2, _2, F2, I2, rt2, D2, Ee2, it2, ct2, at2.max, lt2, ut2, dt2, ft2, mt2, ht2, _e2, et2, tt2, Ze2, Ot2, Dt2, yt2, xt2, Et2, ke2, h2, g2, _t2, Ke2, j2, Oe2, ye2, jt2, Nt2, Mt2]);
5311
- return (0, import_jsx_runtime.jsx)(Xy.Provider, { value: Ht2, children: u2 });
5308
+ }, [xe2, a2, x2, y2, ee2, S2]), Nt2 = Wy(de2, At2()), Pt2 = (0, import_react.useCallback)(() => {
5309
+ S2(tf({ component: uf.GO_TO_HOMEPAGE_BUTTON, action: cf, pageName: df })), y2(`/`).catch((e3) => ga(e3, { feature: ma.reschedule, action: `go-home` }));
5310
+ }, [y2, S2]), { serviceBookability: Ft2, policyDescription: It2, coverImage: Lt2 } = Je2, Rt2 = (0, import_react.useCallback)(() => Ft2.isAvailableForBooking, [Ft2]), zt2 = (0, import_react.useCallback)(() => !!It2, [It2]), Bt2 = (0, import_react.useCallback)(() => !!Lt2, [Lt2]), Vt2 = (0, import_react.useCallback)(() => Ap(m2), [m2]), Ht2 = (0, import_react.useCallback)(() => !!m2 && lm(m2), [m2]), Ut2 = (0, import_react.useMemo)(() => ({ ...Je2, service: m2, servicePageLink: we2, serviceOptionsAndVariants: Be2, pricingOption: st2, isLoadingServiceOptionsAndVariants: ze2, isAvailableForBooking: Rt2, hasPolicyDescription: zt2, hasCoverImage: Bt2, hasGalleryImages: Vt2, isVariantDuration: Ht2, isLoading: false, hasError: h2, locale: v2, selectStaffMember: rt2, clearSelection: it2, clearStaffMember: I2, selection: de2, selectionTimezone: O2.current ?? Oe2, setVariant: at2, setVariantCounts: lt2, maxParticipantsPerBooking: ot2.max, toggleAddOn: ut2, setAddOnQuantity: dt2, setSlot: ft2, clearSlot: pt2, setMultiServiceSlot: ht2, clearMultiServiceSlot: gt2, draftRevision: ye2, wantsPromoCode: tt2, setWantsPromoCode: nt2, withSelectionParam: Qe2, navigateToNextPage: kt2, navigateToMultiServiceForm: Ot2, resolveNextPageHref: bt2, isNavigating: St2, editingSurface: u2, openPreferences: Dt2, multiServiceAppointmentsEnabled: je2, isMultiServiceAppointment: g2, multiServiceAppointmentServices: _2, multiServiceAppointmentSelections: vt2, multiServiceAppointmentOptionsAndVariants: j2, multiServiceAppointmentVariantsStatus: M2, bookingsSettingsLoading: Ae2, reschedule: xe2, rescheduleBooking: Mt2, goHomeAfterReschedule: Pt2, canRescheduleToPick: Nt2 }), [Je2, m2, we2, Be2, st2, ze2, Rt2, zt2, Bt2, Vt2, Ht2, h2, v2, rt2, it2, I2, de2, Oe2, at2, lt2, ot2.max, ut2, dt2, ft2, pt2, ht2, gt2, ye2, tt2, nt2, Qe2, kt2, Ot2, bt2, St2, u2, Dt2, je2, g2, _2, vt2, j2, M2, Ae2, xe2, Mt2, Pt2, Nt2]);
5311
+ return (0, import_jsx_runtime.jsx)(Xy.Provider, { value: Ut2, children: d2 });
5312
5312
  }
5313
5313
  function Sb({ pathname: e2, initialServiceId: t2, refreshSignal: n2, editingSurface: r2, children: i2 }) {
5314
5314
  pf(nf.SERVICE);
@@ -5316,11 +5316,11 @@ function Sb({ pathname: e2, initialServiceId: t2, refreshSignal: n2, editingSurf
5316
5316
  let r3 = $y(Id(e2), s2 ? null : iy(o2().searchParams), t2);
5317
5317
  return r3.by === `none` ? Ma(db) : r3.by === `multi` ? Pa(P_({ key: b_(r3.serviceIds), refresh: n2 !== 0, warmupData: a2, fetchData: () => _a(`service-context-load-multi-service`, { feature: ma.service }, Vd(r3.serviceIds)) }), fb, pb) : Pa(P_({ key: y_(r3.by, r3.value), refresh: n2 !== 0, warmupData: a2, fetchData: () => _a(`service-context-load`, { feature: ma.service }, r3.by === `slug` ? zd(r3.value) : Bd(r3.value)) }), lb, ub);
5318
5318
  });
5319
- return (0, import_jsx_runtime.jsx)(_b, { servicePromise: c2, refreshSignal: n2, rescheduleRequest: s2, children: i2 });
5319
+ return (0, import_jsx_runtime.jsx)(_b, { servicePromise: c2, refreshSignal: n2, rescheduleRequest: s2, editingSurface: r2, children: i2 });
5320
5320
  }
5321
5321
  function Cb({ serviceData: e2, servicePicker: t2, refreshSignal: n2 = 0, editingSurface: r2 = false, children: i2 }) {
5322
5322
  let { pathname: a2 } = Aa(), o2 = t2?.serviceId?.$eq, c2 = e2?.service ?? null, l2 = (0, import_react.useMemo)(() => c2 ? { service: c2, masterEvents: e2?.masterEvents ?? ab, serviceOptionsAndVariants: e2?.serviceOptionsAndVariants ?? null, bookingsSettings: e2?.bookingsSettings } : null, [c2, e2?.masterEvents, e2?.serviceOptionsAndVariants, e2?.bookingsSettings]);
5323
- return l2 ? (0, import_jsx_runtime.jsx)(_b, { injected: l2, bookingsSettings: l2.bookingsSettings, children: i2 }, `injected:${n2}`) : e2 ? (0, import_jsx_runtime.jsx)(_b, { bookingsSettings: e2.bookingsSettings, children: i2 }) : (0, import_jsx_runtime.jsx)(Sb, { pathname: a2, initialServiceId: o2, refreshSignal: n2, editingSurface: r2, children: i2 }, `fetch:${a2}:${o2 ?? ``}:${n2}:${r2}`);
5323
+ return l2 ? (0, import_jsx_runtime.jsx)(_b, { injected: l2, bookingsSettings: l2.bookingsSettings, editingSurface: r2, children: i2 }, `injected:${n2}`) : e2 ? (0, import_jsx_runtime.jsx)(_b, { bookingsSettings: e2.bookingsSettings, editingSurface: r2, children: i2 }) : (0, import_jsx_runtime.jsx)(Sb, { pathname: a2, initialServiceId: o2, refreshSignal: n2, editingSurface: r2, children: i2 }, `fetch:${a2}:${o2 ?? ``}:${n2}:${r2}`);
5324
5324
  }
5325
5325
  var wb = na(`426941a1-1d08-4cf4-ae61-e433e800cde5`);
5326
5326
  // Annotate the CommonJS export names for ESM import in node: