@nice2dev/ui 1.1.5 → 1.1.7

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 (164) hide show
  1. package/CHANGELOG.md +102 -0
  2. package/README.md +50 -29
  3. package/css/legacy-bg-text-aliases.css +65 -61
  4. package/dist/NiceCodeEditor-Bc81wiaN.js +1134 -0
  5. package/dist/NiceCodeEditor-D6f8KdHN.js +1134 -0
  6. package/dist/NiceCodeEditor-DE3saxyt.cjs +260 -0
  7. package/dist/NiceCodeEditor-DZM16My5.cjs +260 -0
  8. package/dist/NiceCodeEditor-HqmcJjmZ.js +1179 -0
  9. package/dist/NiceColorPicker-6EqXaDj0.cjs +1 -0
  10. package/dist/NiceColorPicker-BiEWqWnd.js +596 -0
  11. package/dist/NiceColorPicker-Cuc6YXqz.cjs +1 -0
  12. package/dist/NiceColorPicker-DMATcNWG.js +596 -0
  13. package/dist/NiceColorPicker-R3O1nemp.js +596 -0
  14. package/dist/NiceConfirmDialog-B0e10fRL.cjs +1 -0
  15. package/dist/NiceConfirmDialog-BBDgEMHv.js +81 -0
  16. package/dist/NiceConfirmDialog-C7kdr8jJ.js +81 -0
  17. package/dist/NiceConfirmDialog-DMHqPfFM.js +81 -0
  18. package/dist/NiceConfirmDialog-ZJpQLQQS.cjs +1 -0
  19. package/dist/NiceDataGrid-BzUw4dSu.cjs +10 -0
  20. package/dist/NiceDataGrid-CPKcVOVz.js +1743 -0
  21. package/dist/NiceDataGrid-DJr33WMy.cjs +10 -0
  22. package/dist/NiceDataGrid-D_4gZ1Hu.js +1736 -0
  23. package/dist/NiceDataGrid-DlUAaXhD.js +1736 -0
  24. package/dist/NiceDocumentViewer-8ghRVtfO.js +672 -0
  25. package/dist/NiceDocumentViewer-ChWtA_Ry.cjs +180 -0
  26. package/dist/NiceDocumentViewer-DwLUV7Tc.js +672 -0
  27. package/dist/NiceDocumentViewer-goMzF1w3.cjs +180 -0
  28. package/dist/NiceDocumentViewer-gt1mxzP8.js +672 -0
  29. package/dist/NiceForm-CHEAHxDw.js +4805 -0
  30. package/dist/NiceForm-CJUp1CL0.cjs +1 -0
  31. package/dist/NiceForm-Cp_RH3Yj.js +4805 -0
  32. package/dist/NiceForm-a6tGr6ss.js +4819 -0
  33. package/dist/NiceForm-jU89oe2S.cjs +1 -0
  34. package/dist/NiceGantt-BnQwyTfG.cjs +1 -0
  35. package/dist/NiceGantt-D8coFAvK.js +328 -0
  36. package/dist/NiceGantt-DOZfT6r5.js +328 -0
  37. package/dist/NiceGantt-DQzH1V-R.js +328 -0
  38. package/dist/NiceGantt-jQ8ZpXko.cjs +1 -0
  39. package/dist/NiceHtmlEditor-B1nlXJNW.cjs +10 -0
  40. package/dist/NiceHtmlEditor-Bv3VqJPG.js +862 -0
  41. package/dist/NiceHtmlEditor-CKsGj-Ei.cjs +10 -0
  42. package/dist/NiceHtmlEditor-CloMgyzg.js +841 -0
  43. package/dist/NiceHtmlEditor-DUAHmkWI.js +841 -0
  44. package/dist/NiceLoginForm-Ce_QLnLf.js +736 -0
  45. package/dist/NiceLoginForm-DLpNTQlR.cjs +1 -0
  46. package/dist/NiceLoginForm-Dg0286Cc.js +736 -0
  47. package/dist/NiceLoginForm-X05Vadeg.js +708 -0
  48. package/dist/NiceLoginForm-f_dBCnUi.cjs +1 -0
  49. package/dist/NiceMention-BByI4nFG.js +11120 -0
  50. package/dist/NiceMention-BjeLN4Jx.cjs +430 -0
  51. package/dist/NiceMention-C2TPiMph.cjs +430 -0
  52. package/dist/NiceMention-C67vT6m0.js +11145 -0
  53. package/dist/NiceMention-D1cdy63w.cjs +430 -0
  54. package/dist/NiceMention-OaCi-GNO.js +11094 -0
  55. package/dist/NiceMention-QIuggb9Y.js +11122 -0
  56. package/dist/NiceMention.css +1 -1
  57. package/dist/NiceModal-CHaan9al.js +95 -0
  58. package/dist/NiceModal-Czq6OEAT.js +95 -0
  59. package/dist/NiceModal-D-HFwawr.js +95 -0
  60. package/dist/NiceModal-DOy2XTzc.cjs +1 -0
  61. package/dist/NiceModal-DkawKzEE.cjs +1 -0
  62. package/dist/NiceModuleLifecyclePanel-1CsP8Zst.js +6997 -0
  63. package/dist/NiceModuleLifecyclePanel-Bkx4Yg-3.cjs +1 -0
  64. package/dist/NiceModuleLifecyclePanel-C5oYtczk.js +6999 -0
  65. package/dist/NiceModuleLifecyclePanel-DCcy2yYi.cjs +1 -0
  66. package/dist/NiceModuleLifecyclePanel-DqdgW-0s.js +7004 -0
  67. package/dist/NiceModuleLifecyclePanel.css +1 -1
  68. package/dist/NicePagination-7od5KUa3.cjs +1 -0
  69. package/dist/NicePagination-DMrkR8hH.cjs +1 -0
  70. package/dist/NicePagination-DQmZpsSQ.js +179 -0
  71. package/dist/NicePagination-DipQRjPq.js +172 -0
  72. package/dist/NicePagination-KhlVXYaT.js +172 -0
  73. package/dist/NicePivotGrid-B-KthuqL.cjs +152 -0
  74. package/dist/NicePivotGrid-CLCTHkKO.cjs +152 -0
  75. package/dist/NicePivotGrid-DV54FCsH.js +1174 -0
  76. package/dist/NicePivotGrid-DoWLUPUs.js +1167 -0
  77. package/dist/NicePivotGrid-etwpfccz.js +1167 -0
  78. package/dist/NiceSavedQueryPanel-BABkTNc5.js +5129 -0
  79. package/dist/NiceSavedQueryPanel-Cfeig83P.cjs +586 -0
  80. package/dist/NiceSavedQueryPanel-DTWRLseb.cjs +586 -0
  81. package/dist/NiceSavedQueryPanel-Dy154sxE.js +5129 -0
  82. package/dist/NiceSavedQueryPanel-v7AffOOe.js +5129 -0
  83. package/dist/NiceSavedQueryPanel.css +1 -1
  84. package/dist/NiceScheduler-BEgB7ZgF.cjs +5 -0
  85. package/dist/NiceScheduler-C9JprsEI.cjs +5 -0
  86. package/dist/NiceScheduler-DSP-PPh0.js +1645 -0
  87. package/dist/NiceScheduler-DuPnaA3t.js +1652 -0
  88. package/dist/NiceScheduler-Oa89YZx9.js +1645 -0
  89. package/dist/NiceSelect-A336yeLZ.js +433 -0
  90. package/dist/NiceSelect-B5hTbqi2.js +433 -0
  91. package/dist/NiceSelect-BYSgDYzq.cjs +1 -0
  92. package/dist/NiceSelect-Dudf2T5T.js +433 -0
  93. package/dist/NiceSelect-DwBAIrX7.cjs +1 -0
  94. package/dist/NiceWindow-B6zjBTl9.cjs +1 -0
  95. package/dist/NiceWindow-BKQEx7Vf.js +1623 -0
  96. package/dist/NiceWindow-BnTH7Gy0.js +1623 -0
  97. package/dist/NiceWindow-CZN9NVZw.cjs +1 -0
  98. package/dist/NiceWindow-lxtPR7yZ.js +1623 -0
  99. package/dist/NiceWindow.css +1 -1
  100. package/dist/charts-B8_V3_nq.cjs +882 -0
  101. package/dist/charts-BZgyyybE.js +31933 -0
  102. package/dist/charts-FuDk5-r6.js +31958 -0
  103. package/dist/charts-INj3yFo5.js +31946 -0
  104. package/dist/charts-NolNXKUL.cjs +882 -0
  105. package/dist/charts.cjs +1 -1
  106. package/dist/charts.css +1 -1
  107. package/dist/charts.mjs +1 -1
  108. package/dist/core-A_A6c7an.js +795 -0
  109. package/dist/core-B2iH2J_X.js +795 -0
  110. package/dist/core-BmspZEfD.js +795 -0
  111. package/dist/core-DAfLOet6.cjs +1 -0
  112. package/dist/core-ZG3bgnBR.cjs +1 -0
  113. package/dist/data-branching-B3TOqXAO.cjs +1 -0
  114. package/dist/data-branching-BUGiICDZ.js +6275 -0
  115. package/dist/data-branching-DMXmcocj.js +6275 -0
  116. package/dist/data-branching-YE8P9M5P.js +6275 -0
  117. package/dist/data-branching-t6uhAwIm.cjs +1 -0
  118. package/dist/data-branching.cjs +1 -1
  119. package/dist/data-branching.mjs +1 -1
  120. package/dist/data.cjs +1 -1
  121. package/dist/data.d.ts +7 -2
  122. package/dist/data.mjs +3 -3
  123. package/dist/devops-BhV3OmF7.js +8285 -0
  124. package/dist/devops-BqUxnbRi.cjs +17 -0
  125. package/dist/devops-Bx-Qwj9w.cjs +17 -0
  126. package/dist/devops-DYZatW45.js +8251 -0
  127. package/dist/devops-R98k2zpd.js +8251 -0
  128. package/dist/devops.cjs +1 -1
  129. package/dist/devops.d.ts +29 -16
  130. package/dist/devops.mjs +1 -1
  131. package/dist/editors.cjs +1 -1
  132. package/dist/editors.d.ts +59 -28
  133. package/dist/editors.mjs +7 -7
  134. package/dist/feedback.cjs +1 -1
  135. package/dist/feedback.mjs +3 -3
  136. package/dist/index.cjs +445 -445
  137. package/dist/index.css +1 -1
  138. package/dist/index.d.ts +214 -119
  139. package/dist/index.mjs +16635 -16351
  140. package/dist/lazy.cjs +1 -1
  141. package/dist/lazy.d.ts +31 -18
  142. package/dist/lazy.mjs +24 -24
  143. package/dist/navigation.cjs +1 -1
  144. package/dist/navigation.d.ts +17 -14
  145. package/dist/navigation.mjs +130 -130
  146. package/dist/no-code-BPaAS4wW.cjs +332 -0
  147. package/dist/no-code-CBwUVL1i.js +7447 -0
  148. package/dist/no-code-CjktkQ50.js +7447 -0
  149. package/dist/no-code-DW2NrRba.js +7447 -0
  150. package/dist/no-code-DmFxrZ5T.cjs +332 -0
  151. package/dist/no-code.cjs +1 -1
  152. package/dist/no-code.d.ts +2 -2
  153. package/dist/no-code.mjs +1 -1
  154. package/dist/overlays.cjs +1 -1
  155. package/dist/overlays.d.ts +4 -4
  156. package/dist/overlays.mjs +2 -2
  157. package/dist/pickerCommons-C4XWRUvH.cjs +1 -0
  158. package/dist/pickerCommons-C_BpYs_m.cjs +1 -0
  159. package/dist/pickerCommons-DAOXH_u5.js +1122 -0
  160. package/dist/pickerCommons-Dn4wnDco.js +1122 -0
  161. package/dist/pickerCommons-DskswPS5.js +1122 -0
  162. package/dist/pickerCommons.css +1 -1
  163. package/dist/style.css +7 -7
  164. package/package.json +3 -3
