@wix/bookings 1.0.1781 → 1.0.1783

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.
Files changed (63) hide show
  1. package/build/cjs/context-booking-checkout.d.ts +32 -0
  2. package/build/cjs/context-booking-checkout.js +2002 -1762
  3. package/build/cjs/context-booking-checkout.js.map +1 -1
  4. package/build/cjs/context-my-booking.d.ts +2832 -0
  5. package/build/cjs/context-my-booking.js +592 -0
  6. package/build/cjs/context-my-booking.js.map +1 -0
  7. package/build/cjs/context-my-bookings.d.ts +2862 -0
  8. package/build/cjs/context-my-bookings.js +12885 -0
  9. package/build/cjs/context-my-bookings.js.map +1 -0
  10. package/build/cjs/context-service-addons.d.ts +54 -3
  11. package/build/cjs/context-service-addons.js +1065 -578
  12. package/build/cjs/context-service-addons.js.map +1 -1
  13. package/build/cjs/context-service.d.ts +35 -24
  14. package/build/cjs/context-service.js +985 -966
  15. package/build/cjs/context-service.js.map +1 -1
  16. package/build/cjs/context-time-slots.d.ts +44 -98
  17. package/build/cjs/context-time-slots.js +456 -474
  18. package/build/cjs/context-time-slots.js.map +1 -1
  19. package/build/es/context-booking-checkout.d.mts +32 -0
  20. package/build/es/context-booking-checkout.mjs +2002 -1762
  21. package/build/es/context-booking-checkout.mjs.map +1 -1
  22. package/build/es/context-my-booking.d.mts +2832 -0
  23. package/build/es/context-my-booking.mjs +562 -0
  24. package/build/es/context-my-booking.mjs.map +1 -0
  25. package/build/es/context-my-bookings.d.mts +2862 -0
  26. package/build/es/context-my-bookings.mjs +12844 -0
  27. package/build/es/context-my-bookings.mjs.map +1 -0
  28. package/build/es/context-service-addons.d.mts +54 -3
  29. package/build/es/context-service-addons.mjs +1061 -574
  30. package/build/es/context-service-addons.mjs.map +1 -1
  31. package/build/es/context-service.d.mts +35 -24
  32. package/build/es/context-service.mjs +985 -966
  33. package/build/es/context-service.mjs.map +1 -1
  34. package/build/es/context-time-slots.d.mts +44 -98
  35. package/build/es/context-time-slots.mjs +456 -474
  36. package/build/es/context-time-slots.mjs.map +1 -1
  37. package/build/internal/cjs/context-booking-checkout.d.ts +32 -0
  38. package/build/internal/cjs/context-my-booking.d.ts +2832 -0
  39. package/build/internal/cjs/context-my-bookings.d.ts +2862 -0
  40. package/build/internal/cjs/context-service-addons.d.ts +54 -3
  41. package/build/internal/cjs/context-service.d.ts +35 -24
  42. package/build/internal/cjs/context-time-slots.d.ts +44 -98
  43. package/build/internal/es/context-booking-checkout.d.mts +32 -0
  44. package/build/internal/es/context-my-booking.d.mts +2832 -0
  45. package/build/internal/es/context-my-bookings.d.mts +2862 -0
  46. package/build/internal/es/context-service-addons.d.mts +54 -3
  47. package/build/internal/es/context-service.d.mts +35 -24
  48. package/build/internal/es/context-time-slots.d.mts +44 -98
  49. package/context/my-booking/package.json +3 -0
  50. package/context/my-bookings/package.json +3 -0
  51. package/context-runtime/context-booking-checkout/runtime.d.ts +32 -0
  52. package/context-runtime/context-booking-checkout/runtime.js +3 -3
  53. package/context-runtime/context-my-booking/runtime.d.ts +2832 -0
  54. package/context-runtime/context-my-booking/runtime.js +2 -0
  55. package/context-runtime/context-my-bookings/runtime.d.ts +2862 -0
  56. package/context-runtime/context-my-bookings/runtime.js +11 -0
  57. package/context-runtime/context-service/runtime.d.ts +35 -24
  58. package/context-runtime/context-service/runtime.js +3 -3
  59. package/context-runtime/context-service-addons/runtime.d.ts +54 -3
  60. package/context-runtime/context-service-addons/runtime.js +2 -2
  61. package/context-runtime/context-time-slots/runtime.d.ts +44 -98
  62. package/context-runtime/context-time-slots/runtime.js +3 -3
  63. package/package.json +20 -4
@@ -20,11 +20,11 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // context-time-slots.ts
21
21
  var context_time_slots_exports = {};
22
22
  __export(context_time_slots_exports, {
23
- TimeSlotsContextProvider: () => Xl,
24
- default: () => Xl,
25
- injectAccessTokenGetter: () => eu,
26
- timeSlotsContext: () => Gl,
27
- useTimeSlotsContext: () => Kl
23
+ TimeSlotsContextProvider: () => Jl,
24
+ default: () => Jl,
25
+ injectAccessTokenGetter: () => Ql,
26
+ timeSlotsContext: () => Ul,
27
+ useTimeSlotsContext: () => Wl
28
28
  });
29
29
  module.exports = __toCommonJS(context_time_slots_exports);
30
30
 
@@ -104,12 +104,12 @@ function ee(e2, t2) {
104
104
  }
105
105
  var E = `x-wix-bi-gateway`;
106
106
  function D(e2, t2, n2) {
107
- return { [E]: O({ environment: `js-sdk${n2 ? `-${n2}` : ``}`, "package-name": e2.packageName ?? t2?.PACKAGE_NAME, "method-fqn": e2.methodFqn, entity: e2.entityFqdn }) };
107
+ return { [E]: te({ environment: `js-sdk${n2 ? `-${n2}` : ``}`, "package-name": e2.packageName ?? t2?.PACKAGE_NAME, "method-fqn": e2.methodFqn, entity: e2.entityFqdn }) };
108
108
  }
