@featherk/composables 0.9.7 → 0.9.8

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