@directo-ui/web 1.1.0 → 1.2.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.
package/dist/wari.js CHANGED
@@ -1,7 +1,7 @@
1
- import { useEffect as e, useId as t, useMemo as n, useRef as r, useState as i } from "react";
2
- import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime";
1
+ import { useEffect as e, useId as t, useLayoutEffect as n, useMemo as r, useRef as i, useState as a } from "react";
2
+ import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
3
3
  //#region src/wari/statuses.ts
4
- var c = [
4
+ var l = [
5
5
  {
6
6
  value: "libre",
7
7
  label: "Libre"
@@ -42,16 +42,16 @@ var c = [
42
42
  value: "empalmado",
43
43
  label: "Empalmado"
44
44
  }
45
- ], l = (e) => c.find((t) => t.value === e)?.label ?? e;
45
+ ], u = (e) => l.find((t) => t.value === e)?.label ?? e;
46
46
  //#endregion
47
47
  //#region src/wari/StatusTag.tsx
48
- function u({ status: e, size: t = "md", color: n, children: r, className: i, style: a, ...s }) {
48
+ function d({ status: e, size: t = "md", color: n, children: r, className: i, style: a, ...o }) {
49
49
  let c = n ? {
50
50
  "--ds-status-bg": n.background,
51
51
  "--ds-status-fg": n.foreground
52
- } : void 0, u = r ?? (e && e !== "todos" ? l(e) : "Todos");
53
- return /* @__PURE__ */ o("span", {
54
- ...s,
52
+ } : void 0, l = r ?? (e && e !== "todos" ? u(e) : "Todos");
53
+ return /* @__PURE__ */ s("span", {
54
+ ...o,
55
55
  className: ["ds-status", i].filter(Boolean).join(" "),
56
56
  "data-status": e,
57
57
  "data-size": t,
@@ -59,166 +59,166 @@ function u({ status: e, size: t = "md", color: n, children: r, className: i, sty
59
59
  ...c,
60
60
  ...a
61
61
  } : a,
62
- children: /* @__PURE__ */ o("span", { children: u })
62
+ children: /* @__PURE__ */ s("span", { children: l })
63
63
  });
64
64
  }
65
65
  //#endregion
66
66
  //#region src/wari/logic.ts
67
- function d(e) {
67
+ function f(e) {
68
68
  return e.normalize("NFD").replace(/\p{Diacritic}/gu, "").toLowerCase().trim();
69
69
  }
70
- function f(e, t) {
71
- let n = d(t);
72
- return n ? e.filter((e) => d(e.label).includes(n)) : [...e];
73
- }
74
70
  function p(e, t) {
71
+ let n = f(t);
72
+ return n ? e.filter((e) => f(e.label).includes(n)) : [...e];
73
+ }
74
+ function m(e, t) {
75
75
  let n = new Set(e);
76
76
  return t.filter((e) => n.has(e.value)).map((e) => e.value);
77
77
  }
78
- function m(e, t, n) {
78
+ function h(e, t, n) {
79
79
  let r = n.find((e) => e.value === t);
80
80
  if (!r || r.disabled) return [...e];
81
81
  let i = new Set(e);
82
- return i.has(t) ? i.delete(t) : i.add(t), p(i, n);
82
+ return i.has(t) ? i.delete(t) : i.add(t), m(i, n);
83
83
  }
84
- function h(e, t) {
84
+ function g(e, t) {
85
85
  let n = t.filter((e) => !e.disabled), r = n.filter((t) => e.includes(t.value)).length;
86
86
  return r === 0 ? "none" : r === n.length ? "all" : "some";
87
87
  }
88
- function g(e, t) {
88
+ function _(e, t) {
89
89
  let n = t.filter((t) => t.disabled && e.includes(t.value)).map((e) => e.value);
90
- return h(e, t) === "all" ? p(n, t) : p([...n, ...t.filter((e) => !e.disabled).map((e) => e.value)], t);
90
+ return g(e, t) === "all" ? m(n, t) : m([...n, ...t.filter((e) => !e.disabled).map((e) => e.value)], t);
91
91
  }
92
- function _(e) {
92
+ function v(e) {
93
93
  return e <= 0 ? "" : e === 1 ? "1 elemento seleccionado" : `${e} elementos seleccionados`;
94
94
  }
95
95
  //#endregion
96
96
  //#region src/wari/MultiSelect.tsx
97
- var v = Symbol("all");
98
- function y({ options: a, value: c, defaultValue: l, onChange: d, label: p, "aria-label": y, placeholder: b = "Seleccionar", searchPlaceholder: x = "Buscar…", allLabel: S = "Todos", maxTags: C = 2, supportingText: w, summary: T = !0, emptyMessage: E = "Sin coincidencias", error: D = !1, disabled: O = !1, required: k, name: A, id: j, className: M, size: N = "md" }) {
99
- let P = t(), F = j ?? P, I = `${F}-listbox`, L = `${F}-label`, ee = `${F}-hint`, R = (e) => `${F}-option-${e}`, [z, te] = i(() => l ?? []), B = c ?? z, [V, H] = i(!1), [U, ne] = i(""), [re, W] = i(0), ie = r(null), G = r(null), ae = n(() => f(a, U), [a, U]), K = S && !U && a.length > 0 ? [v, ...ae] : ae, q = Math.min(re, K.length - 1), J = h(B, a), oe = a.some((e) => e.status || e.color), Y = a.filter((e) => B.includes(e.value)).length, se = w ?? (T === !1 ? "" : typeof T == "function" ? T(Y, a.length) : _(Y));
97
+ var y = Symbol("all");
98
+ function b({ options: n, value: o, defaultValue: l, onChange: u, label: f, "aria-label": m, placeholder: b = "Seleccionar", searchPlaceholder: x = "Buscar…", allLabel: S = "Todos", maxTags: C = 2, supportingText: w, summary: T = !0, emptyMessage: E = "Sin coincidencias", error: D = !1, disabled: O = !1, required: k, name: A, id: j, className: M, size: N = "md" }) {
99
+ let P = t(), F = j ?? P, I = `${F}-listbox`, L = `${F}-label`, R = `${F}-hint`, ee = (e) => `${F}-option-${e}`, [z, B] = a(() => l ?? []), V = o ?? z, [H, te] = a(!1), [U, ne] = a(""), [re, W] = a(0), ie = i(null), G = i(null), ae = r(() => p(n, U), [n, U]), K = S && !U && n.length > 0 ? [y, ...ae] : ae, q = Math.min(re, K.length - 1), J = g(V, n), oe = n.some((e) => e.status || e.color), Y = n.filter((e) => V.includes(e.value)).length, se = w ?? (T === !1 ? "" : typeof T == "function" ? T(Y, n.length) : v(Y));
100
100
  e(() => {
101
- if (!V) return;
101
+ if (!H) return;
102
102
  let e = (e) => {
103
- ie.current?.contains(e.target) || (H(!1), ne(""));
103
+ ie.current?.contains(e.target) || (te(!1), ne(""));
104
104
  };
105
105
  return document.addEventListener("pointerdown", e), () => document.removeEventListener("pointerdown", e);
106
- }, [V]), e(() => {
107
- V && q >= 0 && document.getElementById(`${F}-option-${q}`)?.scrollIntoView?.({ block: "nearest" });
106
+ }, [H]), e(() => {
107
+ H && q >= 0 && document.getElementById(`${F}-option-${q}`)?.scrollIntoView?.({ block: "nearest" });
108
108
  }, [
109
- V,
109
+ H,
110
110
  q,
111
111
  F
112
112
  ]);
113
113
  let X = (e) => {
114
- c === void 0 && te(e), d?.(e);
115
- }, Z = () => {
116
- H(!1), ne("");
117
- }, Q = (e) => {
118
- O || (H(!0), W(e));
119
- }, $ = (e) => X(e === v ? g(B, a) : m(B, e.value, a)), ce = (e, t, n) => oe ? /* @__PURE__ */ o(u, {
114
+ o === void 0 && B(e), u?.(e);
115
+ }, ce = () => {
116
+ te(!1), ne("");
117
+ }, Z = (e) => {
118
+ O || (te(!0), W(e));
119
+ }, Q = (e) => X(e === y ? _(V, n) : h(V, e.value, n)), le = (e, t, n) => oe ? /* @__PURE__ */ s(d, {
120
120
  status: t,
121
121
  color: n,
122
122
  children: e
123
- }) : /* @__PURE__ */ o("span", {
123
+ }) : /* @__PURE__ */ s("span", {
124
124
  className: "ds-multiselect-option-label",
125
125
  children: e
126
- }), le = (e) => {
126
+ }), ue = (e) => {
127
127
  let t = K.length - 1;
128
128
  switch (e.key) {
129
129
  case "ArrowDown":
130
- e.preventDefault(), V ? W(Math.min(q + 1, t)) : Q(0);
130
+ e.preventDefault(), H ? W(Math.min(q + 1, t)) : Z(0);
131
131
  break;
132
132
  case "ArrowUp":
133
- e.preventDefault(), V ? W(Math.max(q - 1, 0)) : Q(t);
133
+ e.preventDefault(), H ? W(Math.max(q - 1, 0)) : Z(t);
134
134
  break;
135
135
  case "Home":
136
136
  case "End":
137
- V && (e.preventDefault(), W(e.key === "Home" ? 0 : t));
137
+ H && (e.preventDefault(), W(e.key === "Home" ? 0 : t));
138
138
  break;
139
139
  case "Enter":
140
- e.preventDefault(), V ? K[q] && $(K[q]) : Q(0);
140
+ e.preventDefault(), H ? K[q] && Q(K[q]) : Z(0);
141
141
  break;
142
142
  case "Escape":
143
- V && (e.preventDefault(), U ? (ne(""), W(0)) : Z());
143
+ H && (e.preventDefault(), U ? (ne(""), W(0)) : ce());
144
144
  break;
145
- case "Tab": Z();
145
+ case "Tab": ce();
146
146
  }
147
- }, ue = (e) => {
148
- O || e.target === G.current || (e.preventDefault(), G.current?.focus(), V ? Z() : Q(0));
149
147
  }, de = (e) => {
148
+ O || e.target === G.current || (e.preventDefault(), G.current?.focus(), H ? ce() : Z(0));
149
+ }, $ = (e) => {
150
150
  let t = e.relatedTarget;
151
- t && !ie.current?.contains(t) && Z();
152
- }, fe = a.filter((e) => B.includes(e.value)), pe = Math.max(0, fe.length - C);
153
- return /* @__PURE__ */ s("div", {
151
+ t && !ie.current?.contains(t) && ce();
152
+ }, fe = n.filter((e) => V.includes(e.value)), pe = Math.max(0, fe.length - C);
153
+ return /* @__PURE__ */ c("div", {
154
154
  ref: ie,
155
155
  className: [
156
156
  "ds-input",
157
157
  "ds-multiselect",
158
158
  M
159
159
  ].filter(Boolean).join(" "),
160
- "data-open": V,
160
+ "data-open": H,
161
161
  "data-error": D,
162
162
  "data-disabled": O,
163
163
  "data-size": N,
164
- onBlur: de,
164
+ onBlur: $,
165
165
  children: [
166
- p && /* @__PURE__ */ s("label", {
166
+ f && /* @__PURE__ */ c("label", {
167
167
  id: L,
168
168
  htmlFor: F,
169
- children: [p, k && /* @__PURE__ */ o("span", {
169
+ children: [f, k && /* @__PURE__ */ s("span", {
170
170
  className: "ds-input-required",
171
171
  "aria-hidden": "true",
172
172
  children: "*"
173
173
  })]
174
174
  }),
175
- /* @__PURE__ */ s("div", {
175
+ /* @__PURE__ */ c("div", {
176
176
  className: "ds-multiselect-anchor",
177
- children: [/* @__PURE__ */ s("div", {
177
+ children: [/* @__PURE__ */ c("div", {
178
178
  className: "ds-input-shell",
179
- onMouseDown: ue,
179
+ onMouseDown: de,
180
180
  children: [
181
- Y > 0 && /* @__PURE__ */ s("div", {
181
+ Y > 0 && /* @__PURE__ */ c("div", {
182
182
  className: "ds-multiselect-values",
183
183
  "aria-hidden": "true",
184
- children: [J === "all" && S ? ce(S, "todos") : fe.slice(0, C).map((e) => /* @__PURE__ */ o("span", { children: ce(e.label, e.status, e.color) }, e.value)), !(J === "all" && S) && pe > 0 && /* @__PURE__ */ s("span", {
184
+ children: [J === "all" && S ? le(S, "todos") : fe.slice(0, C).map((e) => /* @__PURE__ */ s("span", { children: le(e.label, e.status, e.color) }, e.value)), !(J === "all" && S) && pe > 0 && /* @__PURE__ */ c("span", {
185
185
  className: "ds-multiselect-more",
186
186
  children: ["+", pe]
187
187
  })]
188
188
  }),
189
- /* @__PURE__ */ o("input", {
189
+ /* @__PURE__ */ s("input", {
190
190
  ref: G,
191
191
  id: F,
192
192
  className: "ds-multiselect-input",
193
193
  type: "text",
194
194
  role: "combobox",
195
195
  autoComplete: "off",
196
- "aria-expanded": V,
196
+ "aria-expanded": H,
197
197
  "aria-controls": I,
198
198
  "aria-autocomplete": "list",
199
- "aria-activedescendant": V && q >= 0 ? R(q) : void 0,
200
- "aria-label": p ? void 0 : y,
199
+ "aria-activedescendant": H && q >= 0 ? ee(q) : void 0,
200
+ "aria-label": f ? void 0 : m,
201
201
  "aria-invalid": D || void 0,
202
202
  "aria-required": k || void 0,
203
- "aria-describedby": se ? ee : void 0,
204
- placeholder: V ? x : Y ? "" : b,
203
+ "aria-describedby": se ? R : void 0,
204
+ placeholder: H ? x : Y ? "" : b,
205
205
  value: U,
206
206
  disabled: O,
207
207
  onChange: (e) => {
208
- ne(e.target.value), H(!0), W(0);
208
+ ne(e.target.value), te(!0), W(0);
209
209
  },
210
210
  onClick: () => {
211
- V || Q(0);
211
+ H || Z(0);
212
212
  },
213
- onKeyDown: le
213
+ onKeyDown: ue
214
214
  }),
215
- /* @__PURE__ */ o("button", {
215
+ /* @__PURE__ */ s("button", {
216
216
  type: "button",
217
217
  className: "ds-multiselect-caret",
218
218
  tabIndex: -1,
219
219
  "aria-hidden": "true",
220
220
  disabled: O,
221
- children: /* @__PURE__ */ o("svg", {
221
+ children: /* @__PURE__ */ s("svg", {
222
222
  width: "16",
223
223
  height: "16",
224
224
  viewBox: "0 0 16 16",
@@ -227,21 +227,21 @@ function y({ options: a, value: c, defaultValue: l, onChange: d, label: p, "aria
227
227
  strokeWidth: "1.8",
228
228
  strokeLinecap: "round",
229
229
  strokeLinejoin: "round",
230
- children: /* @__PURE__ */ o("path", { d: "m4 6 4 4 4-4" })
230
+ children: /* @__PURE__ */ s("path", { d: "m4 6 4 4 4-4" })
231
231
  })
232
232
  })
233
233
  ]
234
- }), V && /* @__PURE__ */ s("ul", {
234
+ }), H && /* @__PURE__ */ c("ul", {
235
235
  id: I,
236
236
  className: "ds-multiselect-list",
237
237
  role: "listbox",
238
238
  "aria-multiselectable": "true",
239
- "aria-labelledby": p ? L : void 0,
240
- "aria-label": p ? void 0 : y,
239
+ "aria-labelledby": f ? L : void 0,
240
+ "aria-label": f ? void 0 : m,
241
241
  children: [K.map((e, t) => {
242
- let n = e === v, r = !n && !!e.disabled, i = n ? J === "all" : B.includes(e.value);
243
- return /* @__PURE__ */ s("li", {
244
- id: R(t),
242
+ let n = e === y, r = !n && !!e.disabled, i = n ? J === "all" : V.includes(e.value);
243
+ return /* @__PURE__ */ c("li", {
244
+ id: ee(t),
245
245
  role: "option",
246
246
  className: "ds-multiselect-option",
247
247
  "aria-selected": i,
@@ -253,33 +253,33 @@ function y({ options: a, value: c, defaultValue: l, onChange: d, label: p, "aria
253
253
  t !== q && W(t);
254
254
  },
255
255
  onClick: () => {
256
- r || ($(e), W(t));
256
+ r || (Q(e), W(t));
257
257
  },
258
258
  children: [
259
- /* @__PURE__ */ o("span", {
259
+ /* @__PURE__ */ s("span", {
260
260
  className: "ds-multiselect-check",
261
261
  "aria-hidden": "true"
262
262
  }),
263
- n ? ce(S, "todos") : ce(e.label, e.status, e.color),
264
- !n && e.description != null && /* @__PURE__ */ o("span", {
263
+ n ? le(S, "todos") : le(e.label, e.status, e.color),
264
+ !n && e.description != null && /* @__PURE__ */ s("span", {
265
265
  className: "ds-multiselect-option-label",
266
266
  children: e.description
267
267
  })
268
268
  ]
269
269
  }, n ? "__all__" : e.value);
270
- }), K.length === 0 && /* @__PURE__ */ o("li", {
270
+ }), K.length === 0 && /* @__PURE__ */ s("li", {
271
271
  className: "ds-multiselect-empty",
272
272
  role: "presentation",
273
273
  children: E
274
274
  })]
275
275
  })]
276
276
  }),
277
- se && /* @__PURE__ */ o("small", {
278
- id: ee,
277
+ se && /* @__PURE__ */ s("small", {
278
+ id: R,
279
279
  "aria-live": "polite",
280
280
  children: se
281
281
  }),
282
- A && B.map((e) => /* @__PURE__ */ o("input", {
282
+ A && V.map((e) => /* @__PURE__ */ s("input", {
283
283
  type: "hidden",
284
284
  name: A,
285
285
  value: e
@@ -289,14 +289,14 @@ function y({ options: a, value: c, defaultValue: l, onChange: d, label: p, "aria
289
289
  }
290
290
  //#endregion
291
291
  //#region src/wari/WariStatusSelect.tsx
292
- function b({ statuses: e, descriptions: t, onChange: n, label: r = "Estado", ...i }) {
293
- let a = c.filter((t) => !e || e.includes(t.value)).map((e) => ({
292
+ function x({ statuses: e, descriptions: t, onChange: n, label: r = "Estado", ...i }) {
293
+ let a = l.filter((t) => !e || e.includes(t.value)).map((e) => ({
294
294
  value: e.value,
295
295
  label: e.label,
296
296
  status: e.value,
297
297
  description: t?.[e.value]
298
298
  }));
299
- return /* @__PURE__ */ o(y, {
299
+ return /* @__PURE__ */ s(b, {
300
300
  ...i,
301
301
  label: r,
302
302
  options: a,
@@ -305,11 +305,11 @@ function b({ statuses: e, descriptions: t, onChange: n, label: r = "Estado", ...
305
305
  }
306
306
  //#endregion
307
307
  //#region src/wari/datetime.ts
308
- var x = (e, t = 2) => String(e).padStart(t, "0");
309
- function S(e, t, n) {
310
- return `${x(e, 4)}-${x(t + 1)}-${x(n)}`;
308
+ var S = (e, t = 2) => String(e).padStart(t, "0");
309
+ function C(e, t, n) {
310
+ return `${S(e, 4)}-${S(t + 1)}-${S(n)}`;
311
311
  }
312
- function C(e) {
312
+ function w(e) {
313
313
  let t = /^(\d{4})-(\d{2})-(\d{2})$/.exec(e ?? "");
314
314
  if (!t) return null;
315
315
  let n = Number(t[1]), r = Number(t[2]) - 1, i = Number(t[3]), a = new Date(n, r, i);
@@ -319,37 +319,37 @@ function C(e) {
319
319
  day: i
320
320
  } : null;
321
321
  }
322
- function w(e = /* @__PURE__ */ new Date()) {
323
- return S(e.getFullYear(), e.getMonth(), e.getDate());
324
- }
325
- function T(e) {
326
- let t = C(e);
327
- return t ? `${x(t.day)}/${x(t.month + 1)}/${x(t.year % 100)}` : "";
322
+ function T(e = /* @__PURE__ */ new Date()) {
323
+ return C(e.getFullYear(), e.getMonth(), e.getDate());
328
324
  }
329
325
  function E(e) {
326
+ let t = w(e);
327
+ return t ? `${S(t.day)}/${S(t.month + 1)}/${S(t.year % 100)}` : "";
328
+ }
329
+ function D(e) {
330
330
  let t = /^\s*(\d{1,2})[/.-](\d{1,2})[/.-](\d{2}|\d{4})\s*$/.exec(e);
331
331
  if (!t) return null;
332
- let n = S(t[3].length === 2 ? 2e3 + Number(t[3]) : Number(t[3]), Number(t[2]) - 1, Number(t[1]));
333
- return C(n) ? n : null;
332
+ let n = C(t[3].length === 2 ? 2e3 + Number(t[3]) : Number(t[3]), Number(t[2]) - 1, Number(t[1]));
333
+ return w(n) ? n : null;
334
334
  }
335
- function D(e, t, n) {
335
+ function O(e, t, n) {
336
336
  return (!t || e >= t) && (!n || e <= n);
337
337
  }
338
- function O(e, t, n) {
338
+ function k(e, t, n) {
339
339
  let r = new Date(e, t + n, 1);
340
340
  return {
341
341
  year: r.getFullYear(),
342
342
  month: r.getMonth()
343
343
  };
344
344
  }
345
- function k(e, t, n = 0) {
345
+ function A(e, t, n = 0) {
346
346
  let r = (new Date(e, t, 1).getDay() - n + 7) % 7, i = [];
347
347
  for (let n = 0; n < 6; n++) {
348
348
  let a = [];
349
349
  for (let i = 0; i < 7; i++) {
350
350
  let o = new Date(e, t, 1 - r + n * 7 + i);
351
351
  a.push({
352
- iso: S(o.getFullYear(), o.getMonth(), o.getDate()),
352
+ iso: C(o.getFullYear(), o.getMonth(), o.getDate()),
353
353
  day: o.getDate(),
354
354
  outside: o.getMonth() !== t
355
355
  });
@@ -358,34 +358,34 @@ function k(e, t, n = 0) {
358
358
  }
359
359
  return i;
360
360
  }
361
- function A(e, t) {
362
- let n = C(e);
361
+ function j(e, t) {
362
+ let n = w(e);
363
363
  if (!n) return e;
364
364
  let r = new Date(n.year, n.month, n.day + t);
365
- return S(r.getFullYear(), r.getMonth(), r.getDate());
365
+ return C(r.getFullYear(), r.getMonth(), r.getDate());
366
366
  }
367
- function j(e, t) {
368
- let n = C(e);
367
+ function M(e, t) {
368
+ let n = w(e);
369
369
  if (!n) return e;
370
- let r = O(n.year, n.month, t), i = new Date(r.year, r.month + 1, 0).getDate();
371
- return S(r.year, r.month, Math.min(n.day, i));
370
+ let r = k(n.year, n.month, t), i = new Date(r.year, r.month + 1, 0).getDate();
371
+ return C(r.year, r.month, Math.min(n.day, i));
372
372
  }
373
- function M(e = "es", t = "long") {
373
+ function N(e = "es", t = "long") {
374
374
  let n = new Intl.DateTimeFormat(e, {
375
375
  month: t,
376
376
  timeZone: "UTC"
377
377
  });
378
378
  return Array.from({ length: 12 }, (e, t) => n.format(new Date(Date.UTC(2024, t, 1))).replace(".", ""));
379
379
  }
380
- function N(e = "es", t = 0, n = "narrow") {
380
+ function P(e = "es", t = 0, n = "narrow") {
381
381
  let r = new Intl.DateTimeFormat(e, {
382
382
  weekday: n,
383
383
  timeZone: "UTC"
384
384
  });
385
385
  return Array.from({ length: 7 }, (e, n) => r.format(new Date(Date.UTC(2024, 0, 7 + (n + t) % 7))));
386
386
  }
387
- function P(e, t = "es") {
388
- let n = C(e);
387
+ function F(e, t = "es") {
388
+ let n = w(e);
389
389
  return n ? new Intl.DateTimeFormat(t, {
390
390
  weekday: "long",
391
391
  day: "numeric",
@@ -394,7 +394,7 @@ function P(e, t = "es") {
394
394
  timeZone: "UTC"
395
395
  }).format(new Date(Date.UTC(n.year, n.month, n.day))) : "";
396
396
  }
397
- function F(e) {
397
+ function I(e) {
398
398
  let t = /^(\d{1,2}):(\d{2})$/.exec(e ?? "");
399
399
  if (!t) return null;
400
400
  let n = Number(t[1]), r = Number(t[2]);
@@ -403,10 +403,10 @@ function F(e) {
403
403
  minutes: r
404
404
  } : null;
405
405
  }
406
- function I(e, t) {
407
- return `${x(e)}:${x(t)}`;
406
+ function L(e, t) {
407
+ return `${S(e)}:${S(t)}`;
408
408
  }
409
- function L(e) {
409
+ function R(e) {
410
410
  return {
411
411
  hour: e % 12 == 0 ? 12 : e % 12,
412
412
  period: e < 12 ? "AM" : "PM"
@@ -415,13 +415,13 @@ function L(e) {
415
415
  function ee(e, t) {
416
416
  return e % 12 + (t === "PM" ? 12 : 0);
417
417
  }
418
- function R(e) {
419
- let t = F(e);
418
+ function z(e) {
419
+ let t = I(e);
420
420
  if (!t) return "";
421
- let { hour: n, period: r } = L(t.hours);
422
- return `${x(n)}:${x(t.minutes)} ${r}`;
421
+ let { hour: n, period: r } = R(t.hours);
422
+ return `${S(n)}:${S(t.minutes)} ${r}`;
423
423
  }
424
- function z(e) {
424
+ function B(e) {
425
425
  let t = /^\s*(\d{1,2})(?::?(\d{2}))?\s*([ap])?\.?\s*m?\.?\s*$/i.exec(e);
426
426
  if (!t) return null;
427
427
  let n = Number(t[1]), r = t[2] ? Number(t[2]) : 0, i = t[3]?.toLowerCase();
@@ -430,16 +430,16 @@ function z(e) {
430
430
  if (n < 1 || n > 12) return null;
431
431
  n = ee(n, i === "p" ? "PM" : "AM");
432
432
  } else if (n > 23) return null;
433
- return I(n, r);
433
+ return L(n, r);
434
434
  }
435
- function te(e, t, n, r) {
435
+ function V(e, t, n, r) {
436
436
  let i = e % t / t * Math.PI * 2;
437
437
  return {
438
438
  x: r + n * Math.sin(i),
439
439
  y: r - n * Math.cos(i)
440
440
  };
441
441
  }
442
- function B(e, t, n, r) {
442
+ function H(e, t, n, r) {
443
443
  let i = (Math.atan2(e - n, n - t) * 180 / Math.PI + 360) % 360;
444
444
  if (r === "hour") {
445
445
  let e = Math.round(i / 30) % 12;
@@ -447,7 +447,7 @@ function B(e, t, n, r) {
447
447
  }
448
448
  return Math.round(i / 6) % 60;
449
449
  }
450
- var V = (e) => x(e), H = {
450
+ var te = (e) => S(e), U = {
451
451
  width: 20,
452
452
  height: 20,
453
453
  viewBox: "0 0 24 24",
@@ -457,18 +457,18 @@ var V = (e) => x(e), H = {
457
457
  strokeLinecap: "round",
458
458
  strokeLinejoin: "round",
459
459
  "aria-hidden": !0
460
- }, U = () => /* @__PURE__ */ s("svg", {
461
- ...H,
460
+ }, ne = () => /* @__PURE__ */ c("svg", {
461
+ ...U,
462
462
  children: [
463
- /* @__PURE__ */ o("rect", {
463
+ /* @__PURE__ */ s("rect", {
464
464
  x: "3.5",
465
465
  y: "5",
466
466
  width: "17",
467
467
  height: "15.5",
468
468
  rx: "2.5"
469
469
  }),
470
- /* @__PURE__ */ o("path", { d: "M3.5 9.5h17M8 3v4M16 3v4" }),
471
- /* @__PURE__ */ o("rect", {
470
+ /* @__PURE__ */ s("path", { d: "M3.5 9.5h17M8 3v4M16 3v4" }),
471
+ /* @__PURE__ */ s("rect", {
472
472
  x: "11",
473
473
  y: "13",
474
474
  width: "2.4",
@@ -478,83 +478,83 @@ var V = (e) => x(e), H = {
478
478
  stroke: "none"
479
479
  })
480
480
  ]
481
- }), ne = ({ size: e = 20 }) => /* @__PURE__ */ s("svg", {
482
- ...H,
481
+ }), re = ({ size: e = 20 }) => /* @__PURE__ */ c("svg", {
482
+ ...U,
483
483
  width: e,
484
484
  height: e,
485
- children: [/* @__PURE__ */ o("circle", {
485
+ children: [/* @__PURE__ */ s("circle", {
486
486
  cx: "12",
487
487
  cy: "12",
488
488
  r: "8.5"
489
- }), /* @__PURE__ */ o("path", { d: "M12 7.5V12l3 2" })]
490
- }), re = () => /* @__PURE__ */ o("svg", {
491
- ...H,
492
- children: /* @__PURE__ */ o("path", { d: "m14.5 6-6 6 6 6" })
493
- }), W = () => /* @__PURE__ */ o("svg", {
494
- ...H,
495
- children: /* @__PURE__ */ o("path", { d: "m9.5 6 6 6-6 6" })
496
- }), ie = () => /* @__PURE__ */ o("svg", {
497
- ...H,
489
+ }), /* @__PURE__ */ s("path", { d: "M12 7.5V12l3 2" })]
490
+ }), W = () => /* @__PURE__ */ s("svg", {
491
+ ...U,
492
+ children: /* @__PURE__ */ s("path", { d: "m14.5 6-6 6 6 6" })
493
+ }), ie = () => /* @__PURE__ */ s("svg", {
494
+ ...U,
495
+ children: /* @__PURE__ */ s("path", { d: "m9.5 6 6 6-6 6" })
496
+ }), G = () => /* @__PURE__ */ s("svg", {
497
+ ...U,
498
498
  width: 18,
499
499
  height: 18,
500
- children: /* @__PURE__ */ o("path", {
500
+ children: /* @__PURE__ */ s("path", {
501
501
  d: "m7 10 5 5 5-5",
502
502
  fill: "currentColor",
503
503
  stroke: "none"
504
504
  })
505
- }), G = () => /* @__PURE__ */ o("svg", {
506
- ...H,
505
+ }), ae = () => /* @__PURE__ */ s("svg", {
506
+ ...U,
507
507
  width: 24,
508
508
  height: 24,
509
- children: /* @__PURE__ */ o("path", { d: "m5 12.5 4.5 4.5L19 7.5" })
510
- }), ae = () => /* @__PURE__ */ s("svg", {
511
- ...H,
512
- children: [/* @__PURE__ */ o("rect", {
509
+ children: /* @__PURE__ */ s("path", { d: "m5 12.5 4.5 4.5L19 7.5" })
510
+ }), K = () => /* @__PURE__ */ c("svg", {
511
+ ...U,
512
+ children: [/* @__PURE__ */ s("rect", {
513
513
  x: "2.5",
514
514
  y: "6",
515
515
  width: "19",
516
516
  height: "12",
517
517
  rx: "2"
518
- }), /* @__PURE__ */ o("path", { d: "M6 9.5h.01M9 9.5h.01M12 9.5h.01M15 9.5h.01M18 9.5h.01M7 14.5h10" })]
519
- }), K = () => /* @__PURE__ */ o("svg", {
520
- ...H,
518
+ }), /* @__PURE__ */ s("path", { d: "M6 9.5h.01M9 9.5h.01M12 9.5h.01M15 9.5h.01M18 9.5h.01M7 14.5h10" })]
519
+ }), q = () => /* @__PURE__ */ s("svg", {
520
+ ...U,
521
521
  width: 24,
522
522
  height: 24,
523
- children: /* @__PURE__ */ o("path", { d: "M6 4v8M6 16v4M12 4v2M12 10v10M18 4v10M18 18v2M4 14h4M10 8h4M16 16h4" })
524
- }), q = () => /* @__PURE__ */ o("svg", {
525
- ...H,
526
- children: /* @__PURE__ */ o("path", { d: "m6 9.5 6 6 6-6" })
527
- }), J = () => /* @__PURE__ */ o("svg", {
528
- ...H,
523
+ children: /* @__PURE__ */ s("path", { d: "M6 4v8M6 16v4M12 4v2M12 10v10M18 4v10M18 18v2M4 14h4M10 8h4M16 16h4" })
524
+ }), J = () => /* @__PURE__ */ s("svg", {
525
+ ...U,
526
+ children: /* @__PURE__ */ s("path", { d: "m6 9.5 6 6 6-6" })
527
+ }), oe = () => /* @__PURE__ */ s("svg", {
528
+ ...U,
529
529
  width: 16,
530
530
  height: 16,
531
- children: /* @__PURE__ */ o("path", { d: "M5 12h14" })
532
- }), oe = () => /* @__PURE__ */ o("svg", {
533
- ...H,
531
+ children: /* @__PURE__ */ s("path", { d: "M5 12h14" })
532
+ }), Y = () => /* @__PURE__ */ s("svg", {
533
+ ...U,
534
534
  width: 16,
535
535
  height: 16,
536
- children: /* @__PURE__ */ o("path", { d: "M12 5v14M5 12h14" })
537
- }), Y = {
538
- ...H,
536
+ children: /* @__PURE__ */ s("path", { d: "M12 5v14M5 12h14" })
537
+ }), se = {
538
+ ...U,
539
539
  width: 12,
540
540
  height: 12,
541
541
  strokeWidth: 2
542
- }, se = () => /* @__PURE__ */ s("svg", {
543
- ...Y,
544
- children: [/* @__PURE__ */ o("circle", {
542
+ }, X = () => /* @__PURE__ */ c("svg", {
543
+ ...se,
544
+ children: [/* @__PURE__ */ s("circle", {
545
545
  cx: "12",
546
546
  cy: "8",
547
547
  r: "4",
548
548
  fill: "currentColor",
549
549
  stroke: "none"
550
- }), /* @__PURE__ */ o("path", {
550
+ }), /* @__PURE__ */ s("path", {
551
551
  d: "M4.5 20.5c1-4 4-6 7.5-6s6.5 2 7.5 6",
552
552
  fill: "currentColor",
553
553
  stroke: "none"
554
554
  })]
555
- }), X = () => /* @__PURE__ */ s("svg", {
556
- ...Y,
557
- children: [/* @__PURE__ */ o("rect", {
555
+ }), ce = () => /* @__PURE__ */ c("svg", {
556
+ ...se,
557
+ children: [/* @__PURE__ */ s("rect", {
558
558
  x: "6",
559
559
  y: "7",
560
560
  width: "12",
@@ -562,10 +562,10 @@ var V = (e) => x(e), H = {
562
562
  rx: "2",
563
563
  fill: "currentColor",
564
564
  stroke: "none"
565
- }), /* @__PURE__ */ o("path", { d: "M9.5 7V4.5h5V7M9 22v-2M15 22v-2" })]
566
- }), Z = () => /* @__PURE__ */ s("svg", {
567
- ...Y,
568
- children: [/* @__PURE__ */ o("rect", {
565
+ }), /* @__PURE__ */ s("path", { d: "M9.5 7V4.5h5V7M9 22v-2M15 22v-2" })]
566
+ }), Z = () => /* @__PURE__ */ c("svg", {
567
+ ...se,
568
+ children: [/* @__PURE__ */ s("rect", {
569
569
  x: "2.5",
570
570
  y: "8.5",
571
571
  width: "19",
@@ -573,57 +573,225 @@ var V = (e) => x(e), H = {
573
573
  rx: "2",
574
574
  fill: "currentColor",
575
575
  stroke: "none"
576
- }), /* @__PURE__ */ o("path", { d: "M9 8.5V6.5h6v2" })]
576
+ }), /* @__PURE__ */ s("path", { d: "M9 8.5V6.5h6v2" })]
577
+ }), Q = () => /* @__PURE__ */ c("svg", {
578
+ ...U,
579
+ width: 24,
580
+ height: 24,
581
+ children: [
582
+ /* @__PURE__ */ s("rect", {
583
+ x: "3.5",
584
+ y: "3.5",
585
+ width: "17",
586
+ height: "17",
587
+ rx: "2.5"
588
+ }),
589
+ /* @__PURE__ */ s("circle", {
590
+ cx: "12",
591
+ cy: "10",
592
+ r: "3"
593
+ }),
594
+ /* @__PURE__ */ s("path", { d: "M6.5 20c.9-2.7 3-4 5.5-4s4.6 1.3 5.5 4" })
595
+ ]
596
+ }), le = () => /* @__PURE__ */ c("svg", {
597
+ ...U,
598
+ width: 24,
599
+ height: 24,
600
+ children: [/* @__PURE__ */ s("circle", {
601
+ cx: "10.5",
602
+ cy: "10.5",
603
+ r: "6.5"
604
+ }), /* @__PURE__ */ s("path", { d: "m20 20-4.8-4.8" })]
605
+ }), ue = () => /* @__PURE__ */ s("svg", {
606
+ ...U,
607
+ width: 16,
608
+ height: 16,
609
+ children: /* @__PURE__ */ s("path", { d: "M12 4v16M4 12h16" })
610
+ }), de = () => /* @__PURE__ */ s("svg", {
611
+ ...U,
612
+ width: 16,
613
+ height: 16,
614
+ children: /* @__PURE__ */ s("path", { d: "M5 3.5h3.2l1.6 4-2 1.3a10.5 10.5 0 0 0 5.4 5.4l1.3-2 4 1.6V17a2 2 0 0 1-2 2A15.5 15.5 0 0 1 3 5.5a2 2 0 0 1 2-2Z" })
615
+ }), $ = () => /* @__PURE__ */ c("svg", {
616
+ ...U,
617
+ width: 16,
618
+ height: 16,
619
+ children: [/* @__PURE__ */ s("circle", {
620
+ cx: "12",
621
+ cy: "12",
622
+ r: "9",
623
+ fill: "currentColor",
624
+ stroke: "none"
625
+ }), /* @__PURE__ */ s("path", {
626
+ d: "M12 11v5.5M12 7.6v.1",
627
+ stroke: "#fff",
628
+ strokeWidth: 2.4
629
+ })]
630
+ }), fe = () => /* @__PURE__ */ c("svg", {
631
+ ...U,
632
+ width: 16,
633
+ height: 16,
634
+ children: [/* @__PURE__ */ s("path", {
635
+ d: "M4 20h4.5L19 9.5 14.5 5 4 15.5z",
636
+ fill: "currentColor",
637
+ stroke: "none"
638
+ }), /* @__PURE__ */ s("path", { d: "M13 20h7" })]
639
+ }), pe = () => /* @__PURE__ */ s("svg", {
640
+ ...U,
641
+ width: 16,
642
+ height: 16,
643
+ children: /* @__PURE__ */ s("path", { d: "M4.5 6.5h15M9.5 6.5V4.5h5v2M6.5 6.5l1 13h9l1-13M10.5 10v6M13.5 10v6" })
644
+ }), me = () => /* @__PURE__ */ c("svg", {
645
+ ...U,
646
+ width: 24,
647
+ height: 24,
648
+ children: [/* @__PURE__ */ s("path", { d: "M6 5h9.5a3.5 3.5 0 0 1 0 7h-7a3.5 3.5 0 0 0 0 7H17" }), /* @__PURE__ */ s("circle", {
649
+ cx: "19",
650
+ cy: "19",
651
+ r: "2",
652
+ fill: "currentColor",
653
+ stroke: "none"
654
+ })]
655
+ }), he = () => /* @__PURE__ */ s("svg", {
656
+ ...U,
657
+ width: 16,
658
+ height: 16,
659
+ children: /* @__PURE__ */ s("path", { d: "M4 9a8 8 0 0 1 14-3l2 2M20 4v4h-4M20 15a8 8 0 0 1-14 3l-2-2M4 20v-4h4" })
660
+ }), ge = () => /* @__PURE__ */ s("svg", {
661
+ ...U,
662
+ width: 18,
663
+ height: 18,
664
+ children: /* @__PURE__ */ s("path", { d: "M5 7h14M5 12h14M5 17h14" })
665
+ }), _e = () => /* @__PURE__ */ s("svg", {
666
+ ...U,
667
+ width: 18,
668
+ height: 18,
669
+ children: /* @__PURE__ */ s("path", { d: "M6 6l12 12M18 6 6 18" })
670
+ }), ve = () => /* @__PURE__ */ s("svg", {
671
+ ...U,
672
+ width: 16,
673
+ height: 16,
674
+ strokeWidth: 2.4,
675
+ children: /* @__PURE__ */ s("circle", {
676
+ cx: "12",
677
+ cy: "12",
678
+ r: "7.5"
679
+ })
680
+ }), ye = () => /* @__PURE__ */ s("svg", {
681
+ ...U,
682
+ width: 16,
683
+ height: 16,
684
+ strokeWidth: 2.4,
685
+ children: /* @__PURE__ */ s("rect", {
686
+ x: "4.5",
687
+ y: "4.5",
688
+ width: "15",
689
+ height: "15",
690
+ rx: "1.5"
691
+ })
692
+ }), be = () => /* @__PURE__ */ c("svg", {
693
+ ...U,
694
+ width: 16,
695
+ height: 16,
696
+ children: [/* @__PURE__ */ s("circle", {
697
+ cx: "10",
698
+ cy: "8",
699
+ r: "3.5"
700
+ }), /* @__PURE__ */ s("path", { d: "M3.5 20c.8-3.5 3.3-5.5 6.5-5.5s5.7 2 6.5 5.5M18 8v6M15 11h6" })]
701
+ }), xe = () => /* @__PURE__ */ c("svg", {
702
+ ...U,
703
+ width: 16,
704
+ height: 16,
705
+ children: [/* @__PURE__ */ s("circle", {
706
+ cx: "12",
707
+ cy: "8",
708
+ r: "3.5"
709
+ }), /* @__PURE__ */ s("path", { d: "M5 20c.8-3.5 3.6-5.5 7-5.5s6.2 2 7 5.5" })]
710
+ }), Se = () => /* @__PURE__ */ c("svg", {
711
+ ...U,
712
+ width: 16,
713
+ height: 16,
714
+ children: [/* @__PURE__ */ s("circle", {
715
+ cx: "12",
716
+ cy: "12",
717
+ r: "9.5",
718
+ fill: "currentColor",
719
+ stroke: "none"
720
+ }), /* @__PURE__ */ s("path", {
721
+ d: "M12 7.5v9M7.5 12h9",
722
+ stroke: "#fff",
723
+ strokeWidth: 2.2
724
+ })]
725
+ }), Ce = () => /* @__PURE__ */ c("svg", {
726
+ ...U,
727
+ width: 16,
728
+ height: 16,
729
+ children: [/* @__PURE__ */ s("circle", {
730
+ cx: "12",
731
+ cy: "12",
732
+ r: "9.5",
733
+ fill: "currentColor",
734
+ stroke: "none"
735
+ }), /* @__PURE__ */ s("path", {
736
+ d: "m9 9 6 6M15 9l-6 6",
737
+ stroke: "#fff",
738
+ strokeWidth: 2
739
+ })]
740
+ }), we = () => /* @__PURE__ */ c("svg", {
741
+ ...U,
742
+ width: 16,
743
+ height: 16,
744
+ children: [/* @__PURE__ */ s("path", { d: "M5 3.5h3.2l1.6 4-2 1.3a10.5 10.5 0 0 0 5.4 5.4l1.3-2 4 1.6V17a2 2 0 0 1-2 2A15.5 15.5 0 0 1 3 5.5a2 2 0 0 1 2-2Z" }), /* @__PURE__ */ s("path", { d: "M15 4h5M15 7h5M17 10h3" })]
577
745
  });
578
746
  //#endregion
579
747
  //#region src/wari/WariDateField.tsx
580
- function Q({ label: n, value: a, defaultValue: c = "", onChange: l, min: u, max: d, placeholder: f = "dd/mm/aa", supportingText: p, error: m = !1, required: h, disabled: g = !1, name: _, id: v, locale: y = "es", weekStartsOn: b = 0, cancelLabel: x = "Cancelar", okLabel: S = "Aceptar", align: F = "start", className: I }) {
581
- let L = t(), ee = v ?? L, R = `${ee}-hint`, [z, te] = i(c), B = a ?? z, [V, H] = i(() => T(B)), [ne, ae] = i(!1), [K, q] = i(!1), [J, oe] = i("days"), [Y, se] = i(""), [X, Z] = i(""), [Q, $] = i(() => {
582
- let e = C(B) ?? C(w());
748
+ function Te({ label: n, value: r, defaultValue: o = "", onChange: l, min: u, max: d, placeholder: f = "dd/mm/aa", supportingText: p, error: m = !1, required: h, disabled: g = !1, name: _, id: v, locale: y = "es", weekStartsOn: b = 0, cancelLabel: x = "Cancelar", okLabel: S = "Aceptar", align: C = "start", className: I }) {
749
+ let L = t(), R = v ?? L, ee = `${R}-hint`, [z, B] = a(o), V = r ?? z, [H, te] = a(() => E(V)), [U, re] = a(!1), [K, q] = a(!1), [J, oe] = a("days"), [Y, se] = a(""), [X, ce] = a(""), [Z, Q] = a(() => {
750
+ let e = w(V) ?? w(T());
583
751
  return {
584
752
  year: e.year,
585
753
  month: e.month
586
754
  };
587
- }), ce = r(null), le = r(null), ue = r(null), de = r(!1), fe = ne ? V : T(B), pe = M(y, "long"), me = M(y, "short"), he = N(y, b), ge = N(y, b, "long"), _e = w(), ve = C(u)?.year ?? Q.year - 50, ye = C(d)?.year ?? Q.year + 50, be = (e) => {
588
- a === void 0 && te(e), e !== B && l?.(e);
755
+ }), le = i(null), ue = i(null), de = i(null), $ = i(!1), fe = U ? H : E(V), pe = N(y, "long"), me = N(y, "short"), he = P(y, b), ge = P(y, b, "long"), _e = T(), ve = w(u)?.year ?? Z.year - 50, ye = w(d)?.year ?? Z.year + 50, be = (e) => {
756
+ r === void 0 && B(e), e !== V && l?.(e);
589
757
  }, xe = (e) => u && e < u ? u : d && e > d ? d : e, Se = () => {
590
758
  if (g) return;
591
- let e = xe(C(B) ? B : _e), t = C(e);
592
- se(C(B) ? B : ""), Z(e), $({
759
+ let e = xe(w(V) ? V : _e), t = w(e);
760
+ se(w(V) ? V : ""), ce(e), Q({
593
761
  year: t.year,
594
762
  month: t.month
595
- }), oe("days"), de.current = !0, q(!0);
763
+ }), oe("days"), $.current = !0, q(!0);
596
764
  }, Ce = (e = !0) => {
597
- q(!1), e && le.current?.focus();
765
+ q(!1), e && ue.current?.focus();
598
766
  };
599
767
  e(() => {
600
768
  if (!K) return;
601
769
  let e = (e) => {
602
- ce.current?.contains(e.target) || q(!1);
770
+ le.current?.contains(e.target) || q(!1);
603
771
  };
604
772
  return document.addEventListener("pointerdown", e), () => document.removeEventListener("pointerdown", e);
605
773
  }, [K]), e(() => {
606
- if (!K || !de.current) return;
607
- de.current = !1;
608
- let e = J === "days" ? ue.current?.querySelector(`[data-iso="${X}"]`) : ue.current?.querySelector(".ds-wpicker-option[tabindex=\"0\"]");
774
+ if (!K || !$.current) return;
775
+ $.current = !1;
776
+ let e = J === "days" ? de.current?.querySelector(`[data-iso="${X}"]`) : de.current?.querySelector(".ds-wpicker-option[tabindex=\"0\"]");
609
777
  e?.focus(), J !== "days" && e?.scrollIntoView?.({ block: "center" });
610
778
  });
611
779
  let we = (e) => {
612
- let t = xe(e), n = C(t);
613
- Z(t), (n.year !== Q.year || n.month !== Q.month) && $({
780
+ let t = xe(e), n = w(t);
781
+ ce(t), (n.year !== Z.year || n.month !== Z.month) && Q({
614
782
  year: n.year,
615
783
  month: n.month
616
- }), de.current = !0;
784
+ }), $.current = !0;
617
785
  }, Te = (e) => {
618
786
  let t = {
619
- ArrowLeft: () => A(X, -1),
620
- ArrowRight: () => A(X, 1),
621
- ArrowUp: () => A(X, -7),
622
- ArrowDown: () => A(X, 7),
623
- PageUp: () => j(X, e.shiftKey ? -12 : -1),
624
- PageDown: () => j(X, e.shiftKey ? 12 : 1),
625
- Home: () => A(X, -(((/* @__PURE__ */ new Date(`${X}T00:00`)).getDay() - b + 7) % 7)),
626
- End: () => A(X, 6 - ((/* @__PURE__ */ new Date(`${X}T00:00`)).getDay() - b + 7) % 7)
787
+ ArrowLeft: () => j(X, -1),
788
+ ArrowRight: () => j(X, 1),
789
+ ArrowUp: () => j(X, -7),
790
+ ArrowDown: () => j(X, 7),
791
+ PageUp: () => M(X, e.shiftKey ? -12 : -1),
792
+ PageDown: () => M(X, e.shiftKey ? 12 : 1),
793
+ Home: () => j(X, -(((/* @__PURE__ */ new Date(`${X}T00:00`)).getDay() - b + 7) % 7)),
794
+ End: () => j(X, 6 - ((/* @__PURE__ */ new Date(`${X}T00:00`)).getDay() - b + 7) % 7)
627
795
  };
628
796
  t[e.key] && (e.preventDefault(), we(t[e.key]()));
629
797
  }, Ee = (e) => {
@@ -635,24 +803,24 @@ function Q({ label: n, value: a, defaultValue: c = "", onChange: l, min: u, max:
635
803
  }[e.key];
636
804
  r !== void 0 && (e.preventDefault(), t[Math.max(0, Math.min(r, t.length - 1))]?.focus());
637
805
  }, De = (e) => {
638
- e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), J === "days" ? Ce() : (oe("days"), de.current = !0));
806
+ e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), J === "days" ? Ce() : (oe("days"), $.current = !0));
639
807
  }, Oe = () => {
640
- if (ae(!1), !V.trim()) {
808
+ if (re(!1), !H.trim()) {
641
809
  be("");
642
810
  return;
643
811
  }
644
- let e = E(V);
645
- e && D(e, u, d) && be(e);
812
+ let e = D(H);
813
+ e && O(e, u, d) && be(e);
646
814
  }, ke = (e) => {
647
815
  let t = e.relatedTarget;
648
- K && t && !ce.current?.contains(t) && q(!1);
816
+ K && t && !le.current?.contains(t) && q(!1);
649
817
  }, Ae = (e) => {
650
- $(e);
651
- let t = C(X)?.day ?? 1, n = new Date(e.year, e.month + 1, 0).getDate();
652
- Z(xe(`${String(e.year).padStart(4, "0")}-${String(e.month + 1).padStart(2, "0")}-${String(Math.min(t, n)).padStart(2, "0")}`)), oe("days"), de.current = !0;
653
- }, je = O(Q.year, Q.month, -1), Me = O(Q.year, Q.month, 1), Ne = !!u && `${je.year}-${String(je.month + 1).padStart(2, "0")}-31` < u, Pe = !!d && `${Me.year}-${String(Me.month + 1).padStart(2, "0")}-01` > d, Fe = Array.from({ length: ye - ve + 1 }, (e, t) => ve + t);
654
- return /* @__PURE__ */ s("div", {
655
- ref: ce,
818
+ Q(e);
819
+ let t = w(X)?.day ?? 1, n = new Date(e.year, e.month + 1, 0).getDate();
820
+ ce(xe(`${String(e.year).padStart(4, "0")}-${String(e.month + 1).padStart(2, "0")}-${String(Math.min(t, n)).padStart(2, "0")}`)), oe("days"), $.current = !0;
821
+ }, je = k(Z.year, Z.month, -1), Me = k(Z.year, Z.month, 1), Ne = !!u && `${je.year}-${String(je.month + 1).padStart(2, "0")}-31` < u, Pe = !!d && `${Me.year}-${String(Me.month + 1).padStart(2, "0")}-01` > d, Fe = Array.from({ length: ye - ve + 1 }, (e, t) => ve + t);
822
+ return /* @__PURE__ */ c("div", {
823
+ ref: le,
656
824
  className: [
657
825
  "ds-input",
658
826
  "ds-wfield",
@@ -661,23 +829,23 @@ function Q({ label: n, value: a, defaultValue: c = "", onChange: l, min: u, max:
661
829
  "data-open": K,
662
830
  "data-error": m,
663
831
  "data-disabled": g,
664
- "data-align": F,
832
+ "data-align": C,
665
833
  onBlur: ke,
666
834
  children: [
667
- n && /* @__PURE__ */ s("label", {
668
- htmlFor: ee,
669
- children: [n, h && /* @__PURE__ */ o("span", {
835
+ n && /* @__PURE__ */ c("label", {
836
+ htmlFor: R,
837
+ children: [n, h && /* @__PURE__ */ s("span", {
670
838
  className: "ds-input-required",
671
839
  "aria-hidden": "true",
672
840
  children: "*"
673
841
  })]
674
842
  }),
675
- /* @__PURE__ */ s("div", {
843
+ /* @__PURE__ */ c("div", {
676
844
  className: "ds-wfield-anchor",
677
- children: [/* @__PURE__ */ s("div", {
845
+ children: [/* @__PURE__ */ c("div", {
678
846
  className: "ds-input-shell",
679
- children: [/* @__PURE__ */ o("input", {
680
- id: ee,
847
+ children: [/* @__PURE__ */ s("input", {
848
+ id: R,
681
849
  type: "text",
682
850
  inputMode: "numeric",
683
851
  autoComplete: "off",
@@ -686,30 +854,30 @@ function Q({ label: n, value: a, defaultValue: c = "", onChange: l, min: u, max:
686
854
  disabled: g,
687
855
  required: h,
688
856
  "aria-invalid": m || void 0,
689
- "aria-describedby": p ? R : void 0,
857
+ "aria-describedby": p ? ee : void 0,
690
858
  onChange: (e) => {
691
- ae(!0), H(e.target.value);
859
+ re(!0), te(e.target.value);
692
860
  },
693
861
  onFocus: () => {
694
- ae(!0), H(T(B));
862
+ re(!0), te(E(V));
695
863
  },
696
864
  onBlur: Oe,
697
865
  onKeyDown: (e) => {
698
866
  e.key === "Enter" && (e.preventDefault(), Oe()), e.key === "ArrowDown" && (e.altKey || !K) && (e.preventDefault(), Oe(), Se());
699
867
  }
700
- }), /* @__PURE__ */ o("button", {
701
- ref: le,
868
+ }), /* @__PURE__ */ s("button", {
869
+ ref: ue,
702
870
  type: "button",
703
871
  className: "ds-wfield-trigger",
704
872
  disabled: g,
705
- "aria-label": `Elegir fecha${B ? `, ${P(B, y)}` : ""}`,
873
+ "aria-label": `Elegir fecha${V ? `, ${F(V, y)}` : ""}`,
706
874
  "aria-haspopup": "dialog",
707
875
  "aria-expanded": K,
708
876
  onClick: () => K ? Ce() : Se(),
709
- children: /* @__PURE__ */ o(U, {})
877
+ children: /* @__PURE__ */ s(ne, {})
710
878
  })]
711
- }), K && /* @__PURE__ */ s("div", {
712
- ref: ue,
879
+ }), K && /* @__PURE__ */ c("div", {
880
+ ref: de,
713
881
  className: "ds-wpicker",
714
882
  "data-kind": "date",
715
883
  "data-view": J,
@@ -717,92 +885,92 @@ function Q({ label: n, value: a, defaultValue: c = "", onChange: l, min: u, max:
717
885
  "aria-label": "Elegir fecha",
718
886
  onKeyDown: De,
719
887
  children: [
720
- /* @__PURE__ */ s("div", {
888
+ /* @__PURE__ */ c("div", {
721
889
  className: "ds-wpicker-head",
722
- children: [/* @__PURE__ */ s("div", {
890
+ children: [/* @__PURE__ */ c("div", {
723
891
  className: "ds-wpicker-nav",
724
892
  "data-part": "month",
725
893
  children: [
726
- /* @__PURE__ */ o("button", {
894
+ /* @__PURE__ */ s("button", {
727
895
  type: "button",
728
896
  className: "ds-wpicker-icon",
729
897
  "aria-label": "Mes anterior",
730
898
  disabled: Ne || J !== "days",
731
- onClick: () => $(je),
732
- children: /* @__PURE__ */ o(re, {})
899
+ onClick: () => Q(je),
900
+ children: /* @__PURE__ */ s(W, {})
733
901
  }),
734
- /* @__PURE__ */ s("button", {
902
+ /* @__PURE__ */ c("button", {
735
903
  type: "button",
736
904
  className: "ds-wpicker-menu",
737
905
  "aria-haspopup": "listbox",
738
906
  "aria-expanded": J === "months",
739
- "aria-label": `Elegir mes, ${pe[Q.month]}`,
907
+ "aria-label": `Elegir mes, ${pe[Z.month]}`,
740
908
  onClick: () => {
741
- oe(J === "months" ? "days" : "months"), de.current = !0;
909
+ oe(J === "months" ? "days" : "months"), $.current = !0;
742
910
  },
743
- children: [me[Q.month], /* @__PURE__ */ o(ie, {})]
911
+ children: [me[Z.month], /* @__PURE__ */ s(G, {})]
744
912
  }),
745
- /* @__PURE__ */ o("button", {
913
+ /* @__PURE__ */ s("button", {
746
914
  type: "button",
747
915
  className: "ds-wpicker-icon",
748
916
  "aria-label": "Mes siguiente",
749
917
  disabled: Pe || J !== "days",
750
- onClick: () => $(Me),
751
- children: /* @__PURE__ */ o(W, {})
918
+ onClick: () => Q(Me),
919
+ children: /* @__PURE__ */ s(ie, {})
752
920
  })
753
921
  ]
754
- }), /* @__PURE__ */ s("div", {
922
+ }), /* @__PURE__ */ c("div", {
755
923
  className: "ds-wpicker-nav",
756
924
  "data-part": "year",
757
925
  children: [
758
- /* @__PURE__ */ o("button", {
926
+ /* @__PURE__ */ s("button", {
759
927
  type: "button",
760
928
  className: "ds-wpicker-icon",
761
929
  "aria-label": "Año anterior",
762
- disabled: Q.year - 1 < ve || J !== "days",
763
- onClick: () => $({
764
- ...Q,
765
- year: Q.year - 1
930
+ disabled: Z.year - 1 < ve || J !== "days",
931
+ onClick: () => Q({
932
+ ...Z,
933
+ year: Z.year - 1
766
934
  }),
767
- children: /* @__PURE__ */ o(re, {})
935
+ children: /* @__PURE__ */ s(W, {})
768
936
  }),
769
- /* @__PURE__ */ s("button", {
937
+ /* @__PURE__ */ c("button", {
770
938
  type: "button",
771
939
  className: "ds-wpicker-menu",
772
940
  "aria-haspopup": "listbox",
773
941
  "aria-expanded": J === "years",
774
- "aria-label": `Elegir año, ${Q.year}`,
942
+ "aria-label": `Elegir año, ${Z.year}`,
775
943
  onClick: () => {
776
- oe(J === "years" ? "days" : "years"), de.current = !0;
944
+ oe(J === "years" ? "days" : "years"), $.current = !0;
777
945
  },
778
- children: [Q.year, /* @__PURE__ */ o(ie, {})]
946
+ children: [Z.year, /* @__PURE__ */ s(G, {})]
779
947
  }),
780
- /* @__PURE__ */ o("button", {
948
+ /* @__PURE__ */ s("button", {
781
949
  type: "button",
782
950
  className: "ds-wpicker-icon",
783
951
  "aria-label": "Año siguiente",
784
- disabled: Q.year + 1 > ye || J !== "days",
785
- onClick: () => $({
786
- ...Q,
787
- year: Q.year + 1
952
+ disabled: Z.year + 1 > ye || J !== "days",
953
+ onClick: () => Q({
954
+ ...Z,
955
+ year: Z.year + 1
788
956
  }),
789
- children: /* @__PURE__ */ o(W, {})
957
+ children: /* @__PURE__ */ s(ie, {})
790
958
  })
791
959
  ]
792
960
  })]
793
961
  }),
794
- J === "days" && /* @__PURE__ */ s("table", {
962
+ J === "days" && /* @__PURE__ */ c("table", {
795
963
  className: "ds-wpicker-grid",
796
964
  role: "grid",
797
- "aria-label": `${pe[Q.month]} ${Q.year}`,
965
+ "aria-label": `${pe[Z.month]} ${Z.year}`,
798
966
  onKeyDown: Te,
799
- children: [/* @__PURE__ */ o("thead", { children: /* @__PURE__ */ o("tr", { children: he.map((e, t) => /* @__PURE__ */ o("th", {
967
+ children: [/* @__PURE__ */ s("thead", { children: /* @__PURE__ */ s("tr", { children: he.map((e, t) => /* @__PURE__ */ s("th", {
800
968
  scope: "col",
801
969
  abbr: ge[t],
802
970
  children: e
803
- }, t)) }) }), /* @__PURE__ */ o("tbody", { children: k(Q.year, Q.month, b).map((e, t) => /* @__PURE__ */ o("tr", { children: e.map((e) => {
804
- let t = !D(e.iso, u, d);
805
- return /* @__PURE__ */ o("td", { children: /* @__PURE__ */ o("button", {
971
+ }, t)) }) }), /* @__PURE__ */ s("tbody", { children: A(Z.year, Z.month, b).map((e, t) => /* @__PURE__ */ s("tr", { children: e.map((e) => {
972
+ let t = !O(e.iso, u, d);
973
+ return /* @__PURE__ */ s("td", { children: /* @__PURE__ */ s("button", {
806
974
  type: "button",
807
975
  className: "ds-wpicker-day",
808
976
  "data-iso": e.iso,
@@ -810,7 +978,7 @@ function Q({ label: n, value: a, defaultValue: c = "", onChange: l, min: u, max:
810
978
  "data-today": e.iso === _e,
811
979
  "aria-selected": e.iso === Y,
812
980
  "aria-disabled": t || void 0,
813
- "aria-label": P(e.iso, y),
981
+ "aria-label": F(e.iso, y),
814
982
  tabIndex: e.iso === X ? 0 : -1,
815
983
  onClick: () => {
816
984
  t || (se(e.iso), we(e.iso));
@@ -819,50 +987,50 @@ function Q({ label: n, value: a, defaultValue: c = "", onChange: l, min: u, max:
819
987
  }) }, e.iso);
820
988
  }) }, t)) })]
821
989
  }),
822
- J === "months" && /* @__PURE__ */ o("div", {
990
+ J === "months" && /* @__PURE__ */ s("div", {
823
991
  className: "ds-wpicker-list",
824
992
  role: "listbox",
825
993
  "aria-label": "Meses",
826
994
  onKeyDown: Ee,
827
- children: pe.map((e, t) => /* @__PURE__ */ s("button", {
995
+ children: pe.map((e, t) => /* @__PURE__ */ c("button", {
828
996
  type: "button",
829
997
  role: "option",
830
998
  className: "ds-wpicker-option",
831
- "aria-selected": t === Q.month,
832
- tabIndex: t === Q.month ? 0 : -1,
999
+ "aria-selected": t === Z.month,
1000
+ tabIndex: t === Z.month ? 0 : -1,
833
1001
  onClick: () => Ae({
834
- year: Q.year,
1002
+ year: Z.year,
835
1003
  month: t
836
1004
  }),
837
- children: [/* @__PURE__ */ o(G, {}), e]
1005
+ children: [/* @__PURE__ */ s(ae, {}), e]
838
1006
  }, e))
839
1007
  }),
840
- J === "years" && /* @__PURE__ */ o("div", {
1008
+ J === "years" && /* @__PURE__ */ s("div", {
841
1009
  className: "ds-wpicker-list",
842
1010
  role: "listbox",
843
1011
  "aria-label": "Años",
844
1012
  onKeyDown: Ee,
845
- children: Fe.map((e) => /* @__PURE__ */ s("button", {
1013
+ children: Fe.map((e) => /* @__PURE__ */ c("button", {
846
1014
  type: "button",
847
1015
  role: "option",
848
1016
  className: "ds-wpicker-option",
849
- "aria-selected": e === Q.year,
850
- tabIndex: e === Q.year ? 0 : -1,
1017
+ "aria-selected": e === Z.year,
1018
+ tabIndex: e === Z.year ? 0 : -1,
851
1019
  onClick: () => Ae({
852
1020
  year: e,
853
- month: Q.month
1021
+ month: Z.month
854
1022
  }),
855
- children: [/* @__PURE__ */ o(G, {}), e]
1023
+ children: [/* @__PURE__ */ s(ae, {}), e]
856
1024
  }, e))
857
1025
  }),
858
- /* @__PURE__ */ s("div", {
1026
+ /* @__PURE__ */ c("div", {
859
1027
  className: "ds-wpicker-actions",
860
- children: [/* @__PURE__ */ o("button", {
1028
+ children: [/* @__PURE__ */ s("button", {
861
1029
  type: "button",
862
1030
  className: "ds-wpicker-action",
863
1031
  onClick: () => Ce(),
864
1032
  children: x
865
- }), /* @__PURE__ */ o("button", {
1033
+ }), /* @__PURE__ */ s("button", {
866
1034
  type: "button",
867
1035
  className: "ds-wpicker-action",
868
1036
  onClick: () => {
@@ -874,21 +1042,21 @@ function Q({ label: n, value: a, defaultValue: c = "", onChange: l, min: u, max:
874
1042
  ]
875
1043
  })]
876
1044
  }),
877
- p && /* @__PURE__ */ o("small", {
878
- id: R,
1045
+ p && /* @__PURE__ */ s("small", {
1046
+ id: ee,
879
1047
  children: p
880
1048
  }),
881
- _ && /* @__PURE__ */ o("input", {
1049
+ _ && /* @__PURE__ */ s("input", {
882
1050
  type: "hidden",
883
1051
  name: _,
884
- value: B
1052
+ value: V
885
1053
  })
886
1054
  ]
887
1055
  });
888
1056
  }
889
1057
  //#endregion
890
1058
  //#region src/wari/WariTimeField.tsx
891
- var $ = 256, ce = $ / 2, le = 100, ue = [
1059
+ var Ee = 256, De = Ee / 2, Oe = 100, ke = [
892
1060
  12,
893
1061
  1,
894
1062
  2,
@@ -901,7 +1069,7 @@ var $ = 256, ce = $ / 2, le = 100, ue = [
901
1069
  9,
902
1070
  10,
903
1071
  11
904
- ], de = [
1072
+ ], Ae = [
905
1073
  0,
906
1074
  5,
907
1075
  10,
@@ -915,20 +1083,20 @@ var $ = 256, ce = $ / 2, le = 100, ue = [
915
1083
  50,
916
1084
  55
917
1085
  ];
918
- function fe({ label: n, value: a, defaultValue: c = "", onChange: l, placeholder: u = "hh:mm", supportingText: d, error: f = !1, required: p, disabled: m = !1, name: h, id: g, title: _ = "Selecciona la hora", cancelLabel: v = "Cancelar", okLabel: y = "Aceptar", align: b = "start", className: x }) {
919
- let S = t(), C = g ?? S, w = `${C}-hint`, [T, E] = i(c), D = a ?? T, [O, k] = i(""), [A, j] = i(!1), [M, N] = i(!1), [P, H] = i(12), [U, re] = i(0), [W, ie] = i("AM"), [G, K] = i("hour"), [q, J] = i("dial"), oe = r(null), Y = r(null), se = r(null), X = r(null), Z = r(!1), Q = A ? O : R(D), fe = (e) => {
920
- a === void 0 && E(e), e !== D && l?.(e);
921
- }, pe = () => {
1086
+ function je({ label: n, value: r, defaultValue: o = "", onChange: l, placeholder: u = "hh:mm", supportingText: d, error: f = !1, required: p, disabled: m = !1, name: h, id: g, title: _ = "Selecciona la hora", cancelLabel: v = "Cancelar", okLabel: y = "Aceptar", align: b = "start", className: x }) {
1087
+ let S = t(), C = g ?? S, w = `${C}-hint`, [T, E] = a(o), D = r ?? T, [O, k] = a(""), [A, j] = a(!1), [M, N] = a(!1), [P, F] = a(12), [U, ne] = a(0), [W, ie] = a("AM"), [G, ae] = a("hour"), [q, J] = a("dial"), oe = i(null), Y = i(null), se = i(null), X = i(null), ce = i(!1), Z = A ? O : z(D), Q = (e) => {
1088
+ r === void 0 && E(e), e !== D && l?.(e);
1089
+ }, le = () => {
922
1090
  if (m) return;
923
- let e = F(D) ?? {
1091
+ let e = I(D) ?? {
924
1092
  hours: 12,
925
1093
  minutes: 0
926
- }, t = L(e.hours);
927
- H(t.hour), re(e.minutes), ie(t.period), K("hour"), N(!0);
928
- }, me = (e = !0) => {
1094
+ }, t = R(e.hours);
1095
+ F(t.hour), ne(e.minutes), ie(t.period), ae("hour"), N(!0);
1096
+ }, ue = (e = !0) => {
929
1097
  N(!1), e && Y.current?.focus();
930
- }, he = () => {
931
- fe(I(ee(P, W), U)), me();
1098
+ }, de = () => {
1099
+ Q(L(ee(P, W), U)), ue();
932
1100
  };
933
1101
  e(() => {
934
1102
  if (!M) return;
@@ -938,29 +1106,29 @@ function fe({ label: n, value: a, defaultValue: c = "", onChange: l, placeholder
938
1106
  };
939
1107
  return document.addEventListener("pointerdown", e), () => document.removeEventListener("pointerdown", e);
940
1108
  }, [M]);
941
- let ge = () => {
1109
+ let $ = () => {
942
1110
  if (j(!1), !O.trim()) {
943
- fe("");
1111
+ Q("");
944
1112
  return;
945
1113
  }
946
- let e = z(O);
947
- e && fe(e);
948
- }, _e = (e) => {
949
- let t = e.currentTarget.getBoundingClientRect(), n = $ / t.width, r = B((e.clientX - t.left) * n, (e.clientY - t.top) * n, ce, G);
950
- G === "hour" ? H(r) : re(r);
951
- }, ve = (e, t) => {
1114
+ let e = B(O);
1115
+ e && Q(e);
1116
+ }, fe = (e) => {
1117
+ let t = e.currentTarget.getBoundingClientRect(), n = Ee / t.width, r = H((e.clientX - t.left) * n, (e.clientY - t.top) * n, De, G);
1118
+ G === "hour" ? F(r) : ne(r);
1119
+ }, pe = (e, t) => {
952
1120
  let n = e.key === "ArrowUp" ? 1 : e.key === "ArrowDown" ? -1 : 0;
953
- n && (e.preventDefault(), t === "hour" ? H((e) => (e - 1 + n + 12) % 12 + 1) : re((e) => (e + n + 60) % 60)), e.key === "Enter" && (e.preventDefault(), he());
954
- }, ye = (e, t) => {
1121
+ n && (e.preventDefault(), t === "hour" ? F((e) => (e - 1 + n + 12) % 12 + 1) : ne((e) => (e + n + 60) % 60)), e.key === "Enter" && (e.preventDefault(), de());
1122
+ }, me = (e, t) => {
955
1123
  let n = e.replace(/\D/g, "").slice(-2);
956
1124
  if (!n) return;
957
1125
  let r = Number(n);
958
- t === "hour" ? (r >= 1 && r <= 12 ? H(r) : r > 12 && Number(n.slice(-1)) >= 1 && H(Number(n.slice(-1))), (n.length === 2 || r > 1) && (K("minute"), X.current?.focus(), X.current?.select())) : re(r <= 59 ? r : Number(n.slice(-1)));
959
- }, be = (e) => {
1126
+ t === "hour" ? (r >= 1 && r <= 12 ? F(r) : r > 12 && Number(n.slice(-1)) >= 1 && F(Number(n.slice(-1))), (n.length === 2 || r > 1) && (ae("minute"), X.current?.focus(), X.current?.select())) : ne(r <= 59 ? r : Number(n.slice(-1)));
1127
+ }, he = (e) => {
960
1128
  let t = e.relatedTarget;
961
1129
  M && t && !oe.current?.contains(t) && N(!1);
962
- }, xe = G === "hour" ? P : U, Se = G === "hour" ? P % 12 * 30 : U * 6, Ce = G === "hour" ? ue : de;
963
- return /* @__PURE__ */ s("div", {
1130
+ }, ge = G === "hour" ? P : U, _e = G === "hour" ? P % 12 * 30 : U * 6, ve = G === "hour" ? ke : Ae;
1131
+ return /* @__PURE__ */ c("div", {
964
1132
  ref: oe,
965
1133
  className: [
966
1134
  "ds-input",
@@ -971,26 +1139,26 @@ function fe({ label: n, value: a, defaultValue: c = "", onChange: l, placeholder
971
1139
  "data-error": f,
972
1140
  "data-disabled": m,
973
1141
  "data-align": b,
974
- onBlur: be,
1142
+ onBlur: he,
975
1143
  children: [
976
- n && /* @__PURE__ */ s("label", {
1144
+ n && /* @__PURE__ */ c("label", {
977
1145
  htmlFor: C,
978
- children: [n, p && /* @__PURE__ */ o("span", {
1146
+ children: [n, p && /* @__PURE__ */ s("span", {
979
1147
  className: "ds-input-required",
980
1148
  "aria-hidden": "true",
981
1149
  children: "*"
982
1150
  })]
983
1151
  }),
984
- /* @__PURE__ */ s("div", {
1152
+ /* @__PURE__ */ c("div", {
985
1153
  className: "ds-wfield-anchor",
986
- children: [/* @__PURE__ */ s("div", {
1154
+ children: [/* @__PURE__ */ c("div", {
987
1155
  className: "ds-input-shell",
988
- children: [/* @__PURE__ */ o("input", {
1156
+ children: [/* @__PURE__ */ s("input", {
989
1157
  id: C,
990
1158
  type: "text",
991
1159
  autoComplete: "off",
992
1160
  placeholder: u,
993
- value: Q,
1161
+ value: Z,
994
1162
  disabled: m,
995
1163
  required: p,
996
1164
  "aria-invalid": f || void 0,
@@ -999,144 +1167,144 @@ function fe({ label: n, value: a, defaultValue: c = "", onChange: l, placeholder
999
1167
  j(!0), k(e.target.value);
1000
1168
  },
1001
1169
  onFocus: () => {
1002
- j(!0), k(R(D));
1170
+ j(!0), k(z(D));
1003
1171
  },
1004
- onBlur: ge,
1172
+ onBlur: $,
1005
1173
  onKeyDown: (e) => {
1006
- e.key === "Enter" && (e.preventDefault(), ge()), e.key === "ArrowDown" && (e.altKey || !M) && (e.preventDefault(), ge(), pe());
1174
+ e.key === "Enter" && (e.preventDefault(), $()), e.key === "ArrowDown" && (e.altKey || !M) && (e.preventDefault(), $(), le());
1007
1175
  }
1008
- }), /* @__PURE__ */ o("button", {
1176
+ }), /* @__PURE__ */ s("button", {
1009
1177
  ref: Y,
1010
1178
  type: "button",
1011
1179
  className: "ds-wfield-trigger",
1012
1180
  disabled: m,
1013
- "aria-label": `Elegir hora${D ? `, ${R(D)}` : ""}`,
1181
+ "aria-label": `Elegir hora${D ? `, ${z(D)}` : ""}`,
1014
1182
  "aria-haspopup": "dialog",
1015
1183
  "aria-expanded": M,
1016
- onClick: () => M ? me() : pe(),
1017
- children: /* @__PURE__ */ o(ne, {})
1184
+ onClick: () => M ? ue() : le(),
1185
+ children: /* @__PURE__ */ s(re, {})
1018
1186
  })]
1019
- }), M && /* @__PURE__ */ s("div", {
1187
+ }), M && /* @__PURE__ */ c("div", {
1020
1188
  className: "ds-wpicker",
1021
1189
  "data-kind": "time",
1022
1190
  "data-input": q,
1023
1191
  role: "dialog",
1024
1192
  "aria-label": _,
1025
1193
  onKeyDown: (e) => {
1026
- e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), me());
1194
+ e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), ue());
1027
1195
  },
1028
1196
  children: [
1029
- /* @__PURE__ */ o("div", {
1197
+ /* @__PURE__ */ s("div", {
1030
1198
  className: "ds-wpicker-title",
1031
1199
  children: _
1032
1200
  }),
1033
- /* @__PURE__ */ s("div", {
1201
+ /* @__PURE__ */ c("div", {
1034
1202
  className: "ds-wtime-body",
1035
- children: [/* @__PURE__ */ s("div", {
1203
+ children: [/* @__PURE__ */ c("div", {
1036
1204
  className: "ds-wtime-inputs",
1037
- children: [/* @__PURE__ */ s("div", {
1205
+ children: [/* @__PURE__ */ c("div", {
1038
1206
  className: "ds-wtime-fields",
1039
1207
  children: [
1040
- /* @__PURE__ */ o("input", {
1208
+ /* @__PURE__ */ s("input", {
1041
1209
  ref: se,
1042
1210
  className: "ds-wtime-box",
1043
1211
  inputMode: "numeric",
1044
1212
  "aria-label": "Hora",
1045
1213
  "data-active": G === "hour",
1046
- value: V(P),
1214
+ value: te(P),
1047
1215
  onFocus: (e) => {
1048
- K("hour"), e.currentTarget.select();
1216
+ ae("hour"), e.currentTarget.select();
1049
1217
  },
1050
- onChange: (e) => ye(e.target.value, "hour"),
1051
- onKeyDown: (e) => ve(e, "hour")
1218
+ onChange: (e) => me(e.target.value, "hour"),
1219
+ onKeyDown: (e) => pe(e, "hour")
1052
1220
  }),
1053
- /* @__PURE__ */ o("span", {
1221
+ /* @__PURE__ */ s("span", {
1054
1222
  className: "ds-wtime-sep",
1055
1223
  "aria-hidden": "true",
1056
1224
  children: ":"
1057
1225
  }),
1058
- /* @__PURE__ */ o("input", {
1226
+ /* @__PURE__ */ s("input", {
1059
1227
  ref: X,
1060
1228
  className: "ds-wtime-box",
1061
1229
  inputMode: "numeric",
1062
1230
  "aria-label": "Minutos",
1063
1231
  "data-active": G === "minute",
1064
- value: V(U),
1232
+ value: te(U),
1065
1233
  onFocus: (e) => {
1066
- K("minute"), e.currentTarget.select();
1234
+ ae("minute"), e.currentTarget.select();
1067
1235
  },
1068
- onChange: (e) => ye(e.target.value, "minute"),
1069
- onKeyDown: (e) => ve(e, "minute")
1236
+ onChange: (e) => me(e.target.value, "minute"),
1237
+ onKeyDown: (e) => pe(e, "minute")
1070
1238
  })
1071
1239
  ]
1072
- }), /* @__PURE__ */ o("div", {
1240
+ }), /* @__PURE__ */ s("div", {
1073
1241
  className: "ds-wtime-period",
1074
1242
  role: "group",
1075
1243
  "aria-label": "AM o PM",
1076
- children: ["AM", "PM"].map((e) => /* @__PURE__ */ o("button", {
1244
+ children: ["AM", "PM"].map((e) => /* @__PURE__ */ s("button", {
1077
1245
  type: "button",
1078
1246
  "aria-pressed": W === e,
1079
1247
  onClick: () => ie(e),
1080
1248
  children: e
1081
1249
  }, e))
1082
1250
  })]
1083
- }), /* @__PURE__ */ s("div", {
1251
+ }), /* @__PURE__ */ c("div", {
1084
1252
  className: "ds-wtime-dial",
1085
1253
  "aria-hidden": "true",
1086
1254
  onPointerDown: (e) => {
1087
- Z.current = !0, e.currentTarget.setPointerCapture?.(e.pointerId), e.preventDefault(), _e(e);
1255
+ ce.current = !0, e.currentTarget.setPointerCapture?.(e.pointerId), e.preventDefault(), fe(e);
1088
1256
  },
1089
1257
  onPointerMove: (e) => {
1090
- Z.current && _e(e);
1258
+ ce.current && fe(e);
1091
1259
  },
1092
1260
  onPointerUp: () => {
1093
- Z.current = !1, G === "hour" && (K("minute"), X.current?.focus());
1261
+ ce.current = !1, G === "hour" && (ae("minute"), X.current?.focus());
1094
1262
  },
1095
1263
  children: [
1096
- /* @__PURE__ */ o("span", {
1264
+ /* @__PURE__ */ s("span", {
1097
1265
  className: "ds-wtime-hand",
1098
1266
  style: {
1099
- width: le,
1100
- transform: `rotate(${Se - 90}deg)`
1267
+ width: Oe,
1268
+ transform: `rotate(${_e - 90}deg)`
1101
1269
  }
1102
1270
  }),
1103
- /* @__PURE__ */ o("span", { className: "ds-wtime-center" }),
1104
- Ce.map((e) => {
1105
- let t = te(e, G === "hour" ? 12 : 60, le, ce);
1106
- return /* @__PURE__ */ o("span", {
1271
+ /* @__PURE__ */ s("span", { className: "ds-wtime-center" }),
1272
+ ve.map((e) => {
1273
+ let t = V(e, G === "hour" ? 12 : 60, Oe, De);
1274
+ return /* @__PURE__ */ s("span", {
1107
1275
  className: "ds-wtime-num",
1108
- "data-selected": e === xe,
1276
+ "data-selected": e === ge,
1109
1277
  style: {
1110
- left: `${t.x / $ * 100}%`,
1111
- top: `${t.y / $ * 100}%`
1278
+ left: `${t.x / Ee * 100}%`,
1279
+ top: `${t.y / Ee * 100}%`
1112
1280
  },
1113
- children: G === "hour" ? e : V(e)
1281
+ children: G === "hour" ? e : te(e)
1114
1282
  }, e);
1115
1283
  })
1116
1284
  ]
1117
1285
  })]
1118
1286
  }),
1119
- /* @__PURE__ */ s("div", {
1287
+ /* @__PURE__ */ c("div", {
1120
1288
  className: "ds-wpicker-actions",
1121
1289
  children: [
1122
- /* @__PURE__ */ o("button", {
1290
+ /* @__PURE__ */ s("button", {
1123
1291
  type: "button",
1124
1292
  className: "ds-wpicker-mode",
1125
1293
  "aria-label": q === "dial" ? "Escribir la hora" : "Usar el reloj",
1126
1294
  onClick: () => J(q === "dial" ? "keyboard" : "dial"),
1127
- children: o(q === "dial" ? ae : ne, {})
1295
+ children: s(q === "dial" ? K : re, {})
1128
1296
  }),
1129
- /* @__PURE__ */ o("span", { className: "ds-wpicker-actions-spacer" }),
1130
- /* @__PURE__ */ o("button", {
1297
+ /* @__PURE__ */ s("span", { className: "ds-wpicker-actions-spacer" }),
1298
+ /* @__PURE__ */ s("button", {
1131
1299
  type: "button",
1132
1300
  className: "ds-wpicker-action",
1133
- onClick: () => me(),
1301
+ onClick: () => ue(),
1134
1302
  children: v
1135
1303
  }),
1136
- /* @__PURE__ */ o("button", {
1304
+ /* @__PURE__ */ s("button", {
1137
1305
  type: "button",
1138
1306
  className: "ds-wpicker-action",
1139
- onClick: he,
1307
+ onClick: de,
1140
1308
  children: y
1141
1309
  })
1142
1310
  ]
@@ -1144,11 +1312,11 @@ function fe({ label: n, value: a, defaultValue: c = "", onChange: l, placeholder
1144
1312
  ]
1145
1313
  })]
1146
1314
  }),
1147
- d && /* @__PURE__ */ o("small", {
1315
+ d && /* @__PURE__ */ s("small", {
1148
1316
  id: w,
1149
1317
  children: d
1150
1318
  }),
1151
- h && /* @__PURE__ */ o("input", {
1319
+ h && /* @__PURE__ */ s("input", {
1152
1320
  type: "hidden",
1153
1321
  name: h,
1154
1322
  value: D
@@ -1158,21 +1326,21 @@ function fe({ label: n, value: a, defaultValue: c = "", onChange: l, placeholder
1158
1326
  }
1159
1327
  //#endregion
1160
1328
  //#region src/wari/WariSchedule.tsx
1161
- function pe({ title: e = "Horario", headingLevel: n = 3, date: r, defaultDate: i, onDateChange: a, time: c, defaultTime: l, onTimeChange: u, dateLabel: d = "Fecha", timeLabel: f = "Hora de recojo", minDate: p, maxDate: m, dateName: h, timeName: g, required: _ = !0, disabled: v, dateError: y, timeError: b, dateSupportingText: x, timeSupportingText: S, locale: C, weekStartsOn: w, className: T }) {
1329
+ function Me({ title: e = "Horario", headingLevel: n = 3, date: r, defaultDate: i, onDateChange: a, time: o, defaultTime: l, onTimeChange: u, dateLabel: d = "Fecha", timeLabel: f = "Hora de recojo", minDate: p, maxDate: m, dateName: h, timeName: g, required: _ = !0, disabled: v, dateError: y, timeError: b, dateSupportingText: x, timeSupportingText: S, locale: C, weekStartsOn: w, className: T }) {
1162
1330
  let E = t(), D = `h${n}`;
1163
- return /* @__PURE__ */ s("section", {
1331
+ return /* @__PURE__ */ c("section", {
1164
1332
  className: ["ds-wschedule", T].filter(Boolean).join(" "),
1165
1333
  "aria-labelledby": E,
1166
- children: [/* @__PURE__ */ s("header", {
1334
+ children: [/* @__PURE__ */ c("header", {
1167
1335
  className: "ds-wschedule-header",
1168
- children: [/* @__PURE__ */ o(ne, { size: 24 }), /* @__PURE__ */ o(D, {
1336
+ children: [/* @__PURE__ */ s(re, { size: 24 }), /* @__PURE__ */ s(D, {
1169
1337
  id: E,
1170
1338
  className: "ds-wschedule-title",
1171
1339
  children: e
1172
1340
  })]
1173
- }), /* @__PURE__ */ s("div", {
1341
+ }), /* @__PURE__ */ c("div", {
1174
1342
  className: "ds-wschedule-fields",
1175
- children: [/* @__PURE__ */ o(Q, {
1343
+ children: [/* @__PURE__ */ s(Te, {
1176
1344
  label: d,
1177
1345
  value: r,
1178
1346
  defaultValue: i,
@@ -1186,9 +1354,9 @@ function pe({ title: e = "Horario", headingLevel: n = 3, date: r, defaultDate: i
1186
1354
  supportingText: x,
1187
1355
  locale: C,
1188
1356
  weekStartsOn: w
1189
- }), /* @__PURE__ */ o(fe, {
1357
+ }), /* @__PURE__ */ s(je, {
1190
1358
  label: f,
1191
- value: c,
1359
+ value: o,
1192
1360
  defaultValue: l,
1193
1361
  onChange: u,
1194
1362
  name: g,
@@ -1203,7 +1371,7 @@ function pe({ title: e = "Horario", headingLevel: n = 3, date: r, defaultDate: i
1203
1371
  }
1204
1372
  //#endregion
1205
1373
  //#region src/wari/trip.ts
1206
- var me = [
1374
+ var Ne = [
1207
1375
  {
1208
1376
  value: "lite",
1209
1377
  label: "Lite",
@@ -1241,20 +1409,51 @@ var me = [
1241
1409
  luggageAlt: 10,
1242
1410
  hourlyPrice: 140
1243
1411
  }
1244
- ], he = [
1412
+ ], Pe = [
1245
1413
  {
1246
1414
  value: "carseat",
1247
- label: "Carseat"
1415
+ label: "Carseat",
1416
+ maxQuantity: 2,
1417
+ choices: [
1418
+ {
1419
+ value: "0-2",
1420
+ label: "0-2 años"
1421
+ },
1422
+ {
1423
+ value: "3-5",
1424
+ label: "3-5 años"
1425
+ },
1426
+ {
1427
+ value: "6-10",
1428
+ label: "6-10 años"
1429
+ }
1430
+ ],
1431
+ note: "Solicítalo con al menos 2 horas de anticipación a la hora programada."
1248
1432
  },
1249
1433
  {
1250
1434
  value: "booster",
1251
- label: "Booster"
1435
+ label: "Booster",
1436
+ description: "Para niños de 4 hasta 12 años",
1437
+ maxQuantity: 2,
1438
+ note: "Solicítalo con al menos 2 horas de anticipación a la hora programada."
1252
1439
  },
1253
1440
  {
1254
1441
  value: "carga",
1255
- label: "Carga"
1442
+ label: "Carga",
1443
+ fields: [{
1444
+ name: "weight",
1445
+ label: "Peso aproximado",
1446
+ placeholder: "Peso aprox.",
1447
+ inputMode: "decimal",
1448
+ width: "96px"
1449
+ }, {
1450
+ name: "value",
1451
+ label: "Valor estimado en soles",
1452
+ placeholder: "S/Valor est.",
1453
+ inputMode: "decimal"
1454
+ }]
1256
1455
  }
1257
- ], ge = [
1456
+ ], Fe = [
1258
1457
  {
1259
1458
  value: "efectivo",
1260
1459
  label: "Efectivo"
@@ -1267,16 +1466,19 @@ var me = [
1267
1466
  value: "vale",
1268
1467
  label: "Vale corporativo"
1269
1468
  }
1270
- ], _e = {
1469
+ ], Ie = {
1271
1470
  service: "lite",
1272
1471
  hourly: !1,
1273
1472
  delivery: !1,
1274
1473
  extras: [],
1474
+ extraQuantities: {},
1475
+ extraChoices: {},
1476
+ extraFields: {},
1275
1477
  vehicles: 1,
1276
1478
  payment: "efectivo"
1277
- }, ve = (e) => `S/${Number.isInteger(e) ? e : e.toFixed(2)}`;
1278
- function ye(e, t) {
1279
- let n = t.hourly && e.hourlyPrice != null ? `Desde ${ve(e.hourlyPrice)}` : null, r = !t.hourly && !t.delivery ? {
1479
+ }, Le = (e) => `S/${Number.isInteger(e) ? e : e.toFixed(2)}`;
1480
+ function Re(e, t) {
1481
+ let n = t.hourly && e.hourlyPrice != null ? `Desde ${Le(e.hourlyPrice)}` : null, r = !t.hourly && !t.delivery ? {
1280
1482
  passengers: e.passengers,
1281
1483
  luggage: e.luggage,
1282
1484
  luggageAlt: e.luggageAlt
@@ -1288,10 +1490,10 @@ function ye(e, t) {
1288
1490
  label: i.join(", ")
1289
1491
  };
1290
1492
  }
1291
- function be(e, t = 1, n = 99) {
1493
+ function ze(e, t = 1, n = 99) {
1292
1494
  return Number.isFinite(e) ? Math.min(n, Math.max(t, Math.round(e))) : t;
1293
1495
  }
1294
- function xe(e, t, n) {
1496
+ function Be(e, t, n) {
1295
1497
  let r = t.normalize("NFD").replace(/\p{Diacritic}/gu, "").toLowerCase();
1296
1498
  if (!r) return -1;
1297
1499
  let i = e.length;
@@ -1301,26 +1503,54 @@ function xe(e, t, n) {
1301
1503
  }
1302
1504
  return -1;
1303
1505
  }
1304
- function Se(e, t, n = he) {
1506
+ function Ve(e, t, n = Pe) {
1305
1507
  let r = new Set(e);
1306
1508
  return r.has(t) ? r.delete(t) : r.add(t), n.filter((e) => r.has(e.value)).map((e) => e.value);
1307
1509
  }
1510
+ function He(e, t, n = Pe) {
1511
+ let r = {};
1512
+ for (let i of n) i.maxQuantity && e.includes(i.value) && (r[i.value] = ze(t[i.value] ?? 1, 1, i.maxQuantity));
1513
+ return r;
1514
+ }
1515
+ function Ue(e, t, n = Pe) {
1516
+ let r = {};
1517
+ for (let i of n) {
1518
+ if (!i.choices?.length || !e.includes(i.value)) continue;
1519
+ let n = (t[i.value] ?? []).filter((e) => i.choices.some((t) => t.value === e)), a = i.maxQuantity ?? 1;
1520
+ r[i.value] = (n.length ? n : [i.choices[0].value]).slice(0, Math.max(1, a));
1521
+ }
1522
+ return r;
1523
+ }
1524
+ function We(e, t, n = Pe) {
1525
+ let r = {};
1526
+ for (let i of n) i.fields?.length && e.includes(i.value) && (r[i.value] = Object.fromEntries(i.fields.map((e) => [e.name, t[i.value]?.[e.name] ?? ""])));
1527
+ return r;
1528
+ }
1529
+ function Ge(e, t = {}, n = Pe) {
1530
+ let r = Ue(e, t.extraChoices ?? {}, n), i = He(e, t.extraQuantities ?? {}, n);
1531
+ for (let [e, t] of Object.entries(r)) i[e] = t.length;
1532
+ return {
1533
+ extraQuantities: i,
1534
+ extraChoices: r,
1535
+ extraFields: We(e, t.extraFields ?? {}, n)
1536
+ };
1537
+ }
1308
1538
  //#endregion
1309
1539
  //#region src/wari/WariSelect.tsx
1310
- function Ce({ label: n, "aria-label": a, options: c, value: l, defaultValue: u = "", onChange: d, placeholder: f = "Seleccionar", supportingText: p, error: m = !1, required: h, disabled: g = !1, name: _, id: v, className: y }) {
1311
- let b = t(), x = v ?? b, S = `${x}-label`, C = `${x}-value`, w = `${x}-listbox`, T = `${x}-hint`, [E, D] = i(u), O = l ?? E, [k, A] = i(!1), [j, M] = i(0), N = r(null), P = r(null), F = r({
1540
+ function Ke({ label: n, "aria-label": r, options: o, value: l, defaultValue: u = "", onChange: d, placeholder: f = "Seleccionar", supportingText: p, error: m = !1, required: h, disabled: g = !1, name: _, id: v, className: y }) {
1541
+ let b = t(), x = v ?? b, S = `${x}-label`, C = `${x}-value`, w = `${x}-listbox`, T = `${x}-hint`, [E, D] = a(u), O = l ?? E, [k, A] = a(!1), [j, M] = a(0), N = i(null), P = i(null), F = i({
1312
1542
  text: "",
1313
1543
  at: 0
1314
- }), I = c.findIndex((e) => e.value === O), L = c[I], ee = (e) => !!c[e] && !c[e].disabled, R = (e) => {
1315
- let t = c[e];
1544
+ }), I = o.findIndex((e) => e.value === O), L = o[I], R = (e) => !!o[e] && !o[e].disabled, ee = (e) => {
1545
+ let t = o[e];
1316
1546
  t && !t.disabled && (l === void 0 && D(t.value), t.value !== O && d?.(t.value));
1317
1547
  }, z = (e) => {
1318
1548
  g || (M(Math.max(0, e)), A(!0));
1319
- }, te = (e, t) => {
1549
+ }, B = (e, t) => {
1320
1550
  let n = e;
1321
- for (let e = 0; e < c.length; e++) {
1322
- if (n = Math.min(c.length - 1, Math.max(0, n + t)), ee(n)) return n;
1323
- if (n === 0 || n === c.length - 1) break;
1551
+ for (let e = 0; e < o.length; e++) {
1552
+ if (n = Math.min(o.length - 1, Math.max(0, n + t)), R(n)) return n;
1553
+ if (n === 0 || n === o.length - 1) break;
1324
1554
  }
1325
1555
  return e;
1326
1556
  };
@@ -1335,7 +1565,7 @@ function Ce({ label: n, "aria-label": a, options: c, value: l, defaultValue: u =
1335
1565
  k,
1336
1566
  j,
1337
1567
  x
1338
- ]), /* @__PURE__ */ s("div", {
1568
+ ]), /* @__PURE__ */ c("div", {
1339
1569
  ref: N,
1340
1570
  className: [
1341
1571
  "ds-input",
@@ -1352,18 +1582,18 @@ function Ce({ label: n, "aria-label": a, options: c, value: l, defaultValue: u =
1352
1582
  k && t && !N.current?.contains(t) && A(!1);
1353
1583
  },
1354
1584
  children: [
1355
- n && /* @__PURE__ */ s("label", {
1585
+ n && /* @__PURE__ */ c("label", {
1356
1586
  id: S,
1357
1587
  onClick: () => P.current?.focus(),
1358
- children: [n, h && /* @__PURE__ */ o("span", {
1588
+ children: [n, h && /* @__PURE__ */ s("span", {
1359
1589
  className: "ds-input-required",
1360
1590
  "aria-hidden": "true",
1361
1591
  children: "*"
1362
1592
  })]
1363
1593
  }),
1364
- /* @__PURE__ */ s("div", {
1594
+ /* @__PURE__ */ c("div", {
1365
1595
  className: "ds-wfield-anchor",
1366
- children: [/* @__PURE__ */ s("div", {
1596
+ children: [/* @__PURE__ */ c("div", {
1367
1597
  ref: P,
1368
1598
  className: "ds-input-shell",
1369
1599
  role: "combobox",
@@ -1372,7 +1602,7 @@ function Ce({ label: n, "aria-label": a, options: c, value: l, defaultValue: u =
1372
1602
  "aria-expanded": k,
1373
1603
  "aria-controls": w,
1374
1604
  "aria-labelledby": n ? `${S} ${C}` : void 0,
1375
- "aria-label": n ? void 0 : a,
1605
+ "aria-label": n ? void 0 : r,
1376
1606
  "aria-activedescendant": k ? `${x}-option-${j}` : void 0,
1377
1607
  "aria-disabled": g || void 0,
1378
1608
  "aria-required": h || void 0,
@@ -1384,30 +1614,30 @@ function Ce({ label: n, "aria-label": a, options: c, value: l, defaultValue: u =
1384
1614
  let t = I >= 0 ? I : 0;
1385
1615
  switch (e.key) {
1386
1616
  case "ArrowDown":
1387
- e.preventDefault(), k ? M(te(j, 1)) : z(t);
1617
+ e.preventDefault(), k ? M(B(j, 1)) : z(t);
1388
1618
  return;
1389
1619
  case "ArrowUp":
1390
- e.preventDefault(), k ? M(te(j, -1)) : z(t);
1620
+ e.preventDefault(), k ? M(B(j, -1)) : z(t);
1391
1621
  return;
1392
1622
  case "Home":
1393
- e.preventDefault(), z(te(-1, 1));
1623
+ e.preventDefault(), z(B(-1, 1));
1394
1624
  return;
1395
1625
  case "End":
1396
- e.preventDefault(), z(te(c.length, -1));
1626
+ e.preventDefault(), z(B(o.length, -1));
1397
1627
  return;
1398
1628
  case "PageDown":
1399
1629
  case "PageUp":
1400
- k && (e.preventDefault(), M(te(j, e.key === "PageDown" ? 10 : -10)));
1630
+ k && (e.preventDefault(), M(B(j, e.key === "PageDown" ? 10 : -10)));
1401
1631
  return;
1402
1632
  case "Enter":
1403
1633
  case " ":
1404
- e.preventDefault(), k ? (R(j), A(!1)) : z(t);
1634
+ e.preventDefault(), k ? (ee(j), A(!1)) : z(t);
1405
1635
  return;
1406
1636
  case "Escape":
1407
1637
  k && (e.preventDefault(), A(!1));
1408
1638
  return;
1409
1639
  case "Tab":
1410
- k && (R(j), A(!1));
1640
+ k && (ee(j), A(!1));
1411
1641
  return;
1412
1642
  }
1413
1643
  if (e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey) {
@@ -1416,38 +1646,38 @@ function Ce({ label: n, "aria-label": a, options: c, value: l, defaultValue: u =
1416
1646
  text: n - F.current.at < 600 ? F.current.text + e.key : e.key,
1417
1647
  at: n
1418
1648
  };
1419
- let r = k ? j : t, i = xe(c, F.current.text, F.current.text.length > 1 ? r - 1 : r);
1649
+ let r = k ? j : t, i = Be(o, F.current.text, F.current.text.length > 1 ? r - 1 : r);
1420
1650
  i >= 0 && (k ? M(i) : z(i));
1421
1651
  }
1422
1652
  },
1423
1653
  children: [
1424
- /* @__PURE__ */ s("span", {
1654
+ /* @__PURE__ */ c("span", {
1425
1655
  id: C,
1426
1656
  className: "ds-wselect-value",
1427
1657
  "data-placeholder": !L,
1428
- children: [L ? L.label : f, L?.metaLabel && /* @__PURE__ */ s("span", {
1658
+ children: [L ? L.label : f, L?.metaLabel && /* @__PURE__ */ c("span", {
1429
1659
  className: "ds-wvisually-hidden",
1430
1660
  children: [", ", L.metaLabel]
1431
1661
  })]
1432
1662
  }),
1433
- L?.meta && /* @__PURE__ */ o("span", {
1663
+ L?.meta && /* @__PURE__ */ s("span", {
1434
1664
  "aria-hidden": "true",
1435
1665
  style: { display: "contents" },
1436
1666
  children: L.meta
1437
1667
  }),
1438
- /* @__PURE__ */ o("span", {
1668
+ /* @__PURE__ */ s("span", {
1439
1669
  className: "ds-wselect-caret",
1440
1670
  "aria-hidden": "true",
1441
- children: /* @__PURE__ */ o(q, {})
1671
+ children: /* @__PURE__ */ s(J, {})
1442
1672
  })
1443
1673
  ]
1444
- }), k && /* @__PURE__ */ o("ul", {
1674
+ }), k && /* @__PURE__ */ s("ul", {
1445
1675
  id: w,
1446
1676
  className: "ds-wselect-list",
1447
1677
  role: "listbox",
1448
1678
  "aria-labelledby": n ? S : void 0,
1449
- "aria-label": n ? void 0 : a,
1450
- children: c.map((e, t) => /* @__PURE__ */ s("li", {
1679
+ "aria-label": n ? void 0 : r,
1680
+ children: o.map((e, t) => /* @__PURE__ */ c("li", {
1451
1681
  id: `${x}-option-${t}`,
1452
1682
  role: "option",
1453
1683
  className: "ds-wselect-option",
@@ -1460,12 +1690,12 @@ function Ce({ label: n, "aria-label": a, options: c, value: l, defaultValue: u =
1460
1690
  t !== j && !e.disabled && M(t);
1461
1691
  },
1462
1692
  onClick: () => {
1463
- e.disabled || (R(t), A(!1), P.current?.focus());
1693
+ e.disabled || (ee(t), A(!1), P.current?.focus());
1464
1694
  },
1465
- children: [/* @__PURE__ */ o("span", {
1695
+ children: [/* @__PURE__ */ s("span", {
1466
1696
  className: "ds-wselect-label",
1467
1697
  children: e.label
1468
- }), e.meta && /* @__PURE__ */ o("span", {
1698
+ }), e.meta && /* @__PURE__ */ s("span", {
1469
1699
  "aria-hidden": "true",
1470
1700
  style: { display: "contents" },
1471
1701
  children: e.meta
@@ -1473,11 +1703,11 @@ function Ce({ label: n, "aria-label": a, options: c, value: l, defaultValue: u =
1473
1703
  }, e.value))
1474
1704
  })]
1475
1705
  }),
1476
- p && /* @__PURE__ */ o("small", {
1706
+ p && /* @__PURE__ */ s("small", {
1477
1707
  id: T,
1478
1708
  children: p
1479
1709
  }),
1480
- _ && /* @__PURE__ */ o("input", {
1710
+ _ && /* @__PURE__ */ s("input", {
1481
1711
  type: "hidden",
1482
1712
  name: _,
1483
1713
  value: O
@@ -1486,143 +1716,268 @@ function Ce({ label: n, "aria-label": a, options: c, value: l, defaultValue: u =
1486
1716
  });
1487
1717
  }
1488
1718
  //#endregion
1489
- //#region src/wari/WariSwitchList.tsx
1490
- function we({ legend: e, items: t, value: n, defaultValue: r = [], onChange: a, orientation: c = "vertical", name: l, disabled: u = !1, className: d }) {
1491
- let [f, p] = i(r), m = n ?? f, h = (e, r) => {
1492
- let i = new Set(m);
1493
- r ? i.add(e) : i.delete(e);
1494
- let o = t.filter((e) => i.has(e.value)).map((e) => e.value);
1495
- n === void 0 && p(o), a?.(o);
1496
- };
1497
- return /* @__PURE__ */ s("fieldset", {
1498
- className: ["ds-wswitches", d].filter(Boolean).join(" "),
1499
- "data-orientation": c,
1500
- disabled: u,
1501
- children: [/* @__PURE__ */ o("legend", { children: e }), t.map((e) => /* @__PURE__ */ s("label", {
1502
- className: "ds-wswitch",
1503
- children: [/* @__PURE__ */ o("span", { children: e.label }), /* @__PURE__ */ o("input", {
1504
- type: "checkbox",
1505
- role: "switch",
1506
- name: l,
1507
- value: e.value,
1508
- checked: m.includes(e.value),
1509
- disabled: e.disabled,
1510
- onChange: (t) => h(e.value, t.target.checked)
1511
- })]
1512
- }, e.value))]
1513
- });
1514
- }
1515
- //#endregion
1516
1719
  //#region src/wari/WariStepper.tsx
1517
- function Te({ label: e, value: n, defaultValue: r = 1, onChange: a, min: c = 1, max: l = 99, name: u, id: d, disabled: f = !1, supportingText: p, className: m }) {
1518
- let h = t(), g = d ?? h, [_, v] = i(() => be(r, c, l)), y = n ?? _, [b, x] = i(null), S = (e) => {
1519
- let t = be(e, c, l);
1520
- n === void 0 && v(t), t !== y && a?.(t);
1521
- }, C = () => {
1522
- b !== null && (b.trim() && S(Number(b)), x(null));
1523
- }, w = e ? e.toLowerCase() : "cantidad";
1524
- return /* @__PURE__ */ s("div", {
1720
+ function qe({ label: e, "aria-label": n, variant: r = "filled", value: i, defaultValue: o = 1, onChange: l, min: u = 1, max: d = 99, name: f, id: p, disabled: m = !1, supportingText: h, className: g }) {
1721
+ let _ = t(), v = p ?? _, [y, b] = a(() => ze(o, u, d)), x = i ?? y, [S, C] = a(null), w = (e) => {
1722
+ let t = ze(e, u, d);
1723
+ i === void 0 && b(t), t !== x && l?.(t);
1724
+ }, T = () => {
1725
+ S !== null && (S.trim() && w(Number(S)), C(null));
1726
+ }, E = (e ?? n ?? "cantidad").toLowerCase();
1727
+ return /* @__PURE__ */ c("div", {
1525
1728
  className: [
1526
1729
  "ds-input",
1527
1730
  "ds-wfield",
1528
1731
  "ds-wstepper",
1529
- m
1732
+ g
1530
1733
  ].filter(Boolean).join(" "),
1531
- "data-disabled": f,
1734
+ "data-disabled": m,
1532
1735
  "data-label": "lg",
1736
+ "data-variant": r,
1533
1737
  children: [
1534
- e && /* @__PURE__ */ o("label", {
1535
- htmlFor: g,
1738
+ e && /* @__PURE__ */ s("label", {
1739
+ htmlFor: v,
1536
1740
  children: e
1537
1741
  }),
1538
- /* @__PURE__ */ s("div", {
1742
+ /* @__PURE__ */ c("div", {
1539
1743
  className: "ds-input-shell",
1540
1744
  children: [
1541
- /* @__PURE__ */ o("button", {
1745
+ /* @__PURE__ */ s("button", {
1542
1746
  type: "button",
1543
1747
  className: "ds-wstepper-button",
1544
- "aria-label": `Disminuir ${w}`,
1545
- "aria-controls": g,
1546
- disabled: f || y <= c,
1547
- onClick: () => S(y - 1),
1548
- children: /* @__PURE__ */ o(J, {})
1748
+ "aria-label": `Disminuir ${E}`,
1749
+ "aria-controls": v,
1750
+ disabled: m || x <= u,
1751
+ onClick: () => w(x - 1),
1752
+ children: /* @__PURE__ */ s(oe, {})
1549
1753
  }),
1550
- /* @__PURE__ */ o("input", {
1551
- id: g,
1754
+ /* @__PURE__ */ s("input", {
1755
+ id: v,
1552
1756
  type: "text",
1553
1757
  inputMode: "numeric",
1554
1758
  role: "spinbutton",
1555
- name: u,
1556
- disabled: f,
1557
- "aria-valuenow": y,
1558
- "aria-valuemin": c,
1559
- "aria-valuemax": l,
1560
- "aria-describedby": p ? `${g}-hint` : void 0,
1561
- value: b ?? String(y),
1562
- onChange: (e) => x(e.target.value.replace(/\D/g, "")),
1563
- onBlur: C,
1759
+ name: f,
1760
+ disabled: m,
1761
+ "aria-label": e ? void 0 : n,
1762
+ "aria-valuenow": x,
1763
+ "aria-valuemin": u,
1764
+ "aria-valuemax": d,
1765
+ "aria-describedby": h ? `${v}-hint` : void 0,
1766
+ value: S ?? String(x),
1767
+ onChange: (e) => C(e.target.value.replace(/\D/g, "")),
1768
+ onBlur: T,
1564
1769
  onKeyDown: (e) => {
1565
1770
  let t = {
1566
- ArrowUp: y + 1,
1567
- ArrowDown: y - 1,
1568
- PageUp: y + 10,
1569
- PageDown: y - 10,
1570
- Home: c,
1571
- End: l
1771
+ ArrowUp: x + 1,
1772
+ ArrowDown: x - 1,
1773
+ PageUp: x + 10,
1774
+ PageDown: x - 10,
1775
+ Home: u,
1776
+ End: d
1572
1777
  };
1573
- e.key in t && (e.preventDefault(), x(null), S(t[e.key])), e.key === "Enter" && (e.preventDefault(), C());
1778
+ e.key in t && (e.preventDefault(), C(null), w(t[e.key])), e.key === "Enter" && (e.preventDefault(), T());
1574
1779
  }
1575
1780
  }),
1576
- /* @__PURE__ */ o("button", {
1781
+ /* @__PURE__ */ s("button", {
1577
1782
  type: "button",
1578
1783
  className: "ds-wstepper-button",
1579
- "aria-label": `Aumentar ${w}`,
1580
- "aria-controls": g,
1581
- disabled: f || y >= l,
1582
- onClick: () => S(y + 1),
1583
- children: /* @__PURE__ */ o(oe, {})
1784
+ "aria-label": `Aumentar ${E}`,
1785
+ "aria-controls": v,
1786
+ disabled: m || x >= d,
1787
+ onClick: () => w(x + 1),
1788
+ children: /* @__PURE__ */ s(Y, {})
1584
1789
  })
1585
1790
  ]
1586
1791
  }),
1587
- p && /* @__PURE__ */ o("small", {
1588
- id: `${g}-hint`,
1589
- children: p
1792
+ h && /* @__PURE__ */ s("small", {
1793
+ id: `${v}-hint`,
1794
+ children: h
1590
1795
  })
1591
1796
  ]
1592
1797
  });
1593
1798
  }
1594
1799
  //#endregion
1800
+ //#region src/wari/WariSwitchList.tsx
1801
+ function Je({ legend: e, items: n, value: r, defaultValue: i = [], onChange: l, quantities: u, defaultQuantities: d = {}, onQuantitiesChange: f, choices: p, defaultChoices: m = {}, onChoicesChange: h, fields: g, defaultFields: _ = {}, onFieldsChange: v, orientation: y = "vertical", name: b, disabled: x = !1, className: S }) {
1802
+ let C = t(), [w, T] = a(i), E = r ?? w, [D] = a(() => Ge(i, {
1803
+ extraQuantities: d,
1804
+ extraChoices: m,
1805
+ extraFields: _
1806
+ }, n)), [O, k] = a(D.extraQuantities), [A, j] = a(D.extraChoices), [M, N] = a(D.extraFields), P = u ?? O, F = p ?? A, I = g ?? M, L = (e, t) => {
1807
+ let i = new Set(E);
1808
+ t ? i.add(e) : i.delete(e);
1809
+ let a = n.filter((e) => i.has(e.value)).map((e) => e.value), o = Ge(a, {
1810
+ extraQuantities: P,
1811
+ extraChoices: F,
1812
+ extraFields: I
1813
+ }, n);
1814
+ r === void 0 && T(a), u === void 0 && k(o.extraQuantities), p === void 0 && j(o.extraChoices), g === void 0 && N(o.extraFields), l?.(a, o.extraQuantities, o.extraChoices, o.extraFields);
1815
+ }, R = (e, t, n) => {
1816
+ let r = {
1817
+ ...I,
1818
+ [e]: {
1819
+ ...I[e],
1820
+ [t]: n
1821
+ }
1822
+ };
1823
+ g === void 0 && N(r), v?.(r);
1824
+ }, ee = (e, t) => {
1825
+ let n = {
1826
+ ...P,
1827
+ [e]: t
1828
+ };
1829
+ u === void 0 && k(n), f?.(n);
1830
+ }, z = (e, t, n) => {
1831
+ let r = {
1832
+ ...F,
1833
+ [e]: t
1834
+ }, i = {
1835
+ ...P,
1836
+ [e]: t.length
1837
+ };
1838
+ p === void 0 && j(r), u === void 0 && k(i), h?.(r, i), n && requestAnimationFrame(() => {
1839
+ let e = document.getElementById(n)?.querySelectorAll("[role=\"combobox\"]");
1840
+ e?.[e.length - 1]?.focus();
1841
+ });
1842
+ };
1843
+ return /* @__PURE__ */ c("fieldset", {
1844
+ className: ["ds-wswitches", S].filter(Boolean).join(" "),
1845
+ "data-orientation": y,
1846
+ disabled: x,
1847
+ children: [/* @__PURE__ */ s("legend", { children: e }), n.map((e, t) => {
1848
+ let n = E.includes(e.value), r = !!e.choices?.length, i = !!e.fields?.length, a = !!(e.description || e.note || e.maxQuantity || r || i), l = `${C}-panel-${t}`, u = `${C}-desc-${t}`, d = F[e.value] ?? [], f = e.maxQuantity ?? 1;
1849
+ return /* @__PURE__ */ c("div", {
1850
+ className: "ds-wswitch-item",
1851
+ children: [/* @__PURE__ */ c("label", {
1852
+ className: "ds-wswitch",
1853
+ children: [/* @__PURE__ */ s("span", { children: e.label }), /* @__PURE__ */ s("input", {
1854
+ type: "checkbox",
1855
+ role: "switch",
1856
+ name: b,
1857
+ value: e.value,
1858
+ checked: n,
1859
+ disabled: e.disabled,
1860
+ "aria-controls": a ? l : void 0,
1861
+ "aria-expanded": a ? n : void 0,
1862
+ "aria-describedby": a && n && e.description ? u : void 0,
1863
+ onChange: (t) => L(e.value, t.target.checked)
1864
+ })]
1865
+ }), a && /* @__PURE__ */ s("div", {
1866
+ id: l,
1867
+ className: "ds-wswitch-panel",
1868
+ hidden: !n,
1869
+ children: n && /* @__PURE__ */ c(o, { children: [
1870
+ e.description && /* @__PURE__ */ s("p", {
1871
+ id: u,
1872
+ className: "ds-wswitch-desc",
1873
+ children: e.description
1874
+ }),
1875
+ r && /* @__PURE__ */ s("div", {
1876
+ className: "ds-wswitch-units",
1877
+ role: "group",
1878
+ "aria-label": e.label,
1879
+ children: d.map((t, n) => /* @__PURE__ */ c("div", {
1880
+ className: "ds-wswitch-unit",
1881
+ children: [
1882
+ /* @__PURE__ */ s(Ke, {
1883
+ "aria-label": `${e.label} ${n + 1}`,
1884
+ options: e.choices,
1885
+ value: t,
1886
+ disabled: x || e.disabled,
1887
+ name: b ? `${b}.${e.value}` : void 0,
1888
+ onChange: (t) => z(e.value, d.map((e, r) => r === n ? t : e))
1889
+ }),
1890
+ d.length > 1 && /* @__PURE__ */ s("button", {
1891
+ type: "button",
1892
+ className: "ds-wswitch-unit-button",
1893
+ "aria-label": `Quitar ${e.label} ${n + 1}`,
1894
+ disabled: x || e.disabled,
1895
+ onClick: () => z(e.value, d.filter((e, t) => t !== n), l),
1896
+ children: /* @__PURE__ */ s(pe, {})
1897
+ }),
1898
+ n === d.length - 1 && d.length < f && /* @__PURE__ */ s("button", {
1899
+ type: "button",
1900
+ className: "ds-wswitch-unit-button",
1901
+ "aria-label": `Agregar otro ${e.label}`,
1902
+ disabled: x || e.disabled,
1903
+ onClick: () => z(e.value, [...d, e.choices[0].value], l),
1904
+ children: /* @__PURE__ */ s(Y, {})
1905
+ })
1906
+ ]
1907
+ }, n))
1908
+ }),
1909
+ i && /* @__PURE__ */ s("div", {
1910
+ className: "ds-wswitch-fields",
1911
+ role: "group",
1912
+ "aria-label": e.label,
1913
+ children: e.fields.map((t) => /* @__PURE__ */ s("input", {
1914
+ className: "ds-wswitch-field",
1915
+ type: "text",
1916
+ inputMode: t.inputMode ?? "text",
1917
+ "aria-label": t.label,
1918
+ placeholder: t.placeholder,
1919
+ autoComplete: "off",
1920
+ "data-fixed": t.width ? !0 : void 0,
1921
+ style: t.width ? { width: t.width } : void 0,
1922
+ value: I[e.value]?.[t.name] ?? "",
1923
+ disabled: x || e.disabled,
1924
+ name: b ? `${b}.${e.value}.${t.name}` : void 0,
1925
+ onChange: (n) => R(e.value, t.name, n.target.value)
1926
+ }, t.name))
1927
+ }),
1928
+ !r && e.maxQuantity != null && /* @__PURE__ */ s(qe, {
1929
+ "aria-label": `Cantidad de ${e.label}`,
1930
+ variant: "outlined",
1931
+ min: 1,
1932
+ max: e.maxQuantity,
1933
+ value: P[e.value] ?? 1,
1934
+ disabled: x || e.disabled,
1935
+ name: b ? `${b}.${e.value}` : void 0,
1936
+ onChange: (t) => ee(e.value, t)
1937
+ }),
1938
+ e.note && /* @__PURE__ */ s("p", {
1939
+ className: "ds-wswitch-note",
1940
+ role: "note",
1941
+ children: e.note
1942
+ })
1943
+ ] })
1944
+ })]
1945
+ }, e.value);
1946
+ })]
1947
+ });
1948
+ }
1949
+ //#endregion
1595
1950
  //#region src/wari/WariServiceMeta.tsx
1596
- function Ee({ service: e, hourly: t = !1, delivery: n = !1 }) {
1597
- let r = ye(e, {
1951
+ function Ye({ service: e, hourly: t = !1, delivery: n = !1 }) {
1952
+ let r = Re(e, {
1598
1953
  hourly: t,
1599
1954
  delivery: n
1600
1955
  });
1601
- return /* @__PURE__ */ s("span", {
1956
+ return /* @__PURE__ */ c("span", {
1602
1957
  className: "ds-wmeta",
1603
1958
  children: [
1604
- r.delivery && /* @__PURE__ */ o("span", {
1959
+ r.delivery && /* @__PURE__ */ s("span", {
1605
1960
  className: "ds-wmeta-badge",
1606
1961
  children: "Envío"
1607
1962
  }),
1608
- r.price && /* @__PURE__ */ o("span", {
1963
+ r.price && /* @__PURE__ */ s("span", {
1609
1964
  className: "ds-wmeta-item",
1610
1965
  children: r.price
1611
1966
  }),
1612
- r.capacity && /* @__PURE__ */ s(a, { children: [
1613
- /* @__PURE__ */ s("span", {
1967
+ r.capacity && /* @__PURE__ */ c(o, { children: [
1968
+ /* @__PURE__ */ c("span", {
1614
1969
  className: "ds-wmeta-item",
1615
- children: [/* @__PURE__ */ o(se, {}), r.capacity.passengers]
1970
+ children: [/* @__PURE__ */ s(X, {}), r.capacity.passengers]
1616
1971
  }),
1617
- /* @__PURE__ */ s("span", {
1972
+ /* @__PURE__ */ c("span", {
1618
1973
  className: "ds-wmeta-item",
1619
- children: [/* @__PURE__ */ o(X, {}), r.capacity.luggage]
1974
+ children: [/* @__PURE__ */ s(ce, {}), r.capacity.luggage]
1620
1975
  }),
1621
- r.capacity.luggageAlt != null && /* @__PURE__ */ s("span", {
1976
+ r.capacity.luggageAlt != null && /* @__PURE__ */ c("span", {
1622
1977
  className: "ds-wmeta-item",
1623
1978
  children: [
1624
1979
  "o ",
1625
- /* @__PURE__ */ o(Z, {}),
1980
+ /* @__PURE__ */ s(Z, {}),
1626
1981
  r.capacity.luggageAlt
1627
1982
  ]
1628
1983
  })
@@ -1632,16 +1987,16 @@ function Ee({ service: e, hourly: t = !1, delivery: n = !1 }) {
1632
1987
  }
1633
1988
  //#endregion
1634
1989
  //#region src/wari/WariTripAttributes.tsx
1635
- function De({ title: e = "Atributos del viaje", headingLevel: n = 3, value: r, defaultValue: a, onChange: c, services: l = me, extras: u = he, paymentMethods: d = ge, maxVehicles: f = 10, name: p, disabled: m = !1, serviceLabel: h = "Tipo de servicio", vehiclesLabel: g = "Cantidad de vehículos", paymentLabel: _ = "Método de pago", hourlyLabel: v = "Por horas", deliveryLabel: y = "Envíos", className: b }) {
1636
- let x = t(), [S, C] = i(() => ({
1637
- ..._e,
1638
- ...a
1990
+ function Xe({ title: e = "Atributos del viaje", headingLevel: n = 3, value: r, defaultValue: i, onChange: o, services: l = Ne, extras: u = Pe, paymentMethods: d = Fe, maxVehicles: f = 10, name: p, disabled: m = !1, serviceLabel: h = "Tipo de servicio", vehiclesLabel: g = "Cantidad de vehículos", paymentLabel: _ = "Método de pago", hourlyLabel: v = "Por horas", deliveryLabel: y = "Envíos", className: b }) {
1991
+ let x = t(), [S, C] = a(() => ({
1992
+ ...Ie,
1993
+ ...i
1639
1994
  })), w = r ?? S, T = (e) => {
1640
1995
  let t = {
1641
1996
  ...w,
1642
1997
  ...e
1643
1998
  };
1644
- r === void 0 && C(t), c?.(t);
1999
+ r === void 0 && C(t), o?.(t);
1645
2000
  }, E = (e) => p ? `${p}.${e}` : void 0, D = `h${n}`, O = {
1646
2001
  hourly: w.hourly,
1647
2002
  delivery: w.delivery
@@ -1652,26 +2007,26 @@ function De({ title: e = "Atributos del viaje", headingLevel: n = 3, value: r, d
1652
2007
  value: "delivery",
1653
2008
  label: y
1654
2009
  }];
1655
- return /* @__PURE__ */ s("section", {
2010
+ return /* @__PURE__ */ c("section", {
1656
2011
  className: [
1657
2012
  "ds-wcard",
1658
2013
  "ds-wtrip",
1659
2014
  b
1660
2015
  ].filter(Boolean).join(" "),
1661
2016
  "aria-labelledby": x,
1662
- children: [/* @__PURE__ */ s("header", {
2017
+ children: [/* @__PURE__ */ c("header", {
1663
2018
  className: "ds-wcard-header",
1664
- children: [/* @__PURE__ */ o(K, {}), /* @__PURE__ */ o(D, {
2019
+ children: [/* @__PURE__ */ s(q, {}), /* @__PURE__ */ s(D, {
1665
2020
  id: x,
1666
2021
  className: "ds-wcard-title",
1667
2022
  children: e
1668
2023
  })]
1669
- }), /* @__PURE__ */ s("div", {
2024
+ }), /* @__PURE__ */ c("div", {
1670
2025
  className: "ds-wcard-body",
1671
2026
  children: [
1672
- /* @__PURE__ */ s("div", {
2027
+ /* @__PURE__ */ c("div", {
1673
2028
  className: "ds-wtrip-service",
1674
- children: [/* @__PURE__ */ o(Ce, {
2029
+ children: [/* @__PURE__ */ s(Ke, {
1675
2030
  label: h,
1676
2031
  value: w.service,
1677
2032
  onChange: (e) => T({ service: e }),
@@ -1681,13 +2036,13 @@ function De({ title: e = "Atributos del viaje", headingLevel: n = 3, value: r, d
1681
2036
  value: e.value,
1682
2037
  label: e.label,
1683
2038
  disabled: e.disabled,
1684
- meta: /* @__PURE__ */ o(Ee, {
2039
+ meta: /* @__PURE__ */ s(Ye, {
1685
2040
  service: e,
1686
2041
  ...O
1687
2042
  }),
1688
- metaLabel: ye(e, O).label
2043
+ metaLabel: Re(e, O).label
1689
2044
  }))
1690
- }), /* @__PURE__ */ o(we, {
2045
+ }), /* @__PURE__ */ s(Je, {
1691
2046
  legend: "Modalidad del viaje",
1692
2047
  orientation: "horizontal",
1693
2048
  items: k,
@@ -1700,15 +2055,29 @@ function De({ title: e = "Atributos del viaje", headingLevel: n = 3, value: r, d
1700
2055
  name: E("mode")
1701
2056
  })]
1702
2057
  }),
1703
- /* @__PURE__ */ o(we, {
2058
+ /* @__PURE__ */ s(Je, {
1704
2059
  legend: "Extras",
1705
2060
  items: u,
1706
2061
  value: w.extras,
1707
- onChange: (e) => T({ extras: e }),
2062
+ quantities: w.extraQuantities ?? {},
2063
+ choices: w.extraChoices ?? {},
2064
+ fields: w.extraFields ?? {},
2065
+ onChange: (e, t, n, r) => T({
2066
+ extras: e,
2067
+ extraQuantities: t,
2068
+ extraChoices: n,
2069
+ extraFields: r
2070
+ }),
2071
+ onFieldsChange: (e) => T({ extraFields: e }),
2072
+ onQuantitiesChange: (e) => T({ extraQuantities: e }),
2073
+ onChoicesChange: (e, t) => T({
2074
+ extraChoices: e,
2075
+ extraQuantities: t
2076
+ }),
1708
2077
  disabled: m,
1709
2078
  name: E("extras")
1710
2079
  }),
1711
- /* @__PURE__ */ o(Te, {
2080
+ /* @__PURE__ */ s(qe, {
1712
2081
  label: g,
1713
2082
  value: w.vehicles,
1714
2083
  onChange: (e) => T({ vehicles: e }),
@@ -1717,7 +2086,7 @@ function De({ title: e = "Atributos del viaje", headingLevel: n = 3, value: r, d
1717
2086
  disabled: m,
1718
2087
  name: E("vehicles")
1719
2088
  }),
1720
- /* @__PURE__ */ o(Ce, {
2089
+ /* @__PURE__ */ s(Ke, {
1721
2090
  label: _,
1722
2091
  value: w.payment,
1723
2092
  onChange: (e) => T({ payment: e }),
@@ -1730,6 +2099,676 @@ function De({ title: e = "Atributos del viaje", headingLevel: n = 3, value: r, d
1730
2099
  });
1731
2100
  }
1732
2101
  //#endregion
1733
- export { y as MultiSelect, u as StatusTag, Q as WariDateField, pe as WariSchedule, Ce as WariSelect, Ee as WariServiceMeta, b as WariStatusSelect, Te as WariStepper, we as WariSwitchList, fe as WariTimeField, De as WariTripAttributes, k as calendarWeeks, be as clampCount, _e as defaultTripAttributes, f as filterOptions, T as formatDisplayDate, R as formatDisplayTime, ve as formatSoles, d as normalizeSearch, E as parseDisplayDate, z as parseDisplayTime, C as parseISODate, F as parseTime24, h as selectionState, _ as selectionSummary, ye as serviceMeta, S as toISODate, w as todayISO, g as toggleAll, Se as toggleExtra, m as toggleValue, xe as typeaheadIndex, he as wariExtras, ge as wariPaymentMethods, me as wariServices, l as wariStatusLabel, c as wariStatuses };
2102
+ //#region src/wari/WariClientSearch.tsx
2103
+ function Ze({ title: e = "Cliente / usuario", headingLevel: n = 3, value: r, defaultValue: i = "", onChange: l, onSearch: u, onCreate: d, createHref: f, createLabel: p = "Crear usuario", placeholder: m = "Puedes filtrar por nombre o número", searchLabel: h = "Buscar cliente por nombre o número", name: g = "q", action: _, loading: v = !1, loadingLabel: y = "Buscando cliente…", showCreate: b, showSearch: x = !0, hoverable: S = !0, disabled: C = !1, children: w, className: T }) {
2104
+ let E = t(), D = t(), [O, k] = a(i), A = r ?? O, j = `h${n}`, M = /* @__PURE__ */ c(o, { children: [/* @__PURE__ */ s(ue, {}), p] }), N = b ?? (!A.trim() && !v);
2105
+ return /* @__PURE__ */ c("section", {
2106
+ className: [
2107
+ "ds-wcard",
2108
+ "ds-wclient",
2109
+ T
2110
+ ].filter(Boolean).join(" "),
2111
+ "aria-labelledby": E,
2112
+ "data-hover": S ? "lift" : void 0,
2113
+ "aria-busy": v || void 0,
2114
+ children: [
2115
+ /* @__PURE__ */ c("header", {
2116
+ className: "ds-wcard-header",
2117
+ children: [
2118
+ /* @__PURE__ */ s(Q, {}),
2119
+ /* @__PURE__ */ s(j, {
2120
+ id: E,
2121
+ className: "ds-wcard-title",
2122
+ title: e,
2123
+ children: e
2124
+ }),
2125
+ N ? f ? /* @__PURE__ */ s("a", {
2126
+ className: "ds-wcard-action",
2127
+ href: f,
2128
+ children: M
2129
+ }) : d && /* @__PURE__ */ s("button", {
2130
+ type: "button",
2131
+ className: "ds-wcard-action",
2132
+ onClick: d,
2133
+ disabled: C,
2134
+ children: M
2135
+ }) : null
2136
+ ]
2137
+ }),
2138
+ x && /* @__PURE__ */ c("form", {
2139
+ role: "search",
2140
+ className: "ds-input ds-wsearch",
2141
+ action: _,
2142
+ onSubmit: (e) => {
2143
+ _ || e.preventDefault(), u?.(A.trim());
2144
+ },
2145
+ children: [/* @__PURE__ */ s("label", {
2146
+ htmlFor: D,
2147
+ className: "ds-wvisually-hidden",
2148
+ children: h
2149
+ }), /* @__PURE__ */ c("div", {
2150
+ className: "ds-input-shell",
2151
+ children: [/* @__PURE__ */ s(le, {}), /* @__PURE__ */ s("input", {
2152
+ id: D,
2153
+ type: "search",
2154
+ name: g,
2155
+ value: A,
2156
+ placeholder: m,
2157
+ autoComplete: "off",
2158
+ disabled: C,
2159
+ enterKeyHint: "search",
2160
+ onChange: (e) => {
2161
+ r === void 0 && k(e.target.value), l?.(e.target.value);
2162
+ }
2163
+ })]
2164
+ })]
2165
+ }),
2166
+ v && /* @__PURE__ */ s("div", {
2167
+ className: "ds-wclient-progress",
2168
+ role: "progressbar",
2169
+ "aria-label": y
2170
+ }),
2171
+ w != null && /* @__PURE__ */ s("div", {
2172
+ className: "ds-wclient-results",
2173
+ children: w
2174
+ })
2175
+ ]
2176
+ });
2177
+ }
2178
+ //#endregion
2179
+ //#region src/wari/WariClientDetails.tsx
2180
+ function Qe({ name: e, company: t, phone: n, vip: r, tone: i, onRates: a, ratesLabel: o = "Tarifas", onInfo: l, infoLabel: u = "Ver información del cliente", onEdit: d, editLabel: f = "Editar cliente", notes: p, notesLabel: m = "Observaciones del cliente", notesHint: h = "(no editable)", children: g, disabled: _ = !1, className: v }) {
2181
+ let y = a || l || d, b = i ?? (r === !1 ? "info" : "warning");
2182
+ return /* @__PURE__ */ c("div", {
2183
+ className: ["ds-wclient-details", v].filter(Boolean).join(" "),
2184
+ children: [
2185
+ /* @__PURE__ */ c("div", {
2186
+ className: "ds-wclient-summary",
2187
+ children: [/* @__PURE__ */ c("div", {
2188
+ className: "ds-wclient-banner",
2189
+ "data-tone": b,
2190
+ children: [
2191
+ /* @__PURE__ */ s("p", {
2192
+ className: "ds-wclient-name",
2193
+ title: e,
2194
+ children: e
2195
+ }),
2196
+ t && /* @__PURE__ */ s("span", {
2197
+ className: "ds-wclient-company",
2198
+ title: t,
2199
+ children: t
2200
+ }),
2201
+ n && /* @__PURE__ */ c("a", {
2202
+ className: "ds-wclient-phone",
2203
+ href: `tel:${n.replace(/[^\d+]/g, "")}`,
2204
+ children: [/* @__PURE__ */ s(de, {}), n]
2205
+ })
2206
+ ]
2207
+ }), y && /* @__PURE__ */ c("div", {
2208
+ className: "ds-wclient-actions",
2209
+ children: [a && /* @__PURE__ */ s("button", {
2210
+ type: "button",
2211
+ className: "ds-wclient-rates",
2212
+ onClick: a,
2213
+ disabled: _,
2214
+ children: o
2215
+ }), (l || d) && /* @__PURE__ */ c("div", { children: [l && /* @__PURE__ */ s("button", {
2216
+ type: "button",
2217
+ className: "ds-wclient-icon",
2218
+ "aria-label": u,
2219
+ title: u,
2220
+ onClick: l,
2221
+ disabled: _,
2222
+ children: /* @__PURE__ */ s($, {})
2223
+ }), d && /* @__PURE__ */ s("button", {
2224
+ type: "button",
2225
+ className: "ds-wclient-icon",
2226
+ "aria-label": f,
2227
+ title: f,
2228
+ onClick: d,
2229
+ disabled: _,
2230
+ children: /* @__PURE__ */ s(fe, {})
2231
+ })] })]
2232
+ })]
2233
+ }),
2234
+ g != null && /* @__PURE__ */ s("div", {
2235
+ className: "ds-wclient-fields",
2236
+ children: g
2237
+ }),
2238
+ p != null && /* @__PURE__ */ c("div", {
2239
+ className: "ds-wclient-notes",
2240
+ children: [/* @__PURE__ */ c("span", { children: [
2241
+ m,
2242
+ " ",
2243
+ /* @__PURE__ */ s("em", { children: h })
2244
+ ] }), /* @__PURE__ */ s("p", { children: p })]
2245
+ })
2246
+ ]
2247
+ });
2248
+ }
2249
+ //#endregion
2250
+ //#region src/wari/motion.ts
2251
+ var $e = "cubic-bezier(.2, .8, .2, 1)";
2252
+ function et() {
2253
+ return typeof window > "u" || typeof window.matchMedia != "function" || window.matchMedia("(prefers-reduced-motion: reduce)").matches;
2254
+ }
2255
+ var tt = (e) => typeof e.animate == "function";
2256
+ function nt(e) {
2257
+ let t = /* @__PURE__ */ new Map();
2258
+ return !e || et() || e.querySelectorAll("[data-motion]").forEach((e) => t.set(e.dataset.motion, e.getBoundingClientRect())), t;
2259
+ }
2260
+ function rt(e, t) {
2261
+ if (!e || t.size === 0 || et()) return;
2262
+ let n = 0;
2263
+ e.querySelectorAll("[data-motion]").forEach((r) => {
2264
+ if (!tt(r)) return;
2265
+ let i = t.get(r.dataset.motion);
2266
+ if (!i) {
2267
+ r.animate([{
2268
+ opacity: 0,
2269
+ transform: "translateY(-6px) scale(.98)"
2270
+ }, {
2271
+ opacity: 1,
2272
+ transform: "none"
2273
+ }], {
2274
+ duration: 240,
2275
+ easing: $e,
2276
+ delay: Math.min(n++, 6) * 35,
2277
+ fill: "backwards"
2278
+ });
2279
+ return;
2280
+ }
2281
+ if (r.parentElement?.closest("[data-motion]") && e.contains(r.parentElement.closest("[data-motion]"))) return;
2282
+ let a = r.getBoundingClientRect(), o = i.left - a.left, s = i.top - a.top;
2283
+ Math.abs(o) < 1 && Math.abs(s) < 1 || r.animate([{ transform: `translate(${o}px, ${s}px)` }, { transform: "none" }], {
2284
+ duration: 280,
2285
+ easing: $e
2286
+ });
2287
+ });
2288
+ }
2289
+ function it(e, t) {
2290
+ if (!e || !tt(e) || et()) {
2291
+ t();
2292
+ return;
2293
+ }
2294
+ let n = e.animate([{
2295
+ opacity: 1,
2296
+ transform: "none"
2297
+ }, {
2298
+ opacity: 0,
2299
+ transform: "translateX(12px) scale(.97)"
2300
+ }], {
2301
+ duration: 170,
2302
+ easing: "ease-in",
2303
+ fill: "forwards"
2304
+ }), r = () => {
2305
+ t(), requestAnimationFrame(() => requestAnimationFrame(() => n.cancel()));
2306
+ };
2307
+ n.finished.then(r, r);
2308
+ }
2309
+ //#endregion
2310
+ //#region src/wari/route.ts
2311
+ var at = 0;
2312
+ function ot(e = {}) {
2313
+ return at += 1, {
2314
+ id: `stop-${Date.now().toString(36)}-${at}`,
2315
+ address: "",
2316
+ reference: "",
2317
+ passenger: null,
2318
+ ...e
2319
+ };
2320
+ }
2321
+ function st() {
2322
+ return {
2323
+ stops: [ot(), ot()],
2324
+ passenger: null,
2325
+ tolls: [""]
2326
+ };
2327
+ }
2328
+ var ct = () => ({
2329
+ name: "",
2330
+ phone: ""
2331
+ });
2332
+ function lt(e, t, n) {
2333
+ if (t === n || t < 0 || n < 0 || t >= e.length || n >= e.length) return [...e];
2334
+ let r = [...e], [i] = r.splice(t, 1);
2335
+ return r.splice(n, 0, i), r;
2336
+ }
2337
+ function ut(e) {
2338
+ return {
2339
+ ...e,
2340
+ stops: [...e.stops].reverse()
2341
+ };
2342
+ }
2343
+ function dt(e, t = 10) {
2344
+ return e.length >= t ? [...e] : [...e, ot()];
2345
+ }
2346
+ function ft(e, t) {
2347
+ return t < 0 || t >= e.length ? [...e] : e.length <= 2 ? e.map((e, n) => n === t ? {
2348
+ ...e,
2349
+ address: "",
2350
+ reference: "",
2351
+ zone: void 0,
2352
+ price: void 0,
2353
+ passenger: null
2354
+ } : e) : e.filter((e, n) => n !== t);
2355
+ }
2356
+ function pt(e, t, n) {
2357
+ return e.map((e, r) => r === t ? {
2358
+ ...e,
2359
+ ...n
2360
+ } : e);
2361
+ }
2362
+ function mt(e, t = 5) {
2363
+ return e.length >= t ? [...e] : [...e, ""];
2364
+ }
2365
+ function ht(e, t) {
2366
+ return e.length <= 1 ? [""] : e.filter((e, n) => n !== t);
2367
+ }
2368
+ function gt(e) {
2369
+ return e.reduce((e, t) => {
2370
+ let n = Number(t.replace(",", "."));
2371
+ return Number.isFinite(n) && n > 0 ? e + n : e;
2372
+ }, 0);
2373
+ }
2374
+ function _t(e) {
2375
+ return e === 0 ? "¿Dónde recogemos al cliente?" : "¿A dónde lo llevamos?";
2376
+ }
2377
+ function vt(e) {
2378
+ return e === 0 ? "Origen" : `Destino ${e}`;
2379
+ }
2380
+ function yt(e) {
2381
+ let t = e?.stops?.length ? e.stops.map((e) => ({
2382
+ passenger: null,
2383
+ ...e
2384
+ })) : st().stops;
2385
+ for (; t.length < 2;) t.push(ot());
2386
+ return {
2387
+ stops: t,
2388
+ passenger: e?.passenger ?? null,
2389
+ tolls: e?.tolls?.length ? [...e.tolls] : [""]
2390
+ };
2391
+ }
2392
+ //#endregion
2393
+ //#region src/wari/WariRoute.tsx
2394
+ var bt = /* @__PURE__ */ new WeakMap();
2395
+ function xt({ title: r = "Ruta", headingLevel: l = 3, value: u, defaultValue: d, onChange: f, onInvert: p, maxStops: m = 10, maxTolls: h = 5, showPassengers: g = !0, showTolls: _ = !0, invertingLabel: v = "Invirtiendo direcciones...", invertedMessage: y = "Direcciones invertidas con éxito", routePassengerNote: b = "Este pasajero será el registrado para todas las direcciones de la ruta.", disabled: x = !1, className: S }) {
2396
+ let C = t(), [w, T] = a(() => yt(d)), E = u ? yt(u) : w, [D, O] = a(!1), [k, A] = a(!1), [j, M] = a(null), [N, P] = a(null), F = i(null), I = () => typeof document > "u" ? null : document.getElementById(`${C}-title`)?.closest(".ds-wroute"), L = () => {
2397
+ let e = I();
2398
+ e && bt.set(e, nt(e));
2399
+ };
2400
+ n(() => {
2401
+ let e = I(), t = e && bt.get(e);
2402
+ e && t && (bt.delete(e), rt(e, t));
2403
+ });
2404
+ let R = (e, t) => it(e.currentTarget.closest("[data-motion]"), t), ee = `h${l}`, z = (e) => {
2405
+ L(), u === void 0 && T(e), f?.(e);
2406
+ }, B = (e) => z({
2407
+ ...E,
2408
+ ...e
2409
+ });
2410
+ e(() => {
2411
+ if (!k) return;
2412
+ let e = window.setTimeout(() => A(!1), 3e3);
2413
+ return () => window.clearTimeout(e);
2414
+ }, [k]);
2415
+ let V = async () => {
2416
+ let e = ut(E);
2417
+ A(!1);
2418
+ let t = p?.(e);
2419
+ if (t && typeof t.then == "function") {
2420
+ L(), O(!0);
2421
+ try {
2422
+ let n = await t;
2423
+ z(n ? yt(n) : e), A(!0);
2424
+ } catch {} finally {
2425
+ O(!1);
2426
+ }
2427
+ } else z(e), A(!0);
2428
+ }, H = (e) => requestAnimationFrame(() => {
2429
+ F.current?.querySelector(`[data-stop="${e}"] .ds-wroute-handle`)?.focus();
2430
+ }), te = (e, t) => {
2431
+ let n = e.key === "ArrowUp" ? t - 1 : e.key === "ArrowDown" ? t + 1 : -1;
2432
+ if (n < 0 || n >= E.stops.length) return;
2433
+ e.preventDefault();
2434
+ let r = E.stops[t].id;
2435
+ B({ stops: lt(E.stops, t, n) }), H(r);
2436
+ }, U = (e, t) => {
2437
+ e.preventDefault(), j !== null && B({ stops: lt(E.stops, j, t) }), M(null), P(null);
2438
+ }, ne = (e, t, n) => /* @__PURE__ */ c("div", {
2439
+ className: "ds-wroute-passenger",
2440
+ role: "group",
2441
+ "aria-label": `Pasajero: ${n}`,
2442
+ children: [
2443
+ /* @__PURE__ */ c("label", { children: [/* @__PURE__ */ s(xe, {}), /* @__PURE__ */ s("input", {
2444
+ className: "ds-wroute-input",
2445
+ type: "text",
2446
+ autoComplete: "name",
2447
+ placeholder: "Nombre del pasajero",
2448
+ "aria-label": "Nombre del pasajero",
2449
+ value: e.name,
2450
+ disabled: x,
2451
+ onChange: (n) => t({
2452
+ ...e,
2453
+ name: n.target.value
2454
+ })
2455
+ })] }),
2456
+ /* @__PURE__ */ c("label", { children: [/* @__PURE__ */ s(de, {}), /* @__PURE__ */ s("input", {
2457
+ className: "ds-wroute-input",
2458
+ type: "tel",
2459
+ autoComplete: "tel",
2460
+ inputMode: "tel",
2461
+ placeholder: "Ingresa el número del pasajero",
2462
+ "aria-label": "Número del pasajero",
2463
+ value: e.phone,
2464
+ disabled: x,
2465
+ onChange: (n) => t({
2466
+ ...e,
2467
+ phone: n.target.value
2468
+ })
2469
+ })] }),
2470
+ /* @__PURE__ */ s("button", {
2471
+ type: "button",
2472
+ className: "ds-wroute-clear",
2473
+ "aria-label": `Quitar pasajero: ${n}`,
2474
+ disabled: x,
2475
+ onClick: (e) => R(e, () => t(null)),
2476
+ children: /* @__PURE__ */ s(Ce, {})
2477
+ })
2478
+ ]
2479
+ });
2480
+ return /* @__PURE__ */ c("section", {
2481
+ className: [
2482
+ "ds-wcard",
2483
+ "ds-wroute",
2484
+ S
2485
+ ].filter(Boolean).join(" "),
2486
+ "aria-labelledby": `${C}-title`,
2487
+ "aria-busy": D || void 0,
2488
+ children: [/* @__PURE__ */ c("header", {
2489
+ className: "ds-wcard-header",
2490
+ children: [
2491
+ /* @__PURE__ */ s(me, {}),
2492
+ /* @__PURE__ */ s(ee, {
2493
+ id: `${C}-title`,
2494
+ className: "ds-wcard-title",
2495
+ children: r
2496
+ }),
2497
+ g && !E.passenger && !D && /* @__PURE__ */ c("button", {
2498
+ type: "button",
2499
+ className: "ds-wroute-pill",
2500
+ "data-motion": "pill",
2501
+ disabled: x,
2502
+ onClick: () => B({ passenger: ct() }),
2503
+ children: [/* @__PURE__ */ s(Y, {}), "Añadir pasajero (ruta completa)"]
2504
+ }),
2505
+ /* @__PURE__ */ s("span", { className: "ds-wroute-header-spacer" }),
2506
+ /* @__PURE__ */ c("button", {
2507
+ type: "button",
2508
+ className: "ds-wroute-link",
2509
+ disabled: x || D,
2510
+ onClick: V,
2511
+ children: [/* @__PURE__ */ s(he, {}), "Invertir"]
2512
+ })
2513
+ ]
2514
+ }), D ? /* @__PURE__ */ c("div", {
2515
+ className: "ds-wroute-status",
2516
+ role: "status",
2517
+ "data-motion": "status",
2518
+ children: [/* @__PURE__ */ s("div", {
2519
+ className: "ds-wclient-progress",
2520
+ role: "progressbar",
2521
+ "aria-label": v
2522
+ }), v]
2523
+ }) : /* @__PURE__ */ c(o, { children: [
2524
+ k && /* @__PURE__ */ s("p", {
2525
+ className: "ds-wroute-success",
2526
+ role: "status",
2527
+ children: y
2528
+ }),
2529
+ E.passenger && /* @__PURE__ */ c("div", {
2530
+ className: "ds-wroute-passenger-block",
2531
+ "data-motion": "route-passenger",
2532
+ children: [ne(E.passenger, (e) => B({ passenger: e }), "ruta completa"), /* @__PURE__ */ s("p", {
2533
+ className: "ds-wroute-info",
2534
+ children: b
2535
+ })]
2536
+ }),
2537
+ /* @__PURE__ */ s("ol", {
2538
+ ref: F,
2539
+ className: "ds-wroute-stops",
2540
+ "aria-label": "Paradas",
2541
+ children: E.stops.map((e, t) => {
2542
+ let n = vt(t);
2543
+ return /* @__PURE__ */ c("li", {
2544
+ className: "ds-wroute-stop",
2545
+ "data-stop": e.id,
2546
+ "data-motion": `stop:${e.id}`,
2547
+ "data-dragging": j === t || void 0,
2548
+ "data-drop": N === t && j !== t || void 0,
2549
+ onDragOver: (e) => {
2550
+ j !== null && (e.preventDefault(), P(t));
2551
+ },
2552
+ onDrop: (e) => U(e, t),
2553
+ children: [
2554
+ /* @__PURE__ */ s("button", {
2555
+ type: "button",
2556
+ className: "ds-wroute-handle",
2557
+ draggable: !x,
2558
+ disabled: x,
2559
+ "aria-label": `Mover ${n}`,
2560
+ "aria-describedby": `${C}-move-hint`,
2561
+ onKeyDown: (e) => te(e, t),
2562
+ onDragStart: (n) => {
2563
+ M(t), n.dataTransfer.effectAllowed = "move", n.dataTransfer.setData("text/plain", e.id);
2564
+ },
2565
+ onDragEnd: () => {
2566
+ M(null), P(null);
2567
+ },
2568
+ children: /* @__PURE__ */ s(ge, {})
2569
+ }),
2570
+ /* @__PURE__ */ c("div", {
2571
+ className: "ds-wroute-stop-box",
2572
+ children: [
2573
+ /* @__PURE__ */ c("div", {
2574
+ className: "ds-wroute-stop-main",
2575
+ children: [
2576
+ /* @__PURE__ */ c("label", {
2577
+ className: "ds-wroute-address",
2578
+ children: [s(t === 0 ? ve : ye, {}), /* @__PURE__ */ s("input", {
2579
+ className: "ds-wroute-input",
2580
+ type: "text",
2581
+ autoComplete: "off",
2582
+ placeholder: _t(t),
2583
+ "aria-label": `Dirección: ${n}`,
2584
+ value: e.address,
2585
+ disabled: x,
2586
+ onChange: (e) => B({ stops: pt(E.stops, t, { address: e.target.value }) })
2587
+ })]
2588
+ }),
2589
+ /* @__PURE__ */ c("span", {
2590
+ className: "ds-wroute-zone",
2591
+ children: [/* @__PURE__ */ s("strong", { children: "Zona" }), e.zone || "Sin definir"]
2592
+ }),
2593
+ e.price != null && /* @__PURE__ */ s("span", {
2594
+ className: "ds-wroute-price",
2595
+ children: Le(e.price)
2596
+ })
2597
+ ]
2598
+ }),
2599
+ /* @__PURE__ */ c("div", {
2600
+ className: "ds-wroute-stop-extra",
2601
+ children: [/* @__PURE__ */ s("input", {
2602
+ className: "ds-wroute-input ds-wroute-input-sm",
2603
+ type: "text",
2604
+ autoComplete: "off",
2605
+ placeholder: "Escribe la referencia",
2606
+ "aria-label": `Referencia: ${n}`,
2607
+ value: e.reference,
2608
+ disabled: x,
2609
+ onChange: (e) => B({ stops: pt(E.stops, t, { reference: e.target.value }) })
2610
+ }), g && !e.passenger && /* @__PURE__ */ c("button", {
2611
+ type: "button",
2612
+ className: "ds-wroute-stop-passenger",
2613
+ disabled: x,
2614
+ "aria-label": `Añadir pasajero: ${n}`,
2615
+ onClick: () => B({ stops: pt(E.stops, t, { passenger: ct() }) }),
2616
+ children: [/* @__PURE__ */ s(be, {}), "Añadir Pasajero"]
2617
+ })]
2618
+ }),
2619
+ e.passenger && /* @__PURE__ */ s("div", {
2620
+ className: "ds-wroute-stop-passenger-wrap",
2621
+ "data-motion": `passenger:${e.id}`,
2622
+ children: ne(e.passenger, (e) => B({ stops: pt(E.stops, t, { passenger: e }) }), n)
2623
+ })
2624
+ ]
2625
+ }),
2626
+ /* @__PURE__ */ s("button", {
2627
+ type: "button",
2628
+ className: "ds-wroute-remove",
2629
+ "aria-label": E.stops.length > 2 ? `Quitar ${n}` : `Vaciar ${n}`,
2630
+ disabled: x,
2631
+ onClick: (e) => {
2632
+ let n = () => B({ stops: ft(E.stops, t) });
2633
+ E.stops.length > 2 ? R(e, n) : n();
2634
+ },
2635
+ children: /* @__PURE__ */ s(_e, {})
2636
+ })
2637
+ ]
2638
+ }, e.id);
2639
+ })
2640
+ }),
2641
+ /* @__PURE__ */ s("span", {
2642
+ id: `${C}-move-hint`,
2643
+ className: "ds-wvisually-hidden",
2644
+ children: "Arrastra o usa las flechas arriba y abajo para cambiar el orden."
2645
+ }),
2646
+ /* @__PURE__ */ c("button", {
2647
+ type: "button",
2648
+ className: "ds-wroute-add",
2649
+ "data-motion": "add",
2650
+ disabled: x || E.stops.length >= m,
2651
+ onClick: () => {
2652
+ let e = dt(E.stops, m);
2653
+ B({ stops: e }), requestAnimationFrame(() => F.current?.querySelector(`[data-stop="${e[e.length - 1].id}"] input`)?.focus());
2654
+ },
2655
+ children: [/* @__PURE__ */ s(Se, {}), "Agregar destino"]
2656
+ }),
2657
+ _ && /* @__PURE__ */ c("div", {
2658
+ className: "ds-wroute-tolls",
2659
+ role: "group",
2660
+ "aria-label": "Peajes",
2661
+ "data-motion": "tolls",
2662
+ children: [E.tolls.map((e, t) => /* @__PURE__ */ c("div", {
2663
+ className: "ds-wroute-toll",
2664
+ "data-motion": `toll:${t}`,
2665
+ children: [
2666
+ /* @__PURE__ */ c("label", {
2667
+ htmlFor: `${C}-toll-${t}`,
2668
+ children: ["Peaje ", t + 1]
2669
+ }),
2670
+ /* @__PURE__ */ s("input", {
2671
+ id: `${C}-toll-${t}`,
2672
+ className: "ds-wroute-input",
2673
+ type: "text",
2674
+ inputMode: "decimal",
2675
+ placeholder: "S/ 0.00",
2676
+ value: e,
2677
+ disabled: x,
2678
+ onChange: (e) => B({ tolls: E.tolls.map((n, r) => r === t ? e.target.value : n) })
2679
+ }),
2680
+ E.tolls.length > 1 && /* @__PURE__ */ s("button", {
2681
+ type: "button",
2682
+ className: "ds-wroute-clear",
2683
+ "aria-label": `Quitar peaje ${t + 1}`,
2684
+ disabled: x,
2685
+ onClick: (e) => R(e, () => B({ tolls: ht(E.tolls, t) })),
2686
+ children: /* @__PURE__ */ s(_e, {})
2687
+ })
2688
+ ]
2689
+ }, t)), /* @__PURE__ */ c("button", {
2690
+ type: "button",
2691
+ className: "ds-wroute-toll-add",
2692
+ disabled: x || E.tolls.length >= h,
2693
+ onClick: () => B({ tolls: mt(E.tolls, h) }),
2694
+ children: [/* @__PURE__ */ s(Se, {}), "Agregar peaje"]
2695
+ })]
2696
+ })
2697
+ ] })]
2698
+ });
2699
+ }
2700
+ //#endregion
2701
+ //#region src/wari/WariPassengerField.tsx
2702
+ function St({ value: e, defaultValue: t, onChange: n, onClear: r, loading: i = !1, loadingLabel: o = "Buscando pasajero…", label: l = "Pasajero", namePlaceholder: u = "Nombre del pasajero", phonePlaceholder: d = "Ingresa el número del pasajero", nameLabel: f = "Nombre del pasajero", phoneLabel: p = "Número del pasajero", clearLabel: m = "Quitar pasajero", showClear: h = !0, nameInputName: g, phoneInputName: _, disabled: v = !1, className: y }) {
2703
+ let [b, x] = a(() => ({
2704
+ ...ct(),
2705
+ ...t
2706
+ })), S = e ?? b, C = (t) => {
2707
+ e === void 0 && x(t), n?.(t);
2708
+ };
2709
+ return /* @__PURE__ */ c("div", {
2710
+ className: ["ds-wpassenger", y].filter(Boolean).join(" "),
2711
+ role: "group",
2712
+ "aria-label": l,
2713
+ "aria-busy": i || void 0,
2714
+ children: [/* @__PURE__ */ c("div", {
2715
+ className: "ds-wpassenger-row",
2716
+ children: [
2717
+ /* @__PURE__ */ c("label", {
2718
+ className: "ds-wpassenger-field",
2719
+ children: [/* @__PURE__ */ s(xe, {}), /* @__PURE__ */ s("input", {
2720
+ className: "ds-wpassenger-input",
2721
+ type: "text",
2722
+ autoComplete: "name",
2723
+ name: g,
2724
+ placeholder: u,
2725
+ "aria-label": f,
2726
+ value: S.name,
2727
+ disabled: v,
2728
+ onChange: (e) => C({
2729
+ ...S,
2730
+ name: e.target.value
2731
+ })
2732
+ })]
2733
+ }),
2734
+ /* @__PURE__ */ c("label", {
2735
+ className: "ds-wpassenger-field",
2736
+ children: [S.phone ? /* @__PURE__ */ s(we, {}) : /* @__PURE__ */ s(de, {}), /* @__PURE__ */ s("input", {
2737
+ className: "ds-wpassenger-input",
2738
+ type: "tel",
2739
+ autoComplete: "tel",
2740
+ inputMode: "tel",
2741
+ name: _,
2742
+ placeholder: d,
2743
+ "aria-label": p,
2744
+ value: S.phone,
2745
+ disabled: v,
2746
+ onChange: (e) => C({
2747
+ ...S,
2748
+ phone: e.target.value
2749
+ })
2750
+ })]
2751
+ }),
2752
+ h && /* @__PURE__ */ s("button", {
2753
+ type: "button",
2754
+ className: "ds-wpassenger-clear",
2755
+ "aria-label": m,
2756
+ title: m,
2757
+ disabled: v,
2758
+ onClick: () => {
2759
+ C(ct()), r?.();
2760
+ },
2761
+ children: /* @__PURE__ */ s(Ce, {})
2762
+ })
2763
+ ]
2764
+ }), i && /* @__PURE__ */ s("div", {
2765
+ className: "ds-wclient-progress ds-wpassenger-progress",
2766
+ role: "progressbar",
2767
+ "aria-label": o
2768
+ })]
2769
+ });
2770
+ }
2771
+ //#endregion
2772
+ export { b as MultiSelect, d as StatusTag, Qe as WariClientDetails, Ze as WariClientSearch, Te as WariDateField, St as WariPassengerField, xt as WariRoute, Me as WariSchedule, Ke as WariSelect, Ye as WariServiceMeta, x as WariStatusSelect, qe as WariStepper, Je as WariSwitchList, je as WariTimeField, Xe as WariTripAttributes, dt as addStop, mt as addToll, A as calendarWeeks, ze as clampCount, ot as createStop, st as defaultRouteValue, Ie as defaultTripAttributes, ct as emptyPassenger, p as filterOptions, E as formatDisplayDate, z as formatDisplayTime, Le as formatSoles, ut as invertRoute, lt as moveStop, yt as normalizeRoute, f as normalizeSearch, D as parseDisplayDate, B as parseDisplayTime, w as parseISODate, I as parseTime24, ft as removeStop, ht as removeToll, g as selectionState, v as selectionSummary, Re as serviceMeta, vt as stopLabel, _t as stopPlaceholder, Ue as syncExtraChoices, We as syncExtraFields, He as syncExtraQuantities, Ge as syncExtras, C as toISODate, T as todayISO, _ as toggleAll, Ve as toggleExtra, h as toggleValue, gt as tollsTotal, Be as typeaheadIndex, pt as updateStop, Pe as wariExtras, Fe as wariPaymentMethods, Ne as wariServices, u as wariStatusLabel, l as wariStatuses };
1734
2773
 
1735
2774
  //# sourceMappingURL=wari.js.map