109
- function O(e2) {
109
+ function te(e2) {
110
110
  return Object.entries(e2).filter(([e3, t2]) => !!t2).map(([e3, t2]) => `${e3}=${t2}`).join(`,`);
111
111
  }
112
- function te(e2) {
112
+ function ne(e2) {
113
113
  let t2 = globalThis.__wix_context__, n2 = { client: m.client, elevatedClient: m.elevatedClient }, r2;
114
114
  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);
115
115
  try {
@@ -118,32 +118,32 @@ function te(e2) {
118
118
  globalThis.__wix_context__ = t2, m.client = n2.client, m.elevatedClient = n2.elevatedClient, typeof $wixContext < `u` && ($wixContext.client = r2.client, $wixContext.elevatedClient = r2.elevatedClient);
119
119
  }
120
120
  }
121
- var k = { id: `_id`, createdDate: `_createdDate`, updatedDate: `_updatedDate` };
122
- function A(e2) {
123
- return M(e2).map((e3) => e3.toLocaleUpperCase()).join(`_`);
121
+ var O = { id: `_id`, createdDate: `_createdDate`, updatedDate: `_updatedDate` };
122
+ function k(e2) {
123
+ return j(e2).map((e3) => e3.toLocaleUpperCase()).join(`_`);
124
124
  }
125
- var ne = /([\p{Ll}\d])(\p{Lu})/gu;
126
- var re = /(\p{Lu})([\p{Lu}][\p{Ll}])/gu;
127
- var j = `$1\0$2`;
128
- var ie = /[^\p{L}\d]+/giu;
129
- function M(e2) {
125
+ var re = /([\p{Ll}\d])(\p{Lu})/gu;
126
+ var ie = /(\p{Lu})([\p{Lu}][\p{Ll}])/gu;
127
+ var A = `$1\0$2`;
128
+ var ae = /[^\p{L}\d]+/giu;
129
+ function j(e2) {
130
130
  let t2 = e2.trim();
131
- t2 = t2.replace(ne, j).replace(re, j), t2 = t2.replace(ie, `\0`);
131
+ t2 = t2.replace(re, A).replace(ie, A), t2 = t2.replace(ae, `\0`);
132
132
  let n2 = 0, r2 = t2.length;
133
133
  for (; t2.charAt(n2) === `\0`; ) n2++;
134
134
  if (n2 === r2) return [];
135
135
  for (; t2.charAt(r2 - 1) === `\0`; ) r2--;
136
136
  return t2.slice(n2, r2).split(/\0/g);
137
137
  }
138
- var ae = (e2) => `validationError` in (e2.response?.data?.details ?? {});
139
- var oe = (e2) => `applicationError` in (e2.response?.data?.details ?? {});
138
+ var oe = (e2) => `validationError` in (e2.response?.data?.details ?? {});
139
+ var M = (e2) => `applicationError` in (e2.response?.data?.details ?? {});
140
140
  var se = (e2) => (e2.response?.status ?? -1) >= 400 && (e2.response?.status ?? -1) < 500;
141
141
  function N(e2, t2 = { explicitPathsToArguments: {}, spreadPathsToArguments: {}, singleArgumentUnchanged: false }, n2 = []) {
142
142
  if (typeof e2 != `object` || !e2) throw e2;
143
- if (ae(e2)) return ce(e2, t2, n2);
144
- if (oe(e2)) return ue(e2);
143
+ if (oe(e2)) return ce(e2, t2, n2);
144
+ if (M(e2)) return ue(e2);
145
145
  if (se(e2)) {
146
- let t3 = e2.response?.status, n3 = e2.response?.statusText ?? `UNKNOWN`, r2 = e2.response?.data?.message ?? n3, i2 = { applicationError: { description: n3, code: A(n3), data: {} }, requestId: e2.requestId };
146
+ 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 };
147
147
  return le(e2, { message: JSON.stringify({ message: r2, details: i2 }, null, 2), extraProperties: { details: i2, status: t3 } });
148
148
  }
149
149
  return de(e2);
@@ -154,10 +154,10 @@ var ce = (e2, t2, n2) => {
154
154
  };
155
155
  var le = (e2, { message: t2, extraProperties: n2 }) => Object.assign(e2, { ...n2, message: t2 });
156
156
  var ue = (e2) => {
157
- 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 ?? A(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 };
157
+ 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 };
158
158
  return le(e2, { message: JSON.stringify({ message: s2, details: c2 }, null, 2), extraProperties: { details: c2, status: t2, requestId: e2.requestId } });
159
159
  };
160
- 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: A(e2.response?.statusText ?? `UNKNOWN`), ...!e2.response && { runtimeError: e2 } } });
160
+ 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 } } });
161
161
  var fe = ({ spreadPathsToArguments: e2, explicitPathsToArguments: t2, singleArgumentUnchanged: n2 }, r2, i2) => {
162
162
  let a2 = { ...e2, ...t2 }, o2 = Object.keys(a2);
163
163
  return r2?.filter((e3) => !r2.some((t3) => t3.field.length > e3.field.length && t3.field.startsWith(e3.field) && o2.includes(t3.field))).map((e3) => {
@@ -180,7 +180,7 @@ var P = (e2) => {
180
180
  return t2 && t2.groups && Number(t2.groups.argIndex);
181
181
  };
182
182
  function me(e2, t2, n2, r2, i2, a2, o2, s2, c2, l2, u2) {
183
- return te(() => e2({ request: async (e3) => {
183
+ return ne(() => e2({ request: async (e3) => {
184
184
  let i3 = e3({ host: s2?.HTTPHost || `www.wixapis.com` }), a3 = i3;
185
185
  a3.method === `GET` && a3.fallback?.length && (a3.params?.toString().length ?? 0) > 4e3 && (a3 = i3.fallback[0]);
186
186
  let o3 = s2?.HTTPHost ?? `www.wixapis.com`, u3 = `https://${l2 ? b : o3}${a3.url}`;
@@ -283,7 +283,7 @@ var Se = class {
283
283
  if (!Array.isArray(n2)) throw Error(`Expected array at path ${this.buildPathString(r2)}, but got ${typeof n2}`);
284
284
  r2.push(`[${e3}]`), n2 = n2[parseInt(e3, 10)];
285
285
  }, a2 = (e3, t3) => {
286
- let i3 = e3 in k ? k[e3] : void 0;
286
+ let i3 = e3 in O ? O[e3] : void 0;
287
287
  if (i3 && i3 in t3) {
288
288
  r2.push(i3), n2 = t3[i3];
289
289
  return;
@@ -485,7 +485,7 @@ function Pe(e2) {
485
485
  if (typeof t3 == `function`) {
486
486
  if (`__type` in t3 && t3.__type === `wix_spi_error`) return t3;
487
487
  let r3 = e2.host?.apiBaseUrl ?? `www.wixapis.com`, o3 = e2.useCDN === void 0 ? i2().shouldUseCDN : e2.useCDN;
488
- return me(te(() => v(t3)) ? _(t3) : t3, n3 ?? {}, f2, e2.host?.getErrorHandler?.(), (e3, t4) => {
488
+ return me(ne(() => v(t3)) ? _(t3) : t3, n3 ?? {}, f2, e2.host?.getErrorHandler?.(), (e3, t4) => {
489
489
  let n4 = new URL(e3, `https://${r3}`);
490
490
  return n4.host = r3, n4.protocol = `https`, f2(n4.toString(), t4);
491
491
  }, i2().getActiveToken, async () => a2(), { HTTPHost: r3 }, e2.host?.name, o3, e2.validateRequestSchema);
@@ -854,24 +854,24 @@ function rn() {
854
854
  let t2 = new URL(e2);
855
855
  return t2?.pathname && t2.pathname !== `/` ? `${t2.hostname}${t2.pathname}` : t2.hostname;
856
856
  }
857
- var an = ({ clientSdk: e2, applicationId: t2 }) => ({ invoke: async ({ namespace: n2, method: r2, args: i2 }) => {
857
+ var U = ({ clientSdk: e2, applicationId: t2 }) => ({ invoke: async ({ namespace: n2, method: r2, args: i2 }) => {
858
858
  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`);
859
859
  return e2.invoke({ namespace: n2, method: r2, args: i2, applicationId: t2, accessToken: `accessToken` });
860
860
  }, getAccessToken: () => {
861
861
  throw Error(`Not implemented`);
862
862
  }, observeState: () => ({ disconnect: () => {
863
863
  } }) });
864
- var on = tn({ createHost: function(e2) {
864
+ var an = tn({ createHost: function(e2) {
865
865
  let t2 = (typeof $wixContext < `u` ? $wixContext.clientSdk : void 0) ?? e2?.clientSdk ?? (typeof window < `u` ? window?.clientSdk : void 0), { applicationId: n2 } = e2 || {};
866
866
  if (!n2) throw Error(`"createHost" was called without a required field "applicationId"`);
867
- return { channel: an({ clientSdk: t2, applicationId: n2 }), close: () => {
867
+ return { channel: U({ clientSdk: t2, applicationId: n2 }), close: () => {
868
868
  } };
869
869
  } });
870
- var U = (e2, t2) => {
871
- let n2 = on.host({ applicationId: e2, componentId: t2 }), r2 = on.auth();
870
+ var on = (e2, t2) => {
871
+ let n2 = an.host({ applicationId: e2, componentId: t2 }), r2 = an.auth();
872
872
  return Pe({ auth: r2, host: n2 }).enableContext(`module`), r2.getAccessTokenInjector();
873
873
  };
874
- var sn = (e2) => U(`13d21c63-b5ec-5912-8397-c3a5ddb27a97`, e2);
874
+ var sn = (e2) => on(`13d21c63-b5ec-5912-8397-c3a5ddb27a97`, e2);
875
875
  var cn = [`ANY_FEMALE`, `ANY_MALE`];
876
876
  var ln = `3.7.8`;
877
877
  var un = ln;
@@ -917,7 +917,7 @@ var Dn = dn ? (e2) => Buffer.from(e2, `utf8`).toString(`base64`) : pn ? (e2) =>
917
917
  var On = (e2, t2 = false) => t2 ? vn(Dn(e2)) : Dn(e2);
918
918
  var kn = (e2) => On(e2, true);
919
919
  var An = /[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g;
920
- var jn = (e2) => {
920
+ var G = (e2) => {
921
921
  switch (e2.length) {
922
922
  case 4:
923
923
  var t2 = ((7 & e2.charCodeAt(0)) << 18 | (63 & e2.charCodeAt(1)) << 12 | (63 & e2.charCodeAt(2)) << 6 | 63 & e2.charCodeAt(3)) - 65536;
@@ -928,18 +928,18 @@ var jn = (e2) => {
928
928
  return W((31 & e2.charCodeAt(0)) << 6 | 63 & e2.charCodeAt(1));
929
929
  }
930
930
  };
931
- var Mn = (e2) => e2.replace(An, jn);
932
- var G = (e2) => {
931
+ var jn = (e2) => e2.replace(An, G);
932
+ var Mn = (e2) => {
933
933
  if (e2 = e2.replace(/\s+/g, ``), !gn.test(e2)) throw TypeError(`malformed base64.`);
934
934
  e2 += `==`.slice(2 - (e2.length & 3));
935
935
  let t2, n2, r2, i2 = [];
936
936
  for (let a2 = 0; a2 < e2.length; ) t2 = hn[e2.charAt(a2++)] << 18 | hn[e2.charAt(a2++)] << 12 | (n2 = hn[e2.charAt(a2++)]) << 6 | (r2 = hn[e2.charAt(a2++)]), n2 === 64 ? i2.push(W(t2 >> 16 & 255)) : r2 === 64 ? i2.push(W(t2 >> 16 & 255, t2 >> 8 & 255)) : i2.push(W(t2 >> 16 & 255, t2 >> 8 & 255, t2 & 255));
937
937
  return i2.join(``);
938
938
  };
939
- var Nn = typeof atob == `function` ? (e2) => atob(yn(e2)) : dn ? (e2) => Buffer.from(e2, `base64`).toString(`binary`) : G;
939
+ var Nn = typeof atob == `function` ? (e2) => atob(yn(e2)) : dn ? (e2) => Buffer.from(e2, `base64`).toString(`binary`) : Mn;
940
940
  var Pn = dn ? (e2) => _n(Buffer.from(e2, `base64`)) : (e2) => _n(Nn(e2).split(``).map((e3) => e3.charCodeAt(0)));
941
941
  var Fn = (e2) => Pn(Ln(e2));
942
- var In = dn ? (e2) => Buffer.from(e2, `base64`).toString(`utf8`) : fn ? (e2) => fn.decode(Pn(e2)) : (e2) => Mn(Nn(e2));
942
+ var In = dn ? (e2) => Buffer.from(e2, `base64`).toString(`utf8`) : fn ? (e2) => fn.decode(Pn(e2)) : (e2) => jn(Nn(e2));
943
943
  var Ln = (e2) => yn(e2.replace(/[-_]/g, (e3) => e3 == `-` ? `+` : `/`));
944
944
  var Rn = (e2) => In(Ln(e2));
945
945
  var zn = (e2) => {
@@ -972,7 +972,7 @@ var Hn = function() {
972
972
  return Cn(this, true);
973
973
  });
974
974
  };
975
- var Un = { version: ln, VERSION: un, atob: Nn, atobPolyfill: G, btoa: xn, btoaPolyfill: bn, fromBase64: Rn, toBase64: On, encode: On, encodeURI: kn, encodeURL: kn, utob: En, btou: Mn, decode: Rn, isValid: zn, fromUint8Array: Cn, toUint8Array: Fn, extendString: Vn, extendUint8Array: Hn, extendBuiltins: () => {
975
+ var Un = { version: ln, VERSION: un, atob: Nn, atobPolyfill: Mn, btoa: xn, btoaPolyfill: bn, fromBase64: Rn, toBase64: On, encode: On, encodeURI: kn, encodeURL: kn, utob: En, btou: jn, decode: Rn, isValid: zn, fromUint8Array: Cn, toUint8Array: Fn, extendString: Vn, extendUint8Array: Hn, extendBuiltins: () => {
976
976
  Vn(), Hn();
977
977
  } };
978
978
  var K = Uint8Array;
@@ -1081,18 +1081,18 @@ var hr = function(e2, t2, n2, r2) {
1081
1081
  d2 += 14;
1082
1082
  for (var T2 = new K(w2), ee2 = new K(19), E2 = 0; E2 < C2; ++E2) ee2[Jn[E2]] = lr(e2, d2 + E2 * 3, 7);
1083
1083
  d2 += C2 * 3;
1084
- for (var D2 = cr(ee2), O2 = (1 << D2) - 1, te2 = rr(ee2, D2, 1), E2 = 0; E2 < w2; ) {
1085
- var k2 = te2[lr(e2, d2, O2)];
1086
- d2 += k2 & 15;
1087
- var y2 = k2 >> 4;
1084
+ for (var D2 = cr(ee2), te2 = (1 << D2) - 1, ne2 = rr(ee2, D2, 1), E2 = 0; E2 < w2; ) {
1085
+ var O2 = ne2[lr(e2, d2, te2)];
1086
+ d2 += O2 & 15;
1087
+ var y2 = O2 >> 4;
1088
1088
  if (y2 < 16) T2[E2++] = y2;
1089
1089
  else {
1090
- var A2 = 0, ne2 = 0;
1091
- for (y2 == 16 ? (ne2 = 3 + lr(e2, d2, 3), d2 += 2, A2 = T2[E2 - 1]) : y2 == 17 ? (ne2 = 3 + lr(e2, d2, 7), d2 += 3) : y2 == 18 && (ne2 = 11 + lr(e2, d2, 127), d2 += 7); ne2--; ) T2[E2++] = A2;
1090
+ var k2 = 0, re2 = 0;
1091
+ for (y2 == 16 ? (re2 = 3 + lr(e2, d2, 3), d2 += 2, k2 = T2[E2 - 1]) : y2 == 17 ? (re2 = 3 + lr(e2, d2, 7), d2 += 3) : y2 == 18 && (re2 = 11 + lr(e2, d2, 127), d2 += 7); re2--; ) T2[E2++] = k2;
1092
1092
  }
1093
1093
  }
1094
- var re2 = T2.subarray(0, S2), j2 = T2.subarray(S2);
1095
- h2 = cr(re2), g2 = cr(j2), p2 = rr(re2, h2, 1), m2 = rr(j2, g2, 1);
1094
+ var ie2 = T2.subarray(0, S2), A2 = T2.subarray(S2);
1095
+ h2 = cr(ie2), g2 = cr(A2), p2 = rr(ie2, h2, 1), m2 = rr(A2, g2, 1);
1096
1096
  } else mr(1);
1097
1097
  if (d2 > _2) {
1098
1098
  c2 && mr(0);
@@ -1100,28 +1100,28 @@ var hr = function(e2, t2, n2, r2) {
1100
1100
  }
1101
1101
  }
1102
1102
  s2 && l2(f2 + 131072);
1103
- for (var ie2 = (1 << h2) - 1, M2 = (1 << g2) - 1, ae2 = d2; ; ae2 = d2) {
1104
- var A2 = p2[ur(e2, d2) & ie2], oe2 = A2 >> 4;
1105
- if (d2 += A2 & 15, d2 > _2) {
1103
+ for (var ae2 = (1 << h2) - 1, j2 = (1 << g2) - 1, oe2 = d2; ; oe2 = d2) {
1104
+ var k2 = p2[ur(e2, d2) & ae2], M2 = k2 >> 4;
1105
+ if (d2 += k2 & 15, d2 > _2) {
1106
1106
  c2 && mr(0);
1107
1107
  break;
1108
1108
  }
1109
- if (A2 || mr(2), oe2 < 256) n2[f2++] = oe2;
1110
- else if (oe2 == 256) {
1111
- ae2 = d2, p2 = null;
1109
+ if (k2 || mr(2), M2 < 256) n2[f2++] = M2;
1110
+ else if (M2 == 256) {
1111
+ oe2 = d2, p2 = null;
1112
1112
  break;
1113
1113
  } else {
1114
- var se2 = oe2 - 254;
1115
- if (oe2 > 264) {
1116
- var E2 = oe2 - 257, N2 = Kn[E2];
1114
+ var se2 = M2 - 254;
1115
+ if (M2 > 264) {
1116
+ var E2 = M2 - 257, N2 = Kn[E2];
1117
1117
  se2 = lr(e2, d2, (1 << N2) - 1) + Zn[E2], d2 += N2;
1118
1118
  }
1119
- var ce2 = m2[ur(e2, d2) & M2], le2 = ce2 >> 4;
1119
+ var ce2 = m2[ur(e2, d2) & j2], le2 = ce2 >> 4;
1120
1120
  ce2 || mr(3), d2 += ce2 & 15;
1121
- var j2 = er[le2];
1121
+ var A2 = er[le2];
1122
1122
  if (le2 > 3) {
1123
1123
  var N2 = qn[le2];
1124
- j2 += ur(e2, d2) & (1 << N2) - 1, d2 += N2;
1124
+ A2 += ur(e2, d2) & (1 << N2) - 1, d2 += N2;
1125
1125
  }
1126
1126
  if (d2 > _2) {
1127
1127
  c2 && mr(0);
@@ -1129,14 +1129,14 @@ var hr = function(e2, t2, n2, r2) {
1129
1129
  }
1130
1130
  s2 && l2(f2 + 131072);
1131
1131
  var ue2 = f2 + se2;
1132
- if (f2 < j2) {
1133
- var de2 = a2 - j2, fe2 = Math.min(j2, ue2);
1132
+ if (f2 < A2) {
1133
+ var de2 = a2 - A2, fe2 = Math.min(A2, ue2);
1134
1134
  for (de2 + f2 < 0 && mr(3); f2 < fe2; ++f2) n2[f2] = r2[de2 + f2];
1135
1135
  }
1136
- for (; f2 < ue2; ++f2) n2[f2] = n2[f2 - j2];
1136
+ for (; f2 < ue2; ++f2) n2[f2] = n2[f2 - A2];
1137
1137
  }
1138
1138
  }
1139
- t2.l = p2, t2.p = ae2, t2.b = f2, t2.f = u2, p2 && (u2 = 1, t2.m = h2, t2.d = m2, t2.n = g2);
1139
+ t2.l = p2, t2.p = oe2, t2.b = f2, t2.f = u2, p2 && (u2 = 1, t2.m = h2, t2.d = m2, t2.n = g2);
1140
1140
  } while (!u2);
1141
1141
  return f2 != n2.length && o2 ? fr(n2, 0, f2) : n2.subarray(0, f2);
1142
1142
  };
@@ -1915,54 +1915,42 @@ function Vo(e2) {
1915
1915
  let t2 = ko(e2), n2 = new Date(t2.getFullYear(), t2.getMonth(), 1), r2 = new Date(t2.getFullYear(), t2.getMonth() + 1, 0);
1916
1916
  return { startDate: Oo(n2), endDate: Oo(r2) };
1917
1917
  }
1918
- function Ho(e2) {
1919
- let t2 = Vo(e2.startDate);
1920
- return t2.startDate === e2.startDate && t2.endDate === e2.endDate;
1921
- }
1922
- function Uo(e2, t2) {
1923
- if (Ho(e2)) {
1924
- let n3 = ko(e2.startDate);
1925
- return Vo(Oo(new Date(n3.getFullYear(), n3.getMonth() + t2, 1)));
1926
- }
1927
- let n2 = t2 * Bo(e2);
1928
- return { startDate: zo(e2.startDate, n2), endDate: zo(e2.endDate, n2) };
1929
- }
1930
- function Wo(e2, t2) {
1918
+ function Ho(e2, t2) {
1931
1919
  return e2 >= t2.startDate && e2 <= t2.endDate;
1932
1920
  }
1933
- function Go(e2) {
1921
+ function Uo(e2) {
1934
1922
  let t2 = ko(e2), n2 = new Date(t2.getFullYear(), t2.getMonth() + 2, 0).getDate(), r2 = Math.min(t2.getDate(), n2);
1935
1923
  return Oo(new Date(t2.getFullYear(), t2.getMonth() + 1, r2));
1936
1924
  }
1937
- function Ko(e2) {
1925
+ function Wo(e2) {
1938
1926
  let t2 = [], n2 = e2.startDate;
1939
1927
  for (; n2 <= e2.endDate; ) {
1940
- let r2 = zo(Go(n2), -1), i2 = r2 < e2.endDate ? r2 : e2.endDate;
1928
+ let r2 = zo(Uo(n2), -1), i2 = r2 < e2.endDate ? r2 : e2.endDate;
1941
1929
  t2.push({ startDate: n2, endDate: i2 }), n2 = zo(i2, 1);
1942
1930
  }
1943
1931
  return t2;
1944
1932
  }
1945
- function qo({ allowGenderSelection: e2, staffSelectionStrategy: t2 }) {
1933
+ function Go({ allowGenderSelection: e2, staffSelectionStrategy: t2 }) {
1946
1934
  return e2 && t2 !== `CUSTOMER_CANNOT_CHOOSE`;
1947
1935
  }
1948
- async function Jo() {
1936
+ async function Ko() {
1949
1937
  let e2 = await Ia(Vr);
1950
1938
  return { businessTimeZone: e2.timeSlotsConfiguration?.displayTimeZone?.timeZone || null, staffSelectionStrategy: e2.timeSlotsConfiguration?.staffSelection?.strategy ?? null, allowGenderSelection: e2.timeSlotsConfiguration?.staffSelection?.allowGenderSelection ?? false };
1951
1939
  }
1952
- function Yo(e2) {
1940
+ function qo(e2) {
1953
1941
  let t2 = e2.location?._id || (e2.location?.locationType ? `${e2.location.locationType}:${e2.location.formattedAddress ?? ``}` : ``);
1954
1942
  return `${e2.localStartDate ?? ``}|${e2.localEndDate ?? ``}|${t2}`;
1955
1943
  }
1956
- function Xo(e2) {
1944
+ function Jo(e2) {
1957
1945
  return e2.availableResources?.[0]?.resources?.[0]?._id ?? null;
1958
1946
  }
1959
- function Zo(e2) {
1960
- return `${Yo(e2)}|${Xo(e2) ?? ``}`;
1947
+ function Yo(e2) {
1948
+ return `${qo(e2)}|${Jo(e2) ?? ``}`;
1961
1949
  }
1962
- function Qo(e2) {
1950
+ function Xo(e2) {
1963
1951
  let t2 = /* @__PURE__ */ new Map();
1964
1952
  for (let n2 of e2) {
1965
- let e3 = Yo(n2), r2 = t2.get(e3);
1953
+ let e3 = qo(n2), r2 = t2.get(e3);
1966
1954
  r2 ? r2.push(n2) : t2.set(e3, [n2]);
1967
1955
  }
1968
1956
  return [...t2.values()].map((e3) => {
@@ -1971,132 +1959,132 @@ function Qo(e2) {
1971
1959
  return { ...n2[0], availableResources: n2.flatMap((e4) => e4.availableResources ?? []) };
1972
1960
  });
1973
1961
  }
1974
- function $o(e2) {
1962
+ function Zo(e2) {
1975
1963
  return e2 ? { locations: [{ _id: e2, locationType: `BUSINESS` }] } : {};
1976
1964
  }
1977
- function es(e2) {
1965
+ function Qo(e2) {
1978
1966
  return e2 ? { resourceTypes: [{ resourceTypeId: Wr, resourceIds: [e2] }] } : {};
1979
1967
  }
1980
- function ts(e2) {
1968
+ function $o(e2) {
1981
1969
  let { requestedGender: t2, ...n2 } = e2;
1982
1970
  return Object.keys(n2).length ? n2 : void 0;
1983
1971
  }
1984
- function ns(e2, t2) {
1972
+ function es(e2, t2) {
1985
1973
  if (!e2) return {};
1986
- let n2 = t2 ? ts(e2) : e2;
1974
+ let n2 = t2 ? $o(e2) : e2;
1987
1975
  return n2 ? { customerChoices: n2 } : {};
1988
1976
  }
1989
- var rs = `REQUESTED_GENDER_NOT_ALLOWED`;
1990
- function is(e2) {
1991
- return _o(e2) === rs;
1977
+ var ts = `REQUESTED_GENDER_NOT_ALLOWED`;
1978
+ function ns(e2) {
1979
+ return _o(e2) === ts;
1992
1980
  }
1993
- var as = false;
1994
- var os = /* @__PURE__ */ new Set();
1995
- function ss() {
1996
- return as;
1981
+ var rs = false;
1982
+ var is = /* @__PURE__ */ new Set();
1983
+ function as() {
1984
+ return rs;
1997
1985
  }
1998
- function cs(e2) {
1999
- return os.add(e2), () => os.delete(e2);
1986
+ function os(e2) {
1987
+ return is.add(e2), () => is.delete(e2);
2000
1988
  }
2001
- function ls() {
2002
- as || (as = true, os.forEach((e2) => e2()));
1989
+ function ss() {
1990
+ rs || (rs = true, is.forEach((e2) => e2()));
2003
1991
  }
2004
- async function us(e2) {
1992
+ async function cs(e2) {
2005
1993
  let { customerChoices: t2, ...n2 } = e2, r2 = (e3) => {
2006
- let t3 = ts(e3);
1994
+ let t3 = $o(e3);
2007
1995
  return la({ ...n2, ...t3 ? { customerChoices: t3 } : {} });
2008
1996
  };
2009
- if (as && t2?.requestedGender) return r2(t2);
1997
+ if (rs && t2?.requestedGender) return r2(t2);
2010
1998
  try {
2011
1999
  return await la(e2);
2012
2000
  } catch (e3) {
2013
- if (!t2?.requestedGender || !is(e3)) throw e3;
2014
- return $(e3, { feature: Q.timeSlots, action: `requested-gender-rejected`, level: `warning` }), ls(), r2(t2);
2001
+ if (!t2?.requestedGender || !ns(e3)) throw e3;
2002
+ return $(e3, { feature: Q.timeSlots, action: `requested-gender-rejected`, level: `warning` }), ss(), r2(t2);
2015
2003
  }
2016
2004
  }
2017
- function ds(e2, t2, n2) {
2005
+ function ls(e2, t2, n2) {
2018
2006
  return { ...e2 ? { "location.id": e2 } : {}, ...t2 ? { "resources.id": { $hasSome: [t2] } } : {}, ...n2 ? { remainingCapacity: { $gte: n2 } } : {} };
2019
2007
  }
2020
- async function fs(e2) {
2008
+ async function us(e2) {
2021
2009
  let t2 = await _a(e2);
2022
2010
  return { timeSlots: t2.timeSlots ?? [], timeZone: t2.timeZone ?? null, nextCursor: t2.pagingMetadata?.cursors?.next || null };
2023
2011
  }
2024
- function ps({ 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 }) {
2025
- return Ya(t2) ? ms({ serviceId: e2, fromLocalDate: n2, toLocalDate: r2, timeZone: i2, locationId: a2, staffId: o2, onlyAvailableSlots: s2, customerChoices: c2, timeSlotsPerDay: u2, limit: d2, cursor: f2 }) : fs({ serviceIds: [e2], fromLocalDate: n2, ...r2 ? { toLocalDate: r2 } : {}, ...i2 ? { timeZone: i2 } : {}, includeNonBookable: !s2, eventFilter: { type: t2, ...ds(a2, o2, l2) }, cursorPaging: { limit: d2, ...f2 ? { cursor: f2 } : {} } });
2012
+ function ds({ 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 }) {
2013
+ return Ya(t2) ? fs({ serviceId: e2, fromLocalDate: n2, toLocalDate: r2, timeZone: i2, locationId: a2, staffId: o2, onlyAvailableSlots: s2, customerChoices: c2, timeSlotsPerDay: u2, limit: d2, cursor: f2 }) : us({ serviceIds: [e2], fromLocalDate: n2, ...r2 ? { toLocalDate: r2 } : {}, ...i2 ? { timeZone: i2 } : {}, includeNonBookable: !s2, eventFilter: { type: t2, ...ls(a2, o2, l2) }, cursorPaging: { limit: d2, ...f2 ? { cursor: f2 } : {} } });
2026
2014
  }
2027
- async function ms({ serviceId: e2, fromLocalDate: t2, toLocalDate: n2, timeZone: r2, locationId: i2, staffId: a2, onlyAvailableSlots: o2, customerChoices: s2, timeSlotsPerDay: c2, limit: l2, cursor: u2 }) {
2028
- let d2 = await us({ serviceId: e2, fromLocalDate: t2, ...n2 ? { toLocalDate: n2 } : {}, ...r2 ? { timeZone: r2 } : {}, ...o2 ? { bookable: true } : {}, ...$o(i2), ...es(a2), ...ns(s2, a2), includeResourceTypeIds: [Wr], ...c2 == null ? {} : { timeSlotsPerDay: c2 }, cursorPaging: { limit: l2, ...u2 ? { cursor: u2 } : {} } });
2015
+ async function fs({ serviceId: e2, fromLocalDate: t2, toLocalDate: n2, timeZone: r2, locationId: i2, staffId: a2, onlyAvailableSlots: o2, customerChoices: s2, timeSlotsPerDay: c2, limit: l2, cursor: u2 }) {
2016
+ let d2 = await cs({ serviceId: e2, fromLocalDate: t2, ...n2 ? { toLocalDate: n2 } : {}, ...r2 ? { timeZone: r2 } : {}, ...o2 ? { bookable: true } : {}, ...Zo(i2), ...Qo(a2), ...es(s2, a2), includeResourceTypeIds: [Wr], ...c2 == null ? {} : { timeSlotsPerDay: c2 }, cursorPaging: { limit: l2, ...u2 ? { cursor: u2 } : {} } });
2029
2017
  return { timeSlots: d2.timeSlots ?? [], timeZone: d2.timeZone ?? null, nextCursor: d2.cursorPagingMetadata?.cursors?.next || null };
2030
2018
  }
2031
- var hs = 6;
2032
- var gs = 864e5;
2033
- function _s(e2) {
2034
- let t2 = e2 ? ko(e2) : new Date(Date.now()), n2 = new Date(t2.getFullYear(), t2.getMonth() + hs + 1, 1), r2 = new Date(n2.getTime() - gs);
2019
+ var ps = 6;
2020
+ var ms = 864e5;
2021
+ function hs(e2) {
2022
+ let t2 = e2 ? ko(e2) : new Date(Date.now()), n2 = new Date(t2.getFullYear(), t2.getMonth() + ps + 1, 1), r2 = new Date(n2.getTime() - ms);
2035
2023
  return { fromLocalDate: jo(t2), toLocalDate: Mo(r2) };
2036
2024
  }
2037
- async function vs({ serviceId: e2, serviceType: t2, timeZone: n2, limit: r2, onlyAvailableSlots: i2 = true, fromDate: a2, locationId: o2, staffId: s2, customerChoices: c2, minRemainingCapacity: l2 }) {
2038
- let { fromLocalDate: u2, toLocalDate: d2 } = _s(a2);
2025
+ async function gs({ serviceId: e2, serviceType: t2, timeZone: n2, limit: r2, onlyAvailableSlots: i2 = true, fromDate: a2, locationId: o2, staffId: s2, customerChoices: c2, minRemainingCapacity: l2 }) {
2026
+ let { fromLocalDate: u2, toLocalDate: d2 } = hs(a2);
2039
2027
  if (Xa(t2) || Za(t2)) {
2040
- let a3 = { ...Za(t2) ? { type: `COURSE` } : {}, ...ds(o2, s2, l2) }, c3 = await fs({ serviceIds: [e2], fromLocalDate: u2, toLocalDate: d2, ...n2 ? { timeZone: n2 } : {}, includeNonBookable: !i2, ...Object.keys(a3).length ? { eventFilter: a3 } : {}, ...r2 == null ? {} : { cursorPaging: { limit: r2 } } });
2028
+ let a3 = { ...Za(t2) ? { type: `COURSE` } : {}, ...ls(o2, s2, l2) }, c3 = await us({ serviceIds: [e2], fromLocalDate: u2, toLocalDate: d2, ...n2 ? { timeZone: n2 } : {}, includeNonBookable: !i2, ...Object.keys(a3).length ? { eventFilter: a3 } : {}, ...r2 == null ? {} : { cursorPaging: { limit: r2 } } });
2041
2029
  return { timeSlots: c3.timeSlots, timeZone: c3.timeZone };
2042
2030
  }
2043
- let f2 = await us({ serviceId: e2, fromLocalDate: u2, toLocalDate: d2, ...n2 ? { timeZone: n2 } : {}, ...i2 ? { bookable: true } : {}, ...$o(o2), ...es(s2), ...ns(c2, s2), includeResourceTypeIds: [Wr], ...r2 == null ? {} : { cursorPaging: { limit: r2 } } });
2031
+ let f2 = await cs({ serviceId: e2, fromLocalDate: u2, toLocalDate: d2, ...n2 ? { timeZone: n2 } : {}, ...i2 ? { bookable: true } : {}, ...Zo(o2), ...Qo(s2), ...es(c2, s2), includeResourceTypeIds: [Wr], ...r2 == null ? {} : { cursorPaging: { limit: r2 } } });
2044
2032
  return { timeSlots: f2.timeSlots ?? [], timeZone: f2.timeZone ?? null };
2045
2033
  }
2046
- var ys = 1e3;
2047
- async function bs({ serviceId: e2, serviceType: t2, date: n2, timeZone: r2, onlyAvailableSlots: i2, locationId: a2, staffId: o2, customerChoices: s2, minRemainingCapacity: c2, fromLocalDate: l2, toLocalDate: u2 }) {
2034
+ var _s = 1e3;
2035
+ async function vs({ serviceId: e2, serviceType: t2, date: n2, timeZone: r2, onlyAvailableSlots: i2, locationId: a2, staffId: o2, customerChoices: s2, minRemainingCapacity: c2, fromLocalDate: l2, toLocalDate: u2 }) {
2048
2036
  let d2 = `${n2}T00:00:00`, f2 = `${n2}T23:59:59`, p2 = Za(t2) ? `COURSE` : Xa(t2) ? `CLASS` : `APPOINTMENT`, m2 = [], h2 = null, g2;
2049
2037
  do {
2050
- let t3 = await ps({ 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: ys, cursor: g2 });
2038
+ let t3 = await ds({ 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: _s, cursor: g2 });
2051
2039
  m2.push(...t3.timeSlots), h2 = t3.timeZone ?? h2, g2 = t3.nextCursor ?? void 0;
2052
2040
  } while (g2);
2053
2041
  return { timeSlots: m2, timeZone: h2 };
2054
2042
  }
2055
- function xs(e2) {
2043
+ function ys(e2) {
2056
2044
  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 };
2057
2045
  }
2058
- function Ss(e2) {
2046
+ function bs(e2) {
2059
2047
  return e2?.options?.values?.[0]?.type === Ea.STAFF_MEMBER;
2060
2048
  }
2061
- function Cs(e2) {
2049
+ function xs(e2) {
2062
2050
  return e2.staffMemberDetails?.staffMembers ?? [];
2063
2051
  }
2064
- function ws(e2, t2) {
2052
+ function Ss(e2, t2) {
2065
2053
  let n2 = e2.workingHoursLocationCoverage;
2066
2054
  return { staffMemberId: e2.staffMemberId ?? ``, name: e2.name ?? null, image: null, isSelected: t2 === e2.staffMemberId, ...n2 ? { locationCoverage: { availableAtAllLocations: n2.availableAtAllLocations ?? false, locationIds: n2.locationIds ?? [] } } : {} };
2067
2055
  }
2068
- function Ts(e2, t2) {
2056
+ function Cs(e2, t2) {
2069
2057
  let n2 = e2.locationCoverage;
2070
2058
  return !n2 || n2.availableAtAllLocations || n2.locationIds.includes(t2);
2071
2059
  }
2072
- function Es(e2, t2) {
2073
- return t2 ? e2.filter((e3) => Ts(e3, t2)) : e2;
2060
+ function ws(e2, t2) {
2061
+ return t2 ? e2.filter((e3) => Cs(e3, t2)) : e2;
2074
2062
  }
2075
- function Ds(e2, t2) {
2063
+ function Ts(e2, t2) {
2076
2064
  let n2 = new Map(t2.map((e3) => [e3.staffMemberId, e3.locationCoverage]));
2077
2065
  return e2.choices.map((e3) => e3.choiceId).filter((e3) => e3 != null).map((e3) => ({ staffMemberId: e3, locationCoverage: n2.get(e3) }));
2078
2066
  }
2079
- function Os(e2, t2, n2) {
2067
+ function Es(e2, t2, n2) {
2080
2068
  if (e2?.type !== `STAFF_MEMBER` || !n2) return;
2081
- let r2 = Es(Ds(e2, t2), n2);
2069
+ let r2 = ws(Ts(e2, t2), n2);
2082
2070
  return r2.length === 1 ? r2[0].staffMemberId : void 0;
2083
2071
  }
2084
- function ks(e2, t2) {
2072
+ function Ds(e2, t2) {
2085
2073
  if (t2.length === 0) return e2;
2086
- let n2 = e2.filter((e3) => Es(t2, e3.id).length > 0);
2074
+ let n2 = e2.filter((e3) => ws(t2, e3.id).length > 0);
2087
2075
  return n2.length > 0 ? n2 : e2;
2088
2076
  }
2089
- function As(e2) {
2090
- return Cs(e2).map((e3) => ws(e3, null));
2077
+ function Os(e2) {
2078
+ return xs(e2).map((e3) => Ss(e3, null));
2091
2079
  }
2092
- function js(e2, t2, n2 = false) {
2093
- let r2 = Ms(e2), i2 = r2.length === 1 ? r2[0].id : void 0, a2 = n2 || !i2 || r2.some((e3) => e3.id === t2);
2080
+ function ks(e2, t2, n2 = false) {
2081
+ let r2 = As(e2), i2 = r2.length === 1 ? r2[0].id : void 0, a2 = n2 || !i2 || r2.some((e3) => e3.id === t2);
2094
2082
  return t2 && a2 ? t2 : i2;
2095
2083
  }
2096
- function Ms(e2) {
2097
- return ks(Ja(e2), As(e2));
2084
+ function As(e2) {
2085
+ return Ds(Ja(e2), Os(e2));
2098
2086
  }
2099
- function Ns(e2) {
2087
+ function js(e2) {
2100
2088
  let t2 = e2;
2101
2089
  if (t2.__state || (t2.__state = { status: `pending` }, t2.then((e3) => {
2102
2090
  t2.__state = { status: `fulfilled`, value: e3 };
@@ -2105,27 +2093,27 @@ function Ns(e2) {
2105
2093
  })), t2.__state.status === `fulfilled`) return t2.__state.value;
2106
2094
  throw t2.__state.status === `rejected` ? t2.__state.reason : t2;
2107
2095
  }
2108
- function Ps(e2) {
2096
+ function Ms(e2) {
2109
2097
  let t2 = Promise.resolve(e2);
2110
2098
  return t2.__state = { status: `fulfilled`, value: e2 }, t2;
2111
2099
  }
2112
- var Fs = Fr(`@wix/site-service-warmup-data`);
2113
- function Is() {
2100
+ var Ns = Fr(`@wix/site-service-warmup-data`);
2101
+ function Ps() {
2114
2102
  try {
2115
2103
  return (0, import_services_manager_react.useGetService)();
2116
2104
  } catch {
2117
2105
  return null;
2118
2106
  }
2119
2107
  }
2120
- function Ls(e2) {
2108
+ function Fs(e2) {
2121
2109
  try {
2122
- return e2 ? e2(Fs) : null;
2110
+ return e2 ? e2(Ns) : null;
2123
2111
  } catch {
2124
2112
  return null;
2125
2113
  }
2126
2114
  }
2127
- function Rs() {
2128
- let e2 = Ls(Is()), t2 = typeof window > `u`;
2115
+ function Is() {
2116
+ let e2 = Fs(Ps()), t2 = typeof window > `u`;
2129
2117
  return { scope: e2 ?? void 0, get: async (n2) => {
2130
2118
  if (t2 || !e2) return null;
2131
2119
  try {
@@ -2140,57 +2128,57 @@ function Rs() {
2140
2128
  }
2141
2129
  } };
2142
2130
  }
2143
- var zs = `bookings-uou`;
2144
- function Bs() {
2145
- return `${zs}:bookings-settings`;
2131
+ var Ls = `bookings-uou`;
2132
+ function Rs() {
2133
+ return `${Ls}:bookings-settings`;
2146
2134
  }
2147
- function Vs() {
2148
- return `${zs}:time-slots-configuration`;
2135
+ function zs() {
2136
+ return `${Ls}:time-slots-configuration`;
2149
2137
  }
2150
- var Hs = 5e3;
2151
- var Us = 100;
2152
- var Ws = `wix-warmup-data`;
2153
- var Gs = null;
2154
- function Ks(e2) {
2138
+ var Bs = 5e3;
2139
+ var Vs = 100;
2140
+ var Hs = `wix-warmup-data`;
2141
+ var Us = null;
2142
+ function Ws(e2) {
2155
2143
  if (typeof document < `u`) try {
2156
- let t2 = document.getElementById(Ws)?.textContent;
2157
- return t2 ? (Gs?.text !== t2 && (Gs = { text: t2, data: JSON.parse(t2).builderComponentsWarmupData ?? {} }), Gs.data[e2] ?? void 0) : void 0;
2144
+ let t2 = document.getElementById(Hs)?.textContent;
2145
+ return t2 ? (Us?.text !== t2 && (Us = { text: t2, data: JSON.parse(t2).builderComponentsWarmupData ?? {} }), Us.data[e2] ?? void 0) : void 0;
2158
2146
  } catch {
2159
2147
  return;
2160
2148
  }
2161
2149
  }
2162
- var qs = () => ({ promises: /* @__PURE__ */ new Map(), invalidatedWarmup: /* @__PURE__ */ new Set() });
2163
- var Js = qs();
2164
- var Ys = /* @__PURE__ */ new WeakMap();
2165
- var Xs = /* @__PURE__ */ new WeakMap();
2166
- function Zs(e2) {
2167
- if (!e2) return Js;
2168
- let t2 = Ys.get(e2);
2169
- return t2 || (t2 = qs(), Ys.set(e2, t2)), t2;
2150
+ var Gs = () => ({ promises: /* @__PURE__ */ new Map(), invalidatedWarmup: /* @__PURE__ */ new Set() });
2151
+ var Ks = Gs();
2152
+ var qs = /* @__PURE__ */ new WeakMap();
2153
+ var Js = /* @__PURE__ */ new WeakMap();
2154
+ function Ys(e2) {
2155
+ if (!e2) return Ks;
2156
+ let t2 = qs.get(e2);
2157
+ return t2 || (t2 = Gs(), qs.set(e2, t2)), t2;
2170
2158
  }
2171
- function Qs({ key: e2, warmupData: t2, fetchData: n2, refresh: r2 = false }) {
2159
+ function Xs({ key: e2, warmupData: t2, fetchData: n2, refresh: r2 = false }) {
2172
2160
  if (e2 === null) return n2();
2173
2161
  if (typeof window > `u`) {
2174
2162
  let r3 = () => n2().then((n3) => (t2.set(e2, n3), n3)), { scope: i3 } = t2;
2175
2163
  if (!i3) return r3();
2176
- let a3 = Xs.get(i3);
2177
- a3 || (a3 = /* @__PURE__ */ new Map(), Xs.set(i3, a3));
2164
+ let a3 = Js.get(i3);
2165
+ a3 || (a3 = /* @__PURE__ */ new Map(), Js.set(i3, a3));
2178
2166
  let o3 = a3.get(e2);
2179
2167
  if (o3) return o3;
2180
2168
  let s3 = r3();
2181
2169
  return a3.set(e2, s3), s3.catch(() => a3.delete(e2)), s3;
2182
2170
  }
2183
- let i2 = Zs(t2.scope), a2 = Date.now();
2171
+ let i2 = Ys(t2.scope), a2 = Date.now();
2184
2172
  for (let [e3, t3] of i2.promises) t3.expiresAt <= a2 && i2.promises.delete(e3);
2185
2173
  let o2 = i2.promises.get(e2);
2186
2174
  if (o2 && !r2) return o2.promise;
2187
2175
  r2 && i2.invalidatedWarmup.add(e2);
2188
2176
  let s2 = !i2.invalidatedWarmup.has(e2);
2189
2177
  if (s2) {
2190
- let t3 = Ks(e2);
2178
+ let t3 = Ws(e2);
2191
2179
  if (t3 !== void 0) {
2192
- let n3 = Ps(t3);
2193
- return i2.promises.set(e2, { promise: n3, expiresAt: a2 + Hs }), n3;
2180
+ let n3 = Ms(t3);
2181
+ return i2.promises.set(e2, { promise: n3, expiresAt: a2 + Bs }), n3;
2194
2182
  }
2195
2183
  }
2196
2184
  let c2 = (async () => {
@@ -2200,48 +2188,48 @@ function Qs({ key: e2, warmupData: t2, fetchData: n2, refresh: r2 = false }) {
2200
2188
  }
2201
2189
  return n2();
2202
2190
  })();
2203
- i2.promises.size >= Us && i2.promises.delete(i2.promises.keys().next().value);
2191
+ i2.promises.size >= Vs && i2.promises.delete(i2.promises.keys().next().value);
2204
2192
  let l2 = { promise: c2, expiresAt: 1 / 0 };
2205
2193
  return i2.promises.set(e2, l2), c2.then(() => {
2206
- l2.expiresAt = Date.now() + Hs;
2194
+ l2.expiresAt = Date.now() + Bs;
2207
2195
  }, () => {
2208
2196
  i2.promises.get(e2) === l2 && i2.promises.delete(e2);
2209
2197
  }), c2;
2210
2198
  }
2211
- var $s = { displayTimeZonePolicy: { basedOn: Ha.BUSINESS_TIME_ZONE, customerCanChange: false }, multiServiceAppointmentsEnabled: false };
2212
- async function ec() {
2199
+ var Zs = { displayTimeZonePolicy: { basedOn: Ha.BUSINESS_TIME_ZONE, customerCanChange: false }, multiServiceAppointmentsEnabled: false };
2200
+ async function Qs() {
2213
2201
  try {
2214
2202
  let e2 = await Ga();
2215
2203
  return { displayTimeZonePolicy: { basedOn: e2.displayTimeZone?.basedOn ?? Ha.BUSINESS_TIME_ZONE, customerCanChange: e2.displayTimeZone?.customerCanChange ?? false }, multiServiceAppointmentsEnabled: e2.multiServiceAppointments?.enabled ?? false };
2216
2204
  } catch (e2) {
2217
- return $(e2, { feature: Q.bookingsSettings, action: `fetch-bookings-settings`, level: `warning` }), $s;
2205
+ return $(e2, { feature: Q.bookingsSettings, action: `fetch-bookings-settings`, level: `warning` }), Zs;
2218
2206
  }
2219
2207
  }
2220
- var tc = { isLoading: true };
2221
- var nc = (0, import_react.createContext)(null);
2222
- var rc = `useBookingsSettingsContext must be used within BookingsSettingsProvider`;
2223
- function ic() {
2224
- let e2 = (0, import_react.useContext)(nc);
2225
- if (!e2) throw Error(rc);
2208
+ var $s = { isLoading: true };
2209
+ var ec = (0, import_react.createContext)(null);
2210
+ var tc = `useBookingsSettingsContext must be used within BookingsSettingsProvider`;
2211
+ function nc() {
2212
+ let e2 = (0, import_react.useContext)(ec);
2213
+ if (!e2) throw Error(tc);
2226
2214
  return e2;
2227
2215
  }
2228
- function ac(e2) {
2216
+ function rc(e2) {
2229
2217
  return e2.basedOn === Ha.CUSTOMER_TIME_ZONE ? Intl.DateTimeFormat().resolvedOptions().timeZone : void 0;
2230
2218
  }
2231
- function oc() {
2232
- let e2 = ic();
2233
- return e2.isLoading ? void 0 : ac(e2.displayTimeZonePolicy);
2219
+ function ic() {
2220
+ let e2 = nc();
2221
+ return e2.isLoading ? void 0 : rc(e2.displayTimeZonePolicy);
2234
2222
  }
2235
- function sc({ settingsPromise: e2, children: t2 }) {
2236
- let n2 = Ns(e2), r2 = (0, import_react.useMemo)(() => ({ isLoading: false, ...n2 }), [n2]);
2237
- return (0, import_jsx_runtime.jsx)(nc.Provider, { value: r2, children: t2 });
2223
+ function ac({ settingsPromise: e2, children: t2 }) {
2224
+ let n2 = js(e2), r2 = (0, import_react.useMemo)(() => ({ isLoading: false, ...n2 }), [n2]);
2225
+ return (0, import_jsx_runtime.jsx)(ec.Provider, { value: r2, children: t2 });
2238
2226
  }
2239
- function cc({ bookingsSettings: e2, children: n2 }) {
2240
- let r2 = Rs(), [i2] = (0, import_react.useState)(() => e2 ? null : Qs({ key: Bs(), warmupData: r2, fetchData: ec }));
2241
- return e2 ? (0, import_jsx_runtime.jsx)(nc.Provider, { value: { isLoading: false, ...e2 }, children: n2 }) : (0, import_jsx_runtime.jsx)(import_react.Suspense, { fallback: (0, import_jsx_runtime.jsx)(nc.Provider, { value: tc, children: n2 }), children: (0, import_jsx_runtime.jsx)(sc, { settingsPromise: i2, children: n2 }) });
2227
+ function oc({ bookingsSettings: e2, children: n2 }) {
2228
+ let r2 = Is(), [i2] = (0, import_react.useState)(() => e2 ? null : Xs({ key: Rs(), warmupData: r2, fetchData: Qs }));
2229
+ return e2 ? (0, import_jsx_runtime.jsx)(ec.Provider, { value: { isLoading: false, ...e2 }, children: n2 }) : (0, import_jsx_runtime.jsx)(import_react.Suspense, { fallback: (0, import_jsx_runtime.jsx)(ec.Provider, { value: $s, children: n2 }), children: (0, import_jsx_runtime.jsx)(ac, { settingsPromise: i2, children: n2 }) });
2242
2230
  }
2243
- var lc = 1e3;
2244
- var uc = class extends import_react.Component {
2231
+ var sc = 1e3;
2232
+ var cc = class extends import_react.Component {
2245
2233
  state = { hasError: false };
2246
2234
  static getDerivedStateFromError() {
2247
2235
  return { hasError: true };
@@ -2253,16 +2241,16 @@ var uc = class extends import_react.Component {
2253
2241
  return this.state.hasError ? this.props.fallback : this.props.children;
2254
2242
  }
2255
2243
  };
2256
- var dc = `appSectionParams`;
2257
- function fc(e2) {
2258
- let t2 = e2.searchParams.get(dc);
2244
+ var lc = `appSectionParams`;
2245
+ function uc(e2) {
2246
+ let t2 = e2.searchParams.get(lc);
2259
2247
  if (t2 === null) return e2;
2260
2248
  let n2 = new URL(e2);
2261
- n2.searchParams.delete(dc);
2262
- for (let [e3, r2] of Object.entries(pc(t2))) typeof r2 == `string` && !n2.searchParams.has(e3) && n2.searchParams.set(e3, r2);
2249
+ n2.searchParams.delete(lc);
2250
+ for (let [e3, r2] of Object.entries(dc(t2))) typeof r2 == `string` && !n2.searchParams.has(e3) && n2.searchParams.set(e3, r2);
2263
2251
  return n2;
2264
2252
  }
2265
- function pc(e2) {
2253
+ function dc(e2) {
2266
2254
  try {
2267
2255
  let t2 = JSON.parse(e2);
2268
2256
  return t2 && typeof t2 == `object` && !Array.isArray(t2) ? t2 : {};
@@ -2270,16 +2258,16 @@ function pc(e2) {
2270
2258
  return {};
2271
2259
  }
2272
2260
  }
2273
- var mc = `bookings-uou:url-change`;
2274
- var hc = (e2) => {
2261
+ var fc = `bookings-uou:url-change`;
2262
+ var pc = (e2) => {
2275
2263
  let t2 = new URL(e2);
2276
2264
  return t2.searchParams.sort(), t2.href;
2277
2265
  };
2278
- function gc(e2, { disableScrollToTop: t2, skipHistory: n2 } = {}) {
2266
+ function mc(e2, { disableScrollToTop: t2, skipHistory: n2 } = {}) {
2279
2267
  let r2 = globalThis.window;
2280
2268
  if (!r2?.history) return;
2281
2269
  let i2 = new URL(r2.location.href);
2282
- if (hc(i2) === hc(e2)) return;
2270
+ if (pc(i2) === pc(e2)) return;
2283
2271
  let a2 = { scrollY: r2.scrollY };
2284
2272
  if (n2) r2.history.replaceState(a2, ``, e2.href);
2285
2273
  else {
@@ -2290,111 +2278,109 @@ function gc(e2, { disableScrollToTop: t2, skipHistory: n2 } = {}) {
2290
2278
  return;
2291
2279
  }
2292
2280
  }
2293
- r2.dispatchEvent(new Event(mc));
2281
+ r2.dispatchEvent(new Event(fc));
2294
2282
  }
2295
- function _c(e2) {
2283
+ function hc(e2) {
2296
2284
  let t2 = globalThis.window;
2297
- return t2 ? (t2.addEventListener(mc, e2), t2.addEventListener(`popstate`, e2), () => {
2298
- t2.removeEventListener(mc, e2), t2.removeEventListener(`popstate`, e2);
2285
+ return t2 ? (t2.addEventListener(fc, e2), t2.addEventListener(`popstate`, e2), () => {
2286
+ t2.removeEventListener(fc, e2), t2.removeEventListener(`popstate`, e2);
2299
2287
  }) : () => {
2300
2288
  };
2301
2289
  }
2302
- var vc = (e2) => {
2290
+ var gc = (e2) => {
2303
2291
  try {
2304
2292
  return decodeURIComponent(e2);
2305
2293
  } catch {
2306
2294
  return e2;
2307
2295
  }
2308
2296
  };
2309
- function yc(e2, t2) {
2297
+ function _c(e2, t2) {
2310
2298
  let n2 = t2 ? new URL(t2).pathname : `/`;
2311
- return `./${vc(new URL(e2).pathname.replace(n2, ``).replace(/^\/|\/$/g, ``))}`;
2299
+ return `./${gc(new URL(e2).pathname.replace(n2, ``).replace(/^\/|\/$/g, ``))}`;
2312
2300
  }
2313
- function bc() {
2314
- let e2 = (0, import_services_manager_react.useService)(zr), t2 = (0, import_react.useCallback)(() => e2.currentUrl, [e2]), n2 = (0, import_react.useSyncExternalStore)(_c, t2, t2), i2 = (0, import_react.useMemo)(() => fc(new URL(n2)), [n2]), a2 = e2.siteUrl.replace(/\/$/, ``);
2315
- return { pathname: i2.pathname, search: i2.search, searchParams: i2.searchParams, href: i2.href, getParsedUrl: () => fc(new URL(e2.currentUrl)), getRelativeUrl: () => yc(e2.currentUrl, a2), getExternalBaseUrl: () => a2, pushUrl: gc };
2301
+ function vc() {
2302
+ let e2 = (0, import_services_manager_react.useService)(zr), t2 = (0, import_react.useCallback)(() => e2.currentUrl, [e2]), n2 = (0, import_react.useSyncExternalStore)(hc, t2, t2), i2 = (0, import_react.useMemo)(() => uc(new URL(n2)), [n2]), a2 = e2.siteUrl.replace(/\/$/, ``);
2303
+ return { pathname: i2.pathname, search: i2.search, searchParams: i2.searchParams, href: i2.href, getParsedUrl: () => uc(new URL(e2.currentUrl)), getRelativeUrl: () => _c(e2.currentUrl, a2), getExternalBaseUrl: () => a2, pushUrl: mc };
2316
2304
  }
2317
- var xc = Fr(`@wix/site-service-business-logger`);
2318
- function Sc(e2) {
2305
+ var yc = Fr(`@wix/site-service-business-logger`);
2306
+ function bc(e2) {
2319
2307
  return { evid: 32, src: 16, endpoint: ``, params: e2 };
2320
2308
  }
2321
- function Cc(e2) {
2309
+ function xc(e2) {
2322
2310
  return { evid: 33, src: 16, endpoint: ``, params: e2 };
2323
2311
  }
2324
- function wc(e2) {
2312
+ function Sc(e2) {
2325
2313
  return { evid: 34, src: 16, endpoint: ``, params: e2 };
2326
2314
  }
2327
- var Tc = { 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` };
2315
+ var Cc = { 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` };
2328
2316
  Gr.BOOK_ONLINE;
2329
- var Ec = `new_bookings_server`;
2330
- var Dc = { LOAD: `load`, LOCATION_CHOSEN: `location chosen`, STAFF_CHOSEN: `staff chosen`, VARIANT_SELECTED: `variant selected`, ADD_ON_SELECTED: `add on selected`, ADD_ON_UNSELECTED: `add on unselected`, BACK: `back`, CLOSE: `close`, STAY: `stay`, ADD_SERVICE: `add service`, EDIT_BASKET_ITEM: `edit basket item`, EDIT_BASKET_ITEM_FROM_CALENDAR: `edit basket item from calendar`, CHANGE_STAFF_MEMBER: `change staff member`, REMOVE_BASKET_ITEM: `remove basket item`, SELECT_SERVICE: `select service`, SEARCH: `search`, CLEAR_SEARCH: `clear search` };
2331
- var Oc = { TIMEZONE_PICKER: `timezone_picker`, TIME_PICKER: `time_picker`, BOOKING_DETAILS: `booking_details`, RESCHEDULE_DIALOG: `reschedule_dialog` };
2332
- var kc = { DROPDOWN: `dropdown`, TIME_SLOT: `time_slot`, EXPAND: `expand`, COLLAPSE: `collapse` };
2333
- var Ac = (e2) => {
2334
- let { reportBi: t2 } = (0, import_services_manager_react.useService)(xc);
2317
+ var wc = `new_bookings_server`;
2318
+ var Tc = { LOAD: `load`, LOCATION_CHOSEN: `location chosen`, STAFF_CHOSEN: `staff chosen`, VARIANT_SELECTED: `variant selected`, ADD_ON_SELECTED: `add on selected`, ADD_ON_UNSELECTED: `add on unselected`, BACK: `back`, CLOSE: `close`, STAY: `stay`, ADD_SERVICE: `add service`, EDIT_BASKET_ITEM: `edit basket item`, EDIT_BASKET_ITEM_FROM_CALENDAR: `edit basket item from calendar`, CHANGE_STAFF_MEMBER: `change staff member`, REMOVE_BASKET_ITEM: `remove basket item`, SELECT_SERVICE: `select service`, SEARCH: `search`, CLEAR_SEARCH: `clear search` };
2319
+ var Ec = { TIMEZONE_PICKER: `timezone_picker`, TIME_PICKER: `time_picker`, BOOKING_DETAILS: `booking_details`, RESCHEDULE_DIALOG: `reschedule_dialog`, JOIN_WAITLIST_DIALOG: `join_waitlist_dialog` };
2320
+ var Dc = { DROPDOWN: `dropdown`, TIME_SLOT: `time_slot`, EXPAND: `expand`, COLLAPSE: `collapse` };
2321
+ var Oc = (e2) => {
2322
+ let { reportBi: t2 } = (0, import_services_manager_react.useService)(yc);
2335
2323
  return (0, import_react.useCallback)((n2) => {
2336
- t2({ widget_name: e2, bookingsPlatform: Ec, is_over_editor: false, ...n2.params, src: n2.src, evid: n2.evid }, { endpoint: n2.endpoint });
2324
+ t2({ widget_name: e2, bookingsPlatform: wc, is_over_editor: false, ...n2.params, src: n2.src, evid: n2.evid }, { endpoint: n2.endpoint });
2337
2325
  }, [t2, e2]);
2338
2326
  };
2339
- var jc = (e2, t2 = true) => {
2340
- let n2 = Ac(e2), { getParsedUrl: r2 } = bc(), i2 = (0, import_react.useRef)(false);
2327
+ var kc = (e2, t2 = true) => {
2328
+ let n2 = Oc(e2), { getParsedUrl: r2 } = vc(), i2 = (0, import_react.useRef)(false);
2341
2329
  (0, import_react.useEffect)(() => {
2342
- t2 && !i2.current && (i2.current = true, n2(Sc({ referralInfo: r2().searchParams.get(eo.referral) ?? void 0 })));
2330
+ t2 && !i2.current && (i2.current = true, n2(bc({ referralInfo: r2().searchParams.get(eo.referral) ?? void 0 })));
2343
2331
  }, [t2, n2, r2]);
2344
2332
  };
2345
- function Mc(e2) {
2333
+ function Ac(e2) {
2346
2334
  return { evid: 1177, src: 16, endpoint: `wixboost-ugc`, params: e2 };
2347
2335
  }
2348
- function Nc(e2) {
2336
+ function jc(e2) {
2349
2337
  return { evid: 596, src: 16, endpoint: `wixboost-ugc`, params: e2 };
2350
2338
  }
2351
- function Pc(e2, t2) {
2339
+ function Mc(e2, t2) {
2352
2340
  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 = {};
2353
2341
  for (let e3 of n2) e3.type !== `literal` && (r2[e3.type] = Number(e3.value));
2354
2342
  return Date.UTC(r2.year, r2.month - 1, r2.day, r2.hour, r2.minute, r2.second) - e2;
2355
2343
  }
2356
- function Fc(e2, t2) {
2344
+ function Nc(e2, t2) {
2357
2345
  let n2 = e2.match(/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2}))?/);
2358
2346
  if (!n2) return null;
2359
2347
  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);
2360
2348
  if (Number.isNaN(l2)) return null;
2361
2349
  try {
2362
- let e3 = l2 - Pc(l2, t2);
2363
- return new Date(l2 - Pc(e3, t2));
2350
+ let e3 = l2 - Mc(l2, t2);
2351
+ return new Date(l2 - Mc(e3, t2));
2364
2352
  } catch {
2365
2353
  return null;
2366
2354
  }
2367
2355
  }
2368
- function Ic({ start: e2, end: t2, timeZone: n2, ...r2 }) {
2369
- let i2 = (e3) => e3 && n2 ? Fc(e3, n2)?.getTime() : void 0;
2370
- return wc({ bookingsServiceId: r2.serviceId, serviceType: r2.serviceType, startTime: i2(e2), endTime: i2(t2), isEligibleForFlowCompletion: r2.isEligibleForFlowCompletion });
2356
+ function Pc({ start: e2, end: t2, timeZone: n2, ...r2 }) {
2357
+ let i2 = (e3) => e3 && n2 ? Nc(e3, n2)?.getTime() : void 0;
2358
+ return Sc({ bookingsServiceId: r2.serviceId, serviceType: r2.serviceType, startTime: i2(e2), endTime: i2(t2), isEligibleForFlowCompletion: r2.isEligibleForFlowCompletion });
2371
2359
  }
2372
- function Lc({ nextAvailableSlotsCount: e2, isLoading: t2, hasError: n2, children: r2 }) {
2373
- let i2 = n2 ? `loadFailed` : null, a2 = { selectedDate: null, daysAvailabilityRange: null, daysAvailability: [], daysAvailabilityLoading: false, daysAvailabilityHasError: false, timeSlotsLoading: t2, timeSlotsErrorCode: i2, selectDate: async () => {
2360
+ function Fc({ nextAvailableSlotsCount: e2, isLoading: t2, hasError: n2, children: r2 }) {
2361
+ let i2 = n2 ? `loadFailed` : null, a2 = { selectedDate: null, daysAvailabilityRange: null, daysAvailability: [], daysAvailabilityLoading: false, daysAvailabilityHasError: false, selectDate: async () => {
2374
2362
  }, setDaysAvailabilityRange: async () => {
2375
- }, nextDaysAvailabilityRange: async () => {
2376
- }, previousDaysAvailabilityRange: async () => {
2377
- }, goToNextAvailableDate: async () => `cancelled`, canChangeTimeZone: false, isMultiService: false, hasValidSchedulingInput: false, availabilityRequestKey: null, needsServiceChoice: false, isRescheduling: (0, import_service.useServiceContext)(true)?.reschedule != null, rescheduleValidUntil: null, staffFilterOptions: [], locationFilterOptions: [], selectedStaffFilter: null, requestedGender: null, genderSelectionAllowed: false, selectedLocationFilter: null, setStaffFilter: () => {
2363
+ }, goToNextAvailableDate: async () => `cancelled`, canChangeTimeZone: false, isMultiService: false, availabilityRequestKey: null, needsServiceChoice: false, isRescheduling: (0, import_service.useServiceContext)(true)?.reschedule != null, rescheduleValidUntil: null, staffFilterOptions: [], locationFilterOptions: [], selectedStaffFilter: null, requestedGender: null, genderSelectionAllowed: false, selectedLocationFilter: null, setStaffFilter: () => {
2378
2364
  }, setLocationFilter: () => {
2379
- }, isComplete: false, isSelectionValidated: false, timeSlots: [], isLoading: t2, hasError: n2, errorCode: i2, businessTimeZone: null, setTimeZone: () => {
2365
+ }, isComplete: false, timeSlots: [], isLoading: t2, hasError: n2, errorCode: i2, businessTimeZone: null, setTimeZone: () => {
2380
2366
  }, currentTimeSlotsPage: 1, hasNextTimeSlotsPage: false, hasPreviousTimeSlotsPage: false, nextTimeSlotsPage: async () => {
2381
2367
  }, loadUpcomingTimeSlots: async () => {
2382
2368
  }, upcomingTimeSlotsRequested: false, previousTimeSlotsPage: () => {
2383
2369
  }, nextAvailableSlotsCount: e2, timeZone: null, staffFromSlots: [], selectedResourceId: null, setSelectedResource: () => {
2384
2370
  }, canAutoAssignStaff: false, selectedTimeSlot: null, selectTimeSlot: () => {
2385
2371
  }, navigateToBookingForm: () => {
2386
- }, timeSlotLimitPerDay: null, expandedDates: /* @__PURE__ */ new Set(), daysWithMore: /* @__PURE__ */ new Set(), loadingDate: null, loadAllTimeSlotsForDay: async () => {
2372
+ }, timeSlotLimitPerDay: null, daysWithMore: /* @__PURE__ */ new Set(), loadingDate: null, loadAllTimeSlotsForDay: async () => {
2387
2373
  } };
2388
- return (0, import_jsx_runtime.jsx)(Gl.Provider, { value: a2, children: r2 });
2374
+ return (0, import_jsx_runtime.jsx)(Ul.Provider, { value: a2, children: r2 });
2389
2375
  }
2390
- function Rc({ nextAvailableSlotsCount: e2, children: t2 }) {
2391
- return (0, import_jsx_runtime.jsx)(Lc, { nextAvailableSlotsCount: e2, isLoading: true, hasError: false, children: t2 });
2376
+ function Ic({ nextAvailableSlotsCount: e2, children: t2 }) {
2377
+ return (0, import_jsx_runtime.jsx)(Fc, { nextAvailableSlotsCount: e2, isLoading: true, hasError: false, children: t2 });
2392
2378
  }
2393
- function zc({ nextAvailableSlotsCount: e2, children: t2 }) {
2394
- return (0, import_jsx_runtime.jsx)(Lc, { nextAvailableSlotsCount: e2, isLoading: false, hasError: true, children: t2 });
2379
+ function Lc({ nextAvailableSlotsCount: e2, children: t2 }) {
2380
+ return (0, import_jsx_runtime.jsx)(Fc, { nextAvailableSlotsCount: e2, isLoading: false, hasError: true, children: t2 });
2395
2381
  }
2396
- var Bc = 1e3;
2397
- function Vc(e2, t2) {
2382
+ var Rc = 1e3;
2383
+ function zc(e2, t2) {
2398
2384
  let n2 = /* @__PURE__ */ new Map();
2399
2385
  for (let e3 of t2) {
2400
2386
  let t3 = e3.localStartDate?.slice(0, 10);
@@ -2407,68 +2393,68 @@ function Vc(e2, t2) {
2407
2393
  }
2408
2394
  return r2;
2409
2395
  }
2410
- function Hc(e2, t2) {
2396
+ function Bc(e2, t2) {
2411
2397
  return { fromLocalDate: Po(e2.startDate, t2), toLocalDate: Mo(ko(e2.endDate)) };
2412
2398
  }
2413
- async function Uc(e2, t2, n2, r2, i2, a2) {
2414
- return (await us({ serviceId: e2, ...Hc(n2, t2), timeZone: t2, ...$o(r2), ...es(i2), ...ns(a2, i2), timeSlotsPerDay: 1, cursorPaging: { limit: Math.min(Bo(n2), Bc) } })).timeSlots ?? [];
2399
+ async function Vc(e2, t2, n2, r2, i2, a2) {
2400
+ return (await cs({ serviceId: e2, ...Bc(n2, t2), timeZone: t2, ...Zo(r2), ...Qo(i2), ...es(a2, i2), timeSlotsPerDay: 1, cursorPaging: { limit: Math.min(Bo(n2), Rc) } })).timeSlots ?? [];
2415
2401
  }
2416
- async function Wc(e2, t2, n2, r2, i2, a2) {
2417
- return (await fs({ serviceIds: [e2], ...Hc(n2, t2), timeZone: t2, includeNonBookable: true, eventFilter: { type: `CLASS`, ...ds(r2, i2, a2) }, maxSlotsPerDay: 1, cursorPaging: { limit: Math.min(Bo(n2), Bc) } })).timeSlots;
2402
+ async function Hc(e2, t2, n2, r2, i2, a2) {
2403
+ return (await us({ serviceIds: [e2], ...Bc(n2, t2), timeZone: t2, includeNonBookable: true, eventFilter: { type: `CLASS`, ...ls(r2, i2, a2) }, maxSlotsPerDay: 1, cursorPaging: { limit: Math.min(Bo(n2), Rc) } })).timeSlots;
2418
2404
  }
2419
- async function Gc({ serviceId: e2, serviceType: t2, range: n2, fromDate: r2, timeZone: i2, locationId: a2, staffId: o2, customerChoices: s2, minRemainingCapacity: c2 }) {
2420
- if (Za(t2) || n2.endDate < r2) return Vc(n2, []);
2421
- let l2 = { startDate: n2.startDate < r2 ? r2 : n2.startDate, endDate: n2.endDate }, u2 = Xa(t2) ? Ko(l2) : [l2];
2422
- return Vc(n2, (await Promise.all(u2.map((n3) => Xa(t2) ? Wc(e2, i2, n3, a2, o2, c2) : Uc(e2, i2, n3, a2, o2, s2)))).flat());
2405
+ async function Uc({ serviceId: e2, serviceType: t2, range: n2, fromDate: r2, timeZone: i2, locationId: a2, staffId: o2, customerChoices: s2, minRemainingCapacity: c2 }) {
2406
+ if (Za(t2) || n2.endDate < r2) return zc(n2, []);
2407
+ let l2 = { startDate: n2.startDate < r2 ? r2 : n2.startDate, endDate: n2.endDate }, u2 = Xa(t2) ? Wo(l2) : [l2];
2408
+ return zc(n2, (await Promise.all(u2.map((n3) => Xa(t2) ? Hc(e2, i2, n3, a2, o2, c2) : Vc(e2, i2, n3, a2, o2, s2)))).flat());
2423
2409
  }
2424
- function Kc({ serviceId: e2, staff: t2, customerChoices: n2 }) {
2410
+ function Wc({ serviceId: e2, staff: t2, customerChoices: n2 }) {
2425
2411
  let r2 = t2 && !t2.anyResource ? t2.staffMemberId : void 0;
2426
- return { serviceId: e2, ...ns(n2, r2), ...t2?.anyResource ? {} : { includeResourceTypeIds: [Wr] }, ...r2 ? { resourceTypes: [{ resourceTypeId: Wr, resourceIds: [r2] }] } : {} };
2412
+ return { serviceId: e2, ...es(n2, r2), ...t2?.anyResource ? {} : { includeResourceTypeIds: [Wr] }, ...r2 ? { resourceTypes: [{ resourceTypeId: Wr, resourceIds: [r2] }] } : {} };
2427
2413
  }
2428
- function qc({ services: e2, locationId: t2, locationType: n2, timeZone: r2 }) {
2429
- return { services: e2.map(Kc), timeZone: r2, location: { ...t2 ? { _id: t2 } : {}, locationType: n2 } };
2414
+ function Gc({ services: e2, locationId: t2, locationType: n2, timeZone: r2 }) {
2415
+ return { services: e2.map(Wc), timeZone: r2, location: { ...t2 ? { _id: t2 } : {}, locationType: n2 } };
2430
2416
  }
2431
- function Jc(e2) {
2432
- let { customerChoices: t2, ...n2 } = e2, r2 = t2 ? ts(t2) : void 0;
2417
+ function Kc(e2) {
2418
+ let { customerChoices: t2, ...n2 } = e2, r2 = t2 ? $o(t2) : void 0;
2433
2419
  return r2 ? { ...n2, customerChoices: r2 } : n2;
2434
2420
  }
2435
- async function Yc(e2) {
2436
- let t2 = e2.services ?? [], n2 = () => Ta({ ...e2, services: t2.map(Jc) }), r2 = t2.some((e3) => e3.customerChoices?.requestedGender);
2437
- if (r2 && ss()) return n2();
2421
+ async function qc(e2) {
2422
+ let t2 = e2.services ?? [], n2 = () => Ta({ ...e2, services: t2.map(Kc) }), r2 = t2.some((e3) => e3.customerChoices?.requestedGender);
2423
+ if (r2 && as()) return n2();
2438
2424
  try {
2439
2425
  return await Ta(e2);
2440
2426
  } catch (e3) {
2441
- if (!r2 || !is(e3)) throw e3;
2442
- return $(e3, { feature: Q.timeSlots, action: `requested-gender-rejected`, level: `warning` }), ls(), n2();
2427
+ if (!r2 || !ns(e3)) throw e3;
2428
+ return $(e3, { feature: Q.timeSlots, action: `requested-gender-rejected`, level: `warning` }), ss(), n2();
2443
2429
  }
2444
2430
  }
2445
- var Xc = 1e3;
2446
- async function Zc({ range: e2, fromDate: t2, ...n2 }) {
2447
- if (e2.endDate < t2) return Vc(e2, []);
2431
+ var Jc = 1e3;
2432
+ async function Yc({ range: e2, fromDate: t2, ...n2 }) {
2433
+ if (e2.endDate < t2) return zc(e2, []);
2448
2434
  let r2 = { startDate: e2.startDate < t2 ? t2 : e2.startDate, endDate: e2.endDate };
2449
- return Vc(e2, (await Yc({ ...qc(n2), fromLocalDate: Po(r2.startDate, n2.timeZone), toLocalDate: Mo(ko(r2.endDate)), timeSlotsPerDay: 1, cursorPaging: { limit: Math.min(Bo(r2), Xc) } })).timeSlots ?? []);
2435
+ return zc(e2, (await qc({ ...Gc(n2), fromLocalDate: Po(r2.startDate, n2.timeZone), toLocalDate: Mo(ko(r2.endDate)), timeSlotsPerDay: 1, cursorPaging: { limit: Math.min(Bo(r2), Jc) } })).timeSlots ?? []);
2450
2436
  }
2451
- async function Qc({ date: e2, onlyAvailableSlots: t2, fromLocalDate: n2, ...r2 }) {
2437
+ async function Xc({ date: e2, onlyAvailableSlots: t2, fromLocalDate: n2, ...r2 }) {
2452
2438
  let i2 = `${e2}T00:00:00`, a2 = [], o2 = null, s2;
2453
2439
  do {
2454
- let c2 = await Yc({ ...qc(r2), fromLocalDate: n2 && n2 > i2 ? n2 : i2, toLocalDate: `${e2}T23:59:59`, ...t2 ? { bookable: true } : {}, cursorPaging: { limit: Xc, ...s2 ? { cursor: s2 } : {} } });
2440
+ let c2 = await qc({ ...Gc(r2), fromLocalDate: n2 && n2 > i2 ? n2 : i2, toLocalDate: `${e2}T23:59:59`, ...t2 ? { bookable: true } : {}, cursorPaging: { limit: Jc, ...s2 ? { cursor: s2 } : {} } });
2455
2441
  a2.push(...c2.timeSlots ?? []), o2 = c2.timeZone ?? o2, s2 = c2.cursorPagingMetadata?.cursors?.next || void 0;
2456
2442
  } while (s2);
2457
2443
  return { timeSlots: a2, timeZone: o2 };
2458
2444
  }
2459
- async function $c({ fromDate: e2, ...t2 }) {
2460
- let n2 = await Yc({ ...qc(t2), ..._s(e2), bookable: true, cursorPaging: { limit: 1 } });
2445
+ async function Zc({ fromDate: e2, ...t2 }) {
2446
+ let n2 = await qc({ ...Gc(t2), ...hs(e2), bookable: true, cursorPaging: { limit: 1 } });
2461
2447
  return { timeSlots: n2.timeSlots ?? [], timeZone: n2.timeZone ?? null };
2462
2448
  }
2463
- var el = [];
2464
- function tl({ enabled: e2, serviceId: t2, serviceType: n2, multiServiceRequest: i2, timeZone: l2, today: u2, locationId: d2, staffId: f2, loadInitially: p2, customerChoices: m2, minRemainingCapacity: h2, onlyAvailableSlots: g2 }) {
2465
- let [_2, v2] = (0, import_react.useState)(null), [y2, b2] = (0, import_react.useState)(p2), [x2, S2] = (0, import_react.useState)(el), [C2, w2] = (0, import_react.useState)(false), [T2, ee2] = (0, import_react.useState)(false), E2 = (0, import_react.useRef)(0);
2449
+ var Qc = [];
2450
+ function $c({ enabled: e2, serviceId: t2, serviceType: n2, multiServiceRequest: i2, timeZone: l2, today: u2, locationId: d2, staffId: f2, loadInitially: p2, customerChoices: m2, minRemainingCapacity: h2, onlyAvailableSlots: g2 }) {
2451
+ let [_2, v2] = (0, import_react.useState)(null), [y2, b2] = (0, import_react.useState)(p2), [x2, S2] = (0, import_react.useState)(Qc), [C2, w2] = (0, import_react.useState)(false), [T2, ee2] = (0, import_react.useState)(false), E2 = (0, import_react.useRef)(0);
2466
2452
  (0, import_react.useEffect)(() => {
2467
2453
  _2 === null && u2 && v2(Vo(u2));
2468
2454
  }, [_2, u2]), (0, import_react.useEffect)(() => {
2469
2455
  if (!y2 || !e2 || !(t2 || i2) || !l2 || !u2 || !_2 || !i2 && Za(n2)) return;
2470
2456
  let r2 = ++E2.current;
2471
- return w2(true), (i2 ? Zc({ ...i2, range: _2, fromDate: u2, timeZone: l2 }) : Gc({ serviceId: t2, serviceType: n2, range: _2, fromDate: u2, timeZone: l2, locationId: d2 ?? void 0, staffId: f2 ?? void 0, customerChoices: m2, minRemainingCapacity: h2 })).then((e3) => {
2457
+ return w2(true), (i2 ? Yc({ ...i2, range: _2, fromDate: u2, timeZone: l2 }) : Uc({ serviceId: t2, serviceType: n2, range: _2, fromDate: u2, timeZone: l2, locationId: d2 ?? void 0, staffId: f2 ?? void 0, customerChoices: m2, minRemainingCapacity: h2 })).then((e3) => {
2472
2458
  r2 === E2.current && (S2(e3), ee2(false), w2(false));
2473
2459
  }).catch((e3) => {
2474
2460
  r2 === E2.current && ($(e3, { feature: Q.timeSlots, action: `fetch-days-availability`, level: `warning` }), ee2(true), w2(false));
@@ -2478,26 +2464,22 @@ function tl({ enabled: e2, serviceId: t2, serviceType: n2, multiServiceRequest:
2478
2464
  }, [y2, e2, t2, n2, i2, l2, u2, _2, d2, f2, m2, h2]);
2479
2465
  let D2 = (0, import_react.useCallback)(async (e3) => {
2480
2466
  Ro(e3) && (v2(e3), b2(true));
2481
- }, []), O2 = (0, import_react.useCallback)(async () => {
2482
- v2((e3) => e3 && Uo(e3, 1)), b2(true);
2483
- }, []), te2 = (0, import_react.useCallback)(async () => {
2484
- v2((e3) => e3 && Uo(e3, -1)), b2(true);
2485
2467
  }, []);
2486
- return { range: _2, daysAvailability: (0, import_react.useMemo)(() => g2 ? x2.map((e3) => e3.availability === `unavailable` ? { ...e3, availability: `none` } : e3) : x2, [x2, g2]), isLoading: C2, hasError: T2, setRange: D2, nextRange: O2, previousRange: te2 };
2468
+ return { range: _2, daysAvailability: (0, import_react.useMemo)(() => g2 ? x2.map((e3) => e3.availability === `unavailable` ? { ...e3, availability: `none` } : e3) : x2, [x2, g2]), isLoading: C2, hasError: T2, setRange: D2 };
2487
2469
  }
2488
- function nl({ enabled: e2, serviceId: t2, serviceType: n2, multiServiceRequest: i2, timeZone: o2, today: l2, locationId: u2, staffId: d2, customerChoices: f2, minRemainingCapacity: p2, onlyAvailableSlots: m2, serviceLoading: h2 }) {
2489
- let [g2, _2] = (0, import_react.useState)(null), [v2, y2] = (0, import_react.useState)(0), [b2, x2] = (0, import_react.useState)(null), [S2, C2] = (0, import_react.useState)(null), [w2, T2] = (0, import_react.useState)(null), [ee2, E2] = (0, import_react.useState)(false), D2 = (0, import_react.useRef)(0), O2 = (0, import_react.useRef)(0), te2 = (0, import_react.useRef)(0), k2 = (0, import_react.useCallback)(() => {
2490
- O2.current += 1, E2(false);
2470
+ function el({ enabled: e2, serviceId: t2, serviceType: n2, multiServiceRequest: i2, timeZone: o2, today: l2, locationId: u2, staffId: d2, customerChoices: f2, minRemainingCapacity: p2, onlyAvailableSlots: m2, serviceLoading: h2 }) {
2471
+ let [g2, _2] = (0, import_react.useState)(null), [v2, y2] = (0, import_react.useState)(0), [b2, x2] = (0, import_react.useState)(null), [S2, C2] = (0, import_react.useState)(null), [w2, T2] = (0, import_react.useState)(null), [ee2, E2] = (0, import_react.useState)(false), D2 = (0, import_react.useRef)(0), te2 = (0, import_react.useRef)(0), ne2 = (0, import_react.useRef)(0), O2 = (0, import_react.useCallback)(() => {
2472
+ te2.current += 1, E2(false);
2491
2473
  }, []);
2492
2474
  (0, import_react.useEffect)(() => {
2493
- k2();
2494
- }, [e2, t2, n2, i2, o2, u2, d2, f2, p2, k2]);
2495
- let A2 = e2 && !h2 && !t2 && !i2;
2475
+ O2();
2476
+ }, [e2, t2, n2, i2, o2, u2, d2, f2, p2, O2]);
2477
+ let k2 = e2 && !h2 && !t2 && !i2;
2496
2478
  (0, import_react.useEffect)(() => {
2497
- A2 && (C2(null), T2(null));
2498
- }, [A2]), (0, import_react.useEffect)(() => {
2479
+ k2 && (C2(null), T2(null));
2480
+ }, [k2]), (0, import_react.useEffect)(() => {
2499
2481
  if (!g2) return;
2500
- if (A2) {
2482
+ if (k2) {
2501
2483
  _2(null);
2502
2484
  return;
2503
2485
  }
@@ -2513,7 +2495,7 @@ function nl({ enabled: e2, serviceId: t2, serviceType: n2, multiServiceRequest:
2513
2495
  let r2 = No(new Date(Date.now()), o2), a2 = ++D2.current;
2514
2496
  x2(null), C2(null), T2(null);
2515
2497
  let s2 = r2.slice(0, 10) === g2.date ? r2 : void 0;
2516
- return (i2 ? Qc({ ...i2, date: g2.date, timeZone: o2, onlyAvailableSlots: m2, fromLocalDate: s2 }) : bs({ 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) => {
2498
+ return (i2 ? Xc({ ...i2, date: g2.date, timeZone: o2, onlyAvailableSlots: m2, fromLocalDate: s2 }) : vs({ 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) => {
2517
2499
  a2 === D2.current && x2({ timeSlots: e3.timeSlots, timeZone: e3.timeZone ?? o2 });
2518
2500
  }).catch((e3) => {
2519
2501
  a2 === D2.current && ($(e3, { feature: Q.timeSlots, action: `fetch-day-time-slots`, level: `warning` }), C2(`timeSlotsLoadFailed`));
@@ -2521,58 +2503,58 @@ function nl({ enabled: e2, serviceId: t2, serviceType: n2, multiServiceRequest:
2521
2503
  a2 === D2.current && (D2.current += 1);
2522
2504
  };
2523
2505
  }, [g2, v2, e2, t2, h2, n2, i2, o2, l2, u2, d2, f2, p2, m2]);
2524
- let ne2 = (0, import_react.useCallback)(async (e3) => {
2525
- !i2 && Za(n2) || !Lo(e3) || l2 && e3 < l2 || (k2(), y2((e4) => e4 + 1), _2({ kind: `day`, date: e3 }));
2526
- }, [n2, i2, l2, k2]), re2 = g2?.date ?? null, j2 = (0, import_react.useCallback)(async () => {
2506
+ let re2 = (0, import_react.useCallback)(async (e3) => {
2507
+ !i2 && Za(n2) || !Lo(e3) || l2 && e3 < l2 || (O2(), y2((e4) => e4 + 1), _2({ kind: `day`, date: e3 }));
2508
+ }, [n2, i2, l2, O2]), ie2 = g2?.date ?? null, A2 = (0, import_react.useCallback)(async () => {
2527
2509
  let r2 = !!(t2 || i2);
2528
2510
  if (!i2 && Za(n2) || !e2 || !r2 || !o2) return { outcome: `none` };
2529
- let a2 = D2.current, s2 = ++O2.current, c2 = ++te2.current, m3 = () => a2 === D2.current && s2 === O2.current;
2511
+ let a2 = D2.current, s2 = ++te2.current, c2 = ++ne2.current, m3 = () => a2 === D2.current && s2 === te2.current;
2530
2512
  E2(true), T2(null);
2531
2513
  try {
2532
- let e3 = re2 ?? l2 ?? void 0, r3 = i2 ? await $c({ ...i2, timeZone: o2, fromDate: e3 }) : await vs({ serviceId: t2, serviceType: n2, timeZone: o2, limit: 1, onlyAvailableSlots: true, fromDate: e3, locationId: u2 ?? void 0, staffId: d2 ?? void 0, customerChoices: f2, minRemainingCapacity: p2 });
2514
+ let e3 = ie2 ?? l2 ?? void 0, r3 = i2 ? await Zc({ ...i2, timeZone: o2, fromDate: e3 }) : await gs({ serviceId: t2, serviceType: n2, timeZone: o2, limit: 1, onlyAvailableSlots: true, fromDate: e3, locationId: u2 ?? void 0, staffId: d2 ?? void 0, customerChoices: f2, minRemainingCapacity: p2 });
2533
2515
  if (!m3()) return { outcome: `cancelled` };
2534
2516
  let a3 = r3.timeSlots[0]?.localStartDate?.slice(0, 10) ?? null;
2535
2517
  return a3 ? { outcome: `found`, date: a3 } : { outcome: `none` };
2536
2518
  } catch (e3) {
2537
2519
  return m3() ? ($(e3, { feature: Q.timeSlots, action: `find-next-available-date`, level: `warning` }), T2(`timeSlotsLoadFailed`), { outcome: `error` }) : { outcome: `cancelled` };
2538
2520
  } finally {
2539
- c2 === te2.current && E2(false);
2521
+ c2 === ne2.current && E2(false);
2540
2522
  }
2541
- }, [e2, t2, n2, i2, o2, l2, u2, d2, f2, p2, re2]), ie2 = w2 ?? S2;
2542
- return { query: g2, selectedDate: re2, timeSlots: b2?.timeSlots ?? null, timeZone: b2?.timeZone ?? null, isLoading: ee2 || g2 !== null && b2 === null && S2 === null, error: ie2, selectDate: ne2, findNextAvailableDate: j2 };
2523
+ }, [e2, t2, n2, i2, o2, l2, u2, d2, f2, p2, ie2]), ae2 = w2 ?? S2;
2524
+ 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 };
2543
2525
  }
2544
- var rl = (e2) => e2?.type === `DATE_TIME`;
2545
- function il(e2) {
2526
+ var tl = (e2) => e2?.type === `DATE_TIME`;
2527
+ function nl(e2) {
2546
2528
  let t2 = e2.schedule?.availabilityConstraints?.durations;
2547
2529
  if (!Ya(e2.type) || !Array.isArray(t2)) return false;
2548
2530
  let n2 = t2.map((e3) => typeof e3 == `number` ? e3 : e3?.minutes);
2549
2531
  return new Set(n2).size > 1;
2550
2532
  }
2551
- function al({ service: e2, multiServiceAppointmentsEnabled: t2, variants: n2, locationId: r2 }) {
2533
+ function rl({ service: e2, multiServiceAppointmentsEnabled: t2, variants: n2, locationId: r2 }) {
2552
2534
  if (!Ya(e2.type)) return false;
2553
- if (t2 || il(e2) || $a(e2)) return true;
2554
- if (!Qa(e2) || rl(n2)) return false;
2555
- let i2 = js(e2, r2);
2556
- return r2 && i2 !== r2 ? true : !Os(n2, As(e2), i2);
2535
+ if (t2 || nl(e2) || $a(e2)) return true;
2536
+ if (!Qa(e2) || tl(n2)) return false;
2537
+ let i2 = ks(e2, r2);
2538
+ return r2 && i2 !== r2 ? true : !Es(n2, Os(e2), i2);
2557
2539
  }
2558
- function ol(e2, t2) {
2540
+ function il(e2, t2) {
2559
2541
  return !!Pr(e2)?.services.some((e3) => e3.serviceId === t2);
2560
2542
  }
2561
- function sl({ blobParam: e2, ...t2 }) {
2562
- return !t2.service._id || ol(e2, t2.service._id) ? false : al({ ...t2, multiServiceAppointmentsEnabled: false });
2543
+ function al({ blobParam: e2, ...t2 }) {
2544
+ return !t2.service._id || il(e2, t2.service._id) ? false : rl({ ...t2, multiServiceAppointmentsEnabled: false });
2563
2545
  }
2564
- function cl(e2) {
2546
+ function ol(e2) {
2565
2547
  return !!e2?._id;
2566
2548
  }
2567
- function ll() {
2549
+ function sl() {
2568
2550
  try {
2569
2551
  return (0, import_services_manager_react.useGetService)();
2570
2552
  } catch {
2571
2553
  return null;
2572
2554
  }
2573
2555
  }
2574
- function ul() {
2575
- let e2 = ll();
2556
+ function cl() {
2557
+ let e2 = sl();
2576
2558
  return (0, import_react.useCallback)((t2) => {
2577
2559
  if (!e2) return false;
2578
2560
  try {
@@ -2583,70 +2565,71 @@ function ul() {
2583
2565
  }
2584
2566
  }, [e2]);
2585
2567
  }
2586
- function dl(e2) {
2587
- let { service: t2, isLoading: n2, hasError: r2, bookingsSettingsLoading: i2, isLoadingServiceOptionsAndVariants: o2, pricingOption: c2, multiServiceAppointmentsEnabled: l2, isMultiServiceAppointment: d2, reschedule: f2, selection: p2, openPreferences: m2, editingSurface: h2 } = (0, import_service.useServiceContext)(), { searchParams: g2 } = bc(), _2 = ul(), v2 = Ac(Tc.PREFERENCES), y2 = (0, import_react.useRef)(false), b2 = e2 && !h2 && !n2 && !r2 && !i2 && !o2 && f2 == null && !d2 && cl(t2), x2 = p2.locationId ?? void 0, S2 = g2.get(eo.blob);
2568
+ function ll(e2) {
2569
+ let { service: t2, isLoading: n2, hasError: r2, bookingsSettingsLoading: i2, isLoadingServiceOptionsAndVariants: o2, pricingOption: c2, multiServiceAppointmentsEnabled: l2, isMultiServiceAppointment: d2, reschedule: f2, selection: p2, openPreferences: m2, editingSurface: h2 } = (0, import_service.useServiceContext)(), { searchParams: g2 } = vc(), _2 = cl(), v2 = Oc(Cc.PREFERENCES), y2 = (0, import_react.useRef)(false), b2 = e2 && !h2 && !n2 && !r2 && !i2 && !o2 && f2 == null && !d2 && ol(t2), x2 = p2.locationId ?? void 0, S2 = g2.get(eo.blob);
2588
2570
  (0, import_react.useEffect)(() => {
2589
- !y2.current && b2 && (y2.current = true, _2(Gr.CALENDAR_PAGE) && sl({ service: t2, multiServiceAppointmentsEnabled: l2, variants: c2, locationId: x2, blobParam: S2 }) && (Do({ message: `Calendar opens the preferences modal`, category: `navigation`, feature: Q.timeSlots, data: { serviceId: t2._id ?? null, serviceType: t2.type ?? null } }), v2(Mc({ action: Dc.EDIT_BASKET_ITEM_FROM_CALENDAR, numberOfServices: 1, isMultiFlow: l2 })), m2().then(() => Eo(`Preferences modal opened`, { feature: Q.timeSlots, action: `auto-open-preferences`, tags: { serviceType: t2.type ?? `unknown` } }), (e3) => $(e3, { feature: Q.timeSlots, action: `open-preferences-lightbox` }))));
2571
+ !y2.current && b2 && (y2.current = true, _2(Gr.CALENDAR_PAGE) && al({ service: t2, multiServiceAppointmentsEnabled: l2, variants: c2, locationId: x2, blobParam: S2 }) && (Do({ message: `Calendar opens the preferences modal`, category: `navigation`, feature: Q.timeSlots, data: { serviceId: t2._id ?? null, serviceType: t2.type ?? null } }), v2(Ac({ action: Tc.EDIT_BASKET_ITEM_FROM_CALENDAR, numberOfServices: 1, isMultiFlow: l2 })), m2().then(() => Eo(`Preferences modal opened`, { feature: Q.timeSlots, action: `auto-open-preferences`, tags: { serviceType: t2.type ?? `unknown` } }), (e3) => $(e3, { feature: Q.timeSlots, action: `open-preferences-lightbox` }))));
2590
2572
  }, [b2, t2, l2, c2, x2, S2, _2, v2, m2]);
2591
2573
  }
2592
- function fl(e2, t2) {
2574
+ function ul(e2, t2) {
2593
2575
  return t2 === void 0 ? false : !e2 || new Date(e2).getTime() <= t2;
2594
2576
  }
2595
- function pl({ serviceId: e2, serviceType: t2, lastSessionEnd: n2, timeZone: r2, now: i2, onlyAvailableSlots: a2, locationId: o2, staffId: s2, timeSlotLimitPerDay: c2, customerChoices: l2, minRemainingCapacity: u2 }) {
2577
+ var dl = 864e5;
2578
+ function fl({ serviceId: e2, serviceType: t2, lastSessionEnd: n2, timeZone: r2, now: i2, onlyAvailableSlots: a2, locationId: o2, staffId: s2, timeSlotLimitPerDay: c2, customerChoices: l2, minRemainingCapacity: u2 }) {
2596
2579
  let d2 = { serviceId: e2, onlyAvailableSlots: a2, locationId: o2 ?? void 0, staffId: s2 ?? void 0, timeZone: r2, fromLocalDate: No(new Date(i2), r2) };
2597
- return Xa(t2) ? { ...d2, serviceType: `CLASS`, minRemainingCapacity: u2 } : Za(t2) ? !n2 || fl(n2, i2) ? void 0 : { ...d2, serviceType: `COURSE`, toLocalDate: No(new Date(n2), r2) } : { ...d2, serviceType: `APPOINTMENT`, toLocalDate: _s().toLocalDate, timeSlotsPerDay: c2 + 1, customerChoices: l2 };
2580
+ return Xa(t2) ? { ...d2, serviceType: `CLASS`, minRemainingCapacity: u2 } : Za(t2) ? !n2 || ul(n2, i2) ? void 0 : { ...d2, serviceType: `COURSE`, toLocalDate: No(new Date(new Date(n2).getTime() + dl), r2) } : { ...d2, serviceType: `APPOINTMENT`, toLocalDate: hs().toLocalDate, timeSlotsPerDay: c2 + 1, customerChoices: l2 };
2598
2581
  }
2599
- function ml({ isAppointment: e2, staffOnSlotCount: t2, hasStaffFilter: n2, hasRequestedGender: r2, hasStaffPricedVariants: i2, staffSelectionStrategy: a2 }) {
2582
+ function pl({ isAppointment: e2, staffOnSlotCount: t2, hasStaffFilter: n2, hasRequestedGender: r2, hasStaffPricedVariants: i2, staffSelectionStrategy: a2 }) {
2600
2583
  return e2 && t2 > 1 && !n2 && !i2 && (a2 !== `CUSTOMER_MUST_CHOOSE` || r2);
2601
2584
  }
2602
- function hl(e2, t2) {
2585
+ function ml(e2, t2) {
2603
2586
  return e2.length ? e2.length === 1 ? { anyResource: false, staffMemberId: e2[0] } : t2 ? { anyResource: true } : null : null;
2604
2587
  }
2605
- function gl(e2, t2, n2) {
2588
+ function hl(e2, t2, n2) {
2606
2589
  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 };
2607
2590
  }
2608
- var _l = { staff: null, requestedGender: null, locationId: null };
2609
- function vl({ entry: e2, appointmentLike: t2, staffChoiceHidden: n2, staffPriced: r2, staffSelectionStrategy: i2, genderAllowed: a2, staffMemberIds: o2, locationIds: s2 }) {
2610
- if (!e2) return _l;
2591
+ var gl = { staff: null, requestedGender: null, locationId: null };
2592
+ function _l({ entry: e2, appointmentLike: t2, staffChoiceHidden: n2, staffPriced: r2, staffSelectionStrategy: i2, genderAllowed: a2, staffMemberIds: o2, locationIds: s2 }) {
2593
+ if (!e2) return gl;
2611
2594
  let c2 = e2.locationId && s2.includes(e2.locationId) ? e2.locationId : null, l2 = t2 && !n2 ? oo(e2) : null;
2612
- if (!l2) return { ..._l, locationId: c2 };
2613
- if (!l2.anyResource) return o2.includes(l2.staffMemberId) ? { staff: l2, requestedGender: null, locationId: c2 } : { ..._l, locationId: c2 };
2595
+ if (!l2) return { ...gl, locationId: c2 };
2596
+ if (!l2.anyResource) return o2.includes(l2.staffMemberId) ? { staff: l2, requestedGender: null, locationId: c2 } : { ...gl, locationId: c2 };
2614
2597
  let u2 = a2 ? e2.requestedGender ?? null : null;
2615
- return o2.length > 1 && !r2 && (i2 !== `CUSTOMER_MUST_CHOOSE` || u2 !== null) ? { staff: l2, requestedGender: u2, locationId: c2 } : { ..._l, locationId: c2 };
2598
+ return o2.length > 1 && !r2 && (i2 !== `CUSTOMER_MUST_CHOOSE` || u2 !== null) ? { staff: l2, requestedGender: u2, locationId: c2 } : { ...gl, locationId: c2 };
2616
2599
  }
2617
- var yl = [];
2618
- function bl({ sessions: e2, dayQuery: t2, daySlots: n2, staffFilter: r2, appointmentLike: i2, limitPerDay: a2, expandedDates: o2 }) {
2619
- let s2 = kl(Al(e2, r2)), c2 = n2 ? Al(i2 ? Qo(n2) : n2, r2) : yl;
2620
- return { rows: t2 ? c2 : jl(s2, a2, o2), slotIdOf: t2 ? Yo : Zo, daysWithMore: Ol(s2, a2, o2) };
2600
+ var vl = [];
2601
+ function yl({ sessions: e2, dayQuery: t2, daySlots: n2, staffFilter: r2, appointmentLike: i2, limitPerDay: a2, expandedDates: o2 }) {
2602
+ let s2 = Ol(kl(e2, r2)), c2 = n2 ? kl(i2 ? Xo(n2) : n2, r2) : vl;
2603
+ return { rows: t2 ? c2 : Al(s2, a2, o2), slotIdOf: t2 ? qo : Yo, daysWithMore: Dl(s2, a2, o2) };
2621
2604
  }
2622
- function xl({ rows: e2, slotIdOf: t2 }, n2) {
2623
- return [...e2.filter((e3) => t2(e3) === n2)].sort((e3, t3) => Dl(t3) - Dl(e3))[0] ?? null;
2605
+ function bl({ rows: e2, slotIdOf: t2 }, n2) {
2606
+ return [...e2.filter((e3) => t2(e3) === n2)].sort((e3, t3) => El(t3) - El(e3))[0] ?? null;
2624
2607
  }
2625
- function Sl(e2, t2, n2, r2) {
2626
- return { slotId: n2(e2), slotStartTime: e2.localStartDate ?? null, slotEndTime: e2.localEndDate ?? null, bookable: e2.bookable ?? false, tooEarlyToBook: e2.bookingPolicyViolations?.tooEarlyToBook ?? false, tooLateToBook: e2.bookingPolicyViolations?.tooLateToBook ?? 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: El(e2, t2), isAllDay: e2.allDay ?? false, staff: r2 ? [] : Cl(e2) };
2608
+ function xl(e2, t2, n2, r2) {
2609
+ return { slotId: n2(e2), slotStartTime: e2.localStartDate ?? null, slotEndTime: e2.localEndDate ?? null, bookable: e2.bookable ?? false, tooEarlyToBook: e2.bookingPolicyViolations?.tooEarlyToBook ?? false, tooLateToBook: e2.bookingPolicyViolations?.tooLateToBook ?? 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 ? [] : Sl(e2) };
2627
2610
  }
2628
- function Cl(e2) {
2611
+ function Sl(e2) {
2629
2612
  let t2 = /* @__PURE__ */ new Map();
2630
2613
  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 ?? ``);
2631
2614
  return [...t2].map(([e3, t3]) => ({ staffMemberId: e3, name: t3 }));
2632
2615
  }
2633
- function wl(e2) {
2634
- let t2 = Cl(e2);
2616
+ function Cl(e2) {
2617
+ let t2 = Sl(e2);
2635
2618
  if (t2.length) return t2.length === 1 ? t2[0].staffMemberId : null;
2636
2619
  }
2637
- function Tl(e2) {
2638
- return Cl(e2).map((e3) => e3.staffMemberId);
2620
+ function wl(e2) {
2621
+ return Sl(e2).map((e3) => e3.staffMemberId);
2639
2622
  }
2640
- function El(e2, t2) {
2623
+ function Tl(e2, t2) {
2641
2624
  if (!e2.localStartDate || !e2.localEndDate) return null;
2642
- let n2 = e2.allDay ? `UTC` : t2 ?? `UTC`, r2 = Fc(e2.localStartDate, n2), i2 = Fc(e2.localEndDate, n2);
2625
+ let n2 = e2.allDay ? `UTC` : t2 ?? `UTC`, r2 = Nc(e2.localStartDate, n2), i2 = Nc(e2.localEndDate, n2);
2643
2626
  return !r2 || !i2 || i2 < r2 ? null : Math.round((i2.getTime() - r2.getTime()) / 6e4);
2644
2627
  }
2645
- function Dl(e2) {
2628
+ function El(e2) {
2646
2629
  let t2 = e2.bookableCapacity ?? e2.remainingCapacity;
2647
2630
  return (e2.eventInfo?.waitingList?.remainingCapacity ?? 0) > 0 && (t2 ?? 0) <= 0 ? 1 : e2.bookable ? 2 : 0;
2648
2631
  }
2649
- function Ol(e2, t2, n2) {
2632
+ function Dl(e2, t2, n2) {
2650
2633
  let r2 = /* @__PURE__ */ new Map();
2651
2634
  for (let t3 of e2) {
2652
2635
  let e3 = (t3.localStartDate ?? ``).slice(0, 10);
@@ -2654,16 +2637,16 @@ function Ol(e2, t2, n2) {
2654
2637
  }
2655
2638
  return new Set([...r2].filter(([e3, r3]) => r3 > t2 && !n2.has(e3)).map(([e3]) => e3));
2656
2639
  }
2657
- function kl(e2) {
2640
+ function Ol(e2) {
2658
2641
  return e2.flatMap((e3) => {
2659
2642
  let t2 = e3.availableResources?.find((e4) => e4.resourceTypeId === Wr), n2 = t2?.resources ?? [];
2660
2643
  return n2.length <= 1 ? [e3] : n2.map((n3) => ({ ...e3, availableResources: [{ ...t2, resources: [n3] }] }));
2661
2644
  });
2662
2645
  }
2663
- function Al(e2, t2) {
2646
+ function kl(e2, t2) {
2664
2647
  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;
2665
2648
  }
2666
- function jl(e2, t2, n2) {
2649
+ function Al(e2, t2, n2) {
2667
2650
  let r2 = /* @__PURE__ */ new Map();
2668
2651
  return e2.filter((e3) => {
2669
2652
  let i2 = (e3.localStartDate ?? ``).slice(0, 10);
@@ -2672,24 +2655,24 @@ function jl(e2, t2, n2) {
2672
2655
  return r2.set(i2, a2 + 1), a2 < t2;
2673
2656
  });
2674
2657
  }
2675
- async function Ml() {
2658
+ async function jl() {
2676
2659
  try {
2677
- return await Jo();
2660
+ return await Ko();
2678
2661
  } catch (e2) {
2679
2662
  return $(e2, { feature: Q.timeSlots, action: `fetch-business-time-zone`, level: `warning` }), { businessTimeZone: null, staffSelectionStrategy: void 0, allowGenderSelection: false };
2680
2663
  }
2681
2664
  }
2682
- function Nl(e2) {
2683
- return Qs({ key: Vs(), warmupData: e2, fetchData: Ml });
2665
+ function Ml(e2) {
2666
+ return Xs({ key: zs(), warmupData: e2, fetchData: jl });
2684
2667
  }
2685
- function Pl(e2) {
2668
+ function Nl(e2) {
2686
2669
  return (e2.localStartDate ?? ``).slice(0, 10);
2687
2670
  }
2688
- var Fl = [];
2689
- function Il(e2, t2) {
2690
- 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] = (0, import_react.useState)([]), [v2, y2] = (0, import_react.useState)([]), [b2, x2] = (0, import_react.useState)(1), [S2, C2] = (0, import_react.useState)(!!n2), [w2, T2] = (0, import_react.useState)(null), [ee2, E2] = (0, import_react.useState)(null), [D2, O2] = (0, import_react.useState)(/* @__PURE__ */ new Set()), [te2, k2] = (0, import_react.useState)(null), A2 = (0, import_react.useRef)(null), ne2 = (0, import_react.useRef)(null);
2671
+ var Pl = [];
2672
+ function Fl(e2, t2) {
2673
+ 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] = (0, import_react.useState)([]), [v2, y2] = (0, import_react.useState)([]), [b2, x2] = (0, import_react.useState)(1), [S2, C2] = (0, import_react.useState)(!!n2), [w2, T2] = (0, import_react.useState)(null), [ee2, E2] = (0, import_react.useState)(null), [D2, te2] = (0, import_react.useState)(/* @__PURE__ */ new Set()), [ne2, O2] = (0, import_react.useState)(null), k2 = (0, import_react.useRef)(null), re2 = (0, import_react.useRef)(null);
2691
2674
  (0, import_react.useEffect)(() => {
2692
- if (_2([]), y2([]), x2(1), E2(null), T2(null), O2(/* @__PURE__ */ new Set()), k2(null), C2(!!n2), !n2) return;
2675
+ if (_2([]), y2([]), x2(1), E2(null), T2(null), te2(/* @__PURE__ */ new Set()), O2(null), C2(!!n2), !n2) return;
2693
2676
  let t3 = false, a2 = false, s2 = [], c2 = [];
2694
2677
  async function g3(g4) {
2695
2678
  if (t3 || a2) return;
@@ -2704,7 +2687,7 @@ function Il(e2, t2) {
2704
2687
  let a3 = [], b3 = null, S3 = v4 ?? void 0, C3 = /* @__PURE__ */ new Set();
2705
2688
  do {
2706
2689
  S3 && C3.add(S3);
2707
- let s3 = await ps({ 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 });
2690
+ let s3 = await ds({ 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 });
2708
2691
  if (t3) return;
2709
2692
  if (a3.push(...s3.timeSlots), b3 = s3.nextCursor, b3 && C3.has(b3)) throw Error(`The session API repeated a page cursor`);
2710
2693
  S3 = b3 ?? void 0, E2(s3.timeZone ?? l2 ?? null);
@@ -2721,200 +2704,199 @@ function Il(e2, t2) {
2721
2704
  async function v3(e3) {
2722
2705
  if (!(t3 || a2)) {
2723
2706
  if (h2 == null) {
2724
- O2((t4) => /* @__PURE__ */ new Set([...t4, e3]));
2707
+ te2((t4) => /* @__PURE__ */ new Set([...t4, e3]));
2725
2708
  return;
2726
2709
  }
2727
- a2 = true, k2(e3), T2(null);
2710
+ a2 = true, O2(e3), T2(null);
2728
2711
  try {
2729
- let a3 = await bs({ serviceId: n2, serviceType: r2, date: e3, timeZone: l2, onlyAvailableSlots: f2, locationId: u2, staffId: d2, customerChoices: p2, minRemainingCapacity: m2, fromLocalDate: i2, toLocalDate: o2 });
2712
+ let a3 = await vs({ serviceId: n2, serviceType: r2, date: e3, timeZone: l2, onlyAvailableSlots: f2, locationId: u2, staffId: d2, customerChoices: p2, minRemainingCapacity: m2, fromLocalDate: i2, toLocalDate: o2 });
2730
2713
  if (t3) return;
2731
- let c3 = a3.timeSlots.filter((t4) => Pl(t4) === e3), h3 = Math.max(0, s2.findIndex((t4) => t4.some((t5) => Pl(t5) === e3)));
2714
+ let c3 = a3.timeSlots.filter((t4) => Nl(t4) === e3), h3 = Math.max(0, s2.findIndex((t4) => t4.some((t5) => Nl(t5) === e3)));
2732
2715
  s2 = s2.map((t4, n3) => {
2733
- let r3 = t4.filter((t5) => Pl(t5) !== e3);
2716
+ let r3 = t4.filter((t5) => Nl(t5) !== e3);
2734
2717
  return n3 === h3 ? [...r3, ...c3] : r3;
2735
- }), _2(s2), O2((t4) => /* @__PURE__ */ new Set([...t4, e3]));
2718
+ }), _2(s2), te2((t4) => /* @__PURE__ */ new Set([...t4, e3]));
2736
2719
  } catch (e4) {
2737
2720
  if (t3) return;
2738
2721
  $(e4, { feature: Q.sessions, action: `fetch-day` }), T2(e4 instanceof Error ? e4.message : `Failed to load sessions`);
2739
2722
  } finally {
2740
- a2 = false, t3 || k2(null);
2723
+ a2 = false, t3 || O2(null);
2741
2724
  }
2742
2725
  }
2743
2726
  }
2744
- return A2.current = g3, ne2.current = v3, g3(1), () => {
2745
- t3 = true, A2.current = null, ne2.current = null;
2727
+ return k2.current = g3, re2.current = v3, g3(1), () => {
2728
+ t3 = true, k2.current = null, re2.current = null;
2746
2729
  };
2747
2730
  }, [n2, r2, i2, o2, l2, u2, d2, f2, p2, m2, h2, e2]);
2748
- let re2 = [...g2[b2 - 1] ?? Fl].sort((e3, t3) => (e3.localStartDate ?? ``).localeCompare(t3.localStartDate ?? ``)), j2 = g2[b2], ie2 = j2 ? j2.length > 0 : v2[b2 - 1] != null, M2 = b2 > 1;
2749
- async function ae2() {
2750
- ie2 && !S2 && await A2.current?.(b2 + 1);
2731
+ let ie2 = [...g2[b2 - 1] ?? Pl].sort((e3, t3) => (e3.localStartDate ?? ``).localeCompare(t3.localStartDate ?? ``)), A2 = g2[b2], ae2 = A2 ? A2.length > 0 : v2[b2 - 1] != null, j2 = b2 > 1;
2732
+ async function oe2() {
2733
+ ae2 && !S2 && await k2.current?.(b2 + 1);
2751
2734
  }
2752
- function oe2() {
2753
- M2 && !S2 && A2.current?.(b2 - 1);
2735
+ function M2() {
2736
+ j2 && !S2 && k2.current?.(b2 - 1);
2754
2737
  }
2755
2738
  async function se2(e3) {
2756
- S2 || te2 !== null || D2.has(e3) || await ne2.current?.(e3);
2739
+ S2 || ne2 !== null || D2.has(e3) || await re2.current?.(e3);
2757
2740
  }
2758
- return { isLoadingPage: S2, firstPageSettled: g2.length > 0 || w2 !== null, error: w2, timeZone: ee2, sessions: re2, pageSize: e2, currentPage: b2, hasNextPage: ie2, hasPreviousPage: M2, nextPage: ae2, previousPage: oe2, expandedDates: D2, loadingDate: te2, loadAllSessionsForDay: se2 };
2741
+ 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 };
2759
2742
  }
2760
- var Ll = (e2) => e2?.onlineBooking?.enabled === true;
2761
- function Rl(e2, t2) {
2743
+ var Il = (e2) => e2?.onlineBooking?.enabled === true;
2744
+ function Ll(e2, t2) {
2762
2745
  return e2 ? e2.anyResource ? t2 ?? `` : e2.staffMemberId : null;
2763
2746
  }
2747
+ var Rl = [];
2764
2748
  var zl = [];
2765
- var Bl = [];
2766
- var Vl = cn.map((e2) => ({ id: e2, gender: e2 }));
2767
- var Hl = { isSelectionValidated: false };
2768
- var Ul = () => {
2749
+ var Bl = cn.map((e2) => ({ id: e2, gender: e2 }));
2750
+ var Vl = () => {
2769
2751
  };
2770
- var Wl = async () => {
2752
+ var Hl = async () => {
2771
2753
  };
2772
- var Gl = (0, import_react.createContext)(null);
2773
- function Kl() {
2774
- let e2 = (0, import_react.useContext)(Gl);
2754
+ var Ul = (0, import_react.createContext)(null);
2755
+ function Wl() {
2756
+ let e2 = (0, import_react.useContext)(Ul);
2775
2757
  if (!e2) throw Error(`useTimeSlotsContext must be used within TimeSlotsContextProvider`);
2776
2758
  return e2;
2777
2759
  }
2778
- function ql(e2, t2, n2) {
2760
+ function Gl(e2, t2, n2) {
2779
2761
  e2 ? t2() : n2();
2780
2762
  }
2781
- var Jl = { loginRequired: `rescheduleLoginRequired`, notFound: `rescheduleNotFound`, accessDenied: `rescheduleAccessDenied`, failed: `rescheduleNotFound`, wrongService: `rescheduleNotFound`, notReschedulable: `rescheduleNotReschedulable` };
2782
- function Yl(e2 = 3) {
2783
- return Math.min(Math.max(e2, 1), lc);
2763
+ var Kl = { loginRequired: `rescheduleLoginRequired`, notFound: `rescheduleNotFound`, accessDenied: `rescheduleAccessDenied`, failed: `rescheduleNotFound`, wrongService: `rescheduleNotFound`, notReschedulable: `rescheduleNotReschedulable` };
2764
+ function ql(e2 = 3) {
2765
+ return Math.min(Math.max(e2, 1), sc);
2784
2766
  }
2785
- function Xl(e2) {
2767
+ function Jl(e2) {
2786
2768
  let { isLoading: n2, bookingsSettingsLoading: r2 } = (0, import_service.useServiceContext)();
2787
- jc(Tc.TIME_SLOTS, !n2 && !r2);
2788
- let i2 = Rs(), [a2] = (0, import_react.useState)(() => Nl(i2));
2789
- return (0, import_jsx_runtime.jsx)(cc, { children: (0, import_jsx_runtime.jsx)(import_react.Suspense, { fallback: (0, import_jsx_runtime.jsx)(Rc, { nextAvailableSlotsCount: Yl(e2.nextAvailableSlotsCount), children: e2.children }), children: (0, import_jsx_runtime.jsx)(Ql, { ...e2, configurationPromise: a2 }) }) });
2769
+ kc(Cc.TIME_SLOTS, !n2 && !r2);
2770
+ let i2 = Is(), [a2] = (0, import_react.useState)(() => Ml(i2));
2771
+ return (0, import_jsx_runtime.jsx)(oc, { children: (0, import_jsx_runtime.jsx)(import_react.Suspense, { fallback: (0, import_jsx_runtime.jsx)(Ic, { nextAvailableSlotsCount: ql(e2.nextAvailableSlotsCount), children: e2.children }), children: (0, import_jsx_runtime.jsx)(Xl, { ...e2, configurationPromise: a2 }) }) });
2790
2772
  }
2791
- function Zl(e2) {
2773
+ function Yl(e2) {
2792
2774
  let [t2, n2] = (0, import_react.useState)({ serviceId: e2, key: 0 });
2793
2775
  return e2 !== t2.serviceId && n2({ serviceId: e2, key: t2.serviceId ? t2.key + 1 : t2.key }), t2.key;
2794
2776
  }
2795
- function Ql({ onlyAvailableSlots: e2 = true, nextAvailableSlotsCount: t2 = 3, loadDaysAvailabilityInitially: n2 = false, timeSlotLimitPerDay: r2 = 100, configurationPromise: i2, children: o2 }) {
2796
- let s2 = ic().isLoading, { searchParams: d2 } = bc(), { reschedule: f2 } = (0, import_service.useServiceContext)(), [m2] = (0, import_react.useState)(() => ({ locationId: d2.get(eo.location), staffId: d2.get(eo.resource), timeZone: (f2 ? void 0 : Pr(d2.get(eo.blob))?.timezone) ?? d2.get(eo.timezone) })), [h2, g2] = (0, import_react.useState)(m2.timeZone), _2 = Yl(t2), [v2, y2] = (0, import_react.useState)(false);
2777
+ function Xl({ onlyAvailableSlots: e2 = true, nextAvailableSlotsCount: t2 = 3, loadDaysAvailabilityInitially: n2 = false, timeSlotLimitPerDay: r2 = 100, configurationPromise: i2, children: o2 }) {
2778
+ let s2 = nc().isLoading, { searchParams: d2 } = vc(), { reschedule: f2 } = (0, import_service.useServiceContext)(), [m2] = (0, import_react.useState)(() => ({ locationId: d2.get(eo.location), staffId: d2.get(eo.resource), timeZone: (f2 ? void 0 : Pr(d2.get(eo.blob))?.timezone) ?? d2.get(eo.timezone) })), [h2, g2] = (0, import_react.useState)(m2.timeZone), _2 = ql(t2), [v2, y2] = (0, import_react.useState)(false);
2797
2779
  (0, import_react.useEffect)(() => y2(true), []);
2798
2780
  let b2 = v2 && !s2;
2799
- dl(b2);
2800
- let x2 = Ns(i2), S2 = (0, import_react.useSyncExternalStore)(cs, ss, () => false), { serviceId: C2 } = (0, import_service.useServiceContext)(), w2 = Zl(C2), T2 = Number.isFinite(r2) ? Math.max(1, Math.floor(r2)) : 100;
2801
- return (0, import_jsx_runtime.jsx)(uc, { fallback: (0, import_jsx_runtime.jsx)(zc, { nextAvailableSlotsCount: _2, children: o2 }), feature: Q.timeSlots, children: (0, import_jsx_runtime.jsx)($l, { 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);
2781
+ ll(b2);
2782
+ let x2 = js(i2), S2 = (0, import_react.useSyncExternalStore)(os, as, () => false), { serviceId: C2 } = (0, import_service.useServiceContext)(), w2 = Yl(C2), T2 = Number.isFinite(r2) ? Math.max(1, Math.floor(r2)) : 100;
2783
+ return (0, import_jsx_runtime.jsx)(cc, { fallback: (0, import_jsx_runtime.jsx)(Lc, { nextAvailableSlotsCount: _2, children: o2 }), feature: Q.timeSlots, children: (0, import_jsx_runtime.jsx)(Zl, { 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);
2802
2784
  }
2803
- function $l({ 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 }) {
2804
- let { service: x2, serviceId: S2, serviceType: C2, setSlot: w2, clearSlot: T2, setMultiServiceSlot: ee2, clearMultiServiceSlot: E2, draftRevision: D2, navigateToMultiServiceForm: O2, selection: te2, selectStaffMember: k2, clearSelection: A2, clearStaffMember: ne2, withSelectionParam: re2, staffMembers: j2, serviceOptionsAndVariants: ie2, isLoading: M2, hasError: ae2, multiServiceAppointmentServices: oe2 = Bl, reschedule: se2 } = (0, import_service.useServiceContext)(), N2 = se2 != null, ce2 = N2 && se2.status !== `ready`, le2 = N2 && se2.status === `loading`, ue2 = N2 ? Jl[se2.status] : void 0, de2 = ce2 ? null : se2?.booking ?? null, fe2 = de2 ? se2.validUntil : null, pe2 = cl(x2) && !Ll(x2), P2 = pe2 || ce2 ? null : S2, me2 = bc(), he2 = N2 ? null : me2.searchParams.get(eo.blob), ge2 = (0, import_react.useMemo)(() => io(Pr(he2)), [he2]), F2 = !S2 && !M2 && !ae2 && (ge2.valid || ge2.reason !== `too-few-services`), _e2 = F2 && ge2.valid && oe2.some((e3) => !Ll(e3) && ge2.services.some((t3) => t3.serviceId === e3._id)), ve2 = pe2 || _e2, ye2 = F2 && ge2.valid && !_e2 ? ge2.requestKey : null, be2 = (0, import_react.useMemo)(() => ye2 && ge2.valid ? { services: ge2.services, locationId: ge2.locationId, locationType: ge2.locationType } : null, [ye2]), xe2 = !!P2 || be2 !== null, Se2 = P2 || ye2, Ce2 = i2 && !M2 && !ae2 && !xe2 && !le2, we2 = oc(), Te2 = ic(), { navigate: Ee2, resolvePath: De2 } = go(), [Oe2, ke2] = (0, import_react.useState)(null), [Ae2, je2] = (0, import_react.useState)(false), Me2 = (0, import_react.useRef)([]), Ne2 = (0, import_react.useRef)(false), Pe2 = (0, import_react.useCallback)(() => (je2(true), Ne2.current ? Promise.resolve() : new Promise((e3) => {
2785
+ function Zl({ 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 }) {
2786
+ 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 = zl, reschedule: se2 } = (0, import_service.useServiceContext)(), N2 = se2 != null, ce2 = N2 && se2.status !== `ready`, le2 = N2 && se2.status === `loading`, ue2 = N2 ? Kl[se2.status] : void 0, de2 = ce2 ? null : se2?.booking ?? null, fe2 = de2 ? se2.validUntil : null, pe2 = ol(x2) && !Il(x2), P2 = pe2 || ce2 ? null : S2, me2 = vc(), he2 = N2 ? null : me2.searchParams.get(eo.blob), ge2 = (0, import_react.useMemo)(() => io(Pr(he2)), [he2]), F2 = !S2 && !j2 && !oe2 && (ge2.valid || ge2.reason !== `too-few-services`), _e2 = F2 && ge2.valid && M2.some((e3) => !Il(e3) && ge2.services.some((t3) => t3.serviceId === e3._id)), ve2 = pe2 || _e2, ye2 = F2 && ge2.valid && !_e2 ? ge2.requestKey : null, be2 = (0, import_react.useMemo)(() => 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 = ic(), Te2 = nc(), { navigate: Ee2, resolvePath: De2 } = go(), [Oe2, ke2] = (0, import_react.useState)(null), [Ae2, je2] = (0, import_react.useState)(false), Me2 = (0, import_react.useRef)([]), Ne2 = (0, import_react.useRef)(false), Pe2 = (0, import_react.useCallback)(() => (je2(true), Ne2.current ? Promise.resolve() : new Promise((e3) => {
2805
2787
  Me2.current.push(e3);
2806
- })), []), Fe2 = i2 ? Intl.DateTimeFormat().resolvedOptions().timeZone : null, Ie2 = Ja(x2), Le2 = (0, import_react.useRef)(null), Re2 = oo(te2), ze2 = (0, import_react.useRef)(Re2);
2788
+ })), []), Fe2 = i2 ? Intl.DateTimeFormat().resolvedOptions().timeZone : null, Ie2 = Ja(x2), Le2 = (0, import_react.useRef)(null), Re2 = oo(ne2), ze2 = (0, import_react.useRef)(Re2);
2807
2789
  ze2.current = Re2;
2808
- let Be2 = Re2 && !Re2.anyResource ? Re2.staffMemberId : null, Ve2 = te2.requestedGender ?? null, I2 = !Xa(C2) && !Za(C2), He2 = I2 && !F2 && Ss(ie2), L2 = F2 || I2 && _2 === `CUSTOMER_CANNOT_CHOOSE`, Ue2 = _2 !== void 0, We2 = qo({ allowGenderSelection: v2, staffSelectionStrategy: _2 ?? null }) && I2 && !F2 && !He2, Ge2 = We2 && !y2, Ke2 = (0, import_react.useMemo)(() => P2 ? Pr(he2)?.services.find((e3) => e3.serviceId === P2) ?? null : null, [he2, P2]), qe2 = (j2 ?? []).map((e3) => e3.staffMemberId).join(`,`), Je2 = Ie2.map((e3) => e3.id).join(`,`), Ye2 = (0, import_react.useMemo)(() => vl({ 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] = (0, import_react.useState)(null), [et2, tt2] = (0, import_react.useState)(m2 !== null || N2), z2 = (0, import_react.useMemo)(() => x2 ? As(x2) : [], [x2]), nt2 = R2 && !R2.anyResource ? R2.staffMemberId : null, rt2 = (0, import_react.useMemo)(() => {
2790
+ let Be2 = Re2 && !Re2.anyResource ? Re2.staffMemberId : null, Ve2 = ne2.requestedGender ?? null, I2 = !Xa(C2) && !Za(C2), He2 = I2 && !F2 && bs(ae2), L2 = F2 || I2 && _2 === `CUSTOMER_CANNOT_CHOOSE`, Ue2 = _2 !== void 0, We2 = Go({ allowGenderSelection: v2, staffSelectionStrategy: _2 ?? null }) && I2 && !F2 && !He2, Ge2 = We2 && !y2, Ke2 = (0, import_react.useMemo)(() => P2 ? Pr(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 = (0, import_react.useMemo)(() => _l({ 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] = (0, import_react.useState)(null), [et2, tt2] = (0, import_react.useState)(m2 !== null || N2), z2 = (0, import_react.useMemo)(() => x2 ? Os(x2) : [], [x2]), nt2 = R2 && !R2.anyResource ? R2.staffMemberId : null, rt2 = (0, import_react.useMemo)(() => {
2809
2791
  if (!nt2) return z2;
2810
2792
  let e3 = z2.find((e4) => e4.staffMemberId === nt2);
2811
2793
  return e3 ? [e3] : z2;
2812
2794
  }, [z2, nt2]), it2 = de2?.locationId ?? null, at2 = (0, import_react.useMemo)(() => {
2813
- let e3 = ks(Ie2, rt2);
2795
+ let e3 = Ds(Ie2, rt2);
2814
2796
  return !it2 || e3.some((e4) => e4.id === it2) ? e3 : Ie2.filter((t3) => t3.id === it2 || e3.some((e4) => e4.id === t3.id));
2815
- }, [x2, rt2, it2]), ot2 = (e3) => !!e3 && at2.some((t3) => t3.id === e3), st2 = Qe2 ?? (et2 ? ot2(it2) ? it2 : m2 : null), ct2 = Ie2.length > 1 && at2.length === 1 ? at2[0].id : null, B2 = Xe2 ?? (ot2(st2) ? st2 : ct2), lt2 = (0, import_react.useMemo)(() => Xe2 ? [] : at2.map((e3) => ({ id: e3.id, name: e3.label })), [at2, Xe2]), ut2 = (0, import_react.useMemo)(() => new Map(z2.map((e3) => [e3.staffMemberId, e3.locationCoverage])), [z2]), dt2 = (0, import_react.useCallback)((e3, t3) => Es([{ staffMemberId: e3, locationCoverage: ut2.get(e3) }], t3).length === 1, [ut2]), ft2 = (0, import_react.useMemo)(() => Ze2 ? [] : (j2 ?? []).filter((e3) => e3.name).map((e3) => ({ id: e3.staffMemberId, name: e3.name ?? ``, gender: null })), [j2, Ze2]), pt2 = (0, import_react.useMemo)(() => B2 ? ft2.filter((e3) => dt2(e3.id, B2)) : ft2, [ft2, B2, dt2]), mt2 = I2 && !Ue2 ? zl : pt2, ht2 = I2 && !Ue2 ? 0 : ft2.length, gt2 = Ge2 && ht2 > 1, _t2 = (0, import_react.useMemo)(() => gt2 ? [...Vl, ...mt2] : mt2, [gt2, mt2]), [vt2, yt2] = (0, import_react.useState)(null), [bt2, xt2] = (0, import_react.useState)(h2 !== null);
2797
+ }, [x2, rt2, it2]), ot2 = (e3) => !!e3 && at2.some((t3) => t3.id === e3), st2 = Qe2 ?? (et2 ? ot2(it2) ? it2 : m2 : null), ct2 = Ie2.length > 1 && at2.length === 1 ? at2[0].id : null, B2 = Xe2 ?? (ot2(st2) ? st2 : ct2), lt2 = (0, import_react.useMemo)(() => Xe2 ? [] : at2.map((e3) => ({ id: e3.id, name: e3.label })), [at2, Xe2]), ut2 = (0, import_react.useMemo)(() => new Map(z2.map((e3) => [e3.staffMemberId, e3.locationCoverage])), [z2]), dt2 = (0, import_react.useCallback)((e3, t3) => ws([{ staffMemberId: e3, locationCoverage: ut2.get(e3) }], t3).length === 1, [ut2]), ft2 = (0, import_react.useMemo)(() => Ze2 ? [] : (A2 ?? []).filter((e3) => e3.name).map((e3) => ({ id: e3.staffMemberId, name: e3.name ?? ``, gender: null })), [A2, Ze2]), pt2 = (0, import_react.useMemo)(() => B2 ? ft2.filter((e3) => dt2(e3.id, B2)) : ft2, [ft2, B2, dt2]), mt2 = I2 && !Ue2 ? Rl : pt2, ht2 = I2 && !Ue2 ? 0 : ft2.length, gt2 = Ge2 && ht2 > 1, _t2 = (0, import_react.useMemo)(() => gt2 ? [...Bl, ...mt2] : mt2, [gt2, mt2]), [vt2, yt2] = (0, import_react.useState)(null), [bt2, xt2] = (0, import_react.useState)(h2 !== null);
2816
2798
  bt2 && h2 !== null && B2 !== null && !dt2(h2, B2) && xt2(false);
2817
2799
  let St2 = vt2 ?? (bt2 ? h2 : null), V2 = R2 ? R2.anyResource ? null : R2.staffMemberId : St2 !== null && pt2.some((e3) => e3.id === St2) ? St2 : null, Ct2 = Re2?.anyResource ? Ve2 : null, [wt2, Tt2] = (0, import_react.useState)(Ct2), [Et2, Dt2] = (0, import_react.useState)(Ct2);
2818
2800
  !y2 && Re2?.anyResource && Ve2 !== Et2 && (Dt2(Ve2), Tt2(Ve2));
2819
2801
  let Ot2 = R2 ? Ye2.requestedGender : We2 && ht2 > 1 && V2 === null ? wt2 : null, kt2 = y2 ? null : Ot2, At2 = (0, import_react.useCallback)((e3) => {
2820
- ze2.current = e3, e3 ? e3.anyResource ? A2(kt2 ?? void 0) : k2(e3.staffMemberId) : ne2();
2821
- }, [ne2, A2, k2, kt2]), jt2 = (0, import_react.useCallback)((e3) => At2(e3 ? { anyResource: false, staffMemberId: e3 } : { anyResource: true }), [At2]), Mt2 = (de2?.addOnIds ?? []).filter((e3) => x2?.addOnGroups?.some((t3) => t3.addOnIds?.includes(e3))), Nt2 = de2 && Xa(C2) ? de2.participants : null, Pt2 = I2 ? to(te2) : null, { addOnIds: Ft2, ...It2 } = Pt2 ?? {}, Lt2 = I2 && de2 ? Mt2.length ? { ...It2, addOnIds: Mt2 } : It2 : Pt2, Rt2 = Lt2 ? ts(Lt2) : void 0, zt2 = JSON.stringify(Ot2 ? { ...Rt2, requestedGender: { gender: Ot2 } } : Rt2 ?? null), Bt2 = (0, import_react.useMemo)(() => JSON.parse(zt2), [zt2]), Vt2 = R2?.anyResource === true, Ht2 = (0, import_react.useCallback)((e3) => Vt2 || _2 !== void 0 && ml({ isAppointment: I2, staffOnSlotCount: e3, hasStaffFilter: V2 !== null, hasRequestedGender: kt2 !== null, hasStaffPricedVariants: He2, staffSelectionStrategy: _2 }), [Vt2, I2, _2, V2, kt2, He2]), Ut2 = (0, import_react.useCallback)((e3) => R2 ?? (L2 ? null : e3), [R2, L2]), Wt2 = (0, import_react.useCallback)((e3) => {
2802
+ ze2.current = e3, e3 ? e3.anyResource ? k2(kt2 ?? void 0) : O2(e3.staffMemberId) : re2();
2803
+ }, [re2, k2, O2, kt2]), jt2 = (0, import_react.useCallback)((e3) => At2(e3 ? { anyResource: false, staffMemberId: e3 } : { anyResource: true }), [At2]), Mt2 = (de2?.addOnIds ?? []).filter((e3) => x2?.addOnGroups?.some((t3) => t3.addOnIds?.includes(e3))), Nt2 = de2 && Xa(C2) ? de2.participants : null, Pt2 = I2 ? to(ne2) : null, { addOnIds: Ft2, ...It2 } = Pt2 ?? {}, Lt2 = I2 && de2 ? Mt2.length ? { ...It2, addOnIds: Mt2 } : It2 : Pt2, Rt2 = Lt2 ? $o(Lt2) : void 0, zt2 = JSON.stringify(Ot2 ? { ...Rt2, requestedGender: { gender: Ot2 } } : Rt2 ?? null), Bt2 = (0, import_react.useMemo)(() => JSON.parse(zt2), [zt2]), Vt2 = R2?.anyResource === true, Ht2 = (0, import_react.useCallback)((e3) => Vt2 || _2 !== void 0 && pl({ isAppointment: I2, staffOnSlotCount: e3, hasStaffFilter: V2 !== null, hasRequestedGender: kt2 !== null, hasStaffPricedVariants: He2, staffSelectionStrategy: _2 }), [Vt2, I2, _2, V2, kt2, He2]), Ut2 = (0, import_react.useCallback)((e3) => R2 ?? (L2 ? null : e3), [R2, L2]), Wt2 = (0, import_react.useCallback)((e3) => {
2822
2804
  let t3 = e3 === null ? null : _t2.find((t4) => t4.id === e3);
2823
2805
  t3 !== void 0 && (xt2(false), yt2(t3 && !t3.gender ? t3.id : null), Tt2(t3?.gender ?? null));
2824
2806
  }, [_t2]), Gt2 = (0, import_react.useCallback)((e3) => {
2825
2807
  (e3 === null || at2.some((t3) => t3.id === e3)) && (tt2(false), $e2(e3), St2 !== null && e3 !== null && !dt2(St2, e3) && (yt2(null), xt2(false)));
2826
2808
  }, [at2, St2, dt2]), Kt2 = !!(i2 && !Te2.isLoading && Te2.displayTimeZonePolicy.customerCanChange && g2 && Fe2 && g2 !== Fe2), H2 = i2 ? Kt2 && t2 && (t2 === g2 || t2 === Fe2) ? t2 : we2 ?? g2 ?? Fe2 : null, qt2 = (0, import_react.useCallback)((e3) => {
2827
2809
  Kt2 && (e3 === g2 || e3 === Fe2) && n2(e3);
2828
- }, [Kt2, g2, Fe2, n2]), Jt2 = (0, import_react.useMemo)(() => i2 && !M2 && xe2 ? Date.now() : void 0, [i2, M2, P2, be2, H2]), Yt2 = Jt2 !== void 0 && H2 ? Ao(new Date(Jt2), H2) : null, { range: Xt2, daysAvailability: Zt2, isLoading: Qt2, hasError: $t2, setRange: en2, nextRange: tn2, previousRange: nn2 } = tl({ enabled: i2, serviceId: P2, serviceType: C2, multiServiceRequest: be2, timeZone: H2, today: Yt2, locationId: B2, staffId: V2, customerChoices: Bt2, minRemainingCapacity: Nt2, loadInitially: d2, onlyAvailableSlots: e2 }), rn2 = fe2?.slice(0, 10) ?? null, an2 = (0, import_react.useMemo)(() => rn2 ? Zt2.map((e3) => e3.date > rn2 ? { ...e3, availability: `none` } : e3) : Zt2, [Zt2, rn2]), on2 = fe2 && H2 ? No(new Date(fe2), H2) : null, { query: U2, selectedDate: sn2, timeSlots: cn2, isLoading: ln2, error: un2, selectDate: dn2, findNextAvailableDate: fn2 } = nl({ enabled: i2, serviceId: P2, serviceType: C2, multiServiceRequest: be2, timeZone: H2, today: Yt2, locationId: B2, staffId: V2, customerChoices: Bt2, minRemainingCapacity: Nt2, onlyAvailableSlots: e2, serviceLoading: M2 || le2 }), pn2 = (0, import_react.useRef)(true), mn2 = (0, import_react.useRef)(null);
2810
+ }, [Kt2, g2, Fe2, n2]), Jt2 = (0, import_react.useMemo)(() => i2 && !j2 && xe2 ? Date.now() : void 0, [i2, j2, P2, be2, H2]), Yt2 = Jt2 !== void 0 && H2 ? Ao(new Date(Jt2), H2) : null, { range: Xt2, daysAvailability: Zt2, isLoading: Qt2, hasError: $t2, setRange: en2 } = $c({ enabled: i2, serviceId: P2, serviceType: C2, multiServiceRequest: be2, timeZone: H2, today: Yt2, locationId: B2, staffId: V2, customerChoices: Bt2, minRemainingCapacity: Nt2, loadInitially: d2, onlyAvailableSlots: e2 }), tn2 = fe2?.slice(0, 10) ?? null, nn2 = (0, import_react.useMemo)(() => tn2 ? Zt2.map((e3) => e3.date > tn2 ? { ...e3, availability: `none` } : e3) : Zt2, [Zt2, tn2]), rn2 = fe2 && H2 ? No(new Date(fe2), H2) : null, { query: U2, selectedDate: an2, timeSlots: on2, isLoading: sn2, error: cn2, selectDate: ln2, findNextAvailableDate: un2 } = el({ enabled: i2, serviceId: P2, serviceType: C2, multiServiceRequest: be2, timeZone: H2, today: Yt2, locationId: B2, staffId: V2, customerChoices: Bt2, minRemainingCapacity: Nt2, onlyAvailableSlots: e2, serviceLoading: j2 || le2 }), dn2 = (0, import_react.useRef)(true), fn2 = (0, import_react.useRef)(null);
2829
2811
  (0, import_react.useEffect)(() => {
2830
- if (pn2.current) {
2831
- pn2.current = false;
2812
+ if (dn2.current) {
2813
+ dn2.current = false;
2832
2814
  return;
2833
2815
  }
2834
- ke2(null), Le2.current && ql(P2, T2, E2), Le2.current = null, mn2.current = null;
2816
+ ke2(null), Le2.current && Gl(P2, T2, E2), Le2.current = null, fn2.current = null;
2835
2817
  }, [U2, be2, H2, B2, V2, Bt2, Nt2, e2, l2, f2, D2]);
2836
- let hn2 = (0, import_react.useCallback)(async () => {
2837
- let e3 = await fn2();
2838
- return e3.outcome === `found` ? rn2 && e3.date > rn2 ? `none` : (await Promise.all([dn2(e3.date), Xt2 && Wo(e3.date, Xt2) ? Promise.resolve() : en2(Vo(e3.date))]), `found`) : e3.outcome;
2839
- }, [fn2, rn2, dn2, Xt2, en2]), gn2 = !!(i2 && !M2 && xe2 && H2 && Yt2), W2 = i2 && !M2 && !le2 && !xe2, [_n2, vn2] = (0, import_react.useState)(false), [yn2, bn2] = (0, import_react.useState)(0), xn2 = (0, import_react.useRef)(false), Sn2 = (0, import_react.useRef)([]), Cn2 = (0, import_react.useRef)(0), wn2 = (0, import_react.useCallback)(() => {
2840
- vn2(false);
2841
- let e3 = Sn2.current;
2842
- return Sn2.current = [], e3;
2843
- }, []), Tn2 = (0, import_react.useCallback)(() => {
2844
- Cn2.current += 1, wn2().forEach((e3) => e3(`cancelled`));
2845
- }, [wn2]), En2 = (0, import_react.useCallback)((e3) => (Tn2(), dn2(e3)), [Tn2, dn2]), Dn2 = (0, import_react.useCallback)((e3) => {
2846
- let t3 = Cn2.current;
2847
- xn2.current = true, hn2().then((n3) => {
2848
- xn2.current = false, n3 === `cancelled` && t3 === Cn2.current ? (Sn2.current.unshift(...e3), vn2(true)) : e3.forEach((e4) => e4(n3)), bn2((e4) => e4 + 1);
2818
+ let pn2 = (0, import_react.useCallback)(async () => {
2819
+ let e3 = await un2();
2820
+ return e3.outcome === `found` ? tn2 && e3.date > tn2 ? `none` : (await Promise.all([ln2(e3.date), Xt2 && Ho(e3.date, Xt2) ? Promise.resolve() : en2(Vo(e3.date))]), `found`) : e3.outcome;
2821
+ }, [un2, tn2, ln2, Xt2, en2]), mn2 = !!(i2 && !j2 && xe2 && H2 && Yt2), hn2 = i2 && !j2 && !le2 && !xe2, [gn2, W2] = (0, import_react.useState)(false), [_n2, vn2] = (0, import_react.useState)(0), yn2 = (0, import_react.useRef)(false), bn2 = (0, import_react.useRef)([]), xn2 = (0, import_react.useRef)(0), Sn2 = (0, import_react.useCallback)(() => {
2822
+ W2(false);
2823
+ let e3 = bn2.current;
2824
+ return bn2.current = [], e3;
2825
+ }, []), Cn2 = (0, import_react.useCallback)(() => {
2826
+ xn2.current += 1, Sn2().forEach((e3) => e3(`cancelled`));
2827
+ }, [Sn2]), wn2 = (0, import_react.useCallback)((e3) => (Cn2(), ln2(e3)), [Cn2, ln2]), Tn2 = (0, import_react.useCallback)((e3) => {
2828
+ let t3 = xn2.current;
2829
+ yn2.current = true, pn2().then((n3) => {
2830
+ yn2.current = false, n3 === `cancelled` && t3 === xn2.current ? (bn2.current.unshift(...e3), W2(true)) : e3.forEach((e4) => e4(n3)), vn2((e4) => e4 + 1);
2849
2831
  });
2850
- }, [hn2]), On2 = (0, import_react.useCallback)(() => W2 ? Promise.resolve(`none`) : new Promise((e3) => {
2851
- if (gn2 && !xn2.current) {
2852
- Dn2([...wn2(), e3]);
2832
+ }, [pn2]), En2 = (0, import_react.useCallback)(() => hn2 ? Promise.resolve(`none`) : new Promise((e3) => {
2833
+ if (mn2 && !yn2.current) {
2834
+ Tn2([...Sn2(), e3]);
2853
2835
  return;
2854
2836
  }
2855
- Sn2.current.push(e3), vn2(true);
2856
- }), [W2, gn2, Dn2, wn2]);
2837
+ bn2.current.push(e3), W2(true);
2838
+ }), [hn2, mn2, Tn2, Sn2]);
2857
2839
  (0, import_react.useEffect)(() => {
2858
- if (_n2 && !xn2.current) {
2859
- if (W2) {
2860
- wn2().forEach((e3) => e3(`none`));
2840
+ if (gn2 && !yn2.current) {
2841
+ if (hn2) {
2842
+ Sn2().forEach((e3) => e3(`none`));
2861
2843
  return;
2862
2844
  }
2863
- gn2 && Dn2(wn2());
2845
+ mn2 && Tn2(Sn2());
2864
2846
  }
2865
- }, [_n2, yn2, gn2, W2, Dn2, wn2]);
2866
- let kn2 = x2?.schedule?.lastSessionEnd, An2 = I2 || Xa(C2) || Za(C2) && !fl(kn2, Jt2), jn2 = !!(Ae2 && i2 && !M2 && P2 && H2 && Jt2 !== void 0), Mn2 = jn2 && P2 && H2 && Jt2 !== void 0 ? pl({ serviceId: P2, serviceType: C2, lastSessionEnd: kn2, timeZone: H2, now: Jt2, onlyAvailableSlots: e2, locationId: B2, staffId: V2, timeSlotLimitPerDay: f2, customerChoices: Bt2, minRemainingCapacity: Nt2 }) : void 0, G2 = Il(l2, Mn2), Nn2 = Ae2 && P2 && An2 && !(Ae2 && P2 && An2 && (!i2 || M2)) && !H2, Pn2 = ve2 ? `onlineBookingOff` : ue2 ?? (G2.error === null ? Nn2 ? `timeZoneMissing` : null : `upcomingSlotsLoadFailed`), Fn2 = U2 !== null, In2 = (0, import_react.useMemo)(() => bl({ sessions: G2.sessions, dayQuery: Fn2, daySlots: cn2, staffFilter: V2, appointmentLike: I2, limitPerDay: f2, expandedDates: G2.expandedDates }), [G2.sessions, Fn2, cn2, V2, I2, f2, G2.expandedDates]), { slotIdOf: Ln2 } = In2, Rn2 = Ae2 && (Mn2 ? G2.firstPageSettled : jn2 || i2 && !M2 && !P2 || Nn2);
2867
- Ne2.current = Rn2, (0, import_react.useEffect)(() => {
2868
- if (!Rn2) return;
2847
+ }, [gn2, _n2, mn2, hn2, Tn2, Sn2]);
2848
+ let Dn2 = x2?.schedule?.lastSessionEnd, On2 = I2 || Xa(C2) || Za(C2) && !ul(Dn2, Jt2), kn2 = !!(Ae2 && i2 && !j2 && P2 && H2 && Jt2 !== void 0), An2 = kn2 && P2 && H2 && Jt2 !== void 0 ? fl({ serviceId: P2, serviceType: C2, lastSessionEnd: Dn2, timeZone: H2, now: Jt2, onlyAvailableSlots: e2, locationId: B2, staffId: V2, timeSlotLimitPerDay: f2, customerChoices: Bt2, minRemainingCapacity: Nt2 }) : void 0, G2 = Fl(l2, An2), jn2 = Ae2 && P2 && On2 && !(Ae2 && P2 && On2 && (!i2 || j2)) && !H2, Mn2 = ve2 ? `onlineBookingOff` : ue2 ?? (G2.error === null ? jn2 ? `timeZoneMissing` : null : `upcomingSlotsLoadFailed`), Nn2 = U2 !== null, Pn2 = (0, import_react.useMemo)(() => yl({ sessions: G2.sessions, dayQuery: Nn2, daySlots: on2, staffFilter: V2, appointmentLike: I2, limitPerDay: f2, expandedDates: G2.expandedDates }), [G2.sessions, Nn2, on2, V2, I2, f2, G2.expandedDates]), { slotIdOf: Fn2 } = Pn2, In2 = Ae2 && (An2 ? G2.firstPageSettled : kn2 || i2 && !j2 && !P2 || jn2);
2849
+ Ne2.current = In2, (0, import_react.useEffect)(() => {
2850
+ if (!In2) return;
2869
2851
  let e3 = Me2.current;
2870
2852
  Me2.current = [], e3.forEach((e4) => e4());
2871
- }, [Rn2]);
2872
- let zn2 = Ae2 && !Rn2 || G2.isLoadingPage, Bn2 = Pn2 !== null, Vn2 = U2 ? ln2 : zn2 || ln2 || !i2 || xe2 && !H2 || _n2 || le2, Hn2 = U2 ? un2 : un2 ?? Pn2, Un2 = U2 ? un2 !== null : Bn2 || un2 !== null, K2 = Ac(Tc.TIME_SLOTS), Wn2 = (0, import_react.useRef)(false), Gn2 = (0, import_react.useCallback)((e3, t3) => {
2853
+ }, [In2]);
2854
+ let Ln2 = Ae2 && !In2 || G2.isLoadingPage, Rn2 = Mn2 !== null, zn2 = U2 ? sn2 : Ln2 || sn2 || !i2 || xe2 && !H2 || gn2 || le2, Bn2 = U2 ? cn2 : cn2 ?? Mn2, Vn2 = U2 ? cn2 !== null : Rn2 || cn2 !== null, Hn2 = Oc(Cc.TIME_SLOTS), Un2 = (0, import_react.useRef)(false), K2 = (0, import_react.useCallback)((e3, t3) => {
2873
2855
  if (!t3.bookable) {
2874
- mn2.current = null;
2856
+ fn2.current = null;
2875
2857
  return;
2876
2858
  }
2877
- if (e3 === mn2.current) return;
2878
- mn2.current = e3;
2879
- let n3 = P2 ?? t3.serviceId ?? t3.nestedTimeSlots?.[0]?.serviceId ?? void 0, r2 = C2 ?? oe2.find((e4) => e4._id === n3)?.type ?? void 0;
2880
- !Wn2.current && !N2 && K2(Cc({ bookingsServiceId: n3, serviceType: r2, isEligibleForFlowCompletion: true })), Wn2.current = true, K2(Nc({ component: Oc.TIME_PICKER, element: kc.TIME_SLOT, properties: JSON.stringify({ selectedTime: t3.localStartDate }) }));
2881
- }, [K2, P2, C2, oe2, N2]), Kn2 = (0, import_react.useCallback)((e3) => {
2859
+ if (e3 === fn2.current) return;
2860
+ fn2.current = e3;
2861
+ let n3 = P2 ?? t3.serviceId ?? t3.nestedTimeSlots?.[0]?.serviceId ?? void 0, r2 = C2 ?? M2.find((e4) => e4._id === n3)?.type ?? void 0;
2862
+ !Un2.current && !N2 && Hn2(xc({ bookingsServiceId: n3, serviceType: r2, isEligibleForFlowCompletion: true })), Un2.current = true, Hn2(jc({ component: Ec.TIME_PICKER, element: Dc.TIME_SLOT, properties: JSON.stringify({ selectedTime: t3.localStartDate }) }));
2863
+ }, [Hn2, P2, C2, M2, N2]), Wn2 = (0, import_react.useCallback)((e3) => {
2882
2864
  if (e3 === null) {
2883
2865
  let e4 = Le2.current !== null;
2884
- Le2.current = null, mn2.current = null, ke2(null), e4 && ql(P2, T2, E2);
2866
+ Le2.current = null, fn2.current = null, ke2(null), e4 && Gl(P2, T2, E2);
2885
2867
  return;
2886
2868
  }
2887
- let t3 = xl(In2, e3);
2869
+ let t3 = bl(Pn2, e3);
2888
2870
  if (!t3) return;
2889
2871
  if (F2) {
2890
2872
  if (!ee2(t3.nestedTimeSlots ?? [], H2 ?? void 0)) return;
2891
- Le2.current = t3, ke2(t3), Gn2(e3, t3);
2873
+ Le2.current = t3, ke2(t3), K2(e3, t3);
2892
2874
  return;
2893
2875
  }
2894
- Le2.current = t3, ke2(t3), Gn2(e3, t3);
2895
- let n3 = Tl(t3);
2896
- if (w2(xs(t3), { staffId: I2 ? void 0 : wl(t3), timezone: H2 ?? void 0, bookable: t3.bookable, staffChoiceRequired: I2 && Ue2 && !L2 && n3.length > 1 && !Ht2(n3.length), rescheduleStaffId: I2 && (_2 !== `CUSTOMER_MAY_CHOOSE` || !Ht2(n3.length)) ? n3[0] : void 0 }), !I2) return;
2876
+ Le2.current = t3, ke2(t3), K2(e3, t3);
2877
+ let n3 = wl(t3);
2878
+ if (w2(ys(t3), { staffId: I2 ? void 0 : Cl(t3), timezone: H2 ?? void 0, bookable: t3.bookable, staffChoiceRequired: I2 && Ue2 && !L2 && n3.length > 1 && !Ht2(n3.length), rescheduleStaffId: I2 && (_2 !== `CUSTOMER_MAY_CHOOSE` || !Ht2(n3.length)) ? n3[0] : void 0 }), !I2) return;
2897
2879
  let r2 = ze2.current, i3;
2898
- i3 = R2 || (V2 && n3.includes(V2) ? { anyResource: false, staffMemberId: V2 } : kt2 !== null && Ht2(n3.length) ? { anyResource: true } : hl(n3, Ue2 && Ht2(n3.length))), Rl(i3, kt2) !== Rl(r2, Ve2) && At2(i3);
2899
- }, [F2, P2, T2, E2, ee2, w2, In2, Gn2, H2, I2, Ue2, _2, Ht2, R2, V2, kt2, Ve2, At2]), qn2 = (0, import_react.useCallback)(() => {
2880
+ i3 = R2 || (V2 && n3.includes(V2) ? { anyResource: false, staffMemberId: V2 } : kt2 !== null && Ht2(n3.length) ? { anyResource: true } : ml(n3, Ue2 && Ht2(n3.length))), Ll(i3, kt2) !== Ll(r2, Ve2) && At2(i3);
2881
+ }, [F2, P2, T2, E2, ee2, w2, Pn2, K2, H2, I2, Ue2, _2, Ht2, R2, V2, kt2, Ve2, At2]), Gn2 = (0, import_react.useCallback)(() => {
2900
2882
  let e3 = Le2.current;
2901
- if (!e3 || N2) return;
2883
+ if (!e3 || N2 || !e3.bookable) return;
2902
2884
  if (F2) {
2903
- O2(K2);
2885
+ te2(Hn2);
2904
2886
  return;
2905
2887
  }
2906
2888
  if (!P2) return;
2907
2889
  let t3;
2908
2890
  if (I2) {
2909
- let n4 = Tl(e3), r2 = gl(n4, Ut2(ze2.current), Ht2(n4.length));
2891
+ let n4 = wl(e3), r2 = hl(n4, Ut2(ze2.current), Ht2(n4.length));
2910
2892
  t3 = (r2.isComplete ? r2.resourceId : n4[0]) ?? (n4.length ? null : void 0);
2911
2893
  }
2912
2894
  let n3 = De2(`bookingForm`, { slug: x2?.mainSlug?.name ?? null, serviceId: P2 });
2913
- e3.bookable && K2(Ic({ serviceId: P2, serviceType: C2 ?? void 0, start: e3.localStartDate, end: e3.localEndDate, timeZone: H2 ?? void 0, isEligibleForFlowCompletion: !!n3 })), n3 && Ee2(re2(n3, { handoff: true, staffId: t3 }));
2914
- }, [K2, F2, O2, H2, P2, C2, x2, I2, Ut2, Ht2, Ee2, De2, re2, N2]), Jn2 = Oe2 ? Tl(Oe2) : null, Yn2 = Jn2 ? F2 || !I2 || gl(Jn2, Ut2(Re2), Ht2(Jn2.length)).isComplete : false, Xn2 = Jn2 ? Ht2(Jn2.length) : false, Zn2 = (0, import_react.useMemo)(() => !Oe2 || Ze2 ? [] : Cl(Oe2).map((e3) => ({ staffMemberId: e3.staffMemberId, name: e3.name || null, image: null, isSelected: e3.staffMemberId === Be2 })), [Oe2, Ze2, Be2]), Qn2 = (0, import_react.useMemo)(() => ({ ...Hl, isMultiService: F2, hasValidSchedulingInput: xe2, availabilityRequestKey: Se2, needsServiceChoice: Ce2, isRescheduling: N2, rescheduleValidUntil: on2, businessTimeZone: g2, canChangeTimeZone: Kt2, setTimeZone: qt2, locationFilterOptions: lt2, selectedLocationFilter: B2, setLocationFilter: Gt2, staffFilterOptions: _t2, selectedStaffFilter: V2, setStaffFilter: Wt2, requestedGender: kt2, genderSelectionAllowed: Ge2, currentTimeSlotsPage: U2 ? 1 : G2.currentPage, hasNextTimeSlotsPage: !U2 && G2.hasNextPage, hasPreviousTimeSlotsPage: !U2 && G2.hasPreviousPage, nextTimeSlotsPage: U2 ? Wl : G2.nextPage, loadUpcomingTimeSlots: Pe2, upcomingTimeSlotsRequested: Ae2, previousTimeSlotsPage: U2 ? Ul : G2.previousPage, timeSlots: In2.rows.map((e3) => Sl(e3, H2, Ln2, L2)), isLoading: Vn2, hasError: Un2, errorCode: Hn2, selectedDate: sn2, daysAvailabilityRange: Xt2, daysAvailability: an2, daysAvailabilityLoading: Qt2, daysAvailabilityHasError: $t2, timeSlotsLoading: Vn2, timeSlotsErrorCode: Hn2, selectDate: En2, setDaysAvailabilityRange: en2, nextDaysAvailabilityRange: tn2, previousDaysAvailabilityRange: nn2, goToNextAvailableDate: On2, nextAvailableSlotsCount: l2, timeZone: H2, staffFromSlots: Zn2, selectedResourceId: Be2, setSelectedResource: jt2, canAutoAssignStaff: Xn2, isComplete: Yn2, selectedTimeSlot: Oe2 ? Sl(Oe2, H2, Ln2, L2) : null, selectTimeSlot: Kn2, navigateToBookingForm: qn2, timeSlotLimitPerDay: f2, expandedDates: G2.expandedDates, daysWithMore: In2.daysWithMore, loadingDate: G2.loadingDate, loadAllTimeSlotsForDay: G2.loadAllSessionsForDay }), [F2, xe2, Se2, Ce2, N2, on2, g2, H2, Kt2, qt2, G2, Pe2, Ae2, lt2, B2, Gt2, _t2, V2, Wt2, kt2, Ge2, U2, Vn2, Hn2, Un2, In2, sn2, Xt2, an2, Qt2, $t2, En2, en2, tn2, nn2, On2, l2, Zn2, Be2, jt2, Xn2, Yn2, Oe2, Kn2, qn2, f2, Ln2, L2]);
2915
- return (0, import_jsx_runtime.jsx)(Gl.Provider, { value: Qn2, children: b2 });
2895
+ Hn2(Pc({ serviceId: P2, serviceType: C2 ?? void 0, start: e3.localStartDate, end: e3.localEndDate, timeZone: H2 ?? void 0, isEligibleForFlowCompletion: !!n3 })), n3 && Ee2(ie2(n3, { handoff: true, staffId: t3 }));
2896
+ }, [Hn2, F2, te2, H2, P2, C2, x2, I2, Ut2, Ht2, Ee2, De2, ie2, N2]), Kn2 = Oe2 ? wl(Oe2) : null, qn2 = Kn2 ? F2 || !I2 || hl(Kn2, Ut2(Re2), Ht2(Kn2.length)).isComplete : false, Jn2 = Kn2 ? Ht2(Kn2.length) : false, Yn2 = (0, import_react.useMemo)(() => !Oe2 || Ze2 ? [] : Sl(Oe2).map((e3) => ({ staffMemberId: e3.staffMemberId, name: e3.name || null, image: null, isSelected: e3.staffMemberId === Be2 })), [Oe2, Ze2, Be2]), Xn2 = (0, import_react.useMemo)(() => ({ isMultiService: F2, availabilityRequestKey: Se2, needsServiceChoice: Ce2, isRescheduling: N2, rescheduleValidUntil: rn2, businessTimeZone: g2, canChangeTimeZone: Kt2, setTimeZone: qt2, locationFilterOptions: lt2, selectedLocationFilter: B2, setLocationFilter: Gt2, staffFilterOptions: _t2, selectedStaffFilter: V2, setStaffFilter: Wt2, requestedGender: kt2, genderSelectionAllowed: Ge2, currentTimeSlotsPage: U2 ? 1 : G2.currentPage, hasNextTimeSlotsPage: !U2 && G2.hasNextPage, hasPreviousTimeSlotsPage: !U2 && G2.hasPreviousPage, nextTimeSlotsPage: U2 ? Hl : G2.nextPage, loadUpcomingTimeSlots: Pe2, upcomingTimeSlotsRequested: Ae2, previousTimeSlotsPage: U2 ? Vl : G2.previousPage, timeSlots: Pn2.rows.map((e3) => xl(e3, H2, Fn2, L2)), isLoading: zn2, hasError: Vn2, errorCode: Bn2, selectedDate: an2, daysAvailabilityRange: Xt2, daysAvailability: nn2, daysAvailabilityLoading: Qt2, daysAvailabilityHasError: $t2, selectDate: wn2, setDaysAvailabilityRange: en2, goToNextAvailableDate: En2, nextAvailableSlotsCount: l2, timeZone: H2, staffFromSlots: Yn2, selectedResourceId: Be2, setSelectedResource: jt2, canAutoAssignStaff: Jn2, isComplete: qn2, selectedTimeSlot: Oe2 ? xl(Oe2, H2, Fn2, L2) : null, selectTimeSlot: Wn2, navigateToBookingForm: Gn2, timeSlotLimitPerDay: f2, daysWithMore: Pn2.daysWithMore, loadingDate: G2.loadingDate, loadAllTimeSlotsForDay: G2.loadAllSessionsForDay }), [F2, Se2, Ce2, N2, rn2, g2, H2, Kt2, qt2, G2, Pe2, Ae2, lt2, B2, Gt2, _t2, V2, Wt2, kt2, Ge2, U2, zn2, Bn2, Vn2, Pn2, an2, Xt2, nn2, Qt2, $t2, wn2, en2, En2, l2, Yn2, Be2, jt2, Jn2, qn2, Oe2, Wn2, Gn2, f2, Fn2, L2]);
2897
+ return (0, import_jsx_runtime.jsx)(Ul.Provider, { value: Xn2, children: b2 });
2916
2898
  }
2917
- var eu = sn(`4936242d-905c-48bf-80ce-5f56d075de4f`);
2899
+ var Ql = sn(`4936242d-905c-48bf-80ce-5f56d075de4f`);
2918
2900
  // Annotate the CommonJS export names for ESM import in node:
2919
2901
  0 && (module.exports = {
2920
2902
  TimeSlotsContextProvider,