@wix/form-elements 1.224.0 → 1.225.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 (125) hide show
  1. package/dist/component/{appointment-rac-UcRjJTHp.js → appointment-rac-DfglpMHC.js} +5 -5
  2. package/dist/component/{bookings-address-rac-DDjZGEhk.js → bookings-address-rac-BsAUAgUH.js} +1 -1
  3. package/dist/component/{bookings-email-rac-Dy2vh3dy.js → bookings-email-rac-DL0Q3omz.js} +1 -1
  4. package/dist/component/{bookings-first-name-rac-fDHMNznn.js → bookings-first-name-rac-C3eHsd6U.js} +1 -1
  5. package/dist/component/{bookings-header-rac-DLOeNNQf.js → bookings-header-rac-YVCqWtfu.js} +1 -1
  6. package/dist/component/{bookings-last-name-rac-Bx19ROVT.js → bookings-last-name-rac-BzBQBIMy.js} +1 -1
  7. package/dist/component/{bookings-login-bar-rac-8FbvPiv1.js → bookings-login-bar-rac-MJvhVfsH.js} +1 -1
  8. package/dist/component/{bookings-phone-rac-CvPQgtvq.js → bookings-phone-rac-BTEB2Mzf.js} +1 -1
  9. package/dist/component/{bookings-rich-text-rac-CO8bHRpD.js → bookings-rich-text-rac-BopQG6gV.js} +1 -1
  10. package/dist/component/calendar-icon-DOeHn3jt.js +19 -0
  11. package/dist/component/{checkbox-field-rac-tzsGw10P.js → checkbox-field-rac-NvQt_qcN.js} +6 -6
  12. package/dist/component/{checkbox-group-field-headless-CL18dpkq.js → checkbox-group-field-headless-CwLaBukh.js} +3 -3
  13. package/dist/component/{checkbox-group-field-rac-BmbxaprJ.js → checkbox-group-field-rac-BKQhos1K.js} +6 -6
  14. package/dist/component/{checkbox-group-rac-shsbUvRc.js → checkbox-group-rac-DMeC2rsZ.js} +1 -1
  15. package/dist/component/{checkbox-indicator-module-classes-DOxE4UQg.js → checkbox-indicator-module-classes-Cozvs_kk.js} +1 -1
  16. package/dist/component/{checkbox-rac-CobYYayd.js → checkbox-rac-Dea1HbEL.js} +1 -1
  17. package/dist/component/{contacts-address-rac-BoDqJCi1.js → contacts-address-rac-B64jiofc.js} +1 -1
  18. package/dist/component/{contacts-birthdate-rac-GAujbm-z.js → contacts-birthdate-rac-CM4GjTBV.js} +1 -1
  19. package/dist/component/{contacts-company-rac-CLcEz04V.js → contacts-company-rac-DTf9dwuR.js} +1 -1
  20. package/dist/component/{contacts-email-rac-D9q7TJwy.js → contacts-email-rac-B2vhNF_y.js} +1 -1
  21. package/dist/component/{contacts-first-name-rac-BAecbeNQ.js → contacts-first-name-rac-C5ywHnnX.js} +1 -1
  22. package/dist/component/{contacts-last-name-rac-Ccrw8BDa.js → contacts-last-name-rac-C2JbeG_J.js} +1 -1
  23. package/dist/component/{contacts-phone-rac-DA2N033V.js → contacts-phone-rac-Dm0PS175.js} +1 -1
  24. package/dist/component/{contacts-position-rac-0lAd-nCW.js → contacts-position-rac-t6bWP1Yh.js} +1 -1
  25. package/dist/component/{contacts-subscribe-rac-DB2ssF-E.js → contacts-subscribe-rac-D5EWQfGj.js} +1 -1
  26. package/dist/component/{contacts-tax-id-rac-B-Sn92Ho.js → contacts-tax-id-rac-CXqezyXg.js} +1 -1
  27. package/dist/component/{date-availability-CtfWLvii.js → date-availability-CtrbZvl3.js} +1 -1
  28. package/dist/component/date-input-field-rac-CPLAqaMS.js +365 -0
  29. package/dist/component/{date-input-rac-BnWwBe2i.js → date-input-rac-DjQc-F8G.js} +1 -1
  30. package/dist/component/date-picker-field-rac-pA2HwauY.js +386 -0
  31. package/dist/component/{date-picker-rac-BhI6jOQE.js → date-picker-rac-B6M3C8dN.js} +1 -1
  32. package/dist/component/date-time-input-field-rac-Qz6g31Eu.js +507 -0
  33. package/dist/component/{date-time-input-rac-DAbopLQt.js → date-time-input-rac-D7bS3bUX.js} +1 -1
  34. package/dist/component/{dext-checkbox-group-rac-D_HLv0tP.js → dext-checkbox-group-rac-caVwDBtB.js} +2 -2
  35. package/dist/component/{dext-checkbox-rac-BnBTlqEI.js → dext-checkbox-rac-CMxPnPT3.js} +1 -1
  36. package/dist/component/{dext-date-picker-rac-Co_yfhuz.js → dext-date-picker-rac-5WBCluMk.js} +1 -1
  37. package/dist/component/{dext-date-time-input-rac-BSpUehb2.js → dext-date-time-input-rac-C5d1PKMu.js} +1 -1
  38. package/dist/component/{dext-dropdown-rac-DPApx74L.js → dext-dropdown-rac-BPeVs1gI.js} +1 -1
  39. package/dist/component/{dext-email-rac-Dns6jFl4.js → dext-email-rac-BTXfUaaY.js} +1 -1
  40. package/dist/component/{dext-number-input-rac-DfN-xRID.js → dext-number-input-rac-DJt_dDVj.js} +1 -1
  41. package/dist/component/{dext-phone-rac-b5Ix3aTQ.js → dext-phone-rac-DDtneNPi.js} +1 -1
  42. package/dist/component/{dext-radio-group-rac-BAwIkDsJ.js → dext-radio-group-rac-DzLW_As4.js} +2 -2
  43. package/dist/component/{dext-rating-input-rac-mwQpCQUI.js → dext-rating-input-rac-0wwq1TR3.js} +1 -1
  44. package/dist/component/{dext-tags-rac-BGmElgw8.js → dext-tags-rac-Cj7nIZWu.js} +2 -2
  45. package/dist/component/{dext-text-area-rac-DN5HPqdg.js → dext-text-area-rac-D4Ej9MYY.js} +1 -1
  46. package/dist/component/{dext-text-input-rac-DEyDRhQ2.js → dext-text-input-rac-DgqBl2cb.js} +1 -1
  47. package/dist/component/{dext-url-input-rac-B1o3BAZE.js → dext-url-input-rac-CH-5gGxA.js} +1 -1
  48. package/dist/component/dismiss-icon-ejA47noY.js +69 -0
  49. package/dist/component/{donation-rac-Dp6PmATz.js → donation-rac-BwpE1YTR.js} +6 -6
  50. package/dist/component/dropdown-field-rac-CeywMN1E.js +40 -0
  51. package/dist/component/{dropdown-rac-eqQW-Z9k.js → dropdown-rac-DiXJLvXK.js} +1 -1
  52. package/dist/component/{ecom-address-rac-Q02N1v6i.js → ecom-address-rac-MD0hbW1w.js} +1 -1
  53. package/dist/component/{ecom-subscription-checkbox-rac-CmqVje9n.js → ecom-subscription-checkbox-rac-BssVeeXB.js} +2 -2
  54. package/dist/component/{email-input-field-rac-HmrdF3g7.js → email-input-field-rac-BXoueQNf.js} +4 -4
  55. package/dist/component/{events-repeater-rac-BSML2My0.js → events-repeater-rac-fm6lHaJ2.js} +6 -6
  56. package/dist/component/{events-rsvp-rac-0pI3cb2e.js → events-rsvp-rac-QV9f5chX.js} +4 -4
  57. package/dist/component/{field-error-headless-B3U_Gymg.js → field-error-headless-BIzDViIC.js} +1 -1
  58. package/dist/component/{field-label-headless-Cyy9_5qJ.js → field-label-headless-D_ubs4wp.js} +1 -1
  59. package/dist/component/field-rac.module-D0QzJXUv.js +32 -0
  60. package/dist/component/{file-upload-rac-hR9TZqk2.js → file-upload-rac-Csmt20hK.js} +5 -5
  61. package/dist/component/{fixed-payment-rac-CghZp6bR.js → fixed-payment-rac-BXr53Q8H.js} +4 -4
  62. package/dist/component/{form-BmSV4tOz.js → form-Dnq7LxSl.js} +1701 -1688
  63. package/dist/component/form.css +1 -1
  64. package/dist/component/form.js +1 -1
  65. package/dist/component/{header-field-rac-C7LDm89o.js → header-field-rac-9750XSxD.js} +2 -2
  66. package/dist/component/{header-rac-BNNzF5wQ.js → header-rac-DGSENeOk.js} +1 -1
  67. package/dist/component/{image-choice-rac-DLgxkKIZ.js → image-choice-rac-HX8H18Z3.js} +5 -5
  68. package/dist/component/{index-Dg8Fefid.js → index-pgW3uSoZ.js} +2 -2
  69. package/dist/component/{index-B8ObIJtL.js → index-vs-qkVQt.js} +4 -4
  70. package/dist/component/{isObjectLike-oBQcCfqW.js → isObjectLike-DoUrU0Hj.js} +1 -1
  71. package/dist/component/multiline-address-field-rac-B3gKz3u_.js +1818 -0
  72. package/dist/component/{multiline-address-rac-8MZkKfqY.js → multiline-address-rac-BBign7ot.js} +1 -1
  73. package/dist/component/native-select-BbxBpe3S.js +32 -0
  74. package/dist/component/{number-input-field-rac-Dmp8pNIq.js → number-input-field-rac-CO6DG443.js} +5 -5
  75. package/dist/component/{number-input-rac-2cN_bN_s.js → number-input-rac-C_Ndaqs4.js} +1 -1
  76. package/dist/component/{password-rac-CFdC1hoi.js → password-rac-pq-CaSkt.js} +5 -5
  77. package/dist/component/{payment-input-rac-BWElGzuv.js → payment-input-rac-Dco8O86k.js} +5 -5
  78. package/dist/component/phone-input-field-rac-BmcADPkC.js +558 -0
  79. package/dist/component/{phone-rac-CE9-90C3.js → phone-rac-B3aFMUMq.js} +1 -1
  80. package/dist/component/{product-list-rac-QU7Ocwvy.js → product-list-rac-Cw21coVk.js} +6 -6
  81. package/dist/component/{quiz-radio-group-rac-Hm7B7RlU.js → quiz-radio-group-rac-ChkNtxix.js} +1 -1
  82. package/dist/component/{radio-button-module-classes-CcGF7N_Y.js → radio-button-module-classes-BtiG6yqb.js} +3 -3
  83. package/dist/component/{radio-group-field-rac-Bk1JBBts.js → radio-group-field-rac-6SefZCE6.js} +5 -5
  84. package/dist/component/{radio-group-rac-D_YZnpID.js → radio-group-rac-BRhOFR2j.js} +1 -1
  85. package/dist/component/{rating-input-field-rac-zvA6QBGo.js → rating-input-field-rac-DaVnkb6k.js} +5 -5
  86. package/dist/component/{rating-input-rac-CXVQUoi-.js → rating-input-rac-B-2pZ61H.js} +1 -1
  87. package/dist/component/{rich-content-rac.module-CnZ4lMBG.js → rich-content-rac.module-C6LD--Ql.js} +1 -1
  88. package/dist/component/{rich-text-field-rac-DYQgVXdV.js → rich-text-field-rac-C-rfA6pQ.js} +2 -2
  89. package/dist/component/{rich-text-rac-Dk8396e-.js → rich-text-rac-1s5CGO8u.js} +1 -1
  90. package/dist/component/service-dropdown-rac-Bcr83doj.js +150 -0
  91. package/dist/component/{services-multi-choice-rac-D1RiVaLW.js → services-multi-choice-rac-C9nSuz9x.js} +7 -7
  92. package/dist/component/{signature-rac-DcGKMX84.js → signature-rac-pgob6vV_.js} +5 -5
  93. package/dist/component/{submit-button-rac-DbMxQlNH.js → submit-button-rac-CzcFB8hM.js} +2 -2
  94. package/dist/component/{tags-field-rac-Bi4lKutL.js → tags-field-rac-BBFxSNch.js} +6 -6
  95. package/dist/component/{tags-rac-DDCPnT8M.js → tags-rac-DkwugVvK.js} +1 -1
  96. package/dist/component/{text-area-field-rac-cre_K0MD.js → text-area-field-rac-DHT-fc0i.js} +5 -5
  97. package/dist/component/{text-area-rac-61wsMj-j.js → text-area-rac-cTq-i-bf.js} +1 -1
  98. package/dist/component/{text-input-field-rac-CV5_ba0x.js → text-input-field-rac-D3v-e_5R.js} +4 -4
  99. package/dist/component/{text-input-headless-kRv3KpSL.js → text-input-headless-B-DwvpWg.js} +3 -3
  100. package/dist/component/{text-input-rac-CwqZ6NXO.js → text-input-rac-CpG9qt33.js} +1 -1
  101. package/dist/component/time-input-rac-iL1G8Uwo.js +212 -0
  102. package/dist/component/to-native-time-Co_gOLkc.js +9 -0
  103. package/dist/component/{url-input-field-rac-C1JL_m6D.js → url-input-field-rac-1P81rK_4.js} +5 -5
  104. package/dist/component/{url-input-rac-C1CiGrCn.js → url-input-rac-D9c0BJKG.js} +1 -1
  105. package/dist/component/{use-dropdown-option-class-name-COGEk5d6.js → use-dropdown-option-class-name-CyC7rDCE.js} +3 -3
  106. package/dist/component/use-dropdown-trigger-class-name-BvRCjLXG.js +137 -0
  107. package/dist/component/{use-element-state-class-name-pSOX0Y0p.js → use-element-state-class-name-Cpdx_lRm.js} +1 -1
  108. package/dist/component/{use-hoverable-input-class-name-DGEpOAdi.js → use-hoverable-input-class-name-zEk2Vnct.js} +3 -3
  109. package/dist/component/{use-is-forced-open-dropdown-DPG1e5E9.js → use-is-forced-open-dropdown-_YI6RNG3.js} +1 -1
  110. package/dist/component/use-native-mobile-input-Czyhb-0V.js +31 -0
  111. package/dist/component/use-native-state-class-name-B0m2ghbS.js +18 -0
  112. package/dist/component/{use-service-options-base-BgIZ94V9.js → use-service-options-base-CbFG_r1u.js} +1 -1
  113. package/dist/component/use-text-input-class-name-CL-b4_Ph.js +6 -0
  114. package/package.json +3 -2
  115. package/dist/component/date-input-field-rac-CiAaOiYY.js +0 -309
  116. package/dist/component/date-picker-field-rac-Dg-chlTL.js +0 -320
  117. package/dist/component/date-time-input-field-rac-CbDvEPIp.js +0 -441
  118. package/dist/component/dropdown-field-rac-DY3GGJgP.js +0 -36
  119. package/dist/component/field-rac.module-DcyJyi2B.js +0 -25
  120. package/dist/component/multiline-address-field-rac-CgH7lDce.js +0 -1738
  121. package/dist/component/phone-input-field-rac-CsJGw_OE.js +0 -520
  122. package/dist/component/service-dropdown-rac-BSXYuBPJ.js +0 -145
  123. package/dist/component/time-input-rac-DuQar6zW.js +0 -161
  124. package/dist/component/use-dropdown-trigger-class-name-D6c-3Lyw.js +0 -98
  125. package/dist/component/use-text-input-class-name-BcbHdFV-.js +0 -6