@@ -0,0 +1,4805 @@
1
+ import { jsxs as p, jsx as e, Fragment as vn } from "react/jsx-runtime";
2
+ import { r as qn, g as Un, D as dn, c as un, G as We, q as Ge, j as _n, o as Ee, S as It, n as Et, A as Ft, t as Lt, E as zt, B as Pt, Z as Bt, F as Ht } from "./charts-BZgyyybE.js";
3
+ import An, { useMemo as ve, useState as $e, useRef as Ne, useEffect as Ie, useCallback as I, forwardRef as bn, useImperativeHandle as Gt, useContext as Yt, useLayoutEffect as mt } from "react";
4
+ import { N as Vt, a as Vn } from "./NiceColorPicker-R3O1nemp.js";
5
+ import { b as on, u as jt, F as lt, c as Kt, N as Ot, a as rt, d as qt } from "./pickerCommons-DskswPS5.js";
6
+ import { createPortal as ht } from "react-dom";
7
+ import { u as Zt, N as gt, s as Jt } from "./NiceSelect-Dudf2T5T.js";
8
+ import { u as Qt } from "./core-BmspZEfD.js";
9
+ function Xt({ text: n, query: i }) {
10
+ if (!i)
11
+ return /* @__PURE__ */ e(vn, { children: n });
12
+ const t = n.toLowerCase().indexOf(i.toLowerCase());
13
+ return t < 0 ? /* @__PURE__ */ e(vn, { children: n }) : /* @__PURE__ */ p("span", { children: [
14
+ n.slice(0, t),
15
+ /* @__PURE__ */ e("strong", { children: n.slice(t, t + i.length) }),
16
+ n.slice(t + i.length)
17
+ ] });
18
+ }
19
+ const Wt = ({
20
+ options: n,
21
+ value: i,
22
+ onChange: t,
23
+ minSearchLength: l = 1,
24
+ maxResults: a = 10,
25
+ onSearch: o,
26
+ clearable: s,
27
+ loading: v,
28
+ multiple: C,
29
+ renderOption: K,
30
+ highlightMatch: le = !0,
31
+ showAll: D = !0,
32
+ menuGap: x,
33
+ label: z,
34
+ error: re,
35
+ helperText: P,
36
+ required: E,
37
+ disabled: k,
38
+ readOnly: H,
39
+ size: de = "md",
40
+ id: G,
41
+ className: fe,
42
+ style: ce,
43
+ accessMode: w,
44
+ showKeyboardHints: F,
45
+ displayStyle: U,
46
+ labelPlacement: L,
47
+ errorPlacement: Y,
48
+ labelWidth: A,
49
+ controlWidth: J
50
+ }) => {
51
+ qn("input", U), Un("input", U);
52
+ const R = dn(w, G), Q = R === "hidden";
53
+ (R === "disabled" || R === "readOnly") && (k = !0);
54
+ const ee = un(G), { t: f } = We(), m = ve(
55
+ () => C ? Array.isArray(i) ? i : i ? [i] : [] : [],
56
+ [i, C]
57
+ ), [y, ne] = $e(
58
+ () => C || Array.isArray(i) ? "" : n.find((d) => String(d.value) === i)?.label ?? i ?? ""
59
+ ), [te, b] = $e(!1), h = Ne(null), [O, V] = $e(-1), be = Ne(null), oe = Ne(null), { popupRef: ue, coords: M, ready: W, themeClass: X, portalTarget: we } = Zt(
60
+ te,
61
+ h,
62
+ () => b(!1)
63
+ ), ze = ve(() => {
64
+ const d = [
65
+ Ge.moveDown,
66
+ Ge.moveUp,
67
+ Ge.submit,
68
+ Ge.cancel
69
+ ];
70
+ return C && d.push({ key: "Backspace", description: f("shortcuts.removeLastTag", "Remove last tag") }), d;
71
+ }, [C, f]);
72
+ Ie(() => {
73
+ C || ne(
74
+ Array.isArray(i) ? "" : n.find((d) => String(d.value) === i)?.label ?? i ?? ""
75
+ );
76
+ }, [i, C, n]);
77
+ const B = ve(() => {
78
+ if (y.length < l)
79
+ return D ? (o ? n : [...n].sort((q, ie) => q.label.localeCompare(ie.label))).slice(0, a) : [];
80
+ if (o)
81
+ return n.slice(0, a);
82
+ const d = y.toLowerCase();
83
+ return n.filter((pe) => pe.label.toLowerCase().includes(d)).slice(0, a);
84
+ }, [n, y, l, a, o, D]), ye = ve(() => {
85
+ const d = /* @__PURE__ */ new Map();
86
+ for (const pe of B) {
87
+ const q = pe.group || "";
88
+ d.has(q) || d.set(q, []), d.get(q).push(pe);
89
+ }
90
+ return d;
91
+ }, [B]), j = I(
92
+ (d) => {
93
+ H || (ne(d), b(d.length >= l), V(0), o?.(d));
94
+ },
95
+ [l, o, H]
96
+ ), Ue = I(
97
+ (d) => {
98
+ if (!H)
99
+ if (C) {
100
+ const pe = String(d.value), q = m.includes(pe) ? m.filter((ie) => ie !== pe) : [...m, pe];
101
+ t?.(q), ne("");
102
+ } else
103
+ ne(d.label), t?.(String(d.value)), b(!1);
104
+ },
105
+ [t, C, m, H]
106
+ ), g = (d) => {
107
+ if (!H) {
108
+ if (C && d.key === "Backspace" && !y && m.length > 0) {
109
+ t?.(m.slice(0, -1));
110
+ return;
111
+ }
112
+ if (!te && (d.key === "ArrowDown" || d.key === "ArrowUp")) {
113
+ d.preventDefault(), b(!0), V(0);
114
+ return;
115
+ }
116
+ te && (d.key === "ArrowDown" ? (d.preventDefault(), V((pe) => pe < 0 ? 0 : Math.min(pe + 1, B.length - 1))) : d.key === "ArrowUp" ? (d.preventDefault(), V((pe) => pe <= 0 ? B.length - 1 : pe - 1)) : (d.key === "Enter" || d.key === "Tab") && O >= 0 && O < B.length ? (d.preventDefault(), Ue(B[O])) : d.key === "Escape" && b(!1));
117
+ }
118
+ }, T = I(
119
+ (d) => {
120
+ H || t?.(m.filter((pe) => pe !== d));
121
+ },
122
+ [m, t, H]
123
+ );
124
+ return Q ? null : /* @__PURE__ */ p(
125
+ "div",
126
+ {
127
+ className: `nice-field nice-field--${de} ${L === "left" ? "nice-field--label-left" : ""} ${v ? "nice-field--loading" : ""} ${fe || ""}`,
128
+ style: {
129
+ width: "fit-content",
130
+ ...ce,
131
+ ...A != null && {
132
+ "--nice-field-label-width": typeof A == "number" ? `${A}px` : A
133
+ },
134
+ ...J != null && {
135
+ "--nice-field-control-width": typeof J == "number" ? `${J}px` : J
136
+ },
137
+ ...x != null && { "--nice-dropdown-gap": `${x}px` }
138
+ },
139
+ ref: be,
140
+ "aria-busy": v || void 0,
141
+ children: [
142
+ z && /* @__PURE__ */ p(
143
+ "label",
144
+ {
145
+ className: `nice-field__label ${E ? "nice-field__label--required" : ""}`,
146
+ htmlFor: ee,
147
+ children: [
148
+ z,
149
+ F && /* @__PURE__ */ e(_n, { shortcuts: ze, size: "sm" })
150
+ ]
151
+ }
152
+ ),
153
+ /* @__PURE__ */ p("div", { className: "nice-field__control", style: { position: "relative" }, children: [
154
+ /* @__PURE__ */ e(
155
+ "div",
156
+ {
157
+ ref: h,
158
+ className: `nice-input nice-input--${de} ${re ? "nice-input--error" : ""} ${k ? "nice-input--disabled" : ""}`,
159
+ style: { width: "220px" },
160
+ children: /* @__PURE__ */ p(
161
+ "div",
162
+ {
163
+ className: "nice-field__input-wrap",
164
+ style: {
165
+ display: "flex",
166
+ flexWrap: C ? "wrap" : "nowrap",
167
+ gap: 4,
168
+ alignItems: "center",
169
+ flex: 1,
170
+ minWidth: 0
171
+ },
172
+ children: [
173
+ C && m.map((d) => {
174
+ const pe = n.find((q) => String(q.value) === d);
175
+ return /* @__PURE__ */ p("span", { className: "nice-autocomplete__tag", children: [
176
+ pe?.label || d,
177
+ !H && /* @__PURE__ */ e(
178
+ "button",
179
+ {
180
+ type: "button",
181
+ className: "nice-autocomplete__tag-remove",
182
+ onClick: () => T(d),
183
+ "aria-label": f("controls.remove", "Remove"),
184
+ children: /* @__PURE__ */ e(Ee, { name: "close", size: 14 })
185
+ }
186
+ )
187
+ ] }, d);
188
+ }),
189
+ /* @__PURE__ */ e(
190
+ "input",
191
+ {
192
+ ref: oe,
193
+ id: ee,
194
+ type: "text",
195
+ className: "nice-input__native",
196
+ value: y,
197
+ onChange: (d) => j(d.target.value),
198
+ onFocus: () => !H && (D || y.length >= l) && b(!0),
199
+ onKeyDown: g,
200
+ disabled: k,
201
+ readOnly: H,
202
+ required: E,
203
+ role: "combobox",
204
+ "aria-expanded": te,
205
+ "aria-autocomplete": "list",
206
+ autoComplete: "off",
207
+ style: {
208
+ flex: 1,
209
+ minWidth: 60,
210
+ border: "none",
211
+ outline: "none",
212
+ background: "transparent",
213
+ color: "inherit",
214
+ padding: 0,
215
+ font: "inherit"
216
+ }
217
+ }
218
+ ),
219
+ s && !C && y && !k && !H && /* @__PURE__ */ e(
220
+ "button",
221
+ {
222
+ type: "button",
223
+ className: "nice-input__clear",
224
+ onClick: () => {
225
+ ne(""), t?.("");
226
+ },
227
+ "aria-label": f("controls.clear", "Clear"),
228
+ children: /* @__PURE__ */ e(Ee, { name: "close", size: 14 })
229
+ }
230
+ )
231
+ ]
232
+ }
233
+ )
234
+ }
235
+ ),
236
+ te && B.length > 0 && M && we && ht(
237
+ /* @__PURE__ */ e(
238
+ "ul",
239
+ {
240
+ ref: ue,
241
+ className: `nice-dropdown__list${X ? ` ${X}` : ""}`,
242
+ "data-theme": X === "nice-dark" ? "dark" : X === "nice-light" ? "light" : void 0,
243
+ role: "listbox",
244
+ style: {
245
+ position: "fixed",
246
+ left: M.left,
247
+ top: M.top,
248
+ width: M.width,
249
+ minWidth: M.width,
250
+ zIndex: 1e3,
251
+ // Stay transparent until the hook measures the real height (first open
252
+ // positions with an estimate that can flip above the trigger). opacity
253
+ // (not visibility) keeps the search input focusable while hidden.
254
+ opacity: W ? 1 : 0,
255
+ pointerEvents: W ? void 0 : "none"
256
+ },
257
+ children: Array.from(ye.entries()).map(([d, pe]) => /* @__PURE__ */ p(An.Fragment, { children: [
258
+ d && /* @__PURE__ */ e("li", { className: "nice-dropdown__group-label", children: d }),
259
+ pe.map((q) => {
260
+ const N = B.indexOf(q) === O, Ke = C && m.includes(String(q.value));
261
+ return /* @__PURE__ */ e(
262
+ "li",
263
+ {
264
+ role: "option",
265
+ className: `nice-dropdown__option ${N ? "nice-dropdown__option--active" : ""} ${Ke ? "nice-dropdown__option--selected" : ""}`,
266
+ onMouseDown: (qe) => {
267
+ qe.preventDefault(), Ue(q);
268
+ },
269
+ "aria-selected": N,
270
+ children: K ? K(q, y) : le ? /* @__PURE__ */ e(Xt, { text: q.label, query: y }) : q.label
271
+ },
272
+ String(q.value)
273
+ );
274
+ })
275
+ ] }, d))
276
+ }
277
+ ),
278
+ we
279
+ ),
280
+ v && /* @__PURE__ */ e("span", { className: "nice-field__spinner", children: /* @__PURE__ */ e("span", { className: "nice-spinner nice-spinner--sm" }) }),
281
+ Y === "right" && re && /* @__PURE__ */ e("div", { id: `${ee}-error`, className: "nice-field__error", role: "alert", children: re }),
282
+ Y === "right" && !re && P && /* @__PURE__ */ e("div", { id: `${ee}-helper`, className: "nice-field__helper", children: P })
283
+ ] }),
284
+ Y !== "right" && re && /* @__PURE__ */ e("div", { id: `${ee}-error`, className: "nice-field__error", role: "alert", children: re }),
285
+ Y !== "right" && !re && P && /* @__PURE__ */ e("div", { id: `${ee}-helper`, className: "nice-field__helper", children: P })
286
+ ]
287
+ }
288
+ );
289
+ }, ei = {
290
+ phone: "(999) 999-9999",
291
+ "credit-card": "9999 9999 9999 9999",
292
+ date: "99/99/9999",
293
+ ssn: "999-99-9999",
294
+ zip: "99-999",
295
+ time: "99:99",
296
+ iban: "aa99 9999 9999 9999 9999 9999"
297
+ };
298
+ function ni(n) {
299
+ return [...n].map((i) => i === "9" ? { type: "digit" } : i === "a" ? { type: "letter" } : i === "*" ? { type: "alphanum" } : { type: "literal", literal: i });
300
+ }
301
+ function ti(n, i) {
302
+ return i.type === "digit" ? /\d/.test(n) : i.type === "letter" ? /[a-zA-Z]/.test(n) : i.type === "alphanum" ? /[a-zA-Z0-9]/.test(n) : !1;
303
+ }
304
+ function ct(n, i, t) {
305
+ let l = 0, a = "";
306
+ for (const o of i)
307
+ o.type === "literal" ? a += o.literal : l < n.length ? (a += n[l], l++) : a += t;
308
+ return a;
309
+ }
310
+ function ii(n, i) {
311
+ return n.map((t) => t.type === "literal" ? t.literal : i).join("");
312
+ }
313
+ const yt = bn(
314
+ ({
315
+ label: n,
316
+ helperText: i,
317
+ error: t,
318
+ required: l,
319
+ disabled: a,
320
+ readOnly: o,
321
+ size: s = "md",
322
+ name: v,
323
+ id: C,
324
+ className: K,
325
+ style: le,
326
+ value: D = "",
327
+ onChange: x,
328
+ onBlur: z,
329
+ onKeyDown: re,
330
+ mask: P,
331
+ maskPreset: E,
332
+ maskChar: k = "_",
333
+ placeholder: H,
334
+ showMaskAsPlaceholder: de = !0,
335
+ clearable: G = !1,
336
+ autoFocus: fe,
337
+ labelPlacement: ce,
338
+ errorPlacement: w,
339
+ loading: F,
340
+ labelWidth: U,
341
+ controlWidth: L,
342
+ ...Y
343
+ }, A) => {
344
+ const { t: J } = We(), R = un(C), Q = Ne(null), [ee, f] = $e(!1), m = P || (E ? ei[E] : "") || "999", y = An.useMemo(() => ni(m), [m]), ne = An.useMemo(
345
+ () => ct(D, y, k),
346
+ [D, y, k]
347
+ ), te = ee || D ? ne : "", b = H ?? (de ? ii(y, k) : void 0), h = I(
348
+ (W) => {
349
+ Q.current = W, typeof A == "function" ? A(W) : A && (A.current = W);
350
+ },
351
+ [A]
352
+ ), O = I(
353
+ (W) => {
354
+ const X = ct(W, y, k);
355
+ x?.(W, X);
356
+ },
357
+ [x, y, k]
358
+ ), V = I(
359
+ (W) => {
360
+ const X = W.currentTarget, we = X.value, ze = X.selectionStart ?? we.length;
361
+ let B = "", ye = 0;
362
+ for (let j = 0; j < we.length && ye < y.length; j++) {
363
+ const Ue = we[j];
364
+ for (; ye < y.length && y[ye].type === "literal"; )
365
+ ye++;
366
+ if (ye >= y.length)
367
+ break;
368
+ ti(Ue, y[ye]) && (B += Ue, ye++);
369
+ }
370
+ O(B), requestAnimationFrame(() => {
371
+ let j = 0, Ue = 0;
372
+ for (let g = 0; g < y.length; g++) {
373
+ if (y[g].type === "literal")
374
+ j = g + 1;
375
+ else if (Ue < B.length)
376
+ Ue++, j = g + 1;
377
+ else {
378
+ j = g;
379
+ break;
380
+ }
381
+ if (j >= ze && Ue >= B.length)
382
+ break;
383
+ }
384
+ Ue >= B.length && B.length > 0 && (j = Math.min(j, y.length)), X.setSelectionRange(j, j);
385
+ });
386
+ },
387
+ [y, O]
388
+ ), be = I(
389
+ (W) => {
390
+ if (W.key === "Backspace" && D.length > 0) {
391
+ W.preventDefault();
392
+ const X = D.slice(0, -1);
393
+ O(X);
394
+ }
395
+ re?.(W);
396
+ },
397
+ [D, O, re]
398
+ ), oe = I(() => f(!0), []), ue = I(
399
+ (W) => {
400
+ f(!1), z?.(W);
401
+ },
402
+ [z]
403
+ ), M = I(() => {
404
+ O(""), Q.current?.focus();
405
+ }, [O]);
406
+ return /* @__PURE__ */ p(
407
+ "div",
408
+ {
409
+ className: `nice-field nice-field--masked nice-field--${s} ${ce === "left" ? "nice-field--label-left" : ""} ${F ? "nice-field--loading" : ""} ${K || ""}`,
410
+ style: {
411
+ ...le,
412
+ ...U != null && {
413
+ "--nice-field-label-width": typeof U == "number" ? `${U}px` : U
414
+ },
415
+ ...L != null && {
416
+ "--nice-field-control-width": typeof L == "number" ? `${L}px` : L
417
+ }
418
+ },
419
+ "aria-busy": F || void 0,
420
+ children: [
421
+ n && /* @__PURE__ */ e(
422
+ "label",
423
+ {
424
+ htmlFor: R,
425
+ className: `nice-field__label ${l ? "nice-field__label--required" : ""}`,
426
+ children: n
427
+ }
428
+ ),
429
+ /* @__PURE__ */ p("div", { className: "nice-field__control", children: [
430
+ /* @__PURE__ */ p(
431
+ "div",
432
+ {
433
+ className: `nice-input nice-input--${s} ${t ? "nice-input--error" : ""} ${a ? "nice-input--disabled" : ""} ${o ? "nice-input--readonly" : ""}`,
434
+ style: { width: "fit-content", minWidth: 0 },
435
+ children: [
436
+ /* @__PURE__ */ e(
437
+ "input",
438
+ {
439
+ ref: h,
440
+ id: R,
441
+ className: "nice-input__native nice-masked-input",
442
+ type: "text",
443
+ name: v,
444
+ value: te,
445
+ placeholder: b,
446
+ disabled: a || F,
447
+ readOnly: o,
448
+ autoFocus: fe,
449
+ style: {
450
+ width: `${m.length}ch`,
451
+ minWidth: 0,
452
+ fontFamily: "ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",
453
+ fontVariantNumeric: "tabular-nums"
454
+ },
455
+ "aria-invalid": !!t,
456
+ "aria-describedby": t ? `${R}-error` : i ? `${R}-helper` : void 0,
457
+ onInput: V,
458
+ onChange: () => {
459
+ },
460
+ onKeyDown: be,
461
+ onFocus: oe,
462
+ onBlur: ue,
463
+ ...Y
464
+ }
465
+ ),
466
+ G && D && /* @__PURE__ */ e(
467
+ "button",
468
+ {
469
+ type: "button",
470
+ className: "nice-input__clear",
471
+ disabled: a || o,
472
+ onClick: M,
473
+ "aria-label": J("controls.clear", "Clear"),
474
+ children: /* @__PURE__ */ e(Ee, { name: "close", size: 14 })
475
+ }
476
+ )
477
+ ]
478
+ }
479
+ ),
480
+ F && /* @__PURE__ */ e("span", { className: "nice-field__spinner", children: /* @__PURE__ */ e("span", { className: "nice-spinner nice-spinner--sm" }) }),
481
+ w === "right" && t && /* @__PURE__ */ e("div", { id: `${R}-error`, className: "nice-field__error", role: "alert", children: t }),
482
+ w === "right" && !t && i && /* @__PURE__ */ e("div", { id: `${R}-helper`, className: "nice-field__helper", children: i })
483
+ ] }),
484
+ w !== "right" && t && /* @__PURE__ */ e("div", { id: `${R}-error`, className: "nice-field__error", role: "alert", children: t }),
485
+ w !== "right" && !t && i && /* @__PURE__ */ e("div", { id: `${R}-helper`, className: "nice-field__helper", children: i })
486
+ ]
487
+ }
488
+ );
489
+ }
490
+ );
491
+ yt.displayName = "NiceMaskedInput";
492
+ const ai = [
493
+ { id: "length", label: "At least 8 characters", test: (n) => n.length >= 8 },
494
+ { id: "uppercase", label: "At least one uppercase letter", test: (n) => /[A-Z]/.test(n) },
495
+ { id: "lowercase", label: "At least one lowercase letter", test: (n) => /[a-z]/.test(n) },
496
+ { id: "digit", label: "At least one digit", test: (n) => /\d/.test(n) },
497
+ { id: "special", label: "At least one special character", test: (n) => /[^a-zA-Z0-9]/.test(n) }
498
+ ];
499
+ function li(n, i) {
500
+ if (!n)
501
+ return { level: "none", passed: [], ratio: 0 };
502
+ const t = i.filter((o) => o.test(n)).map((o) => o.id), l = t.length / i.length;
503
+ let a = "weak";
504
+ return l >= 1 ? a = "strong" : l >= 0.75 ? a = "good" : l >= 0.5 && (a = "fair"), { level: a, passed: t, ratio: l };
505
+ }
506
+ const _t = bn(
507
+ ({
508
+ label: n,
509
+ helperText: i,
510
+ error: t,
511
+ required: l,
512
+ disabled: a,
513
+ readOnly: o,
514
+ size: s = "md",
515
+ name: v,
516
+ id: C,
517
+ className: K,
518
+ style: le,
519
+ value: D = "",
520
+ onChange: x,
521
+ onBlur: z,
522
+ onKeyDown: re,
523
+ placeholder: P,
524
+ maxLength: E,
525
+ showToggle: k = !0,
526
+ showStrength: H = !1,
527
+ strengthRules: de,
528
+ validationPlacement: G = "bottom",
529
+ autoFocus: fe,
530
+ autoComplete: ce,
531
+ labelPlacement: w,
532
+ errorPlacement: F,
533
+ loading: U,
534
+ labelWidth: L,
535
+ controlWidth: Y,
536
+ ...A
537
+ }, J) => {
538
+ const { t: R } = We(), Q = un(C), [ee, f] = $e(!1), m = de ?? ai, y = ve(
539
+ () => H ? li(D, m) : null,
540
+ [H, D, m]
541
+ ), ne = I(() => f((b) => !b), []), te = H && y && D ? /* @__PURE__ */ p(
542
+ "div",
543
+ {
544
+ className: `nice-password__strength ${G === "right" ? "nice-password__strength--right" : ""}`,
545
+ children: [
546
+ /* @__PURE__ */ e("div", { className: "nice-password__meter", children: /* @__PURE__ */ e(
547
+ "div",
548
+ {
549
+ className: `nice-password__meter-fill nice-password__meter-fill--${y.level}`,
550
+ style: { width: `${y.ratio * 100}%` }
551
+ }
552
+ ) }),
553
+ /* @__PURE__ */ e(
554
+ "span",
555
+ {
556
+ className: `nice-password__strength-label nice-password__strength-label--${y.level}`,
557
+ children: R(
558
+ `password.strength.${y.level}`,
559
+ y.level.charAt(0).toUpperCase() + y.level.slice(1)
560
+ )
561
+ }
562
+ ),
563
+ /* @__PURE__ */ e("ul", { className: "nice-password__rules", children: m.map((b) => {
564
+ const h = y.passed.includes(b.id);
565
+ return /* @__PURE__ */ p(
566
+ "li",
567
+ {
568
+ className: `nice-password__rule ${h ? "nice-password__rule--passed" : ""}`,
569
+ children: [
570
+ /* @__PURE__ */ e("span", { className: "nice-password__rule-icon", children: /* @__PURE__ */ e(Ee, { name: h ? "check" : "close", size: 14 }) }),
571
+ b.label
572
+ ]
573
+ },
574
+ b.id
575
+ );
576
+ }) })
577
+ ]
578
+ }
579
+ ) : null;
580
+ return /* @__PURE__ */ p(
581
+ "div",
582
+ {
583
+ className: `nice-field nice-field--${s} ${w === "left" ? "nice-field--label-left" : ""} ${U ? "nice-field--loading" : ""} ${K || ""}`,
584
+ style: {
585
+ ...le,
586
+ ...L != null && {
587
+ "--nice-field-label-width": typeof L == "number" ? `${L}px` : L
588
+ },
589
+ ...Y != null && {
590
+ "--nice-field-control-width": typeof Y == "number" ? `${Y}px` : Y
591
+ }
592
+ },
593
+ "aria-busy": U || void 0,
594
+ children: [
595
+ n && /* @__PURE__ */ e(
596
+ "label",
597
+ {
598
+ htmlFor: Q,
599
+ className: `nice-field__label ${l ? "nice-field__label--required" : ""}`,
600
+ style: G === "right" && w === "left" ? (
601
+ /* When validation block sits to the right of the input it makes
602
+ `.nice-field__control` taller than a single input row. Without
603
+ this override the grid row centres the label against the whole
604
+ control (input + strength meter), pushing it visually too low.
605
+ `align-self: flex-start` + matching padding keeps the label
606
+ aligned with the input row only. */
607
+ { alignSelf: "flex-start", paddingTop: 6 }
608
+ ) : void 0,
609
+ children: n
610
+ }
611
+ ),
612
+ /* @__PURE__ */ p(
613
+ "div",
614
+ {
615
+ className: "nice-field__control",
616
+ style: G === "right" ? { alignItems: "flex-start" } : void 0,
617
+ children: [
618
+ /* @__PURE__ */ p(
619
+ "div",
620
+ {
621
+ style: G === "right" ? { display: "flex", flexDirection: "column", flex: "1 1 auto", minWidth: 0 } : { display: "contents" },
622
+ children: [
623
+ /* @__PURE__ */ p(
624
+ "div",
625
+ {
626
+ className: `nice-input nice-input--${s} ${t ? "nice-input--error" : ""} ${a ? "nice-input--disabled" : ""} ${o ? "nice-input--readonly" : ""}`,
627
+ children: [
628
+ /* @__PURE__ */ e(
629
+ "input",
630
+ {
631
+ ref: J,
632
+ id: Q,
633
+ className: "nice-input__native",
634
+ type: ee ? "text" : "password",
635
+ name: v,
636
+ value: D,
637
+ placeholder: P,
638
+ disabled: a || U,
639
+ readOnly: o,
640
+ maxLength: E,
641
+ autoFocus: fe,
642
+ autoComplete: ce,
643
+ "aria-invalid": !!t,
644
+ "aria-describedby": t ? `${Q}-error` : i ? `${Q}-helper` : void 0,
645
+ onChange: (b) => x?.(b.target.value),
646
+ onBlur: z,
647
+ onKeyDown: re,
648
+ ...A
649
+ }
650
+ ),
651
+ k && /* @__PURE__ */ e(
652
+ "button",
653
+ {
654
+ type: "button",
655
+ className: "nice-password__toggle",
656
+ onClick: ne,
657
+ disabled: a,
658
+ tabIndex: -1,
659
+ "aria-label": ee ? R("password.hide", "Hide password") : R("password.show", "Show password"),
660
+ children: /* @__PURE__ */ e(Ee, { name: ee ? "eye-off" : "eye", size: 18 })
661
+ }
662
+ )
663
+ ]
664
+ }
665
+ ),
666
+ G === "right" && F !== "right" && t && /* @__PURE__ */ e("div", { id: `${Q}-error`, className: "nice-field__error", role: "alert", children: t }),
667
+ G === "right" && F !== "right" && !t && i && /* @__PURE__ */ e("div", { id: `${Q}-helper`, className: "nice-field__helper", children: i })
668
+ ]
669
+ }
670
+ ),
671
+ U && /* @__PURE__ */ e("span", { className: "nice-field__spinner", children: /* @__PURE__ */ e("span", { className: "nice-spinner nice-spinner--sm" }) }),
672
+ G === "right" && te,
673
+ F === "right" && t && /* @__PURE__ */ e("div", { id: `${Q}-error`, className: "nice-field__error", role: "alert", children: t }),
674
+ F === "right" && !t && i && /* @__PURE__ */ e("div", { id: `${Q}-helper`, className: "nice-field__helper", children: i })
675
+ ]
676
+ }
677
+ ),
678
+ G !== "right" && te,
679
+ G !== "right" && F !== "right" && t && /* @__PURE__ */ e("div", { id: `${Q}-error`, className: "nice-field__error", role: "alert", children: t }),
680
+ G !== "right" && F !== "right" && !t && i && /* @__PURE__ */ e("div", { id: `${Q}-helper`, className: "nice-field__helper", children: i })
681
+ ]
682
+ }
683
+ );
684
+ }
685
+ );
686
+ _t.displayName = "NicePasswordInput";
687
+ const vt = ({
688
+ label: n,
689
+ helperText: i,
690
+ error: t,
691
+ required: l,
692
+ disabled: a,
693
+ size: o = "md",
694
+ name: s,
695
+ id: v,
696
+ className: C,
697
+ style: K,
698
+ accessMode: le,
699
+ options: D,
700
+ value: x,
701
+ onChange: z,
702
+ direction: re = "horizontal",
703
+ showKeyboardHints: P,
704
+ displayStyle: E,
705
+ labelPlacement: k,
706
+ errorPlacement: H,
707
+ labelWidth: de,
708
+ controlWidth: G,
709
+ loading: fe,
710
+ readOnly: ce
711
+ }) => {
712
+ Un("toggle", E);
713
+ const w = dn(le, v), F = w === "hidden";
714
+ (w === "disabled" || w === "readOnly") && (a = !0);
715
+ const { t: U } = We(), L = un(v), Y = s || L, A = ve(
716
+ () => [
717
+ { key: "ArrowUp", description: U("shortcuts.previousOption", "Previous option") },
718
+ { key: "ArrowDown", description: U("shortcuts.nextOption", "Next option") },
719
+ { key: "Space", description: U("shortcuts.select", "Select") }
720
+ ],
721
+ [U]
722
+ );
723
+ return F ? null : /* @__PURE__ */ p(
724
+ "div",
725
+ {
726
+ className: `nice-field nice-field--inline nice-field--inline-block nice-field--${o} ${k === "left" ? "nice-field--label-left" : ""} ${H === "right" ? "nice-field--error-right" : ""} ${fe ? "nice-field--loading" : ""} ${C || ""}`,
727
+ style: {
728
+ ...K,
729
+ ...de != null && {
730
+ "--nice-field-label-width": typeof de == "number" ? `${de}px` : de
731
+ },
732
+ ...G != null && {
733
+ "--nice-field-control-width": typeof G == "number" ? `${G}px` : G
734
+ }
735
+ },
736
+ role: "radiogroup",
737
+ "aria-labelledby": `${L}-label`,
738
+ "aria-busy": fe || void 0,
739
+ children: [
740
+ n && /* @__PURE__ */ p(
741
+ "span",
742
+ {
743
+ id: `${L}-label`,
744
+ className: `nice-field__label ${l ? "nice-field__label--required" : ""}`,
745
+ children: [
746
+ n,
747
+ P && /* @__PURE__ */ e(_n, { shortcuts: A, size: "sm" })
748
+ ]
749
+ }
750
+ ),
751
+ /* @__PURE__ */ p("div", { className: "nice-field__control", children: [
752
+ /* @__PURE__ */ e(
753
+ "div",
754
+ {
755
+ className: `nice-radio-group ${re === "vertical" ? "nice-radio-group--vertical" : ""}`,
756
+ children: D.map((J) => /* @__PURE__ */ p(
757
+ "label",
758
+ {
759
+ className: `nice-radio ${a || J.disabled || fe ? "nice-radio--disabled" : ""} ${ce ? "nice-radio--readonly" : ""}`,
760
+ children: [
761
+ /* @__PURE__ */ e(
762
+ "input",
763
+ {
764
+ type: "radio",
765
+ className: "nice-radio__input",
766
+ name: Y,
767
+ value: J.value,
768
+ checked: x === J.value,
769
+ disabled: a || J.disabled || fe,
770
+ "aria-readonly": ce || void 0,
771
+ onChange: () => {
772
+ ce || z?.(J.value);
773
+ }
774
+ }
775
+ ),
776
+ /* @__PURE__ */ e("span", { className: "nice-radio__circle", children: /* @__PURE__ */ e("span", { className: "nice-radio__dot" }) }),
777
+ /* @__PURE__ */ e("span", { children: J.label })
778
+ ]
779
+ },
780
+ J.value
781
+ ))
782
+ }
783
+ ),
784
+ fe && /* @__PURE__ */ e("span", { className: "nice-field__spinner", children: /* @__PURE__ */ e("span", { className: "nice-spinner nice-spinner--sm" }) }),
785
+ H === "right" && t && /* @__PURE__ */ e("div", { id: `${L}-error`, className: "nice-field__error", role: "alert", children: t }),
786
+ H === "right" && !t && i && /* @__PURE__ */ e("div", { id: `${L}-helper`, className: "nice-field__helper", children: i })
787
+ ] }),
788
+ H !== "right" && t && /* @__PURE__ */ e("div", { id: `${L}-error`, className: "nice-field__error", role: "alert", children: t }),
789
+ H !== "right" && !t && i && /* @__PURE__ */ e("div", { id: `${L}-helper`, className: "nice-field__helper", children: i })
790
+ ]
791
+ }
792
+ );
793
+ }, ji = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
794
+ __proto__: null,
795
+ NiceRadioGroup: vt
796
+ }, Symbol.toStringTag, { value: "Module" })), ri = ({
797
+ filled: n,
798
+ size: i
799
+ }) => /* @__PURE__ */ p(
800
+ "svg",
801
+ {
802
+ width: i,
803
+ height: i,
804
+ viewBox: "0 0 24 24",
805
+ fill: "none",
806
+ xmlns: "http://www.w3.org/2000/svg",
807
+ children: [
808
+ n === "half" && /* @__PURE__ */ e("defs", { children: /* @__PURE__ */ p("linearGradient", { id: "halfGrad", children: [
809
+ /* @__PURE__ */ e("stop", { offset: "50%", stopColor: "currentColor" }),
810
+ /* @__PURE__ */ e("stop", { offset: "50%", stopColor: "transparent" })
811
+ ] }) }),
812
+ /* @__PURE__ */ e(
813
+ "path",
814
+ {
815
+ d: "M12 2l3.09 6.26L22 9.27l-5 4.87L18.18 22 12 18.27 5.82 22 7 14.14l-5-4.87 6.91-1.01L12 2z",
816
+ fill: n === "full" ? "currentColor" : n === "half" ? "url(#halfGrad)" : "none",
817
+ stroke: "currentColor",
818
+ strokeWidth: "1.5",
819
+ strokeLinejoin: "round"
820
+ }
821
+ )
822
+ ]
823
+ }
824
+ ), ci = {
825
+ xxs: 10,
826
+ xs: 14,
827
+ sm: 18,
828
+ md: 22,
829
+ lg: 28,
830
+ xl: 34,
831
+ xxl: 42,
832
+ small: 18,
833
+ medium: 22,
834
+ large: 28
835
+ }, Zn = bn(
836
+ ({
837
+ value: n = 0,
838
+ onChange: i,
839
+ count: t = 5,
840
+ half: l = !1,
841
+ readOnly: a = !1,
842
+ disabled: o = !1,
843
+ size: s = "md",
844
+ label: v,
845
+ icon: C,
846
+ name: K,
847
+ error: le,
848
+ helperText: D,
849
+ required: x,
850
+ id: z,
851
+ className: re,
852
+ style: P,
853
+ labelPlacement: E,
854
+ errorPlacement: k,
855
+ labelWidth: H,
856
+ controlWidth: de,
857
+ valuePlacement: G = "none",
858
+ valueTemplate: fe,
859
+ loading: ce,
860
+ ...w
861
+ }, F) => {
862
+ const { t: U } = We(), L = un(z), [Y, A] = $e(null), J = ci[s], R = !a && !o && !ce, Q = Y ?? n, ee = (b) => Q >= b + 1 ? "full" : l && Q >= b + 0.5 ? "half" : "empty", f = I(
863
+ (b, h) => {
864
+ if (!R)
865
+ return;
866
+ const O = h && l ? b + 0.5 : b + 1;
867
+ i?.(O === n ? 0 : O);
868
+ },
869
+ [R, l, i, n]
870
+ ), m = I(
871
+ (b, h) => {
872
+ if (R)
873
+ if (l) {
874
+ const O = h.currentTarget.getBoundingClientRect(), V = h.clientX - O.left < O.width / 2;
875
+ A(V ? b + 0.5 : b + 1);
876
+ } else
877
+ A(b + 1);
878
+ },
879
+ [R, l]
880
+ ), y = I(() => {
881
+ R && A(null);
882
+ }, [R]), ne = I(
883
+ (b) => {
884
+ if (!R)
885
+ return;
886
+ const h = l ? 0.5 : 1;
887
+ if (b.key === "ArrowRight" || b.key === "ArrowUp") {
888
+ b.preventDefault();
889
+ const O = Math.min(t, n + h);
890
+ i?.(O);
891
+ } else if (b.key === "ArrowLeft" || b.key === "ArrowDown") {
892
+ b.preventDefault();
893
+ const O = Math.max(0, n - h);
894
+ i?.(O);
895
+ }
896
+ },
897
+ [R, l, t, n, i]
898
+ ), te = fe ? fe.replace("{value}", String(n)) : String(n);
899
+ return /* @__PURE__ */ p(
900
+ "div",
901
+ {
902
+ className: `nice-field nice-field--${s} ${E === "left" ? "nice-field--label-left" : ""} ${ce ? "nice-field--loading" : ""} ${re || ""}`,
903
+ style: {
904
+ ...P,
905
+ ...H != null && {
906
+ "--nice-field-label-width": typeof H == "number" ? `${H}px` : H
907
+ },
908
+ ...de != null && {
909
+ "--nice-field-control-width": typeof de == "number" ? `${de}px` : de
910
+ }
911
+ },
912
+ "aria-busy": ce || void 0,
913
+ ...w,
914
+ children: [
915
+ v && /* @__PURE__ */ e(
916
+ "label",
917
+ {
918
+ htmlFor: L,
919
+ className: `nice-field__label ${x ? "nice-field__label--required" : ""}`,
920
+ children: v
921
+ }
922
+ ),
923
+ /* @__PURE__ */ p("div", { className: "nice-field__control", children: [
924
+ /* @__PURE__ */ p(
925
+ "div",
926
+ {
927
+ ref: F,
928
+ id: L,
929
+ className: `nice-rating nice-rating--${s} ${o ? "nice-rating--disabled" : ""} ${a ? "nice-rating--readonly" : ""}`,
930
+ role: "slider",
931
+ "aria-valuenow": n,
932
+ "aria-valuemin": 0,
933
+ "aria-valuemax": t,
934
+ "aria-label": v || U("controls.rating", "Rating"),
935
+ "aria-invalid": !!le,
936
+ tabIndex: R ? 0 : -1,
937
+ onMouseLeave: y,
938
+ onKeyDown: ne,
939
+ children: [
940
+ K && /* @__PURE__ */ e("input", { type: "hidden", name: K, value: n }),
941
+ Array.from({ length: t }, (b, h) => {
942
+ const O = ee(h);
943
+ return /* @__PURE__ */ e(
944
+ "span",
945
+ {
946
+ className: `nice-rating__star nice-rating__star--${O}`,
947
+ onClick: (V) => {
948
+ if (!R)
949
+ return;
950
+ const be = V.currentTarget.getBoundingClientRect(), oe = l && V.clientX - be.left < be.width / 2;
951
+ f(h, oe);
952
+ },
953
+ onMouseMove: (V) => m(h, V),
954
+ "aria-label": `${h + 1} ${U("controls.star", "star")}`,
955
+ children: C ? C(O) : /* @__PURE__ */ e(ri, { filled: O, size: J })
956
+ },
957
+ h
958
+ );
959
+ }),
960
+ ce && /* @__PURE__ */ e("span", { className: "nice-rating__loading", children: /* @__PURE__ */ e("span", { className: "nice-spinner nice-spinner--sm" }) })
961
+ ]
962
+ }
963
+ ),
964
+ G === "right" && !ce && /* @__PURE__ */ e("span", { className: "nice-rating__value", children: te }),
965
+ G === "bottom" && !ce && /* @__PURE__ */ e("div", { className: "nice-rating__value nice-rating__value--bottom", children: te }),
966
+ k === "right" && le && /* @__PURE__ */ e("div", { id: `${L}-error`, className: "nice-field__error", role: "alert", children: le }),
967
+ k === "right" && !le && D && /* @__PURE__ */ e("div", { id: `${L}-helper`, className: "nice-field__helper", children: D })
968
+ ] }),
969
+ k !== "right" && le && /* @__PURE__ */ e("div", { id: `${L}-error`, className: "nice-field__error", role: "alert", children: le }),
970
+ k !== "right" && !le && D && /* @__PURE__ */ e("div", { id: `${L}-helper`, className: "nice-field__helper", children: D })
971
+ ]
972
+ }
973
+ );
974
+ }
975
+ );
976
+ Zn.displayName = "NiceRating";
977
+ const Ki = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
978
+ __proto__: null,
979
+ NiceRating: Zn
980
+ }, Symbol.toStringTag, { value: "Module" })), Jn = bn(
981
+ ({
982
+ label: n,
983
+ helperText: i,
984
+ error: t,
985
+ required: l,
986
+ disabled: a,
987
+ id: o,
988
+ className: s,
989
+ style: v,
990
+ accessMode: C,
991
+ value: K = 0,
992
+ onChange: le,
993
+ min: D = 0,
994
+ max: x = 100,
995
+ step: z = 1,
996
+ showValue: re = !0,
997
+ showMinMax: P = !1,
998
+ formatValue: E,
999
+ showKeyboardHints: k,
1000
+ displayStyle: H,
1001
+ size: de = "md",
1002
+ labelPlacement: G,
1003
+ errorPlacement: fe,
1004
+ labelWidth: ce,
1005
+ controlWidth: w,
1006
+ loading: F,
1007
+ showTicks: U = !1,
1008
+ tickInterval: L,
1009
+ maxTicks: Y = 21,
1010
+ showTickLabels: A = !1
1011
+ }, J) => {
1012
+ Un("input", H);
1013
+ const R = dn(C, o), Q = R === "hidden";
1014
+ (R === "disabled" || R === "readOnly") && (a = !0);
1015
+ const { t: ee } = We(), f = un(o), m = ve(() => (K - D) / (x - D) * 100, [K, D, x]), y = E ? E(K) : K.toString(), ne = ve(() => {
1016
+ if (!U)
1017
+ return [];
1018
+ const h = x - D;
1019
+ if (h <= 0)
1020
+ return [D, x];
1021
+ let O = L ?? z, V = Math.floor(h / O) + 1;
1022
+ return V > Y && (O = h / (Y - 1), V = Y), Array.from({ length: V }, (be, oe) => {
1023
+ const ue = D + oe * O;
1024
+ return oe === V - 1 ? x : ue;
1025
+ });
1026
+ }, [U, D, x, z, L, Y]), te = ve(
1027
+ () => [
1028
+ Ge.increment,
1029
+ Ge.decrement,
1030
+ Ge.first,
1031
+ Ge.last,
1032
+ Ge.incrementBig,
1033
+ Ge.decrementBig
1034
+ ],
1035
+ []
1036
+ ), b = G === "left";
1037
+ return Q ? null : /* @__PURE__ */ p(
1038
+ "div",
1039
+ {
1040
+ className: `nice-field nice-field--${de} ${b ? "nice-field--label-left" : ""} ${F ? "nice-field--loading" : ""} ${s || ""}`,
1041
+ style: {
1042
+ ...v,
1043
+ ...ce != null && {
1044
+ "--nice-field-label-width": typeof ce == "number" ? `${ce}px` : ce
1045
+ },
1046
+ ...w != null && {
1047
+ "--nice-field-control-width": typeof w == "number" ? `${w}px` : w
1048
+ }
1049
+ },
1050
+ "aria-busy": F || void 0,
1051
+ children: [
1052
+ b ? n && /* @__PURE__ */ p(
1053
+ "label",
1054
+ {
1055
+ htmlFor: f,
1056
+ className: `nice-field__label ${l ? "nice-field__label--required" : ""}`,
1057
+ children: [
1058
+ n,
1059
+ k && /* @__PURE__ */ e(_n, { shortcuts: te, size: "sm" })
1060
+ ]
1061
+ }
1062
+ ) : (n || re || k) && /* @__PURE__ */ p("div", { className: "nice-slider__header", children: [
1063
+ n ? /* @__PURE__ */ p(
1064
+ "label",
1065
+ {
1066
+ htmlFor: f,
1067
+ className: `nice-field__label ${l ? "nice-field__label--required" : ""}`,
1068
+ children: [
1069
+ n,
1070
+ k && /* @__PURE__ */ e(_n, { shortcuts: te, size: "sm" })
1071
+ ]
1072
+ }
1073
+ ) : /* @__PURE__ */ e("span", {}),
1074
+ re && /* @__PURE__ */ e("span", { className: "nice-slider__value nice-slider__value--header", children: y })
1075
+ ] }),
1076
+ /* @__PURE__ */ p("div", { className: "nice-field__control nice-field__control--slider", children: [
1077
+ /* @__PURE__ */ p(
1078
+ "div",
1079
+ {
1080
+ className: `nice-slider ${a || F ? "nice-slider--disabled" : ""} ${U ? "nice-slider--with-ticks" : ""}`,
1081
+ children: [
1082
+ /* @__PURE__ */ p("div", { className: "nice-slider__track-wrapper", children: [
1083
+ /* @__PURE__ */ e("div", { className: "nice-slider__track", children: /* @__PURE__ */ e("div", { className: "nice-slider__fill", style: { width: `${m}%` } }) }),
1084
+ U && ne.length > 0 && /* @__PURE__ */ e("div", { className: "nice-slider__ticks", "aria-hidden": "true", children: ne.map((h, O) => {
1085
+ const V = (h - D) / (x - D) * 100, be = h <= K;
1086
+ return /* @__PURE__ */ e(
1087
+ "span",
1088
+ {
1089
+ className: `nice-slider__tick ${be ? "nice-slider__tick--active" : ""}`,
1090
+ style: { left: `${V}%` },
1091
+ children: A && /* @__PURE__ */ e("span", { className: "nice-slider__tick-label", children: E ? E(h) : h })
1092
+ },
1093
+ O
1094
+ );
1095
+ }) }),
1096
+ /* @__PURE__ */ e(
1097
+ "input",
1098
+ {
1099
+ ref: J,
1100
+ id: f,
1101
+ type: "range",
1102
+ className: "nice-slider__native",
1103
+ min: D,
1104
+ max: x,
1105
+ step: z,
1106
+ value: K,
1107
+ disabled: a || F,
1108
+ "aria-valuenow": K,
1109
+ "aria-valuemin": D,
1110
+ "aria-valuemax": x,
1111
+ onChange: (h) => le?.(parseFloat(h.target.value))
1112
+ }
1113
+ ),
1114
+ /* @__PURE__ */ e("div", { className: "nice-slider__thumb-visual", style: { left: `${m}%` } })
1115
+ ] }),
1116
+ P && /* @__PURE__ */ p("div", { className: "nice-slider__labels", children: [
1117
+ /* @__PURE__ */ e("span", { children: E ? E(D) : D }),
1118
+ /* @__PURE__ */ e("span", { children: E ? E(x) : x })
1119
+ ] })
1120
+ ]
1121
+ }
1122
+ ),
1123
+ b && re && /* @__PURE__ */ e("span", { className: "nice-slider__value nice-slider__value--inline", children: y }),
1124
+ F && /* @__PURE__ */ e("span", { className: "nice-field__spinner nice-field__spinner--slider", children: /* @__PURE__ */ e("span", { className: "nice-spinner nice-spinner--sm" }) }),
1125
+ fe === "right" && t && /* @__PURE__ */ e("div", { className: "nice-field__error nice-field__error--slider", role: "alert", children: t }),
1126
+ fe === "right" && !t && i && /* @__PURE__ */ e("div", { className: "nice-field__helper nice-field__helper--slider", children: i })
1127
+ ] }),
1128
+ fe !== "right" && t && /* @__PURE__ */ e("div", { className: "nice-field__error", role: "alert", children: t }),
1129
+ fe !== "right" && !t && i && /* @__PURE__ */ e("div", { className: "nice-field__helper", children: i })
1130
+ ]
1131
+ }
1132
+ );
1133
+ }
1134
+ );
1135
+ Jn.displayName = "NiceSlider";
1136
+ const Oi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1137
+ __proto__: null,
1138
+ NiceSlider: Jn
1139
+ }, Symbol.toStringTag, { value: "Module" })), oi = ({
1140
+ options: n,
1141
+ suggestions: i,
1142
+ value: t,
1143
+ onChange: l,
1144
+ searchable: a = !0,
1145
+ clearable: o,
1146
+ maxTags: s,
1147
+ allowCustom: v,
1148
+ placeholder: C,
1149
+ label: K,
1150
+ error: le,
1151
+ helperText: D,
1152
+ required: x,
1153
+ disabled: z,
1154
+ size: re = "md",
1155
+ loading: P,
1156
+ id: E,
1157
+ className: k,
1158
+ style: H,
1159
+ accessMode: de,
1160
+ showKeyboardHints: G,
1161
+ labelPlacement: fe,
1162
+ errorPlacement: ce,
1163
+ labelWidth: w,
1164
+ controlWidth: F,
1165
+ readOnly: U,
1166
+ autoExpand: L = !1
1167
+ }) => {
1168
+ const Y = dn(de, E), A = Y === "hidden";
1169
+ (Y === "disabled" || Y === "readOnly") && (z = !0);
1170
+ const J = un(E), { t: R } = We(), [Q, ee] = $e(!1), [f, m] = $e(""), y = Ne(null), ne = Ne(null);
1171
+ It(y, () => ee(!1));
1172
+ const te = ve(
1173
+ () => [
1174
+ Ge.submit,
1175
+ Ge.cancel,
1176
+ { key: "Backspace", description: R("shortcuts.removeLastTag", "Remove last tag") }
1177
+ ],
1178
+ [R]
1179
+ ), b = ve(() => Array.isArray(n) && n.length > 0 ? n : Array.isArray(i) ? i.map((M) => ({ label: M, value: M })) : [], [n, i]), h = ve(() => Array.isArray(t) ? t : [], [t]), O = ve(() => {
1180
+ let M = b.filter((W) => !h.includes(String(W.value)));
1181
+ if (f) {
1182
+ const W = f.toLowerCase();
1183
+ M = M.filter((X) => X.label.toLowerCase().includes(W));
1184
+ }
1185
+ return M;
1186
+ }, [b, h, f]), V = I(
1187
+ (M) => {
1188
+ s && h.length >= s || (h.includes(M) || l([...h, M]), m(""));
1189
+ },
1190
+ [h, l, s]
1191
+ ), be = I(
1192
+ (M) => {
1193
+ l(h.filter((W) => W !== M));
1194
+ },
1195
+ [h, l]
1196
+ ), oe = (M) => {
1197
+ U || (M.key === "Backspace" && !f && h.length > 0 ? be(h[h.length - 1]) : M.key === "Enter" && f ? (M.preventDefault(), O.length > 0 ? V(String(O[0].value)) : v && V(f)) : M.key === "Escape" && ee(!1));
1198
+ }, ue = (M) => b.find((W) => String(W.value) === M)?.label ?? M;
1199
+ return A ? null : /* @__PURE__ */ p(
1200
+ "div",
1201
+ {
1202
+ className: `nice-field nice-field--${re} ${fe === "left" ? "nice-field--label-left" : ""} ${P ? "nice-field--loading" : ""} ${k || ""}`,
1203
+ style: {
1204
+ ...H,
1205
+ ...w != null && {
1206
+ "--nice-field-label-width": typeof w == "number" ? `${w}px` : w
1207
+ },
1208
+ ...F != null && {
1209
+ "--nice-field-control-width": typeof F == "number" ? `${F}px` : F
1210
+ }
1211
+ },
1212
+ ref: y,
1213
+ "aria-busy": P || void 0,
1214
+ children: [
1215
+ K && /* @__PURE__ */ p(
1216
+ "label",
1217
+ {
1218
+ className: `nice-field__label ${x ? "nice-field__label--required" : ""}`,
1219
+ htmlFor: J,
1220
+ children: [
1221
+ K,
1222
+ G && /* @__PURE__ */ e(_n, { shortcuts: te, size: "sm" })
1223
+ ]
1224
+ }
1225
+ ),
1226
+ /* @__PURE__ */ p("div", { className: "nice-field__control", children: [
1227
+ /* @__PURE__ */ p(
1228
+ "div",
1229
+ {
1230
+ className: `nice-tagbox nice-tagbox--${re} ${L ? "nice-tagbox--expand" : "nice-tagbox--fixed"} ${le ? "nice-tagbox--error" : ""} ${z ? "nice-tagbox--disabled" : ""} ${U ? "nice-tagbox--readonly" : ""}`,
1231
+ onClick: () => {
1232
+ !z && !P && !U && (ee(!0), ne.current?.focus());
1233
+ },
1234
+ style: {
1235
+ position: "relative",
1236
+ cursor: z || P ? "not-allowed" : U ? "default" : "text"
1237
+ },
1238
+ children: [
1239
+ /* @__PURE__ */ p("div", { className: "nice-tagbox__tags", children: [
1240
+ h.map((M) => /* @__PURE__ */ p("span", { className: "nice-tag nice-tagbox__tag", children: [
1241
+ ue(M),
1242
+ !z && !U && /* @__PURE__ */ e(
1243
+ "button",
1244
+ {
1245
+ type: "button",
1246
+ className: "nice-tag__remove",
1247
+ onClick: (W) => {
1248
+ W.stopPropagation(), be(M);
1249
+ },
1250
+ "aria-label": R("controls.remove", "Remove"),
1251
+ children: /* @__PURE__ */ e(Ee, { name: "close", size: 14 })
1252
+ }
1253
+ )
1254
+ ] }, M)),
1255
+ a && /* @__PURE__ */ e(
1256
+ "input",
1257
+ {
1258
+ ref: ne,
1259
+ id: J,
1260
+ type: "text",
1261
+ className: "nice-tagbox__input nice-input__native",
1262
+ value: f,
1263
+ onChange: (M) => {
1264
+ m(M.target.value), ee(!0);
1265
+ },
1266
+ onFocus: () => ee(!0),
1267
+ onKeyDown: oe,
1268
+ placeholder: h.length === 0 ? C || R("controls.select", "Select...") : "",
1269
+ disabled: z || P,
1270
+ readOnly: U,
1271
+ autoComplete: "off",
1272
+ style: {
1273
+ border: "none",
1274
+ outline: "none",
1275
+ background: "transparent",
1276
+ color: "inherit",
1277
+ flex: 1,
1278
+ minWidth: 80,
1279
+ padding: 0,
1280
+ font: "inherit",
1281
+ caretColor: "var(--nice-color-primary)"
1282
+ }
1283
+ }
1284
+ )
1285
+ ] }),
1286
+ o && h.length > 0 && !z && !U && /* @__PURE__ */ e(
1287
+ "button",
1288
+ {
1289
+ type: "button",
1290
+ className: "nice-input__clear",
1291
+ onClick: (M) => {
1292
+ M.stopPropagation(), l([]);
1293
+ },
1294
+ "aria-label": R("controls.clear", "Clear"),
1295
+ children: /* @__PURE__ */ e(Ee, { name: "close", size: 14 })
1296
+ }
1297
+ ),
1298
+ Q && (O.length > 0 || v && f) && /* @__PURE__ */ p("ul", { className: "nice-dropdown__list nice-tagbox__dropdown", role: "listbox", children: [
1299
+ O.map((M) => /* @__PURE__ */ e(
1300
+ "li",
1301
+ {
1302
+ role: "option",
1303
+ className: "nice-dropdown__option",
1304
+ onMouseDown: (W) => {
1305
+ W.preventDefault(), V(String(M.value));
1306
+ },
1307
+ children: M.label
1308
+ },
1309
+ String(M.value)
1310
+ )),
1311
+ v && f && !O.some((M) => String(M.value).toLowerCase() === f.toLowerCase()) && /* @__PURE__ */ p(
1312
+ "li",
1313
+ {
1314
+ role: "option",
1315
+ className: "nice-dropdown__option nice-dropdown__option--add",
1316
+ onMouseDown: (M) => {
1317
+ M.preventDefault(), V(f);
1318
+ },
1319
+ children: [
1320
+ "+ ",
1321
+ R("controls.add", "Add"),
1322
+ " “",
1323
+ f,
1324
+ "”"
1325
+ ]
1326
+ }
1327
+ )
1328
+ ] })
1329
+ ]
1330
+ }
1331
+ ),
1332
+ P && /* @__PURE__ */ e("span", { className: "nice-field__spinner", children: /* @__PURE__ */ e("span", { className: "nice-spinner nice-spinner--sm" }) }),
1333
+ ce === "right" && le && /* @__PURE__ */ e("div", { id: `${J}-error`, className: "nice-field__error", role: "alert", children: le }),
1334
+ ce === "right" && !le && D && /* @__PURE__ */ e("div", { id: `${J}-helper`, className: "nice-field__helper", children: D })
1335
+ ] }),
1336
+ ce !== "right" && le && /* @__PURE__ */ e("div", { id: `${J}-error`, className: "nice-field__error", role: "alert", children: le }),
1337
+ ce !== "right" && !le && D && /* @__PURE__ */ e("div", { id: `${J}-helper`, className: "nice-field__helper", children: D })
1338
+ ]
1339
+ }
1340
+ );
1341
+ }, Qn = bn(
1342
+ ({
1343
+ label: n,
1344
+ helperText: i,
1345
+ error: t,
1346
+ required: l,
1347
+ disabled: a,
1348
+ readOnly: o,
1349
+ size: s = "md",
1350
+ name: v,
1351
+ id: C,
1352
+ className: K,
1353
+ style: le,
1354
+ accessMode: D,
1355
+ displayStyle: x,
1356
+ value: z,
1357
+ defaultValue: re,
1358
+ onChange: P,
1359
+ onBlur: E,
1360
+ onKeyDown: k,
1361
+ placeholder: H,
1362
+ rows: de = 3,
1363
+ maxLength: G,
1364
+ resize: fe = "vertical",
1365
+ autoFocus: ce,
1366
+ showCount: w,
1367
+ counterPlacement: F = "bottom",
1368
+ submitOnEnter: U,
1369
+ onSubmit: L,
1370
+ showKeyboardHints: Y,
1371
+ labelPlacement: A,
1372
+ errorPlacement: J,
1373
+ loading: R,
1374
+ labelWidth: Q,
1375
+ controlWidth: ee,
1376
+ displayMode: f
1377
+ }, m) => {
1378
+ const y = dn(D, C), ne = y === "hidden";
1379
+ y === "disabled" && (a = !0), y === "readOnly" && (o = !0);
1380
+ const { t: te } = We(), b = un(C), h = qn("input", x), O = Un("input", x), V = z?.length ?? 0, be = G ? V > G : !1, oe = Et({ enabled: f, readOnly: o, disabled: a }), ue = {
1381
+ key: "Enter",
1382
+ ctrl: !0,
1383
+ description: te("shortcuts.submit", "Submit")
1384
+ }, M = I(
1385
+ (X) => {
1386
+ U && Ft(X, ue) && (X.preventDefault(), L?.()), k?.(X);
1387
+ },
1388
+ [U, L, k, ue]
1389
+ ), W = ve(() => {
1390
+ const X = [];
1391
+ return U && X.push(ue), X.push({ key: "Tab", description: te("shortcuts.indent", "Indent (when supported)") }), X;
1392
+ }, [U, te, ue]);
1393
+ return ne ? null : /* @__PURE__ */ p(
1394
+ "div",
1395
+ {
1396
+ className: `nice-field nice-field--${s} ${A === "left" ? "nice-field--label-left" : ""} ${R ? "nice-field--loading" : ""} ${K || ""}`,
1397
+ style: {
1398
+ ...le,
1399
+ ...Q != null && {
1400
+ "--nice-field-label-width": typeof Q == "number" ? `${Q}px` : Q
1401
+ },
1402
+ ...ee != null && {
1403
+ "--nice-field-control-width": typeof ee == "number" ? `${ee}px` : ee
1404
+ }
1405
+ },
1406
+ "aria-busy": R || void 0,
1407
+ children: [
1408
+ n && /* @__PURE__ */ p(
1409
+ "label",
1410
+ {
1411
+ htmlFor: b,
1412
+ className: `nice-field__label ${l ? "nice-field__label--required" : ""}`,
1413
+ children: [
1414
+ n,
1415
+ Y && W.length > 0 && /* @__PURE__ */ e(_n, { shortcuts: W, size: "sm" })
1416
+ ]
1417
+ }
1418
+ ),
1419
+ /* @__PURE__ */ p("div", { className: "nice-field__control nice-field__control--textarea", children: [
1420
+ oe.isDisplay ? /* @__PURE__ */ e(
1421
+ Lt,
1422
+ {
1423
+ value: z ?? re ?? "",
1424
+ placeholder: H,
1425
+ disabled: a,
1426
+ readOnly: o,
1427
+ onActivate: oe.enterEdit,
1428
+ ariaLabel: n,
1429
+ className: "nice-display-value--textarea"
1430
+ }
1431
+ ) : /* @__PURE__ */ p(vn, { children: [
1432
+ /* @__PURE__ */ p(
1433
+ "div",
1434
+ {
1435
+ style: { display: "flex", flexDirection: "column", flex: "1 1 auto", minWidth: 0 },
1436
+ children: [
1437
+ /* @__PURE__ */ e(
1438
+ "textarea",
1439
+ {
1440
+ ref: (X) => {
1441
+ typeof m == "function" ? m(X) : m && (m.current = X), oe.autoFocusRef(X);
1442
+ },
1443
+ id: b,
1444
+ className: `nice-textarea nice-input--${s} nice-textarea--ds-${O} ${t ? "nice-textarea--error" : ""} ${a ? "nice-textarea--disabled" : ""}`,
1445
+ style: { ...h, resize: fe },
1446
+ name: v,
1447
+ value: z,
1448
+ defaultValue: re,
1449
+ placeholder: H,
1450
+ rows: de,
1451
+ maxLength: G,
1452
+ disabled: a || R,
1453
+ readOnly: o,
1454
+ autoFocus: ce,
1455
+ "aria-invalid": !!t,
1456
+ "aria-describedby": t ? `${b}-error` : i ? `${b}-helper` : void 0,
1457
+ onChange: (X) => P?.(X.target.value),
1458
+ onBlur: (X) => {
1459
+ f && oe.exitEdit(), E?.(X);
1460
+ },
1461
+ onKeyDown: M
1462
+ }
1463
+ ),
1464
+ F !== "right" && (w || G) && /* @__PURE__ */ p(
1465
+ "div",
1466
+ {
1467
+ className: `nice-textarea__counter ${be ? "nice-textarea__counter--over" : ""}`,
1468
+ children: [
1469
+ V,
1470
+ G ? ` / ${G}` : ""
1471
+ ]
1472
+ }
1473
+ )
1474
+ ]
1475
+ }
1476
+ ),
1477
+ F === "right" && (w || G) && /* @__PURE__ */ p(
1478
+ "div",
1479
+ {
1480
+ className: `nice-textarea__counter nice-textarea__counter--right ${be ? "nice-textarea__counter--over" : ""}`,
1481
+ children: [
1482
+ V,
1483
+ G ? ` / ${G}` : ""
1484
+ ]
1485
+ }
1486
+ )
1487
+ ] }),
1488
+ R && /* @__PURE__ */ e("span", { className: "nice-field__spinner nice-field__spinner--textarea", children: /* @__PURE__ */ e("span", { className: "nice-spinner nice-spinner--sm" }) }),
1489
+ J === "right" && t && /* @__PURE__ */ e("div", { id: `${b}-error`, className: "nice-field__error", role: "alert", children: t }),
1490
+ J === "right" && !t && i && /* @__PURE__ */ e("div", { id: `${b}-helper`, className: "nice-field__helper", children: i })
1491
+ ] }),
1492
+ J !== "right" && t && /* @__PURE__ */ e("div", { id: `${b}-error`, className: "nice-field__error", role: "alert", children: t }),
1493
+ J !== "right" && !t && i && /* @__PURE__ */ e("div", { id: `${b}-helper`, className: "nice-field__helper", children: i })
1494
+ ]
1495
+ }
1496
+ );
1497
+ }
1498
+ );
1499
+ Qn.displayName = "NiceTextArea";
1500
+ const qi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1501
+ __proto__: null,
1502
+ NiceTextArea: Qn
1503
+ }, Symbol.toStringTag, { value: "Module" })), si = () => `file-${Date.now()}-${Math.random().toString(36).slice(2, 11)}`, jn = (n) => {
1504
+ if (n === 0)
1505
+ return "0 B";
1506
+ const i = 1024, t = ["B", "KB", "MB", "GB", "TB"], l = Math.floor(Math.log(n) / Math.log(i));
1507
+ return `${parseFloat((n / Math.pow(i, l)).toFixed(2))} ${t[l]}`;
1508
+ }, Xn = (n) => n.startsWith("image/"), Wn = (n) => n.startsWith("video/"), bt = (n) => n.startsWith("audio/"), di = (n) => Xn(n) ? "image" : Wn(n) ? "video" : bt(n) ? "music" : /pdf|word|document|text|json|xml/.test(n) ? "file" : /excel|spreadsheet/.test(n) ? "table" : /powerpoint|presentation/.test(n) ? "monitor" : /zip|rar|7z/.test(n) ? "box" : "folder", ui = (n) => {
1509
+ if (Xn(n.type) || Wn(n.type) || bt(n.type))
1510
+ return URL.createObjectURL(n);
1511
+ }, pi = {
1512
+ xxs: 24,
1513
+ xs: 32,
1514
+ sm: 48,
1515
+ md: 80,
1516
+ lg: 120,
1517
+ xl: 160,
1518
+ xxl: 200
1519
+ }, fi = (n, i) => (t) => {
1520
+ const l = new FormData();
1521
+ t.chunk ? (l.append("chunk", t.chunk), l.append("chunkIndex", String(t.chunkIndex)), l.append("totalChunks", String(t.totalChunks)), l.append("fileName", t.file.name), l.append("fileId", t.fileId || "")) : l.append("file", t.file);
1522
+ const a = new XMLHttpRequest();
1523
+ return new Promise((o) => {
1524
+ a.upload.addEventListener("progress", (s) => {
1525
+ s.lengthComputable && t.onProgress && t.onProgress(s.loaded / s.total * 100);
1526
+ }), a.addEventListener("load", () => {
1527
+ if (a.status >= 200 && a.status < 300)
1528
+ try {
1529
+ const s = JSON.parse(a.responseText);
1530
+ o({
1531
+ success: !0,
1532
+ url: s.url,
1533
+ fileId: s.fileId || s.id,
1534
+ metadata: s
1535
+ });
1536
+ } catch {
1537
+ o({ success: !0, url: a.responseText });
1538
+ }
1539
+ else
1540
+ o({ success: !1, error: `Upload failed: ${a.status} ${a.statusText}` });
1541
+ }), a.addEventListener("error", () => o({ success: !1, error: "Network error" })), a.addEventListener("abort", () => o({ success: !1, error: "Upload cancelled" })), t.signal && t.signal.addEventListener("abort", () => a.abort()), a.open("POST", n), i && Object.entries(i).forEach(([s, v]) => a.setRequestHeader(s, v)), a.send(l);
1542
+ });
1543
+ }, Nt = bn((n, i) => {
1544
+ const {
1545
+ accept: t,
1546
+ multiple: l = !0,
1547
+ maxFileSize: a,
1548
+ maxFiles: o,
1549
+ minFileSize: s,
1550
+ onFilesSelected: v,
1551
+ uploadMode: C = "instant",
1552
+ labelText: K,
1553
+ text: le,
1554
+ dropzoneText: D,
1555
+ browseText: x,
1556
+ dragActiveText: z,
1557
+ labelPlacement: re = "right",
1558
+ icon: P = "upload",
1559
+ showFileList: E = !0,
1560
+ imagePreview: k,
1561
+ showPreview: H = !0,
1562
+ listMode: de = "list",
1563
+ previewSize: G = "md",
1564
+ fileProgress: fe,
1565
+ renderPreview: ce,
1566
+ renderFileItem: w,
1567
+ variant: F = "dropzone",
1568
+ trigger: U,
1569
+ dropChildren: L,
1570
+ autoUpload: Y = !1,
1571
+ uploadHandler: A,
1572
+ uploadUrl: J,
1573
+ uploadHeaders: R,
1574
+ concurrentUploads: Q = 3,
1575
+ maxRetries: ee = 3,
1576
+ chunkSize: f = 5 * 1024 * 1024,
1577
+ chunkThreshold: m = 10 * 1024 * 1024,
1578
+ validateFile: y,
1579
+ keepFilesAfterUpload: ne = !0,
1580
+ initialFiles: te,
1581
+ disabled: b,
1582
+ readOnly: h,
1583
+ onFilesAdded: O,
1584
+ onUploadComplete: V,
1585
+ onUploadError: be,
1586
+ onProgress: oe,
1587
+ onFileRemoved: ue,
1588
+ onChange: M,
1589
+ apiRef: W,
1590
+ pasteFromClipboard: X,
1591
+ className: we,
1592
+ style: ze
1593
+ } = n, { t: B } = We(), [ye, j] = $e(() => te ?? []), [Ue, g] = $e(!1), T = Ne(ye), d = Ne(null), pe = Ne(/* @__PURE__ */ new Map()), q = Ne([]), ie = Ne(/* @__PURE__ */ new Set()), N = Ne(0), Ke = Ne(() => {
1594
+ }), qe = Ne(M), en = !!(A || J);
1595
+ Ie(() => {
1596
+ T.current = ye;
1597
+ }, [ye]), Ie(() => {
1598
+ qe.current = M;
1599
+ }), Ie(() => {
1600
+ qe.current?.(ye);
1601
+ }, [ye]), Ie(
1602
+ () => () => {
1603
+ T.current.forEach((r) => r.previewUrl && URL.revokeObjectURL(r.previewUrl));
1604
+ },
1605
+ []
1606
+ );
1607
+ const Ye = I(
1608
+ (r) => v(r.map((Z) => Z.file)),
1609
+ [v]
1610
+ ), ae = I(
1611
+ (r) => {
1612
+ if (y) {
1613
+ const Z = y(r);
1614
+ if (Z)
1615
+ return Z;
1616
+ }
1617
+ if (a && r.size > a)
1618
+ return B("fileUpload.error.tooLarge", "File is too large. Maximum size: {size}").replace(
1619
+ "{size}",
1620
+ jn(a)
1621
+ );
1622
+ if (s && r.size < s)
1623
+ return B("fileUpload.error.tooSmall", "File is too small. Minimum size: {size}").replace(
1624
+ "{size}",
1625
+ jn(s)
1626
+ );
1627
+ if (t) {
1628
+ const Z = t.split(",").map((me) => me.trim().toLowerCase()), se = r.type.toLowerCase(), Me = "." + (r.name.split(".").pop()?.toLowerCase() ?? "");
1629
+ if (!Z.some((me) => me.startsWith(".") ? Me === me : me.endsWith("/*") ? se.startsWith(me.replace("/*", "/")) : se === me))
1630
+ return B(
1631
+ "fileUpload.error.badType",
1632
+ "File type not allowed. Accepted types: {accept}"
1633
+ ).replace("{accept}", t);
1634
+ }
1635
+ return null;
1636
+ },
1637
+ [y, a, s, t, B]
1638
+ ), xe = I(() => A || (J ? fi(J, R) : null), [A, J, R]), Xe = I(
1639
+ async (r, Z, se) => {
1640
+ const Me = r.file, Te = Math.ceil(Me.size / f);
1641
+ let me = 0, Le = { success: !1 };
1642
+ for (let Re = 0; Re < Te; Re++) {
1643
+ if (se.aborted)
1644
+ throw new Error("Upload cancelled");
1645
+ const Qe = Re * f, Fn = Math.min(Qe + f, Me.size), mn = Me.slice(Qe, Fn);
1646
+ let hn = 0, an = !1;
1647
+ for (; !an && hn < ee; )
1648
+ try {
1649
+ Le = await Z({
1650
+ file: Me,
1651
+ chunk: mn,
1652
+ chunkIndex: Re,
1653
+ totalChunks: Te,
1654
+ fileId: r.id,
1655
+ onProgress: (gn) => {
1656
+ const Mn = (me + mn.size * gn / 100) / Me.size * 100;
1657
+ j(
1658
+ (Gn) => Gn.map(($n) => $n.id === r.id ? { ...$n, progress: Mn } : $n)
1659
+ );
1660
+ },
1661
+ signal: se
1662
+ }), Le.success ? (an = !0, me += mn.size) : hn++;
1663
+ } catch (gn) {
1664
+ if (hn++, hn >= ee)
1665
+ throw gn;
1666
+ }
1667
+ if (!an)
1668
+ throw new Error(`Failed to upload chunk ${Re + 1}/${Te}`);
1669
+ }
1670
+ return Le;
1671
+ },
1672
+ [f, ee]
1673
+ ), nn = I(
1674
+ async (r, Z) => {
1675
+ const se = T.current.find((Te) => Te.id === r);
1676
+ if (!se || se.status === "uploading" || se.status === "success")
1677
+ return;
1678
+ const Me = new AbortController();
1679
+ pe.current.set(r, Me), ie.current.add(r), j(
1680
+ (Te) => Te.map(
1681
+ (me) => me.id === r ? { ...me, status: "uploading", progress: 0, error: void 0 } : me
1682
+ )
1683
+ );
1684
+ try {
1685
+ const Te = se.file;
1686
+ let me;
1687
+ if (Te.size > m ? me = await Xe(se, Z, Me.signal) : me = await Z({
1688
+ file: Te,
1689
+ onProgress: (Le) => {
1690
+ j((Re) => Re.map((Qe) => Qe.id === r ? { ...Qe, progress: Le } : Qe)), oe?.(se, Le);
1691
+ },
1692
+ signal: Me.signal
1693
+ }), me.success) {
1694
+ if (j(
1695
+ (Le) => Le.map(
1696
+ (Re) => Re.id === r ? {
1697
+ ...Re,
1698
+ status: "success",
1699
+ progress: 100,
1700
+ uploadedUrl: me.url,
1701
+ uploadedAt: /* @__PURE__ */ new Date()
1702
+ } : Re
1703
+ )
1704
+ ), V?.({ ...se, status: "success", uploadedUrl: me.url }), !ne) {
1705
+ const Le = T.current.find((Re) => Re.id === r);
1706
+ Le?.previewUrl && URL.revokeObjectURL(Le.previewUrl), j((Re) => Re.filter((Qe) => Qe.id !== r));
1707
+ }
1708
+ } else
1709
+ throw new Error(me.error || "Upload failed");
1710
+ } catch (Te) {
1711
+ const me = Te;
1712
+ if (me.name === "AbortError" || me.message === "Upload cancelled")
1713
+ j(
1714
+ (Le) => Le.map(
1715
+ (Re) => Re.id === r ? {
1716
+ ...Re,
1717
+ status: "cancelled",
1718
+ error: B("fileUpload.status.cancelled", "Cancelled")
1719
+ } : Re
1720
+ )
1721
+ );
1722
+ else {
1723
+ const Le = me.message || B("fileUpload.error.generic", "Upload error");
1724
+ j(
1725
+ (Re) => Re.map((Qe) => Qe.id === r ? { ...Qe, status: "error", error: Le } : Qe)
1726
+ ), be?.(se, Le);
1727
+ }
1728
+ } finally {
1729
+ pe.current.delete(r), ie.current.delete(r), Ke.current();
1730
+ }
1731
+ },
1732
+ [
1733
+ m,
1734
+ Xe,
1735
+ oe,
1736
+ V,
1737
+ be,
1738
+ ne,
1739
+ B
1740
+ ]
1741
+ ), pn = Ne(nn);
1742
+ Ie(() => {
1743
+ pn.current = nn;
1744
+ });
1745
+ const Ze = I(() => {
1746
+ const r = xe();
1747
+ if (r)
1748
+ for (; q.current.length > 0 && ie.current.size < Q; ) {
1749
+ const Z = q.current.shift();
1750
+ Z && pn.current(Z, r);
1751
+ }
1752
+ }, [xe, Q]);
1753
+ Ie(() => {
1754
+ Ke.current = Ze;
1755
+ });
1756
+ const ke = I(
1757
+ (r) => {
1758
+ const Z = xe();
1759
+ if (!Z) {
1760
+ console.error("No upload handler configured");
1761
+ return;
1762
+ }
1763
+ pn.current(r, Z);
1764
+ },
1765
+ [xe]
1766
+ ), fn = I(
1767
+ (r) => {
1768
+ pe.current.get(r)?.abort(), j(
1769
+ (Z) => Z.map(
1770
+ (se) => se.id === r && se.status === "uploading" ? { ...se, status: "cancelled", error: B("fileUpload.status.cancelled", "Cancelled") } : se
1771
+ )
1772
+ );
1773
+ },
1774
+ [B]
1775
+ ), $ = I(
1776
+ (r) => {
1777
+ j(
1778
+ (Z) => Z.map(
1779
+ (se) => se.id === r ? { ...se, status: "pending", progress: 0, error: void 0 } : se
1780
+ )
1781
+ ), ke(r);
1782
+ },
1783
+ [ke]
1784
+ ), u = I(
1785
+ (r) => {
1786
+ const Z = T.current.find((Me) => Me.id === r);
1787
+ if (!Z)
1788
+ return;
1789
+ pe.current.get(r)?.abort(), Z.previewUrl && URL.revokeObjectURL(Z.previewUrl);
1790
+ const se = T.current.filter((Me) => Me.id !== r);
1791
+ T.current = se, j((Me) => Me.filter((Te) => Te.id !== r)), ue?.(Z), C === "instant" && Ye(se);
1792
+ },
1793
+ [ue, C, Ye]
1794
+ ), he = I(() => {
1795
+ T.current.filter((r) => r.status === "pending").forEach((r) => q.current.push(r.id)), Ze();
1796
+ }, [Ze]), Ve = I(() => {
1797
+ pe.current.forEach((r) => r.abort()), j(
1798
+ (r) => r.map(
1799
+ (Z) => Z.status === "uploading" ? { ...Z, status: "cancelled", error: B("fileUpload.status.cancelled", "Cancelled") } : Z
1800
+ )
1801
+ );
1802
+ }, [B]), Fe = I(() => {
1803
+ Ve(), T.current.forEach((r) => r.previewUrl && URL.revokeObjectURL(r.previewUrl)), j([]), C === "instant" && Ye([]);
1804
+ }, [Ve, C, Ye]), Oe = I(() => {
1805
+ T.current.filter((r) => r.status === "error").forEach((r) => $(r.id));
1806
+ }, [$]), je = I(
1807
+ (r) => {
1808
+ if (b || h)
1809
+ return;
1810
+ const Z = T.current;
1811
+ let se = l ? r : r.slice(0, 1);
1812
+ o && (se = se.slice(0, Math.max(0, o - Z.length)));
1813
+ const Me = se.map((me) => {
1814
+ const Le = ae(me);
1815
+ return {
1816
+ id: si(),
1817
+ file: me,
1818
+ name: me.name,
1819
+ size: me.size,
1820
+ type: me.type,
1821
+ status: Le ? "error" : "pending",
1822
+ progress: 0,
1823
+ error: Le || void 0,
1824
+ previewUrl: ui(me)
1825
+ };
1826
+ }), Te = l ? [...Z, ...Me] : Me;
1827
+ j(Te), T.current = Te, O?.(Me), C === "instant" && Ye(Te), Y && (Me.filter((me) => me.status === "pending").forEach((me) => q.current.push(me.id)), Ze());
1828
+ },
1829
+ [
1830
+ b,
1831
+ h,
1832
+ l,
1833
+ o,
1834
+ ae,
1835
+ O,
1836
+ C,
1837
+ Ye,
1838
+ Y,
1839
+ Ze
1840
+ ]
1841
+ ), tn = I(() => d.current?.click(), []);
1842
+ Gt(
1843
+ W,
1844
+ () => ({
1845
+ addFiles: je,
1846
+ uploadAll: he,
1847
+ cancelAll: Ve,
1848
+ clearAll: Fe,
1849
+ getFiles: () => T.current,
1850
+ getFile: (r) => T.current.find((Z) => Z.id === r),
1851
+ retryFailed: Oe,
1852
+ openFileBrowser: tn
1853
+ }),
1854
+ [je, he, Ve, Fe, Oe, tn]
1855
+ ), Ie(() => {
1856
+ if (!X || b || h)
1857
+ return;
1858
+ const r = (Z) => {
1859
+ const se = Z.clipboardData?.items;
1860
+ if (!se)
1861
+ return;
1862
+ const Me = [];
1863
+ for (let Te = 0; Te < se.length; Te++)
1864
+ if (se[Te].kind === "file") {
1865
+ const me = se[Te].getAsFile();
1866
+ me && Me.push(me);
1867
+ }
1868
+ Me.length > 0 && (Z.preventDefault(), je(Me));
1869
+ };
1870
+ return document.addEventListener("paste", r), () => document.removeEventListener("paste", r);
1871
+ }, [X, b, h, je]);
1872
+ const Rn = (r) => {
1873
+ r.preventDefault(), !(b || h) && (N.current++, g(!0));
1874
+ }, Dn = (r) => {
1875
+ r.preventDefault(), N.current--, N.current <= 0 && (N.current = 0, g(!1));
1876
+ }, zn = (r) => {
1877
+ r.preventDefault(), N.current = 0, g(!1), !(b || h) && je(Array.from(r.dataTransfer.files));
1878
+ }, In = (r) => {
1879
+ r.target.files && je(Array.from(r.target.files)), r.target.value = "";
1880
+ }, Pe = ve(() => {
1881
+ const r = { total: ye.length, pending: 0, uploading: 0, success: 0, error: 0 };
1882
+ for (const Z of ye)
1883
+ Z.status === "pending" ? r.pending++ : Z.status === "uploading" ? r.uploading++ : Z.status === "success" ? r.success++ : Z.status === "error" && r.error++;
1884
+ return r;
1885
+ }, [ye]), rn = K ?? le ?? D ?? B("dropOrClick", "Drop files here or click to browse"), cn = z ?? B("fileUpload.dropzone.dragActive", "Drop files here"), Nn = (r) => B(
1886
+ `fileUpload.status.${r}`,
1887
+ {
1888
+ pending: "Pending",
1889
+ uploading: "Uploading…",
1890
+ success: "Uploaded",
1891
+ error: "Error",
1892
+ cancelled: "Cancelled"
1893
+ }[r]
1894
+ ), Pn = (r) => en || r.status !== "pending", Bn = (r) => {
1895
+ if (ce)
1896
+ return ce(r);
1897
+ const Z = pi[G] ?? 80, se = k ?? H;
1898
+ return se && r.previewUrl && Xn(r.type) ? /* @__PURE__ */ e(
1899
+ "img",
1900
+ {
1901
+ src: r.previewUrl,
1902
+ alt: r.name,
1903
+ className: "nice-fileuploader__thumb nice-upload__thumb nice-upload__preview",
1904
+ style: { width: Z, height: Z, objectFit: "cover" }
1905
+ }
1906
+ ) : se && r.previewUrl && Wn(r.type) ? /* @__PURE__ */ p(
1907
+ "span",
1908
+ {
1909
+ className: "nice-upload__preview",
1910
+ style: { position: "relative", display: "inline-flex" },
1911
+ children: [
1912
+ /* @__PURE__ */ e("video", { src: r.previewUrl, muted: !0, style: { width: Z, height: Z, objectFit: "cover" } }),
1913
+ /* @__PURE__ */ e("span", { className: "nice-upload__preview-overlay", "aria-hidden": "true", children: /* @__PURE__ */ e(Ee, { name: "play", size: 20 }) })
1914
+ ]
1915
+ }
1916
+ ) : /* @__PURE__ */ e("span", { className: "nice-upload__preview nice-upload__preview--icon", "aria-hidden": "true", children: /* @__PURE__ */ e(Ee, { name: di(r.type), size: Math.round(Z * 0.5) }) });
1917
+ }, Hn = (r) => {
1918
+ const Z = {
1919
+ upload: () => ke(r.id),
1920
+ cancel: () => fn(r.id),
1921
+ retry: () => $(r.id),
1922
+ remove: () => u(r.id)
1923
+ };
1924
+ if (w)
1925
+ return /* @__PURE__ */ e(An.Fragment, { children: w(r, Z) }, r.id);
1926
+ const se = fe?.[r.name] ?? r.progress, Me = Pn(r);
1927
+ return /* @__PURE__ */ p(
1928
+ "div",
1929
+ {
1930
+ className: `nice-fileuploader__file nice-upload__file nice-upload__item nice-upload__item--${r.status}`,
1931
+ children: [
1932
+ (k ?? H) && Bn(r),
1933
+ /* @__PURE__ */ e("span", { className: "nice-fileuploader__filename nice-upload__filename", title: r.name, children: r.name }),
1934
+ /* @__PURE__ */ e("span", { className: "nice-fileuploader__filesize nice-upload__filesize", children: jn(r.size) }),
1935
+ Me && /* @__PURE__ */ e("span", { className: `nice-upload__badge nice-upload__badge--${r.status}`, children: Nn(r.status) }),
1936
+ (r.status === "uploading" || se != null && se > 0 && se < 100) && /* @__PURE__ */ e("div", { className: "nice-fileuploader__progress nice-upload__progress", children: /* @__PURE__ */ e(
1937
+ "div",
1938
+ {
1939
+ className: "nice-fileuploader__progress-bar nice-upload__progress-bar",
1940
+ style: { width: `${Math.min(100, Math.max(0, se))}%` }
1941
+ }
1942
+ ) }),
1943
+ r.error && r.status === "error" && /* @__PURE__ */ e("span", { className: "nice-upload__item-error", children: r.error }),
1944
+ r.uploadedUrl && /* @__PURE__ */ e(
1945
+ "a",
1946
+ {
1947
+ className: "nice-upload__link",
1948
+ href: r.uploadedUrl,
1949
+ target: "_blank",
1950
+ rel: "noopener noreferrer",
1951
+ children: B("fileUpload.openFile", "Open file")
1952
+ }
1953
+ ),
1954
+ !h && !b && /* @__PURE__ */ p("span", { className: "nice-upload__item-actions", children: [
1955
+ en && r.status === "pending" && /* @__PURE__ */ e(
1956
+ "button",
1957
+ {
1958
+ type: "button",
1959
+ className: "nice-upload__btn nice-upload__btn--upload",
1960
+ onClick: Z.upload,
1961
+ title: B("fileUpload.action.upload", "Upload"),
1962
+ "aria-label": B("fileUpload.action.upload", "Upload"),
1963
+ children: /* @__PURE__ */ e(Ee, { name: "upload", size: 14 })
1964
+ }
1965
+ ),
1966
+ r.status === "uploading" && /* @__PURE__ */ e(
1967
+ "button",
1968
+ {
1969
+ type: "button",
1970
+ className: "nice-upload__btn nice-upload__btn--cancel",
1971
+ onClick: Z.cancel,
1972
+ title: B("fileUpload.action.cancel", "Cancel"),
1973
+ "aria-label": B("fileUpload.action.cancel", "Cancel"),
1974
+ children: /* @__PURE__ */ e(Ee, { name: "stop", size: 14 })
1975
+ }
1976
+ ),
1977
+ en && r.status === "error" && /* @__PURE__ */ e(
1978
+ "button",
1979
+ {
1980
+ type: "button",
1981
+ className: "nice-upload__btn nice-upload__btn--retry",
1982
+ onClick: Z.retry,
1983
+ title: B("fileUpload.action.retry", "Retry"),
1984
+ "aria-label": B("fileUpload.action.retry", "Retry"),
1985
+ children: /* @__PURE__ */ e(Ee, { name: "refresh", size: 14 })
1986
+ }
1987
+ ),
1988
+ r.status !== "uploading" && /* @__PURE__ */ e(
1989
+ "button",
1990
+ {
1991
+ type: "button",
1992
+ className: "nice-fileuploader__remove nice-upload__remove nice-upload__btn nice-upload__btn--remove",
1993
+ onClick: Z.remove,
1994
+ title: B("remove", "Remove"),
1995
+ "aria-label": B("remove", "Remove"),
1996
+ children: /* @__PURE__ */ e(Ee, { name: "close", size: 14 })
1997
+ }
1998
+ )
1999
+ ] })
2000
+ ]
2001
+ },
2002
+ r.id
2003
+ );
2004
+ }, Cn = (r) => {
2005
+ (r.key === "Enter" || r.key === " ") && (r.preventDefault(), tn());
2006
+ }, En = /* @__PURE__ */ e(
2007
+ "input",
2008
+ {
2009
+ ref: d,
2010
+ type: "file",
2011
+ accept: t,
2012
+ multiple: l,
2013
+ hidden: !0,
2014
+ disabled: b,
2015
+ onChange: In
2016
+ }
2017
+ );
2018
+ return /* @__PURE__ */ p(
2019
+ "div",
2020
+ {
2021
+ ref: i,
2022
+ className: `nice-fileuploader nice-upload ${b ? "nice-fileuploader--disabled nice-upload--disabled" : ""} ${h ? "nice-upload--readonly" : ""} ${we || ""}`,
2023
+ style: ze,
2024
+ children: [
2025
+ F === "button" ? /* @__PURE__ */ p(vn, { children: [
2026
+ /* @__PURE__ */ e(
2027
+ "button",
2028
+ {
2029
+ type: "button",
2030
+ className: "nice-upload__trigger nice-btn nice-btn--primary",
2031
+ onClick: tn,
2032
+ disabled: b || h,
2033
+ children: U ?? B("filePicker.label", "Choose files")
2034
+ }
2035
+ ),
2036
+ En
2037
+ ] }) : !h && /* @__PURE__ */ p(
2038
+ "div",
2039
+ {
2040
+ className: `nice-fileuploader__dropzone nice-upload__dropzone nice-upload__dropzone--label-${re} ${!L && !rn ? "nice-upload__dropzone--icon-only" : ""} ${Ue ? "nice-fileuploader__dropzone--active nice-upload__dropzone--active" : ""}`,
2041
+ role: "button",
2042
+ tabIndex: b ? -1 : 0,
2043
+ "aria-disabled": b || void 0,
2044
+ onDragEnter: Rn,
2045
+ onDragOver: (r) => r.preventDefault(),
2046
+ onDragLeave: Dn,
2047
+ onDrop: zn,
2048
+ onClick: () => !b && tn(),
2049
+ onKeyDown: Cn,
2050
+ children: [
2051
+ En,
2052
+ L ?? /* @__PURE__ */ p(vn, { children: [
2053
+ P && /* @__PURE__ */ e("div", { className: "nice-upload__icon", "aria-hidden": "true", children: /* @__PURE__ */ e(Ee, { name: P, size: "lg" }) }),
2054
+ (Ue ? cn : rn) && /* @__PURE__ */ p("div", { className: "nice-fileuploader__label nice-upload__label", children: [
2055
+ Ue ? cn : rn,
2056
+ x && /* @__PURE__ */ p("span", { className: "nice-upload__browse", children: [
2057
+ " ",
2058
+ x
2059
+ ] })
2060
+ ] })
2061
+ ] })
2062
+ ]
2063
+ }
2064
+ ),
2065
+ E && ye.length > 0 && /* @__PURE__ */ e("div", { className: `nice-fileuploader__list nice-upload__list nice-upload__list--${de}`, children: ye.map(Hn) }),
2066
+ en && ye.length > 0 && !h && /* @__PURE__ */ p("div", { className: "nice-upload__bulk", children: [
2067
+ Pe.pending > 0 && /* @__PURE__ */ e(
2068
+ "button",
2069
+ {
2070
+ type: "button",
2071
+ className: "nice-btn nice-btn--primary nice-btn--sm",
2072
+ onClick: he,
2073
+ children: B("fileUpload.bulk.uploadAll", "Upload all ({n})").replace(
2074
+ "{n}",
2075
+ String(Pe.pending)
2076
+ )
2077
+ }
2078
+ ),
2079
+ Pe.error > 0 && /* @__PURE__ */ e("button", { type: "button", className: "nice-btn nice-btn--sm", onClick: Oe, children: B("fileUpload.bulk.retryFailed", "Retry failed ({n})").replace(
2080
+ "{n}",
2081
+ String(Pe.error)
2082
+ ) }),
2083
+ /* @__PURE__ */ e("button", { type: "button", className: "nice-btn nice-btn--sm", onClick: Fe, children: B("fileUpload.bulk.clear", "Clear") })
2084
+ ] }),
2085
+ !en && C === "useButtons" && ye.length > 0 && !h && /* @__PURE__ */ p("div", { className: "nice-fileuploader__actions nice-upload__actions", children: [
2086
+ /* @__PURE__ */ e(
2087
+ "button",
2088
+ {
2089
+ type: "button",
2090
+ className: "nice-btn nice-btn--primary nice-btn--sm",
2091
+ onClick: () => Ye(T.current),
2092
+ children: B("upload", "Upload")
2093
+ }
2094
+ ),
2095
+ /* @__PURE__ */ e("button", { type: "button", className: "nice-btn nice-btn--sm", onClick: Fe, children: B("clearAll", "Clear All") })
2096
+ ] })
2097
+ ]
2098
+ }
2099
+ );
2100
+ });
2101
+ Nt.displayName = "NiceUpload";
2102
+ const mi = [
2103
+ { label: "Polska", value: "PL" },
2104
+ { label: "Deutschland", value: "DE" },
2105
+ { label: "Česko", value: "CZ" },
2106
+ { label: "Slovensko", value: "SK" },
2107
+ { label: "United Kingdom", value: "GB" },
2108
+ { label: "United States", value: "US" },
2109
+ { label: "France", value: "FR" },
2110
+ { label: "Italia", value: "IT" },
2111
+ { label: "España", value: "ES" },
2112
+ { label: "Nederland", value: "NL" }
2113
+ ], Ct = ({
2114
+ label: n,
2115
+ helperText: i,
2116
+ error: t,
2117
+ errorPlacement: l = "bottom",
2118
+ required: a,
2119
+ disabled: o,
2120
+ readOnly: s,
2121
+ loading: v,
2122
+ size: C = "md",
2123
+ className: K,
2124
+ style: le,
2125
+ accessMode: D,
2126
+ id: x,
2127
+ value: z,
2128
+ defaultValue: re,
2129
+ onChange: P,
2130
+ columns: E = 2,
2131
+ showState: k = !1,
2132
+ showBuilding: H = !0,
2133
+ showApartment: de = !0,
2134
+ showCountry: G = !0,
2135
+ countryOptions: fe = mi,
2136
+ defaultCountry: ce = "PL",
2137
+ fieldLabels: w,
2138
+ fieldPlaceholders: F,
2139
+ showLabel: U = !0,
2140
+ labelPlacement: L,
2141
+ labelWidth: Y,
2142
+ controlWidth: A
2143
+ }) => {
2144
+ const J = dn(D, x), R = J === "hidden";
2145
+ J === "disabled" && (o = !0), J === "readOnly" && (s = !0);
2146
+ const { t: Q } = We(), ee = z !== void 0, [f, m] = An.useState(re ?? {}), y = ee ? z : f, ne = (M) => {
2147
+ const W = { ...y, ...M };
2148
+ ee || m(W), P?.(W);
2149
+ }, te = {
2150
+ street: w?.street ?? Q("address.street", "Street"),
2151
+ building: w?.building ?? Q("address.building", "Building"),
2152
+ apartment: w?.apartment ?? Q("address.apartment", "Apt."),
2153
+ postalCode: w?.postalCode ?? Q("address.postalCode", "Postal code"),
2154
+ city: w?.city ?? Q("address.city", "City"),
2155
+ state: w?.state ?? Q("address.state", "State / Region"),
2156
+ country: w?.country ?? Q("address.country", "Country")
2157
+ }, b = F ?? {}, h = y.country ?? ce, O = L === "left" ? "left" : "top", V = {
2158
+ ...le,
2159
+ ...Y != null && {
2160
+ "--nice-field-label-width": typeof Y == "number" ? `${Y}px` : Y
2161
+ },
2162
+ ...A != null && {
2163
+ "--nice-field-control-width": typeof A == "number" ? `${A}px` : A
2164
+ }
2165
+ }, be = {
2166
+ display: "grid",
2167
+ gridTemplateColumns: `repeat(${E}, minmax(0, 1fr))`,
2168
+ gap: "8px 12px"
2169
+ }, oe = E === 2 ? { gridColumn: "span 2" } : {}, ue = {
2170
+ size: C,
2171
+ disabled: o || v,
2172
+ readOnly: s,
2173
+ labelPlacement: O
2174
+ };
2175
+ return R ? null : /* @__PURE__ */ p(
2176
+ "div",
2177
+ {
2178
+ className: `nice-field nice-field--${C} nice-address nice-address--cols-${E} ${v ? "nice-field--loading" : ""} ${K || ""}`,
2179
+ style: V,
2180
+ "aria-busy": v || void 0,
2181
+ children: [
2182
+ U && n && /* @__PURE__ */ e("label", { className: `nice-field__label ${a ? "nice-field__label--required" : ""}`, children: n }),
2183
+ /* @__PURE__ */ p("div", { className: "nice-field__control", children: [
2184
+ /* @__PURE__ */ p("div", { className: "nice-address__grid", style: be, children: [
2185
+ /* @__PURE__ */ e("div", { style: oe, children: /* @__PURE__ */ e(
2186
+ on,
2187
+ {
2188
+ ...ue,
2189
+ label: te.street,
2190
+ value: y.street ?? "",
2191
+ onChange: (M) => ne({ street: M }),
2192
+ placeholder: b.street,
2193
+ required: a
2194
+ }
2195
+ ) }),
2196
+ H && /* @__PURE__ */ e(
2197
+ on,
2198
+ {
2199
+ ...ue,
2200
+ label: te.building,
2201
+ value: y.building ?? "",
2202
+ onChange: (M) => ne({ building: M }),
2203
+ placeholder: b.building
2204
+ }
2205
+ ),
2206
+ de && /* @__PURE__ */ e(
2207
+ on,
2208
+ {
2209
+ ...ue,
2210
+ label: te.apartment,
2211
+ value: y.apartment ?? "",
2212
+ onChange: (M) => ne({ apartment: M }),
2213
+ placeholder: b.apartment
2214
+ }
2215
+ ),
2216
+ /* @__PURE__ */ e(
2217
+ on,
2218
+ {
2219
+ ...ue,
2220
+ label: te.postalCode,
2221
+ value: y.postalCode ?? "",
2222
+ onChange: (M) => ne({ postalCode: M }),
2223
+ placeholder: b.postalCode ?? "00-000",
2224
+ required: a
2225
+ }
2226
+ ),
2227
+ /* @__PURE__ */ e(
2228
+ on,
2229
+ {
2230
+ ...ue,
2231
+ label: te.city,
2232
+ value: y.city ?? "",
2233
+ onChange: (M) => ne({ city: M }),
2234
+ placeholder: b.city,
2235
+ required: a
2236
+ }
2237
+ ),
2238
+ k && /* @__PURE__ */ e(
2239
+ on,
2240
+ {
2241
+ ...ue,
2242
+ label: te.state,
2243
+ value: y.state ?? "",
2244
+ onChange: (M) => ne({ state: M }),
2245
+ placeholder: b.state
2246
+ }
2247
+ ),
2248
+ G && /* @__PURE__ */ e(
2249
+ gt,
2250
+ {
2251
+ ...ue,
2252
+ label: te.country,
2253
+ value: h,
2254
+ onChange: (M) => ne({ country: typeof M == "string" ? M : String(M ?? "") }),
2255
+ options: fe,
2256
+ required: a
2257
+ }
2258
+ )
2259
+ ] }),
2260
+ v && /* @__PURE__ */ e("span", { className: "nice-field__spinner nice-field__spinner--address", children: /* @__PURE__ */ e("span", { className: "nice-spinner nice-spinner--sm" }) }),
2261
+ l === "right" && t && /* @__PURE__ */ e("div", { className: "nice-field__error", role: "alert", children: t }),
2262
+ l === "right" && !t && i && /* @__PURE__ */ e("div", { className: "nice-field__helper", children: i })
2263
+ ] }),
2264
+ l !== "right" && t && /* @__PURE__ */ e("div", { className: "nice-field__error", role: "alert", children: t }),
2265
+ l !== "right" && !t && i && /* @__PURE__ */ e("div", { className: "nice-field__helper", children: i })
2266
+ ]
2267
+ }
2268
+ );
2269
+ };
2270
+ Ct.displayName = "NiceAddress";
2271
+ const hi = [
2272
+ { code: "US", name: "United States", dialCode: "+1", flag: "🇺🇸" },
2273
+ { code: "GB", name: "United Kingdom", dialCode: "+44", flag: "🇬🇧" },
2274
+ { code: "DE", name: "Germany", dialCode: "+49", flag: "🇩🇪" },
2275
+ { code: "FR", name: "France", dialCode: "+33", flag: "🇫🇷" },
2276
+ { code: "PL", name: "Poland", dialCode: "+48", flag: "🇵🇱" },
2277
+ { code: "ES", name: "Spain", dialCode: "+34", flag: "🇪🇸" },
2278
+ { code: "IT", name: "Italy", dialCode: "+39", flag: "🇮🇹" },
2279
+ { code: "NL", name: "Netherlands", dialCode: "+31", flag: "🇳🇱" },
2280
+ { code: "BE", name: "Belgium", dialCode: "+32", flag: "🇧🇪" },
2281
+ { code: "AT", name: "Austria", dialCode: "+43", flag: "🇦🇹" },
2282
+ { code: "CH", name: "Switzerland", dialCode: "+41", flag: "🇨🇭" },
2283
+ { code: "SE", name: "Sweden", dialCode: "+46", flag: "🇸🇪" },
2284
+ { code: "NO", name: "Norway", dialCode: "+47", flag: "🇳🇴" },
2285
+ { code: "DK", name: "Denmark", dialCode: "+45", flag: "🇩🇰" },
2286
+ { code: "FI", name: "Finland", dialCode: "+358", flag: "🇫🇮" },
2287
+ { code: "PT", name: "Portugal", dialCode: "+351", flag: "🇵🇹" },
2288
+ { code: "IE", name: "Ireland", dialCode: "+353", flag: "🇮🇪" },
2289
+ { code: "CZ", name: "Czech Republic", dialCode: "+420", flag: "🇨🇿" },
2290
+ { code: "SK", name: "Slovakia", dialCode: "+421", flag: "🇸🇰" },
2291
+ { code: "HU", name: "Hungary", dialCode: "+36", flag: "🇭🇺" },
2292
+ { code: "RO", name: "Romania", dialCode: "+40", flag: "🇷🇴" },
2293
+ { code: "BG", name: "Bulgaria", dialCode: "+359", flag: "🇧🇬" },
2294
+ { code: "GR", name: "Greece", dialCode: "+30", flag: "🇬🇷" },
2295
+ { code: "UA", name: "Ukraine", dialCode: "+380", flag: "🇺🇦" },
2296
+ { code: "RU", name: "Russia", dialCode: "+7", flag: "🇷🇺" },
2297
+ { code: "CA", name: "Canada", dialCode: "+1", flag: "🇨🇦" },
2298
+ { code: "AU", name: "Australia", dialCode: "+61", flag: "🇦🇺" },
2299
+ { code: "NZ", name: "New Zealand", dialCode: "+64", flag: "🇳🇿" },
2300
+ { code: "JP", name: "Japan", dialCode: "+81", flag: "🇯🇵" },
2301
+ { code: "KR", name: "South Korea", dialCode: "+82", flag: "🇰🇷" },
2302
+ { code: "CN", name: "China", dialCode: "+86", flag: "🇨🇳" },
2303
+ { code: "IN", name: "India", dialCode: "+91", flag: "🇮🇳" },
2304
+ { code: "SG", name: "Singapore", dialCode: "+65", flag: "🇸🇬" },
2305
+ { code: "MY", name: "Malaysia", dialCode: "+60", flag: "🇲🇾" },
2306
+ { code: "TH", name: "Thailand", dialCode: "+66", flag: "🇹🇭" },
2307
+ { code: "VN", name: "Vietnam", dialCode: "+84", flag: "🇻🇳" },
2308
+ { code: "ID", name: "Indonesia", dialCode: "+62", flag: "🇮🇩" },
2309
+ { code: "PH", name: "Philippines", dialCode: "+63", flag: "🇵🇭" },
2310
+ { code: "BR", name: "Brazil", dialCode: "+55", flag: "🇧🇷" },
2311
+ { code: "MX", name: "Mexico", dialCode: "+52", flag: "🇲🇽" },
2312
+ { code: "AR", name: "Argentina", dialCode: "+54", flag: "🇦🇷" },
2313
+ { code: "CL", name: "Chile", dialCode: "+56", flag: "🇨🇱" },
2314
+ { code: "CO", name: "Colombia", dialCode: "+57", flag: "🇨🇴" },
2315
+ { code: "PE", name: "Peru", dialCode: "+51", flag: "🇵🇪" },
2316
+ { code: "ZA", name: "South Africa", dialCode: "+27", flag: "🇿🇦" },
2317
+ { code: "EG", name: "Egypt", dialCode: "+20", flag: "🇪🇬" },
2318
+ { code: "NG", name: "Nigeria", dialCode: "+234", flag: "🇳🇬" },
2319
+ { code: "KE", name: "Kenya", dialCode: "+254", flag: "🇰🇪" },
2320
+ { code: "AE", name: "United Arab Emirates", dialCode: "+971", flag: "🇦🇪" },
2321
+ { code: "SA", name: "Saudi Arabia", dialCode: "+966", flag: "🇸🇦" },
2322
+ { code: "IL", name: "Israel", dialCode: "+972", flag: "🇮🇱" },
2323
+ { code: "TR", name: "Turkey", dialCode: "+90", flag: "🇹🇷" },
2324
+ // Additional countries
2325
+ { code: "AF", name: "Afghanistan", dialCode: "+93", flag: "🇦🇫" },
2326
+ { code: "AL", name: "Albania", dialCode: "+355", flag: "🇦🇱" },
2327
+ { code: "DZ", name: "Algeria", dialCode: "+213", flag: "🇩🇿" },
2328
+ { code: "AD", name: "Andorra", dialCode: "+376", flag: "🇦🇩" },
2329
+ { code: "AO", name: "Angola", dialCode: "+244", flag: "🇦🇴" },
2330
+ { code: "AG", name: "Antigua and Barbuda", dialCode: "+1268", flag: "🇦🇬" },
2331
+ { code: "AM", name: "Armenia", dialCode: "+374", flag: "🇦🇲" },
2332
+ { code: "AZ", name: "Azerbaijan", dialCode: "+994", flag: "🇦🇿" },
2333
+ { code: "BS", name: "Bahamas", dialCode: "+1242", flag: "🇧🇸" },
2334
+ { code: "BH", name: "Bahrain", dialCode: "+973", flag: "🇧🇭" },
2335
+ { code: "BD", name: "Bangladesh", dialCode: "+880", flag: "🇧🇩" },
2336
+ { code: "BB", name: "Barbados", dialCode: "+1246", flag: "🇧🇧" },
2337
+ { code: "BY", name: "Belarus", dialCode: "+375", flag: "🇧🇾" },
2338
+ { code: "BZ", name: "Belize", dialCode: "+501", flag: "🇧🇿" },
2339
+ { code: "BJ", name: "Benin", dialCode: "+229", flag: "🇧🇯" },
2340
+ { code: "BT", name: "Bhutan", dialCode: "+975", flag: "🇧🇹" },
2341
+ { code: "BO", name: "Bolivia", dialCode: "+591", flag: "🇧🇴" },
2342
+ { code: "BA", name: "Bosnia and Herzegovina", dialCode: "+387", flag: "🇧🇦" },
2343
+ { code: "BW", name: "Botswana", dialCode: "+267", flag: "🇧🇼" },
2344
+ { code: "BN", name: "Brunei", dialCode: "+673", flag: "🇧🇳" },
2345
+ { code: "BF", name: "Burkina Faso", dialCode: "+226", flag: "🇧🇫" },
2346
+ { code: "BI", name: "Burundi", dialCode: "+257", flag: "🇧🇮" },
2347
+ { code: "CV", name: "Cape Verde", dialCode: "+238", flag: "🇨🇻" },
2348
+ { code: "KH", name: "Cambodia", dialCode: "+855", flag: "🇰🇭" },
2349
+ { code: "CM", name: "Cameroon", dialCode: "+237", flag: "🇨🇲" },
2350
+ { code: "CF", name: "Central African Republic", dialCode: "+236", flag: "🇨🇫" },
2351
+ { code: "TD", name: "Chad", dialCode: "+235", flag: "🇹🇩" },
2352
+ { code: "KM", name: "Comoros", dialCode: "+269", flag: "🇰🇲" },
2353
+ { code: "CG", name: "Congo", dialCode: "+242", flag: "🇨🇬" },
2354
+ { code: "CD", name: "DR Congo", dialCode: "+243", flag: "🇨🇩" },
2355
+ { code: "CR", name: "Costa Rica", dialCode: "+506", flag: "🇨🇷" },
2356
+ { code: "CI", name: "Côte d'Ivoire", dialCode: "+225", flag: "🇨🇮" },
2357
+ { code: "HR", name: "Croatia", dialCode: "+385", flag: "🇭🇷" },
2358
+ { code: "CU", name: "Cuba", dialCode: "+53", flag: "🇨🇺" },
2359
+ { code: "CY", name: "Cyprus", dialCode: "+357", flag: "🇨🇾" },
2360
+ { code: "DJ", name: "Djibouti", dialCode: "+253", flag: "🇩🇯" },
2361
+ { code: "DM", name: "Dominica", dialCode: "+1767", flag: "🇩🇲" },
2362
+ { code: "DO", name: "Dominican Republic", dialCode: "+1809", flag: "🇩🇴" },
2363
+ { code: "EC", name: "Ecuador", dialCode: "+593", flag: "🇪🇨" },
2364
+ { code: "SV", name: "El Salvador", dialCode: "+503", flag: "🇸🇻" },
2365
+ { code: "GQ", name: "Equatorial Guinea", dialCode: "+240", flag: "🇬🇶" },
2366
+ { code: "ER", name: "Eritrea", dialCode: "+291", flag: "🇪🇷" },
2367
+ { code: "EE", name: "Estonia", dialCode: "+372", flag: "🇪🇪" },
2368
+ { code: "SZ", name: "Eswatini", dialCode: "+268", flag: "🇸🇿" },
2369
+ { code: "ET", name: "Ethiopia", dialCode: "+251", flag: "🇪🇹" },
2370
+ { code: "FJ", name: "Fiji", dialCode: "+679", flag: "🇫🇯" },
2371
+ { code: "GA", name: "Gabon", dialCode: "+241", flag: "🇬🇦" },
2372
+ { code: "GM", name: "Gambia", dialCode: "+220", flag: "🇬🇲" },
2373
+ { code: "GE", name: "Georgia", dialCode: "+995", flag: "🇬🇪" },
2374
+ { code: "GH", name: "Ghana", dialCode: "+233", flag: "🇬🇭" },
2375
+ { code: "GD", name: "Grenada", dialCode: "+1473", flag: "🇬🇩" },
2376
+ { code: "GT", name: "Guatemala", dialCode: "+502", flag: "🇬🇹" },
2377
+ { code: "GN", name: "Guinea", dialCode: "+224", flag: "🇬🇳" },
2378
+ { code: "GW", name: "Guinea-Bissau", dialCode: "+245", flag: "🇬🇼" },
2379
+ { code: "GY", name: "Guyana", dialCode: "+592", flag: "🇬🇾" },
2380
+ { code: "HT", name: "Haiti", dialCode: "+509", flag: "🇭🇹" },
2381
+ { code: "HN", name: "Honduras", dialCode: "+504", flag: "🇭🇳" },
2382
+ { code: "HK", name: "Hong Kong", dialCode: "+852", flag: "🇭🇰" },
2383
+ { code: "IS", name: "Iceland", dialCode: "+354", flag: "🇮🇸" },
2384
+ { code: "IQ", name: "Iraq", dialCode: "+964", flag: "🇮🇶" },
2385
+ { code: "IR", name: "Iran", dialCode: "+98", flag: "🇮🇷" },
2386
+ { code: "JM", name: "Jamaica", dialCode: "+1876", flag: "🇯🇲" },
2387
+ { code: "JO", name: "Jordan", dialCode: "+962", flag: "🇯🇴" },
2388
+ { code: "KZ", name: "Kazakhstan", dialCode: "+7", flag: "🇰🇿" },
2389
+ { code: "KW", name: "Kuwait", dialCode: "+965", flag: "🇰🇼" },
2390
+ { code: "KG", name: "Kyrgyzstan", dialCode: "+996", flag: "🇰🇬" },
2391
+ { code: "LA", name: "Laos", dialCode: "+856", flag: "🇱🇦" },
2392
+ { code: "LV", name: "Latvia", dialCode: "+371", flag: "🇱🇻" },
2393
+ { code: "LB", name: "Lebanon", dialCode: "+961", flag: "🇱🇧" },
2394
+ { code: "LS", name: "Lesotho", dialCode: "+266", flag: "🇱🇸" },
2395
+ { code: "LR", name: "Liberia", dialCode: "+231", flag: "🇱🇷" },
2396
+ { code: "LY", name: "Libya", dialCode: "+218", flag: "🇱🇾" },
2397
+ { code: "LI", name: "Liechtenstein", dialCode: "+423", flag: "🇱🇮" },
2398
+ { code: "LT", name: "Lithuania", dialCode: "+370", flag: "🇱🇹" },
2399
+ { code: "LU", name: "Luxembourg", dialCode: "+352", flag: "🇱🇺" },
2400
+ { code: "MO", name: "Macau", dialCode: "+853", flag: "🇲🇴" },
2401
+ { code: "MK", name: "North Macedonia", dialCode: "+389", flag: "🇲🇰" },
2402
+ { code: "MG", name: "Madagascar", dialCode: "+261", flag: "🇲🇬" },
2403
+ { code: "MW", name: "Malawi", dialCode: "+265", flag: "🇲🇼" },
2404
+ { code: "MV", name: "Maldives", dialCode: "+960", flag: "🇲🇻" },
2405
+ { code: "ML", name: "Mali", dialCode: "+223", flag: "🇲🇱" },
2406
+ { code: "MT", name: "Malta", dialCode: "+356", flag: "🇲🇹" },
2407
+ { code: "MR", name: "Mauritania", dialCode: "+222", flag: "🇲🇷" },
2408
+ { code: "MU", name: "Mauritius", dialCode: "+230", flag: "🇲🇺" },
2409
+ { code: "MD", name: "Moldova", dialCode: "+373", flag: "🇲🇩" },
2410
+ { code: "MC", name: "Monaco", dialCode: "+377", flag: "🇲🇨" },
2411
+ { code: "MN", name: "Mongolia", dialCode: "+976", flag: "🇲🇳" },
2412
+ { code: "ME", name: "Montenegro", dialCode: "+382", flag: "🇲🇪" },
2413
+ { code: "MA", name: "Morocco", dialCode: "+212", flag: "🇲🇦" },
2414
+ { code: "MZ", name: "Mozambique", dialCode: "+258", flag: "🇲🇿" },
2415
+ { code: "MM", name: "Myanmar", dialCode: "+95", flag: "🇲🇲" },
2416
+ { code: "NA", name: "Namibia", dialCode: "+264", flag: "🇳🇦" },
2417
+ { code: "NP", name: "Nepal", dialCode: "+977", flag: "🇳🇵" },
2418
+ { code: "NI", name: "Nicaragua", dialCode: "+505", flag: "🇳🇮" },
2419
+ { code: "NE", name: "Niger", dialCode: "+227", flag: "🇳🇪" },
2420
+ { code: "KP", name: "North Korea", dialCode: "+850", flag: "🇰🇵" },
2421
+ { code: "OM", name: "Oman", dialCode: "+968", flag: "🇴🇲" },
2422
+ { code: "PK", name: "Pakistan", dialCode: "+92", flag: "🇵🇰" },
2423
+ { code: "PS", name: "Palestine", dialCode: "+970", flag: "🇵🇸" },
2424
+ { code: "PA", name: "Panama", dialCode: "+507", flag: "🇵🇦" },
2425
+ { code: "PG", name: "Papua New Guinea", dialCode: "+675", flag: "🇵🇬" },
2426
+ { code: "PY", name: "Paraguay", dialCode: "+595", flag: "🇵🇾" },
2427
+ { code: "QA", name: "Qatar", dialCode: "+974", flag: "🇶🇦" },
2428
+ { code: "RW", name: "Rwanda", dialCode: "+250", flag: "🇷🇼" },
2429
+ { code: "WS", name: "Samoa", dialCode: "+685", flag: "🇼🇸" },
2430
+ { code: "SM", name: "San Marino", dialCode: "+378", flag: "🇸🇲" },
2431
+ { code: "ST", name: "São Tomé and Príncipe", dialCode: "+239", flag: "🇸🇹" },
2432
+ { code: "SN", name: "Senegal", dialCode: "+221", flag: "🇸🇳" },
2433
+ { code: "RS", name: "Serbia", dialCode: "+381", flag: "🇷🇸" },
2434
+ { code: "SC", name: "Seychelles", dialCode: "+248", flag: "🇸🇨" },
2435
+ { code: "SL", name: "Sierra Leone", dialCode: "+232", flag: "🇸🇱" },
2436
+ { code: "SI", name: "Slovenia", dialCode: "+386", flag: "🇸🇮" },
2437
+ { code: "SB", name: "Solomon Islands", dialCode: "+677", flag: "🇸🇧" },
2438
+ { code: "SO", name: "Somalia", dialCode: "+252", flag: "🇸🇴" },
2439
+ { code: "SS", name: "South Sudan", dialCode: "+211", flag: "🇸🇸" },
2440
+ { code: "LK", name: "Sri Lanka", dialCode: "+94", flag: "🇱🇰" },
2441
+ { code: "SD", name: "Sudan", dialCode: "+249", flag: "🇸🇩" },
2442
+ { code: "SR", name: "Suriname", dialCode: "+597", flag: "🇸🇷" },
2443
+ { code: "SY", name: "Syria", dialCode: "+963", flag: "🇸🇾" },
2444
+ { code: "TW", name: "Taiwan", dialCode: "+886", flag: "🇹🇼" },
2445
+ { code: "TJ", name: "Tajikistan", dialCode: "+992", flag: "🇹🇯" },
2446
+ { code: "TZ", name: "Tanzania", dialCode: "+255", flag: "🇹🇿" },
2447
+ { code: "TL", name: "Timor-Leste", dialCode: "+670", flag: "🇹🇱" },
2448
+ { code: "TG", name: "Togo", dialCode: "+228", flag: "🇹🇬" },
2449
+ { code: "TO", name: "Tonga", dialCode: "+676", flag: "🇹🇴" },
2450
+ { code: "TT", name: "Trinidad and Tobago", dialCode: "+1868", flag: "🇹🇹" },
2451
+ { code: "TN", name: "Tunisia", dialCode: "+216", flag: "🇹🇳" },
2452
+ { code: "TM", name: "Turkmenistan", dialCode: "+993", flag: "🇹🇲" },
2453
+ { code: "UG", name: "Uganda", dialCode: "+256", flag: "🇺🇬" },
2454
+ { code: "UY", name: "Uruguay", dialCode: "+598", flag: "🇺🇾" },
2455
+ { code: "UZ", name: "Uzbekistan", dialCode: "+998", flag: "🇺🇿" },
2456
+ { code: "VU", name: "Vanuatu", dialCode: "+678", flag: "🇻🇺" },
2457
+ { code: "VA", name: "Vatican City", dialCode: "+379", flag: "🇻🇦" },
2458
+ { code: "VE", name: "Venezuela", dialCode: "+58", flag: "🇻🇪" },
2459
+ { code: "YE", name: "Yemen", dialCode: "+967", flag: "🇾🇪" },
2460
+ { code: "ZM", name: "Zambia", dialCode: "+260", flag: "🇿🇲" },
2461
+ { code: "ZW", name: "Zimbabwe", dialCode: "+263", flag: "🇿🇼" }
2462
+ ], Mt = ({
2463
+ value: n,
2464
+ defaultValue: i,
2465
+ onChange: t,
2466
+ placeholder: l,
2467
+ showSearch: a = !0,
2468
+ searchPlaceholder: o,
2469
+ showDialCode: s,
2470
+ showFlag: v,
2471
+ showFlagInValue: C,
2472
+ showFlagInMenu: K,
2473
+ showTextInValue: le,
2474
+ showTextInMenu: D,
2475
+ showDialCodeInValue: x,
2476
+ showDialCodeInMenu: z,
2477
+ showCodeInValue: re = !1,
2478
+ showCodeInMenu: P = !1,
2479
+ compact: E = !1,
2480
+ variant: k = "default",
2481
+ dropdownAlign: H,
2482
+ disabled: de = !1,
2483
+ countries: G,
2484
+ priorityCountries: fe = ["US", "GB", "DE", "FR", "PL"],
2485
+ allowClear: ce = !1,
2486
+ size: w = "md",
2487
+ className: F = "",
2488
+ style: U,
2489
+ // NiceFormFieldProps extras (label/error/state placement etc.)
2490
+ label: L,
2491
+ helperText: Y,
2492
+ error: A,
2493
+ required: J,
2494
+ readOnly: R,
2495
+ loading: Q,
2496
+ labelPlacement: ee,
2497
+ errorPlacement: f,
2498
+ labelWidth: m,
2499
+ controlWidth: y,
2500
+ id: ne,
2501
+ "data-testid": te = "nice-country-picker"
2502
+ }) => {
2503
+ const { t: b } = We(), h = Ne(null), O = Ne(null), V = Ne(null), [be, oe] = $e(i), [ue, M] = $e(!1), [W, X] = $e(""), [we, ze] = $e(0), B = C ?? v ?? !0, ye = K ?? v ?? !0, j = le ?? !E, Ue = D ?? !0, g = x ?? s ?? !E, T = z ?? s ?? !0, d = jt(
2504
+ ue,
2505
+ O,
2506
+ H ?? (E ? "auto" : "left")
2507
+ ), pe = n !== void 0 ? n : be, q = ve(() => {
2508
+ let ae = hi;
2509
+ if (G) {
2510
+ const xe = new Set(G.map((Xe) => Xe.toUpperCase()));
2511
+ ae = ae.filter((Xe) => xe.has(Xe.code));
2512
+ }
2513
+ return ae;
2514
+ }, [G]), ie = ve(() => {
2515
+ if (!fe?.length)
2516
+ return q;
2517
+ const ae = new Set(fe.map((nn) => nn.toUpperCase())), xe = q.filter((nn) => ae.has(nn.code)), Xe = q.filter((nn) => !ae.has(nn.code));
2518
+ return [...xe, ...Xe];
2519
+ }, [q, fe]), N = ve(() => {
2520
+ if (!W)
2521
+ return ie;
2522
+ const ae = W.toLowerCase();
2523
+ return ie.filter(
2524
+ (xe) => xe.name.toLowerCase().includes(ae) || xe.code.toLowerCase().includes(ae) || xe.dialCode.includes(ae)
2525
+ );
2526
+ }, [ie, W]), Ke = ve(() => pe ? q.find((ae) => ae.code === pe) ?? null : null, [pe, q]);
2527
+ Ie(() => {
2528
+ if (!ue)
2529
+ return;
2530
+ const ae = (xe) => {
2531
+ h.current && !h.current.contains(xe.target) && (M(!1), X(""));
2532
+ };
2533
+ return document.addEventListener("mousedown", ae), () => document.removeEventListener("mousedown", ae);
2534
+ }, [ue]), Ie(() => {
2535
+ ue && a && V.current && V.current.focus();
2536
+ }, [ue, a]), Ie(() => {
2537
+ ze(0);
2538
+ }, [W]);
2539
+ const qe = I(
2540
+ (ae) => {
2541
+ n === void 0 && oe(ae.code), t?.(ae), M(!1), X("");
2542
+ },
2543
+ [n, t]
2544
+ ), en = I(
2545
+ (ae) => {
2546
+ ae.stopPropagation(), n === void 0 && oe(void 0), t?.(null);
2547
+ },
2548
+ [n, t]
2549
+ ), Ye = I(
2550
+ (ae) => {
2551
+ if (!ue) {
2552
+ (ae.key === "Enter" || ae.key === " " || ae.key === "ArrowDown") && (ae.preventDefault(), M(!0));
2553
+ return;
2554
+ }
2555
+ switch (ae.key) {
2556
+ case "ArrowDown":
2557
+ ae.preventDefault(), ze((xe) => Math.min(xe + 1, N.length - 1));
2558
+ break;
2559
+ case "ArrowUp":
2560
+ ae.preventDefault(), ze((xe) => Math.max(xe - 1, 0));
2561
+ break;
2562
+ case "Enter":
2563
+ ae.preventDefault(), N[we] && qe(N[we]);
2564
+ break;
2565
+ case "Escape":
2566
+ ae.preventDefault(), M(!1), X("");
2567
+ break;
2568
+ }
2569
+ },
2570
+ [ue, N, we, qe]
2571
+ );
2572
+ return /* @__PURE__ */ p(
2573
+ "div",
2574
+ {
2575
+ ref: h,
2576
+ className: `nice-field nice-field--${w} nice-field--country-picker ${ee === "left" ? "nice-field--label-left" : ""} ${f === "right" ? "nice-field--error-right" : ""} ${A ? "nice-field--error" : ""} ${Q ? "nice-field--loading" : ""} nice-country-picker nice-country-picker--${w} ${E ? "nice-country-picker--compact" : ""} ${k === "ghost" ? "nice-country-picker--ghost" : ""} ${ue ? "nice-country-picker--open" : ""} ${de ? "nice-country-picker--disabled" : ""} ${F}`,
2577
+ style: {
2578
+ ...U,
2579
+ ...m != null && {
2580
+ "--nice-field-label-width": typeof m == "number" ? `${m}px` : m
2581
+ },
2582
+ ...y != null && {
2583
+ "--nice-field-control-width": typeof y == "number" ? `${y}px` : y
2584
+ }
2585
+ },
2586
+ "data-testid": te,
2587
+ "aria-busy": Q || void 0,
2588
+ children: [
2589
+ L && /* @__PURE__ */ p("label", { className: "nice-field__label", htmlFor: ne, children: [
2590
+ L,
2591
+ J && /* @__PURE__ */ e("span", { className: "nice-field__required", children: "*" })
2592
+ ] }),
2593
+ /* @__PURE__ */ p("div", { className: "nice-field__control", children: [
2594
+ /* @__PURE__ */ p(
2595
+ "button",
2596
+ {
2597
+ ref: O,
2598
+ type: "button",
2599
+ className: "nice-country-picker__trigger",
2600
+ onClick: () => !de && !R && M(!ue),
2601
+ onKeyDown: Ye,
2602
+ disabled: de,
2603
+ id: ne,
2604
+ "aria-haspopup": "listbox",
2605
+ "aria-expanded": ue,
2606
+ "aria-invalid": A ? !0 : void 0,
2607
+ "data-testid": `${te}-trigger`,
2608
+ children: [
2609
+ Ke ? /* @__PURE__ */ p("span", { className: "nice-country-picker__value", children: [
2610
+ B && /* @__PURE__ */ e("span", { className: "nice-country-picker__flag", "aria-hidden": "true", children: /* @__PURE__ */ e(lt, { code: Ke.code }) }),
2611
+ j && /* @__PURE__ */ e("span", { className: "nice-country-picker__name", children: Ke.name }),
2612
+ re && /* @__PURE__ */ e("span", { className: "nice-country-picker__code", children: Ke.code }),
2613
+ g && /* @__PURE__ */ p("span", { className: "nice-country-picker__dial-code", children: [
2614
+ "(",
2615
+ Ke.dialCode,
2616
+ ")"
2617
+ ] })
2618
+ ] }) : /* @__PURE__ */ e("span", { className: "nice-country-picker__placeholder", children: E ? "" : l ?? b("controls.select", "Select country") }),
2619
+ /* @__PURE__ */ p("span", { className: "nice-country-picker__icons", children: [
2620
+ ce && Ke && !de && !R && /* @__PURE__ */ e(
2621
+ "span",
2622
+ {
2623
+ className: "nice-country-picker__clear",
2624
+ onClick: en,
2625
+ "aria-label": b("clear", "Clear"),
2626
+ children: /* @__PURE__ */ e(Ee, { name: "close", size: 14 })
2627
+ }
2628
+ ),
2629
+ k !== "ghost" && /* @__PURE__ */ e("span", { className: "nice-country-picker__arrow", children: /* @__PURE__ */ e(Ee, { name: ue ? "chevron-up" : "chevron-down", size: 16 }) })
2630
+ ] })
2631
+ ]
2632
+ }
2633
+ ),
2634
+ ue && /* @__PURE__ */ p(
2635
+ "div",
2636
+ {
2637
+ className: `nice-country-picker__dropdown nice-country-picker__dropdown--align-${d}`,
2638
+ role: "listbox",
2639
+ "data-testid": `${te}-dropdown`,
2640
+ children: [
2641
+ a && /* @__PURE__ */ e("div", { className: "nice-country-picker__search", children: /* @__PURE__ */ e(
2642
+ "input",
2643
+ {
2644
+ ref: V,
2645
+ type: "text",
2646
+ value: W,
2647
+ onChange: (ae) => X(ae.target.value),
2648
+ onKeyDown: Ye,
2649
+ placeholder: o ?? b("search", "Search"),
2650
+ className: "nice-country-picker__search-input",
2651
+ "data-testid": `${te}-search`
2652
+ }
2653
+ ) }),
2654
+ /* @__PURE__ */ e("div", { className: "nice-country-picker__list", children: N.length === 0 ? /* @__PURE__ */ e("div", { className: "nice-country-picker__empty", children: b("noData", "No countries found") }) : N.map((ae, xe) => /* @__PURE__ */ p(
2655
+ "div",
2656
+ {
2657
+ className: `nice-country-picker__option ${ae.code === pe ? "nice-country-picker__option--selected" : ""} ${xe === we ? "nice-country-picker__option--highlighted" : ""}`,
2658
+ onClick: () => qe(ae),
2659
+ onMouseEnter: () => ze(xe),
2660
+ role: "option",
2661
+ "aria-selected": ae.code === pe,
2662
+ "data-testid": `${te}-option-${ae.code}`,
2663
+ children: [
2664
+ ye && /* @__PURE__ */ e("span", { className: "nice-country-picker__flag", "aria-hidden": "true", children: /* @__PURE__ */ e(lt, { code: ae.code }) }),
2665
+ Ue && /* @__PURE__ */ e("span", { className: "nice-country-picker__name", children: ae.name }),
2666
+ P && /* @__PURE__ */ e("span", { className: "nice-country-picker__code", children: ae.code }),
2667
+ T && /* @__PURE__ */ e("span", { className: "nice-country-picker__dial-code", children: ae.dialCode })
2668
+ ]
2669
+ },
2670
+ ae.code
2671
+ )) })
2672
+ ]
2673
+ }
2674
+ ),
2675
+ Q && /* @__PURE__ */ e("span", { className: "nice-field__spinner", children: /* @__PURE__ */ e("span", { className: "nice-spinner nice-spinner--sm" }) }),
2676
+ f === "right" && A && /* @__PURE__ */ e("div", { className: "nice-field__error", role: "alert", children: A }),
2677
+ f === "right" && !A && Y && /* @__PURE__ */ e("div", { className: "nice-field__helper", children: Y })
2678
+ ] }),
2679
+ f !== "right" && A && /* @__PURE__ */ e("div", { className: "nice-field__error", role: "alert", children: A }),
2680
+ f !== "right" && !A && Y && /* @__PURE__ */ e("div", { className: "nice-field__helper", children: Y })
2681
+ ]
2682
+ }
2683
+ );
2684
+ };
2685
+ Mt.displayName = "NiceCountryPicker";
2686
+ const gi = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
2687
+ function yi(n, i) {
2688
+ return new Date(n, i + 1, 0).getDate();
2689
+ }
2690
+ function _i(n, i) {
2691
+ return new Date(n, i, 1).getDay();
2692
+ }
2693
+ function ot(n, i, t) {
2694
+ return `${n}-${String(i + 1).padStart(2, "0")}-${String(t).padStart(2, "0")}`;
2695
+ }
2696
+ function vi(n) {
2697
+ const i = new Date(Date.UTC(n.getFullYear(), n.getMonth(), n.getDate()));
2698
+ i.setUTCDate(i.getUTCDate() + 4 - (i.getUTCDay() || 7));
2699
+ const t = new Date(Date.UTC(i.getUTCFullYear(), 0, 1));
2700
+ return Math.ceil(((i.getTime() - t.getTime()) / 864e5 + 1) / 7);
2701
+ }
2702
+ const st = [
2703
+ "January",
2704
+ "February",
2705
+ "March",
2706
+ "April",
2707
+ "May",
2708
+ "June",
2709
+ "July",
2710
+ "August",
2711
+ "September",
2712
+ "October",
2713
+ "November",
2714
+ "December"
2715
+ ], $t = ({
2716
+ value: n,
2717
+ onChange: i,
2718
+ min: t,
2719
+ max: l,
2720
+ disabledDates: a = [],
2721
+ firstDayOfWeek: o = 1,
2722
+ size: s = "md",
2723
+ showWeekNumbers: v,
2724
+ onMonthChange: C,
2725
+ className: K,
2726
+ style: le,
2727
+ accessMode: D,
2728
+ id: x,
2729
+ multiple: z,
2730
+ selectedDates: re,
2731
+ onSelectedDatesChange: P,
2732
+ selectionMode: E = "single",
2733
+ rangeStart: k,
2734
+ rangeEnd: H,
2735
+ onRangeChange: de,
2736
+ renderDay: G,
2737
+ showKeyboardHints: fe,
2738
+ persistPreferences: ce = !1,
2739
+ fullWidth: w = !1,
2740
+ // Traceless storage props
2741
+ cookies: F = !1,
2742
+ localStorage: U = !0,
2743
+ sessionStorage: L = !1,
2744
+ storageMode: Y,
2745
+ storageKey: A
2746
+ }) => {
2747
+ const J = dn(D, x), R = J === "hidden", Q = J === "disabled" || J === "readOnly", { t: ee } = We(), f = /* @__PURE__ */ new Date(), m = (E === "range" ? k : n) || n, y = m ? new Date(m) : f, ne = Qt(A ?? "nice-calendar"), te = ve(() => ce ? ne.get("prefs") ?? {} : {}, [ce, ne]), b = te.firstDayOfWeek ?? o, [h, O] = $e(te.lastViewYear ?? y.getFullYear()), [V, be] = $e(te.lastViewMonth ?? y.getMonth()), [oe, ue] = $e(te.preferredView ?? "days"), [M, W] = $e([]), X = re ?? M, [we, ze] = $e(null), B = I(
2748
+ ($) => {
2749
+ if (!ce)
2750
+ return;
2751
+ const u = ne.get("prefs") ?? {};
2752
+ ne.set("prefs", { ...u, ...$ });
2753
+ },
2754
+ [ce, ne]
2755
+ ), ye = I(
2756
+ ($) => {
2757
+ ue($), B({ preferredView: $ });
2758
+ },
2759
+ [B]
2760
+ ), j = I(
2761
+ ($, u) => {
2762
+ B({ lastViewYear: $, lastViewMonth: u });
2763
+ },
2764
+ [B]
2765
+ ), Ue = ve(
2766
+ () => [
2767
+ Ge.moveUp,
2768
+ Ge.moveDown,
2769
+ Ge.moveLeft,
2770
+ Ge.moveRight,
2771
+ { key: "Enter", description: ee("shortcuts.selectDate", "Select date") },
2772
+ Ge.pageUp,
2773
+ Ge.pageDown
2774
+ ],
2775
+ [ee]
2776
+ ), g = ve(() => yi(h, V), [h, V]), T = ve(() => (_i(h, V) - b + 7) % 7, [h, V, b]), d = ve(() => {
2777
+ const $ = [...gi];
2778
+ for (let u = 0; u < b; u++)
2779
+ $.push($.shift());
2780
+ return $;
2781
+ }, [b]), pe = I(
2782
+ ($) => {
2783
+ const u = (he) => /^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])/.test(he);
2784
+ return t && u(t) && $ < t || l && u(l) && $ > l ? !0 : a.includes($);
2785
+ },
2786
+ [t, l, a]
2787
+ ), q = I(
2788
+ ($) => {
2789
+ if (oe === "years") {
2790
+ O((Ve) => Ve + $ * 10);
2791
+ return;
2792
+ }
2793
+ if (oe === "months") {
2794
+ O((Ve) => Ve + $);
2795
+ return;
2796
+ }
2797
+ let u = V + $, he = h;
2798
+ u < 0 && (u = 11, he--), u > 11 && (u = 0, he++), be(u), O(he), j(he, u), C?.(he, u);
2799
+ },
2800
+ [V, h, C, oe, j]
2801
+ ), ie = ot(f.getFullYear(), f.getMonth(), f.getDate()), N = E === "range", Ke = I(
2802
+ ($) => N ? $ === k || $ === H : z ? X.includes($) : $ === n,
2803
+ [N, k, H, z, X, n]
2804
+ ), [qe, en] = ve(() => {
2805
+ if (!N || !k)
2806
+ return ["", ""];
2807
+ const $ = H || we;
2808
+ return $ ? $ < k ? [$, k] : [k, $] : [k, k];
2809
+ }, [N, k, H, we]), Ye = I(
2810
+ ($) => {
2811
+ if (!Q) {
2812
+ if (N) {
2813
+ const u = !k || H ? { start: $, end: "" } : $ < k ? { start: $, end: k } : { start: k, end: $ };
2814
+ ze(null), de?.(u), i?.($);
2815
+ return;
2816
+ }
2817
+ if (z) {
2818
+ const u = X.includes($) ? X.filter((he) => he !== $) : [...X, $];
2819
+ re === void 0 && W(u), P?.(u);
2820
+ }
2821
+ i?.($);
2822
+ }
2823
+ },
2824
+ [
2825
+ Q,
2826
+ N,
2827
+ k,
2828
+ H,
2829
+ de,
2830
+ z,
2831
+ X,
2832
+ re,
2833
+ i,
2834
+ P
2835
+ ]
2836
+ ), ae = I(() => {
2837
+ oe === "days" ? ye("months") : oe === "months" && ye("years");
2838
+ }, [oe, ye]), xe = I(
2839
+ ($) => {
2840
+ be($), ye("days"), j(h, $), C?.(h, $);
2841
+ },
2842
+ [h, C, ye, j]
2843
+ ), Xe = I(
2844
+ ($) => {
2845
+ O($), ye("months");
2846
+ },
2847
+ [ye]
2848
+ ), nn = oe === "years" ? `${h - h % 10} – ${h - h % 10 + 9}` : oe === "months" ? `${h}` : `${st[V]} ${h}`, pn = oe === "years" ? "decade" : oe === "months" ? "year" : "month", Ze = [];
2849
+ for (let $ = 0; $ < T; $++)
2850
+ Ze.push(null);
2851
+ for (let $ = 1; $ <= g; $++)
2852
+ Ze.push($);
2853
+ for (; Ze.length % 7 !== 0; )
2854
+ Ze.push(null);
2855
+ const ke = [];
2856
+ for (let $ = 0; $ < Ze.length; $ += 7)
2857
+ ke.push(Ze.slice($, $ + 7));
2858
+ const fn = h - h % 10;
2859
+ return R ? null : /* @__PURE__ */ p(
2860
+ "div",
2861
+ {
2862
+ className: `nice-calendar nice-calendar--${s}${w ? " nice-calendar--full-width" : ""} ${K || ""}`,
2863
+ style: le,
2864
+ children: [
2865
+ /* @__PURE__ */ p("div", { className: "nice-calendar__header", children: [
2866
+ /* @__PURE__ */ e(
2867
+ "button",
2868
+ {
2869
+ type: "button",
2870
+ className: "nice-calendar__nav",
2871
+ onClick: () => q(-1),
2872
+ "aria-label": `Previous ${pn}`,
2873
+ children: /* @__PURE__ */ e(Ee, { name: "chevron-left", size: 16 })
2874
+ }
2875
+ ),
2876
+ /* @__PURE__ */ e(
2877
+ "button",
2878
+ {
2879
+ type: "button",
2880
+ className: "nice-calendar__title",
2881
+ onClick: ae,
2882
+ "aria-label": oe === "days" ? "Show month picker" : oe === "months" ? "Show year picker" : void 0,
2883
+ disabled: oe === "years",
2884
+ children: nn
2885
+ }
2886
+ ),
2887
+ /* @__PURE__ */ e(
2888
+ "button",
2889
+ {
2890
+ type: "button",
2891
+ className: "nice-calendar__nav",
2892
+ onClick: () => q(1),
2893
+ "aria-label": `Next ${pn}`,
2894
+ children: /* @__PURE__ */ e(Ee, { name: "chevron-right", size: 16 })
2895
+ }
2896
+ ),
2897
+ fe && /* @__PURE__ */ e(_n, { shortcuts: Ue, size: "sm" })
2898
+ ] }),
2899
+ oe === "days" && /* @__PURE__ */ p(
2900
+ "table",
2901
+ {
2902
+ className: "nice-calendar__grid",
2903
+ role: "grid",
2904
+ onMouseLeave: N ? () => ze(null) : void 0,
2905
+ children: [
2906
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ p("tr", { children: [
2907
+ v && /* @__PURE__ */ e("th", { className: "nice-calendar__wk", children: "W" }),
2908
+ d.map(($) => /* @__PURE__ */ e("th", { children: $ }, $))
2909
+ ] }) }),
2910
+ /* @__PURE__ */ e("tbody", { children: ke.map(($, u) => /* @__PURE__ */ p("tr", { children: [
2911
+ v && /* @__PURE__ */ e("td", { className: "nice-calendar__wk", children: $.find((he) => he != null) ? vi(
2912
+ new Date(
2913
+ h,
2914
+ V,
2915
+ $.find((he) => he != null)
2916
+ )
2917
+ ) : "" }),
2918
+ $.map((he, Ve) => {
2919
+ if (he == null)
2920
+ return /* @__PURE__ */ e("td", { className: "nice-calendar__empty-cell" }, Ve);
2921
+ const Fe = ot(h, V, he), Oe = pe(Fe), je = Ke(Fe), tn = Fe === ie, Dn = qe !== "" && Fe >= qe && Fe <= en ? ` nice-calendar__day--in-range${Fe === qe ? " nice-calendar__day--range-start" : ""}${Fe === en ? " nice-calendar__day--range-end" : ""}` : "";
2922
+ return /* @__PURE__ */ e(
2923
+ "td",
2924
+ {
2925
+ className: `nice-calendar__day${je ? " nice-calendar__day--selected" : ""}${Dn}${tn ? " nice-calendar__day--today" : ""}${Oe ? " nice-calendar__day--disabled" : ""}`,
2926
+ onClick: () => !Oe && Ye(Fe),
2927
+ onMouseEnter: N && !Oe ? () => ze(Fe) : void 0,
2928
+ role: "gridcell",
2929
+ "aria-selected": je,
2930
+ "aria-disabled": Oe,
2931
+ children: G ? G(Fe, he) : he
2932
+ },
2933
+ Ve
2934
+ );
2935
+ })
2936
+ ] }, u)) })
2937
+ ]
2938
+ }
2939
+ ),
2940
+ oe === "months" && /* @__PURE__ */ e("div", { className: "nice-calendar__picker-grid", children: st.map(($, u) => /* @__PURE__ */ e(
2941
+ "button",
2942
+ {
2943
+ type: "button",
2944
+ className: `nice-calendar__picker-cell${u === V && h === y.getFullYear() ? " nice-calendar__picker-cell--selected" : ""}`,
2945
+ onClick: () => xe(u),
2946
+ children: $.slice(0, 3)
2947
+ },
2948
+ u
2949
+ )) }),
2950
+ oe === "years" && /* @__PURE__ */ e("div", { className: "nice-calendar__picker-grid", children: Array.from({ length: 12 }, ($, u) => fn - 1 + u).map(($) => /* @__PURE__ */ e(
2951
+ "button",
2952
+ {
2953
+ type: "button",
2954
+ className: `nice-calendar__picker-cell${$ === h ? " nice-calendar__picker-cell--selected" : ""}${$ < fn || $ > fn + 9 ? " nice-calendar__picker-cell--other" : ""}`,
2955
+ onClick: () => Xe($),
2956
+ children: $
2957
+ },
2958
+ $
2959
+ )) })
2960
+ ]
2961
+ }
2962
+ );
2963
+ };
2964
+ $t.displayName = "NiceCalendar";
2965
+ const bi = {
2966
+ "date-local": { inputType: "date", localized: !0 },
2967
+ "date-utc": { inputType: "date", localized: !1 },
2968
+ "datetime-local": { inputType: "datetime-local", localized: !0 },
2969
+ "datetime-utc": { inputType: "datetime-local", localized: !1 },
2970
+ "month-local": { inputType: "month", localized: !0 },
2971
+ "month-utc": { inputType: "month", localized: !1 },
2972
+ week: { inputType: "week", localized: !1 },
2973
+ time: { inputType: "time", localized: !1 }
2974
+ }, dt = {
2975
+ date: "yyyy-MM-dd",
2976
+ "datetime-local": "yyyy-MM-ddTHH:mm",
2977
+ month: "yyyy-MM",
2978
+ week: "yyyy-Www",
2979
+ time: "HH:mm"
2980
+ }, Ni = {
2981
+ "yyyy-MM-dd": "YYYY-MM-DD",
2982
+ "yyyy-MM-ddTHH:mm": "YYYY-MM-DDTHH:MM",
2983
+ "yyyy-MM": "YYYY-MM",
2984
+ "yyyy-Www": "YYYY-Www",
2985
+ "HH:mm": "HH:MM"
2986
+ };
2987
+ function On(n) {
2988
+ const i = (n || "").toLowerCase().replace("_", "-"), t = i.split("-")[0], l = {
2989
+ // dd.MM.yyyy (dot)
2990
+ pl: "dd.MM.yyyy",
2991
+ "pl-pl": "dd.MM.yyyy",
2992
+ de: "dd.MM.yyyy",
2993
+ "de-de": "dd.MM.yyyy",
2994
+ "de-at": "dd.MM.yyyy",
2995
+ "de-ch": "dd.MM.yyyy",
2996
+ cs: "dd.MM.yyyy",
2997
+ "cs-cz": "dd.MM.yyyy",
2998
+ sk: "dd.MM.yyyy",
2999
+ "sk-sk": "dd.MM.yyyy",
3000
+ ru: "dd.MM.yyyy",
3001
+ "ru-ru": "dd.MM.yyyy",
3002
+ fi: "dd.MM.yyyy",
3003
+ "fi-fi": "dd.MM.yyyy",
3004
+ no: "dd.MM.yyyy",
3005
+ nb: "dd.MM.yyyy",
3006
+ nn: "dd.MM.yyyy",
3007
+ da: "dd.MM.yyyy",
3008
+ "da-dk": "dd.MM.yyyy",
3009
+ tr: "dd.MM.yyyy",
3010
+ "tr-tr": "dd.MM.yyyy",
3011
+ sl: "dd.MM.yyyy",
3012
+ hr: "dd.MM.yyyy",
3013
+ sr: "dd.MM.yyyy",
3014
+ ro: "dd.MM.yyyy",
3015
+ bg: "dd.MM.yyyy",
3016
+ uk: "dd.MM.yyyy",
3017
+ is: "dd.MM.yyyy",
3018
+ et: "dd.MM.yyyy",
3019
+ lv: "dd.MM.yyyy",
3020
+ lt: "dd.MM.yyyy",
3021
+ // dd/MM/yyyy (slash)
3022
+ "en-gb": "dd/MM/yyyy",
3023
+ "en-au": "dd/MM/yyyy",
3024
+ "en-ie": "dd/MM/yyyy",
3025
+ "en-nz": "dd/MM/yyyy",
3026
+ "en-in": "dd/MM/yyyy",
3027
+ fr: "dd/MM/yyyy",
3028
+ "fr-fr": "dd/MM/yyyy",
3029
+ "fr-be": "dd/MM/yyyy",
3030
+ es: "dd/MM/yyyy",
3031
+ "es-es": "dd/MM/yyyy",
3032
+ pt: "dd/MM/yyyy",
3033
+ "pt-pt": "dd/MM/yyyy",
3034
+ "pt-br": "dd/MM/yyyy",
3035
+ it: "dd/MM/yyyy",
3036
+ "it-it": "dd/MM/yyyy",
3037
+ nl: "dd-MM-yyyy",
3038
+ "nl-nl": "dd-MM-yyyy",
3039
+ "nl-be": "dd/MM/yyyy",
3040
+ el: "dd/MM/yyyy",
3041
+ hu: "yyyy.MM.dd",
3042
+ // MM/dd/yyyy
3043
+ en: "MM/dd/yyyy",
3044
+ "en-us": "MM/dd/yyyy",
3045
+ "en-ca": "MM/dd/yyyy",
3046
+ // yyyy-MM-dd / yyyy/MM/dd
3047
+ ja: "yyyy/MM/dd",
3048
+ "ja-jp": "yyyy/MM/dd",
3049
+ ko: "yyyy.MM.dd",
3050
+ "ko-kr": "yyyy.MM.dd",
3051
+ zh: "yyyy/MM/dd",
3052
+ "zh-cn": "yyyy/MM/dd",
3053
+ "zh-tw": "yyyy/MM/dd",
3054
+ sv: "yyyy-MM-dd",
3055
+ "sv-se": "yyyy-MM-dd"
3056
+ };
3057
+ if (l[i])
3058
+ return l[i];
3059
+ if (l[t])
3060
+ return l[t];
3061
+ try {
3062
+ const o = new Intl.DateTimeFormat(n, {
3063
+ year: "numeric",
3064
+ month: "2-digit",
3065
+ day: "2-digit"
3066
+ }).formatToParts(new Date(2024, 0, 15));
3067
+ let s = "";
3068
+ for (const v of o)
3069
+ if (v.type === "day")
3070
+ s += "dd";
3071
+ else if (v.type === "month")
3072
+ s += "MM";
3073
+ else if (v.type === "year")
3074
+ s += "yyyy";
3075
+ else if (v.type === "literal") {
3076
+ const C = v.value.replace(/[\u00A0\u202F\u2009]/g, " ").trim();
3077
+ s += C || ".";
3078
+ }
3079
+ return !/y/.test(s) || !/M/.test(s) || !/d/.test(s) ? "yyyy-MM-dd" : s;
3080
+ } catch {
3081
+ return "yyyy-MM-dd";
3082
+ }
3083
+ }
3084
+ function Ci(n) {
3085
+ const t = On(n).replace(/dd[^\w]*/g, "").replace(/[^\w]*dd/g, "");
3086
+ return !/y/.test(t) || !/M/.test(t) ? "yyyy-MM" : t;
3087
+ }
3088
+ function kt() {
3089
+ if (typeof document < "u") {
3090
+ const n = document.documentElement?.lang;
3091
+ if (n && /^[a-zA-Z]{2,}/.test(n))
3092
+ return n;
3093
+ }
3094
+ return typeof navigator < "u" && navigator.language ? navigator.language : "en-US";
3095
+ }
3096
+ function Mi(n, i, t, l = !1) {
3097
+ dt[n] || (n = "date");
3098
+ let a = dt[n];
3099
+ l && (n === "datetime-local" || n === "time") && (a = a.replace("HH:mm", "HH:mm:ss"));
3100
+ let o = a;
3101
+ i && (n === "date" || n === "datetime-local" || n === "month") && (n === "date" ? o = On(t) : n === "datetime-local" ? o = `${On(t)} HH:mm${l ? ":ss" : ""}` : o = Ci(t)), n === "datetime-local" && (o = o.replace("T", " · "));
3102
+ const s = Ni[o] ?? o.replace(/y/g, "Y").replace(/M/g, "M").replace(/d/g, "D").replace(/H/g, "H").replace(/m/g, "M").replace(/s/g, "S");
3103
+ return { displayTpl: o, isoTpl: a, placeholder: s };
3104
+ }
3105
+ const $i = /* @__PURE__ */ new Set(["y", "M", "d", "H", "m", "s", "w"]);
3106
+ function sn(n) {
3107
+ return $i.has(n);
3108
+ }
3109
+ function et(n) {
3110
+ let i = 0;
3111
+ for (const t of n)
3112
+ sn(t) && i++;
3113
+ return i;
3114
+ }
3115
+ function nt(n, i) {
3116
+ let t = "", l = 0;
3117
+ for (const a of n)
3118
+ if (sn(a)) {
3119
+ if (l >= i.length)
3120
+ break;
3121
+ t += i[l++];
3122
+ } else {
3123
+ if (l === 0)
3124
+ break;
3125
+ l >= i.length, t += a;
3126
+ }
3127
+ return t;
3128
+ }
3129
+ function ki(n, i, t) {
3130
+ if (t.length === 0)
3131
+ return "";
3132
+ const l = {};
3133
+ let a = 0;
3134
+ for (const v of n)
3135
+ sn(v) && (a >= t.length ? (l[v] ?? (l[v] = [])).push("") : (l[v] ?? (l[v] = [])).push(t[a]), a++);
3136
+ const o = {};
3137
+ let s = "";
3138
+ for (const v of i)
3139
+ if (sn(v)) {
3140
+ const C = l[v] ?? [], K = o[v] ?? 0;
3141
+ s += C[K] ?? "", o[v] = K + 1;
3142
+ }
3143
+ return s;
3144
+ }
3145
+ function yn(n, i, t) {
3146
+ if (t.length === 0)
3147
+ return "";
3148
+ const l = {};
3149
+ let a = 0;
3150
+ for (const v of i)
3151
+ sn(v) && ((l[v] ?? (l[v] = [])).push(t[a] ?? ""), a++);
3152
+ const o = {};
3153
+ let s = "";
3154
+ for (const v of n)
3155
+ if (sn(v)) {
3156
+ const C = l[v] ?? [], K = o[v] ?? 0;
3157
+ s += C[K] ?? "", o[v] = K + 1;
3158
+ }
3159
+ return s.replace(/\s+$/, "");
3160
+ }
3161
+ function ut(n, i, t) {
3162
+ const l = et(i);
3163
+ if (t.length < l)
3164
+ return "";
3165
+ const a = ki(n, i, t);
3166
+ if (a.length < l)
3167
+ return "";
3168
+ let o = "", s = 0;
3169
+ for (const v of i)
3170
+ sn(v) ? o += a[s++] : o += v;
3171
+ return o;
3172
+ }
3173
+ function pt(n, i, t) {
3174
+ return n && (i && n < i ? i : t && n > t ? t : n);
3175
+ }
3176
+ function De(n) {
3177
+ return n.toString().padStart(2, "0");
3178
+ }
3179
+ function xn(n) {
3180
+ const i = /(\d{2}):(\d{2})(?::(\d{2}))?$/.exec(n);
3181
+ return i ? { hours: Number(i[1]), minutes: Number(i[2]), seconds: Number(i[3] ?? 0) } : null;
3182
+ }
3183
+ function ft(n, i, t, l, a) {
3184
+ const o = a ? `${De(i)}:${De(t)}:${De(l)}` : `${De(i)}:${De(t)}`;
3185
+ return n.replace(/\d{2}:\d{2}(?::\d{2})?$/, o);
3186
+ }
3187
+ function wt(n, i) {
3188
+ if (n <= 0)
3189
+ return i;
3190
+ const t = Math.floor(n / 864e5), l = `${De(Math.floor(n % 864e5 / 36e5))}:${De(Math.floor(n % 36e5 / 6e4))}:${De(Math.floor(n % 6e4 / 1e3))}`;
3191
+ return t > 0 ? `${t}d ${l}` : l;
3192
+ }
3193
+ function wi(n, i) {
3194
+ if (n <= 0)
3195
+ return i;
3196
+ const t = Math.floor(n / 864e5), l = Math.floor(n % 864e5 / 36e5), a = Math.floor(n % 36e5 / 6e4), o = Math.floor(n % 6e4 / 1e3), s = [];
3197
+ return t && s.push(`${t}d`), (t || l) && s.push(`${l}h`), (t || l || a) && s.push(`${a}m`), s.push(`${o}s`), s.join(" ");
3198
+ }
3199
+ function Ti(n, i) {
3200
+ if (n <= 0)
3201
+ return i;
3202
+ const t = Math.floor(n / 1e3), l = Math.floor(t / 3600), a = Math.floor(t % 3600 / 60), o = t % 60;
3203
+ return l > 0 ? `${De(l)}:${De(a)}:${De(o)}` : `${De(a)}:${De(o)}`;
3204
+ }
3205
+ function Di(n, i) {
3206
+ if (n <= 0)
3207
+ return i;
3208
+ const t = Math.floor(n / 1e3), l = Math.floor(t / 86400);
3209
+ if (l)
3210
+ return `${l}d`;
3211
+ const a = Math.floor(t / 3600);
3212
+ if (a)
3213
+ return `${a}h`;
3214
+ const o = Math.floor(t / 60);
3215
+ return o ? `${o}m` : `${t}s`;
3216
+ }
3217
+ function xi(n, i) {
3218
+ if (n <= 0)
3219
+ return i;
3220
+ const t = Math.floor(n / 1e3), l = Math.floor(t / 86400), a = Math.floor(t % 86400 / 3600), o = Math.floor(t % 3600 / 60), s = [];
3221
+ return l && s.push(`${l} ${l === 1 ? "day" : "days"}`), a && s.push(`${a} ${a === 1 ? "hour" : "hours"}`), o && s.push(`${o} ${o === 1 ? "minute" : "minutes"}`), s.length ? s.join(", ") : "less than a minute";
3222
+ }
3223
+ const Si = {
3224
+ verbose: wt,
3225
+ compact: wi,
3226
+ short: Ti,
3227
+ minimal: Di,
3228
+ words: xi
3229
+ };
3230
+ function Ai(n, i, t) {
3231
+ const l = n ? xn(n) : null, { hours: a, minutes: o, seconds: s } = l ?? { hours: 0, minutes: 0, seconds: 0 }, v = new Date(t);
3232
+ if (i != null) {
3233
+ const K = typeof i == "string" ? new Date(i) : new Date(i.getTime());
3234
+ if (!Number.isNaN(K.getTime()))
3235
+ return K.setHours(a, o, s, 0), K;
3236
+ }
3237
+ if (n && /^\d{4}-\d{2}-\d{2}T/.test(n)) {
3238
+ const K = new Date(n);
3239
+ if (!Number.isNaN(K.getTime()))
3240
+ return K;
3241
+ }
3242
+ const C = new Date(v);
3243
+ return C.setHours(a, o, s, 0), C.getTime() <= v.getTime() && C.setDate(C.getDate() + 1), C;
3244
+ }
3245
+ function Tn(n, i) {
3246
+ if (!n)
3247
+ return "";
3248
+ const t = n.replace(/[^0-9]/g, ""), l = et(i);
3249
+ return t.slice(0, l);
3250
+ }
3251
+ function ln(n, i, t) {
3252
+ const l = nt(n, t);
3253
+ let a = 0;
3254
+ const o = Math.min(i, l.length);
3255
+ for (let s = 0; s < o; s++)
3256
+ sn(n[s]) && a++;
3257
+ return Math.min(a, t.length);
3258
+ }
3259
+ function Ui(n, i, t) {
3260
+ if (t <= 0)
3261
+ return 0;
3262
+ const l = nt(n, i);
3263
+ let a = 0;
3264
+ for (let o = 0; o < l.length; o++)
3265
+ if (sn(n[o]) && (a++, a === t)) {
3266
+ let s = o + 1;
3267
+ for (; s < l.length && !sn(n[s]); )
3268
+ s++;
3269
+ return s;
3270
+ }
3271
+ return l.length;
3272
+ }
3273
+ const Kn = 40;
3274
+ function Ri() {
3275
+ return typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
3276
+ }
3277
+ const Ii = ({
3278
+ part: n,
3279
+ label: i,
3280
+ value: t,
3281
+ max: l,
3282
+ step: a,
3283
+ onPick: o,
3284
+ onStep: s,
3285
+ startHold: v,
3286
+ stopHold: C
3287
+ }) => {
3288
+ const K = Ne(null), le = Ne(!1), D = Ne(null), x = Ne(null), z = ve(() => {
3289
+ const w = [], F = a > 0 ? a : 1;
3290
+ for (let U = 0; U <= l; U += F)
3291
+ w.push(U);
3292
+ return w;
3293
+ }, [l, a]), re = Math.max(
3294
+ 0,
3295
+ Math.min(z.length - 1, Math.round(t / (a > 0 ? a : 1)))
3296
+ ), P = z.length, E = ve(() => [...z, ...z, ...z], [z]), k = P + re, H = Ne(!1);
3297
+ mt(() => {
3298
+ const w = K.current;
3299
+ if (!w)
3300
+ return;
3301
+ const F = k * Kn;
3302
+ if (Math.abs(w.scrollTop - F) < 1)
3303
+ return;
3304
+ const U = Math.abs(w.scrollTop / Kn - k);
3305
+ le.current = !0, D.current && (clearTimeout(D.current), D.current = null);
3306
+ const L = H.current && U <= 3 && !Ri();
3307
+ w.scrollTo({ top: F, behavior: L ? "smooth" : "instant" }), H.current = !0, x.current && clearTimeout(x.current), x.current = setTimeout(() => {
3308
+ le.current = !1;
3309
+ }, 380);
3310
+ }, [k]), Ie(
3311
+ () => () => {
3312
+ D.current && clearTimeout(D.current), x.current && clearTimeout(x.current);
3313
+ },
3314
+ []
3315
+ );
3316
+ const de = () => {
3317
+ le.current || (D.current && clearTimeout(D.current), D.current = setTimeout(() => {
3318
+ const w = K.current;
3319
+ if (!w)
3320
+ return;
3321
+ const F = Math.round(w.scrollTop / Kn), U = z[(F % P + P) % P];
3322
+ U !== t && o(U);
3323
+ }, 110));
3324
+ }, G = (w) => {
3325
+ w.key === "ArrowUp" ? (w.preventDefault(), s(-1)) : w.key === "ArrowDown" && (w.preventDefault(), s(1));
3326
+ }, fe = (w) => {
3327
+ const F = w.replace(/\D/g, "");
3328
+ if (!F)
3329
+ return;
3330
+ const U = Number(F.slice(-2));
3331
+ o(Math.max(0, Math.min(l, U)));
3332
+ }, ce = (w) => {
3333
+ K.current && K.current.scrollBy({ top: w.deltaY });
3334
+ };
3335
+ return /* @__PURE__ */ p("div", { className: "nice-datetime-popup__spinner", role: "group", "aria-label": i, children: [
3336
+ /* @__PURE__ */ e(
3337
+ "div",
3338
+ {
3339
+ ref: K,
3340
+ className: "nice-datetime-popup__spin-column",
3341
+ role: "listbox",
3342
+ tabIndex: -1,
3343
+ "aria-label": i,
3344
+ "aria-activedescendant": `${n}-opt-${k}`,
3345
+ onScroll: de,
3346
+ children: E.map((w, F) => /* @__PURE__ */ e(
3347
+ "button",
3348
+ {
3349
+ type: "button",
3350
+ id: `${n}-opt-${F}`,
3351
+ role: "option",
3352
+ "aria-selected": F === k,
3353
+ className: `nice-datetime-popup__spin-item${F === k ? " is-selected" : ""}`,
3354
+ onClick: () => o(w),
3355
+ tabIndex: -1,
3356
+ children: De(w)
3357
+ },
3358
+ F
3359
+ ))
3360
+ }
3361
+ ),
3362
+ /* @__PURE__ */ p("div", { className: "nice-datetime-popup__spin-center", onWheel: ce, children: [
3363
+ /* @__PURE__ */ e(
3364
+ "button",
3365
+ {
3366
+ type: "button",
3367
+ className: "nice-datetime-popup__spin-btn",
3368
+ onClick: () => s(-1),
3369
+ onPointerDown: () => v(() => s(-1)),
3370
+ onPointerUp: C,
3371
+ onPointerLeave: C,
3372
+ "aria-label": `${i} -`,
3373
+ tabIndex: -1,
3374
+ children: /* @__PURE__ */ e(Ee, { name: "chevron-up", size: 14 })
3375
+ }
3376
+ ),
3377
+ /* @__PURE__ */ e(
3378
+ "input",
3379
+ {
3380
+ className: "nice-datetime-popup__spin-value",
3381
+ inputMode: "numeric",
3382
+ "aria-label": i,
3383
+ value: De(t),
3384
+ onFocus: (w) => w.currentTarget.select(),
3385
+ onChange: (w) => fe(w.target.value),
3386
+ onKeyDown: G
3387
+ }
3388
+ ),
3389
+ /* @__PURE__ */ e(
3390
+ "button",
3391
+ {
3392
+ type: "button",
3393
+ className: "nice-datetime-popup__spin-btn",
3394
+ onClick: () => s(1),
3395
+ onPointerDown: () => v(() => s(1)),
3396
+ onPointerUp: C,
3397
+ onPointerLeave: C,
3398
+ "aria-label": `${i} +`,
3399
+ tabIndex: -1,
3400
+ children: /* @__PURE__ */ e(Ee, { name: "chevron-down", size: 14 })
3401
+ }
3402
+ )
3403
+ ] })
3404
+ ] });
3405
+ }, Ei = ({ hours: n, minutes: i, minuteStep: t, onChange: l, t: a }) => {
3406
+ const [o, s] = $e("hours"), v = Ne(null), C = 100, K = 78, le = 52, D = 62, x = 65, z = 18, re = n >= 12 ? "PM" : "AM", P = n % 12 === 0 ? 12 : n % 12, E = (f, m) => {
3407
+ const y = (f - 90) * Math.PI / 180;
3408
+ return { x: C + m * Math.cos(y), y: C + m * Math.sin(y) };
3409
+ }, k = (f) => {
3410
+ const m = re === "PM" ? f % 12 + 12 : f % 12;
3411
+ l(m, i);
3412
+ }, H = (f) => {
3413
+ const m = t && t > 1 ? t : 1, y = Math.round(f / m) * m % 60;
3414
+ l(n, y);
3415
+ }, de = (f) => {
3416
+ if (f === re)
3417
+ return;
3418
+ const m = f === "PM" ? n + 12 : n - 12;
3419
+ l((m % 24 + 24) % 24, i);
3420
+ }, G = (f) => {
3421
+ const m = f.currentTarget.getBoundingClientRect(), y = (f.clientX - m.left) / m.width * 200 - C, ne = (f.clientY - m.top) / m.height * 200 - C;
3422
+ let te = Math.atan2(ne, y) * 180 / Math.PI + 90;
3423
+ return te < 0 && (te += 360), { ang: te, radius: Math.hypot(y, ne) };
3424
+ }, fe = (f, m) => {
3425
+ if (f === "hours") {
3426
+ const y = Math.round(m / 30) % 12;
3427
+ k(y === 0 ? 12 : y);
3428
+ } else
3429
+ H(Math.round(m / 6) % 60);
3430
+ }, ce = (f) => {
3431
+ const { ang: m, radius: y } = G(f);
3432
+ if (y < z)
3433
+ return;
3434
+ const ne = y > x ? "hours" : "minutes";
3435
+ v.current = ne, s(ne), f.currentTarget.setPointerCapture?.(f.pointerId), fe(ne, m);
3436
+ }, w = (f) => {
3437
+ const m = v.current;
3438
+ m && fe(m, G(f).ang);
3439
+ }, F = (f) => {
3440
+ v.current && (v.current = null, f.currentTarget.releasePointerCapture?.(f.pointerId));
3441
+ }, U = Array.from({ length: 12 }, (f, m) => m + 1), L = t && t > 1 ? t : 5, Y = [];
3442
+ for (let f = 0; f < 60; f += L)
3443
+ Y.push(f);
3444
+ const A = t && t > 1 ? t : 1, J = Math.round(i / A) * A % 60, R = o === "hours", Q = E(P % 12 * 30, K), ee = E(J * 6, le);
3445
+ return /* @__PURE__ */ p("div", { className: "nice-datetime-popup__clock", children: [
3446
+ /* @__PURE__ */ p("div", { className: "nice-datetime-popup__clock-readout", children: [
3447
+ /* @__PURE__ */ e(
3448
+ "button",
3449
+ {
3450
+ type: "button",
3451
+ className: `nice-datetime-popup__clock-seg${o === "hours" ? " nice-datetime-popup__clock-seg--active" : ""}`,
3452
+ onClick: () => s("hours"),
3453
+ "aria-label": a("datetime.hours", "Hours"),
3454
+ children: De(P)
3455
+ }
3456
+ ),
3457
+ /* @__PURE__ */ e("span", { className: "nice-datetime-popup__clock-colon", children: ":" }),
3458
+ /* @__PURE__ */ e(
3459
+ "button",
3460
+ {
3461
+ type: "button",
3462
+ className: `nice-datetime-popup__clock-seg${o === "minutes" ? " nice-datetime-popup__clock-seg--active" : ""}`,
3463
+ onClick: () => s("minutes"),
3464
+ "aria-label": a("datetime.minutes", "Minutes"),
3465
+ children: De(i)
3466
+ }
3467
+ ),
3468
+ /* @__PURE__ */ p("div", { className: "nice-datetime-popup__clock-ampm", role: "group", children: [
3469
+ /* @__PURE__ */ e(
3470
+ "button",
3471
+ {
3472
+ type: "button",
3473
+ className: `nice-datetime-popup__clock-period${re === "AM" ? " nice-datetime-popup__clock-period--active" : ""}`,
3474
+ onClick: () => de("AM"),
3475
+ "aria-pressed": re === "AM",
3476
+ children: "AM"
3477
+ }
3478
+ ),
3479
+ /* @__PURE__ */ e(
3480
+ "button",
3481
+ {
3482
+ type: "button",
3483
+ className: `nice-datetime-popup__clock-period${re === "PM" ? " nice-datetime-popup__clock-period--active" : ""}`,
3484
+ onClick: () => de("PM"),
3485
+ "aria-pressed": re === "PM",
3486
+ children: "PM"
3487
+ }
3488
+ )
3489
+ ] })
3490
+ ] }),
3491
+ /* @__PURE__ */ p(
3492
+ "svg",
3493
+ {
3494
+ viewBox: "0 0 200 200",
3495
+ className: "nice-datetime-popup__clock-face",
3496
+ onPointerDown: ce,
3497
+ onPointerMove: w,
3498
+ onPointerUp: F,
3499
+ onPointerCancel: F,
3500
+ role: "img",
3501
+ "aria-label": a("datetime.clockMode", "Analog clock"),
3502
+ children: [
3503
+ /* @__PURE__ */ e("circle", { cx: C, cy: C, r: 96, className: "nice-datetime-popup__clock-bg" }),
3504
+ Y.map((f) => {
3505
+ const m = E(f * 6, D);
3506
+ return /* @__PURE__ */ e(
3507
+ "circle",
3508
+ {
3509
+ cx: m.x,
3510
+ cy: m.y,
3511
+ r: f === J ? 2.6 : 1.5,
3512
+ className: `nice-datetime-popup__clock-tick${f === J ? " nice-datetime-popup__clock-tick--active" : ""}`
3513
+ },
3514
+ `tick-${f}`
3515
+ );
3516
+ }),
3517
+ /* @__PURE__ */ e(
3518
+ "line",
3519
+ {
3520
+ x1: C,
3521
+ y1: C,
3522
+ x2: Q.x,
3523
+ y2: Q.y,
3524
+ className: `nice-datetime-popup__clock-hand nice-datetime-popup__clock-hand--hour${R ? " nice-datetime-popup__clock-hand--active" : ""}`
3525
+ }
3526
+ ),
3527
+ /* @__PURE__ */ e(
3528
+ "line",
3529
+ {
3530
+ x1: C,
3531
+ y1: C,
3532
+ x2: ee.x,
3533
+ y2: ee.y,
3534
+ className: `nice-datetime-popup__clock-hand nice-datetime-popup__clock-hand--minute${R ? "" : " nice-datetime-popup__clock-hand--active"}`
3535
+ }
3536
+ ),
3537
+ /* @__PURE__ */ e("circle", { cx: Q.x, cy: Q.y, r: 15, className: "nice-datetime-popup__clock-knob" }),
3538
+ /* @__PURE__ */ e(
3539
+ "circle",
3540
+ {
3541
+ cx: ee.x,
3542
+ cy: ee.y,
3543
+ r: 12,
3544
+ className: "nice-datetime-popup__clock-knob nice-datetime-popup__clock-knob--minute"
3545
+ }
3546
+ ),
3547
+ /* @__PURE__ */ e("circle", { cx: C, cy: C, r: 4, className: "nice-datetime-popup__clock-center" }),
3548
+ U.map((f) => {
3549
+ const m = E(f * 30, K);
3550
+ return /* @__PURE__ */ e(
3551
+ "text",
3552
+ {
3553
+ x: m.x,
3554
+ y: m.y,
3555
+ className: `nice-datetime-popup__clock-num${f === P ? " nice-datetime-popup__clock-num--active" : ""}`,
3556
+ textAnchor: "middle",
3557
+ dominantBaseline: "central",
3558
+ children: f
3559
+ },
3560
+ `h-${f}`
3561
+ );
3562
+ }),
3563
+ Y.map((f) => {
3564
+ const m = E(f * 6, le);
3565
+ return /* @__PURE__ */ e(
3566
+ "text",
3567
+ {
3568
+ x: m.x,
3569
+ y: m.y,
3570
+ className: `nice-datetime-popup__clock-num nice-datetime-popup__clock-num--minute${f === J ? " nice-datetime-popup__clock-num--active" : ""}`,
3571
+ textAnchor: "middle",
3572
+ dominantBaseline: "central",
3573
+ children: De(f)
3574
+ },
3575
+ `m-${f}`
3576
+ );
3577
+ })
3578
+ ]
3579
+ }
3580
+ )
3581
+ ] });
3582
+ }, Sn = bn(
3583
+ ({
3584
+ label: n,
3585
+ helperText: i,
3586
+ error: t,
3587
+ required: l,
3588
+ disabled: a,
3589
+ readOnly: o,
3590
+ size: s = "md",
3591
+ name: v,
3592
+ id: C,
3593
+ className: K,
3594
+ style: le,
3595
+ accessMode: D,
3596
+ value: x,
3597
+ onChange: z,
3598
+ onBlur: re,
3599
+ onKeyDown: P,
3600
+ min: E,
3601
+ max: k,
3602
+ type: H,
3603
+ dateFormatPreset: de,
3604
+ submitOnEnter: G,
3605
+ onSubmit: fe,
3606
+ showKeyboardHints: ce,
3607
+ displayStyle: w,
3608
+ labelPlacement: F,
3609
+ errorPlacement: U,
3610
+ loading: L,
3611
+ labelWidth: Y,
3612
+ controlWidth: A,
3613
+ placeholder: J,
3614
+ clearable: R = !1,
3615
+ showPickerButton: Q = !0,
3616
+ displayLocale: ee,
3617
+ keyboardShortcuts: f = !0,
3618
+ showSeconds: m = !1,
3619
+ minuteStep: y = 1,
3620
+ showNow: ne = !1,
3621
+ hourFormat: te = "24",
3622
+ timeSelectorType: b = "spinners",
3623
+ targetDate: h,
3624
+ onTargetChange: O,
3625
+ countdown: V = !1,
3626
+ countdownFormat: be = "verbose",
3627
+ formatCountdown: oe,
3628
+ countdownLabel: ue,
3629
+ countdownInterval: M = 1e3,
3630
+ countdownDoneText: W
3631
+ }, X) => {
3632
+ const we = qn("input", w), ze = Un("input", w), B = dn(D, C), ye = B === "hidden";
3633
+ B === "disabled" && (a = !0), B === "readOnly" && (o = !0);
3634
+ const { t: j } = We(), Ue = un(C), g = Ne(null), T = Ne(null), d = Ne(null), pe = Ne(null), [q, ie] = $e(!1), [N, Ke] = $e(null), [qe, en] = $e(""), [Ye, ae] = $e(b);
3635
+ Ie(() => {
3636
+ ae(b);
3637
+ }, [b]);
3638
+ const Xe = Yt(zt)?.portalTarget ?? (typeof document < "u" ? document.body : null), { start: nn, stop: pn } = Pt(), Ze = de ? bi[de] : null, ke = Ze?.inputType ?? H ?? "date", fn = Ze?.localized ?? !1, $ = ee ?? kt(), u = ve(
3639
+ () => Mi(ke, fn, $, m),
3640
+ [ke, fn, $, m]
3641
+ ), he = ve(() => et(u.isoTpl), [u.isoTpl]), [Ve, Fe] = $e(() => {
3642
+ const c = Tn(x, u.isoTpl);
3643
+ return yn(u.displayTpl, u.isoTpl, c);
3644
+ }), Oe = Ne(Ve);
3645
+ Ie(() => {
3646
+ Oe.current = Ve;
3647
+ }, [Ve]);
3648
+ const je = Ne(x ?? ""), tn = Ne(null);
3649
+ Ie(() => {
3650
+ const c = x ?? "";
3651
+ if (c === je.current)
3652
+ return;
3653
+ const _ = Tn(c, u.isoTpl), S = yn(u.displayTpl, u.isoTpl, _);
3654
+ Fe(S), je.current = c;
3655
+ }, [x, u.displayTpl, u.isoTpl]), Ie(() => {
3656
+ const c = Tn(x, u.isoTpl);
3657
+ Fe(yn(u.displayTpl, u.isoTpl, c));
3658
+ }, [u.displayTpl, u.isoTpl]), Ie(() => {
3659
+ if (tn.current == null)
3660
+ return;
3661
+ const c = tn.current;
3662
+ tn.current = null;
3663
+ const _ = g.current;
3664
+ if (_ && document.activeElement === _)
3665
+ try {
3666
+ _.setSelectionRange(c, c);
3667
+ } catch {
3668
+ }
3669
+ });
3670
+ const Rn = ve(
3671
+ () => nt(u.displayTpl, Ve),
3672
+ [u.displayTpl, Ve]
3673
+ ), Dn = J ?? u.placeholder, zn = Math.max(u.displayTpl.length + 1, 9), In = Bt({
3674
+ enabled: G,
3675
+ onSubmit: fe
3676
+ }), Pe = I(
3677
+ (c, _) => {
3678
+ const S = c.slice(0, he);
3679
+ Oe.current = S, Fe(S), tn.current = Ui(
3680
+ u.displayTpl,
3681
+ S,
3682
+ Math.max(0, Math.min(S.length, _))
3683
+ );
3684
+ const ge = pt(ut(u.displayTpl, u.isoTpl, S), E, k);
3685
+ ge !== je.current && (je.current = ge, z?.(ge));
3686
+ },
3687
+ [z, u.displayTpl, u.isoTpl, he, E, k]
3688
+ ), rn = I(
3689
+ (c) => {
3690
+ const _ = pt(c, E, k), S = Tn(_, u.isoTpl);
3691
+ je.current = _, Fe(yn(u.displayTpl, u.isoTpl, S)), z?.(_);
3692
+ },
3693
+ [z, u.displayTpl, u.isoTpl, E, k]
3694
+ ), cn = ke === "time" || ke === "datetime-local", Nn = I(
3695
+ () => ut(u.displayTpl, u.isoTpl, Oe.current),
3696
+ [u.displayTpl, u.isoTpl]
3697
+ ), Pn = I(() => {
3698
+ if (a || o)
3699
+ return;
3700
+ const c = Nn(), _ = c ? xn(c) : null;
3701
+ if (!_)
3702
+ return;
3703
+ const S = _.hours >= 12 ? _.hours - 12 : _.hours + 12;
3704
+ rn(ft(c, S, _.minutes, _.seconds, m));
3705
+ }, [a, o, Nn, rn, m]), Bn = (() => {
3706
+ const c = xn(x ?? "");
3707
+ return c && c.hours >= 12 ? "PM" : "AM";
3708
+ })(), Hn = I(
3709
+ (c) => {
3710
+ if (In(c), o || a) {
3711
+ P?.(c);
3712
+ return;
3713
+ }
3714
+ const _ = c.key;
3715
+ if (c.ctrlKey || c.metaKey || c.altKey) {
3716
+ P?.(c);
3717
+ return;
3718
+ }
3719
+ if (cn && (_ === "ArrowUp" || _ === "ArrowDown")) {
3720
+ const _e = Nn(), Ae = _e ? xn(_e) : null;
3721
+ if (Ae) {
3722
+ c.preventDefault();
3723
+ const Ce = _ === "ArrowUp" ? 1 : -1;
3724
+ let { minutes: He, seconds: Je } = Ae;
3725
+ m ? Je = ((Je + Ce) % 60 + 60) % 60 : He = ((He + Ce * y) % 60 + 60) % 60, rn(ft(_e, Ae.hours, He, Je, m)), P?.(c);
3726
+ return;
3727
+ }
3728
+ }
3729
+ const S = Oe.current;
3730
+ if (_ === "Escape" && S.length > 0) {
3731
+ c.preventDefault(), Pe("", 0), P?.(c);
3732
+ return;
3733
+ }
3734
+ if (f && (u.isoTpl === "yyyy-MM-dd" || u.isoTpl === "yyyy-MM-ddTHH:mm" || u.isoTpl === "yyyy-MM")) {
3735
+ const _e = (Ce) => {
3736
+ const He = String(Ce.getFullYear()).padStart(4, "0"), Je = String(Ce.getMonth() + 1).padStart(2, "0"), kn = String(Ce.getDate()).padStart(2, "0");
3737
+ let wn = "";
3738
+ if (u.isoTpl === "yyyy-MM")
3739
+ wn = `${He}-${Je}`;
3740
+ else if (u.isoTpl === "yyyy-MM-dd")
3741
+ wn = `${He}-${Je}-${kn}`;
3742
+ else {
3743
+ const Ut = String(Ce.getHours()).padStart(2, "0"), Rt = String(Ce.getMinutes()).padStart(2, "0");
3744
+ wn = `${He}-${Je}-${kn}T${Ut}:${Rt}`;
3745
+ }
3746
+ rn(wn);
3747
+ }, Ae = () => {
3748
+ if (x && /^\d{4}-\d{2}/.test(x)) {
3749
+ const Ce = new Date(x);
3750
+ if (!Number.isNaN(Ce.getTime()))
3751
+ return Ce;
3752
+ }
3753
+ return /* @__PURE__ */ new Date();
3754
+ };
3755
+ if (_ === "t" || _ === "T") {
3756
+ c.preventDefault(), _e(/* @__PURE__ */ new Date()), P?.(c);
3757
+ return;
3758
+ }
3759
+ if (_ === "+" || _ === "=" || _ === "-") {
3760
+ c.preventDefault();
3761
+ const Ce = _ === "-" ? -1 : 1, He = Ae();
3762
+ He.setDate(He.getDate() + Ce), _e(He), P?.(c);
3763
+ return;
3764
+ }
3765
+ if (_ === "m" || _ === "M") {
3766
+ c.preventDefault();
3767
+ const Ce = Ae();
3768
+ Ce.setMonth(Ce.getMonth() + (_ === "M" ? -1 : 1)), _e(Ce), P?.(c);
3769
+ return;
3770
+ }
3771
+ if (_ === "y" || _ === "Y") {
3772
+ c.preventDefault();
3773
+ const Ce = Ae();
3774
+ Ce.setFullYear(Ce.getFullYear() + (_ === "Y" ? -1 : 1)), _e(Ce), P?.(c);
3775
+ return;
3776
+ }
3777
+ }
3778
+ const ge = c.currentTarget, Se = ge.selectionStart ?? 0, Be = ge.selectionEnd ?? 0;
3779
+ if (/^[0-9]$/.test(_)) {
3780
+ c.preventDefault();
3781
+ const _e = ln(u.displayTpl, Se, S), Ae = ln(u.displayTpl, Be, S), Ce = S.slice(0, _e), He = S.slice(Ae);
3782
+ let Je = (Ce + _ + He).slice(0, he);
3783
+ _e === Ae && Ce.length + 1 + He.length > he && (Je = (Ce + _ + He.slice(1)).slice(0, he)), Pe(Je, _e + 1), P?.(c);
3784
+ return;
3785
+ }
3786
+ if (_ === "Backspace") {
3787
+ if (c.preventDefault(), Se !== Be) {
3788
+ const _e = ln(u.displayTpl, Se, S), Ae = ln(u.displayTpl, Be, S), Ce = S.slice(0, _e) + S.slice(Ae);
3789
+ Pe(Ce, _e);
3790
+ } else {
3791
+ const _e = ln(u.displayTpl, Se, S);
3792
+ if (_e === 0) {
3793
+ P?.(c);
3794
+ return;
3795
+ }
3796
+ const Ae = S.slice(0, _e - 1) + S.slice(_e);
3797
+ Pe(Ae, _e - 1);
3798
+ }
3799
+ P?.(c);
3800
+ return;
3801
+ }
3802
+ if (_ === "Delete") {
3803
+ if (c.preventDefault(), Se !== Be) {
3804
+ const _e = ln(u.displayTpl, Se, S), Ae = ln(u.displayTpl, Be, S), Ce = S.slice(0, _e) + S.slice(Ae);
3805
+ Pe(Ce, _e);
3806
+ } else {
3807
+ const _e = ln(u.displayTpl, Se, S);
3808
+ if (_e >= S.length) {
3809
+ P?.(c);
3810
+ return;
3811
+ }
3812
+ const Ae = S.slice(0, _e) + S.slice(_e + 1);
3813
+ Pe(Ae, _e);
3814
+ }
3815
+ P?.(c);
3816
+ return;
3817
+ }
3818
+ P?.(c);
3819
+ },
3820
+ [
3821
+ Pe,
3822
+ a,
3823
+ In,
3824
+ P,
3825
+ o,
3826
+ u.displayTpl,
3827
+ u.isoTpl,
3828
+ he,
3829
+ f,
3830
+ x,
3831
+ cn,
3832
+ Nn,
3833
+ rn,
3834
+ m,
3835
+ y
3836
+ ]
3837
+ ), [Cn, En] = $e(() => Date.now());
3838
+ Ie(() => {
3839
+ if (!V)
3840
+ return;
3841
+ const c = window.setInterval(
3842
+ () => En(Date.now()),
3843
+ Math.max(100, M)
3844
+ );
3845
+ return () => window.clearInterval(c);
3846
+ }, [V, M]);
3847
+ const r = ve(
3848
+ () => Ai(x, h, Cn),
3849
+ [x, h, Cn]
3850
+ ), Z = Ne(0);
3851
+ Ie(() => {
3852
+ if (!O)
3853
+ return;
3854
+ const c = r.getTime();
3855
+ c !== Z.current && (Z.current = c, O(r));
3856
+ }, [r, O]);
3857
+ const se = ve(() => {
3858
+ if (!V)
3859
+ return null;
3860
+ const c = r.getTime() - Cn;
3861
+ return oe ? oe(c, r) : (Si[be] ?? wt)(c, W ?? j("datetime.countdownDone", "Done"));
3862
+ }, [V, r, Cn, oe, be, W, j]), Me = I(
3863
+ (c) => {
3864
+ if (o || a)
3865
+ return;
3866
+ const _ = c.clipboardData.getData("text");
3867
+ if (!_)
3868
+ return;
3869
+ c.preventDefault();
3870
+ const S = Oe.current, ge = _.replace(/[^0-9]/g, "");
3871
+ let Se;
3872
+ ge.length === he && (_.includes("-") || _.includes("T")) ? Se = yn(u.displayTpl, u.isoTpl, ge) : Se = ge.slice(0, he);
3873
+ const Be = c.currentTarget, _e = Be.selectionStart ?? 0, Ae = Be.selectionEnd ?? 0, Ce = ln(u.displayTpl, _e, S), He = ln(u.displayTpl, Ae, S), Je = S.slice(0, Ce), kn = S.slice(He), wn = (Je + Se + kn).slice(0, he);
3874
+ Pe(wn, Math.min(he, Je.length + Se.length));
3875
+ },
3876
+ [Pe, a, o, u.displayTpl, u.isoTpl, he]
3877
+ ), Te = I(
3878
+ (c) => {
3879
+ const _ = c;
3880
+ if (_.inputType === "insertText" || _.inputType === "insertCompositionText" || _.inputType === "insertFromComposition") {
3881
+ const S = _.data ?? "";
3882
+ if (!/^[0-9]+$/.test(S)) {
3883
+ c.preventDefault();
3884
+ return;
3885
+ }
3886
+ if (S.length > 1) {
3887
+ c.preventDefault();
3888
+ const ge = c.currentTarget, Se = ge.selectionStart ?? 0, Be = ge.selectionEnd ?? 0, _e = Oe.current, Ae = ln(u.displayTpl, Se, _e), Ce = ln(u.displayTpl, Be, _e), He = _e.slice(0, Ae), Je = _e.slice(Ce), kn = (He + S + Je).slice(0, he);
3889
+ Pe(kn, Math.min(he, He.length + S.length));
3890
+ }
3891
+ }
3892
+ },
3893
+ [Pe, u.displayTpl, he]
3894
+ ), me = I(
3895
+ (c) => {
3896
+ if (o || a)
3897
+ return;
3898
+ const _ = c.target.value, S = _.replace(/[^0-9]/g, "").slice(0, he);
3899
+ if (S !== Oe.current)
3900
+ if (S.length === he && (_.includes("-") || _.includes("T") || _.includes(":"))) {
3901
+ const ge = yn(u.displayTpl, u.isoTpl, S);
3902
+ Pe(ge, ge.length);
3903
+ } else
3904
+ Pe(S, S.length);
3905
+ },
3906
+ [Pe, a, o, u.displayTpl, u.isoTpl, he]
3907
+ ), Le = I(() => {
3908
+ Pe("", 0), requestAnimationFrame(() => g.current?.focus());
3909
+ }, [Pe]), Re = I(() => {
3910
+ if (a || o)
3911
+ return;
3912
+ if (ke === "date" || ke === "datetime-local" || ke === "time") {
3913
+ ie((S) => !S);
3914
+ return;
3915
+ }
3916
+ const c = T.current;
3917
+ if (!c)
3918
+ return;
3919
+ const _ = c;
3920
+ try {
3921
+ if (typeof _.showPicker == "function") {
3922
+ _.showPicker();
3923
+ return;
3924
+ }
3925
+ } catch {
3926
+ }
3927
+ c.focus(), c.click();
3928
+ }, [a, o, ke]), Qe = I(
3929
+ (c) => {
3930
+ const _ = c.target.value, S = Tn(_, u.isoTpl), ge = yn(u.displayTpl, u.isoTpl, S);
3931
+ je.current = _, Fe(ge), z?.(_), requestAnimationFrame(() => g.current?.focus());
3932
+ },
3933
+ [z, u.displayTpl, u.isoTpl]
3934
+ ), Fn = I(() => {
3935
+ if (a || o)
3936
+ return;
3937
+ const c = /* @__PURE__ */ new Date(), _ = (Ae) => String(Ae).padStart(2, "0"), S = `${c.getFullYear()}-${_(c.getMonth() + 1)}-${_(c.getDate())}`, ge = `${_(c.getHours())}:${_(c.getMinutes())}`, Se = m ? `${ge}:${_(c.getSeconds())}` : ge;
3938
+ let Be;
3939
+ ke === "time" ? Be = Se : ke === "datetime-local" ? Be = `${S}T${Se}` : ke === "month" ? Be = `${c.getFullYear()}-${_(c.getMonth() + 1)}` : Be = S;
3940
+ const _e = Tn(Be, u.isoTpl);
3941
+ je.current = Be, Fe(yn(u.displayTpl, u.isoTpl, _e)), z?.(Be);
3942
+ }, [a, o, ke, m, z, u.displayTpl, u.isoTpl]), mn = ke === "date" || ke === "datetime-local", hn = (() => {
3943
+ const c = /^(\d{4}-\d{2}-\d{2})/.exec(x ?? "");
3944
+ return c ? c[1] : "";
3945
+ })(), an = xn(x ?? "") ?? { hours: 0, minutes: 0, seconds: 0 }, gn = () => {
3946
+ const c = /* @__PURE__ */ new Date();
3947
+ return `${c.getFullYear()}-${De(c.getMonth() + 1)}-${De(c.getDate())}`;
3948
+ }, Mn = (c, _) => {
3949
+ const S = m ? `${De(_.hours)}:${De(_.minutes)}:${De(_.seconds)}` : `${De(_.hours)}:${De(_.minutes)}`;
3950
+ let ge;
3951
+ ke === "time" ? ge = S : ke === "datetime-local" ? ge = `${c}T${S}` : ge = c, rn(ge);
3952
+ }, Gn = (c) => {
3953
+ c && Mn(c, cn ? an : { hours: 0, minutes: 0, seconds: 0 });
3954
+ }, $n = (c, _) => {
3955
+ Mn(mn ? hn || gn() : "", { ...an, [c]: _ });
3956
+ }, tt = (c) => c === "hours" ? 23 : 59, it = (c) => c === "minutes" && y && y > 0 ? y : 1, Tt = (c, _) => {
3957
+ const S = tt(c), ge = it(c), Se = S + 1, Be = ((an[c] + _ * ge) % Se + Se) % Se;
3958
+ $n(c, Be);
3959
+ }, Yn = (c, _, S) => /* @__PURE__ */ e(
3960
+ Ii,
3961
+ {
3962
+ part: c,
3963
+ label: j(_, S),
3964
+ value: an[c],
3965
+ max: tt(c),
3966
+ step: it(c),
3967
+ onPick: (ge) => $n(c, ge),
3968
+ onStep: (ge) => Tt(c, ge),
3969
+ startHold: nn,
3970
+ stopHold: pn
3971
+ }
3972
+ ), Dt = () => {
3973
+ Mn(gn(), cn ? an : { hours: 0, minutes: 0, seconds: 0 });
3974
+ }, Ln = (() => {
3975
+ const c = gn(), _ = E && E.length >= 10 ? E.slice(0, 10) : E, S = k && k.length >= 10 ? k.slice(0, 10) : k;
3976
+ return !!(_ && c < _ || S && c > S);
3977
+ })(), xt = () => {
3978
+ ie(!1), requestAnimationFrame(() => g.current?.focus());
3979
+ };
3980
+ mt(() => {
3981
+ if (!q)
3982
+ return;
3983
+ const c = d.current?.getBoundingClientRect();
3984
+ c && (Ke({ left: c.left, top: c.bottom + 6 }), en(Jt(d.current)));
3985
+ }, [q]), Ie(() => {
3986
+ if (!q)
3987
+ return;
3988
+ const c = (ge) => {
3989
+ const Se = ge.target;
3990
+ d.current?.contains(Se) || pe.current?.contains(Se) || ie(!1);
3991
+ }, _ = (ge) => {
3992
+ ge.key === "Escape" && ie(!1);
3993
+ }, S = () => {
3994
+ const ge = d.current?.getBoundingClientRect();
3995
+ ge && Ke({ left: ge.left, top: ge.bottom + 6 });
3996
+ };
3997
+ return document.addEventListener("mousedown", c), document.addEventListener("keydown", _), window.addEventListener("scroll", S, !0), window.addEventListener("resize", S), () => {
3998
+ document.removeEventListener("mousedown", c), document.removeEventListener("keydown", _), window.removeEventListener("scroll", S, !0), window.removeEventListener("resize", S);
3999
+ };
4000
+ }, [q]);
4001
+ const St = I(
4002
+ (c) => {
4003
+ g.current = c, typeof X == "function" ? X(c) : X && (X.current = c);
4004
+ },
4005
+ [X]
4006
+ ), at = ve(() => {
4007
+ const c = [];
4008
+ return G && c.push(Ge.submit), c.push({ key: "Esc", description: j("shortcuts.clearDate", "Clear value") }), c;
4009
+ }, [G, j]), At = ke === "time";
4010
+ return ye ? null : /* @__PURE__ */ p(
4011
+ "div",
4012
+ {
4013
+ className: `nice-field nice-field--${s}${F ? ` nice-field--label-${F}` : ""}${U === "right" ? " nice-field--error-right" : ""} ${L ? "nice-field--loading" : ""} ${K || ""}`,
4014
+ style: {
4015
+ ...le,
4016
+ ...Y != null && {
4017
+ "--nice-field-label-width": typeof Y == "number" ? `${Y}px` : Y
4018
+ },
4019
+ ...A != null && {
4020
+ "--nice-field-control-width": typeof A == "number" ? `${A}px` : A
4021
+ }
4022
+ },
4023
+ "aria-busy": L || void 0,
4024
+ children: [
4025
+ n && /* @__PURE__ */ p(
4026
+ "label",
4027
+ {
4028
+ htmlFor: Ue,
4029
+ className: `nice-field__label ${l ? "nice-field__label--required" : ""}`,
4030
+ children: [
4031
+ n,
4032
+ ce && at.length > 0 && /* @__PURE__ */ e(_n, { shortcuts: at, size: "sm" })
4033
+ ]
4034
+ }
4035
+ ),
4036
+ /* @__PURE__ */ p("div", { className: "nice-field__control", children: [
4037
+ /* @__PURE__ */ p(
4038
+ "div",
4039
+ {
4040
+ ref: d,
4041
+ className: `nice-input nice-input--date nice-input--${s} nice-input--ds-${ze} ${t ? "nice-input--error" : ""} ${a ? "nice-input--disabled" : ""} ${o ? "nice-input--readonly" : ""}`,
4042
+ style: { ...we, width: "fit-content", position: "relative" },
4043
+ children: [
4044
+ /* @__PURE__ */ e(
4045
+ "input",
4046
+ {
4047
+ ref: St,
4048
+ id: Ue,
4049
+ className: "nice-input__native nice-masked-input",
4050
+ type: "text",
4051
+ name: v,
4052
+ value: Rn,
4053
+ placeholder: Dn,
4054
+ disabled: a || L,
4055
+ readOnly: o,
4056
+ autoComplete: "off",
4057
+ spellCheck: !1,
4058
+ inputMode: "numeric",
4059
+ "aria-invalid": !!t,
4060
+ "aria-label": n ? void 0 : j("controls.date", "Date"),
4061
+ "data-display-tpl": u.displayTpl,
4062
+ "data-iso-tpl": u.isoTpl,
4063
+ style: {
4064
+ width: `${zn}ch`,
4065
+ fontFamily: "ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",
4066
+ fontVariantNumeric: "tabular-nums"
4067
+ },
4068
+ onBeforeInput: Te,
4069
+ onChange: me,
4070
+ onBlur: re,
4071
+ onKeyDown: Hn,
4072
+ onPaste: Me
4073
+ }
4074
+ ),
4075
+ R && /* @__PURE__ */ e(
4076
+ "button",
4077
+ {
4078
+ type: "button",
4079
+ className: "nice-input__clear",
4080
+ onClick: Le,
4081
+ disabled: !x || a || o,
4082
+ "aria-label": j("controls.clear", "Clear"),
4083
+ tabIndex: x && !a && !o ? 0 : -1,
4084
+ children: /* @__PURE__ */ e(Ee, { name: "close", size: 14 })
4085
+ }
4086
+ ),
4087
+ Q && /* @__PURE__ */ p(vn, { children: [
4088
+ /* @__PURE__ */ e(
4089
+ "button",
4090
+ {
4091
+ type: "button",
4092
+ className: "nice-input__picker-trigger",
4093
+ onClick: Re,
4094
+ "aria-label": j("controls.openPicker", "Open picker"),
4095
+ tabIndex: -1,
4096
+ disabled: a || o,
4097
+ children: At ? (
4098
+ /* Clock icon */
4099
+ /* @__PURE__ */ p(
4100
+ "svg",
4101
+ {
4102
+ width: "16",
4103
+ height: "16",
4104
+ viewBox: "0 0 24 24",
4105
+ fill: "none",
4106
+ "aria-hidden": "true",
4107
+ focusable: "false",
4108
+ children: [
4109
+ /* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "9", stroke: "currentColor", strokeWidth: "1.8" }),
4110
+ /* @__PURE__ */ e(
4111
+ "path",
4112
+ {
4113
+ d: "M12 7v5l3.5 2",
4114
+ stroke: "currentColor",
4115
+ strokeWidth: "1.8",
4116
+ strokeLinecap: "round",
4117
+ strokeLinejoin: "round"
4118
+ }
4119
+ )
4120
+ ]
4121
+ }
4122
+ )
4123
+ ) : (
4124
+ /* Calendar icon — outline style, matches NtdCalendar.outline */
4125
+ /* @__PURE__ */ p(
4126
+ "svg",
4127
+ {
4128
+ width: "16",
4129
+ height: "16",
4130
+ viewBox: "0 0 24 24",
4131
+ fill: "none",
4132
+ "aria-hidden": "true",
4133
+ focusable: "false",
4134
+ children: [
4135
+ /* @__PURE__ */ e(
4136
+ "rect",
4137
+ {
4138
+ x: "3.25",
4139
+ y: "4.5",
4140
+ width: "17.5",
4141
+ height: "16.5",
4142
+ rx: "2",
4143
+ stroke: "currentColor",
4144
+ strokeWidth: "1.7"
4145
+ }
4146
+ ),
4147
+ /* @__PURE__ */ e(
4148
+ "line",
4149
+ {
4150
+ x1: "16",
4151
+ y1: "2.5",
4152
+ x2: "16",
4153
+ y2: "6.5",
4154
+ stroke: "currentColor",
4155
+ strokeWidth: "1.7",
4156
+ strokeLinecap: "round"
4157
+ }
4158
+ ),
4159
+ /* @__PURE__ */ e(
4160
+ "line",
4161
+ {
4162
+ x1: "8",
4163
+ y1: "2.5",
4164
+ x2: "8",
4165
+ y2: "6.5",
4166
+ stroke: "currentColor",
4167
+ strokeWidth: "1.7",
4168
+ strokeLinecap: "round"
4169
+ }
4170
+ ),
4171
+ /* @__PURE__ */ e(
4172
+ "line",
4173
+ {
4174
+ x1: "3.25",
4175
+ y1: "9.75",
4176
+ x2: "20.75",
4177
+ y2: "9.75",
4178
+ stroke: "currentColor",
4179
+ strokeWidth: "1.5"
4180
+ }
4181
+ )
4182
+ ]
4183
+ }
4184
+ )
4185
+ )
4186
+ }
4187
+ ),
4188
+ /* @__PURE__ */ e(
4189
+ "input",
4190
+ {
4191
+ ref: T,
4192
+ type: ke,
4193
+ className: "nice-input__picker-companion",
4194
+ value: x ?? "",
4195
+ min: E,
4196
+ max: k,
4197
+ step: ke === "time" || ke === "datetime-local" ? m ? 1 : y ? y * 60 : void 0 : void 0,
4198
+ onChange: Qe,
4199
+ tabIndex: -1,
4200
+ "aria-hidden": "true",
4201
+ style: {
4202
+ position: "absolute",
4203
+ width: 0,
4204
+ height: 0,
4205
+ opacity: 0,
4206
+ pointerEvents: "none",
4207
+ border: 0,
4208
+ padding: 0,
4209
+ left: 0,
4210
+ bottom: 0
4211
+ }
4212
+ }
4213
+ )
4214
+ ] }),
4215
+ cn && te === "12" && !a && !o && /* @__PURE__ */ e(
4216
+ "button",
4217
+ {
4218
+ type: "button",
4219
+ className: "nice-input__ampm",
4220
+ onClick: Pn,
4221
+ disabled: !x,
4222
+ "aria-label": j("datetime.toggleAmPm", "Toggle AM/PM"),
4223
+ tabIndex: -1,
4224
+ children: Bn
4225
+ }
4226
+ ),
4227
+ ne && !a && !o && /* @__PURE__ */ e("button", { type: "button", className: "nice-input__now", onClick: Fn, tabIndex: -1, children: j("controls.now", "Now") })
4228
+ ]
4229
+ }
4230
+ ),
4231
+ q && N && Xe && ht(
4232
+ /* @__PURE__ */ p(
4233
+ "div",
4234
+ {
4235
+ ref: pe,
4236
+ className: `nice-datetime-popup${qe ? ` ${qe}` : ""}`,
4237
+ style: {
4238
+ position: "fixed",
4239
+ left: N.left,
4240
+ top: N.top,
4241
+ zIndex: 1e3
4242
+ },
4243
+ role: "dialog",
4244
+ "aria-label": j("controls.openPicker", "Open picker"),
4245
+ children: [
4246
+ /* @__PURE__ */ p("div", { className: "nice-datetime-popup__body", children: [
4247
+ mn && /* @__PURE__ */ e("div", { className: "nice-datetime-popup__col nice-datetime-popup__col--date", children: /* @__PURE__ */ e(
4248
+ $t,
4249
+ {
4250
+ value: hn,
4251
+ onChange: Gn,
4252
+ min: E && E.length >= 10 ? E.slice(0, 10) : void 0,
4253
+ max: k && k.length >= 10 ? k.slice(0, 10) : void 0
4254
+ }
4255
+ ) }),
4256
+ cn && /* @__PURE__ */ p("div", { className: "nice-datetime-popup__col nice-datetime-popup__col--time", children: [
4257
+ /* @__PURE__ */ p(
4258
+ "div",
4259
+ {
4260
+ className: "nice-datetime-popup__time-modes",
4261
+ role: "group",
4262
+ "aria-label": j("datetime.timeSelector", "Time selector"),
4263
+ children: [
4264
+ /* @__PURE__ */ e(
4265
+ "button",
4266
+ {
4267
+ type: "button",
4268
+ className: `nice-datetime-popup__mode-btn${Ye === "spinners" ? " nice-datetime-popup__mode-btn--active" : ""}`,
4269
+ onClick: () => ae("spinners"),
4270
+ "aria-pressed": Ye === "spinners",
4271
+ "aria-label": j("datetime.spinnersMode", "Spinner wheels"),
4272
+ title: j("datetime.spinnersMode", "Spinner wheels"),
4273
+ tabIndex: -1,
4274
+ children: /* @__PURE__ */ e(Ee, { name: "list", size: 16 })
4275
+ }
4276
+ ),
4277
+ /* @__PURE__ */ e(
4278
+ "button",
4279
+ {
4280
+ type: "button",
4281
+ className: `nice-datetime-popup__mode-btn${Ye === "clock" ? " nice-datetime-popup__mode-btn--active" : ""}`,
4282
+ onClick: () => ae("clock"),
4283
+ "aria-pressed": Ye === "clock",
4284
+ "aria-label": j("datetime.clockMode", "Analog clock"),
4285
+ title: j("datetime.clockMode", "Analog clock"),
4286
+ tabIndex: -1,
4287
+ children: /* @__PURE__ */ e(Ee, { name: "clock", size: 16 })
4288
+ }
4289
+ )
4290
+ ]
4291
+ }
4292
+ ),
4293
+ Ye === "clock" ? /* @__PURE__ */ e(
4294
+ Ei,
4295
+ {
4296
+ hours: an.hours,
4297
+ minutes: an.minutes,
4298
+ minuteStep: y,
4299
+ onChange: (c, _) => Mn(mn ? hn || gn() : "", {
4300
+ ...an,
4301
+ hours: c,
4302
+ minutes: _
4303
+ }),
4304
+ t: j
4305
+ }
4306
+ ) : /* @__PURE__ */ p("div", { className: "nice-datetime-popup__time", role: "group", children: [
4307
+ Yn("hours", "datetime.hours", "Hours"),
4308
+ /* @__PURE__ */ e("span", { className: "nice-datetime-popup__time-sep", children: ":" }),
4309
+ Yn("minutes", "datetime.minutes", "Minutes"),
4310
+ m && /* @__PURE__ */ p(vn, { children: [
4311
+ /* @__PURE__ */ e("span", { className: "nice-datetime-popup__time-sep", children: ":" }),
4312
+ Yn("seconds", "datetime.seconds", "Seconds")
4313
+ ] })
4314
+ ] })
4315
+ ] })
4316
+ ] }),
4317
+ /* @__PURE__ */ p("div", { className: "nice-datetime-popup__footer", children: [
4318
+ R && /* @__PURE__ */ e(
4319
+ "button",
4320
+ {
4321
+ type: "button",
4322
+ className: "nice-datetime-popup__btn",
4323
+ onClick: Le,
4324
+ children: j("controls.clear", "Clear")
4325
+ }
4326
+ ),
4327
+ mn && /* @__PURE__ */ e(
4328
+ "button",
4329
+ {
4330
+ type: "button",
4331
+ className: "nice-datetime-popup__btn",
4332
+ onClick: Dt,
4333
+ disabled: Ln,
4334
+ "aria-disabled": Ln || void 0,
4335
+ children: j("controls.today", "Today")
4336
+ }
4337
+ ),
4338
+ cn && /* @__PURE__ */ e(
4339
+ "button",
4340
+ {
4341
+ type: "button",
4342
+ className: "nice-datetime-popup__btn",
4343
+ onClick: Fn,
4344
+ disabled: Ln,
4345
+ "aria-disabled": Ln || void 0,
4346
+ children: j("controls.now", "Now")
4347
+ }
4348
+ ),
4349
+ /* @__PURE__ */ e(
4350
+ "button",
4351
+ {
4352
+ type: "button",
4353
+ className: "nice-datetime-popup__btn nice-datetime-popup__btn--primary",
4354
+ onClick: xt,
4355
+ children: j("controls.confirm", "Confirm")
4356
+ }
4357
+ )
4358
+ ] })
4359
+ ]
4360
+ }
4361
+ ),
4362
+ Xe
4363
+ ),
4364
+ V && se != null && /* @__PURE__ */ p("span", { className: "nice-datetime__countdown", "aria-live": "polite", children: [
4365
+ ue && /* @__PURE__ */ p("span", { className: "nice-datetime__countdown-label", children: [
4366
+ ue,
4367
+ " "
4368
+ ] }),
4369
+ /* @__PURE__ */ e("span", { className: "nice-datetime__countdown-value", children: se })
4370
+ ] }),
4371
+ L && /* @__PURE__ */ e("span", { className: "nice-field__spinner", children: /* @__PURE__ */ e("span", { className: "nice-spinner nice-spinner--sm" }) }),
4372
+ U === "right" && t && /* @__PURE__ */ e("div", { className: "nice-field__error", role: "alert", children: t }),
4373
+ U === "right" && !t && i && /* @__PURE__ */ e("div", { className: "nice-field__helper", children: i })
4374
+ ] }),
4375
+ U !== "right" && t && /* @__PURE__ */ e("div", { className: "nice-field__error", role: "alert", children: t }),
4376
+ U !== "right" && !t && i && /* @__PURE__ */ e("div", { className: "nice-field__helper", children: i })
4377
+ ]
4378
+ }
4379
+ );
4380
+ }
4381
+ );
4382
+ Sn.displayName = "NiceDateTimePicker";
4383
+ const Zi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4384
+ __proto__: null,
4385
+ NiceDateTimePicker: Sn,
4386
+ getDefaultLocale: kt
4387
+ }, Symbol.toStringTag, { value: "Module" })), Fi = ({
4388
+ items: n,
4389
+ data: i,
4390
+ onFieldChange: t,
4391
+ onSubmit: l,
4392
+ dataSource: a,
4393
+ recordKey: o,
4394
+ columns: s = 1,
4395
+ responsiveColumns: v,
4396
+ gap: C = 16,
4397
+ labelPosition: K = "top",
4398
+ size: le = "md",
4399
+ readOnly: D,
4400
+ disabled: x,
4401
+ className: z,
4402
+ style: re,
4403
+ accessMode: P,
4404
+ id: E,
4405
+ autoSaveDelay: k,
4406
+ onDirtyChange: H,
4407
+ showActions: de,
4408
+ submitLabel: G = "Submit",
4409
+ resetLabel: fe = "Reset",
4410
+ onCancel: ce,
4411
+ cancelLabel: w = "Cancel"
4412
+ }) => {
4413
+ const F = dn(P, E), U = F === "hidden";
4414
+ F === "disabled" && (x = !0), F === "readOnly" && (D = !0);
4415
+ const L = Ht(a ?? null, o), Y = !!a && o != null, A = Y ? L.editData : i ?? {}, [J] = $e(() => ({ ...A })), [R, Q] = $e([]), ee = ve(() => Object.keys(A).some((g) => A[g] !== J[g]), [A, J]), f = Ne(!1);
4416
+ Ie(() => {
4417
+ ee !== f.current && (f.current = ee, H?.(ee));
4418
+ }, [ee, H]);
4419
+ const m = Ne(null), y = I(() => {
4420
+ k && (m.current && clearTimeout(m.current), m.current = setTimeout(() => {
4421
+ Y ? L.save() : l?.(A);
4422
+ }, k));
4423
+ }, [k, Y, L, l, A]), ne = I(
4424
+ (g, T) => {
4425
+ D || x || (Q((d) => [...d, { field: g, prev: A[g] }]), Y ? L.set(g, T) : t?.(g, T), y());
4426
+ },
4427
+ [Y, L, t, D, x, A, y]
4428
+ ), te = I(() => {
4429
+ if (R.length === 0)
4430
+ return;
4431
+ const g = R[R.length - 1];
4432
+ Q((T) => T.slice(0, -1)), Y ? L.set(g.field, g.prev) : t?.(g.field, g.prev);
4433
+ }, [R, Y, L, t]), b = I(
4434
+ (g) => {
4435
+ g.preventDefault(), m.current && clearTimeout(m.current), Y ? L.save() : l?.(A);
4436
+ },
4437
+ [A, l, Y, L]
4438
+ ), h = Ne(null), [O, V] = $e(s);
4439
+ Ie(() => {
4440
+ if (!v || !h.current) {
4441
+ V(s);
4442
+ return;
4443
+ }
4444
+ const g = h.current, T = new ResizeObserver((d) => {
4445
+ const pe = d[0]?.contentRect.width ?? 0, q = Object.keys(v).map(Number).sort((ie, N) => N - ie);
4446
+ for (const ie of q)
4447
+ if (pe >= ie) {
4448
+ V(v[ie]);
4449
+ return;
4450
+ }
4451
+ V(s);
4452
+ });
4453
+ return T.observe(g), () => T.disconnect();
4454
+ }, [v, s]);
4455
+ const be = ve(
4456
+ () => n.filter((g) => !(g.visible === !1 || g.visibleWhen && !g.visibleWhen(A))),
4457
+ [n, A]
4458
+ ), oe = ve(() => {
4459
+ const g = [];
4460
+ let T = null;
4461
+ for (const d of be)
4462
+ !T || T.name !== d.group ? (T = { name: d.group, items: [d] }, g.push(T)) : T.items.push(d);
4463
+ return g;
4464
+ }, [be]), ue = I(
4465
+ (g) => {
4466
+ const T = A[g.field] !== void 0 ? A[g.field] : g.defaultValue, d = (N) => ne(g.field, N);
4467
+ if (g.render)
4468
+ return g.render(T, d);
4469
+ const pe = g.type || "text", q = g.options?.map(
4470
+ (N) => typeof N == "string" ? { label: N, value: N } : { label: N.label, value: String(N.value) }
4471
+ ), ie = { size: le, disabled: x, readOnly: D };
4472
+ switch (pe) {
4473
+ case "number":
4474
+ return /* @__PURE__ */ e(
4475
+ rt,
4476
+ {
4477
+ ...ie,
4478
+ value: T ?? null,
4479
+ onChange: (N) => d(N),
4480
+ required: g.required
4481
+ }
4482
+ );
4483
+ case "currency":
4484
+ return /* @__PURE__ */ e(
4485
+ rt,
4486
+ {
4487
+ ...ie,
4488
+ value: T ?? null,
4489
+ onChange: (N) => d(N),
4490
+ required: g.required,
4491
+ precision: g.precision ?? 2,
4492
+ step: g.step ?? 100,
4493
+ suffix: g.unit ?? "PLN",
4494
+ formatPreset: "money"
4495
+ }
4496
+ );
4497
+ case "textarea":
4498
+ return /* @__PURE__ */ e(Qn, { ...ie, value: T ?? "", onChange: (N) => d(N), rows: 3 });
4499
+ case "address":
4500
+ return /* @__PURE__ */ e(
4501
+ Ct,
4502
+ {
4503
+ ...ie,
4504
+ value: T ?? {},
4505
+ onChange: (N) => d(N),
4506
+ required: g.required,
4507
+ columns: g.columns ?? 2
4508
+ }
4509
+ );
4510
+ case "select":
4511
+ return /* @__PURE__ */ e(
4512
+ gt,
4513
+ {
4514
+ ...ie,
4515
+ value: T ?? "",
4516
+ onChange: (N) => d(N),
4517
+ options: q ?? []
4518
+ }
4519
+ );
4520
+ case "autocomplete":
4521
+ return /* @__PURE__ */ e(
4522
+ Wt,
4523
+ {
4524
+ ...ie,
4525
+ value: T ?? "",
4526
+ onChange: (N) => d(N),
4527
+ options: q ?? [],
4528
+ suggestions: (q ?? []).map((N) => N.label)
4529
+ }
4530
+ );
4531
+ case "radio":
4532
+ return /* @__PURE__ */ e(
4533
+ vt,
4534
+ {
4535
+ ...ie,
4536
+ value: T ?? "",
4537
+ onChange: (N) => d(N),
4538
+ options: q ?? []
4539
+ }
4540
+ );
4541
+ case "checkbox":
4542
+ return /* @__PURE__ */ e(
4543
+ Ot,
4544
+ {
4545
+ ...ie,
4546
+ checked: !!T,
4547
+ onChange: (N) => d(N),
4548
+ label: g.label
4549
+ }
4550
+ );
4551
+ case "toggle":
4552
+ return /* @__PURE__ */ e(Kt, { ...ie, checked: !!T, onChange: (N) => d(N) });
4553
+ case "date":
4554
+ return /* @__PURE__ */ e(Sn, { ...ie, value: T ?? "", onChange: (N) => d(N) });
4555
+ case "time":
4556
+ return /* @__PURE__ */ e(
4557
+ Sn,
4558
+ {
4559
+ ...ie,
4560
+ dateFormatPreset: "time",
4561
+ value: T ?? "",
4562
+ onChange: (N) => d(N)
4563
+ }
4564
+ );
4565
+ case "datetime":
4566
+ return /* @__PURE__ */ e(
4567
+ Sn,
4568
+ {
4569
+ ...ie,
4570
+ dateFormatPreset: "datetime-local",
4571
+ value: T ?? "",
4572
+ onChange: (N) => d(N)
4573
+ }
4574
+ );
4575
+ case "color":
4576
+ return /* @__PURE__ */ e(
4577
+ Vt,
4578
+ {
4579
+ ...ie,
4580
+ value: T ?? "var(--nice-text-primary, #000000)",
4581
+ onChange: (N) => d(N)
4582
+ }
4583
+ );
4584
+ case "slider":
4585
+ return /* @__PURE__ */ e(
4586
+ Jn,
4587
+ {
4588
+ ...ie,
4589
+ value: typeof T == "number" ? T : 0,
4590
+ onChange: (N) => d(N)
4591
+ }
4592
+ );
4593
+ case "rating":
4594
+ return /* @__PURE__ */ e(
4595
+ Zn,
4596
+ {
4597
+ ...ie,
4598
+ value: typeof T == "number" ? T : 0,
4599
+ onChange: (N) => d(N)
4600
+ }
4601
+ );
4602
+ case "password":
4603
+ return /* @__PURE__ */ e(
4604
+ _t,
4605
+ {
4606
+ ...ie,
4607
+ value: T ?? "",
4608
+ onChange: (N) => d(N),
4609
+ required: g.required
4610
+ }
4611
+ );
4612
+ case "phone":
4613
+ case "tel":
4614
+ return /* @__PURE__ */ e(
4615
+ on,
4616
+ {
4617
+ ...ie,
4618
+ type: "tel",
4619
+ value: T ?? "",
4620
+ onChange: (N) => d(N),
4621
+ required: g.required
4622
+ }
4623
+ );
4624
+ case "country":
4625
+ return /* @__PURE__ */ e(Mt, { ...ie, value: T ?? "", onChange: (N) => d(N) });
4626
+ case "tags":
4627
+ return /* @__PURE__ */ e(
4628
+ oi,
4629
+ {
4630
+ ...ie,
4631
+ value: Array.isArray(T) ? T : [],
4632
+ onChange: (N) => d(N),
4633
+ options: q ?? []
4634
+ }
4635
+ );
4636
+ case "masked":
4637
+ return /* @__PURE__ */ e(
4638
+ yt,
4639
+ {
4640
+ ...ie,
4641
+ value: T ?? "",
4642
+ mask: g.mask ?? "999-999-9999",
4643
+ onChange: (N) => d(N)
4644
+ }
4645
+ );
4646
+ case "file":
4647
+ return /* @__PURE__ */ e(Nt, { ...ie, onFilesSelected: (N) => d(N) });
4648
+ case "email":
4649
+ return /* @__PURE__ */ e(
4650
+ on,
4651
+ {
4652
+ ...ie,
4653
+ type: "email",
4654
+ value: T ?? "",
4655
+ onChange: (N) => d(N),
4656
+ required: g.required
4657
+ }
4658
+ );
4659
+ case "url":
4660
+ return /* @__PURE__ */ e(
4661
+ on,
4662
+ {
4663
+ ...ie,
4664
+ type: "url",
4665
+ value: T ?? "",
4666
+ onChange: (N) => d(N),
4667
+ required: g.required
4668
+ }
4669
+ );
4670
+ default:
4671
+ return /* @__PURE__ */ e(
4672
+ on,
4673
+ {
4674
+ ...ie,
4675
+ value: T ?? "",
4676
+ onChange: (N) => d(N),
4677
+ required: g.required
4678
+ }
4679
+ );
4680
+ }
4681
+ },
4682
+ [A, ne, x, D, le]
4683
+ ), M = (g) => /* @__PURE__ */ p(
4684
+ "div",
4685
+ {
4686
+ className: "nice-form__item",
4687
+ style: { gridColumn: g.colSpan ? `span ${g.colSpan}` : void 0 },
4688
+ children: [
4689
+ g.label && /* @__PURE__ */ p("label", { className: "nice-form__label", children: [
4690
+ g.label,
4691
+ g.required && /* @__PURE__ */ e("span", { className: "nice-field__required", children: "*" })
4692
+ ] }),
4693
+ /* @__PURE__ */ e("div", { className: "nice-form__control", children: ue(g) }),
4694
+ g.hint && /* @__PURE__ */ e("div", { className: "nice-form__hint", children: g.hint })
4695
+ ]
4696
+ },
4697
+ g.field
4698
+ ), W = {
4699
+ display: "grid",
4700
+ gridTemplateColumns: `repeat(${O}, 1fr)`,
4701
+ gap: C
4702
+ }, X = oe.some((g) => g.name != null), we = ve(() => {
4703
+ const g = /* @__PURE__ */ new Set(), T = [];
4704
+ for (const d of be)
4705
+ d.tab && !g.has(d.tab) && (g.add(d.tab), T.push(d.tab));
4706
+ return T;
4707
+ }, [be]), ze = we.length > 0, [B, ye] = $e("");
4708
+ Ie(() => {
4709
+ ze && !we.includes(B) && ye(we[0]);
4710
+ }, [ze, we, B]);
4711
+ const j = (g) => {
4712
+ const T = [];
4713
+ let d = null;
4714
+ for (const q of g)
4715
+ !d || d.name !== q.group ? (d = { name: q.group, items: [q] }, T.push(d)) : d.items.push(q);
4716
+ return T.some((q) => q.name != null) ? T.map((q, ie) => /* @__PURE__ */ p(
4717
+ "fieldset",
4718
+ {
4719
+ className: q.name ? "nice-form__group" : "nice-form__group nice-form__group--no-title",
4720
+ children: [
4721
+ q.name && /* @__PURE__ */ e("legend", { className: "nice-form__group-title", children: q.name }),
4722
+ /* @__PURE__ */ e("div", { style: W, children: q.items.map(M) })
4723
+ ]
4724
+ },
4725
+ ie
4726
+ )) : /* @__PURE__ */ e("div", { style: W, children: g.map(M) });
4727
+ }, Ue = de ? /* @__PURE__ */ p("div", { className: "nice-form__actions", children: [
4728
+ /* @__PURE__ */ p("div", { className: "nice-form__actions-left", children: [
4729
+ ce && /* @__PURE__ */ e(Vn, { type: "button", variant: "secondary", size: le, onClick: ce, children: w }),
4730
+ /* @__PURE__ */ e(
4731
+ Vn,
4732
+ {
4733
+ type: "button",
4734
+ variant: "ghost",
4735
+ size: le,
4736
+ onClick: te,
4737
+ disabled: R.length === 0,
4738
+ children: fe
4739
+ }
4740
+ )
4741
+ ] }),
4742
+ /* @__PURE__ */ e("div", { className: "nice-form__actions-right", children: /* @__PURE__ */ e(Vn, { type: "submit", variant: "primary", size: le, children: G }) })
4743
+ ] }) : null;
4744
+ return U ? null : /* @__PURE__ */ p(
4745
+ "form",
4746
+ {
4747
+ ref: h,
4748
+ className: `nice-form nice-form--label-${K}${ee ? " nice-form--dirty" : ""} ${z || ""}`,
4749
+ style: X || ze ? { ...re } : { ...W, ...re },
4750
+ onSubmit: b,
4751
+ noValidate: !0,
4752
+ children: [
4753
+ ze ? /* @__PURE__ */ e(
4754
+ qt,
4755
+ {
4756
+ className: "nice-form__tabs",
4757
+ activeTab: B || we[0],
4758
+ onChange: ye,
4759
+ tabs: we.map((g) => ({
4760
+ id: g,
4761
+ label: g,
4762
+ content: /* @__PURE__ */ e("div", { className: "nice-form__tab-panel", children: j(be.filter((T) => (T.tab ?? we[0]) === g)) })
4763
+ }))
4764
+ }
4765
+ ) : X ? oe.map((g, T) => /* @__PURE__ */ p(
4766
+ "fieldset",
4767
+ {
4768
+ className: g.name ? "nice-form__group" : "nice-form__group nice-form__group--no-title",
4769
+ children: [
4770
+ g.name && /* @__PURE__ */ e("legend", { className: "nice-form__group-title", children: g.name }),
4771
+ /* @__PURE__ */ e("div", { style: W, children: g.items.map(M) })
4772
+ ]
4773
+ },
4774
+ T
4775
+ )) : be.map(M),
4776
+ Ue
4777
+ ]
4778
+ }
4779
+ );
4780
+ };
4781
+ Fi.displayName = "NiceForm";
4782
+ export {
4783
+ hi as C,
4784
+ ei as M,
4785
+ Wt as N,
4786
+ $t as a,
4787
+ Mt as b,
4788
+ Sn as c,
4789
+ Fi as d,
4790
+ yt as e,
4791
+ _t as f,
4792
+ vt as g,
4793
+ Zn as h,
4794
+ Jn as i,
4795
+ oi as j,
4796
+ Qn as k,
4797
+ Nt as l,
4798
+ kt as m,
4799
+ Ct as n,
4800
+ ji as o,
4801
+ Ki as p,
4802
+ Oi as q,
4803
+ qi as r,
4804
+ Zi as s
4805
+ };