@featherk/composables 0.8.2 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,39 +1,39 @@
1
- import { ref as Y, onBeforeUnmount as Te, nextTick as j, computed as g, watchEffect as Fe, toValue as ie, watch as ge, onMounted as xe, readonly as z, getCurrentScope as Le, onScopeDispose as Re, unref as qe, shallowRef as Ve } from "vue";
2
- import { useFocusTrap as Oe } from "@vueuse/integrations/useFocusTrap";
3
- const et = (e, t) => {
4
- const l = Y(null);
5
- let F = !1, C = null, I = null;
6
- const T = [], D = ".k-table-row[data-grid-row-index] [tabindex]", x = () => {
7
- const o = e?.value?.$el;
8
- return o ? o.closest(".k-grid") : null;
9
- }, E = (o) => {
10
- const v = x();
11
- if (!v) return !1;
12
- const u = o.closest(".k-grid-aria-root");
13
- if (u)
14
- return v.contains(u);
15
- const c = o.closest(
1
+ import { ref as N, onBeforeUnmount as Fe, nextTick as B, computed as m, watchEffect as Ve, toValue as ie, reactive as Re, watch as fe, onMounted as Me, readonly as _, getCurrentScope as Le, onScopeDispose as qe, unref as Oe, shallowRef as Ue } from "vue";
2
+ import { useFocusTrap as Ke } from "@vueuse/integrations/useFocusTrap";
3
+ const ut = (e, t) => {
4
+ const o = N(null);
5
+ let T = !1, I = null, C = null;
6
+ const w = [], A = ".k-table-row[data-grid-row-index] [tabindex]", E = () => {
7
+ const l = e?.value?.$el;
8
+ return l ? l.closest(".k-grid") : null;
9
+ }, M = (l) => {
10
+ const g = E();
11
+ if (!g) return !1;
12
+ const s = l.closest(".k-grid-aria-root");
13
+ if (s)
14
+ return g.contains(s);
15
+ const c = l.closest(
16
16
  ".k-grid-header, .k-grid-content, .k-grid-content-locked"
17
17
  );
18
- return c ? v.contains(c) : !1;
19
- }, A = (o) => o.key === "Enter" || o.code === "Enter" || o.code === "NumpadEnter", L = () => e?.value?.columns, b = (o) => {
20
- const v = o.key || o.code;
21
- ([" ", "Spacebar", "Space"].includes(v) || A(o)) && (o.preventDefault(), o.stopPropagation(), l.value = o.target, o.target.click());
22
- }, m = (o) => {
23
- if (!l.value) return;
24
- if (o.code === "Escape") {
25
- o.stopPropagation(), l.value && l.value.focus();
18
+ return c ? g.contains(c) : !1;
19
+ }, x = (l) => l.key === "Enter" || l.code === "Enter" || l.code === "NumpadEnter", F = () => e?.value?.columns, b = (l) => {
20
+ const g = l.key || l.code;
21
+ ([" ", "Spacebar", "Space"].includes(g) || x(l)) && (l.preventDefault(), l.stopPropagation(), o.value = l.target, l.target.click());
22
+ }, v = (l) => {
23
+ if (!o.value) return;
24
+ if (l.code === "Escape") {
25
+ l.stopPropagation(), o.value && o.value.focus();
26
26
  return;
27
27
  }
28
- const v = Array.from(
28
+ const g = Array.from(
29
29
  document.querySelectorAll(
30
30
  ".k-animation-container .k-popup .k-column-menu .k-columnmenu-item-wrapper .k-columnmenu-item"
31
31
  )
32
- ), u = document.querySelector(
32
+ ), s = document.querySelector(
33
33
  ".k-animation-container .k-popup .k-column-menu .k-filter-menu-container"
34
34
  );
35
- if (u) {
36
- if (o.code === "Tab") {
35
+ if (s) {
36
+ if (l.code === "Tab") {
37
37
  const c = [
38
38
  // ".k-filter-menu-container .k-dropdownlist[tabindex='0']",
39
39
  // ".k-filter-menu-container input.k-input-inner:not([tabindex='-1']):not([disabled])",
@@ -43,65 +43,65 @@ const et = (e, t) => {
43
43
  "input.k-input-inner:not([tabindex='-1']):not([disabled])",
44
44
  "button:not([tabindex='-1']):not([disabled])",
45
45
  ".k-checkbox"
46
- ], w = t?.focusableMenuSelectors ?? c, p = Array.from(
47
- u.querySelectorAll(w.join(","))
46
+ ], k = t?.focusableMenuSelectors ?? c, p = Array.from(
47
+ s.querySelectorAll(k.join(","))
48
48
  );
49
49
  if (p.length === 0) return;
50
- const k = p.findIndex(
51
- (W) => W === document.activeElement
50
+ const D = p.findIndex(
51
+ (Y) => Y === document.activeElement
52
52
  );
53
- let V;
54
- k === -1 ? V = 0 : o.shiftKey ? V = (k - 1 + p.length) % p.length : V = (k + 1) % p.length, o.preventDefault(), o.stopPropagation(), p[V]?.focus();
53
+ let q;
54
+ D === -1 ? q = 0 : l.shiftKey ? q = (D - 1 + p.length) % p.length : q = (D + 1) % p.length, l.preventDefault(), l.stopPropagation(), p[q]?.focus();
55
55
  }
56
- } else if (o.code === "ArrowUp" || o.code === "ArrowDown") {
57
- o.preventDefault(), o.stopPropagation();
58
- const c = v.findIndex(
56
+ } else if (l.code === "ArrowUp" || l.code === "ArrowDown") {
57
+ l.preventDefault(), l.stopPropagation();
58
+ const c = g.findIndex(
59
59
  (p) => p === document.activeElement
60
60
  );
61
- let w = c;
62
- o.code === "ArrowUp" ? w = c > 0 ? c - 1 : v.length - 1 : o.code === "ArrowDown" && (w = c < v.length - 1 ? c + 1 : 0), v[w]?.focus();
61
+ let k = c;
62
+ l.code === "ArrowUp" ? k = c > 0 ? c - 1 : g.length - 1 : l.code === "ArrowDown" && (k = c < g.length - 1 ? c + 1 : 0), g[k]?.focus();
63
63
  return;
64
64
  }
65
- if (o.code === "Tab") {
66
- o.preventDefault(), o.stopPropagation();
67
- const c = l.value?.parentElement;
68
- (o.shiftKey ? c?.previousElementSibling : c?.nextElementSibling)?.querySelector(
65
+ if (l.code === "Tab") {
66
+ l.preventDefault(), l.stopPropagation();
67
+ const c = o.value?.parentElement;
68
+ (l.shiftKey ? c?.previousElementSibling : c?.nextElementSibling)?.querySelector(
69
69
  "button, [role='button'], .k-link"
70
70
  )?.focus();
71
71
  }
72
- }, M = () => {
73
- C = new MutationObserver((o) => {
74
- o.forEach((v) => {
75
- v.addedNodes.forEach((u) => {
76
- if (u.nodeType === Node.ELEMENT_NODE) {
77
- const c = u;
72
+ }, $ = () => {
73
+ I = new MutationObserver((l) => {
74
+ l.forEach((g) => {
75
+ g.addedNodes.forEach((s) => {
76
+ if (s.nodeType === Node.ELEMENT_NODE) {
77
+ const c = s;
78
78
  if (c.classList.contains("k-animation-container")) {
79
- const p = l.value;
80
- p && (p.dataset.featherKSortable === "true" || j(() => {
79
+ const p = o.value;
80
+ p && (p.dataset.featherKSortable === "true" || B(() => {
81
81
  c.querySelectorAll(
82
82
  ".k-columnmenu-item-wrapper"
83
- ).forEach((W) => {
84
- W.textContent?.toLowerCase().includes("sort") && W.remove();
83
+ ).forEach((Y) => {
84
+ Y.textContent?.toLowerCase().includes("sort") && Y.remove();
85
85
  });
86
86
  })), c.addEventListener(
87
87
  "keydown",
88
- m
89
- ), j(() => {
90
- const k = () => {
91
- const V = Array.from(
88
+ v
89
+ ), B(() => {
90
+ const D = () => {
91
+ const q = Array.from(
92
92
  c.querySelectorAll(
93
93
  ".k-animation-container .k-popup .k-column-menu .k-columnmenu-item-wrapper .k-columnmenu-item"
94
94
  )
95
95
  );
96
- if (V.length === 1)
97
- V[0].focus(), V[0].click(), k.attempts = 0;
98
- else if (V.length > 1) {
99
- k.attempts = 0;
96
+ if (q.length === 1)
97
+ q[0].focus(), q[0].click(), D.attempts = 0;
98
+ else if (q.length > 1) {
99
+ D.attempts = 0;
100
100
  return;
101
101
  } else
102
- k.attempts === void 0 && (k.attempts = 0), k.attempts++ < 3 && setTimeout(k, 200);
102
+ D.attempts === void 0 && (D.attempts = 0), D.attempts++ < 3 && setTimeout(D, 200);
103
103
  };
104
- k();
104
+ D();
105
105
  });
106
106
  }
107
107
  c.querySelectorAll(
@@ -109,63 +109,63 @@ const et = (e, t) => {
109
109
  ).forEach((p) => {
110
110
  p.addEventListener(
111
111
  "keydown",
112
- m
112
+ v
113
113
  );
114
114
  });
115
115
  }
116
- }), v.removedNodes.forEach((u) => {
117
- if (u.nodeType === Node.ELEMENT_NODE) {
118
- const c = u;
116
+ }), g.removedNodes.forEach((s) => {
117
+ if (s.nodeType === Node.ELEMENT_NODE) {
118
+ const c = s;
119
119
  c.classList.contains("k-animation-container") && c.removeEventListener(
120
120
  "keydown",
121
- m
121
+ v
122
122
  ), c.querySelectorAll(
123
123
  ".k-animation-container"
124
124
  ).forEach((p) => {
125
125
  p.removeEventListener(
126
126
  "keydown",
127
- m
127
+ v
128
128
  );
129
129
  });
130
130
  }
131
131
  });
132
132
  });
133
- }), C.observe(document.body, {
133
+ }), I.observe(document.body, {
134
134
  childList: !0,
135
135
  subtree: !0
136
136
  });
137
- }, R = (o) => {
138
- const v = o.tagName.toLowerCase();
139
- return !!(["input", "textarea", "select", "button"].includes(v) || o.closest(
137
+ }, R = (l) => {
138
+ const g = l.tagName.toLowerCase();
139
+ return !!(["input", "textarea", "select", "button"].includes(g) || l.closest(
140
140
  '.k-picker-wrap, .k-input-inner, .k-textbox, [role="combobox"]'
141
141
  ));
142
- }, d = (o) => {
143
- if (!o.type || !o)
142
+ }, d = (l) => {
143
+ if (!l.type || !l)
144
144
  return;
145
- const v = o.target;
146
- if (!v) return;
147
- const u = v.closest(
145
+ const g = l.target;
146
+ if (!g) return;
147
+ const s = g.closest(
148
148
  ".k-table-row[data-grid-row-index]"
149
149
  );
150
- if (!E(v))
150
+ if (!M(g))
151
151
  return;
152
152
  const c = ["ArrowLeft", "ArrowRight"].includes(
153
- o.code
153
+ l.code
154
154
  );
155
- if (!(R(v) && !(u && c))) {
156
- if (o.code === "Escape") {
157
- const w = document.activeElement?.closest(".k-table-row[data-grid-row-index]");
158
- if (w) {
159
- o.preventDefault(), o.stopPropagation();
155
+ if (!(R(g) && !(s && c))) {
156
+ if (l.code === "Escape") {
157
+ const k = document.activeElement?.closest(".k-table-row[data-grid-row-index]");
158
+ if (k) {
159
+ l.preventDefault(), l.stopPropagation();
160
160
  try {
161
161
  Array.from(
162
162
  e?.value.$el.querySelectorAll(
163
163
  ".k-table-row[data-grid-row-index]"
164
164
  )
165
- ).forEach((k) => k.setAttribute("tabindex", "-1"));
165
+ ).forEach((D) => D.setAttribute("tabindex", "-1"));
166
166
  } catch {
167
167
  }
168
- w.setAttribute("tabindex", "0"), w.focus();
168
+ k.setAttribute("tabindex", "0"), k.focus();
169
169
  return;
170
170
  }
171
171
  }
@@ -177,58 +177,60 @@ const et = (e, t) => {
177
177
  "Enter",
178
178
  "NumpadEnter",
179
179
  "Space"
180
- ].includes(o.code)) {
181
- if (v.classList.contains("k-grid-header-menu") && v.classList.contains("k-grid-column-menu")) {
182
- l.value = v;
180
+ ].includes(l.code)) {
181
+ if (g.classList.contains("k-grid-header-menu") && g.classList.contains("k-grid-column-menu")) {
182
+ o.value = g;
183
183
  return;
184
184
  }
185
- if (u) {
186
- if (["ArrowDown", "ArrowUp"].includes(o.code)) {
187
- o.preventDefault(), o.stopPropagation();
188
- const w = (k, V) => {
189
- let W = V === "next" ? k.nextElementSibling : k.previousElementSibling;
190
- for (; W; ) {
191
- const a = W;
185
+ if (s) {
186
+ if (["ArrowDown", "ArrowUp"].includes(l.code)) {
187
+ l.preventDefault(), l.stopPropagation();
188
+ const k = (D, q) => {
189
+ let Y = q === "next" ? D.nextElementSibling : D.previousElementSibling;
190
+ for (; Y; ) {
191
+ const r = Y;
192
192
  try {
193
- if (a.classList.contains("k-table-row"))
194
- return a;
193
+ if (r.classList.contains("k-table-row"))
194
+ return r;
195
195
  } catch {
196
196
  }
197
- W = V === "next" ? W.nextElementSibling : W.previousElementSibling;
197
+ Y = q === "next" ? Y.nextElementSibling : Y.previousElementSibling;
198
198
  }
199
199
  return null;
200
- }, p = o.code === "ArrowDown" ? w(u, "next") : w(u, "previous");
201
- p && (u.setAttribute("tabindex", "-1"), p.setAttribute("tabindex", "0"), p.focus());
200
+ }, p = l.code === "ArrowDown" ? k(s, "next") : k(s, "previous");
201
+ p && (s.setAttribute("tabindex", "-1"), p.setAttribute("tabindex", "0"), p.focus());
202
202
  return;
203
203
  }
204
- if (["ArrowLeft", "ArrowRight"].includes(o.code)) {
205
- o.preventDefault(), o.stopPropagation();
206
- const w = u.querySelectorAll(
207
- D
204
+ if (["ArrowLeft", "ArrowRight"].includes(l.code)) {
205
+ l.preventDefault(), l.stopPropagation();
206
+ const k = s.querySelectorAll(
207
+ A
208
208
  );
209
- if (w.length === 0) return;
210
- let p = Array.from(w).findIndex(
211
- (k) => k === document.activeElement
209
+ if (k.length === 0) return;
210
+ let p = Array.from(k).findIndex(
211
+ (D) => D === document.activeElement
212
212
  );
213
- if (p === -1 && document.activeElement === u) {
214
- w[0].focus();
213
+ if (p === -1 && document.activeElement === s) {
214
+ k[0].focus();
215
215
  return;
216
216
  }
217
- o.code === "ArrowRight" ? p = p === w.length - 1 ? 0 : p + 1 : o.code === "ArrowLeft" && (p = p === 0 ? w.length - 1 : p - 1), w[p].focus();
217
+ l.code === "ArrowRight" ? p = p === k.length - 1 ? 0 : p + 1 : l.code === "ArrowLeft" && (p = p === 0 ? k.length - 1 : p - 1), k[p].focus();
218
218
  return;
219
219
  }
220
220
  }
221
221
  }
222
222
  }
223
- }, S = () => {
224
- j(() => {
225
- const o = e.value.$el.closest(".k-grid");
226
- o && o.classList.add("fk-grid");
223
+ }, y = () => {
224
+ B(() => {
225
+ const l = e.value?.$el;
226
+ if (!l || typeof l.closest != "function") return;
227
+ const g = l.closest(".k-grid");
228
+ g && g.classList.add("fk-grid");
227
229
  });
228
- }, q = () => {
229
- if (!I)
230
+ }, L = () => {
231
+ if (!C)
230
232
  try {
231
- const o = () => {
233
+ const l = () => {
232
234
  try {
233
235
  const c = Array.from(
234
236
  e.value.$el.querySelectorAll(
@@ -236,12 +238,12 @@ const et = (e, t) => {
236
238
  )
237
239
  );
238
240
  if (!c || c.length === 0 || c.filter(
239
- (k) => k.getAttribute("tabindex") === "0"
241
+ (D) => D.getAttribute("tabindex") === "0"
240
242
  ).length === 1) return;
241
243
  const p = c.find(
242
- (k) => k === document.activeElement || k.contains(document.activeElement)
244
+ (D) => D === document.activeElement || D.contains(document.activeElement)
243
245
  );
244
- if (c.forEach((k) => k.setAttribute("tabindex", "-1")), p) {
246
+ if (c.forEach((D) => D.setAttribute("tabindex", "-1")), p) {
245
247
  p.setAttribute("tabindex", "0");
246
248
  return;
247
249
  }
@@ -249,404 +251,607 @@ const et = (e, t) => {
249
251
  } catch (c) {
250
252
  console.error("ensureSingleTabindex error:", c);
251
253
  }
252
- }, v = Array.from(
254
+ }, g = Array.from(
253
255
  e.value.$el.querySelectorAll(
254
256
  ".k-table-row[data-grid-row-index]"
255
257
  )
256
258
  );
257
- v.length > 0 && v.forEach((c, w) => {
258
- c.setAttribute("tabindex", w === 0 ? "0" : "-1");
259
+ g.length > 0 && g.forEach((c, k) => {
260
+ c.setAttribute("tabindex", k === 0 ? "0" : "-1");
259
261
  });
260
- const u = e.value.$el.querySelector(".k-table-tbody");
261
- u && (I = new MutationObserver(() => {
262
- o();
263
- }), I.observe(u, { childList: !0, subtree: !0 }));
264
- } catch (o) {
265
- console.error("Error setting up row navigation:", o);
262
+ const s = e.value.$el.querySelector(".k-table-tbody");
263
+ s && (C = new MutationObserver(() => {
264
+ l();
265
+ }), C.observe(s, { childList: !0, subtree: !0 }));
266
+ } catch (l) {
267
+ console.error("Error setting up row navigation:", l);
266
268
  }
267
- }, _ = () => {
268
- j(() => {
269
- const v = document.querySelectorAll(".k-grid-header .k-grid-header-menu.k-grid-column-menu");
270
- v && v.forEach((u) => {
271
- u.setAttribute("role", "button"), u.addEventListener(
269
+ }, W = () => {
270
+ B(() => {
271
+ const g = document.querySelectorAll(".k-grid-header .k-grid-header-menu.k-grid-column-menu");
272
+ g && g.forEach((s) => {
273
+ s.setAttribute("role", "button"), s.addEventListener(
272
274
  "keydown",
273
275
  b
274
276
  );
275
- }), M(), ee();
277
+ }), $(), Q();
276
278
  });
277
- }, Z = () => {
278
- const v = document.querySelectorAll(".k-grid-header .k-grid-header-menu.k-grid-column-menu");
279
- v && v.forEach((u) => {
280
- u.removeEventListener(
279
+ }, G = () => {
280
+ const g = document.querySelectorAll(".k-grid-header .k-grid-header-menu.k-grid-column-menu");
281
+ g && g.forEach((s) => {
282
+ s.removeEventListener(
281
283
  "keydown",
282
284
  b
283
285
  );
284
- }), C && (C.disconnect(), C = null), I && (I.disconnect(), I = null), T.forEach((u) => u()), T.length = 0;
285
- }, ee = () => {
286
+ }), I && (I.disconnect(), I = null), C && (C.disconnect(), C = null), w.forEach((s) => s()), w.length = 0;
287
+ }, Q = () => {
286
288
  document.querySelectorAll(
287
289
  ".k-grid-header .k-table-thead th"
288
- ).forEach((u, c) => {
289
- if (u.dataset.featherKHeaderBound === "true")
290
+ ).forEach((s, c) => {
291
+ if (s.dataset.featherKHeaderBound === "true")
290
292
  return;
291
- const w = u.querySelector(
293
+ const k = s.querySelector(
292
294
  ".k-grid-header-menu.k-grid-column-menu"
293
295
  );
294
- if (!w) return;
295
- const p = L();
296
+ if (!k) return;
297
+ const p = F();
296
298
  if (p && p[c]) {
297
- const y = p[c].field ?? "";
298
- u.setAttribute("data-feather-k-field", y), u.setAttribute(
299
+ const h = p[c].field ?? "";
300
+ s.setAttribute("data-feather-k-field", h), s.setAttribute(
299
301
  "data-feather-k-filterable",
300
302
  p[c].filterable === !1 ? "false" : "true"
301
- ), u.setAttribute(
303
+ ), s.setAttribute(
302
304
  "data-feather-k-sortable",
303
305
  p[c].sortable === !1 ? "false" : "true"
304
306
  );
305
307
  }
306
- const k = u.dataset.featherKFilterable !== "false", V = u.dataset.featherKSortable !== "false";
307
- w.setAttribute("tabindex", "-1"), k || V ? u.style.cursor = "pointer" : u.style.cursor = "default", k ? (u.setAttribute("tabindex", "0"), u.setAttribute("role", "button"), u.setAttribute("aria-haspopup", "menu")) : (u.setAttribute("tabindex", "0"), u.setAttribute("role", "columnheader"), u.removeAttribute("aria-haspopup"));
308
- const W = (y) => {
309
- y.target?.closest(".k-column-resizer") || (l.value = u, w.click());
310
- }, a = (y) => {
311
- if (k)
312
- l.value = u, y.preventDefault(), y.stopPropagation(), W(y);
313
- else if (V) {
314
- l.value = u;
315
- const U = u.querySelector(".k-link");
308
+ const D = s.dataset.featherKFilterable !== "false", q = s.dataset.featherKSortable !== "false";
309
+ k.setAttribute("tabindex", "-1"), D || q ? s.style.cursor = "pointer" : s.style.cursor = "default", D ? (s.setAttribute("tabindex", "0"), s.setAttribute("role", "button"), s.setAttribute("aria-haspopup", "menu")) : (s.setAttribute("tabindex", "0"), s.setAttribute("role", "columnheader"), s.removeAttribute("aria-haspopup"));
310
+ const Y = (h) => {
311
+ h.target?.closest(".k-column-resizer") || (o.value = s, k.click());
312
+ }, r = (h) => {
313
+ if (D)
314
+ o.value = s, h.preventDefault(), h.stopPropagation(), Y(h);
315
+ else if (q) {
316
+ o.value = s;
317
+ const U = s.querySelector(".k-link");
316
318
  U && U.click();
317
319
  }
318
320
  };
319
- u.addEventListener("click", a), T.push(() => {
320
- u.removeEventListener("click", a);
321
+ s.addEventListener("click", r), w.push(() => {
322
+ s.removeEventListener("click", r);
321
323
  });
322
- const f = (y) => {
323
- if ((A(y) || y.code === "Space") && (k || V)) {
324
- if (y.preventDefault(), y.stopPropagation(), l.value = u, l.value.focus(), k)
325
- W(y);
326
- else if (V) {
327
- const U = u.querySelector(".k-link");
324
+ const f = (h) => {
325
+ if ((x(h) || h.code === "Space") && (D || q)) {
326
+ if (h.preventDefault(), h.stopPropagation(), o.value = s, o.value.focus(), D)
327
+ Y(h);
328
+ else if (q) {
329
+ const U = s.querySelector(".k-link");
328
330
  U && U.click();
329
331
  }
330
332
  }
331
333
  };
332
- u.addEventListener("keydown", f, !0), T.push(() => {
333
- u.removeEventListener("keydown", f, !0);
334
- }), u.dataset.featherKHeaderBound = "true";
334
+ s.addEventListener("keydown", f, !0), w.push(() => {
335
+ s.removeEventListener("keydown", f, !0);
336
+ }), s.dataset.featherKHeaderBound = "true";
335
337
  });
336
- const v = document.querySelector(".k-grid-header .k-table-thead");
337
- if (v && v.dataset.featherKHeaderBound !== "true") {
338
- const u = (c) => {
339
- const w = c.target.closest("th");
340
- w && (A(c) || c.code === "Space") && w.dataset.featherKFilterable === "false" && w.dataset.featherKSortable === "false" && (c.preventDefault(), c.stopImmediatePropagation());
338
+ const g = document.querySelector(".k-grid-header .k-table-thead");
339
+ if (g && g.dataset.featherKHeaderBound !== "true") {
340
+ const s = (c) => {
341
+ const k = c.target.closest("th");
342
+ k && (x(c) || c.code === "Space") && k.dataset.featherKFilterable === "false" && k.dataset.featherKSortable === "false" && (c.preventDefault(), c.stopImmediatePropagation());
341
343
  };
342
- v.addEventListener(
344
+ g.addEventListener(
343
345
  "keydown",
344
- u,
346
+ s,
345
347
  !0
346
348
  // NOTE: capture phase
347
- ), T.push(() => {
348
- v.removeEventListener(
349
+ ), w.push(() => {
350
+ g.removeEventListener(
349
351
  "keydown",
350
- u,
352
+ s,
351
353
  !0
352
354
  );
353
- }), v.dataset.featherKHeaderBound = "true";
355
+ }), g.dataset.featherKHeaderBound = "true";
354
356
  }
355
- }, te = function(o, v) {
356
- const u = o?.event?.event.target, c = L();
357
- if (!u || !c) return;
358
- const w = u.classList.contains("k-grid-header-menu"), p = u.classList.contains("k-columnmenu-item"), k = c.find((V) => V.field === o?.event?.field)?.sortable && !0;
359
- if (!w) {
360
- if (p && !k) {
361
- o?.event?.sort?.filter(
362
- (W) => W.field !== o?.event?.field
357
+ }, ee = function(l, g) {
358
+ const s = l?.event?.event.target, c = F();
359
+ if (!s || !c) return;
360
+ const k = s.classList.contains("k-grid-header-menu"), p = s.classList.contains("k-columnmenu-item"), D = c.find((q) => q.field === l?.event?.field)?.sortable && !0;
361
+ if (!k) {
362
+ if (p && !D) {
363
+ l?.event?.sort?.filter(
364
+ (Y) => Y.field !== l?.event?.field
363
365
  );
364
366
  return;
365
367
  }
366
- typeof v == "function" && j(() => {
367
- l.value && l.value.focus(), v(o), j(() => {
368
- ee();
368
+ typeof g == "function" && B(() => {
369
+ o.value && o.value.focus(), g(l), B(() => {
370
+ Q();
369
371
  });
370
372
  });
371
373
  }
372
374
  }, le = () => {
373
- if (!F)
375
+ if (!T)
374
376
  try {
375
- S(), q(), _(), F = !0;
376
- } catch (o) {
377
- console.error("initA11y failed:", o), Z();
377
+ y(), L(), W(), T = !0;
378
+ } catch (l) {
379
+ console.error("initA11y failed:", l), G();
378
380
  }
379
381
  };
380
- return Te(() => {
381
- Z();
382
+ return Fe(() => {
383
+ G();
382
384
  }), {
383
- activeFilterButton: l,
385
+ activeFilterButton: o,
384
386
  handleGridKeyDown: d,
385
- handleSortChange: te,
387
+ handleSortChange: ee,
386
388
  initA11y: le
387
389
  };
388
- }, Ue = (e) => !!e && typeof e == "object" && "filters" in e && Array.isArray(e.filters), Be = (e) => !!e && typeof e == "object" && "field" in e, Ce = (e, t) => !e || typeof e != "object" ? !1 : Ue(e) ? e.filters.some(
389
- (l) => Ce(l, t)
390
- ) : Be(e) ? e.field === t : !1, tt = (e) => (t) => e.value?.filters && e.value.filters.some(
391
- (l) => Ce(l, t)
392
- ) ? "active" : "", Ke = "Enter a valid ZIP code with exactly 5 or 9 digits.", Me = (e) => {
390
+ }, Ne = (e) => !!e && typeof e == "object" && "filters" in e && Array.isArray(e.filters), Be = (e) => !!e && typeof e == "object" && "field" in e, $e = (e, t) => !e || typeof e != "object" ? !1 : Ne(e) ? e.filters.some(
391
+ (o) => $e(o, t)
392
+ ) : Be(e) ? e.field === t : !1, ct = (e) => (t) => e.value?.filters && e.value.filters.some(
393
+ (o) => $e(o, t)
394
+ ) ? "active" : "", ze = "Enter a valid ZIP code with exactly 5 or 9 digits.", Ie = (e) => {
393
395
  const t = e.replace(/\D/g, "").slice(0, 9);
394
396
  return t.length > 5 ? `${t.slice(0, 5)}-${t.slice(5)}` : t;
395
- }, Ne = (e, t) => e.slice(0, Math.max(0, t)).replace(/\D/g, "").length, He = (e) => e <= 5 ? e : Math.min(e + 1, 10), nt = (e) => {
396
- const t = Y(Me(e.initialValue ?? "")), l = Y(!1), F = Y(
397
- e.errorMessage?.trim() || Ke
398
- ), C = g(() => t.value.replace(/\D/g, "")), I = g(() => {
399
- const m = C.value.length;
400
- return m === 5 || m === 9;
401
- }), T = g(() => l.value && !I.value), D = g(() => !l.value || I.value), x = g(() => l.value), E = (m, M) => {
402
- const R = He(M);
403
- j(() => {
404
- m.isConnected && m.setSelectionRange(R, R);
397
+ }, He = (e, t) => e.slice(0, Math.max(0, t)).replace(/\D/g, "").length, Ze = (e) => e <= 5 ? e : Math.min(e + 1, 10), We = (e) => {
398
+ const t = N(Ie(e.initialValue ?? "")), o = N(!1), T = N(
399
+ e.errorMessage?.trim() || ze
400
+ ), I = m(() => t.value.replace(/\D/g, "")), C = m(() => {
401
+ const v = I.value.length;
402
+ return v === 5 || v === 9;
403
+ }), w = m(() => o.value && !C.value), A = m(() => !o.value || C.value), E = m(() => o.value), M = (v, $) => {
404
+ const R = Ze($);
405
+ B(() => {
406
+ v.isConnected && v.setSelectionRange(R, R);
405
407
  });
406
408
  };
407
409
  return {
408
410
  // writable state
409
411
  zipDisplay: t,
410
- submitted: l,
411
- errorMessage: F,
412
+ submitted: o,
413
+ errorMessage: T,
412
414
  // bindings
413
415
  wrapperClass: "fk-zip-textbox",
414
416
  // derived state
415
- zipRaw: C,
416
- isZipValid: I,
417
- showZipError: T,
418
- textBoxValid: D,
419
- textBoxValidate: x,
417
+ zipRaw: I,
418
+ isZipValid: C,
419
+ showZipError: w,
420
+ textBoxValid: A,
421
+ textBoxValidate: E,
420
422
  // actions
421
- handleZipInput: (...m) => {
422
- const M = m[0], d = M?.event?.target, S = M?.value, q = Array.isArray(S) ? S.join("") : String(S ?? ""), _ = d?.selectionStart !== void 0 && d.selectionStart !== null ? Ne(
423
+ handleZipInput: (...v) => {
424
+ const $ = v[0], d = $?.event?.target, y = $?.value, L = Array.isArray(y) ? y.join("") : String(y ?? ""), W = d?.selectionStart !== void 0 && d.selectionStart !== null ? He(
423
425
  d.value,
424
426
  d.selectionStart
425
- ) : q.replace(/\D/g, "").length;
426
- t.value = Me(q), d && E(d, _);
427
+ ) : L.replace(/\D/g, "").length;
428
+ t.value = Ie(L), d && M(d, W);
427
429
  },
428
- submitAndValidate: (m) => {
429
- l.value = !0;
430
- const M = I.value;
431
- return !M && m?.focus && j(() => {
430
+ submitAndValidate: (v) => {
431
+ o.value = !0;
432
+ const $ = C.value;
433
+ return !$ && v?.focus && B(() => {
432
434
  document.getElementById(
433
435
  e.id
434
436
  )?.focus();
435
- }), M;
437
+ }), $;
436
438
  },
437
- buildPayload: () => ({ zip: C.value })
439
+ buildPayload: () => ({ zip: I.value })
438
440
  };
439
441
  };
440
442
  function Ye(e, t) {
441
- const l = Y(!1);
442
- Fe(() => {
443
+ const o = N(!1);
444
+ Ve(() => {
443
445
  e.value?.setAttribute("aria-invalid", String(!t.isValid()));
444
446
  });
445
- function F(I) {
446
- const T = e.value ?? I.currentTarget, D = I.relatedTarget;
447
- (!T || !T.contains(D)) && (l.value = !0);
447
+ function T(C) {
448
+ const w = e.value ?? C.currentTarget, A = C.relatedTarget;
449
+ (!w || !w.contains(A)) && (o.value = !0);
448
450
  }
449
- function C() {
450
- l.value = !1;
451
+ function I() {
452
+ o.value = !1;
451
453
  }
452
- return { touched: l, onFocusout: F, reset: C };
454
+ return { touched: o, onFocusout: T, reset: I };
453
455
  }
454
- function rt(e, t) {
455
- const l = Y(!1), F = Y(!1), C = g(
456
- () => ie(t.submitted) || l.value
457
- ), I = g(() => !C.value || t.isValid()), T = Ye(e, {
458
- isValid: () => I.value
456
+ function je(e, t) {
457
+ const o = N(!1), T = N(!1), I = m(
458
+ () => ie(t.submitted) || o.value
459
+ ), C = m(() => !I.value || t.isValid()), w = Ye(e, {
460
+ isValid: () => C.value
459
461
  });
460
- function D(b) {
461
- return g(() => !C.value || ie(b));
462
+ function A(b) {
463
+ return m(() => !I.value || ie(b));
462
464
  }
463
- function x(b) {
465
+ function E(b) {
464
466
  return Object.fromEntries(
465
- Object.entries(b).map(([m, M]) => [
466
- m,
467
- D(M)
467
+ Object.entries(b).map(([v, $]) => [
468
+ v,
469
+ A($)
468
470
  ])
469
471
  );
470
472
  }
471
- function E(b) {
472
- const m = ie(b);
473
- if (!m) return;
474
- m.querySelector(
473
+ function M(b) {
474
+ const v = ie(b);
475
+ if (!v) return;
476
+ v.querySelector(
475
477
  '.k-invalid input, .k-invalid[tabindex="0"]'
476
478
  )?.focus();
477
479
  }
478
- function A(b) {
479
- if (F.value) {
480
- F.value = !1;
480
+ function x(b) {
481
+ if (T.value) {
482
+ T.value = !1;
481
483
  return;
482
484
  }
483
- T.onFocusout(b), T.touched.value && (l.value = !0);
485
+ w.onFocusout(b), w.touched.value && (o.value = !0);
484
486
  }
485
- function L() {
486
- l.value = !1, F.value = !0, T.reset();
487
+ function F() {
488
+ o.value = !1, T.value = !0, w.reset();
487
489
  }
488
490
  return {
489
- touched: l,
490
- fieldsetValidate: C,
491
- onFocusout: A,
492
- reset: L,
493
- createFieldValidity: D,
494
- createFieldValidationsMap: x,
495
- focusFirstInvalidField: E
491
+ touched: o,
492
+ fieldsetValidate: I,
493
+ onFocusout: x,
494
+ reset: F,
495
+ createFieldValidity: A,
496
+ createFieldValidationsMap: E,
497
+ focusFirstInvalidField: M
496
498
  };
497
499
  }
498
- function at(e) {
499
- const t = Y(""), l = Y(void 0), F = Y(!!e.debug), C = Y(e.dateFormat ?? "mm/dd/yyyy"), I = g(() => !!e.required), T = Y(!1), D = ["ArrowUp", "ArrowDown"], x = ["ArrowLeft", "ArrowRight"], E = g(() => (t.value ?? "").replace(/\D/g, "")), A = (a) => a <= 2 ? "mm" : a <= 5 ? "dd" : E.value.length <= 10 ? "yyyy" : "mm", L = g(() => {
500
- const a = t.value && t.value.substring(0, 2).replace(/\D/g, "0") || "0";
501
- return parseInt(a).toString().padStart(2, "0");
502
- }), b = g(() => {
503
- const a = t.value && t.value.substring(3, 5).replace(/\D/g, "0") || "0";
504
- return parseInt(a).toString().padStart(2, "0");
505
- }), m = g(() => {
506
- const a = t.value && t.value.substring(6, 10).replace(/\D/g, "0") || "0";
507
- return parseInt(a).toString().padStart(4, "0");
508
- }), M = (a) => {
509
- if (E.value.length === 0) {
510
- e.onChange({ value: null, event: a });
500
+ const Ge = [
501
+ { label: "Alabama", value: "AL" },
502
+ { label: "Alaska", value: "AK" },
503
+ { label: "Arizona", value: "AZ" },
504
+ { label: "Arkansas", value: "AR" },
505
+ { label: "California", value: "CA" },
506
+ { label: "Colorado", value: "CO" },
507
+ { label: "Connecticut", value: "CT" },
508
+ { label: "Delaware", value: "DE" },
509
+ { label: "Florida", value: "FL" },
510
+ { label: "Georgia", value: "GA" },
511
+ { label: "Hawaii", value: "HI" },
512
+ { label: "Idaho", value: "ID" },
513
+ { label: "Illinois", value: "IL" },
514
+ { label: "Indiana", value: "IN" },
515
+ { label: "Iowa", value: "IA" },
516
+ { label: "Kansas", value: "KS" },
517
+ { label: "Kentucky", value: "KY" },
518
+ { label: "Louisiana", value: "LA" },
519
+ { label: "Maine", value: "ME" },
520
+ { label: "Maryland", value: "MD" },
521
+ { label: "Massachusetts", value: "MA" },
522
+ { label: "Michigan", value: "MI" },
523
+ { label: "Minnesota", value: "MN" },
524
+ { label: "Mississippi", value: "MS" },
525
+ { label: "Missouri", value: "MO" },
526
+ { label: "Montana", value: "MT" },
527
+ { label: "Nebraska", value: "NE" },
528
+ { label: "Nevada", value: "NV" },
529
+ { label: "New Hampshire", value: "NH" },
530
+ { label: "New Jersey", value: "NJ" },
531
+ { label: "New Mexico", value: "NM" },
532
+ { label: "New York", value: "NY" },
533
+ { label: "North Carolina", value: "NC" },
534
+ { label: "North Dakota", value: "ND" },
535
+ { label: "Ohio", value: "OH" },
536
+ { label: "Oklahoma", value: "OK" },
537
+ { label: "Oregon", value: "OR" },
538
+ { label: "Pennsylvania", value: "PA" },
539
+ { label: "Rhode Island", value: "RI" },
540
+ { label: "South Carolina", value: "SC" },
541
+ { label: "South Dakota", value: "SD" },
542
+ { label: "Tennessee", value: "TN" },
543
+ { label: "Texas", value: "TX" },
544
+ { label: "Utah", value: "UT" },
545
+ { label: "Vermont", value: "VT" },
546
+ { label: "Virginia", value: "VA" },
547
+ { label: "Washington", value: "WA" },
548
+ { label: "West Virginia", value: "WV" },
549
+ { label: "Wisconsin", value: "WI" },
550
+ { label: "Wyoming", value: "WY" }
551
+ ];
552
+ function De(e) {
553
+ if (e && typeof e == "object" && "value" in e) {
554
+ const t = e.value;
555
+ return typeof t == "string" ? t : String(t ?? "");
556
+ }
557
+ return "";
558
+ }
559
+ function _e() {
560
+ const e = Re({
561
+ address1: "",
562
+ address2: "",
563
+ city: "",
564
+ state: null,
565
+ zip: ""
566
+ });
567
+ return {
568
+ formData: e,
569
+ onAddress1Input: (...w) => {
570
+ e.address1 = De(w[0]);
571
+ },
572
+ onAddress2Input: (...w) => {
573
+ e.address2 = De(w[0]);
574
+ },
575
+ onCityInput: (...w) => {
576
+ e.city = De(w[0]);
577
+ },
578
+ onStateChange: (w) => {
579
+ w.value === null && e.state !== null || (e.state = w.value);
580
+ },
581
+ resetFormData: () => {
582
+ e.address1 = "", e.address2 = "", e.city = "", e.state = null, e.zip = "";
583
+ }
584
+ };
585
+ }
586
+ function Je(e) {
587
+ const t = We({ id: "zip" }), {
588
+ zipDisplay: o,
589
+ zipRaw: T,
590
+ isZipValid: I,
591
+ wrapperClass: C,
592
+ handleZipInput: w
593
+ } = t;
594
+ return fe(T, (E) => {
595
+ e.zip = E;
596
+ }), {
597
+ zipDisplay: o,
598
+ isZipValid: I,
599
+ zipWrapperClass: C,
600
+ onZipInput: w,
601
+ resetZip: () => {
602
+ o.value = "", e.zip = "";
603
+ }
604
+ };
605
+ }
606
+ function Xe(e) {
607
+ const t = m(
608
+ () => e.formData.address1.trim() !== ""
609
+ ), o = m(() => e.formData.city.trim() !== ""), T = m(() => !!e.formData.state), I = m(() => ie(e.isZipValid)), C = m(
610
+ () => t.value && o.value && T.value && I.value
611
+ );
612
+ return {
613
+ strictAddress1Valid: t,
614
+ strictCityValid: o,
615
+ strictStateValid: T,
616
+ strictZipValid: I,
617
+ strictAddressValid: C
618
+ };
619
+ }
620
+ function Qe(e) {
621
+ if (!e) return;
622
+ e.querySelector(
623
+ '.k-invalid input, .k-invalid[tabindex="0"]'
624
+ )?.focus();
625
+ }
626
+ function dt(e) {
627
+ const t = N(!1), {
628
+ formData: o,
629
+ onAddress1Input: T,
630
+ onAddress2Input: I,
631
+ onCityInput: C,
632
+ onStateChange: w,
633
+ resetFormData: A
634
+ } = _e(), { zipDisplay: E, isZipValid: M, zipWrapperClass: x, onZipInput: F, resetZip: b } = Je(o), {
635
+ strictAddress1Valid: v,
636
+ strictCityValid: $,
637
+ strictStateValid: R,
638
+ strictZipValid: d,
639
+ strictAddressValid: y
640
+ } = Xe({
641
+ formData: o,
642
+ isZipValid: M
643
+ }), L = je(e.fieldsetRef, {
644
+ submitted: t,
645
+ isValid: () => y.value
646
+ }), {
647
+ touched: W,
648
+ fieldsetValidate: G,
649
+ onFocusout: Q,
650
+ reset: ee
651
+ } = L, le = L.createFieldValidationsMap({
652
+ address1: v,
653
+ city: $,
654
+ state: R,
655
+ zip: d,
656
+ address: y
657
+ }), {
658
+ address1: l,
659
+ city: g,
660
+ state: s,
661
+ zip: c,
662
+ address: k
663
+ } = le, p = { value: null, label: "Select state" }, D = Ge.map(({ label: f, value: h }) => ({
664
+ label: f,
665
+ value: h
666
+ })), q = m(() => ({
667
+ address1: o.address1.trim(),
668
+ address2: o.address2.trim(),
669
+ city: o.city.trim(),
670
+ state: (o.state ?? "").trim().toUpperCase(),
671
+ zip: o.zip.replace(/\D/g, "")
672
+ }));
673
+ return {
674
+ formData: o,
675
+ submitted: t,
676
+ touched: W,
677
+ addressValidate: G,
678
+ address1Valid: l,
679
+ cityValid: g,
680
+ stateValid: s,
681
+ zipValid: c,
682
+ addressValid: k,
683
+ stateDefaultItem: p,
684
+ stateOptions: D,
685
+ zipDisplay: E,
686
+ zipWrapperClass: x,
687
+ onAddress1Input: T,
688
+ onAddress2Input: I,
689
+ onCityInput: C,
690
+ onStateChange: w,
691
+ onZipInput: F,
692
+ onFieldsetFocusout: Q,
693
+ normalizedPayload: q,
694
+ submit: async () => (t.value = !0, y.value ? {
695
+ isValid: !0,
696
+ payload: q.value
697
+ } : (await B(), Qe(e.formRef.value), { isValid: !1, payload: null })),
698
+ reset: () => {
699
+ t.value = !1, ee(), A(), b();
700
+ }
701
+ };
702
+ }
703
+ function ft(e) {
704
+ const t = N(""), o = N(void 0), T = N(!!e.debug), I = N(e.dateFormat ?? "mm/dd/yyyy"), C = m(() => !!e.required), w = N(!1), A = ["ArrowUp", "ArrowDown"], E = ["ArrowLeft", "ArrowRight"], M = m(() => (t.value ?? "").replace(/\D/g, "")), x = (r) => r <= 2 ? "mm" : r <= 5 ? "dd" : M.value.length <= 10 ? "yyyy" : "mm", F = m(() => {
705
+ const r = t.value && t.value.substring(0, 2).replace(/\D/g, "0") || "0";
706
+ return parseInt(r).toString().padStart(2, "0");
707
+ }), b = m(() => {
708
+ const r = t.value && t.value.substring(3, 5).replace(/\D/g, "0") || "0";
709
+ return parseInt(r).toString().padStart(2, "0");
710
+ }), v = m(() => {
711
+ const r = t.value && t.value.substring(6, 10).replace(/\D/g, "0") || "0";
712
+ return parseInt(r).toString().padStart(4, "0");
713
+ }), $ = (r) => {
714
+ if (M.value.length === 0) {
715
+ e.onChange({ value: null, event: r });
511
716
  return;
512
717
  }
513
- if (E.value.length < 8) {
514
- e.onChange({ value: null, event: a });
718
+ if (M.value.length < 8) {
719
+ e.onChange({ value: null, event: r });
515
720
  return;
516
721
  }
517
- if ((t.value ?? "").length === 10 && E.value.length === 8) {
518
- const [f, y, U] = t.value.split("/"), K = parseInt(f), N = parseInt(y), Q = parseInt(U);
519
- if (_(Q, K, N)) {
520
- const ue = new Date(Q, K - 1, N);
521
- R(ue) ? e.onChange({ value: ue, event: a }) : e.onChange({ value: null, event: a });
722
+ if ((t.value ?? "").length === 10 && M.value.length === 8) {
723
+ const [f, h, U] = t.value.split("/"), z = parseInt(f), H = parseInt(h), te = parseInt(U);
724
+ if (W(te, z, H)) {
725
+ const se = new Date(te, z - 1, H);
726
+ R(se) ? e.onChange({ value: se, event: r }) : e.onChange({ value: null, event: r });
522
727
  } else
523
- e.onChange({ value: null, event: a });
728
+ e.onChange({ value: null, event: r });
524
729
  }
525
- }, R = (a) => {
526
- const f = e.min ?? void 0, y = e.max ?? void 0;
527
- return !(f && a < f || y && a > y);
528
- }, d = g(() => {
529
- if ((t.value ?? "").length === 10 && E.value.length === 8) {
530
- const [a, f, y] = (t.value ?? "").split("/"), U = parseInt(a), K = parseInt(f), N = parseInt(y);
531
- if (_(N, U, K))
532
- return new Date(N, U - 1, K);
730
+ }, R = (r) => {
731
+ const f = e.min ?? void 0, h = e.max ?? void 0;
732
+ return !(f && r < f || h && r > h);
733
+ }, d = m(() => {
734
+ if ((t.value ?? "").length === 10 && M.value.length === 8) {
735
+ const [r, f, h] = (t.value ?? "").split("/"), U = parseInt(r), z = parseInt(f), H = parseInt(h);
736
+ if (W(H, U, z))
737
+ return new Date(H, U - 1, z);
533
738
  }
534
739
  return null;
535
- }), S = g(() => (t.value ?? "").length === 10 && E.value.length === 8), q = (a, f) => new Date(a, f, 0).getDate(), _ = (a, f, y) => f >= 1 && f <= 12 && a >= 1900 && y >= 1 && y <= q(a, f), Z = (a) => {
536
- t.value = a.value;
537
- const f = a.event?.target;
538
- l.value = f?.selectionStart ?? 0, M(a);
539
- }, ee = (a) => {
540
- l.value = a.target.selectionStart ?? 0;
541
- }, te = (a, f, y) => {
542
- const U = f?.selectionStart ?? l.value ?? 0;
543
- l.value = U;
544
- let K = parseInt(L.value), N = parseInt(b.value), Q = parseInt(m.value);
545
- if (!(E.value.length >= 8) || !_(Q, K, N)) {
546
- const X = e.defaultValue ?? /* @__PURE__ */ new Date();
547
- K = X.getMonth() + 1, N = X.getDate(), Q = X.getFullYear(), t.value = `${String(K).padStart(2, "0")}/${String(N).padStart(
740
+ }), y = m(() => (t.value ?? "").length === 10 && M.value.length === 8), L = (r, f) => new Date(r, f, 0).getDate(), W = (r, f, h) => f >= 1 && f <= 12 && r >= 1900 && h >= 1 && h <= L(r, f), G = (r) => {
741
+ t.value = r.value;
742
+ const f = r.event?.target;
743
+ o.value = f?.selectionStart ?? 0, $(r);
744
+ }, Q = (r) => {
745
+ o.value = r.target.selectionStart ?? 0;
746
+ }, ee = (r, f, h) => {
747
+ const U = f?.selectionStart ?? o.value ?? 0;
748
+ o.value = U;
749
+ let z = parseInt(F.value), H = parseInt(b.value), te = parseInt(v.value);
750
+ if (!(M.value.length >= 8) || !W(te, z, H)) {
751
+ const J = e.defaultValue ?? /* @__PURE__ */ new Date();
752
+ z = J.getMonth() + 1, H = J.getDate(), te = J.getFullYear(), t.value = `${String(z).padStart(2, "0")}/${String(H).padStart(
548
753
  2,
549
754
  "0"
550
- )}/${String(Q)}`;
551
- const B = new Date(Q, K - 1, N);
552
- e.onChange({ value: R(B) ? B : null, event: y }), c({ useRAF: !0 });
755
+ )}/${String(te)}`;
756
+ const K = new Date(te, z - 1, H);
757
+ e.onChange({ value: R(K) ? K : null, event: h }), c({ useRAF: !0 });
553
758
  return;
554
759
  }
555
- const r = A(U);
556
- if (r === "mm")
557
- K = a === "ArrowUp" ? K < 12 ? K + 1 : 1 : K > 1 ? K - 1 : 12;
558
- else if (r === "dd") {
559
- const X = new Date(Q, K, 0).getDate();
560
- N = a === "ArrowUp" ? N < X ? N + 1 : 1 : N > 1 ? N - 1 : X;
561
- } else r === "yyyy" && (Q = a === "ArrowUp" ? Q + 1 : Math.max(1, Q - 1));
562
- t.value = `${String(K).padStart(2, "0")}/${String(N).padStart(
760
+ const a = x(U);
761
+ if (a === "mm")
762
+ z = r === "ArrowUp" ? z < 12 ? z + 1 : 1 : z > 1 ? z - 1 : 12;
763
+ else if (a === "dd") {
764
+ const J = new Date(te, z, 0).getDate();
765
+ H = r === "ArrowUp" ? H < J ? H + 1 : 1 : H > 1 ? H - 1 : J;
766
+ } else a === "yyyy" && (te = r === "ArrowUp" ? te + 1 : Math.max(1, te - 1));
767
+ t.value = `${String(z).padStart(2, "0")}/${String(H).padStart(
563
768
  2,
564
769
  "0"
565
- )}/${String(Q)}`;
566
- const [i, P, O] = t.value.split("/"), H = new Date(
770
+ )}/${String(te)}`;
771
+ const [i, V, O] = t.value.split("/"), Z = new Date(
567
772
  parseInt(O),
568
773
  parseInt(i) - 1,
569
- parseInt(P)
774
+ parseInt(V)
570
775
  );
571
- H.toString() !== "Invalid Date" && parseInt(O) >= 1e3 ? e.onChange({
572
- value: R(H) ? H : null,
573
- event: y
574
- }) : e.onChange({ value: null, event: y }), c({ useRAF: !0 });
575
- }, le = (a) => {
576
- if (a.code === "Space" || a.key === " ") {
577
- a.preventDefault(), a.stopPropagation(), e.onShowCalendar(a);
776
+ Z.toString() !== "Invalid Date" && parseInt(O) >= 1e3 ? e.onChange({
777
+ value: R(Z) ? Z : null,
778
+ event: h
779
+ }) : e.onChange({ value: null, event: h }), c({ useRAF: !0 });
780
+ }, le = (r) => {
781
+ if (r.code === "Space" || r.key === " ") {
782
+ r.preventDefault(), r.stopPropagation(), e.onShowCalendar(r);
578
783
  return;
579
784
  }
580
- if (a.key === "ArrowDown" && a.altKey) {
581
- a.preventDefault(), a.stopPropagation(), e.onShowCalendar(a);
785
+ if (r.key === "ArrowDown" && r.altKey) {
786
+ r.preventDefault(), r.stopPropagation(), e.onShowCalendar(r);
582
787
  return;
583
788
  }
584
- if (D.includes(a.key)) {
585
- if (a.altKey) return;
586
- a.preventDefault(), a.stopPropagation();
587
- const f = a.target;
588
- te(a.key, f, a);
789
+ if (A.includes(r.key)) {
790
+ if (r.altKey) return;
791
+ r.preventDefault(), r.stopPropagation();
792
+ const f = r.target;
793
+ ee(r.key, f, r);
589
794
  return;
590
795
  }
591
- }, o = (a) => {
592
- a.preventDefault();
593
- const f = a.deltaY < 0 ? "ArrowUp" : "ArrowDown";
594
- te(f, a.target, a);
595
- }, v = (a) => {
596
- const f = a.target;
597
- if (x.includes(a.key)) {
598
- l.value = f?.selectionStart ?? 0;
796
+ }, l = (r) => {
797
+ r.preventDefault();
798
+ const f = r.deltaY < 0 ? "ArrowUp" : "ArrowDown";
799
+ ee(f, r.target, r);
800
+ }, g = (r) => {
801
+ const f = r.target;
802
+ if (E.includes(r.key)) {
803
+ o.value = f?.selectionStart ?? 0;
599
804
  return;
600
805
  }
601
- if (D.includes(a.key)) {
602
- if (a.altKey) return;
603
- l.value = f?.selectionStart ?? 0;
806
+ if (A.includes(r.key)) {
807
+ if (r.altKey) return;
808
+ o.value = f?.selectionStart ?? 0;
604
809
  }
605
- }, u = (a) => {
606
- T.value = !0, I.value && !e.defaultValue && e.externalValue && e.externalValue.value === void 0 && E.value.length === 0 && (e.externalValue.value = "");
607
- const f = a.target;
608
- f && (l.value = f.selectionStart ?? 0);
609
- }, c = (a) => {
810
+ }, s = (r) => {
811
+ w.value = !0, C.value && !e.defaultValue && e.externalValue && e.externalValue.value === void 0 && M.value.length === 0 && (e.externalValue.value = "");
812
+ const f = r.target;
813
+ f && (o.value = f.selectionStart ?? 0);
814
+ }, c = (r) => {
610
815
  const f = () => {
611
- const y = document.getElementById(
816
+ const h = document.getElementById(
612
817
  e.id
613
818
  );
614
- if (!y) return;
615
- const U = a?.pos ?? l.value ?? y.value.length;
819
+ if (!h) return;
820
+ const U = r?.pos ?? o.value ?? h.value.length;
616
821
  try {
617
- y.focus(), y.setSelectionRange(U, U);
822
+ h.focus(), h.setSelectionRange(U, U);
618
823
  } catch {
619
824
  }
620
825
  };
621
- j(() => {
622
- if (a?.delay && a.delay > 0) {
623
- setTimeout(f, a.delay);
826
+ B(() => {
827
+ if (r?.delay && r.delay > 0) {
828
+ setTimeout(f, r.delay);
624
829
  return;
625
830
  }
626
- if (a?.useRAF) {
831
+ if (r?.useRAF) {
627
832
  requestAnimationFrame(f);
628
833
  return;
629
834
  }
630
835
  f();
631
836
  });
632
837
  };
633
- e.externalValue && ge(
838
+ e.externalValue && fe(
634
839
  e.externalValue,
635
- (a) => {
636
- if (a) {
637
- const f = new Date(a);
840
+ (r) => {
841
+ if (r) {
842
+ const f = new Date(r);
638
843
  if (f.toString() !== "Invalid Date") {
639
- const y = (f.getMonth() + 1).toString().padStart(2, "0"), U = f.getDate().toString().padStart(2, "0"), K = f.getFullYear().toString();
640
- t.value = `${y}/${U}/${K}`, c({ delay: 50 });
844
+ const h = (f.getMonth() + 1).toString().padStart(2, "0"), U = f.getDate().toString().padStart(2, "0"), z = f.getFullYear().toString();
845
+ t.value = `${h}/${U}/${z}`, c({ delay: 50 });
641
846
  return;
642
847
  }
643
848
  }
644
849
  },
645
850
  { immediate: !0 }
646
851
  );
647
- const w = g(() => [
648
- ["Date", `${L.value} / ${b.value} / ${m.value}`],
649
- ["Digits only", E.value],
852
+ const k = m(() => [
853
+ ["Date", `${F.value} / ${b.value} / ${v.value}`],
854
+ ["Digits only", M.value],
650
855
  [
651
856
  "min",
652
857
  e.min?.toLocaleDateString("en-US", {
@@ -663,138 +868,138 @@ function at(e) {
663
868
  day: "2-digit"
664
869
  }) ?? null
665
870
  ]
666
- ]), p = g(() => {
667
- if (!I.value) {
668
- if (!S.value) return !0;
871
+ ]), p = m(() => {
872
+ if (!C.value) {
873
+ if (!y.value) return !0;
669
874
  const f = d.value;
670
875
  return f ? R(f) : !1;
671
876
  }
672
- if (!T.value) return !0;
673
- const a = d.value;
674
- return !S.value || !a ? !1 : R(a);
675
- }), k = g(() => {
676
- if (!I.value) {
677
- if (!S.value) return;
877
+ if (!w.value) return !0;
878
+ const r = d.value;
879
+ return !y.value || !r ? !1 : R(r);
880
+ }), D = m(() => {
881
+ if (!C.value) {
882
+ if (!y.value) return;
678
883
  const f = d.value;
679
884
  return f ? R(f) ? "valid" : "out-of-bounds" : "invalid-date";
680
885
  }
681
- if (!T.value) return;
682
- if (E.value.length === 0 || !S.value)
886
+ if (!w.value) return;
887
+ if (M.value.length === 0 || !y.value)
683
888
  return "incomplete";
684
- const a = d.value;
685
- return a ? R(a) ? "valid" : "out-of-bounds" : "invalid-date";
686
- }), V = g(() => {
687
- const a = k.value;
688
- if (!a || a === "valid") return "";
689
- if (a === "incomplete")
889
+ const r = d.value;
890
+ return r ? R(r) ? "valid" : "out-of-bounds" : "invalid-date";
891
+ }), q = m(() => {
892
+ const r = D.value;
893
+ if (!r || r === "valid") return "";
894
+ if (r === "incomplete")
690
895
  return "Required";
691
- if (a === "invalid-date")
692
- return `Must be in ${C.value} format.`;
896
+ if (r === "invalid-date")
897
+ return `Must be in ${I.value} format.`;
693
898
  const f = e.min ? e.min.toLocaleDateString("en-US", {
694
899
  year: "numeric",
695
900
  month: "2-digit",
696
901
  day: "2-digit"
697
- }) : null, y = e.max ? e.max.toLocaleDateString("en-US", {
902
+ }) : null, h = e.max ? e.max.toLocaleDateString("en-US", {
698
903
  year: "numeric",
699
904
  month: "2-digit",
700
905
  day: "2-digit"
701
906
  }) : null;
702
- if (a === "out-of-bounds") {
703
- if (f && y) return `Must be between ${f} and ${y}.`;
907
+ if (r === "out-of-bounds") {
908
+ if (f && h) return `Must be between ${f} and ${h}.`;
704
909
  if (f) return `Must be on or after ${f}.`;
705
- if (y) return `Must be on or before ${y}.`;
910
+ if (h) return `Must be on or before ${h}.`;
706
911
  }
707
912
  return "";
708
- }), W = () => {
709
- j(() => {
710
- const a = document.getElementById(
913
+ }), Y = () => {
914
+ B(() => {
915
+ const r = document.getElementById(
711
916
  e.id
712
917
  );
713
- if (!a) {
918
+ if (!r) {
714
919
  console.warn(`ID (#${e.id}) not found for styling.`);
715
920
  return;
716
921
  }
717
- const f = a.closest(".k-datepicker");
922
+ const f = r.closest(".k-datepicker");
718
923
  if (!f) {
719
924
  console.warn(`.k-datepicker parent not found for #${e.id} styling.`);
720
925
  return;
721
926
  }
722
- const y = f.parentElement;
723
- if (y) {
724
- if (y.classList.contains("fk-datepicker"))
927
+ const h = f.parentElement;
928
+ if (h) {
929
+ if (h.classList.contains("fk-datepicker"))
725
930
  return;
726
- y.classList.add("fk-datepicker");
931
+ h.classList.add("fk-datepicker");
727
932
  } else
728
933
  console.warn(
729
934
  `Parent of .k-datepicker not found for #${e.id} styling.`
730
935
  );
731
936
  });
732
937
  };
733
- return xe(() => {
734
- W();
938
+ return Me(() => {
939
+ Y();
735
940
  }), {
736
941
  raw: t,
737
- cursorPos: l,
738
- debugEnabled: F,
739
- debugLines: w,
740
- placeholder: C,
942
+ cursorPos: o,
943
+ debugEnabled: T,
944
+ debugLines: k,
945
+ placeholder: I,
741
946
  isValid: p,
742
- reason: z(k),
743
- validationMessage: V,
744
- digitsOnly: E,
745
- month: z(L),
746
- day: z(b),
747
- year: z(m),
748
- datePart: A,
749
- handleChange: Z,
947
+ reason: _(D),
948
+ validationMessage: q,
949
+ digitsOnly: M,
950
+ month: _(F),
951
+ day: _(b),
952
+ year: _(v),
953
+ datePart: x,
954
+ handleChange: G,
750
955
  handleKeyDown: le,
751
- handleWheel: o,
752
- handleKeyUp: v,
753
- handleClick: ee,
754
- handleBlur: u,
956
+ handleWheel: l,
957
+ handleKeyUp: g,
958
+ handleClick: Q,
959
+ handleBlur: s,
755
960
  // Expose so consumers can re-run styling when needed
756
- initStyling: W
961
+ initStyling: Y
757
962
  };
758
963
  }
759
- function ot(e) {
760
- const t = Y(""), l = Y(void 0), F = Y(!!e.debug), C = Y(!1), I = 1440 * 60 * 1e3, T = 365 * I, D = /* @__PURE__ */ new Date(), x = new Date(D.getTime() - T), E = new Date(D.getTime() + T);
761
- e.min = e.min ?? x, e.max = e.max ?? E;
762
- const A = g(() => (t.value ?? "").replace(/\D/g, "")), L = (n, s) => new Date(n, s, 0).getDate(), b = (n, s, h) => s >= 1 && s <= 12 && n >= 1e3 && h >= 1 && h <= L(n, s), m = (n) => Date.UTC(n.getFullYear(), n.getMonth(), n.getDate()), M = (n) => {
964
+ function pt(e) {
965
+ const t = N(""), o = N(void 0), T = N(!!e.debug), I = N(!1), C = 1440 * 60 * 1e3, w = 365 * C, A = /* @__PURE__ */ new Date(), E = new Date(A.getTime() - w), M = new Date(A.getTime() + w);
966
+ e.min = e.min ?? E, e.max = e.max ?? M;
967
+ const x = m(() => (t.value ?? "").replace(/\D/g, "")), F = (n, u) => new Date(n, u, 0).getDate(), b = (n, u, S) => u >= 1 && u <= 12 && n >= 1e3 && S >= 1 && S <= F(n, u), v = (n) => Date.UTC(n.getFullYear(), n.getMonth(), n.getDate()), $ = (n) => {
763
968
  if (!n) return null;
764
- const s = e.min ?? new Date(Date.now() - 90 * I), h = e.max ?? /* @__PURE__ */ new Date(), $ = m(n);
765
- return $ < m(s) || $ > m(h) ? null : n;
766
- }, R = (n, s) => e.allowReverse ?? !1 ? !0 : n <= s, d = g(() => (t.value?.length ?? 0) >= 23 && A.value.length >= 16), S = (n) => {
767
- if ((n ?? "").length < 23 || A.value.length < 16)
969
+ const u = e.min ?? new Date(Date.now() - 90 * C), S = e.max ?? /* @__PURE__ */ new Date(), P = v(n);
970
+ return P < v(u) || P > v(S) ? null : n;
971
+ }, R = (n, u) => e.allowReverse ?? !1 ? !0 : n <= u, d = m(() => (t.value?.length ?? 0) >= 23 && x.value.length >= 16), y = (n) => {
972
+ if ((n ?? "").length < 23 || x.value.length < 16)
768
973
  return { start: null, end: null };
769
- const s = n.substring(0, 10), h = n.substring(13, 23), [$, ne, re] = s.split("/").map((de) => parseInt(de || "0", 10)), [ce, fe, pe] = h.split("/").map((de) => parseInt(de || "0", 10)), me = new Date(re, $ - 1, ne), he = new Date(pe, ce - 1, fe), we = b(re, $, ne) && me.toString() !== "Invalid Date", ke = b(pe, ce, fe) && he.toString() !== "Invalid Date";
770
- return { start: we ? me : null, end: ke ? he : null };
771
- }, q = e.externalValid ?? Y(!0), _ = g(() => S(t.value)), Z = g(() => {
772
- const n = M(_.value.start), s = M(_.value.end);
773
- return { start: n, end: s };
774
- }), ee = g(() => {
974
+ const u = n.substring(0, 10), S = n.substring(13, 23), [P, ne, ae] = u.split("/").map((de) => parseInt(de || "0", 10)), [ce, pe, me] = S.split("/").map((de) => parseInt(de || "0", 10)), ve = new Date(ae, P - 1, ne), he = new Date(me, ce - 1, pe), we = b(ae, P, ne) && ve.toString() !== "Invalid Date", Ae = b(me, ce, pe) && he.toString() !== "Invalid Date";
975
+ return { start: we ? ve : null, end: Ae ? he : null };
976
+ }, L = e.externalValid ?? N(!0), W = m(() => y(t.value)), G = m(() => {
977
+ const n = $(W.value.start), u = $(W.value.end);
978
+ return { start: n, end: u };
979
+ }), Q = m(() => {
775
980
  if (!d.value) return;
776
- const n = Z.value.start, s = Z.value.end;
777
- if (!n || !s) return;
778
- const h = Math.abs(m(s) - m(n));
779
- return Math.round(h / 864e5 + 1);
780
- }), te = g(() => {
981
+ const n = G.value.start, u = G.value.end;
982
+ if (!n || !u) return;
983
+ const S = Math.abs(v(u) - v(n));
984
+ return Math.round(S / 864e5 + 1);
985
+ }), ee = m(() => {
781
986
  if (!d.value) return !1;
782
- const { start: n, end: s } = _.value;
783
- if (!n || !s || !Z.value.start || !Z.value.end) return !1;
784
- const h = Z.value.start, $ = Z.value.end;
785
- return !(!R(h, $) || typeof e.maxSpanDays == "number" && ee.value !== void 0 && ee.value > e.maxSpanDays);
786
- }), le = g(() => {
787
- const { start: n, end: s } = _.value;
987
+ const { start: n, end: u } = W.value;
988
+ if (!n || !u || !G.value.start || !G.value.end) return !1;
989
+ const S = G.value.start, P = G.value.end;
990
+ return !(!R(S, P) || typeof e.maxSpanDays == "number" && Q.value !== void 0 && Q.value > e.maxSpanDays);
991
+ }), le = m(() => {
992
+ const { start: n, end: u } = W.value;
788
993
  if (!d.value) return "incomplete";
789
- if (!n || !s) return "invalid-date";
790
- if (!Z.value.start || !Z.value.end) return "out-of-bounds";
791
- const h = Z.value.start, $ = Z.value.end;
792
- return R(h, $) ? typeof e.maxSpanDays == "number" && ee.value !== void 0 && ee.value > e.maxSpanDays ? "span-exceeds-limit" : "valid" : "reversed-range";
793
- }), o = Y(void 0), v = g(() => {
794
- if (q.value !== !1) return "";
795
- const { min: n, max: s } = e, h = o.value;
796
- if (!h) return "";
797
- switch (h) {
994
+ if (!n || !u) return "invalid-date";
995
+ if (!G.value.start || !G.value.end) return "out-of-bounds";
996
+ const S = G.value.start, P = G.value.end;
997
+ return R(S, P) ? typeof e.maxSpanDays == "number" && Q.value !== void 0 && Q.value > e.maxSpanDays ? "span-exceeds-limit" : "valid" : "reversed-range";
998
+ }), l = N(void 0), g = m(() => {
999
+ if (L.value !== !1) return "";
1000
+ const { min: n, max: u } = e, S = l.value;
1001
+ if (!S) return "";
1002
+ switch (S) {
798
1003
  case "incomplete":
799
1004
  return "Required";
800
1005
  case "invalid-date":
@@ -802,89 +1007,89 @@ function ot(e) {
802
1007
  case "reversed-range":
803
1008
  return "End Date must be on or after Start Date.";
804
1009
  case "out-of-bounds":
805
- return n && s ? `Dates must be between ${p(n)} and ${p(s)}.` : "Dates must be within the allowed range.";
1010
+ return n && u ? `Dates must be between ${p(n)} and ${p(u)}.` : "Dates must be within the allowed range.";
806
1011
  case "span-exceeds-limit":
807
1012
  return typeof e.maxSpanDays == "number" ? `Date range exceeds ${e.maxSpanDays} days.` : "Date range exceeds maximum allowed span.";
808
1013
  default:
809
1014
  return "";
810
1015
  }
811
- }), u = ["ArrowUp", "ArrowDown"], c = ["ArrowLeft", "ArrowRight"], w = (n, s) => String(n).padStart(s, "0"), p = (n) => `${w(n.getMonth() + 1, 2)}/${w(n.getDate(), 2)}/${w(
1016
+ }), s = ["ArrowUp", "ArrowDown"], c = ["ArrowLeft", "ArrowRight"], k = (n, u) => String(n).padStart(u, "0"), p = (n) => `${k(n.getMonth() + 1, 2)}/${k(n.getDate(), 2)}/${k(
812
1017
  n.getFullYear(),
813
1018
  4
814
- )}`, k = (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" }, V = (n, s, h) => {
815
- const $ = s?.selectionStart ?? l.value ?? 0;
816
- l.value = $;
817
- const { start: ne, end: re } = S(t.value);
818
- if (!ne && !re) {
819
- const G = /* @__PURE__ */ new Date(), se = p(G);
820
- t.value = `${se} - ${se}`, e.onChange({ value: { start: G, end: G }, event: h }), j(() => {
1019
+ )}`, D = (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" }, q = (n, u, S) => {
1020
+ const P = u?.selectionStart ?? o.value ?? 0;
1021
+ o.value = P;
1022
+ const { start: ne, end: ae } = y(t.value);
1023
+ if (!ne && !ae) {
1024
+ const j = /* @__PURE__ */ new Date(), ue = p(j);
1025
+ t.value = `${ue} - ${ue}`, e.onChange({ value: { start: j, end: j }, event: S }), B(() => {
821
1026
  requestAnimationFrame(() => {
822
- const ae = document.getElementById(
1027
+ const re = document.getElementById(
823
1028
  e.id
824
- ), oe = l.value ?? 0;
825
- ae && (ae.focus(), ae.setSelectionRange(oe, oe));
1029
+ ), oe = o.value ?? 0;
1030
+ re && (re.focus(), re.setSelectionRange(oe, oe));
826
1031
  });
827
1032
  });
828
1033
  return;
829
1034
  }
830
- const ce = /* @__PURE__ */ new Date(), fe = k($);
831
- let pe = ne ? new Date(ne) : new Date(ce), me = re ? new Date(re) : new Date(ce);
832
- const he = (G, se) => {
833
- if (se === "mm") {
834
- const ae = G.getMonth() + 1, oe = n === "ArrowUp" ? ae < 12 ? ae + 1 : 1 : ae > 1 ? ae - 1 : 12;
835
- G.setMonth(oe - 1);
836
- const be = L(G.getFullYear(), oe);
837
- G.getDate() > be && G.setDate(be);
838
- } else if (se === "dd") {
839
- const ae = L(G.getFullYear(), G.getMonth() + 1), oe = G.getDate(), be = n === "ArrowUp" ? oe < ae ? oe + 1 : 1 : oe > 1 ? oe - 1 : ae;
840
- G.setDate(be);
841
- } else if (se === "yyyy") {
842
- const ae = G.getFullYear();
843
- G.setFullYear(n === "ArrowUp" ? ae + 1 : Math.max(1, ae - 1));
844
- const oe = L(G.getFullYear(), G.getMonth() + 1);
845
- G.getDate() > oe && G.setDate(oe);
1035
+ const ce = /* @__PURE__ */ new Date(), pe = D(P);
1036
+ let me = ne ? new Date(ne) : new Date(ce), ve = ae ? new Date(ae) : new Date(ce);
1037
+ const he = (j, ue) => {
1038
+ if (ue === "mm") {
1039
+ const re = j.getMonth() + 1, oe = n === "ArrowUp" ? re < 12 ? re + 1 : 1 : re > 1 ? re - 1 : 12;
1040
+ j.setMonth(oe - 1);
1041
+ const Se = F(j.getFullYear(), oe);
1042
+ j.getDate() > Se && j.setDate(Se);
1043
+ } else if (ue === "dd") {
1044
+ const re = F(j.getFullYear(), j.getMonth() + 1), oe = j.getDate(), Se = n === "ArrowUp" ? oe < re ? oe + 1 : 1 : oe > 1 ? oe - 1 : re;
1045
+ j.setDate(Se);
1046
+ } else if (ue === "yyyy") {
1047
+ const re = j.getFullYear();
1048
+ j.setFullYear(n === "ArrowUp" ? re + 1 : Math.max(1, re - 1));
1049
+ const oe = F(j.getFullYear(), j.getMonth() + 1);
1050
+ j.getDate() > oe && j.setDate(oe);
846
1051
  }
847
1052
  };
848
- fe.side === "start" ? he(pe, fe.part) : he(me, fe.part);
849
- const we = p(pe), ke = p(me);
850
- t.value = `${we} - ${ke}`;
851
- const de = M(pe), De = M(me);
852
- de && De && R(de, De) ? e.onChange({ value: { start: de, end: De }, event: h }) : e.onChange({ value: null, event: h }), j(() => {
1053
+ pe.side === "start" ? he(me, pe.part) : he(ve, pe.part);
1054
+ const we = p(me), Ae = p(ve);
1055
+ t.value = `${we} - ${Ae}`;
1056
+ const de = $(me), ke = $(ve);
1057
+ de && ke && R(de, ke) ? e.onChange({ value: { start: de, end: ke }, event: S }) : e.onChange({ value: null, event: S }), B(() => {
853
1058
  requestAnimationFrame(() => {
854
- const G = document.getElementById(
1059
+ const j = document.getElementById(
855
1060
  e.id
856
- ), se = l.value ?? 0;
857
- G && (G.focus(), G.setSelectionRange(se, se));
1061
+ ), ue = o.value ?? 0;
1062
+ j && (j.focus(), j.setSelectionRange(ue, ue));
858
1063
  });
859
1064
  });
860
- }, W = (n) => {
861
- const { start: s, end: h } = S(t.value);
862
- if (!s || !h) {
1065
+ }, Y = (n) => {
1066
+ const { start: u, end: S } = y(t.value);
1067
+ if (!u || !S) {
863
1068
  e.onChange({ value: null, event: n });
864
1069
  return;
865
1070
  }
866
- const $ = M(s), ne = M(h);
867
- if (!$ || !ne) {
1071
+ const P = $(u), ne = $(S);
1072
+ if (!P || !ne) {
868
1073
  e.onChange({ value: null, event: n });
869
1074
  return;
870
1075
  }
871
- if (!R($, ne)) {
1076
+ if (!R(P, ne)) {
872
1077
  e.onChange({ value: null, event: n });
873
1078
  return;
874
1079
  }
875
- e.onChange({ value: { start: $, end: ne }, event: n });
876
- }, a = (n) => {
877
- const s = n.value ?? "", h = n.event;
878
- if (!s && h && h.type === "click") {
879
- ue(h);
1080
+ e.onChange({ value: { start: P, end: ne }, event: n });
1081
+ }, r = (n) => {
1082
+ const u = n.value ?? "", S = n.event;
1083
+ if (!u && S && S.type === "click") {
1084
+ se(S);
880
1085
  return;
881
1086
  }
882
- t.value = s;
883
- const $ = h?.target;
884
- l.value = $?.selectionStart ?? 0, W(n);
1087
+ t.value = u;
1088
+ const P = S?.target;
1089
+ o.value = P?.selectionStart ?? 0, Y(n);
885
1090
  }, f = (n) => {
886
- l.value = n.target.selectionStart ?? 0;
887
- }, y = (n) => {
1091
+ o.value = n.target.selectionStart ?? 0;
1092
+ }, h = (n) => {
888
1093
  if (n.code === "Space" || n.key === " ") {
889
1094
  n.preventDefault(), n.stopPropagation(), e.onShowCalendar(n);
890
1095
  return;
@@ -893,63 +1098,63 @@ function ot(e) {
893
1098
  n.preventDefault(), n.stopPropagation(), e.onShowCalendar(n);
894
1099
  return;
895
1100
  }
896
- if (u.includes(n.key)) {
1101
+ if (s.includes(n.key)) {
897
1102
  n.preventDefault(), n.stopPropagation();
898
- const s = n.target;
899
- V(n.key, s, n);
1103
+ const u = n.target;
1104
+ q(n.key, u, n);
900
1105
  return;
901
1106
  }
902
1107
  }, U = (n) => {
903
1108
  n.preventDefault();
904
- const s = n.deltaY < 0 ? "ArrowUp" : "ArrowDown";
905
- V(s, n.target, n);
906
- }, K = (n) => {
907
- if (c.includes(n.key) || u.includes(n.key)) {
908
- const s = n.target;
909
- l.value = s?.selectionStart ?? 0;
1109
+ const u = n.deltaY < 0 ? "ArrowUp" : "ArrowDown";
1110
+ q(u, n.target, n);
1111
+ }, z = (n) => {
1112
+ if (c.includes(n.key) || s.includes(n.key)) {
1113
+ const u = n.target;
1114
+ o.value = u?.selectionStart ?? 0;
910
1115
  }
911
- }, N = () => {
912
- o.value = le.value, (e.manageValid ?? !0) && (q.value = te.value);
913
- }, Q = (n) => {
914
- N();
915
- }, ue = (n) => {
916
- console.log("Clear event:", n), t.value = "", l.value = 0, e.onChange({ value: null, event: n }), N(), j(() => {
917
- const s = document.getElementById(
1116
+ }, H = () => {
1117
+ l.value = le.value, (e.manageValid ?? !0) && (L.value = ee.value);
1118
+ }, te = (n) => {
1119
+ H();
1120
+ }, se = (n) => {
1121
+ console.log("Clear event:", n), t.value = "", o.value = 0, e.onChange({ value: null, event: n }), H(), B(() => {
1122
+ const u = document.getElementById(
918
1123
  e.id
919
1124
  );
920
- s && (s.focus(), s.setSelectionRange(0, 0));
1125
+ u && (u.focus(), u.setSelectionRange(0, 0));
921
1126
  });
922
1127
  };
923
- e.externalValue && ge(
1128
+ e.externalValue && fe(
924
1129
  e.externalValue,
925
1130
  (n) => {
926
- const s = n?.start ?? null, h = n?.end ?? null;
927
- if (s && h) {
928
- if (t.value = `${p(s)} - ${p(h)}`, e.isOpen?.value && C.value && e.onRequestClose) {
929
- const $ = typeof e.closeDelay == "number" ? e.closeDelay : e.closeDelay?.value ?? 0;
1131
+ const u = n?.start ?? null, S = n?.end ?? null;
1132
+ if (u && S) {
1133
+ if (t.value = `${p(u)} - ${p(S)}`, e.isOpen?.value && I.value && e.onRequestClose) {
1134
+ const P = typeof e.closeDelay == "number" ? e.closeDelay : e.closeDelay?.value ?? 0;
930
1135
  setTimeout(() => {
931
- e.onRequestClose?.(), C.value = !1, N();
932
- }, $);
1136
+ e.onRequestClose?.(), I.value = !1, H();
1137
+ }, P);
933
1138
  }
934
1139
  return;
935
1140
  }
936
1141
  },
937
1142
  { immediate: !0 }
938
1143
  );
939
- const r = g(
1144
+ const a = m(
940
1145
  () => t.value && t.value.substring(0, 2).replace(/\D/g, "0") || "0"
941
- ), i = g(
1146
+ ), i = m(
942
1147
  () => t.value && t.value.substring(3, 5).replace(/\D/g, "0") || "0"
943
- ), P = g(
1148
+ ), V = m(
944
1149
  () => t.value && t.value.substring(6, 10).replace(/\D/g, "0") || "0"
945
- ), O = g(
1150
+ ), O = m(
946
1151
  () => t.value && t.value.substring(13, 15).replace(/\D/g, "0") || "0"
947
- ), H = g(
1152
+ ), Z = m(
948
1153
  () => t.value && t.value.substring(16, 18).replace(/\D/g, "0") || "0"
949
- ), X = g(
1154
+ ), J = m(
950
1155
  () => t.value && t.value.substring(19, 23).replace(/\D/g, "0") || "0"
951
- ), B = g(() => {
952
- const { start: n, end: s } = S(t.value);
1156
+ ), K = m(() => {
1157
+ const { start: n, end: u } = y(t.value);
953
1158
  return [
954
1159
  {
955
1160
  label: "Raw",
@@ -965,81 +1170,81 @@ function ot(e) {
965
1170
  },
966
1171
  {
967
1172
  label: "Start",
968
- value: `${String(r.value).padStart(2, "0")} / ${String(
1173
+ value: `${String(a.value).padStart(2, "0")} / ${String(
969
1174
  i.value
970
- ).padStart(2, "0")} / ${String(P.value).padStart(4, "0")}`
1175
+ ).padStart(2, "0")} / ${String(V.value).padStart(4, "0")}`
971
1176
  },
972
1177
  {
973
1178
  label: "End",
974
1179
  value: `${String(O.value).padStart(2, "0")} / ${String(
975
- H.value
976
- ).padStart(2, "0")} / ${String(X.value).padStart(4, "0")}`
1180
+ Z.value
1181
+ ).padStart(2, "0")} / ${String(J.value).padStart(4, "0")}`
977
1182
  },
978
- { label: "Digits only", value: A.value },
1183
+ { label: "Digits only", value: x.value },
979
1184
  { label: "Mask complete", value: `${d.value}` },
980
1185
  {
981
1186
  label: "Parsed",
982
- value: `${n ? n.toDateString() : "-"} | ${s ? s.toDateString() : "-"}`
1187
+ value: `${n ? n.toDateString() : "-"} | ${u ? u.toDateString() : "-"}`
983
1188
  },
984
1189
  {
985
1190
  label: "Valid (managed)",
986
- value: `${q.value ?? "-"}`
1191
+ value: `${L.value ?? "-"}`
987
1192
  },
988
- { label: "Span (days)", value: `${ee.value ?? "-"}` },
1193
+ { label: "Span (days)", value: `${Q.value ?? "-"}` },
989
1194
  {
990
1195
  label: "Reason",
991
1196
  value: `${le.value ?? "-"}`
992
1197
  },
993
1198
  {
994
1199
  label: "Cursor in",
995
- value: `${l.value ?? "-"} (${(() => {
996
- const h = l.value ?? 0, $ = k(h);
997
- return `${$.side}.${$.part}`;
1200
+ value: `${o.value ?? "-"} (${(() => {
1201
+ const S = o.value ?? 0, P = D(S);
1202
+ return `${P.side}.${P.part}`;
998
1203
  })()})`
999
1204
  }
1000
1205
  ];
1001
- }), J = () => {
1002
- j(() => {
1206
+ }), X = () => {
1207
+ B(() => {
1003
1208
  const n = document.getElementById(e.id);
1004
1209
  if (!n) {
1005
1210
  console.warn(`#${e.id} not found for styling.`);
1006
1211
  return;
1007
1212
  }
1008
- const s = n.closest("div");
1009
- if (!s) {
1213
+ const u = n.closest("div");
1214
+ if (!u) {
1010
1215
  console.warn(`Parent div of #${e.id} not found for styling.`);
1011
1216
  return;
1012
1217
  }
1013
- s.classList.contains("fk-daterangepicker") || s.classList.add("fk-daterangepicker");
1218
+ u.classList.contains("fk-daterangepicker") || u.classList.add("fk-daterangepicker");
1014
1219
  });
1015
1220
  };
1016
- xe(() => {
1017
- J();
1221
+ Me(() => {
1222
+ X();
1018
1223
  });
1019
1224
  const ye = () => {
1020
- j(() => {
1225
+ B(() => {
1021
1226
  try {
1022
1227
  const n = Array.from(
1023
1228
  document.querySelectorAll(".k-animation-container")
1024
1229
  );
1025
1230
  if (!n.length) return;
1026
- const h = [...n].reverse().find((re) => re.querySelector(".k-calendar"))?.querySelector(
1231
+ const S = [...n].reverse().find((ae) => ae.querySelector(".k-calendar"))?.querySelector(
1027
1232
  ".k-calendar"
1028
1233
  );
1029
- if (!h) return;
1030
- const $ = h.querySelectorAll(
1234
+ if (!S) return;
1235
+ const P = S.querySelectorAll(
1031
1236
  ".k-calendar-table"
1032
1237
  );
1033
1238
  let ne = !1;
1034
- $.forEach((re) => {
1035
- re.tabIndex === 0 && (ne ? re.tabIndex = -1 : ne = !0);
1239
+ P.forEach((ae) => {
1240
+ ae.tabIndex === 0 && (ne ? ae.tabIndex = -1 : ne = !0);
1036
1241
  });
1037
1242
  } catch (n) {
1038
1243
  console.warn(n);
1039
1244
  }
1040
1245
  });
1041
1246
  };
1042
- return e.isOpen && ge(
1247
+ return e.isOpen && fe(
1043
1248
  e.isOpen,
1044
1249
  (n) => {
1045
1250
  n && setTimeout(() => ye(), 0);
@@ -1047,268 +1252,268 @@ function ot(e) {
1047
1252
  { immediate: !1 }
1048
1253
  ), {
1049
1254
  raw: t,
1050
- cursorPos: l,
1051
- debugEnabled: F,
1052
- debugLines: B,
1053
- digitsOnly: A,
1054
- valid: q,
1055
- validComputed: z(te),
1056
- reason: z(le),
1057
- validationMessage: z(v),
1058
- spanDays: z(ee),
1059
- month1: z(r),
1060
- day1: z(i),
1061
- year1: z(P),
1062
- month2: z(O),
1063
- day2: z(H),
1064
- year2: z(X),
1065
- handleChange: a,
1066
- handleKeyDown: y,
1255
+ cursorPos: o,
1256
+ debugEnabled: T,
1257
+ debugLines: K,
1258
+ digitsOnly: x,
1259
+ valid: L,
1260
+ validComputed: _(ee),
1261
+ reason: _(le),
1262
+ validationMessage: _(g),
1263
+ spanDays: _(Q),
1264
+ month1: _(a),
1265
+ day1: _(i),
1266
+ year1: _(V),
1267
+ month2: _(O),
1268
+ day2: _(Z),
1269
+ year2: _(J),
1270
+ handleChange: r,
1271
+ handleKeyDown: h,
1067
1272
  handleWheel: U,
1068
- handleKeyUp: K,
1273
+ handleKeyUp: z,
1069
1274
  handleClick: f,
1070
- handleBlur: Q,
1071
- handleClear: ue,
1275
+ handleBlur: te,
1276
+ handleClear: se,
1072
1277
  onCalendarChange: () => {
1073
- C.value = !0;
1278
+ I.value = !0;
1074
1279
  },
1075
- initStyling: J
1280
+ initStyling: X
1076
1281
  };
1077
1282
  }
1078
- function lt(e) {
1079
- const t = Y(""), l = Y(void 0), F = Y(!!e.debug), C = Y(e.timeFormat ?? "hh:mm AM"), I = g(() => !!e.required), T = Y(!1), D = ["ArrowUp", "ArrowDown"], x = ["ArrowLeft", "ArrowRight"], E = g(() => (t.value ?? "").replace(/\D/g, "")), A = {
1283
+ function mt(e) {
1284
+ const t = N(""), o = N(void 0), T = N(!!e.debug), I = N(e.timeFormat ?? "hh:mm AM"), C = m(() => !!e.required), w = N(!1), A = ["ArrowUp", "ArrowDown"], E = ["ArrowLeft", "ArrowRight"], M = m(() => (t.value ?? "").replace(/\D/g, "")), x = {
1080
1285
  H: /[0-9]/,
1081
1286
  h: /[0-9]/,
1082
1287
  M: /[0-9]/,
1083
1288
  m: /[0-9]/,
1084
1289
  A: /[AaPp]/,
1085
1290
  a: /[Mm]/
1086
- }, L = (r) => r <= 2 ? "hh" : r <= 5 ? "mm" : "ampm", b = g(() => {
1087
- const r = t.value && t.value.substring(0, 2).replace(/\D/g, "0") || "0", i = parseInt(r);
1291
+ }, F = (a) => a <= 2 ? "hh" : a <= 5 ? "mm" : "ampm", b = m(() => {
1292
+ const a = t.value && t.value.substring(0, 2).replace(/\D/g, "0") || "0", i = parseInt(a);
1088
1293
  return Math.min(Math.max(i, 0), 23);
1089
- }), m = g(() => {
1090
- const r = t.value && t.value.substring(3, 5).replace(/\D/g, "0") || "0", i = parseInt(r);
1294
+ }), v = m(() => {
1295
+ const a = t.value && t.value.substring(3, 5).replace(/\D/g, "0") || "0", i = parseInt(a);
1091
1296
  return Math.min(Math.max(i, 0), 59);
1092
- }), M = g(() => (t.value?.substring(6, 8) || "AM").toUpperCase().startsWith("P") ? "PM" : "AM"), R = g(() => {
1093
- const r = parseInt(t.value?.substring(0, 2).replace(/\D/g, "0") || "0"), i = M.value;
1094
- return r === 12 ? i === "AM" ? 0 : 12 : i === "PM" ? r + 12 : r;
1095
- }), d = g(() => S.value ? `${String(R.value).padStart(2, "0")}:${String(m.value).padStart(2, "0")}:00` : null), S = g(
1297
+ }), $ = m(() => (t.value?.substring(6, 8) || "AM").toUpperCase().startsWith("P") ? "PM" : "AM"), R = m(() => {
1298
+ const a = parseInt(t.value?.substring(0, 2).replace(/\D/g, "0") || "0"), i = $.value;
1299
+ return a === 12 ? i === "AM" ? 0 : 12 : i === "PM" ? a + 12 : a;
1300
+ }), d = m(() => y.value ? `${String(R.value).padStart(2, "0")}:${String(v.value).padStart(2, "0")}:00` : null), y = m(
1096
1301
  () => /^(\d{2}):(\d{2})\s([AP]M)$/i.test(t.value ?? "")
1097
- ), q = (r, i, P) => {
1098
- let O = r % 12;
1302
+ ), L = (a, i, V) => {
1303
+ let O = a % 12;
1099
1304
  return O === 0 && (O = 12), `${String(O).padStart(2, "0")}:${String(i).padStart(
1100
1305
  2,
1101
1306
  "0"
1102
- )} ${P}`;
1103
- }, _ = (r) => {
1104
- const i = r.match(/^(\d{2}):(\d{2})\s([AP]M)$/i);
1307
+ )} ${V}`;
1308
+ }, W = (a) => {
1309
+ const i = a.match(/^(\d{2}):(\d{2})\s([AP]M)$/i);
1105
1310
  if (!i) return null;
1106
- const P = parseInt(i[1]), O = parseInt(i[2]), H = i[3].toUpperCase();
1107
- if (P < 1 || P > 12 || O < 0 || O > 59) return null;
1108
- let X = P % 12;
1109
- H === "PM" && (X += 12);
1110
- const B = /* @__PURE__ */ new Date();
1111
- return B.setSeconds(0, 0), B.setHours(X), B.setMinutes(O), B;
1112
- }, Z = (r) => {
1113
- if (E.value.length === 0) {
1114
- e.onChange({ value: null, event: r });
1311
+ const V = parseInt(i[1]), O = parseInt(i[2]), Z = i[3].toUpperCase();
1312
+ if (V < 1 || V > 12 || O < 0 || O > 59) return null;
1313
+ let J = V % 12;
1314
+ Z === "PM" && (J += 12);
1315
+ const K = /* @__PURE__ */ new Date();
1316
+ return K.setSeconds(0, 0), K.setHours(J), K.setMinutes(O), K;
1317
+ }, G = (a) => {
1318
+ if (M.value.length === 0) {
1319
+ e.onChange({ value: null, event: a });
1115
1320
  return;
1116
1321
  }
1117
- if (!S.value) {
1118
- e.onChange({ value: null, event: r });
1322
+ if (!y.value) {
1323
+ e.onChange({ value: null, event: a });
1119
1324
  return;
1120
1325
  }
1121
- const i = _(t.value);
1122
- i && te(i) ? e.onChange({ value: i, event: r }) : e.onChange({ value: null, event: r });
1123
- }, ee = (r) => r.getHours() * 60 + r.getMinutes(), te = (r) => {
1124
- const i = e.min ?? void 0, P = e.max ?? void 0, O = ee(r);
1326
+ const i = W(t.value);
1327
+ i && ee(i) ? e.onChange({ value: i, event: a }) : e.onChange({ value: null, event: a });
1328
+ }, Q = (a) => a.getHours() * 60 + a.getMinutes(), ee = (a) => {
1329
+ const i = e.min ?? void 0, V = e.max ?? void 0, O = Q(a);
1125
1330
  if (i) {
1126
- const H = ee(i);
1127
- if (O < H) return !1;
1331
+ const Z = Q(i);
1332
+ if (O < Z) return !1;
1128
1333
  }
1129
- if (P) {
1130
- const H = ee(P);
1131
- if (O > H) return !1;
1334
+ if (V) {
1335
+ const Z = Q(V);
1336
+ if (O > Z) return !1;
1132
1337
  }
1133
1338
  return !0;
1134
- }, le = (r) => {
1135
- const i = r.getHours(), P = i >= 12 ? "PM" : "AM";
1136
- t.value = q(i, r.getMinutes(), P);
1137
- }, o = (r, i) => {
1138
- e.onChange({ value: r, event: i });
1139
- }, v = () => {
1140
- j(() => {
1339
+ }, le = (a) => {
1340
+ const i = a.getHours(), V = i >= 12 ? "PM" : "AM";
1341
+ t.value = L(i, a.getMinutes(), V);
1342
+ }, l = (a, i) => {
1343
+ e.onChange({ value: a, event: i });
1344
+ }, g = () => {
1345
+ B(() => {
1141
1346
  requestAnimationFrame(() => {
1142
1347
  requestAnimationFrame(() => {
1143
- const r = document.getElementById(
1348
+ const a = document.getElementById(
1144
1349
  e.id
1145
1350
  );
1146
- if (r) {
1147
- r.focus();
1148
- const i = (r.value ?? "").length;
1149
- r.setSelectionRange(i, i);
1351
+ if (a) {
1352
+ a.focus();
1353
+ const i = (a.value ?? "").length;
1354
+ a.setSelectionRange(i, i);
1150
1355
  }
1151
1356
  });
1152
1357
  });
1153
1358
  });
1154
- }, u = (r) => {
1155
- const i = r?.event?.target;
1359
+ }, s = (a) => {
1360
+ const i = a?.event?.target;
1156
1361
  return i ? i.closest(".k-time-now") ? "now" : i.closest(".k-time-accept") ? "set" : null : null;
1157
- }, c = (r, i) => {
1158
- r && te(r) ? o(r, i) : o(null, i);
1159
- }, w = (...r) => {
1160
- const i = r[0];
1362
+ }, c = (a, i) => {
1363
+ a && ee(a) ? l(a, i) : l(null, i);
1364
+ }, k = (...a) => {
1365
+ const i = a[0];
1161
1366
  if (!i) return;
1162
- const P = u(i);
1163
- if (P === "now") {
1164
- const H = /* @__PURE__ */ new Date();
1165
- le(H), c(H, i), v();
1367
+ const V = s(i);
1368
+ if (V === "now") {
1369
+ const Z = /* @__PURE__ */ new Date();
1370
+ le(Z), c(Z, i), g();
1166
1371
  return;
1167
1372
  }
1168
1373
  if (i?.value instanceof Date) {
1169
- const H = new Date(i.value);
1170
- le(H), c(H, i), P === "set" && v();
1374
+ const Z = new Date(i.value);
1375
+ le(Z), c(Z, i), V === "set" && g();
1171
1376
  return;
1172
1377
  }
1173
1378
  if (i?.value === null) {
1174
- t.value = "", o(null, i);
1379
+ t.value = "", l(null, i);
1175
1380
  return;
1176
1381
  }
1177
1382
  t.value = i.value;
1178
1383
  const O = i.event?.target;
1179
- l.value = O?.selectionStart ?? 0;
1384
+ o.value = O?.selectionStart ?? 0;
1180
1385
  try {
1181
- const H = l.value ?? 0;
1182
- if (L(H) === "ampm" && (t.value ?? "").length >= 8) {
1183
- const X = t.value.charAt(6);
1184
- /[Aa]/.test(X) ? (t.value = `${t.value.slice(0, 6)}AM${t.value.slice(8)}`, j(() => {
1386
+ const Z = o.value ?? 0;
1387
+ if (F(Z) === "ampm" && (t.value ?? "").length >= 8) {
1388
+ const J = t.value.charAt(6);
1389
+ /[Aa]/.test(J) ? (t.value = `${t.value.slice(0, 6)}AM${t.value.slice(8)}`, B(() => {
1185
1390
  requestAnimationFrame(() => {
1186
- const B = document.getElementById(
1391
+ const K = document.getElementById(
1187
1392
  e.id
1188
1393
  );
1189
- B && (B.focus(), B.setSelectionRange(8, 8));
1394
+ K && (K.focus(), K.setSelectionRange(8, 8));
1190
1395
  });
1191
- })) : /[Pp]/.test(X) && (t.value = `${t.value.slice(0, 6)}PM${t.value.slice(8)}`, j(() => {
1396
+ })) : /[Pp]/.test(J) && (t.value = `${t.value.slice(0, 6)}PM${t.value.slice(8)}`, B(() => {
1192
1397
  requestAnimationFrame(() => {
1193
- const B = document.getElementById(
1398
+ const K = document.getElementById(
1194
1399
  e.id
1195
1400
  );
1196
- B && (B.focus(), B.setSelectionRange(8, 8));
1401
+ K && (K.focus(), K.setSelectionRange(8, 8));
1197
1402
  });
1198
1403
  }));
1199
1404
  }
1200
1405
  } catch {
1201
1406
  }
1202
- Z(i);
1203
- }, p = (r) => {
1204
- l.value = r.target.selectionStart ?? 0;
1205
- }, k = (r, i, P) => {
1206
- const O = i?.selectionStart ?? l.value ?? 0;
1207
- l.value = O;
1208
- const H = L(O), X = (t.value ?? "").match(/^(\d{2}):(\d{2})\s([AP]M)$/i);
1209
- if (!X) {
1210
- if ((t.value ?? "").length === 0 || E.value.length === 0) {
1211
- const s = /* @__PURE__ */ new Date(), h = s.getHours(), $ = h >= 12 ? "PM" : "AM";
1212
- t.value = q(h, s.getMinutes(), $);
1213
- const ne = _(t.value);
1214
- c(ne, P), j(() => {
1407
+ G(i);
1408
+ }, p = (a) => {
1409
+ o.value = a.target.selectionStart ?? 0;
1410
+ }, D = (a, i, V) => {
1411
+ const O = i?.selectionStart ?? o.value ?? 0;
1412
+ o.value = O;
1413
+ const Z = F(O), J = (t.value ?? "").match(/^(\d{2}):(\d{2})\s([AP]M)$/i);
1414
+ if (!J) {
1415
+ if ((t.value ?? "").length === 0 || M.value.length === 0) {
1416
+ const u = /* @__PURE__ */ new Date(), S = u.getHours(), P = S >= 12 ? "PM" : "AM";
1417
+ t.value = L(S, u.getMinutes(), P);
1418
+ const ne = W(t.value);
1419
+ c(ne, V), B(() => {
1215
1420
  requestAnimationFrame(() => {
1216
- const re = document.getElementById(
1421
+ const ae = document.getElementById(
1217
1422
  e.id
1218
- ), ce = l.value ?? 0;
1219
- re && (re.focus(), re.setSelectionRange(ce, ce));
1423
+ ), ce = o.value ?? 0;
1424
+ ae && (ae.focus(), ae.setSelectionRange(ce, ce));
1220
1425
  });
1221
1426
  });
1222
1427
  }
1223
1428
  return;
1224
1429
  }
1225
- let B = parseInt(X[1]), J = parseInt(X[2]), ye = X[3].toUpperCase();
1226
- if (H === "hh")
1227
- r === "ArrowUp" ? B = B < 12 ? B + 1 : 1 : B = B > 1 ? B - 1 : 12;
1228
- else if (H === "mm") {
1229
- const s = e.minuteStepRef?.value ?? e.minuteStep ?? 1;
1230
- if (s === 1)
1231
- r === "ArrowUp" ? J = J < 59 ? J + 1 : 0 : J = J > 0 ? J - 1 : 59;
1232
- else if (r === "ArrowUp") {
1233
- const h = J % s;
1234
- let $ = h === 0 ? J + s : J + (s - h);
1235
- $ >= 60 && ($ = 0), J = $;
1430
+ let K = parseInt(J[1]), X = parseInt(J[2]), ye = J[3].toUpperCase();
1431
+ if (Z === "hh")
1432
+ a === "ArrowUp" ? K = K < 12 ? K + 1 : 1 : K = K > 1 ? K - 1 : 12;
1433
+ else if (Z === "mm") {
1434
+ const u = e.minuteStepRef?.value ?? e.minuteStep ?? 1;
1435
+ if (u === 1)
1436
+ a === "ArrowUp" ? X = X < 59 ? X + 1 : 0 : X = X > 0 ? X - 1 : 59;
1437
+ else if (a === "ArrowUp") {
1438
+ const S = X % u;
1439
+ let P = S === 0 ? X + u : X + (u - S);
1440
+ P >= 60 && (P = 0), X = P;
1236
1441
  } else {
1237
- const h = J % s;
1238
- let $ = h === 0 ? J - s : J - h;
1239
- $ < 0 && ($ = 60 - s), J = $;
1442
+ const S = X % u;
1443
+ let P = S === 0 ? X - u : X - S;
1444
+ P < 0 && (P = 60 - u), X = P;
1240
1445
  }
1241
- } else H === "ampm" && (ye = ye === "AM" ? "PM" : "AM");
1242
- t.value = `${String(B).padStart(2, "0")}:${String(J).padStart(
1446
+ } else Z === "ampm" && (ye = ye === "AM" ? "PM" : "AM");
1447
+ t.value = `${String(K).padStart(2, "0")}:${String(X).padStart(
1243
1448
  2,
1244
1449
  "0"
1245
1450
  )} ${ye}`;
1246
- const n = _(t.value);
1247
- c(n, P), j(() => {
1451
+ const n = W(t.value);
1452
+ c(n, V), B(() => {
1248
1453
  requestAnimationFrame(() => {
1249
- const s = document.getElementById(
1454
+ const u = document.getElementById(
1250
1455
  e.id
1251
- ), h = l.value ?? 0;
1252
- s && (s.focus(), s.setSelectionRange(h, h));
1456
+ ), S = o.value ?? 0;
1457
+ u && (u.focus(), u.setSelectionRange(S, S));
1253
1458
  });
1254
1459
  });
1255
- }, V = (r) => {
1256
- if (r.code === "Space" || r.key === " ") {
1257
- r.preventDefault(), r.stopPropagation(), e.onShowPicker(r);
1460
+ }, q = (a) => {
1461
+ if (a.code === "Space" || a.key === " ") {
1462
+ a.preventDefault(), a.stopPropagation(), e.onShowPicker(a);
1258
1463
  return;
1259
1464
  }
1260
- if (r.key === "ArrowDown" && r.altKey) {
1261
- r.preventDefault(), r.stopPropagation(), e.onShowPicker(r);
1465
+ if (a.key === "ArrowDown" && a.altKey) {
1466
+ a.preventDefault(), a.stopPropagation(), e.onShowPicker(a);
1262
1467
  return;
1263
1468
  }
1264
- if (D.includes(r.key)) {
1265
- if (r.altKey) return;
1266
- r.preventDefault(), r.stopPropagation();
1267
- const i = r.target;
1268
- k(r.key, i, r);
1469
+ if (A.includes(a.key)) {
1470
+ if (a.altKey) return;
1471
+ a.preventDefault(), a.stopPropagation();
1472
+ const i = a.target;
1473
+ D(a.key, i, a);
1269
1474
  return;
1270
1475
  }
1271
- }, W = (r) => {
1272
- r.preventDefault();
1273
- const i = r.deltaY < 0 ? "ArrowUp" : "ArrowDown";
1274
- k(i, r.target, r);
1275
- }, a = (r) => {
1276
- const i = r.target;
1277
- if (x.includes(r.key)) {
1278
- l.value = i?.selectionStart ?? 0;
1476
+ }, Y = (a) => {
1477
+ a.preventDefault();
1478
+ const i = a.deltaY < 0 ? "ArrowUp" : "ArrowDown";
1479
+ D(i, a.target, a);
1480
+ }, r = (a) => {
1481
+ const i = a.target;
1482
+ if (E.includes(a.key)) {
1483
+ o.value = i?.selectionStart ?? 0;
1279
1484
  return;
1280
1485
  }
1281
- if (D.includes(r.key)) {
1282
- if (r.altKey) return;
1283
- l.value = i?.selectionStart ?? 0;
1486
+ if (A.includes(a.key)) {
1487
+ if (a.altKey) return;
1488
+ o.value = i?.selectionStart ?? 0;
1284
1489
  }
1285
- }, f = (r) => {
1286
- T.value = !0, I.value && e.externalValue && e.externalValue.value === void 0 && E.value.length === 0 && (e.externalValue.value = "");
1287
- const i = r.target;
1288
- i && (l.value = i.selectionStart ?? 0);
1490
+ }, f = (a) => {
1491
+ w.value = !0, C.value && e.externalValue && e.externalValue.value === void 0 && M.value.length === 0 && (e.externalValue.value = "");
1492
+ const i = a.target;
1493
+ i && (o.value = i.selectionStart ?? 0);
1289
1494
  };
1290
- e.externalValue && ge(
1495
+ e.externalValue && fe(
1291
1496
  e.externalValue,
1292
- (r) => {
1293
- if (r) {
1294
- const i = new Date(r);
1497
+ (a) => {
1498
+ if (a) {
1499
+ const i = new Date(a);
1295
1500
  if (i.toString() !== "Invalid Date") {
1296
- const P = i.getHours(), O = P >= 12 ? "PM" : "AM";
1297
- t.value = q(P, i.getMinutes(), O);
1501
+ const V = i.getHours(), O = V >= 12 ? "PM" : "AM";
1502
+ t.value = L(V, i.getMinutes(), O);
1298
1503
  return;
1299
1504
  }
1300
1505
  }
1301
1506
  },
1302
1507
  { immediate: !0 }
1303
1508
  );
1304
- const y = g(() => [
1509
+ const h = m(() => [
1305
1510
  ["Time", t.value || "--:-- --"],
1306
1511
  ["Hour (12h)", b.value],
1307
1512
  ["Hour (24h)", R.value],
1308
- ["Minute", m.value],
1309
- ["Period", M.value],
1513
+ ["Minute", v.value],
1514
+ ["Period", $.value],
1310
1515
  ["Time (24h)", d.value ?? "--:--:--"],
1311
- ["Digits only", E.value],
1516
+ ["Digits only", M.value],
1312
1517
  [
1313
1518
  "Parsed Date",
1314
1519
  U.value?.toLocaleDateString("en-US", {
@@ -1330,313 +1535,314 @@ function lt(e) {
1330
1535
  minute: "2-digit"
1331
1536
  }) ?? null
1332
1537
  ],
1333
- ["valid", K.value],
1334
- ["reason", N.value],
1335
- ["validationMessage", Q.value]
1336
- ]), U = g(
1337
- () => _(t.value) ?? null
1338
- ), K = g(() => {
1339
- if (!I.value) {
1340
- if (!S.value) return !0;
1538
+ ["valid", z.value],
1539
+ ["reason", H.value],
1540
+ ["validationMessage", te.value]
1541
+ ]), U = m(
1542
+ () => W(t.value) ?? null
1543
+ ), z = m(() => {
1544
+ if (!C.value) {
1545
+ if (!y.value) return !0;
1341
1546
  const i = U.value;
1342
- return i ? te(i) : !1;
1547
+ return i ? ee(i) : !1;
1343
1548
  }
1344
- if (!T.value) return !0;
1345
- const r = U.value;
1346
- return !S.value || !r ? !1 : te(r);
1347
- }), N = g(() => {
1348
- if (!I.value) {
1349
- if (!S.value) return;
1549
+ if (!w.value) return !0;
1550
+ const a = U.value;
1551
+ return !y.value || !a ? !1 : ee(a);
1552
+ }), H = m(() => {
1553
+ if (!C.value) {
1554
+ if (!y.value) return;
1350
1555
  const i = U.value;
1351
- return i ? te(i) ? "valid" : "out-of-bounds" : "invalid-time";
1556
+ return i ? ee(i) ? "valid" : "out-of-bounds" : "invalid-time";
1352
1557
  }
1353
- if (!T.value) return;
1354
- if (E.value.length === 0 || !S.value)
1558
+ if (!w.value) return;
1559
+ if (M.value.length === 0 || !y.value)
1355
1560
  return "incomplete";
1356
- const r = U.value;
1357
- return r ? te(r) ? "valid" : "out-of-bounds" : "invalid-time";
1358
- }), Q = g(() => {
1359
- const r = N.value;
1360
- if (!r || r === "valid") return "";
1361
- if (r === "incomplete")
1561
+ const a = U.value;
1562
+ return a ? ee(a) ? "valid" : "out-of-bounds" : "invalid-time";
1563
+ }), te = m(() => {
1564
+ const a = H.value;
1565
+ if (!a || a === "valid") return "";
1566
+ if (a === "incomplete")
1362
1567
  return "Required";
1363
- if (r === "invalid-time")
1364
- return `Must be in ${C.value} format.`;
1568
+ if (a === "invalid-time")
1569
+ return `Must be in ${I.value} format.`;
1365
1570
  const i = {
1366
1571
  hour: "2-digit",
1367
1572
  minute: "2-digit"
1368
- }, P = e.min ? e.min.toLocaleTimeString("en-US", i) : null, O = e.max ? e.max.toLocaleTimeString("en-US", i) : null;
1369
- if (r === "out-of-bounds") {
1370
- if (P && O) return `Must be between ${P} and ${O}.`;
1371
- if (P) return `Must be ${P} or later.`;
1573
+ }, V = e.min ? e.min.toLocaleTimeString("en-US", i) : null, O = e.max ? e.max.toLocaleTimeString("en-US", i) : null;
1574
+ if (a === "out-of-bounds") {
1575
+ if (V && O) return `Must be between ${V} and ${O}.`;
1576
+ if (V) return `Must be ${V} or later.`;
1372
1577
  if (O) return `Must be ${O} or earlier.`;
1373
1578
  }
1374
1579
  return "";
1375
- }), ue = () => {
1376
- j(() => {
1377
- const r = document.getElementById(e.id);
1378
- if (!r) {
1580
+ }), se = () => {
1581
+ B(() => {
1582
+ const a = document.getElementById(e.id);
1583
+ if (!a) {
1379
1584
  console.warn(`#${e.id} not found for styling.`);
1380
1585
  return;
1381
1586
  }
1382
- const i = r.closest(".k-timepicker");
1587
+ const i = a.closest(".k-timepicker");
1383
1588
  if (!i) {
1384
1589
  console.warn(
1385
1590
  `.k-timepicker parent of #${e.id} not found for styling.`
1386
1591
  );
1387
1592
  return;
1388
1593
  }
1389
- const P = i.parentElement;
1390
- if (!P) {
1594
+ const V = i.parentElement;
1595
+ if (!V) {
1391
1596
  console.warn(
1392
1597
  `Parent of .k-timepicker not found for #${e.id} styling.`
1393
1598
  );
1394
1599
  return;
1395
1600
  }
1396
- P.classList.contains("fk-timepicker") || P.classList.add("fk-timepicker");
1601
+ V.classList.contains("fk-timepicker") || V.classList.add("fk-timepicker");
1397
1602
  });
1398
1603
  };
1399
- return xe(() => {
1400
- ue();
1604
+ return Me(() => {
1605
+ se();
1401
1606
  }), {
1402
1607
  raw: t,
1403
- rules: A,
1404
- debugEnabled: F,
1405
- debugLines: y,
1406
- placeholder: C,
1407
- isValid: K,
1408
- reason: z(N),
1409
- validationMessage: Q,
1410
- isComplete: S,
1411
- inRangeTime: te,
1412
- cursorPos: l,
1413
- hour: z(b),
1414
- hour24: z(R),
1415
- minute: z(m),
1416
- period: z(M),
1417
- time24: z(d),
1418
- parsedRawTime: z(U),
1419
- handleChange: w,
1420
- handleKeyDown: V,
1421
- handleKeyUp: a,
1608
+ rules: x,
1609
+ debugEnabled: T,
1610
+ debugLines: h,
1611
+ placeholder: I,
1612
+ isValid: z,
1613
+ reason: _(H),
1614
+ validationMessage: te,
1615
+ isComplete: y,
1616
+ inRangeTime: ee,
1617
+ cursorPos: o,
1618
+ hour: _(b),
1619
+ hour24: _(R),
1620
+ minute: _(v),
1621
+ period: _($),
1622
+ time24: _(d),
1623
+ parsedRawTime: _(U),
1624
+ handleChange: k,
1625
+ handleKeyDown: q,
1626
+ handleKeyUp: r,
1422
1627
  handleClick: p,
1423
- handleWheel: W,
1628
+ handleWheel: Y,
1424
1629
  handleBlur: f,
1425
1630
  // Expose so consumers can reapply theming when Kendo updates DOM
1426
- initStyling: ue
1631
+ initStyling: se
1427
1632
  };
1428
1633
  }
1429
- function je(e) {
1430
- return Le() ? (Re(e), !0) : !1;
1634
+ function et(e) {
1635
+ return Le() ? (qe(e), !0) : !1;
1431
1636
  }
1432
- const Ie = typeof window < "u" && typeof document < "u";
1637
+ const Te = typeof window < "u" && typeof document < "u";
1433
1638
  typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
1434
- const Ge = Object.prototype.toString, We = (e) => Ge.call(e) === "[object Object]", ve = () => {
1435
- }, ze = /* @__PURE__ */ _e();
1436
- function _e() {
1639
+ const tt = Object.prototype.toString, nt = (e) => tt.call(e) === "[object Object]", ge = () => {
1640
+ }, at = /* @__PURE__ */ rt();
1641
+ function rt() {
1437
1642
  var e, t;
1438
- return Ie && ((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));
1643
+ return Te && ((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));
1439
1644
  }
1440
- function Ae(e) {
1645
+ function Ee(e) {
1441
1646
  return Array.isArray(e) ? e : [e];
1442
1647
  }
1443
- function Ze(e, t, l) {
1444
- return ge(
1648
+ function ot(e, t, o) {
1649
+ return fe(
1445
1650
  e,
1446
1651
  t,
1447
1652
  {
1448
- ...l,
1653
+ ...o,
1449
1654
  immediate: !0
1450
1655
  }
1451
1656
  );
1452
1657
  }
1453
- const Pe = Ie ? window : void 0;
1454
- function Se(e) {
1658
+ const Pe = Te ? window : void 0;
1659
+ function be(e) {
1455
1660
  var t;
1456
- const l = ie(e);
1457
- return (t = l?.$el) != null ? t : l;
1661
+ const o = ie(e);
1662
+ return (t = o?.$el) != null ? t : o;
1458
1663
  }
1459
- function Ee(...e) {
1460
- const t = [], l = () => {
1461
- t.forEach((D) => D()), t.length = 0;
1462
- }, F = (D, x, E, A) => (D.addEventListener(x, E, A), () => D.removeEventListener(x, E, A)), C = g(() => {
1463
- const D = Ae(ie(e[0])).filter((x) => x != null);
1464
- return D.every((x) => typeof x != "string") ? D : void 0;
1465
- }), I = Ze(
1664
+ function xe(...e) {
1665
+ const t = [], o = () => {
1666
+ t.forEach((A) => A()), t.length = 0;
1667
+ }, T = (A, E, M, x) => (A.addEventListener(E, M, x), () => A.removeEventListener(E, M, x)), I = m(() => {
1668
+ const A = Ee(ie(e[0])).filter((E) => E != null);
1669
+ return A.every((E) => typeof E != "string") ? A : void 0;
1670
+ }), C = ot(
1466
1671
  () => {
1467
- var D, x;
1672
+ var A, E;
1468
1673
  return [
1469
- (x = (D = C.value) == null ? void 0 : D.map((E) => Se(E))) != null ? x : [Pe].filter((E) => E != null),
1470
- Ae(ie(C.value ? e[1] : e[0])),
1471
- Ae(qe(C.value ? e[2] : e[1])),
1674
+ (E = (A = I.value) == null ? void 0 : A.map((M) => be(M))) != null ? E : [Pe].filter((M) => M != null),
1675
+ Ee(ie(I.value ? e[1] : e[0])),
1676
+ Ee(Oe(I.value ? e[2] : e[1])),
1472
1677
  // @ts-expect-error - TypeScript gets the correct types, but somehow still complains
1473
- ie(C.value ? e[3] : e[2])
1678
+ ie(I.value ? e[3] : e[2])
1474
1679
  ];
1475
1680
  },
1476
- ([D, x, E, A]) => {
1477
- if (l(), !D?.length || !x?.length || !E?.length)
1681
+ ([A, E, M, x]) => {
1682
+ if (o(), !A?.length || !E?.length || !M?.length)
1478
1683
  return;
1479
- const L = We(A) ? { ...A } : A;
1684
+ const F = nt(x) ? { ...x } : x;
1480
1685
  t.push(
1481
- ...D.flatMap(
1482
- (b) => x.flatMap(
1483
- (m) => E.map((M) => F(b, m, M, L))
1686
+ ...A.flatMap(
1687
+ (b) => E.flatMap(
1688
+ (v) => M.map(($) => T(b, v, $, F))
1484
1689
  )
1485
1690
  )
1486
1691
  );
1487
1692
  },
1488
1693
  { flush: "post" }
1489
- ), T = () => {
1490
- I(), l();
1694
+ ), w = () => {
1695
+ C(), o();
1491
1696
  };
1492
- return je(l), T;
1697
+ return et(o), w;
1493
1698
  }
1494
- let $e = !1;
1495
- function Xe(e, t, l = {}) {
1496
- const { window: F = Pe, ignore: C = [], capture: I = !0, detectIframe: T = !1, controls: D = !1 } = l;
1497
- if (!F)
1498
- return D ? { stop: ve, cancel: ve, trigger: ve } : ve;
1499
- if (ze && !$e) {
1500
- $e = !0;
1699
+ let Ce = !1;
1700
+ function lt(e, t, o = {}) {
1701
+ const { window: T = Pe, ignore: I = [], capture: C = !0, detectIframe: w = !1, controls: A = !1 } = o;
1702
+ if (!T)
1703
+ return A ? { stop: ge, cancel: ge, trigger: ge } : ge;
1704
+ if (at && !Ce) {
1705
+ Ce = !0;
1501
1706
  const d = { passive: !0 };
1502
- Array.from(F.document.body.children).forEach((S) => S.addEventListener("click", ve, d)), F.document.documentElement.addEventListener("click", ve, d);
1707
+ Array.from(T.document.body.children).forEach((y) => y.addEventListener("click", ge, d)), T.document.documentElement.addEventListener("click", ge, d);
1503
1708
  }
1504
- let x = !0;
1505
- const E = (d) => ie(C).some((S) => {
1506
- if (typeof S == "string")
1507
- return Array.from(F.document.querySelectorAll(S)).some((q) => q === d.target || d.composedPath().includes(q));
1709
+ let E = !0;
1710
+ const M = (d) => ie(I).some((y) => {
1711
+ if (typeof y == "string")
1712
+ return Array.from(T.document.querySelectorAll(y)).some((L) => L === d.target || d.composedPath().includes(L));
1508
1713
  {
1509
- const q = Se(S);
1510
- return q && (d.target === q || d.composedPath().includes(q));
1714
+ const L = be(y);
1715
+ return L && (d.target === L || d.composedPath().includes(L));
1511
1716
  }
1512
1717
  });
1513
- function A(d) {
1514
- const S = ie(d);
1515
- return S && S.$.subTree.shapeFlag === 16;
1718
+ function x(d) {
1719
+ const y = ie(d);
1720
+ return y && y.$.subTree.shapeFlag === 16;
1516
1721
  }
1517
- function L(d, S) {
1518
- const q = ie(d), _ = q.$.subTree && q.$.subTree.children;
1519
- return _ == null || !Array.isArray(_) ? !1 : _.some((Z) => Z.el === S.target || S.composedPath().includes(Z.el));
1722
+ function F(d, y) {
1723
+ const L = ie(d), W = L.$.subTree && L.$.subTree.children;
1724
+ return W == null || !Array.isArray(W) ? !1 : W.some((G) => G.el === y.target || y.composedPath().includes(G.el));
1520
1725
  }
1521
1726
  const b = (d) => {
1522
- const S = Se(e);
1523
- if (d.target != null && !(!(S instanceof Element) && A(e) && L(e, d)) && !(!S || S === d.target || d.composedPath().includes(S))) {
1524
- if ("detail" in d && d.detail === 0 && (x = !E(d)), !x) {
1525
- x = !0;
1727
+ const y = be(e);
1728
+ if (d.target != null && !(!(y instanceof Element) && x(e) && F(e, d)) && !(!y || y === d.target || d.composedPath().includes(y))) {
1729
+ if ("detail" in d && d.detail === 0 && (E = !M(d)), !E) {
1730
+ E = !0;
1526
1731
  return;
1527
1732
  }
1528
1733
  t(d);
1529
1734
  }
1530
1735
  };
1531
- let m = !1;
1532
- const M = [
1533
- Ee(F, "click", (d) => {
1534
- m || (m = !0, setTimeout(() => {
1535
- m = !1;
1736
+ let v = !1;
1737
+ const $ = [
1738
+ xe(T, "click", (d) => {
1739
+ v || (v = !0, setTimeout(() => {
1740
+ v = !1;
1536
1741
  }, 0), b(d));
1537
- }, { passive: !0, capture: I }),
1538
- Ee(F, "pointerdown", (d) => {
1539
- const S = Se(e);
1540
- x = !E(d) && !!(S && !d.composedPath().includes(S));
1742
+ }, { passive: !0, capture: C }),
1743
+ xe(T, "pointerdown", (d) => {
1744
+ const y = be(e);
1745
+ E = !M(d) && !!(y && !d.composedPath().includes(y));
1541
1746
  }, { passive: !0 }),
1542
- T && Ee(F, "blur", (d) => {
1747
+ w && xe(T, "blur", (d) => {
1543
1748
  setTimeout(() => {
1544
- var S;
1545
- const q = Se(e);
1546
- ((S = F.document.activeElement) == null ? void 0 : S.tagName) === "IFRAME" && !q?.contains(F.document.activeElement) && t(d);
1749
+ var y;
1750
+ const L = be(e);
1751
+ ((y = T.document.activeElement) == null ? void 0 : y.tagName) === "IFRAME" && !L?.contains(T.document.activeElement) && t(d);
1547
1752
  }, 0);
1548
1753
  }, { passive: !0 })
1549
- ].filter(Boolean), R = () => M.forEach((d) => d());
1550
- return D ? {
1754
+ ].filter(Boolean), R = () => $.forEach((d) => d());
1755
+ return A ? {
1551
1756
  stop: R,
1552
1757
  cancel: () => {
1553
- x = !1;
1758
+ E = !1;
1554
1759
  },
1555
1760
  trigger: (d) => {
1556
- x = !0, b(d), x = !1;
1761
+ E = !0, b(d), E = !1;
1557
1762
  }
1558
1763
  } : R;
1559
1764
  }
1560
- function it(e) {
1561
- const t = Ve(null), l = [
1765
+ function vt(e) {
1766
+ const t = Ue(null), o = [
1562
1767
  ".k-animation-container .k-popup",
1563
1768
  ".k-popup",
1564
1769
  ".k-timepicker-popup",
1565
1770
  ".k-menu-popup"
1566
- ], F = Array.isArray(e.popupSelector) ? e.popupSelector : [e.popupSelector ?? l].flat(), C = (A) => A ? typeof e.initialFocus == "string" ? A.querySelector(e.initialFocus) ?? A : typeof e.initialFocus == "function" ? e.initialFocus(A) ?? A : A.querySelector(
1771
+ ], T = Array.isArray(e.popupSelector) ? e.popupSelector : [e.popupSelector ?? o].flat(), I = (x) => x ? typeof e.initialFocus == "string" ? x.querySelector(e.initialFocus) ?? x : typeof e.initialFocus == "function" ? e.initialFocus(x) ?? x : x.querySelector(
1567
1772
  'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
1568
- ) ?? A : null, { activate: I, deactivate: T } = Oe(t, {
1773
+ ) ?? x : null, { activate: C, deactivate: w } = Ke(t, {
1569
1774
  escapeDeactivates: !1,
1570
1775
  clickOutsideDeactivates: !1,
1571
1776
  fallbackFocus: () => t.value,
1572
- initialFocus: () => C(t.value),
1777
+ initialFocus: () => I(t.value),
1573
1778
  ...e.focusTrapOptions ?? {}
1574
1779
  });
1575
- let D = null, x = Y(null);
1576
- const E = () => {
1780
+ let A = null, E = N(null);
1781
+ const M = () => {
1577
1782
  if (e.resolvePopupEl) return e.resolvePopupEl();
1578
- const A = (b, m) => {
1579
- const M = Array.from(b.querySelectorAll(m));
1580
- if (!M.length) return null;
1581
- const R = M.filter(
1783
+ const x = (b, v) => {
1784
+ const $ = Array.from(b.querySelectorAll(v));
1785
+ if (!$.length) return null;
1786
+ const R = $.filter(
1582
1787
  (d) => d.offsetParent !== null || d.getClientRects().length > 0
1583
1788
  );
1584
- return R[R.length - 1] ?? M[M.length - 1] ?? null;
1585
- }, L = e.triggerEl?.value?.closest?.(".k-animation-container") ?? document.body;
1586
- for (const b of F) {
1587
- const m = A(L, b);
1588
- if (m) return m;
1789
+ return R[R.length - 1] ?? $[$.length - 1] ?? null;
1790
+ }, F = e.triggerEl?.value?.closest?.(".k-animation-container") ?? document.body;
1791
+ for (const b of T) {
1792
+ const v = x(F, b);
1793
+ if (v) return v;
1589
1794
  }
1590
- for (const b of F) {
1591
- const m = A(document, b);
1592
- if (m) return m;
1795
+ for (const b of T) {
1796
+ const v = x(document, b);
1797
+ if (v) return v;
1593
1798
  }
1594
1799
  return null;
1595
1800
  };
1596
- return Xe(t, (A) => {
1597
- x.value = "outside", e.isOpen.value && e.onRequestClose?.("outside", A);
1598
- }), ge(
1801
+ return lt(t, (x) => {
1802
+ E.value = "outside", e.isOpen.value && e.onRequestClose?.("outside", x);
1803
+ }), fe(
1599
1804
  () => e.isOpen.value,
1600
- (A) => {
1601
- A ? (x.value = null, j(() => {
1602
- const L = E();
1603
- L && (t.value = L, setTimeout(() => I(), 0), D || (D = (b) => {
1604
- b.key === "Escape" && (x.value = "escape", e.isOpen.value && e.onRequestClose?.("escape", b));
1605
- }, document.addEventListener("keydown", D, !0)));
1606
- })) : (T(), D && (document.removeEventListener("keydown", D, !0), D = null), t.value = null, x.value === "outside" && j(() => {
1607
- const L = () => {
1608
- const b = e.triggerEl?.value, m = b?.querySelector("input"), M = document.activeElement;
1609
- M && (M === m || b && b.contains(M)) && (m ?? b)?.blur?.();
1805
+ (x) => {
1806
+ x ? (E.value = null, B(() => {
1807
+ const F = M();
1808
+ F && (t.value = F, setTimeout(() => C(), 0), A || (A = (b) => {
1809
+ b.key === "Escape" && (E.value = "escape", e.isOpen.value && e.onRequestClose?.("escape", b));
1810
+ }, document.addEventListener("keydown", A, !0)));
1811
+ })) : (w(), A && (document.removeEventListener("keydown", A, !0), A = null), t.value = null, E.value === "outside" && B(() => {
1812
+ const F = () => {
1813
+ const b = e.triggerEl?.value, v = b?.querySelector("input"), $ = document.activeElement;
1814
+ $ && ($ === v || b && b.contains($)) && (v ?? b)?.blur?.();
1610
1815
  };
1611
- requestAnimationFrame(() => setTimeout(L, 0));
1612
- }), e.returnFocusToTrigger !== !1 && x.value === "escape" && e.triggerEl?.value && (console.log(
1816
+ requestAnimationFrame(() => setTimeout(F, 0));
1817
+ }), e.returnFocusToTrigger !== !1 && E.value === "escape" && e.triggerEl?.value && (console.log(
1613
1818
  "Returning focus to trigger element:",
1614
1819
  e.triggerEl.value
1615
- ), j(() => {
1616
- const L = () => {
1820
+ ), B(() => {
1821
+ const F = () => {
1617
1822
  const b = e.triggerEl?.value;
1618
1823
  if (!b) return;
1619
1824
  (b.querySelector("input") ?? b)?.focus?.();
1620
1825
  };
1621
- requestAnimationFrame(() => setTimeout(L, 0));
1826
+ requestAnimationFrame(() => setTimeout(F, 0));
1622
1827
  })));
1623
1828
  }
1624
1829
  ), {
1625
1830
  popupRef: t,
1626
- activate: I,
1627
- deactivate: T,
1628
- lastCloseReason: z(x),
1629
- setPopupEl: (A) => t.value = A
1831
+ activate: C,
1832
+ deactivate: w,
1833
+ lastCloseReason: _(E),
1834
+ setPopupEl: (x) => t.value = x
1630
1835
  };
1631
1836
  }
1632
1837
  export {
1633
1838
  Ye as useFieldsetTouchTracker,
1634
- rt as useFieldsetValidationKit,
1635
- et as useGridA11y,
1636
- tt as useGridActiveFilter,
1637
- at as useMaskedDateInput,
1638
- ot as useMaskedDateRangeInput,
1639
- lt as useMaskedTimeInput,
1640
- it as usePopupTrap,
1641
- nt as useZipTextBox
1839
+ je as useFieldsetValidationKit,
1840
+ ut as useGridA11y,
1841
+ ct as useGridActiveFilter,
1842
+ ft as useMaskedDateInput,
1843
+ pt as useMaskedDateRangeInput,
1844
+ mt as useMaskedTimeInput,
1845
+ vt as usePopupTrap,
1846
+ dt as useUSAddress,
1847
+ We as useZipTextBox
1642
1848
  };