@wix/form-elements 1.237.0 → 1.239.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 (122) hide show
  1. package/dist/component/appointment-rac-Bm8rDoTG.js +1041 -0
  2. package/dist/component/{bookings-address-rac-lkvT2jFg.js → bookings-address-rac-DU8OkeK5.js} +1 -1
  3. package/dist/component/{bookings-email-rac-B6yDIr7X.js → bookings-email-rac-CknyRCva.js} +1 -1
  4. package/dist/component/{bookings-first-name-rac-BdwaASKa.js → bookings-first-name-rac-DU59YdGL.js} +1 -1
  5. package/dist/component/{bookings-header-rac-K_4D2edM.js → bookings-header-rac-Cp9jofKf.js} +1 -1
  6. package/dist/component/{bookings-last-name-rac-z1DsE6Te.js → bookings-last-name-rac-icNxzYrt.js} +1 -1
  7. package/dist/component/{bookings-login-bar-rac-DuDc27Sg.js → bookings-login-bar-rac-C7q9ivGr.js} +1 -1
  8. package/dist/component/{bookings-phone-rac-D3I57XfO.js → bookings-phone-rac-DO6xouOx.js} +1 -1
  9. package/dist/component/{bookings-rich-text-rac-Dva_0eJC.js → bookings-rich-text-rac-BlchtuQW.js} +1 -1
  10. package/dist/component/{checkbox-field-rac-CcVXm9fo.js → checkbox-field-rac-DykQE4ex.js} +4 -4
  11. package/dist/component/{checkbox-group-field-headless-DIwGr5_m.js → checkbox-group-field-headless-DEEfGA8I.js} +3 -3
  12. package/dist/component/{checkbox-group-field-rac-Di8eepGG.js → checkbox-group-field-rac-Dhj9rm6Q.js} +4 -4
  13. package/dist/component/{checkbox-group-rac-uA3X1M2J.js → checkbox-group-rac-CpfowXJ1.js} +1 -1
  14. package/dist/component/{checkbox-rac-BSYp2Yim.js → checkbox-rac-BR4S6ifx.js} +1 -1
  15. package/dist/component/{contacts-address-rac-BmITc1pA.js → contacts-address-rac-VJta12Vu.js} +1 -1
  16. package/dist/component/{contacts-birthdate-rac-BbiTr6cp.js → contacts-birthdate-rac-8M-73m41.js} +1 -1
  17. package/dist/component/{contacts-company-rac-DUQ7fNTn.js → contacts-company-rac-DL9YQzZH.js} +1 -1
  18. package/dist/component/{contacts-email-rac-CVqqMJbq.js → contacts-email-rac-Cc3REWGd.js} +1 -1
  19. package/dist/component/{contacts-first-name-rac-uv3ldXXw.js → contacts-first-name-rac--JpJgbEk.js} +1 -1
  20. package/dist/component/{contacts-last-name-rac-CimDHNgO.js → contacts-last-name-rac-CY5pia7A.js} +1 -1
  21. package/dist/component/{contacts-phone-rac-BShfAZ5U.js → contacts-phone-rac-CM3FGS_4.js} +1 -1
  22. package/dist/component/{contacts-position-rac-BENXoFz5.js → contacts-position-rac-D4Peii3n.js} +1 -1
  23. package/dist/component/{contacts-subscribe-rac-CBBgFf9U.js → contacts-subscribe-rac-BJkc1FNK.js} +1 -1
  24. package/dist/component/{contacts-tax-id-rac-B4fcviNx.js → contacts-tax-id-rac-QhcqnnBB.js} +1 -1
  25. package/dist/component/{date-availability-BrxRBFHK.js → date-availability-BK0U1C5v.js} +1 -1
  26. package/dist/component/{date-input-field-rac-BFDOSod0.js → date-input-field-rac-Dz8j3H_P.js} +8 -8
  27. package/dist/component/{date-input-rac-Cd6SHUjO.js → date-input-rac-o0ootRXL.js} +1 -1
  28. package/dist/component/{date-picker-field-rac-BN2EjYXP.js → date-picker-field-rac-CWz0tsV1.js} +8 -8
  29. package/dist/component/{date-picker-rac-BQWpqtZJ.js → date-picker-rac-DNJWptj-.js} +1 -1
  30. package/dist/component/{date-time-input-field-rac-BO_3H4NG.js → date-time-input-field-rac-Bw32HIB2.js} +8 -8
  31. package/dist/component/{date-time-input-rac-wgKGtEcj.js → date-time-input-rac-CAfM3cKC.js} +1 -1
  32. package/dist/component/{dext-checkbox-group-rac-DM20MEtm.js → dext-checkbox-group-rac-DU61bMpN.js} +2 -2
  33. package/dist/component/{dext-checkbox-rac-DvzEyVhG.js → dext-checkbox-rac-CMnEAlvV.js} +1 -1
  34. package/dist/component/{dext-date-picker-rac-cof0w9i_.js → dext-date-picker-rac-CFZJvc4p.js} +1 -1
  35. package/dist/component/{dext-date-time-input-rac-BiJqwZ-5.js → dext-date-time-input-rac-D9uVYWdR.js} +1 -1
  36. package/dist/component/{dext-dropdown-rac-DEq1gj7M.js → dext-dropdown-rac-rnSAPrM7.js} +1 -1
  37. package/dist/component/{dext-email-rac-BDg2wBuO.js → dext-email-rac-OjBTeg7J.js} +1 -1
  38. package/dist/component/{dext-number-input-rac-BBouksMP.js → dext-number-input-rac-BDHXmpsz.js} +1 -1
  39. package/dist/component/{dext-phone-rac-DZASm4Ft.js → dext-phone-rac-Dwqg2FSb.js} +1 -1
  40. package/dist/component/{dext-radio-group-rac-DqAZs7cq.js → dext-radio-group-rac-BdHFvP7g.js} +2 -2
  41. package/dist/component/{dext-rating-input-rac-BUB6w2g3.js → dext-rating-input-rac-BxStM3Z6.js} +1 -1
  42. package/dist/component/{dext-tags-rac-BH6azQiT.js → dext-tags-rac-By9ABifk.js} +2 -2
  43. package/dist/component/{dext-text-area-rac-Bm1Oi7pi.js → dext-text-area-rac-DUiklOQo.js} +1 -1
  44. package/dist/component/{dext-text-input-rac-DBSxcYp8.js → dext-text-input-rac-CyxWpYGU.js} +1 -1
  45. package/dist/component/{dext-url-input-rac-gJ_-qrzY.js → dext-url-input-rac-w8R6U7u8.js} +1 -1
  46. package/dist/component/{dismiss-icon-sdQDwRev.js → dismiss-icon-4SdtTtrF.js} +1 -1
  47. package/dist/component/{donation-rac-CJHcIOnk.js → donation-rac-mhC_41a7.js} +5 -5
  48. package/dist/component/{dropdown-field-rac-D94vF6Um.js → dropdown-field-rac-nCvgQtwV.js} +3 -3
  49. package/dist/component/{dropdown-rac-EN7KMhtd.js → dropdown-rac-BN3E1a2F.js} +1 -1
  50. package/dist/component/{ecom-address-rac-CYk1wXq3.js → ecom-address-rac-BvZ5fKwq.js} +1 -1
  51. package/dist/component/{ecom-subscription-checkbox-rac--cLVBIUD.js → ecom-subscription-checkbox-rac-B21kn8WX.js} +2 -2
  52. package/dist/component/{email-input-field-rac-DWTQUl88.js → email-input-field-rac-BAZfDhzT.js} +3 -3
  53. package/dist/component/{events-repeater-rac-B-CAZJsO.js → events-repeater-rac-MrnfHupV.js} +4 -4
  54. package/dist/component/{events-rsvp-rac-CkLzjZe0.js → events-rsvp-rac-BSeWX1Lx.js} +3 -3
  55. package/dist/component/{field-error-headless-Hpn7Cjyz.js → field-error-headless-Ek4POGu5.js} +1 -1
  56. package/dist/component/{field-label-headless-CZaQ-q22.js → field-label-headless-DrZeUGw3.js} +1 -1
  57. package/dist/component/{file-upload-rac-DelhbRzX.js → file-upload-rac-BgHsS7Ze.js} +4 -4
  58. package/dist/component/{fixed-payment-rac-CGee8oWb.js → fixed-payment-rac-DOYG4dHG.js} +3 -3
  59. package/dist/component/{form-CKPfFL3D.js → form-DnkQAGFK.js} +1698 -1669
  60. package/dist/component/form.js +1 -1
  61. package/dist/component/{header-field-rac-B6vzJnaW.js → header-field-rac-BkCSVoMt.js} +2 -2
  62. package/dist/component/{header-rac-Bc4WxzR1.js → header-rac-DrxFuzRm.js} +1 -1
  63. package/dist/component/{image-choice-rac-BuArZj5n.js → image-choice-rac-BW4I446V.js} +4 -4
  64. package/dist/component/{index-CmopQE1P.js → index-BoA1-4AG.js} +2 -2
  65. package/dist/component/{index-yqi4FTyq.js → index-CffZGLlY.js} +4 -4
  66. package/dist/component/{isObjectLike-DO4jXs__.js → isObjectLike-Bz7iKiVE.js} +1 -1
  67. package/dist/component/{messages_de-BblI6nNP.js → messages_de-S0rBxAIU.js} +1 -1
  68. package/dist/component/{messages_el-Bn-N2ylb.js → messages_el-CMI_nPL7.js} +1 -1
  69. package/dist/component/{messages_fr-DwsdsKNJ.js → messages_fr-CheAamQq.js} +1 -1
  70. package/dist/component/{messages_hr-Cg6bfHop.js → messages_hr-E_aOZLMp.js} +1 -1
  71. package/dist/component/{messages_hu-DlaM-wMA.js → messages_hu-B2dkjZ1e.js} +1 -1
  72. package/dist/component/{messages_it-Cd9TDhM_.js → messages_it-BsPU-f6V.js} +1 -1
  73. package/dist/component/{messages_ko-CXsE6Y5X.js → messages_ko-BeTBMjB8.js} +2 -2
  74. package/dist/component/{messages_lt-D2_5jBX-.js → messages_lt-D5b93e1_.js} +1 -1
  75. package/dist/component/{messages_nl--wTlsfUh.js → messages_nl-7-vnYSr_.js} +1 -1
  76. package/dist/component/{messages_no-C0t05F50.js → messages_no-BgFqH2jP.js} +1 -1
  77. package/dist/component/{messages_pt-CfE28POg.js → messages_pt-DL0XLwt6.js} +1 -1
  78. package/dist/component/{messages_ru-Cjgw9gK2.js → messages_ru-NQEwxnBj.js} +1 -1
  79. package/dist/component/{messages_zh-Dy3Cx4WX.js → messages_zh-Cjp8A8Tu.js} +1 -1
  80. package/dist/component/{multiline-address-field-rac-CijPzBxU.js → multiline-address-field-rac-BqJCbVps.js} +8 -8
  81. package/dist/component/{multiline-address-rac-CchEjTwl.js → multiline-address-rac-BmH-FA_w.js} +1 -1
  82. package/dist/component/{number-input-field-rac-CdJstTE-.js → number-input-field-rac-BZAEJpnZ.js} +4 -4
  83. package/dist/component/{number-input-rac-B0V7Xy0I.js → number-input-rac-BNnuE4_U.js} +1 -1
  84. package/dist/component/{password-rac-BipcyWPk.js → password-rac-CdouGooI.js} +4 -4
  85. package/dist/component/{payment-input-rac-ClhUNxdL.js → payment-input-rac-CJpi9gN5.js} +4 -4
  86. package/dist/component/{phone-input-field-rac-CPNMdr70.js → phone-input-field-rac-CrlJJbEi.js} +7 -7
  87. package/dist/component/{phone-rac-DL5pW-cK.js → phone-rac-DUhwmZCm.js} +1 -1
  88. package/dist/component/{product-list-rac-Ii0qlyiq.js → product-list-rac-BOiMnJzz.js} +4 -4
  89. package/dist/component/{quiz-radio-group-rac-DtO0om99.js → quiz-radio-group-rac-BhUdkWjK.js} +1 -1
  90. package/dist/component/{radio-button-module-classes-CY-zH0im.js → radio-button-module-classes-C3bv24a7.js} +3 -3
  91. package/dist/component/{radio-group-field-rac-ViY8g4gL.js → radio-group-field-rac-DaBu-Y0t.js} +4 -4
  92. package/dist/component/{radio-group-rac-CjCoPD-w.js → radio-group-rac-BfogPsFM.js} +1 -1
  93. package/dist/component/{rating-input-field-rac-BMFXLqfg.js → rating-input-field-rac-DMb9Gx38.js} +4 -4
  94. package/dist/component/{rating-input-rac-CWGGV3Fx.js → rating-input-rac-BSWe-su7.js} +1 -1
  95. package/dist/component/{rich-content-rac.module-CTlkS2_O.js → rich-content-rac.module-BTwxU9GT.js} +1 -1
  96. package/dist/component/{rich-text-field-rac-2SQn_URM.js → rich-text-field-rac-ColJr0G-.js} +2 -2
  97. package/dist/component/{rich-text-rac-L3m09cVp.js → rich-text-rac-Bl8NdFB3.js} +1 -1
  98. package/dist/component/{service-dropdown-rac-uKz9PkBj.js → service-dropdown-rac-BRJGGTwv.js} +4 -4
  99. package/dist/component/{services-multi-choice-rac-sOJlp6_l.js → services-multi-choice-rac-ChQYyeIQ.js} +5 -5
  100. package/dist/component/{signature-rac-B1O7Ivtg.js → signature-rac-C_u7kXY2.js} +4 -4
  101. package/dist/component/{submit-button-rac-iYdJFSXy.js → submit-button-rac-PiSBi7Db.js} +2 -2
  102. package/dist/component/{tags-field-rac-CFSrsxw9.js → tags-field-rac-DW_tFzve.js} +5 -5
  103. package/dist/component/{tags-rac-KW_c8m3p.js → tags-rac-ND1_w18c.js} +1 -1
  104. package/dist/component/{text-area-field-rac-BJEAvqCy.js → text-area-field-rac-BT5kn2_p.js} +4 -4
  105. package/dist/component/{text-area-rac-Bk9j2e4k.js → text-area-rac-RTfL5OYW.js} +1 -1
  106. package/dist/component/{text-input-field-rac-KlrY_3qp.js → text-input-field-rac-B6aqpQqL.js} +3 -3
  107. package/dist/component/{text-input-headless-B6gzsedE.js → text-input-headless-BiYydJnd.js} +3 -3
  108. package/dist/component/{text-input-rac-CSO1g0rD.js → text-input-rac-B_ktWIA7.js} +1 -1
  109. package/dist/component/{time-input-rac-jaYI3_XV.js → time-input-rac-vNgNQgNN.js} +6 -6
  110. package/dist/component/{url-input-field-rac-1t5d4VjM.js → url-input-field-rac-BYRoYHR6.js} +4 -4
  111. package/dist/component/{url-input-rac-BTQOpun9.js → url-input-rac-9AVzPoc5.js} +1 -1
  112. package/dist/component/{use-dropdown-option-class-name-DEBN31l5.js → use-dropdown-option-class-name-DAiT5uNc.js} +2 -2
  113. package/dist/component/{use-dropdown-trigger-class-name-BpcEWMWj.js → use-dropdown-trigger-class-name-aUb_sgFq.js} +7 -7
  114. package/dist/component/{use-element-state-class-name-B0muHOx4.js → use-element-state-class-name-4Q4mzmq7.js} +1 -1
  115. package/dist/component/{use-hoverable-input-class-name-CL0sOlNu.js → use-hoverable-input-class-name-B3TQVTv2.js} +2 -2
  116. package/dist/component/{use-is-forced-open-dropdown-BhQKJWNc.js → use-is-forced-open-dropdown-BqAHpu-1.js} +1 -1
  117. package/dist/component/{use-native-mobile-input-W9CS9U3u.js → use-native-mobile-input-Bq_rDwKS.js} +1 -1
  118. package/dist/component/{use-service-options-base-DUgTjbHR.js → use-service-options-base-Dfmr-7Ha.js} +1 -1
  119. package/dist/component/use-text-input-class-name-D7autJGB.js +6 -0
  120. package/package.json +2 -2
  121. package/dist/component/appointment-rac-DaJz8fBt.js +0 -1021
  122. package/dist/component/use-text-input-class-name-Mm_0ULVk.js +0 -6
