@opennsw/jsonforms-renderers 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,182 +1,191 @@
1
- import { jsx as g, jsxs as R, Fragment as $t } from "react/jsx-runtime";
2
- import p, { createContext as Kt, useContext as Jt, useEffect as We, useCallback as le, useRef as Ie, useLayoutEffect as rr, useState as Ne, useMemo as et } from "react";
3
- import { rankWith as he, isStringControl as or, or as at, isNumberControl as ar, isIntegerControl as sr, isBooleanControl as ir, isEnumControl as Zt, isOneOfControl as Lt, isDateControl as cr, isDateTimeControl as ur, isTimeControl as lr, uiTypeIs as Ge, and as dr, schemaMatches as fr, createDefaultValue as hr, isObjectArrayControl as mr, isPrimitiveArrayControl as yr } from "@jsonforms/core";
4
- import { withJsonFormsControlProps as Ye, JsonFormsDispatch as Ve, withJsonFormsArrayControlProps as gr } from "@jsonforms/react";
5
- import { Box as ie, Flex as te, Text as H, TextField as nt, Checkbox as wr, RadioGroup as Ft, Select as Ke, Popover as ht, Button as rt, Tabs as Je, Heading as en, Card as tn, IconButton as br } from "@radix-ui/themes";
6
- import { CalendarIcon as Mr, FileTextIcon as vr, CheckCircledIcon as Dr, Cross2Icon as kr, ExclamationTriangleIcon as Or, UploadIcon as pr, TrashIcon as Sr, PlusIcon as Wr } from "@radix-ui/react-icons";
7
- const nn = Kt(null);
8
- function gi({
9
- children: e,
10
- onUpload: t,
1
+ import { jsx as e, jsxs as f, Fragment as be } from "react/jsx-runtime";
2
+ import { useContext as ze, createContext as Se, useMemo as Ue, useEffect as X, useState as A, useRef as Q, useCallback as Te } from "react";
3
+ import { rankWith as D, isStringControl as Ee, or as ge, isNumberControl as Ve, isIntegerControl as je, isBooleanControl as Ne, isEnumControl as Re, isOneOfControl as ke, schemaMatches as $e, isDateControl as Pe, isDateTimeControl as Be, isTimeControl as Me, uiTypeIs as ie, and as We, createDefaultValue as He, isObjectArrayControl as Ke, isPrimitiveArrayControl as Ge } from "@jsonforms/core";
4
+ import { withJsonFormsControlProps as J, JsonFormsDispatch as ce, withJsonFormsArrayControlProps as Je } from "@jsonforms/react";
5
+ import { Box as C, Flex as z, Text as c, TextField as Y, Checkbox as _e, RadioGroup as we, Select as de, ScrollArea as qe, Spinner as Ce, Button as he, Tabs as ue, Heading as Fe, Card as De, IconButton as Ze } from "@radix-ui/themes";
6
+ import { ChevronDownIcon as Qe, FileTextIcon as Xe, CheckCircledIcon as Ye, Cross2Icon as er, ExclamationTriangleIcon as rr, UploadIcon as tr, TrashIcon as nr, PlusIcon as or } from "@radix-ui/react-icons";
7
+ import lr from "dayjs";
8
+ const Oe = Se(null);
9
+ function tt({
10
+ children: t,
11
+ onUpload: r,
11
12
  getDownloadUrl: n
12
13
  }) {
13
- const r = { onUpload: t, getDownloadUrl: n };
14
- return /* @__PURE__ */ g(nn.Provider, { value: r, children: e });
14
+ const a = { onUpload: r, getDownloadUrl: n };
15
+ return /* @__PURE__ */ e(Oe.Provider, { value: a, children: t });
15
16
  }
16
- function Cr() {
17
- return Jt(nn);
17
+ function ir() {
18
+ return ze(Oe);
18
19
  }
19
- const $e = (e, t) => e ? e.split(`
20
- `).map((n) => n.trim() === "is a required property" ? `${t || "This field"} is required` : n).join(`
21
- `) : "", Nr = ({
22
- data: e,
23
- handleChange: t,
20
+ const Ie = Se(null);
21
+ function nt({
22
+ children: t,
23
+ services: r
24
+ }) {
25
+ const n = Ue(() => r, [r]);
26
+ return /* @__PURE__ */ e(Ie.Provider, { value: n, children: t });
27
+ }
28
+ function cr(t) {
29
+ const r = ze(Ie);
30
+ return !r || !t ? null : r[t] ?? null;
31
+ }
32
+ const ee = (t, r, n, a = void 0) => {
33
+ X(() => {
34
+ t === !1 && n(r, a);
35
+ }, [t, r, n, a]);
36
+ }, _ = (t, r) => t ? t.split(`
37
+ `).map((n) => n.trim() === "is a required property" ? `${r || "This field"} is required` : n).join(`
38
+ `) : "", sr = ({
39
+ data: t,
40
+ handleChange: r,
24
41
  path: n,
25
- label: r,
26
- required: o,
27
- errors: a,
42
+ label: a,
43
+ required: y,
44
+ errors: h,
28
45
  uischema: s,
29
- schema: i,
30
- enabled: c,
31
- visible: u = !0
46
+ schema: v,
47
+ enabled: d,
48
+ visible: g = !0
32
49
  }) => {
33
- var d;
34
- if (We(() => {
35
- u === !1 && t(n, void 0);
36
- }, [u, n, t]), u === !1)
50
+ var x;
51
+ if (ee(g, n, r), g === !1)
37
52
  return null;
38
- const l = a.length === 0;
39
- return /* @__PURE__ */ g(ie, { mb: "4", children: /* @__PURE__ */ R(te, { direction: "column", gap: "1", children: [
40
- /* @__PURE__ */ R(H, { as: "label", size: "2", weight: "bold", htmlFor: n, children: [
41
- r,
53
+ const l = h.length === 0;
54
+ return /* @__PURE__ */ e(C, { mb: "4", children: /* @__PURE__ */ f(z, { direction: "column", gap: "1", children: [
55
+ /* @__PURE__ */ f(c, { as: "label", size: "2", weight: "bold", htmlFor: n, children: [
56
+ a,
42
57
  " ",
43
- o && /* @__PURE__ */ g(H, { color: "red", children: "*" })
58
+ y && /* @__PURE__ */ e(c, { color: "red", children: "*" })
44
59
  ] }),
45
- /* @__PURE__ */ g(
46
- nt.Root,
60
+ /* @__PURE__ */ e(
61
+ Y.Root,
47
62
  {
48
- value: e || "",
49
- onChange: (h) => t(n, h.target.value),
50
- disabled: !c,
51
- placeholder: (d = s.options) == null ? void 0 : d.placeholder,
63
+ value: t || "",
64
+ onChange: (p) => r(n, p.target.value),
65
+ disabled: !d,
66
+ placeholder: (x = s.options) == null ? void 0 : x.placeholder,
52
67
  color: l ? void 0 : "red",
53
68
  id: n
54
69
  }
55
70
  ),
56
- !l && /* @__PURE__ */ g(H, { color: "red", size: "1", children: $e(a, r) }),
57
- i.description && /* @__PURE__ */ g(H, { size: "1", color: "gray", children: i.description })
71
+ !l && /* @__PURE__ */ e(c, { color: "red", size: "1", children: _(h, a) }),
72
+ v.description && /* @__PURE__ */ e(c, { size: "1", color: "gray", children: v.description })
58
73
  ] }) });
59
- }, Tr = he(1, or), xr = Ye(Nr), Yr = ({
60
- data: e,
61
- handleChange: t,
74
+ }, ar = D(1, Ee), dr = J(sr), ur = ({
75
+ data: t,
76
+ handleChange: r,
62
77
  path: n,
63
- label: r,
64
- required: o,
65
- errors: a,
78
+ label: a,
79
+ required: y,
80
+ errors: h,
66
81
  uischema: s,
67
- schema: i,
68
- enabled: c,
69
- visible: u = !0
82
+ schema: v,
83
+ enabled: d,
84
+ visible: g = !0
70
85
  }) => {
71
- var h;
72
- if (We(() => {
73
- u === !1 && t(n, void 0);
74
- }, [u, n, t]), u === !1)
86
+ var p;
87
+ if (ee(g, n, r), g === !1)
75
88
  return null;
76
- const l = a.length === 0, d = (m) => {
77
- if (m === "") {
78
- t(n, void 0);
89
+ const l = h.length === 0, x = (o) => {
90
+ if (o === "") {
91
+ r(n, void 0);
79
92
  return;
80
93
  }
81
- const y = Number(m);
82
- isNaN(y) || t(n, y);
94
+ const u = Number(o);
95
+ isNaN(u) || r(n, u);
83
96
  };
84
- return /* @__PURE__ */ g(ie, { mb: "4", children: /* @__PURE__ */ R(te, { direction: "column", gap: "1", children: [
85
- /* @__PURE__ */ R(H, { as: "label", size: "2", weight: "bold", htmlFor: n, children: [
86
- r,
97
+ return /* @__PURE__ */ e(C, { mb: "4", children: /* @__PURE__ */ f(z, { direction: "column", gap: "1", children: [
98
+ /* @__PURE__ */ f(c, { as: "label", size: "2", weight: "bold", htmlFor: n, children: [
99
+ a,
87
100
  " ",
88
- o && /* @__PURE__ */ g(H, { color: "red", children: "*" })
101
+ y && /* @__PURE__ */ e(c, { color: "red", children: "*" })
89
102
  ] }),
90
- /* @__PURE__ */ g(
91
- nt.Root,
103
+ /* @__PURE__ */ e(
104
+ Y.Root,
92
105
  {
93
106
  type: "number",
94
- value: e ?? "",
95
- onChange: (m) => d(m.target.value),
96
- disabled: !c,
97
- placeholder: (h = s.options) == null ? void 0 : h.placeholder,
107
+ value: t ?? "",
108
+ onChange: (o) => x(o.target.value),
109
+ disabled: !d,
110
+ placeholder: (p = s.options) == null ? void 0 : p.placeholder,
98
111
  color: l ? void 0 : "red",
99
112
  id: n
100
113
  }
101
114
  ),
102
- !l && /* @__PURE__ */ g(H, { color: "red", size: "1", children: $e(a, r) }),
103
- i.description && /* @__PURE__ */ g(H, { size: "1", color: "gray", children: i.description })
115
+ !l && /* @__PURE__ */ e(c, { color: "red", size: "1", children: _(h, a) }),
116
+ v.description && /* @__PURE__ */ e(c, { size: "1", color: "gray", children: v.description })
104
117
  ] }) });
105
- }, $r = he(2, at(ar, sr)), Fr = Ye(Yr), Pr = ({
106
- data: e,
107
- handleChange: t,
118
+ }, fr = D(2, ge(Ve, je)), pr = J(ur), hr = ({
119
+ data: t,
120
+ handleChange: r,
108
121
  path: n,
109
- label: r,
110
- required: o,
111
- errors: a,
122
+ label: a,
123
+ required: y,
124
+ errors: h,
112
125
  schema: s,
113
- enabled: i,
114
- visible: c = !0
126
+ enabled: v,
127
+ visible: d = !0
115
128
  }) => {
116
- if (We(() => {
117
- c === !1 && t(n, void 0);
118
- }, [c, n, t]), c === !1)
129
+ if (ee(d, n, r), d === !1)
119
130
  return null;
120
- const u = a.length === 0;
121
- return /* @__PURE__ */ R(ie, { mb: "4", children: [
122
- /* @__PURE__ */ R(te, { gap: "2", align: "center", children: [
123
- /* @__PURE__ */ g(
124
- wr,
131
+ const g = h.length === 0;
132
+ return /* @__PURE__ */ f(C, { mb: "4", children: [
133
+ /* @__PURE__ */ f(z, { gap: "2", align: "center", children: [
134
+ /* @__PURE__ */ e(
135
+ _e,
125
136
  {
126
- checked: !!e,
127
- onCheckedChange: (l) => t(n, l === !0),
128
- disabled: !i,
137
+ checked: !!t,
138
+ onCheckedChange: (l) => r(n, l === !0),
139
+ disabled: !v,
129
140
  id: n
130
141
  }
131
142
  ),
132
- /* @__PURE__ */ R(H, { as: "label", size: "2", htmlFor: n, children: [
133
- r,
143
+ /* @__PURE__ */ f(c, { as: "label", size: "2", htmlFor: n, children: [
144
+ a,
134
145
  " ",
135
- o && "*"
146
+ y && "*"
136
147
  ] })
137
148
  ] }),
138
- !u && /* @__PURE__ */ g(H, { color: "red", size: "1", className: "block mt-1", children: $e(a, r) }),
139
- s.description && /* @__PURE__ */ g(H, { size: "1", color: "gray", className: "block mt-1", children: s.description })
149
+ !g && /* @__PURE__ */ e(c, { color: "red", size: "1", className: "block mt-1", children: _(h, a) }),
150
+ s.description && /* @__PURE__ */ e(c, { size: "1", color: "gray", className: "block mt-1", children: s.description })
140
151
  ] });
141
- }, _r = he(2, ir), Er = Ye(Pr), Ir = ({
142
- data: e,
143
- handleChange: t,
152
+ }, gr = D(2, Ne), mr = J(hr), yr = ({
153
+ data: t,
154
+ handleChange: r,
144
155
  path: n,
145
- label: r,
146
- required: o,
147
- errors: a,
156
+ label: a,
157
+ required: y,
158
+ errors: h,
148
159
  schema: s,
149
- enabled: i,
150
- visible: c = !0
160
+ enabled: v,
161
+ visible: d = !0
151
162
  }) => {
152
- if (We(() => {
153
- c === !1 && t(n, void 0);
154
- }, [c, n, t]), c === !1)
163
+ if (ee(d, n, r), d === !1)
155
164
  return null;
156
- const u = a.length === 0;
165
+ const g = h.length === 0;
157
166
  let l = [];
158
- s.enum ? l = s.enum.map((h) => ({ value: h, label: String(h) })) : s.oneOf && (l = s.oneOf.map((h) => ({
159
- value: h.const,
160
- label: h.title || String(h.const)
167
+ s.enum ? l = s.enum.map((p) => ({ value: p, label: String(p) })) : s.oneOf && (l = s.oneOf.map((p) => ({
168
+ value: p.const,
169
+ label: p.title || String(p.const)
161
170
  })));
162
- const d = e;
163
- return /* @__PURE__ */ g(ie, { mb: "4", children: /* @__PURE__ */ R(te, { direction: "column", gap: "1", children: [
164
- /* @__PURE__ */ R(H, { as: "div", size: "2", weight: "bold", children: [
165
- r,
171
+ const x = t;
172
+ return /* @__PURE__ */ e(C, { mb: "4", children: /* @__PURE__ */ f(z, { direction: "column", gap: "1", children: [
173
+ /* @__PURE__ */ f(c, { as: "div", size: "2", weight: "bold", children: [
174
+ a,
166
175
  " ",
167
- o && /* @__PURE__ */ g(H, { color: "red", children: "*" })
176
+ y && /* @__PURE__ */ e(c, { color: "red", children: "*" })
168
177
  ] }),
169
- /* @__PURE__ */ g(
170
- Ft.Root,
178
+ /* @__PURE__ */ e(
179
+ we.Root,
171
180
  {
172
- value: d !== void 0 ? String(d) : "",
173
- onValueChange: (h) => {
174
- const m = l.find((y) => String(y.value) === h);
175
- m && t(n, m.value);
181
+ value: x !== void 0 ? String(x) : "",
182
+ onValueChange: (p) => {
183
+ const o = l.find((u) => String(u.value) === p);
184
+ o && r(n, o.value);
176
185
  },
177
- disabled: !i,
178
- children: /* @__PURE__ */ g(
179
- te,
186
+ disabled: !v,
187
+ children: /* @__PURE__ */ e(
188
+ z,
180
189
  {
181
190
  direction: "row",
182
191
  style: {
@@ -184,3669 +193,551 @@ const $e = (e, t) => e ? e.split(`
184
193
  columnGap: "clamp(14px, 3vw, 36px)",
185
194
  rowGap: "clamp(8px, 1.6vw, 14px)"
186
195
  },
187
- children: l.map((h) => /* @__PURE__ */ R(te, { align: "center", gap: "2", style: { minWidth: "max-content" }, children: [
188
- /* @__PURE__ */ g(Ft.Item, { value: String(h.value) }),
189
- /* @__PURE__ */ g(H, { size: "2", color: i ? void 0 : "gray", children: h.label })
190
- ] }, String(h.value)))
196
+ children: l.map((p) => /* @__PURE__ */ f(z, { align: "center", gap: "2", style: { minWidth: "max-content" }, children: [
197
+ /* @__PURE__ */ e(we.Item, { value: String(p.value) }),
198
+ /* @__PURE__ */ e(c, { size: "2", color: v ? void 0 : "gray", children: p.label })
199
+ ] }, String(p.value)))
191
200
  }
192
201
  )
193
202
  }
194
203
  ),
195
- !u && /* @__PURE__ */ g(H, { color: "red", size: "1", children: $e(a, r) }),
196
- s.description && /* @__PURE__ */ g(H, { size: "1", color: "gray", children: s.description })
204
+ !g && /* @__PURE__ */ e(c, { color: "red", size: "1", children: _(h, a) }),
205
+ s.description && /* @__PURE__ */ e(c, { size: "1", color: "gray", children: s.description })
197
206
  ] }) });
198
- }, Br = (e, t, n) => {
199
- var o;
200
- return at(Zt, Lt)(e, t, n) && ((o = e == null ? void 0 : e.options) == null ? void 0 : o.format) === "radio" ? 3 : -1;
201
- }, Ar = Ye(Ir), zr = ({
202
- data: e,
203
- handleChange: t,
207
+ }, vr = (t, r, n) => {
208
+ var y;
209
+ return ge(Re, ke)(t, r, n) && ((y = t == null ? void 0 : t.options) == null ? void 0 : y.format) === "radio" ? 3 : -1;
210
+ }, br = J(yr), wr = ({
211
+ data: t,
212
+ handleChange: r,
204
213
  path: n,
205
- label: r,
206
- required: o,
207
- errors: a,
214
+ label: a,
215
+ required: y,
216
+ errors: h,
208
217
  schema: s,
209
- uischema: i,
210
- enabled: c,
211
- visible: u = !0
218
+ uischema: v,
219
+ enabled: d,
220
+ visible: g = !0
212
221
  }) => {
213
- var m;
214
- if (We(() => {
215
- u === !1 && t(n, void 0);
216
- }, [u, n, t]), u === !1)
222
+ var o;
223
+ if (ee(g, n, r), g === !1)
217
224
  return null;
218
- const l = a.length === 0;
219
- let d = [];
220
- s.enum ? d = s.enum.map((y) => ({ value: String(y), label: String(y) })) : s.oneOf && (d = s.oneOf.map((y) => ({
221
- value: String(y.const),
222
- label: y.title || String(y.const)
225
+ const l = h.length === 0;
226
+ let x = [];
227
+ s.enum ? x = s.enum.map((u) => ({ value: String(u), label: String(u) })) : s.oneOf && (x = s.oneOf.map((u) => ({
228
+ value: String(u.const),
229
+ label: u.title || String(u.const)
223
230
  })));
224
- const h = e !== void 0 ? String(e) : "";
225
- return /* @__PURE__ */ g(ie, { mb: "4", children: /* @__PURE__ */ R(te, { direction: "column", gap: "1", children: [
226
- /* @__PURE__ */ R(H, { as: "label", size: "2", weight: "bold", htmlFor: n, children: [
227
- r,
231
+ const p = t !== void 0 ? String(t) : "";
232
+ return /* @__PURE__ */ e(C, { mb: "4", children: /* @__PURE__ */ f(z, { direction: "column", gap: "1", children: [
233
+ /* @__PURE__ */ f(c, { as: "label", size: "2", weight: "bold", htmlFor: n, children: [
234
+ a,
228
235
  " ",
229
- o && /* @__PURE__ */ g(H, { color: "red", children: "*" })
236
+ y && /* @__PURE__ */ e(c, { color: "red", children: "*" })
230
237
  ] }),
231
- /* @__PURE__ */ R(Ke.Root, { value: h, onValueChange: (y) => t(n, y), disabled: !c, children: [
232
- /* @__PURE__ */ g(
233
- Ke.Trigger,
238
+ /* @__PURE__ */ f(de.Root, { value: p, onValueChange: (u) => r(n, u), disabled: !d, children: [
239
+ /* @__PURE__ */ e(
240
+ de.Trigger,
234
241
  {
235
- placeholder: ((m = i.options) == null ? void 0 : m.placeholder) || "Select an option",
242
+ placeholder: ((o = v.options) == null ? void 0 : o.placeholder) || "Select an option",
236
243
  color: l ? void 0 : "red",
237
244
  id: n
238
245
  }
239
246
  ),
240
- /* @__PURE__ */ g(Ke.Content, { children: d.map((y) => /* @__PURE__ */ g(Ke.Item, { value: y.value, children: y.label }, y.value)) })
247
+ /* @__PURE__ */ e(de.Content, { children: x.map((u) => /* @__PURE__ */ e(de.Item, { value: u.value, children: u.label }, u.value)) })
241
248
  ] }),
242
- !l && /* @__PURE__ */ g(H, { color: "red", size: "1", children: $e(a, r) }),
243
- s.description && /* @__PURE__ */ g(H, { size: "1", color: "gray", children: s.description })
249
+ !l && /* @__PURE__ */ e(c, { color: "red", size: "1", children: _(h, a) }),
250
+ s.description && /* @__PURE__ */ e(c, { size: "1", color: "gray", children: s.description })
244
251
  ] }) });
245
- }, Hr = he(2, at(Zt, Lt)), jr = Ye(zr);
246
- function Rr(e, t, n = "long") {
247
- return new Intl.DateTimeFormat("en-US", {
248
- // Enforces engine to render the time. Without the option JavaScriptCore omits it.
249
- hour: "numeric",
250
- timeZone: e,
251
- timeZoneName: n
252
- }).format(t).split(/\s/g).slice(2).join(" ");
253
- }
254
- const mt = {}, je = {};
255
- function Oe(e, t) {
256
- try {
257
- const r = (mt[e] || (mt[e] = new Intl.DateTimeFormat("en-US", {
258
- timeZone: e,
259
- timeZoneName: "longOffset"
260
- }).format))(t).split("GMT")[1];
261
- return r in je ? je[r] : Pt(r, r.split(":"));
262
- } catch {
263
- if (e in je) return je[e];
264
- const n = e == null ? void 0 : e.match(qr);
265
- return n ? Pt(e, n.slice(1)) : NaN;
266
- }
267
- }
268
- const qr = /([+-]\d\d):?(\d\d)?/;
269
- function Pt(e, t) {
270
- const n = +(t[0] || 0), r = +(t[1] || 0), o = +(t[2] || 0) / 60;
271
- return je[e] = n * 60 + r > 0 ? n * 60 + r + o : n * 60 - r - o;
272
- }
273
- class De extends Date {
274
- //#region static
275
- constructor(...t) {
276
- super(), t.length > 1 && typeof t[t.length - 1] == "string" && (this.timeZone = t.pop()), this.internal = /* @__PURE__ */ new Date(), isNaN(Oe(this.timeZone, this)) ? this.setTime(NaN) : t.length ? typeof t[0] == "number" && (t.length === 1 || t.length === 2 && typeof t[1] != "number") ? this.setTime(t[0]) : typeof t[0] == "string" ? this.setTime(+new Date(t[0])) : t[0] instanceof Date ? this.setTime(+t[0]) : (this.setTime(+new Date(...t)), rn(this, t)) : this.setTime(Date.now());
277
- }
278
- static tz(t, ...n) {
279
- return n.length ? new De(...n, t) : new De(Date.now(), t);
280
- }
281
- //#endregion
282
- //#region time zone
283
- withTimeZone(t) {
284
- return new De(+this, t);
285
- }
286
- getTimezoneOffset() {
287
- const t = -Oe(this.timeZone, this);
288
- return t > 0 ? Math.floor(t) : Math.ceil(t);
289
- }
290
- //#endregion
291
- //#region time
292
- setTime(t) {
293
- return Date.prototype.setTime.apply(this, arguments), ot(this), +this;
294
- }
295
- //#endregion
296
- //#region date-fns integration
297
- [Symbol.for("constructDateFrom")](t) {
298
- return new De(+new Date(t), this.timeZone);
299
- }
300
- //#endregion
301
- }
302
- const _t = /^(get|set)(?!UTC)/;
303
- Object.getOwnPropertyNames(Date.prototype).forEach((e) => {
304
- if (!_t.test(e)) return;
305
- const t = e.replace(_t, "$1UTC");
306
- De.prototype[t] && (e.startsWith("get") ? De.prototype[e] = function() {
307
- return this.internal[t]();
308
- } : (De.prototype[e] = function() {
309
- return Date.prototype[t].apply(this.internal, arguments), Ur(this), +this;
310
- }, De.prototype[t] = function() {
311
- return Date.prototype[t].apply(this, arguments), ot(this), +this;
312
- }));
313
- });
314
- function ot(e) {
315
- e.internal.setTime(+e), e.internal.setUTCSeconds(e.internal.getUTCSeconds() - // Round after converting minutes to seconds to avoid fractional offset
316
- // precision errors from historical offsets.
317
- Math.round(-Oe(e.timeZone, e) * 60));
318
- }
319
- function Ur(e) {
320
- Date.prototype.setFullYear.call(e, e.internal.getUTCFullYear(), e.internal.getUTCMonth(), e.internal.getUTCDate()), Date.prototype.setHours.call(e, e.internal.getUTCHours(), e.internal.getUTCMinutes(), e.internal.getUTCSeconds(), e.internal.getUTCMilliseconds()), rn(e);
321
- }
322
- function rn(e, t) {
323
- const n = Array.isArray(t) ? Gr(t) : +e.internal, r = Oe(e.timeZone, e), o = r > 0 ? Math.floor(r) : Math.ceil(r), a = /* @__PURE__ */ new Date(+e);
324
- a.setUTCHours(a.getUTCHours() - 1);
325
- const s = -(/* @__PURE__ */ new Date(+e)).getTimezoneOffset(), i = -(/* @__PURE__ */ new Date(+a)).getTimezoneOffset(), c = s - i;
326
- let u = s;
327
- if (c && s !== o) {
328
- const q = Date.prototype.getHours.apply(e), _ = Array.isArray(t) ? t[3] || 0 : e.internal.getUTCHours();
329
- if (q !== _) {
330
- const Y = /* @__PURE__ */ new Date(+e), ee = s - o;
331
- ee && Y.setUTCMinutes(Y.getUTCMinutes() + ee);
332
- const re = Oe(e.timeZone, Y);
333
- (re > 0 ? Math.floor(re) : Math.ceil(re)) === o && (u = i);
334
- }
335
- }
336
- const l = u - o;
337
- l && Date.prototype.setUTCMinutes.call(e, Date.prototype.getUTCMinutes.call(e) + l);
338
- const d = /* @__PURE__ */ new Date(+e);
339
- d.setUTCSeconds(0);
340
- const h = s > 0 ? d.getSeconds() : (d.getSeconds() - 60) % 60, m = Math.round(-(Oe(e.timeZone, e) * 60)) % 60;
341
- (m || h) && Date.prototype.setUTCSeconds.call(e, Date.prototype.getUTCSeconds.call(e) + m + h);
342
- const y = Oe(e.timeZone, e), N = y > 0 ? Math.floor(y) : Math.ceil(y), P = -(/* @__PURE__ */ new Date(+e)).getTimezoneOffset() - N, b = N !== o, v = P - l, C = N - o, S = n - N * 60 * 1e3, f = C > 0 && Et(e) - n === C * 60 * 1e3 && Et(e, S) !== n;
343
- if (b && v && !f) {
344
- Date.prototype.setUTCMinutes.call(e, Date.prototype.getUTCMinutes.call(e) + v);
345
- const q = Oe(e.timeZone, e), _ = q > 0 ? Math.floor(q) : Math.ceil(q), Y = N - _;
346
- Y && v < 0 && Date.prototype.setUTCMinutes.call(e, Date.prototype.getUTCMinutes.call(e) + Y);
347
- }
348
- ot(e);
349
- const j = (t ? n : n + m * 1e3) - +e.internal;
350
- j && Math.abs(j) < 1800 * 1e3 && (Date.prototype.setTime.call(e, +e + j), ot(e));
351
- }
352
- function Gr(e) {
353
- return Date.UTC(e[0], e.length > 1 ? e[1] : 0, e.length > 2 ? e[2] : 1, ...e.slice(3));
354
- }
355
- function Et(e, t) {
356
- const n = new Date(t ?? +e);
357
- return n.setUTCSeconds(n.getUTCSeconds() - Math.round(-Oe(e.timeZone, n) * 60)), +n;
358
- }
359
- class ce extends De {
360
- //#region static
361
- static tz(t, ...n) {
362
- return n.length ? new ce(...n, t) : new ce(Date.now(), t);
363
- }
364
- //#endregion
365
- //#region representation
366
- toISOString() {
367
- const [t, n, r] = this.tzComponents(), o = `${t}${n}:${r}`;
368
- return this.internal.toISOString().slice(0, -1) + o;
369
- }
370
- toString() {
371
- return `${this.toDateString()} ${this.toTimeString()}`;
372
- }
373
- toDateString() {
374
- const [t, n, r, o] = this.internal.toUTCString().split(" ");
375
- return `${t == null ? void 0 : t.slice(0, -1)} ${r} ${n} ${o}`;
376
- }
377
- toTimeString() {
378
- const t = this.internal.toUTCString().split(" ")[4], [n, r, o] = this.tzComponents();
379
- return `${t} GMT${n}${r}${o} (${Rr(this.timeZone, this)})`;
380
- }
381
- toLocaleString(t, n) {
382
- return Date.prototype.toLocaleString.call(this, t, {
383
- ...n,
384
- timeZone: (n == null ? void 0 : n.timeZone) || this.timeZone
385
- });
386
- }
387
- toLocaleDateString(t, n) {
388
- return Date.prototype.toLocaleDateString.call(this, t, {
389
- ...n,
390
- timeZone: (n == null ? void 0 : n.timeZone) || this.timeZone
391
- });
392
- }
393
- toLocaleTimeString(t, n) {
394
- return Date.prototype.toLocaleTimeString.call(this, t, {
395
- ...n,
396
- timeZone: (n == null ? void 0 : n.timeZone) || this.timeZone
397
- });
398
- }
399
- //#endregion
400
- //#region private
401
- tzComponents() {
402
- const t = this.getTimezoneOffset(), n = t > 0 ? "-" : "+", r = String(Math.floor(Math.abs(t) / 60)).padStart(2, "0"), o = String(Math.abs(t) % 60).padStart(2, "0");
403
- return [n, r, o];
404
- }
405
- //#endregion
406
- withTimeZone(t) {
407
- return new ce(+this, t);
408
- }
409
- //#region date-fns integration
410
- [Symbol.for("constructDateFrom")](t) {
411
- return new ce(+new Date(t), this.timeZone);
412
- }
413
- //#endregion
414
- }
415
- const on = 6048e5, Vr = 864e5, It = Symbol.for("constructDateFrom");
416
- function ne(e, t) {
417
- return typeof e == "function" ? e(t) : e && typeof e == "object" && It in e ? e[It](t) : e instanceof Date ? new e.constructor(t) : new Date(t);
418
- }
419
- function K(e, t) {
420
- return ne(t || e, e);
421
- }
422
- function an(e, t, n) {
423
- const r = K(e, n == null ? void 0 : n.in);
424
- return isNaN(t) ? ne(e, NaN) : (t && r.setDate(r.getDate() + t), r);
425
- }
426
- function sn(e, t, n) {
427
- const r = K(e, n == null ? void 0 : n.in);
428
- if (isNaN(t)) return ne(e, NaN);
429
- if (!t)
430
- return r;
431
- const o = r.getDate(), a = ne(e, r.getTime());
432
- a.setMonth(r.getMonth() + t + 1, 0);
433
- const s = a.getDate();
434
- return o >= s ? a : (r.setFullYear(
435
- a.getFullYear(),
436
- a.getMonth(),
437
- o
438
- ), r);
439
- }
440
- let Qr = {};
441
- function Qe() {
442
- return Qr;
443
- }
444
- function Be(e, t) {
445
- var i, c, u, l;
446
- const n = Qe(), r = (t == null ? void 0 : t.weekStartsOn) ?? ((c = (i = t == null ? void 0 : t.locale) == null ? void 0 : i.options) == null ? void 0 : c.weekStartsOn) ?? n.weekStartsOn ?? ((l = (u = n.locale) == null ? void 0 : u.options) == null ? void 0 : l.weekStartsOn) ?? 0, o = K(e, t == null ? void 0 : t.in), a = o.getDay(), s = (a < r ? 7 : 0) + a - r;
447
- return o.setDate(o.getDate() - s), o.setHours(0, 0, 0, 0), o;
448
- }
449
- function qe(e, t) {
450
- return Be(e, { ...t, weekStartsOn: 1 });
451
- }
452
- function cn(e, t) {
453
- const n = K(e, t == null ? void 0 : t.in), r = n.getFullYear(), o = ne(n, 0);
454
- o.setFullYear(r + 1, 0, 4), o.setHours(0, 0, 0, 0);
455
- const a = qe(o), s = ne(n, 0);
456
- s.setFullYear(r, 0, 4), s.setHours(0, 0, 0, 0);
457
- const i = qe(s);
458
- return n.getTime() >= a.getTime() ? r + 1 : n.getTime() >= i.getTime() ? r : r - 1;
459
- }
460
- function Bt(e) {
461
- const t = K(e), n = new Date(
462
- Date.UTC(
463
- t.getFullYear(),
464
- t.getMonth(),
465
- t.getDate(),
466
- t.getHours(),
467
- t.getMinutes(),
468
- t.getSeconds(),
469
- t.getMilliseconds()
470
- )
471
- );
472
- return n.setUTCFullYear(t.getFullYear()), +e - +n;
473
- }
474
- function Ae(e, ...t) {
475
- const n = ne.bind(
476
- null,
477
- t.find((r) => typeof r == "object")
478
- );
479
- return t.map(n);
480
- }
481
- function Ue(e, t) {
482
- const n = K(e, t == null ? void 0 : t.in);
483
- return n.setHours(0, 0, 0, 0), n;
484
- }
485
- function vt(e, t, n) {
486
- const [r, o] = Ae(
487
- n == null ? void 0 : n.in,
488
- e,
489
- t
490
- ), a = Ue(r), s = Ue(o), i = +a - Bt(a), c = +s - Bt(s);
491
- return Math.round((i - c) / Vr);
492
- }
493
- function Xr(e, t) {
494
- const n = cn(e, t), r = ne(e, 0);
495
- return r.setFullYear(n, 0, 4), r.setHours(0, 0, 0, 0), qe(r);
496
- }
497
- function Kr(e, t, n) {
498
- return an(e, t * 7, n);
499
- }
500
- function Jr(e, t, n) {
501
- return sn(e, t * 12, n);
502
- }
503
- function Zr(e, t) {
504
- let n, r = t == null ? void 0 : t.in;
505
- return e.forEach((o) => {
506
- !r && typeof o == "object" && (r = ne.bind(null, o));
507
- const a = K(o, r);
508
- (!n || n < a || isNaN(+a)) && (n = a);
509
- }), ne(r, n || NaN);
510
- }
511
- function Lr(e, t) {
512
- let n, r = t == null ? void 0 : t.in;
513
- return e.forEach((o) => {
514
- !r && typeof o == "object" && (r = ne.bind(null, o));
515
- const a = K(o, r);
516
- (!n || n > a || isNaN(+a)) && (n = a);
517
- }), ne(r, n || NaN);
518
- }
519
- function eo(e, t, n) {
520
- const [r, o] = Ae(
521
- n == null ? void 0 : n.in,
522
- e,
523
- t
524
- );
525
- return +Ue(r) == +Ue(o);
526
- }
527
- function un(e) {
528
- return e instanceof Date || typeof e == "object" && Object.prototype.toString.call(e) === "[object Date]";
529
- }
530
- function to(e) {
531
- return !(!un(e) && typeof e != "number" || isNaN(+K(e)));
532
- }
533
- function ln(e, t, n) {
534
- const [r, o] = Ae(
535
- n == null ? void 0 : n.in,
536
- e,
537
- t
538
- ), a = r.getFullYear() - o.getFullYear(), s = r.getMonth() - o.getMonth();
539
- return a * 12 + s;
540
- }
541
- function no(e, t) {
542
- const n = K(e, t == null ? void 0 : t.in), r = n.getMonth();
543
- return n.setFullYear(n.getFullYear(), r + 1, 0), n.setHours(23, 59, 59, 999), n;
544
- }
545
- function dn(e, t) {
546
- const [n, r] = Ae(e, t.start, t.end);
547
- return { start: n, end: r };
548
- }
549
- function ro(e, t) {
550
- const { start: n, end: r } = dn(t == null ? void 0 : t.in, e);
551
- let o = +n > +r;
552
- const a = o ? +n : +r, s = o ? r : n;
553
- s.setHours(0, 0, 0, 0), s.setDate(1);
554
- let i = 1;
555
- const c = [];
556
- for (; +s <= a; )
557
- c.push(ne(n, s)), s.setMonth(s.getMonth() + i);
558
- return o ? c.reverse() : c;
559
- }
560
- function oo(e, t) {
561
- const n = K(e, t == null ? void 0 : t.in);
562
- return n.setDate(1), n.setHours(0, 0, 0, 0), n;
563
- }
564
- function ao(e, t) {
565
- const n = K(e, t == null ? void 0 : t.in), r = n.getFullYear();
566
- return n.setFullYear(r + 1, 0, 0), n.setHours(23, 59, 59, 999), n;
567
- }
568
- function fn(e, t) {
569
- const n = K(e, t == null ? void 0 : t.in);
570
- return n.setFullYear(n.getFullYear(), 0, 1), n.setHours(0, 0, 0, 0), n;
571
- }
572
- function so(e, t) {
573
- const { start: n, end: r } = dn(t == null ? void 0 : t.in, e);
574
- let o = +n > +r;
575
- const a = o ? +n : +r, s = o ? r : n;
576
- s.setHours(0, 0, 0, 0), s.setMonth(0, 1);
577
- let i = 1;
578
- const c = [];
579
- for (; +s <= a; )
580
- c.push(ne(n, s)), s.setFullYear(s.getFullYear() + i);
581
- return o ? c.reverse() : c;
582
- }
583
- function hn(e, t) {
584
- var i, c, u, l;
585
- const n = Qe(), r = (t == null ? void 0 : t.weekStartsOn) ?? ((c = (i = t == null ? void 0 : t.locale) == null ? void 0 : i.options) == null ? void 0 : c.weekStartsOn) ?? n.weekStartsOn ?? ((l = (u = n.locale) == null ? void 0 : u.options) == null ? void 0 : l.weekStartsOn) ?? 0, o = K(e, t == null ? void 0 : t.in), a = o.getDay(), s = (a < r ? -7 : 0) + 6 - (a - r);
586
- return o.setDate(o.getDate() + s), o.setHours(23, 59, 59, 999), o;
587
- }
588
- function io(e, t) {
589
- return hn(e, { ...t, weekStartsOn: 1 });
590
- }
591
- const co = {
592
- lessThanXSeconds: {
593
- one: "less than a second",
594
- other: "less than {{count}} seconds"
595
- },
596
- xSeconds: {
597
- one: "1 second",
598
- other: "{{count}} seconds"
599
- },
600
- halfAMinute: "half a minute",
601
- lessThanXMinutes: {
602
- one: "less than a minute",
603
- other: "less than {{count}} minutes"
604
- },
605
- xMinutes: {
606
- one: "1 minute",
607
- other: "{{count}} minutes"
608
- },
609
- aboutXHours: {
610
- one: "about 1 hour",
611
- other: "about {{count}} hours"
612
- },
613
- xHours: {
614
- one: "1 hour",
615
- other: "{{count}} hours"
616
- },
617
- xDays: {
618
- one: "1 day",
619
- other: "{{count}} days"
620
- },
621
- aboutXWeeks: {
622
- one: "about 1 week",
623
- other: "about {{count}} weeks"
624
- },
625
- xWeeks: {
626
- one: "1 week",
627
- other: "{{count}} weeks"
628
- },
629
- aboutXMonths: {
630
- one: "about 1 month",
631
- other: "about {{count}} months"
632
- },
633
- xMonths: {
634
- one: "1 month",
635
- other: "{{count}} months"
636
- },
637
- aboutXYears: {
638
- one: "about 1 year",
639
- other: "about {{count}} years"
640
- },
641
- xYears: {
642
- one: "1 year",
643
- other: "{{count}} years"
644
- },
645
- overXYears: {
646
- one: "over 1 year",
647
- other: "over {{count}} years"
648
- },
649
- almostXYears: {
650
- one: "almost 1 year",
651
- other: "almost {{count}} years"
652
- }
653
- }, uo = (e, t, n) => {
654
- let r;
655
- const o = co[e];
656
- return typeof o == "string" ? r = o : t === 1 ? r = o.one : r = o.other.replace("{{count}}", t.toString()), n != null && n.addSuffix ? n.comparison && n.comparison > 0 ? "in " + r : r + " ago" : r;
657
- };
658
- function yt(e) {
659
- return (t = {}) => {
660
- const n = t.width ? String(t.width) : e.defaultWidth;
661
- return e.formats[n] || e.formats[e.defaultWidth];
662
- };
663
- }
664
- const lo = {
665
- full: "EEEE, MMMM do, y",
666
- long: "MMMM do, y",
667
- medium: "MMM d, y",
668
- short: "MM/dd/yyyy"
669
- }, fo = {
670
- full: "h:mm:ss a zzzz",
671
- long: "h:mm:ss a z",
672
- medium: "h:mm:ss a",
673
- short: "h:mm a"
674
- }, ho = {
675
- full: "{{date}} 'at' {{time}}",
676
- long: "{{date}} 'at' {{time}}",
677
- medium: "{{date}}, {{time}}",
678
- short: "{{date}}, {{time}}"
679
- }, mo = {
680
- date: yt({
681
- formats: lo,
682
- defaultWidth: "full"
683
- }),
684
- time: yt({
685
- formats: fo,
686
- defaultWidth: "full"
687
- }),
688
- dateTime: yt({
689
- formats: ho,
690
- defaultWidth: "full"
691
- })
692
- }, yo = {
693
- lastWeek: "'last' eeee 'at' p",
694
- yesterday: "'yesterday at' p",
695
- today: "'today at' p",
696
- tomorrow: "'tomorrow at' p",
697
- nextWeek: "eeee 'at' p",
698
- other: "P"
699
- }, go = (e, t, n, r) => yo[e];
700
- function ze(e) {
701
- return (t, n) => {
702
- const r = n != null && n.context ? String(n.context) : "standalone";
703
- let o;
704
- if (r === "formatting" && e.formattingValues) {
705
- const s = e.defaultFormattingWidth || e.defaultWidth, i = n != null && n.width ? String(n.width) : s;
706
- o = e.formattingValues[i] || e.formattingValues[s];
707
- } else {
708
- const s = e.defaultWidth, i = n != null && n.width ? String(n.width) : e.defaultWidth;
709
- o = e.values[i] || e.values[s];
710
- }
711
- const a = e.argumentCallback ? e.argumentCallback(t) : t;
712
- return o[a];
713
- };
714
- }
715
- const wo = {
716
- narrow: ["B", "A"],
717
- abbreviated: ["BC", "AD"],
718
- wide: ["Before Christ", "Anno Domini"]
719
- }, bo = {
720
- narrow: ["1", "2", "3", "4"],
721
- abbreviated: ["Q1", "Q2", "Q3", "Q4"],
722
- wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"]
723
- }, Mo = {
724
- narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"],
725
- abbreviated: [
726
- "Jan",
727
- "Feb",
728
- "Mar",
729
- "Apr",
730
- "May",
731
- "Jun",
732
- "Jul",
733
- "Aug",
734
- "Sep",
735
- "Oct",
736
- "Nov",
737
- "Dec"
738
- ],
739
- wide: [
740
- "January",
741
- "February",
742
- "March",
743
- "April",
744
- "May",
745
- "June",
746
- "July",
747
- "August",
748
- "September",
749
- "October",
750
- "November",
751
- "December"
752
- ]
753
- }, vo = {
754
- narrow: ["S", "M", "T", "W", "T", "F", "S"],
755
- short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
756
- abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
757
- wide: [
758
- "Sunday",
759
- "Monday",
760
- "Tuesday",
761
- "Wednesday",
762
- "Thursday",
763
- "Friday",
764
- "Saturday"
765
- ]
766
- }, Do = {
767
- narrow: {
768
- am: "a",
769
- pm: "p",
770
- midnight: "mi",
771
- noon: "n",
772
- morning: "morning",
773
- afternoon: "afternoon",
774
- evening: "evening",
775
- night: "night"
776
- },
777
- abbreviated: {
778
- am: "AM",
779
- pm: "PM",
780
- midnight: "midnight",
781
- noon: "noon",
782
- morning: "morning",
783
- afternoon: "afternoon",
784
- evening: "evening",
785
- night: "night"
786
- },
787
- wide: {
788
- am: "a.m.",
789
- pm: "p.m.",
790
- midnight: "midnight",
791
- noon: "noon",
792
- morning: "morning",
793
- afternoon: "afternoon",
794
- evening: "evening",
795
- night: "night"
796
- }
797
- }, ko = {
798
- narrow: {
799
- am: "a",
800
- pm: "p",
801
- midnight: "mi",
802
- noon: "n",
803
- morning: "in the morning",
804
- afternoon: "in the afternoon",
805
- evening: "in the evening",
806
- night: "at night"
807
- },
808
- abbreviated: {
809
- am: "AM",
810
- pm: "PM",
811
- midnight: "midnight",
812
- noon: "noon",
813
- morning: "in the morning",
814
- afternoon: "in the afternoon",
815
- evening: "in the evening",
816
- night: "at night"
817
- },
818
- wide: {
819
- am: "a.m.",
820
- pm: "p.m.",
821
- midnight: "midnight",
822
- noon: "noon",
823
- morning: "in the morning",
824
- afternoon: "in the afternoon",
825
- evening: "in the evening",
826
- night: "at night"
827
- }
828
- }, Oo = (e, t) => {
829
- const n = Number(e), r = n % 100;
830
- if (r > 20 || r < 10)
831
- switch (r % 10) {
832
- case 1:
833
- return n + "st";
834
- case 2:
835
- return n + "nd";
836
- case 3:
837
- return n + "rd";
838
- }
839
- return n + "th";
840
- }, po = {
841
- ordinalNumber: Oo,
842
- era: ze({
843
- values: wo,
844
- defaultWidth: "wide"
845
- }),
846
- quarter: ze({
847
- values: bo,
848
- defaultWidth: "wide",
849
- argumentCallback: (e) => e - 1
850
- }),
851
- month: ze({
852
- values: Mo,
853
- defaultWidth: "wide"
854
- }),
855
- day: ze({
856
- values: vo,
857
- defaultWidth: "wide"
858
- }),
859
- dayPeriod: ze({
860
- values: Do,
861
- defaultWidth: "wide",
862
- formattingValues: ko,
863
- defaultFormattingWidth: "wide"
864
- })
865
- };
866
- function He(e) {
867
- return (t, n = {}) => {
868
- const r = n.width, o = r && e.matchPatterns[r] || e.matchPatterns[e.defaultMatchWidth], a = t.match(o);
869
- if (!a)
870
- return null;
871
- const s = a[0], i = r && e.parsePatterns[r] || e.parsePatterns[e.defaultParseWidth], c = Array.isArray(i) ? Wo(i, (d) => d.test(s)) : (
872
- // [TODO] -- I challenge you to fix the type
873
- So(i, (d) => d.test(s))
874
- );
875
- let u;
876
- u = e.valueCallback ? e.valueCallback(c) : c, u = n.valueCallback ? (
877
- // [TODO] -- I challenge you to fix the type
878
- n.valueCallback(u)
879
- ) : u;
880
- const l = t.slice(s.length);
881
- return { value: u, rest: l };
882
- };
883
- }
884
- function So(e, t) {
885
- for (const n in e)
886
- if (Object.prototype.hasOwnProperty.call(e, n) && t(e[n]))
887
- return n;
888
- }
889
- function Wo(e, t) {
890
- for (let n = 0; n < e.length; n++)
891
- if (t(e[n]))
892
- return n;
893
- }
894
- function Co(e) {
895
- return (t, n = {}) => {
896
- const r = t.match(e.matchPattern);
897
- if (!r) return null;
898
- const o = r[0], a = t.match(e.parsePattern);
899
- if (!a) return null;
900
- let s = e.valueCallback ? e.valueCallback(a[0]) : a[0];
901
- s = n.valueCallback ? n.valueCallback(s) : s;
902
- const i = t.slice(o.length);
903
- return { value: s, rest: i };
904
- };
905
- }
906
- const No = /^(\d+)(th|st|nd|rd)?/i, To = /\d+/i, xo = {
907
- narrow: /^(b|a)/i,
908
- abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
909
- wide: /^(before christ|before common era|anno domini|common era)/i
910
- }, Yo = {
911
- any: [/^b/i, /^(a|c)/i]
912
- }, $o = {
913
- narrow: /^[1234]/i,
914
- abbreviated: /^q[1234]/i,
915
- wide: /^[1234](th|st|nd|rd)? quarter/i
916
- }, Fo = {
917
- any: [/1/i, /2/i, /3/i, /4/i]
918
- }, Po = {
919
- narrow: /^[jfmasond]/i,
920
- abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
921
- wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
922
- }, _o = {
923
- narrow: [
924
- /^j/i,
925
- /^f/i,
926
- /^m/i,
927
- /^a/i,
928
- /^m/i,
929
- /^j/i,
930
- /^j/i,
931
- /^a/i,
932
- /^s/i,
933
- /^o/i,
934
- /^n/i,
935
- /^d/i
936
- ],
937
- any: [
938
- /^ja/i,
939
- /^f/i,
940
- /^mar/i,
941
- /^ap/i,
942
- /^may/i,
943
- /^jun/i,
944
- /^jul/i,
945
- /^au/i,
946
- /^s/i,
947
- /^o/i,
948
- /^n/i,
949
- /^d/i
950
- ]
951
- }, Eo = {
952
- narrow: /^[smtwf]/i,
953
- short: /^(su|mo|tu|we|th|fr|sa)/i,
954
- abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
955
- wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
956
- }, Io = {
957
- narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
958
- any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
959
- }, Bo = {
960
- narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
961
- any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
962
- }, Ao = {
963
- any: {
964
- am: /^a/i,
965
- pm: /^p/i,
966
- midnight: /^mi/i,
967
- noon: /^no/i,
968
- morning: /morning/i,
969
- afternoon: /afternoon/i,
970
- evening: /evening/i,
971
- night: /night/i
972
- }
973
- }, zo = {
974
- ordinalNumber: Co({
975
- matchPattern: No,
976
- parsePattern: To,
977
- valueCallback: (e) => parseInt(e, 10)
978
- }),
979
- era: He({
980
- matchPatterns: xo,
981
- defaultMatchWidth: "wide",
982
- parsePatterns: Yo,
983
- defaultParseWidth: "any"
984
- }),
985
- quarter: He({
986
- matchPatterns: $o,
987
- defaultMatchWidth: "wide",
988
- parsePatterns: Fo,
989
- defaultParseWidth: "any",
990
- valueCallback: (e) => e + 1
991
- }),
992
- month: He({
993
- matchPatterns: Po,
994
- defaultMatchWidth: "wide",
995
- parsePatterns: _o,
996
- defaultParseWidth: "any"
997
- }),
998
- day: He({
999
- matchPatterns: Eo,
1000
- defaultMatchWidth: "wide",
1001
- parsePatterns: Io,
1002
- defaultParseWidth: "any"
1003
- }),
1004
- dayPeriod: He({
1005
- matchPatterns: Bo,
1006
- defaultMatchWidth: "any",
1007
- parsePatterns: Ao,
1008
- defaultParseWidth: "any"
1009
- })
1010
- }, Ee = {
1011
- code: "en-US",
1012
- formatDistance: uo,
1013
- formatLong: mo,
1014
- formatRelative: go,
1015
- localize: po,
1016
- match: zo,
1017
- options: {
1018
- weekStartsOn: 0,
1019
- firstWeekContainsDate: 1
1020
- }
1021
- };
1022
- function Ho(e, t) {
1023
- const n = K(e, t == null ? void 0 : t.in);
1024
- return vt(n, fn(n)) + 1;
1025
- }
1026
- function Dt(e, t) {
1027
- const n = K(e, t == null ? void 0 : t.in), r = +qe(n) - +Xr(n);
1028
- return Math.round(r / on) + 1;
1029
- }
1030
- function mn(e, t) {
1031
- var l, d, h, m;
1032
- const n = K(e, t == null ? void 0 : t.in), r = n.getFullYear(), o = Qe(), a = (t == null ? void 0 : t.firstWeekContainsDate) ?? ((d = (l = t == null ? void 0 : t.locale) == null ? void 0 : l.options) == null ? void 0 : d.firstWeekContainsDate) ?? o.firstWeekContainsDate ?? ((m = (h = o.locale) == null ? void 0 : h.options) == null ? void 0 : m.firstWeekContainsDate) ?? 1, s = ne((t == null ? void 0 : t.in) || e, 0);
1033
- s.setFullYear(r + 1, 0, a), s.setHours(0, 0, 0, 0);
1034
- const i = Be(s, t), c = ne((t == null ? void 0 : t.in) || e, 0);
1035
- c.setFullYear(r, 0, a), c.setHours(0, 0, 0, 0);
1036
- const u = Be(c, t);
1037
- return +n >= +i ? r + 1 : +n >= +u ? r : r - 1;
1038
- }
1039
- function jo(e, t) {
1040
- var i, c, u, l;
1041
- const n = Qe(), r = (t == null ? void 0 : t.firstWeekContainsDate) ?? ((c = (i = t == null ? void 0 : t.locale) == null ? void 0 : i.options) == null ? void 0 : c.firstWeekContainsDate) ?? n.firstWeekContainsDate ?? ((l = (u = n.locale) == null ? void 0 : u.options) == null ? void 0 : l.firstWeekContainsDate) ?? 1, o = mn(e, t), a = ne((t == null ? void 0 : t.in) || e, 0);
1042
- return a.setFullYear(o, 0, r), a.setHours(0, 0, 0, 0), Be(a, t);
1043
- }
1044
- function kt(e, t) {
1045
- const n = K(e, t == null ? void 0 : t.in), r = +Be(n, t) - +jo(n, t);
1046
- return Math.round(r / on) + 1;
1047
- }
1048
- function X(e, t) {
1049
- const n = e < 0 ? "-" : "", r = Math.abs(e).toString().padStart(t, "0");
1050
- return n + r;
1051
- }
1052
- const Ce = {
1053
- // Year
1054
- y(e, t) {
1055
- const n = e.getFullYear(), r = n > 0 ? n : 1 - n;
1056
- return X(t === "yy" ? r % 100 : r, t.length);
1057
- },
1058
- // Month
1059
- M(e, t) {
1060
- const n = e.getMonth();
1061
- return t === "M" ? String(n + 1) : X(n + 1, 2);
1062
- },
1063
- // Day of the month
1064
- d(e, t) {
1065
- return X(e.getDate(), t.length);
1066
- },
1067
- // AM or PM
1068
- a(e, t) {
1069
- const n = e.getHours() / 12 >= 1 ? "pm" : "am";
1070
- switch (t) {
1071
- case "a":
1072
- case "aa":
1073
- return n.toUpperCase();
1074
- case "aaa":
1075
- return n;
1076
- case "aaaaa":
1077
- return n[0];
1078
- case "aaaa":
1079
- default:
1080
- return n === "am" ? "a.m." : "p.m.";
1081
- }
1082
- },
1083
- // Hour [1-12]
1084
- h(e, t) {
1085
- return X(e.getHours() % 12 || 12, t.length);
1086
- },
1087
- // Hour [0-23]
1088
- H(e, t) {
1089
- return X(e.getHours(), t.length);
1090
- },
1091
- // Minute
1092
- m(e, t) {
1093
- return X(e.getMinutes(), t.length);
1094
- },
1095
- // Second
1096
- s(e, t) {
1097
- return X(e.getSeconds(), t.length);
1098
- },
1099
- // Fraction of second
1100
- S(e, t) {
1101
- const n = t.length, r = e.getMilliseconds(), o = Math.trunc(
1102
- r * Math.pow(10, n - 3)
1103
- );
1104
- return X(o, t.length);
1105
- }
1106
- }, Pe = {
1107
- midnight: "midnight",
1108
- noon: "noon",
1109
- morning: "morning",
1110
- afternoon: "afternoon",
1111
- evening: "evening",
1112
- night: "night"
1113
- }, At = {
1114
- // Era
1115
- G: function(e, t, n) {
1116
- const r = e.getFullYear() > 0 ? 1 : 0;
1117
- switch (t) {
1118
- // AD, BC
1119
- case "G":
1120
- case "GG":
1121
- case "GGG":
1122
- return n.era(r, { width: "abbreviated" });
1123
- // A, B
1124
- case "GGGGG":
1125
- return n.era(r, { width: "narrow" });
1126
- // Anno Domini, Before Christ
1127
- case "GGGG":
1128
- default:
1129
- return n.era(r, { width: "wide" });
1130
- }
1131
- },
1132
- // Year
1133
- y: function(e, t, n) {
1134
- if (t === "yo") {
1135
- const r = e.getFullYear(), o = r > 0 ? r : 1 - r;
1136
- return n.ordinalNumber(o, { unit: "year" });
1137
- }
1138
- return Ce.y(e, t);
1139
- },
1140
- // Local week-numbering year
1141
- Y: function(e, t, n, r) {
1142
- const o = mn(e, r), a = o > 0 ? o : 1 - o;
1143
- if (t === "YY") {
1144
- const s = a % 100;
1145
- return X(s, 2);
1146
- }
1147
- return t === "Yo" ? n.ordinalNumber(a, { unit: "year" }) : X(a, t.length);
1148
- },
1149
- // ISO week-numbering year
1150
- R: function(e, t) {
1151
- const n = cn(e);
1152
- return X(n, t.length);
1153
- },
1154
- // Extended year. This is a single number designating the year of this calendar system.
1155
- // The main difference between `y` and `u` localizers are B.C. years:
1156
- // | Year | `y` | `u` |
1157
- // |------|-----|-----|
1158
- // | AC 1 | 1 | 1 |
1159
- // | BC 1 | 1 | 0 |
1160
- // | BC 2 | 2 | -1 |
1161
- // Also `yy` always returns the last two digits of a year,
1162
- // while `uu` pads single digit years to 2 characters and returns other years unchanged.
1163
- u: function(e, t) {
1164
- const n = e.getFullYear();
1165
- return X(n, t.length);
1166
- },
1167
- // Quarter
1168
- Q: function(e, t, n) {
1169
- const r = Math.ceil((e.getMonth() + 1) / 3);
1170
- switch (t) {
1171
- // 1, 2, 3, 4
1172
- case "Q":
1173
- return String(r);
1174
- // 01, 02, 03, 04
1175
- case "QQ":
1176
- return X(r, 2);
1177
- // 1st, 2nd, 3rd, 4th
1178
- case "Qo":
1179
- return n.ordinalNumber(r, { unit: "quarter" });
1180
- // Q1, Q2, Q3, Q4
1181
- case "QQQ":
1182
- return n.quarter(r, {
1183
- width: "abbreviated",
1184
- context: "formatting"
1185
- });
1186
- // 1, 2, 3, 4 (narrow quarter; could be not numerical)
1187
- case "QQQQQ":
1188
- return n.quarter(r, {
1189
- width: "narrow",
1190
- context: "formatting"
1191
- });
1192
- // 1st quarter, 2nd quarter, ...
1193
- case "QQQQ":
1194
- default:
1195
- return n.quarter(r, {
1196
- width: "wide",
1197
- context: "formatting"
1198
- });
1199
- }
1200
- },
1201
- // Stand-alone quarter
1202
- q: function(e, t, n) {
1203
- const r = Math.ceil((e.getMonth() + 1) / 3);
1204
- switch (t) {
1205
- // 1, 2, 3, 4
1206
- case "q":
1207
- return String(r);
1208
- // 01, 02, 03, 04
1209
- case "qq":
1210
- return X(r, 2);
1211
- // 1st, 2nd, 3rd, 4th
1212
- case "qo":
1213
- return n.ordinalNumber(r, { unit: "quarter" });
1214
- // Q1, Q2, Q3, Q4
1215
- case "qqq":
1216
- return n.quarter(r, {
1217
- width: "abbreviated",
1218
- context: "standalone"
1219
- });
1220
- // 1, 2, 3, 4 (narrow quarter; could be not numerical)
1221
- case "qqqqq":
1222
- return n.quarter(r, {
1223
- width: "narrow",
1224
- context: "standalone"
1225
- });
1226
- // 1st quarter, 2nd quarter, ...
1227
- case "qqqq":
1228
- default:
1229
- return n.quarter(r, {
1230
- width: "wide",
1231
- context: "standalone"
1232
- });
1233
- }
1234
- },
1235
- // Month
1236
- M: function(e, t, n) {
1237
- const r = e.getMonth();
1238
- switch (t) {
1239
- case "M":
1240
- case "MM":
1241
- return Ce.M(e, t);
1242
- // 1st, 2nd, ..., 12th
1243
- case "Mo":
1244
- return n.ordinalNumber(r + 1, { unit: "month" });
1245
- // Jan, Feb, ..., Dec
1246
- case "MMM":
1247
- return n.month(r, {
1248
- width: "abbreviated",
1249
- context: "formatting"
1250
- });
1251
- // J, F, ..., D
1252
- case "MMMMM":
1253
- return n.month(r, {
1254
- width: "narrow",
1255
- context: "formatting"
1256
- });
1257
- // January, February, ..., December
1258
- case "MMMM":
1259
- default:
1260
- return n.month(r, { width: "wide", context: "formatting" });
1261
- }
1262
- },
1263
- // Stand-alone month
1264
- L: function(e, t, n) {
1265
- const r = e.getMonth();
1266
- switch (t) {
1267
- // 1, 2, ..., 12
1268
- case "L":
1269
- return String(r + 1);
1270
- // 01, 02, ..., 12
1271
- case "LL":
1272
- return X(r + 1, 2);
1273
- // 1st, 2nd, ..., 12th
1274
- case "Lo":
1275
- return n.ordinalNumber(r + 1, { unit: "month" });
1276
- // Jan, Feb, ..., Dec
1277
- case "LLL":
1278
- return n.month(r, {
1279
- width: "abbreviated",
1280
- context: "standalone"
1281
- });
1282
- // J, F, ..., D
1283
- case "LLLLL":
1284
- return n.month(r, {
1285
- width: "narrow",
1286
- context: "standalone"
1287
- });
1288
- // January, February, ..., December
1289
- case "LLLL":
1290
- default:
1291
- return n.month(r, { width: "wide", context: "standalone" });
1292
- }
1293
- },
1294
- // Local week of year
1295
- w: function(e, t, n, r) {
1296
- const o = kt(e, r);
1297
- return t === "wo" ? n.ordinalNumber(o, { unit: "week" }) : X(o, t.length);
1298
- },
1299
- // ISO week of year
1300
- I: function(e, t, n) {
1301
- const r = Dt(e);
1302
- return t === "Io" ? n.ordinalNumber(r, { unit: "week" }) : X(r, t.length);
1303
- },
1304
- // Day of the month
1305
- d: function(e, t, n) {
1306
- return t === "do" ? n.ordinalNumber(e.getDate(), { unit: "date" }) : Ce.d(e, t);
1307
- },
1308
- // Day of year
1309
- D: function(e, t, n) {
1310
- const r = Ho(e);
1311
- return t === "Do" ? n.ordinalNumber(r, { unit: "dayOfYear" }) : X(r, t.length);
1312
- },
1313
- // Day of week
1314
- E: function(e, t, n) {
1315
- const r = e.getDay();
1316
- switch (t) {
1317
- // Tue
1318
- case "E":
1319
- case "EE":
1320
- case "EEE":
1321
- return n.day(r, {
1322
- width: "abbreviated",
1323
- context: "formatting"
1324
- });
1325
- // T
1326
- case "EEEEE":
1327
- return n.day(r, {
1328
- width: "narrow",
1329
- context: "formatting"
1330
- });
1331
- // Tu
1332
- case "EEEEEE":
1333
- return n.day(r, {
1334
- width: "short",
1335
- context: "formatting"
1336
- });
1337
- // Tuesday
1338
- case "EEEE":
1339
- default:
1340
- return n.day(r, {
1341
- width: "wide",
1342
- context: "formatting"
1343
- });
1344
- }
1345
- },
1346
- // Local day of week
1347
- e: function(e, t, n, r) {
1348
- const o = e.getDay(), a = (o - r.weekStartsOn + 8) % 7 || 7;
1349
- switch (t) {
1350
- // Numerical value (Nth day of week with current locale or weekStartsOn)
1351
- case "e":
1352
- return String(a);
1353
- // Padded numerical value
1354
- case "ee":
1355
- return X(a, 2);
1356
- // 1st, 2nd, ..., 7th
1357
- case "eo":
1358
- return n.ordinalNumber(a, { unit: "day" });
1359
- case "eee":
1360
- return n.day(o, {
1361
- width: "abbreviated",
1362
- context: "formatting"
1363
- });
1364
- // T
1365
- case "eeeee":
1366
- return n.day(o, {
1367
- width: "narrow",
1368
- context: "formatting"
1369
- });
1370
- // Tu
1371
- case "eeeeee":
1372
- return n.day(o, {
1373
- width: "short",
1374
- context: "formatting"
1375
- });
1376
- // Tuesday
1377
- case "eeee":
1378
- default:
1379
- return n.day(o, {
1380
- width: "wide",
1381
- context: "formatting"
1382
- });
1383
- }
1384
- },
1385
- // Stand-alone local day of week
1386
- c: function(e, t, n, r) {
1387
- const o = e.getDay(), a = (o - r.weekStartsOn + 8) % 7 || 7;
1388
- switch (t) {
1389
- // Numerical value (same as in `e`)
1390
- case "c":
1391
- return String(a);
1392
- // Padded numerical value
1393
- case "cc":
1394
- return X(a, t.length);
1395
- // 1st, 2nd, ..., 7th
1396
- case "co":
1397
- return n.ordinalNumber(a, { unit: "day" });
1398
- case "ccc":
1399
- return n.day(o, {
1400
- width: "abbreviated",
1401
- context: "standalone"
1402
- });
1403
- // T
1404
- case "ccccc":
1405
- return n.day(o, {
1406
- width: "narrow",
1407
- context: "standalone"
1408
- });
1409
- // Tu
1410
- case "cccccc":
1411
- return n.day(o, {
1412
- width: "short",
1413
- context: "standalone"
1414
- });
1415
- // Tuesday
1416
- case "cccc":
1417
- default:
1418
- return n.day(o, {
1419
- width: "wide",
1420
- context: "standalone"
1421
- });
1422
- }
1423
- },
1424
- // ISO day of week
1425
- i: function(e, t, n) {
1426
- const r = e.getDay(), o = r === 0 ? 7 : r;
1427
- switch (t) {
1428
- // 2
1429
- case "i":
1430
- return String(o);
1431
- // 02
1432
- case "ii":
1433
- return X(o, t.length);
1434
- // 2nd
1435
- case "io":
1436
- return n.ordinalNumber(o, { unit: "day" });
1437
- // Tue
1438
- case "iii":
1439
- return n.day(r, {
1440
- width: "abbreviated",
1441
- context: "formatting"
1442
- });
1443
- // T
1444
- case "iiiii":
1445
- return n.day(r, {
1446
- width: "narrow",
1447
- context: "formatting"
1448
- });
1449
- // Tu
1450
- case "iiiiii":
1451
- return n.day(r, {
1452
- width: "short",
1453
- context: "formatting"
1454
- });
1455
- // Tuesday
1456
- case "iiii":
1457
- default:
1458
- return n.day(r, {
1459
- width: "wide",
1460
- context: "formatting"
1461
- });
1462
- }
1463
- },
1464
- // AM or PM
1465
- a: function(e, t, n) {
1466
- const o = e.getHours() / 12 >= 1 ? "pm" : "am";
1467
- switch (t) {
1468
- case "a":
1469
- case "aa":
1470
- return n.dayPeriod(o, {
1471
- width: "abbreviated",
1472
- context: "formatting"
1473
- });
1474
- case "aaa":
1475
- return n.dayPeriod(o, {
1476
- width: "abbreviated",
1477
- context: "formatting"
1478
- }).toLowerCase();
1479
- case "aaaaa":
1480
- return n.dayPeriod(o, {
1481
- width: "narrow",
1482
- context: "formatting"
1483
- });
1484
- case "aaaa":
1485
- default:
1486
- return n.dayPeriod(o, {
1487
- width: "wide",
1488
- context: "formatting"
1489
- });
1490
- }
1491
- },
1492
- // AM, PM, midnight, noon
1493
- b: function(e, t, n) {
1494
- const r = e.getHours();
1495
- let o;
1496
- switch (r === 12 ? o = Pe.noon : r === 0 ? o = Pe.midnight : o = r / 12 >= 1 ? "pm" : "am", t) {
1497
- case "b":
1498
- case "bb":
1499
- return n.dayPeriod(o, {
1500
- width: "abbreviated",
1501
- context: "formatting"
1502
- });
1503
- case "bbb":
1504
- return n.dayPeriod(o, {
1505
- width: "abbreviated",
1506
- context: "formatting"
1507
- }).toLowerCase();
1508
- case "bbbbb":
1509
- return n.dayPeriod(o, {
1510
- width: "narrow",
1511
- context: "formatting"
1512
- });
1513
- case "bbbb":
1514
- default:
1515
- return n.dayPeriod(o, {
1516
- width: "wide",
1517
- context: "formatting"
1518
- });
1519
- }
1520
- },
1521
- // in the morning, in the afternoon, in the evening, at night
1522
- B: function(e, t, n) {
1523
- const r = e.getHours();
1524
- let o;
1525
- switch (r >= 17 ? o = Pe.evening : r >= 12 ? o = Pe.afternoon : r >= 4 ? o = Pe.morning : o = Pe.night, t) {
1526
- case "B":
1527
- case "BB":
1528
- case "BBB":
1529
- return n.dayPeriod(o, {
1530
- width: "abbreviated",
1531
- context: "formatting"
1532
- });
1533
- case "BBBBB":
1534
- return n.dayPeriod(o, {
1535
- width: "narrow",
1536
- context: "formatting"
1537
- });
1538
- case "BBBB":
1539
- default:
1540
- return n.dayPeriod(o, {
1541
- width: "wide",
1542
- context: "formatting"
1543
- });
1544
- }
1545
- },
1546
- // Hour [1-12]
1547
- h: function(e, t, n) {
1548
- if (t === "ho") {
1549
- let r = e.getHours() % 12;
1550
- return r === 0 && (r = 12), n.ordinalNumber(r, { unit: "hour" });
1551
- }
1552
- return Ce.h(e, t);
1553
- },
1554
- // Hour [0-23]
1555
- H: function(e, t, n) {
1556
- return t === "Ho" ? n.ordinalNumber(e.getHours(), { unit: "hour" }) : Ce.H(e, t);
1557
- },
1558
- // Hour [0-11]
1559
- K: function(e, t, n) {
1560
- const r = e.getHours() % 12;
1561
- return t === "Ko" ? n.ordinalNumber(r, { unit: "hour" }) : X(r, t.length);
1562
- },
1563
- // Hour [1-24]
1564
- k: function(e, t, n) {
1565
- let r = e.getHours();
1566
- return r === 0 && (r = 24), t === "ko" ? n.ordinalNumber(r, { unit: "hour" }) : X(r, t.length);
1567
- },
1568
- // Minute
1569
- m: function(e, t, n) {
1570
- return t === "mo" ? n.ordinalNumber(e.getMinutes(), { unit: "minute" }) : Ce.m(e, t);
1571
- },
1572
- // Second
1573
- s: function(e, t, n) {
1574
- return t === "so" ? n.ordinalNumber(e.getSeconds(), { unit: "second" }) : Ce.s(e, t);
1575
- },
1576
- // Fraction of second
1577
- S: function(e, t) {
1578
- return Ce.S(e, t);
1579
- },
1580
- // Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
1581
- X: function(e, t, n) {
1582
- const r = e.getTimezoneOffset();
1583
- if (r === 0)
1584
- return "Z";
1585
- switch (t) {
1586
- // Hours and optional minutes
1587
- case "X":
1588
- return Ht(r);
1589
- // Hours, minutes and optional seconds without `:` delimiter
1590
- // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
1591
- // so this token always has the same output as `XX`
1592
- case "XXXX":
1593
- case "XX":
1594
- return xe(r);
1595
- // Hours, minutes and optional seconds with `:` delimiter
1596
- // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
1597
- // so this token always has the same output as `XXX`
1598
- case "XXXXX":
1599
- case "XXX":
1600
- // Hours and minutes with `:` delimiter
1601
- default:
1602
- return xe(r, ":");
1603
- }
1604
- },
1605
- // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
1606
- x: function(e, t, n) {
1607
- const r = e.getTimezoneOffset();
1608
- switch (t) {
1609
- // Hours and optional minutes
1610
- case "x":
1611
- return Ht(r);
1612
- // Hours, minutes and optional seconds without `:` delimiter
1613
- // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
1614
- // so this token always has the same output as `xx`
1615
- case "xxxx":
1616
- case "xx":
1617
- return xe(r);
1618
- // Hours, minutes and optional seconds with `:` delimiter
1619
- // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
1620
- // so this token always has the same output as `xxx`
1621
- case "xxxxx":
1622
- case "xxx":
1623
- // Hours and minutes with `:` delimiter
1624
- default:
1625
- return xe(r, ":");
1626
- }
1627
- },
1628
- // Timezone (GMT)
1629
- O: function(e, t, n) {
1630
- const r = e.getTimezoneOffset();
1631
- switch (t) {
1632
- // Short
1633
- case "O":
1634
- case "OO":
1635
- case "OOO":
1636
- return "GMT" + zt(r, ":");
1637
- // Long
1638
- case "OOOO":
1639
- default:
1640
- return "GMT" + xe(r, ":");
1641
- }
1642
- },
1643
- // Timezone (specific non-location)
1644
- z: function(e, t, n) {
1645
- const r = e.getTimezoneOffset();
1646
- switch (t) {
1647
- // Short
1648
- case "z":
1649
- case "zz":
1650
- case "zzz":
1651
- return "GMT" + zt(r, ":");
1652
- // Long
1653
- case "zzzz":
1654
- default:
1655
- return "GMT" + xe(r, ":");
1656
- }
1657
- },
1658
- // Seconds timestamp
1659
- t: function(e, t, n) {
1660
- const r = Math.trunc(+e / 1e3);
1661
- return X(r, t.length);
1662
- },
1663
- // Milliseconds timestamp
1664
- T: function(e, t, n) {
1665
- return X(+e, t.length);
1666
- }
1667
- };
1668
- function zt(e, t = "") {
1669
- const n = e > 0 ? "-" : "+", r = Math.abs(e), o = Math.trunc(r / 60), a = r % 60;
1670
- return a === 0 ? n + String(o) : n + String(o) + t + X(a, 2);
1671
- }
1672
- function Ht(e, t) {
1673
- return e % 60 === 0 ? (e > 0 ? "-" : "+") + X(Math.abs(e) / 60, 2) : xe(e, t);
1674
- }
1675
- function xe(e, t = "") {
1676
- const n = e > 0 ? "-" : "+", r = Math.abs(e), o = X(Math.trunc(r / 60), 2), a = X(r % 60, 2);
1677
- return n + o + t + a;
1678
- }
1679
- const jt = (e, t) => {
1680
- switch (e) {
1681
- case "P":
1682
- return t.date({ width: "short" });
1683
- case "PP":
1684
- return t.date({ width: "medium" });
1685
- case "PPP":
1686
- return t.date({ width: "long" });
1687
- case "PPPP":
1688
- default:
1689
- return t.date({ width: "full" });
1690
- }
1691
- }, yn = (e, t) => {
1692
- switch (e) {
1693
- case "p":
1694
- return t.time({ width: "short" });
1695
- case "pp":
1696
- return t.time({ width: "medium" });
1697
- case "ppp":
1698
- return t.time({ width: "long" });
1699
- case "pppp":
1700
- default:
1701
- return t.time({ width: "full" });
1702
- }
1703
- }, Ro = (e, t) => {
1704
- const n = e.match(/(P+)(p+)?/) || [], r = n[1], o = n[2];
1705
- if (!o)
1706
- return jt(e, t);
1707
- let a;
1708
- switch (r) {
1709
- case "P":
1710
- a = t.dateTime({ width: "short" });
1711
- break;
1712
- case "PP":
1713
- a = t.dateTime({ width: "medium" });
1714
- break;
1715
- case "PPP":
1716
- a = t.dateTime({ width: "long" });
1717
- break;
1718
- case "PPPP":
1719
- default:
1720
- a = t.dateTime({ width: "full" });
1721
- break;
1722
- }
1723
- return a.replace("{{date}}", jt(r, t)).replace("{{time}}", yn(o, t));
1724
- }, qo = {
1725
- p: yn,
1726
- P: Ro
1727
- }, Uo = /^D+$/, Go = /^Y+$/, Vo = ["D", "DD", "YY", "YYYY"];
1728
- function Qo(e) {
1729
- return Uo.test(e);
1730
- }
1731
- function Xo(e) {
1732
- return Go.test(e);
1733
- }
1734
- function Ko(e, t, n) {
1735
- const r = Jo(e, t, n);
1736
- if (console.warn(r), Vo.includes(e)) throw new RangeError(r);
1737
- }
1738
- function Jo(e, t, n) {
1739
- const r = e[0] === "Y" ? "years" : "days of the month";
1740
- return `Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`;
1741
- }
1742
- const Zo = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g, Lo = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g, ea = /^'([^]*?)'?$/, ta = /''/g, na = /[a-zA-Z]/;
1743
- function Re(e, t, n) {
1744
- var l, d, h, m, y, N, x, P;
1745
- const r = Qe(), o = (n == null ? void 0 : n.locale) ?? r.locale ?? Ee, a = (n == null ? void 0 : n.firstWeekContainsDate) ?? ((d = (l = n == null ? void 0 : n.locale) == null ? void 0 : l.options) == null ? void 0 : d.firstWeekContainsDate) ?? r.firstWeekContainsDate ?? ((m = (h = r.locale) == null ? void 0 : h.options) == null ? void 0 : m.firstWeekContainsDate) ?? 1, s = (n == null ? void 0 : n.weekStartsOn) ?? ((N = (y = n == null ? void 0 : n.locale) == null ? void 0 : y.options) == null ? void 0 : N.weekStartsOn) ?? r.weekStartsOn ?? ((P = (x = r.locale) == null ? void 0 : x.options) == null ? void 0 : P.weekStartsOn) ?? 0, i = K(e, n == null ? void 0 : n.in);
1746
- if (!to(i))
1747
- throw new RangeError("Invalid time value");
1748
- let c = t.match(Lo).map((b) => {
1749
- const v = b[0];
1750
- if (v === "p" || v === "P") {
1751
- const C = qo[v];
1752
- return C(b, o.formatLong);
1753
- }
1754
- return b;
1755
- }).join("").match(Zo).map((b) => {
1756
- if (b === "''")
1757
- return { isToken: !1, value: "'" };
1758
- const v = b[0];
1759
- if (v === "'")
1760
- return { isToken: !1, value: ra(b) };
1761
- if (At[v])
1762
- return { isToken: !0, value: b };
1763
- if (v.match(na))
1764
- throw new RangeError(
1765
- "Format string contains an unescaped latin alphabet character `" + v + "`"
1766
- );
1767
- return { isToken: !1, value: b };
1768
- });
1769
- o.localize.preprocessor && (c = o.localize.preprocessor(i, c));
1770
- const u = {
1771
- firstWeekContainsDate: a,
1772
- weekStartsOn: s,
1773
- locale: o
1774
- };
1775
- return c.map((b) => {
1776
- if (!b.isToken) return b.value;
1777
- const v = b.value;
1778
- (!(n != null && n.useAdditionalWeekYearTokens) && Xo(v) || !(n != null && n.useAdditionalDayOfYearTokens) && Qo(v)) && Ko(v, t, String(e));
1779
- const C = At[v[0]];
1780
- return C(i, v, o.localize, u);
1781
- }).join("");
1782
- }
1783
- function ra(e) {
1784
- const t = e.match(ea);
1785
- return t ? t[1].replace(ta, "'") : e;
1786
- }
1787
- function oa(e, t) {
1788
- const n = K(e, t == null ? void 0 : t.in), r = n.getFullYear(), o = n.getMonth(), a = ne(n, 0);
1789
- return a.setFullYear(r, o + 1, 0), a.setHours(0, 0, 0, 0), a.getDate();
1790
- }
1791
- function aa(e, t) {
1792
- return K(e, t == null ? void 0 : t.in).getMonth();
1793
- }
1794
- function sa(e, t) {
1795
- return K(e, t == null ? void 0 : t.in).getFullYear();
1796
- }
1797
- function ia(e, t) {
1798
- return +K(e) > +K(t);
1799
- }
1800
- function ca(e, t) {
1801
- return +K(e) < +K(t);
1802
- }
1803
- function ua(e, t, n) {
1804
- const [r, o] = Ae(
1805
- n == null ? void 0 : n.in,
1806
- e,
1807
- t
1808
- );
1809
- return r.getFullYear() === o.getFullYear() && r.getMonth() === o.getMonth();
1810
- }
1811
- function la(e, t, n) {
1812
- const [r, o] = Ae(
1813
- n == null ? void 0 : n.in,
1814
- e,
1815
- t
1816
- );
1817
- return r.getFullYear() === o.getFullYear();
1818
- }
1819
- function da(e, t, n) {
1820
- const r = K(e, n == null ? void 0 : n.in), o = r.getFullYear(), a = r.getDate(), s = ne(e, 0);
1821
- s.setFullYear(o, t, 15), s.setHours(0, 0, 0, 0);
1822
- const i = oa(s);
1823
- return r.setMonth(t, Math.min(a, i)), r;
1824
- }
1825
- function fa(e, t, n) {
1826
- const r = K(e, n == null ? void 0 : n.in);
1827
- return isNaN(+r) ? ne(e, NaN) : (r.setFullYear(t), r);
1828
- }
1829
- const Rt = 5, ha = 4;
1830
- function ma(e, t) {
1831
- const n = t.startOfMonth(e), r = n.getDay() > 0 ? n.getDay() : 7, o = t.addDays(e, -r + 1), a = t.addDays(o, Rt * 7 - 1);
1832
- return t.getMonth(e) === t.getMonth(a) ? Rt : ha;
1833
- }
1834
- function gn(e, t) {
1835
- const n = t.startOfMonth(e), r = n.getDay();
1836
- return r === 1 ? n : r === 0 ? t.addDays(n, -6) : t.addDays(n, -1 * (r - 1));
1837
- }
1838
- function ya(e, t) {
1839
- const n = gn(e, t), r = ma(e, t);
1840
- return t.addDays(n, r * 7 - 1);
1841
- }
1842
- const wn = {
1843
- ...Ee,
1844
- labels: {
1845
- labelDayButton: (e, t, n, r) => {
1846
- let o;
1847
- r && typeof r.format == "function" ? o = r.format.bind(r) : o = (s, i) => Re(s, i, { locale: Ee, ...n });
1848
- let a = o(e, "PPPP");
1849
- return t.today && (a = `Today, ${a}`), t.selected && (a = `${a}, selected`), a;
1850
- },
1851
- labelMonthDropdown: "Choose the Month",
1852
- labelNext: "Go to the Next Month",
1853
- labelPrevious: "Go to the Previous Month",
1854
- labelWeekNumber: (e) => `Week ${e}`,
1855
- labelYearDropdown: "Choose the Year",
1856
- labelGrid: (e, t, n) => {
1857
- let r;
1858
- return n && typeof n.format == "function" ? r = n.format.bind(n) : r = (o, a) => Re(o, a, { locale: Ee, ...t }), r(e, "LLLL yyyy");
1859
- },
1860
- labelGridcell: (e, t, n, r) => {
1861
- let o;
1862
- r && typeof r.format == "function" ? o = r.format.bind(r) : o = (s, i) => Re(s, i, { locale: Ee, ...n });
1863
- let a = o(e, "PPPP");
1864
- return t != null && t.today && (a = `Today, ${a}`), a;
1865
- },
1866
- labelNav: "Navigation bar",
1867
- labelWeekNumberHeader: "Week Number",
1868
- labelWeekday: (e, t, n) => {
1869
- let r;
1870
- return n && typeof n.format == "function" ? r = n.format.bind(n) : r = (o, a) => Re(o, a, { locale: Ee, ...t }), r(e, "cccc");
252
+ }, Cr = D(2, ge(Re, ke)), xr = J(wr), zr = {
253
+ "small-list": { fetchOnOpen: !0, searchable: !1, paginated: !1 },
254
+ "large-searchable-list": { fetchOnOpen: !0, searchable: !0, paginated: !1 },
255
+ "large-paginated-list": { fetchOnOpen: !1, searchable: !0, paginated: !0 }
256
+ }, Sr = ({
257
+ data: t,
258
+ handleChange: r,
259
+ path: n,
260
+ label: a,
261
+ required: y,
262
+ errors: h,
263
+ enabled: s,
264
+ visible: v = !0,
265
+ schema: d,
266
+ uischema: g
267
+ }) => {
268
+ var me;
269
+ const l = (d == null ? void 0 : d["x-search"]) ?? { service: "" }, x = l.service ?? "", p = l.mode ?? "large-paginated-list", o = zr[p], u = (o == null ? void 0 : o.fetchOnOpen) ?? !1, S = cr(x), $ = x ? S ? o ? null : `Invalid x-search.mode "${p}". Expected "small-list", "large-searchable-list", or "large-paginated-list".` : `Search service "${x}" is not registered.` : "Search not configured.", w = s !== !1, R = !h || h.length === 0, [k, V] = A(!1), [O, j] = A(""), [te, N] = A([]), [re, U] = A(!1), [I, B] = A(!1), [ne, M] = A(!1), [oe, W] = A(null), [le, q] = A(void 0), H = Q(void 0), Z = Q(null), i = Q(null), T = Q(null), F = Q(void 0);
270
+ X(() => {
271
+ if (!t) {
272
+ q(void 0), F.current = void 0;
273
+ return;
1871
274
  }
1872
- }
1873
- };
1874
- class fe {
1875
- /**
1876
- * Creates an instance of `DateLib`.
1877
- *
1878
- * @param options Configuration options for the date library.
1879
- * @param overrides Custom overrides for the date library functions.
1880
- */
1881
- constructor(t, n) {
1882
- this.today = () => {
1883
- var o;
1884
- if ((o = this.overrides) != null && o.today)
1885
- return this.overrides.today();
1886
- if (this.options.timeZone)
1887
- return ce.tz(this.options.timeZone);
1888
- const r = this.options.Date ?? Date;
1889
- return new r();
1890
- }, this.newDate = (r, o, a) => {
1891
- var s;
1892
- return (s = this.overrides) != null && s.newDate ? this.overrides.newDate(r, o, a) : this.options.timeZone ? new ce(r, o, a, this.options.timeZone) : new Date(r, o, a);
1893
- }, this.addDays = (r, o) => {
1894
- var a;
1895
- return (a = this.overrides) != null && a.addDays ? this.overrides.addDays(r, o) : an(r, o);
1896
- }, this.addMonths = (r, o) => {
1897
- var a;
1898
- return (a = this.overrides) != null && a.addMonths ? this.overrides.addMonths(r, o) : sn(r, o);
1899
- }, this.addWeeks = (r, o) => {
1900
- var a;
1901
- return (a = this.overrides) != null && a.addWeeks ? this.overrides.addWeeks(r, o) : Kr(r, o);
1902
- }, this.addYears = (r, o) => {
1903
- var a;
1904
- return (a = this.overrides) != null && a.addYears ? this.overrides.addYears(r, o) : Jr(r, o);
1905
- }, this.differenceInCalendarDays = (r, o) => {
1906
- var a;
1907
- return (a = this.overrides) != null && a.differenceInCalendarDays ? this.overrides.differenceInCalendarDays(r, o) : vt(r, o);
1908
- }, this.differenceInCalendarMonths = (r, o) => {
1909
- var a;
1910
- return (a = this.overrides) != null && a.differenceInCalendarMonths ? this.overrides.differenceInCalendarMonths(r, o) : ln(r, o);
1911
- }, this.eachMonthOfInterval = (r) => {
1912
- var o;
1913
- return (o = this.overrides) != null && o.eachMonthOfInterval ? this.overrides.eachMonthOfInterval(r) : ro(r);
1914
- }, this.eachYearOfInterval = (r) => {
1915
- var i;
1916
- const o = (i = this.overrides) != null && i.eachYearOfInterval ? this.overrides.eachYearOfInterval(r) : so(r), a = new Set(o.map((c) => this.getYear(c)));
1917
- if (a.size === o.length)
1918
- return o;
1919
- const s = [];
1920
- return a.forEach((c) => {
1921
- s.push(new Date(c, 0, 1));
1922
- }), s;
1923
- }, this.endOfBroadcastWeek = (r) => {
1924
- var o;
1925
- return (o = this.overrides) != null && o.endOfBroadcastWeek ? this.overrides.endOfBroadcastWeek(r) : ya(r, this);
1926
- }, this.endOfISOWeek = (r) => {
1927
- var o;
1928
- return (o = this.overrides) != null && o.endOfISOWeek ? this.overrides.endOfISOWeek(r) : io(r);
1929
- }, this.endOfMonth = (r) => {
1930
- var o;
1931
- return (o = this.overrides) != null && o.endOfMonth ? this.overrides.endOfMonth(r) : no(r);
1932
- }, this.endOfWeek = (r, o) => {
1933
- var a;
1934
- return (a = this.overrides) != null && a.endOfWeek ? this.overrides.endOfWeek(r, o) : hn(r, this.options);
1935
- }, this.endOfYear = (r) => {
1936
- var o;
1937
- return (o = this.overrides) != null && o.endOfYear ? this.overrides.endOfYear(r) : ao(r);
1938
- }, this.format = (r, o, a) => {
1939
- var i;
1940
- const s = (i = this.overrides) != null && i.format ? this.overrides.format(r, o, this.options) : Re(r, o, this.options);
1941
- return this.options.numerals && this.options.numerals !== "latn" ? this.replaceDigits(s) : s;
1942
- }, this.getISOWeek = (r) => {
1943
- var o;
1944
- return (o = this.overrides) != null && o.getISOWeek ? this.overrides.getISOWeek(r) : Dt(r);
1945
- }, this.getMonth = (r, o) => {
1946
- var a;
1947
- return (a = this.overrides) != null && a.getMonth ? this.overrides.getMonth(r, this.options) : aa(r, this.options);
1948
- }, this.getYear = (r, o) => {
1949
- var a;
1950
- return (a = this.overrides) != null && a.getYear ? this.overrides.getYear(r, this.options) : sa(r, this.options);
1951
- }, this.getWeek = (r, o) => {
1952
- var a;
1953
- return (a = this.overrides) != null && a.getWeek ? this.overrides.getWeek(r, this.options) : kt(r, this.options);
1954
- }, this.isAfter = (r, o) => {
1955
- var a;
1956
- return (a = this.overrides) != null && a.isAfter ? this.overrides.isAfter(r, o) : ia(r, o);
1957
- }, this.isBefore = (r, o) => {
1958
- var a;
1959
- return (a = this.overrides) != null && a.isBefore ? this.overrides.isBefore(r, o) : ca(r, o);
1960
- }, this.isDate = (r) => {
1961
- var o;
1962
- return (o = this.overrides) != null && o.isDate ? this.overrides.isDate(r) : un(r);
1963
- }, this.isSameDay = (r, o) => {
1964
- var a;
1965
- return (a = this.overrides) != null && a.isSameDay ? this.overrides.isSameDay(r, o) : eo(r, o);
1966
- }, this.isSameMonth = (r, o) => {
1967
- var a;
1968
- return (a = this.overrides) != null && a.isSameMonth ? this.overrides.isSameMonth(r, o) : ua(r, o);
1969
- }, this.isSameYear = (r, o) => {
1970
- var a;
1971
- return (a = this.overrides) != null && a.isSameYear ? this.overrides.isSameYear(r, o) : la(r, o);
1972
- }, this.max = (r) => {
1973
- var o;
1974
- return (o = this.overrides) != null && o.max ? this.overrides.max(r) : Zr(r);
1975
- }, this.min = (r) => {
1976
- var o;
1977
- return (o = this.overrides) != null && o.min ? this.overrides.min(r) : Lr(r);
1978
- }, this.setMonth = (r, o) => {
1979
- var a;
1980
- return (a = this.overrides) != null && a.setMonth ? this.overrides.setMonth(r, o) : da(r, o);
1981
- }, this.setYear = (r, o) => {
1982
- var a;
1983
- return (a = this.overrides) != null && a.setYear ? this.overrides.setYear(r, o) : fa(r, o);
1984
- }, this.startOfBroadcastWeek = (r, o) => {
1985
- var a;
1986
- return (a = this.overrides) != null && a.startOfBroadcastWeek ? this.overrides.startOfBroadcastWeek(r, this) : gn(r, this);
1987
- }, this.startOfDay = (r) => {
1988
- var o;
1989
- return (o = this.overrides) != null && o.startOfDay ? this.overrides.startOfDay(r) : Ue(r);
1990
- }, this.startOfISOWeek = (r) => {
1991
- var o;
1992
- return (o = this.overrides) != null && o.startOfISOWeek ? this.overrides.startOfISOWeek(r) : qe(r);
1993
- }, this.startOfMonth = (r) => {
1994
- var o;
1995
- return (o = this.overrides) != null && o.startOfMonth ? this.overrides.startOfMonth(r) : oo(r);
1996
- }, this.startOfWeek = (r, o) => {
1997
- var a;
1998
- return (a = this.overrides) != null && a.startOfWeek ? this.overrides.startOfWeek(r, this.options) : Be(r, this.options);
1999
- }, this.startOfYear = (r) => {
2000
- var o;
2001
- return (o = this.overrides) != null && o.startOfYear ? this.overrides.startOfYear(r) : fn(r);
2002
- }, this.options = { locale: wn, ...t }, this.overrides = n;
2003
- }
2004
- /**
2005
- * Generates a mapping of Arabic digits (0-9) to the target numbering system
2006
- * digits.
2007
- *
2008
- * @since 9.5.0
2009
- * @returns A record mapping Arabic digits to the target numerals.
2010
- */
2011
- getDigitMap() {
2012
- const { numerals: t = "latn" } = this.options, n = new Intl.NumberFormat("en-US", {
2013
- numberingSystem: t
2014
- }), r = {};
2015
- for (let o = 0; o < 10; o++)
2016
- r[o.toString()] = n.format(o);
2017
- return r;
2018
- }
2019
- /**
2020
- * Replaces Arabic digits in a string with the target numbering system digits.
2021
- *
2022
- * @since 9.5.0
2023
- * @param input The string containing Arabic digits.
2024
- * @returns The string with digits replaced.
2025
- */
2026
- replaceDigits(t) {
2027
- const n = this.getDigitMap();
2028
- return t.replace(/\d/g, (r) => n[r] || r);
2029
- }
2030
- /**
2031
- * Formats a number using the configured numbering system.
2032
- *
2033
- * @since 9.5.0
2034
- * @param value The number to format.
2035
- * @returns The formatted number as a string.
2036
- */
2037
- formatNumber(t) {
2038
- return this.replaceDigits(t.toString());
2039
- }
2040
- /**
2041
- * Returns the preferred ordering for month and year labels for the current
2042
- * locale.
2043
- */
2044
- getMonthYearOrder() {
2045
- var n;
2046
- const t = (n = this.options.locale) == null ? void 0 : n.code;
2047
- return t && fe.yearFirstLocales.has(t) ? "year-first" : "month-first";
2048
- }
2049
- /**
2050
- * Formats the month/year pair respecting locale conventions.
2051
- *
2052
- * @since 9.11.0
2053
- */
2054
- formatMonthYear(t) {
2055
- const { locale: n, timeZone: r, numerals: o } = this.options, a = n == null ? void 0 : n.code;
2056
- if (a && fe.yearFirstLocales.has(a))
275
+ if (F.current === t || (F.current = t, q({ id: t, name: t }), !(S != null && S.resolve))) return;
276
+ let m = !1;
277
+ return S.resolve(t).then((E) => {
278
+ !m && E && q(E);
279
+ }).catch(() => {
280
+ }), () => {
281
+ m = !0;
282
+ };
283
+ }, [t, S]);
284
+ const b = Te(
285
+ async (m, E = !1) => {
286
+ var ye;
287
+ if (!S) {
288
+ W("Search service not configured.");
289
+ return;
290
+ }
291
+ (ye = i.current) == null || ye.abort();
292
+ const se = new AbortController();
293
+ i.current = se, E ? M(!0) : (B(!0), M(!1), W(null));
2057
294
  try {
2058
- return new Intl.DateTimeFormat(a, {
2059
- month: "long",
2060
- year: "numeric",
2061
- timeZone: r,
2062
- numberingSystem: o
2063
- }).format(t);
295
+ const ae = await S.search({
296
+ query: m,
297
+ cursor: E ? H.current : void 0,
298
+ signal: se.signal
299
+ }), ve = ae.options ?? [];
300
+ N(E ? (Ae) => [...Ae, ...ve] : ve), H.current = ae.nextCursor, U(((o == null ? void 0 : o.paginated) ?? !1) && ae.nextCursor != null);
2064
301
  } catch {
302
+ if (se.signal.aborted) return;
303
+ W("Failed to load results. Please try again.");
304
+ } finally {
305
+ se.signal.aborted || (E ? M(!1) : B(!1));
2065
306
  }
2066
- const s = this.getMonthYearOrder() === "year-first" ? "y LLLL" : "LLLL y";
2067
- return this.format(t, s);
2068
- }
2069
- }
2070
- fe.yearFirstLocales = /* @__PURE__ */ new Set([
2071
- "eu",
2072
- "hu",
2073
- "ja",
2074
- "ja-Hira",
2075
- "ja-JP",
2076
- "ko",
2077
- "ko-KR",
2078
- "lt",
2079
- "lt-LT",
2080
- "lv",
2081
- "lv-LV",
2082
- "mn",
2083
- "mn-MN",
2084
- "zh",
2085
- "zh-CN",
2086
- "zh-HK",
2087
- "zh-TW"
2088
- ]);
2089
- const ke = new fe();
2090
- class bn {
2091
- constructor(t, n, r = ke) {
2092
- this.date = t, this.displayMonth = n, this.outside = !!(n && !r.isSameMonth(t, n)), this.dateLib = r, this.isoDate = r.format(t, "yyyy-MM-dd"), this.displayMonthId = r.format(n, "yyyy-MM"), this.dateMonthId = r.format(t, "yyyy-MM");
2093
- }
2094
- /**
2095
- * Checks if this day is equal to another `CalendarDay`, considering both the
2096
- * date and the displayed month.
2097
- *
2098
- * @param day The `CalendarDay` to compare with.
2099
- * @returns `true` if the days are equal, otherwise `false`.
2100
- */
2101
- isEqualTo(t) {
2102
- return this.dateLib.isSameDay(t.date, this.date) && this.dateLib.isSameMonth(t.displayMonth, this.displayMonth);
2103
- }
2104
- }
2105
- class ga {
2106
- constructor(t, n) {
2107
- this.date = t, this.weeks = n;
2108
- }
2109
- }
2110
- class wa {
2111
- constructor(t, n) {
2112
- this.days = n, this.weekNumber = t;
2113
- }
2114
- }
2115
- function ba(e) {
2116
- return p.createElement("span", { ...e });
2117
- }
2118
- function Ma(e) {
2119
- const { size: t = 24, orientation: n = "left", className: r, style: o } = e;
2120
- return p.createElement(
2121
- "svg",
2122
- { className: r, style: o, width: t, height: t, viewBox: "0 0 24 24" },
2123
- n === "up" && p.createElement("polygon", { points: "6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28" }),
2124
- n === "down" && p.createElement("polygon", { points: "6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72" }),
2125
- n === "left" && p.createElement("polygon", { points: "16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20" }),
2126
- n === "right" && p.createElement("polygon", { points: "8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20" })
2127
- );
2128
- }
2129
- function va(e) {
2130
- const { day: t, modifiers: n, ...r } = e;
2131
- return p.createElement("td", { ...r });
2132
- }
2133
- function Da(e) {
2134
- const { day: t, modifiers: n, ...r } = e, o = p.useRef(null);
2135
- return p.useEffect(() => {
2136
- var a;
2137
- n.focused && ((a = o.current) == null || a.focus());
2138
- }, [n.focused]), p.createElement("button", { ref: o, ...r });
2139
- }
2140
- var O;
2141
- (function(e) {
2142
- e.Root = "root", e.Chevron = "chevron", e.Day = "day", e.DayButton = "day_button", e.CaptionLabel = "caption_label", e.Dropdowns = "dropdowns", e.Dropdown = "dropdown", e.DropdownRoot = "dropdown_root", e.Footer = "footer", e.MonthGrid = "month_grid", e.MonthCaption = "month_caption", e.MonthsDropdown = "months_dropdown", e.Month = "month", e.Months = "months", e.Nav = "nav", e.NextMonthButton = "button_next", e.PreviousMonthButton = "button_previous", e.Week = "week", e.Weeks = "weeks", e.Weekday = "weekday", e.Weekdays = "weekdays", e.WeekNumber = "week_number", e.WeekNumberHeader = "week_number_header", e.YearsDropdown = "years_dropdown";
2143
- })(O || (O = {}));
2144
- var Z;
2145
- (function(e) {
2146
- e.disabled = "disabled", e.hidden = "hidden", e.outside = "outside", e.focused = "focused", e.today = "today";
2147
- })(Z || (Z = {}));
2148
- var ge;
2149
- (function(e) {
2150
- e.range_end = "range_end", e.range_middle = "range_middle", e.range_start = "range_start", e.selected = "selected";
2151
- })(ge || (ge = {}));
2152
- var de;
2153
- (function(e) {
2154
- e.weeks_before_enter = "weeks_before_enter", e.weeks_before_exit = "weeks_before_exit", e.weeks_after_enter = "weeks_after_enter", e.weeks_after_exit = "weeks_after_exit", e.caption_after_enter = "caption_after_enter", e.caption_after_exit = "caption_after_exit", e.caption_before_enter = "caption_before_enter", e.caption_before_exit = "caption_before_exit";
2155
- })(de || (de = {}));
2156
- const Mn = Kt(void 0);
2157
- function st() {
2158
- const e = Jt(Mn);
2159
- if (e === void 0)
2160
- throw new Error("useDayPicker() must be used within a custom component.");
2161
- return e;
2162
- }
2163
- function ka(e) {
2164
- const { options: t, className: n, ...r } = e, { classNames: o, components: a, styles: s } = st(), i = [o[O.Dropdown], n].join(" "), c = t == null ? void 0 : t.find(({ value: u }) => u === r.value);
2165
- return p.createElement(
2166
- "span",
2167
- { "data-disabled": r.disabled, className: o[O.DropdownRoot], style: s == null ? void 0 : s[O.DropdownRoot] },
2168
- p.createElement(a.Select, { className: i, ...r }, t == null ? void 0 : t.map(({ value: u, label: l, disabled: d }) => p.createElement(a.Option, { key: u, value: u, disabled: d }, l))),
2169
- p.createElement(
2170
- "span",
2171
- { className: o[O.CaptionLabel], style: s == null ? void 0 : s[O.CaptionLabel], "aria-hidden": !0 },
2172
- c == null ? void 0 : c.label,
2173
- p.createElement(a.Chevron, { orientation: "down", size: 18, className: o[O.Chevron], style: s == null ? void 0 : s[O.Chevron] })
2174
- )
2175
- );
2176
- }
2177
- function Oa(e) {
2178
- return p.createElement("div", { ...e });
2179
- }
2180
- function pa(e) {
2181
- return p.createElement("div", { ...e });
2182
- }
2183
- function Sa(e) {
2184
- const { calendarMonth: t, displayIndex: n, ...r } = e;
2185
- return p.createElement("div", { ...r }, e.children);
2186
- }
2187
- function Wa(e) {
2188
- const { calendarMonth: t, displayIndex: n, ...r } = e;
2189
- return p.createElement("div", { ...r });
2190
- }
2191
- function Ca(e) {
2192
- return p.createElement("table", { ...e });
2193
- }
2194
- function Na(e) {
2195
- return p.createElement("div", { ...e });
2196
- }
2197
- function Ta(e) {
2198
- const { components: t } = st();
2199
- return p.createElement(t.Dropdown, { ...e });
2200
- }
2201
- function xa(e) {
2202
- const { onPreviousClick: t, onNextClick: n, previousMonth: r, nextMonth: o, ...a } = e, { components: s, classNames: i, styles: c, labels: { labelPrevious: u, labelNext: l } } = st(), d = le((m) => {
2203
- o && (n == null || n(m));
2204
- }, [o, n]), h = le((m) => {
2205
- r && (t == null || t(m));
2206
- }, [r, t]);
2207
- return p.createElement(
2208
- "nav",
2209
- { ...a },
2210
- p.createElement(
2211
- s.PreviousMonthButton,
2212
- { type: "button", className: i[O.PreviousMonthButton], style: c == null ? void 0 : c[O.PreviousMonthButton], tabIndex: r ? void 0 : -1, "aria-disabled": r ? void 0 : !0, "aria-label": u(r), onClick: h },
2213
- p.createElement(s.Chevron, { disabled: r ? void 0 : !0, className: i[O.Chevron], style: c == null ? void 0 : c[O.Chevron], orientation: "left" })
2214
- ),
2215
- p.createElement(
2216
- s.NextMonthButton,
2217
- { type: "button", className: i[O.NextMonthButton], style: c == null ? void 0 : c[O.NextMonthButton], tabIndex: o ? void 0 : -1, "aria-disabled": o ? void 0 : !0, "aria-label": l(o), onClick: d },
2218
- p.createElement(s.Chevron, { disabled: o ? void 0 : !0, orientation: "right", className: i[O.Chevron], style: c == null ? void 0 : c[O.Chevron] })
2219
- )
2220
- );
2221
- }
2222
- function Ya(e) {
2223
- return p.createElement("button", { ...e });
2224
- }
2225
- function $a(e) {
2226
- return p.createElement("option", { ...e });
2227
- }
2228
- function Fa(e) {
2229
- return p.createElement("button", { ...e });
2230
- }
2231
- function Pa(e) {
2232
- const { rootRef: t, ...n } = e;
2233
- return p.createElement("div", { ...n, ref: t });
2234
- }
2235
- function _a(e) {
2236
- return p.createElement("select", { ...e });
2237
- }
2238
- function Ea(e) {
2239
- const { week: t, ...n } = e;
2240
- return p.createElement("tr", { ...n });
2241
- }
2242
- function Ia(e) {
2243
- return p.createElement("th", { ...e });
2244
- }
2245
- function Ba(e) {
2246
- return p.createElement(
2247
- "thead",
2248
- { "aria-hidden": !0 },
2249
- p.createElement("tr", { ...e })
2250
- );
2251
- }
2252
- function Aa(e) {
2253
- const { week: t, ...n } = e;
2254
- return p.createElement("th", { ...n });
2255
- }
2256
- function za(e) {
2257
- return p.createElement("th", { ...e });
2258
- }
2259
- function Ha(e) {
2260
- return p.createElement("tbody", { ...e });
2261
- }
2262
- function ja(e) {
2263
- const { components: t } = st();
2264
- return p.createElement(t.Dropdown, { ...e });
2265
- }
2266
- const Ra = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2267
- __proto__: null,
2268
- CaptionLabel: ba,
2269
- Chevron: Ma,
2270
- Day: va,
2271
- DayButton: Da,
2272
- Dropdown: ka,
2273
- DropdownNav: Oa,
2274
- Footer: pa,
2275
- Month: Sa,
2276
- MonthCaption: Wa,
2277
- MonthGrid: Ca,
2278
- Months: Na,
2279
- MonthsDropdown: Ta,
2280
- Nav: xa,
2281
- NextMonthButton: Ya,
2282
- Option: $a,
2283
- PreviousMonthButton: Fa,
2284
- Root: Pa,
2285
- Select: _a,
2286
- Week: Ea,
2287
- WeekNumber: Aa,
2288
- WeekNumberHeader: za,
2289
- Weekday: Ia,
2290
- Weekdays: Ba,
2291
- Weeks: Ha,
2292
- YearsDropdown: ja
2293
- }, Symbol.toStringTag, { value: "Module" }));
2294
- function pe(e, t, n = !1, r = ke) {
2295
- let { from: o, to: a } = e;
2296
- const { differenceInCalendarDays: s, isSameDay: i } = r;
2297
- return o && a ? (s(a, o) < 0 && ([o, a] = [a, o]), s(t, o) >= (n ? 1 : 0) && s(a, t) >= (n ? 1 : 0)) : !n && a ? i(a, t) : !n && o ? i(o, t) : !1;
2298
- }
2299
- function Ot(e) {
2300
- return !!(e && typeof e == "object" && "before" in e && "after" in e);
2301
- }
2302
- function it(e) {
2303
- return !!(e && typeof e == "object" && "from" in e);
2304
- }
2305
- function pt(e) {
2306
- return !!(e && typeof e == "object" && "after" in e);
2307
- }
2308
- function St(e) {
2309
- return !!(e && typeof e == "object" && "before" in e);
2310
- }
2311
- function vn(e) {
2312
- return !!(e && typeof e == "object" && "dayOfWeek" in e);
2313
- }
2314
- function Dn(e, t) {
2315
- return Array.isArray(e) && e.every(t.isDate);
2316
- }
2317
- function Se(e, t, n = ke) {
2318
- const r = Array.isArray(t) ? t : [t], { isSameDay: o, differenceInCalendarDays: a, isAfter: s } = n;
2319
- return r.some((i) => {
2320
- if (typeof i == "boolean")
2321
- return i;
2322
- if (n.isDate(i))
2323
- return o(e, i);
2324
- if (Dn(i, n))
2325
- return i.some((c) => o(e, c));
2326
- if (it(i))
2327
- return pe(i, e, !1, n);
2328
- if (vn(i))
2329
- return Array.isArray(i.dayOfWeek) ? i.dayOfWeek.includes(e.getDay()) : i.dayOfWeek === e.getDay();
2330
- if (Ot(i)) {
2331
- const c = a(i.before, e), u = a(i.after, e), l = c > 0, d = u < 0;
2332
- return s(i.before, i.after) ? d && l : l || d;
2333
- }
2334
- return pt(i) ? a(e, i.after) > 0 : St(i) ? a(i.before, e) > 0 : typeof i == "function" ? i(e) : !1;
2335
- });
2336
- }
2337
- function qa(e, t, n, r, o) {
2338
- const { disabled: a, hidden: s, modifiers: i, showOutsideDays: c, broadcastCalendar: u, today: l = o.today() } = t, { isSameDay: d, isSameMonth: h, startOfMonth: m, isBefore: y, endOfMonth: N, isAfter: x } = o, P = n && m(n), b = r && N(r), v = {
2339
- [Z.focused]: [],
2340
- [Z.outside]: [],
2341
- [Z.disabled]: [],
2342
- [Z.hidden]: [],
2343
- [Z.today]: []
2344
- }, C = {};
2345
- for (const S of e) {
2346
- const { date: f, displayMonth: I } = S, j = !!(I && !h(f, I)), q = !!(P && y(f, P)), _ = !!(b && x(f, b)), Y = !!(a && Se(f, a, o)), ee = !!(s && Se(f, s, o)) || q || _ || // Broadcast calendar will show outside days as default
2347
- !u && !c && j || u && c === !1 && j, re = d(f, l);
2348
- j && v.outside.push(S), Y && v.disabled.push(S), ee && v.hidden.push(S), re && v.today.push(S), i && Object.keys(i).forEach((W) => {
2349
- const D = i == null ? void 0 : i[W];
2350
- D && Se(f, D, o) && (C[W] ? C[W].push(S) : C[W] = [S]);
2351
- });
2352
- }
2353
- return (S) => {
2354
- const f = {
2355
- [Z.focused]: !1,
2356
- [Z.disabled]: !1,
2357
- [Z.hidden]: !1,
2358
- [Z.outside]: !1,
2359
- [Z.today]: !1
2360
- }, I = {};
2361
- for (const j in v) {
2362
- const q = v[j];
2363
- f[j] = q.some((_) => _ === S);
2364
- }
2365
- for (const j in C)
2366
- I[j] = C[j].some((q) => q === S);
2367
- return {
2368
- ...f,
2369
- // custom modifiers should override all the previous ones
2370
- ...I
2371
- };
2372
- };
2373
- }
2374
- function Ua(e, t, n = {}) {
2375
- return Object.entries(e).filter(([, o]) => o === !0).reduce((o, [a]) => (n[a] ? o.push(n[a]) : t[Z[a]] ? o.push(t[Z[a]]) : t[ge[a]] && o.push(t[ge[a]]), o), [t[O.Day]]);
2376
- }
2377
- function Ga(e) {
2378
- return {
2379
- ...Ra,
2380
- ...e
2381
- };
2382
- }
2383
- function Va(e) {
2384
- const t = {
2385
- "data-mode": e.mode ?? void 0,
2386
- "data-required": "required" in e ? e.required : void 0,
2387
- "data-multiple-months": e.numberOfMonths && e.numberOfMonths > 1 || void 0,
2388
- "data-week-numbers": e.showWeekNumber || void 0,
2389
- "data-broadcast-calendar": e.broadcastCalendar || void 0,
2390
- "data-nav-layout": e.navLayout || void 0
2391
- };
2392
- return Object.entries(e).forEach(([n, r]) => {
2393
- n.startsWith("data-") && (t[n] = r);
2394
- }), t;
2395
- }
2396
- function Qa() {
2397
- const e = {};
2398
- for (const t in O)
2399
- e[O[t]] = `rdp-${O[t]}`;
2400
- for (const t in Z)
2401
- e[Z[t]] = `rdp-${Z[t]}`;
2402
- for (const t in ge)
2403
- e[ge[t]] = `rdp-${ge[t]}`;
2404
- for (const t in de)
2405
- e[de[t]] = `rdp-${de[t]}`;
2406
- return e;
2407
- }
2408
- function Xa(e, t, n) {
2409
- return (n ?? new fe(t)).formatMonthYear(e);
2410
- }
2411
- function Ka(e, t, n) {
2412
- return (n ?? new fe(t)).format(e, "d");
2413
- }
2414
- function Ja(e, t = ke) {
2415
- return t.format(e, "LLLL");
2416
- }
2417
- function Za(e, t, n) {
2418
- return (n ?? new fe(t)).format(e, "cccccc");
2419
- }
2420
- function La(e, t = ke) {
2421
- return e < 10 ? t.formatNumber(`0${e.toLocaleString()}`) : t.formatNumber(`${e.toLocaleString()}`);
2422
- }
2423
- function es() {
2424
- return "";
2425
- }
2426
- function ts(e, t = ke) {
2427
- return t.format(e, "yyyy");
2428
- }
2429
- const ns = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2430
- __proto__: null,
2431
- formatCaption: Xa,
2432
- formatDay: Ka,
2433
- formatMonthDropdown: Ja,
2434
- formatWeekNumber: La,
2435
- formatWeekNumberHeader: es,
2436
- formatWeekdayName: Za,
2437
- formatYearDropdown: ts
2438
- }, Symbol.toStringTag, { value: "Module" }));
2439
- function rs(e) {
2440
- return {
2441
- ...ns,
2442
- ...e
2443
- };
2444
- }
2445
- function kn(e, t, n, r) {
2446
- let o = (r ?? new fe(n)).format(e, "PPPP");
2447
- return t.today && (o = `Today, ${o}`), t.selected && (o = `${o}, selected`), o;
2448
- }
2449
- function On(e, t, n) {
2450
- return (n ?? new fe(t)).formatMonthYear(e);
2451
- }
2452
- function pn(e, t, n, r) {
2453
- let o = (r ?? new fe(n)).format(e, "PPPP");
2454
- return t != null && t.today && (o = `Today, ${o}`), o;
2455
- }
2456
- function Sn(e) {
2457
- return "Choose the Month";
2458
- }
2459
- function Wn() {
2460
- return "";
2461
- }
2462
- const os = "Go to the Next Month";
2463
- function Cn(e, t) {
2464
- return os;
2465
- }
2466
- function Nn(e) {
2467
- return "Go to the Previous Month";
2468
- }
2469
- function Tn(e, t, n) {
2470
- return (n ?? new fe(t)).format(e, "cccc");
2471
- }
2472
- function xn(e, t) {
2473
- return `Week ${e}`;
2474
- }
2475
- function Yn(e) {
2476
- return "Week Number";
2477
- }
2478
- function $n(e) {
2479
- return "Choose the Year";
2480
- }
2481
- const as = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2482
- __proto__: null,
2483
- labelDayButton: kn,
2484
- labelGrid: On,
2485
- labelGridcell: pn,
2486
- labelMonthDropdown: Sn,
2487
- labelNav: Wn,
2488
- labelNext: Cn,
2489
- labelPrevious: Nn,
2490
- labelWeekNumber: xn,
2491
- labelWeekNumberHeader: Yn,
2492
- labelWeekday: Tn,
2493
- labelYearDropdown: $n
2494
- }, Symbol.toStringTag, { value: "Module" })), ye = (e, t, n) => t || (n ? typeof n == "function" ? n : (...r) => n : e);
2495
- function ss(e, t) {
2496
- var r;
2497
- const n = ((r = t.locale) == null ? void 0 : r.labels) ?? {};
2498
- return {
2499
- ...as,
2500
- ...e ?? {},
2501
- labelDayButton: ye(kn, e == null ? void 0 : e.labelDayButton, n.labelDayButton),
2502
- labelMonthDropdown: ye(Sn, e == null ? void 0 : e.labelMonthDropdown, n.labelMonthDropdown),
2503
- labelNext: ye(Cn, e == null ? void 0 : e.labelNext, n.labelNext),
2504
- labelPrevious: ye(Nn, e == null ? void 0 : e.labelPrevious, n.labelPrevious),
2505
- labelWeekNumber: ye(xn, e == null ? void 0 : e.labelWeekNumber, n.labelWeekNumber),
2506
- labelYearDropdown: ye($n, e == null ? void 0 : e.labelYearDropdown, n.labelYearDropdown),
2507
- labelGrid: ye(On, e == null ? void 0 : e.labelGrid, n.labelGrid),
2508
- labelGridcell: ye(pn, e == null ? void 0 : e.labelGridcell, n.labelGridcell),
2509
- labelNav: ye(Wn, e == null ? void 0 : e.labelNav, n.labelNav),
2510
- labelWeekNumberHeader: ye(Yn, e == null ? void 0 : e.labelWeekNumberHeader, n.labelWeekNumberHeader),
2511
- labelWeekday: ye(Tn, e == null ? void 0 : e.labelWeekday, n.labelWeekday)
2512
- };
2513
- }
2514
- function is(e, t, n, r, o) {
2515
- const { startOfMonth: a, startOfYear: s, endOfYear: i, eachMonthOfInterval: c, getMonth: u } = o;
2516
- return c({
2517
- start: s(e),
2518
- end: i(e)
2519
- }).map((h) => {
2520
- const m = r.formatMonthDropdown(h, o), y = u(h), N = t && h < a(t) || n && h > a(n) || !1;
2521
- return { value: y, label: m, disabled: N };
2522
- });
2523
- }
2524
- function cs(e, t = {}, n = {}) {
2525
- let r = { ...t == null ? void 0 : t[O.Day] };
2526
- return Object.entries(e).filter(([, o]) => o === !0).forEach(([o]) => {
2527
- r = {
2528
- ...r,
2529
- ...n == null ? void 0 : n[o]
2530
- };
2531
- }), r;
2532
- }
2533
- function us(e, t, n, r) {
2534
- const o = r ?? e.today(), a = n ? e.startOfBroadcastWeek(o, e) : t ? e.startOfISOWeek(o) : e.startOfWeek(o), s = [];
2535
- for (let i = 0; i < 7; i++) {
2536
- const c = e.addDays(a, i);
2537
- s.push(c);
2538
- }
2539
- return s;
2540
- }
2541
- function ls(e, t, n, r, o = !1) {
2542
- if (!e || !t)
2543
- return;
2544
- const { startOfYear: a, endOfYear: s, eachYearOfInterval: i, getYear: c } = r, u = a(e), l = s(t), d = i({ start: u, end: l });
2545
- return o && d.reverse(), d.map((h) => {
2546
- const m = n.formatYearDropdown(h, r);
2547
- return {
2548
- value: c(h),
2549
- label: m,
2550
- disabled: !1
2551
- };
2552
- });
2553
- }
2554
- function ds(e, t = {}) {
2555
- var i;
2556
- const { weekStartsOn: n, locale: r } = t, o = n ?? ((i = r == null ? void 0 : r.options) == null ? void 0 : i.weekStartsOn) ?? 0, a = (c) => {
2557
- const u = typeof c == "number" || typeof c == "string" ? new Date(c) : c;
2558
- return new ce(u.getFullYear(), u.getMonth(), u.getDate(), 12, 0, 0, e);
2559
- }, s = (c) => {
2560
- const u = a(c);
2561
- return new Date(u.getFullYear(), u.getMonth(), u.getDate(), 0, 0, 0, 0);
2562
- };
2563
- return {
2564
- today: () => a(ce.tz(e)),
2565
- newDate: (c, u, l) => new ce(c, u, l, 12, 0, 0, e),
2566
- startOfDay: (c) => a(c),
2567
- startOfWeek: (c, u) => {
2568
- const l = a(c), d = (u == null ? void 0 : u.weekStartsOn) ?? o, h = (l.getDay() - d + 7) % 7;
2569
- return l.setDate(l.getDate() - h), l;
2570
- },
2571
- startOfISOWeek: (c) => {
2572
- const u = a(c), l = (u.getDay() - 1 + 7) % 7;
2573
- return u.setDate(u.getDate() - l), u;
2574
- },
2575
- startOfMonth: (c) => {
2576
- const u = a(c);
2577
- return u.setDate(1), u;
2578
- },
2579
- startOfYear: (c) => {
2580
- const u = a(c);
2581
- return u.setMonth(0, 1), u;
2582
- },
2583
- endOfWeek: (c, u) => {
2584
- const l = a(c), m = ((((u == null ? void 0 : u.weekStartsOn) ?? o) + 6) % 7 - l.getDay() + 7) % 7;
2585
- return l.setDate(l.getDate() + m), l;
2586
- },
2587
- endOfISOWeek: (c) => {
2588
- const u = a(c), l = (7 - u.getDay()) % 7;
2589
- return u.setDate(u.getDate() + l), u;
2590
- },
2591
- endOfMonth: (c) => {
2592
- const u = a(c);
2593
- return u.setMonth(u.getMonth() + 1, 0), u;
2594
- },
2595
- endOfYear: (c) => {
2596
- const u = a(c);
2597
- return u.setMonth(11, 31), u;
2598
- },
2599
- eachMonthOfInterval: (c) => {
2600
- const u = a(c.start), l = a(c.end), d = [], h = new ce(u.getFullYear(), u.getMonth(), 1, 12, 0, 0, e), m = l.getFullYear() * 12 + l.getMonth();
2601
- for (; h.getFullYear() * 12 + h.getMonth() <= m; )
2602
- d.push(new ce(h, e)), h.setMonth(h.getMonth() + 1, 1);
2603
- return d;
2604
- },
2605
- // Normalize to noon once before arithmetic (avoid DST/midnight edge cases),
2606
- // mutate the same TZDate, and return it.
2607
- addDays: (c, u) => {
2608
- const l = a(c);
2609
- return l.setDate(l.getDate() + u), l;
2610
- },
2611
- addWeeks: (c, u) => {
2612
- const l = a(c);
2613
- return l.setDate(l.getDate() + u * 7), l;
2614
- },
2615
- addMonths: (c, u) => {
2616
- const l = a(c);
2617
- return l.setMonth(l.getMonth() + u), l;
2618
- },
2619
- addYears: (c, u) => {
2620
- const l = a(c);
2621
- return l.setFullYear(l.getFullYear() + u), l;
2622
307
  },
2623
- eachYearOfInterval: (c) => {
2624
- const u = a(c.start), l = a(c.end), d = [], h = new ce(u.getFullYear(), 0, 1, 12, 0, 0, e);
2625
- for (; h.getFullYear() <= l.getFullYear(); )
2626
- d.push(new ce(h, e)), h.setFullYear(h.getFullYear() + 1, 0, 1);
2627
- return d;
2628
- },
2629
- getWeek: (c, u) => {
2630
- var d;
2631
- const l = s(c);
2632
- return kt(l, {
2633
- weekStartsOn: (u == null ? void 0 : u.weekStartsOn) ?? o,
2634
- firstWeekContainsDate: (u == null ? void 0 : u.firstWeekContainsDate) ?? ((d = r == null ? void 0 : r.options) == null ? void 0 : d.firstWeekContainsDate) ?? 1
2635
- });
2636
- },
2637
- getISOWeek: (c) => {
2638
- const u = s(c);
2639
- return Dt(u);
2640
- },
2641
- differenceInCalendarDays: (c, u) => {
2642
- const l = s(c), d = s(u);
2643
- return vt(l, d);
2644
- },
2645
- differenceInCalendarMonths: (c, u) => {
2646
- const l = s(c), d = s(u);
2647
- return ln(l, d);
2648
- }
2649
- };
2650
- }
2651
- const Xe = (e) => e instanceof HTMLElement ? e : null, gt = (e) => [
2652
- ...e.querySelectorAll("[data-animated-month]") ?? []
2653
- ], fs = (e) => Xe(e.querySelector("[data-animated-month]")), wt = (e) => Xe(e.querySelector("[data-animated-caption]")), bt = (e) => Xe(e.querySelector("[data-animated-weeks]")), hs = (e) => Xe(e.querySelector("[data-animated-nav]")), ms = (e) => Xe(e.querySelector("[data-animated-weekdays]"));
2654
- function ys(e, t, { classNames: n, months: r, focused: o, dateLib: a }) {
2655
- const s = Ie(null), i = Ie(r), c = Ie(!1);
2656
- rr(() => {
2657
- const u = i.current;
2658
- if (i.current = r, !t || !e.current || // safety check because the ref can be set to anything by consumers
2659
- !(e.current instanceof HTMLElement) || // validation required for the animation to work as expected
2660
- r.length === 0 || u.length === 0 || r.length !== u.length)
2661
- return;
2662
- const l = a.isSameMonth(r[0].date, u[0].date), d = a.isAfter(r[0].date, u[0].date), h = d ? n[de.caption_after_enter] : n[de.caption_before_enter], m = d ? n[de.weeks_after_enter] : n[de.weeks_before_enter], y = s.current, N = e.current.cloneNode(!0);
2663
- if (N instanceof HTMLElement ? (gt(N).forEach((v) => {
2664
- if (!(v instanceof HTMLElement))
2665
- return;
2666
- const C = fs(v);
2667
- C && v.contains(C) && v.removeChild(C);
2668
- const S = wt(v);
2669
- S && S.classList.remove(h);
2670
- const f = bt(v);
2671
- f && f.classList.remove(m);
2672
- }), s.current = N) : s.current = null, c.current || l || // skip animation if a day is focused because it can cause issues to the animation and is better for a11y
2673
- o)
2674
- return;
2675
- const x = y instanceof HTMLElement ? gt(y) : [], P = gt(e.current);
2676
- if (P != null && P.every((b) => b instanceof HTMLElement) && (x != null && x.every((b) => b instanceof HTMLElement))) {
2677
- c.current = !0, e.current.style.isolation = "isolate";
2678
- const b = hs(e.current);
2679
- b && (b.style.zIndex = "1"), P.forEach((v, C) => {
2680
- const S = x[C];
2681
- if (!S)
2682
- return;
2683
- v.style.position = "relative", v.style.overflow = "hidden";
2684
- const f = wt(v);
2685
- f && f.classList.add(h);
2686
- const I = bt(v);
2687
- I && I.classList.add(m);
2688
- const j = () => {
2689
- c.current = !1, e.current && (e.current.style.isolation = ""), b && (b.style.zIndex = ""), f && f.classList.remove(h), I && I.classList.remove(m), v.style.position = "", v.style.overflow = "", v.contains(S) && v.removeChild(S);
2690
- };
2691
- S.style.pointerEvents = "none", S.style.position = "absolute", S.style.overflow = "hidden", S.setAttribute("aria-hidden", "true");
2692
- const q = ms(S);
2693
- q && (q.style.opacity = "0");
2694
- const _ = wt(S);
2695
- _ && (_.classList.add(d ? n[de.caption_before_exit] : n[de.caption_after_exit]), _.addEventListener("animationend", j));
2696
- const Y = bt(S);
2697
- Y && Y.classList.add(d ? n[de.weeks_before_exit] : n[de.weeks_after_exit]), v.insertBefore(S, v.firstChild);
2698
- });
2699
- }
2700
- });
2701
- }
2702
- function gs(e, t, n, r) {
2703
- const o = e[0], a = e[e.length - 1], { ISOWeek: s, fixedWeeks: i, broadcastCalendar: c } = n ?? {}, { addDays: u, differenceInCalendarDays: l, differenceInCalendarMonths: d, endOfBroadcastWeek: h, endOfISOWeek: m, endOfMonth: y, endOfWeek: N, isAfter: x, startOfBroadcastWeek: P, startOfISOWeek: b, startOfWeek: v } = r, C = c ? P(o, r) : s ? b(o) : v(o), S = c ? h(a) : s ? m(y(a)) : N(y(a)), f = t && (c ? h(t) : s ? m(t) : N(t)), I = f && x(S, f) ? f : S, j = l(I, C), q = d(a, o) + 1, _ = [];
2704
- for (let re = 0; re <= j; re++) {
2705
- const W = u(C, re);
2706
- _.push(W);
2707
- }
2708
- const ee = (c ? 35 : 42) * q;
2709
- if (i && _.length < ee) {
2710
- const re = ee - _.length;
2711
- for (let W = 0; W < re; W++) {
2712
- const D = u(_[_.length - 1], 1);
2713
- _.push(D);
2714
- }
2715
- }
2716
- return _;
2717
- }
2718
- function ws(e) {
2719
- const t = [];
2720
- return e.reduce((n, r) => {
2721
- const o = r.weeks.reduce((a, s) => a.concat(s.days.slice()), t.slice());
2722
- return n.concat(o.slice());
2723
- }, t.slice());
2724
- }
2725
- function bs(e, t, n, r) {
2726
- const { numberOfMonths: o = 1 } = n, a = [];
2727
- for (let s = 0; s < o; s++) {
2728
- const i = r.addMonths(e, s);
2729
- if (t && i > t)
2730
- break;
2731
- a.push(i);
2732
- }
2733
- return a;
2734
- }
2735
- function qt(e, t, n, r) {
2736
- const { month: o, defaultMonth: a, today: s = r.today(), numberOfMonths: i = 1 } = e;
2737
- let c = o || a || s;
2738
- const { differenceInCalendarMonths: u, addMonths: l, startOfMonth: d } = r;
2739
- if (n && u(n, c) < i - 1) {
2740
- const h = -1 * (i - 1);
2741
- c = l(n, h);
2742
- }
2743
- return t && u(c, t) < 0 && (c = t), d(c);
2744
- }
2745
- function Ms(e, t, n, r) {
2746
- const { addDays: o, endOfBroadcastWeek: a, endOfISOWeek: s, endOfMonth: i, endOfWeek: c, getISOWeek: u, getWeek: l, startOfBroadcastWeek: d, startOfISOWeek: h, startOfWeek: m } = r, y = e.reduce((N, x) => {
2747
- const P = n.broadcastCalendar ? d(x, r) : n.ISOWeek ? h(x) : m(x), b = n.broadcastCalendar ? a(x) : n.ISOWeek ? s(i(x)) : c(i(x)), v = t.filter((I) => I >= P && I <= b), C = n.broadcastCalendar ? 35 : 42;
2748
- if (n.fixedWeeks && v.length < C) {
2749
- const I = t.filter((j) => {
2750
- const q = C - v.length;
2751
- return j > b && j <= o(b, q);
2752
- });
2753
- v.push(...I);
2754
- }
2755
- const S = v.reduce((I, j) => {
2756
- const q = n.ISOWeek ? u(j) : l(j), _ = I.find((ee) => ee.weekNumber === q), Y = new bn(j, x, r);
2757
- return _ ? _.days.push(Y) : I.push(new wa(q, [Y])), I;
2758
- }, []), f = new ga(x, S);
2759
- return N.push(f), N;
2760
- }, []);
2761
- return n.reverseMonths ? y.reverse() : y;
2762
- }
2763
- function vs(e, t) {
2764
- let { startMonth: n, endMonth: r } = e;
2765
- const { startOfYear: o, startOfDay: a, startOfMonth: s, endOfMonth: i, addYears: c, endOfYear: u, today: l } = t, d = e.captionLayout === "dropdown" || e.captionLayout === "dropdown-years";
2766
- return n ? n = s(n) : !n && d && (n = o(c(e.today ?? l(), -100))), r ? r = i(r) : !r && d && (r = u(e.today ?? l())), [
2767
- n && a(n),
2768
- r && a(r)
2769
- ];
2770
- }
2771
- function Ds(e, t, n, r) {
2772
- if (n.disableNavigation)
2773
- return;
2774
- const { pagedNavigation: o, numberOfMonths: a = 1 } = n, { startOfMonth: s, addMonths: i, differenceInCalendarMonths: c } = r, u = o ? a : 1, l = s(e);
2775
- if (!t)
2776
- return i(l, u);
2777
- if (!(c(t, e) < a))
2778
- return i(l, u);
2779
- }
2780
- function ks(e, t, n, r) {
2781
- if (n.disableNavigation)
2782
- return;
2783
- const { pagedNavigation: o, numberOfMonths: a } = n, { startOfMonth: s, addMonths: i, differenceInCalendarMonths: c } = r, u = o ? a ?? 1 : 1, l = s(e);
2784
- if (!t)
2785
- return i(l, -u);
2786
- if (!(c(l, t) <= 0))
2787
- return i(l, -u);
2788
- }
2789
- function Os(e) {
2790
- const t = [];
2791
- return e.reduce((n, r) => n.concat(r.weeks.slice()), t.slice());
2792
- }
2793
- function ct(e, t) {
2794
- const [n, r] = Ne(e);
2795
- return [t === void 0 ? n : t, r];
2796
- }
2797
- function ps(e, t) {
2798
- var C;
2799
- const [n, r] = vs(e, t), { startOfMonth: o, endOfMonth: a } = t, s = qt(e, n, r, t), [i, c] = ct(
2800
- s,
2801
- // initialMonth is always computed from props.month if provided
2802
- e.month ? s : void 0
308
+ [S, o == null ? void 0 : o.paginated]
2803
309
  );
2804
- We(() => {
2805
- const S = qt(e, n, r, t);
2806
- c(S);
2807
- }, [e.timeZone]);
2808
- const { months: u, weeks: l, days: d, previousMonth: h, nextMonth: m } = et(() => {
2809
- const S = bs(i, r, { numberOfMonths: e.numberOfMonths }, t), f = gs(S, e.endMonth ? a(e.endMonth) : void 0, {
2810
- ISOWeek: e.ISOWeek,
2811
- fixedWeeks: e.fixedWeeks,
2812
- broadcastCalendar: e.broadcastCalendar
2813
- }, t), I = Ms(S, f, {
2814
- broadcastCalendar: e.broadcastCalendar,
2815
- fixedWeeks: e.fixedWeeks,
2816
- ISOWeek: e.ISOWeek,
2817
- reverseMonths: e.reverseMonths
2818
- }, t), j = Os(I), q = ws(I), _ = ks(i, n, e, t), Y = Ds(i, r, e, t);
2819
- return {
2820
- months: I,
2821
- weeks: j,
2822
- days: q,
2823
- previousMonth: _,
2824
- nextMonth: Y
310
+ if (X(() => {
311
+ if (!k) return;
312
+ const m = (E) => {
313
+ T.current && !T.current.contains(E.target) && V(!1);
2825
314
  };
2826
- }, [
2827
- t,
2828
- i.getTime(),
2829
- r == null ? void 0 : r.getTime(),
2830
- n == null ? void 0 : n.getTime(),
2831
- e.disableNavigation,
2832
- e.broadcastCalendar,
2833
- (C = e.endMonth) == null ? void 0 : C.getTime(),
2834
- e.fixedWeeks,
2835
- e.ISOWeek,
2836
- e.numberOfMonths,
2837
- e.pagedNavigation,
2838
- e.reverseMonths
2839
- ]), { disableNavigation: y, onMonthChange: N } = e, x = (S) => l.some((f) => f.days.some((I) => I.isEqualTo(S))), P = (S) => {
2840
- if (y)
315
+ return document.addEventListener("mousedown", m), () => document.removeEventListener("mousedown", m);
316
+ }, [k]), X(() => {
317
+ var m;
318
+ k || ((m = i.current) == null || m.abort(), j(""), N([]), U(!1), W(null), B(!1), M(!1), H.current = void 0);
319
+ }, [k]), X(() => {
320
+ if (!k) return;
321
+ if (!O && !u) {
322
+ N([]), U(!1), W(null), H.current = void 0;
2841
323
  return;
2842
- let f = o(S);
2843
- n && f < o(n) && (f = o(n)), r && f > o(r) && (f = o(r)), c(f), N == null || N(f);
2844
- };
2845
- return {
2846
- months: u,
2847
- weeks: l,
2848
- days: d,
2849
- navStart: n,
2850
- navEnd: r,
2851
- previousMonth: h,
2852
- nextMonth: m,
2853
- goToMonth: P,
2854
- goToDay: (S) => {
2855
- x(S) || P(S.date);
2856
- }
2857
- };
2858
- }
2859
- var ve;
2860
- (function(e) {
2861
- e[e.Today = 0] = "Today", e[e.Selected = 1] = "Selected", e[e.LastFocused = 2] = "LastFocused", e[e.FocusedModifier = 3] = "FocusedModifier";
2862
- })(ve || (ve = {}));
2863
- function Ut(e) {
2864
- return !e[Z.disabled] && !e[Z.hidden] && !e[Z.outside];
2865
- }
2866
- function Ss(e, t, n, r) {
2867
- let o, a = -1;
2868
- for (const s of e) {
2869
- const i = t(s);
2870
- Ut(i) && (i[Z.focused] && a < ve.FocusedModifier ? (o = s, a = ve.FocusedModifier) : r != null && r.isEqualTo(s) && a < ve.LastFocused ? (o = s, a = ve.LastFocused) : n(s.date) && a < ve.Selected ? (o = s, a = ve.Selected) : i[Z.today] && a < ve.Today && (o = s, a = ve.Today));
2871
- }
2872
- return o || (o = e.find((s) => Ut(t(s)))), o;
2873
- }
2874
- function Ws(e, t, n, r, o, a, s) {
2875
- const { ISOWeek: i, broadcastCalendar: c } = a, { addDays: u, addMonths: l, addWeeks: d, addYears: h, endOfBroadcastWeek: m, endOfISOWeek: y, endOfWeek: N, max: x, min: P, startOfBroadcastWeek: b, startOfISOWeek: v, startOfWeek: C } = s;
2876
- let f = {
2877
- day: u,
2878
- week: d,
2879
- month: l,
2880
- year: h,
2881
- startOfWeek: (I) => c ? b(I, s) : i ? v(I) : C(I),
2882
- endOfWeek: (I) => c ? m(I) : i ? y(I) : N(I)
2883
- }[e](n, t === "after" ? 1 : -1);
2884
- return t === "before" && r ? f = x([r, f]) : t === "after" && o && (f = P([o, f])), f;
2885
- }
2886
- function Fn(e, t, n, r, o, a, s, i = 0) {
2887
- if (i > 365)
2888
- return;
2889
- const c = Ws(e, t, n.date, r, o, a, s), u = !!(a.disabled && Se(c, a.disabled, s)), l = !!(a.hidden && Se(c, a.hidden, s)), d = c, h = new bn(c, d, s);
2890
- return !u && !l ? h : Fn(e, t, h, r, o, a, s, i + 1);
2891
- }
2892
- function Cs(e, t, n, r, o) {
2893
- const { autoFocus: a } = e, [s, i] = Ne(), c = Ss(t.days, n, r || (() => !1), s), [u, l] = Ne(a ? c : void 0);
2894
- return {
2895
- isFocusTarget: (N) => !!(c != null && c.isEqualTo(N)),
2896
- setFocused: l,
2897
- focused: u,
2898
- blur: () => {
2899
- i(u), l(void 0);
2900
- },
2901
- moveFocus: (N, x) => {
2902
- if (!u)
2903
- return;
2904
- const P = Fn(N, x, u, t.navStart, t.navEnd, e, o);
2905
- P && (e.disableNavigation && !t.days.some((v) => v.isEqualTo(P)) || (t.goToDay(P), l(P)));
2906
- }
2907
- };
2908
- }
2909
- function Ns(e, t) {
2910
- const { selected: n, required: r, onSelect: o } = e, [a, s] = ct(n, o ? n : void 0), i = o ? n : a, { isSameDay: c } = t, u = (m) => (i == null ? void 0 : i.some((y) => c(y, m))) ?? !1, { min: l, max: d } = e;
2911
- return {
2912
- selected: i,
2913
- select: (m, y, N) => {
2914
- let x = [...i ?? []];
2915
- if (u(m)) {
2916
- if ((i == null ? void 0 : i.length) === l || r && (i == null ? void 0 : i.length) === 1)
2917
- return;
2918
- x = i == null ? void 0 : i.filter((P) => !c(P, m));
2919
- } else
2920
- (i == null ? void 0 : i.length) === d ? x = [m] : x = [...x, m];
2921
- return o || s(x), o == null || o(x, m, y, N), x;
2922
- },
2923
- isSelected: u
2924
- };
2925
- }
2926
- function Ts(e, t, n = 0, r = 0, o = !1, a = ke) {
2927
- const { from: s, to: i } = t || {}, { isSameDay: c, isAfter: u, isBefore: l } = a;
2928
- let d;
2929
- if (!s && !i)
2930
- d = { from: e, to: n > 0 ? void 0 : e };
2931
- else if (s && !i)
2932
- c(s, e) ? n === 0 ? d = { from: s, to: e } : o ? d = { from: s, to: void 0 } : d = void 0 : l(e, s) ? d = { from: e, to: s } : d = { from: s, to: e };
2933
- else if (s && i)
2934
- if (c(s, e) && c(i, e))
2935
- o ? d = { from: s, to: i } : d = void 0;
2936
- else if (c(s, e))
2937
- d = { from: s, to: n > 0 ? void 0 : e };
2938
- else if (c(i, e))
2939
- d = { from: e, to: n > 0 ? void 0 : e };
2940
- else if (l(e, s))
2941
- d = { from: e, to: i };
2942
- else if (u(e, s))
2943
- d = { from: s, to: e };
2944
- else if (u(e, i))
2945
- d = { from: s, to: e };
2946
- else
2947
- throw new Error("Invalid range");
2948
- if (d != null && d.from && (d != null && d.to)) {
2949
- const h = a.differenceInCalendarDays(d.to, d.from);
2950
- r > 0 && h > r ? d = { from: e, to: void 0 } : n > 1 && h < n && (d = { from: e, to: void 0 });
2951
- }
2952
- return d;
2953
- }
2954
- function xs(e, t, n = ke) {
2955
- const r = Array.isArray(t) ? t : [t];
2956
- let o = e.from;
2957
- const a = n.differenceInCalendarDays(e.to, e.from), s = Math.min(a, 6);
2958
- for (let i = 0; i <= s; i++) {
2959
- if (r.includes(o.getDay()))
2960
- return !0;
2961
- o = n.addDays(o, 1);
2962
- }
2963
- return !1;
2964
- }
2965
- function Gt(e, t, n = ke) {
2966
- return pe(e, t.from, !1, n) || pe(e, t.to, !1, n) || pe(t, e.from, !1, n) || pe(t, e.to, !1, n);
2967
- }
2968
- function Ys(e, t, n = ke) {
2969
- const r = Array.isArray(t) ? t : [t];
2970
- if (r.filter((i) => typeof i != "function").some((i) => typeof i == "boolean" ? i : n.isDate(i) ? pe(e, i, !1, n) : Dn(i, n) ? i.some((c) => pe(e, c, !1, n)) : it(i) ? i.from && i.to ? Gt(e, { from: i.from, to: i.to }, n) : !1 : vn(i) ? xs(e, i.dayOfWeek, n) : Ot(i) ? n.isAfter(i.before, i.after) ? Gt(e, {
2971
- from: n.addDays(i.after, 1),
2972
- to: n.addDays(i.before, -1)
2973
- }, n) : Se(e.from, i, n) || Se(e.to, i, n) : pt(i) || St(i) ? Se(e.from, i, n) || Se(e.to, i, n) : !1))
2974
- return !0;
2975
- const s = r.filter((i) => typeof i == "function");
2976
- if (s.length) {
2977
- let i = e.from;
2978
- const c = n.differenceInCalendarDays(e.to, e.from);
2979
- for (let u = 0; u <= c; u++) {
2980
- if (s.some((l) => l(i)))
2981
- return !0;
2982
- i = n.addDays(i, 1);
2983
324
  }
2984
- }
2985
- return !1;
2986
- }
2987
- function $s(e, t) {
2988
- const { disabled: n, excludeDisabled: r, resetOnSelect: o, selected: a, required: s, onSelect: i } = e, [c, u] = ct(a, i ? a : void 0), l = i ? a : c;
2989
- return {
2990
- selected: l,
2991
- select: (m, y, N) => {
2992
- const { min: x, max: P } = e;
2993
- let b;
2994
- if (m) {
2995
- const v = l == null ? void 0 : l.from, C = l == null ? void 0 : l.to, S = !!v && !!C, f = !!v && !!C && t.isSameDay(v, C) && t.isSameDay(m, v);
2996
- o && (S || !(l != null && l.from)) ? !s && f ? b = void 0 : b = { from: m, to: void 0 } : b = Ts(m, l, x, P, s, t);
2997
- }
2998
- return r && n && (b != null && b.from) && b.to && Ys({ from: b.from, to: b.to }, n, t) && (b.from = m, b.to = void 0), i || u(b), i == null || i(b, m, y, N), b;
2999
- },
3000
- isSelected: (m) => l && pe(l, m, !1, t)
3001
- };
3002
- }
3003
- function Fs(e, t) {
3004
- const { selected: n, required: r, onSelect: o } = e, [a, s] = ct(n, o ? n : void 0), i = o ? n : a, { isSameDay: c } = t;
3005
- return {
3006
- selected: i,
3007
- select: (d, h, m) => {
3008
- let y = d;
3009
- return !r && i && i && c(d, i) && (y = void 0), o || s(y), o == null || o(y, d, h, m), y;
3010
- },
3011
- isSelected: (d) => i ? c(i, d) : !1
3012
- };
3013
- }
3014
- function Ps(e, t) {
3015
- const n = Fs(e, t), r = Ns(e, t), o = $s(e, t);
3016
- switch (e.mode) {
3017
- case "single":
3018
- return n;
3019
- case "multiple":
3020
- return r;
3021
- case "range":
3022
- return o;
3023
- default:
3024
- return;
3025
- }
3026
- }
3027
- function me(e, t) {
3028
- return e instanceof ce && e.timeZone === t ? e : new ce(e, t);
3029
- }
3030
- function _e(e, t, n) {
3031
- return me(e, t);
3032
- }
3033
- function Vt(e, t, n) {
3034
- return typeof e == "boolean" || typeof e == "function" ? e : e instanceof Date ? _e(e, t) : Array.isArray(e) ? e.map((r) => r instanceof Date ? _e(r, t) : r) : it(e) ? {
3035
- ...e,
3036
- from: e.from ? me(e.from, t) : e.from,
3037
- to: e.to ? me(e.to, t) : e.to
3038
- } : Ot(e) ? {
3039
- before: _e(e.before, t),
3040
- after: _e(e.after, t)
3041
- } : pt(e) ? {
3042
- after: _e(e.after, t)
3043
- } : St(e) ? {
3044
- before: _e(e.before, t)
3045
- } : e;
3046
- }
3047
- function Mt(e, t, n) {
3048
- return e && (Array.isArray(e) ? e.map((r) => Vt(r, t)) : Vt(e, t));
3049
- }
3050
- function _s(e) {
3051
- var Yt;
3052
- let t = e;
3053
- const n = t.timeZone;
3054
- if (n && (t = {
3055
- ...e,
3056
- timeZone: n
3057
- }, t.today && (t.today = me(t.today, n)), t.month && (t.month = me(t.month, n)), t.defaultMonth && (t.defaultMonth = me(t.defaultMonth, n)), t.startMonth && (t.startMonth = me(t.startMonth, n)), t.endMonth && (t.endMonth = me(t.endMonth, n)), t.mode === "single" && t.selected ? t.selected = me(t.selected, n) : t.mode === "multiple" && t.selected ? t.selected = (Yt = t.selected) == null ? void 0 : Yt.map((A) => me(A, n)) : t.mode === "range" && t.selected && (t.selected = {
3058
- from: t.selected.from ? me(t.selected.from, n) : t.selected.from,
3059
- to: t.selected.to ? me(t.selected.to, n) : t.selected.to
3060
- }), t.disabled !== void 0 && (t.disabled = Mt(t.disabled, n)), t.hidden !== void 0 && (t.hidden = Mt(t.hidden, n)), t.modifiers)) {
3061
- const A = {};
3062
- Object.keys(t.modifiers).forEach((U) => {
3063
- var z;
3064
- A[U] = Mt((z = t.modifiers) == null ? void 0 : z[U], n);
3065
- }), t.modifiers = A;
3066
- }
3067
- const { components: r, formatters: o, labels: a, dateLib: s, locale: i, classNames: c } = et(() => {
3068
- const A = { ...wn, ...t.locale }, U = t.broadcastCalendar ? 1 : t.weekStartsOn, z = t.noonSafe && t.timeZone ? ds(t.timeZone, {
3069
- weekStartsOn: U,
3070
- locale: A
3071
- }) : void 0, L = t.dateLib && z ? { ...z, ...t.dateLib } : t.dateLib ?? z, Q = new fe({
3072
- locale: A,
3073
- weekStartsOn: U,
3074
- firstWeekContainsDate: t.firstWeekContainsDate,
3075
- useAdditionalWeekYearTokens: t.useAdditionalWeekYearTokens,
3076
- useAdditionalDayOfYearTokens: t.useAdditionalDayOfYearTokens,
3077
- timeZone: t.timeZone,
3078
- numerals: t.numerals
3079
- }, L);
3080
- return {
3081
- dateLib: Q,
3082
- components: Ga(t.components),
3083
- formatters: rs(t.formatters),
3084
- labels: ss(t.labels, Q.options),
3085
- locale: A,
3086
- classNames: { ...Qa(), ...t.classNames }
325
+ Z.current && clearTimeout(Z.current);
326
+ const m = O ? 300 : 0;
327
+ return Z.current = setTimeout(() => {
328
+ N([]), U(!1), H.current = void 0, b(O);
329
+ }, m), () => {
330
+ Z.current && clearTimeout(Z.current);
3087
331
  };
3088
- }, [
3089
- t.locale,
3090
- t.broadcastCalendar,
3091
- t.weekStartsOn,
3092
- t.firstWeekContainsDate,
3093
- t.useAdditionalWeekYearTokens,
3094
- t.useAdditionalDayOfYearTokens,
3095
- t.timeZone,
3096
- t.numerals,
3097
- t.dateLib,
3098
- t.noonSafe,
3099
- t.components,
3100
- t.formatters,
3101
- t.labels,
3102
- t.classNames
3103
- ]);
3104
- t.today || (t = { ...t, today: s.today() });
3105
- const { captionLayout: u, mode: l, navLayout: d, numberOfMonths: h = 1, onDayBlur: m, onDayClick: y, onDayFocus: N, onDayKeyDown: x, onDayMouseEnter: P, onDayMouseLeave: b, onNextClick: v, onPrevClick: C, showWeekNumber: S, styles: f } = t, { formatCaption: I, formatDay: j, formatMonthDropdown: q, formatWeekNumber: _, formatWeekNumberHeader: Y, formatWeekdayName: ee, formatYearDropdown: re } = o, W = ps(t, s), { days: D, months: w, navStart: T, navEnd: k, previousMonth: $, nextMonth: F, goToMonth: M } = W, B = qa(D, t, T, k, s), { isSelected: G, select: E, selected: J } = Ps(t, s) ?? {}, { blur: se, focused: ae, isFocusTarget: ue, moveFocus: we, setFocused: oe } = Cs(t, W, B, G ?? (() => !1), s), { labelDayButton: be, labelGridcell: Te, labelGrid: Fe, labelMonthDropdown: Pn, labelNav: Ct, labelPrevious: _n, labelNext: En, labelWeekday: In, labelWeekNumber: Bn, labelWeekNumberHeader: An, labelYearDropdown: zn } = a, Hn = et(() => us(s, t.ISOWeek, t.broadcastCalendar, t.today), [s, t.ISOWeek, t.broadcastCalendar, t.today]), Nt = l !== void 0 || y !== void 0, ut = le(() => {
3106
- $ && (M($), C == null || C($));
3107
- }, [$, M, C]), lt = le(() => {
3108
- F && (M(F), v == null || v(F));
3109
- }, [M, F, v]), jn = le((A, U) => (z) => {
3110
- z.preventDefault(), z.stopPropagation(), oe(A), !U.disabled && (E == null || E(A.date, U, z), y == null || y(A.date, U, z));
3111
- }, [E, y, oe]), Rn = le((A, U) => (z) => {
3112
- oe(A), N == null || N(A.date, U, z);
3113
- }, [N, oe]), qn = le((A, U) => (z) => {
3114
- se(), m == null || m(A.date, U, z);
3115
- }, [se, m]), Un = le((A, U) => (z) => {
3116
- const L = {
3117
- ArrowLeft: [
3118
- z.shiftKey ? "month" : "day",
3119
- t.dir === "rtl" ? "after" : "before"
3120
- ],
3121
- ArrowRight: [
3122
- z.shiftKey ? "month" : "day",
3123
- t.dir === "rtl" ? "before" : "after"
3124
- ],
3125
- ArrowDown: [z.shiftKey ? "year" : "week", "after"],
3126
- ArrowUp: [z.shiftKey ? "year" : "week", "before"],
3127
- PageUp: [z.shiftKey ? "year" : "month", "before"],
3128
- PageDown: [z.shiftKey ? "year" : "month", "after"],
3129
- Home: ["startOfWeek", "before"],
3130
- End: ["endOfWeek", "after"]
3131
- };
3132
- if (L[z.key]) {
3133
- z.preventDefault(), z.stopPropagation();
3134
- const [Q, Me] = L[z.key];
3135
- we(Q, Me);
3136
- }
3137
- x == null || x(A.date, U, z);
3138
- }, [we, x, t.dir]), Gn = le((A, U) => (z) => {
3139
- P == null || P(A.date, U, z);
3140
- }, [P]), Vn = le((A, U) => (z) => {
3141
- b == null || b(A.date, U, z);
3142
- }, [b]), Qn = le((A, U) => (z) => {
3143
- const L = Number(z.target.value), Q = s.setMonth(s.startOfMonth(A), L);
3144
- M(s.addMonths(Q, -U));
3145
- }, [s, M]), Xn = le((A, U) => (z) => {
3146
- const L = Number(z.target.value), Q = s.setYear(s.startOfMonth(A), L);
3147
- M(s.addMonths(Q, -U));
3148
- }, [s, M]), { className: Kn, style: Jn } = et(() => ({
3149
- className: [c[O.Root], t.className].filter(Boolean).join(" "),
3150
- style: { ...f == null ? void 0 : f[O.Root], ...t.style }
3151
- }), [c, t.className, t.style, f]), Zn = Va(t), Tt = (A) => {
3152
- const U = f == null ? void 0 : f[O.Dropdown], z = f == null ? void 0 : f[A];
3153
- if (!(!U && !z))
3154
- return {
3155
- ...U,
3156
- ...z
3157
- };
3158
- }, xt = Ie(null);
3159
- ys(xt, !!t.animate, {
3160
- classNames: c,
3161
- months: w,
3162
- focused: ae,
3163
- dateLib: s
3164
- });
3165
- const Ln = {
3166
- dayPickerProps: t,
3167
- selected: J,
3168
- select: E,
3169
- isSelected: G,
3170
- months: w,
3171
- nextMonth: F,
3172
- previousMonth: $,
3173
- goToMonth: M,
3174
- getModifiers: B,
3175
- components: r,
3176
- classNames: c,
3177
- styles: f,
3178
- labels: a,
3179
- formatters: o
3180
- };
3181
- return p.createElement(
3182
- Mn.Provider,
3183
- { value: Ln },
3184
- p.createElement(
3185
- r.Root,
3186
- { rootRef: t.animate ? xt : void 0, className: Kn, style: Jn, dir: t.dir, id: t.id, lang: t.lang ?? i.code, nonce: t.nonce, title: t.title, role: t.role, "aria-label": t["aria-label"], "aria-labelledby": t["aria-labelledby"], ...Zn },
3187
- p.createElement(
3188
- r.Months,
3189
- { className: c[O.Months], style: f == null ? void 0 : f[O.Months] },
3190
- !t.hideNavigation && !d && p.createElement(r.Nav, { "data-animated-nav": t.animate ? "true" : void 0, className: c[O.Nav], style: f == null ? void 0 : f[O.Nav], "aria-label": Ct(), onPreviousClick: ut, onNextClick: lt, previousMonth: $, nextMonth: F }),
3191
- w.map((A, U) => {
3192
- const z = t.reverseMonths ? w.length - 1 - U : U;
3193
- return p.createElement(
3194
- r.Month,
3195
- {
3196
- "data-animated-month": t.animate ? "true" : void 0,
3197
- className: c[O.Month],
3198
- style: f == null ? void 0 : f[O.Month],
3199
- // biome-ignore lint/suspicious/noArrayIndexKey: breaks animation
3200
- key: U,
3201
- displayIndex: U,
3202
- calendarMonth: A
3203
- },
3204
- d === "around" && !t.hideNavigation && U === 0 && p.createElement(
3205
- r.PreviousMonthButton,
3206
- { type: "button", className: c[O.PreviousMonthButton], style: f == null ? void 0 : f[O.PreviousMonthButton], tabIndex: $ ? void 0 : -1, "aria-disabled": $ ? void 0 : !0, "aria-label": _n($), onClick: ut, "data-animated-button": t.animate ? "true" : void 0 },
3207
- p.createElement(r.Chevron, { disabled: $ ? void 0 : !0, className: c[O.Chevron], style: f == null ? void 0 : f[O.Chevron], orientation: t.dir === "rtl" ? "right" : "left" })
3208
- ),
3209
- p.createElement(r.MonthCaption, { "data-animated-caption": t.animate ? "true" : void 0, className: c[O.MonthCaption], style: f == null ? void 0 : f[O.MonthCaption], calendarMonth: A, displayIndex: U }, u != null && u.startsWith("dropdown") ? p.createElement(
3210
- r.DropdownNav,
3211
- { className: c[O.Dropdowns], style: f == null ? void 0 : f[O.Dropdowns] },
3212
- (() => {
3213
- const L = u === "dropdown" || u === "dropdown-months" ? p.createElement(r.MonthsDropdown, { key: "month", className: c[O.MonthsDropdown], "aria-label": Pn(), disabled: !!t.disableNavigation, onChange: Qn(A.date, z), options: is(A.date, T, k, o, s), style: Tt(O.MonthsDropdown), value: s.getMonth(A.date) }) : p.createElement("span", { key: "month" }, q(A.date, s)), Q = u === "dropdown" || u === "dropdown-years" ? p.createElement(r.YearsDropdown, { key: "year", className: c[O.YearsDropdown], "aria-label": zn(s.options), disabled: !!t.disableNavigation, onChange: Xn(A.date, z), options: ls(T, k, o, s, !!t.reverseYears), style: Tt(O.YearsDropdown), value: s.getYear(A.date) }) : p.createElement("span", { key: "year" }, re(A.date, s));
3214
- return s.getMonthYearOrder() === "year-first" ? [Q, L] : [L, Q];
3215
- })(),
3216
- p.createElement("span", { role: "status", "aria-live": "polite", style: {
3217
- border: 0,
3218
- clip: "rect(0 0 0 0)",
3219
- height: "1px",
3220
- margin: "-1px",
3221
- overflow: "hidden",
3222
- padding: 0,
3223
- position: "absolute",
3224
- width: "1px",
3225
- whiteSpace: "nowrap",
3226
- wordWrap: "normal"
3227
- } }, I(A.date, s.options, s))
3228
- ) : p.createElement(r.CaptionLabel, { className: c[O.CaptionLabel], style: f == null ? void 0 : f[O.CaptionLabel], role: "status", "aria-live": "polite" }, I(A.date, s.options, s))),
3229
- d === "around" && !t.hideNavigation && U === h - 1 && p.createElement(
3230
- r.NextMonthButton,
3231
- { type: "button", className: c[O.NextMonthButton], style: f == null ? void 0 : f[O.NextMonthButton], tabIndex: F ? void 0 : -1, "aria-disabled": F ? void 0 : !0, "aria-label": En(F), onClick: lt, "data-animated-button": t.animate ? "true" : void 0 },
3232
- p.createElement(r.Chevron, { disabled: F ? void 0 : !0, className: c[O.Chevron], style: f == null ? void 0 : f[O.Chevron], orientation: t.dir === "rtl" ? "left" : "right" })
332
+ }, [O, k, u, b]), ee(v, n, r, null), v === !1)
333
+ return null;
334
+ const L = () => {
335
+ j(""), N([]), U(!1), W(null), H.current = void 0, V(!0);
336
+ }, P = (m) => {
337
+ r(n, m.id), q(m), F.current = m.id, V(!1);
338
+ }, K = (m) => {
339
+ m.stopPropagation(), r(n, null), q(void 0);
340
+ }, G = (m) => {
341
+ (m.key === "Enter" || m.key === " ") && K(m);
342
+ }, Le = ((me = g == null ? void 0 : g.options) == null ? void 0 : me.placeholder) ?? "Select an option";
343
+ return /* @__PURE__ */ e(C, { mb: "4", children: /* @__PURE__ */ f(z, { direction: "column", gap: "1", children: [
344
+ /* @__PURE__ */ f(c, { as: "label", size: "2", weight: "bold", htmlFor: n, children: [
345
+ a,
346
+ " ",
347
+ y && /* @__PURE__ */ e(c, { color: "red", children: "*" })
348
+ ] }),
349
+ /* @__PURE__ */ f("div", { ref: T, style: { position: "relative" }, children: [
350
+ /* @__PURE__ */ e(
351
+ Y.Root,
352
+ {
353
+ id: n,
354
+ value: k ? O : (le == null ? void 0 : le.name) ?? "",
355
+ placeholder: k && (o != null && o.searchable) ? "Search..." : Le,
356
+ disabled: !w,
357
+ readOnly: k && !(o != null && o.searchable),
358
+ style: R ? void 0 : { outline: "2px solid var(--red-7)", outlineOffset: "-1px" },
359
+ onChange: (m) => {
360
+ o != null && o.searchable && (j(m.target.value), k || L());
361
+ },
362
+ onFocus: () => {
363
+ w && !k && L();
364
+ },
365
+ onKeyDown: (m) => {
366
+ m.key === "Escape" && V(!1);
367
+ },
368
+ children: /* @__PURE__ */ e(Y.Slot, { side: "right", children: /* @__PURE__ */ f(z, { align: "center", gap: "1", children: [
369
+ t && w && /* @__PURE__ */ e(
370
+ "span",
371
+ {
372
+ role: "button",
373
+ tabIndex: 0,
374
+ onMouseDown: (m) => m.preventDefault(),
375
+ onClick: K,
376
+ onKeyDown: G,
377
+ style: { lineHeight: 1, color: "var(--gray-9)", padding: "0 2px", cursor: "pointer" },
378
+ "aria-label": "Clear selection",
379
+ children: "×"
380
+ }
3233
381
  ),
3234
- U === h - 1 && d === "after" && !t.hideNavigation && p.createElement(r.Nav, { "data-animated-nav": t.animate ? "true" : void 0, className: c[O.Nav], style: f == null ? void 0 : f[O.Nav], "aria-label": Ct(), onPreviousClick: ut, onNextClick: lt, previousMonth: $, nextMonth: F }),
3235
- p.createElement(
3236
- r.MonthGrid,
3237
- { role: "grid", "aria-multiselectable": l === "multiple" || l === "range", "aria-label": Fe(A.date, s.options, s) || void 0, className: c[O.MonthGrid], style: f == null ? void 0 : f[O.MonthGrid] },
3238
- !t.hideWeekdays && p.createElement(
3239
- r.Weekdays,
3240
- { "data-animated-weekdays": t.animate ? "true" : void 0, className: c[O.Weekdays], style: f == null ? void 0 : f[O.Weekdays] },
3241
- S && p.createElement(r.WeekNumberHeader, { "aria-label": An(s.options), className: c[O.WeekNumberHeader], style: f == null ? void 0 : f[O.WeekNumberHeader], scope: "col" }, Y()),
3242
- Hn.map((L) => p.createElement(r.Weekday, { "aria-label": In(L, s.options, s), className: c[O.Weekday], key: String(L), style: f == null ? void 0 : f[O.Weekday], scope: "col" }, ee(L, s.options, s)))
3243
- ),
3244
- p.createElement(r.Weeks, { "data-animated-weeks": t.animate ? "true" : void 0, className: c[O.Weeks], style: f == null ? void 0 : f[O.Weeks] }, A.weeks.map((L) => p.createElement(
3245
- r.Week,
3246
- { className: c[O.Week], key: L.weekNumber, style: f == null ? void 0 : f[O.Week], week: L },
3247
- S && p.createElement(r.WeekNumber, { week: L, style: f == null ? void 0 : f[O.WeekNumber], "aria-label": Bn(L.weekNumber, {
3248
- locale: i
3249
- }), className: c[O.WeekNumber], scope: "row", role: "rowheader" }, _(L.weekNumber, s)),
3250
- L.days.map((Q) => {
3251
- const { date: Me } = Q, V = B(Q);
3252
- if (V[Z.focused] = !V.hidden && !!(ae != null && ae.isEqualTo(Q)), V[ge.selected] = (G == null ? void 0 : G(Me)) || V.selected, it(J)) {
3253
- const { from: dt, to: ft } = J;
3254
- V[ge.range_start] = !!(dt && ft && s.isSameDay(Me, dt)), V[ge.range_end] = !!(dt && ft && s.isSameDay(Me, ft)), V[ge.range_middle] = pe(J, Me, !0, s);
3255
- }
3256
- const er = cs(V, f, t.modifiersStyles), tr = Ua(V, c, t.modifiersClassNames), nr = !Nt && !V.hidden ? Te(Me, V, s.options, s) : void 0;
3257
- return p.createElement(r.Day, { key: `${Q.isoDate}_${Q.displayMonthId}`, day: Q, modifiers: V, className: tr.join(" "), style: er, role: "gridcell", "aria-selected": V.selected || void 0, "aria-label": nr, "data-day": Q.isoDate, "data-month": Q.outside ? Q.dateMonthId : void 0, "data-selected": V.selected || void 0, "data-disabled": V.disabled || void 0, "data-hidden": V.hidden || void 0, "data-outside": Q.outside || void 0, "data-focused": V.focused || void 0, "data-today": V.today || void 0 }, !V.hidden && Nt ? p.createElement(r.DayButton, { className: c[O.DayButton], style: f == null ? void 0 : f[O.DayButton], type: "button", day: Q, modifiers: V, disabled: !V.focused && V.disabled || void 0, "aria-disabled": V.focused && V.disabled || void 0, tabIndex: ue(Q) ? 0 : -1, "aria-label": be(Me, V, s.options, s), onClick: jn(Q, V), onBlur: qn(Q, V), onFocus: Rn(Q, V), onKeyDown: Un(Q, V), onMouseEnter: Gn(Q, V), onMouseLeave: Vn(Q, V) }, j(Me, s.options, s)) : !V.hidden && j(Q.date, s.options, s));
3258
- })
3259
- )))
382
+ /* @__PURE__ */ e(
383
+ Qe,
384
+ {
385
+ style: { transform: k ? "rotate(180deg)" : void 0, transition: "transform 150ms" }
386
+ }
3260
387
  )
3261
- );
3262
- })
3263
- ),
3264
- t.footer && p.createElement(r.Footer, { className: c[O.Footer], style: f == null ? void 0 : f[O.Footer], role: "status", "aria-live": "polite" }, t.footer)
3265
- )
3266
- );
3267
- }
3268
- function Es(e) {
3269
- return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
3270
- }
3271
- var tt = { exports: {} }, Is = tt.exports, Qt;
3272
- function Bs() {
3273
- return Qt || (Qt = 1, (function(e, t) {
3274
- (function(n, r) {
3275
- e.exports = r();
3276
- })(Is, (function() {
3277
- var n = 1e3, r = 6e4, o = 36e5, a = "millisecond", s = "second", i = "minute", c = "hour", u = "day", l = "week", d = "month", h = "quarter", m = "year", y = "date", N = "Invalid Date", x = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, P = /\[([^\]]+)]|YYYY|YY|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, b = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(W) {
3278
- var D = ["th", "st", "nd", "rd"], w = W % 100;
3279
- return "[" + W + (D[(w - 20) % 10] || D[w] || D[0]) + "]";
3280
- } }, v = function(W, D, w) {
3281
- var T = String(W);
3282
- return !T || T.length >= D ? W : "" + Array(D + 1 - T.length).join(w) + W;
3283
- }, C = { s: v, z: function(W) {
3284
- var D = -W.utcOffset(), w = Math.abs(D), T = Math.floor(w / 60), k = w % 60;
3285
- return (D <= 0 ? "+" : "-") + v(T, 2, "0") + ":" + v(k, 2, "0");
3286
- }, m: function W(D, w) {
3287
- if (D.date() < w.date()) return -W(w, D);
3288
- var T = 12 * (w.year() - D.year()) + (w.month() - D.month()), k = D.clone().add(T, d), $ = w - k < 0, F = D.clone().add(T + ($ ? -1 : 1), d);
3289
- return +(-(T + (w - k) / ($ ? k - F : F - k)) || 0);
3290
- }, a: function(W) {
3291
- return W < 0 ? Math.ceil(W) || 0 : Math.floor(W);
3292
- }, p: function(W) {
3293
- return { M: d, y: m, w: l, d: u, D: y, h: c, m: i, s, ms: a, Q: h }[W] || String(W || "").toLowerCase().replace(/s$/, "");
3294
- }, u: function(W) {
3295
- return W === void 0;
3296
- } }, S = "en", f = {};
3297
- f[S] = b;
3298
- var I = "$isDayjsObject", j = function(W) {
3299
- return W instanceof ee || !(!W || !W[I]);
3300
- }, q = function W(D, w, T) {
3301
- var k;
3302
- if (!D) return S;
3303
- if (typeof D == "string") {
3304
- var $ = D.toLowerCase();
3305
- f[$] && (k = $), w && (f[$] = w, k = $);
3306
- var F = D.split("-");
3307
- if (!k && F.length > 1) return W(F[0]);
3308
- } else {
3309
- var M = D.name;
3310
- f[M] = D, k = M;
3311
- }
3312
- return !T && k && (S = k), k || !T && S;
3313
- }, _ = function(W, D) {
3314
- if (j(W)) return W.clone();
3315
- var w = typeof D == "object" ? D : {};
3316
- return w.date = W, w.args = arguments, new ee(w);
3317
- }, Y = C;
3318
- Y.l = q, Y.i = j, Y.w = function(W, D) {
3319
- return _(W, { locale: D.$L, utc: D.$u, x: D.$x, $offset: D.$offset });
3320
- };
3321
- var ee = (function() {
3322
- function W(w) {
3323
- this.$L = q(w.locale, null, !0), this.parse(w), this.$x = this.$x || w.x || {}, this[I] = !0;
388
+ ] }) })
3324
389
  }
3325
- var D = W.prototype;
3326
- return D.parse = function(w) {
3327
- this.$d = (function(T) {
3328
- var k = T.date, $ = T.utc;
3329
- if (k === null) return /* @__PURE__ */ new Date(NaN);
3330
- if (Y.u(k)) return /* @__PURE__ */ new Date();
3331
- if (k instanceof Date) return new Date(k);
3332
- if (typeof k == "string" && !/Z$/i.test(k)) {
3333
- var F = k.match(x);
3334
- if (F) {
3335
- var M = F[2] - 1 || 0, B = (F[7] || "0").substring(0, 3);
3336
- return $ ? new Date(Date.UTC(F[1], M, F[3] || 1, F[4] || 0, F[5] || 0, F[6] || 0, B)) : new Date(F[1], M, F[3] || 1, F[4] || 0, F[5] || 0, F[6] || 0, B);
3337
- }
3338
- }
3339
- return new Date(k);
3340
- })(w), this.init();
3341
- }, D.init = function() {
3342
- var w = this.$d;
3343
- this.$y = w.getFullYear(), this.$M = w.getMonth(), this.$D = w.getDate(), this.$W = w.getDay(), this.$H = w.getHours(), this.$m = w.getMinutes(), this.$s = w.getSeconds(), this.$ms = w.getMilliseconds();
3344
- }, D.$utils = function() {
3345
- return Y;
3346
- }, D.isValid = function() {
3347
- return this.$d.toString() !== N;
3348
- }, D.isSame = function(w, T) {
3349
- var k = _(w);
3350
- return this.startOf(T) <= k && k <= this.endOf(T);
3351
- }, D.isAfter = function(w, T) {
3352
- return _(w) < this.startOf(T);
3353
- }, D.isBefore = function(w, T) {
3354
- return this.endOf(T) < _(w);
3355
- }, D.$g = function(w, T, k) {
3356
- return Y.u(w) ? this[T] : this.set(k, w);
3357
- }, D.unix = function() {
3358
- return Math.floor(this.valueOf() / 1e3);
3359
- }, D.valueOf = function() {
3360
- return this.$d.getTime();
3361
- }, D.startOf = function(w, T) {
3362
- var k = this, $ = !!Y.u(T) || T, F = Y.p(w), M = function(we, oe) {
3363
- var be = Y.w(k.$u ? Date.UTC(k.$y, oe, we) : new Date(k.$y, oe, we), k);
3364
- return $ ? be : be.endOf(u);
3365
- }, B = function(we, oe) {
3366
- return Y.w(k.toDate()[we].apply(k.toDate("s"), ($ ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(oe)), k);
3367
- }, G = this.$W, E = this.$M, J = this.$D, se = "set" + (this.$u ? "UTC" : "");
3368
- switch (F) {
3369
- case m:
3370
- return $ ? M(1, 0) : M(31, 11);
3371
- case d:
3372
- return $ ? M(1, E) : M(0, E + 1);
3373
- case l:
3374
- var ae = this.$locale().weekStart || 0, ue = (G < ae ? G + 7 : G) - ae;
3375
- return M($ ? J - ue : J + (6 - ue), E);
3376
- case u:
3377
- case y:
3378
- return B(se + "Hours", 0);
3379
- case c:
3380
- return B(se + "Minutes", 1);
3381
- case i:
3382
- return B(se + "Seconds", 2);
3383
- case s:
3384
- return B(se + "Milliseconds", 3);
3385
- default:
3386
- return this.clone();
3387
- }
3388
- }, D.endOf = function(w) {
3389
- return this.startOf(w, !1);
3390
- }, D.$set = function(w, T) {
3391
- var k, $ = Y.p(w), F = "set" + (this.$u ? "UTC" : ""), M = (k = {}, k[u] = F + "Date", k[y] = F + "Date", k[d] = F + "Month", k[m] = F + "FullYear", k[c] = F + "Hours", k[i] = F + "Minutes", k[s] = F + "Seconds", k[a] = F + "Milliseconds", k)[$], B = $ === u ? this.$D + (T - this.$W) : T;
3392
- if ($ === d || $ === m) {
3393
- var G = this.clone().set(y, 1);
3394
- G.$d[M](B), G.init(), this.$d = G.set(y, Math.min(this.$D, G.daysInMonth())).$d;
3395
- } else M && this.$d[M](B);
3396
- return this.init(), this;
3397
- }, D.set = function(w, T) {
3398
- return this.clone().$set(w, T);
3399
- }, D.get = function(w) {
3400
- return this[Y.p(w)]();
3401
- }, D.add = function(w, T) {
3402
- var k, $ = this;
3403
- w = Number(w);
3404
- var F = Y.p(T), M = function(E) {
3405
- var J = _($);
3406
- return Y.w(J.date(J.date() + Math.round(E * w)), $);
3407
- };
3408
- if (F === d) return this.set(d, this.$M + w);
3409
- if (F === m) return this.set(m, this.$y + w);
3410
- if (F === u) return M(1);
3411
- if (F === l) return M(7);
3412
- var B = (k = {}, k[i] = r, k[c] = o, k[s] = n, k)[F] || 1, G = this.$d.getTime() + w * B;
3413
- return Y.w(G, this);
3414
- }, D.subtract = function(w, T) {
3415
- return this.add(-1 * w, T);
3416
- }, D.format = function(w) {
3417
- var T = this, k = this.$locale();
3418
- if (!this.isValid()) return k.invalidDate || N;
3419
- var $ = w || "YYYY-MM-DDTHH:mm:ssZ", F = Y.z(this), M = this.$H, B = this.$m, G = this.$M, E = k.weekdays, J = k.months, se = k.meridiem, ae = function(oe, be, Te, Fe) {
3420
- return oe && (oe[be] || oe(T, $)) || Te[be].slice(0, Fe);
3421
- }, ue = function(oe) {
3422
- return Y.s(M % 12 || 12, oe, "0");
3423
- }, we = se || function(oe, be, Te) {
3424
- var Fe = oe < 12 ? "AM" : "PM";
3425
- return Te ? Fe.toLowerCase() : Fe;
3426
- };
3427
- return $.replace(P, (function(oe, be) {
3428
- return be || (function(Te) {
3429
- switch (Te) {
3430
- case "YY":
3431
- return String(T.$y).slice(-2);
3432
- case "YYYY":
3433
- return Y.s(T.$y, 4, "0");
3434
- case "M":
3435
- return G + 1;
3436
- case "MM":
3437
- return Y.s(G + 1, 2, "0");
3438
- case "MMM":
3439
- return ae(k.monthsShort, G, J, 3);
3440
- case "MMMM":
3441
- return ae(J, G);
3442
- case "D":
3443
- return T.$D;
3444
- case "DD":
3445
- return Y.s(T.$D, 2, "0");
3446
- case "d":
3447
- return String(T.$W);
3448
- case "dd":
3449
- return ae(k.weekdaysMin, T.$W, E, 2);
3450
- case "ddd":
3451
- return ae(k.weekdaysShort, T.$W, E, 3);
3452
- case "dddd":
3453
- return E[T.$W];
3454
- case "H":
3455
- return String(M);
3456
- case "HH":
3457
- return Y.s(M, 2, "0");
3458
- case "h":
3459
- return ue(1);
3460
- case "hh":
3461
- return ue(2);
3462
- case "a":
3463
- return we(M, B, !0);
3464
- case "A":
3465
- return we(M, B, !1);
3466
- case "m":
3467
- return String(B);
3468
- case "mm":
3469
- return Y.s(B, 2, "0");
3470
- case "s":
3471
- return String(T.$s);
3472
- case "ss":
3473
- return Y.s(T.$s, 2, "0");
3474
- case "SSS":
3475
- return Y.s(T.$ms, 3, "0");
3476
- case "Z":
3477
- return F;
390
+ ),
391
+ k && /* @__PURE__ */ e(
392
+ C,
393
+ {
394
+ style: {
395
+ position: "absolute",
396
+ top: "calc(100% + 4px)",
397
+ left: 0,
398
+ right: 0,
399
+ zIndex: 50,
400
+ background: "var(--color-panel-solid)",
401
+ borderRadius: "var(--radius-3)",
402
+ boxShadow: "var(--shadow-5)",
403
+ border: "1px solid var(--gray-a6)",
404
+ overflow: "hidden"
405
+ },
406
+ children: $ ? /* @__PURE__ */ e(C, { p: "3", children: /* @__PURE__ */ e(c, { size: "2", color: "gray", children: $ }) }) : /* @__PURE__ */ e(qe, { style: { maxHeight: 240 }, children: /* @__PURE__ */ f(C, { p: "1", children: [
407
+ I && /* @__PURE__ */ e(z, { justify: "center", p: "4", children: /* @__PURE__ */ e(Ce, {}) }),
408
+ !I && oe && /* @__PURE__ */ e(C, { px: "3", py: "2", children: /* @__PURE__ */ e(c, { size: "2", color: "red", children: oe }) }),
409
+ !I && !oe && te.length === 0 && /* @__PURE__ */ e(C, { px: "3", py: "2", children: /* @__PURE__ */ e(c, { size: "2", color: "gray", children: O || u ? "No results found." : "Type to search…" }) }),
410
+ te.map((m) => /* @__PURE__ */ e(
411
+ C,
412
+ {
413
+ px: "3",
414
+ py: "2",
415
+ onMouseDown: (E) => E.preventDefault(),
416
+ onClick: () => P(m),
417
+ style: {
418
+ cursor: "pointer",
419
+ borderRadius: "var(--radius-2)",
420
+ backgroundColor: m.id === t ? "var(--accent-3)" : void 0
421
+ },
422
+ className: "hover:bg-(--gray-3)",
423
+ children: /* @__PURE__ */ e(c, { size: "2", children: m.name })
424
+ },
425
+ m.id
426
+ )),
427
+ (o == null ? void 0 : o.paginated) && re && !ne && /* @__PURE__ */ e(C, { px: "3", py: "2", children: /* @__PURE__ */ e(
428
+ he,
429
+ {
430
+ variant: "ghost",
431
+ size: "1",
432
+ style: { width: "100%" },
433
+ onMouseDown: (m) => m.preventDefault(),
434
+ onClick: () => void b(O, !0),
435
+ children: "Load more"
3478
436
  }
3479
- return null;
3480
- })(oe) || F.replace(":", "");
3481
- }));
3482
- }, D.utcOffset = function() {
3483
- return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
3484
- }, D.diff = function(w, T, k) {
3485
- var $, F = this, M = Y.p(T), B = _(w), G = (B.utcOffset() - this.utcOffset()) * r, E = this - B, J = function() {
3486
- return Y.m(F, B);
3487
- };
3488
- switch (M) {
3489
- case m:
3490
- $ = J() / 12;
3491
- break;
3492
- case d:
3493
- $ = J();
3494
- break;
3495
- case h:
3496
- $ = J() / 3;
3497
- break;
3498
- case l:
3499
- $ = (E - G) / 6048e5;
3500
- break;
3501
- case u:
3502
- $ = (E - G) / 864e5;
3503
- break;
3504
- case c:
3505
- $ = E / o;
3506
- break;
3507
- case i:
3508
- $ = E / r;
3509
- break;
3510
- case s:
3511
- $ = E / n;
3512
- break;
3513
- default:
3514
- $ = E;
3515
- }
3516
- return k ? $ : Y.a($);
3517
- }, D.daysInMonth = function() {
3518
- return this.endOf(d).$D;
3519
- }, D.$locale = function() {
3520
- return f[this.$L];
3521
- }, D.locale = function(w, T) {
3522
- if (!w) return this.$L;
3523
- var k = this.clone(), $ = q(w, T, !0);
3524
- return $ && (k.$L = $), k;
3525
- }, D.clone = function() {
3526
- return Y.w(this.$d, this);
3527
- }, D.toDate = function() {
3528
- return new Date(this.valueOf());
3529
- }, D.toJSON = function() {
3530
- return this.isValid() ? this.toISOString() : null;
3531
- }, D.toISOString = function() {
3532
- return this.$d.toISOString();
3533
- }, D.toString = function() {
3534
- return this.$d.toUTCString();
3535
- }, W;
3536
- })(), re = ee.prototype;
3537
- return _.prototype = re, [["$ms", a], ["$s", s], ["$m", i], ["$H", c], ["$W", u], ["$M", d], ["$y", m], ["$D", y]].forEach((function(W) {
3538
- re[W[1]] = function(D) {
3539
- return this.$g(D, W[0], W[1]);
3540
- };
3541
- })), _.extend = function(W, D) {
3542
- return W.$i || (W(D, ee, _), W.$i = !0), _;
3543
- }, _.locale = q, _.isDayjs = j, _.unix = function(W) {
3544
- return _(1e3 * W);
3545
- }, _.en = f[S], _.Ls = f, _.p = {}, _;
3546
- }));
3547
- })(tt)), tt.exports;
3548
- }
3549
- var As = Bs();
3550
- const Wt = /* @__PURE__ */ Es(As), zs = (e) => Wt(e).format("YYYY-MM-DD"), Hs = (e) => {
3551
- if (!e) return;
3552
- const t = Wt(`${e}T00:00:00`);
3553
- return t.isValid() ? t.toDate() : void 0;
3554
- }, js = (e, t) => Wt(`${e}T${t}`).format(), Rs = ({ path: e, label: t, required: n, errors: r, description: o, children: a }) => {
3555
- const s = r.length === 0;
3556
- return /* @__PURE__ */ g(ie, { mb: "4", children: /* @__PURE__ */ R(te, { direction: "column", gap: "1", children: [
3557
- /* @__PURE__ */ R(H, { as: "label", size: "2", weight: "bold", htmlFor: e, children: [
3558
- t,
437
+ ) }),
438
+ ne && /* @__PURE__ */ e(z, { justify: "center", p: "2", children: /* @__PURE__ */ e(Ce, {}) })
439
+ ] }) })
440
+ }
441
+ )
442
+ ] }),
443
+ !R && /* @__PURE__ */ e(c, { color: "red", size: "1", children: _(h, a) }),
444
+ d.description && /* @__PURE__ */ e(c, { size: "1", color: "gray", children: d.description })
445
+ ] }) });
446
+ }, Tr = J(Sr), Rr = D(
447
+ 3,
448
+ $e((t) => {
449
+ const r = t["x-search"];
450
+ return t.type === "string" && typeof (r == null ? void 0 : r.service) == "string" && r.service !== "";
451
+ })
452
+ ), kr = (t, r) => lr(`${t}T${r}`).format(), $r = ({ path: t, label: r, required: n, errors: a, description: y, children: h }) => {
453
+ const s = a.length === 0;
454
+ return /* @__PURE__ */ e(C, { mb: "4", children: /* @__PURE__ */ f(z, { direction: "column", gap: "1", children: [
455
+ /* @__PURE__ */ f(c, { as: "label", size: "2", weight: "bold", htmlFor: t, children: [
456
+ r,
3559
457
  " ",
3560
- n && /* @__PURE__ */ g(H, { color: "red", children: "*" })
458
+ n && /* @__PURE__ */ e(c, { color: "red", children: "*" })
3561
459
  ] }),
3562
- a,
3563
- !s && /* @__PURE__ */ g(H, { color: "red", size: "1", children: $e(r, t) }),
3564
- o && /* @__PURE__ */ g(H, { size: "1", color: "gray", children: o })
460
+ h,
461
+ !s && /* @__PURE__ */ e(c, { color: "red", size: "1", children: _(a, r) }),
462
+ y && /* @__PURE__ */ e(c, { size: "1", color: "gray", children: y })
3565
463
  ] }) });
3566
- }, qs = ({
3567
- data: e,
3568
- handleChange: t,
464
+ }, Fr = ({
465
+ data: t,
466
+ handleChange: r,
3569
467
  path: n,
3570
- label: r,
3571
- required: o,
3572
- errors: a,
468
+ label: a,
469
+ required: y,
470
+ errors: h,
3573
471
  schema: s,
3574
- enabled: i,
3575
- visible: c = !0
472
+ enabled: v,
473
+ visible: d = !0
3576
474
  }) => {
3577
- if (We(() => {
3578
- c === !1 && t(n, void 0);
3579
- }, [c, n, t]), c === !1)
475
+ if (X(() => {
476
+ d === !1 && r(n, void 0);
477
+ }, [d, n, r]), d === !1)
3580
478
  return null;
3581
- const u = a.length === 0, [l, d] = Ne(!1), h = typeof e == "string" ? e : "", m = (C) => /* @__PURE__ */ g(Rs, { path: n, label: r, required: o, errors: a, description: s.description, children: C });
479
+ const g = h.length === 0, l = typeof t == "string" ? t : "", x = (w) => /* @__PURE__ */ e($r, { path: n, label: a, required: y, errors: h, description: s.description, children: w });
3582
480
  if (s.format === "time")
3583
- return m(
3584
- /* @__PURE__ */ g(
3585
- nt.Root,
481
+ return x(
482
+ /* @__PURE__ */ e(
483
+ Y.Root,
3586
484
  {
3587
485
  type: "time",
3588
- value: h,
3589
- onChange: (C) => t(n, C.target.value),
3590
- disabled: !i,
3591
- color: u ? void 0 : "red",
486
+ value: l,
487
+ onChange: (w) => r(n, w.target.value),
488
+ disabled: !v,
489
+ color: g ? void 0 : "red",
3592
490
  id: n
3593
491
  }
3594
492
  )
3595
493
  );
3596
- const y = s.format === "date-time", [N = "", x = ""] = h.split("T"), P = Hs(N), b = x.slice(0, 5), v = (C, S) => {
3597
- if (!C) {
3598
- t(n, void 0);
494
+ const p = s.format === "date-time", [o = "", u = ""] = l.split("T"), S = u.slice(0, 5), $ = (w, R) => {
495
+ if (!w) {
496
+ r(n, void 0);
3599
497
  return;
3600
498
  }
3601
- t(n, y ? js(C, S || "00:00") : C);
499
+ r(n, p ? kr(w, R || "00:00") : w);
3602
500
  };
3603
- return m(
3604
- /* @__PURE__ */ R(te, { gap: "2", align: "center", children: [
3605
- /* @__PURE__ */ R(ht.Root, { open: l, onOpenChange: d, children: [
3606
- /* @__PURE__ */ g(ht.Trigger, { children: /* @__PURE__ */ R(rt, { id: n, type: "button", variant: "surface", color: u ? "gray" : "red", disabled: !i, children: [
3607
- /* @__PURE__ */ g(Mr, {}),
3608
- P ? P.toLocaleDateString() : "Select date"
3609
- ] }) }),
3610
- /* @__PURE__ */ g(ht.Content, { children: /* @__PURE__ */ g(
3611
- _s,
3612
- {
3613
- mode: "single",
3614
- captionLayout: "dropdown",
3615
- startMonth: new Date(1900, 0),
3616
- endMonth: new Date((/* @__PURE__ */ new Date()).getFullYear() + 100, 11),
3617
- selected: P,
3618
- defaultMonth: P,
3619
- onSelect: (C) => {
3620
- v(C ? zs(C) : "", b), C && d(!1);
3621
- }
3622
- }
3623
- ) })
3624
- ] }),
3625
- y && /* @__PURE__ */ g(
3626
- nt.Root,
501
+ return x(
502
+ /* @__PURE__ */ f(z, { gap: "2", align: "center", children: [
503
+ /* @__PURE__ */ e(
504
+ Y.Root,
505
+ {
506
+ type: "date",
507
+ value: o,
508
+ disabled: !v,
509
+ color: g ? void 0 : "red",
510
+ onChange: (w) => $(w.target.value, S),
511
+ id: n,
512
+ style: { flex: 1 }
513
+ }
514
+ ),
515
+ p && /* @__PURE__ */ e(
516
+ Y.Root,
3627
517
  {
3628
518
  type: "time",
3629
- value: b,
3630
- disabled: !i || !N,
3631
- color: u ? void 0 : "red",
3632
- onChange: (C) => v(N, C.target.value)
519
+ value: S,
520
+ disabled: !v || !o,
521
+ color: g ? void 0 : "red",
522
+ onChange: (w) => $(o, w.target.value),
523
+ style: { flex: 1 }
3633
524
  }
3634
525
  )
3635
526
  ] })
3636
527
  );
3637
- }, Us = he(2, at(cr, ur, lr)), Gs = Ye(qs), Vs = ({
3638
- uischema: e,
3639
- schema: t,
528
+ }, Dr = D(2, ge(Pe, Be, Me)), Or = J(Fr), Ir = ({
529
+ uischema: t,
530
+ schema: r,
3640
531
  path: n,
3641
- renderers: r,
3642
- cells: o,
3643
- enabled: a,
532
+ renderers: a,
533
+ cells: y,
534
+ enabled: h,
3644
535
  visible: s = !0
3645
536
  }) => {
3646
- const c = e.elements;
3647
- return s === !1 ? null : /* @__PURE__ */ g(te, { direction: "column", gap: "4", children: c.map((u, l) => /* @__PURE__ */ g(
3648
- Ve,
537
+ const d = t.elements;
538
+ return s === !1 ? null : /* @__PURE__ */ e(z, { direction: "column", gap: "4", children: d.map((g, l) => /* @__PURE__ */ e(
539
+ ce,
3649
540
  {
3650
- uischema: u,
3651
- schema: t,
541
+ uischema: g,
542
+ schema: r,
3652
543
  path: n,
3653
- renderers: r,
3654
- cells: o,
3655
- enabled: a
544
+ renderers: a,
545
+ cells: y,
546
+ enabled: h
3656
547
  },
3657
548
  `${n}-${l}`
3658
549
  )) });
3659
- }, Qs = he(1, Ge("VerticalLayout")), Xs = ({
3660
- uischema: e,
3661
- schema: t,
550
+ }, Lr = D(1, ie("VerticalLayout")), Ar = ({
551
+ uischema: t,
552
+ schema: r,
3662
553
  path: n,
3663
- renderers: r,
3664
- cells: o,
3665
- enabled: a,
554
+ renderers: a,
555
+ cells: y,
556
+ enabled: h,
3666
557
  visible: s = !0
3667
558
  }) => {
3668
- const c = e.elements;
3669
- return s === !1 ? null : /* @__PURE__ */ g(te, { direction: "row", gap: "4", children: c.map((u, l) => /* @__PURE__ */ g(ie, { style: { flex: 1 }, children: /* @__PURE__ */ g(
3670
- Ve,
559
+ const d = t.elements;
560
+ return s === !1 ? null : /* @__PURE__ */ e(z, { direction: "row", gap: "4", children: d.map((g, l) => /* @__PURE__ */ e(C, { style: { flex: 1 }, children: /* @__PURE__ */ e(
561
+ ce,
3671
562
  {
3672
- uischema: u,
3673
- schema: t,
563
+ uischema: g,
564
+ schema: r,
3674
565
  path: n,
3675
- renderers: r,
3676
- cells: o,
3677
- enabled: a
566
+ renderers: a,
567
+ cells: y,
568
+ enabled: h
3678
569
  }
3679
570
  ) }, `${n}-${l}`)) });
3680
- }, Ks = he(1, Ge("HorizontalLayout")), Js = ({
3681
- uischema: e,
3682
- schema: t,
571
+ }, Ur = D(1, ie("HorizontalLayout")), Er = ({
572
+ uischema: t,
573
+ schema: r,
3683
574
  path: n,
3684
- renderers: r,
3685
- cells: o,
3686
- enabled: a,
575
+ renderers: a,
576
+ cells: y,
577
+ enabled: h,
3687
578
  visible: s = !0
3688
579
  }) => {
3689
- const i = e, c = i.elements;
3690
- return s === !1 ? null : /* @__PURE__ */ R(ie, { mb: "6", children: [
3691
- i.label && /* @__PURE__ */ g(en, { size: "3", mb: "3", className: "text-gray-500 uppercase tracking-wide font-semibold", children: i.label }),
3692
- /* @__PURE__ */ g(te, { direction: "column", gap: "4", children: c.map((u, l) => /* @__PURE__ */ g(
3693
- Ve,
580
+ const v = t, d = v.elements;
581
+ return s === !1 ? null : /* @__PURE__ */ f(C, { mb: "6", children: [
582
+ v.label && /* @__PURE__ */ e(Fe, { size: "3", mb: "3", className: "text-gray-500 uppercase tracking-wide font-semibold", children: v.label }),
583
+ /* @__PURE__ */ e(z, { direction: "column", gap: "4", children: d.map((g, l) => /* @__PURE__ */ e(
584
+ ce,
3694
585
  {
3695
- uischema: u,
3696
- schema: t,
586
+ uischema: g,
587
+ schema: r,
3697
588
  path: n,
3698
- renderers: r,
3699
- cells: o,
3700
- enabled: a
589
+ renderers: a,
590
+ cells: y,
591
+ enabled: h
3701
592
  },
3702
593
  `${n}-${l}`
3703
594
  )) })
3704
595
  ] });
3705
- }, Zs = he(1, Ge("Group")), Ls = ({
3706
- uischema: e,
3707
- schema: t,
596
+ }, Vr = D(1, ie("Group")), jr = ({
597
+ uischema: t,
598
+ schema: r,
3708
599
  path: n,
3709
- renderers: r,
3710
- cells: o,
3711
- enabled: a,
600
+ renderers: a,
601
+ cells: y,
602
+ enabled: h,
3712
603
  visible: s = !0
3713
604
  }) => {
3714
- var h;
3715
- const c = e.elements.filter((m) => m.type === "Category"), [u, l] = Ne(((h = c[0]) == null ? void 0 : h.label) || "");
3716
- if (s === !1 || !c.length) return null;
3717
- const d = c.find((m) => m.label === u) ? u : c[0].label;
3718
- return /* @__PURE__ */ R(Je.Root, { value: d, onValueChange: l, children: [
3719
- /* @__PURE__ */ g(Je.List, { children: c.map((m, y) => /* @__PURE__ */ g(Je.Trigger, { value: m.label, children: m.label }, `${n}-${y}`)) }),
3720
- /* @__PURE__ */ g(ie, { pt: "3", children: c.map((m, y) => /* @__PURE__ */ g(Je.Content, { value: m.label, children: /* @__PURE__ */ g(te, { direction: "column", gap: "4", children: m.elements.map((N, x) => /* @__PURE__ */ g(
3721
- Ve,
605
+ var p;
606
+ const d = t.elements.filter((o) => o.type === "Category"), [g, l] = A(((p = d[0]) == null ? void 0 : p.label) || "");
607
+ if (s === !1 || !d.length) return null;
608
+ const x = d.find((o) => o.label === g) ? g : d[0].label;
609
+ return /* @__PURE__ */ f(ue.Root, { value: x, onValueChange: l, children: [
610
+ /* @__PURE__ */ e(ue.List, { children: d.map((o, u) => /* @__PURE__ */ e(ue.Trigger, { value: o.label, children: o.label }, `${n}-${u}`)) }),
611
+ /* @__PURE__ */ e(C, { pt: "3", children: d.map((o, u) => /* @__PURE__ */ e(ue.Content, { value: o.label, children: /* @__PURE__ */ e(z, { direction: "column", gap: "4", children: o.elements.map((S, $) => /* @__PURE__ */ e(
612
+ ce,
3722
613
  {
3723
- uischema: N,
3724
- schema: t,
614
+ uischema: S,
615
+ schema: r,
3725
616
  path: n,
3726
- renderers: r,
3727
- cells: o,
3728
- enabled: a
617
+ renderers: a,
618
+ cells: y,
619
+ enabled: h
3729
620
  },
3730
- `${n}-${y}-${x}`
3731
- )) }) }, `${n}-${y}`)) })
621
+ `${n}-${u}-${$}`
622
+ )) }) }, `${n}-${u}`)) })
3732
623
  ] });
3733
- }, ei = he(1, Ge("Categorization"));
3734
- function ti(e) {
3735
- return e ? Array.isArray(e) ? e : [e] : [];
3736
- }
3737
- function Ze(e) {
3738
- return e >= 1024 * 1024 ? `${(e / (1024 * 1024)).toFixed(0)} MB` : e >= 1024 ? `${(e / 1024).toFixed(0)} KB` : `${e} B`;
3739
- }
3740
- function Le(e) {
3741
- return e.split(",").map((t) => {
3742
- if (t = t.trim(), t.endsWith("/*"))
3743
- return t.split("/")[0].toUpperCase() + "S";
3744
- if (t.startsWith("."))
3745
- return t.slice(1).toUpperCase();
3746
- const n = t.split("/")[1];
3747
- return n ? n.toUpperCase() : t;
624
+ }, Nr = D(1, ie("Categorization"));
625
+ function Pr(t) {
626
+ return t ? Array.isArray(t) ? t : [t] : [];
627
+ }
628
+ function fe(t) {
629
+ return t >= 1024 * 1024 ? `${(t / (1024 * 1024)).toFixed(0)} MB` : t >= 1024 ? `${(t / 1024).toFixed(0)} KB` : `${t} B`;
630
+ }
631
+ function pe(t) {
632
+ return t.split(",").map((r) => {
633
+ if (r = r.trim(), r.endsWith("/*"))
634
+ return r.split("/")[0].toUpperCase() + "S";
635
+ if (r.startsWith("."))
636
+ return r.slice(1).toUpperCase();
637
+ const n = r.split("/")[1];
638
+ return n ? n.toUpperCase() : r;
3748
639
  }).join(", ");
3749
640
  }
3750
- const ni = ({
3751
- data: e,
3752
- handleChange: t,
641
+ const Br = ({
642
+ data: t,
643
+ handleChange: r,
3753
644
  path: n,
3754
- label: r,
3755
- required: o,
3756
- uischema: a,
645
+ label: a,
646
+ required: y,
647
+ uischema: h,
3757
648
  schema: s,
3758
- enabled: i,
3759
- errors: c,
3760
- visible: u = !0
649
+ enabled: v,
650
+ errors: d,
651
+ visible: g = !0
3761
652
  }) => {
3762
- const l = Cr();
3763
- if (We(() => {
3764
- u === !1 && t(n, null);
3765
- }, [u, n, t]), u === !1)
3766
- return null;
3767
- const d = !c || c.length === 0, h = (s == null ? void 0 : s["x-file"]) ?? {}, m = (a == null ? void 0 : a.options) ?? {}, y = h.maxFiles ?? m.maxFiles ?? 1, N = h.maxSize ?? m.maxSize ?? 5 * 1024 * 1024, x = h.accept ?? m.accept ?? "image/*,application/pdf", P = y > 1, b = i !== !1, [v, C] = Ne(!1), [S, f] = Ne(null), [I, j] = Ne({}), q = Ie(/* @__PURE__ */ new Set()), _ = Ie(null), Y = ti(e), ee = Y.length >= y;
3768
- We(() => () => {
3769
- q.current.forEach((M) => URL.revokeObjectURL(M)), q.current.clear();
653
+ const l = ir();
654
+ ee(g, n, r, null);
655
+ const x = !d || d.length === 0, p = (s == null ? void 0 : s["x-file"]) ?? {}, o = (h == null ? void 0 : h.options) ?? {}, u = p.maxFiles ?? o.maxFiles ?? 1, S = p.maxSize ?? o.maxSize ?? 5 * 1024 * 1024, $ = p.accept ?? o.accept ?? "image/*,application/pdf", w = u > 1, R = v !== !1, [k, V] = A(!1), [O, j] = A(null), [te, N] = A({}), re = Q(/* @__PURE__ */ new Set()), U = Q(null), I = Pr(t), B = I.length >= u;
656
+ X(() => () => {
657
+ re.current.forEach((i) => URL.revokeObjectURL(i)), re.current.clear();
3770
658
  }, []);
3771
- const re = le(
3772
- async (M) => {
3773
- if (f(null), Y.length >= y) {
3774
- f(`Maximum ${y} file${y > 1 ? "s" : ""} allowed.`);
659
+ const ne = Te(
660
+ async (i) => {
661
+ if (j(null), I.length >= u) {
662
+ j(`Maximum ${u} file${u > 1 ? "s" : ""} allowed.`);
3775
663
  return;
3776
664
  }
3777
- if (M.size > N) {
3778
- f(`File exceeds the ${Ze(N)} limit.`);
665
+ if (i.size > S) {
666
+ j(`File exceeds the ${fe(S)} limit.`);
3779
667
  return;
3780
668
  }
3781
- if (!x.split(",").map((E) => E.trim()).some((E) => E === "*" || E === "*/*" ? !0 : E.endsWith("/*") ? M.type.startsWith(E.slice(0, -1)) : E.startsWith(".") ? M.name.toLowerCase().endsWith(E.toLowerCase()) : M.type === E)) {
3782
- f(`Invalid type. Accepted: ${Le(x)}`);
669
+ if (!$.split(",").map((b) => b.trim()).some((b) => b === "*" || b === "*/*" ? !0 : b.endsWith("/*") ? i.type.startsWith(b.slice(0, -1)) : b.startsWith(".") ? i.name.toLowerCase().endsWith(b.toLowerCase()) : i.type === b)) {
670
+ j(`Invalid type. Accepted: ${pe($)}`);
3783
671
  return;
3784
672
  }
3785
673
  if (!(l != null && l.onUpload)) {
3786
- f("Upload service not configured.");
674
+ j("Upload service not configured.");
3787
675
  return;
3788
676
  }
3789
677
  try {
3790
- const E = await l.onUpload(M), J = URL.createObjectURL(M);
3791
- q.current.add(J);
3792
- const se = { key: E.key, name: E.name ?? M.name, blobUrl: J };
3793
- j((ue) => ({ ...ue, [E.key]: se }));
3794
- const ae = [...Y, E.key];
3795
- t(n, P ? ae : ae[0]);
678
+ const b = await l.onUpload(i), L = URL.createObjectURL(i);
679
+ re.current.add(L);
680
+ const P = { key: b.key, name: b.name ?? i.name, blobUrl: L };
681
+ N((G) => ({ ...G, [b.key]: P }));
682
+ const K = [...I, b.key];
683
+ r(n, w ? K : K[0]);
3796
684
  } catch {
3797
- f("Upload failed. Please try again."), _.current && (_.current.value = "");
685
+ j("Upload failed. Please try again."), U.current && (U.current.value = "");
3798
686
  }
3799
687
  },
3800
- [Y, y, N, x, l, n, t, P]
3801
- ), W = (M) => {
3802
- M.preventDefault(), M.stopPropagation(), !(!b || ee) && C(M.type === "dragenter" || M.type === "dragover");
3803
- }, D = (M) => {
3804
- var B;
3805
- M.preventDefault(), M.stopPropagation(), C(!1), !(!b || ee) && (B = M.dataTransfer.files) != null && B[0] && re(M.dataTransfer.files[0]);
3806
- }, w = (M) => {
3807
- var B;
3808
- (B = M.target.files) != null && B[0] && (re(M.target.files[0]), M.target.value = "");
3809
- }, T = (M) => {
3810
- if (!b) return;
3811
- j((G) => {
3812
- var se;
3813
- const E = { ...G }, J = (se = E[M]) == null ? void 0 : se.blobUrl;
3814
- return J && (URL.revokeObjectURL(J), q.current.delete(J)), delete E[M], E;
688
+ [I, u, S, $, l, n, r, w]
689
+ );
690
+ if (g === !1)
691
+ return null;
692
+ const M = (i) => {
693
+ i.preventDefault(), i.stopPropagation(), !(!R || B) && V(i.type === "dragenter" || i.type === "dragover");
694
+ }, oe = (i) => {
695
+ var T;
696
+ i.preventDefault(), i.stopPropagation(), V(!1), !(!R || B) && (T = i.dataTransfer.files) != null && T[0] && ne(i.dataTransfer.files[0]);
697
+ }, W = (i) => {
698
+ var T;
699
+ (T = i.target.files) != null && T[0] && (ne(i.target.files[0]), i.target.value = "");
700
+ }, le = (i) => {
701
+ if (!R) return;
702
+ N((F) => {
703
+ var P;
704
+ const b = { ...F }, L = (P = b[i]) == null ? void 0 : P.blobUrl;
705
+ return L && (URL.revokeObjectURL(L), re.current.delete(L)), delete b[i], b;
3815
706
  });
3816
- const B = Y.filter((G) => G !== M);
3817
- t(n, P ? B.length > 0 ? B : null : B[0] ?? null);
3818
- }, k = async (M, B) => {
3819
- var J, se, ae;
3820
- M.preventDefault();
3821
- const G = (J = I[B]) == null ? void 0 : J.blobUrl;
3822
- if (G) {
3823
- (se = window.open(G, "_blank", "noopener,noreferrer")) == null || se.focus();
707
+ const T = I.filter((F) => F !== i);
708
+ r(n, w ? T.length > 0 ? T : null : T[0] ?? null);
709
+ }, q = async (i, T) => {
710
+ var L, P, K;
711
+ i.preventDefault();
712
+ const F = (L = te[T]) == null ? void 0 : L.blobUrl;
713
+ if (F) {
714
+ (P = window.open(F, "_blank", "noopener,noreferrer")) == null || P.focus();
3824
715
  return;
3825
716
  }
3826
- const E = window.open("", "_blank");
3827
- if (E)
717
+ const b = window.open("", "_blank");
718
+ if (b)
3828
719
  try {
3829
- const ue = await ((ae = l == null ? void 0 : l.getDownloadUrl) == null ? void 0 : ae.call(l, B));
3830
- ue != null && ue.url ? E.location.href = ue.url : E.close();
720
+ const G = await ((K = l == null ? void 0 : l.getDownloadUrl) == null ? void 0 : K.call(l, T));
721
+ G != null && G.url ? b.location.href = G.url : b.close();
3831
722
  } catch {
3832
- E.close();
723
+ b.close();
3833
724
  }
3834
725
  };
3835
- if (!b && Y.length === 0) return null;
3836
- const $ = y - Y.length, F = b && !ee;
3837
- return /* @__PURE__ */ R(ie, { mb: "4", children: [
3838
- /* @__PURE__ */ R(te, { align: "center", justify: "between", mb: "2", children: [
3839
- /* @__PURE__ */ R(H, { as: "label", size: "2", weight: "bold", children: [
3840
- r,
3841
- o && /* @__PURE__ */ g(H, { color: "red", children: " *" })
726
+ if (!R && I.length === 0) return null;
727
+ const H = u - I.length, Z = R && !B;
728
+ return /* @__PURE__ */ f(C, { mb: "4", children: [
729
+ /* @__PURE__ */ f(z, { align: "center", justify: "between", mb: "2", children: [
730
+ /* @__PURE__ */ f(c, { as: "label", size: "2", weight: "bold", children: [
731
+ a,
732
+ y && /* @__PURE__ */ e(c, { color: "red", children: " *" })
3842
733
  ] }),
3843
- /* @__PURE__ */ g(H, { size: "1", color: "gray", children: P ? `Up to ${y} files · ${Ze(N)} each · ${Le(x)}` : `${Ze(N)} · ${Le(x)}` })
734
+ /* @__PURE__ */ e(c, { size: "1", color: "gray", children: w ? `Up to ${u} files · ${fe(S)} each · ${pe($)}` : `${fe(S)} · ${pe($)}` })
3844
735
  ] }),
3845
- Y.map((M) => {
3846
- var B;
3847
- return /* @__PURE__ */ g(tn, { size: "2", variant: "surface", mb: "2", children: /* @__PURE__ */ R(te, { align: "center", gap: "3", children: [
3848
- /* @__PURE__ */ g(
3849
- ie,
736
+ I.map((i) => {
737
+ var T;
738
+ return /* @__PURE__ */ e(De, { size: "2", variant: "surface", mb: "2", children: /* @__PURE__ */ f(z, { align: "center", gap: "3", children: [
739
+ /* @__PURE__ */ e(
740
+ C,
3850
741
  {
3851
742
  style: {
3852
743
  background: "var(--blue-3)",
@@ -3855,11 +746,11 @@ const ni = ({
3855
746
  color: "var(--blue-9)",
3856
747
  flexShrink: 0
3857
748
  },
3858
- children: /* @__PURE__ */ g(vr, { width: "20", height: "20" })
749
+ children: /* @__PURE__ */ e(Xe, { width: "20", height: "20" })
3859
750
  }
3860
751
  ),
3861
- /* @__PURE__ */ g(ie, { style: { flex: 1, overflow: "hidden" }, children: /* @__PURE__ */ g(
3862
- H,
752
+ /* @__PURE__ */ e(C, { style: { flex: 1, overflow: "hidden" }, children: /* @__PURE__ */ e(
753
+ c,
3863
754
  {
3864
755
  size: "2",
3865
756
  weight: "bold",
@@ -3869,204 +760,208 @@ const ni = ({
3869
760
  textOverflow: "ellipsis",
3870
761
  whiteSpace: "nowrap"
3871
762
  },
3872
- children: ((B = I[M]) == null ? void 0 : B.name) ?? "Uploaded File"
763
+ children: ((T = te[i]) == null ? void 0 : T.name) ?? "Uploaded File"
3873
764
  }
3874
765
  ) }),
3875
- /* @__PURE__ */ R(te, { align: "center", gap: "2", style: { flexShrink: 0 }, children: [
3876
- /* @__PURE__ */ g(rt, { variant: "soft", color: "blue", size: "1", onClick: (G) => k(G, M), children: "View" }),
3877
- /* @__PURE__ */ g(Dr, { style: { color: "var(--green-9)", width: 18, height: 18 } }),
3878
- b && /* @__PURE__ */ g(br, { variant: "ghost", color: "gray", onClick: () => T(M), children: /* @__PURE__ */ g(kr, {}) })
766
+ /* @__PURE__ */ f(z, { align: "center", gap: "2", style: { flexShrink: 0 }, children: [
767
+ /* @__PURE__ */ e(he, { variant: "soft", color: "blue", size: "1", onClick: (F) => q(F, i), children: "View" }),
768
+ /* @__PURE__ */ e(Ye, { style: { color: "var(--green-9)", width: 18, height: 18 } }),
769
+ R && /* @__PURE__ */ e(Ze, { variant: "ghost", color: "gray", onClick: () => le(i), children: /* @__PURE__ */ e(er, {}) })
3879
770
  ] })
3880
- ] }) }, M);
771
+ ] }) }, i);
3881
772
  }),
3882
- F && /* @__PURE__ */ R(
773
+ Z && /* @__PURE__ */ f(
3883
774
  "div",
3884
775
  {
3885
776
  role: "button",
3886
777
  tabIndex: 0,
3887
778
  onClick: () => {
3888
- var M;
3889
- return (M = _.current) == null ? void 0 : M.click();
779
+ var i;
780
+ return (i = U.current) == null ? void 0 : i.click();
3890
781
  },
3891
- onKeyDown: (M) => {
3892
- var B;
3893
- (M.key === "Enter" || M.key === " ") && (M.preventDefault(), (B = _.current) == null || B.click());
782
+ onKeyDown: (i) => {
783
+ var T;
784
+ (i.key === "Enter" || i.key === " ") && (i.preventDefault(), (T = U.current) == null || T.click());
3894
785
  },
3895
- onDragEnter: W,
3896
- onDragLeave: W,
3897
- onDragOver: W,
3898
- onDrop: D,
786
+ onDragEnter: M,
787
+ onDragLeave: M,
788
+ onDragOver: M,
789
+ onDrop: oe,
3899
790
  style: { cursor: "pointer" },
3900
791
  className: [
3901
792
  "border-2 border-dashed rounded-lg p-6 text-center",
3902
793
  "transition-all duration-200 ease-in-out",
3903
- v ? "border-blue-500 bg-blue-50" : S ? "border-red-300 bg-red-50" : "border-gray-300 hover:border-blue-400 hover:bg-gray-50"
794
+ k ? "border-blue-500 bg-blue-50" : O ? "border-red-300 bg-red-50" : "border-gray-300 hover:border-blue-400 hover:bg-gray-50"
3904
795
  ].join(" "),
3905
796
  children: [
3906
- /* @__PURE__ */ g("input", { ref: _, type: "file", style: { display: "none" }, accept: x, onChange: w }),
3907
- /* @__PURE__ */ g(te, { direction: "column", align: "center", gap: "2", children: S ? /* @__PURE__ */ R($t, { children: [
3908
- /* @__PURE__ */ g(Or, { style: { width: 32, height: 32, color: "var(--red-9)" } }),
3909
- /* @__PURE__ */ g(H, { size: "2", color: "red", weight: "medium", children: S }),
3910
- /* @__PURE__ */ g(H, { size: "1", color: "gray", children: "Click to try again" })
3911
- ] }) : /* @__PURE__ */ R($t, { children: [
3912
- /* @__PURE__ */ g(pr, { style: { width: 32, height: 32, color: "var(--gray-8)" } }),
3913
- /* @__PURE__ */ g(H, { size: "2", weight: "medium", children: Y.length > 0 ? `Add another file (${$} remaining)` : "Click to upload or drag and drop" }),
3914
- /* @__PURE__ */ R(H, { size: "1", color: "gray", children: [
3915
- Ze(N),
797
+ /* @__PURE__ */ e("input", { ref: U, type: "file", style: { display: "none" }, accept: $, onChange: W }),
798
+ /* @__PURE__ */ e(z, { direction: "column", align: "center", gap: "2", children: O ? /* @__PURE__ */ f(be, { children: [
799
+ /* @__PURE__ */ e(rr, { style: { width: 32, height: 32, color: "var(--red-9)" } }),
800
+ /* @__PURE__ */ e(c, { size: "2", color: "red", weight: "medium", children: O }),
801
+ /* @__PURE__ */ e(c, { size: "1", color: "gray", children: "Click to try again" })
802
+ ] }) : /* @__PURE__ */ f(be, { children: [
803
+ /* @__PURE__ */ e(tr, { style: { width: 32, height: 32, color: "var(--gray-8)" } }),
804
+ /* @__PURE__ */ e(c, { size: "2", weight: "medium", children: I.length > 0 ? `Add another file (${H} remaining)` : "Click to upload or drag and drop" }),
805
+ /* @__PURE__ */ f(c, { size: "1", color: "gray", children: [
806
+ fe(S),
3916
807
  " max · ",
3917
- Le(x)
808
+ pe($)
3918
809
  ] })
3919
810
  ] }) })
3920
811
  ]
3921
812
  }
3922
813
  ),
3923
- b && ee && P && /* @__PURE__ */ R(H, { size: "1", color: "gray", mt: "1", style: { display: "block", textAlign: "center" }, children: [
814
+ R && B && w && /* @__PURE__ */ f(c, { size: "1", color: "gray", mt: "1", style: { display: "block", textAlign: "center" }, children: [
3924
815
  "Maximum ",
3925
- y,
816
+ u,
3926
817
  " files uploaded. Remove one to replace it."
3927
818
  ] }),
3928
- !d && /* @__PURE__ */ g(H, { color: "red", size: "1", mt: "2", style: { display: "block" }, children: $e(c, r) })
819
+ !x && /* @__PURE__ */ e(c, { color: "red", size: "1", mt: "2", style: { display: "block" }, children: _(d, a) })
3929
820
  ] });
3930
- }, ri = Ye(ni), oi = he(
821
+ }, Mr = J(Br), Wr = D(
3931
822
  10,
3932
823
  // high rank to beat default array renderer
3933
- dr(
824
+ We(
3934
825
  // Match both single-file (type: string) and multi-file (type: array)
3935
- fr((e) => {
3936
- if (e.type === "string" && e.format === "file") return !0;
3937
- if (e.type === "array") {
3938
- const t = e.items;
3939
- return (t == null ? void 0 : t.type) === "string" && (t == null ? void 0 : t.format) === "file";
826
+ $e((t) => {
827
+ if (t.type === "string" && t.format === "file") return !0;
828
+ if (t.type === "array") {
829
+ const r = t.items;
830
+ return (r == null ? void 0 : r.type) === "string" && (r == null ? void 0 : r.format) === "file";
3940
831
  }
3941
832
  return !1;
3942
833
  })
3943
834
  )
3944
- ), ai = ({
3945
- data: e,
3946
- path: t,
835
+ ), Hr = ({
836
+ data: t,
837
+ path: r,
3947
838
  schema: n,
3948
- uischema: r,
3949
- enabled: o,
3950
- visible: a,
839
+ uischema: a,
840
+ enabled: y,
841
+ visible: h,
3951
842
  addItem: s,
3952
- removeItems: i,
3953
- rootSchema: c,
3954
- arraySchema: u
843
+ removeItems: v,
844
+ rootSchema: d,
845
+ arraySchema: g
3955
846
  }) => {
3956
- const l = u ? n : n.items, d = u || n;
3957
- if (a === !1 || !l || typeof l != "object" || Array.isArray(l))
847
+ const l = g ? n : n.items, x = g || n;
848
+ if (h === !1 || !l || typeof l != "object" || Array.isArray(l))
3958
849
  return null;
3959
- const h = l, m = Array.isArray(e) ? e : [], y = d.title || "Array Items", N = () => {
3960
- const P = hr(h, c);
3961
- s && s(t, P)();
3962
- }, x = (P) => {
3963
- if (i) {
3964
- const b = i(t, [P]);
3965
- b && b();
850
+ const p = l, o = Array.isArray(t) ? t : [], u = x.title || "Array Items", S = () => {
851
+ const w = He(p, d);
852
+ s && s(r, w)();
853
+ }, $ = (w) => {
854
+ if (v) {
855
+ const R = v(r, [w]);
856
+ R && R();
3966
857
  }
3967
858
  };
3968
- return /* @__PURE__ */ g(ie, { mb: "6", children: /* @__PURE__ */ R(te, { direction: "column", gap: "4", children: [
3969
- /* @__PURE__ */ g(H, { as: "div", size: "4", weight: "bold", children: y }),
3970
- m.length === 0 && /* @__PURE__ */ g(ie, { py: "4", px: "4", style: { backgroundColor: "var(--gray-3)", borderRadius: "var(--radius-3)" }, children: /* @__PURE__ */ g(H, { size: "2", color: "gray", children: "No items have been added yet." }) }),
3971
- m.map((P, b) => {
3972
- var C;
3973
- const v = `${t}.${b}`;
3974
- return /* @__PURE__ */ g(tn, { size: "3", variant: "surface", children: /* @__PURE__ */ R(te, { direction: "column", gap: "4", children: [
3975
- /* @__PURE__ */ R(te, { justify: "between", align: "center", children: [
3976
- /* @__PURE__ */ R(H, { size: "3", weight: "bold", children: [
859
+ return /* @__PURE__ */ e(C, { mb: "6", children: /* @__PURE__ */ f(z, { direction: "column", gap: "4", children: [
860
+ /* @__PURE__ */ e(c, { as: "div", size: "4", weight: "bold", children: u }),
861
+ o.length === 0 && /* @__PURE__ */ e(C, { py: "4", px: "4", style: { backgroundColor: "var(--gray-3)", borderRadius: "var(--radius-3)" }, children: /* @__PURE__ */ e(c, { size: "2", color: "gray", children: "No items have been added yet." }) }),
862
+ o.map((w, R) => {
863
+ var V;
864
+ const k = `${r}.${R}`;
865
+ return /* @__PURE__ */ e(De, { size: "3", variant: "surface", children: /* @__PURE__ */ f(z, { direction: "column", gap: "4", children: [
866
+ /* @__PURE__ */ f(z, { justify: "between", align: "center", children: [
867
+ /* @__PURE__ */ f(c, { size: "3", weight: "bold", children: [
3977
868
  "Item ",
3978
- b + 1
869
+ R + 1
3979
870
  ] }),
3980
- o && /* @__PURE__ */ R(
3981
- rt,
871
+ y && /* @__PURE__ */ f(
872
+ he,
3982
873
  {
3983
874
  type: "button",
3984
875
  color: "red",
3985
876
  variant: "soft",
3986
- onClick: () => x(b),
877
+ onClick: () => $(R),
3987
878
  title: "Remove item",
3988
879
  children: [
3989
- /* @__PURE__ */ g(Sr, {}),
880
+ /* @__PURE__ */ e(nr, {}),
3990
881
  "Remove"
3991
882
  ]
3992
883
  }
3993
884
  )
3994
885
  ] }),
3995
- /* @__PURE__ */ g(ie, { children: /* @__PURE__ */ g(
3996
- Ve,
886
+ /* @__PURE__ */ e(C, { children: /* @__PURE__ */ e(
887
+ ce,
3997
888
  {
3998
- schema: h,
3999
- uischema: ((C = r.options) == null ? void 0 : C.detail) || (h.type === "object" || h.properties ? {
889
+ schema: p,
890
+ uischema: ((V = a.options) == null ? void 0 : V.detail) || (p.type === "object" || p.properties ? {
4000
891
  type: "VerticalLayout",
4001
- elements: Object.keys(h.properties || {}).map((S) => ({
892
+ elements: Object.keys(p.properties || {}).map((O) => ({
4002
893
  type: "Control",
4003
- scope: `#/properties/${S}`
894
+ scope: `#/properties/${O}`
4004
895
  }))
4005
896
  } : {
4006
897
  type: "Control",
4007
898
  scope: "#"
4008
899
  }),
4009
- path: v,
4010
- enabled: o,
900
+ path: k,
901
+ enabled: y,
4011
902
  renderers: void 0,
4012
903
  cells: void 0
4013
904
  }
4014
905
  ) })
4015
- ] }) }, v);
906
+ ] }) }, k);
4016
907
  }),
4017
- o && /* @__PURE__ */ g(ie, { mt: "2", children: /* @__PURE__ */ R(rt, { type: "button", variant: "surface", onClick: N, children: [
4018
- /* @__PURE__ */ g(Wr, {}),
908
+ y && /* @__PURE__ */ e(C, { mt: "2", children: /* @__PURE__ */ f(he, { type: "button", variant: "surface", onClick: S, children: [
909
+ /* @__PURE__ */ e(or, {}),
4019
910
  "Add Item"
4020
911
  ] }) })
4021
912
  ] }) });
4022
- }, Xt = gr(ai), si = he(3, mr), ii = ({ uischema: e, visible: t }) => {
4023
- const n = e;
4024
- return t === !1 ? null : /* @__PURE__ */ g(ie, { mb: "4", children: /* @__PURE__ */ g(en, { size: "4", children: n.text }) });
4025
- }, ci = he(1, Ge("Label")), ui = he(3, yr), wi = [
4026
- { tester: Tr, renderer: xr },
4027
- { tester: $r, renderer: Fr },
4028
- { tester: _r, renderer: Er },
4029
- { tester: Br, renderer: Ar },
4030
- { tester: Hr, renderer: jr },
4031
- { tester: Us, renderer: Gs },
4032
- { tester: Qs, renderer: Vs },
4033
- { tester: Ks, renderer: Xs },
4034
- { tester: Zs, renderer: Js },
4035
- { tester: ei, renderer: Ls },
4036
- { tester: oi, renderer: ri },
4037
- { tester: si, renderer: Xt },
4038
- { tester: ui, renderer: Xt },
4039
- { tester: ci, renderer: ii }
913
+ }, xe = Je(Hr), Kr = D(3, Ke), Gr = ({ uischema: t, visible: r }) => {
914
+ const n = t;
915
+ return r === !1 ? null : /* @__PURE__ */ e(C, { mb: "4", children: /* @__PURE__ */ e(Fe, { size: "4", children: n.text }) });
916
+ }, Jr = D(1, ie("Label")), _r = D(3, Ge), ot = [
917
+ { tester: ar, renderer: dr },
918
+ { tester: fr, renderer: pr },
919
+ { tester: gr, renderer: mr },
920
+ { tester: vr, renderer: br },
921
+ { tester: Rr, renderer: Tr },
922
+ { tester: Cr, renderer: xr },
923
+ { tester: Dr, renderer: Or },
924
+ { tester: Lr, renderer: Ir },
925
+ { tester: Ur, renderer: Ar },
926
+ { tester: Vr, renderer: Er },
927
+ { tester: Nr, renderer: jr },
928
+ { tester: Wr, renderer: Mr },
929
+ { tester: Kr, renderer: xe },
930
+ { tester: _r, renderer: xe },
931
+ { tester: Jr, renderer: Gr }
4040
932
  ];
4041
933
  export {
4042
- Xt as ArrayControl,
4043
- si as ArrayControlTester,
4044
- Pr as BooleanControl,
4045
- _r as BooleanControlTester,
4046
- Ls as CategorizationLayoutRenderer,
4047
- ei as CategorizationLayoutTester,
4048
- qs as DateControl,
4049
- Us as DateControlTester,
4050
- ri as FileControl,
4051
- oi as FileControlTester,
4052
- Js as GroupLayoutRenderer,
4053
- Zs as GroupLayoutTester,
4054
- Xs as HorizontalLayoutRenderer,
4055
- Ks as HorizontalLayoutTester,
4056
- ii as LabelRenderer,
4057
- ci as LabelTester,
4058
- Yr as NumberControl,
4059
- $r as NumberControlTester,
4060
- Ir as RadioControl,
4061
- Br as RadioControlTester,
4062
- zr as SelectControl,
4063
- Hr as SelectControlTester,
4064
- Nr as TextControl,
4065
- Tr as TextControlTester,
4066
- gi as UploadProvider,
4067
- Vs as VerticalLayoutRenderer,
4068
- Qs as VerticalLayoutTester,
4069
- $e as getErrorMessage,
4070
- wi as radixRenderers,
4071
- Cr as useUpload
934
+ xe as ArrayControl,
935
+ Kr as ArrayControlTester,
936
+ hr as BooleanControl,
937
+ gr as BooleanControlTester,
938
+ jr as CategorizationLayoutRenderer,
939
+ Nr as CategorizationLayoutTester,
940
+ Fr as DateControl,
941
+ Dr as DateControlTester,
942
+ Mr as FileControl,
943
+ Wr as FileControlTester,
944
+ Er as GroupLayoutRenderer,
945
+ Vr as GroupLayoutTester,
946
+ Ar as HorizontalLayoutRenderer,
947
+ Ur as HorizontalLayoutTester,
948
+ Gr as LabelRenderer,
949
+ Jr as LabelTester,
950
+ ur as NumberControl,
951
+ fr as NumberControlTester,
952
+ yr as RadioControl,
953
+ vr as RadioControlTester,
954
+ Tr as SearchSelectControl,
955
+ Rr as SearchSelectControlTester,
956
+ nt as SearchServiceProvider,
957
+ wr as SelectControl,
958
+ Cr as SelectControlTester,
959
+ sr as TextControl,
960
+ ar as TextControlTester,
961
+ tt as UploadProvider,
962
+ Ir as VerticalLayoutRenderer,
963
+ Lr as VerticalLayoutTester,
964
+ ot as radixRenderers,
965
+ cr as useSearchService,
966
+ ir as useUpload
4072
967
  };