@featherk/composables 0.6.18 → 0.6.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,15 +1,28 @@
1
- import { ref as J, onBeforeUnmount as Ie, nextTick as W, computed as h, watch as ge, onMounted as xe, readonly as Y, getCurrentScope as Le, onScopeDispose as Te, toValue as de, unref as Fe, shallowRef as Re } from "vue";
1
+ import { ref as J, onBeforeUnmount as Ie, nextTick as j, computed as b, watch as ge, onMounted as xe, readonly as G, getCurrentScope as Le, onScopeDispose as Te, toValue as de, unref as Fe, shallowRef as Re } from "vue";
2
2
  import { useFocusTrap as qe } from "@vueuse/integrations/useFocusTrap";
3
3
  const _e = (e, t) => {
4
4
  const s = J(null);
5
- let U = !1, P = null, L = null;
6
- const N = [], A = ".k-table-row[data-grid-row-index] [tabindex]", S = (o) => o.key === "Enter" || o.code === "Enter" || o.code === "NumpadEnter", b = () => e?.value?.columns, w = (o) => {
7
- const m = o.key || o.code;
8
- ([" ", "Spacebar", "Space"].includes(m) || S(o)) && (o.preventDefault(), o.stopPropagation(), s.value = o.target, o.target.click());
9
- }, I = (o) => {
5
+ let O = !1, $ = null, P = null;
6
+ const H = [], x = ".k-table-row[data-grid-row-index] [tabindex]", D = () => {
7
+ const a = e?.value?.$el;
8
+ return a ? a.closest(".k-grid") : null;
9
+ }, k = (a) => {
10
+ const m = D();
11
+ if (!m) return !1;
12
+ const i = a.closest(".k-grid-aria-root");
13
+ if (i)
14
+ return m.contains(i);
15
+ const c = a.closest(
16
+ ".k-grid-header, .k-grid-content, .k-grid-content-locked"
17
+ );
18
+ return c ? m.contains(c) : !1;
19
+ }, w = (a) => a.key === "Enter" || a.code === "Enter" || a.code === "NumpadEnter", I = () => e?.value?.columns, A = (a) => {
20
+ const m = a.key || a.code;
21
+ ([" ", "Spacebar", "Space"].includes(m) || w(a)) && (a.preventDefault(), a.stopPropagation(), s.value = a.target, a.target.click());
22
+ }, E = (a) => {
10
23
  if (!s.value) return;
11
- if (o.code === "Escape") {
12
- o.stopPropagation(), s.value && s.value.focus();
24
+ if (a.code === "Escape") {
25
+ a.stopPropagation(), s.value && s.value.focus();
13
26
  return;
14
27
  }
15
28
  const m = Array.from(
@@ -20,7 +33,7 @@ const _e = (e, t) => {
20
33
  ".k-animation-container .k-popup .k-column-menu .k-filter-menu-container"
21
34
  );
22
35
  if (i) {
23
- if (o.code === "Tab") {
36
+ if (a.code === "Tab") {
24
37
  const c = [
25
38
  // ".k-filter-menu-container .k-dropdownlist[tabindex='0']",
26
39
  // ".k-filter-menu-container input.k-input-inner:not([tabindex='-1']):not([disabled])",
@@ -30,73 +43,73 @@ const _e = (e, t) => {
30
43
  "input.k-input-inner:not([tabindex='-1']):not([disabled])",
31
44
  "button:not([tabindex='-1']):not([disabled])",
32
45
  ".k-checkbox"
33
- ], v = t?.focusableMenuSelectors ?? c, g = Array.from(
34
- i.querySelectorAll(v.join(","))
46
+ ], y = t?.focusableMenuSelectors ?? c, f = Array.from(
47
+ i.querySelectorAll(y.join(","))
35
48
  );
36
- if (g.length === 0) return;
37
- const k = g.findIndex(
38
- (j) => j === document.activeElement
49
+ if (f.length === 0) return;
50
+ const h = f.findIndex(
51
+ (W) => W === document.activeElement
39
52
  );
40
- let D;
41
- k === -1 ? D = 0 : o.shiftKey ? D = (k - 1 + g.length) % g.length : D = (k + 1) % g.length, o.preventDefault(), o.stopPropagation(), g[D]?.focus();
53
+ let T;
54
+ h === -1 ? T = 0 : a.shiftKey ? T = (h - 1 + f.length) % f.length : T = (h + 1) % f.length, a.preventDefault(), a.stopPropagation(), f[T]?.focus();
42
55
  }
43
- } else if (o.code === "ArrowUp" || o.code === "ArrowDown") {
44
- o.preventDefault(), o.stopPropagation();
56
+ } else if (a.code === "ArrowUp" || a.code === "ArrowDown") {
57
+ a.preventDefault(), a.stopPropagation();
45
58
  const c = m.findIndex(
46
- (g) => g === document.activeElement
59
+ (f) => f === document.activeElement
47
60
  );
48
- let v = c;
49
- o.code === "ArrowUp" ? v = c > 0 ? c - 1 : m.length - 1 : o.code === "ArrowDown" && (v = c < m.length - 1 ? c + 1 : 0), m[v]?.focus();
61
+ let y = c;
62
+ a.code === "ArrowUp" ? y = c > 0 ? c - 1 : m.length - 1 : a.code === "ArrowDown" && (y = c < m.length - 1 ? c + 1 : 0), m[y]?.focus();
50
63
  return;
51
64
  }
52
- if (o.code === "Tab") {
53
- o.preventDefault(), o.stopPropagation();
65
+ if (a.code === "Tab") {
66
+ a.preventDefault(), a.stopPropagation();
54
67
  const c = s.value?.parentElement;
55
- (o.shiftKey ? c?.previousElementSibling : c?.nextElementSibling)?.querySelector(
68
+ (a.shiftKey ? c?.previousElementSibling : c?.nextElementSibling)?.querySelector(
56
69
  "button, [role='button'], .k-link"
57
70
  )?.focus();
58
71
  }
59
- }, E = () => {
60
- P = new MutationObserver((o) => {
61
- o.forEach((m) => {
72
+ }, L = () => {
73
+ $ = new MutationObserver((a) => {
74
+ a.forEach((m) => {
62
75
  m.addedNodes.forEach((i) => {
63
76
  if (i.nodeType === Node.ELEMENT_NODE) {
64
77
  const c = i;
65
78
  if (c.classList.contains("k-animation-container")) {
66
- const g = s.value;
67
- g && (g.dataset.featherKSortable === "true" || W(() => {
79
+ const f = s.value;
80
+ f && (f.dataset.featherKSortable === "true" || j(() => {
68
81
  c.querySelectorAll(
69
82
  ".k-columnmenu-item-wrapper"
70
- ).forEach((j) => {
71
- j.textContent?.toLowerCase().includes("sort") && j.remove();
83
+ ).forEach((W) => {
84
+ W.textContent?.toLowerCase().includes("sort") && W.remove();
72
85
  });
73
86
  })), c.addEventListener(
74
87
  "keydown",
75
- I
76
- ), W(() => {
77
- const k = () => {
78
- const D = Array.from(
88
+ E
89
+ ), j(() => {
90
+ const h = () => {
91
+ const T = Array.from(
79
92
  c.querySelectorAll(
80
93
  ".k-animation-container .k-popup .k-column-menu .k-columnmenu-item-wrapper .k-columnmenu-item"
81
94
  )
82
95
  );
83
- if (D.length === 1)
84
- D[0].focus(), D[0].click(), k.attempts = 0;
85
- else if (D.length > 1) {
86
- k.attempts = 0;
96
+ if (T.length === 1)
97
+ T[0].focus(), T[0].click(), h.attempts = 0;
98
+ else if (T.length > 1) {
99
+ h.attempts = 0;
87
100
  return;
88
101
  } else
89
- k.attempts === void 0 && (k.attempts = 0), k.attempts++ < 3 && setTimeout(k, 200);
102
+ h.attempts === void 0 && (h.attempts = 0), h.attempts++ < 3 && setTimeout(h, 200);
90
103
  };
91
- k();
104
+ h();
92
105
  });
93
106
  }
94
107
  c.querySelectorAll(
95
108
  ".k-animation-container"
96
- ).forEach((g) => {
97
- g.addEventListener(
109
+ ).forEach((f) => {
110
+ f.addEventListener(
98
111
  "keydown",
99
- I
112
+ E
100
113
  );
101
114
  });
102
115
  }
@@ -105,45 +118,54 @@ const _e = (e, t) => {
105
118
  const c = i;
106
119
  c.classList.contains("k-animation-container") && c.removeEventListener(
107
120
  "keydown",
108
- I
121
+ E
109
122
  ), c.querySelectorAll(
110
123
  ".k-animation-container"
111
- ).forEach((g) => {
112
- g.removeEventListener(
124
+ ).forEach((f) => {
125
+ f.removeEventListener(
113
126
  "keydown",
114
- I
127
+ E
115
128
  );
116
129
  });
117
130
  }
118
131
  });
119
132
  });
120
- }), P.observe(document.body, {
133
+ }), $.observe(document.body, {
121
134
  childList: !0,
122
135
  subtree: !0
123
136
  });
124
- }, M = (o) => {
125
- const m = o.tagName.toLowerCase();
126
- return !!(["input", "textarea", "select", "button"].includes(m) || o.closest(
137
+ }, K = (a) => {
138
+ const m = a.tagName.toLowerCase();
139
+ return !!(["input", "textarea", "select", "button"].includes(m) || a.closest(
127
140
  '.k-picker-wrap, .k-input-inner, .k-textbox, [role="combobox"]'
128
141
  ));
129
- }, T = (o) => {
130
- if (!o.type || !o)
142
+ }, p = (a) => {
143
+ if (!a.type || !a)
131
144
  return;
132
- const m = o.target;
133
- if (m && !M(m)) {
134
- if (o.code === "Escape") {
135
- const i = document.activeElement?.closest(".k-table-row[data-grid-row-index]");
136
- if (i) {
137
- o.preventDefault(), o.stopPropagation();
145
+ const m = a.target;
146
+ if (!m) return;
147
+ const i = m.closest(
148
+ ".k-table-row[data-grid-row-index]"
149
+ );
150
+ if (!k(m))
151
+ return;
152
+ const c = ["ArrowLeft", "ArrowRight"].includes(
153
+ a.code
154
+ );
155
+ if (!(K(m) && !(i && c))) {
156
+ if (a.code === "Escape") {
157
+ const y = document.activeElement?.closest(".k-table-row[data-grid-row-index]");
158
+ if (y) {
159
+ a.preventDefault(), a.stopPropagation();
138
160
  try {
139
161
  Array.from(
140
162
  e?.value.$el.querySelectorAll(
141
163
  ".k-table-row[data-grid-row-index]"
142
164
  )
143
- ).forEach((v) => v.setAttribute("tabindex", "-1"));
165
+ ).forEach((h) => h.setAttribute("tabindex", "-1"));
144
166
  } catch {
145
167
  }
146
- i.setAttribute("tabindex", "0"), i.focus();
168
+ y.setAttribute("tabindex", "0"), y.focus();
147
169
  return;
148
170
  }
149
171
  }
@@ -155,61 +177,58 @@ const _e = (e, t) => {
155
177
  "Enter",
156
178
  "NumpadEnter",
157
179
  "Space"
158
- ].includes(o.code)) {
180
+ ].includes(a.code)) {
159
181
  if (m.classList.contains("k-grid-header-menu") && m.classList.contains("k-grid-column-menu")) {
160
182
  s.value = m;
161
183
  return;
162
184
  }
163
- const i = m.closest(
164
- ".k-table-row[data-grid-row-index]"
165
- );
166
185
  if (i) {
167
- if (["ArrowDown", "ArrowUp"].includes(o.code)) {
168
- o.preventDefault(), o.stopPropagation();
169
- const c = (g, k) => {
170
- let D = k === "next" ? g.nextElementSibling : g.previousElementSibling;
171
- for (; D; ) {
172
- const j = D;
186
+ if (["ArrowDown", "ArrowUp"].includes(a.code)) {
187
+ a.preventDefault(), a.stopPropagation();
188
+ const y = (h, T) => {
189
+ let W = T === "next" ? h.nextElementSibling : h.previousElementSibling;
190
+ for (; W; ) {
191
+ const o = W;
173
192
  try {
174
- if (j.classList.contains("k-table-row"))
175
- return j;
193
+ if (o.classList.contains("k-table-row"))
194
+ return o;
176
195
  } catch {
177
196
  }
178
- D = k === "next" ? D.nextElementSibling : D.previousElementSibling;
197
+ W = T === "next" ? W.nextElementSibling : W.previousElementSibling;
179
198
  }
180
199
  return null;
181
- }, v = o.code === "ArrowDown" ? c(i, "next") : c(i, "previous");
182
- v && (i.setAttribute("tabindex", "-1"), v.setAttribute("tabindex", "0"), v.focus());
200
+ }, f = a.code === "ArrowDown" ? y(i, "next") : y(i, "previous");
201
+ f && (i.setAttribute("tabindex", "-1"), f.setAttribute("tabindex", "0"), f.focus());
183
202
  return;
184
203
  }
185
- if (["ArrowLeft", "ArrowRight"].includes(o.code)) {
186
- o.preventDefault(), o.stopPropagation();
187
- const c = i.querySelectorAll(
188
- A
204
+ if (["ArrowLeft", "ArrowRight"].includes(a.code)) {
205
+ a.preventDefault(), a.stopPropagation();
206
+ const y = i.querySelectorAll(
207
+ x
189
208
  );
190
- if (c.length === 0) return;
191
- let v = Array.from(c).findIndex(
192
- (g) => g === document.activeElement
209
+ if (y.length === 0) return;
210
+ let f = Array.from(y).findIndex(
211
+ (h) => h === document.activeElement
193
212
  );
194
- if (v === -1 && document.activeElement === i) {
195
- c[0].focus();
213
+ if (f === -1 && document.activeElement === i) {
214
+ y[0].focus();
196
215
  return;
197
216
  }
198
- o.code === "ArrowRight" ? v = v === c.length - 1 ? 0 : v + 1 : o.code === "ArrowLeft" && (v = v === c.length - 1 ? v - 1 : c.length - 1), c[v].focus();
217
+ a.code === "ArrowRight" ? f = f === y.length - 1 ? 0 : f + 1 : a.code === "ArrowLeft" && (f = f === 0 ? y.length - 1 : f - 1), y[f].focus();
199
218
  return;
200
219
  }
201
220
  }
202
221
  }
203
222
  }
204
- }, O = () => {
205
- W(() => {
206
- const o = e.value.$el.closest(".k-grid");
207
- o && o.classList.add("fk-grid");
223
+ }, S = () => {
224
+ j(() => {
225
+ const a = e.value.$el.closest(".k-grid");
226
+ a && a.classList.add("fk-grid");
208
227
  });
209
- }, f = () => {
210
- if (!L)
228
+ }, q = () => {
229
+ if (!P)
211
230
  try {
212
- const o = () => {
231
+ const a = () => {
213
232
  try {
214
233
  const c = Array.from(
215
234
  e.value.$el.querySelectorAll(
@@ -217,13 +236,13 @@ const _e = (e, t) => {
217
236
  )
218
237
  );
219
238
  if (!c || c.length === 0 || c.filter(
220
- (k) => k.getAttribute("tabindex") === "0"
239
+ (h) => h.getAttribute("tabindex") === "0"
221
240
  ).length === 1) return;
222
- const g = c.find(
223
- (k) => k === document.activeElement || k.contains(document.activeElement)
241
+ const f = c.find(
242
+ (h) => h === document.activeElement || h.contains(document.activeElement)
224
243
  );
225
- if (c.forEach((k) => k.setAttribute("tabindex", "-1")), g) {
226
- g.setAttribute("tabindex", "0");
244
+ if (c.forEach((h) => h.setAttribute("tabindex", "-1")), f) {
245
+ f.setAttribute("tabindex", "0");
227
246
  return;
228
247
  }
229
248
  c[0].setAttribute("tabindex", "0");
@@ -235,97 +254,97 @@ const _e = (e, t) => {
235
254
  ".k-table-row[data-grid-row-index]"
236
255
  )
237
256
  );
238
- m.length > 0 && m.forEach((c, v) => {
239
- c.setAttribute("tabindex", v === 0 ? "0" : "-1");
257
+ m.length > 0 && m.forEach((c, y) => {
258
+ c.setAttribute("tabindex", y === 0 ? "0" : "-1");
240
259
  });
241
260
  const i = e.value.$el.querySelector(".k-table-tbody");
242
- i && (L = new MutationObserver(() => {
243
- o();
244
- }), L.observe(i, { childList: !0, subtree: !0 }));
245
- } catch (o) {
246
- console.error("Error setting up row navigation:", o);
261
+ i && (P = new MutationObserver(() => {
262
+ a();
263
+ }), P.observe(i, { childList: !0, subtree: !0 }));
264
+ } catch (a) {
265
+ console.error("Error setting up row navigation:", a);
247
266
  }
248
- }, y = () => {
249
- W(() => {
267
+ }, X = () => {
268
+ j(() => {
250
269
  const m = document.querySelectorAll(".k-grid-header .k-grid-header-menu.k-grid-column-menu");
251
270
  m && m.forEach((i) => {
252
271
  i.setAttribute("role", "button"), i.addEventListener(
253
272
  "keydown",
254
- w
273
+ A
255
274
  );
256
- }), E(), _();
275
+ }), L(), ee();
257
276
  });
258
- }, R = () => {
277
+ }, _ = () => {
259
278
  const m = document.querySelectorAll(".k-grid-header .k-grid-header-menu.k-grid-column-menu");
260
279
  m && m.forEach((i) => {
261
280
  i.removeEventListener(
262
281
  "keydown",
263
- w
282
+ A
264
283
  );
265
- }), P && (P.disconnect(), P = null), L && (L.disconnect(), L = null), N.forEach((i) => i()), N.length = 0;
266
- }, _ = () => {
284
+ }), $ && ($.disconnect(), $ = null), P && (P.disconnect(), P = null), H.forEach((i) => i()), H.length = 0;
285
+ }, ee = () => {
267
286
  document.querySelectorAll(
268
287
  ".k-grid-header .k-table-thead th"
269
288
  ).forEach((i, c) => {
270
289
  if (i.dataset.featherKHeaderBound === "true")
271
290
  return;
272
- const v = i.querySelector(
291
+ const y = i.querySelector(
273
292
  ".k-grid-header-menu.k-grid-column-menu"
274
293
  );
275
- if (!v) return;
276
- const g = b();
277
- if (g && g[c]) {
278
- const n = g[c].field ?? "";
279
- i.setAttribute("data-feather-k-field", n), i.setAttribute(
294
+ if (!y) return;
295
+ const f = I();
296
+ if (f && f[c]) {
297
+ const v = f[c].field ?? "";
298
+ i.setAttribute("data-feather-k-field", v), i.setAttribute(
280
299
  "data-feather-k-filterable",
281
- g[c].filterable === !1 ? "false" : "true"
300
+ f[c].filterable === !1 ? "false" : "true"
282
301
  ), i.setAttribute(
283
302
  "data-feather-k-sortable",
284
- g[c].sortable === !1 ? "false" : "true"
303
+ f[c].sortable === !1 ? "false" : "true"
285
304
  );
286
305
  }
287
- const k = i.dataset.featherKFilterable !== "false", D = i.dataset.featherKSortable !== "false";
288
- v.setAttribute("tabindex", "-1"), k || D ? i.style.cursor = "pointer" : i.style.cursor = "default", k ? (i.setAttribute("tabindex", "0"), i.setAttribute("role", "button"), i.setAttribute("aria-haspopup", "menu")) : (i.setAttribute("tabindex", "0"), i.setAttribute("role", "columnheader"), i.removeAttribute("aria-haspopup"));
289
- const j = (n) => {
290
- n.target?.closest(".k-column-resizer") || (s.value = i, v.click());
291
- }, oe = (n) => {
292
- if (k)
293
- s.value = i, n.preventDefault(), n.stopPropagation(), j(n);
294
- else if (D) {
306
+ const h = i.dataset.featherKFilterable !== "false", T = i.dataset.featherKSortable !== "false";
307
+ y.setAttribute("tabindex", "-1"), h || T ? i.style.cursor = "pointer" : i.style.cursor = "default", h ? (i.setAttribute("tabindex", "0"), i.setAttribute("role", "button"), i.setAttribute("aria-haspopup", "menu")) : (i.setAttribute("tabindex", "0"), i.setAttribute("role", "columnheader"), i.removeAttribute("aria-haspopup"));
308
+ const W = (v) => {
309
+ v.target?.closest(".k-column-resizer") || (s.value = i, y.click());
310
+ }, o = (v) => {
311
+ if (h)
312
+ s.value = i, v.preventDefault(), v.stopPropagation(), W(v);
313
+ else if (T) {
295
314
  s.value = i;
296
- const d = i.querySelector(".k-link");
297
- d && d.click();
315
+ const R = i.querySelector(".k-link");
316
+ R && R.click();
298
317
  }
299
318
  };
300
- i.addEventListener("click", oe), N.push(() => {
301
- i.removeEventListener("click", oe);
319
+ i.addEventListener("click", o), H.push(() => {
320
+ i.removeEventListener("click", o);
302
321
  });
303
- const le = (n) => {
304
- if ((S(n) || n.code === "Space") && (k || D)) {
305
- if (n.preventDefault(), n.stopPropagation(), s.value = i, s.value.focus(), k)
306
- j(n);
307
- else if (D) {
308
- const d = i.querySelector(".k-link");
309
- d && d.click();
322
+ const d = (v) => {
323
+ if ((w(v) || v.code === "Space") && (h || T)) {
324
+ if (v.preventDefault(), v.stopPropagation(), s.value = i, s.value.focus(), h)
325
+ W(v);
326
+ else if (T) {
327
+ const R = i.querySelector(".k-link");
328
+ R && R.click();
310
329
  }
311
330
  }
312
331
  };
313
- i.addEventListener("keydown", le, !0), N.push(() => {
314
- i.removeEventListener("keydown", le, !0);
332
+ i.addEventListener("keydown", d, !0), H.push(() => {
333
+ i.removeEventListener("keydown", d, !0);
315
334
  }), i.dataset.featherKHeaderBound = "true";
316
335
  });
317
336
  const m = document.querySelector(".k-grid-header .k-table-thead");
318
337
  if (m && m.dataset.featherKHeaderBound !== "true") {
319
338
  const i = (c) => {
320
- const v = c.target.closest("th");
321
- v && (S(c) || c.code === "Space") && v.dataset.featherKFilterable === "false" && v.dataset.featherKSortable === "false" && (c.preventDefault(), c.stopImmediatePropagation());
339
+ const y = c.target.closest("th");
340
+ y && (w(c) || c.code === "Space") && y.dataset.featherKFilterable === "false" && y.dataset.featherKSortable === "false" && (c.preventDefault(), c.stopImmediatePropagation());
322
341
  };
323
342
  m.addEventListener(
324
343
  "keydown",
325
344
  i,
326
345
  !0
327
346
  // NOTE: capture phase
328
- ), N.push(() => {
347
+ ), H.push(() => {
329
348
  m.removeEventListener(
330
349
  "keydown",
331
350
  i,
@@ -333,169 +352,169 @@ const _e = (e, t) => {
333
352
  );
334
353
  }), m.dataset.featherKHeaderBound = "true";
335
354
  }
336
- }, X = function(o, m) {
337
- const i = o?.event?.event.target, c = b();
355
+ }, te = function(a, m) {
356
+ const i = a?.event?.event.target, c = I();
338
357
  if (!i || !c) return;
339
- const v = i.classList.contains("k-grid-header-menu"), g = i.classList.contains("k-columnmenu-item"), k = c.find((D) => D.field === o?.event?.field)?.sortable && !0;
340
- if (!v) {
341
- if (g && !k) {
342
- o?.event?.sort?.filter(
343
- (j) => j.field !== o?.event?.field
358
+ const y = i.classList.contains("k-grid-header-menu"), f = i.classList.contains("k-columnmenu-item"), h = c.find((T) => T.field === a?.event?.field)?.sortable && !0;
359
+ if (!y) {
360
+ if (f && !h) {
361
+ a?.event?.sort?.filter(
362
+ (W) => W.field !== a?.event?.field
344
363
  );
345
364
  return;
346
365
  }
347
- typeof m == "function" && W(() => {
348
- s.value && s.value.focus(), m(o), W(() => {
349
- _();
366
+ typeof m == "function" && j(() => {
367
+ s.value && s.value.focus(), m(a), j(() => {
368
+ ee();
350
369
  });
351
370
  });
352
371
  }
353
- }, ne = () => {
354
- if (!U)
372
+ }, le = () => {
373
+ if (!O)
355
374
  try {
356
- O(), f(), y(), U = !0;
357
- } catch (o) {
358
- console.error("initA11y failed:", o), R();
375
+ S(), q(), X(), O = !0;
376
+ } catch (a) {
377
+ console.error("initA11y failed:", a), _();
359
378
  }
360
379
  };
361
380
  return Ie(() => {
362
- R();
381
+ _();
363
382
  }), {
364
383
  activeFilterButton: s,
365
- handleGridKeyDown: T,
366
- handleSortChange: X,
367
- initA11y: ne
384
+ handleGridKeyDown: p,
385
+ handleSortChange: te,
386
+ initA11y: le
368
387
  };
369
388
  };
370
389
  function ze(e) {
371
- const t = J(""), s = J(void 0), U = J(!!e.debug), P = J(e.dateFormat ?? "mm/dd/yyyy"), L = h(() => !!e.required), N = J(!1), A = ["ArrowUp", "ArrowDown"], S = ["ArrowLeft", "ArrowRight"], b = h(() => (t.value ?? "").replace(/\D/g, "")), w = (n) => n <= 2 ? "mm" : n <= 5 ? "dd" : b.value.length <= 10 ? "yyyy" : "mm", I = h(() => {
372
- const n = t.value && t.value.substring(0, 2).replace(/\D/g, "0") || "0";
373
- return parseInt(n).toString().padStart(2, "0");
374
- }), E = h(() => {
375
- const n = t.value && t.value.substring(3, 5).replace(/\D/g, "0") || "0";
376
- return parseInt(n).toString().padStart(2, "0");
377
- }), M = h(() => {
378
- const n = t.value && t.value.substring(6, 10).replace(/\D/g, "0") || "0";
379
- return parseInt(n).toString().padStart(4, "0");
380
- }), T = (n) => {
381
- if (b.value.length === 0) {
382
- e.onChange({ value: null, event: n });
390
+ const t = J(""), s = J(void 0), O = J(!!e.debug), $ = J(e.dateFormat ?? "mm/dd/yyyy"), P = b(() => !!e.required), H = J(!1), x = ["ArrowUp", "ArrowDown"], D = ["ArrowLeft", "ArrowRight"], k = b(() => (t.value ?? "").replace(/\D/g, "")), w = (o) => o <= 2 ? "mm" : o <= 5 ? "dd" : k.value.length <= 10 ? "yyyy" : "mm", I = b(() => {
391
+ const o = t.value && t.value.substring(0, 2).replace(/\D/g, "0") || "0";
392
+ return parseInt(o).toString().padStart(2, "0");
393
+ }), A = b(() => {
394
+ const o = t.value && t.value.substring(3, 5).replace(/\D/g, "0") || "0";
395
+ return parseInt(o).toString().padStart(2, "0");
396
+ }), E = b(() => {
397
+ const o = t.value && t.value.substring(6, 10).replace(/\D/g, "0") || "0";
398
+ return parseInt(o).toString().padStart(4, "0");
399
+ }), L = (o) => {
400
+ if (k.value.length === 0) {
401
+ e.onChange({ value: null, event: o });
383
402
  return;
384
403
  }
385
- if (b.value.length < 8) {
386
- e.onChange({ value: null, event: n });
404
+ if (k.value.length < 8) {
405
+ e.onChange({ value: null, event: o });
387
406
  return;
388
407
  }
389
- if ((t.value ?? "").length === 10 && b.value.length === 8) {
390
- const [d, C, G] = t.value.split("/"), K = parseInt(d), B = parseInt(C), Z = parseInt(G);
391
- if (_(Z, K, B)) {
392
- const ie = new Date(Z, K - 1, B);
393
- O(ie) ? e.onChange({ value: ie, event: n }) : e.onChange({ value: null, event: n });
408
+ if ((t.value ?? "").length === 10 && k.value.length === 8) {
409
+ const [d, v, R] = t.value.split("/"), B = parseInt(d), V = parseInt(v), Z = parseInt(R);
410
+ if (X(Z, B, V)) {
411
+ const ie = new Date(Z, B - 1, V);
412
+ K(ie) ? e.onChange({ value: ie, event: o }) : e.onChange({ value: null, event: o });
394
413
  } else
395
- e.onChange({ value: null, event: n });
414
+ e.onChange({ value: null, event: o });
396
415
  }
397
- }, O = (n) => {
398
- const d = e.min ?? void 0, C = e.max ?? void 0;
399
- return !(d && n < d || C && n > C);
400
- }, f = h(() => {
401
- if ((t.value ?? "").length === 10 && b.value.length === 8) {
402
- const [n, d, C] = (t.value ?? "").split("/"), G = parseInt(n), K = parseInt(d), B = parseInt(C);
403
- if (_(B, G, K))
404
- return new Date(B, G - 1, K);
416
+ }, K = (o) => {
417
+ const d = e.min ?? void 0, v = e.max ?? void 0;
418
+ return !(d && o < d || v && o > v);
419
+ }, p = b(() => {
420
+ if ((t.value ?? "").length === 10 && k.value.length === 8) {
421
+ const [o, d, v] = (t.value ?? "").split("/"), R = parseInt(o), B = parseInt(d), V = parseInt(v);
422
+ if (X(V, R, B))
423
+ return new Date(V, R - 1, B);
405
424
  }
406
425
  return null;
407
- }), y = h(() => (t.value ?? "").length === 10 && b.value.length === 8), R = (n, d) => new Date(n, d, 0).getDate(), _ = (n, d, C) => d >= 1 && d <= 12 && n >= 1900 && C >= 1 && C <= R(n, d), X = (n) => {
408
- t.value = n.value;
409
- const d = n.event?.target;
410
- s.value = d?.selectionStart ?? 0, T(n);
411
- }, ne = (n) => {
412
- s.value = n.target.selectionStart ?? 0;
413
- }, o = (n, d, C) => {
414
- const G = d?.selectionStart ?? s.value ?? 0;
415
- s.value = G;
416
- let K = parseInt(I.value), B = parseInt(E.value), Z = parseInt(M.value);
417
- if (!(b.value.length >= 8) || !_(Z, K, B)) {
426
+ }), S = b(() => (t.value ?? "").length === 10 && k.value.length === 8), q = (o, d) => new Date(o, d, 0).getDate(), X = (o, d, v) => d >= 1 && d <= 12 && o >= 1900 && v >= 1 && v <= q(o, d), _ = (o) => {
427
+ t.value = o.value;
428
+ const d = o.event?.target;
429
+ s.value = d?.selectionStart ?? 0, L(o);
430
+ }, ee = (o) => {
431
+ s.value = o.target.selectionStart ?? 0;
432
+ }, te = (o, d, v) => {
433
+ const R = d?.selectionStart ?? s.value ?? 0;
434
+ s.value = R;
435
+ let B = parseInt(I.value), V = parseInt(A.value), Z = parseInt(E.value);
436
+ if (!(k.value.length >= 8) || !X(Z, B, V)) {
418
437
  const z = e.defaultValue ?? /* @__PURE__ */ new Date();
419
- K = z.getMonth() + 1, B = z.getDate(), Z = z.getFullYear(), t.value = `${String(K).padStart(2, "0")}/${String(B).padStart(
438
+ B = z.getMonth() + 1, V = z.getDate(), Z = z.getFullYear(), t.value = `${String(B).padStart(2, "0")}/${String(V).padStart(
420
439
  2,
421
440
  "0"
422
441
  )}/${String(Z)}`;
423
- const q = new Date(Z, K - 1, B);
424
- e.onChange({ value: O(q) ? q : null, event: C }), g({ useRAF: !0 });
442
+ const U = new Date(Z, B - 1, V);
443
+ e.onChange({ value: K(U) ? U : null, event: v }), c({ useRAF: !0 });
425
444
  return;
426
445
  }
427
- const a = w(G);
428
- if (a === "mm")
429
- K = n === "ArrowUp" ? K < 12 ? K + 1 : 1 : K > 1 ? K - 1 : 12;
430
- else if (a === "dd") {
431
- const z = new Date(Z, K, 0).getDate();
432
- B = n === "ArrowUp" ? B < z ? B + 1 : 1 : B > 1 ? B - 1 : z;
433
- } else a === "yyyy" && (Z = n === "ArrowUp" ? Z + 1 : Math.max(1, Z - 1));
434
- t.value = `${String(K).padStart(2, "0")}/${String(B).padStart(
446
+ const r = w(R);
447
+ if (r === "mm")
448
+ B = o === "ArrowUp" ? B < 12 ? B + 1 : 1 : B > 1 ? B - 1 : 12;
449
+ else if (r === "dd") {
450
+ const z = new Date(Z, B, 0).getDate();
451
+ V = o === "ArrowUp" ? V < z ? V + 1 : 1 : V > 1 ? V - 1 : z;
452
+ } else r === "yyyy" && (Z = o === "ArrowUp" ? Z + 1 : Math.max(1, Z - 1));
453
+ t.value = `${String(B).padStart(2, "0")}/${String(V).padStart(
435
454
  2,
436
455
  "0"
437
456
  )}/${String(Z)}`;
438
- const [l, $, F] = t.value.split("/"), V = new Date(
457
+ const [l, C, F] = t.value.split("/"), N = new Date(
439
458
  parseInt(F),
440
459
  parseInt(l) - 1,
441
- parseInt($)
460
+ parseInt(C)
442
461
  );
443
- V.toString() !== "Invalid Date" && parseInt(F) >= 1e3 ? e.onChange({
444
- value: O(V) ? V : null,
445
- event: C
446
- }) : e.onChange({ value: null, event: C }), g({ useRAF: !0 });
447
- }, m = (n) => {
448
- if (n.code === "Space" || n.key === " ") {
449
- n.preventDefault(), n.stopPropagation(), e.onShowCalendar(n);
462
+ N.toString() !== "Invalid Date" && parseInt(F) >= 1e3 ? e.onChange({
463
+ value: K(N) ? N : null,
464
+ event: v
465
+ }) : e.onChange({ value: null, event: v }), c({ useRAF: !0 });
466
+ }, le = (o) => {
467
+ if (o.code === "Space" || o.key === " ") {
468
+ o.preventDefault(), o.stopPropagation(), e.onShowCalendar(o);
450
469
  return;
451
470
  }
452
- if (n.key === "ArrowDown" && n.altKey) {
453
- n.preventDefault(), n.stopPropagation(), e.onShowCalendar(n);
471
+ if (o.key === "ArrowDown" && o.altKey) {
472
+ o.preventDefault(), o.stopPropagation(), e.onShowCalendar(o);
454
473
  return;
455
474
  }
456
- if (A.includes(n.key)) {
457
- if (n.altKey) return;
458
- n.preventDefault(), n.stopPropagation();
459
- const d = n.target;
460
- o(n.key, d, n);
475
+ if (x.includes(o.key)) {
476
+ if (o.altKey) return;
477
+ o.preventDefault(), o.stopPropagation();
478
+ const d = o.target;
479
+ te(o.key, d, o);
461
480
  return;
462
481
  }
463
- }, i = (n) => {
464
- n.preventDefault();
465
- const d = n.deltaY < 0 ? "ArrowUp" : "ArrowDown";
466
- o(d, n.target, n);
467
- }, c = (n) => {
468
- const d = n.target;
469
- if (S.includes(n.key)) {
482
+ }, a = (o) => {
483
+ o.preventDefault();
484
+ const d = o.deltaY < 0 ? "ArrowUp" : "ArrowDown";
485
+ te(d, o.target, o);
486
+ }, m = (o) => {
487
+ const d = o.target;
488
+ if (D.includes(o.key)) {
470
489
  s.value = d?.selectionStart ?? 0;
471
490
  return;
472
491
  }
473
- if (A.includes(n.key)) {
474
- if (n.altKey) return;
492
+ if (x.includes(o.key)) {
493
+ if (o.altKey) return;
475
494
  s.value = d?.selectionStart ?? 0;
476
495
  }
477
- }, v = (n) => {
478
- N.value = !0, L.value && !e.defaultValue && e.externalValue && e.externalValue.value === void 0 && b.value.length === 0 && (e.externalValue.value = "");
479
- const d = n.target;
496
+ }, i = (o) => {
497
+ H.value = !0, P.value && !e.defaultValue && e.externalValue && e.externalValue.value === void 0 && k.value.length === 0 && (e.externalValue.value = "");
498
+ const d = o.target;
480
499
  d && (s.value = d.selectionStart ?? 0);
481
- }, g = (n) => {
500
+ }, c = (o) => {
482
501
  const d = () => {
483
- const C = document.getElementById(
502
+ const v = document.getElementById(
484
503
  e.id
485
504
  );
486
- if (!C) return;
487
- const G = n?.pos ?? s.value ?? C.value.length;
505
+ if (!v) return;
506
+ const R = o?.pos ?? s.value ?? v.value.length;
488
507
  try {
489
- C.focus(), C.setSelectionRange(G, G);
508
+ v.focus(), v.setSelectionRange(R, R);
490
509
  } catch {
491
510
  }
492
511
  };
493
- W(() => {
494
- if (n?.delay && n.delay > 0) {
495
- setTimeout(d, n.delay);
512
+ j(() => {
513
+ if (o?.delay && o.delay > 0) {
514
+ setTimeout(d, o.delay);
496
515
  return;
497
516
  }
498
- if (n?.useRAF) {
517
+ if (o?.useRAF) {
499
518
  requestAnimationFrame(d);
500
519
  return;
501
520
  }
@@ -504,21 +523,21 @@ function ze(e) {
504
523
  };
505
524
  e.externalValue && ge(
506
525
  e.externalValue,
507
- (n) => {
508
- if (n) {
509
- const d = new Date(n);
526
+ (o) => {
527
+ if (o) {
528
+ const d = new Date(o);
510
529
  if (d.toString() !== "Invalid Date") {
511
- const C = (d.getMonth() + 1).toString().padStart(2, "0"), G = d.getDate().toString().padStart(2, "0"), K = d.getFullYear().toString();
512
- t.value = `${C}/${G}/${K}`, g({ delay: 50 });
530
+ const v = (d.getMonth() + 1).toString().padStart(2, "0"), R = d.getDate().toString().padStart(2, "0"), B = d.getFullYear().toString();
531
+ t.value = `${v}/${R}/${B}`, c({ delay: 50 });
513
532
  return;
514
533
  }
515
534
  }
516
535
  },
517
536
  { immediate: !0 }
518
537
  );
519
- const k = h(() => [
520
- ["Date", `${I.value} / ${E.value} / ${M.value}`],
521
- ["Digits only", b.value],
538
+ const y = b(() => [
539
+ ["Date", `${I.value} / ${A.value} / ${E.value}`],
540
+ ["Digits only", k.value],
522
541
  [
523
542
  "min",
524
543
  e.min?.toLocaleDateString("en-US", {
@@ -535,67 +554,67 @@ function ze(e) {
535
554
  day: "2-digit"
536
555
  }) ?? null
537
556
  ]
538
- ]), D = h(() => {
539
- if (!L.value) {
540
- if (!y.value) return !0;
541
- const d = f.value;
542
- return d ? O(d) : !1;
557
+ ]), f = b(() => {
558
+ if (!P.value) {
559
+ if (!S.value) return !0;
560
+ const d = p.value;
561
+ return d ? K(d) : !1;
543
562
  }
544
- if (!N.value) return !0;
545
- const n = f.value;
546
- return !y.value || !n ? !1 : O(n);
547
- }), j = h(() => {
548
- if (!L.value) {
549
- if (!y.value) return;
550
- const d = f.value;
551
- return d ? O(d) ? "valid" : "out-of-bounds" : "invalid-date";
563
+ if (!H.value) return !0;
564
+ const o = p.value;
565
+ return !S.value || !o ? !1 : K(o);
566
+ }), h = b(() => {
567
+ if (!P.value) {
568
+ if (!S.value) return;
569
+ const d = p.value;
570
+ return d ? K(d) ? "valid" : "out-of-bounds" : "invalid-date";
552
571
  }
553
- if (!N.value) return;
554
- if (b.value.length === 0 || !y.value)
572
+ if (!H.value) return;
573
+ if (k.value.length === 0 || !S.value)
555
574
  return "incomplete";
556
- const n = f.value;
557
- return n ? O(n) ? "valid" : "out-of-bounds" : "invalid-date";
558
- }), oe = h(() => {
559
- const n = j.value;
560
- if (!n || n === "valid") return "";
561
- if (n === "incomplete")
575
+ const o = p.value;
576
+ return o ? K(o) ? "valid" : "out-of-bounds" : "invalid-date";
577
+ }), T = b(() => {
578
+ const o = h.value;
579
+ if (!o || o === "valid") return "";
580
+ if (o === "incomplete")
562
581
  return "Required";
563
- if (n === "invalid-date")
564
- return `Must be in ${P.value} format.`;
582
+ if (o === "invalid-date")
583
+ return `Must be in ${$.value} format.`;
565
584
  const d = e.min ? e.min.toLocaleDateString("en-US", {
566
585
  year: "numeric",
567
586
  month: "2-digit",
568
587
  day: "2-digit"
569
- }) : null, C = e.max ? e.max.toLocaleDateString("en-US", {
588
+ }) : null, v = e.max ? e.max.toLocaleDateString("en-US", {
570
589
  year: "numeric",
571
590
  month: "2-digit",
572
591
  day: "2-digit"
573
592
  }) : null;
574
- if (n === "out-of-bounds") {
575
- if (d && C) return `Must be between ${d} and ${C}.`;
593
+ if (o === "out-of-bounds") {
594
+ if (d && v) return `Must be between ${d} and ${v}.`;
576
595
  if (d) return `Must be on or after ${d}.`;
577
- if (C) return `Must be on or before ${C}.`;
596
+ if (v) return `Must be on or before ${v}.`;
578
597
  }
579
598
  return "";
580
- }), le = () => {
581
- W(() => {
582
- const n = document.getElementById(
599
+ }), W = () => {
600
+ j(() => {
601
+ const o = document.getElementById(
583
602
  e.id
584
603
  );
585
- if (!n) {
604
+ if (!o) {
586
605
  console.warn(`ID (#${e.id}) not found for styling.`);
587
606
  return;
588
607
  }
589
- const d = n.closest(".k-datepicker");
608
+ const d = o.closest(".k-datepicker");
590
609
  if (!d) {
591
610
  console.warn(`.k-datepicker parent not found for #${e.id} styling.`);
592
611
  return;
593
612
  }
594
- const C = d.parentElement;
595
- if (C) {
596
- if (C.classList.contains("fk-datepicker"))
613
+ const v = d.parentElement;
614
+ if (v) {
615
+ if (v.classList.contains("fk-datepicker"))
597
616
  return;
598
- C.classList.add("fk-datepicker");
617
+ v.classList.add("fk-datepicker");
599
618
  } else
600
619
  console.warn(
601
620
  `Parent of .k-datepicker not found for #${e.id} styling.`
@@ -603,70 +622,70 @@ function ze(e) {
603
622
  });
604
623
  };
605
624
  return xe(() => {
606
- le();
625
+ W();
607
626
  }), {
608
627
  raw: t,
609
628
  cursorPos: s,
610
- debugEnabled: U,
611
- debugLines: k,
612
- placeholder: P,
613
- isValid: D,
614
- reason: Y(j),
615
- validationMessage: oe,
616
- digitsOnly: b,
617
- month: Y(I),
618
- day: Y(E),
619
- year: Y(M),
629
+ debugEnabled: O,
630
+ debugLines: y,
631
+ placeholder: $,
632
+ isValid: f,
633
+ reason: G(h),
634
+ validationMessage: T,
635
+ digitsOnly: k,
636
+ month: G(I),
637
+ day: G(A),
638
+ year: G(E),
620
639
  datePart: w,
621
- handleChange: X,
622
- handleKeyDown: m,
623
- handleWheel: i,
624
- handleKeyUp: c,
625
- handleClick: ne,
626
- handleBlur: v,
640
+ handleChange: _,
641
+ handleKeyDown: le,
642
+ handleWheel: a,
643
+ handleKeyUp: m,
644
+ handleClick: ee,
645
+ handleBlur: i,
627
646
  // Expose so consumers can re-run styling when needed
628
- initStyling: le
647
+ initStyling: W
629
648
  };
630
649
  }
631
650
  function Xe(e) {
632
- const t = J(""), s = J(void 0), U = J(!!e.debug), P = J(!1), L = 1440 * 60 * 1e3, N = 365 * L, A = /* @__PURE__ */ new Date(), S = new Date(A.getTime() - N), b = new Date(A.getTime() + N);
633
- e.min = e.min ?? S, e.max = e.max ?? b;
634
- const w = h(() => (t.value ?? "").replace(/\D/g, "")), I = (r, u) => new Date(r, u, 0).getDate(), E = (r, u, p) => u >= 1 && u <= 12 && r >= 1e3 && p >= 1 && p <= I(r, u), M = (r) => Date.UTC(r.getFullYear(), r.getMonth(), r.getDate()), T = (r) => {
635
- if (!r) return null;
636
- const u = e.min ?? new Date(Date.now() - 90 * L), p = e.max ?? /* @__PURE__ */ new Date(), x = M(r);
637
- return x < M(u) || x > M(p) ? null : r;
638
- }, O = (r, u) => e.allowReverse ?? !1 ? !0 : r <= u, f = h(() => (t.value?.length ?? 0) >= 23 && w.value.length >= 16), y = (r) => {
639
- if ((r ?? "").length < 23 || w.value.length < 16)
651
+ const t = J(""), s = J(void 0), O = J(!!e.debug), $ = J(!1), P = 1440 * 60 * 1e3, H = 365 * P, x = /* @__PURE__ */ new Date(), D = new Date(x.getTime() - H), k = new Date(x.getTime() + H);
652
+ e.min = e.min ?? D, e.max = e.max ?? k;
653
+ const w = b(() => (t.value ?? "").replace(/\D/g, "")), I = (n, u) => new Date(n, u, 0).getDate(), A = (n, u, g) => u >= 1 && u <= 12 && n >= 1e3 && g >= 1 && g <= I(n, u), E = (n) => Date.UTC(n.getFullYear(), n.getMonth(), n.getDate()), L = (n) => {
654
+ if (!n) return null;
655
+ const u = e.min ?? new Date(Date.now() - 90 * P), g = e.max ?? /* @__PURE__ */ new Date(), M = E(n);
656
+ return M < E(u) || M > E(g) ? null : n;
657
+ }, K = (n, u) => e.allowReverse ?? !1 ? !0 : n <= u, p = b(() => (t.value?.length ?? 0) >= 23 && w.value.length >= 16), S = (n) => {
658
+ if ((n ?? "").length < 23 || w.value.length < 16)
640
659
  return { start: null, end: null };
641
- const u = r.substring(0, 10), p = r.substring(13, 23), [x, ee, te] = u.split("/").map((ce) => parseInt(ce || "0", 10)), [se, fe, pe] = p.split("/").map((ce) => parseInt(ce || "0", 10)), me = new Date(te, x - 1, ee), he = new Date(pe, se - 1, fe), we = E(te, x, ee) && me.toString() !== "Invalid Date", ke = E(pe, se, fe) && he.toString() !== "Invalid Date";
660
+ const u = n.substring(0, 10), g = n.substring(13, 23), [M, ne, re] = u.split("/").map((ce) => parseInt(ce || "0", 10)), [se, fe, pe] = g.split("/").map((ce) => parseInt(ce || "0", 10)), me = new Date(re, M - 1, ne), he = new Date(pe, se - 1, fe), we = A(re, M, ne) && me.toString() !== "Invalid Date", ke = A(pe, se, fe) && he.toString() !== "Invalid Date";
642
661
  return { start: we ? me : null, end: ke ? he : null };
643
- }, R = e.externalValid ?? J(!0), _ = h(() => y(t.value)), X = h(() => {
644
- const r = T(_.value.start), u = T(_.value.end);
645
- return { start: r, end: u };
646
- }), ne = h(() => {
647
- if (!f.value) return;
648
- const r = X.value.start, u = X.value.end;
649
- if (!r || !u) return;
650
- const p = Math.abs(M(u) - M(r));
651
- return Math.round(p / 864e5 + 1);
652
- }), o = h(() => {
653
- if (!f.value) return !1;
654
- const { start: r, end: u } = _.value;
655
- if (!r || !u || !X.value.start || !X.value.end) return !1;
656
- const p = X.value.start, x = X.value.end;
657
- return !(!O(p, x) || typeof e.maxSpanDays == "number" && ne.value !== void 0 && ne.value > e.maxSpanDays);
658
- }), m = h(() => {
659
- const { start: r, end: u } = _.value;
660
- if (!f.value) return "incomplete";
661
- if (!r || !u) return "invalid-date";
662
- if (!X.value.start || !X.value.end) return "out-of-bounds";
663
- const p = X.value.start, x = X.value.end;
664
- return O(p, x) ? typeof e.maxSpanDays == "number" && ne.value !== void 0 && ne.value > e.maxSpanDays ? "span-exceeds-limit" : "valid" : "reversed-range";
665
- }), i = J(void 0), c = h(() => {
666
- if (R.value !== !1) return "";
667
- const { min: r, max: u } = e, p = i.value;
668
- if (!p) return "";
669
- switch (p) {
662
+ }, q = e.externalValid ?? J(!0), X = b(() => S(t.value)), _ = b(() => {
663
+ const n = L(X.value.start), u = L(X.value.end);
664
+ return { start: n, end: u };
665
+ }), ee = b(() => {
666
+ if (!p.value) return;
667
+ const n = _.value.start, u = _.value.end;
668
+ if (!n || !u) return;
669
+ const g = Math.abs(E(u) - E(n));
670
+ return Math.round(g / 864e5 + 1);
671
+ }), te = b(() => {
672
+ if (!p.value) return !1;
673
+ const { start: n, end: u } = X.value;
674
+ if (!n || !u || !_.value.start || !_.value.end) return !1;
675
+ const g = _.value.start, M = _.value.end;
676
+ return !(!K(g, M) || typeof e.maxSpanDays == "number" && ee.value !== void 0 && ee.value > e.maxSpanDays);
677
+ }), le = b(() => {
678
+ const { start: n, end: u } = X.value;
679
+ if (!p.value) return "incomplete";
680
+ if (!n || !u) return "invalid-date";
681
+ if (!_.value.start || !_.value.end) return "out-of-bounds";
682
+ const g = _.value.start, M = _.value.end;
683
+ return K(g, M) ? typeof e.maxSpanDays == "number" && ee.value !== void 0 && ee.value > e.maxSpanDays ? "span-exceeds-limit" : "valid" : "reversed-range";
684
+ }), a = J(void 0), m = b(() => {
685
+ if (q.value !== !1) return "";
686
+ const { min: n, max: u } = e, g = a.value;
687
+ if (!g) return "";
688
+ switch (g) {
670
689
  case "incomplete":
671
690
  return "Required";
672
691
  case "invalid-date":
@@ -674,118 +693,118 @@ function Xe(e) {
674
693
  case "reversed-range":
675
694
  return "End Date must be on or after Start Date.";
676
695
  case "out-of-bounds":
677
- return r && u ? `Dates must be between ${D(r)} and ${D(u)}.` : "Dates must be within the allowed range.";
696
+ return n && u ? `Dates must be between ${f(n)} and ${f(u)}.` : "Dates must be within the allowed range.";
678
697
  case "span-exceeds-limit":
679
698
  return typeof e.maxSpanDays == "number" ? `Date range exceeds ${e.maxSpanDays} days.` : "Date range exceeds maximum allowed span.";
680
699
  default:
681
700
  return "";
682
701
  }
683
- }), v = ["ArrowUp", "ArrowDown"], g = ["ArrowLeft", "ArrowRight"], k = (r, u) => String(r).padStart(u, "0"), D = (r) => `${k(r.getMonth() + 1, 2)}/${k(r.getDate(), 2)}/${k(
684
- r.getFullYear(),
702
+ }), i = ["ArrowUp", "ArrowDown"], c = ["ArrowLeft", "ArrowRight"], y = (n, u) => String(n).padStart(u, "0"), f = (n) => `${y(n.getMonth() + 1, 2)}/${y(n.getDate(), 2)}/${y(
703
+ n.getFullYear(),
685
704
  4
686
- )}`, j = (r) => r <= 2 ? { side: "start", part: "mm" } : r <= 5 ? { side: "start", part: (r <= 3, "dd") } : r <= 11 ? { side: "start", part: "yyyy" } : r <= 15 ? { side: "end", part: "mm" } : r <= 18 ? { side: "end", part: "dd" } : { side: "end", part: "yyyy" }, oe = (r, u, p) => {
687
- const x = u?.selectionStart ?? s.value ?? 0;
688
- s.value = x;
689
- const { start: ee, end: te } = y(t.value);
690
- if (!ee && !te) {
691
- const H = /* @__PURE__ */ new Date(), ue = D(H);
692
- t.value = `${ue} - ${ue}`, e.onChange({ value: { start: H, end: H }, event: p }), W(() => {
705
+ )}`, h = (n) => n <= 2 ? { side: "start", part: "mm" } : n <= 5 ? { side: "start", part: (n <= 3, "dd") } : n <= 11 ? { side: "start", part: "yyyy" } : n <= 15 ? { side: "end", part: "mm" } : n <= 18 ? { side: "end", part: "dd" } : { side: "end", part: "yyyy" }, T = (n, u, g) => {
706
+ const M = u?.selectionStart ?? s.value ?? 0;
707
+ s.value = M;
708
+ const { start: ne, end: re } = S(t.value);
709
+ if (!ne && !re) {
710
+ const Y = /* @__PURE__ */ new Date(), ue = f(Y);
711
+ t.value = `${ue} - ${ue}`, e.onChange({ value: { start: Y, end: Y }, event: g }), j(() => {
693
712
  requestAnimationFrame(() => {
694
- const re = document.getElementById(
713
+ const oe = document.getElementById(
695
714
  e.id
696
715
  ), ae = s.value ?? 0;
697
- re && (re.focus(), re.setSelectionRange(ae, ae));
716
+ oe && (oe.focus(), oe.setSelectionRange(ae, ae));
698
717
  });
699
718
  });
700
719
  return;
701
720
  }
702
- const se = /* @__PURE__ */ new Date(), fe = j(x);
703
- let pe = ee ? new Date(ee) : new Date(se), me = te ? new Date(te) : new Date(se);
704
- const he = (H, ue) => {
721
+ const se = /* @__PURE__ */ new Date(), fe = h(M);
722
+ let pe = ne ? new Date(ne) : new Date(se), me = re ? new Date(re) : new Date(se);
723
+ const he = (Y, ue) => {
705
724
  if (ue === "mm") {
706
- const re = H.getMonth() + 1, ae = r === "ArrowUp" ? re < 12 ? re + 1 : 1 : re > 1 ? re - 1 : 12;
707
- H.setMonth(ae - 1);
708
- const be = I(H.getFullYear(), ae);
709
- H.getDate() > be && H.setDate(be);
725
+ const oe = Y.getMonth() + 1, ae = n === "ArrowUp" ? oe < 12 ? oe + 1 : 1 : oe > 1 ? oe - 1 : 12;
726
+ Y.setMonth(ae - 1);
727
+ const be = I(Y.getFullYear(), ae);
728
+ Y.getDate() > be && Y.setDate(be);
710
729
  } else if (ue === "dd") {
711
- const re = I(H.getFullYear(), H.getMonth() + 1), ae = H.getDate(), be = r === "ArrowUp" ? ae < re ? ae + 1 : 1 : ae > 1 ? ae - 1 : re;
712
- H.setDate(be);
730
+ const oe = I(Y.getFullYear(), Y.getMonth() + 1), ae = Y.getDate(), be = n === "ArrowUp" ? ae < oe ? ae + 1 : 1 : ae > 1 ? ae - 1 : oe;
731
+ Y.setDate(be);
713
732
  } else if (ue === "yyyy") {
714
- const re = H.getFullYear();
715
- H.setFullYear(r === "ArrowUp" ? re + 1 : Math.max(1, re - 1));
716
- const ae = I(H.getFullYear(), H.getMonth() + 1);
717
- H.getDate() > ae && H.setDate(ae);
733
+ const oe = Y.getFullYear();
734
+ Y.setFullYear(n === "ArrowUp" ? oe + 1 : Math.max(1, oe - 1));
735
+ const ae = I(Y.getFullYear(), Y.getMonth() + 1);
736
+ Y.getDate() > ae && Y.setDate(ae);
718
737
  }
719
738
  };
720
739
  fe.side === "start" ? he(pe, fe.part) : he(me, fe.part);
721
- const we = D(pe), ke = D(me);
740
+ const we = f(pe), ke = f(me);
722
741
  t.value = `${we} - ${ke}`;
723
- const ce = T(pe), De = T(me);
724
- ce && De && O(ce, De) ? e.onChange({ value: { start: ce, end: De }, event: p }) : e.onChange({ value: null, event: p }), W(() => {
742
+ const ce = L(pe), De = L(me);
743
+ ce && De && K(ce, De) ? e.onChange({ value: { start: ce, end: De }, event: g }) : e.onChange({ value: null, event: g }), j(() => {
725
744
  requestAnimationFrame(() => {
726
- const H = document.getElementById(
745
+ const Y = document.getElementById(
727
746
  e.id
728
747
  ), ue = s.value ?? 0;
729
- H && (H.focus(), H.setSelectionRange(ue, ue));
748
+ Y && (Y.focus(), Y.setSelectionRange(ue, ue));
730
749
  });
731
750
  });
732
- }, le = (r) => {
733
- const { start: u, end: p } = y(t.value);
734
- if (!u || !p) {
735
- e.onChange({ value: null, event: r });
751
+ }, W = (n) => {
752
+ const { start: u, end: g } = S(t.value);
753
+ if (!u || !g) {
754
+ e.onChange({ value: null, event: n });
736
755
  return;
737
756
  }
738
- const x = T(u), ee = T(p);
739
- if (!x || !ee) {
740
- e.onChange({ value: null, event: r });
757
+ const M = L(u), ne = L(g);
758
+ if (!M || !ne) {
759
+ e.onChange({ value: null, event: n });
741
760
  return;
742
761
  }
743
- if (!O(x, ee)) {
744
- e.onChange({ value: null, event: r });
762
+ if (!K(M, ne)) {
763
+ e.onChange({ value: null, event: n });
745
764
  return;
746
765
  }
747
- e.onChange({ value: { start: x, end: ee }, event: r });
748
- }, n = (r) => {
749
- const u = r.value ?? "", p = r.event;
750
- if (!u && p && p.type === "click") {
751
- ie(p);
766
+ e.onChange({ value: { start: M, end: ne }, event: n });
767
+ }, o = (n) => {
768
+ const u = n.value ?? "", g = n.event;
769
+ if (!u && g && g.type === "click") {
770
+ ie(g);
752
771
  return;
753
772
  }
754
773
  t.value = u;
755
- const x = p?.target;
756
- s.value = x?.selectionStart ?? 0, le(r);
757
- }, d = (r) => {
758
- s.value = r.target.selectionStart ?? 0;
759
- }, C = (r) => {
760
- if (r.code === "Space" || r.key === " ") {
761
- r.preventDefault(), r.stopPropagation(), e.onShowCalendar(r);
774
+ const M = g?.target;
775
+ s.value = M?.selectionStart ?? 0, W(n);
776
+ }, d = (n) => {
777
+ s.value = n.target.selectionStart ?? 0;
778
+ }, v = (n) => {
779
+ if (n.code === "Space" || n.key === " ") {
780
+ n.preventDefault(), n.stopPropagation(), e.onShowCalendar(n);
762
781
  return;
763
782
  }
764
- if (r.key === "ArrowDown" && r.altKey) {
765
- r.preventDefault(), r.stopPropagation(), e.onShowCalendar(r);
783
+ if (n.key === "ArrowDown" && n.altKey) {
784
+ n.preventDefault(), n.stopPropagation(), e.onShowCalendar(n);
766
785
  return;
767
786
  }
768
- if (v.includes(r.key)) {
769
- r.preventDefault(), r.stopPropagation();
770
- const u = r.target;
771
- oe(r.key, u, r);
787
+ if (i.includes(n.key)) {
788
+ n.preventDefault(), n.stopPropagation();
789
+ const u = n.target;
790
+ T(n.key, u, n);
772
791
  return;
773
792
  }
774
- }, G = (r) => {
775
- r.preventDefault();
776
- const u = r.deltaY < 0 ? "ArrowUp" : "ArrowDown";
777
- oe(u, r.target, r);
778
- }, K = (r) => {
779
- if (g.includes(r.key) || v.includes(r.key)) {
780
- const u = r.target;
793
+ }, R = (n) => {
794
+ n.preventDefault();
795
+ const u = n.deltaY < 0 ? "ArrowUp" : "ArrowDown";
796
+ T(u, n.target, n);
797
+ }, B = (n) => {
798
+ if (c.includes(n.key) || i.includes(n.key)) {
799
+ const u = n.target;
781
800
  s.value = u?.selectionStart ?? 0;
782
801
  }
783
- }, B = () => {
784
- i.value = m.value, (e.manageValid ?? !0) && (R.value = o.value);
785
- }, Z = (r) => {
786
- B();
787
- }, ie = (r) => {
788
- console.log("Clear event:", r), t.value = "", s.value = 0, e.onChange({ value: null, event: r }), B(), W(() => {
802
+ }, V = () => {
803
+ a.value = le.value, (e.manageValid ?? !0) && (q.value = te.value);
804
+ }, Z = (n) => {
805
+ V();
806
+ }, ie = (n) => {
807
+ console.log("Clear event:", n), t.value = "", s.value = 0, e.onChange({ value: null, event: n }), V(), j(() => {
789
808
  const u = document.getElementById(
790
809
  e.id
791
810
  );
@@ -794,34 +813,34 @@ function Xe(e) {
794
813
  };
795
814
  e.externalValue && ge(
796
815
  e.externalValue,
797
- (r) => {
798
- const u = r?.start ?? null, p = r?.end ?? null;
799
- if (u && p) {
800
- if (t.value = `${D(u)} - ${D(p)}`, e.isOpen?.value && P.value && e.onRequestClose) {
801
- const x = typeof e.closeDelay == "number" ? e.closeDelay : e.closeDelay?.value ?? 0;
816
+ (n) => {
817
+ const u = n?.start ?? null, g = n?.end ?? null;
818
+ if (u && g) {
819
+ if (t.value = `${f(u)} - ${f(g)}`, e.isOpen?.value && $.value && e.onRequestClose) {
820
+ const M = typeof e.closeDelay == "number" ? e.closeDelay : e.closeDelay?.value ?? 0;
802
821
  setTimeout(() => {
803
- e.onRequestClose?.(), P.value = !1, B();
804
- }, x);
822
+ e.onRequestClose?.(), $.value = !1, V();
823
+ }, M);
805
824
  }
806
825
  return;
807
826
  }
808
827
  },
809
828
  { immediate: !0 }
810
829
  );
811
- const a = h(
830
+ const r = b(
812
831
  () => t.value && t.value.substring(0, 2).replace(/\D/g, "0") || "0"
813
- ), l = h(
832
+ ), l = b(
814
833
  () => t.value && t.value.substring(3, 5).replace(/\D/g, "0") || "0"
815
- ), $ = h(
834
+ ), C = b(
816
835
  () => t.value && t.value.substring(6, 10).replace(/\D/g, "0") || "0"
817
- ), F = h(
836
+ ), F = b(
818
837
  () => t.value && t.value.substring(13, 15).replace(/\D/g, "0") || "0"
819
- ), V = h(
838
+ ), N = b(
820
839
  () => t.value && t.value.substring(16, 18).replace(/\D/g, "0") || "0"
821
- ), z = h(
840
+ ), z = b(
822
841
  () => t.value && t.value.substring(19, 23).replace(/\D/g, "0") || "0"
823
- ), q = h(() => {
824
- const { start: r, end: u } = y(t.value);
842
+ ), U = b(() => {
843
+ const { start: n, end: u } = S(t.value);
825
844
  return [
826
845
  {
827
846
  label: "Raw",
@@ -837,47 +856,47 @@ function Xe(e) {
837
856
  },
838
857
  {
839
858
  label: "Start",
840
- value: `${String(a.value).padStart(2, "0")} / ${String(
859
+ value: `${String(r.value).padStart(2, "0")} / ${String(
841
860
  l.value
842
- ).padStart(2, "0")} / ${String($.value).padStart(4, "0")}`
861
+ ).padStart(2, "0")} / ${String(C.value).padStart(4, "0")}`
843
862
  },
844
863
  {
845
864
  label: "End",
846
865
  value: `${String(F.value).padStart(2, "0")} / ${String(
847
- V.value
866
+ N.value
848
867
  ).padStart(2, "0")} / ${String(z.value).padStart(4, "0")}`
849
868
  },
850
869
  { label: "Digits only", value: w.value },
851
- { label: "Mask complete", value: `${f.value}` },
870
+ { label: "Mask complete", value: `${p.value}` },
852
871
  {
853
872
  label: "Parsed",
854
- value: `${r ? r.toDateString() : "-"} | ${u ? u.toDateString() : "-"}`
873
+ value: `${n ? n.toDateString() : "-"} | ${u ? u.toDateString() : "-"}`
855
874
  },
856
875
  {
857
876
  label: "Valid (managed)",
858
- value: `${R.value ?? "-"}`
877
+ value: `${q.value ?? "-"}`
859
878
  },
860
- { label: "Span (days)", value: `${ne.value ?? "-"}` },
879
+ { label: "Span (days)", value: `${ee.value ?? "-"}` },
861
880
  {
862
881
  label: "Reason",
863
- value: `${m.value ?? "-"}`
882
+ value: `${le.value ?? "-"}`
864
883
  },
865
884
  {
866
885
  label: "Cursor in",
867
886
  value: `${s.value ?? "-"} (${(() => {
868
- const p = s.value ?? 0, x = j(p);
869
- return `${x.side}.${x.part}`;
887
+ const g = s.value ?? 0, M = h(g);
888
+ return `${M.side}.${M.part}`;
870
889
  })()})`
871
890
  }
872
891
  ];
873
892
  }), Q = () => {
874
- W(() => {
875
- const r = document.getElementById(e.id);
876
- if (!r) {
893
+ j(() => {
894
+ const n = document.getElementById(e.id);
895
+ if (!n) {
877
896
  console.warn(`#${e.id} not found for styling.`);
878
897
  return;
879
898
  }
880
- const u = r.closest("div");
899
+ const u = n.closest("div");
881
900
  if (!u) {
882
901
  console.warn(`Parent div of #${e.id} not found for styling.`);
883
902
  return;
@@ -889,301 +908,301 @@ function Xe(e) {
889
908
  Q();
890
909
  });
891
910
  const ye = () => {
892
- W(() => {
911
+ j(() => {
893
912
  try {
894
- const r = Array.from(
913
+ const n = Array.from(
895
914
  document.querySelectorAll(".k-animation-container")
896
915
  );
897
- if (!r.length) return;
898
- const p = [...r].reverse().find((te) => te.querySelector(".k-calendar"))?.querySelector(
916
+ if (!n.length) return;
917
+ const g = [...n].reverse().find((re) => re.querySelector(".k-calendar"))?.querySelector(
899
918
  ".k-calendar"
900
919
  );
901
- if (!p) return;
902
- const x = p.querySelectorAll(
920
+ if (!g) return;
921
+ const M = g.querySelectorAll(
903
922
  ".k-calendar-table"
904
923
  );
905
- let ee = !1;
906
- x.forEach((te) => {
907
- te.tabIndex === 0 && (ee ? te.tabIndex = -1 : ee = !0);
924
+ let ne = !1;
925
+ M.forEach((re) => {
926
+ re.tabIndex === 0 && (ne ? re.tabIndex = -1 : ne = !0);
908
927
  });
909
- } catch (r) {
910
- console.warn(r);
928
+ } catch (n) {
929
+ console.warn(n);
911
930
  }
912
931
  });
913
932
  };
914
933
  return e.isOpen && ge(
915
934
  e.isOpen,
916
- (r) => {
917
- r && setTimeout(() => ye(), 0);
935
+ (n) => {
936
+ n && setTimeout(() => ye(), 0);
918
937
  },
919
938
  { immediate: !1 }
920
939
  ), {
921
940
  raw: t,
922
941
  cursorPos: s,
923
- debugEnabled: U,
924
- debugLines: q,
942
+ debugEnabled: O,
943
+ debugLines: U,
925
944
  digitsOnly: w,
926
- valid: R,
927
- validComputed: Y(o),
928
- reason: Y(m),
929
- validationMessage: Y(c),
930
- spanDays: Y(ne),
931
- month1: Y(a),
932
- day1: Y(l),
933
- year1: Y($),
934
- month2: Y(F),
935
- day2: Y(V),
936
- year2: Y(z),
937
- handleChange: n,
938
- handleKeyDown: C,
939
- handleWheel: G,
940
- handleKeyUp: K,
945
+ valid: q,
946
+ validComputed: G(te),
947
+ reason: G(le),
948
+ validationMessage: G(m),
949
+ spanDays: G(ee),
950
+ month1: G(r),
951
+ day1: G(l),
952
+ year1: G(C),
953
+ month2: G(F),
954
+ day2: G(N),
955
+ year2: G(z),
956
+ handleChange: o,
957
+ handleKeyDown: v,
958
+ handleWheel: R,
959
+ handleKeyUp: B,
941
960
  handleClick: d,
942
961
  handleBlur: Z,
943
962
  handleClear: ie,
944
963
  onCalendarChange: () => {
945
- P.value = !0;
964
+ $.value = !0;
946
965
  },
947
966
  initStyling: Q
948
967
  };
949
968
  }
950
969
  function Je(e) {
951
- const t = J(""), s = J(void 0), U = J(!!e.debug), P = J(e.timeFormat ?? "hh:mm AM"), L = h(() => !!e.required), N = J(!1), A = ["ArrowUp", "ArrowDown"], S = ["ArrowLeft", "ArrowRight"], b = h(() => (t.value ?? "").replace(/\D/g, "")), w = {
970
+ const t = J(""), s = J(void 0), O = J(!!e.debug), $ = J(e.timeFormat ?? "hh:mm AM"), P = b(() => !!e.required), H = J(!1), x = ["ArrowUp", "ArrowDown"], D = ["ArrowLeft", "ArrowRight"], k = b(() => (t.value ?? "").replace(/\D/g, "")), w = {
952
971
  H: /[0-9]/,
953
972
  h: /[0-9]/,
954
973
  M: /[0-9]/,
955
974
  m: /[0-9]/,
956
975
  A: /[AaPp]/,
957
976
  a: /[Mm]/
958
- }, I = (a) => a <= 2 ? "hh" : a <= 5 ? "mm" : "ampm", E = h(() => {
959
- const a = t.value && t.value.substring(0, 2).replace(/\D/g, "0") || "0", l = parseInt(a);
977
+ }, I = (r) => r <= 2 ? "hh" : r <= 5 ? "mm" : "ampm", A = b(() => {
978
+ const r = t.value && t.value.substring(0, 2).replace(/\D/g, "0") || "0", l = parseInt(r);
960
979
  return Math.min(Math.max(l, 0), 23);
961
- }), M = h(() => {
962
- const a = t.value && t.value.substring(3, 5).replace(/\D/g, "0") || "0", l = parseInt(a);
980
+ }), E = b(() => {
981
+ const r = t.value && t.value.substring(3, 5).replace(/\D/g, "0") || "0", l = parseInt(r);
963
982
  return Math.min(Math.max(l, 0), 59);
964
- }), T = h(() => (t.value?.substring(6, 8) || "AM").toUpperCase().startsWith("P") ? "PM" : "AM"), O = h(() => {
965
- const a = parseInt(t.value?.substring(0, 2).replace(/\D/g, "0") || "0"), l = T.value;
966
- return a === 12 ? l === "AM" ? 0 : 12 : l === "PM" ? a + 12 : a;
967
- }), f = h(() => y.value ? `${String(O.value).padStart(2, "0")}:${String(M.value).padStart(2, "0")}:00` : null), y = h(
983
+ }), L = b(() => (t.value?.substring(6, 8) || "AM").toUpperCase().startsWith("P") ? "PM" : "AM"), K = b(() => {
984
+ const r = parseInt(t.value?.substring(0, 2).replace(/\D/g, "0") || "0"), l = L.value;
985
+ return r === 12 ? l === "AM" ? 0 : 12 : l === "PM" ? r + 12 : r;
986
+ }), p = b(() => S.value ? `${String(K.value).padStart(2, "0")}:${String(E.value).padStart(2, "0")}:00` : null), S = b(
968
987
  () => /^(\d{2}):(\d{2})\s([AP]M)$/i.test(t.value ?? "")
969
- ), R = (a, l, $) => {
970
- let F = a % 12;
988
+ ), q = (r, l, C) => {
989
+ let F = r % 12;
971
990
  return F === 0 && (F = 12), `${String(F).padStart(2, "0")}:${String(l).padStart(
972
991
  2,
973
992
  "0"
974
- )} ${$}`;
975
- }, _ = (a) => {
976
- const l = a.match(/^(\d{2}):(\d{2})\s([AP]M)$/i);
993
+ )} ${C}`;
994
+ }, X = (r) => {
995
+ const l = r.match(/^(\d{2}):(\d{2})\s([AP]M)$/i);
977
996
  if (!l) return null;
978
- const $ = parseInt(l[1]), F = parseInt(l[2]), V = l[3].toUpperCase();
979
- if ($ < 1 || $ > 12 || F < 0 || F > 59) return null;
980
- let z = $ % 12;
981
- V === "PM" && (z += 12);
982
- const q = /* @__PURE__ */ new Date();
983
- return q.setSeconds(0, 0), q.setHours(z), q.setMinutes(F), q;
984
- }, X = (a) => {
985
- if (b.value.length === 0) {
986
- e.onChange({ value: null, event: a });
997
+ const C = parseInt(l[1]), F = parseInt(l[2]), N = l[3].toUpperCase();
998
+ if (C < 1 || C > 12 || F < 0 || F > 59) return null;
999
+ let z = C % 12;
1000
+ N === "PM" && (z += 12);
1001
+ const U = /* @__PURE__ */ new Date();
1002
+ return U.setSeconds(0, 0), U.setHours(z), U.setMinutes(F), U;
1003
+ }, _ = (r) => {
1004
+ if (k.value.length === 0) {
1005
+ e.onChange({ value: null, event: r });
987
1006
  return;
988
1007
  }
989
- if (!y.value) {
990
- e.onChange({ value: null, event: a });
1008
+ if (!S.value) {
1009
+ e.onChange({ value: null, event: r });
991
1010
  return;
992
1011
  }
993
- const l = _(t.value);
994
- l && o(l) ? e.onChange({ value: l, event: a }) : e.onChange({ value: null, event: a });
995
- }, ne = (a) => a.getHours() * 60 + a.getMinutes(), o = (a) => {
996
- const l = e.min ?? void 0, $ = e.max ?? void 0, F = ne(a);
1012
+ const l = X(t.value);
1013
+ l && te(l) ? e.onChange({ value: l, event: r }) : e.onChange({ value: null, event: r });
1014
+ }, ee = (r) => r.getHours() * 60 + r.getMinutes(), te = (r) => {
1015
+ const l = e.min ?? void 0, C = e.max ?? void 0, F = ee(r);
997
1016
  if (l) {
998
- const V = ne(l);
999
- if (F < V) return !1;
1017
+ const N = ee(l);
1018
+ if (F < N) return !1;
1000
1019
  }
1001
- if ($) {
1002
- const V = ne($);
1003
- if (F > V) return !1;
1020
+ if (C) {
1021
+ const N = ee(C);
1022
+ if (F > N) return !1;
1004
1023
  }
1005
1024
  return !0;
1006
- }, m = (a) => {
1007
- const l = a.getHours(), $ = l >= 12 ? "PM" : "AM";
1008
- t.value = R(l, a.getMinutes(), $);
1009
- }, i = (a, l) => {
1010
- e.onChange({ value: a, event: l });
1011
- }, c = () => {
1012
- W(() => {
1025
+ }, le = (r) => {
1026
+ const l = r.getHours(), C = l >= 12 ? "PM" : "AM";
1027
+ t.value = q(l, r.getMinutes(), C);
1028
+ }, a = (r, l) => {
1029
+ e.onChange({ value: r, event: l });
1030
+ }, m = () => {
1031
+ j(() => {
1013
1032
  requestAnimationFrame(() => {
1014
1033
  requestAnimationFrame(() => {
1015
- const a = document.getElementById(
1034
+ const r = document.getElementById(
1016
1035
  e.id
1017
1036
  );
1018
- if (a) {
1019
- a.focus();
1020
- const l = (a.value ?? "").length;
1021
- a.setSelectionRange(l, l);
1037
+ if (r) {
1038
+ r.focus();
1039
+ const l = (r.value ?? "").length;
1040
+ r.setSelectionRange(l, l);
1022
1041
  }
1023
1042
  });
1024
1043
  });
1025
1044
  });
1026
- }, v = (a) => {
1027
- const l = a?.event?.target;
1045
+ }, i = (r) => {
1046
+ const l = r?.event?.target;
1028
1047
  return l ? l.closest(".k-time-now") ? "now" : l.closest(".k-time-accept") ? "set" : null : null;
1029
- }, g = (a, l) => {
1030
- a && o(a) ? i(a, l) : i(null, l);
1031
- }, k = (...a) => {
1032
- const l = a[0];
1048
+ }, c = (r, l) => {
1049
+ r && te(r) ? a(r, l) : a(null, l);
1050
+ }, y = (...r) => {
1051
+ const l = r[0];
1033
1052
  if (!l) return;
1034
- const $ = v(l);
1035
- if ($ === "now") {
1036
- const V = /* @__PURE__ */ new Date();
1037
- m(V), g(V, l), c();
1053
+ const C = i(l);
1054
+ if (C === "now") {
1055
+ const N = /* @__PURE__ */ new Date();
1056
+ le(N), c(N, l), m();
1038
1057
  return;
1039
1058
  }
1040
1059
  if (l?.value instanceof Date) {
1041
- const V = new Date(l.value);
1042
- m(V), g(V, l), $ === "set" && c();
1060
+ const N = new Date(l.value);
1061
+ le(N), c(N, l), C === "set" && m();
1043
1062
  return;
1044
1063
  }
1045
1064
  if (l?.value === null) {
1046
- t.value = "", i(null, l);
1065
+ t.value = "", a(null, l);
1047
1066
  return;
1048
1067
  }
1049
1068
  t.value = l.value;
1050
1069
  const F = l.event?.target;
1051
1070
  s.value = F?.selectionStart ?? 0;
1052
1071
  try {
1053
- const V = s.value ?? 0;
1054
- if (I(V) === "ampm" && (t.value ?? "").length >= 8) {
1072
+ const N = s.value ?? 0;
1073
+ if (I(N) === "ampm" && (t.value ?? "").length >= 8) {
1055
1074
  const z = t.value.charAt(6);
1056
- /[Aa]/.test(z) ? (t.value = `${t.value.slice(0, 6)}AM${t.value.slice(8)}`, W(() => {
1075
+ /[Aa]/.test(z) ? (t.value = `${t.value.slice(0, 6)}AM${t.value.slice(8)}`, j(() => {
1057
1076
  requestAnimationFrame(() => {
1058
- const q = document.getElementById(
1077
+ const U = document.getElementById(
1059
1078
  e.id
1060
1079
  );
1061
- q && (q.focus(), q.setSelectionRange(8, 8));
1080
+ U && (U.focus(), U.setSelectionRange(8, 8));
1062
1081
  });
1063
- })) : /[Pp]/.test(z) && (t.value = `${t.value.slice(0, 6)}PM${t.value.slice(8)}`, W(() => {
1082
+ })) : /[Pp]/.test(z) && (t.value = `${t.value.slice(0, 6)}PM${t.value.slice(8)}`, j(() => {
1064
1083
  requestAnimationFrame(() => {
1065
- const q = document.getElementById(
1084
+ const U = document.getElementById(
1066
1085
  e.id
1067
1086
  );
1068
- q && (q.focus(), q.setSelectionRange(8, 8));
1087
+ U && (U.focus(), U.setSelectionRange(8, 8));
1069
1088
  });
1070
1089
  }));
1071
1090
  }
1072
1091
  } catch {
1073
1092
  }
1074
- X(l);
1075
- }, D = (a) => {
1076
- s.value = a.target.selectionStart ?? 0;
1077
- }, j = (a, l, $) => {
1093
+ _(l);
1094
+ }, f = (r) => {
1095
+ s.value = r.target.selectionStart ?? 0;
1096
+ }, h = (r, l, C) => {
1078
1097
  const F = l?.selectionStart ?? s.value ?? 0;
1079
1098
  s.value = F;
1080
- const V = I(F), z = (t.value ?? "").match(/^(\d{2}):(\d{2})\s([AP]M)$/i);
1099
+ const N = I(F), z = (t.value ?? "").match(/^(\d{2}):(\d{2})\s([AP]M)$/i);
1081
1100
  if (!z) {
1082
- if ((t.value ?? "").length === 0 || b.value.length === 0) {
1083
- const u = /* @__PURE__ */ new Date(), p = u.getHours(), x = p >= 12 ? "PM" : "AM";
1084
- t.value = R(p, u.getMinutes(), x);
1085
- const ee = _(t.value);
1086
- g(ee, $), W(() => {
1101
+ if ((t.value ?? "").length === 0 || k.value.length === 0) {
1102
+ const u = /* @__PURE__ */ new Date(), g = u.getHours(), M = g >= 12 ? "PM" : "AM";
1103
+ t.value = q(g, u.getMinutes(), M);
1104
+ const ne = X(t.value);
1105
+ c(ne, C), j(() => {
1087
1106
  requestAnimationFrame(() => {
1088
- const te = document.getElementById(
1107
+ const re = document.getElementById(
1089
1108
  e.id
1090
1109
  ), se = s.value ?? 0;
1091
- te && (te.focus(), te.setSelectionRange(se, se));
1110
+ re && (re.focus(), re.setSelectionRange(se, se));
1092
1111
  });
1093
1112
  });
1094
1113
  }
1095
1114
  return;
1096
1115
  }
1097
- let q = parseInt(z[1]), Q = parseInt(z[2]), ye = z[3].toUpperCase();
1098
- if (V === "hh")
1099
- a === "ArrowUp" ? q = q < 12 ? q + 1 : 1 : q = q > 1 ? q - 1 : 12;
1100
- else if (V === "mm") {
1116
+ let U = parseInt(z[1]), Q = parseInt(z[2]), ye = z[3].toUpperCase();
1117
+ if (N === "hh")
1118
+ r === "ArrowUp" ? U = U < 12 ? U + 1 : 1 : U = U > 1 ? U - 1 : 12;
1119
+ else if (N === "mm") {
1101
1120
  const u = e.minuteStepRef?.value ?? e.minuteStep ?? 1;
1102
1121
  if (u === 1)
1103
- a === "ArrowUp" ? Q = Q < 59 ? Q + 1 : 0 : Q = Q > 0 ? Q - 1 : 59;
1104
- else if (a === "ArrowUp") {
1105
- const p = Q % u;
1106
- let x = p === 0 ? Q + u : Q + (u - p);
1107
- x >= 60 && (x = 0), Q = x;
1122
+ r === "ArrowUp" ? Q = Q < 59 ? Q + 1 : 0 : Q = Q > 0 ? Q - 1 : 59;
1123
+ else if (r === "ArrowUp") {
1124
+ const g = Q % u;
1125
+ let M = g === 0 ? Q + u : Q + (u - g);
1126
+ M >= 60 && (M = 0), Q = M;
1108
1127
  } else {
1109
- const p = Q % u;
1110
- let x = p === 0 ? Q - u : Q - p;
1111
- x < 0 && (x = 60 - u), Q = x;
1128
+ const g = Q % u;
1129
+ let M = g === 0 ? Q - u : Q - g;
1130
+ M < 0 && (M = 60 - u), Q = M;
1112
1131
  }
1113
- } else V === "ampm" && (ye = ye === "AM" ? "PM" : "AM");
1114
- t.value = `${String(q).padStart(2, "0")}:${String(Q).padStart(
1132
+ } else N === "ampm" && (ye = ye === "AM" ? "PM" : "AM");
1133
+ t.value = `${String(U).padStart(2, "0")}:${String(Q).padStart(
1115
1134
  2,
1116
1135
  "0"
1117
1136
  )} ${ye}`;
1118
- const r = _(t.value);
1119
- g(r, $), W(() => {
1137
+ const n = X(t.value);
1138
+ c(n, C), j(() => {
1120
1139
  requestAnimationFrame(() => {
1121
1140
  const u = document.getElementById(
1122
1141
  e.id
1123
- ), p = s.value ?? 0;
1124
- u && (u.focus(), u.setSelectionRange(p, p));
1142
+ ), g = s.value ?? 0;
1143
+ u && (u.focus(), u.setSelectionRange(g, g));
1125
1144
  });
1126
1145
  });
1127
- }, oe = (a) => {
1128
- if (a.code === "Space" || a.key === " ") {
1129
- a.preventDefault(), a.stopPropagation(), e.onShowPicker(a);
1146
+ }, T = (r) => {
1147
+ if (r.code === "Space" || r.key === " ") {
1148
+ r.preventDefault(), r.stopPropagation(), e.onShowPicker(r);
1130
1149
  return;
1131
1150
  }
1132
- if (a.key === "ArrowDown" && a.altKey) {
1133
- a.preventDefault(), a.stopPropagation(), e.onShowPicker(a);
1151
+ if (r.key === "ArrowDown" && r.altKey) {
1152
+ r.preventDefault(), r.stopPropagation(), e.onShowPicker(r);
1134
1153
  return;
1135
1154
  }
1136
- if (A.includes(a.key)) {
1137
- if (a.altKey) return;
1138
- a.preventDefault(), a.stopPropagation();
1139
- const l = a.target;
1140
- j(a.key, l, a);
1155
+ if (x.includes(r.key)) {
1156
+ if (r.altKey) return;
1157
+ r.preventDefault(), r.stopPropagation();
1158
+ const l = r.target;
1159
+ h(r.key, l, r);
1141
1160
  return;
1142
1161
  }
1143
- }, le = (a) => {
1144
- a.preventDefault();
1145
- const l = a.deltaY < 0 ? "ArrowUp" : "ArrowDown";
1146
- j(l, a.target, a);
1147
- }, n = (a) => {
1148
- const l = a.target;
1149
- if (S.includes(a.key)) {
1162
+ }, W = (r) => {
1163
+ r.preventDefault();
1164
+ const l = r.deltaY < 0 ? "ArrowUp" : "ArrowDown";
1165
+ h(l, r.target, r);
1166
+ }, o = (r) => {
1167
+ const l = r.target;
1168
+ if (D.includes(r.key)) {
1150
1169
  s.value = l?.selectionStart ?? 0;
1151
1170
  return;
1152
1171
  }
1153
- if (A.includes(a.key)) {
1154
- if (a.altKey) return;
1172
+ if (x.includes(r.key)) {
1173
+ if (r.altKey) return;
1155
1174
  s.value = l?.selectionStart ?? 0;
1156
1175
  }
1157
- }, d = (a) => {
1158
- N.value = !0, L.value && e.externalValue && e.externalValue.value === void 0 && b.value.length === 0 && (e.externalValue.value = "");
1159
- const l = a.target;
1176
+ }, d = (r) => {
1177
+ H.value = !0, P.value && e.externalValue && e.externalValue.value === void 0 && k.value.length === 0 && (e.externalValue.value = "");
1178
+ const l = r.target;
1160
1179
  l && (s.value = l.selectionStart ?? 0);
1161
1180
  };
1162
1181
  e.externalValue && ge(
1163
1182
  e.externalValue,
1164
- (a) => {
1165
- if (a) {
1166
- const l = new Date(a);
1183
+ (r) => {
1184
+ if (r) {
1185
+ const l = new Date(r);
1167
1186
  if (l.toString() !== "Invalid Date") {
1168
- const $ = l.getHours(), F = $ >= 12 ? "PM" : "AM";
1169
- t.value = R($, l.getMinutes(), F);
1187
+ const C = l.getHours(), F = C >= 12 ? "PM" : "AM";
1188
+ t.value = q(C, l.getMinutes(), F);
1170
1189
  return;
1171
1190
  }
1172
1191
  }
1173
1192
  },
1174
1193
  { immediate: !0 }
1175
1194
  );
1176
- const C = h(() => [
1195
+ const v = b(() => [
1177
1196
  ["Time", t.value || "--:-- --"],
1178
- ["Hour (12h)", E.value],
1179
- ["Hour (24h)", O.value],
1180
- ["Minute", M.value],
1181
- ["Period", T.value],
1182
- ["Time (24h)", f.value ?? "--:--:--"],
1183
- ["Digits only", b.value],
1197
+ ["Hour (12h)", A.value],
1198
+ ["Hour (24h)", K.value],
1199
+ ["Minute", E.value],
1200
+ ["Period", L.value],
1201
+ ["Time (24h)", p.value ?? "--:--:--"],
1202
+ ["Digits only", k.value],
1184
1203
  [
1185
1204
  "Parsed Date",
1186
- G.value?.toLocaleDateString("en-US", {
1205
+ R.value?.toLocaleDateString("en-US", {
1187
1206
  hour: "2-digit",
1188
1207
  minute: "2-digit"
1189
1208
  }) ?? null
@@ -1202,70 +1221,70 @@ function Je(e) {
1202
1221
  minute: "2-digit"
1203
1222
  }) ?? null
1204
1223
  ],
1205
- ["valid", K.value],
1206
- ["reason", B.value],
1224
+ ["valid", B.value],
1225
+ ["reason", V.value],
1207
1226
  ["validationMessage", Z.value]
1208
- ]), G = h(
1209
- () => _(t.value) ?? null
1210
- ), K = h(() => {
1211
- if (!L.value) {
1212
- if (!y.value) return !0;
1213
- const l = G.value;
1214
- return l ? o(l) : !1;
1227
+ ]), R = b(
1228
+ () => X(t.value) ?? null
1229
+ ), B = b(() => {
1230
+ if (!P.value) {
1231
+ if (!S.value) return !0;
1232
+ const l = R.value;
1233
+ return l ? te(l) : !1;
1215
1234
  }
1216
- if (!N.value) return !0;
1217
- const a = G.value;
1218
- return !y.value || !a ? !1 : o(a);
1219
- }), B = h(() => {
1220
- if (!L.value) {
1221
- if (!y.value) return;
1222
- const l = G.value;
1223
- return l ? o(l) ? "valid" : "out-of-bounds" : "invalid-time";
1235
+ if (!H.value) return !0;
1236
+ const r = R.value;
1237
+ return !S.value || !r ? !1 : te(r);
1238
+ }), V = b(() => {
1239
+ if (!P.value) {
1240
+ if (!S.value) return;
1241
+ const l = R.value;
1242
+ return l ? te(l) ? "valid" : "out-of-bounds" : "invalid-time";
1224
1243
  }
1225
- if (!N.value) return;
1226
- if (b.value.length === 0 || !y.value)
1244
+ if (!H.value) return;
1245
+ if (k.value.length === 0 || !S.value)
1227
1246
  return "incomplete";
1228
- const a = G.value;
1229
- return a ? o(a) ? "valid" : "out-of-bounds" : "invalid-time";
1230
- }), Z = h(() => {
1231
- const a = B.value;
1232
- if (!a || a === "valid") return "";
1233
- if (a === "incomplete")
1247
+ const r = R.value;
1248
+ return r ? te(r) ? "valid" : "out-of-bounds" : "invalid-time";
1249
+ }), Z = b(() => {
1250
+ const r = V.value;
1251
+ if (!r || r === "valid") return "";
1252
+ if (r === "incomplete")
1234
1253
  return "Required";
1235
- if (a === "invalid-time")
1236
- return `Must be in ${P.value} format.`;
1254
+ if (r === "invalid-time")
1255
+ return `Must be in ${$.value} format.`;
1237
1256
  const l = {
1238
1257
  hour: "2-digit",
1239
1258
  minute: "2-digit"
1240
- }, $ = e.min ? e.min.toLocaleTimeString("en-US", l) : null, F = e.max ? e.max.toLocaleTimeString("en-US", l) : null;
1241
- if (a === "out-of-bounds") {
1242
- if ($ && F) return `Must be between ${$} and ${F}.`;
1243
- if ($) return `Must be ${$} or later.`;
1259
+ }, C = e.min ? e.min.toLocaleTimeString("en-US", l) : null, F = e.max ? e.max.toLocaleTimeString("en-US", l) : null;
1260
+ if (r === "out-of-bounds") {
1261
+ if (C && F) return `Must be between ${C} and ${F}.`;
1262
+ if (C) return `Must be ${C} or later.`;
1244
1263
  if (F) return `Must be ${F} or earlier.`;
1245
1264
  }
1246
1265
  return "";
1247
1266
  }), ie = () => {
1248
- W(() => {
1249
- const a = document.getElementById(e.id);
1250
- if (!a) {
1267
+ j(() => {
1268
+ const r = document.getElementById(e.id);
1269
+ if (!r) {
1251
1270
  console.warn(`#${e.id} not found for styling.`);
1252
1271
  return;
1253
1272
  }
1254
- const l = a.closest(".k-timepicker");
1273
+ const l = r.closest(".k-timepicker");
1255
1274
  if (!l) {
1256
1275
  console.warn(
1257
1276
  `.k-timepicker parent of #${e.id} not found for styling.`
1258
1277
  );
1259
1278
  return;
1260
1279
  }
1261
- const $ = l.parentElement;
1262
- if (!$) {
1280
+ const C = l.parentElement;
1281
+ if (!C) {
1263
1282
  console.warn(
1264
1283
  `Parent of .k-timepicker not found for #${e.id} styling.`
1265
1284
  );
1266
1285
  return;
1267
1286
  }
1268
- $.classList.contains("fk-timepicker") || $.classList.add("fk-timepicker");
1287
+ C.classList.contains("fk-timepicker") || C.classList.add("fk-timepicker");
1269
1288
  });
1270
1289
  };
1271
1290
  return xe(() => {
@@ -1273,26 +1292,26 @@ function Je(e) {
1273
1292
  }), {
1274
1293
  raw: t,
1275
1294
  rules: w,
1276
- debugEnabled: U,
1277
- debugLines: C,
1278
- placeholder: P,
1279
- isValid: K,
1280
- reason: Y(B),
1295
+ debugEnabled: O,
1296
+ debugLines: v,
1297
+ placeholder: $,
1298
+ isValid: B,
1299
+ reason: G(V),
1281
1300
  validationMessage: Z,
1282
- isComplete: y,
1283
- inRangeTime: o,
1301
+ isComplete: S,
1302
+ inRangeTime: te,
1284
1303
  cursorPos: s,
1285
- hour: Y(E),
1286
- hour24: Y(O),
1287
- minute: Y(M),
1288
- period: Y(T),
1289
- time24: Y(f),
1290
- parsedRawTime: Y(G),
1291
- handleChange: k,
1292
- handleKeyDown: oe,
1293
- handleKeyUp: n,
1294
- handleClick: D,
1295
- handleWheel: le,
1304
+ hour: G(A),
1305
+ hour24: G(K),
1306
+ minute: G(E),
1307
+ period: G(L),
1308
+ time24: G(p),
1309
+ parsedRawTime: G(R),
1310
+ handleChange: y,
1311
+ handleKeyDown: T,
1312
+ handleKeyUp: o,
1313
+ handleClick: f,
1314
+ handleWheel: W,
1296
1315
  handleBlur: d,
1297
1316
  // Expose so consumers can reapply theming when Kendo updates DOM
1298
1317
  initStyling: ie
@@ -1330,104 +1349,104 @@ function Se(e) {
1330
1349
  }
1331
1350
  function Ee(...e) {
1332
1351
  const t = [], s = () => {
1333
- t.forEach((A) => A()), t.length = 0;
1334
- }, U = (A, S, b, w) => (A.addEventListener(S, b, w), () => A.removeEventListener(S, b, w)), P = h(() => {
1335
- const A = Ae(de(e[0])).filter((S) => S != null);
1336
- return A.every((S) => typeof S != "string") ? A : void 0;
1337
- }), L = Ne(
1352
+ t.forEach((x) => x()), t.length = 0;
1353
+ }, O = (x, D, k, w) => (x.addEventListener(D, k, w), () => x.removeEventListener(D, k, w)), $ = b(() => {
1354
+ const x = Ae(de(e[0])).filter((D) => D != null);
1355
+ return x.every((D) => typeof D != "string") ? x : void 0;
1356
+ }), P = Ne(
1338
1357
  () => {
1339
- var A, S;
1358
+ var x, D;
1340
1359
  return [
1341
- (S = (A = P.value) == null ? void 0 : A.map((b) => Se(b))) != null ? S : [$e].filter((b) => b != null),
1342
- Ae(de(P.value ? e[1] : e[0])),
1343
- Ae(Fe(P.value ? e[2] : e[1])),
1360
+ (D = (x = $.value) == null ? void 0 : x.map((k) => Se(k))) != null ? D : [$e].filter((k) => k != null),
1361
+ Ae(de($.value ? e[1] : e[0])),
1362
+ Ae(Fe($.value ? e[2] : e[1])),
1344
1363
  // @ts-expect-error - TypeScript gets the correct types, but somehow still complains
1345
- de(P.value ? e[3] : e[2])
1364
+ de($.value ? e[3] : e[2])
1346
1365
  ];
1347
1366
  },
1348
- ([A, S, b, w]) => {
1349
- if (s(), !A?.length || !S?.length || !b?.length)
1367
+ ([x, D, k, w]) => {
1368
+ if (s(), !x?.length || !D?.length || !k?.length)
1350
1369
  return;
1351
1370
  const I = Ke(w) ? { ...w } : w;
1352
1371
  t.push(
1353
- ...A.flatMap(
1354
- (E) => S.flatMap(
1355
- (M) => b.map((T) => U(E, M, T, I))
1372
+ ...x.flatMap(
1373
+ (A) => D.flatMap(
1374
+ (E) => k.map((L) => O(A, E, L, I))
1356
1375
  )
1357
1376
  )
1358
1377
  );
1359
1378
  },
1360
1379
  { flush: "post" }
1361
- ), N = () => {
1362
- L(), s();
1380
+ ), H = () => {
1381
+ P(), s();
1363
1382
  };
1364
- return Ue(s), N;
1383
+ return Ue(s), H;
1365
1384
  }
1366
1385
  let Me = !1;
1367
1386
  function He(e, t, s = {}) {
1368
- const { window: U = $e, ignore: P = [], capture: L = !0, detectIframe: N = !1, controls: A = !1 } = s;
1369
- if (!U)
1370
- return A ? { stop: ve, cancel: ve, trigger: ve } : ve;
1387
+ const { window: O = $e, ignore: $ = [], capture: P = !0, detectIframe: H = !1, controls: x = !1 } = s;
1388
+ if (!O)
1389
+ return x ? { stop: ve, cancel: ve, trigger: ve } : ve;
1371
1390
  if (Be && !Me) {
1372
1391
  Me = !0;
1373
- const f = { passive: !0 };
1374
- Array.from(U.document.body.children).forEach((y) => y.addEventListener("click", ve, f)), U.document.documentElement.addEventListener("click", ve, f);
1392
+ const p = { passive: !0 };
1393
+ Array.from(O.document.body.children).forEach((S) => S.addEventListener("click", ve, p)), O.document.documentElement.addEventListener("click", ve, p);
1375
1394
  }
1376
- let S = !0;
1377
- const b = (f) => de(P).some((y) => {
1378
- if (typeof y == "string")
1379
- return Array.from(U.document.querySelectorAll(y)).some((R) => R === f.target || f.composedPath().includes(R));
1395
+ let D = !0;
1396
+ const k = (p) => de($).some((S) => {
1397
+ if (typeof S == "string")
1398
+ return Array.from(O.document.querySelectorAll(S)).some((q) => q === p.target || p.composedPath().includes(q));
1380
1399
  {
1381
- const R = Se(y);
1382
- return R && (f.target === R || f.composedPath().includes(R));
1400
+ const q = Se(S);
1401
+ return q && (p.target === q || p.composedPath().includes(q));
1383
1402
  }
1384
1403
  });
1385
- function w(f) {
1386
- const y = de(f);
1387
- return y && y.$.subTree.shapeFlag === 16;
1404
+ function w(p) {
1405
+ const S = de(p);
1406
+ return S && S.$.subTree.shapeFlag === 16;
1388
1407
  }
1389
- function I(f, y) {
1390
- const R = de(f), _ = R.$.subTree && R.$.subTree.children;
1391
- return _ == null || !Array.isArray(_) ? !1 : _.some((X) => X.el === y.target || y.composedPath().includes(X.el));
1408
+ function I(p, S) {
1409
+ const q = de(p), X = q.$.subTree && q.$.subTree.children;
1410
+ return X == null || !Array.isArray(X) ? !1 : X.some((_) => _.el === S.target || S.composedPath().includes(_.el));
1392
1411
  }
1393
- const E = (f) => {
1394
- const y = Se(e);
1395
- if (f.target != null && !(!(y instanceof Element) && w(e) && I(e, f)) && !(!y || y === f.target || f.composedPath().includes(y))) {
1396
- if ("detail" in f && f.detail === 0 && (S = !b(f)), !S) {
1397
- S = !0;
1412
+ const A = (p) => {
1413
+ const S = Se(e);
1414
+ if (p.target != null && !(!(S instanceof Element) && w(e) && I(e, p)) && !(!S || S === p.target || p.composedPath().includes(S))) {
1415
+ if ("detail" in p && p.detail === 0 && (D = !k(p)), !D) {
1416
+ D = !0;
1398
1417
  return;
1399
1418
  }
1400
- t(f);
1419
+ t(p);
1401
1420
  }
1402
1421
  };
1403
- let M = !1;
1404
- const T = [
1405
- Ee(U, "click", (f) => {
1406
- M || (M = !0, setTimeout(() => {
1407
- M = !1;
1408
- }, 0), E(f));
1409
- }, { passive: !0, capture: L }),
1410
- Ee(U, "pointerdown", (f) => {
1411
- const y = Se(e);
1412
- S = !b(f) && !!(y && !f.composedPath().includes(y));
1422
+ let E = !1;
1423
+ const L = [
1424
+ Ee(O, "click", (p) => {
1425
+ E || (E = !0, setTimeout(() => {
1426
+ E = !1;
1427
+ }, 0), A(p));
1428
+ }, { passive: !0, capture: P }),
1429
+ Ee(O, "pointerdown", (p) => {
1430
+ const S = Se(e);
1431
+ D = !k(p) && !!(S && !p.composedPath().includes(S));
1413
1432
  }, { passive: !0 }),
1414
- N && Ee(U, "blur", (f) => {
1433
+ H && Ee(O, "blur", (p) => {
1415
1434
  setTimeout(() => {
1416
- var y;
1417
- const R = Se(e);
1418
- ((y = U.document.activeElement) == null ? void 0 : y.tagName) === "IFRAME" && !R?.contains(U.document.activeElement) && t(f);
1435
+ var S;
1436
+ const q = Se(e);
1437
+ ((S = O.document.activeElement) == null ? void 0 : S.tagName) === "IFRAME" && !q?.contains(O.document.activeElement) && t(p);
1419
1438
  }, 0);
1420
1439
  }, { passive: !0 })
1421
- ].filter(Boolean), O = () => T.forEach((f) => f());
1422
- return A ? {
1423
- stop: O,
1440
+ ].filter(Boolean), K = () => L.forEach((p) => p());
1441
+ return x ? {
1442
+ stop: K,
1424
1443
  cancel: () => {
1425
- S = !1;
1444
+ D = !1;
1426
1445
  },
1427
- trigger: (f) => {
1428
- S = !0, E(f), S = !1;
1446
+ trigger: (p) => {
1447
+ D = !0, A(p), D = !1;
1429
1448
  }
1430
- } : O;
1449
+ } : K;
1431
1450
  }
1432
1451
  function Qe(e) {
1433
1452
  const t = Re(null), s = [
@@ -1435,84 +1454,84 @@ function Qe(e) {
1435
1454
  ".k-popup",
1436
1455
  ".k-timepicker-popup",
1437
1456
  ".k-menu-popup"
1438
- ], U = Array.isArray(e.popupSelector) ? e.popupSelector : [e.popupSelector ?? s].flat(), P = (w) => w ? typeof e.initialFocus == "string" ? w.querySelector(e.initialFocus) ?? w : typeof e.initialFocus == "function" ? e.initialFocus(w) ?? w : w.querySelector(
1457
+ ], O = Array.isArray(e.popupSelector) ? e.popupSelector : [e.popupSelector ?? s].flat(), $ = (w) => w ? typeof e.initialFocus == "string" ? w.querySelector(e.initialFocus) ?? w : typeof e.initialFocus == "function" ? e.initialFocus(w) ?? w : w.querySelector(
1439
1458
  'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
1440
- ) ?? w : null, { activate: L, deactivate: N } = qe(t, {
1459
+ ) ?? w : null, { activate: P, deactivate: H } = qe(t, {
1441
1460
  escapeDeactivates: !1,
1442
1461
  clickOutsideDeactivates: !1,
1443
1462
  fallbackFocus: () => t.value,
1444
- initialFocus: () => P(t.value),
1463
+ initialFocus: () => $(t.value),
1445
1464
  ...e.focusTrapOptions ?? {}
1446
1465
  });
1447
- let A = null, S = J(null);
1448
- const b = () => {
1466
+ let x = null, D = J(null);
1467
+ const k = () => {
1449
1468
  if (e.resolvePopupEl) return e.resolvePopupEl();
1450
- const w = (E, M) => {
1451
- const T = Array.from(E.querySelectorAll(M));
1452
- if (!T.length) return null;
1453
- const O = T.filter(
1454
- (f) => f.offsetParent !== null || f.getClientRects().length > 0
1469
+ const w = (A, E) => {
1470
+ const L = Array.from(A.querySelectorAll(E));
1471
+ if (!L.length) return null;
1472
+ const K = L.filter(
1473
+ (p) => p.offsetParent !== null || p.getClientRects().length > 0
1455
1474
  );
1456
- return O[O.length - 1] ?? T[T.length - 1] ?? null;
1475
+ return K[K.length - 1] ?? L[L.length - 1] ?? null;
1457
1476
  }, I = e.triggerEl?.value?.closest?.(".k-animation-container") ?? document.body;
1458
- for (const E of U) {
1459
- const M = w(I, E);
1460
- if (M) return M;
1477
+ for (const A of O) {
1478
+ const E = w(I, A);
1479
+ if (E) return E;
1461
1480
  }
1462
- for (const E of U) {
1463
- const M = w(document, E);
1464
- if (M) return M;
1481
+ for (const A of O) {
1482
+ const E = w(document, A);
1483
+ if (E) return E;
1465
1484
  }
1466
1485
  return null;
1467
1486
  };
1468
1487
  return He(t, (w) => {
1469
- S.value = "outside", e.isOpen.value && e.onRequestClose?.("outside", w);
1488
+ D.value = "outside", e.isOpen.value && e.onRequestClose?.("outside", w);
1470
1489
  }), ge(
1471
1490
  () => e.isOpen.value,
1472
1491
  (w) => {
1473
- w ? (S.value = null, W(() => {
1474
- const I = b();
1475
- I && (t.value = I, setTimeout(() => L(), 0), A || (A = (E) => {
1476
- E.key === "Escape" && (S.value = "escape", e.isOpen.value && e.onRequestClose?.("escape", E));
1477
- }, document.addEventListener("keydown", A, !0)));
1478
- })) : (N(), A && (document.removeEventListener("keydown", A, !0), A = null), t.value = null, S.value === "outside" && W(() => {
1492
+ w ? (D.value = null, j(() => {
1493
+ const I = k();
1494
+ I && (t.value = I, setTimeout(() => P(), 0), x || (x = (A) => {
1495
+ A.key === "Escape" && (D.value = "escape", e.isOpen.value && e.onRequestClose?.("escape", A));
1496
+ }, document.addEventListener("keydown", x, !0)));
1497
+ })) : (H(), x && (document.removeEventListener("keydown", x, !0), x = null), t.value = null, D.value === "outside" && j(() => {
1479
1498
  const I = () => {
1480
- const E = e.triggerEl?.value, M = E?.querySelector("input"), T = document.activeElement;
1481
- T && (T === M || E && E.contains(T)) && (M ?? E)?.blur?.();
1499
+ const A = e.triggerEl?.value, E = A?.querySelector("input"), L = document.activeElement;
1500
+ L && (L === E || A && A.contains(L)) && (E ?? A)?.blur?.();
1482
1501
  };
1483
1502
  requestAnimationFrame(() => setTimeout(I, 0));
1484
- }), e.returnFocusToTrigger !== !1 && S.value === "escape" && e.triggerEl?.value && (console.log(
1503
+ }), e.returnFocusToTrigger !== !1 && D.value === "escape" && e.triggerEl?.value && (console.log(
1485
1504
  "Returning focus to trigger element:",
1486
1505
  e.triggerEl.value
1487
- ), W(() => {
1506
+ ), j(() => {
1488
1507
  const I = () => {
1489
- const E = e.triggerEl?.value;
1490
- if (!E) return;
1491
- (E.querySelector("input") ?? E)?.focus?.();
1508
+ const A = e.triggerEl?.value;
1509
+ if (!A) return;
1510
+ (A.querySelector("input") ?? A)?.focus?.();
1492
1511
  };
1493
1512
  requestAnimationFrame(() => setTimeout(I, 0));
1494
1513
  })));
1495
1514
  }
1496
1515
  ), {
1497
1516
  popupRef: t,
1498
- activate: L,
1499
- deactivate: N,
1500
- lastCloseReason: Y(S),
1517
+ activate: P,
1518
+ deactivate: H,
1519
+ lastCloseReason: G(D),
1501
1520
  setPopupEl: (w) => t.value = w
1502
1521
  };
1503
1522
  }
1504
1523
  const Ye = (e) => !!e && typeof e == "object" && "filters" in e && Array.isArray(e.filters), We = (e) => !!e && typeof e == "object" && "field" in e, Pe = (e, t) => !e || typeof e != "object" ? !1 : Ye(e) ? e.filters.some(
1505
1524
  (s) => Pe(s, t)
1506
1525
  ) : We(e) ? e.field === t : !1, Ze = (e) => {
1507
- const t = J({}), s = (P) => !e.value || !e.value.filters ? !1 : e.value.filters.some(
1508
- (L) => Pe(L, P)
1526
+ const t = J({}), s = ($) => !e.value || !e.value.filters ? !1 : e.value.filters.some(
1527
+ (P) => Pe(P, $)
1509
1528
  );
1510
1529
  return {
1511
1530
  activeClasses: t,
1512
1531
  hasFieldFilter: s,
1513
- updateActiveClass: (P) => {
1514
- const L = s(P);
1515
- console.log("updateActiveClass for", P, "hasFilter:", L), t.value[P] = L ? "active" : "", console.log("activeClasses after update", t.value);
1532
+ updateActiveClass: ($) => {
1533
+ const P = s($);
1534
+ console.log("updateActiveClass for", $, "hasFilter:", P), t.value[$] = P ? "active" : "", console.log("activeClasses after update", t.value);
1516
1535
  }
1517
1536
  };
1518
1537
  };