@wix/bookings 1.0.1791 → 1.0.1792

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 (31) hide show
  1. package/build/cjs/context-booking-checkout.js +1 -1
  2. package/build/cjs/context-booking-checkout.js.map +1 -1
  3. package/build/cjs/context-service-addons.js +123 -134
  4. package/build/cjs/context-service-addons.js.map +1 -1
  5. package/build/cjs/context-service.d.ts +16 -6
  6. package/build/cjs/context-service.js +728 -724
  7. package/build/cjs/context-service.js.map +1 -1
  8. package/build/cjs/context-services.js +801 -812
  9. package/build/cjs/context-services.js.map +1 -1
  10. package/build/cjs/context-time-slots.js +1300 -1267
  11. package/build/cjs/context-time-slots.js.map +1 -1
  12. package/build/es/context-booking-checkout.mjs +1 -1
  13. package/build/es/context-booking-checkout.mjs.map +1 -1
  14. package/build/es/context-service-addons.mjs +123 -134
  15. package/build/es/context-service-addons.mjs.map +1 -1
  16. package/build/es/context-service.d.mts +16 -6
  17. package/build/es/context-service.mjs +728 -724
  18. package/build/es/context-service.mjs.map +1 -1
  19. package/build/es/context-services.mjs +801 -812
  20. package/build/es/context-services.mjs.map +1 -1
  21. package/build/es/context-time-slots.mjs +1300 -1267
  22. package/build/es/context-time-slots.mjs.map +1 -1
  23. package/build/internal/cjs/context-service.d.ts +16 -6
  24. package/build/internal/es/context-service.d.mts +16 -6
  25. package/context-runtime/context-booking-checkout/runtime.js +2 -2
  26. package/context-runtime/context-service/runtime.d.ts +16 -6
  27. package/context-runtime/context-service/runtime.js +2 -2
  28. package/context-runtime/context-service-addons/runtime.js +2 -2
  29. package/context-runtime/context-services/runtime.js +3 -3
  30. package/context-runtime/context-time-slots/runtime.js +3 -3
  31. package/package.json +2 -2
@@ -20,13 +20,13 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // context-service.ts
21
21
  var context_service_exports = {};
22
22
  __export(context_service_exports, {
23
- SERVICE_CONTEXT_MISSING_PROVIDER_ERROR: () => DS,
24
- ServiceContextProvider: () => rC,
25
- default: () => rC,
26
- injectAccessTokenGetter: () => aC,
27
- resolveServiceTarget: () => kS,
28
- serviceContext: () => ES,
29
- useServiceContext: () => OS
23
+ SERVICE_CONTEXT_MISSING_PROVIDER_ERROR: () => AS,
24
+ ServiceContextProvider: () => aC,
25
+ default: () => aC,
26
+ injectAccessTokenGetter: () => sC,
27
+ resolveServiceTarget: () => MS,
28
+ serviceContext: () => kS,
29
+ useServiceContext: () => jS
30
30
  });
31
31
  module.exports = __toCommonJS(context_service_exports);
32
32
 
@@ -5311,253 +5311,25 @@ function pv({ servicePromise: e5, page: t2 }) {
5311
5311
  return a2(lv(r2, o2)), true;
5312
5312
  }), null;
5313
5313
  }
