@wix/form-elements 1.135.0 → 1.136.0

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 (109) hide show
  1. package/dist/component/appointment-rac-DsD7xLmb.js +1010 -0
  2. package/dist/component/{bookings-address-rac-BK-sU26E.js → bookings-address-rac-ByaFu51U.js} +1 -1
  3. package/dist/component/{bookings-email-rac-DZ3HVkyn.js → bookings-email-rac-CxuvkcYw.js} +1 -1
  4. package/dist/component/{bookings-first-name-rac-Ci4PHqOr.js → bookings-first-name-rac-JXLJa_7E.js} +1 -1
  5. package/dist/component/{bookings-header-rac-C_MYNrDA.js → bookings-header-rac-CIQTbf9d.js} +1 -1
  6. package/dist/component/{bookings-last-name-rac-CdNlwyjm.js → bookings-last-name-rac-_2Xt4BPe.js} +1 -1
  7. package/dist/component/{bookings-login-bar-rac-CP2JcaVr.js → bookings-login-bar-rac-BUjys5i9.js} +6 -6
  8. package/dist/component/{bookings-phone-rac-BV8sqxil.js → bookings-phone-rac-DlsdGmOt.js} +1 -1
  9. package/dist/component/{bookings-rich-text-rac-DQtcYRsh.js → bookings-rich-text-rac-BvRdhL7M.js} +1 -1
  10. package/dist/component/{checkbox-field-rac-DPNqHTNc.js → checkbox-field-rac-Be6wicaA.js} +121 -121
  11. package/dist/component/{checkbox-group-field-headless-DhhynlgN.js → checkbox-group-field-headless-BJ0pGvXi.js} +19 -19
  12. package/dist/component/{checkbox-group-field-rac-B3zOW7qr.js → checkbox-group-field-rac-D7xqqVf6.js} +4 -4
  13. package/dist/component/{checkbox-group-rac-Qy03hO31.js → checkbox-group-rac-DtCS-gEH.js} +1 -1
  14. package/dist/component/{checkbox-rac-DYr3RaHj.js → checkbox-rac-ub7MFwY-.js} +1 -1
  15. package/dist/component/{contacts-address-rac-Bi-etpfX.js → contacts-address-rac-Bwsdpg11.js} +1 -1
  16. package/dist/component/{contacts-birthdate-rac-D2LLjX9P.js → contacts-birthdate-rac-D54hibhb.js} +1 -1
  17. package/dist/component/{contacts-company-rac-C9ImoG_i.js → contacts-company-rac-CKqzgKio.js} +1 -1
  18. package/dist/component/{contacts-email-rac-DeGblC9V.js → contacts-email-rac-Dxm31wuY.js} +1 -1
  19. package/dist/component/{contacts-first-name-rac-Xk3m57jK.js → contacts-first-name-rac-CXHsx6Vy.js} +1 -1
  20. package/dist/component/{contacts-last-name-rac-BKE-1IYB.js → contacts-last-name-rac-B0S268f3.js} +1 -1
  21. package/dist/component/{contacts-phone-rac-CHmtTutD.js → contacts-phone-rac-DEbgIiEj.js} +1 -1
  22. package/dist/component/{contacts-position-rac-BS3TySLG.js → contacts-position-rac-D31uoOlR.js} +1 -1
  23. package/dist/component/{contacts-subscribe-rac--fpczJiB.js → contacts-subscribe-rac-DJ8NtoxZ.js} +1 -1
  24. package/dist/component/{contacts-tax-id-rac-CHkn8vkL.js → contacts-tax-id-rac-DTQffHAo.js} +1 -1
  25. package/dist/component/{date-availability-70Vb-dlb.js → date-availability-DmhJ9apH.js} +1 -1
  26. package/dist/component/{date-input-field-rac-BlkYEYM_.js → date-input-field-rac-BwM_q4FW.js} +52 -52
  27. package/dist/component/{date-input-rac-JdNFk07Q.js → date-input-rac-C93pgocp.js} +1 -1
  28. package/dist/component/{date-picker-field-rac-DHu11mY1.js → date-picker-field-rac-CtZL368W.js} +5 -5
  29. package/dist/component/{date-picker-rac-CZtWhFzM.js → date-picker-rac-4DNe6hOX.js} +1 -1
  30. package/dist/component/{date-time-input-field-rac-cHAALqS5.js → date-time-input-field-rac-MlCVy3Oz.js} +58 -58
  31. package/dist/component/{date-time-input-rac-Dz7GfoJO.js → date-time-input-rac-ByyBvFgo.js} +1 -1
  32. package/dist/component/{dext-checkbox-group-rac-ZNKzyWda.js → dext-checkbox-group-rac-BP76Xwiq.js} +4 -4
  33. package/dist/component/{dext-checkbox-rac-DfPFXrKu.js → dext-checkbox-rac-DGaKSh4Z.js} +1 -1
  34. package/dist/component/{dext-date-picker-rac-BPbl65qK.js → dext-date-picker-rac-UEXbMSlL.js} +1 -1
  35. package/dist/component/{dext-date-time-input-rac-D5ywbLtW.js → dext-date-time-input-rac-CsJcGK4I.js} +1 -1
  36. package/dist/component/{dext-dropdown-rac-BuVsPZOU.js → dext-dropdown-rac-BzbRzloh.js} +1 -1
  37. package/dist/component/{dext-email-rac-DRjt3lqT.js → dext-email-rac-DufFAnTi.js} +1 -1
  38. package/dist/component/{dext-number-input-rac-Bzrl87fo.js → dext-number-input-rac-D6xXi7B2.js} +1 -1
  39. package/dist/component/{dext-phone-rac-LibvQb8h.js → dext-phone-rac-svy9CDHW.js} +1 -1
  40. package/dist/component/{dext-radio-group-rac-BTWnIvwW.js → dext-radio-group-rac-C4p9NuQS.js} +4 -4
  41. package/dist/component/{dext-rating-input-rac-DTlnOcC8.js → dext-rating-input-rac-wJ7-RFFN.js} +1 -1
  42. package/dist/component/{dext-tags-rac-YdeijviH.js → dext-tags-rac-D2myHrSZ.js} +4 -4
  43. package/dist/component/{dext-text-area-rac-CdCzQYey.js → dext-text-area-rac-B4Fw_9mF.js} +1 -1
  44. package/dist/component/{dext-text-input-rac-B28RTezm.js → dext-text-input-rac-DlZanFMT.js} +1 -1
  45. package/dist/component/{dext-url-input-rac-B0ZBPbAb.js → dext-url-input-rac-DYjl3wuk.js} +1 -1
  46. package/dist/component/{donation-rac-_0cwsIAq.js → donation-rac-B6LwJxik.js} +72 -72
  47. package/dist/component/{dropdown-field-headless-DVZnbZAM.js → dropdown-field-headless-BAt2RoAH.js} +8 -8
  48. package/dist/component/{dropdown-field-rac-DWCj_Grt.js → dropdown-field-rac-DFjn3ecV.js} +7 -7
  49. package/dist/component/{dropdown-rac-Bpo-F5sc.js → dropdown-rac-DQ6keNRI.js} +1 -1
  50. package/dist/component/{ecom-address-rac-vJ0ku_Ld.js → ecom-address-rac-j1T2zp0k.js} +1 -1
  51. package/dist/component/{ecom-subscription-checkbox-rac-DgVReM6c.js → ecom-subscription-checkbox-rac-viTaRZsk.js} +2 -2
  52. package/dist/component/{email-input-field-rac-BXJGOBg-.js → email-input-field-rac-5eb-1w7B.js} +46 -46
  53. package/dist/component/{events-repeater-rac-CrXE_ppd.js → events-repeater-rac-BtcoN_Ra.js} +23 -23
  54. package/dist/component/{events-rsvp-rac-BGg3P1CQ.js → events-rsvp-rac-DSzFEmty.js} +10 -10
  55. package/dist/component/{field-error-headless-C3eOy1_l.js → field-error-headless-Bpe041x2.js} +6 -6
  56. package/dist/component/{field-label-headless-BMmR_IeF.js → field-label-headless-BUuK1Ftv.js} +7 -7
  57. package/dist/component/{file-upload-rac-Umix6wXx.js → file-upload-rac-CfU8Ygwq.js} +50 -50
  58. package/dist/component/{fixed-payment-rac-CfIJCBjb.js → fixed-payment-rac-CYp7zNq8.js} +12 -12
  59. package/dist/component/{form-CYPNOMwk.js → form-C6lnbh2O.js} +831 -823
  60. package/dist/component/form.css +1 -1
  61. package/dist/component/form.js +1 -1
  62. package/dist/component/{header-field-rac-oxHUTKYV.js → header-field-rac-B7YfrhId.js} +4 -4
  63. package/dist/component/{header-rac-DTGV923r.js → header-rac-BtJKAKAz.js} +1 -1
  64. package/dist/component/{image-choice-rac-B9JGl_h7.js → image-choice-rac-Bmq7Pyg6.js} +32 -32
  65. package/dist/component/{index-BOKSOnDK.js → index-BjPSeVyh.js} +107 -107
  66. package/dist/component/{index-C_ktc-yO.js → index-CQdUOkIN.js} +5 -5
  67. package/dist/component/{isObjectLike-Di8V7txC.js → isObjectLike-CxNqKfU5.js} +7 -7
  68. package/dist/component/{multiline-address-field-rac-zgmTbXlg.js → multiline-address-field-rac-BeiUJWKd.js} +115 -115
  69. package/dist/component/{multiline-address-rac-Cyb3dvBf.js → multiline-address-rac-B2mocF6M.js} +1 -1
  70. package/dist/component/{number-input-field-rac-DquqqRy_.js → number-input-field-rac-CQX7_S2O.js} +24 -24
  71. package/dist/component/{number-input-rac-G2DdTbk2.js → number-input-rac-BZri-E8P.js} +1 -1
  72. package/dist/component/{password-rac-DJCU0F38.js → password-rac-CdwrtDJU.js} +50 -50
  73. package/dist/component/{payment-input-rac-DlIYza6N.js → payment-input-rac-ClQiqmjm.js} +38 -38
  74. package/dist/component/{phone-input-field-rac-B10TInMa.js → phone-input-field-rac-BtG_Rado.js} +56 -56
  75. package/dist/component/{phone-rac-BuyttJpM.js → phone-rac-CdcAMa5E.js} +1 -1
  76. package/dist/component/{product-list-rac-WrSJwQ_g.js → product-list-rac-Dp_YK6mo.js} +61 -61
  77. package/dist/component/{quiz-radio-group-rac-CHxZ_pK_.js → quiz-radio-group-rac-CorojxKD.js} +1 -1
  78. package/dist/component/{radio-button-module-classes-DjJU-8ZB.js → radio-button-module-classes-ZX12Fyj4.js} +3 -3
  79. package/dist/component/{radio-group-field-rac-BImiqcKa.js → radio-group-field-rac-BifCDpE4.js} +10 -10
  80. package/dist/component/{radio-group-rac-CDkJeGpN.js → radio-group-rac-CJ2fzqnY.js} +1 -1
  81. package/dist/component/{rating-input-field-rac-Dsr_S5qN.js → rating-input-field-rac-Dg1T0DZW.js} +28 -28
  82. package/dist/component/{rating-input-rac-BJUW8U93.js → rating-input-rac-Ba4YK13i.js} +1 -1
  83. package/dist/component/{rich-content-rac.module-BfQJqA-x.js → rich-content-rac.module-BehwBL3L.js} +3 -3
  84. package/dist/component/{rich-text-field-rac-DIuZbu_u.js → rich-text-field-rac-DtIWdB-S.js} +7 -7
  85. package/dist/component/{rich-text-rac-C39fpEiP.js → rich-text-rac-BX4eDDFw.js} +1 -1
  86. package/dist/component/service-dropdown-rac-68WLBlsa.js +146 -0
  87. package/dist/component/{services-multi-choice-rac-GVb4qA7g.js → services-multi-choice-rac-8yNdAHfS.js} +7 -7
  88. package/dist/component/{signature-rac-nC5pr6nB.js → signature-rac-DeVOyl5O.js} +73 -73
  89. package/dist/component/{submit-button-rac-eUjgrx9Q.js → submit-button-rac-IOr1g-G-.js} +12 -12
  90. package/dist/component/{tags-field-rac-zv30chSd.js → tags-field-rac-DaiMlAxt.js} +27 -27
  91. package/dist/component/{tags-rac-PnS2SxVP.js → tags-rac-BgrUkY0A.js} +1 -1
  92. package/dist/component/{text-area-field-rac-DLeOMD4g.js → text-area-field-rac-CLPZEY93.js} +16 -16
  93. package/dist/component/{text-area-rac-jZ_mh45C.js → text-area-rac-C8PdPSzX.js} +1 -1
  94. package/dist/component/{text-input-field-rac-DifV7Erd.js → text-input-field-rac-Dm-xU8Rg.js} +5 -5
  95. package/dist/component/{text-input-headless-DhVEjorY.js → text-input-headless-BEmRjL8Z.js} +6 -6
  96. package/dist/component/{text-input-rac-Ce4qKN9M.js → text-input-rac-C-FnaOXT.js} +1 -1
  97. package/dist/component/{time-input-rac-1kW3aDIo.js → time-input-rac-VmTURkiK.js} +46 -46
  98. package/dist/component/{url-input-field-rac-D9xXAQCq.js → url-input-field-rac-CnnS0tVx.js} +23 -23
  99. package/dist/component/{url-input-rac-SaAybDdN.js → url-input-rac-6nd_ccoP.js} +1 -1
  100. package/dist/component/{use-dropdown-option-class-name-C_MO_0JS.js → use-dropdown-option-class-name-CcZl1qrj.js} +2 -2
  101. package/dist/component/{use-dropdown-trigger-class-name-D7EMiD-M.js → use-dropdown-trigger-class-name-BNc0mkdK.js} +4 -4
  102. package/dist/component/{use-element-state-class-name-DZFi3Z42.js → use-element-state-class-name-BU6RXqBy.js} +1 -1
  103. package/dist/component/{use-hoverable-input-class-name-JAZ1mif0.js → use-hoverable-input-class-name-CkXPkbiP.js} +2 -2
  104. package/dist/component/{use-service-options-base-ZX4iaxzr.js → use-service-options-base-B5afDbnr.js} +4 -4
  105. package/dist/component/use-text-input-class-name-BB3V6Q0b.js +6 -0
  106. package/package.json +2 -2
  107. package/dist/component/appointment-rac-CYCddSl9.js +0 -1010
  108. package/dist/component/service-dropdown-rac-Bc9hEpx3.js +0 -146
  109. package/dist/component/use-text-input-class-name-XFjQX8q1.js +0 -6
