@featherk/composables 0.6.16 → 0.6.18

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