5314
- function mv(e5) {
5315
- return e5?.details?.applicationError?.code;
5316
- }
5317
- var hv = (e5) => {
5318
- let t2 = (e6) => e6 < 10 ? `0${e6}` : `${e6}`;
5319
- return `${e5.getFullYear()}-${t2(e5.getMonth() + 1)}-${t2(e5.getDate())}`;
5320
- };
5321
- var gv = (e5, t2) => new Intl.DateTimeFormat(`en-CA`, { year: `numeric`, month: `2-digit`, day: `2-digit`, ...t2 ? { timeZone: t2 } : {} }).format(e5);
5322
- var _v = (e5) => `${hv(e5)}T00:00:00`;
5323
- var vv = false;
5324
- function yv() {
5325
- return vv;
5326
- }
5327
- var bv = ms(`@wix/site-service-business-logger`);
5328
- function xv(e5) {
5329
- return { evid: 1190, src: 16, endpoint: ``, params: e5 };
5330
- }
5331
- function Sv(e5) {
5332
- return { evid: 32, src: 16, endpoint: ``, params: e5 };
5333
- }
5334
- function Cv(e5) {
5335
- return { evid: 33, src: 16, endpoint: ``, params: e5 };
5336
- }
5337
- function wv(e5) {
5338
- return { evid: 34, src: 16, endpoint: ``, params: e5 };
5339
- }
5340
- function Tv(e5) {
5341
- return { evid: 87, src: 16, endpoint: ``, params: e5 };
5342
- }
5343
- var Ev = { 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` };
5344
- Bs.BOOK_ONLINE;
5345
- var Dv = `new_bookings_server`;
5346
- var Ov = { WIDGET_BUTTON: `widget_button`, WIDGET_MORE_INFO_LABEL: `widget_more_info_label`, EXPLORE_PLANS: `explore_plans` };
5347
- var kv = { servicePage: `service_page`, bookingCalendar: `calendar_page`, bookingForm: `form` };
5348
- var Av = { servicePage: `navigate_to_service_page`, bookingCalendar: `navigate_to_calendar`, bookingForm: `navigate_to_booking_form` };
5349
- var jv = `click`;
5350
- var Mv = { TIMEZONE_PICKER: `timezone_picker`, TIME_PICKER: `time_picker`, BOOKING_DETAILS: `booking_details`, RESCHEDULE_DIALOG: `reschedule_dialog`, JOIN_WAITLIST_DIALOG: `join_waitlist_dialog` };
5351
- var Nv = { CONFIRM_BUTTON: `confirm_button`, GO_TO_HOMEPAGE_BUTTON: `go_to_homepage_button` };
5352
- var Pv = `reschedule success`;
5353
- var Fv = (e5) => {
5354
- let { reportBi: t2 } = (0, import_services_manager_react.useService)(bv);
5355
- return (0, import_react.useCallback)((n2) => {
5356
- t2({ widget_name: e5, bookingsPlatform: Dv, is_over_editor: false, ...n2.params, src: n2.src, evid: n2.evid }, { endpoint: n2.endpoint });
5357
- }, [t2, e5]);
5358
- };
5359
- var Iv = (e5, t2 = true) => {
5360
- let n2 = Fv(e5), { getParsedUrl: r2 } = ps(), i2 = (0, import_react.useRef)(false);
5361
- (0, import_react.useEffect)(() => {
5362
- t2 && !i2.current && (i2.current = true, n2(Sv({ referralInfo: r2().searchParams.get(i_.referral) ?? void 0 })));
5363
- }, [t2, n2, r2]);
5364
- };
5365
- function Lv(e5) {
5366
- return { evid: 501, src: 16, endpoint: `wixboost-ugc`, params: e5 };
5367
- }
5368
- function Rv(e5) {
5369
- return { evid: 551, src: 16, endpoint: `wixboost-ugc`, params: e5 };
5370
- }
5371
- function zv(e5) {
5372
- return { evid: 596, src: 16, endpoint: `wixboost-ugc`, params: e5 };
5373
- }
5374
- function Bv(e5, t2) {
5375
- 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(e5)), r2 = {};
5376
- for (let e6 of n2) e6.type !== `literal` && (r2[e6.type] = Number(e6.value));
5377
- return Date.UTC(r2.year, r2.month - 1, r2.day, r2.hour, r2.minute, r2.second) - e5;
5378
- }
5379
- function Vv(e5, t2) {
5380
- let n2 = e5.match(/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2}))?/);
5381
- if (!n2) return null;
5382
- 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);
5383
- if (Number.isNaN(l2)) return null;
5384
- try {
5385
- let e6 = l2 - Bv(l2, t2);
5386
- return new Date(l2 - Bv(e6, t2));
5387
- } catch {
5388
- return null;
5389
- }
5390
- }
5391
- function Hv({ start: e5, end: t2, timeZone: n2, ...r2 }) {
5392
- let i2 = (e6) => e6 && n2 ? Vv(e6, n2)?.getTime() : void 0;
5393
- return wv({ bookingsServiceId: r2.serviceId, serviceType: r2.serviceType, startTime: i2(e5), endTime: i2(t2), isEligibleForFlowCompletion: r2.isEligibleForFlowCompletion });
5394
- }
5395
- var Uv = ns(`@wix/site-service-site-info`);
5396
- function Wv() {
5397
- let e5 = gs();
5398
- if (!e5) return ``;
5399
- try {
5400
- return e5(Uv).siteId;
5401
- } catch {
5402
- return ``;
5403
- }
5404
- }
5405
- function Gv(e5) {
5406
- return hi(Object.assign(e5, { domainToMappings: { "api._api_base_domain_": [{ srcPath: `/events-3`, destPath: `` }], "manage._base_domain_": [{ srcPath: `/_api/calendar/v3/events`, destPath: `/v3/events` }, { srcPath: `/_api/calendar/v3/bulk/events`, destPath: `/v3/bulk/events` }, { srcPath: `/_api/calendar/v3/ro/events`, destPath: `/v3/events` }], "www.wixapis.com": [{ srcPath: `/calendar/v3/events`, destPath: `/v3/events` }, { srcPath: `/calendar/v3/bulk/events`, destPath: `/v3/bulk/events` }], _: [{ srcPath: `/_api/calendar/v3/events`, destPath: `/v3/events` }, { srcPath: `/_api/calendar/v3/bulk/events`, destPath: `/v3/bulk/events` }], "*.dev.wix-code.com": [{ srcPath: `/_api/calendar/v3/events`, destPath: `/v3/events` }, { srcPath: `/_api/calendar/v3/bulk/events`, destPath: `/v3/bulk/events` }], "editor._base_domain_": [{ srcPath: `/_api/calendar/v3/events`, destPath: `/v3/events` }, { srcPath: `/_api/calendar/v3/bulk/events`, destPath: `/v3/bulk/events` }], "blocks._base_domain_": [{ srcPath: `/_api/calendar/v3/events`, destPath: `/v3/events` }, { srcPath: `/_api/calendar/v3/bulk/events`, destPath: `/v3/bulk/events` }], "create.editorx": [{ srcPath: `/_api/calendar/v3/events`, destPath: `/v3/events` }, { srcPath: `/_api/calendar/v3/bulk/events`, destPath: `/v3/bulk/events` }] } }));
5407
- }
5408
- var Kv = `@wix/auto_sdk_calendar_events`;
5409
- function qv(e5) {
5410
- function t2({ host: t3 }) {
5411
- return { entityFqdn: `wix.calendar.v3.event`, method: `POST`, methodFqn: `wix.calendar.events.v3.EventsService.QueryEvents`, packageName: Kv, migrationOptions: { optInTransformResponse: true }, url: Gv({ protoPath: `/v3/events/query`, data: e5, host: t3 }), data: e5, transformResponse: (e6) => H(e6, [{ transformFn: V, paths: [{ path: `events.createdDate` }, { path: `events.updatedDate` }, { path: `events.start.utcDate` }, { path: `events.end.utcDate` }, { path: `events.adjustedStart.utcDate` }, { path: `events.adjustedEnd.utcDate` }, { path: `events.recurrenceRule.until.utcDate` }, { path: `events.recurrenceRule.adjustedUntil.utcDate` }] }]) };
5412
- }
5413
- return t2;
5414
- }
5415
- function Jv(e5) {
5416
- let { httpClient: t2, sideEffects: n2 } = arguments[1];
5417
- return sl({ func: async (r2) => {
5418
- let i2 = qv({ ...r2, ...e5 ?? {} });
5419
- n2?.onSiteCall?.();
5420
- try {
5421
- let e6 = await t2.request(i2);
5422
- return n2?.onSuccess?.(e6), e6;
5423
- } catch (e6) {
5424
- throw n2?.onError?.(e6), e6;
5425
- }
5426
- }, requestTransformer: (t3) => {
5427
- let n3 = [t3, e5];
5428
- return z({ ...n3?.[1], query: n3?.[0] });
5429
- }, responseTransformer: ({ data: e6 }) => {
5430
- let t3 = B(H(e6, []));
5431
- return { items: t3?.events, pagingMetadata: t3?.pagingMetadata };
5432
- }, errorTransformer: (e6) => {
5433
- throw U(e6, { spreadPathsToArguments: {}, explicitPathsToArguments: { query: `$[0]` }, singleArgumentUnchanged: false });
5434
- }, pagingMethod: `CURSOR`, transformationPaths: {} });
5435
- }
5436
- async function Yv(e5, t2) {
5437
- let { httpClient: n2, sideEffects: r2 } = arguments[2], i2 = qv(z({ query: e5, ...t2 }));
5438
- r2?.onSiteCall?.();
5439
- try {
5440
- let e6 = await n2.request(i2);
5441
- return r2?.onSuccess?.(e6), B(e6.data);
5442
- } catch (e6) {
5443
- let t3 = U(e6, { spreadPathsToArguments: {}, explicitPathsToArguments: { query: `$[0]` }, singleArgumentUnchanged: false }, [`query`, `options`]);
5444
- throw r2?.onError?.(e6), t3;
5445
- }
5446
- }
5447
- ({ ...ml() });
5448
- function Xv(e5) {
5449
- return (t2) => Jv(t2, { httpClient: e5 });
5450
- }
5451
- function Zv(e5) {
5452
- return (t2, n2) => Yv(t2, n2, { httpClient: e5 });
5453
- }
5454
- var Qv = b(`wix.calendar.v3.event_cancelled`, true, (e5) => B(H(e5, [{ transformFn: V, paths: [{ path: `data.event.createdDate` }, { path: `data.event.updatedDate` }, { path: `data.event.start.utcDate` }, { path: `data.event.end.utcDate` }, { path: `data.event.adjustedStart.utcDate` }, { path: `data.event.adjustedEnd.utcDate` }, { path: `data.event.recurrenceRule.until.utcDate` }, { path: `data.event.recurrenceRule.adjustedUntil.utcDate` }, { path: `metadata.eventTime` }] }])))();
5455
- var $v = b(`wix.calendar.v3.event_created`, true, (e5) => B(H(e5, [{ transformFn: V, paths: [{ path: `entity.createdDate` }, { path: `entity.updatedDate` }, { path: `entity.start.utcDate` }, { path: `entity.end.utcDate` }, { path: `entity.adjustedStart.utcDate` }, { path: `entity.adjustedEnd.utcDate` }, { path: `entity.recurrenceRule.until.utcDate` }, { path: `entity.recurrenceRule.adjustedUntil.utcDate` }, { path: `metadata.eventTime` }] }])))();
5456
- var ey = b(`wix.calendar.v3.event_recurring_split`, true, (e5) => B(H(e5, [{ transformFn: V, paths: [{ path: `data.updatedRecurringEventEndingBeforeSplit.createdDate` }, { path: `data.updatedRecurringEventEndingBeforeSplit.updatedDate` }, { path: `data.updatedRecurringEventEndingBeforeSplit.start.utcDate` }, { path: `data.updatedRecurringEventEndingBeforeSplit.end.utcDate` }, { path: `data.updatedRecurringEventEndingBeforeSplit.adjustedStart.utcDate` }, { path: `data.updatedRecurringEventEndingBeforeSplit.adjustedEnd.utcDate` }, { path: `data.updatedRecurringEventEndingBeforeSplit.recurrenceRule.until.utcDate` }, { path: `data.updatedRecurringEventEndingBeforeSplit.recurrenceRule.adjustedUntil.utcDate` }, { path: `data.newRecurringEventStartingFromSplit.createdDate` }, { path: `data.newRecurringEventStartingFromSplit.updatedDate` }, { path: `data.newRecurringEventStartingFromSplit.start.utcDate` }, { path: `data.newRecurringEventStartingFromSplit.end.utcDate` }, { path: `data.newRecurringEventStartingFromSplit.adjustedStart.utcDate` }, { path: `data.newRecurringEventStartingFromSplit.adjustedEnd.utcDate` }, { path: `data.newRecurringEventStartingFromSplit.recurrenceRule.until.utcDate` }, { path: `data.newRecurringEventStartingFromSplit.recurrenceRule.adjustedUntil.utcDate` }, { path: `metadata.eventTime` }] }])))();
5457
- var ty = b(`wix.calendar.v3.event_updated`, true, (e5) => B(H(e5, [{ transformFn: V, paths: [{ path: `entity.createdDate` }, { path: `entity.updatedDate` }, { path: `entity.start.utcDate` }, { path: `entity.end.utcDate` }, { path: `entity.adjustedStart.utcDate` }, { path: `entity.adjustedEnd.utcDate` }, { path: `entity.recurrenceRule.until.utcDate` }, { path: `entity.recurrenceRule.adjustedUntil.utcDate` }, { path: `metadata.eventTime` }, { path: `modifiedFields.createdDate` }, { path: `modifiedFields.updatedDate` }, { path: `modifiedFields.start.utcDate` }, { path: `modifiedFields.end.utcDate` }, { path: `modifiedFields.adjustedStart.utcDate` }, { path: `modifiedFields.adjustedEnd.utcDate` }, { path: `modifiedFields.recurrenceRule.until.utcDate` }, { path: `modifiedFields.recurrenceRule.adjustedUntil.utcDate` }] }])))();
5458
- function ny(e5) {
5459
- let t2 = wl({ builderQueryFunction: (t3) => Xv(e5)(t3), typedQueryFunction: (t3, n3) => Zv(e5)(t3, n3), hasOptionsParameter: true });
5460
- function n2(e6, n3) {
5461
- return t2(...arguments);
5462
- }
5463
- return n2;
5464
- }
5465
- var ry = W(ny);
5466
- Vi(Qv), Vi($v), Vi(ey), Vi(ty);
5467
- var iy = 1e3;
5468
- async function ay(e5, t2) {
5469
- let n2 = [], r2;
5470
- do {
5471
- let i2 = await ry({ filter: e5, cursorPaging: { limit: iy, ...r2 ? { cursor: r2 } : {} } }, t2);
5472
- n2.push(...i2.events ?? []), r2 = i2.pagingMetadata?.hasNext ? i2.pagingMetadata.cursors?.next ?? void 0 : void 0;
5473
- } while (r2);
5474
- return n2;
5475
- }
5476
- async function oy(e5, t2) {
5477
- return e5.length === 0 ? [] : ay({ appId: Is, scheduleId: { $in: e5 } }, { recurrenceType: [`MASTER`, `NONE`], fromLocalDate: _v(/* @__PURE__ */ new Date()), ...t2 ? { timeZone: t2 } : {} });
5478
- }
5479
- var sy = `SERVICE_OPTIONS_AND_VARIANTS_NOT_FOUND`;
5480
- async function cy(e5) {
5481
- try {
5482
- let { serviceVariants: t2 } = await zl(e5);
5483
- return t2 ?? null;
5484
- } catch (e6) {
5485
- if (mv(e6) === sy) return null;
5486
- throw e6;
5487
- }
5488
- }
5489
- var ly = 100;
5490
- async function uy(e5) {
5491
- if (e5.length === 0) return {};
5492
- let t2 = [];
5493
- for (let n3 = 0; n3 < e5.length; n3 += ly) t2.push(e5.slice(n3, n3 + ly));
5494
- let n2 = await Promise.all(t2.map((e6) => Bl().in(`serviceId`, e6).limit(ly).find())), r2 = {};
5495
- for (let e6 of n2.flatMap((e7) => e7.items ?? [])) e6.serviceId && (r2[e6.serviceId] = e6);
5496
- return r2;
5497
- }
5498
- function dy(e5, t2) {
5499
- let n2 = e5?.value, r2 = e5?.currency;
5500
- if (n2 == null || !r2) return null;
5501
- let i2 = Number(n2);
5502
- if (!Number.isFinite(i2)) return null;
5503
- let a2 = i2 % 1 == 0 ? 0 : 2;
5504
- return new Intl.NumberFormat(t2, { style: `currency`, currency: r2, currencyDisplay: `symbol`, maximumFractionDigits: a2, minimumFractionDigits: a2 }).format(i2).replace(/\p{Zs}/gu, `\xA0`);
5505
- }
5506
- function fy(e5, t2) {
5507
- if (e5 == null || !Number.isFinite(e5) || e5 <= 0) return null;
5508
- let n2 = new Intl.NumberFormat(t2, { style: `unit`, unit: `hour`, unitDisplay: `short` }), r2 = new Intl.NumberFormat(t2, { style: `unit`, unit: `minute`, unitDisplay: `short` });
5509
- if (e5 < 60) return r2.format(e5);
5510
- let i2 = Math.floor(e5 / 60), a2 = e5 % 60;
5511
- return a2 === 0 ? n2.format(i2) : `${n2.format(i2)} ${r2.format(a2)}`;
5512
- }
5513
- function py(e5) {
5514
- return e5.staffMemberId ? e5.staffMemberId : e5._id ? e5._id : e5.custom == null ? null : e5.custom;
5515
- }
5516
- function my(e5, t2, n2, r2) {
5517
- return e5.custom == null ? e5.staffMemberId ? n2[e5.staffMemberId] ?? null : e5.businessLocationId ? r2[e5.businessLocationId] ?? null : e5.duration ? e5.duration.name ?? fy(e5.duration.minutes, t2) : null : e5.custom;
5518
- }
5519
- function hy(e5) {
5520
- let t2 = {};
5521
- for (let n2 of e5) n2.staffMemberId && (t2[n2.staffMemberId] = n2.name ?? ``);
5522
- return t2;
5523
- }
5524
- function gy(e5) {
5525
- let t2 = {};
5526
- for (let n2 of e5) n2.id && (t2[n2.id] = n2.label);
5527
- return t2;
5528
- }
5529
- function _y(e5) {
5530
- return e5?.options?.values?.[0]?.type === jl.STAFF_MEMBER;
5531
- }
5532
- function vy(e5, { locale: t2, staffMembers: n2 = [], businessLocations: r2 = [] }) {
5533
- let i2 = e5?.options?.values?.[0];
5534
- if (!i2) return null;
5535
- let a2 = hy(n2), o2 = gy(r2), s2 = (e5?.variants?.values ?? []).map((e6) => {
5536
- let n3 = e6.choices?.[0];
5537
- return { choiceId: n3 ? py(n3) : null, label: n3 ? my(n3, t2, a2, o2) : null, price: dy(e6.price, t2), priceAmount: e6.price?.value ?? null, durationMinutes: n3?.duration?.minutes ?? null, durationName: n3?.duration?.name ?? null, businessLocationId: n3?.businessLocationId ?? null };
5538
- });
5539
- return { optionId: i2._id ?? null, type: i2.type ?? null, name: i2.customData?.name || i2.durationData?.name || null, choices: s2 };
5540
- }
5541
- function yy(e5) {
5542
- return e5.staffMemberDetails?.staffMembers ?? [];
5543
- }
5544
- function by(e5, t2) {
5545
- let n2 = e5.workingHoursLocationCoverage;
5546
- return { staffMemberId: e5.staffMemberId ?? ``, name: e5.name ?? null, image: null, isSelected: t2 === e5.staffMemberId, ...n2 ? { locationCoverage: { availableAtAllLocations: n2.availableAtAllLocations ?? false, locationIds: n2.locationIds ?? [] } } : {} };
5314
+ function mv() {
5315
+ let [e5, t2] = (0, import_react.useState)(void 0);
5316
+ return (0, import_react.useEffect)(() => {
5317
+ (0, import_react.startTransition)(() => t2(Date.now()));
5318
+ }, []), e5;
5547
5319
  }
5548
- function xy(e5) {
5320
+ function hv(e5) {
5549
5321
  return e5 == null;
5550
5322
  }
5551
- var Sy = `Wix code SDK error:`;
5552
- var Cy = (e5) => {
5553
- console.error(`${Sy} ${e5}`);
5323
+ var gv = `Wix code SDK error:`;
5324
+ var _v = (e5) => {
5325
+ console.error(`${gv} ${e5}`);
5554
5326
  };
5555
5327
  var Q = { IMAGE: `image`, DOCUMENT: `document`, VIDEO: `video`, AUDIO: `audio`, VECTOR: `vector` };
5556
5328
  var $ = { empty_media_id: `empty_media_id`, empty_poster_id: `empty_poster_id`, bad_media_id: `bad_media_id`, unknown_media_type: `unknown_media_type`, missing_width_height: `missing_width_height`, non_string_media_id: `non_string_media_id` };
5557
- var wy = { vector: (e5, t2) => `wix:vector://v1/${e5}/${t2}`, image: (e5, t2, n2, r2, i2) => `wix:image://v1/${e5}/${t2}#originWidth=${n2}&originHeight=${r2}${i2 ? `&watermark=${i2}` : ``}`, document: (e5, t2) => `wix:document://v1/${e5}/${t2}`, video: (e5, t2, n2, r2 = 0, i2 = 0) => `wix:video://v1/${e5}/${n2}#posterUri=${t2}&posterWidth=${r2}&posterHeight=${i2}`, audio: (e5, t2, n2) => `wix:audio://v1/${e5}/${t2}#duration=${n2}` };
5558
- var Ty = { vector: /^wix:vector:\/\/v1\/([^\/]+)\/([^\/]*)$/, image: /^wix:image:\/\/v1\/([^\/]+)\/([^\/]*)#originWidth=([0-9]+)&originHeight=([0-9]+)(?:&watermark=([^\/]+))?$/, document: /^wix:document:\/\/v1\/([^\/]+)\/([^\/]+)$/, video: /^wix:video:\/\/v1\/([^\/]+)\/([^\/]+)#posterUri=([^\/]+)&posterWidth=([0-9]+)&posterHeight=([0-9]+)$/, audio: /^wix:audio:\/\/v1\/([^\/]+)\/([^\/]+)#duration=([0-9]+)$/, deprecated_video: /^wix:video:\/\/v1\/([^\/]+)\/([^\/]+)\/#posterUri=([^\/]+)&posterWidth=([0-9]+)&posterHeight=([0-9]+)$/, deprecated_image: /^image:\/\/v1\/([^\/]+)\/([0-9]+)_([0-9]+)\/([^\/]*)$/, deprecated_type: /^(image):/, type: /^wix:(\w+):/, splitExtension: /\.(?=[^.]+$)/, emptyTitle: /^_\./ };
5559
- function Ey(e5, t2 = ``, n2) {
5560
- let [r2, i2] = n2.split(Ty.splitExtension), [a2, o2] = t2.split(Ty.splitExtension), s2;
5329
+ var vv = { vector: (e5, t2) => `wix:vector://v1/${e5}/${t2}`, image: (e5, t2, n2, r2, i2) => `wix:image://v1/${e5}/${t2}#originWidth=${n2}&originHeight=${r2}${i2 ? `&watermark=${i2}` : ``}`, document: (e5, t2) => `wix:document://v1/${e5}/${t2}`, video: (e5, t2, n2, r2 = 0, i2 = 0) => `wix:video://v1/${e5}/${n2}#posterUri=${t2}&posterWidth=${r2}&posterHeight=${i2}`, audio: (e5, t2, n2) => `wix:audio://v1/${e5}/${t2}#duration=${n2}` };
5330
+ var yv = { vector: /^wix:vector:\/\/v1\/([^\/]+)\/([^\/]*)$/, image: /^wix:image:\/\/v1\/([^\/]+)\/([^\/]*)#originWidth=([0-9]+)&originHeight=([0-9]+)(?:&watermark=([^\/]+))?$/, document: /^wix:document:\/\/v1\/([^\/]+)\/([^\/]+)$/, video: /^wix:video:\/\/v1\/([^\/]+)\/([^\/]+)#posterUri=([^\/]+)&posterWidth=([0-9]+)&posterHeight=([0-9]+)$/, audio: /^wix:audio:\/\/v1\/([^\/]+)\/([^\/]+)#duration=([0-9]+)$/, deprecated_video: /^wix:video:\/\/v1\/([^\/]+)\/([^\/]+)\/#posterUri=([^\/]+)&posterWidth=([0-9]+)&posterHeight=([0-9]+)$/, deprecated_image: /^image:\/\/v1\/([^\/]+)\/([0-9]+)_([0-9]+)\/([^\/]*)$/, deprecated_type: /^(image):/, type: /^wix:(\w+):/, splitExtension: /\.(?=[^.]+$)/, emptyTitle: /^_\./ };
5331
+ function bv(e5, t2 = ``, n2) {
5332
+ let [r2, i2] = n2.split(yv.splitExtension), [a2, o2] = t2.split(yv.splitExtension), s2;
5561
5333
  switch (e5) {
5562
5334
  case Q.IMAGE:
5563
5335
  s2 = `${a2 || `_`}.${o2 || i2}`;
@@ -5579,109 +5351,109 @@ function Ey(e5, t2 = ``, n2) {
5579
5351
  }
5580
5352
  return encodeURI(s2);
5581
5353
  }
5582
- function Dy(e5) {
5583
- return Ty.emptyTitle.test(e5) ? `` : decodeURI(e5);
5354
+ function xv(e5) {
5355
+ return yv.emptyTitle.test(e5) ? `` : decodeURI(e5);
5584
5356
  }
5585
- function Oy({ mediaId: e5, title: t2, width: n2, height: r2, watermark: i2 }) {
5357
+ function Sv({ mediaId: e5, title: t2, width: n2, height: r2, watermark: i2 }) {
5586
5358
  if (!e5) return { error: $.empty_media_id };
5587
5359
  if (typeof r2 != `number` || typeof n2 != `number`) return { error: $.missing_width_height };
5588
- let a2 = Ey(Q.IMAGE, t2, e5);
5589
- return { item: wy.image(e5, a2, n2, r2, i2) };
5360
+ let a2 = bv(Q.IMAGE, t2, e5);
5361
+ return { item: vv.image(e5, a2, n2, r2, i2) };
5590
5362
  }
5591
- function ky({ mediaId: e5, title: t2 }) {
5363
+ function Cv({ mediaId: e5, title: t2 }) {
5592
5364
  if (!e5) return { error: $.empty_media_id };
5593
- let n2 = Ey(Q.DOCUMENT, t2, e5);
5594
- return { item: wy.document(e5, n2) };
5365
+ let n2 = bv(Q.DOCUMENT, t2, e5);
5366
+ return { item: vv.document(e5, n2) };
5595
5367
  }
5596
- function Ay({ mediaId: e5, title: t2 }) {
5368
+ function wv({ mediaId: e5, title: t2 }) {
5597
5369
  if (!e5) return { error: $.empty_media_id };
5598
- let n2 = Ey(Q.VECTOR, t2, e5);
5599
- return { item: wy.vector(e5, n2) };
5370
+ let n2 = bv(Q.VECTOR, t2, e5);
5371
+ return { item: vv.vector(e5, n2) };
5600
5372
  }
5601
- function jy({ mediaId: e5, title: t2, width: n2, height: r2, posterId: i2 }) {
5373
+ function Tv({ mediaId: e5, title: t2, width: n2, height: r2, posterId: i2 }) {
5602
5374
  if (!e5) return { error: $.empty_media_id };
5603
5375
  if (!i2) return { error: $.empty_poster_id };
5604
5376
  if (isNaN(r2 || NaN) || isNaN(n2 || NaN)) return { error: $.missing_width_height };
5605
- let a2 = e5.replace(`video/`, ``), o2 = Ey(Q.VIDEO, t2, a2);
5606
- return { item: wy.video(a2, i2, o2, n2, r2) };
5377
+ let a2 = e5.replace(`video/`, ``), o2 = bv(Q.VIDEO, t2, a2);
5378
+ return { item: vv.video(a2, i2, o2, n2, r2) };
5607
5379
  }
5608
- function My({ mediaId: e5, title: t2, duration: n2 }) {
5380
+ function Ev({ mediaId: e5, title: t2, duration: n2 }) {
5609
5381
  if (!e5) return { error: $.empty_media_id };
5610
- let r2 = Ey(Q.AUDIO, t2, e5);
5611
- return { item: wy.audio(e5, r2, n2 || 0) };
5382
+ let r2 = bv(Q.AUDIO, t2, e5);
5383
+ return { item: vv.audio(e5, r2, n2 || 0) };
5612
5384
  }
5613
- function Ny(e5) {
5614
- let [, t2, n2, r2, i2, a2] = e5.match(Ty.image) || [], o2 = Dy(n2);
5385
+ function Dv(e5) {
5386
+ let [, t2, n2, r2, i2, a2] = e5.match(yv.image) || [], o2 = xv(n2);
5615
5387
  return t2 ? { type: Q.IMAGE, mediaId: t2, title: o2, width: parseInt(r2, 10), height: parseInt(i2, 10), watermark: a2 } : { error: $.bad_media_id };
5616
5388
  }
5617
- function Py(e5) {
5618
- let [, t2, n2, r2, i2] = e5.match(Ty.deprecated_image) || [], a2 = Dy(i2);
5389
+ function Ov(e5) {
5390
+ let [, t2, n2, r2, i2] = e5.match(yv.deprecated_image) || [], a2 = xv(i2);
5619
5391
  return t2 ? { type: Q.IMAGE, mediaId: t2, title: a2, width: parseInt(n2, 10), height: parseInt(r2, 10) } : { error: $.bad_media_id };
5620
5392
  }
5621
- function Fy(e5) {
5622
- let [, t2, n2] = e5.match(Ty.document) || [], r2 = Dy(n2);
5393
+ function kv(e5) {
5394
+ let [, t2, n2] = e5.match(yv.document) || [], r2 = xv(n2);
5623
5395
  return t2 ? { type: Q.DOCUMENT, mediaId: t2, title: r2 } : { error: $.bad_media_id };
5624
5396
  }
5625
- function Iy(e5) {
5626
- let [, t2, n2] = e5.match(Ty.vector) || [], r2 = Dy(n2);
5397
+ function Av(e5) {
5398
+ let [, t2, n2] = e5.match(yv.vector) || [], r2 = xv(n2);
5627
5399
  return t2 ? { type: Q.VECTOR, mediaId: t2, title: r2 } : { error: $.bad_media_id };
5628
5400
  }
5629
- function Ly(e5) {
5630
- let t2 = Ty.deprecated_video.test(e5) ? Ty.deprecated_video : Ty.video, [, n2, r2, i2, a2, o2] = e5.match(t2) || [], s2 = Dy(r2);
5401
+ function jv(e5) {
5402
+ let t2 = yv.deprecated_video.test(e5) ? yv.deprecated_video : yv.video, [, n2, r2, i2, a2, o2] = e5.match(t2) || [], s2 = xv(r2);
5631
5403
  return n2 && i2 ? { type: Q.VIDEO, mediaId: n2, posterId: i2, width: parseInt(a2, 10), height: parseInt(o2, 10), title: s2 } : { error: $.bad_media_id };
5632
5404
  }
5633
- function Ry(e5) {
5634
- let [, t2, n2, r2] = e5.match(Ty.audio) || [], i2 = Dy(n2);
5405
+ function Mv(e5) {
5406
+ let [, t2, n2, r2] = e5.match(yv.audio) || [], i2 = xv(n2);
5635
5407
  return t2 ? { type: Q.AUDIO, mediaId: t2, title: i2, duration: parseInt(r2, 10) } : { error: $.bad_media_id };
5636
5408
  }
5637
- function zy({ mediaId: e5, type: t2, title: n2, width: r2, height: i2, posterId: a2, watermark: o2, duration: s2 }) {
5409
+ function Nv({ mediaId: e5, type: t2, title: n2, width: r2, height: i2, posterId: a2, watermark: o2, duration: s2 }) {
5638
5410
  switch (t2) {
5639
5411
  case Q.IMAGE:
5640
- return Oy({ mediaId: e5, title: n2, width: r2, height: i2, watermark: o2 });
5412
+ return Sv({ mediaId: e5, title: n2, width: r2, height: i2, watermark: o2 });
5641
5413
  case Q.DOCUMENT:
5642
- return ky({ mediaId: e5, title: n2 });
5414
+ return Cv({ mediaId: e5, title: n2 });
5643
5415
  case Q.VECTOR:
5644
- return Ay({ mediaId: e5, title: n2 });
5416
+ return wv({ mediaId: e5, title: n2 });
5645
5417
  case Q.VIDEO:
5646
- return jy({ mediaId: e5, title: n2, width: r2, height: i2, posterId: a2 });
5418
+ return Tv({ mediaId: e5, title: n2, width: r2, height: i2, posterId: a2 });
5647
5419
  case Q.AUDIO:
5648
- return My({ mediaId: e5, title: n2, duration: s2 });
5420
+ return Ev({ mediaId: e5, title: n2, duration: s2 });
5649
5421
  default:
5650
5422
  return { error: $.unknown_media_type };
5651
5423
  }
5652
5424
  }
5653
- function By(e5 = ``) {
5425
+ function Pv(e5 = ``) {
5654
5426
  if (typeof e5 != `string`) return { error: $.non_string_media_id };
5655
- let [, t2] = e5.match(Ty.type) || [];
5427
+ let [, t2] = e5.match(yv.type) || [];
5656
5428
  switch (t2) {
5657
5429
  case Q.IMAGE:
5658
- return Ny(e5);
5430
+ return Dv(e5);
5659
5431
  case Q.DOCUMENT:
5660
- return Fy(e5);
5432
+ return kv(e5);
5661
5433
  case Q.VECTOR:
5662
- return Iy(e5);
5434
+ return Av(e5);
5663
5435
  case Q.VIDEO:
5664
- return Ly(e5);
5436
+ return jv(e5);
5665
5437
  case Q.AUDIO:
5666
- return Ry(e5);
5438
+ return Mv(e5);
5667
5439
  default:
5668
- let [, t3] = e5.match(Ty.deprecated_type) || [];
5669
- return t3 ? Py(e5) : { error: $.unknown_media_type };
5440
+ let [, t3] = e5.match(yv.deprecated_type) || [];
5441
+ return t3 ? Ov(e5) : { error: $.unknown_media_type };
5670
5442
  }
5671
5443
  }
5672
- var Vy = { externalUrl: /(^https?)|(^data)|(^blob)|(^\/\/)/, inlineSvg: /<svg[\s\S]*>[\s\S]*<\/svg>/im };
5673
- var Hy = { [Q.VECTOR]: [Vy.externalUrl, Vy.inlineSvg], [Q.IMAGE]: [Vy.externalUrl], [Q.DOCUMENT]: [], [Q.VIDEO]: [], [Q.AUDIO]: [Vy.externalUrl] };
5674
- function Uy({ mediaId: e5, type: t2, title: n2, width: r2, height: i2, posterId: a2, watermark: o2, duration: s2 }) {
5675
- return Hy[t2]?.some((t3) => t3.test(e5)) ? { item: e5 } : zy({ mediaId: e5, type: t2, title: n2, width: r2, height: i2, posterId: a2, watermark: o2, duration: s2 });
5444
+ var Fv = { externalUrl: /(^https?)|(^data)|(^blob)|(^\/\/)/, inlineSvg: /<svg[\s\S]*>[\s\S]*<\/svg>/im };
5445
+ var Iv = { [Q.VECTOR]: [Fv.externalUrl, Fv.inlineSvg], [Q.IMAGE]: [Fv.externalUrl], [Q.DOCUMENT]: [], [Q.VIDEO]: [], [Q.AUDIO]: [Fv.externalUrl] };
5446
+ function Lv({ mediaId: e5, type: t2, title: n2, width: r2, height: i2, posterId: a2, watermark: o2, duration: s2 }) {
5447
+ return Iv[t2]?.some((t3) => t3.test(e5)) ? { item: e5 } : Nv({ mediaId: e5, type: t2, title: n2, width: r2, height: i2, posterId: a2, watermark: o2, duration: s2 });
5676
5448
  }
5677
- function Wy(e5, t2) {
5449
+ function Rv(e5, t2) {
5678
5450
  if (!Object.values(Q).includes(t2)) return { error: $.unknown_media_type };
5679
- if (Hy[t2].some((t3) => t3.test(e5))) return { type: t2, mediaId: e5 };
5680
- let n2 = By(e5);
5451
+ if (Iv[t2].some((t3) => t3.test(e5))) return { type: t2, mediaId: e5 };
5452
+ let n2 = Pv(e5);
5681
5453
  return n2.error === $.non_string_media_id ? n2 : n2.error === $.unknown_media_type || t2 !== n2.type ? { error: $.bad_media_id } : n2;
5682
5454
  }
5683
- var Gy = (e5) => `aria` + e5.charAt(0).toUpperCase() + e5.slice(1);
5684
- function Ky(e5, t2) {
5455
+ var zv = (e5) => `aria` + e5.charAt(0).toUpperCase() + e5.slice(1);
5456
+ function Bv(e5, t2) {
5685
5457
  let { modifyAriaSourceKeys: n2 } = t2 ?? {};
5686
5458
  return (t3) => {
5687
5459
  let r2 = {};
@@ -5689,13 +5461,13 @@ function Ky(e5, t2) {
5689
5461
  let a2 = e5[i2](t3), o2 = Object.keys(a2);
5690
5462
  for (let e6 = 0; e6 < o2.length; e6++) {
5691
5463
  let t4 = o2[e6], i3 = Object.getOwnPropertyDescriptor(a2, t4);
5692
- Object.defineProperty(r2, n2 && i3.get ? Gy(t4) : t4, i3);
5464
+ Object.defineProperty(r2, n2 && i3.get ? zv(t4) : t4, i3);
5693
5465
  }
5694
5466
  }
5695
5467
  return r2;
5696
5468
  };
5697
5469
  }
5698
- var qy = ({ handlers: e5, metaData: t2 }) => {
5470
+ var Vv = ({ handlers: e5, metaData: t2 }) => {
5699
5471
  let { compId: n2, connection: r2, compType: i2, isGlobal: a2, getParent: o2, role: s2, wixCodeId: c2 } = t2, l2 = `$w.${i2}`;
5700
5472
  return { get id() {
5701
5473
  return c2 || s2;
@@ -5717,14 +5489,14 @@ var qy = ({ handlers: e5, metaData: t2 }) => {
5717
5489
  return { id: s2, type: l2, global: a2() };
5718
5490
  } };
5719
5491
  };
5720
- var Jy = (e5) => {
5492
+ var Hv = (e5) => {
5721
5493
  let { props: t2, setProps: n2 } = e5;
5722
5494
  return { get src() {
5723
- return Uy({ type: `image`, mediaId: t2?.image?.uri, title: t2?.image?.name, width: t2?.image?.width, height: t2?.image?.height }).item ?? ``;
5495
+ return Lv({ type: `image`, mediaId: t2?.image?.uri, title: t2?.image?.name, width: t2?.image?.width, height: t2?.image?.height }).item ?? ``;
5724
5496
  }, set src(e6) {
5725
- let { height: r2, width: i2, title: a2, error: o2, mediaId: s2 } = Wy((xy(e6) ? `` : e6).toString(), `image`);
5497
+ let { height: r2, width: i2, title: a2, error: o2, mediaId: s2 } = Rv((hv(e6) ? `` : e6).toString(), `image`);
5726
5498
  if (o2) {
5727
- Cy(`The "src" property cannot be set to "src". It must be a valid URL starting with "http://", "https://", or "wix:image://".`);
5499
+ _v(`The "src" property cannot be set to "src". It must be a valid URL starting with "http://", "https://", or "wix:image://".`);
5728
5500
  return;
5729
5501
  }
5730
5502
  let { image: c2 } = t2, l2 = c2, u2 = { ...l2, width: i2 || l2?.width, height: r2 || l2?.height, uri: s2 || l2?.uri, name: a2 || l2?.name, crop: null };
@@ -5732,7 +5504,7 @@ var Jy = (e5) => {
5732
5504
  }, get alt() {
5733
5505
  return t2.image?.alt;
5734
5506
  }, set alt(e6) {
5735
- if (xy(e6)) {
5507
+ if (hv(e6)) {
5736
5508
  let e7 = t2.image || {};
5737
5509
  delete e7.alt, n2({ image: e7 });
5738
5510
  } else n2({ image: { ...t2.image, alt: e6 } });
@@ -5750,23 +5522,23 @@ var Jy = (e5) => {
5750
5522
  return { type: `$w.Image`, alt: t2?.image?.alt, src: t2?.image?.uri, name: t2?.image?.name };
5751
5523
  } };
5752
5524
  };
5753
- Ky([Jy, qy]);
5754
- var Yy = `11062b_7b9f1e3756b64285ad5cf5e244b4ae77~mv2.png`;
5755
- var Xy = `wix:image://v1/${Yy}/${Yy}#originWidth=460&originHeight=460`;
5756
- function Zy(e5) {
5525
+ Bv([Hv, Vv]);
5526
+ var Uv = `11062b_7b9f1e3756b64285ad5cf5e244b4ae77~mv2.png`;
5527
+ var Wv = `wix:image://v1/${Uv}/${Uv}#originWidth=460&originHeight=460`;
5528
+ function Gv(e5) {
5757
5529
  if (!e5) return null;
5758
5530
  let t2;
5759
- return Jy({ props: {}, setProps: ({ image: e6 }) => {
5531
+ return Hv({ props: {}, setProps: ({ image: e6 }) => {
5760
5532
  t2 = e6;
5761
5533
  } }).src = e5, t2 ?? null;
5762
5534
  }
5763
- function Qy(e5) {
5764
- return Zy(e5.media?.mainMedia?.image || Xy);
5535
+ function Kv(e5) {
5536
+ return Gv(e5.media?.mainMedia?.image || Wv);
5765
5537
  }
5766
- function $y(e5) {
5767
- return Zy(e5.media?.coverMedia?.image) ?? void 0;
5538
+ function qv(e5) {
5539
+ return Gv(e5.media?.coverMedia?.image) ?? void 0;
5768
5540
  }
5769
- function eb(e5) {
5541
+ function Jv(e5) {
5770
5542
  switch (e5.type) {
5771
5543
  case kd.BUSINESS:
5772
5544
  return `business`;
@@ -5778,7 +5550,7 @@ function eb(e5) {
5778
5550
  return null;
5779
5551
  }
5780
5552
  }
5781
- function tb(e5, t2) {
5553
+ function Yv(e5, t2) {
5782
5554
  switch (e5.type) {
5783
5555
  case kd.BUSINESS:
5784
5556
  return e5.business?.name ?? null;
@@ -5790,230 +5562,471 @@ function tb(e5, t2) {
5790
5562
  return null;
5791
5563
  }
5792
5564
  }
5793
- function nb(e5) {
5565
+ function Xv(e5) {
5794
5566
  return (e5?.locations ?? []).flatMap((e6) => {
5795
- let t2 = eb(e6);
5567
+ let t2 = Jv(e6);
5796
5568
  if (!t2) return [];
5797
5569
  if (t2 === `customer`) return [{ type: t2, text: null }];
5798
- let n2 = tb(e6, ``);
5570
+ let n2 = Yv(e6, ``);
5799
5571
  return n2 ? [{ type: t2, text: n2 }] : [];
5800
5572
  });
5801
5573
  }
5802
- var rb = { AVAILABLE: `available`, FULLY_BOOKED: `fullyBooked`, BOOKING_NOT_OPEN_YET: `bookingNotOpenYet`, BOOKING_CLOSED: `bookingClosed`, COURSE_IN_PROGRESS: `courseInProgress`, NO_UPCOMING_SESSIONS: `noUpcomingSessions` };
5803
- var ib = 6e4;
5804
- var ab = (e5) => e5?.onlineBooking?.enabled === true;
5805
- var ob = (e5) => e5 ? new Date(e5).getTime() : null;
5806
- var sb = (e5, t2) => t2 !== void 0 && e5 !== null && e5 <= t2;
5807
- function cb({ service: e5, courseRemainingCapacity: t2, now: n2 }) {
5808
- let r2 = ab(e5), i2 = ob(e5?.schedule?.firstSessionStart), a2 = ob(e5?.schedule?.lastSessionEnd), o2 = i2 !== null;
5574
+ var Zv = { AVAILABLE: `available`, FULLY_BOOKED: `fullyBooked`, BOOKING_NOT_OPEN_YET: `bookingNotOpenYet`, BOOKING_CLOSED: `bookingClosed`, COURSE_IN_PROGRESS: `courseInProgress`, NO_UPCOMING_SESSIONS: `noUpcomingSessions` };
5575
+ var Qv = 6e4;
5576
+ var $v = (e5) => e5?.onlineBooking?.enabled === true;
5577
+ var ey = (e5) => e5 ? new Date(e5).getTime() : null;
5578
+ var ty = (e5, t2) => t2 !== void 0 && e5 !== null && e5 <= t2;
5579
+ function ny({ service: e5, courseRemainingCapacity: t2, now: n2 }) {
5580
+ let r2 = $v(e5), i2 = ey(e5?.schedule?.firstSessionStart), a2 = ey(e5?.schedule?.lastSessionEnd), o2 = i2 !== null;
5809
5581
  if (!Um(e5?.type)) {
5810
- let t3 = !Hm(e5?.type) || o2 && !sb(a2, n2);
5811
- return { state: r2 && !t3 ? rb.NO_UPCOMING_SESSIONS : rb.AVAILABLE, isAvailableForBooking: r2 && t3, bookingOpensAt: null };
5582
+ let t3 = !Hm(e5?.type) || o2 && !ty(a2, n2);
5583
+ return { state: r2 && !t3 ? Zv.NO_UPCOMING_SESSIONS : Zv.AVAILABLE, isAvailableForBooking: r2 && t3, bookingOpensAt: null };
5812
5584
  }
5813
- let s2 = e5?.bookingPolicy, c2 = s2?.limitEarlyBookingPolicy?.enabled ? s2.limitEarlyBookingPolicy.earliestBookingInMinutes ?? 0 : 0, l2 = s2?.limitLateBookingPolicy?.enabled ? s2.limitLateBookingPolicy.latestBookingInMinutes ?? 0 : 0, u2 = s2?.bookAfterStartPolicy?.enabled === true, d2 = i2 === null || n2 === void 0 ? null : (i2 - n2) / ib, f2 = t2 !== null && t2 <= 0, p2 = d2 !== null && c2 > 0 && d2 >= c2, m2 = d2 !== null && !u2 && d2 <= l2, h2 = o2 && !sb(a2, n2), g2 = sb(i2, n2) && !sb(a2, n2) && u2, _2 = i2 === null ? null : new Date(i2 - c2 * ib), v2 = rb.AVAILABLE;
5814
- return r2 && (f2 ? v2 = rb.FULLY_BOOKED : p2 ? v2 = rb.BOOKING_NOT_OPEN_YET : m2 ? v2 = rb.BOOKING_CLOSED : h2 ? g2 && (v2 = rb.COURSE_IN_PROGRESS) : v2 = rb.NO_UPCOMING_SESSIONS), { state: v2, isAvailableForBooking: r2 && !f2 && h2 && !p2 && !m2, bookingOpensAt: _2 };
5585
+ let s2 = e5?.bookingPolicy, c2 = s2?.limitEarlyBookingPolicy?.enabled ? s2.limitEarlyBookingPolicy.earliestBookingInMinutes ?? 0 : 0, l2 = s2?.limitLateBookingPolicy?.enabled ? s2.limitLateBookingPolicy.latestBookingInMinutes ?? 0 : 0, u2 = s2?.bookAfterStartPolicy?.enabled === true, d2 = i2 === null || n2 === void 0 ? null : (i2 - n2) / Qv, f2 = t2 !== null && t2 <= 0, p2 = d2 !== null && c2 > 0 && d2 >= c2, m2 = d2 !== null && !u2 && d2 <= l2, h2 = o2 && !ty(a2, n2), g2 = ty(i2, n2) && !ty(a2, n2) && u2, _2 = i2 === null ? null : new Date(i2 - c2 * Qv), v2 = Zv.AVAILABLE;
5586
+ return r2 && (f2 ? v2 = Zv.FULLY_BOOKED : p2 ? v2 = Zv.BOOKING_NOT_OPEN_YET : m2 ? v2 = Zv.BOOKING_CLOSED : h2 ? g2 && (v2 = Zv.COURSE_IN_PROGRESS) : v2 = Zv.NO_UPCOMING_SESSIONS), { state: v2, isAvailableForBooking: r2 && !f2 && h2 && !p2 && !m2, bookingOpensAt: _2 };
5815
5587
  }
5816
- var lb = [];
5817
- var ub = (e5) => (e5.recurrenceRule?.days ?? []).map((e6) => ({ day: e6 }));
5818
- function db(e5) {
5819
- let t2 = e5.flatMap(ub);
5820
- return t2.length === 0 ? lb : t2;
5588
+ function ry(e5) {
5589
+ return e5.staffMemberDetails?.staffMembers ?? [];
5590
+ }
5591
+ function iy(e5, t2) {
5592
+ let n2 = e5.workingHoursLocationCoverage;
5593
+ return { staffMemberId: e5.staffMemberId ?? ``, name: e5.name ?? null, image: null, isSelected: t2 === e5.staffMemberId, ...n2 ? { locationCoverage: { availableAtAllLocations: n2.availableAtAllLocations ?? false, locationIds: n2.locationIds ?? [] } } : {} };
5594
+ }
5595
+ var ay = [];
5596
+ var oy = (e5) => (e5.recurrenceRule?.days ?? []).map((e6) => ({ day: e6 }));
5597
+ function sy(e5) {
5598
+ let t2 = e5.flatMap(oy);
5599
+ return t2.length === 0 ? ay : t2;
5821
5600
  }
5822
- function fb(e5, t2) {
5601
+ function cy(e5, t2) {
5823
5602
  return t2 === void 0 ? false : !e5 || new Date(e5).getTime() <= t2;
5824
5603
  }
5825
- function pb(e5) {
5604
+ function ly(e5) {
5826
5605
  return e5 !== null && e5 <= 0;
5827
5606
  }
5828
- function mb({ lastSessionEnd: e5, masterEvents: t2, now: n2 }) {
5829
- if (fb(e5, n2)) return null;
5607
+ function uy({ lastSessionEnd: e5, masterEvents: t2, now: n2 }) {
5608
+ if (cy(e5, n2)) return null;
5830
5609
  let r2 = t2[0];
5831
5610
  return r2 ? { totalCapacity: r2.totalCapacity ?? null, remainingCapacity: r2.remainingCapacity ?? null } : null;
5832
5611
  }
5833
- var hb = (e5, t2) => !e5 || new Date(e5).getTime() <= t2;
5834
- var gb = 6e4;
5835
- function _b(e5, t2) {
5612
+ var dy = (e5, t2) => !e5 || new Date(e5).getTime() <= t2;
5613
+ var fy = 6e4;
5614
+ function py(e5, t2) {
5836
5615
  if (t2 === void 0) return false;
5837
5616
  let n2 = e5.bookingPolicy?.bookAfterStartPolicy?.enabled, r2 = e5.schedule?.firstSessionStart ?? null, i2 = e5.schedule?.lastSessionEnd ?? null, a2 = false;
5838
5617
  if (!n2 && r2 && e5.bookingPolicy?.limitLateBookingPolicy?.enabled) {
5839
5618
  let n3 = e5.bookingPolicy.limitLateBookingPolicy.latestBookingInMinutes ?? 0;
5840
- a2 = t2 >= new Date(r2).getTime() - n3 * gb;
5619
+ a2 = t2 >= new Date(r2).getTime() - n3 * fy;
5841
5620
  }
5842
- let o2 = Um(e5.type) && hb(i2, t2), s2 = hb(r2, t2);
5621
+ let o2 = Um(e5.type) && dy(i2, t2), s2 = dy(r2, t2);
5843
5622
  return o2 || s2 && !n2 || a2;
5844
5623
  }
5845
- function vb(e5) {
5624
+ function my(e5) {
5846
5625
  return Um(e5.serviceType) && (e5.courseFull || e5.tooLateToBook) ? Yc.VIEW_COURSE : e5.requireManualApproval ? Yc.REQUEST_TO_BOOK : Yc.BOOK;
5847
5626
  }
5848
- var { RateType: yb, FrequencyType: bb } = fu;
5849
- var xb = { rateType: null, price: null, priceAfterDiscount: null, discountName: null, calculatedAtCheckout: false, subscriptionFrequency: null, isFree: false };
5850
- function Sb(e5) {
5627
+ function hy(e5, t2) {
5628
+ let n2 = e5?.value, r2 = e5?.currency;
5629
+ if (n2 == null || !r2) return null;
5630
+ let i2 = Number(n2);
5631
+ if (!Number.isFinite(i2)) return null;
5632
+ let a2 = i2 % 1 == 0 ? 0 : 2;
5633
+ return new Intl.NumberFormat(t2, { style: `currency`, currency: r2, currencyDisplay: `symbol`, maximumFractionDigits: a2, minimumFractionDigits: a2 }).format(i2).replace(/\p{Zs}/gu, `\xA0`);
5634
+ }
5635
+ function gy(e5, t2) {
5636
+ return (t2.getUTCFullYear() - e5.getUTCFullYear()) * 12 + (t2.getUTCMonth() - e5.getUTCMonth());
5637
+ }
5638
+ function _y(e5, t2) {
5639
+ let n2 = e5?.totalPayments;
5640
+ if (n2 == null) return null;
5641
+ let r2 = e5?.recurringStartDate;
5642
+ if (!r2 || t2 === void 0) return n2;
5643
+ let i2 = new Date(r2), a2 = new Date(t2);
5644
+ return Number.isNaN(i2.getTime()) || a2 < i2 ? n2 : Math.max(1, n2 - gy(i2, a2));
5645
+ }
5646
+ var { RateType: vy, FrequencyType: yy } = fu;
5647
+ var by = { rateType: null, price: null, priceAfterDiscount: null, discountName: null, calculatedAtCheckout: false, subscriptionFrequency: null, remainingPayments: null, isFree: false };
5648
+ function xy(e5) {
5851
5649
  if (e5 == null || e5 === ``) return false;
5852
5650
  let t2 = Number(e5);
5853
5651
  return Number.isFinite(t2) && t2 === 0;
5854
5652
  }
5855
- function Cb(e5, t2) {
5856
- let n2 = e5?.payment;
5857
- if (!n2) return xb;
5858
- let r2 = n2.rateType ?? null, i2 = null;
5859
- switch (r2) {
5860
- case yb.FIXED:
5861
- i2 = dy(n2.fixed?.price, t2);
5653
+ function Sy(e5, t2, n2 = {}) {
5654
+ let r2 = e5?.payment;
5655
+ if (!r2) return by;
5656
+ let i2 = r2.rateType ?? null, a2 = null;
5657
+ switch (i2) {
5658
+ case vy.FIXED:
5659
+ a2 = hy(r2.fixed?.price, t2);
5862
5660
  break;
5863
- case yb.VARIED:
5864
- i2 = dy(n2.varied?.minPrice, t2);
5661
+ case vy.VARIED:
5662
+ a2 = hy(r2.varied?.minPrice, t2);
5865
5663
  break;
5866
- case yb.CUSTOM:
5867
- i2 = n2.custom?.description ?? null;
5664
+ case vy.CUSTOM:
5665
+ a2 = r2.custom?.description ?? null;
5868
5666
  break;
5869
- case yb.SUBSCRIPTION:
5870
- i2 = dy(n2.subscription?.amountPerBillingCycle, t2);
5667
+ case vy.SUBSCRIPTION:
5668
+ a2 = hy(r2.subscription?.amountPerBillingCycle, t2);
5871
5669
  }
5872
- let a2 = !(n2.pricingPlanIds?.length || n2.options?.pricingPlan) && (r2 === yb.NO_FEE || r2 === yb.FIXED && Sb(n2.fixed?.price?.value)), o2 = n2.discountInfo?.discountName ?? null, s2 = o2 && r2 === yb.FIXED ? dy(n2.discountInfo?.priceAfterDiscount, t2) : null;
5873
- return { rateType: r2, price: i2, priceAfterDiscount: s2, discountName: o2, calculatedAtCheckout: !!o2 && !s2, subscriptionFrequency: n2.subscription?.frequency ?? null, isFree: a2 };
5670
+ let o2 = !(r2.pricingPlanIds?.length || r2.options?.pricingPlan) && (i2 === vy.NO_FEE || i2 === vy.FIXED && xy(r2.fixed?.price?.value)), s2 = !!n2.subscriptionPayment && i2 === vy.SUBSCRIPTION, c2 = s2 && !n2.monthlyDiscounts ? void 0 : r2.discountInfo ?? void 0, l2 = c2?.discountName ?? null, u2 = l2 && (i2 === vy.FIXED || s2) ? hy(c2?.priceAfterDiscount, t2) : null, d2 = s2 && r2.subscription?.frequency === yy.MONTHLY ? _y(r2.subscription, n2.now) : null;
5671
+ return { rateType: i2, price: a2, priceAfterDiscount: u2, discountName: l2, calculatedAtCheckout: !!l2 && !u2, subscriptionFrequency: r2.subscription?.frequency ?? null, remainingPayments: d2, isFree: o2 };
5874
5672
  }
5875
- function wb(e5) {
5876
- return e5 ? yy(e5).filter((e6) => e6.staffMemberId).map((e6) => {
5877
- let { staffMemberId: t2, name: n2, image: r2 } = by(e6, null);
5673
+ var Cy = (e5) => {
5674
+ let t2 = (e6) => e6 < 10 ? `0${e6}` : `${e6}`;
5675
+ return `${e5.getFullYear()}-${t2(e5.getMonth() + 1)}-${t2(e5.getDate())}`;
5676
+ };
5677
+ var wy = (e5, t2) => new Intl.DateTimeFormat(`en-CA`, { year: `numeric`, month: `2-digit`, day: `2-digit`, ...t2 ? { timeZone: t2 } : {} }).format(e5);
5678
+ var Ty = (e5) => `${Cy(e5)}T00:00:00`;
5679
+ function Ey(e5, t2) {
5680
+ if (e5 == null || !Number.isFinite(e5) || e5 <= 0) return null;
5681
+ let n2 = new Intl.NumberFormat(t2, { style: `unit`, unit: `hour`, unitDisplay: `short` }), r2 = new Intl.NumberFormat(t2, { style: `unit`, unit: `minute`, unitDisplay: `short` });
5682
+ if (e5 < 60) return r2.format(e5);
5683
+ let i2 = Math.floor(e5 / 60), a2 = e5 % 60;
5684
+ return a2 === 0 ? n2.format(i2) : `${n2.format(i2)} ${r2.format(a2)}`;
5685
+ }
5686
+ function Dy(e5) {
5687
+ return e5 ? ry(e5).filter((e6) => e6.staffMemberId).map((e6) => {
5688
+ let { staffMemberId: t2, name: n2, image: r2 } = iy(e6, null);
5878
5689
  return { staffMemberId: t2, name: n2, image: r2 };
5879
5690
  }) : [];
5880
5691
  }
5881
- function Tb(e5, t2, n2) {
5882
- return Um(e5?.type) ? mb({ lastSessionEnd: e5?.schedule?.lastSessionEnd, masterEvents: t2, now: n2 }) : null;
5692
+ function Oy(e5, t2, n2) {
5693
+ return Um(e5?.type) ? uy({ lastSessionEnd: e5?.schedule?.lastSessionEnd, masterEvents: t2, now: n2 }) : null;
5694
+ }
5695
+ function ky({ service: e5, masterEvents: t2, locale: n2, timeZone: r2, now: i2, servicePriceOptions: a2 }) {
5696
+ let o2 = Oy(e5, t2, i2), s2 = t2[0]?.timeZone ?? r2 ?? `UTC`, c2 = ny({ service: e5, courseRemainingCapacity: o2?.remainingCapacity ?? null, now: i2 }), l2 = e5?.bookingPolicy?.customPolicyDescription;
5697
+ return { serviceId: e5?._id ?? null, serviceSlug: e5?.mainSlug?.name ?? null, serviceName: e5?.name ?? null, serviceDescription: e5?.description ?? null, serviceTagLine: e5?.tagLine ?? null, serviceType: e5?.type ?? null, serviceDefaultDuration: e5 ? Ey(Qm(e5), n2) : null, serviceImage: e5 ? Kv(e5) : null, serviceCtaState: my({ serviceType: e5?.type ?? null, requireManualApproval: !!e5?.onlineBooking?.requireManualApproval, courseFull: ly(o2?.remainingCapacity ?? null), tooLateToBook: e5 ? py(e5, i2) : false }), servicePrice: Sy(e5, n2, { ...a2, now: i2 }), isVariedService: e5 ? Wm(e5) : false, hasAddOns: e5 ? Km(e5) : false, isConferenceEnabled: !!e5?.conferencing?.enabled, offeredDays: sy(t2), courseAvailability: o2, courseStartDate: e5?.schedule?.firstSessionStart ? wy(new Date(e5.schedule.firstSessionStart), s2) : null, courseEndDate: e5?.schedule?.lastSessionEnd ? wy(new Date(e5.schedule.lastSessionEnd), s2) : null, staffMembers: Dy(e5), coverImage: e5 ? qv(e5) : void 0, gallery: rv(e5), serviceLocations: Xv(e5), policyDescription: l2?.enabled ? l2.description ?? null : null, serviceBookability: c2, displayTimeZone: s2 };
5698
+ }
5699
+ function Ay({ serviceCtaState: e5, courseAvailability: t2, serviceBookability: n2, servicePrice: r2 }) {
5700
+ return `${r2.remainingPayments}|${e5}|${t2?.totalCapacity ?? `-`}|${t2?.remainingCapacity ?? `-`}|${t2 === null}|${n2.state}|${n2.isAvailableForBooking}`;
5701
+ }
5702
+ function jy({ service: e5, masterEvents: t2, locale: n2, timeZone: r2 }) {
5703
+ let i2 = mv(), a2 = Es(`bookingsUouSubscriptionPayment`), o2 = Es(`allowMonthlyPricingAutomaticDiscountsBO`), s2 = ky({ service: e5, masterEvents: t2, locale: n2, timeZone: r2, now: i2, servicePriceOptions: { subscriptionPayment: a2, monthlyDiscounts: o2 } }), c2 = Ay(s2);
5704
+ return (0, import_react.useMemo)(() => s2, [e5, t2, n2, r2, c2, a2, o2]);
5705
+ }
5706
+ function My(e5) {
5707
+ return e5?.details?.applicationError?.code;
5708
+ }
5709
+ var Ny = false;
5710
+ function Py() {
5711
+ return Ny;
5712
+ }
5713
+ var Fy = ms(`@wix/site-service-business-logger`);
5714
+ function Iy(e5) {
5715
+ return { evid: 1190, src: 16, endpoint: ``, params: e5 };
5716
+ }
5717
+ function Ly(e5) {
5718
+ return { evid: 32, src: 16, endpoint: ``, params: e5 };
5719
+ }
5720
+ function Ry(e5) {
5721
+ return { evid: 33, src: 16, endpoint: ``, params: e5 };
5722
+ }
5723
+ function zy(e5) {
5724
+ return { evid: 34, src: 16, endpoint: ``, params: e5 };
5725
+ }
5726
+ function By(e5) {
5727
+ return { evid: 87, src: 16, endpoint: ``, params: e5 };
5728
+ }
5729
+ var Vy = { 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` };
5730
+ Bs.BOOK_ONLINE;
5731
+ var Hy = `new_bookings_server`;
5732
+ var Uy = { WIDGET_BUTTON: `widget_button`, WIDGET_MORE_INFO_LABEL: `widget_more_info_label`, EXPLORE_PLANS: `explore_plans` };
5733
+ var Wy = { servicePage: `service_page`, bookingCalendar: `calendar_page`, bookingForm: `form` };
5734
+ var Gy = { servicePage: `navigate_to_service_page`, bookingCalendar: `navigate_to_calendar`, bookingForm: `navigate_to_booking_form` };
5735
+ var Ky = `click`;
5736
+ var qy = { TIMEZONE_PICKER: `timezone_picker`, TIME_PICKER: `time_picker`, BOOKING_DETAILS: `booking_details`, RESCHEDULE_DIALOG: `reschedule_dialog`, JOIN_WAITLIST_DIALOG: `join_waitlist_dialog` };
5737
+ var Jy = { CONFIRM_BUTTON: `confirm_button`, GO_TO_HOMEPAGE_BUTTON: `go_to_homepage_button` };
5738
+ var Yy = `reschedule success`;
5739
+ var Xy = (e5) => {
5740
+ let { reportBi: t2 } = (0, import_services_manager_react.useService)(Fy);
5741
+ return (0, import_react.useCallback)((n2) => {
5742
+ t2({ widget_name: e5, bookingsPlatform: Hy, is_over_editor: false, ...n2.params, src: n2.src, evid: n2.evid }, { endpoint: n2.endpoint });
5743
+ }, [t2, e5]);
5744
+ };
5745
+ var Zy = (e5, t2 = true) => {
5746
+ let n2 = Xy(e5), { getParsedUrl: r2 } = ps(), i2 = (0, import_react.useRef)(false);
5747
+ (0, import_react.useEffect)(() => {
5748
+ t2 && !i2.current && (i2.current = true, n2(Ly({ referralInfo: r2().searchParams.get(i_.referral) ?? void 0 })));
5749
+ }, [t2, n2, r2]);
5750
+ };
5751
+ function Qy(e5) {
5752
+ return { evid: 501, src: 16, endpoint: `wixboost-ugc`, params: e5 };
5753
+ }
5754
+ function $y(e5) {
5755
+ return { evid: 551, src: 16, endpoint: `wixboost-ugc`, params: e5 };
5756
+ }
5757
+ function eb(e5) {
5758
+ return { evid: 596, src: 16, endpoint: `wixboost-ugc`, params: e5 };
5759
+ }
5760
+ function tb(e5, t2) {
5761
+ 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(e5)), r2 = {};
5762
+ for (let e6 of n2) e6.type !== `literal` && (r2[e6.type] = Number(e6.value));
5763
+ return Date.UTC(r2.year, r2.month - 1, r2.day, r2.hour, r2.minute, r2.second) - e5;
5764
+ }
5765
+ function nb(e5, t2) {
5766
+ let n2 = e5.match(/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2}))?/);
5767
+ if (!n2) return null;
5768
+ 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);
5769
+ if (Number.isNaN(l2)) return null;
5770
+ try {
5771
+ let e6 = l2 - tb(l2, t2);
5772
+ return new Date(l2 - tb(e6, t2));
5773
+ } catch {
5774
+ return null;
5775
+ }
5776
+ }
5777
+ function rb({ start: e5, end: t2, timeZone: n2, ...r2 }) {
5778
+ let i2 = (e6) => e6 && n2 ? nb(e6, n2)?.getTime() : void 0;
5779
+ return zy({ bookingsServiceId: r2.serviceId, serviceType: r2.serviceType, startTime: i2(e5), endTime: i2(t2), isEligibleForFlowCompletion: r2.isEligibleForFlowCompletion });
5780
+ }
5781
+ var ib = ns(`@wix/site-service-site-info`);
5782
+ function ab() {
5783
+ let e5 = gs();
5784
+ if (!e5) return ``;
5785
+ try {
5786
+ return e5(ib).siteId;
5787
+ } catch {
5788
+ return ``;
5789
+ }
5790
+ }
5791
+ function ob(e5) {
5792
+ return hi(Object.assign(e5, { domainToMappings: { "api._api_base_domain_": [{ srcPath: `/events-3`, destPath: `` }], "manage._base_domain_": [{ srcPath: `/_api/calendar/v3/events`, destPath: `/v3/events` }, { srcPath: `/_api/calendar/v3/bulk/events`, destPath: `/v3/bulk/events` }, { srcPath: `/_api/calendar/v3/ro/events`, destPath: `/v3/events` }], "www.wixapis.com": [{ srcPath: `/calendar/v3/events`, destPath: `/v3/events` }, { srcPath: `/calendar/v3/bulk/events`, destPath: `/v3/bulk/events` }], _: [{ srcPath: `/_api/calendar/v3/events`, destPath: `/v3/events` }, { srcPath: `/_api/calendar/v3/bulk/events`, destPath: `/v3/bulk/events` }], "*.dev.wix-code.com": [{ srcPath: `/_api/calendar/v3/events`, destPath: `/v3/events` }, { srcPath: `/_api/calendar/v3/bulk/events`, destPath: `/v3/bulk/events` }], "editor._base_domain_": [{ srcPath: `/_api/calendar/v3/events`, destPath: `/v3/events` }, { srcPath: `/_api/calendar/v3/bulk/events`, destPath: `/v3/bulk/events` }], "blocks._base_domain_": [{ srcPath: `/_api/calendar/v3/events`, destPath: `/v3/events` }, { srcPath: `/_api/calendar/v3/bulk/events`, destPath: `/v3/bulk/events` }], "create.editorx": [{ srcPath: `/_api/calendar/v3/events`, destPath: `/v3/events` }, { srcPath: `/_api/calendar/v3/bulk/events`, destPath: `/v3/bulk/events` }] } }));
5793
+ }
5794
+ var sb = `@wix/auto_sdk_calendar_events`;
5795
+ function cb(e5) {
5796
+ function t2({ host: t3 }) {
5797
+ return { entityFqdn: `wix.calendar.v3.event`, method: `POST`, methodFqn: `wix.calendar.events.v3.EventsService.QueryEvents`, packageName: sb, migrationOptions: { optInTransformResponse: true }, url: ob({ protoPath: `/v3/events/query`, data: e5, host: t3 }), data: e5, transformResponse: (e6) => H(e6, [{ transformFn: V, paths: [{ path: `events.createdDate` }, { path: `events.updatedDate` }, { path: `events.start.utcDate` }, { path: `events.end.utcDate` }, { path: `events.adjustedStart.utcDate` }, { path: `events.adjustedEnd.utcDate` }, { path: `events.recurrenceRule.until.utcDate` }, { path: `events.recurrenceRule.adjustedUntil.utcDate` }] }]) };
5798
+ }
5799
+ return t2;
5800
+ }
5801
+ function lb(e5) {
5802
+ let { httpClient: t2, sideEffects: n2 } = arguments[1];
5803
+ return sl({ func: async (r2) => {
5804
+ let i2 = cb({ ...r2, ...e5 ?? {} });
5805
+ n2?.onSiteCall?.();
5806
+ try {
5807
+ let e6 = await t2.request(i2);
5808
+ return n2?.onSuccess?.(e6), e6;
5809
+ } catch (e6) {
5810
+ throw n2?.onError?.(e6), e6;
5811
+ }
5812
+ }, requestTransformer: (t3) => {
5813
+ let n3 = [t3, e5];
5814
+ return z({ ...n3?.[1], query: n3?.[0] });
5815
+ }, responseTransformer: ({ data: e6 }) => {
5816
+ let t3 = B(H(e6, []));
5817
+ return { items: t3?.events, pagingMetadata: t3?.pagingMetadata };
5818
+ }, errorTransformer: (e6) => {
5819
+ throw U(e6, { spreadPathsToArguments: {}, explicitPathsToArguments: { query: `$[0]` }, singleArgumentUnchanged: false });
5820
+ }, pagingMethod: `CURSOR`, transformationPaths: {} });
5821
+ }
5822
+ async function ub(e5, t2) {
5823
+ let { httpClient: n2, sideEffects: r2 } = arguments[2], i2 = cb(z({ query: e5, ...t2 }));
5824
+ r2?.onSiteCall?.();
5825
+ try {
5826
+ let e6 = await n2.request(i2);
5827
+ return r2?.onSuccess?.(e6), B(e6.data);
5828
+ } catch (e6) {
5829
+ let t3 = U(e6, { spreadPathsToArguments: {}, explicitPathsToArguments: { query: `$[0]` }, singleArgumentUnchanged: false }, [`query`, `options`]);
5830
+ throw r2?.onError?.(e6), t3;
5831
+ }
5832
+ }
5833
+ ({ ...ml() });
5834
+ function db(e5) {
5835
+ return (t2) => lb(t2, { httpClient: e5 });
5836
+ }
5837
+ function fb(e5) {
5838
+ return (t2, n2) => ub(t2, n2, { httpClient: e5 });
5839
+ }
5840
+ var pb = b(`wix.calendar.v3.event_cancelled`, true, (e5) => B(H(e5, [{ transformFn: V, paths: [{ path: `data.event.createdDate` }, { path: `data.event.updatedDate` }, { path: `data.event.start.utcDate` }, { path: `data.event.end.utcDate` }, { path: `data.event.adjustedStart.utcDate` }, { path: `data.event.adjustedEnd.utcDate` }, { path: `data.event.recurrenceRule.until.utcDate` }, { path: `data.event.recurrenceRule.adjustedUntil.utcDate` }, { path: `metadata.eventTime` }] }])))();
5841
+ var mb = b(`wix.calendar.v3.event_created`, true, (e5) => B(H(e5, [{ transformFn: V, paths: [{ path: `entity.createdDate` }, { path: `entity.updatedDate` }, { path: `entity.start.utcDate` }, { path: `entity.end.utcDate` }, { path: `entity.adjustedStart.utcDate` }, { path: `entity.adjustedEnd.utcDate` }, { path: `entity.recurrenceRule.until.utcDate` }, { path: `entity.recurrenceRule.adjustedUntil.utcDate` }, { path: `metadata.eventTime` }] }])))();
5842
+ var hb = b(`wix.calendar.v3.event_recurring_split`, true, (e5) => B(H(e5, [{ transformFn: V, paths: [{ path: `data.updatedRecurringEventEndingBeforeSplit.createdDate` }, { path: `data.updatedRecurringEventEndingBeforeSplit.updatedDate` }, { path: `data.updatedRecurringEventEndingBeforeSplit.start.utcDate` }, { path: `data.updatedRecurringEventEndingBeforeSplit.end.utcDate` }, { path: `data.updatedRecurringEventEndingBeforeSplit.adjustedStart.utcDate` }, { path: `data.updatedRecurringEventEndingBeforeSplit.adjustedEnd.utcDate` }, { path: `data.updatedRecurringEventEndingBeforeSplit.recurrenceRule.until.utcDate` }, { path: `data.updatedRecurringEventEndingBeforeSplit.recurrenceRule.adjustedUntil.utcDate` }, { path: `data.newRecurringEventStartingFromSplit.createdDate` }, { path: `data.newRecurringEventStartingFromSplit.updatedDate` }, { path: `data.newRecurringEventStartingFromSplit.start.utcDate` }, { path: `data.newRecurringEventStartingFromSplit.end.utcDate` }, { path: `data.newRecurringEventStartingFromSplit.adjustedStart.utcDate` }, { path: `data.newRecurringEventStartingFromSplit.adjustedEnd.utcDate` }, { path: `data.newRecurringEventStartingFromSplit.recurrenceRule.until.utcDate` }, { path: `data.newRecurringEventStartingFromSplit.recurrenceRule.adjustedUntil.utcDate` }, { path: `metadata.eventTime` }] }])))();
5843
+ var gb = b(`wix.calendar.v3.event_updated`, true, (e5) => B(H(e5, [{ transformFn: V, paths: [{ path: `entity.createdDate` }, { path: `entity.updatedDate` }, { path: `entity.start.utcDate` }, { path: `entity.end.utcDate` }, { path: `entity.adjustedStart.utcDate` }, { path: `entity.adjustedEnd.utcDate` }, { path: `entity.recurrenceRule.until.utcDate` }, { path: `entity.recurrenceRule.adjustedUntil.utcDate` }, { path: `metadata.eventTime` }, { path: `modifiedFields.createdDate` }, { path: `modifiedFields.updatedDate` }, { path: `modifiedFields.start.utcDate` }, { path: `modifiedFields.end.utcDate` }, { path: `modifiedFields.adjustedStart.utcDate` }, { path: `modifiedFields.adjustedEnd.utcDate` }, { path: `modifiedFields.recurrenceRule.until.utcDate` }, { path: `modifiedFields.recurrenceRule.adjustedUntil.utcDate` }] }])))();
5844
+ function _b(e5) {
5845
+ let t2 = wl({ builderQueryFunction: (t3) => db(e5)(t3), typedQueryFunction: (t3, n3) => fb(e5)(t3, n3), hasOptionsParameter: true });
5846
+ function n2(e6, n3) {
5847
+ return t2(...arguments);
5848
+ }
5849
+ return n2;
5850
+ }
5851
+ var vb = W(_b);
5852
+ Vi(pb), Vi(mb), Vi(hb), Vi(gb);
5853
+ var yb = 1e3;
5854
+ async function bb(e5, t2) {
5855
+ let n2 = [], r2;
5856
+ do {
5857
+ let i2 = await vb({ filter: e5, cursorPaging: { limit: yb, ...r2 ? { cursor: r2 } : {} } }, t2);
5858
+ n2.push(...i2.events ?? []), r2 = i2.pagingMetadata?.hasNext ? i2.pagingMetadata.cursors?.next ?? void 0 : void 0;
5859
+ } while (r2);
5860
+ return n2;
5861
+ }
5862
+ async function xb(e5, t2) {
5863
+ return e5.length === 0 ? [] : bb({ appId: Is, scheduleId: { $in: e5 } }, { recurrenceType: [`MASTER`, `NONE`], fromLocalDate: Ty(/* @__PURE__ */ new Date()), ...t2 ? { timeZone: t2 } : {} });
5864
+ }
5865
+ var Sb = `SERVICE_OPTIONS_AND_VARIANTS_NOT_FOUND`;
5866
+ async function Cb(e5) {
5867
+ try {
5868
+ let { serviceVariants: t2 } = await zl(e5);
5869
+ return t2 ?? null;
5870
+ } catch (e6) {
5871
+ if (My(e6) === Sb) return null;
5872
+ throw e6;
5873
+ }
5874
+ }
5875
+ var wb = 100;
5876
+ async function Tb(e5) {
5877
+ if (e5.length === 0) return {};
5878
+ let t2 = [];
5879
+ for (let n3 = 0; n3 < e5.length; n3 += wb) t2.push(e5.slice(n3, n3 + wb));
5880
+ let n2 = await Promise.all(t2.map((e6) => Bl().in(`serviceId`, e6).limit(wb).find())), r2 = {};
5881
+ for (let e6 of n2.flatMap((e7) => e7.items ?? [])) e6.serviceId && (r2[e6.serviceId] = e6);
5882
+ return r2;
5883
+ }
5884
+ function Eb(e5) {
5885
+ return e5.staffMemberId ? e5.staffMemberId : e5._id ? e5._id : e5.custom == null ? null : e5.custom;
5886
+ }
5887
+ function Db(e5, t2, n2, r2) {
5888
+ return e5.custom == null ? e5.staffMemberId ? n2[e5.staffMemberId] ?? null : e5.businessLocationId ? r2[e5.businessLocationId] ?? null : e5.duration ? e5.duration.name ?? Ey(e5.duration.minutes, t2) : null : e5.custom;
5883
5889
  }
5884
- function Eb({ service: e5, masterEvents: t2, locale: n2, timeZone: r2, now: i2 }) {
5885
- let a2 = Tb(e5, t2, i2), o2 = t2[0]?.timeZone ?? r2 ?? `UTC`, s2 = cb({ service: e5, courseRemainingCapacity: a2?.remainingCapacity ?? null, now: i2 }), c2 = e5?.bookingPolicy?.customPolicyDescription;
5886
- return { serviceId: e5?._id ?? null, serviceSlug: e5?.mainSlug?.name ?? null, serviceName: e5?.name ?? null, serviceDescription: e5?.description ?? null, serviceTagLine: e5?.tagLine ?? null, serviceType: e5?.type ?? null, serviceDefaultDuration: e5 ? fy(Qm(e5), n2) : null, serviceImage: e5 ? Qy(e5) : null, serviceCtaState: vb({ serviceType: e5?.type ?? null, requireManualApproval: !!e5?.onlineBooking?.requireManualApproval, courseFull: pb(a2?.remainingCapacity ?? null), tooLateToBook: e5 ? _b(e5, i2) : false }), servicePrice: Cb(e5, n2), isVariedService: e5 ? Wm(e5) : false, hasAddOns: e5 ? Km(e5) : false, isConferenceEnabled: !!e5?.conferencing?.enabled, offeredDays: db(t2), courseAvailability: a2, courseStartDate: e5?.schedule?.firstSessionStart ? gv(new Date(e5.schedule.firstSessionStart), o2) : null, courseEndDate: e5?.schedule?.lastSessionEnd ? gv(new Date(e5.schedule.lastSessionEnd), o2) : null, staffMembers: wb(e5), coverImage: e5 ? $y(e5) : void 0, gallery: rv(e5), serviceLocations: nb(e5), policyDescription: c2?.enabled ? c2.description ?? null : null, serviceBookability: s2, displayTimeZone: o2 };
5890
+ function Ob(e5) {
5891
+ let t2 = {};
5892
+ for (let n2 of e5) n2.staffMemberId && (t2[n2.staffMemberId] = n2.name ?? ``);
5893
+ return t2;
5894
+ }
5895
+ function kb(e5) {
5896
+ let t2 = {};
5897
+ for (let n2 of e5) n2.id && (t2[n2.id] = n2.label);
5898
+ return t2;
5887
5899
  }
5888
- function Db(e5) {
5900
+ function Ab(e5) {
5901
+ return e5?.options?.values?.[0]?.type === jl.STAFF_MEMBER;
5902
+ }
5903
+ function jb(e5, { locale: t2, staffMembers: n2 = [], businessLocations: r2 = [] }) {
5904
+ let i2 = e5?.options?.values?.[0];
5905
+ if (!i2) return null;
5906
+ let a2 = Ob(n2), o2 = kb(r2), s2 = (e5?.variants?.values ?? []).map((e6) => {
5907
+ let n3 = e6.choices?.[0];
5908
+ return { choiceId: n3 ? Eb(n3) : null, label: n3 ? Db(n3, t2, a2, o2) : null, price: hy(e6.price, t2), priceAmount: e6.price?.value ?? null, durationMinutes: n3?.duration?.minutes ?? null, durationName: n3?.duration?.name ?? null, businessLocationId: n3?.businessLocationId ?? null };
5909
+ });
5910
+ return { optionId: i2._id ?? null, type: i2.type ?? null, name: i2.customData?.name || i2.durationData?.name || null, choices: s2 };
5911
+ }
5912
+ function Mb(e5) {
5889
5913
  let t2 = e5.schedule?.availabilityConstraints?.durations;
5890
5914
  if (!Vm(e5.type) || !Array.isArray(t2)) return false;
5891
5915
  let n2 = t2.map((e6) => typeof e6 == `number` ? e6 : e6?.minutes);
5892
5916
  return new Set(n2).size > 1;
5893
5917
  }
5894
- function Ob(e5) {
5918
+ function Nb(e5) {
5895
5919
  if (!Vm(e5.type)) return false;
5896
5920
  let t2 = new Set(e5.addOnGroups?.flatMap((e6) => e6.addOnIds ?? []));
5897
5921
  return !!e5.addOnDetails?.some((e6) => e6.addOnId && t2.has(e6.addOnId) && (e6.durationInMinutes ?? 0) > 0);
5898
5922
  }
5899
- function kb(e5) {
5900
- return Db(e5) || Ob(e5);
5923
+ function Pb(e5) {
5924
+ return Mb(e5) || Nb(e5);
5901
5925
  }
5902
- var Ab = ns(`@wix/site-service-lightbox`);
5903
- function jb({ service: e5, ...t2 }) {
5926
+ var Fb = ns(`@wix/site-service-lightbox`);
5927
+ function Ib({ service: e5, ...t2 }) {
5904
5928
  return { ...t2, serviceType: e5?.type ?? t2.serviceType };
5905
5929
  }
5906
- function Mb(e5) {
5907
- let t2 = Nb(e5);
5930
+ function Lb(e5) {
5931
+ let t2 = Rb(e5);
5908
5932
  if (!t2) return null;
5909
5933
  let [n2, r2] = t2;
5910
5934
  return { pageId: n2, slug: r2.path };
5911
5935
  }
5912
- function Nb(e5) {
5936
+ function Rb(e5) {
5913
5937
  let t2 = Object.entries(e5).filter(([, e6]) => e6.popup), n2 = t2.find(([e6, t3]) => e6 === `95a79598-f5d6-4902-877d-35f31f144b7b` || t3.appPageId === `95a79598-f5d6-4902-877d-35f31f144b7b`);
5914
5938
  if (n2) return n2;
5915
5939
  let r2 = t2.filter(([, e6]) => e6.appDefinitionId === Is);
5916
5940
  return r2.length === 1 ? r2[0] : null;
5917
5941
  }
5918
- function Pb(e5) {
5919
- let t2 = e5(Ab);
5942
+ function zb(e5) {
5943
+ let t2 = e5(Fb);
5920
5944
  return { open: ({ slug: e6 }, n2) => t2.open({ slug: e6, payload: n2 }), close: () => t2.close(), getContext: () => t2.getPayload() };
5921
5945
  }
5922
- function Fb() {
5946
+ function Bb() {
5923
5947
  let e5 = gs();
5924
5948
  return (0, import_react.useMemo)(() => {
5925
- let t2 = null, n2 = (e6) => (t2 ??= Pb(e6), t2), r2 = () => {
5949
+ let t2 = null, n2 = (e6) => (t2 ??= zb(e6), t2), r2 = () => {
5926
5950
  if (!e5) throw Error(`Services are not available outside a ServicesManagerProvider`);
5927
5951
  return e5;
5928
5952
  };
5929
5953
  return { open: async (e6) => {
5930
- let t3 = r2(), i2 = Mb(t3(Ns).pages);
5954
+ let t3 = r2(), i2 = Lb(t3(Ns).pages);
5931
5955
  if (!i2) throw Error(`Preferences popup page was not found among the site pages`);
5932
5956
  await n2(t3).open(i2, e6);
5933
5957
  }, close: () => n2(r2()).close(), getContext: () => n2(r2()).getContext() ?? null };
5934
5958
  }, [e5]);
5935
5959
  }
5936
- function Ib(e5, t2) {
5937
- return Wm(e5) ? t2 ?? void 0 : Db(e5) ? void 0 : null;
5960
+ function Vb(e5, t2) {
5961
+ return Wm(e5) ? t2 ?? void 0 : Mb(e5) ? void 0 : null;
5938
5962
  }
5939
- function Lb(e5) {
5940
- return { serviceId: e5.serviceId, staff: zb(e5), variantChoiceId: T_(e5)[0], addOns: j_(e5).map((e6) => ({ addOnId: e6.id, quantity: e6.quantity ?? 1 })) };
5963
+ function Hb(e5) {
5964
+ return { serviceId: e5.serviceId, staff: Wb(e5), variantChoiceId: T_(e5)[0], addOns: j_(e5).map((e6) => ({ addOnId: e6.id, quantity: e6.quantity ?? 1 })) };
5941
5965
  }
5942
- function Rb({ service: e5, pricingOption: t2, selection: n2, multiServiceAppointmentsEnabled: r2, basketSelections: i2, openAtBasket: a2 }) {
5943
- return { serviceId: e5?._id ?? void 0, service: e5 ?? void 0, variants: e5 ? Ib(e5, t2) : void 0, staff: zb(n2), locationId: n2.locationId ?? void 0, variantChoiceId: T_(n2)[0], addOns: j_(n2).map((e6) => ({ addOnId: e6.id, quantity: e6.quantity ?? 1 })), multiServiceAppointmentsEnabled: r2, ...i2?.length ? { basket: i2.map(Lb) } : {}, ...a2 ? { openAtBasket: a2 } : {} };
5966
+ function Ub({ service: e5, pricingOption: t2, selection: n2, multiServiceAppointmentsEnabled: r2, basketSelections: i2, openAtBasket: a2 }) {
5967
+ return { serviceId: e5?._id ?? void 0, service: e5 ?? void 0, variants: e5 ? Vb(e5, t2) : void 0, staff: Wb(n2), locationId: n2.locationId ?? void 0, variantChoiceId: T_(n2)[0], addOns: j_(n2).map((e6) => ({ addOnId: e6.id, quantity: e6.quantity ?? 1 })), multiServiceAppointmentsEnabled: r2, ...i2?.length ? { basket: i2.map(Hb) } : {}, ...a2 ? { openAtBasket: a2 } : {} };
5944
5968
  }
5945
- function zb(e5) {
5969
+ function Wb(e5) {
5946
5970
  let t2 = x_(e5);
5947
5971
  if (t2) return t2.anyResource && e5.requestedGender ? { ...t2, requestedGender: e5.requestedGender } : t2;
5948
5972
  }
5949
- var Bb = ns(`@wix/site-service-locale`);
5950
- var Vb = ms(`@wix/viewer-service-multilingual`);
5951
- var Hb = `en`;
5952
- function Ub() {
5953
- let e5 = ws(Bb), t2 = ws(Vb);
5954
- return t2?.multilingualEnabled && t2.currentLocale?.regionalFormat || e5?.locale || e5?.language || Hb;
5973
+ var Gb = ns(`@wix/site-service-locale`);
5974
+ var Kb = ms(`@wix/viewer-service-multilingual`);
5975
+ var qb = `en`;
5976
+ function Jb() {
5977
+ let e5 = ws(Gb), t2 = ws(Kb);
5978
+ return t2?.multilingualEnabled && t2.currentLocale?.regionalFormat || e5?.locale || e5?.language || qb;
5955
5979
  }
5956
- function Wb() {
5980
+ function Yb() {
5957
5981
  try {
5958
5982
  return qo.getLanguage() ?? `en`;
5959
5983
  } catch {
5960
5984
  return `en`;
5961
5985
  }
5962
5986
  }
5963
- function Gb() {
5964
- let e5 = ws(Bb), t2 = ws(Vb);
5965
- return t2?.multilingualEnabled && t2.currentLocale?.languageCode || e5?.language || Wb();
5987
+ function Xb() {
5988
+ let e5 = ws(Gb), t2 = ws(Kb);
5989
+ return t2?.multilingualEnabled && t2.currentLocale?.languageCode || e5?.language || Yb();
5966
5990
  }
5967
- function Kb() {
5991
+ function Zb() {
5968
5992
  return (0, import_services_manager_react.useService)(Fs).currency;
5969
5993
  }
5970
- function qb() {
5971
- return globalThis.commonConfig?.currency;
5972
- }
5973
- function Jb(e5) {
5974
- let t2 = globalThis.window;
5975
- if (!t2) return () => {
5976
- };
5977
- let n2 = t2.navigation, r2 = true, i2 = () => queueMicrotask(() => {
5978
- r2 && e5();
5979
- });
5980
- return n2?.addEventListener(`currententrychange`, i2), t2.addEventListener(`popstate`, e5), () => {
5981
- r2 = false, n2?.removeEventListener(`currententrychange`, i2), t2.removeEventListener(`popstate`, e5);
5982
- };
5994
+ function Qb() {
5995
+ return ws(Gb)?.currency;
5983
5996
  }
5984
- var Yb = /^[A-Z]{3}$/;
5985
- function Xb(e5) {
5986
- return Yb.test(e5) ? typeof Intl.supportedValuesOf != `function` || Intl.supportedValuesOf(`currency`).includes(e5) : false;
5997
+ var $b = /^[A-Z]{3}$/;
5998
+ function ex(e5) {
5999
+ return $b.test(e5) ? typeof Intl.supportedValuesOf != `function` || Intl.supportedValuesOf(`currency`).includes(e5) : false;
5987
6000
  }
5988
- function Zb(e5) {
6001
+ function tx(e5) {
5989
6002
  let t2 = e5?.toUpperCase();
5990
- return t2 && Xb(t2) ? t2 : null;
6003
+ return t2 && ex(t2) ? t2 : null;
5991
6004
  }
5992
- function Qb(e5, t2) {
5993
- let n2 = Zb(e5);
5994
- return n2 && n2 !== Zb(t2) ? n2 : null;
6005
+ function nx(e5, t2) {
6006
+ let n2 = tx(e5);
6007
+ return n2 && n2 !== tx(t2) ? n2 : null;
5995
6008
  }
5996
- function $b() {
5997
- let e5 = (0, import_react.useSyncExternalStore)(Jb, qb, qb), t2 = Kb();
5998
- return (0, import_react.useDeferredValue)(Qb(e5, t2));
6009
+ function rx() {
6010
+ let e5 = Qb(), t2 = Zb();
6011
+ return (0, import_react.useDeferredValue)(nx(e5, t2));
5999
6012
  }
6000
- var ex = ns(`@wix/site-service-warmup-data`);
6001
- function tx() {
6013
+ var ix = ns(`@wix/site-service-warmup-data`);
6014
+ function ax() {
6002
6015
  try {
6003
6016
  return (0, import_services_manager_react.useGetService)();
6004
6017
  } catch {
6005
6018
  return null;
6006
6019
  }
6007
6020
  }
6008
- function nx(e5) {
6021
+ function ox(e5) {
6009
6022
  try {
6010
- return e5 ? e5(ex) : null;
6023
+ return e5 ? e5(ix) : null;
6011
6024
  } catch {
6012
6025
  return null;
6013
6026
  }
6014
6027
  }
6015
- function rx() {
6016
- let e5 = nx(tx()), t2 = typeof window > `u`;
6028
+ function sx() {
6029
+ let e5 = ox(ax()), t2 = typeof window > `u`;
6017
6030
  return { scope: e5 ?? void 0, get: async (n2) => {
6018
6031
  if (t2 || !e5) return null;
6019
6032
  try {
@@ -6028,75 +6041,69 @@ function rx() {
6028
6041
  }
6029
6042
  } };
6030
6043
  }
6031
- function ix() {
6032
- let [e5, t2] = (0, import_react.useState)(void 0);
6033
- return (0, import_react.useEffect)(() => {
6034
- (0, import_react.startTransition)(() => t2(Date.now()));
6035
- }, []), e5;
6036
- }
6037
- var ax = `bookings-uou`;
6038
- function ox(e5) {
6044
+ var cx = `bookings-uou`;
6045
+ function lx(e5) {
6039
6046
  return e5 ? `:currency-${e5}` : ``;
6040
6047
  }
6041
- function sx(e5, t2, n2, r2) {
6042
- return `${ax}:${e5}:service:${n2}:${r2}${ox(t2)}`;
6048
+ function ux(e5, t2, n2, r2) {
6049
+ return `${cx}:${e5}:service:${n2}:${r2}${lx(t2)}`;
6043
6050
  }
6044
- function cx(e5, t2, n2) {
6045
- return `${ax}:${e5}:multi-service-appointment:${encodeURIComponent(JSON.stringify(n2))}${ox(t2)}`;
6051
+ function dx(e5, t2, n2) {
6052
+ return `${cx}:${e5}:multi-service-appointment:${encodeURIComponent(JSON.stringify(n2))}${lx(t2)}`;
6046
6053
  }
6047
- function lx(e5, t2, n2, r2) {
6048
- return `${ax}:${e5}:service-variants:${n2}:refresh-${r2}${ox(t2)}`;
6054
+ function fx(e5, t2, n2, r2) {
6055
+ return `${cx}:${e5}:service-variants:${n2}:refresh-${r2}${lx(t2)}`;
6049
6056
  }
6050
- function ux(e5, t2, n2, r2) {
6051
- return `${ax}:${e5}:services-variants:ids-${encodeURIComponent(JSON.stringify([...n2].sort()))}:refresh-${r2}${ox(t2)}`;
6057
+ function px(e5, t2, n2, r2) {
6058
+ return `${cx}:${e5}:services-variants:ids-${encodeURIComponent(JSON.stringify([...n2].sort()))}:refresh-${r2}${lx(t2)}`;
6052
6059
  }
6053
- function dx() {
6054
- return `${ax}:bookings-settings`;
6060
+ function mx() {
6061
+ return `${cx}:bookings-settings`;
6055
6062
  }
6056
- var fx = 5e3;
6057
- var px = 100;
6058
- var mx = `wix-warmup-data`;
6059
- var hx = null;
6060
- function gx(e5) {
6063
+ var hx = 5e3;
6064
+ var gx = 100;
6065
+ var _x = `wix-warmup-data`;
6066
+ var vx = null;
6067
+ function yx(e5) {
6061
6068
  if (typeof document < `u`) try {
6062
- let t2 = document.getElementById(mx)?.textContent;
6063
- return t2 ? (hx?.text !== t2 && (hx = { text: t2, data: JSON.parse(t2).builderComponentsWarmupData ?? {} }), hx.data[e5] ?? void 0) : void 0;
6069
+ let t2 = document.getElementById(_x)?.textContent;
6070
+ return t2 ? (vx?.text !== t2 && (vx = { text: t2, data: JSON.parse(t2).builderComponentsWarmupData ?? {} }), vx.data[e5] ?? void 0) : void 0;
6064
6071
  } catch {
6065
6072
  return;
6066
6073
  }
6067
6074
  }
6068
- var _x = () => ({ promises: /* @__PURE__ */ new Map(), invalidatedWarmup: /* @__PURE__ */ new Set() });
6069
- var vx = _x();
6070
- var yx = /* @__PURE__ */ new WeakMap();
6071
- var bx = /* @__PURE__ */ new WeakMap();
6072
- function xx(e5) {
6073
- if (!e5) return vx;
6074
- let t2 = yx.get(e5);
6075
- return t2 || (t2 = _x(), yx.set(e5, t2)), t2;
6075
+ var bx = () => ({ promises: /* @__PURE__ */ new Map(), invalidatedWarmup: /* @__PURE__ */ new Set() });
6076
+ var xx = bx();
6077
+ var Sx = /* @__PURE__ */ new WeakMap();
6078
+ var Cx = /* @__PURE__ */ new WeakMap();
6079
+ function wx(e5) {
6080
+ if (!e5) return xx;
6081
+ let t2 = Sx.get(e5);
6082
+ return t2 || (t2 = bx(), Sx.set(e5, t2)), t2;
6076
6083
  }
6077
- function Sx({ key: e5, warmupData: t2, fetchData: n2, refresh: r2 = false }) {
6084
+ function Tx({ key: e5, warmupData: t2, fetchData: n2, refresh: r2 = false }) {
6078
6085
  if (e5 === null) return n2();
6079
6086
  if (typeof window > `u`) {
6080
6087
  let r3 = () => n2().then((n3) => (t2.set(e5, n3), n3)), { scope: i3 } = t2;
6081
6088
  if (!i3) return r3();
6082
- let a3 = bx.get(i3);
6083
- a3 || (a3 = /* @__PURE__ */ new Map(), bx.set(i3, a3));
6089
+ let a3 = Cx.get(i3);
6090
+ a3 || (a3 = /* @__PURE__ */ new Map(), Cx.set(i3, a3));
6084
6091
  let o3 = a3.get(e5);
6085
6092
  if (o3) return o3;
6086
6093
  let s3 = r3();
6087
6094
  return a3.set(e5, s3), s3.catch(() => a3.delete(e5)), s3;
6088
6095
  }
6089
- let i2 = xx(t2.scope), a2 = Date.now();
6096
+ let i2 = wx(t2.scope), a2 = Date.now();
6090
6097
  for (let [e6, t3] of i2.promises) t3.expiresAt <= a2 && i2.promises.delete(e6);
6091
6098
  let o2 = i2.promises.get(e5);
6092
6099
  if (o2 && !r2) return o2.promise;
6093
6100
  r2 && i2.invalidatedWarmup.add(e5);
6094
6101
  let s2 = !i2.invalidatedWarmup.has(e5);
6095
6102
  if (s2) {
6096
- let t3 = gx(e5);
6103
+ let t3 = yx(e5);
6097
6104
  if (t3 !== void 0) {
6098
6105
  let n3 = ks(t3);
6099
- return i2.promises.set(e5, { promise: n3, expiresAt: a2 + fx }), n3;
6106
+ return i2.promises.set(e5, { promise: n3, expiresAt: a2 + hx }), n3;
6100
6107
  }
6101
6108
  }
6102
6109
  let c2 = (async () => {
@@ -6106,15 +6113,15 @@ function Sx({ key: e5, warmupData: t2, fetchData: n2, refresh: r2 = false }) {
6106
6113
  }
6107
6114
  return n2();
6108
6115
  })();
6109
- i2.promises.size >= px && i2.promises.delete(i2.promises.keys().next().value);
6116
+ i2.promises.size >= gx && i2.promises.delete(i2.promises.keys().next().value);
6110
6117
  let l2 = { promise: c2, expiresAt: 1 / 0 };
6111
6118
  return i2.promises.set(e5, l2), c2.then(() => {
6112
- l2.expiresAt = Date.now() + fx;
6119
+ l2.expiresAt = Date.now() + hx;
6113
6120
  }, () => {
6114
6121
  i2.promises.get(e5) === l2 && i2.promises.delete(e5);
6115
6122
  }), c2;
6116
6123
  }
6117
- function Cx(e5) {
6124
+ function Ex(e5) {
6118
6125
  (0, import_react.useEffect)(() => {
6119
6126
  let t2 = (t3) => {
6120
6127
  t3.persisted && e5();
@@ -6122,73 +6129,73 @@ function Cx(e5) {
6122
6129
  return window.addEventListener(`pageshow`, t2), () => window.removeEventListener(`pageshow`, t2);
6123
6130
  }, [e5]);
6124
6131
  }
6125
- var wx = () => () => {
6132
+ var Dx = () => () => {
6126
6133
  };
6127
- function Tx() {
6134
+ function Ox() {
6128
6135
  let e5;
6129
6136
  return { inBrowser: () => e5 ??= false, onServer: () => e5 ??= true };
6130
6137
  }
6131
- function Ex() {
6132
- let [e5] = (0, import_react.useState)(Tx);
6133
- return (0, import_react.useSyncExternalStore)(wx, e5.inBrowser, e5.onServer);
6138
+ function kx() {
6139
+ let [e5] = (0, import_react.useState)(Ox);
6140
+ return (0, import_react.useSyncExternalStore)(Dx, e5.inBrowser, e5.onServer);
6134
6141
  }
6135
- var Dx = Symbol(`landing pending`);
6136
- function Ox() {
6137
- return !Ex();
6142
+ var Ax = Symbol(`landing pending`);
6143
+ function jx() {
6144
+ return !kx();
6138
6145
  }
6139
- function kx() {
6140
- let { searchParams: e5 } = ps(), t2 = Ox(), [n2, i2] = (0, import_react.useState)(t2);
6146
+ function Mx() {
6147
+ let { searchParams: e5 } = ps(), t2 = jx(), [n2, i2] = (0, import_react.useState)(t2);
6141
6148
  return (0, import_react.useEffect)(() => {
6142
6149
  (0, import_react.startTransition)(() => i2(true));
6143
- }, []), n2 ? a_(e5) : Dx;
6150
+ }, []), n2 ? a_(e5) : Ax;
6144
6151
  }
6145
- function Ax() {
6146
- let e5 = kx();
6147
- return (0, import_react.useMemo)(() => e5 === Dx ? Dx : r_(e5) ?? `none`, [e5]);
6152
+ function Nx() {
6153
+ let e5 = Mx();
6154
+ return (0, import_react.useMemo)(() => e5 === Ax ? Ax : r_(e5) ?? `none`, [e5]);
6148
6155
  }
6149
- function jx(e5) {
6150
- return e5 === Dx || e5 === `none` ? null : e5;
6156
+ function Px(e5) {
6157
+ return e5 === Ax || e5 === `none` ? null : e5;
6151
6158
  }
6152
- var Mx = { displayTimeZonePolicy: { basedOn: Nm.BUSINESS_TIME_ZONE, customerCanChange: false }, multiServiceAppointmentsEnabled: false };
6153
- async function Nx() {
6159
+ var Fx = { displayTimeZonePolicy: { basedOn: Nm.BUSINESS_TIME_ZONE, customerCanChange: false }, multiServiceAppointmentsEnabled: false };
6160
+ async function Ix() {
6154
6161
  try {
6155
6162
  let e5 = await Im();
6156
6163
  return { displayTimeZonePolicy: { basedOn: e5.displayTimeZone?.basedOn ?? Nm.BUSINESS_TIME_ZONE, customerCanChange: e5.displayTimeZone?.customerCanChange ?? false }, multiServiceAppointmentsEnabled: e5.multiServiceAppointments?.enabled ?? false };
6157
6164
  } catch (e5) {
6158
- return $o(e5, { feature: Zo.bookingsSettings, action: `fetch-bookings-settings`, level: `warning` }), Mx;
6165
+ return $o(e5, { feature: Zo.bookingsSettings, action: `fetch-bookings-settings`, level: `warning` }), Fx;
6159
6166
  }
6160
6167
  }
6161
- var Px = { isLoading: true };
6162
- var Fx = (0, import_react.createContext)(null);
6163
- var Ix = `useBookingsSettingsContext must be used within BookingsSettingsProvider`;
6164
- function Lx() {
6165
- let e5 = (0, import_react.useContext)(Fx);
6166
- if (!e5) throw Error(Ix);
6168
+ var Lx = { isLoading: true };
6169
+ var Rx = (0, import_react.createContext)(null);
6170
+ var zx = `useBookingsSettingsContext must be used within BookingsSettingsProvider`;
6171
+ function Bx() {
6172
+ let e5 = (0, import_react.useContext)(Rx);
6173
+ if (!e5) throw Error(zx);
6167
6174
  return e5;
6168
6175
  }
6169
- function Rx() {
6170
- return Lx().isLoading;
6176
+ function Vx() {
6177
+ return Bx().isLoading;
6171
6178
  }
6172
- function zx({ children: e5 }) {
6173
- return (0, import_jsx_runtime.jsx)(Fx.Provider, { value: Px, children: e5 });
6179
+ function Hx({ children: e5 }) {
6180
+ return (0, import_jsx_runtime.jsx)(Rx.Provider, { value: Lx, children: e5 });
6174
6181
  }
6175
- function Bx(e5) {
6182
+ function Ux(e5) {
6176
6183
  return e5.basedOn === Nm.CUSTOMER_TIME_ZONE ? Intl.DateTimeFormat().resolvedOptions().timeZone : void 0;
6177
6184
  }
6178
- function Vx() {
6179
- let e5 = Lx();
6180
- return e5.isLoading ? void 0 : Bx(e5.displayTimeZonePolicy);
6185
+ function Wx() {
6186
+ let e5 = Bx();
6187
+ return e5.isLoading ? void 0 : Ux(e5.displayTimeZonePolicy);
6181
6188
  }
6182
- function Hx({ settingsPromise: e5, children: t2 }) {
6189
+ function Gx({ settingsPromise: e5, children: t2 }) {
6183
6190
  let n2 = Os(e5), r2 = (0, import_react.useMemo)(() => ({ isLoading: false, ...n2 }), [n2]);
6184
- return (0, import_jsx_runtime.jsx)(Fx.Provider, { value: r2, children: t2 });
6191
+ return (0, import_jsx_runtime.jsx)(Rx.Provider, { value: r2, children: t2 });
6185
6192
  }
6186
- function Ux({ bookingsSettings: e5, children: n2 }) {
6187
- let r2 = rx(), [i2] = (0, import_react.useState)(() => e5 ? null : Sx({ key: dx(), warmupData: r2, fetchData: Nx }));
6188
- return e5 ? (0, import_jsx_runtime.jsx)(Fx.Provider, { value: { isLoading: false, ...e5 }, children: n2 }) : (0, import_jsx_runtime.jsx)(import_react.Suspense, { fallback: (0, import_jsx_runtime.jsx)(Fx.Provider, { value: Px, children: n2 }), children: (0, import_jsx_runtime.jsx)(Hx, { settingsPromise: i2, children: n2 }) });
6193
+ function Kx({ bookingsSettings: e5, children: n2 }) {
6194
+ let r2 = sx(), [i2] = (0, import_react.useState)(() => e5 ? null : Tx({ key: mx(), warmupData: r2, fetchData: Ix }));
6195
+ return e5 ? (0, import_jsx_runtime.jsx)(Rx.Provider, { value: { isLoading: false, ...e5 }, children: n2 }) : (0, import_jsx_runtime.jsx)(import_react.Suspense, { fallback: (0, import_jsx_runtime.jsx)(Rx.Provider, { value: Lx, children: n2 }), children: (0, import_jsx_runtime.jsx)(Gx, { settingsPromise: i2, children: n2 }) });
6189
6196
  }
6190
- function Wx({ isLoading: e5, hasError: t2, bookingsSettingsLoading: n2, rescheduleRequest: r2 = null, editingSurface: i2 = false, children: a2 }) {
6191
- let o2 = r2 ? { status: `loading`, booking: null, validUntil: null, planName: null } : null, s2 = { service: null, serviceName: null, serviceDescription: null, serviceTagLine: null, serviceDefaultDuration: null, serviceImage: null, serviceSlug: null, servicePageLink: null, serviceId: null, serviceType: null, servicePrice: xb, isVariedService: false, serviceOptionsAndVariants: null, pricingOption: null, isLoadingServiceOptionsAndVariants: e5, hasAddOns: false, isConferenceEnabled: false, offeredDays: [], courseAvailability: null, courseStartDate: null, courseEndDate: null, staffMembers: [], coverImage: void 0, gallery: [], serviceLocations: [], policyDescription: null, serviceBookability: { state: rb.AVAILABLE, isAvailableForBooking: false, bookingOpensAt: null }, displayTimeZone: `UTC`, isAvailableForBooking: () => false, hasPolicyDescription: () => false, hasCoverImage: () => false, hasGalleryImages: () => false, isVariantDuration: () => false, isLoading: e5, hasError: t2, locale: `en-US`, selectStaffMember: () => {
6197
+ function qx({ isLoading: e5, hasError: t2, bookingsSettingsLoading: n2, rescheduleRequest: r2 = null, editingSurface: i2 = false, children: a2 }) {
6198
+ let o2 = r2 ? { status: `loading`, booking: null, validUntil: null, planName: null } : null, s2 = { service: null, serviceName: null, serviceDescription: null, serviceTagLine: null, serviceDefaultDuration: null, serviceImage: null, serviceSlug: null, servicePageLink: null, serviceId: null, serviceType: null, servicePrice: by, isVariedService: false, serviceOptionsAndVariants: null, pricingOption: null, isLoadingServiceOptionsAndVariants: e5, hasAddOns: false, isConferenceEnabled: false, offeredDays: [], courseAvailability: null, courseStartDate: null, courseEndDate: null, staffMembers: [], coverImage: void 0, gallery: [], serviceLocations: [], policyDescription: null, serviceBookability: { state: Zv.AVAILABLE, isAvailableForBooking: false, bookingOpensAt: null }, displayTimeZone: `UTC`, isAvailableForBooking: () => false, hasPolicyDescription: () => false, hasCoverImage: () => false, hasGalleryImages: () => false, isVariantDuration: () => false, isLoading: e5, hasError: t2, locale: `en-US`, selectStaffMember: () => {
6192
6199
  }, clearSelection: () => {
6193
6200
  }, clearStaffMember: () => {
6194
6201
  }, selection: u_(``), isSelectionPending: e5, selectionTimezone: void 0, setVariant: () => {
@@ -6203,90 +6210,90 @@ function Wx({ isLoading: e5, hasError: t2, bookingsSettingsLoading: n2, reschedu
6203
6210
  }, navigateToMultiServiceForm: () => {
6204
6211
  }, resolveNextPageHref: () => null, isNavigating: false, isWaitlistSlotSelected: false, siteId: ``, editingSurface: i2, openPreferences: () => Promise.resolve(), multiServiceAppointmentsEnabled: false, isMultiServiceAppointment: false, multiServiceAppointmentServices: [], multiServiceAppointmentSelections: [], multiServiceAppointmentOptionsAndVariants: {}, multiServiceAppointmentVariantsStatus: `ready`, bookingsSettingsLoading: n2, reschedule: o2, rescheduleBooking: async () => ({ outcome: `failed` }), goHomeAfterReschedule: () => {
6205
6212
  }, canRescheduleToPick: false };
6206
- return (0, import_jsx_runtime.jsx)(ES.Provider, { value: s2, children: a2 });
6213
+ return (0, import_jsx_runtime.jsx)(kS.Provider, { value: s2, children: a2 });
6207
6214
  }
6208
- function Gx({ rescheduleRequest: e5, editingSurface: t2, children: n2 }) {
6209
- return (0, import_jsx_runtime.jsx)(zx, { children: (0, import_jsx_runtime.jsx)(Wx, { isLoading: true, hasError: false, bookingsSettingsLoading: true, rescheduleRequest: e5, editingSurface: t2, children: n2 }) });
6215
+ function Jx({ rescheduleRequest: e5, editingSurface: t2, children: n2 }) {
6216
+ return (0, import_jsx_runtime.jsx)(Hx, { children: (0, import_jsx_runtime.jsx)(qx, { isLoading: true, hasError: false, bookingsSettingsLoading: true, rescheduleRequest: e5, editingSurface: t2, children: n2 }) });
6210
6217
  }
6211
- function Kx({ rescheduleRequest: e5, editingSurface: t2, children: n2 }) {
6212
- let r2 = Rx();
6213
- return (0, import_jsx_runtime.jsx)(Wx, { isLoading: false, hasError: true, bookingsSettingsLoading: r2, rescheduleRequest: e5, editingSurface: t2, children: n2 });
6218
+ function Yx({ rescheduleRequest: e5, editingSurface: t2, children: n2 }) {
6219
+ let r2 = Vx();
6220
+ return (0, import_jsx_runtime.jsx)(qx, { isLoading: false, hasError: true, bookingsSettingsLoading: r2, rescheduleRequest: e5, editingSurface: t2, children: n2 });
6214
6221
  }
6215
- var { RateType: qx } = fu;
6216
- function Jx(e5, t2) {
6217
- if (e5) return t2 ? Vv(e5, t2)?.toISOString() ?? e5 : e5;
6222
+ var { RateType: Xx } = fu;
6223
+ function Zx(e5, t2) {
6224
+ if (e5) return t2 ? nb(e5, t2)?.toISOString() ?? e5 : e5;
6218
6225
  }
6219
- var Yx = { BUSINESS: `OWNER_BUSINESS`, CUSTOM: `OWNER_CUSTOM`, CUSTOMER: `CUSTOM` };
6220
- function Xx(e5) {
6221
- return e5 ? Yx[e5] : Yx.BUSINESS;
6226
+ var Qx = { BUSINESS: `OWNER_BUSINESS`, CUSTOM: `OWNER_CUSTOM`, CUSTOMER: `CUSTOM` };
6227
+ function $x(e5) {
6228
+ return e5 ? Qx[e5] : Qx.BUSINESS;
6222
6229
  }
6223
- function Zx(e5, t2) {
6230
+ function eS(e5, t2) {
6224
6231
  let n2 = x_(e5), r2 = n2 && !n2.anyResource ? n2.staffMemberId : null;
6225
- return { serviceId: e5.serviceId, scheduleId: e5.scheduleId, startDate: Jx(e5.slotStart, t2), endDate: Jx(e5.slotEnd, t2), timezone: t2, eventId: e5.eventId, sessionId: e5.sessionId, location: e5.locationId || e5.locationType ? { ...e5.locationId ? { _id: e5.locationId } : {}, locationType: Xx(e5.locationType) } : void 0, resource: r2 ? { _id: r2 } : void 0, resourceSelections: !r2 && Vm(e5.serviceType) ? [{ resourceTypeId: zs, selectionMethod: `ANY_RESOURCE`, ...n2?.anyResource && e5.requestedGender ? { requestedGender: { gender: e5.requestedGender } } : {} }] : void 0 };
6232
+ return { serviceId: e5.serviceId, scheduleId: e5.scheduleId, startDate: Zx(e5.slotStart, t2), endDate: Zx(e5.slotEnd, t2), timezone: t2, eventId: e5.eventId, sessionId: e5.sessionId, location: e5.locationId || e5.locationType ? { ...e5.locationId ? { _id: e5.locationId } : {}, locationType: $x(e5.locationType) } : void 0, resource: r2 ? { _id: r2 } : void 0, resourceSelections: !r2 && Vm(e5.serviceType) ? [{ resourceTypeId: zs, selectionMethod: `ANY_RESOURCE`, ...n2?.anyResource && e5.requestedGender ? { requestedGender: { gender: e5.requestedGender } } : {} }] : void 0 };
6226
6233
  }
6227
- var Qx = `manage_booking_standalone_page`;
6228
- function $x(e5) {
6234
+ var tS = `manage_booking_standalone_page`;
6235
+ function nS(e5) {
6229
6236
  let t2 = e5.get(i_.bookingId) || null, n2 = e5.get(i_.token) || null;
6230
- return !t2 && !n2 ? null : { bookingId: t2, token: n2, fromManageBookingPage: e5.get(i_.referral) === Qx, redirectUrl: e5.get(i_.rescheduleRedirectUrl) || null };
6237
+ return !t2 && !n2 ? null : { bookingId: t2, token: n2, fromManageBookingPage: e5.get(i_.referral) === tS, redirectUrl: e5.get(i_.rescheduleRedirectUrl) || null };
6231
6238
  }
6232
- function eS(e5, t2, n2, r2 = null) {
6239
+ function rS(e5, t2, n2, r2 = null) {
6233
6240
  if (n2.kind === `class`) return { eventId: e5.eventId };
6234
- let { serviceId: i2, scheduleId: a2, startDate: o2, endDate: s2, location: c2, resource: l2, resourceSelections: u2 } = Zx(e5, t2);
6241
+ let { serviceId: i2, scheduleId: a2, startDate: o2, endDate: s2, location: c2, resource: l2, resourceSelections: u2 } = eS(e5, t2);
6235
6242
  return { serviceId: i2, scheduleId: a2, startDate: o2, endDate: s2, timezone: t2, ...c2 ? { location: { ...c2._id ? { _id: c2._id } : {}, locationType: c2.locationType, ...n2.customAddress !== null && c2.locationType === `CUSTOM` ? { formattedAddress: n2.customAddress } : {} } } : {}, ...l2?._id ? { resource: { _id: l2._id } } : r2 ? { resource: { _id: r2 } } : u2 ? { resourceSelections: u2 } : {} };
6236
6243
  }
6237
- var tS = class extends Error {
6244
+ var iS = class extends Error {
6238
6245
  reason;
6239
6246
  cause;
6240
6247
  constructor(e5, t2) {
6241
6248
  super(`Booking to reschedule not loaded: ${e5}`), this.reason = e5, this.cause = t2;
6242
6249
  }
6243
6250
  };
6244
- var nS = (e5) => e5?.status;
6245
- function rS(e5) {
6251
+ var aS = (e5) => e5?.status;
6252
+ function oS(e5) {
6246
6253
  return e5?.includes(`INDIVIDUAL`) ? `appointment` : e5?.includes(`GROUP`) ? `class` : `other`;
6247
6254
  }
6248
- function iS({ totalParticipants: e5, participantsChoices: t2 }) {
6255
+ function sS({ totalParticipants: e5, participantsChoices: t2 }) {
6249
6256
  return e5 || (t2?.serviceChoices ?? []).reduce((e6, t3) => e6 + (t3.numberOfParticipants ?? 1), 0) || 1;
6250
6257
  }
6251
- function aS(e5) {
6258
+ function cS(e5) {
6252
6259
  if (!e5) return null;
6253
6260
  let t2 = new Date(e5);
6254
6261
  return Number.isNaN(t2.getTime()) ? null : t2.toISOString();
6255
6262
  }
6256
- function oS(e5, t2) {
6263
+ function lS(e5, t2) {
6257
6264
  let { slot: n2, schedule: r2, tags: i2 } = e5.bookedEntity ?? {}, a2 = n2?.location;
6258
- return { bookingId: t2, revision: e5.revision ?? null, serviceId: n2?.serviceId ?? r2?.serviceId ?? null, kind: rS(i2), startDate: aS(e5.startDate), participants: iS(e5), addOnIds: (e5.bookedAddOns ?? []).flatMap((e6) => e6._id ?? []), locationId: a2?._id ?? null, customAddress: a2?.locationType === `CUSTOM` ? a2.formattedAddress ?? `` : null };
6265
+ return { bookingId: t2, revision: e5.revision ?? null, serviceId: n2?.serviceId ?? r2?.serviceId ?? null, kind: oS(i2), startDate: cS(e5.startDate), participants: sS(e5), addOnIds: (e5.bookedAddOns ?? []).flatMap((e6) => e6._id ?? []), locationId: a2?._id ?? null, customAddress: a2?.locationType === `CUSTOM` ? a2.formattedAddress ?? `` : null };
6259
6266
  }
6260
- async function sS({ bookingId: e5, token: t2 }) {
6267
+ async function uS({ bookingId: e5, token: t2 }) {
6261
6268
  let n2;
6262
6269
  try {
6263
6270
  t2 ? n2 = (await Em(t2)).booking : e5 && (n2 = (await eu({ filter: { _id: e5 }, cursorPaging: { limit: 1 } }, {})).extendedBookings?.[0]?.booking);
6264
6271
  } catch (e6) {
6265
- let t3 = nS(e6);
6266
- throw t3 === 404 ? new tS(`notFound`, e6) : new tS(t3 === 403 ? `accessDenied` : `failed`, e6);
6272
+ let t3 = aS(e6);
6273
+ throw t3 === 404 ? new iS(`notFound`, e6) : new iS(t3 === 403 ? `accessDenied` : `failed`, e6);
6267
6274
  }
6268
6275
  let r2 = n2?._id;
6269
- if (!n2 || !r2) throw new tS(`notFound`);
6270
- let i2 = oS(n2, r2);
6276
+ if (!n2 || !r2) throw new iS(`notFound`);
6277
+ let i2 = lS(n2, r2);
6271
6278
  return t2 ? { ...i2, customAddress: null } : i2;
6272
6279
  }
6273
- function cS(e5) {
6280
+ function dS(e5) {
6274
6281
  let t2 = e5?.bookedEntity?.slot;
6275
6282
  return { staffName: t2?.resource?.name || null, locationName: t2?.location?.name || t2?.location?.formattedAddress || null };
6276
6283
  }
6277
- async function lS({ booking: e5, slot: t2, token: n2 }) {
6278
- return cS(n2 ? (await Tm(n2, t2, { revision: e5.revision || `1` })).booking : (await Dm(e5.bookingId, t2, { revision: e5.revision ?? `` })).booking);
6284
+ async function fS({ booking: e5, slot: t2, token: n2 }) {
6285
+ return dS(n2 ? (await Tm(n2, t2, { revision: e5.revision || `1` })).booking : (await Dm(e5.bookingId, t2, { revision: e5.revision ?? `` })).booking);
6279
6286
  }
6280
- var uS = { validUntil: null, planName: null };
6281
- async function dS(e5) {
6287
+ var pS = { validUntil: null, planName: null };
6288
+ async function mS(e5) {
6282
6289
  try {
6283
6290
  let t2 = (await eu({ filter: { _id: e5 }, cursorPaging: { limit: 1 } }, { withEcomTransactions: true })).extendedBookings?.[0]?.transactions?.chargedMembershipPaymentDetails;
6284
- return t2 ? { validUntil: t2.expirationDate ? new Date(t2.expirationDate).toISOString() : null, planName: t2.name?.translated || t2.name?.original || null } : uS;
6291
+ return t2 ? { validUntil: t2.expirationDate ? new Date(t2.expirationDate).toISOString() : null, planName: t2.name?.translated || t2.name?.original || null } : pS;
6285
6292
  } catch (e6) {
6286
- return $o(e6, { feature: Zo.reschedule, action: `fetch-plan-valid-until`, level: `warning` }), uS;
6293
+ return $o(e6, { feature: Zo.reschedule, action: `fetch-plan-valid-until`, level: `warning` }), pS;
6287
6294
  }
6288
6295
  }
6289
- function fS() {
6296
+ function hS() {
6290
6297
  let e5 = gs();
6291
6298
  return (0, import_react.useCallback)(() => {
6292
6299
  if (!e5) return null;
@@ -6297,26 +6304,26 @@ function fS() {
6297
6304
  }
6298
6305
  }, [e5]);
6299
6306
  }
6300
- var pS = ns(`@wix/viewer-service-site-members`);
6301
- function mS() {
6307
+ var gS = ns(`@wix/viewer-service-site-members`);
6308
+ function _S() {
6302
6309
  try {
6303
6310
  return (0, import_services_manager_react.useGetService)();
6304
6311
  } catch {
6305
6312
  return null;
6306
6313
  }
6307
6314
  }
6308
- function hS(e5) {
6315
+ function vS(e5) {
6309
6316
  try {
6310
- return e5 ? e5(pS) : null;
6317
+ return e5 ? e5(gS) : null;
6311
6318
  } catch {
6312
6319
  return null;
6313
6320
  }
6314
6321
  }
6315
- function gS() {
6316
- return hS(mS());
6322
+ function yS() {
6323
+ return vS(_S());
6317
6324
  }
6318
- var _S = typeof window > `u` ? import_react.useEffect : import_react.useLayoutEffect;
6319
- function vS(e5) {
6325
+ var bS = typeof window > `u` ? import_react.useEffect : import_react.useLayoutEffect;
6326
+ function xS(e5) {
6320
6327
  if (!e5) return null;
6321
6328
  try {
6322
6329
  let t2 = new URL(e5);
@@ -6325,99 +6332,96 @@ function vS(e5) {
6325
6332
  return null;
6326
6333
  }
6327
6334
  }
6328
- function yS(e5, { bookable: t2, staffChoiceRequired: n2, timezone: r2, validUntil: i2 }) {
6335
+ function SS(e5, { bookable: t2, staffChoiceRequired: n2, timezone: r2, validUntil: i2 }) {
6329
6336
  if (!I_(e5) || !t2) return false;
6330
6337
  let a2 = x_(e5);
6331
6338
  if (n2 && (!a2 || a2.anyResource)) return false;
6332
- let o2 = e5.slotStart ? Vv(e5.slotStart, r2) : null;
6339
+ let o2 = e5.slotStart ? nb(e5.slotStart, r2) : null;
6333
6340
  return !i2 || !o2 || o2.getTime() <= Date.parse(i2);
6334
6341
  }
6335
- var bS = { validUntil: null, planName: null };
6336
- var xS = { status: `loading`, booking: null, ...bS };
6337
- async function SS(e5) {
6342
+ var CS = { validUntil: null, planName: null };
6343
+ var wS = { status: `loading`, booking: null, ...CS };
6344
+ async function TS(e5) {
6338
6345
  return e5.getMemberDetails ? !!await e5.getMemberDetails().catch(() => null) : !!e5.isInitiallyLoggedIn;
6339
6346
  }
6340
- async function CS(e5, t2) {
6347
+ async function ES(e5, t2) {
6341
6348
  let { bookingId: n2, token: r2 } = e5;
6342
- if (!r2 && !(t2 && await SS(t2)) && !(t2 && await t2.promptLogin({ mode: `login` }).then(() => true, () => false))) return { status: `loginRequired`, booking: null, ...bS };
6349
+ if (!r2 && !(t2 && await TS(t2)) && !(t2 && await t2.promptLogin({ mode: `login` }).then(() => true, () => false))) return { status: `loginRequired`, booking: null, ...CS };
6343
6350
  try {
6344
- let [t3, i2] = await Promise.all([sS(e5), n2 && !r2 ? dS(n2) : bS]);
6351
+ let [t3, i2] = await Promise.all([uS(e5), n2 && !r2 ? mS(n2) : CS]);
6345
6352
  return { status: `ready`, booking: t3, validUntil: i2.validUntil, planName: i2.planName };
6346
6353
  } catch (e6) {
6347
- return $o(e6, { feature: Zo.reschedule, action: `fetch-booking` }), { status: e6 instanceof tS ? e6.reason : `failed`, booking: null, ...bS };
6354
+ return $o(e6, { feature: Zo.reschedule, action: `fetch-booking` }), { status: e6 instanceof iS ? e6.reason : `failed`, booking: null, ...CS };
6348
6355
  }
6349
6356
  }
6350
- var wS = /* @__PURE__ */ new Map();
6351
- function TS(e5, t2, n2) {
6352
- let r2 = `${e5.bookingId ?? ``}|${e5.token ?? ``}`, i2 = wS.get(r2) ?? { load: CS(e5, t2), users: 0 };
6353
- return i2.users += 1, wS.set(r2, i2), i2.load.then(n2), () => {
6354
- --i2.users, i2.users === 0 && wS.get(r2) === i2 && wS.delete(r2);
6357
+ var DS = /* @__PURE__ */ new Map();
6358
+ function OS(e5, t2, n2) {
6359
+ let r2 = `${e5.bookingId ?? ``}|${e5.token ?? ``}`, i2 = DS.get(r2) ?? { load: ES(e5, t2), users: 0 };
6360
+ return i2.users += 1, DS.set(r2, i2), i2.load.then(n2), () => {
6361
+ --i2.users, i2.users === 0 && DS.get(r2) === i2 && DS.delete(r2);
6355
6362
  };
6356
6363
  }
6357
- var ES = (0, import_react.createContext)(null);
6358
- var DS = `useServiceContext must be used within ServiceContextProvider`;
6359
- function OS(e5 = false) {
6360
- let t2 = (0, import_react.useContext)(ES);
6361
- if (!t2 && !e5) throw Error(DS);
6364
+ var kS = (0, import_react.createContext)(null);
6365
+ var AS = `useServiceContext must be used within ServiceContextProvider`;
6366
+ function jS(e5 = false) {
6367
+ let t2 = (0, import_react.useContext)(kS);
6368
+ if (!t2 && !e5) throw Error(AS);
6362
6369
  return t2;
6363
6370
  }
6364
- function kS(e5, t2, n2) {
6371
+ function MS(e5, t2, n2) {
6365
6372
  if (e5) return { by: `slug`, value: e5 };
6366
6373
  let r2 = t2?.services ?? [];
6367
6374
  return o_(t2) ? { by: `multi`, serviceIds: r2.map(({ serviceId: e6 }) => e6) } : r2.length === 1 ? { by: `id`, value: r2[0].serviceId } : n2 ? { by: `id`, value: n2 } : { by: `none` };
6368
6375
  }
6369
- var AS = (e5) => void 0;
6370
- var jS = Symbol(`unseeded`);
6371
- var MS = (e5, t2) => r_(a_(t2))?.services.find((t3) => t3.serviceId === e5);
6372
- var NS = (e5, t2) => {
6373
- let n2 = MS(e5, t2) ?? u_(e5), r2 = AS(e5);
6376
+ var NS = (e5) => void 0;
6377
+ var PS = Symbol(`unseeded`);
6378
+ var FS = (e5, t2) => r_(a_(t2))?.services.find((t3) => t3.serviceId === e5);
6379
+ var IS = (e5, t2) => {
6380
+ let n2 = FS(e5, t2) ?? u_(e5), r2 = NS(e5);
6374
6381
  return r2 === void 0 ? n2 : S_(n2, r2);
6375
6382
  };
6376
- var PS = (e5, t2) => {
6377
- let n2 = NS(e5, t2), r2 = t2.get(i_.resource), i2 = AS(e5) !== void 0 || !!MS(e5, t2);
6383
+ var LS = (e5, t2) => {
6384
+ let n2 = IS(e5, t2), r2 = t2.get(i_.resource), i2 = NS(e5) !== void 0 || !!FS(e5, t2);
6378
6385
  return r2 && !i2 ? S_(n2, r2) : n2;
6379
6386
  };
6380
- function FS(e5, t2) {
6387
+ function RS(e5, t2) {
6381
6388
  return !e5 || !t2 || !e5.services.every(I_) ? null : m_(t2, e5);
6382
6389
  }
6383
- var IS = [];
6384
- function LS(e5) {
6390
+ var zS = [];
6391
+ function BS(e5) {
6385
6392
  return { min: 1, max: e5?.bookingPolicy?.participantsPolicy?.maxParticipantsPerBooking || 1 };
6386
6393
  }
6387
- function RS(e5, { previous: t2, others: n2 }, { min: r2, max: i2 }) {
6394
+ function VS(e5, { previous: t2, others: n2 }, { min: r2, max: i2 }) {
6388
6395
  let a2 = Math.max(0, Math.floor(e5)), o2 = Math.max(t2, i2 - n2), s2 = Math.min(a2, o2);
6389
6396
  return s2 > 0 && n2 + s2 < r2 ? Math.min(r2 - n2, o2) : s2;
6390
6397
  }
6391
- function zS({ serviceCtaState: e5, courseAvailability: t2, serviceBookability: n2 }) {
6392
- return `${e5}|${t2?.totalCapacity ?? `-`}|${t2?.remainingCapacity ?? `-`}|${t2 === null}|${n2.state}|${n2.isAvailableForBooking}`;
6393
- }
6394
- var BS = (e5) => ({ service: e5, hasError: false });
6395
- var VS = () => ({ service: null, hasError: true });
6396
- var HS = { service: null, hasError: false };
6397
- var US = { ...HS, awaitsPreferences: true };
6398
- var WS = (e5) => ({ ...HS, isMultiServiceAppointment: true, multiServiceAppointmentServices: e5 });
6399
- var GS = () => ({ ...VS(), isMultiServiceAppointment: true });
6400
- var KS = [];
6401
- var qS = [];
6402
- var JS = {};
6403
- function YS({ servicePromise: e5, refreshSignal: n2, injected: r2, rescheduleRequest: i2 = null, editingSurface: a2 = false, bookingsSettings: o2, seoPage: s2 = null, children: c2 }) {
6404
- return (0, import_jsx_runtime.jsx)(import_react.Suspense, { fallback: (0, import_jsx_runtime.jsx)(Gx, { rescheduleRequest: i2, editingSurface: a2, children: c2 }), children: (0, import_jsx_runtime.jsx)(Ux, { bookingsSettings: o2, children: (0, import_jsx_runtime.jsxs)(ts, { fallback: (0, import_jsx_runtime.jsx)(Kx, { rescheduleRequest: i2, editingSurface: a2, children: c2 }), feature: Zo.service, children: [s2 && e5 && (0, import_jsx_runtime.jsx)(pv, { servicePromise: e5, page: s2 }), (0, import_jsx_runtime.jsx)($S, { servicePromise: e5, refreshSignal: n2, injected: r2, rescheduleRequest: i2, editingSurface: a2, children: c2 })] }) }) });
6405
- }
6406
- var XS = (e5) => e5 ?? void 0;
6407
- var ZS = () => void 0;
6408
- function QS(e5, t2) {
6398
+ var HS = (e5) => ({ service: e5, hasError: false });
6399
+ var US = () => ({ service: null, hasError: true });
6400
+ var WS = { service: null, hasError: false };
6401
+ var GS = { ...WS, awaitsPreferences: true };
6402
+ var KS = (e5) => ({ ...WS, isMultiServiceAppointment: true, multiServiceAppointmentServices: e5 });
6403
+ var qS = () => ({ ...US(), isMultiServiceAppointment: true });
6404
+ var JS = [];
6405
+ var YS = [];
6406
+ var XS = {};
6407
+ function ZS({ servicePromise: e5, refreshSignal: n2, injected: r2, rescheduleRequest: i2 = null, editingSurface: a2 = false, bookingsSettings: o2, seoPage: s2 = null, children: c2 }) {
6408
+ return (0, import_jsx_runtime.jsx)(import_react.Suspense, { fallback: (0, import_jsx_runtime.jsx)(Jx, { rescheduleRequest: i2, editingSurface: a2, children: c2 }), children: (0, import_jsx_runtime.jsx)(Kx, { bookingsSettings: o2, children: (0, import_jsx_runtime.jsxs)(ts, { fallback: (0, import_jsx_runtime.jsx)(Yx, { rescheduleRequest: i2, editingSurface: a2, children: c2 }), feature: Zo.service, children: [s2 && e5 && (0, import_jsx_runtime.jsx)(pv, { servicePromise: e5, page: s2 }), (0, import_jsx_runtime.jsx)(tC, { servicePromise: e5, refreshSignal: n2, injected: r2, rescheduleRequest: i2, editingSurface: a2, children: c2 })] }) }) });
6409
+ }
6410
+ var QS = (e5) => e5 ?? void 0;
6411
+ var $S = () => void 0;
6412
+ function eC(e5, t2) {
6409
6413
  $o(e5, { feature: Zo.service, action: `fetch-service-variants`, level: `warning`, contexts: { service: { serviceId: t2 } } });
6410
6414
  }
6411
- function $S({ servicePromise: e5, refreshSignal: t2 = 0, injected: n2, rescheduleRequest: a2 = null, editingSurface: o2 = false, children: c2 }) {
6412
- let f2 = n2 ? null : e5 ? Os(e5) : null, p2 = n2?.service ?? f2?.service ?? null, m2 = f2?.hasError ?? false, g2 = f2?.awaitsPreferences ?? false, _2 = f2?.isMultiServiceAppointment ?? false, v2 = f2?.multiServiceAppointmentServices ?? KS, y2 = Ub(), b2 = Gb(), x2 = $b(), { navigate: ee2, navigateToHref: te2, resolvePath: S2, toHref: C2, getBookingFormPath: w2 } = $_(), T2 = fS(), E2 = Fv(Ev.SERVICE), { getParsedUrl: ne2, pushUrl: re2 } = ps(), D2 = (0, import_react.useRef)(ne2);
6415
+ function tC({ servicePromise: e5, refreshSignal: t2 = 0, injected: n2, rescheduleRequest: a2 = null, editingSurface: o2 = false, children: c2 }) {
6416
+ let f2 = n2 ? null : e5 ? Os(e5) : null, p2 = n2?.service ?? f2?.service ?? null, m2 = f2?.hasError ?? false, g2 = f2?.awaitsPreferences ?? false, _2 = f2?.isMultiServiceAppointment ?? false, v2 = f2?.multiServiceAppointmentServices ?? JS, y2 = Jb(), b2 = Xb(), x2 = rx(), { navigate: ee2, navigateToHref: te2, resolvePath: S2, toHref: C2, getBookingFormPath: w2 } = $_(), T2 = hS(), E2 = Xy(Vy.SERVICE), { getParsedUrl: ne2, pushUrl: re2 } = ps(), D2 = (0, import_react.useRef)(ne2);
6413
6417
  D2.current = ne2;
6414
6418
  let ie2 = (0, import_react.useRef)(re2);
6415
6419
  ie2.current = re2;
6416
- let O2 = rx(), ae2 = (0, import_react.useRef)(O2);
6420
+ let O2 = sx(), ae2 = (0, import_react.useRef)(O2);
6417
6421
  ae2.current = O2;
6418
- let [k2, oe2] = (0, import_react.useState)(xS), se2 = gS(), ce2 = (e6, t3) => a2 ? u_(e6) : NS(e6, t3), le2 = (0, import_react.useRef)(ce2);
6422
+ let [k2, oe2] = (0, import_react.useState)(wS), se2 = yS(), ce2 = (e6, t3) => a2 ? u_(e6) : IS(e6, t3), le2 = (0, import_react.useRef)(ce2);
6419
6423
  le2.current = ce2;
6420
- let ue2 = kx(), A2 = ue2 === Dx, de2 = a2 || A2 ? null : ue2, [fe2, pe2] = (0, import_react.useState)(() => A2 ? u_(p2?._id ?? ``) : ce2(p2?._id ?? ``, ne2().searchParams)), j2 = (0, import_react.useRef)(fe2), [me2, he2] = (0, import_react.useState)(A2 && !a2), ge2 = (0, import_react.useRef)(void 0), _e2 = (0, import_react.useRef)(true), [ve2, ye2] = (0, import_react.useState)(false), be2 = Wv(), xe2 = (0, import_react.useRef)(false), Se2 = (0, import_react.useRef)(null), [Ce2, we2] = (0, import_react.useState)(null), Te2 = (0, import_react.useRef)(Ce2), [Ee2, De2] = (0, import_react.useState)(0), M2 = p2?._id ?? null, Oe2 = (0, import_react.useMemo)(() => {
6424
+ let ue2 = Mx(), A2 = ue2 === Ax, de2 = a2 || A2 ? null : ue2, [fe2, pe2] = (0, import_react.useState)(() => A2 ? u_(p2?._id ?? ``) : ce2(p2?._id ?? ``, ne2().searchParams)), j2 = (0, import_react.useRef)(fe2), [me2, he2] = (0, import_react.useState)(A2 && !a2), ge2 = (0, import_react.useRef)(void 0), _e2 = (0, import_react.useRef)(true), [ve2, ye2] = (0, import_react.useState)(false), be2 = ab(), xe2 = (0, import_react.useRef)(false), Se2 = (0, import_react.useRef)(null), [Ce2, we2] = (0, import_react.useState)(null), Te2 = (0, import_react.useRef)(Ce2), [Ee2, De2] = (0, import_react.useState)(0), M2 = p2?._id ?? null, Oe2 = (0, import_react.useMemo)(() => {
6421
6425
  if (!a2) return null;
6422
6426
  let { booking: e6 } = k2;
6423
6427
  if (k2.status !== `ready` || !e6) return { ...k2 };
@@ -6427,25 +6431,25 @@ function $S({ servicePromise: e5, refreshSignal: t2 = 0, injected: n2, reschedul
6427
6431
  if (!p2) return null;
6428
6432
  let e6 = S2(`servicePage`, { slug: p2.mainSlug?.name ?? null, serviceId: p2._id ?? null });
6429
6433
  return e6 ? { href: C2(e6), target: `_self` } : null;
6430
- }, [p2, S2, C2]), [Me2, Ne2] = (0, import_react.useState)(IS), Pe2 = n2 ? n2.masterEvents : Me2, Fe2 = Vx(), Ie2 = Lx(), Le2 = Ie2.isLoading, Re2 = !Ie2.isLoading && Ie2.multiServiceAppointmentsEnabled;
6434
+ }, [p2, S2, C2]), [Me2, Ne2] = (0, import_react.useState)(zS), Pe2 = n2 ? n2.masterEvents : Me2, Fe2 = Wx(), Ie2 = Bx(), Le2 = Ie2.isLoading, Re2 = !Ie2.isLoading && Ie2.multiServiceAppointmentsEnabled;
6431
6435
  (0, import_react.useEffect)(() => {
6432
6436
  if (!a2 || Le2) return;
6433
- let e6 = false, t3 = TS(a2, se2, (t4) => {
6437
+ let e6 = false, t3 = OS(a2, se2, (t4) => {
6434
6438
  e6 || oe2(t4);
6435
6439
  });
6436
6440
  return () => {
6437
6441
  e6 = true, t3();
6438
6442
  };
6439
6443
  }, [a2, Le2, se2]);
6440
- let ze2 = !n2 && !!p2 && Wm(p2), Be2 = ze2 && M2 ? lx(b2, x2, M2, t2) : null, Ve2 = (typeof window > `u` && Be2 && M2 && O2.scope && !Le2 ? Os(js(Sx({ key: Be2, warmupData: O2, fetchData: () => cy(M2).catch((e6) => (QS(e6, M2), null)) }), XS, ZS)) : void 0) ?? (Be2 ? gx(Be2) : void 0), [He2, Ue2] = (0, import_react.useState)(() => Ve2 ?? null), [We2, Ge2] = (0, import_react.useState)(() => Ve2 ? Be2 : null), Ke2 = Be2 !== null && We2 !== Be2, qe2 = n2 ? n2.serviceOptionsAndVariants : ze2 ? He2 : null;
6444
+ let ze2 = !n2 && !!p2 && Wm(p2), Be2 = ze2 && M2 ? fx(b2, x2, M2, t2) : null, Ve2 = (typeof window > `u` && Be2 && M2 && O2.scope && !Le2 ? Os(js(Tx({ key: Be2, warmupData: O2, fetchData: () => Cb(M2).catch((e6) => (eC(e6, M2), null)) }), QS, $S)) : void 0) ?? (Be2 ? yx(Be2) : void 0), [He2, Ue2] = (0, import_react.useState)(() => Ve2 ?? null), [We2, Ge2] = (0, import_react.useState)(() => Ve2 ? Be2 : null), Ke2 = Be2 !== null && We2 !== Be2, qe2 = n2 ? n2.serviceOptionsAndVariants : ze2 ? He2 : null;
6441
6445
  (0, import_react.useEffect)(() => {
6442
6446
  if (n2) return;
6443
6447
  let e6 = ke2 && !Vm(Ae2) ? ke2 : null;
6444
- if ((!e6 || Le2) && Ne2((e7) => e7.length === 0 ? e7 : IS), Le2) return;
6448
+ if ((!e6 || Le2) && Ne2((e7) => e7.length === 0 ? e7 : zS), Le2) return;
6445
6449
  let i2 = ze2 ? M2 : null;
6446
6450
  if (!e6 && !i2) return;
6447
- let a3 = false, o3 = e6 ? oy([e6], Fe2).catch(() => IS) : Promise.resolve(IS), s2 = i2 ? Sx({ key: lx(b2, x2, i2, t2), warmupData: ae2.current, fetchData: () => cy(i2) }).catch((e7) => {
6448
- QS(e7, i2);
6451
+ let a3 = false, o3 = e6 ? xb([e6], Fe2).catch(() => zS) : Promise.resolve(zS), s2 = i2 ? Tx({ key: fx(b2, x2, i2, t2), warmupData: ae2.current, fetchData: () => Cb(i2) }).catch((e7) => {
6452
+ eC(e7, i2);
6449
6453
  }) : Promise.resolve(void 0);
6450
6454
  return Promise.all([o3, s2]).then(([e7, t3]) => {
6451
6455
  a3 || (0, import_react.startTransition)(() => {
@@ -6458,37 +6462,37 @@ function $S({ servicePromise: e5, refreshSignal: t2 = 0, injected: n2, reschedul
6458
6462
  let N2 = me2 ? null : de2, P2 = (0, import_react.useMemo)(() => JSON.stringify([...new Set((r_(N2)?.services ?? []).filter((e6) => T_(e6).length > 0).map(({ serviceId: e6 }) => e6))].sort()), [N2]), F2 = (0, import_react.useMemo)(() => {
6459
6463
  let e6 = new Set(JSON.parse(P2));
6460
6464
  return [...new Set(v2.filter(Wm).flatMap(({ _id: t3 }) => t3 && e6.has(t3) ? [t3] : []))];
6461
- }, [v2, P2]), Je2 = (0, import_react.useMemo)(() => ({ serviceIds: F2, refreshSignal: t2, language: b2, currency: x2 }), [F2, t2, b2, x2]), [Ye2, Xe2] = (0, import_react.useState)(null), Ze2 = Ye2?.request === Je2 ? Ye2 : null, Qe2 = Ze2?.data ?? JS, $e2 = F2.length === 0 ? `ready` : Le2 || !Ze2 ? `loading` : Ze2.data && F2.every((e6) => Ze2.data?.[e6]) ? `ready` : `error`;
6465
+ }, [v2, P2]), Je2 = (0, import_react.useMemo)(() => ({ serviceIds: F2, refreshSignal: t2, language: b2, currency: x2 }), [F2, t2, b2, x2]), [Ye2, Xe2] = (0, import_react.useState)(null), Ze2 = Ye2?.request === Je2 ? Ye2 : null, Qe2 = Ze2?.data ?? XS, $e2 = F2.length === 0 ? `ready` : Le2 || !Ze2 ? `loading` : Ze2.data && F2.every((e6) => Ze2.data?.[e6]) ? `ready` : `error`;
6462
6466
  (0, import_react.useEffect)(() => {
6463
6467
  let { serviceIds: e6, refreshSignal: t3, language: n3, currency: i2 } = Je2;
6464
6468
  if (Le2 || e6.length === 0) return;
6465
6469
  let a3 = false;
6466
- return Sx({ key: ux(n3, i2, e6, t3), warmupData: ae2.current, fetchData: () => uy(e6) }).catch((e7) => ($o(e7, { feature: Zo.service, action: `fetch-multi-service-variants`, level: `warning` }), null)).then((e7) => {
6470
+ return Tx({ key: px(n3, i2, e6, t3), warmupData: ae2.current, fetchData: () => Tb(e6) }).catch((e7) => ($o(e7, { feature: Zo.service, action: `fetch-multi-service-variants`, level: `warning` }), null)).then((e7) => {
6467
6471
  a3 || (0, import_react.startTransition)(() => Xe2({ request: Je2, data: e7 }));
6468
6472
  }), () => {
6469
6473
  a3 = true;
6470
6474
  };
6471
6475
  }, [Le2, Je2]);
6472
- let et2 = Eb({ service: p2, masterEvents: Pe2, locale: y2, timeZone: Fe2, now: ix() }), tt2 = zS(et2), nt2 = (0, import_react.useMemo)(() => et2, [p2, Pe2, y2, Fe2, tt2]), rt2 = (0, import_react.useRef)(jS);
6476
+ let et2 = jy({ service: p2, masterEvents: Pe2, locale: y2, timeZone: Fe2 }), tt2 = (0, import_react.useRef)(PS);
6473
6477
  (0, import_react.useEffect)(() => {
6474
- if (rt2.current !== jS) {
6478
+ if (tt2.current !== PS) {
6475
6479
  let e6 = le2.current(p2?._id ?? ``, D2.current().searchParams);
6476
6480
  j2.current = e6, _e2.current = true, ye2(false), xe2.current = false, Se2.current = null, pe2(e6);
6477
6481
  }
6478
- rt2.current = M2;
6482
+ tt2.current = M2;
6479
6483
  }, [M2]);
6480
- let I2 = (0, import_react.useRef)(A2 ? jS : de2), L2 = (0, import_react.useRef)(null), it2 = (0, import_react.useRef)(false);
6481
- _S(() => {
6482
- if (it2.current = true, I2.current !== jS) return;
6484
+ let nt2 = (0, import_react.useRef)(A2 ? PS : de2), rt2 = (0, import_react.useRef)(null), I2 = (0, import_react.useRef)(false);
6485
+ bS(() => {
6486
+ if (I2.current = true, nt2.current !== PS) return;
6483
6487
  let e6 = le2.current(M2 ?? ``, D2.current().searchParams);
6484
- j2.current = e6, L2.current = e6;
6488
+ j2.current = e6, rt2.current = e6;
6485
6489
  }, []), (0, import_react.useEffect)(() => {
6486
- let e6 = I2.current === jS, t3 = e6 ? a2 ? null : a_(D2.current().searchParams) : de2;
6487
- if (!e6 && (A2 || t3 === I2.current)) return;
6488
- let n3 = I2.current;
6489
- if (I2.current = t3, n3 !== jS && v_(n3, t3)) return;
6490
- let i2 = L2.current;
6491
- if (L2.current = null, e6 && i2 && j2.current !== i2) {
6490
+ let e6 = nt2.current === PS, t3 = e6 ? a2 ? null : a_(D2.current().searchParams) : de2;
6491
+ if (!e6 && (A2 || t3 === nt2.current)) return;
6492
+ let n3 = nt2.current;
6493
+ if (nt2.current = t3, n3 !== PS && v_(n3, t3)) return;
6494
+ let i2 = rt2.current;
6495
+ if (rt2.current = null, e6 && i2 && j2.current !== i2) {
6492
6496
  (0, import_react.startTransition)(() => {
6493
6497
  pe2(j2.current), he2(false);
6494
6498
  });
@@ -6503,153 +6507,153 @@ function $S({ servicePromise: e5, refreshSignal: t2 = 0, injected: n2, reschedul
6503
6507
  }
6504
6508
  pe2(o3), Te2.current = null, we2(null), De2((e7) => e7 + 1);
6505
6509
  }, [A2, de2, M2, a2]);
6506
- let R2 = (0, import_react.useRef)({});
6507
- R2.current = { serviceType: p2?.type ?? void 0, scheduleId: Um(p2?.type) || Hm(p2?.type) ? p2?.schedule?._id ?? void 0 : void 0 };
6508
- let at2 = (0, import_react.useRef)(A2 || me2);
6509
- at2.current = A2 || me2;
6510
- let ot2 = (0, import_react.useCallback)((e6, t3) => c_(e6, { currentUrl: at2.current && !it2.current ? iC(D2.current()) : D2.current(), entries: [b_(t3?.staffId === void 0 ? j2.current : S_(j2.current, t3.staffId), R2.current)], policy: t3?.handoff ? `handoff` : `inPlace`, timezone: ge2.current }), []), st2 = (0, import_react.useCallback)((e6) => {
6510
+ let L2 = (0, import_react.useRef)({});
6511
+ L2.current = { serviceType: p2?.type ?? void 0, scheduleId: Um(p2?.type) || Hm(p2?.type) ? p2?.schedule?._id ?? void 0 : void 0 };
6512
+ let it2 = (0, import_react.useRef)(A2 || me2);
6513
+ it2.current = A2 || me2;
6514
+ let R2 = (0, import_react.useCallback)((e6, t3) => c_(e6, { currentUrl: it2.current && !I2.current ? oC(D2.current()) : D2.current(), entries: [b_(t3?.staffId === void 0 ? j2.current : S_(j2.current, t3.staffId), L2.current)], policy: t3?.handoff ? `handoff` : `inPlace`, timezone: ge2.current }), []), at2 = (0, import_react.useCallback)((e6) => {
6511
6515
  let t3 = e6(j2.current);
6512
6516
  j2.current = t3, pe2(t3);
6513
- }, []), ct2 = (0, import_react.useCallback)((e6) => {
6514
- st2(e6);
6515
- let t3 = D2.current(), n3 = e6(NS(M2 ?? ``, t3.searchParams)), r2 = c_(`${t3.pathname}${t3.search}${t3.hash}`, { currentUrl: t3, entries: [b_(n3, R2.current)], policy: `inPlace` }), i2 = new URL(r2, t3);
6516
- I2.current !== jS && (I2.current = a_(i2.searchParams)), ie2.current(i2, { disableScrollToTop: true, skipHistory: true });
6517
- }, [st2, M2]), lt2 = r_(N2)?.wantsPromoCode === true, ut2 = (0, import_react.useCallback)((e6) => {
6517
+ }, []), ot2 = (0, import_react.useCallback)((e6) => {
6518
+ at2(e6);
6519
+ let t3 = D2.current(), n3 = e6(IS(M2 ?? ``, t3.searchParams)), r2 = c_(`${t3.pathname}${t3.search}${t3.hash}`, { currentUrl: t3, entries: [b_(n3, L2.current)], policy: `inPlace` }), i2 = new URL(r2, t3);
6520
+ nt2.current !== PS && (nt2.current = a_(i2.searchParams)), ie2.current(i2, { disableScrollToTop: true, skipHistory: true });
6521
+ }, [at2, M2]), st2 = r_(N2)?.wantsPromoCode === true, ct2 = (0, import_react.useCallback)((e6) => {
6518
6522
  let t3 = D2.current(), n3 = r_(a_(t3.searchParams));
6519
6523
  if (!n3) return;
6520
6524
  let r2 = new URL(m_(`${t3.pathname}${t3.search}${t3.hash}`, __(n3, e6)), t3);
6521
- I2.current !== jS && (I2.current = a_(r2.searchParams)), ie2.current(r2, { disableScrollToTop: true, skipHistory: true });
6522
- }, []), dt2 = _y(qe2), ft2 = (0, import_react.useCallback)((e6, t3) => dt2 ? E_(e6, t3 ? [t3] : []) : e6, [dt2]), pt2 = (0, import_react.useCallback)((e6) => st2((t3) => ft2(S_(t3, e6), e6)), [st2, ft2]), mt2 = (0, import_react.useCallback)(() => st2((e6) => ft2(w_(e6), null)), [st2, ft2]), ht2 = (0, import_react.useCallback)((e6) => st2((t3) => ft2(C_(t3, e6), null)), [st2, ft2]), gt2 = (0, import_react.useCallback)((e6) => ct2((t3) => E_(t3, e6)), [ct2]), _t2 = (0, import_react.useMemo)(() => LS(p2), [p2]), vt2 = (0, import_react.useMemo)(() => vy(qe2, { locale: y2, staffMembers: p2 ? yy(p2) : [], businessLocations: zm(p2) }), [qe2, y2, p2]), yt2 = (0, import_react.useMemo)(() => new Set(vy(qe2, { locale: y2 })?.choices.flatMap((e6) => e6.choiceId ? [e6.choiceId] : []) ?? []), [qe2, y2]), bt2 = (0, import_react.useCallback)((e6) => {
6523
- let t3 = Object.entries(e6).filter(([e7, t4]) => yt2.has(e7) && Number.isFinite(t4));
6525
+ nt2.current !== PS && (nt2.current = a_(r2.searchParams)), ie2.current(r2, { disableScrollToTop: true, skipHistory: true });
6526
+ }, []), lt2 = Ab(qe2), ut2 = (0, import_react.useCallback)((e6, t3) => lt2 ? E_(e6, t3 ? [t3] : []) : e6, [lt2]), dt2 = (0, import_react.useCallback)((e6) => at2((t3) => ut2(S_(t3, e6), e6)), [at2, ut2]), ft2 = (0, import_react.useCallback)(() => at2((e6) => ut2(w_(e6), null)), [at2, ut2]), pt2 = (0, import_react.useCallback)((e6) => at2((t3) => ut2(C_(t3, e6), null)), [at2, ut2]), mt2 = (0, import_react.useCallback)((e6) => ot2((t3) => E_(t3, e6)), [ot2]), ht2 = (0, import_react.useMemo)(() => BS(p2), [p2]), gt2 = (0, import_react.useMemo)(() => jb(qe2, { locale: y2, staffMembers: p2 ? ry(p2) : [], businessLocations: zm(p2) }), [qe2, y2, p2]), _t2 = (0, import_react.useMemo)(() => new Set(jb(qe2, { locale: y2 })?.choices.flatMap((e6) => e6.choiceId ? [e6.choiceId] : []) ?? []), [qe2, y2]), vt2 = (0, import_react.useCallback)((e6) => {
6527
+ let t3 = Object.entries(e6).filter(([e7, t4]) => _t2.has(e7) && Number.isFinite(t4));
6524
6528
  if (!t3.length) return;
6525
6529
  let n3 = (e7) => {
6526
- let n4 = A_(e7, yt2), r2 = ([e8, t4]) => t4 <= D_(n4, e8), i2 = [...t3.filter(r2), ...t3.filter((e8) => !r2(e8))];
6530
+ let n4 = A_(e7, _t2), r2 = ([e8, t4]) => t4 <= D_(n4, e8), i2 = [...t3.filter(r2), ...t3.filter((e8) => !r2(e8))];
6527
6531
  for (let [e8, t4] of i2) {
6528
- let r3 = D_(n4, e8), i3 = RS(t4, { previous: r3, others: O_(n4) - r3 }, _t2);
6532
+ let r3 = D_(n4, e8), i3 = VS(t4, { previous: r3, others: O_(n4) - r3 }, ht2);
6529
6533
  i3 !== r3 && (n4 = k_(n4, e8, i3));
6530
6534
  }
6531
6535
  return n4;
6532
6536
  };
6533
- n3(j2.current) !== j2.current && ct2(n3);
6534
- }, [yt2, _t2, ct2]), xt2 = (0, import_react.useCallback)((e6) => ct2((t3) => N_(t3, e6)), [ct2]), St2 = (0, import_react.useCallback)((e6, t3) => ct2((n3) => P_(n3, e6, t3)), [ct2]), Ct2 = (0, import_react.useCallback)((e6, t3) => {
6535
- t3?.timezone && (ge2.current = t3.timezone), _e2.current = t3?.bookable ?? true, ye2(!_e2.current), xe2.current = t3?.staffChoiceRequired ?? false, Se2.current = t3?.rescheduleStaffId ?? null, st2((n3) => {
6537
+ n3(j2.current) !== j2.current && ot2(n3);
6538
+ }, [_t2, ht2, ot2]), yt2 = (0, import_react.useCallback)((e6) => ot2((t3) => N_(t3, e6)), [ot2]), bt2 = (0, import_react.useCallback)((e6, t3) => ot2((n3) => P_(n3, e6, t3)), [ot2]), xt2 = (0, import_react.useCallback)((e6, t3) => {
6539
+ t3?.timezone && (ge2.current = t3.timezone), _e2.current = t3?.bookable ?? true, ye2(!_e2.current), xe2.current = t3?.staffChoiceRequired ?? false, Se2.current = t3?.rescheduleStaffId ?? null, at2((n3) => {
6536
6540
  let r2 = L_(n3, e6);
6537
6541
  return t3?.staffId === void 0 ? r2 : S_(r2, t3.staffId);
6538
6542
  });
6539
- }, [st2]), wt2 = (0, import_react.useCallback)(() => {
6543
+ }, [at2]), St2 = (0, import_react.useCallback)(() => {
6540
6544
  _e2.current = true, ye2(false), xe2.current = false, Se2.current = null;
6541
6545
  let e6 = le2.current(M2 ?? ``, D2.current().searchParams);
6542
- st2((t3) => {
6546
+ at2((t3) => {
6543
6547
  let n3 = z_(t3, e6);
6544
- if (!dt2) return n3;
6548
+ if (!lt2) return n3;
6545
6549
  let { selectedVariants: r2, durationChoiceId: i2, ...a3 } = n3;
6546
6550
  return { ...a3, ...e6.selectedVariants ? { selectedVariants: e6.selectedVariants } : {}, ...e6.durationChoiceId ? { durationChoiceId: e6.durationChoiceId } : {} };
6547
6551
  });
6548
- }, [st2, M2, dt2]), Tt2 = (0, import_react.useCallback)((e6) => {
6552
+ }, [at2, M2, lt2]), Ct2 = (0, import_react.useCallback)((e6) => {
6549
6553
  let t3 = Te2.current ?? r_(a_(D2.current().searchParams)), n3 = t3 && e6(t3);
6550
6554
  return n3 ? (Te2.current = n3, we2(n3), true) : false;
6551
- }, []), Et2 = (0, import_react.useCallback)((e6, t3) => Tt2((n3) => B_(n3, e6, t3, yv())), [Tt2]), Dt2 = (0, import_react.useCallback)(() => {
6552
- Tt2(H_);
6553
- }, [Tt2]), Ot2 = nt2.serviceCtaState, kt2 = (0, import_react.useMemo)(() => _2 ? (Ce2 ?? r_(N2))?.services ?? qS : qS, [_2, Ce2, N2]), At2 = (0, import_react.useMemo)(() => _2 ? FS(Ce2 ?? r_(N2), w2()) : null, [_2, Ce2, N2, w2]), jt2 = (0, import_react.useCallback)((e6) => {
6554
- if (_2) return At2 ? C2(At2) : null;
6555
- let t3 = W_({ actionState: Ot2, serviceType: p2?.type ?? null, config: e6 ?? U_ });
6555
+ }, []), wt2 = (0, import_react.useCallback)((e6, t3) => Ct2((n3) => B_(n3, e6, t3, Py())), [Ct2]), Tt2 = (0, import_react.useCallback)(() => {
6556
+ Ct2(H_);
6557
+ }, [Ct2]), Et2 = et2.serviceCtaState, Dt2 = (0, import_react.useMemo)(() => _2 ? (Ce2 ?? r_(N2))?.services ?? YS : YS, [_2, Ce2, N2]), Ot2 = (0, import_react.useMemo)(() => _2 ? RS(Ce2 ?? r_(N2), w2()) : null, [_2, Ce2, N2, w2]), kt2 = Es(`serviceCtaFormHrefCarriesSelection`), At2 = (0, import_react.useCallback)((e6) => {
6558
+ if (_2) return Ot2 ? C2(Ot2) : null;
6559
+ let t3 = W_({ actionState: Et2, serviceType: p2?.type ?? null, config: e6 ?? U_ });
6556
6560
  if (G_(t3, p2?.type ?? null, fe2)) return null;
6557
6561
  let n3 = S2(t3, { slug: p2?.mainSlug?.name ?? null, serviceId: p2?._id ?? null });
6558
- return n3 ? C2(n3) : null;
6559
- }, [_2, At2, Ot2, p2, fe2, S2, C2]), Mt2 = Fb(), [Nt2, Pt2] = (0, import_react.useState)(false), Ft2 = (0, import_react.useRef)(false), It2 = (0, import_react.useCallback)(() => {
6560
- Ft2.current = false, Pt2(false);
6562
+ return n3 ? C2(kt2 && t3 === `bookingForm` ? R2(n3, { handoff: true }) : n3) : null;
6563
+ }, [_2, Ot2, Et2, p2, fe2, S2, C2, kt2, R2]), jt2 = Bb(), [Mt2, Nt2] = (0, import_react.useState)(false), Pt2 = (0, import_react.useRef)(false), Ft2 = (0, import_react.useCallback)(() => {
6564
+ Pt2.current = false, Nt2(false);
6561
6565
  }, []);
6562
- Cx(It2);
6563
- let Lt2 = (0, import_react.useCallback)((e6) => {
6564
- Ft2.current = true, Pt2(true);
6566
+ Ex(Ft2);
6567
+ let It2 = (0, import_react.useCallback)((e6) => {
6568
+ Pt2.current = true, Nt2(true);
6565
6569
  let t3 = D2.current(), n3 = new URL(C2(e6), t3).pathname === t3.pathname;
6566
6570
  ee2(e6).then(() => {
6567
- (n3 || D2.current().href !== t3.href) && It2();
6571
+ (n3 || D2.current().href !== t3.href) && Ft2();
6568
6572
  }, (e7) => {
6569
- $o(e7, { feature: Zo.serviceCta, action: `navigateToNextPage` }), It2();
6573
+ $o(e7, { feature: Zo.serviceCta, action: `navigateToNextPage` }), Ft2();
6570
6574
  });
6571
- }, [ee2, It2, C2]), Rt2 = (0, import_react.useCallback)(() => Mt2.open(jb(Rb({ service: p2, pricingOption: vt2 ?? void 0, selection: PS(M2 ?? ``, D2.current().searchParams), multiServiceAppointmentsEnabled: Re2 }))), [Mt2, p2, vt2, M2, Re2]), zt2 = (0, import_react.useCallback)((e6) => {
6572
- if (Ft2.current) return;
6573
- let t3 = Te2.current ?? r_(a_(D2.current().searchParams)), n3 = FS(t3, w2());
6575
+ }, [ee2, Ft2, C2]), Lt2 = (0, import_react.useCallback)(() => jt2.open(Ib(Ub({ service: p2, pricingOption: gt2 ?? void 0, selection: LS(M2 ?? ``, D2.current().searchParams), multiServiceAppointmentsEnabled: Re2 }))), [jt2, p2, gt2, M2, Re2]), Rt2 = (0, import_react.useCallback)((e6) => {
6576
+ if (Pt2.current) return;
6577
+ let t3 = Te2.current ?? r_(a_(D2.current().searchParams)), n3 = RS(t3, w2());
6574
6578
  if (n3) {
6575
- for (let n4 of t3?.services ?? []) e6(Hv({ serviceId: n4.serviceId, serviceType: n4.serviceType ?? v2.find(({ _id: e7 }) => e7 === n4.serviceId)?.type ?? void 0, start: n4.slotStart, end: n4.slotEnd, timeZone: t3?.timezone ?? void 0, isEligibleForFlowCompletion: true }));
6576
- Lt2(n3);
6579
+ for (let n4 of t3?.services ?? []) e6(rb({ serviceId: n4.serviceId, serviceType: n4.serviceType ?? v2.find(({ _id: e7 }) => e7 === n4.serviceId)?.type ?? void 0, start: n4.slotStart, end: n4.slotEnd, timeZone: t3?.timezone ?? void 0, isEligibleForFlowCompletion: true }));
6580
+ It2(n3);
6577
6581
  }
6578
- }, [w2, v2, Lt2]), Bt2 = (0, import_react.useCallback)((e6, t3 = Ov.WIDGET_BUTTON) => {
6579
- if (Ft2.current || a2) return;
6582
+ }, [w2, v2, It2]), zt2 = (0, import_react.useCallback)((e6, t3 = Uy.WIDGET_BUTTON) => {
6583
+ if (Pt2.current || a2) return;
6580
6584
  if (_2) {
6581
- zt2(E2);
6585
+ Rt2(E2);
6582
6586
  return;
6583
6587
  }
6584
- let n3 = W_({ actionState: Ot2, serviceType: p2?.type ?? null, config: e6 ?? U_ });
6588
+ let n3 = W_({ actionState: Et2, serviceType: p2?.type ?? null, config: e6 ?? U_ });
6585
6589
  if (G_(n3, p2?.type ?? null, j2.current)) return;
6586
6590
  let r2 = n3 === `bookingForm` && !Um(p2?.type ?? null);
6587
6591
  if (r2 && !_e2.current) return;
6588
6592
  let i2 = S2(n3, { slug: p2?.mainSlug?.name ?? null, serviceId: p2?._id ?? null });
6589
- if (n3 !== `servicePage` && !r2 && E2(Cv({ bookingsServiceId: p2?._id ?? void 0, serviceType: p2?.type ?? void 0, isEligibleForFlowCompletion: !!i2 })), r2 && E2(Hv({ serviceId: p2?._id ?? void 0, serviceType: p2?.type ?? void 0, start: j2.current.slotStart, end: j2.current.slotEnd, timeZone: ge2.current ?? r_(N2)?.timezone ?? Fe2, isEligibleForFlowCompletion: !!i2 })), E2(xv({ service_id: p2?._id ?? void 0, destination: kv[n3] })), !i2) return;
6590
- E2(Lv({ service_id: p2?._id ?? void 0, type: p2?.type ?? void 0, isPendingApproval: p2 ? Gm(p2) : void 0, referralInfo: t3, actionName: Av[n3] }));
6593
+ if (n3 !== `servicePage` && !r2 && E2(Ry({ bookingsServiceId: p2?._id ?? void 0, serviceType: p2?.type ?? void 0, isEligibleForFlowCompletion: !!i2 })), r2 && E2(rb({ serviceId: p2?._id ?? void 0, serviceType: p2?.type ?? void 0, start: j2.current.slotStart, end: j2.current.slotEnd, timeZone: ge2.current ?? r_(N2)?.timezone ?? Fe2, isEligibleForFlowCompletion: !!i2 })), E2(Iy({ service_id: p2?._id ?? void 0, destination: Wy[n3] })), !i2) return;
6594
+ E2(Qy({ service_id: p2?._id ?? void 0, type: p2?.type ?? void 0, isPendingApproval: p2 ? Gm(p2) : void 0, referralInfo: t3, actionName: Gy[n3] }));
6591
6595
  let o3 = n3 === `bookingForm`;
6592
6596
  if (!o3 && !g_(j2.current)) {
6593
- Lt2(y_(i2, D2.current()));
6597
+ It2(y_(i2, D2.current()));
6594
6598
  return;
6595
6599
  }
6596
- Lt2(ot2(i2, { handoff: o3 }));
6597
- }, [a2, _2, zt2, N2, Ot2, p2, Fe2, S2, Lt2, ot2, E2]), Vt2 = () => ({ bookable: _e2.current, staffChoiceRequired: xe2.current, timezone: ge2.current ?? Fe2 ?? `UTC`, validUntil: Oe2?.validUntil ?? null }), Ht2 = (0, import_react.useRef)(Vt2);
6598
- Ht2.current = Vt2;
6599
- let Ut2 = (0, import_react.useCallback)(async () => {
6600
+ It2(R2(i2, { handoff: o3 }));
6601
+ }, [a2, _2, Rt2, N2, Et2, p2, Fe2, S2, It2, R2, E2]), Bt2 = () => ({ bookable: _e2.current, staffChoiceRequired: xe2.current, timezone: ge2.current ?? Fe2 ?? `UTC`, validUntil: Oe2?.validUntil ?? null }), Vt2 = (0, import_react.useRef)(Bt2);
6602
+ Vt2.current = Bt2;
6603
+ let Ht2 = (0, import_react.useCallback)(async () => {
6600
6604
  let e6 = Oe2?.status === `ready` ? Oe2.booking : null;
6601
- if (!Oe2 || !a2 || !e6 || !yS(j2.current, Ht2.current())) return { outcome: `failed` };
6602
- E2(zv({ component: Mv.RESCHEDULE_DIALOG, element: Nv.CONFIRM_BUTTON })), E2(Tv({ action: jv, pageName: Nv.CONFIRM_BUTTON, referralInfo: D2.current().searchParams.get(i_.referral) ?? void 0 }));
6603
- let t3 = b_(j2.current, R2.current), n3;
6605
+ if (!Oe2 || !a2 || !e6 || !SS(j2.current, Vt2.current())) return { outcome: `failed` };
6606
+ E2(eb({ component: qy.RESCHEDULE_DIALOG, element: Jy.CONFIRM_BUTTON })), E2(By({ action: Ky, pageName: Jy.CONFIRM_BUTTON, referralInfo: D2.current().searchParams.get(i_.referral) ?? void 0 }));
6607
+ let t3 = b_(j2.current, L2.current), n3;
6604
6608
  try {
6605
- n3 = await lS({ booking: e6, slot: eS(t3, ge2.current ?? null, e6, Se2.current), token: a2.token });
6609
+ n3 = await fS({ booking: e6, slot: rS(t3, ge2.current ?? null, e6, Se2.current), token: a2.token });
6606
6610
  } catch (e7) {
6607
6611
  return $o(e7, { feature: Zo.reschedule, action: `reschedule-booking` }), { outcome: `failed` };
6608
6612
  }
6609
- E2(Rv({ bookingId: e6.bookingId }));
6613
+ E2($y({ bookingId: e6.bookingId }));
6610
6614
  let r2 = { outcome: `succeeded`, ...n3 };
6611
6615
  if (a2.fromManageBookingPage) return r2;
6612
- let i2 = vS(a2.redirectUrl), o3 = i2 ? null : T2();
6616
+ let i2 = xS(a2.redirectUrl), o3 = i2 ? null : T2();
6613
6617
  if (!i2 && !o3) return r2;
6614
6618
  try {
6615
6619
  return i2 ? await te2({ href: i2 }) : o3 && await ee2(o3), { outcome: `navigated` };
6616
6620
  } catch (e7) {
6617
6621
  return $o(e7, { feature: Zo.reschedule, action: `return-after-reschedule` }), r2;
6618
6622
  }
6619
- }, [Oe2, a2, T2, ee2, te2, E2]), Wt2 = yS(fe2, Vt2()), Gt2 = (0, import_react.useCallback)(() => {
6620
- E2(Tv({ component: Nv.GO_TO_HOMEPAGE_BUTTON, action: jv, pageName: Pv })), ee2(`/`).catch((e6) => $o(e6, { feature: Zo.reschedule, action: `go-home` }));
6621
- }, [ee2, E2]), { serviceBookability: Kt2, policyDescription: qt2, coverImage: Jt2 } = nt2, Yt2 = (0, import_react.useCallback)(() => Kt2.isAvailableForBooking, [Kt2]), Xt2 = (0, import_react.useCallback)(() => !!qt2, [qt2]), Zt2 = (0, import_react.useCallback)(() => !!Jt2, [Jt2]), Qt2 = (0, import_react.useCallback)(() => iv(p2), [p2]), $t2 = (0, import_react.useCallback)(() => !!p2 && kb(p2), [p2]), en2 = (0, import_react.useMemo)(() => ({ ...nt2, service: p2, servicePageLink: je2, serviceOptionsAndVariants: qe2, pricingOption: vt2, isLoadingServiceOptionsAndVariants: Ke2, isAvailableForBooking: Yt2, hasPolicyDescription: Xt2, hasCoverImage: Zt2, hasGalleryImages: Qt2, isVariantDuration: $t2, isLoading: g2, hasError: m2, locale: y2, selectStaffMember: pt2, clearSelection: ht2, clearStaffMember: mt2, selection: fe2, isSelectionPending: me2 || fe2.serviceId !== (M2 ?? ``), selectionTimezone: ge2.current ?? Fe2, setVariant: gt2, setVariantCounts: bt2, maxParticipantsPerBooking: _t2.max, toggleAddOn: xt2, setAddOnQuantity: St2, setSlot: Ct2, clearSlot: wt2, setMultiServiceSlot: Et2, clearMultiServiceSlot: Dt2, draftRevision: Ee2, wantsPromoCode: lt2, setWantsPromoCode: ut2, withSelectionParam: ot2, navigateToNextPage: Bt2, navigateToMultiServiceForm: zt2, resolveNextPageHref: jt2, isNavigating: Nt2, isWaitlistSlotSelected: ve2, siteId: be2, editingSurface: o2, openPreferences: Rt2, multiServiceAppointmentsEnabled: Re2, isMultiServiceAppointment: _2, multiServiceAppointmentServices: v2, multiServiceAppointmentSelections: kt2, multiServiceAppointmentOptionsAndVariants: Qe2, multiServiceAppointmentVariantsStatus: $e2, bookingsSettingsLoading: Le2, reschedule: Oe2, rescheduleBooking: Ut2, goHomeAfterReschedule: Gt2, canRescheduleToPick: Wt2 }), [nt2, p2, je2, qe2, vt2, Ke2, Yt2, Xt2, Zt2, Qt2, $t2, g2, m2, y2, pt2, ht2, mt2, fe2, me2, M2, Fe2, gt2, bt2, _t2.max, xt2, St2, Ct2, wt2, Et2, Dt2, Ee2, lt2, ut2, ot2, Bt2, zt2, jt2, Nt2, ve2, be2, o2, Rt2, Re2, _2, v2, kt2, Qe2, $e2, Le2, Oe2, Ut2, Gt2, Wt2]);
6622
- return (0, import_jsx_runtime.jsx)(ES.Provider, { value: en2, children: c2 });
6623
- }
6624
- function eC(e5, t2, n2) {
6625
- let r2 = kS(e5, jx(t2), n2);
6626
- return { target: r2, key: JSON.stringify(r2), awaitsPreferences: t2 === Dx && !e5 };
6627
- }
6628
- function tC({ target: e5, awaitsPreferences: t2 }, { refreshSignal: n2, warmupData: r2, language: i2, currency: a2 }) {
6629
- return e5.by === `none` ? ks(t2 ? US : HS) : e5.by === `multi` ? js(Sx({ key: cx(i2, a2, e5.serviceIds), refresh: n2 !== 0, warmupData: r2, fetchData: () => es(`service-context-load-multi-service`, { feature: Zo.service }, Zm(e5.serviceIds)) }), WS, GS) : js(Sx({ key: sx(i2, a2, e5.by, e5.value), refresh: n2 !== 0, warmupData: r2, fetchData: () => es(`service-context-load`, { feature: Zo.service }, e5.by === `slug` ? Ym(e5.value) : Xm(e5.value)) }), BS, VS);
6630
- }
6631
- function nC({ routerSlug: e5, initialServiceId: t2, refreshSignal: n2, editingSurface: r2, children: i2 }) {
6632
- Iv(Ev.SERVICE);
6633
- let a2 = rx(), o2 = Gb(), { getParsedUrl: s2 } = ps(), c2 = Ss(), u2 = Es(`servicePageSeoTags`) && !r2 && (c2 === `servicePage` || c2 === `calendarPage`) ? c2 : null, [f2] = (0, import_react.useState)(() => r2 ? null : $x(s2().searchParams)), p2 = Ax(), m2 = f2 ? `none` : p2, g2 = $b(), _2 = { refreshSignal: n2, warmupData: a2, language: o2, currency: g2 }, [v2, y2] = (0, import_react.useState)(() => {
6634
- let n3 = eC(e5, m2, t2);
6635
- return { ...n3, currency: g2, promise: tC(n3, _2) };
6623
+ }, [Oe2, a2, T2, ee2, te2, E2]), Ut2 = SS(fe2, Bt2()), Wt2 = (0, import_react.useCallback)(() => {
6624
+ E2(By({ component: Jy.GO_TO_HOMEPAGE_BUTTON, action: Ky, pageName: Yy })), ee2(`/`).catch((e6) => $o(e6, { feature: Zo.reschedule, action: `go-home` }));
6625
+ }, [ee2, E2]), { serviceBookability: Gt2, policyDescription: Kt2, coverImage: qt2 } = et2, Jt2 = (0, import_react.useCallback)(() => Gt2.isAvailableForBooking, [Gt2]), Yt2 = (0, import_react.useCallback)(() => !!Kt2, [Kt2]), Xt2 = (0, import_react.useCallback)(() => !!qt2, [qt2]), Zt2 = (0, import_react.useCallback)(() => iv(p2), [p2]), Qt2 = (0, import_react.useCallback)(() => !!p2 && Pb(p2), [p2]), $t2 = (0, import_react.useMemo)(() => ({ ...et2, service: p2, servicePageLink: je2, serviceOptionsAndVariants: qe2, pricingOption: gt2, isLoadingServiceOptionsAndVariants: Ke2, isAvailableForBooking: Jt2, hasPolicyDescription: Yt2, hasCoverImage: Xt2, hasGalleryImages: Zt2, isVariantDuration: Qt2, isLoading: g2, hasError: m2, locale: y2, selectStaffMember: dt2, clearSelection: pt2, clearStaffMember: ft2, selection: fe2, isSelectionPending: me2 || fe2.serviceId !== (M2 ?? ``), selectionTimezone: ge2.current ?? Fe2, setVariant: mt2, setVariantCounts: vt2, maxParticipantsPerBooking: ht2.max, toggleAddOn: yt2, setAddOnQuantity: bt2, setSlot: xt2, clearSlot: St2, setMultiServiceSlot: wt2, clearMultiServiceSlot: Tt2, draftRevision: Ee2, wantsPromoCode: st2, setWantsPromoCode: ct2, withSelectionParam: R2, navigateToNextPage: zt2, navigateToMultiServiceForm: Rt2, resolveNextPageHref: At2, isNavigating: Mt2, isWaitlistSlotSelected: ve2, siteId: be2, editingSurface: o2, openPreferences: Lt2, multiServiceAppointmentsEnabled: Re2, isMultiServiceAppointment: _2, multiServiceAppointmentServices: v2, multiServiceAppointmentSelections: Dt2, multiServiceAppointmentOptionsAndVariants: Qe2, multiServiceAppointmentVariantsStatus: $e2, bookingsSettingsLoading: Le2, reschedule: Oe2, rescheduleBooking: Ht2, goHomeAfterReschedule: Wt2, canRescheduleToPick: Ut2 }), [et2, p2, je2, qe2, gt2, Ke2, Jt2, Yt2, Xt2, Zt2, Qt2, g2, m2, y2, dt2, pt2, ft2, fe2, me2, M2, Fe2, mt2, vt2, ht2.max, yt2, bt2, xt2, St2, wt2, Tt2, Ee2, st2, ct2, R2, zt2, Rt2, At2, Mt2, ve2, be2, o2, Lt2, Re2, _2, v2, Dt2, Qe2, $e2, Le2, Oe2, Ht2, Wt2, Ut2]);
6626
+ return (0, import_jsx_runtime.jsx)(kS.Provider, { value: $t2, children: c2 });
6627
+ }
6628
+ function nC(e5, t2, n2) {
6629
+ let r2 = MS(e5, Px(t2), n2);
6630
+ return { target: r2, key: JSON.stringify(r2), awaitsPreferences: t2 === Ax && !e5 };
6631
+ }
6632
+ function rC({ target: e5, awaitsPreferences: t2 }, { refreshSignal: n2, warmupData: r2, language: i2, currency: a2 }) {
6633
+ return e5.by === `none` ? ks(t2 ? GS : WS) : e5.by === `multi` ? js(Tx({ key: dx(i2, a2, e5.serviceIds), refresh: n2 !== 0, warmupData: r2, fetchData: () => es(`service-context-load-multi-service`, { feature: Zo.service }, Zm(e5.serviceIds)) }), KS, qS) : js(Tx({ key: ux(i2, a2, e5.by, e5.value), refresh: n2 !== 0, warmupData: r2, fetchData: () => es(`service-context-load`, { feature: Zo.service }, e5.by === `slug` ? Ym(e5.value) : Xm(e5.value)) }), HS, US);
6634
+ }
6635
+ function iC({ routerSlug: e5, initialServiceId: t2, refreshSignal: n2, editingSurface: r2, children: i2 }) {
6636
+ Zy(Vy.SERVICE);
6637
+ let a2 = sx(), o2 = Xb(), { getParsedUrl: s2 } = ps(), c2 = Ss(), u2 = Es(`servicePageSeoTags`) && !r2 && (c2 === `servicePage` || c2 === `calendarPage`) ? c2 : null, [f2] = (0, import_react.useState)(() => r2 ? null : nS(s2().searchParams)), p2 = Nx(), m2 = f2 ? `none` : p2, g2 = rx(), _2 = { refreshSignal: n2, warmupData: a2, language: o2, currency: g2 }, [v2, y2] = (0, import_react.useState)(() => {
6638
+ let n3 = nC(e5, m2, t2);
6639
+ return { ...n3, currency: g2, promise: rC(n3, _2) };
6636
6640
  });
6637
- if (v2.awaitsPreferences && m2 !== Dx) {
6638
- let n3 = eC(e5, m2, t2), r3 = n3.key === v2.key && n3.target.by !== `none` && v2.currency === g2;
6639
- y2({ ...n3, currency: g2, promise: r3 ? v2.promise : tC(n3, _2) });
6640
- } else v2.currency !== g2 && y2({ ...v2, currency: g2, promise: tC(v2, _2) });
6641
+ if (v2.awaitsPreferences && m2 !== Ax) {
6642
+ let n3 = nC(e5, m2, t2), r3 = n3.key === v2.key && n3.target.by !== `none` && v2.currency === g2;
6643
+ y2({ ...n3, currency: g2, promise: r3 ? v2.promise : rC(n3, _2) });
6644
+ } else v2.currency !== g2 && y2({ ...v2, currency: g2, promise: rC(v2, _2) });
6641
6645
  let b2 = v2.promise;
6642
- return (0, import_react.useMemo)(() => (0, import_jsx_runtime.jsx)(YS, { servicePromise: b2, refreshSignal: n2, rescheduleRequest: f2, editingSurface: r2, seoPage: u2, children: i2 }), [b2, n2, f2, r2, u2, i2]);
6646
+ return (0, import_react.useMemo)(() => (0, import_jsx_runtime.jsx)(ZS, { servicePromise: b2, refreshSignal: n2, rescheduleRequest: f2, editingSurface: r2, seoPage: u2, children: i2 }), [b2, n2, f2, r2, u2, i2]);
6643
6647
  }
6644
- function rC({ serviceData: e5, servicePicker: t2, refreshSignal: n2 = 0, editingSurface: r2 = false, children: i2 }) {
6645
- let { pathname: a2 } = ps(), o2 = xs(), s2 = Gb(), c2 = t2?.serviceId?.$eq, u2 = e5?.service ?? null, d2 = (0, import_react.useMemo)(() => u2 ? { service: u2, masterEvents: e5?.masterEvents ?? IS, serviceOptionsAndVariants: e5?.serviceOptionsAndVariants ?? null, bookingsSettings: e5?.bookingsSettings } : null, [u2, e5?.masterEvents, e5?.serviceOptionsAndVariants, e5?.bookingsSettings]);
6646
- return d2 ? (0, import_jsx_runtime.jsx)(YS, { injected: d2, bookingsSettings: d2.bookingsSettings, editingSurface: r2, children: i2 }, `injected:${n2}`) : e5 ? (0, import_jsx_runtime.jsx)(YS, { bookingsSettings: e5.bookingsSettings, editingSurface: r2, children: i2 }) : (0, import_jsx_runtime.jsx)(nC, { routerSlug: o2, initialServiceId: c2, refreshSignal: n2, editingSurface: r2, children: i2 }, `fetch:${a2}:${o2 ?? ``}:${c2 ?? ``}:${n2}:${r2}:${s2}`);
6648
+ function aC({ serviceData: e5, servicePicker: t2, refreshSignal: n2 = 0, editingSurface: r2 = false, children: i2 }) {
6649
+ let { pathname: a2 } = ps(), o2 = xs(), s2 = Xb(), c2 = t2?.serviceId?.$eq, u2 = e5?.service ?? null, d2 = (0, import_react.useMemo)(() => u2 ? { service: u2, masterEvents: e5?.masterEvents ?? zS, serviceOptionsAndVariants: e5?.serviceOptionsAndVariants ?? null, bookingsSettings: e5?.bookingsSettings } : null, [u2, e5?.masterEvents, e5?.serviceOptionsAndVariants, e5?.bookingsSettings]);
6650
+ return d2 ? (0, import_jsx_runtime.jsx)(ZS, { injected: d2, bookingsSettings: d2.bookingsSettings, editingSurface: r2, children: i2 }, `injected:${n2}`) : e5 ? (0, import_jsx_runtime.jsx)(ZS, { bookingsSettings: e5.bookingsSettings, editingSurface: r2, children: i2 }) : (0, import_jsx_runtime.jsx)(iC, { routerSlug: o2, initialServiceId: c2, refreshSignal: n2, editingSurface: r2, children: i2 }, `fetch:${a2}:${o2 ?? ``}:${c2 ?? ``}:${n2}:${r2}:${s2}`);
6647
6651
  }
6648
- function iC(e5) {
6652
+ function oC(e5) {
6649
6653
  let t2 = new URL(e5);
6650
6654
  return t2.searchParams.delete(i_.blob), t2.searchParams.delete(i_.legacyBlob), t2;
6651
6655
  }
6652
- var aC = ya(`426941a1-1d08-4cf4-ae61-e433e800cde5`);
6656
+ var sC = ya(`426941a1-1d08-4cf4-ae61-e433e800cde5`);
6653
6657
  // Annotate the CommonJS export names for ESM import in node:
6654
6658
  0 && (module.exports = {
6655
6659
  SERVICE_CONTEXT_MISSING_PROVIDER_ERROR,