@@ -0,0 +1,1010 @@
1
+ import o, { useRef as J, useState as j, useEffect as P, createContext as Ke, useContext as $e, useMemo as B, useCallback as se } from "react";
2
+ import { RicosViewer as it } from "@wix/ricos/viewer";
3
+ import v from "classnames";
4
+ import { C as he } from "./chevron-down-icon-CcpVm6B-.js";
5
+ import { E as lt } from "./error-icon-hZxQ6DEy.js";
6
+ import { g as ct, c as Ce } from "./calendar.module-CKCBG_Pg.js";
7
+ import { H as me } from "./custom-focus-class-_483Pkwp.js";
8
+ import { s as ue } from "./field-rac.module-DfEb7pBp.js";
9
+ import { bb as De, ba as mt, bf as Te, bt as ut, bs as dt, bj as re, bg as ie, bl as ft, bi as Dt, F as Et, h as St, M as _t, Y as pt, g as Nt, j as We, i as At, m as yt, k as bt, G as It, u as Lt, l as Ot } from "./form-C6lnbh2O.js";
10
+ import { u as gt } from "./use-element-state-class-name-BU6RXqBy.js";
11
+ import { ListBox as Tt, Button as ve, ListBoxItem as vt, RadioGroup as kt, RadioField as Rt, RadioButton as Mt } from "react-aria-components";
12
+ import { f as T, a as Ee } from "./find-child-C60k4CxG.js";
13
+ import { D as wt, E as Ft } from "./field-error-headless-Bpe041x2.js";
14
+ import { L as ht } from "./field-label-headless-BUuK1Ftv.js";
15
+ import { F as Ct } from "./fieldset-headless-CD3fds9J.js";
16
+ import "date-fns";
17
+ import { V as Ge } from "./headless-styles-CmcyA_pi.js";
18
+ function Wt(e) {
19
+ return { evid: 40, src: 16, endpoint: "", params: e };
20
+ }
21
+ var Le = /* @__PURE__ */ (function(e) {
22
+ return e.BOOKING_NOT_INSTALL = "BOOKING_NOT_INSTALL", e.NO_AVAILABILITY_DATES_FOUND = "NO_AVAILABILITY_DATES_FOUND", e.GENERAL = "GENERAL", e;
23
+ })({}), z = /* @__PURE__ */ (function(e) {
24
+ return e.LOADING = "LOADING", e.DONE = "DONE", e.ERROR = "ERROR", e;
25
+ })({});
26
+ const V = 4;
27
+ var Q = /* @__PURE__ */ (function(e) {
28
+ return e.FORM = "form", e.NO_AVAILABILITY_FOR_DATE = "no availability for date empty state", e.NO_AVAILABILITY_AT_ALL = "no availability at all empty state", e.SLOT = "slot", e.DATE = "date", e.PAGINATION = "pagination", e.SHOW_MORE = "show more", e;
29
+ })({}), te = /* @__PURE__ */ (function(e) {
30
+ return e.LOAD = "load", e.CLICK = "click", e;
31
+ })({});
32
+ const Bt = (e) => {
33
+ var t;
34
+ return {
35
+ bookingsServiceId: e == null ? void 0 : e.id,
36
+ formGuid: (t = e == null ? void 0 : e.form) == null ? void 0 : t.id,
37
+ serviceProperties: zt(e)
38
+ };
39
+ }, zt = (e) => {
40
+ var t;
41
+ return JSON.stringify({
42
+ serviceId: e == null ? void 0 : e.id,
43
+ serviceType: e == null ? void 0 : e.type,
44
+ locationIds: (t = e == null ? void 0 : e.locations) == null ? void 0 : t.map((n) => n.id).filter((n) => n),
45
+ staffMemberIds: e == null ? void 0 : e.staffMemberIds,
46
+ isOfferedAsPricingPlan: !1
47
+ });
48
+ }, Ze = (e) => {
49
+ var i;
50
+ const { appointmentFieldProps: t } = ke(), { isEditor: n, isComposer: a } = De(), s = mt(), r = e || ((i = t == null ? void 0 : t.initialData) == null ? void 0 : i.service);
51
+ if (!(n || a))
52
+ return {
53
+ ...s,
54
+ report: (l) => s == null ? void 0 : s.report(Wt({
55
+ ...Bt(r),
56
+ ...l
57
+ }))
58
+ };
59
+ };
60
+ var Oe;
61
+ (function(e) {
62
+ e.UNDEFINED = "UNDEFINED", e.OWNER_BUSINESS = "OWNER_BUSINESS", e.OWNER_CUSTOM = "OWNER_CUSTOM", e.CUSTOM = "CUSTOM";
63
+ })(Oe || (Oe = {}));
64
+ var Be;
65
+ (function(e) {
66
+ e.UNKNOWN_REQUESTED_GENDER = "UNKNOWN_REQUESTED_GENDER", e.ANY_MALE = "ANY_MALE", e.ANY_FEMALE = "ANY_FEMALE";
67
+ })(Be || (Be = {}));
68
+ var ze;
69
+ (function(e) {
70
+ e.UNKNOWN_LOCATION_TYPE = "UNKNOWN_LOCATION_TYPE", e.BUSINESS = "BUSINESS", e.CUSTOM = "CUSTOM", e.CUSTOMER = "CUSTOMER";
71
+ })(ze || (ze = {}));
72
+ var Pe;
73
+ (function(e) {
74
+ e.UNKNOWN_REQUESTED_GENDER = "UNKNOWN_REQUESTED_GENDER", e.ANY_MALE = "ANY_MALE", e.ANY_FEMALE = "ANY_FEMALE";
75
+ })(Pe || (Pe = {}));
76
+ var Ue;
77
+ (function(e) {
78
+ e.ASC = "ASC", e.DESC = "DESC";
79
+ })(Ue || (Ue = {}));
80
+ const Pt = (e) => {
81
+ const { service: t } = e || {};
82
+ return (t == null ? void 0 : t.id) ? null : {
83
+ type: Le.GENERAL,
84
+ message: "Service ID is missing"
85
+ };
86
+ }, Ut = ({ appointmentFieldProps: e, isEditor: t, isComposer: n }) => {
87
+ const { initialData: a } = e, s = Yt();
88
+ if (t || n)
89
+ return {
90
+ ...s,
91
+ timezone: Ve(),
92
+ dataStatus: z.DONE
93
+ };
94
+ {
95
+ const r = Pt(a);
96
+ if (r)
97
+ return {
98
+ dataStatus: z.ERROR,
99
+ error: r
100
+ };
101
+ }
102
+ return {
103
+ ...s,
104
+ dataStatus: z.LOADING
105
+ };
106
+ }, xt = (e, t) => {
107
+ const n = /* @__PURE__ */ new Date(), a = new Date(n);
108
+ a.setMonth(a.getMonth() + e);
109
+ const s = new Date(n.toLocaleString("en-US", {
110
+ timeZone: t
111
+ })), r = new Date(a.toLocaleString("en-US", {
112
+ timeZone: t
113
+ }));
114
+ return {
115
+ startDate: s,
116
+ endDate: r
117
+ };
118
+ }, Ve = () => Intl.DateTimeFormat().resolvedOptions().timeZone, Ht = (e) => {
119
+ var t, n, a;
120
+ if ((n = (t = e == null ? void 0 : e[0]) == null ? void 0 : t.slot) != null && n.startDate)
121
+ return new Date((a = e[0].slot) == null ? void 0 : a.startDate);
122
+ }, Yt = ({ duration: e = 60, timezone: t = "UTC" } = {}) => {
123
+ var E, d;
124
+ const n = "267d1c11-8019-4e3d-b9c6-cd2b859c69e2", a = /* @__PURE__ */ new Date(), s = [], r = [], i = a.toISOString().split("T")[0], l = 10, c = 18;
125
+ let D = /* @__PURE__ */ new Date(`${i}T${l}:00:00`), u = new Date(D);
126
+ u.setMinutes(u.getMinutes() + e);
127
+ let S = !1;
128
+ for (; u.getHours() < c || u.getHours() === c && u.getMinutes() === 0; ) {
129
+ const g = {
130
+ slot: {
131
+ serviceId: n,
132
+ startDate: D.toISOString(),
133
+ endDate: u.toISOString(),
134
+ location: {
135
+ locationType: Oe.CUSTOM
136
+ }
137
+ },
138
+ bookable: !0,
139
+ totalSpots: 1,
140
+ openSpots: 1,
141
+ bookingPolicyViolations: {
142
+ tooEarlyToBook: !1,
143
+ tooLateToBook: !1,
144
+ bookOnlineDisabled: !1
145
+ },
146
+ nestedSlots: []
147
+ };
148
+ r.push(g), S || (s.push(g), S = !0), D = new Date(u), u = new Date(D), u.setMinutes(u.getMinutes() + e);
149
+ }
150
+ return {
151
+ availabilitySlots: r,
152
+ availabilityDates: s,
153
+ timezone: t,
154
+ currentSlotBulkSize: V,
155
+ selectedDate: s.length > 0 && ((d = (E = s[0]) == null ? void 0 : E.slot) != null && d.startDate) ? new Date(s[0].slot.startDate) : void 0
156
+ };
157
+ };
158
+ function Kt(e) {
159
+ var d;
160
+ const { initialData: t, onChange: n, value: a } = e, { isEditor: s, isComposer: r } = De(), i = (d = t == null ? void 0 : t.service) == null ? void 0 : d.id, { actions: l } = Te(), c = J(l);
161
+ c.current = l;
162
+ const D = !!(l != null && l.getAvailabilityDates && (l != null && l.getAvailabilitySlots)), [u, S] = j(null), E = Ze(t == null ? void 0 : t.service);
163
+ return P(() => {
164
+ i && !s && !r && D && (async () => {
165
+ var b, I, U, x, H;
166
+ const M = Ve(), A = {
167
+ currentSlotBulkSize: V,
168
+ timezone: M,
169
+ dataStatus: z.LOADING
170
+ };
171
+ try {
172
+ const Y = async (ae) => {
173
+ var _, p;
174
+ const { startDate: $, endDate: w } = xt(ae, M);
175
+ return (p = (_ = c.current) == null ? void 0 : _.getAvailabilityDates) == null ? void 0 : p.call(_, {
176
+ serviceId: i,
177
+ fromDate: $,
178
+ toDate: w,
179
+ timeZone: M
180
+ });
181
+ };
182
+ if (A.availabilityDates = await Y(2), (b = A.availabilityDates) != null && b.length || (A.availabilityDates = await Y(6)), !((I = A.availabilityDates) != null && I.length)) {
183
+ E == null || E.report({
184
+ action: te.LOAD,
185
+ component: Q.NO_AVAILABILITY_AT_ALL
186
+ }), S({
187
+ dataStatus: z.ERROR,
188
+ error: {
189
+ type: Le.NO_AVAILABILITY_DATES_FOUND,
190
+ message: "No availability dates found"
191
+ }
192
+ });
193
+ return;
194
+ }
195
+ A.selectedDate = Ht(A.availabilityDates), A.selectedDate && (A.availabilitySlots = await ((x = (U = c.current) == null ? void 0 : U.getAvailabilitySlots) == null ? void 0 : x.call(U, {
196
+ serviceId: i,
197
+ timeZone: M,
198
+ selectedDate: A.selectedDate
199
+ }))), E == null || E.report({
200
+ action: te.LOAD,
201
+ component: (H = A.availabilityDates) != null && H.length ? Q.FORM : Q.NO_AVAILABILITY_FOR_DATE
202
+ }), a != null && a.startDate || n(void 0), S({
203
+ ...A,
204
+ dataStatus: z.DONE
205
+ });
206
+ } catch (Y) {
207
+ console.error(Y), S({
208
+ dataStatus: z.ERROR,
209
+ error: {
210
+ type: Le.GENERAL,
211
+ message: "An error occurred in initialAppointmentState"
212
+ }
213
+ });
214
+ }
215
+ })();
216
+ }, [
217
+ s,
218
+ r,
219
+ i,
220
+ D
221
+ ]), u;
222
+ }
223
+ const qe = /* @__PURE__ */ Ke({
224
+ appointmentState: {},
225
+ setAppointmentState: () => {
226
+ }
227
+ }), $t = ({ appointmentFieldProps: e, children: t }) => {
228
+ const { isEditor: n, isComposer: a } = De(), [s, r] = j(() => Ut({
229
+ appointmentFieldProps: e,
230
+ isEditor: n,
231
+ isComposer: a
232
+ })), i = Kt(e);
233
+ return P(() => {
234
+ i && r({
235
+ ...s,
236
+ ...i
237
+ });
238
+ }, [
239
+ i
240
+ ]), /* @__PURE__ */ o.createElement(qe.Provider, {
241
+ value: {
242
+ appointmentFieldProps: e,
243
+ appointmentState: s,
244
+ setAppointmentState: (l) => r({
245
+ ...s,
246
+ ...l
247
+ })
248
+ }
249
+ }, t);
250
+ }, ke = () => $e(qe), Gt = (e, t) => {
251
+ if (e.startOfWeek.getMonth() === e.endOfWeek.getMonth())
252
+ return new Intl.DateTimeFormat(t, {
253
+ month: "long",
254
+ year: "numeric"
255
+ }).format(e.endOfWeek);
256
+ const n = new Intl.DateTimeFormat(t, {
257
+ month: "short"
258
+ }).format(e.startOfWeek), a = new Intl.DateTimeFormat(t, {
259
+ month: "short",
260
+ year: "numeric"
261
+ }).format(e.endOfWeek);
262
+ return `${n} - ${a}`;
263
+ }, Zt = (e) => !(e != null && e.startDate) || !(e != null && e.endDate) || !(e != null && e.timeZone) ? null : {
264
+ startDate: e == null ? void 0 : e.startDate,
265
+ endDate: e == null ? void 0 : e.endDate,
266
+ timeZone: e == null ? void 0 : e.timeZone
267
+ }, xe = ({ timezone: e, language: t, formatType: n }) => {
268
+ var s;
269
+ return (s = new Intl.DateTimeFormat(t, {
270
+ timeZone: e,
271
+ timeZoneName: n === "name" ? "long" : "short"
272
+ }).formatToParts(/* @__PURE__ */ new Date()).find(({ type: r }) => r === "timeZoneName")) == null ? void 0 : s.value;
273
+ }, Vt = ({ timezone: e, language: t }) => {
274
+ const n = xe({
275
+ timezone: e,
276
+ language: t,
277
+ formatType: "name"
278
+ }), a = xe({
279
+ timezone: e,
280
+ language: t,
281
+ formatType: "offset"
282
+ });
283
+ return `${n} (${a})`;
284
+ }, ne = (e, t) => e.getFullYear() === t.getFullYear() && e.getMonth() === t.getMonth() && e.getDate() === t.getDate(), qt = (e, t) => {
285
+ const n = new Date(e);
286
+ n.setDate(e.getDate() - t);
287
+ const a = new Date(e);
288
+ return a.setDate(e.getDate() + t), {
289
+ fromDate: n,
290
+ toDate: a
291
+ };
292
+ }, jt = ({ setIsReloadingSlots: e }) => {
293
+ const { appointmentFieldProps: t, appointmentState: n, setAppointmentState: a } = ke(), { value: s } = t, { actions: r } = Te();
294
+ P(() => {
295
+ (async () => {
296
+ var l, c;
297
+ if (s != null && s.startDate && (n != null && n.selectedDate) && (n == null ? void 0 : n.dataStatus) === z.DONE && !ne(new Date(s.startDate), n == null ? void 0 : n.selectedDate)) {
298
+ e(!0);
299
+ const u = new Date(s.startDate), { fromDate: S, toDate: E } = qt(u, 8), [d, g] = await Promise.all([
300
+ (l = r == null ? void 0 : r.getAvailabilityDates) == null ? void 0 : l.call(r, {
301
+ serviceId: t == null ? void 0 : t.initialData.service.id,
302
+ timeZone: (n == null ? void 0 : n.timezone) || "",
303
+ fromDate: S,
304
+ toDate: E
305
+ }),
306
+ (c = r == null ? void 0 : r.getAvailabilitySlots) == null ? void 0 : c.call(r, {
307
+ serviceId: t == null ? void 0 : t.initialData.service.id,
308
+ timeZone: (n == null ? void 0 : n.timezone) || "",
309
+ selectedDate: u
310
+ })
311
+ ]);
312
+ a({
313
+ availabilityDates: d,
314
+ selectedDate: u,
315
+ availabilitySlots: g
316
+ }), e(!1);
317
+ }
318
+ })();
319
+ }, [
320
+ s,
321
+ n == null ? void 0 : n.dataStatus
322
+ ]);
323
+ }, Qt = (e, t) => !e || !t.length ? e : e.filter((n) => {
324
+ var a;
325
+ return !t.includes(((a = n == null ? void 0 : n.slot) == null ? void 0 : a.startDate) ?? "");
326
+ }), de = (e) => !(e != null && e.startDate) || !(e != null && e.endDate) ? "" : `${e == null ? void 0 : e.startDate}_${e == null ? void 0 : e.endDate}`, Jt = ({ locale: e, endDate: t, startDate: n, timezone: a }) => {
327
+ const s = {
328
+ hour: "numeric",
329
+ minute: "numeric",
330
+ timeZone: a
331
+ }, r = new Intl.DateTimeFormat(e, s).format(new Date(n)), i = new Intl.DateTimeFormat(e, s).format(new Date(t));
332
+ return `${r} - ${i}`;
333
+ }, Xt = ({ selectedDate: e, locale: t, timezone: n }) => e ? new Intl.DateTimeFormat(t, {
334
+ weekday: "long",
335
+ month: "short",
336
+ day: "numeric",
337
+ timeZone: n
338
+ }).format(e) : "", en = (e, t) => {
339
+ let n;
340
+ return t.forEach((a, s) => {
341
+ var r, i;
342
+ de({
343
+ startDate: (r = a == null ? void 0 : a.slot) == null ? void 0 : r.startDate,
344
+ endDate: (i = a == null ? void 0 : a.slot) == null ? void 0 : i.endDate
345
+ }) === e && (n = s);
346
+ }), n;
347
+ };
348
+ var tn = /* @__PURE__ */ (function(e) {
349
+ return e.OS_LOCATION = "OS_LOCATION", e.CUSTOM_LOCATION = "CUSTOM_LOCATION", e;
350
+ })({});
351
+ const nn = "SLOT_UNAVAILABLE", an = (e) => {
352
+ var t;
353
+ return ((t = e == null ? void 0 : e.params) == null ? void 0 : t.reason) === nn;
354
+ }, on = ({ error: e, selectedSlot: t }) => {
355
+ const [n, a] = j([]), s = an(e), r = t == null ? void 0 : t.startDate, i = J(!1);
356
+ return P(() => {
357
+ if (!s) {
358
+ i.current = !1;
359
+ return;
360
+ }
361
+ i.current || (i.current = !0, r && a((l) => l.includes(r) ? l : [
362
+ ...l,
363
+ r
364
+ ]));
365
+ }, [
366
+ s,
367
+ r
368
+ ]), n;
369
+ }, q = 7, ge = (e) => {
370
+ const t = new Date(e);
371
+ return t.setHours(0, 0, 0, 0), t;
372
+ }, sn = (e) => {
373
+ const t = new Date(e);
374
+ return t.setHours(23, 59, 59, 999), t;
375
+ }, ee = (e, t) => {
376
+ const n = new Date(e);
377
+ return n.setDate(n.getDate() + t), n;
378
+ }, He = (e, t) => {
379
+ const n = ge(e), a = (n.getDay() - t + q) % q;
380
+ return ee(n, -a);
381
+ }, rn = (e) => `${e.getFullYear()}-${String(e.getMonth() + 1).padStart(2, "0")}-${String(e.getDate()).padStart(2, "0")}`, ln = (e, t, n) => {
382
+ const a = new Intl.DateTimeFormat(n, {
383
+ month: "short",
384
+ day: "numeric"
385
+ });
386
+ return typeof a.formatRange == "function" ? a.formatRange(e, t) : `${a.format(e)} - ${a.format(t)}`;
387
+ }, cn = (e, t = []) => t.some((n) => {
388
+ var a;
389
+ return !!((a = n.slot) != null && a.startDate) && ne(new Date(n.slot.startDate), e);
390
+ }), mn = () => {
391
+ var Fe;
392
+ const { appointmentFieldProps: e, appointmentState: t, setAppointmentState: n } = ke(), { language: a, isEditor: s, isComposer: r } = De(), { t: i } = ut(), { actions: l } = Te(), c = Ze(), [D, u] = j(!1), [S, E] = j(!1), [d, g] = j(), [M, A] = j();
393
+ jt({
394
+ setIsReloadingSlots: u
395
+ });
396
+ const { onChange: b, value: I, target: U, initialData: x, formatDescription: H, locationType: Y, error: ae } = e, { availabilityDates: $, availabilitySlots: w, timezone: _ = "", selectedDate: p, currentSlotBulkSize: k, dataStatus: G, error: le } = t, K = (Fe = x == null ? void 0 : x.service) == null ? void 0 : Fe.id, Z = G === z.LOADING, X = D || S, Se = !!le, Me = on({
397
+ error: ae,
398
+ selectedSlot: I
399
+ }), y = B(() => Qt(w, Me), [
400
+ w,
401
+ Me
402
+ ]);
403
+ P(() => {
404
+ b == null || b(Zt(I));
405
+ }, [
406
+ I == null ? void 0 : I.startDate,
407
+ I == null ? void 0 : I.endDate,
408
+ _
409
+ ]), dt((f) => {
410
+ const L = f == null ? void 0 : f[U];
411
+ w != null && w.length && n({
412
+ availabilitySlots: w.filter((O) => {
413
+ var R;
414
+ return ((R = O == null ? void 0 : O.slot) == null ? void 0 : R.startDate) !== (L == null ? void 0 : L.startDate);
415
+ })
416
+ });
417
+ }), P(() => {
418
+ if (y != null && y.length && k) {
419
+ const f = en(de(I ?? void 0), y);
420
+ f && f + 1 > k && n({
421
+ currentSlotBulkSize: f + 1
422
+ });
423
+ } else !(y != null && y.length) && I && (b == null || b(void 0));
424
+ }, [
425
+ I,
426
+ y,
427
+ $
428
+ ]);
429
+ const _e = B(() => ct(a), [
430
+ a
431
+ ]), we = J(p);
432
+ P(() => {
433
+ const f = we.current;
434
+ we.current = p, !!p && (!f || !ne(f, p)) && g(void 0);
435
+ }, [
436
+ p
437
+ ]);
438
+ const h = B(() => d ?? He(p ?? /* @__PURE__ */ new Date(), _e), [
439
+ d,
440
+ p,
441
+ _e
442
+ ]), Xe = B(() => {
443
+ const f = ge(/* @__PURE__ */ new Date()), L = new Intl.DateTimeFormat(a, {
444
+ weekday: "short"
445
+ }), O = new Intl.DateTimeFormat(a, {
446
+ day: "numeric"
447
+ }), R = new Intl.DateTimeFormat(a, {
448
+ weekday: "long",
449
+ month: "long",
450
+ day: "numeric"
451
+ });
452
+ return Array.from({
453
+ length: q
454
+ }, (oe, be) => {
455
+ const W = ee(h, be), Ie = !!p && ne(W, p), rt = ge(W) < f;
456
+ return {
457
+ key: rn(W),
458
+ date: W,
459
+ isSelected: Ie,
460
+ isAvailable: !Z && !X && !Ie && cn(W, $),
461
+ isDisabled: rt || X && !Ie,
462
+ isToday: ne(W, f),
463
+ dayOfMonthLabel: O.format(W),
464
+ weekdayLabel: L.format(W),
465
+ label: R.format(W),
466
+ availabilityLabel: i("form.appointment.accessibility.calendar.has-availability.aria-label")
467
+ };
468
+ });
469
+ }, [
470
+ h,
471
+ p,
472
+ $,
473
+ Z,
474
+ X,
475
+ a,
476
+ i
477
+ ]), pe = de(I ?? void 0) || void 0, Ne = B(() => Z || D ? [] : (y ?? []).slice(0, k).flatMap((f) => {
478
+ const { startDate: L, endDate: O } = f.slot ?? {};
479
+ if (!L || !O)
480
+ return [];
481
+ const R = de({
482
+ startDate: L,
483
+ endDate: O
484
+ });
485
+ return [
486
+ {
487
+ key: R,
488
+ startDate: L,
489
+ endDate: O,
490
+ timeRange: Jt({
491
+ startDate: L,
492
+ endDate: O,
493
+ locale: a,
494
+ timezone: _
495
+ }),
496
+ isSelected: R === pe
497
+ }
498
+ ];
499
+ }), [
500
+ y,
501
+ k,
502
+ Z,
503
+ D,
504
+ a,
505
+ _,
506
+ pe
507
+ ]), Ae = !D && !!(y != null && y.length) && (k || V) < y.length, ye = h > He(/* @__PURE__ */ new Date(), _e), et = se(
508
+ async (f) => {
509
+ var L;
510
+ if (!(X || p && ne(f, p))) {
511
+ u(!0), b == null || b(void 0), n({
512
+ currentSlotBulkSize: V,
513
+ selectedDate: f,
514
+ availabilitySlots: void 0
515
+ }), c == null || c.report({
516
+ action: te.CLICK,
517
+ component: Q.DATE
518
+ });
519
+ try {
520
+ const O = await ((L = l == null ? void 0 : l.getAvailabilitySlots) == null ? void 0 : L.call(l, {
521
+ serviceId: K,
522
+ timeZone: _,
523
+ selectedDate: f
524
+ }));
525
+ n({
526
+ currentSlotBulkSize: V,
527
+ selectedDate: f,
528
+ availabilitySlots: O
529
+ });
530
+ } catch {
531
+ } finally {
532
+ u(!1);
533
+ }
534
+ }
535
+ },
536
+ // eslint-disable-next-line react-hooks/exhaustive-deps
537
+ [
538
+ X,
539
+ p,
540
+ K,
541
+ _,
542
+ l,
543
+ b,
544
+ c
545
+ ]
546
+ ), ce = J(0), tt = se(
547
+ async (f) => {
548
+ var oe;
549
+ if (f < 0 && !ye)
550
+ return;
551
+ const L = h, O = ee(h, f * q);
552
+ if (g(O), s || r)
553
+ return;
554
+ const R = ++ce.current;
555
+ E(!0), c == null || c.report({
556
+ action: te.CLICK,
557
+ component: Q.PAGINATION
558
+ });
559
+ try {
560
+ const be = await ((oe = l == null ? void 0 : l.getAvailabilityDates) == null ? void 0 : oe.call(l, {
561
+ serviceId: K,
562
+ timeZone: _,
563
+ fromDate: O,
564
+ toDate: sn(ee(O, q - 1))
565
+ }));
566
+ R === ce.current && n({
567
+ availabilityDates: be
568
+ });
569
+ } catch {
570
+ R === ce.current && g(L);
571
+ } finally {
572
+ R === ce.current && E(!1);
573
+ }
574
+ },
575
+ // eslint-disable-next-line react-hooks/exhaustive-deps
576
+ [
577
+ ye,
578
+ h,
579
+ s,
580
+ r,
581
+ K,
582
+ _,
583
+ l,
584
+ c
585
+ ]
586
+ ), nt = se(
587
+ (f) => {
588
+ const L = Ne.find((oe) => oe.key === f);
589
+ if (!L)
590
+ return;
591
+ const { startDate: O, endDate: R } = L;
592
+ c == null || c.report({
593
+ action: te.CLICK,
594
+ component: Q.SLOT,
595
+ startTime: new Date(O).valueOf(),
596
+ endTime: new Date(R).valueOf()
597
+ }), b == null || b({
598
+ startDate: O,
599
+ endDate: R,
600
+ timeZone: _
601
+ });
602
+ },
603
+ // eslint-disable-next-line react-hooks/exhaustive-deps
604
+ [
605
+ Ne,
606
+ _,
607
+ b,
608
+ c
609
+ ]
610
+ ), at = se(() => {
611
+ if (!Ae)
612
+ return;
613
+ const f = k || V;
614
+ c == null || c.report({
615
+ action: te.CLICK,
616
+ component: Q.SHOW_MORE
617
+ }), A(f), n({
618
+ currentSlotBulkSize: f + V
619
+ });
620
+ }, [
621
+ Ae,
622
+ k,
623
+ c
624
+ ]), ot = se(() => A(void 0), []), st = B(() => {
625
+ if (Se)
626
+ return i("form.appointment.empty-state.notification.text");
627
+ if (!Z && !D && !(y != null && y.length))
628
+ return i("form.appointment.slots-not-found.text");
629
+ }, [
630
+ Se,
631
+ Z,
632
+ D,
633
+ y == null ? void 0 : y.length,
634
+ i
635
+ ]);
636
+ return {
637
+ days: Xe,
638
+ slots: Ne,
639
+ selectedSlotKey: pe,
640
+ selectDate: et,
641
+ selectSlot: nt,
642
+ changeWeek: tt,
643
+ showMoreSlots: at,
644
+ canGoToPreviousWeek: ye,
645
+ hasMoreSlots: Ae,
646
+ hasError: Se,
647
+ isLoading: Z,
648
+ isRefetching: X,
649
+ isReloadingSlots: D,
650
+ weekRangeLabel: ln(h, ee(h, q - 1), a),
651
+ weekCaptionLabel: Gt({
652
+ startOfWeek: h,
653
+ endOfWeek: ee(h, q - 1)
654
+ }, a),
655
+ selectedDateLabel: Xt({
656
+ selectedDate: p,
657
+ locale: a,
658
+ timezone: _
659
+ }),
660
+ timezoneLabel: _ ? `${i("form.appointment.timezone.label")}: ${Vt({
661
+ timezone: _,
662
+ language: a
663
+ })}` : "",
664
+ formatLabel: Y === tn.OS_LOCATION ? i("form.appointment.meeting-format.in-person-location-method-os-location") : H,
665
+ notificationMessage: st,
666
+ showMoreSlotsLabel: i("form.appointment.show-more-slots.text"),
667
+ previousWeekLabel: i("form.appointment.accessibility.calendar.previous-week.aria-label"),
668
+ nextWeekLabel: i("form.appointment.accessibility.calendar.next-week.aria-label"),
669
+ pendingFocusIndex: M,
670
+ consumePendingFocusIndex: ot
671
+ };
672
+ }, je = Ke(void 0), Qe = (e) => `${e}-timezone-note`, Je = (e) => `${e}-date-title`, F = () => {
673
+ const e = $e(je);
674
+ if (typeof e > "u")
675
+ throw new Error("Appointment parts must be used inside an <Appointment> component");
676
+ return e;
677
+ }, Re = () => {
678
+ const { disabled: e, readOnly: t } = re();
679
+ return !!e || !!t;
680
+ }, C = ({ children: e, className: t }) => {
681
+ const { days: n, selectDate: a, weekRangeLabel: s } = F(), r = T(e, C.PreviousWeek), i = T(e, C.Heading), l = T(e, C.NextWeek), c = T(e, C.Day) ?? /* @__PURE__ */ o.createElement(C.Day, null), D = B(() => n.filter((d) => d.isSelected).map((d) => d.key), [
682
+ n
683
+ ]), u = Re(), S = B(() => n.filter((d) => u || d.isDisabled).map((d) => d.key), [
684
+ n,
685
+ u
686
+ ]), E = (d) => {
687
+ if (d === "all")
688
+ return;
689
+ const [g] = [
690
+ ...d
691
+ ], M = n.find(({ key: A }) => A === g);
692
+ M && a(M.date);
693
+ };
694
+ return /* @__PURE__ */ o.createElement("div", {
695
+ className: t
696
+ }, r, i, l, /* @__PURE__ */ o.createElement(Tt, {
697
+ "aria-label": s,
698
+ orientation: "horizontal",
699
+ selectionMode: "single",
700
+ selectedKeys: D,
701
+ disabledKeys: S,
702
+ onSelectionChange: E
703
+ }, n.map((d) => Ee(c, {
704
+ key: d.key,
705
+ day: d
706
+ }))));
707
+ }, un = ({ children: e, className: t }) => {
708
+ const { changeWeek: n, canGoToPreviousWeek: a, previousWeekLabel: s, nextWeekLabel: r } = F(), i = Re(), l = J(null), c = J(!1);
709
+ return P(() => {
710
+ var S, E, d;
711
+ if (a || !c.current)
712
+ return;
713
+ c.current = !1;
714
+ const D = document.activeElement;
715
+ if (D !== document.body && D !== l.current)
716
+ return;
717
+ const u = ((E = (S = l.current) == null ? void 0 : S.closest("fieldset")) == null ? void 0 : E.querySelectorAll("button")) ?? [];
718
+ (d = Array.from(u).find((g) => g.getAttribute("aria-label") === r)) == null || d.focus();
719
+ }, [
720
+ a,
721
+ r
722
+ ]), /* @__PURE__ */ o.createElement(ve, {
723
+ ref: l,
724
+ className: t,
725
+ "aria-label": s,
726
+ isDisabled: !a || i,
727
+ onPress: () => {
728
+ c.current = !0, n(-1);
729
+ }
730
+ }, e ?? "‹");
731
+ }, dn = ({ children: e, className: t }) => {
732
+ const { changeWeek: n, nextWeekLabel: a } = F(), s = Re();
733
+ return /* @__PURE__ */ o.createElement(ve, {
734
+ className: t,
735
+ "aria-label": a,
736
+ isDisabled: s,
737
+ onPress: () => n(1)
738
+ }, e ?? "›");
739
+ }, fn = ({ children: e, className: t }) => {
740
+ const { weekCaptionLabel: n, weekRangeLabel: a } = F();
741
+ return /* @__PURE__ */ o.createElement("span", {
742
+ className: t,
743
+ "aria-live": "polite"
744
+ }, e ? e({
745
+ label: n,
746
+ weekRange: a
747
+ }) : /* @__PURE__ */ o.createElement(o.Fragment, null, /* @__PURE__ */ o.createElement("span", {
748
+ "aria-hidden": "true"
749
+ }, n), /* @__PURE__ */ o.createElement("span", {
750
+ style: Ge
751
+ }, a)));
752
+ }, Dn = ({ children: e, className: t, ...n }) => {
753
+ const { day: a } = n;
754
+ return /* @__PURE__ */ o.createElement(vt, {
755
+ id: a.key,
756
+ className: t,
757
+ textValue: a.label,
758
+ "aria-label": a.isAvailable ? `${a.label}, ${a.availabilityLabel}` : a.label,
759
+ "data-available": a.isAvailable || void 0,
760
+ "data-today": a.isToday || void 0
761
+ }, e ? e({
762
+ ...a,
763
+ date: new Date(a.date)
764
+ }) : /* @__PURE__ */ o.createElement(o.Fragment, null, /* @__PURE__ */ o.createElement("span", null, a.weekdayLabel), /* @__PURE__ */ o.createElement("span", null, a.dayOfMonthLabel)));
765
+ };
766
+ C.PreviousWeek = un;
767
+ C.Heading = fn;
768
+ C.NextWeek = dn;
769
+ C.Day = Dn;
770
+ const Ye = 'input[type="radio"]', fe = ({ children: e, className: t, ...n }) => {
771
+ const { hasTimezoneNote: a, hasDateTitle: s } = n, { slots: r, selectedSlotKey: i, selectSlot: l, selectedDateLabel: c, isReloadingSlots: D, timezoneLabel: u, pendingFocusIndex: S, consumePendingFocusIndex: E } = F(), { id: d, disabled: g, readOnly: M, required: A, hasError: b } = re(), { inputId: I, labelId: U, ariaDescribedBy: x } = ie(), H = J(null), Y = T(e, fe.Slot) ?? /* @__PURE__ */ o.createElement(fe.Slot, null), ae = !!s && !!c, $ = [
772
+ x,
773
+ a && u ? Qe(I) : void 0
774
+ ].filter(Boolean).join(" ") || void 0, w = (_) => {
775
+ var p, k, G;
776
+ (G = (k = (p = H.current) == null ? void 0 : p.querySelectorAll(Ye)) == null ? void 0 : k[_]) == null || G.focus();
777
+ };
778
+ return ft(() => {
779
+ var G, le;
780
+ if (!!((G = H.current) != null && G.querySelector(Ye))) {
781
+ w(0);
782
+ return;
783
+ }
784
+ const p = Array.from(((le = document.getElementById(I)) == null ? void 0 : le.querySelectorAll('[role="option"]')) ?? []), k = p.find((K) => K.getAttribute("aria-selected") === "true") ?? p.find((K) => K.getAttribute("aria-disabled") !== "true");
785
+ k == null || k.focus();
786
+ }, d), P(() => {
787
+ S !== void 0 && (w(S), E());
788
+ }, [
789
+ S,
790
+ r.length
791
+ ]), /* @__PURE__ */ o.createElement(o.Fragment, null, /* @__PURE__ */ o.createElement("div", {
792
+ role: "status",
793
+ style: Ge
794
+ }, r.length > 0 ? c : void 0), /* @__PURE__ */ o.createElement(kt, {
795
+ ref: H,
796
+ className: t,
797
+ value: i ?? null,
798
+ onChange: l,
799
+ isDisabled: g,
800
+ isReadOnly: M,
801
+ isRequired: A,
802
+ isInvalid: b,
803
+ "aria-labelledby": ae ? Je(I) : U,
804
+ "aria-describedby": $,
805
+ "data-refetch": D || void 0
806
+ }, r.map((_) => Ee(Y, {
807
+ key: _.key,
808
+ slot: _
809
+ }))));
810
+ }, En = ({ children: e, className: t, ...n }) => {
811
+ const { slot: a } = n;
812
+ return /* @__PURE__ */ o.createElement(Rt, {
813
+ value: a.key,
814
+ "aria-label": a.timeRange
815
+ }, /* @__PURE__ */ o.createElement(Mt, {
816
+ className: t
817
+ }, e ? e(a) : a.timeRange));
818
+ };
819
+ fe.Slot = En;
820
+ const m = ({ children: e, className: t }) => {
821
+ const n = re(), { id: a, FieldLayout: s } = n, { labelId: r, inputId: i, ariaDescribedBy: l } = ie(), c = Dt(Et.APPOINTMENT), D = B(() => ({
822
+ ...n,
823
+ initialData: c,
824
+ inputId: i,
825
+ ariaLabelledBy: r,
826
+ ariaDescribedBy: l,
827
+ fieldId: a
828
+ }), [
829
+ n,
830
+ c,
831
+ i,
832
+ r,
833
+ l,
834
+ a
835
+ ]), u = T(e, m.Label), S = T(e, m.Description), E = T(e, m.Error);
836
+ return /* @__PURE__ */ o.createElement(s, {
837
+ fieldId: a,
838
+ renderLabel: () => Ee(u, {
839
+ as: "div"
840
+ }),
841
+ renderInput: () => /* @__PURE__ */ o.createElement($t, {
842
+ appointmentFieldProps: D
843
+ }, /* @__PURE__ */ o.createElement(_n, {
844
+ className: t
845
+ }, e)),
846
+ renderDescription: () => /* @__PURE__ */ o.createElement(o.Fragment, null, E, S)
847
+ });
848
+ }, Sn = {
849
+ visibility: "hidden"
850
+ }, _n = ({ children: e, className: t }) => {
851
+ const { required: n, onFocus: a, onBlur: s } = re(), { inputId: r, labelId: i, ariaDescribedBy: l } = ie(), c = mn(), D = T(e, m.Loader), u = T(e, m.Notification), S = T(e, m.Dates), E = T(e, m.Timezone), d = T(e, m.Format), g = T(e, m.DateTitle), M = T(e, m.Slots), A = T(e, m.ShowMoreSlots);
852
+ return /* @__PURE__ */ o.createElement(je.Provider, {
853
+ value: c
854
+ }, /* @__PURE__ */ o.createElement(Ct, {
855
+ id: r,
856
+ className: t,
857
+ ariaLabelledBy: i,
858
+ ariaDescribedBy: l,
859
+ required: n,
860
+ onFocus: a,
861
+ onBlur: s
862
+ }, D, c.hasError ? u : /* @__PURE__ */ o.createElement("div", {
863
+ style: c.isLoading ? Sn : void 0
864
+ }, S, E, d, g, Ee(M, {
865
+ hasTimezoneNote: !!E,
866
+ hasDateTitle: !!g
867
+ }), u, A)));
868
+ }, pn = ({ children: e, className: t }) => {
869
+ const { isLoading: n, isRefetching: a } = F();
870
+ return !n && !a ? null : /* @__PURE__ */ o.createElement("div", {
871
+ className: t,
872
+ role: "status",
873
+ "aria-live": "polite",
874
+ "data-initial": n || void 0,
875
+ "data-refetch": !n && a || void 0
876
+ }, e);
877
+ }, Nn = ({ children: e, className: t }) => {
878
+ const { notificationMessage: n } = F();
879
+ return n ? /* @__PURE__ */ o.createElement("div", {
880
+ className: t,
881
+ role: "status"
882
+ }, e ? e({
883
+ message: n
884
+ }) : n) : null;
885
+ }, An = ({ children: e, className: t }) => {
886
+ const { timezoneLabel: n } = F(), { inputId: a } = ie();
887
+ return n ? /* @__PURE__ */ o.createElement("span", {
888
+ id: Qe(a),
889
+ className: t
890
+ }, e ? e({
891
+ label: n
892
+ }) : n) : null;
893
+ }, yn = ({ children: e, className: t }) => {
894
+ const { formatLabel: n } = F();
895
+ return n ? /* @__PURE__ */ o.createElement("span", {
896
+ className: t
897
+ }, e ? e({
898
+ label: n
899
+ }) : n) : null;
900
+ }, bn = ({ children: e, className: t }) => {
901
+ const { selectedDateLabel: n } = F(), { inputId: a } = ie();
902
+ return n ? /* @__PURE__ */ o.createElement("div", {
903
+ id: Je(a),
904
+ className: t
905
+ }, e ? e({
906
+ label: n
907
+ }) : n) : null;
908
+ }, In = ({ children: e, className: t }) => {
909
+ const { hasMoreSlots: n, showMoreSlots: a, showMoreSlotsLabel: s } = F(), { disabled: r, readOnly: i } = re();
910
+ return n ? /* @__PURE__ */ o.createElement(ve, {
911
+ className: t,
912
+ isDisabled: !!r || !!i,
913
+ onPress: a
914
+ }, e ? e({
915
+ label: s
916
+ }) : s) : null;
917
+ };
918
+ m.Label = ht;
919
+ m.Loader = pn;
920
+ m.Notification = Nn;
921
+ m.Dates = C;
922
+ m.Timezone = An;
923
+ m.Format = yn;
924
+ m.DateTitle = bn;
925
+ m.Slots = fe;
926
+ m.ShowMoreSlots = In;
927
+ m.Description = wt;
928
+ m.Error = Ft;
929
+ const Ln = "_appointment_ig6bz_1", On = "_dates_ig6bz_5", gn = "_weekHeading_ig6bz_27", Tn = "_weekButton_ig6bz_37", vn = "_previousWeek_ig6bz_69", kn = "_nextWeek_ig6bz_73", Rn = "_day_ig6bz_85", Mn = "_weekdayLabel_ig6bz_97", wn = "_dayNumber_ig6bz_110", Fn = "_indicator_ig6bz_114", hn = "_hint_ig6bz_137", Cn = "_slots_ig6bz_150", Wn = "_dateTitle_ig6bz_164", Bn = "_slot_ig6bz_150", zn = "_slotHover_ig6bz_206", Pn = "_slotSelected_ig6bz_214", Un = "_showMoreSlots_ig6bz_268", xn = "_loader_ig6bz_299", Hn = "_notification_ig6bz_335", N = {
930
+ appointment: Ln,
931
+ dates: On,
932
+ weekHeading: gn,
933
+ weekButton: Tn,
934
+ previousWeek: vn,
935
+ nextWeek: kn,
936
+ day: Rn,
937
+ weekdayLabel: Mn,
938
+ dayNumber: wn,
939
+ indicator: Fn,
940
+ hint: hn,
941
+ slots: Cn,
942
+ dateTitle: Wn,
943
+ slot: Bn,
944
+ slotHover: zn,
945
+ slotSelected: Pn,
946
+ showMoreSlots: Un,
947
+ loader: xn,
948
+ notification: Hn
949
+ }, Yn = ({ content: e, locale: t }) => /* @__PURE__ */ o.createElement(it, {
950
+ content: e,
951
+ locale: t
952
+ }), Kn = {
953
+ base: N.slot,
954
+ selected: N.slotSelected,
955
+ hover: N.slotHover
956
+ }, $n = () => {
957
+ const e = gt({
958
+ globalClasses: Ot,
959
+ moduleClasses: Kn
960
+ });
961
+ return /* @__PURE__ */ o.createElement(m, {
962
+ className: v(St, N.appointment)
963
+ }, /* @__PURE__ */ o.createElement(m.Label, {
964
+ className: v(_t, ue.label)
965
+ }, /* @__PURE__ */ o.createElement(m.Label.Required, {
966
+ className: v(pt, ue.requiredMark)
967
+ })), /* @__PURE__ */ o.createElement(m.Loader, {
968
+ className: N.loader
969
+ }), /* @__PURE__ */ o.createElement(m.Dates, {
970
+ className: v(Nt, N.dates)
971
+ }, /* @__PURE__ */ o.createElement(m.Dates.PreviousWeek, {
972
+ className: v(me, N.weekButton, N.previousWeek)
973
+ }, /* @__PURE__ */ o.createElement(he, null)), /* @__PURE__ */ o.createElement(m.Dates.Heading, {
974
+ className: N.weekHeading
975
+ }), /* @__PURE__ */ o.createElement(m.Dates.NextWeek, {
976
+ className: v(me, N.weekButton, N.nextWeek)
977
+ }, /* @__PURE__ */ o.createElement(he, null)), /* @__PURE__ */ o.createElement(m.Dates.Day, {
978
+ className: v(me, Ce.day, N.day)
979
+ }, (t) => /* @__PURE__ */ o.createElement(o.Fragment, null, /* @__PURE__ */ o.createElement("span", {
980
+ className: N.weekdayLabel
981
+ }, t.weekdayLabel), /* @__PURE__ */ o.createElement("span", {
982
+ className: v(Ce.dayNumber, N.dayNumber)
983
+ }, t.dayOfMonthLabel, /* @__PURE__ */ o.createElement("span", {
984
+ className: N.indicator
985
+ }))))), /* @__PURE__ */ o.createElement(m.Timezone, {
986
+ className: v(We, N.hint)
987
+ }), /* @__PURE__ */ o.createElement(m.Format, {
988
+ className: v(We, N.hint)
989
+ }), /* @__PURE__ */ o.createElement(m.DateTitle, {
990
+ className: v(At, N.dateTitle)
991
+ }), /* @__PURE__ */ o.createElement(m.Slots, {
992
+ className: v(yt, N.slots)
993
+ }, /* @__PURE__ */ o.createElement(m.Slots.Slot, {
994
+ className: ({ isSelected: t, isHovered: n, isFocused: a, isDisabled: s, isReadOnly: r }) => e({
995
+ isSelected: t,
996
+ isHovered: (n || a) && !t && !s && !r
997
+ })
998
+ }, (t) => t.timeRange)), /* @__PURE__ */ o.createElement(m.Notification, {
999
+ className: N.notification
1000
+ }), /* @__PURE__ */ o.createElement(m.ShowMoreSlots, {
1001
+ className: v(bt, me, N.showMoreSlots)
1002
+ }), /* @__PURE__ */ o.createElement(m.Error, {
1003
+ className: v(It, ue.error)
1004
+ }, /* @__PURE__ */ o.createElement(lt, null), /* @__PURE__ */ o.createElement(m.Error.Text, null)), /* @__PURE__ */ o.createElement(m.Description, {
1005
+ className: v(Lt, ue.description)
1006
+ }, Yn));
1007
+ }, ca = () => /* @__PURE__ */ o.createElement($n, null);
1008
+ export {
1009
+ ca as AppointmentRAC
1010
+ };