@@ -0,0 +1,1041 @@
1
+ import o, { useRef as J, useState as Q, useEffect as U, createContext as Ge, useContext as Ze, useMemo as P, useCallback as re } from "react";
2
+ import { RicosViewer as ct } from "@wix/ricos/viewer";
3
+ import g from "classnames";
4
+ import { C as We } from "./chevron-down-icon-CcpVm6B-.js";
5
+ import { E as mt } from "./error-icon-hZxQ6DEy.js";
6
+ import { g as ut, c as Be } from "./calendar.module-BMUyMVja.js";
7
+ import { H as me } from "./custom-focus-class-_483Pkwp.js";
8
+ import { s as ue } from "./field-rac.module-D0QzJXUv.js";
9
+ import { bF as Ee, bE as dt, bJ as ve, bH as ft, bY as Dt, bX as Et, bN as ie, bK as le, bP as St, bM as _t, F as Nt, h as At, X as pt, am as yt, g as It, j as Pe, i as Ot, n as Lt, k as Tt, l as bt, M as gt, I as kt, m as vt } from "./form-DnkQAGFK.js";
10
+ import { u as Rt } from "./use-element-state-class-name-4Q4mzmq7.js";
11
+ import { ListBox as Mt, Button as Re, ListBoxItem as Ft, RadioGroup as ht, RadioField as wt, RadioButton as Ct } from "react-aria-components";
12
+ import { f as k, a as Se } from "./find-child-C60k4CxG.js";
13
+ import { D as Wt, E as Bt } from "./field-error-headless-Ek4POGu5.js";
14
+ import { L as Pt } from "./field-label-headless-DrZeUGw3.js";
15
+ import { F as Ut } from "./fieldset-headless-CD3fds9J.js";
16
+ import { parseAbsolute as xt } from "@internationalized/date";
17
+ import { startOfDay as zt } from "date-fns";
18
+ import { V as Ve } from "./headless-styles-CmcyA_pi.js";
19
+ function Yt(e) {
20
+ return { evid: 40, src: 16, endpoint: "", params: e };
21
+ }
22
+ var fe = /* @__PURE__ */ (function(e) {
23
+ return e.BOOKING_NOT_INSTALL = "BOOKING_NOT_INSTALL", e.NO_AVAILABILITY_DATES_FOUND = "NO_AVAILABILITY_DATES_FOUND", e.GENERAL = "GENERAL", e;
24
+ })({}), W = /* @__PURE__ */ (function(e) {
25
+ return e.LOADING = "LOADING", e.DONE = "DONE", e.ERROR = "ERROR", e;
26
+ })({});
27
+ const q = 4;
28
+ var X = /* @__PURE__ */ (function(e) {
29
+ 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;
30
+ })({}), ne = /* @__PURE__ */ (function(e) {
31
+ return e.LOAD = "load", e.CLICK = "click", e;
32
+ })({});
33
+ const Ht = (e) => {
34
+ var n;
35
+ return {
36
+ bookingsServiceId: e == null ? void 0 : e.id,
37
+ formGuid: (n = e == null ? void 0 : e.form) == null ? void 0 : n.id,
38
+ serviceProperties: Kt(e)
39
+ };
40
+ }, Kt = (e) => {
41
+ var n;
42
+ return JSON.stringify({
43
+ serviceId: e == null ? void 0 : e.id,
44
+ serviceType: e == null ? void 0 : e.type,
45
+ locationIds: (n = e == null ? void 0 : e.locations) == null ? void 0 : n.map((t) => t.id).filter((t) => t),
46
+ staffMemberIds: e == null ? void 0 : e.staffMemberIds,
47
+ isOfferedAsPricingPlan: !1
48
+ });
49
+ }, qe = (e) => {
50
+ var l;
51
+ const { appointmentFieldProps: n } = Me(), { isEditor: t, isComposer: a } = Ee(), s = dt(), r = e || ((l = n == null ? void 0 : n.initialData) == null ? void 0 : l.service);
52
+ if (!(t || a))
53
+ return {
54
+ ...s,
55
+ report: (i) => s == null ? void 0 : s.report(Yt({
56
+ ...Ht(r),
57
+ ...i
58
+ }))
59
+ };
60
+ };
61
+ var ge;
62
+ (function(e) {
63
+ e.UNDEFINED = "UNDEFINED", e.OWNER_BUSINESS = "OWNER_BUSINESS", e.OWNER_CUSTOM = "OWNER_CUSTOM", e.CUSTOM = "CUSTOM";
64
+ })(ge || (ge = {}));
65
+ var Ue;
66
+ (function(e) {
67
+ e.UNKNOWN_REQUESTED_GENDER = "UNKNOWN_REQUESTED_GENDER", e.ANY_MALE = "ANY_MALE", e.ANY_FEMALE = "ANY_FEMALE";
68
+ })(Ue || (Ue = {}));
69
+ var xe;
70
+ (function(e) {
71
+ e.UNKNOWN_LOCATION_TYPE = "UNKNOWN_LOCATION_TYPE", e.BUSINESS = "BUSINESS", e.CUSTOM = "CUSTOM", e.CUSTOMER = "CUSTOMER";
72
+ })(xe || (xe = {}));
73
+ var ze;
74
+ (function(e) {
75
+ e.UNKNOWN_REQUESTED_GENDER = "UNKNOWN_REQUESTED_GENDER", e.ANY_MALE = "ANY_MALE", e.ANY_FEMALE = "ANY_FEMALE";
76
+ })(ze || (ze = {}));
77
+ var Ye;
78
+ (function(e) {
79
+ e.ASC = "ASC", e.DESC = "DESC";
80
+ })(Ye || (Ye = {}));
81
+ const He = ({ timezone: e, language: n, formatType: t }) => {
82
+ var s;
83
+ return (s = new Intl.DateTimeFormat(n, {
84
+ timeZone: e,
85
+ timeZoneName: t === "name" ? "long" : "short"
86
+ }).formatToParts(/* @__PURE__ */ new Date()).find(({ type: r }) => r === "timeZoneName")) == null ? void 0 : s.value;
87
+ }, $t = ({ timezone: e, language: n }) => {
88
+ const t = He({
89
+ timezone: e,
90
+ language: n,
91
+ formatType: "name"
92
+ }), a = He({
93
+ timezone: e,
94
+ language: n,
95
+ formatType: "offset"
96
+ });
97
+ return `${t} (${a})`;
98
+ }, ae = (e, n) => e.getFullYear() === n.getFullYear() && e.getMonth() === n.getMonth() && e.getDate() === n.getDate(), Gt = (e, n) => {
99
+ const t = new Date(e);
100
+ t.setDate(e.getDate() - n);
101
+ const a = new Date(e);
102
+ return a.setDate(e.getDate() + n), {
103
+ fromDate: t,
104
+ toDate: a
105
+ };
106
+ }, _e = (e, n) => {
107
+ const t = new Date(e);
108
+ if (!n)
109
+ return t;
110
+ try {
111
+ const { year: a, month: s, day: r } = xt(t.toISOString(), n);
112
+ return new Date(a, s - 1, r);
113
+ } catch {
114
+ return t;
115
+ }
116
+ }, Zt = (e, n = [], t) => n.some((a) => {
117
+ var s;
118
+ return !!((s = a.slot) != null && s.startDate) && ae(_e(a.slot.startDate, t), e);
119
+ }), be = (e) => zt(_e(/* @__PURE__ */ new Date(), e)), Vt = (e) => {
120
+ const { service: n } = e || {};
121
+ return (n == null ? void 0 : n.id) ? null : {
122
+ type: fe.GENERAL,
123
+ message: "Service ID is missing"
124
+ };
125
+ }, qt = ({ appointmentFieldProps: e, isEditor: n, isComposer: t }) => {
126
+ const { initialData: a } = e, s = Jt();
127
+ if (n || t)
128
+ return {
129
+ ...s,
130
+ timezone: ke(a),
131
+ dataStatus: W.DONE
132
+ };
133
+ {
134
+ const r = Vt(a);
135
+ if (r)
136
+ return {
137
+ dataStatus: W.ERROR,
138
+ error: r
139
+ };
140
+ }
141
+ return {
142
+ ...s,
143
+ // The loader data is already resolved, so use its time zone from the start
144
+ // instead of the dummy data's: a restored slot is resubmitted with it.
145
+ timezone: ke(a),
146
+ dataStatus: W.LOADING
147
+ };
148
+ }, jt = (e, n) => {
149
+ const t = /* @__PURE__ */ new Date(), a = new Date(t);
150
+ a.setMonth(a.getMonth() + e);
151
+ const s = new Date(t.toLocaleString("en-US", {
152
+ timeZone: n
153
+ })), r = new Date(a.toLocaleString("en-US", {
154
+ timeZone: n
155
+ }));
156
+ return {
157
+ startDate: s,
158
+ endDate: r
159
+ };
160
+ }, Qt = () => Intl.DateTimeFormat().resolvedOptions().timeZone, ke = (e) => (e == null ? void 0 : e.timeZone) || Qt(), Xt = (e, n) => {
161
+ var t, a;
162
+ if ((a = (t = e == null ? void 0 : e[0]) == null ? void 0 : t.slot) != null && a.startDate)
163
+ return _e(e[0].slot.startDate, n);
164
+ }, Jt = ({ duration: e = 60, timezone: n = "UTC" } = {}) => {
165
+ var S, d;
166
+ const t = "267d1c11-8019-4e3d-b9c6-cd2b859c69e2", a = /* @__PURE__ */ new Date(), s = [], r = [], l = a.toISOString().split("T")[0], i = 10, c = 18;
167
+ let u = /* @__PURE__ */ new Date(`${l}T${i}:00:00`), f = new Date(u);
168
+ f.setMinutes(f.getMinutes() + e);
169
+ let _ = !1;
170
+ for (; f.getHours() < c || f.getHours() === c && f.getMinutes() === 0; ) {
171
+ const b = {
172
+ slot: {
173
+ serviceId: t,
174
+ startDate: u.toISOString(),
175
+ endDate: f.toISOString(),
176
+ location: {
177
+ locationType: ge.CUSTOM
178
+ }
179
+ },
180
+ bookable: !0,
181
+ totalSpots: 1,
182
+ openSpots: 1,
183
+ bookingPolicyViolations: {
184
+ tooEarlyToBook: !1,
185
+ tooLateToBook: !1,
186
+ bookOnlineDisabled: !1
187
+ },
188
+ nestedSlots: []
189
+ };
190
+ r.push(b), _ || (s.push(b), _ = !0), u = new Date(f), f = new Date(u), f.setMinutes(f.getMinutes() + e);
191
+ }
192
+ return {
193
+ availabilitySlots: r,
194
+ availabilityDates: s,
195
+ timezone: n,
196
+ currentSlotBulkSize: q,
197
+ selectedDate: s.length > 0 && ((d = (S = s[0]) == null ? void 0 : S.slot) != null && d.startDate) ? new Date(s[0].slot.startDate) : void 0
198
+ };
199
+ };
200
+ function en(e) {
201
+ var d;
202
+ const { initialData: n, onChange: t, value: a } = e, { isEditor: s, isComposer: r } = Ee(), l = (d = n == null ? void 0 : n.service) == null ? void 0 : d.id, { actions: i } = ve(), c = J(i);
203
+ c.current = i;
204
+ const u = !!(i != null && i.getAvailabilityDates && (i != null && i.getAvailabilitySlots)), [f, _] = Q(null), S = qe(n == null ? void 0 : n.service);
205
+ return U(() => {
206
+ l && !s && !r && u && (async () => {
207
+ var I, O, x, z, Y;
208
+ const v = ke(n), p = {
209
+ currentSlotBulkSize: q,
210
+ timezone: v,
211
+ dataStatus: W.LOADING
212
+ };
213
+ try {
214
+ const H = async (oe) => {
215
+ var D, N;
216
+ const { startDate: $, endDate: F } = jt(oe, v);
217
+ return (N = (D = c.current) == null ? void 0 : D.getAvailabilityDates) == null ? void 0 : N.call(D, {
218
+ serviceId: l,
219
+ fromDate: $,
220
+ toDate: F,
221
+ timeZone: v
222
+ });
223
+ };
224
+ if (p.availabilityDates = await H(2), (I = p.availabilityDates) != null && I.length || (p.availabilityDates = await H(6)), !((O = p.availabilityDates) != null && O.length)) {
225
+ S == null || S.report({
226
+ action: ne.LOAD,
227
+ component: X.NO_AVAILABILITY_AT_ALL
228
+ }), _({
229
+ dataStatus: W.ERROR,
230
+ error: {
231
+ type: fe.NO_AVAILABILITY_DATES_FOUND,
232
+ message: "No availability dates found"
233
+ }
234
+ });
235
+ return;
236
+ }
237
+ p.selectedDate = Xt(p.availabilityDates, v), p.selectedDate && (p.availabilitySlots = await ((z = (x = c.current) == null ? void 0 : x.getAvailabilitySlots) == null ? void 0 : z.call(x, {
238
+ serviceId: l,
239
+ timeZone: v,
240
+ selectedDate: p.selectedDate
241
+ }))), S == null || S.report({
242
+ action: ne.LOAD,
243
+ component: (Y = p.availabilityDates) != null && Y.length ? X.FORM : X.NO_AVAILABILITY_FOR_DATE
244
+ }), a != null && a.startDate || t(void 0), _({
245
+ ...p,
246
+ dataStatus: W.DONE
247
+ });
248
+ } catch (H) {
249
+ console.error(H), _({
250
+ dataStatus: W.ERROR,
251
+ error: {
252
+ type: fe.GENERAL,
253
+ message: "An error occurred in initialAppointmentState"
254
+ }
255
+ });
256
+ }
257
+ })();
258
+ }, [
259
+ s,
260
+ r,
261
+ l,
262
+ u
263
+ ]), f;
264
+ }
265
+ const je = /* @__PURE__ */ Ge({
266
+ appointmentState: {},
267
+ setAppointmentState: () => {
268
+ }
269
+ }), tn = {
270
+ dataStatus: W.ERROR,
271
+ error: {
272
+ type: fe.NO_AVAILABILITY_DATES_FOUND,
273
+ message: "No availability dates found"
274
+ }
275
+ }, nn = ({ appointmentFieldProps: e, children: n }) => {
276
+ var c;
277
+ const { isEditor: t, isComposer: a } = Ee(), s = ((c = ft().appointment) == null ? void 0 : c.noAvailability) === !0, [r, l] = Q(() => qt({
278
+ appointmentFieldProps: e,
279
+ isEditor: t,
280
+ isComposer: a
281
+ })), i = en(e);
282
+ return U(() => {
283
+ i && l({
284
+ ...r,
285
+ ...i
286
+ });
287
+ }, [
288
+ i
289
+ ]), /* @__PURE__ */ o.createElement(je.Provider, {
290
+ value: {
291
+ appointmentFieldProps: e,
292
+ appointmentState: s ? tn : r,
293
+ setAppointmentState: (u) => l({
294
+ ...r,
295
+ ...u
296
+ })
297
+ }
298
+ }, n);
299
+ }, Me = () => Ze(je), an = (e, n) => {
300
+ if (e.startOfWeek.getMonth() === e.endOfWeek.getMonth())
301
+ return new Intl.DateTimeFormat(n, {
302
+ month: "long",
303
+ year: "numeric"
304
+ }).format(e.endOfWeek);
305
+ const t = new Intl.DateTimeFormat(n, {
306
+ month: "short"
307
+ }).format(e.startOfWeek), a = new Intl.DateTimeFormat(n, {
308
+ month: "short",
309
+ year: "numeric"
310
+ }).format(e.endOfWeek);
311
+ return `${t} - ${a}`;
312
+ }, on = (e, n) => {
313
+ const t = n || (e == null ? void 0 : e.timeZone);
314
+ return !(e != null && e.startDate) || !(e != null && e.endDate) || !t ? null : {
315
+ startDate: e.startDate,
316
+ endDate: e.endDate,
317
+ timeZone: t
318
+ };
319
+ }, sn = ({ setIsReloadingSlots: e }) => {
320
+ const { appointmentFieldProps: n, appointmentState: t, setAppointmentState: a } = Me(), { value: s } = n, { actions: r } = ve();
321
+ U(() => {
322
+ (async () => {
323
+ var i, c;
324
+ if (s != null && s.startDate && (t != null && t.selectedDate) && (t == null ? void 0 : t.dataStatus) === W.DONE) {
325
+ const u = _e(s.startDate, t == null ? void 0 : t.timezone);
326
+ if (!ae(u, t == null ? void 0 : t.selectedDate)) {
327
+ e(!0);
328
+ const { fromDate: _, toDate: S } = Gt(u, 8), [d, b] = await Promise.all([
329
+ (i = r == null ? void 0 : r.getAvailabilityDates) == null ? void 0 : i.call(r, {
330
+ serviceId: n == null ? void 0 : n.initialData.service.id,
331
+ timeZone: (t == null ? void 0 : t.timezone) || "",
332
+ fromDate: _,
333
+ toDate: S
334
+ }),
335
+ (c = r == null ? void 0 : r.getAvailabilitySlots) == null ? void 0 : c.call(r, {
336
+ serviceId: n == null ? void 0 : n.initialData.service.id,
337
+ timeZone: (t == null ? void 0 : t.timezone) || "",
338
+ selectedDate: u
339
+ })
340
+ ]);
341
+ a({
342
+ availabilityDates: d,
343
+ selectedDate: u,
344
+ availabilitySlots: b
345
+ }), e(!1);
346
+ }
347
+ }
348
+ })();
349
+ }, [
350
+ s,
351
+ t == null ? void 0 : t.dataStatus
352
+ ]);
353
+ }, rn = (e, n) => !e || !n.length ? e : e.filter((t) => {
354
+ var a;
355
+ return !n.includes(((a = t == null ? void 0 : t.slot) == null ? void 0 : a.startDate) ?? "");
356
+ }), de = (e) => !(e != null && e.startDate) || !(e != null && e.endDate) ? "" : `${e == null ? void 0 : e.startDate}_${e == null ? void 0 : e.endDate}`, ln = ({ locale: e, endDate: n, startDate: t, timezone: a }) => {
357
+ const s = {
358
+ hour: "numeric",
359
+ minute: "numeric",
360
+ timeZone: a
361
+ }, r = new Intl.DateTimeFormat(e, s).format(new Date(t)), l = new Intl.DateTimeFormat(e, s).format(new Date(n));
362
+ return `${r} - ${l}`;
363
+ }, cn = ({ selectedDate: e, locale: n }) => e ? new Intl.DateTimeFormat(n, {
364
+ weekday: "long",
365
+ month: "short",
366
+ day: "numeric"
367
+ }).format(e) : "", mn = (e, n) => {
368
+ let t;
369
+ return n.forEach((a, s) => {
370
+ var r, l;
371
+ de({
372
+ startDate: (r = a == null ? void 0 : a.slot) == null ? void 0 : r.startDate,
373
+ endDate: (l = a == null ? void 0 : a.slot) == null ? void 0 : l.endDate
374
+ }) === e && (t = s);
375
+ }), t;
376
+ };
377
+ var un = /* @__PURE__ */ (function(e) {
378
+ return e.OS_LOCATION = "OS_LOCATION", e.CUSTOM_LOCATION = "CUSTOM_LOCATION", e;
379
+ })({});
380
+ const dn = "SLOT_UNAVAILABLE", fn = (e) => {
381
+ var n;
382
+ return ((n = e == null ? void 0 : e.params) == null ? void 0 : n.reason) === dn;
383
+ }, Dn = ({ error: e, selectedSlot: n }) => {
384
+ const [t, a] = Q([]), s = fn(e), r = n == null ? void 0 : n.startDate, l = J(!1);
385
+ return U(() => {
386
+ if (!s) {
387
+ l.current = !1;
388
+ return;
389
+ }
390
+ l.current || (l.current = !0, r && a((i) => i.includes(r) ? i : [
391
+ ...i,
392
+ r
393
+ ]));
394
+ }, [
395
+ s,
396
+ r
397
+ ]), t;
398
+ }, j = 7, Qe = (e) => {
399
+ const n = new Date(e);
400
+ return n.setHours(0, 0, 0, 0), n;
401
+ }, En = (e) => {
402
+ const n = new Date(e);
403
+ return n.setHours(23, 59, 59, 999), n;
404
+ }, te = (e, n) => {
405
+ const t = new Date(e);
406
+ return t.setDate(t.getDate() + n), t;
407
+ }, Ke = (e, n) => {
408
+ const t = Qe(e), a = (t.getDay() - n + j) % j;
409
+ return te(t, -a);
410
+ }, Sn = (e) => `${e.getFullYear()}-${String(e.getMonth() + 1).padStart(2, "0")}-${String(e.getDate()).padStart(2, "0")}`, _n = (e, n, t) => {
411
+ const a = new Intl.DateTimeFormat(t, {
412
+ month: "short",
413
+ day: "numeric"
414
+ });
415
+ return typeof a.formatRange == "function" ? a.formatRange(e, n) : `${a.format(e)} - ${a.format(n)}`;
416
+ }, Nn = () => {
417
+ var Ce;
418
+ const { appointmentFieldProps: e, appointmentState: n, setAppointmentState: t } = Me(), { language: a, isEditor: s, isComposer: r } = Ee(), { t: l } = Dt(), { actions: i } = ve(), c = qe(), [u, f] = Q(!1), [_, S] = Q(!1), [d, b] = Q(), [v, p] = Q();
419
+ sn({
420
+ setIsReloadingSlots: f
421
+ });
422
+ const { onChange: I, value: O, target: x, initialData: z, formatDescription: Y, locationType: H, error: oe } = e, { availabilityDates: $, availabilitySlots: F, timezone: D = "", selectedDate: N, currentSlotBulkSize: R, dataStatus: G, error: Z } = n, K = (Ce = z == null ? void 0 : z.service) == null ? void 0 : Ce.id, V = G === W.LOADING, ee = u || _, Ne = !!Z, he = Dn({
423
+ error: oe,
424
+ selectedSlot: O
425
+ }), y = P(() => rn(F, he), [
426
+ F,
427
+ he
428
+ ]);
429
+ U(() => {
430
+ I == null || I(on(O, D));
431
+ }, [
432
+ O == null ? void 0 : O.startDate,
433
+ O == null ? void 0 : O.endDate,
434
+ D
435
+ ]), Et((E) => {
436
+ const L = E == null ? void 0 : E[x];
437
+ F != null && F.length && t({
438
+ availabilitySlots: F.filter((T) => {
439
+ var M;
440
+ return ((M = T == null ? void 0 : T.slot) == null ? void 0 : M.startDate) !== (L == null ? void 0 : L.startDate);
441
+ })
442
+ });
443
+ }), U(() => {
444
+ if (y != null && y.length && R) {
445
+ const E = mn(de(O ?? void 0), y);
446
+ E && E + 1 > R && t({
447
+ currentSlotBulkSize: E + 1
448
+ });
449
+ } else !(y != null && y.length) && O && (I == null || I(void 0));
450
+ }, [
451
+ O,
452
+ y,
453
+ $
454
+ ]);
455
+ const Ae = P(() => ut(a), [
456
+ a
457
+ ]), we = J(N);
458
+ U(() => {
459
+ const E = we.current;
460
+ we.current = N, !!N && (!E || !ae(E, N)) && b(void 0);
461
+ }, [
462
+ N
463
+ ]);
464
+ const w = P(() => d ?? Ke(N ?? be(D), Ae), [
465
+ d,
466
+ N,
467
+ Ae,
468
+ D
469
+ ]), tt = P(() => {
470
+ const E = be(D), L = new Intl.DateTimeFormat(a, {
471
+ weekday: "short"
472
+ }), T = new Intl.DateTimeFormat(a, {
473
+ day: "numeric"
474
+ }), M = new Intl.DateTimeFormat(a, {
475
+ weekday: "long",
476
+ month: "long",
477
+ day: "numeric"
478
+ });
479
+ return Array.from({
480
+ length: j
481
+ }, (se, Le) => {
482
+ const B = te(w, Le), Te = !!N && ae(B, N), lt = Qe(B) < E;
483
+ return {
484
+ key: Sn(B),
485
+ date: B,
486
+ isSelected: Te,
487
+ isAvailable: !V && !ee && !Te && Zt(B, $, D),
488
+ isDisabled: lt || ee && !Te,
489
+ isToday: ae(B, E),
490
+ dayOfMonthLabel: T.format(B),
491
+ weekdayLabel: L.format(B),
492
+ label: M.format(B),
493
+ availabilityLabel: l("form.appointment.accessibility.calendar.has-availability.aria-label")
494
+ };
495
+ });
496
+ }, [
497
+ w,
498
+ N,
499
+ $,
500
+ V,
501
+ ee,
502
+ a,
503
+ D,
504
+ l
505
+ ]), pe = de(O ?? void 0) || void 0, ye = P(() => V || u ? [] : (y ?? []).slice(0, R).flatMap((E) => {
506
+ const { startDate: L, endDate: T } = E.slot ?? {};
507
+ if (!L || !T)
508
+ return [];
509
+ const M = de({
510
+ startDate: L,
511
+ endDate: T
512
+ });
513
+ return [
514
+ {
515
+ key: M,
516
+ startDate: L,
517
+ endDate: T,
518
+ timeRange: ln({
519
+ startDate: L,
520
+ endDate: T,
521
+ locale: a,
522
+ timezone: D
523
+ }),
524
+ isSelected: M === pe
525
+ }
526
+ ];
527
+ }), [
528
+ y,
529
+ R,
530
+ V,
531
+ u,
532
+ a,
533
+ D,
534
+ pe
535
+ ]), Ie = !u && !!(y != null && y.length) && (R || q) < y.length, Oe = w > Ke(be(D), Ae), nt = re(
536
+ async (E) => {
537
+ var L;
538
+ if (!(ee || N && ae(E, N))) {
539
+ f(!0), I == null || I(void 0), t({
540
+ currentSlotBulkSize: q,
541
+ selectedDate: E,
542
+ availabilitySlots: void 0
543
+ }), c == null || c.report({
544
+ action: ne.CLICK,
545
+ component: X.DATE
546
+ });
547
+ try {
548
+ const T = await ((L = i == null ? void 0 : i.getAvailabilitySlots) == null ? void 0 : L.call(i, {
549
+ serviceId: K,
550
+ timeZone: D,
551
+ selectedDate: E
552
+ }));
553
+ t({
554
+ currentSlotBulkSize: q,
555
+ selectedDate: E,
556
+ availabilitySlots: T
557
+ });
558
+ } catch {
559
+ } finally {
560
+ f(!1);
561
+ }
562
+ }
563
+ },
564
+ // eslint-disable-next-line react-hooks/exhaustive-deps
565
+ [
566
+ ee,
567
+ N,
568
+ K,
569
+ D,
570
+ i,
571
+ I,
572
+ c
573
+ ]
574
+ ), ce = J(0), at = re(
575
+ async (E) => {
576
+ var se;
577
+ if (E < 0 && !Oe)
578
+ return;
579
+ const L = w, T = te(w, E * j);
580
+ if (b(T), s || r)
581
+ return;
582
+ const M = ++ce.current;
583
+ S(!0), c == null || c.report({
584
+ action: ne.CLICK,
585
+ component: X.PAGINATION
586
+ });
587
+ try {
588
+ const Le = await ((se = i == null ? void 0 : i.getAvailabilityDates) == null ? void 0 : se.call(i, {
589
+ serviceId: K,
590
+ timeZone: D,
591
+ fromDate: T,
592
+ toDate: En(te(T, j - 1))
593
+ }));
594
+ M === ce.current && t({
595
+ availabilityDates: Le
596
+ });
597
+ } catch {
598
+ M === ce.current && b(L);
599
+ } finally {
600
+ M === ce.current && S(!1);
601
+ }
602
+ },
603
+ // eslint-disable-next-line react-hooks/exhaustive-deps
604
+ [
605
+ Oe,
606
+ w,
607
+ s,
608
+ r,
609
+ K,
610
+ D,
611
+ i,
612
+ c
613
+ ]
614
+ ), ot = re(
615
+ (E) => {
616
+ const L = ye.find((se) => se.key === E);
617
+ if (!L)
618
+ return;
619
+ const { startDate: T, endDate: M } = L;
620
+ c == null || c.report({
621
+ action: ne.CLICK,
622
+ component: X.SLOT,
623
+ startTime: new Date(T).valueOf(),
624
+ endTime: new Date(M).valueOf()
625
+ }), I == null || I({
626
+ startDate: T,
627
+ endDate: M,
628
+ timeZone: D
629
+ });
630
+ },
631
+ // eslint-disable-next-line react-hooks/exhaustive-deps
632
+ [
633
+ ye,
634
+ D,
635
+ I,
636
+ c
637
+ ]
638
+ ), st = re(() => {
639
+ if (!Ie)
640
+ return;
641
+ const E = R || q;
642
+ c == null || c.report({
643
+ action: ne.CLICK,
644
+ component: X.SHOW_MORE
645
+ }), p(E), t({
646
+ currentSlotBulkSize: E + q
647
+ });
648
+ }, [
649
+ Ie,
650
+ R,
651
+ c
652
+ ]), rt = re(() => p(void 0), []), it = P(() => {
653
+ if (Ne)
654
+ return l("form.appointment.empty-state.notification.text");
655
+ if (!V && !u && !(y != null && y.length))
656
+ return l("form.appointment.slots-not-found.text");
657
+ }, [
658
+ Ne,
659
+ V,
660
+ u,
661
+ y == null ? void 0 : y.length,
662
+ l
663
+ ]);
664
+ return {
665
+ days: tt,
666
+ slots: ye,
667
+ selectedSlotKey: pe,
668
+ selectDate: nt,
669
+ selectSlot: ot,
670
+ changeWeek: at,
671
+ showMoreSlots: st,
672
+ canGoToPreviousWeek: Oe,
673
+ hasMoreSlots: Ie,
674
+ hasError: Ne,
675
+ isLoading: V,
676
+ isRefetching: ee,
677
+ isReloadingSlots: u,
678
+ weekRangeLabel: _n(w, te(w, j - 1), a),
679
+ weekCaptionLabel: an({
680
+ startOfWeek: w,
681
+ endOfWeek: te(w, j - 1)
682
+ }, a),
683
+ selectedDateLabel: cn({
684
+ selectedDate: N,
685
+ locale: a
686
+ }),
687
+ timezoneLabel: D ? `${l("form.appointment.timezone.label")}: ${$t({
688
+ timezone: D,
689
+ language: a
690
+ })}` : "",
691
+ formatLabel: H === un.OS_LOCATION ? l("form.appointment.meeting-format.in-person-location-method-os-location") : Y,
692
+ notificationMessage: it,
693
+ showMoreSlotsLabel: l("form.appointment.show-more-slots.text"),
694
+ previousWeekLabel: l("form.appointment.accessibility.calendar.previous-week.aria-label"),
695
+ nextWeekLabel: l("form.appointment.accessibility.calendar.next-week.aria-label"),
696
+ pendingFocusIndex: v,
697
+ consumePendingFocusIndex: rt
698
+ };
699
+ }, Xe = Ge(void 0), Je = (e) => `${e}-timezone-note`, et = (e) => `${e}-date-title`, h = () => {
700
+ const e = Ze(Xe);
701
+ if (typeof e > "u")
702
+ throw new Error("Appointment parts must be used inside an <Appointment> component");
703
+ return e;
704
+ }, Fe = () => {
705
+ const { disabled: e, readOnly: n } = ie();
706
+ return !!e || !!n;
707
+ }, C = ({ children: e, className: n }) => {
708
+ const { days: t, selectDate: a, weekRangeLabel: s } = h(), r = k(e, C.PreviousWeek), l = k(e, C.Heading), i = k(e, C.NextWeek), c = k(e, C.Day) ?? /* @__PURE__ */ o.createElement(C.Day, null), u = P(() => t.filter((d) => d.isSelected).map((d) => d.key), [
709
+ t
710
+ ]), f = Fe(), _ = P(() => t.filter((d) => f || d.isDisabled).map((d) => d.key), [
711
+ t,
712
+ f
713
+ ]), S = (d) => {
714
+ if (d === "all")
715
+ return;
716
+ const [b] = [
717
+ ...d
718
+ ], v = t.find(({ key: p }) => p === b);
719
+ v && a(v.date);
720
+ };
721
+ return /* @__PURE__ */ o.createElement("div", {
722
+ className: n
723
+ }, r, l, i, /* @__PURE__ */ o.createElement(Mt, {
724
+ "aria-label": s,
725
+ orientation: "horizontal",
726
+ selectionMode: "single",
727
+ selectedKeys: u,
728
+ disabledKeys: _,
729
+ onSelectionChange: S
730
+ }, t.map((d) => Se(c, {
731
+ key: d.key,
732
+ day: d
733
+ }))));
734
+ }, An = ({ children: e, className: n }) => {
735
+ const { changeWeek: t, canGoToPreviousWeek: a, previousWeekLabel: s, nextWeekLabel: r } = h(), l = Fe(), i = J(null), c = J(!1);
736
+ return U(() => {
737
+ var _, S, d;
738
+ if (a || !c.current)
739
+ return;
740
+ c.current = !1;
741
+ const u = document.activeElement;
742
+ if (u !== document.body && u !== i.current)
743
+ return;
744
+ const f = ((S = (_ = i.current) == null ? void 0 : _.closest("fieldset")) == null ? void 0 : S.querySelectorAll("button")) ?? [];
745
+ (d = Array.from(f).find((b) => b.getAttribute("aria-label") === r)) == null || d.focus();
746
+ }, [
747
+ a,
748
+ r
749
+ ]), /* @__PURE__ */ o.createElement(Re, {
750
+ ref: i,
751
+ className: n,
752
+ "aria-label": s,
753
+ isDisabled: !a || l,
754
+ onPress: () => {
755
+ c.current = !0, t(-1);
756
+ }
757
+ }, e ?? "‹");
758
+ }, pn = ({ children: e, className: n }) => {
759
+ const { changeWeek: t, nextWeekLabel: a } = h(), s = Fe();
760
+ return /* @__PURE__ */ o.createElement(Re, {
761
+ className: n,
762
+ "aria-label": a,
763
+ isDisabled: s,
764
+ onPress: () => t(1)
765
+ }, e ?? "›");
766
+ }, yn = ({ children: e, className: n }) => {
767
+ const { weekCaptionLabel: t, weekRangeLabel: a } = h();
768
+ return /* @__PURE__ */ o.createElement("span", {
769
+ className: n,
770
+ "aria-live": "polite"
771
+ }, e ? e({
772
+ label: t,
773
+ weekRange: a
774
+ }) : /* @__PURE__ */ o.createElement(o.Fragment, null, /* @__PURE__ */ o.createElement("span", {
775
+ "aria-hidden": "true"
776
+ }, t), /* @__PURE__ */ o.createElement("span", {
777
+ style: Ve
778
+ }, a)));
779
+ }, In = ({ children: e, className: n, ...t }) => {
780
+ const { day: a } = t;
781
+ return /* @__PURE__ */ o.createElement(Ft, {
782
+ id: a.key,
783
+ className: n,
784
+ textValue: a.label,
785
+ "aria-label": a.isAvailable ? `${a.label}, ${a.availabilityLabel}` : a.label,
786
+ "data-available": a.isAvailable || void 0,
787
+ "data-today": a.isToday || void 0
788
+ }, e ? e({
789
+ ...a,
790
+ date: new Date(a.date)
791
+ }) : /* @__PURE__ */ o.createElement(o.Fragment, null, /* @__PURE__ */ o.createElement("span", null, a.weekdayLabel), /* @__PURE__ */ o.createElement("span", null, a.dayOfMonthLabel)));
792
+ };
793
+ C.PreviousWeek = An;
794
+ C.Heading = yn;
795
+ C.NextWeek = pn;
796
+ C.Day = In;
797
+ const $e = 'input[type="radio"]', De = ({ children: e, className: n, ...t }) => {
798
+ const { hasTimezoneNote: a, hasDateTitle: s } = t, { slots: r, selectedSlotKey: l, selectSlot: i, selectedDateLabel: c, isReloadingSlots: u, timezoneLabel: f, pendingFocusIndex: _, consumePendingFocusIndex: S } = h(), { id: d, disabled: b, readOnly: v, required: p, hasError: I } = ie(), { inputId: O, labelId: x, ariaDescribedBy: z } = le(), Y = J(null), H = k(e, De.Slot) ?? /* @__PURE__ */ o.createElement(De.Slot, null), oe = !!s && !!c, $ = [
799
+ z,
800
+ a && f ? Je(O) : void 0
801
+ ].filter(Boolean).join(" ") || void 0, F = (D, N) => {
802
+ var R, G, Z;
803
+ (Z = (G = (R = Y.current) == null ? void 0 : R.querySelectorAll($e)) == null ? void 0 : G[D]) == null || Z.focus(N);
804
+ };
805
+ return St(() => {
806
+ var G, Z;
807
+ if (!!((G = Y.current) != null && G.querySelector($e))) {
808
+ F(0, {
809
+ preventScroll: !0
810
+ });
811
+ return;
812
+ }
813
+ const N = Array.from(((Z = document.getElementById(O)) == null ? void 0 : Z.querySelectorAll('[role="option"]')) ?? []), R = N.find((K) => K.getAttribute("aria-selected") === "true") ?? N.find((K) => K.getAttribute("aria-disabled") !== "true");
814
+ R == null || R.focus({
815
+ preventScroll: !0
816
+ });
817
+ }, d), U(() => {
818
+ _ !== void 0 && (F(_), S());
819
+ }, [
820
+ _,
821
+ r.length
822
+ ]), /* @__PURE__ */ o.createElement(o.Fragment, null, /* @__PURE__ */ o.createElement("div", {
823
+ role: "status",
824
+ style: Ve
825
+ }, r.length > 0 ? c : void 0), /* @__PURE__ */ o.createElement(ht, {
826
+ ref: Y,
827
+ className: n,
828
+ value: l ?? null,
829
+ onChange: i,
830
+ isDisabled: b,
831
+ isReadOnly: v,
832
+ isRequired: p,
833
+ isInvalid: I,
834
+ "aria-labelledby": oe ? et(O) : x,
835
+ "aria-describedby": $,
836
+ "data-refetch": u || void 0
837
+ }, r.map((D) => Se(H, {
838
+ key: D.key,
839
+ slot: D
840
+ }))));
841
+ }, On = ({ children: e, className: n, ...t }) => {
842
+ const { slot: a } = t;
843
+ return /* @__PURE__ */ o.createElement(wt, {
844
+ value: a.key,
845
+ "aria-label": a.timeRange
846
+ }, /* @__PURE__ */ o.createElement(Ct, {
847
+ className: n
848
+ }, e ? e(a) : a.timeRange));
849
+ };
850
+ De.Slot = On;
851
+ const m = ({ children: e, className: n }) => {
852
+ const t = ie(), { id: a, FieldLayout: s } = t, { labelId: r, inputId: l, ariaDescribedBy: i } = le(), c = _t(Nt.APPOINTMENT), u = P(() => ({
853
+ ...t,
854
+ initialData: c,
855
+ inputId: l,
856
+ ariaLabelledBy: r,
857
+ ariaDescribedBy: i,
858
+ fieldId: a
859
+ }), [
860
+ t,
861
+ c,
862
+ l,
863
+ r,
864
+ i,
865
+ a
866
+ ]), f = k(e, m.Label), _ = k(e, m.Description), S = k(e, m.Error);
867
+ return /* @__PURE__ */ o.createElement(s, {
868
+ fieldId: a,
869
+ renderLabel: () => Se(f, {
870
+ as: "div"
871
+ }),
872
+ renderInput: () => /* @__PURE__ */ o.createElement(nn, {
873
+ appointmentFieldProps: u
874
+ }, /* @__PURE__ */ o.createElement(Tn, {
875
+ className: n
876
+ }, e)),
877
+ renderDescription: () => /* @__PURE__ */ o.createElement(o.Fragment, null, S, _)
878
+ });
879
+ }, Ln = {
880
+ visibility: "hidden"
881
+ }, Tn = ({ children: e, className: n }) => {
882
+ const { required: t, onFocus: a, onBlur: s } = ie(), { inputId: r, labelId: l, ariaDescribedBy: i } = le(), c = Nn(), u = k(e, m.Loader), f = k(e, m.Notification), _ = k(e, m.Dates), S = k(e, m.Timezone), d = k(e, m.Format), b = k(e, m.DateTitle), v = k(e, m.Slots), p = k(e, m.ShowMoreSlots);
883
+ return /* @__PURE__ */ o.createElement(Xe.Provider, {
884
+ value: c
885
+ }, /* @__PURE__ */ o.createElement(Ut, {
886
+ id: r,
887
+ className: n,
888
+ ariaLabelledBy: l,
889
+ ariaDescribedBy: i,
890
+ required: t,
891
+ onFocus: a,
892
+ onBlur: s
893
+ }, u, c.hasError ? f : /* @__PURE__ */ o.createElement("div", {
894
+ style: c.isLoading ? Ln : void 0
895
+ }, _, S, d, b, Se(v, {
896
+ hasTimezoneNote: !!S,
897
+ hasDateTitle: !!b
898
+ }), f, p)));
899
+ }, bn = ({ children: e, className: n }) => {
900
+ const { isLoading: t, isRefetching: a } = h();
901
+ return !t && !a ? null : /* @__PURE__ */ o.createElement("div", {
902
+ className: n,
903
+ role: "status",
904
+ "aria-live": "polite",
905
+ "data-initial": t || void 0,
906
+ "data-refetch": !t && a || void 0
907
+ }, e);
908
+ }, gn = ({ children: e, className: n }) => {
909
+ const { notificationMessage: t } = h();
910
+ return t ? /* @__PURE__ */ o.createElement("div", {
911
+ className: n,
912
+ role: "status"
913
+ }, e ? e({
914
+ message: t
915
+ }) : t) : null;
916
+ }, kn = ({ children: e, className: n }) => {
917
+ const { timezoneLabel: t } = h(), { inputId: a } = le();
918
+ return t ? /* @__PURE__ */ o.createElement("span", {
919
+ id: Je(a),
920
+ className: n
921
+ }, e ? e({
922
+ label: t
923
+ }) : t) : null;
924
+ }, vn = ({ children: e, className: n }) => {
925
+ const { formatLabel: t } = h();
926
+ return t ? /* @__PURE__ */ o.createElement("span", {
927
+ className: n
928
+ }, e ? e({
929
+ label: t
930
+ }) : t) : null;
931
+ }, Rn = ({ children: e, className: n }) => {
932
+ const { selectedDateLabel: t } = h(), { inputId: a } = le();
933
+ return t ? /* @__PURE__ */ o.createElement("div", {
934
+ id: et(a),
935
+ className: n
936
+ }, e ? e({
937
+ label: t
938
+ }) : t) : null;
939
+ }, Mn = ({ children: e, className: n }) => {
940
+ const { hasMoreSlots: t, showMoreSlots: a, showMoreSlotsLabel: s } = h(), { disabled: r, readOnly: l } = ie();
941
+ return t ? /* @__PURE__ */ o.createElement(Re, {
942
+ className: n,
943
+ isDisabled: !!r || !!l,
944
+ onPress: a
945
+ }, e ? e({
946
+ label: s
947
+ }) : s) : null;
948
+ };
949
+ m.Label = Pt;
950
+ m.Loader = bn;
951
+ m.Notification = gn;
952
+ m.Dates = C;
953
+ m.Timezone = kn;
954
+ m.Format = vn;
955
+ m.DateTitle = Rn;
956
+ m.Slots = De;
957
+ m.ShowMoreSlots = Mn;
958
+ m.Description = Wt;
959
+ m.Error = Bt;
960
+ const Fn = "_appointment_ki27o_1", hn = "_dates_ki27o_5", wn = "_weekHeading_ki27o_30", Cn = "_weekButton_ki27o_36", Wn = "_previousWeek_ki27o_68", Bn = "_nextWeek_ki27o_72", Pn = "_day_ki27o_84", Un = "_weekdayLabel_ki27o_94", xn = "_dayNumber_ki27o_103", zn = "_indicator_ki27o_107", Yn = "_hint_ki27o_130", Hn = "_slots_ki27o_143", Kn = "_dateTitle_ki27o_157", $n = "_slot_ki27o_143", Gn = "_slotHover_ki27o_199", Zn = "_slotSelected_ki27o_207", Vn = "_showMoreSlots_ki27o_261", qn = "_loader_ki27o_292", jn = "_notification_ki27o_328", A = {
961
+ appointment: Fn,
962
+ dates: hn,
963
+ weekHeading: wn,
964
+ weekButton: Cn,
965
+ previousWeek: Wn,
966
+ nextWeek: Bn,
967
+ day: Pn,
968
+ weekdayLabel: Un,
969
+ dayNumber: xn,
970
+ indicator: zn,
971
+ hint: Yn,
972
+ slots: Hn,
973
+ dateTitle: Kn,
974
+ slot: $n,
975
+ slotHover: Gn,
976
+ slotSelected: Zn,
977
+ showMoreSlots: Vn,
978
+ loader: qn,
979
+ notification: jn
980
+ }, Qn = ({ content: e, locale: n }) => /* @__PURE__ */ o.createElement(ct, {
981
+ content: e,
982
+ locale: n
983
+ }), Xn = {
984
+ base: A.slot,
985
+ selected: A.slotSelected,
986
+ hover: A.slotHover
987
+ }, Jn = () => {
988
+ const e = Rt({
989
+ globalClasses: vt,
990
+ moduleClasses: Xn
991
+ });
992
+ return /* @__PURE__ */ o.createElement(m, {
993
+ className: g(At, A.appointment)
994
+ }, /* @__PURE__ */ o.createElement(m.Label, {
995
+ className: g(pt, ue.label)
996
+ }, /* @__PURE__ */ o.createElement(m.Label.Required, {
997
+ className: g(yt, ue.requiredMark)
998
+ })), /* @__PURE__ */ o.createElement(m.Loader, {
999
+ className: A.loader
1000
+ }), /* @__PURE__ */ o.createElement(m.Dates, {
1001
+ className: g(It, A.dates)
1002
+ }, /* @__PURE__ */ o.createElement(m.Dates.PreviousWeek, {
1003
+ className: g(me, A.weekButton, A.previousWeek)
1004
+ }, /* @__PURE__ */ o.createElement(We, null)), /* @__PURE__ */ o.createElement(m.Dates.Heading, {
1005
+ className: A.weekHeading
1006
+ }), /* @__PURE__ */ o.createElement(m.Dates.NextWeek, {
1007
+ className: g(me, A.weekButton, A.nextWeek)
1008
+ }, /* @__PURE__ */ o.createElement(We, null)), /* @__PURE__ */ o.createElement(m.Dates.Day, {
1009
+ className: g(me, Be.day, A.day)
1010
+ }, (n) => /* @__PURE__ */ o.createElement(o.Fragment, null, /* @__PURE__ */ o.createElement("span", {
1011
+ className: A.weekdayLabel
1012
+ }, n.weekdayLabel), /* @__PURE__ */ o.createElement("span", {
1013
+ className: g(Be.dayNumber, A.dayNumber)
1014
+ }, n.dayOfMonthLabel, /* @__PURE__ */ o.createElement("span", {
1015
+ className: A.indicator
1016
+ }))))), /* @__PURE__ */ o.createElement(m.Timezone, {
1017
+ className: g(Pe, A.hint)
1018
+ }), /* @__PURE__ */ o.createElement(m.Format, {
1019
+ className: g(Pe, A.hint)
1020
+ }), /* @__PURE__ */ o.createElement(m.DateTitle, {
1021
+ className: g(Ot, A.dateTitle)
1022
+ }), /* @__PURE__ */ o.createElement(m.Slots, {
1023
+ className: g(Lt, A.slots)
1024
+ }, /* @__PURE__ */ o.createElement(m.Slots.Slot, {
1025
+ className: ({ isSelected: n, isHovered: t, isFocused: a, isDisabled: s, isReadOnly: r }) => e({
1026
+ isSelected: n,
1027
+ isHovered: (t || a) && !n && !s && !r
1028
+ })
1029
+ }, (n) => n.timeRange)), /* @__PURE__ */ o.createElement(m.Notification, {
1030
+ className: g(Tt, A.notification)
1031
+ }), /* @__PURE__ */ o.createElement(m.ShowMoreSlots, {
1032
+ className: g(bt, me, A.showMoreSlots)
1033
+ }), /* @__PURE__ */ o.createElement(m.Error, {
1034
+ className: g(gt, ue.error)
1035
+ }, /* @__PURE__ */ o.createElement(mt, null), /* @__PURE__ */ o.createElement(m.Error.Text, null)), /* @__PURE__ */ o.createElement(m.Description, {
1036
+ className: g(kt, ue.description)
1037
+ }, Qn));
1038
+ }, Na = () => /* @__PURE__ */ o.createElement(Jn, null);
1039
+ export {
1040
+ Na as AppointmentRAC
1041
+ };