@@ -0,0 +1,1818 @@
1
+ import { RicosViewer as ee } from "@wix/ricos/viewer";
2
+ import L from "classnames";
3
+ import n, { useMemo as x, createContext as Ye, useContext as Ne, useState as fe, useRef as B, useCallback as A, useEffect as Te } from "react";
4
+ import { bI as He, d as je, bD as Wt, bF as Ot, bf as Kt, bg as Yt, b8 as Ht, be as X, F as z, bY as Me, bv as pt, bN as _, bK as P, bP as G, bW as ye, bJ as gt, bk as jt, C as Oe, bt as Jt, bx as Xt, bU as Qt, bO as zt, bT as Gt, bB as Zt, bA as en, bp as tn, bz as nn, bQ as rn, aP as sn, Y as on, _ as te, am as ne, $ as Se, M as re, I as se, Z as Et, a0 as an, a1 as ln } from "./form-Dnq7LxSl.js";
5
+ import { mergeProps as ht, UNSAFE_PortalProvider as cn } from "react-aria";
6
+ import { f as b, a as F } from "./find-child-C60k4CxG.js";
7
+ import { F as dn, V as un } from "./headless-styles-CmcyA_pi.js";
8
+ import { c as mn } from "./use-is-forced-open-dropdown-_YI6RNG3.js";
9
+ import { TextField as Ce, Input as de, ComboBoxStateContext as Je, ComboBox as Fe, Popover as De, ListBox as we, ListBoxItem as Ae, Group as Ft, Button as Dt } from "react-aria-components";
10
+ import { D as ue, E as me } from "./field-error-headless-BIzDViIC.js";
11
+ import { L as pe } from "./field-label-headless-D_ubs4wp.js";
12
+ import { e as pn, c as En, a as bn, r as At } from "./isObjectLike-DoUrU0Hj.js";
13
+ import { u as _t, N as Rt } from "./use-native-mobile-input-Czyhb-0V.js";
14
+ import { N as Pt } from "./native-select-BbxBpe3S.js";
15
+ import { u as Tt } from "./use-native-state-class-name-B0m2ghbS.js";
16
+ import { V as fn, a as yn } from "./use-dropdown-option-class-name-CyC7rDCE.js";
17
+ import { u as Cn } from "./use-invoke-callback-UH73A_J3.js";
18
+ import { C as Re } from "./chevron-down-icon-CcpVm6B-.js";
19
+ import { E as oe } from "./error-icon-hZxQ6DEy.js";
20
+ import { H as Be } from "./custom-focus-class-_483Pkwp.js";
21
+ import { s as I } from "./field-rac.module-D0QzJXUv.js";
22
+ import { u as qe } from "./use-hoverable-input-class-name-zEk2Vnct.js";
23
+ const In = (e, t, r) => {
24
+ var o, a, i, l;
25
+ const s = (o = e.steps) == null ? void 0 : o.map((d) => {
26
+ var m, u, y, C, p, E;
27
+ return {
28
+ ...d,
29
+ layout: {
30
+ ...d.layout,
31
+ large: {
32
+ ...(m = d.layout) == null ? void 0 : m.large,
33
+ items: ((C = (y = (u = d.layout) == null ? void 0 : u.large) == null ? void 0 : y.items) == null ? void 0 : C.map((f) => ({
34
+ ...f,
35
+ row: r.row <= f.row ? (f.row || 0) + 1 : f.row
36
+ }))) || ((E = (p = d.layout) == null ? void 0 : p.large) == null ? void 0 : E.items)
37
+ }
38
+ }
39
+ };
40
+ });
41
+ return (l = (i = (a = s == null ? void 0 : s[0].layout) == null ? void 0 : a.large) == null ? void 0 : i.items) == null || l.unshift(r), {
42
+ ...e,
43
+ fields: [
44
+ t,
45
+ ...e.fields || []
46
+ ],
47
+ steps: s || e.steps
48
+ };
49
+ };
50
+ var Ie = /* @__PURE__ */ (function(e) {
51
+ return e.COUNTRY = "country", e.SUBDIVISION = "subdivision", e.CITY = "city", e.ADDRESS_LINE = "addressLine", e.ADDRESS_LINE_2 = "addressLine2", e.POSTAL_CODE = "postalCode", e.STREET_NAME = "streetName", e.STREET_NUMBER = "streetNumber", e.APARTMENT = "apartment", e;
52
+ })({});
53
+ function Nn(e, t, r = !1) {
54
+ const { country: s, subdivision: o, city: a, addressLine: i, streetAddress: l, addressLine2: d, postalCode: m } = e, u = {};
55
+ return t ? (s && (u.country = s), o && (u.subdivision = o), a && (u.city = a), i ? u.addressLine = i : l != null && l.formattedAddressLine && (u.addressLine = l == null ? void 0 : l.formattedAddressLine), d && (u.addressLine = d), m && (u.postalCode = m), l != null && l.apt && (u.apartment = l == null ? void 0 : l.apt), l != null && l.name ? u.streetName = l == null ? void 0 : l.name : r && (l != null && l.formattedAddressLine) && (u.streetName = l == null ? void 0 : l.formattedAddressLine), l != null && l.number && (u.streetNumber = l.number)) : (s && (u.country = s), o && (u.subdivision = o), a && (u.city = a), i ? u.address_line = i : l != null && l.formattedAddressLine && (u.address_line = l == null ? void 0 : l.formattedAddressLine), d && (u.address_line = d), m && (u.postal_code = m), l != null && l.apt && (u.apartment = l == null ? void 0 : l.apt), l != null && l.name ? u.street_name = l == null ? void 0 : l.name : r && (l != null && l.formattedAddressLine) && (u.street_name = l == null ? void 0 : l.formattedAddressLine), l != null && l.number && (u.street_number = l.number)), u;
56
+ }
57
+ const Mt = /* @__PURE__ */ Ye({
58
+ onAddressSelect: () => {
59
+ }
60
+ }), Ln = ({ children: e, onAddressSelect: t, autocompleteEnabled: r }) => {
61
+ const s = x(() => ({
62
+ onAddressSelect: t,
63
+ autocompleteEnabled: r
64
+ }), [
65
+ t,
66
+ r
67
+ ]);
68
+ return /* @__PURE__ */ n.createElement(Mt.Provider, {
69
+ value: s
70
+ }, e);
71
+ };
72
+ function Le() {
73
+ return Ne(Mt);
74
+ }
75
+ const wt = /* @__PURE__ */ Ye(void 0), vn = ({ children: e, countryCode: t }) => {
76
+ const r = x(() => ({
77
+ countryCode: t
78
+ }), [
79
+ t
80
+ ]);
81
+ return /* @__PURE__ */ n.createElement(wt.Provider, {
82
+ value: r
83
+ }, e);
84
+ };
85
+ function ve() {
86
+ const e = Ne(wt);
87
+ return e == null ? void 0 : e.countryCode;
88
+ }
89
+ function xe(e) {
90
+ return e != null;
91
+ }
92
+ function Sn(e, t, r) {
93
+ return !t || !r ? e : {
94
+ ...e,
95
+ fields: (e.fields ?? []).map((s) => {
96
+ const { show: o, ...a } = t[s.target] || {}, { required: i } = r[s.target] || {};
97
+ return {
98
+ ...s,
99
+ view: {
100
+ ...s.view,
101
+ ...a
102
+ },
103
+ ...xe(o) && {
104
+ hidden: !o
105
+ },
106
+ ...xe(i) && xe(s.validation) && {
107
+ validation: {
108
+ ...s.validation,
109
+ required: i
110
+ }
111
+ }
112
+ };
113
+ })
114
+ };
115
+ }
116
+ const On = (e, t) => e.map((r) => ({
117
+ ...r,
118
+ id: ("target" in r ? t[r.target] : void 0) ?? r.id
119
+ })), Bt = 12, gn = (e) => {
120
+ const t = e.filter((s) => !s.properties.hidden), r = e.filter((s) => s.properties.hidden);
121
+ return {
122
+ visibleFields: t,
123
+ hiddenFields: r
124
+ };
125
+ }, hn = (e) => {
126
+ const t = {};
127
+ return e.forEach((r) => {
128
+ const s = r.layout.row;
129
+ t[s] || (t[s] = []), t[s].push(r);
130
+ }), t;
131
+ }, Fn = (e) => {
132
+ const t = {};
133
+ return Object.keys(e).forEach((r) => {
134
+ const s = parseInt(r, 10), o = e[s];
135
+ o.reduce((i, l) => i + l.layout.width, 0) !== Bt && (t[s] = o);
136
+ }), t;
137
+ }, Dn = (e, t) => e.map((r) => {
138
+ const s = r.layout.row;
139
+ if (t[s] && !r.properties.hidden) {
140
+ const o = t[s], a = o.length, i = Bt / a, l = o.findIndex((m) => m.id === r.id), d = i * l;
141
+ return {
142
+ ...r,
143
+ layout: {
144
+ ...r.layout,
145
+ width: i,
146
+ column: d
147
+ }
148
+ };
149
+ }
150
+ return r;
151
+ }), An = (e, t, r) => {
152
+ const s = Math.max(...t.map((o) => o.layout.row), -1);
153
+ return e.map((o) => {
154
+ if (o.properties.hidden) {
155
+ const a = r.findIndex((i) => i.id === o.id);
156
+ return {
157
+ ...o,
158
+ layout: {
159
+ ...o.layout,
160
+ row: s + 1 + a
161
+ }
162
+ };
163
+ }
164
+ return o;
165
+ });
166
+ }, _n = (e) => {
167
+ const { visibleFields: t, hiddenFields: r } = gn(e.fields), s = hn(t), o = Fn(s), a = Dn(e.fields, o), i = An(a, t, r);
168
+ return {
169
+ ...e,
170
+ fields: i
171
+ };
172
+ }, Rn = () => ({
173
+ country: X(),
174
+ subdivision: X(),
175
+ city: X(),
176
+ address_line: X(),
177
+ address_line_2: X(),
178
+ postal_code: X(),
179
+ street_name: X(),
180
+ street_number: X(),
181
+ apartment: X()
182
+ }), Pn = ({ id: e, target: t, fieldType: r, form: s, country: o, fieldSettings: a, validation: i, required: l }) => {
183
+ const [d] = fe(Rn), { isExperimentEnabled: m } = He(), u = m(je.USE_FIELDS_V2), { getCountryAddressForm: y } = Wt(), { isMobile: C, breakpoint: p } = Ot(), E = y(o), f = r === z.MULTILINE_ADDRESS || r === z.BOOKINGS_ADDRESS, N = x(() => {
184
+ var S;
185
+ return Kt(l, (S = i == null ? void 0 : i.predefined) == null ? void 0 : S.multilineAddressOptions);
186
+ }, [
187
+ i,
188
+ l
189
+ ]), v = x(() => Yt(), []);
190
+ return {
191
+ form: x(() => {
192
+ var T, O;
193
+ if (!f || !E)
194
+ return s && {
195
+ ...s,
196
+ fields: On(s.fields, d)
197
+ };
198
+ const S = Ht({
199
+ useFieldsV2: u,
200
+ path: t,
201
+ parentId: e,
202
+ includeHiddenFields: !0,
203
+ isMobile: C,
204
+ breakpoint: p,
205
+ form: Sn(In(E, N, v), a, (O = (T = i == null ? void 0 : i.predefined) == null ? void 0 : T.multilineAddressOptions) == null ? void 0 : O.fields)
206
+ });
207
+ if (!S.fields.some((D) => D.properties.hidden))
208
+ return S;
209
+ const M = _n(S);
210
+ return {
211
+ ...M,
212
+ fields: M.fields.filter((D) => !D.properties.hidden)
213
+ };
214
+ }, [
215
+ E,
216
+ s,
217
+ d,
218
+ a,
219
+ i,
220
+ t,
221
+ N,
222
+ v,
223
+ f,
224
+ u,
225
+ e,
226
+ C,
227
+ p
228
+ ]),
229
+ isMultilineAddressField: f
230
+ };
231
+ }, qt = /* @__PURE__ */ Ye(void 0), Tn = ({ children: e, fields: t }) => {
232
+ const r = x(() => ({
233
+ fields: t
234
+ }), [
235
+ t
236
+ ]);
237
+ return /* @__PURE__ */ n.createElement(qt.Provider, {
238
+ value: r
239
+ }, e);
240
+ };
241
+ function Ee(e) {
242
+ const t = Ne(qt);
243
+ if (!t)
244
+ throw new Error("useAddressFields must be used within AddressFieldsProvider");
245
+ return t.fields[e];
246
+ }
247
+ function be(e) {
248
+ const { t } = Me(), r = ve(), s = r && pt.getCountryByShortKey(r), a = (s ? s.addressPartDisplayNames : pt.getDefaultAddressDisplayNames())[e];
249
+ return a ? t(a) : "";
250
+ }
251
+ const ae = ({ children: e }) => {
252
+ const { id: t, value: r, onChange: s, disabled: o, readOnly: a, required: i, hasError: l, onBlur: d, onFocus: m, FieldLayout: u } = _(), { labelId: y } = P(), C = be("addressLine2"), p = b(e, ae.Label), E = b(e, ae.Input), f = b(e, ae.Description), N = b(e, ae.Error);
253
+ return /* @__PURE__ */ n.createElement(u, {
254
+ fieldId: t,
255
+ renderLabel: () => F(p, {
256
+ label: C
257
+ }),
258
+ renderInput: () => /* @__PURE__ */ n.createElement(Ce, {
259
+ "aria-labelledby": y,
260
+ value: r ?? "",
261
+ onChange: s,
262
+ isDisabled: o,
263
+ isReadOnly: a,
264
+ isRequired: i,
265
+ isInvalid: l,
266
+ onBlur: d,
267
+ onFocus: m
268
+ }, E),
269
+ renderDescription: () => /* @__PURE__ */ n.createElement(n.Fragment, null, N, f)
270
+ });
271
+ }, Mn = ({ className: e }) => {
272
+ const { id: t, placeholder: r } = _(), { inputId: s, ariaDescribedBy: o } = P(), a = B(null);
273
+ return G(() => {
274
+ var i;
275
+ (i = a.current) == null || i.focus({
276
+ preventScroll: !0
277
+ });
278
+ }, t), ye(a), /* @__PURE__ */ n.createElement(de, {
279
+ ref: a,
280
+ id: s,
281
+ autoComplete: "address-line2",
282
+ "aria-describedby": o,
283
+ className: e,
284
+ placeholder: r
285
+ });
286
+ };
287
+ ae.Label = pe;
288
+ ae.Input = Mn;
289
+ ae.Description = ue;
290
+ ae.Error = me;
291
+ const wn = "route", Bn = (e) => {
292
+ var t;
293
+ return ((t = e.types) == null ? void 0 : t.includes(wn)) ?? !1;
294
+ }, qn = /[\s,]+/, bt = (e) => e ? e.toLowerCase().split(qn) : [], xt = (e, t, r) => {
295
+ if (!e || !t)
296
+ return !1;
297
+ const s = bt(r);
298
+ return bt(e).filter((o) => !s.includes(o)).includes(t.toLowerCase());
299
+ }, ft = (e) => e.split("-")[0], xn = (e, t) => !e.postalCode || !t.postalCode || ft(e.postalCode) === ft(t.postalCode), kn = (e, t) => {
300
+ var r, s, o, a, i;
301
+ return !!((r = e.streetAddress) != null && r.name) && ((o = (s = e.streetAddress) == null ? void 0 : s.name) == null ? void 0 : o.toLowerCase()) === ((i = (a = t.streetAddress) == null ? void 0 : a.name) == null ? void 0 : i.toLowerCase());
302
+ }, Un = (e, t) => t.country === e.country && t.subdivision === e.subdivision && xn(e, t) && kn(e, t), $n = async (e, t, r) => {
303
+ var s, o;
304
+ try {
305
+ const a = await r({
306
+ query: e,
307
+ countryCode: t.country ?? void 0
308
+ });
309
+ return (o = (s = a == null ? void 0 : a.find((i) => {
310
+ var l, d;
311
+ return Un(t, i) && xt(e, (l = i.streetAddress) == null ? void 0 : l.number, (d = t.streetAddress) == null ? void 0 : d.name);
312
+ })) == null ? void 0 : s.streetAddress) == null ? void 0 : o.number;
313
+ } catch {
314
+ return;
315
+ }
316
+ }, Vn = (e, t, r) => {
317
+ const s = {
318
+ ...e.streetAddress,
319
+ number: t
320
+ };
321
+ return xt(r, t) ? {
322
+ ...e,
323
+ ...e.addressLine ? {
324
+ addressLine: r
325
+ } : {},
326
+ streetAddress: {
327
+ ...s,
328
+ formattedAddressLine: r
329
+ }
330
+ } : {
331
+ ...e,
332
+ streetAddress: s
333
+ };
334
+ }, Wn = async ({ searchId: e, prediction: t, getPlace: r, searchByQuery: s }) => {
335
+ var i, l;
336
+ const o = await r({
337
+ searchId: e
338
+ });
339
+ if (!o || (i = o.streetAddress) != null && i.number || !(t != null && t.description) || !Bn(t) || !s)
340
+ return o;
341
+ const a = await $n(t.description, o, s);
342
+ return a ? Vn(o, a, (l = t.textStructure) == null ? void 0 : l.mainText) : o;
343
+ }, Xe = ({ enabled: e }) => {
344
+ const { actions: t } = gt(), { isExperimentEnabled: r } = He(), s = r(je.ADDRESS_HOUSE_NUMBER_FALLBACK), [o, a] = fe(X()), i = A(() => a(X()), []), l = B(0);
345
+ return x(() => {
346
+ const { predict: d, getPlace: m, searchByPostalCode: u, searchByQuery: y } = t ?? {};
347
+ if (!e || !d || !m || !u)
348
+ return;
349
+ const C = (p) => m({
350
+ ...p,
351
+ sessionToken: o,
352
+ refreshSessionToken: i
353
+ });
354
+ return {
355
+ predict: (p) => d({
356
+ ...p,
357
+ sessionToken: o
358
+ }),
359
+ getPlace: C,
360
+ searchByPostalCode: (p) => u({
361
+ ...p,
362
+ sessionToken: o
363
+ }),
364
+ resolvePlace: async (p) => {
365
+ const E = ++l.current, f = await Wn({
366
+ ...p,
367
+ getPlace: C,
368
+ searchByQuery: s ? y : void 0
369
+ });
370
+ return E === l.current ? f : void 0;
371
+ }
372
+ };
373
+ }, [
374
+ e,
375
+ t,
376
+ o,
377
+ i,
378
+ s
379
+ ]);
380
+ };
381
+ var ke, yt;
382
+ function Kn() {
383
+ if (yt) return ke;
384
+ yt = 1;
385
+ var e = pn(), t = function() {
386
+ return e.Date.now();
387
+ };
388
+ return ke = t, ke;
389
+ }
390
+ var Ue, Ct;
391
+ function Yn() {
392
+ if (Ct) return Ue;
393
+ Ct = 1;
394
+ var e = /\s/;
395
+ function t(r) {
396
+ for (var s = r.length; s-- && e.test(r.charAt(s)); )
397
+ ;
398
+ return s;
399
+ }
400
+ return Ue = t, Ue;
401
+ }
402
+ var $e, It;
403
+ function Hn() {
404
+ if (It) return $e;
405
+ It = 1;
406
+ var e = Yn(), t = /^\s+/;
407
+ function r(s) {
408
+ return s && s.slice(0, e(s) + 1).replace(t, "");
409
+ }
410
+ return $e = r, $e;
411
+ }
412
+ var Ve, Nt;
413
+ function jn() {
414
+ if (Nt) return Ve;
415
+ Nt = 1;
416
+ var e = En(), t = bn(), r = "[object Symbol]";
417
+ function s(o) {
418
+ return typeof o == "symbol" || t(o) && e(o) == r;
419
+ }
420
+ return Ve = s, Ve;
421
+ }
422
+ var We, Lt;
423
+ function Jn() {
424
+ if (Lt) return We;
425
+ Lt = 1;
426
+ var e = Hn(), t = At(), r = jn(), s = NaN, o = /^[-+]0x[0-9a-f]+$/i, a = /^0b[01]+$/i, i = /^0o[0-7]+$/i, l = parseInt;
427
+ function d(m) {
428
+ if (typeof m == "number")
429
+ return m;
430
+ if (r(m))
431
+ return s;
432
+ if (t(m)) {
433
+ var u = typeof m.valueOf == "function" ? m.valueOf() : m;
434
+ m = t(u) ? u + "" : u;
435
+ }
436
+ if (typeof m != "string")
437
+ return m === 0 ? m : +m;
438
+ m = e(m);
439
+ var y = a.test(m);
440
+ return y || i.test(m) ? l(m.slice(2), y ? 2 : 8) : o.test(m) ? s : +m;
441
+ }
442
+ return We = d, We;
443
+ }
444
+ var Ke, vt;
445
+ function Xn() {
446
+ if (vt) return Ke;
447
+ vt = 1;
448
+ var e = At(), t = Kn(), r = Jn(), s = "Expected a function", o = Math.max, a = Math.min;
449
+ function i(l, d, m) {
450
+ var u, y, C, p, E, f, N = 0, v = !1, h = !1, S = !0;
451
+ if (typeof l != "function")
452
+ throw new TypeError(s);
453
+ d = r(d) || 0, e(m) && (v = !!m.leading, h = "maxWait" in m, C = h ? o(r(m.maxWait) || 0, d) : C, S = "trailing" in m ? !!m.trailing : S);
454
+ function g(R) {
455
+ var k = u, w = y;
456
+ return u = y = void 0, N = R, p = l.apply(w, k), p;
457
+ }
458
+ function M(R) {
459
+ return N = R, E = setTimeout(D, d), v ? g(R) : p;
460
+ }
461
+ function T(R) {
462
+ var k = R - f, w = R - N, V = d - k;
463
+ return h ? a(V, C - w) : V;
464
+ }
465
+ function O(R) {
466
+ var k = R - f, w = R - N;
467
+ return f === void 0 || k >= d || k < 0 || h && w >= C;
468
+ }
469
+ function D() {
470
+ var R = t();
471
+ if (O(R))
472
+ return q(R);
473
+ E = setTimeout(D, T(R));
474
+ }
475
+ function q(R) {
476
+ return E = void 0, S && u ? g(R) : (u = y = void 0, p);
477
+ }
478
+ function Q() {
479
+ E !== void 0 && clearTimeout(E), N = 0, u = f = y = E = void 0;
480
+ }
481
+ function Z() {
482
+ return E === void 0 ? p : q(t());
483
+ }
484
+ function U() {
485
+ var R = t(), k = O(R);
486
+ if (u = arguments, y = this, f = R, k) {
487
+ if (E === void 0)
488
+ return M(f);
489
+ if (h)
490
+ return clearTimeout(E), E = setTimeout(D, d), g(f);
491
+ }
492
+ return E === void 0 && (E = setTimeout(D, d)), p;
493
+ }
494
+ return U.cancel = Q, U.flush = Z, U;
495
+ }
496
+ return Ke = i, Ke;
497
+ }
498
+ var Qn = Xn();
499
+ const zn = /* @__PURE__ */ jt(Qn), Gn = (e, t, r = 200) => {
500
+ const s = B(e), o = A(zn((...a) => {
501
+ s.current(...a);
502
+ }, r), [
503
+ r
504
+ ]);
505
+ return Te(() => {
506
+ s.current = e;
507
+ }, [
508
+ e,
509
+ t
510
+ ]), o;
511
+ }, Zn = () => {
512
+ const e = B(!0);
513
+ return Te(() => () => {
514
+ e.current = !1;
515
+ }, []), () => e.current;
516
+ }, St = {
517
+ loading: !1,
518
+ predictions: []
519
+ }, kt = ({ atlas: e, onError: t }) => {
520
+ const [{ loading: s, predictions: o }, a] = fe(St), i = B(0), l = Zn(), d = A(() => {
521
+ i.current++, a(St);
522
+ }, []), m = Gn(async ({ input: u, countryCodes: y }) => {
523
+ if (!e || !l())
524
+ return;
525
+ if (!u) {
526
+ d();
527
+ return;
528
+ }
529
+ const C = ++i.current;
530
+ a((E) => ({
531
+ ...E,
532
+ loading: !0
533
+ }));
534
+ let p;
535
+ try {
536
+ p = await e.predict({
537
+ input: u,
538
+ countryCodes: y
539
+ });
540
+ } catch (E) {
541
+ t ? t(E) : console.error(E);
542
+ } finally {
543
+ const E = C === i.current;
544
+ l() && E && a((f) => ({
545
+ loading: !1,
546
+ // set new predictions if fetched properly, else keep current predictions
547
+ predictions: p || f.predictions
548
+ }));
549
+ }
550
+ }, [
551
+ e,
552
+ t
553
+ ], 200);
554
+ return {
555
+ predictions: o,
556
+ loading: s,
557
+ updatePredictions: m,
558
+ clearPredictions: d
559
+ };
560
+ }, Qe = ({ optionCount: e }) => {
561
+ const t = Ne(Je), r = B(t);
562
+ r.current = t;
563
+ const s = B(e);
564
+ return Te(() => {
565
+ const o = e > 0 && s.current === 0;
566
+ s.current = e;
567
+ const a = r.current;
568
+ o && (a != null && a.isFocused) && !a.isOpen && a.open(null, "manual");
569
+ }, [
570
+ e
571
+ ]), null;
572
+ }, H = ({ children: e }) => {
573
+ const { id: t, value: r, onChange: s, disabled: o, readOnly: a, required: i, hasError: l, onBlur: d, onFocus: m, FieldLayout: u, autocomplete: y } = _(), { labelId: C } = P(), { autocompleteEnabled: p } = Le(), E = y || p, f = be("addressLine1"), N = b(e, H.Label), v = b(e, H.Input), h = b(e, H.Options), S = b(e, H.Description), g = b(e, H.Error);
574
+ return E ? /* @__PURE__ */ n.createElement(u, {
575
+ fieldId: t,
576
+ renderLabel: () => F(N, {
577
+ label: f
578
+ }),
579
+ renderInput: () => /* @__PURE__ */ n.createElement(er, {
580
+ value: r,
581
+ onChange: s,
582
+ disabled: o,
583
+ readOnly: a,
584
+ required: i,
585
+ hasError: l,
586
+ onBlur: d,
587
+ onFocus: m
588
+ }, v, h),
589
+ renderDescription: () => /* @__PURE__ */ n.createElement(n.Fragment, null, g, S)
590
+ }) : /* @__PURE__ */ n.createElement(u, {
591
+ fieldId: t,
592
+ renderLabel: () => F(N, {
593
+ label: f
594
+ }),
595
+ renderInput: () => /* @__PURE__ */ n.createElement(Ce, {
596
+ "aria-labelledby": C,
597
+ value: r ?? "",
598
+ onChange: s,
599
+ isDisabled: o,
600
+ isReadOnly: a,
601
+ isRequired: i,
602
+ isInvalid: l,
603
+ onBlur: d,
604
+ onFocus: m
605
+ }, v),
606
+ renderDescription: () => /* @__PURE__ */ n.createElement(n.Fragment, null, g, S)
607
+ });
608
+ }, er = ({ children: e, value: t, onChange: r, disabled: s, readOnly: o, required: a, hasError: i, onBlur: l, onFocus: d }) => {
609
+ const { labelId: m } = P(), { onAddressSelect: u } = Le(), y = ve(), C = Xe({
610
+ enabled: !0
611
+ }), { predictions: p, updatePredictions: E, clearPredictions: f } = kt({
612
+ atlas: C
613
+ }), N = x(() => p.map((O) => ({
614
+ id: O.searchId || "",
615
+ label: O.description || ""
616
+ })), [
617
+ p
618
+ ]), v = A((O) => {
619
+ E({
620
+ input: O,
621
+ countryCodes: y ? [
622
+ y
623
+ ] : void 0
624
+ }), r(O);
625
+ }, [
626
+ r,
627
+ E,
628
+ y
629
+ ]), h = A(async (O) => {
630
+ if (!O)
631
+ return;
632
+ f();
633
+ const D = String(O), q = await (C == null ? void 0 : C.resolvePlace({
634
+ searchId: D,
635
+ prediction: p.find((Q) => Q.searchId === D)
636
+ }));
637
+ q && u && u(q);
638
+ }, [
639
+ u,
640
+ f,
641
+ C,
642
+ p
643
+ ]), S = A(() => {
644
+ f(), l == null || l();
645
+ }, [
646
+ l,
647
+ f
648
+ ]), g = A(() => {
649
+ d == null || d();
650
+ }, [
651
+ d
652
+ ]), M = b(e, H.Input), T = b(e, H.Options);
653
+ return /* @__PURE__ */ n.createElement(Fe, {
654
+ "aria-labelledby": m,
655
+ inputValue: t ?? "",
656
+ onInputChange: v,
657
+ value: null,
658
+ onChange: h,
659
+ isDisabled: s,
660
+ isReadOnly: o,
661
+ isRequired: a,
662
+ isInvalid: i,
663
+ onBlur: S,
664
+ onFocus: g,
665
+ allowsCustomValue: !0,
666
+ menuTrigger: "input",
667
+ items: N
668
+ }, F(M, {
669
+ onFocus: g
670
+ }), F(T, {
671
+ options: N
672
+ }), /* @__PURE__ */ n.createElement(Qe, {
673
+ optionCount: N.length
674
+ }));
675
+ }, tr = ({ className: e, ...t }) => {
676
+ const { id: r, placeholder: s } = _(), { inputId: o, ariaDescribedBy: a } = P(), { onFocus: i } = t, l = B(null);
677
+ return G(() => {
678
+ var d;
679
+ (d = l.current) == null || d.focus({
680
+ preventScroll: !0
681
+ });
682
+ }, r), ye(l), /* @__PURE__ */ n.createElement(de, {
683
+ ref: l,
684
+ id: o,
685
+ autoComplete: "address-line1",
686
+ "aria-describedby": a,
687
+ className: e,
688
+ placeholder: s,
689
+ onFocus: i
690
+ });
691
+ }, ze = ({ children: e, className: t }) => {
692
+ const r = b(e, ze.Option);
693
+ return /* @__PURE__ */ n.createElement(De, {
694
+ className: t,
695
+ containerPadding: 0,
696
+ offset: 0
697
+ }, /* @__PURE__ */ n.createElement(we, {
698
+ renderEmptyState: () => null
699
+ }, (s) => F(r, {
700
+ id: s.id,
701
+ label: s.label
702
+ })));
703
+ }, nr = ({ className: e, ...t }) => {
704
+ const { id: r, label: s } = t;
705
+ return /* @__PURE__ */ n.createElement(Ae, {
706
+ className: e,
707
+ id: r,
708
+ textValue: s
709
+ }, s);
710
+ };
711
+ ze.Option = nr;
712
+ H.Label = pe;
713
+ H.Input = tr;
714
+ H.Options = ze;
715
+ H.Description = ue;
716
+ H.Error = me;
717
+ const le = ({ children: e }) => {
718
+ const { id: t, value: r, onChange: s, disabled: o, readOnly: a, required: i, hasError: l, onBlur: d, onFocus: m, FieldLayout: u } = _(), { labelId: y } = P(), { t: C } = Me(), p = C("field.mla-apartment.label"), E = b(e, le.Label), f = b(e, le.Input), N = b(e, le.Description), v = b(e, le.Error);
719
+ return /* @__PURE__ */ n.createElement(u, {
720
+ fieldId: t,
721
+ renderLabel: () => F(E, {
722
+ label: p
723
+ }),
724
+ renderInput: () => /* @__PURE__ */ n.createElement(Ce, {
725
+ "aria-labelledby": y,
726
+ value: r ?? "",
727
+ onChange: s,
728
+ isDisabled: o,
729
+ isReadOnly: a,
730
+ isRequired: i,
731
+ isInvalid: l,
732
+ onBlur: d,
733
+ onFocus: m
734
+ }, f),
735
+ renderDescription: () => /* @__PURE__ */ n.createElement(n.Fragment, null, v, N)
736
+ });
737
+ }, rr = ({ className: e }) => {
738
+ const { id: t, placeholder: r } = _(), { inputId: s, ariaDescribedBy: o } = P(), a = B(null);
739
+ return G(() => {
740
+ var i;
741
+ (i = a.current) == null || i.focus({
742
+ preventScroll: !0
743
+ });
744
+ }, t), ye(a), /* @__PURE__ */ n.createElement(de, {
745
+ ref: a,
746
+ id: s,
747
+ autoComplete: "address-line2",
748
+ "aria-describedby": o,
749
+ className: e,
750
+ placeholder: r
751
+ });
752
+ };
753
+ le.Label = pe;
754
+ le.Input = rr;
755
+ le.Description = ue;
756
+ le.Error = me;
757
+ const ie = ({ children: e }) => {
758
+ const { id: t, value: r, onChange: s, disabled: o, readOnly: a, required: i, hasError: l, onBlur: d, onFocus: m, FieldLayout: u } = _(), { labelId: y } = P(), C = be("city"), p = b(e, ie.Label), E = b(e, ie.Input), f = b(e, ie.Description), N = b(e, ie.Error);
759
+ return /* @__PURE__ */ n.createElement(u, {
760
+ fieldId: t,
761
+ renderLabel: () => F(p, {
762
+ label: C
763
+ }),
764
+ renderInput: () => /* @__PURE__ */ n.createElement(Ce, {
765
+ "aria-labelledby": y,
766
+ value: r ?? "",
767
+ onChange: s,
768
+ isDisabled: o,
769
+ isReadOnly: a,
770
+ isRequired: i,
771
+ isInvalid: l,
772
+ onBlur: d,
773
+ onFocus: m
774
+ }, E),
775
+ renderDescription: () => /* @__PURE__ */ n.createElement(n.Fragment, null, N, f)
776
+ });
777
+ }, sr = ({ className: e }) => {
778
+ const { id: t, placeholder: r } = _(), { inputId: s, ariaDescribedBy: o } = P(), a = B(null);
779
+ return G(() => {
780
+ var i;
781
+ (i = a.current) == null || i.focus({
782
+ preventScroll: !0
783
+ });
784
+ }, t), ye(a), /* @__PURE__ */ n.createElement(de, {
785
+ ref: a,
786
+ id: s,
787
+ autoComplete: "address-level2",
788
+ "aria-describedby": o,
789
+ className: e,
790
+ placeholder: r
791
+ });
792
+ };
793
+ ie.Label = pe;
794
+ ie.Input = sr;
795
+ ie.Description = ue;
796
+ ie.Error = me;
797
+ const or = ({ isOpen: e }) => {
798
+ const t = Ne(Je), r = B(!1);
799
+ return Te(() => {
800
+ e && t && !t.isOpen && t.open(null, "manual"), e && (t == null ? void 0 : t.selectionManager.focusedKey) != null && t.selectionManager.setFocusedKey(null), !e && r.current && (t == null || t.close()), r.current = e;
801
+ }, [
802
+ e,
803
+ t
804
+ ]), null;
805
+ }, Ut = ({ readOnly: e, disabled: t } = {}) => {
806
+ const r = Ne(Je);
807
+ return A(() => {
808
+ !r || r.isOpen || e || t || r.open(null, "manual");
809
+ }, [
810
+ r,
811
+ e,
812
+ t
813
+ ]);
814
+ }, ar = (e, t) => e.find((r) => r.label.toLocaleLowerCase() === t.toLocaleLowerCase().trim()), $t = ({ options: e, value: t, commit: r, clear: s, onBlur: o }) => {
815
+ const [a, i] = fe(null), l = Cn(o), d = x(() => {
816
+ var p;
817
+ return t ? ((p = e.find((E) => E.value === t)) == null ? void 0 : p.label) ?? "" : "";
818
+ }, [
819
+ t,
820
+ e
821
+ ]), m = A((p) => {
822
+ typeof p != "string" || p === "" || p === t || (i(null), r(p));
823
+ }, [
824
+ r,
825
+ t
826
+ ]), u = A((p) => {
827
+ if (i(p), p === "")
828
+ return;
829
+ const E = ar(e, p);
830
+ E && E.value !== t && r(E.value);
831
+ }, [
832
+ r,
833
+ e,
834
+ t
835
+ ]), y = A((p) => {
836
+ p.key !== "Enter" && p.key !== "Escape" || (i(null), p.key === "Enter" && a === "" && t && s());
837
+ }, [
838
+ a,
839
+ t,
840
+ s
841
+ ]), C = A(() => {
842
+ a === "" && t && s(), i(null), l();
843
+ }, [
844
+ a,
845
+ t,
846
+ s,
847
+ l
848
+ ]);
849
+ return {
850
+ value: t ?? null,
851
+ inputValue: a ?? d,
852
+ onChange: m,
853
+ onInputChange: u,
854
+ onBlur: C,
855
+ onInputKeyDown: y
856
+ };
857
+ }, K = ({ children: e, ...t }) => {
858
+ const { isForcedOpen: r = !1 } = t, { id: s, value: o, onChange: a, disabled: i, readOnly: l, required: d, hasError: m, onBlur: u, onFocus: y, FieldLayout: C, options: p } = _(), { labelId: E } = P(), { t: f } = Me(), { language: N } = Ot(), v = x(() => (p || []).reduce((w, V) => (V.value && Oe.hasOwnProperty(V.value) && w.push({
859
+ value: V.value,
860
+ label: f(`locale-dataset.countries.${Oe[V.value].toUpperCase()}`)
861
+ }), w), []).sort((w, V) => w.label.localeCompare(V.label, N)), [
862
+ p,
863
+ f,
864
+ N
865
+ ]), h = A((w) => a(w), [
866
+ a
867
+ ]), S = A(() => h(""), [
868
+ h
869
+ ]), { onInputKeyDown: g, ...M } = $t({
870
+ options: v,
871
+ value: o,
872
+ commit: h,
873
+ clear: S,
874
+ onBlur: u
875
+ }), T = be("country"), O = b(e, K.Label), D = b(e, K.Control), q = b(e, K.Options), Q = b(e, K.Description), Z = b(e, K.Error), U = b(e, K.NativeSelect), k = _t() ? F(U, {
876
+ options: v
877
+ }) : /* @__PURE__ */ n.createElement(Fe, {
878
+ "aria-labelledby": E,
879
+ ...M,
880
+ isDisabled: i,
881
+ isReadOnly: l,
882
+ isRequired: d,
883
+ isInvalid: m,
884
+ onFocus: y,
885
+ menuTrigger: "input"
886
+ }, F(D, {
887
+ onKeyDown: g
888
+ }), F(q, {
889
+ options: v,
890
+ isForcedOpen: r
891
+ }), /* @__PURE__ */ n.createElement(or, {
892
+ isOpen: r
893
+ }));
894
+ return /* @__PURE__ */ n.createElement(C, {
895
+ fieldId: s,
896
+ renderLabel: () => F(O, {
897
+ label: T
898
+ }),
899
+ renderInput: () => k,
900
+ renderDescription: () => /* @__PURE__ */ n.createElement(n.Fragment, null, Z, Q)
901
+ });
902
+ }, ge = ({ children: e, className: t, ...r }) => {
903
+ const { disabled: s, hasError: o } = _(), { onKeyDown: a } = r, i = b(e, ge.Input), l = b(e, ge.Trigger);
904
+ return /* @__PURE__ */ n.createElement(Ft, {
905
+ className: t,
906
+ isDisabled: s,
907
+ isInvalid: o
908
+ }, F(i, {
909
+ onKeyDown: a
910
+ }), l);
911
+ }, lr = ({ className: e, ...t }) => {
912
+ const { id: r, placeholder: s, readOnly: o, disabled: a } = _(), { inputId: i, ariaDescribedBy: l } = P(), { onKeyDown: d } = t, m = B(null), u = Ut({
913
+ readOnly: o,
914
+ disabled: a
915
+ });
916
+ return G(() => {
917
+ var y;
918
+ (y = m.current) == null || y.focus({
919
+ preventScroll: !0
920
+ });
921
+ }, r), /* @__PURE__ */ n.createElement(de, {
922
+ ref: m,
923
+ id: i,
924
+ autoComplete: "country-name",
925
+ "aria-describedby": l,
926
+ className: e,
927
+ placeholder: s,
928
+ onClick: u,
929
+ onKeyDown: d
930
+ });
931
+ }, ir = ({ children: e, className: t }) => /* @__PURE__ */ n.createElement(Dt, {
932
+ className: t
933
+ }, e);
934
+ ge.Input = lr;
935
+ ge.Trigger = ir;
936
+ const Ge = ({ children: e, className: t, ...r }) => {
937
+ const { options: s, isForcedOpen: o } = r, a = b(e, Ge.Option);
938
+ return /* @__PURE__ */ n.createElement(De, {
939
+ className: t,
940
+ containerPadding: 0,
941
+ offset: 0
942
+ }, /* @__PURE__ */ n.createElement(fn, {
943
+ isForcedOpen: o
944
+ }, s.map((i) => F(a, {
945
+ key: i.value,
946
+ value: i.value,
947
+ label: i.label
948
+ }))));
949
+ }, cr = ({ className: e, ...t }) => {
950
+ const { value: r, label: s } = t;
951
+ return /* @__PURE__ */ n.createElement(Ae, {
952
+ className: e,
953
+ id: r,
954
+ textValue: s
955
+ }, s);
956
+ };
957
+ Ge.Option = cr;
958
+ const dr = ({ className: e, children: t, ...r }) => {
959
+ const { options: s } = r, { id: o, value: a, onChange: i, disabled: l, readOnly: d, required: m, hasError: u, placeholder: y, onBlur: C, onFocus: p } = _(), { inputId: E, labelId: f, ariaDescribedBy: N } = P(), v = B(null);
960
+ G(() => {
961
+ var g;
962
+ (g = v.current) == null || g.focus({
963
+ preventScroll: !0
964
+ });
965
+ }, o);
966
+ const { className: h, stateProps: S } = Tt(e);
967
+ return /* @__PURE__ */ n.createElement(Rt, null, /* @__PURE__ */ n.createElement(Pt, {
968
+ ref: v,
969
+ id: E,
970
+ className: h,
971
+ ...ht(S, {
972
+ onFocus: p,
973
+ onBlur: C
974
+ }),
975
+ "aria-labelledby": f,
976
+ "aria-describedby": N,
977
+ "aria-invalid": u || void 0,
978
+ autoComplete: "country",
979
+ value: a,
980
+ options: s,
981
+ placeholder: y,
982
+ onChange: (g) => i(g),
983
+ disabled: l,
984
+ readOnly: d,
985
+ required: m
986
+ }), t);
987
+ };
988
+ K.Label = pe;
989
+ K.NativeSelect = dr;
990
+ K.Control = ge;
991
+ K.Options = Ge;
992
+ K.Description = ue;
993
+ K.Error = me;
994
+ const ur = /(\d{7})|(\d{3}-\d{4})/;
995
+ function mr(e) {
996
+ var t;
997
+ return (t = e.match(ur)) == null ? void 0 : t[0];
998
+ }
999
+ function pr({ isAutocompleteEnabled: e }) {
1000
+ const t = B({
1001
+ hasAddress: !1
1002
+ }), r = Xe({
1003
+ enabled: e
1004
+ });
1005
+ return {
1006
+ searchByPostalCode: A(async (o) => {
1007
+ const a = mr(o);
1008
+ if (a) {
1009
+ if (t.current.postalCode === a && t.current.hasAddress)
1010
+ return t.current.address;
1011
+ t.current = {
1012
+ postalCode: a,
1013
+ address: void 0,
1014
+ hasAddress: !1
1015
+ };
1016
+ try {
1017
+ const i = await (r == null ? void 0 : r.searchByPostalCode({
1018
+ countryCode: "JP",
1019
+ postalCode: a
1020
+ }));
1021
+ return t.current.hasAddress = !0, t.current.address = void 0, i != null && i.formattedAddress ? (t.current.address = i, i) : void 0;
1022
+ } catch (i) {
1023
+ console.error(i);
1024
+ }
1025
+ }
1026
+ }, [
1027
+ r
1028
+ ])
1029
+ };
1030
+ }
1031
+ const j = ({ children: e }) => {
1032
+ const { id: t, value: r, onChange: s, disabled: o, readOnly: a, required: i, hasError: l, onBlur: d, onFocus: m, FieldLayout: u, autocomplete: y } = _(), { labelId: C } = P(), p = ve(), { autocompleteEnabled: E } = Le(), f = !!(p && Oe[p] === Oe.JP), N = (y || E) && f, v = be("zipCode"), h = b(e, j.Label), S = b(e, j.Control), g = b(e, j.Options), M = b(e, j.Description), T = b(e, j.Error);
1033
+ return N ? /* @__PURE__ */ n.createElement(u, {
1034
+ fieldId: t,
1035
+ renderLabel: () => F(h, {
1036
+ label: v
1037
+ }),
1038
+ renderInput: () => /* @__PURE__ */ n.createElement(Er, {
1039
+ value: r,
1040
+ onChange: s,
1041
+ disabled: o,
1042
+ readOnly: a,
1043
+ required: i,
1044
+ hasError: l,
1045
+ onBlur: d,
1046
+ onFocus: m
1047
+ }, S, g),
1048
+ renderDescription: () => /* @__PURE__ */ n.createElement(n.Fragment, null, T, M)
1049
+ }) : /* @__PURE__ */ n.createElement(u, {
1050
+ fieldId: t,
1051
+ renderLabel: () => F(h, {
1052
+ label: v
1053
+ }),
1054
+ renderInput: () => /* @__PURE__ */ n.createElement(Ce, {
1055
+ "aria-labelledby": C,
1056
+ value: r ?? "",
1057
+ onChange: s,
1058
+ isDisabled: o,
1059
+ isReadOnly: a,
1060
+ isRequired: i,
1061
+ isInvalid: l,
1062
+ onBlur: d,
1063
+ onFocus: m
1064
+ }, S),
1065
+ renderDescription: () => /* @__PURE__ */ n.createElement(n.Fragment, null, T, M)
1066
+ });
1067
+ }, Er = ({ children: e, value: t, onChange: r, disabled: s, readOnly: o, required: a, hasError: i, onBlur: l, onFocus: d }) => {
1068
+ const { labelId: m } = P(), { onAddressSelect: u } = Le(), [y, C] = fe(!1), { searchByPostalCode: p } = pr({
1069
+ isAutocompleteEnabled: y
1070
+ }), [E, f] = fe(), N = x(() => E ? [
1071
+ {
1072
+ id: X(),
1073
+ label: E.formattedAddress || ""
1074
+ }
1075
+ ] : [], [
1076
+ E
1077
+ ]), v = A(async (O) => {
1078
+ r(O);
1079
+ const D = await p(O ?? "");
1080
+ f(D);
1081
+ }, [
1082
+ r,
1083
+ p
1084
+ ]), h = A(async (O) => {
1085
+ O && (f(void 0), E && u && u(E));
1086
+ }, [
1087
+ u,
1088
+ E
1089
+ ]), S = A(() => {
1090
+ f(void 0), l == null || l();
1091
+ }, [
1092
+ l
1093
+ ]), g = A(() => {
1094
+ C(!0), d == null || d();
1095
+ }, [
1096
+ d
1097
+ ]), M = b(e, j.Control), T = b(e, j.Options);
1098
+ return /* @__PURE__ */ n.createElement(Fe, {
1099
+ "aria-labelledby": m,
1100
+ inputValue: t ?? "",
1101
+ onInputChange: v,
1102
+ value: null,
1103
+ onChange: h,
1104
+ isDisabled: s,
1105
+ isReadOnly: o,
1106
+ isRequired: a,
1107
+ isInvalid: i,
1108
+ onBlur: S,
1109
+ onFocus: g,
1110
+ allowsCustomValue: !0,
1111
+ menuTrigger: "input",
1112
+ items: N
1113
+ }, F(M, {
1114
+ onFocus: g
1115
+ }), F(T, {
1116
+ options: N
1117
+ }), /* @__PURE__ */ n.createElement(Qe, {
1118
+ optionCount: N.length
1119
+ }));
1120
+ }, Ze = ({ children: e, className: t, ...r }) => {
1121
+ const { disabled: s, hasError: o } = _(), { onFocus: a } = r, i = ve(), l = b(e, Ze.Input);
1122
+ return /* @__PURE__ */ n.createElement("div", {
1123
+ className: t,
1124
+ "data-country": i || void 0,
1125
+ "data-disabled": s || void 0,
1126
+ "data-invalid": o || void 0
1127
+ }, F(l, {
1128
+ onFocus: a
1129
+ }));
1130
+ }, br = ({ className: e, ...t }) => {
1131
+ const { id: r, placeholder: s } = _(), { inputId: o, ariaDescribedBy: a } = P(), { onFocus: i } = t, l = B(null);
1132
+ return G(() => {
1133
+ var d;
1134
+ (d = l.current) == null || d.focus({
1135
+ preventScroll: !0
1136
+ });
1137
+ }, r), ye(l), /* @__PURE__ */ n.createElement(de, {
1138
+ ref: l,
1139
+ id: o,
1140
+ autoComplete: "postal-code",
1141
+ "aria-describedby": a,
1142
+ className: e,
1143
+ placeholder: s,
1144
+ onFocus: i
1145
+ });
1146
+ }, et = ({ children: e, className: t }) => {
1147
+ const r = b(e, et.Option);
1148
+ return /* @__PURE__ */ n.createElement(De, {
1149
+ className: t,
1150
+ containerPadding: 0,
1151
+ offset: 0
1152
+ }, /* @__PURE__ */ n.createElement(we, {
1153
+ renderEmptyState: () => null
1154
+ }, (s) => F(r, {
1155
+ id: s.id,
1156
+ label: s.label
1157
+ })));
1158
+ }, fr = ({ className: e, ...t }) => {
1159
+ const { id: r, label: s } = t;
1160
+ return /* @__PURE__ */ n.createElement(Ae, {
1161
+ className: e,
1162
+ id: r,
1163
+ textValue: s
1164
+ }, s);
1165
+ };
1166
+ et.Option = fr;
1167
+ Ze.Input = br;
1168
+ j.Label = pe;
1169
+ j.Control = Ze;
1170
+ j.Options = et;
1171
+ j.Description = ue;
1172
+ j.Error = me;
1173
+ const J = ({ children: e }) => {
1174
+ const { id: t, value: r, onChange: s, disabled: o, readOnly: a, required: i, hasError: l, onBlur: d, onFocus: m, FieldLayout: u, autocomplete: y } = _(), { labelId: C } = P(), { autocompleteEnabled: p } = Le(), E = y || p, f = be("streetName"), N = b(e, J.Label), v = b(e, J.Input), h = b(e, J.Options), S = b(e, J.Description), g = b(e, J.Error);
1175
+ return E ? /* @__PURE__ */ n.createElement(u, {
1176
+ fieldId: t,
1177
+ renderLabel: () => F(N, {
1178
+ label: f
1179
+ }),
1180
+ renderInput: () => /* @__PURE__ */ n.createElement(yr, {
1181
+ value: r,
1182
+ onChange: s,
1183
+ disabled: o,
1184
+ readOnly: a,
1185
+ required: i,
1186
+ hasError: l,
1187
+ onBlur: d,
1188
+ onFocus: m
1189
+ }, v, h),
1190
+ renderDescription: () => /* @__PURE__ */ n.createElement(n.Fragment, null, g, S)
1191
+ }) : /* @__PURE__ */ n.createElement(u, {
1192
+ fieldId: t,
1193
+ renderLabel: () => F(N, {
1194
+ label: f
1195
+ }),
1196
+ renderInput: () => /* @__PURE__ */ n.createElement(Ce, {
1197
+ "aria-labelledby": C,
1198
+ value: r ?? "",
1199
+ onChange: s,
1200
+ isDisabled: o,
1201
+ isReadOnly: a,
1202
+ isRequired: i,
1203
+ isInvalid: l,
1204
+ onBlur: d,
1205
+ onFocus: m
1206
+ }, v),
1207
+ renderDescription: () => /* @__PURE__ */ n.createElement(n.Fragment, null, g, S)
1208
+ });
1209
+ }, yr = ({ children: e, value: t, onChange: r, disabled: s, readOnly: o, required: a, hasError: i, onBlur: l, onFocus: d }) => {
1210
+ const { labelId: m } = P(), { onAddressSelect: u } = Le(), y = ve(), C = Xe({
1211
+ enabled: !0
1212
+ }), { predictions: p, updatePredictions: E, clearPredictions: f } = kt({
1213
+ atlas: C
1214
+ }), N = b(e, J.Input), v = b(e, J.Options), h = x(() => p.reduce((O, D) => (D.searchId && D.description && O.push({
1215
+ id: D.searchId,
1216
+ label: D.description
1217
+ }), O), []), [
1218
+ p
1219
+ ]), S = A((O) => {
1220
+ E({
1221
+ input: O,
1222
+ countryCodes: y ? [
1223
+ y
1224
+ ] : void 0
1225
+ }), r(O);
1226
+ }, [
1227
+ r,
1228
+ E,
1229
+ y
1230
+ ]), g = A(async (O) => {
1231
+ if (f(), !O)
1232
+ return;
1233
+ const D = String(O), q = await (C == null ? void 0 : C.resolvePlace({
1234
+ searchId: D,
1235
+ prediction: p.find((Q) => Q.searchId === D)
1236
+ }));
1237
+ q && u && u(q);
1238
+ }, [
1239
+ u,
1240
+ f,
1241
+ C,
1242
+ p
1243
+ ]), M = A(() => {
1244
+ f(), l == null || l();
1245
+ }, [
1246
+ l,
1247
+ f
1248
+ ]), T = A(() => {
1249
+ d == null || d();
1250
+ }, [
1251
+ d
1252
+ ]);
1253
+ return /* @__PURE__ */ n.createElement(Fe, {
1254
+ "aria-labelledby": m,
1255
+ inputValue: t ?? "",
1256
+ onInputChange: S,
1257
+ value: null,
1258
+ onChange: g,
1259
+ isDisabled: s,
1260
+ isReadOnly: o,
1261
+ isRequired: a,
1262
+ isInvalid: i,
1263
+ onBlur: M,
1264
+ onFocus: T,
1265
+ allowsCustomValue: !0,
1266
+ menuTrigger: "input",
1267
+ items: h
1268
+ }, F(N, {
1269
+ onFocus: T
1270
+ }), F(v, {
1271
+ options: h
1272
+ }), /* @__PURE__ */ n.createElement(Qe, {
1273
+ optionCount: h.length
1274
+ }));
1275
+ }, Cr = ({ className: e, ...t }) => {
1276
+ const { id: r, placeholder: s } = _(), { inputId: o, ariaDescribedBy: a } = P(), { onFocus: i } = t, l = B(null);
1277
+ return G(() => {
1278
+ var d;
1279
+ (d = l.current) == null || d.focus({
1280
+ preventScroll: !0
1281
+ });
1282
+ }, r), ye(l), /* @__PURE__ */ n.createElement(de, {
1283
+ ref: l,
1284
+ id: o,
1285
+ autoComplete: "address-line1",
1286
+ "aria-describedby": a,
1287
+ className: e,
1288
+ placeholder: s,
1289
+ onFocus: i
1290
+ });
1291
+ }, tt = ({ children: e, className: t }) => {
1292
+ const r = b(e, tt.Option);
1293
+ return /* @__PURE__ */ n.createElement(De, {
1294
+ className: t,
1295
+ containerPadding: 0,
1296
+ offset: 0
1297
+ }, /* @__PURE__ */ n.createElement(we, {
1298
+ renderEmptyState: () => null
1299
+ }, (s) => F(r, {
1300
+ id: s.id,
1301
+ label: s.label
1302
+ })));
1303
+ }, Ir = ({ className: e, ...t }) => {
1304
+ const { id: r, label: s } = t;
1305
+ return /* @__PURE__ */ n.createElement(Ae, {
1306
+ className: e,
1307
+ id: r,
1308
+ textValue: s
1309
+ }, s);
1310
+ };
1311
+ tt.Option = Ir;
1312
+ J.Label = pe;
1313
+ J.Input = Cr;
1314
+ J.Options = tt;
1315
+ J.Description = ue;
1316
+ J.Error = me;
1317
+ const ce = ({ children: e }) => {
1318
+ const { id: t, value: r, onChange: s, disabled: o, readOnly: a, required: i, hasError: l, onBlur: d, onFocus: m, FieldLayout: u } = _(), { labelId: y } = P(), C = be("streetNumber"), p = b(e, ce.Label), E = b(e, ce.Input), f = b(e, ce.Description), N = b(e, ce.Error);
1319
+ return /* @__PURE__ */ n.createElement(u, {
1320
+ fieldId: t,
1321
+ renderLabel: () => F(p, {
1322
+ label: C
1323
+ }),
1324
+ renderInput: () => /* @__PURE__ */ n.createElement(Ce, {
1325
+ "aria-labelledby": y,
1326
+ value: r ?? "",
1327
+ onChange: s,
1328
+ isDisabled: o,
1329
+ isReadOnly: a,
1330
+ isRequired: i,
1331
+ isInvalid: l,
1332
+ onBlur: d,
1333
+ onFocus: m
1334
+ }, E),
1335
+ renderDescription: () => /* @__PURE__ */ n.createElement(n.Fragment, null, N, f)
1336
+ });
1337
+ }, Nr = ({ className: e }) => {
1338
+ const { id: t, placeholder: r } = _(), { inputId: s, ariaDescribedBy: o } = P(), a = B(null);
1339
+ return G(() => {
1340
+ var i;
1341
+ (i = a.current) == null || i.focus({
1342
+ preventScroll: !0
1343
+ });
1344
+ }, t), ye(a), /* @__PURE__ */ n.createElement(de, {
1345
+ ref: a,
1346
+ id: s,
1347
+ "aria-describedby": o,
1348
+ className: e,
1349
+ placeholder: r
1350
+ });
1351
+ };
1352
+ ce.Label = pe;
1353
+ ce.Input = Nr;
1354
+ ce.Description = ue;
1355
+ ce.Error = me;
1356
+ const Y = ({ children: e }) => {
1357
+ const { id: t, value: r, onChange: s, disabled: o, readOnly: a, required: i, hasError: l, onBlur: d, onFocus: m, FieldLayout: u } = _(), { labelId: y } = P(), { t: C } = Me(), p = ve(), E = p ? Oe[p] : void 0, f = p && Jt.getCountryByShortKey(p), N = x(() => {
1358
+ var k;
1359
+ return (Xt(((k = f == null ? void 0 : f.subdivisions) == null ? void 0 : k.list) || [], E) || []).map((w) => ({
1360
+ value: w.key,
1361
+ label: C(w.displayName)
1362
+ })).sort((w, V) => w.label.localeCompare(V.label));
1363
+ }, [
1364
+ E,
1365
+ C,
1366
+ f
1367
+ ]), v = A(() => s(""), [
1368
+ s
1369
+ ]), { onInputKeyDown: h, ...S } = $t({
1370
+ options: N,
1371
+ value: r,
1372
+ commit: s,
1373
+ clear: v,
1374
+ onBlur: d
1375
+ }), g = be("subdivision"), M = b(e, Y.Label), T = b(e, Y.Control), O = b(e, Y.Options), D = b(e, Y.Description), q = b(e, Y.Error), Q = b(e, Y.NativeSelect), U = _t() && N.length > 0 ? F(Q, {
1376
+ options: N
1377
+ }) : /* @__PURE__ */ n.createElement(Fe, {
1378
+ "aria-labelledby": y,
1379
+ ...S,
1380
+ isDisabled: o,
1381
+ isReadOnly: a,
1382
+ isRequired: i,
1383
+ isInvalid: l,
1384
+ onFocus: m,
1385
+ menuTrigger: "input"
1386
+ }, F(T, {
1387
+ onKeyDown: h
1388
+ }), F(O, {
1389
+ options: N
1390
+ }));
1391
+ return /* @__PURE__ */ n.createElement(u, {
1392
+ fieldId: t,
1393
+ renderLabel: () => F(M, {
1394
+ label: g
1395
+ }),
1396
+ renderInput: () => U,
1397
+ renderDescription: () => /* @__PURE__ */ n.createElement(n.Fragment, null, q, D)
1398
+ });
1399
+ }, he = ({ children: e, className: t, ...r }) => {
1400
+ const { disabled: s, hasError: o } = _(), { onKeyDown: a } = r, i = b(e, he.Input), l = b(e, he.Trigger);
1401
+ return /* @__PURE__ */ n.createElement(Ft, {
1402
+ className: t,
1403
+ isDisabled: s,
1404
+ isInvalid: o
1405
+ }, F(i, {
1406
+ onKeyDown: a
1407
+ }), l);
1408
+ }, Lr = ({ className: e, ...t }) => {
1409
+ const { id: r, placeholder: s, readOnly: o, disabled: a } = _(), { inputId: i, ariaDescribedBy: l } = P(), { onKeyDown: d } = t, m = B(null), u = Ut({
1410
+ readOnly: o,
1411
+ disabled: a
1412
+ });
1413
+ return G(() => {
1414
+ var y;
1415
+ (y = m.current) == null || y.focus({
1416
+ preventScroll: !0
1417
+ });
1418
+ }, r), /* @__PURE__ */ n.createElement(de, {
1419
+ ref: m,
1420
+ id: i,
1421
+ autoComplete: "address-level1",
1422
+ "aria-describedby": l,
1423
+ className: e,
1424
+ placeholder: s,
1425
+ onClick: u,
1426
+ onKeyDown: d
1427
+ });
1428
+ }, vr = ({ children: e, className: t }) => /* @__PURE__ */ n.createElement(Dt, {
1429
+ className: t
1430
+ }, e);
1431
+ he.Input = Lr;
1432
+ he.Trigger = vr;
1433
+ const nt = ({ children: e, className: t, ...r }) => {
1434
+ const { options: s } = r, o = b(e, nt.Option);
1435
+ return /* @__PURE__ */ n.createElement(De, {
1436
+ className: t,
1437
+ containerPadding: 0,
1438
+ offset: 0
1439
+ }, /* @__PURE__ */ n.createElement(we, null, s.map((a) => F(o, {
1440
+ key: a.value,
1441
+ value: a.value,
1442
+ label: a.label
1443
+ }))));
1444
+ }, Sr = ({ className: e, ...t }) => {
1445
+ const { value: r, label: s } = t;
1446
+ return /* @__PURE__ */ n.createElement(Ae, {
1447
+ className: e,
1448
+ id: r,
1449
+ textValue: s
1450
+ }, s);
1451
+ };
1452
+ nt.Option = Sr;
1453
+ const Or = ({ className: e, children: t, ...r }) => {
1454
+ const { options: s } = r, { id: o, value: a, onChange: i, disabled: l, readOnly: d, required: m, hasError: u, placeholder: y, onBlur: C, onFocus: p } = _(), { inputId: E, labelId: f, ariaDescribedBy: N } = P(), v = B(null);
1455
+ G(() => {
1456
+ var g;
1457
+ (g = v.current) == null || g.focus({
1458
+ preventScroll: !0
1459
+ });
1460
+ }, o);
1461
+ const { className: h, stateProps: S } = Tt(e);
1462
+ return /* @__PURE__ */ n.createElement(Rt, null, /* @__PURE__ */ n.createElement(Pt, {
1463
+ ref: v,
1464
+ id: E,
1465
+ className: h,
1466
+ ...ht(S, {
1467
+ onFocus: p,
1468
+ onBlur: C
1469
+ }),
1470
+ "aria-labelledby": f,
1471
+ "aria-describedby": N,
1472
+ "aria-invalid": u || void 0,
1473
+ autoComplete: "address-level1",
1474
+ value: a,
1475
+ options: s,
1476
+ placeholder: y,
1477
+ onChange: i,
1478
+ disabled: l,
1479
+ readOnly: d,
1480
+ required: m
1481
+ }), t);
1482
+ };
1483
+ Y.Label = pe;
1484
+ Y.NativeSelect = Or;
1485
+ Y.Control = he;
1486
+ Y.Options = nt;
1487
+ Y.Description = ue;
1488
+ Y.Error = me;
1489
+ const gr = () => Ee("country"), hr = () => Ee("subdivision"), Fr = () => Ee("city"), Dr = () => Ee("addressLine"), Ar = () => Ee("addressLine2"), _r = () => Ee("postalCode"), Rr = () => Ee("streetName"), Pr = () => Ee("streetNumber"), Tr = () => Ee("apartment"), Mr = {
1490
+ [z.MLA_COUNTRY]: gr,
1491
+ [z.MLA_SUBDIVISION]: hr,
1492
+ [z.MLA_CITY]: Fr,
1493
+ [z.MLA_ADDRESS_LINE]: Dr,
1494
+ [z.MLA_ADDRESS_LINE_2]: Ar,
1495
+ [z.MLA_POSTAL_CODE]: _r,
1496
+ [z.MLA_STREET_NAME]: Rr,
1497
+ [z.MLA_STREET_NUMBER]: Pr,
1498
+ [z.MLA_APARTMENT]: Tr
1499
+ }, wr = {}, Br = [], c = ({ children: e, className: t }) => {
1500
+ const { id: r, form: s, value: o, onChange: a, onFieldBlur: i, onFieldFocus: l, errors: d, FieldLayout: m, fieldSettings: u, label: y, validation: C, target: p, autocompleteEnabled: E, required: f, fieldType: N } = _(), [v, h] = fe(null), S = Qt(), g = x(() => ({
1501
+ ...S,
1502
+ ...Mr
1503
+ }), [
1504
+ S
1505
+ ]), { isExperimentEnabled: M } = He(), T = M(je.STREETLESS_LOCALITY_FALLBACK), { validateFields: O } = zt(), D = Gt(), q = gt(), Q = x(() => {
1506
+ var W;
1507
+ const $ = !!((W = q.actions) != null && W.getPlace);
1508
+ return {
1509
+ ...q,
1510
+ actions: {
1511
+ predict: nn,
1512
+ getPlace: tn,
1513
+ searchByPostalCode: en,
1514
+ ...$ ? {} : {
1515
+ searchByQuery: Zt
1516
+ },
1517
+ ...q.actions
1518
+ }
1519
+ };
1520
+ }, [
1521
+ q
1522
+ ]), { form: Z, isMultilineAddressField: U } = Pn({
1523
+ id: r,
1524
+ target: p,
1525
+ fieldType: N,
1526
+ form: s,
1527
+ country: o == null ? void 0 : o.country,
1528
+ fieldSettings: u,
1529
+ validation: C,
1530
+ required: f
1531
+ }), R = A(($) => {
1532
+ if (!o)
1533
+ return;
1534
+ const W = Nn($, U, T), _e = {
1535
+ ...W,
1536
+ [Ie.COUNTRY]: W[Ie.COUNTRY] ?? o[Ie.COUNTRY]
1537
+ };
1538
+ a == null || a(_e);
1539
+ }, [
1540
+ a,
1541
+ o,
1542
+ U,
1543
+ T
1544
+ ]), k = A(($, W) => {
1545
+ if (U && $ === Ie.COUNTRY && (o == null ? void 0 : o[$]) !== W) {
1546
+ a == null || a({
1547
+ [Ie.COUNTRY]: W
1548
+ });
1549
+ return;
1550
+ }
1551
+ a == null || a({
1552
+ ...o,
1553
+ [$]: W
1554
+ });
1555
+ }, [
1556
+ a,
1557
+ o,
1558
+ U
1559
+ ]), w = A(async ($) => O(U ? [
1560
+ ...$,
1561
+ {
1562
+ path: `${p}/${Ie.COUNTRY}`,
1563
+ value: o == null ? void 0 : o.country
1564
+ }
1565
+ ] : $), [
1566
+ o,
1567
+ p,
1568
+ O,
1569
+ U
1570
+ ]);
1571
+ rn(r, () => {
1572
+ var _e;
1573
+ const $ = d == null ? void 0 : d[0], W = (_e = Z == null ? void 0 : Z.fields) == null ? void 0 : _e.find((mt) => "target" in mt && mt.target === ($ == null ? void 0 : $.errorPath));
1574
+ return W == null ? void 0 : W.id;
1575
+ });
1576
+ const V = mn(r), rt = F(b(e, c.Country), {
1577
+ isForcedOpen: V
1578
+ }), st = b(e, c.Subdivision), ot = b(e, c.City), at = b(e, c.AddressLine), lt = b(e, c.AddressLine2), it = b(e, c.PostalCode), ct = b(e, c.StreetName), dt = b(e, c.StreetNumber), ut = b(e, c.Apartment), Vt = x(() => ({
1579
+ country: rt,
1580
+ subdivision: st,
1581
+ city: ot,
1582
+ addressLine: at,
1583
+ addressLine2: lt,
1584
+ postalCode: it,
1585
+ streetName: ct,
1586
+ streetNumber: dt,
1587
+ apartment: ut
1588
+ }), [
1589
+ rt,
1590
+ st,
1591
+ ot,
1592
+ at,
1593
+ lt,
1594
+ it,
1595
+ ct,
1596
+ dt,
1597
+ ut
1598
+ ]);
1599
+ return Z ? /* @__PURE__ */ n.createElement(m, {
1600
+ fieldId: r
1601
+ }, /* @__PURE__ */ n.createElement(vn, {
1602
+ countryCode: o == null ? void 0 : o.country
1603
+ }, /* @__PURE__ */ n.createElement(Ln, {
1604
+ autocompleteEnabled: E,
1605
+ onAddressSelect: R
1606
+ }, /* @__PURE__ */ n.createElement(Tn, {
1607
+ fields: Vt
1608
+ }, /* @__PURE__ */ n.createElement("div", {
1609
+ ref: h,
1610
+ style: {
1611
+ display: "contents"
1612
+ }
1613
+ }), /* @__PURE__ */ n.createElement(cn, {
1614
+ getContainer: () => v
1615
+ }, /* @__PURE__ */ n.createElement("fieldset", {
1616
+ className: t,
1617
+ style: dn
1618
+ }, /* @__PURE__ */ n.createElement("legend", {
1619
+ style: un
1620
+ }, y), /* @__PURE__ */ n.createElement(sn, {
1621
+ formSchema: D,
1622
+ form: Z,
1623
+ values: o ?? wr,
1624
+ onFieldChange: k,
1625
+ onBlur: i,
1626
+ onFocus: l,
1627
+ errors: d ?? Br,
1628
+ validateFields: w,
1629
+ fields: g,
1630
+ fieldActions: Q
1631
+ }))))))) : null;
1632
+ };
1633
+ c.Country = K;
1634
+ c.Subdivision = Y;
1635
+ c.City = ie;
1636
+ c.AddressLine = H;
1637
+ c.AddressLine2 = ae;
1638
+ c.PostalCode = j;
1639
+ c.StreetName = J;
1640
+ c.StreetNumber = ce;
1641
+ c.Apartment = le;
1642
+ const qr = "_postalCodeControl_1tire_1", xr = "_comboControl_1tire_5", kr = "_comboTrigger_1tire_19", Pe = {
1643
+ postalCodeControl: qr,
1644
+ comboControl: xr,
1645
+ comboTrigger: kr
1646
+ }, is = () => {
1647
+ const e = qe(Et, [
1648
+ Pe.comboControl
1649
+ ]), t = qe(Et, [
1650
+ I.nativeInput,
1651
+ I.nativeSelect
1652
+ ]), r = qe(ln, []), s = yn(an, Be);
1653
+ return /* @__PURE__ */ n.createElement(c, {
1654
+ className: on
1655
+ }, /* @__PURE__ */ n.createElement(c.Country, null, /* @__PURE__ */ n.createElement(c.Country.Label, {
1656
+ className: L(te, I.label)
1657
+ }, /* @__PURE__ */ n.createElement(c.Country.Label.Required, {
1658
+ className: L(ne, I.requiredMark)
1659
+ })), /* @__PURE__ */ n.createElement(c.Country.Control, {
1660
+ className: e
1661
+ }, /* @__PURE__ */ n.createElement(c.Country.Control.Input, {
1662
+ className: L(I.innerInput, Be)
1663
+ }), /* @__PURE__ */ n.createElement(c.Country.Control.Trigger, {
1664
+ className: Pe.comboTrigger
1665
+ }, /* @__PURE__ */ n.createElement(Re, {
1666
+ className: I.dropdownIcon
1667
+ }))), /* @__PURE__ */ n.createElement(c.Country.NativeSelect, {
1668
+ className: t
1669
+ }, /* @__PURE__ */ n.createElement(Re, {
1670
+ className: L(I.dropdownIcon, I.nativeDecoration)
1671
+ })), /* @__PURE__ */ n.createElement(c.Country.Options, {
1672
+ className: L(Se, I.selectPopover, I.dropdownPopover)
1673
+ }, /* @__PURE__ */ n.createElement(c.Country.Options.Option, {
1674
+ className: s
1675
+ })), /* @__PURE__ */ n.createElement(c.Country.Error, {
1676
+ className: L(re, I.error)
1677
+ }, /* @__PURE__ */ n.createElement(oe, null), /* @__PURE__ */ n.createElement(c.Country.Error.Text, null)), /* @__PURE__ */ n.createElement(c.Country.Description, {
1678
+ className: L(se, I.description)
1679
+ }, ({ content: o, locale: a }) => /* @__PURE__ */ n.createElement(ee, {
1680
+ content: o,
1681
+ locale: a
1682
+ }))), /* @__PURE__ */ n.createElement(c.AddressLine, null, /* @__PURE__ */ n.createElement(c.AddressLine.Label, {
1683
+ className: L(te, I.label)
1684
+ }, /* @__PURE__ */ n.createElement(c.AddressLine.Label.Required, {
1685
+ className: L(ne, I.requiredMark)
1686
+ })), /* @__PURE__ */ n.createElement(c.AddressLine.Input, {
1687
+ className: r
1688
+ }), /* @__PURE__ */ n.createElement(c.AddressLine.Options, {
1689
+ className: L(Se, I.selectPopover, I.dropdownPopover)
1690
+ }, /* @__PURE__ */ n.createElement(c.AddressLine.Options.Option, {
1691
+ className: s
1692
+ })), /* @__PURE__ */ n.createElement(c.AddressLine.Error, {
1693
+ className: L(re, I.error)
1694
+ }, /* @__PURE__ */ n.createElement(oe, null), /* @__PURE__ */ n.createElement(c.AddressLine.Error.Text, null)), /* @__PURE__ */ n.createElement(c.AddressLine.Description, {
1695
+ className: L(se, I.description)
1696
+ }, ({ content: o, locale: a }) => /* @__PURE__ */ n.createElement(ee, {
1697
+ content: o,
1698
+ locale: a
1699
+ }))), /* @__PURE__ */ n.createElement(c.AddressLine2, null, /* @__PURE__ */ n.createElement(c.AddressLine2.Label, {
1700
+ className: L(te, I.label)
1701
+ }, /* @__PURE__ */ n.createElement(c.AddressLine2.Label.Required, {
1702
+ className: L(ne, I.requiredMark)
1703
+ })), /* @__PURE__ */ n.createElement(c.AddressLine2.Input, {
1704
+ className: r
1705
+ }), /* @__PURE__ */ n.createElement(c.AddressLine2.Error, {
1706
+ className: L(re, I.error)
1707
+ }, /* @__PURE__ */ n.createElement(oe, null), /* @__PURE__ */ n.createElement(c.AddressLine2.Error.Text, null)), /* @__PURE__ */ n.createElement(c.AddressLine2.Description, {
1708
+ className: L(se, I.description)
1709
+ }, ({ content: o, locale: a }) => /* @__PURE__ */ n.createElement(ee, {
1710
+ content: o,
1711
+ locale: a
1712
+ }))), /* @__PURE__ */ n.createElement(c.City, null, /* @__PURE__ */ n.createElement(c.City.Label, {
1713
+ className: L(te, I.label)
1714
+ }, /* @__PURE__ */ n.createElement(c.City.Label.Required, {
1715
+ className: L(ne, I.requiredMark)
1716
+ })), /* @__PURE__ */ n.createElement(c.City.Input, {
1717
+ className: r
1718
+ }), /* @__PURE__ */ n.createElement(c.City.Error, {
1719
+ className: L(re, I.error)
1720
+ }, /* @__PURE__ */ n.createElement(oe, null), /* @__PURE__ */ n.createElement(c.City.Error.Text, null)), /* @__PURE__ */ n.createElement(c.City.Description, {
1721
+ className: L(se, I.description)
1722
+ }, ({ content: o, locale: a }) => /* @__PURE__ */ n.createElement(ee, {
1723
+ content: o,
1724
+ locale: a
1725
+ }))), /* @__PURE__ */ n.createElement(c.PostalCode, null, /* @__PURE__ */ n.createElement(c.PostalCode.Label, {
1726
+ className: L(te, I.label)
1727
+ }, /* @__PURE__ */ n.createElement(c.PostalCode.Label.Required, {
1728
+ className: L(ne, I.requiredMark)
1729
+ })), /* @__PURE__ */ n.createElement(c.PostalCode.Control, {
1730
+ className: Pe.postalCodeControl
1731
+ }, /* @__PURE__ */ n.createElement(c.PostalCode.Control.Input, {
1732
+ className: r
1733
+ })), /* @__PURE__ */ n.createElement(c.PostalCode.Options, {
1734
+ className: L(Se, I.selectPopover, I.dropdownPopover)
1735
+ }, /* @__PURE__ */ n.createElement(c.PostalCode.Options.Option, {
1736
+ className: s
1737
+ })), /* @__PURE__ */ n.createElement(c.PostalCode.Error, {
1738
+ className: L(re, I.error)
1739
+ }, /* @__PURE__ */ n.createElement(oe, null), /* @__PURE__ */ n.createElement(c.PostalCode.Error.Text, null)), /* @__PURE__ */ n.createElement(c.PostalCode.Description, {
1740
+ className: L(se, I.description)
1741
+ }, ({ content: o, locale: a }) => /* @__PURE__ */ n.createElement(ee, {
1742
+ content: o,
1743
+ locale: a
1744
+ }))), /* @__PURE__ */ n.createElement(c.Subdivision, null, /* @__PURE__ */ n.createElement(c.Subdivision.Label, {
1745
+ className: L(te, I.label)
1746
+ }, /* @__PURE__ */ n.createElement(c.Subdivision.Label.Required, {
1747
+ className: L(ne, I.requiredMark)
1748
+ })), /* @__PURE__ */ n.createElement(c.Subdivision.Control, {
1749
+ className: e
1750
+ }, /* @__PURE__ */ n.createElement(c.Subdivision.Control.Input, {
1751
+ className: L(I.innerInput, Be)
1752
+ }), /* @__PURE__ */ n.createElement(c.Subdivision.Control.Trigger, {
1753
+ className: Pe.comboTrigger
1754
+ }, /* @__PURE__ */ n.createElement(Re, {
1755
+ className: I.dropdownIcon
1756
+ }))), /* @__PURE__ */ n.createElement(c.Subdivision.NativeSelect, {
1757
+ className: t
1758
+ }, /* @__PURE__ */ n.createElement(Re, {
1759
+ className: L(I.dropdownIcon, I.nativeDecoration)
1760
+ })), /* @__PURE__ */ n.createElement(c.Subdivision.Options, {
1761
+ className: L(Se, I.selectPopover, I.dropdownPopover)
1762
+ }, /* @__PURE__ */ n.createElement(c.Subdivision.Options.Option, {
1763
+ className: s
1764
+ })), /* @__PURE__ */ n.createElement(c.Subdivision.Error, {
1765
+ className: L(re, I.error)
1766
+ }, /* @__PURE__ */ n.createElement(oe, null), /* @__PURE__ */ n.createElement(c.Subdivision.Error.Text, null)), /* @__PURE__ */ n.createElement(c.Subdivision.Description, {
1767
+ className: L(se, I.description)
1768
+ }, ({ content: o, locale: a }) => /* @__PURE__ */ n.createElement(ee, {
1769
+ content: o,
1770
+ locale: a
1771
+ }))), /* @__PURE__ */ n.createElement(c.StreetName, null, /* @__PURE__ */ n.createElement(c.StreetName.Label, {
1772
+ className: L(te, I.label)
1773
+ }, /* @__PURE__ */ n.createElement(c.StreetName.Label.Required, {
1774
+ className: L(ne, I.requiredMark)
1775
+ })), /* @__PURE__ */ n.createElement(c.StreetName.Input, {
1776
+ className: r
1777
+ }), /* @__PURE__ */ n.createElement(c.StreetName.Options, {
1778
+ className: L(Se, I.selectPopover, I.dropdownPopover)
1779
+ }, /* @__PURE__ */ n.createElement(c.StreetName.Options.Option, {
1780
+ className: s
1781
+ })), /* @__PURE__ */ n.createElement(c.StreetName.Error, {
1782
+ className: L(re, I.error)
1783
+ }, /* @__PURE__ */ n.createElement(oe, null), /* @__PURE__ */ n.createElement(c.StreetName.Error.Text, null)), /* @__PURE__ */ n.createElement(c.StreetName.Description, {
1784
+ className: L(se, I.description)
1785
+ }, ({ content: o, locale: a }) => /* @__PURE__ */ n.createElement(ee, {
1786
+ content: o,
1787
+ locale: a
1788
+ }))), /* @__PURE__ */ n.createElement(c.StreetNumber, null, /* @__PURE__ */ n.createElement(c.StreetNumber.Label, {
1789
+ className: L(te, I.label)
1790
+ }, /* @__PURE__ */ n.createElement(c.StreetNumber.Label.Required, {
1791
+ className: L(ne, I.requiredMark)
1792
+ })), /* @__PURE__ */ n.createElement(c.StreetNumber.Input, {
1793
+ className: r
1794
+ }), /* @__PURE__ */ n.createElement(c.StreetNumber.Error, {
1795
+ className: L(re, I.error)
1796
+ }, /* @__PURE__ */ n.createElement(oe, null), /* @__PURE__ */ n.createElement(c.StreetNumber.Error.Text, null)), /* @__PURE__ */ n.createElement(c.StreetNumber.Description, {
1797
+ className: L(se, I.description)
1798
+ }, ({ content: o, locale: a }) => /* @__PURE__ */ n.createElement(ee, {
1799
+ content: o,
1800
+ locale: a
1801
+ }))), /* @__PURE__ */ n.createElement(c.Apartment, null, /* @__PURE__ */ n.createElement(c.Apartment.Label, {
1802
+ className: L(te, I.label)
1803
+ }, /* @__PURE__ */ n.createElement(c.Apartment.Label.Required, {
1804
+ className: L(ne, I.requiredMark)
1805
+ })), /* @__PURE__ */ n.createElement(c.Apartment.Input, {
1806
+ className: r
1807
+ }), /* @__PURE__ */ n.createElement(c.Apartment.Error, {
1808
+ className: L(re, I.error)
1809
+ }, /* @__PURE__ */ n.createElement(oe, null), /* @__PURE__ */ n.createElement(c.Apartment.Error.Text, null)), /* @__PURE__ */ n.createElement(c.Apartment.Description, {
1810
+ className: L(se, I.description)
1811
+ }, ({ content: o, locale: a }) => /* @__PURE__ */ n.createElement(ee, {
1812
+ content: o,
1813
+ locale: a
1814
+ }))));
1815
+ };
1816
+ export {
1817
+ is as M
1818
+ };