@featherk/composables 0.9.8 → 0.10.1

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