@keenmate/web-daterangepicker 1.0.0-rc01 → 1.0.0-rc08

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,829 +1,1735 @@
1
- var Te = Object.defineProperty;
2
- var Fe = (n, e, t) => e in n ? Te(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
- var _ = (n, e, t) => Fe(n, typeof e != "symbol" ? e + "" : e, t);
4
- const re = Math.min, V = Math.max, U = Math.round, C = (n) => ({
5
- x: n,
6
- y: n
7
- }), Ye = {
1
+ var At = Object.defineProperty;
2
+ var Rt = (e, t, n) => t in e ? At(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
+ var D = (e, t, n) => Rt(e, typeof t != "symbol" ? t + "" : t, n);
4
+ function $t(e) {
5
+ if (e !== "auto")
6
+ return e;
7
+ try {
8
+ const a = new Intl.Locale(navigator.language);
9
+ if ("weekInfo" in a && a.weekInfo && "firstDay" in a.weekInfo) {
10
+ const r = a.weekInfo.firstDay;
11
+ return r === 7 ? 0 : r;
12
+ }
13
+ } catch {
14
+ }
15
+ const t = navigator.language.toLowerCase();
16
+ return [
17
+ "en-us",
18
+ "en-ca",
19
+ // US, Canada
20
+ "ja",
21
+ "ja-jp",
22
+ // Japan
23
+ "he",
24
+ "he-il",
25
+ // Israel
26
+ "ar-sa",
27
+ "ar-ae",
28
+ // Saudi Arabia, UAE
29
+ "ko",
30
+ "ko-kr"
31
+ // South Korea
32
+ ].some((a) => t.startsWith(a)) ? 0 : 1;
33
+ }
34
+ function de(e) {
35
+ if (!e) return null;
36
+ let t;
37
+ return typeof e == "string" ? t = /* @__PURE__ */ new Date(e + "T00:00:00") : t = new Date(e), t.setHours(0, 0, 0, 0), isNaN(t.getTime()) ? null : t;
38
+ }
39
+ function ve(e) {
40
+ const t = e.getFullYear(), n = String(e.getMonth() + 1).padStart(2, "0"), a = String(e.getDate()).padStart(2, "0");
41
+ return `${t}-${n}-${a}`;
42
+ }
43
+ function Pt(e, t, n, a, r, o) {
44
+ const s = ve(e), i = e.getDay();
45
+ return !!(t && e < t || n && e > n || r && r.includes(i) || a.has(s) || o && o(e));
46
+ }
47
+ function kt(e, t) {
48
+ for (let n = 0; n < 12; n++) {
49
+ const a = new Date(t, n + 1, 0).getDate();
50
+ for (let r = 1; r <= a; r++) {
51
+ const o = new Date(t, n, r);
52
+ if (!e.isDateDisabledInternal(o))
53
+ return !0;
54
+ }
55
+ }
56
+ return !1;
57
+ }
58
+ function Tt(e, t, n) {
59
+ const a = new Date(e), r = new Date(t);
60
+ a.setHours(0, 0, 0, 0), r.setHours(0, 0, 0, 0);
61
+ const o = new Date(a);
62
+ for (; o <= r; ) {
63
+ if (n(o))
64
+ return !0;
65
+ o.setDate(o.getDate() + 1);
66
+ }
67
+ return !1;
68
+ }
69
+ function zt(e, t, n) {
70
+ const a = [], r = new Date(e), o = new Date(t);
71
+ r.setHours(0, 0, 0, 0), o.setHours(0, 0, 0, 0);
72
+ const s = new Date(r);
73
+ for (; s <= o; )
74
+ n(s) || a.push(new Date(s)), s.setDate(s.getDate() + 1);
75
+ return a;
76
+ }
77
+ function Ft(e, t, n) {
78
+ const a = [], r = new Date(e), o = new Date(t);
79
+ r.setHours(0, 0, 0, 0), o.setHours(0, 0, 0, 0);
80
+ const s = new Date(r);
81
+ for (; s <= o; )
82
+ n(s) && a.push(new Date(s)), s.setDate(s.getDate() + 1);
83
+ return a;
84
+ }
85
+ function Nt(e, t, n) {
86
+ const a = new Date(e), r = new Date(t);
87
+ a.setHours(0, 0, 0, 0), r.setHours(0, 0, 0, 0);
88
+ let o = new Date(a);
89
+ const s = new Date(a);
90
+ for (s.setDate(s.getDate() + 1); s <= r; ) {
91
+ if (n(s))
92
+ return o;
93
+ o = new Date(s), s.setDate(s.getDate() + 1);
94
+ }
95
+ return r;
96
+ }
97
+ function Ot(e, t, n) {
98
+ const a = [], r = new Date(e), o = new Date(t);
99
+ r.setHours(0, 0, 0, 0), o.setHours(0, 0, 0, 0);
100
+ let s = null;
101
+ const i = new Date(r);
102
+ for (; i <= o; ) {
103
+ if (!n(i))
104
+ s || (s = new Date(i));
105
+ else if (s) {
106
+ const d = new Date(i);
107
+ d.setDate(d.getDate() - 1), a.push({ start: s, end: d }), s = null;
108
+ }
109
+ i.setDate(i.getDate() + 1);
110
+ }
111
+ return s && a.push({ start: s, end: new Date(o) }), a;
112
+ }
113
+ function Ht(e) {
114
+ return Je(e, /* @__PURE__ */ new Date());
115
+ }
116
+ function Je(e, t) {
117
+ return !e || !t ? !1 : e.getFullYear() === t.getFullYear() && e.getMonth() === t.getMonth() && e.getDate() === t.getDate();
118
+ }
119
+ function Yt(e, t, n) {
120
+ return !t || !n ? !1 : e > t && e < n;
121
+ }
122
+ var Qe = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
123
+ function Ze(e) {
124
+ return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
125
+ }
126
+ var et = { exports: {} };
127
+ (function(e) {
128
+ (function(t, n) {
129
+ e.exports ? e.exports = n() : t.log = n();
130
+ })(Qe, function() {
131
+ var t = function() {
132
+ }, n = "undefined", a = typeof window !== n && typeof window.navigator !== n && /Trident\/|MSIE /.test(window.navigator.userAgent), r = [
133
+ "trace",
134
+ "debug",
135
+ "info",
136
+ "warn",
137
+ "error"
138
+ ], o = {}, s = null;
139
+ function i(f, y) {
140
+ var m = f[y];
141
+ if (typeof m.bind == "function")
142
+ return m.bind(f);
143
+ try {
144
+ return Function.prototype.bind.call(m, f);
145
+ } catch {
146
+ return function() {
147
+ return Function.prototype.apply.apply(m, [f, arguments]);
148
+ };
149
+ }
150
+ }
151
+ function d() {
152
+ console.log && (console.log.apply ? console.log.apply(console, arguments) : Function.prototype.apply.apply(console.log, [console, arguments])), console.trace && console.trace();
153
+ }
154
+ function l(f) {
155
+ return f === "debug" && (f = "log"), typeof console === n ? !1 : f === "trace" && a ? d : console[f] !== void 0 ? i(console, f) : console.log !== void 0 ? i(console, "log") : t;
156
+ }
157
+ function c() {
158
+ for (var f = this.getLevel(), y = 0; y < r.length; y++) {
159
+ var m = r[y];
160
+ this[m] = y < f ? t : this.methodFactory(m, f, this.name);
161
+ }
162
+ if (this.log = this.debug, typeof console === n && f < this.levels.SILENT)
163
+ return "No console available for logging";
164
+ }
165
+ function u(f) {
166
+ return function() {
167
+ typeof console !== n && (c.call(this), this[f].apply(this, arguments));
168
+ };
169
+ }
170
+ function p(f, y, m) {
171
+ return l(f) || u.apply(this, arguments);
172
+ }
173
+ function g(f, y) {
174
+ var m = this, x, M, I, b = "loglevel";
175
+ typeof f == "string" ? b += ":" + f : typeof f == "symbol" && (b = void 0);
176
+ function v(S) {
177
+ var E = (r[S] || "silent").toUpperCase();
178
+ if (!(typeof window === n || !b)) {
179
+ try {
180
+ window.localStorage[b] = E;
181
+ return;
182
+ } catch {
183
+ }
184
+ try {
185
+ window.document.cookie = encodeURIComponent(b) + "=" + E + ";";
186
+ } catch {
187
+ }
188
+ }
189
+ }
190
+ function L() {
191
+ var S;
192
+ if (!(typeof window === n || !b)) {
193
+ try {
194
+ S = window.localStorage[b];
195
+ } catch {
196
+ }
197
+ if (typeof S === n)
198
+ try {
199
+ var E = window.document.cookie, P = encodeURIComponent(b), R = E.indexOf(P + "=");
200
+ R !== -1 && (S = /^([^;]+)/.exec(
201
+ E.slice(R + P.length + 1)
202
+ )[1]);
203
+ } catch {
204
+ }
205
+ return m.levels[S] === void 0 && (S = void 0), S;
206
+ }
207
+ }
208
+ function A() {
209
+ if (!(typeof window === n || !b)) {
210
+ try {
211
+ window.localStorage.removeItem(b);
212
+ } catch {
213
+ }
214
+ try {
215
+ window.document.cookie = encodeURIComponent(b) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC";
216
+ } catch {
217
+ }
218
+ }
219
+ }
220
+ function w(S) {
221
+ var E = S;
222
+ if (typeof E == "string" && m.levels[E.toUpperCase()] !== void 0 && (E = m.levels[E.toUpperCase()]), typeof E == "number" && E >= 0 && E <= m.levels.SILENT)
223
+ return E;
224
+ throw new TypeError("log.setLevel() called with invalid level: " + S);
225
+ }
226
+ m.name = f, m.levels = {
227
+ TRACE: 0,
228
+ DEBUG: 1,
229
+ INFO: 2,
230
+ WARN: 3,
231
+ ERROR: 4,
232
+ SILENT: 5
233
+ }, m.methodFactory = y || p, m.getLevel = function() {
234
+ return I ?? M ?? x;
235
+ }, m.setLevel = function(S, E) {
236
+ return I = w(S), E !== !1 && v(I), c.call(m);
237
+ }, m.setDefaultLevel = function(S) {
238
+ M = w(S), L() || m.setLevel(S, !1);
239
+ }, m.resetLevel = function() {
240
+ I = null, A(), c.call(m);
241
+ }, m.enableAll = function(S) {
242
+ m.setLevel(m.levels.TRACE, S);
243
+ }, m.disableAll = function(S) {
244
+ m.setLevel(m.levels.SILENT, S);
245
+ }, m.rebuild = function() {
246
+ if (s !== m && (x = w(s.getLevel())), c.call(m), s === m)
247
+ for (var S in o)
248
+ o[S].rebuild();
249
+ }, x = w(
250
+ s ? s.getLevel() : "WARN"
251
+ );
252
+ var _ = L();
253
+ _ != null && (I = w(_)), c.call(m);
254
+ }
255
+ s = new g(), s.getLogger = function(y) {
256
+ if (typeof y != "symbol" && typeof y != "string" || y === "")
257
+ throw new TypeError("You must supply a name when creating a logger.");
258
+ var m = o[y];
259
+ return m || (m = o[y] = new g(
260
+ y,
261
+ s.methodFactory
262
+ )), m;
263
+ };
264
+ var h = typeof window !== n ? window.log : void 0;
265
+ return s.noConflict = function() {
266
+ return typeof window !== n && window.log === s && (window.log = h), s;
267
+ }, s.getLoggers = function() {
268
+ return o;
269
+ }, s.default = s, s;
270
+ });
271
+ })(et);
272
+ var Vt = et.exports;
273
+ const k = /* @__PURE__ */ Ze(Vt);
274
+ var tt = { exports: {} };
275
+ (function(e) {
276
+ (function(t, n) {
277
+ e.exports ? e.exports = n() : t.prefix = n(t);
278
+ })(Qe, function(t) {
279
+ var n = function(c) {
280
+ for (var u = 1, p = arguments.length, g; u < p; u++)
281
+ for (g in arguments[u])
282
+ Object.prototype.hasOwnProperty.call(arguments[u], g) && (c[g] = arguments[u][g]);
283
+ return c;
284
+ }, a = {
285
+ template: "[%t] %l:",
286
+ levelFormatter: function(c) {
287
+ return c.toUpperCase();
288
+ },
289
+ nameFormatter: function(c) {
290
+ return c || "root";
291
+ },
292
+ timestampFormatter: function(c) {
293
+ return c.toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1");
294
+ },
295
+ format: void 0
296
+ }, r, o = {}, s = function(c) {
297
+ if (!c || !c.getLogger)
298
+ throw new TypeError("Argument is not a root logger");
299
+ r = c;
300
+ }, i = function(c, u) {
301
+ if (!c || !c.setLevel)
302
+ throw new TypeError("Argument is not a logger");
303
+ var p = c.methodFactory, g = c.name || "", h = o[g] || o[""] || a;
304
+ function f(y, m, x) {
305
+ var M = p(y, m, x), I = o[x] || o[""], b = I.template.indexOf("%t") !== -1, v = I.template.indexOf("%l") !== -1, L = I.template.indexOf("%n") !== -1;
306
+ return function() {
307
+ for (var A = "", w = arguments.length, _ = Array(w), S = 0; S < w; S++)
308
+ _[S] = arguments[S];
309
+ if (g || !o[x]) {
310
+ var E = I.timestampFormatter(/* @__PURE__ */ new Date()), P = I.levelFormatter(y), R = I.nameFormatter(x);
311
+ I.format ? A += I.format(P, R, E) : (A += I.template, b && (A = A.replace(/%t/, E)), v && (A = A.replace(/%l/, P)), L && (A = A.replace(/%n/, R))), _.length && typeof _[0] == "string" ? _[0] = A + " " + _[0] : _.unshift(A);
312
+ }
313
+ M.apply(void 0, _);
314
+ };
315
+ }
316
+ return o[g] || (c.methodFactory = f), u = u || {}, u.template && (u.format = void 0), o[g] = n({}, h, u), c.setLevel(c.getLevel()), r || c.warn(
317
+ "It is necessary to call the function reg() of loglevel-plugin-prefix before calling apply. From the next release, it will throw an error. See more: https://github.com/kutuluk/loglevel-plugin-prefix/blob/master/README.md"
318
+ ), c;
319
+ }, d = {
320
+ reg: s,
321
+ apply: i
322
+ }, l;
323
+ return t && (l = t.prefix, d.noConflict = function() {
324
+ return t.prefix === d && (t.prefix = l), d;
325
+ }), d;
326
+ });
327
+ })(tt);
328
+ var qt = tt.exports;
329
+ const K = /* @__PURE__ */ Ze(qt);
330
+ K.reg(k);
331
+ K.apply(k, {
332
+ format(e, t, n) {
333
+ return `[${n}] [${e}] ${t ? `[${t}]` : ""}`;
334
+ },
335
+ timestampFormatter(e) {
336
+ return e.toTimeString().split(" ")[0] + "." + e.getMilliseconds().toString().padStart(3, "0");
337
+ }
338
+ });
339
+ const $ = k.getLogger("INIT"), U = k.getLogger("VALIDATION"), F = k.getLogger("DRAG"), te = k.getLogger("SELECTION"), q = k.getLogger("RENDERING"), B = k.getLogger("UI"), C = k.getLogger("NAVIGATION"), Z = k.getLogger("INTERACTION");
340
+ K.apply($);
341
+ K.apply(U);
342
+ K.apply(F);
343
+ K.apply(te);
344
+ K.apply(q);
345
+ K.apply(B);
346
+ K.apply(C);
347
+ K.apply(Z);
348
+ const X = "silent";
349
+ k.setLevel(X);
350
+ $.setLevel(X);
351
+ U.setLevel(X);
352
+ F.setLevel(X);
353
+ te.setLevel(X);
354
+ q.setLevel(X);
355
+ B.setLevel(X);
356
+ C.setLevel(X);
357
+ Z.setLevel(X);
358
+ const Bt = (e) => {
359
+ const t = e ? "debug" : "silent";
360
+ k.setLevel(t), $.setLevel(t), U.setLevel(t), F.setLevel(t), te.setLevel(t), q.setLevel(t), B.setLevel(t), C.setLevel(t), Z.setLevel(t);
361
+ };
362
+ function Re(e, t, n) {
363
+ for (let a = 1; a <= 31; a++) {
364
+ const r = new Date(t, n, a);
365
+ if (r.getMonth() === n && !e.isDateDisabledInternal(r))
366
+ return !0;
367
+ }
368
+ return !1;
369
+ }
370
+ function Wt(e, t) {
371
+ e.showingRollingSelector[t] = !e.showingRollingSelector[t], e.renderCalendar();
372
+ }
373
+ function jt(e, t, n) {
374
+ const a = e.monthDates[n].getFullYear();
375
+ e.monthDates[n].setFullYear(t), C.debug(`selectYear() Col${n} - changed from ${a} to ${t}`), ue(e, n), e.showingRollingSelector[n] = !1, e.renderCalendar();
376
+ }
377
+ function Kt(e, t, n) {
378
+ const a = e.monthDates[n].getMonth();
379
+ e.monthDates[n].setMonth(t), C.debug(`selectMonth() Col${n} - changed from ${a + 1} to ${t + 1}`), ue(e, n), e.showingRollingSelector[n] = !1, e.renderCalendar();
380
+ }
381
+ function ue(e, t) {
382
+ const n = e.monthDates[t];
383
+ if (t < e.monthDates.length - 1) {
384
+ const a = e.monthDates[t + 1];
385
+ if (be(n, a)) {
386
+ C.debug(`checkAndResolveCollisions() Col${t} - collision with Col${t + 1}, shifting forward`);
387
+ const r = new Date(n.getFullYear(), n.getMonth() + 1, 1);
388
+ e.monthDates[t + 1] = r, ue(e, t + 1);
389
+ }
390
+ }
391
+ if (t > 0) {
392
+ const a = e.monthDates[t - 1];
393
+ if (be(a, n)) {
394
+ C.debug(`checkAndResolveCollisions() Col${t} - collision with Col${t - 1}, shifting backward`);
395
+ const r = new Date(n.getFullYear(), n.getMonth() - 1, 1);
396
+ e.monthDates[t - 1] = r, ue(e, t - 1);
397
+ }
398
+ }
399
+ }
400
+ function be(e, t) {
401
+ const n = e.getFullYear(), a = e.getMonth(), r = t.getFullYear(), o = t.getMonth();
402
+ return n > r || n === r && a >= o;
403
+ }
404
+ function ce(e, t) {
405
+ const n = isNaN(t) ? e.activeMonthIndex : t;
406
+ e.showingRollingSelector[n] && (e.showingRollingSelector[n] = !1);
407
+ const a = e.monthDates[n], r = new Date(a.getFullYear(), a.getMonth() - 1, 1);
408
+ if (e.monthDates[n] = r, C.debug(`prevMonth() Col${n} - changed from ${a.getFullYear()}-${a.getMonth() + 1} to ${r.getFullYear()}-${r.getMonth() + 1}`), n > 0) {
409
+ const o = e.monthDates[n - 1];
410
+ be(o, r) && (C.debug(`prevMonth() Col${n} - collision detected with Col${n - 1}, shifting previous columns back`), ce(e, n - 1));
411
+ }
412
+ e.renderCalendar();
413
+ }
414
+ function pe(e, t) {
415
+ const n = isNaN(t) ? e.activeMonthIndex : t;
416
+ e.showingRollingSelector[n] && (e.showingRollingSelector[n] = !1);
417
+ const a = e.monthDates[n], r = new Date(a.getFullYear(), a.getMonth() + 1, 1);
418
+ if (e.monthDates[n] = r, C.debug(`nextMonth() Col${n} - changed from ${a.getFullYear()}-${a.getMonth() + 1} to ${r.getFullYear()}-${r.getMonth() + 1}`), n < e.monthDates.length - 1) {
419
+ const o = e.monthDates[n + 1];
420
+ be(r, o) && (C.debug(`nextMonth() Col${n} - collision detected with Col${n + 1}, shifting next columns forward`), pe(e, n + 1));
421
+ }
422
+ e.renderCalendar();
423
+ }
424
+ function le(e, t, n, a, r) {
425
+ let o = t, s = 0;
426
+ const i = 60;
427
+ for (; s < i; ) {
428
+ if (o >= 0 && o < a.length) {
429
+ const l = a[o].dataset.date;
430
+ if (l) {
431
+ const [c, u, p] = l.split("-").map(Number), g = new Date(c, u - 1, p);
432
+ if (!e.isDateDisabledInternal(g))
433
+ return { index: o, monthChanged: !1 };
434
+ }
435
+ }
436
+ if (o += n, s++, o < 0 || o >= a.length)
437
+ return { index: null, monthChanged: !0, direction: n > 0 ? "next" : "prev" };
438
+ }
439
+ return { index: null, monthChanged: !1 };
440
+ }
441
+ function Ut(e, t) {
442
+ var s, i, d, l;
443
+ C.debug(`moveFocus(${t}) Col${e.activeMonthIndex} - focusedDayIndex:`, e.focusedDayIndex);
444
+ const n = e.calendar.querySelector(`.drp-date-picker__days[data-month-index="${e.activeMonthIndex}"]`);
445
+ if (!n) {
446
+ C.debug(`moveFocus() Col${e.activeMonthIndex} - ERROR: daysContainer not found!`);
447
+ return;
448
+ }
449
+ const a = n.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)");
450
+ if (C.debug(`moveFocus() Col${e.activeMonthIndex} - found ${a.length} days in column`), a.length === 0) return;
451
+ if (e.focusedDayIndex === null) {
452
+ const c = Array.from(a).findIndex((u) => u.classList.contains("drp-date-picker__day--today"));
453
+ e.focusedDayIndex = c !== -1 ? c : 0, C.debug(`moveFocus() Col${e.activeMonthIndex} - initialized focusedDayIndex to ${e.focusedDayIndex} (today or first day), will move by offset ${t}`);
454
+ }
455
+ (s = a[e.focusedDayIndex]) == null || s.classList.remove("drp-date-picker__day--focused");
456
+ const r = e.focusedDayIndex + t;
457
+ if (r < 0) {
458
+ const c = e.activeMonthIndex;
459
+ if (t === -1)
460
+ C.debug(`moveFocus() Col${c} - edge navigation LEFT: going to last enabled day of prev month`), ce(e, e.activeMonthIndex), setTimeout(() => {
461
+ var h, f;
462
+ const u = e.calendar.querySelector(`.drp-date-picker__month[data-month-index="${c}"] .drp-date-picker__days`);
463
+ if (!u) return;
464
+ const p = u.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)"), g = le(e, p.length - 1, -1, p);
465
+ g.index !== null && (e.focusedDayIndex = g.index, (h = p[e.focusedDayIndex]) == null || h.classList.add("drp-date-picker__day--focused"), (f = p[e.focusedDayIndex]) == null || f.scrollIntoView({ block: "nearest" }));
466
+ }, 0);
467
+ else {
468
+ const p = a[e.focusedDayIndex].dataset.date;
469
+ if (p) {
470
+ const [g, h, f] = p.split("-").map(Number), m = new Date(g, h - 1, f).getDay();
471
+ C.debug(`moveFocus() Col${c} - edge navigation UP: current day ${f} is weekday ${m}, going to prev month`), ce(e, e.activeMonthIndex), setTimeout(() => {
472
+ var v, L;
473
+ const x = e.calendar.querySelector(`.drp-date-picker__month[data-month-index="${c}"] .drp-date-picker__days`);
474
+ if (!x) return;
475
+ const M = x.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)"), b = M[M.length - 1].dataset.date;
476
+ if (b) {
477
+ const [A, w, _] = b.split("-").map(Number), E = new Date(A, w - 1, _).getDay(), P = (E - m + 7) % 7;
478
+ e.focusedDayIndex = M.length - 1 - P, C.debug(`moveFocus() Col${c} - last day weekday ${E}, target ${m}, focusing on day ${e.focusedDayIndex + 1}`), (v = M[e.focusedDayIndex]) == null || v.classList.add("drp-date-picker__day--focused"), (L = M[e.focusedDayIndex]) == null || L.scrollIntoView({ block: "nearest" });
479
+ }
480
+ }, 0);
481
+ }
482
+ }
483
+ return;
484
+ } else if (r >= a.length) {
485
+ const c = e.activeMonthIndex;
486
+ if (t === 1)
487
+ C.debug(`moveFocus() Col${c} - edge navigation RIGHT: going to first enabled day of next month`), pe(e, e.activeMonthIndex), setTimeout(() => {
488
+ var h, f;
489
+ const u = e.calendar.querySelector(`.drp-date-picker__month[data-month-index="${c}"] .drp-date-picker__days`);
490
+ if (!u) return;
491
+ const p = u.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)"), g = le(e, 0, 1, p);
492
+ g.index !== null && (e.focusedDayIndex = g.index, (h = p[e.focusedDayIndex]) == null || h.classList.add("drp-date-picker__day--focused"), (f = p[e.focusedDayIndex]) == null || f.scrollIntoView({ block: "nearest" }));
493
+ }, 0);
494
+ else {
495
+ const p = a[e.focusedDayIndex].dataset.date;
496
+ if (p) {
497
+ const [g, h, f] = p.split("-").map(Number), m = new Date(g, h - 1, f).getDay();
498
+ C.debug(`moveFocus() Col${c} - edge navigation DOWN: current day ${f} is weekday ${m}, going to next month`), pe(e, e.activeMonthIndex), setTimeout(() => {
499
+ var v, L;
500
+ const x = e.calendar.querySelector(`.drp-date-picker__month[data-month-index="${c}"] .drp-date-picker__days`);
501
+ if (!x) return;
502
+ const M = x.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)"), b = M[0].dataset.date;
503
+ if (b) {
504
+ const [A, w, _] = b.split("-").map(Number), E = new Date(A, w - 1, _).getDay(), P = (m - E + 7) % 7;
505
+ e.focusedDayIndex = P, C.debug(`moveFocus() Col${c} - first day weekday ${E}, target ${m}, focusing on day ${e.focusedDayIndex + 1}`), (v = M[e.focusedDayIndex]) == null || v.classList.add("drp-date-picker__day--focused"), (L = M[e.focusedDayIndex]) == null || L.scrollIntoView({ block: "nearest" });
506
+ }
507
+ }, 0);
508
+ }
509
+ }
510
+ return;
511
+ }
512
+ const o = le(e, r, t, a, e.activeMonthIndex);
513
+ if (o.monthChanged) {
514
+ const c = e.activeMonthIndex;
515
+ o.direction === "next" ? pe(e, e.activeMonthIndex) : ce(e, e.activeMonthIndex), setTimeout(() => {
516
+ var h, f;
517
+ const u = e.calendar.querySelector(`.drp-date-picker__month[data-month-index="${c}"] .drp-date-picker__days`);
518
+ if (!u) return;
519
+ const p = u.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)"), g = le(
520
+ e,
521
+ o.direction === "next" ? 0 : p.length - 1,
522
+ t,
523
+ p
524
+ );
525
+ g.index !== null && (e.focusedDayIndex = g.index, (h = p[e.focusedDayIndex]) == null || h.classList.add("drp-date-picker__day--focused"), (f = p[e.focusedDayIndex]) == null || f.scrollIntoView({ block: "nearest" }));
526
+ }, 0);
527
+ return;
528
+ }
529
+ o.index !== null ? (e.focusedDayIndex = o.index, (i = a[e.focusedDayIndex]) == null || i.classList.add("drp-date-picker__day--focused"), (d = a[e.focusedDayIndex]) == null || d.scrollIntoView({ block: "nearest" })) : (C.debug("moveFocus() - no enabled day found in search range"), (l = a[e.focusedDayIndex]) == null || l.classList.add("drp-date-picker__day--focused"));
530
+ }
531
+ function Xt(e, t, n) {
532
+ if (!e) {
533
+ if (n != null && n.normalizedMinDate || n != null && n.normalizedMaxDate) {
534
+ const a = n.normalizedMinDate ? n.normalizedMinDate.getFullYear() : t - 1, r = n.normalizedMaxDate ? n.normalizedMaxDate.getFullYear() : t + 1;
535
+ return { min: a, max: r };
536
+ }
537
+ return { min: t - 1, max: t + 1 };
538
+ }
539
+ if (e.includes("-")) {
540
+ const [a, r] = e.split("-");
541
+ return { min: parseInt(a, 10), max: parseInt(r, 10) };
542
+ } else {
543
+ const a = parseInt(e, 10);
544
+ return { min: a, max: a };
545
+ }
546
+ }
547
+ function Gt(e) {
548
+ if (!e)
549
+ return { min: 1, max: 12 };
550
+ const [t, n] = e.split("-");
551
+ return { min: parseInt(t, 10), max: parseInt(n, 10) };
552
+ }
553
+ function Jt(e) {
554
+ q.debug("[DatePicker 18] renderCalendar called, showingRollingSelector:", e.showingRollingSelector, `activeCol: ${e.activeMonthIndex}`), q.debug("[DatePicker 18] monthDates array:", e.monthDates.map((t, n) => `Col${n}: ${t.getFullYear()}-${t.getMonth() + 1}`).join(", "));
555
+ for (let t = 0; t < e.options.visibleMonthsCount; t++)
556
+ e.showingRollingSelector[t] ? rt(e, t) : nt(e, t);
557
+ if (requestAnimationFrame(() => {
558
+ if (!e.calendarContentHeight && !e.showingRollingSelector[0]) {
559
+ const t = e.calendar.querySelector('.drp-date-picker__month[data-month-index="0"]');
560
+ if (t) {
561
+ const n = t.querySelector(".drp-date-picker__weekdays"), a = t.querySelector(".drp-date-picker__days");
562
+ if (n && a) {
563
+ const r = n.offsetHeight, o = a.offsetHeight, s = a.offsetWidth, i = getComputedStyle(n), d = parseInt(i.marginBottom) || 0;
564
+ e.calendarContentHeight = r + d + o, e.calendarContentWidth = Math.ceil(s), q.debug("[DatePicker] Captured calendar content dimensions:", {
565
+ weekdaysHeight: r,
566
+ weekdaysMargin: d,
567
+ daysHeight: o,
568
+ daysWidth: s,
569
+ totalHeight: e.calendarContentHeight,
570
+ totalWidth: e.calendarContentWidth
571
+ });
572
+ }
573
+ }
574
+ }
575
+ if (e.calendarContentHeight)
576
+ for (let t = 0; t < e.options.visibleMonthsCount; t++) {
577
+ const n = e.calendar.querySelector(`.drp-date-picker__month[data-month-index="${t}"]`);
578
+ if (!n) continue;
579
+ const a = n.querySelector(".drp-date-picker__rolling-selector");
580
+ if (a) {
581
+ const r = a.classList.contains("drp-date-picker__rolling-selector--visible");
582
+ if (a.style.height = `${e.calendarContentHeight}px`, e.calendarContentWidth && (a.style.width = `${e.calendarContentWidth}px`), r) {
583
+ const o = a.offsetHeight, s = a.offsetWidth;
584
+ q.debug(`[DatePicker] Applied dimensions to rolling selector ${t}:`, {
585
+ targetHeight: e.calendarContentHeight,
586
+ actualHeight: o,
587
+ heightDifference: o - e.calendarContentHeight,
588
+ targetWidth: e.calendarContentWidth,
589
+ actualWidth: s,
590
+ widthDifference: s - (e.calendarContentWidth || 0)
591
+ });
592
+ }
593
+ }
594
+ }
595
+ }), e.focusedDayIndex !== null) {
596
+ const t = e.calendar.querySelector(`.drp-date-picker__days[data-month-index="${e.activeMonthIndex}"]`);
597
+ if (t) {
598
+ const n = t.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)");
599
+ n[e.focusedDayIndex] && n[e.focusedDayIndex].classList.add("drp-date-picker__day--focused");
600
+ }
601
+ }
602
+ e.options.selectionMode === "range" && !e.isDragging && e.initDragListeners();
603
+ }
604
+ function nt(e, t) {
605
+ q.debug(`[DatePicker Col${t} 19] renderNormalView called for month`, t);
606
+ const n = e.calendar.querySelector(`.drp-date-picker__month[data-month-index="${t}"]`);
607
+ if (!n) return;
608
+ const a = n.querySelector(".drp-date-picker__rolling-selector");
609
+ a == null || a.classList.remove("drp-date-picker__rolling-selector--visible");
610
+ const r = e.monthDates[t], o = n.querySelector(".drp-date-picker__month-year");
611
+ o && (o.textContent = `${e.monthNames[r.getMonth()]} ${r.getFullYear()}`);
612
+ const s = r.getFullYear(), i = r.getMonth(), d = i === 0 ? 11 : i - 1, l = i === 0 ? s - 1 : s, c = n.querySelector(".drp-date-picker__nav--prev");
613
+ c && (Re(e, l, d) ? (c.removeAttribute("disabled"), c.classList.remove("drp-date-picker__nav--disabled")) : (c.setAttribute("disabled", "true"), c.classList.add("drp-date-picker__nav--disabled")));
614
+ const u = i === 11 ? 0 : i + 1, p = i === 11 ? s + 1 : s, g = n.querySelector(".drp-date-picker__nav--next");
615
+ g && (Re(e, p, u) ? (g.removeAttribute("disabled"), g.classList.remove("drp-date-picker__nav--disabled")) : (g.setAttribute("disabled", "true"), g.classList.add("drp-date-picker__nav--disabled")));
616
+ const h = n.querySelector(".drp-date-picker__weekdays"), f = [
617
+ ...e.weekdayNames.slice(e.weekStartDay),
618
+ ...e.weekdayNames.slice(0, e.weekStartDay)
619
+ ];
620
+ h && (h.innerHTML = f.map((y) => `<div class="drp-date-picker__weekday">${y}</div>`).join("")), at(e, t, r);
621
+ }
622
+ function at(e, t, n) {
623
+ q.debug(`[DatePicker Col${t} 20] renderDays called for month`, t);
624
+ const a = e.calendar.querySelector(`.drp-date-picker__month[data-month-index="${t}"]`);
625
+ if (!a) return;
626
+ const r = a.querySelector(".drp-date-picker__days"), o = n.getFullYear(), s = n.getMonth();
627
+ q.debug(`[DatePicker Col${t} 21] Rendering days for:`, o, s + 1);
628
+ const d = (new Date(o, s, 1).getDay() - e.weekStartDay + 7) % 7, l = new Date(o, s + 1, 0).getDate(), c = new Date(o, s, 0).getDate(), u = new Date(o, s - 1, 1), p = u.getFullYear(), g = u.getMonth(), h = new Date(o, s + 1, 1), f = h.getFullYear(), y = h.getMonth(), m = [];
629
+ for (let v = d - 1; v >= 0; v--) {
630
+ const L = c - v, A = new Date(p, g, L);
631
+ m.push({
632
+ date: A,
633
+ year: p,
634
+ month: g,
635
+ day: L,
636
+ isOtherMonth: !0
637
+ });
638
+ }
639
+ for (let v = 1; v <= l; v++) {
640
+ const L = new Date(o, s, v);
641
+ m.push({
642
+ date: L,
643
+ year: o,
644
+ month: s,
645
+ day: v,
646
+ isOtherMonth: !1
647
+ });
648
+ }
649
+ const M = Math.ceil((d + l) / 7) * 7 - (d + l);
650
+ for (let v = 1; v <= M; v++) {
651
+ const L = new Date(f, y, v);
652
+ m.push({
653
+ date: L,
654
+ year: f,
655
+ month: y,
656
+ day: v,
657
+ isOtherMonth: !0
658
+ });
659
+ }
660
+ const I = [];
661
+ for (let v = 0; v < m.length; v += 7)
662
+ I.push(m.slice(v, v + 7));
663
+ let b = "";
664
+ for (const v of I) {
665
+ const L = v.map((w) => {
666
+ const _ = e.getDateInfoInternal(w.date);
667
+ return {
668
+ label: (_ == null ? void 0 : _.label) || "",
669
+ tooltip: (_ == null ? void 0 : _.tooltip) || "",
670
+ class: (_ == null ? void 0 : _.class) || ""
671
+ };
672
+ });
673
+ if (L.some((w) => w.label)) {
674
+ b += '<div class="drp-date-picker__badge-row">';
675
+ for (const w of L)
676
+ if (w.label) {
677
+ const _ = w.tooltip ? ` data-tooltip="${w.tooltip.replace(/"/g, "&quot;")}"` : "", S = w.class ? ` ${w.class}` : "";
678
+ b += `<div class="drp-date-picker__badge-cell${S}"${_}>${w.label}</div>`;
679
+ } else
680
+ b += '<div class="drp-date-picker__badge-cell"></div>';
681
+ b += "</div>";
682
+ }
683
+ b += '<div class="drp-date-picker__date-row">';
684
+ for (const w of v) {
685
+ const _ = ["drp-date-picker__day"];
686
+ w.isOtherMonth && _.push("drp-date-picker__day--other-month");
687
+ const S = e.isDateDisabledInternal(w.date);
688
+ S && _.push("drp-date-picker__day--disabled");
689
+ const E = e.getDateInfoInternal(w.date);
690
+ E && E.class && _.push(E.class), e.isToday(w.date) && _.push("drp-date-picker__day--today"), e.options.selectionMode === "single" && e.isSameDay(w.date, e.selectedDate) && _.push("drp-date-picker__day--selected");
691
+ const R = e.options.selectionMode === "range" && e.isSameDay(w.date, e.selectedStartDate), N = e.options.selectionMode === "range" && e.isSameDay(w.date, e.selectedEndDate), O = e.options.selectionMode === "range" && e.isInRange(w.date);
692
+ e.options.selectionMode === "range" && (R && _.push("drp-date-picker__day--range-start"), N && _.push("drp-date-picker__day--range-end"), O && (!S || e.options.highlightDisabledInRange) && _.push("drp-date-picker__day--in-range"));
693
+ const T = `${w.year}-${String(w.month + 1).padStart(2, "0")}-${String(w.day).padStart(2, "0")}`;
694
+ b += `<div class="${_.join(" ")}" data-date="${T}" data-day-number="${w.day}">`, b += `<slot name="day-${T}">${w.day}</slot>`, b += "</div>";
695
+ }
696
+ b += "</div>";
697
+ }
698
+ r && (r.innerHTML = b, Qt(e, t, r));
699
+ }
700
+ function Qt(e, t, n) {
701
+ if (!e.options.renderDay && !e.options.renderDayContent)
702
+ return;
703
+ n.querySelectorAll(".drp-date-picker__day").forEach((r) => {
704
+ const o = r, s = o.getAttribute("data-date"), i = parseInt(o.getAttribute("data-day-number") || "0", 10);
705
+ if (!s) return;
706
+ const [d, l, c] = s.split("-"), u = new Date(parseInt(d), parseInt(l) - 1, parseInt(c)), p = o.querySelector(`slot[name="day-${s}"]`);
707
+ if (p && p.assignedNodes().length > 0)
708
+ return;
709
+ const h = e.isDateDisabledInternal(u), f = e.isToday(u), y = u.getDay() === 0 || u.getDay() === 6, m = e.options.selectionMode === "single" && e.isSameDay(u, e.selectedDate), x = e.options.selectionMode === "range" && e.isSameDay(u, e.selectedStartDate), M = e.options.selectionMode === "range" && e.isSameDay(u, e.selectedEndDate), I = e.options.selectionMode === "range" && e.isInRange(u), b = {
710
+ date: u,
711
+ dateString: s,
712
+ dayNumber: i,
713
+ isDisabled: h,
714
+ isSelected: m || x || M,
715
+ isStartDate: x,
716
+ isEndDate: M,
717
+ isInRange: I,
718
+ isToday: f,
719
+ isWeekend: y,
720
+ monthIndex: t,
721
+ element: o,
722
+ picker: e
723
+ };
724
+ if (e.options.renderDay)
725
+ try {
726
+ const v = e.options.renderDay(b);
727
+ v != null && (typeof v == "string" ? p && (p.innerHTML = v) : v instanceof HTMLElement && p && (p.innerHTML = "", p.appendChild(v)));
728
+ } catch (v) {
729
+ console.error("[DatePicker] Error in renderDay callback:", v);
730
+ }
731
+ else if (e.options.renderDayContent)
732
+ try {
733
+ const v = e.options.renderDayContent(b);
734
+ v != null && (typeof v == "string" ? p && (p.innerHTML += v) : v instanceof HTMLElement && p && p.appendChild(v));
735
+ } catch (v) {
736
+ console.error("[DatePicker] Error in renderDayContent callback:", v);
737
+ }
738
+ });
739
+ }
740
+ function rt(e, t) {
741
+ const n = e.calendar.querySelector(`.drp-date-picker__month[data-month-index="${t}"]`);
742
+ if (!n) return;
743
+ const a = n.querySelector(".drp-date-picker__rolling-selector");
744
+ a == null || a.classList.add("drp-date-picker__rolling-selector--visible");
745
+ const r = e.monthDates[t], o = r.getFullYear(), s = r.getMonth(), i = Xt(e.options.rollingYearRange, o, e), d = Gt(e.options.rollingMonthRange), l = a == null ? void 0 : a.querySelector('[data-list="years"]');
746
+ let c = "";
747
+ for (let p = i.min; p <= i.max; p++) {
748
+ const g = p === o ? "drp-date-picker__rolling-item--selected" : "", f = kt(e, p) ? "" : "drp-date-picker__rolling-item--disabled";
749
+ c += `<div class="drp-date-picker__rolling-item ${g} ${f}" data-year="${p}" data-month-index="${t}">${p}</div>`;
750
+ }
751
+ l && (l.innerHTML = c);
752
+ const u = a == null ? void 0 : a.querySelector('[data-list="months"]');
753
+ if (u) {
754
+ let p = "";
755
+ for (let g = d.min - 1; g <= d.max - 1; g++) {
756
+ const h = e.monthNames[g], f = g === s ? "drp-date-picker__rolling-item--selected" : "", m = Re(e, o, g) ? "" : "drp-date-picker__rolling-item--disabled";
757
+ p += `<div class="drp-date-picker__rolling-item ${f} ${m}" data-month="${g}" data-month-index="${t}">${h}</div>`;
758
+ }
759
+ u.innerHTML = p;
760
+ }
761
+ }
762
+ function Zt(e) {
763
+ if (e.options.selectionMode !== "range") return;
764
+ const t = e.calendar.querySelector(".drp-date-picker__summary");
765
+ if (t)
766
+ if (e.selectedStartDate && e.selectedEndDate) {
767
+ let n, a, r, o, s;
768
+ if (e.options.disabledDatesHandling === "individual" || e.options.disabledDatesHandling === "split")
769
+ a = e.getEnabledDatesInRange(
770
+ e.selectedStartDate,
771
+ e.selectedEndDate
772
+ ), n = a.length, o = a, e.options.disabledDatesHandling === "split" && (s = e.splitRangeByDisabled(
773
+ e.selectedStartDate,
774
+ e.selectedEndDate
775
+ ));
776
+ else if (e.options.disabledDatesHandling === "allow") {
777
+ a = e.getEnabledDatesInRange(
778
+ e.selectedStartDate,
779
+ e.selectedEndDate
780
+ ), r = e.getDisabledDatesInRange(
781
+ e.selectedStartDate,
782
+ e.selectedEndDate
783
+ );
784
+ const d = 1e3 * 60 * 60 * 24, l = e.selectedEndDate.getTime() - e.selectedStartDate.getTime();
785
+ n = Math.floor(l / d) + 1;
786
+ } else {
787
+ const l = e.selectedEndDate.getTime() - e.selectedStartDate.getTime();
788
+ n = Math.floor(l / 864e5) + 1;
789
+ }
790
+ const i = n > 0 ? n - 1 : 0;
791
+ if (t.className = "drp-date-picker__summary drp-date-picker__summary--visible", e.options.formatSummaryCallback) {
792
+ const d = {
793
+ days: n,
794
+ nights: i,
795
+ startDate: e.selectedStartDate,
796
+ endDate: e.selectedEndDate,
797
+ selectionMode: e.options.selectionMode,
798
+ disabledDatesHandling: e.options.disabledDatesHandling,
799
+ localeStrings: e.localeStrings,
800
+ isPreview: !1
801
+ };
802
+ a && (d.enabledDates = a), r && (d.disabledDates = r), o && (d.dates = o), s && (d.dateRanges = s), t.innerHTML = e.options.formatSummaryCallback(d);
803
+ } else
804
+ t.innerHTML = `
805
+ <span class="drp-date-picker__summary-count">${n} ${n === 1 ? e.localeStrings.day : e.localeStrings.days}</span>
806
+ <span>, </span>
807
+ <span class="drp-date-picker__summary-count">${i} ${i === 1 ? e.localeStrings.night : e.localeStrings.nights}</span>
808
+ `;
809
+ } else
810
+ t.className = "drp-date-picker__summary drp-date-picker__summary--hidden", t.innerHTML = "";
811
+ }
812
+ function st(e) {
813
+ if (e.options.selectionMode !== "range") return;
814
+ const t = e.calendar.querySelector(".drp-date-picker__summary");
815
+ if (t && e.dragPreviewStart && e.dragPreviewEnd) {
816
+ let n, a, r, o, s;
817
+ if (e.options.disabledDatesHandling === "individual" || e.options.disabledDatesHandling === "split")
818
+ a = e.getEnabledDatesInRange(
819
+ e.dragPreviewStart,
820
+ e.dragPreviewEnd
821
+ ), n = a.length, o = a, e.options.disabledDatesHandling === "split" && (s = e.splitRangeByDisabled(
822
+ e.dragPreviewStart,
823
+ e.dragPreviewEnd
824
+ ));
825
+ else if (e.options.disabledDatesHandling === "allow") {
826
+ a = e.getEnabledDatesInRange(
827
+ e.dragPreviewStart,
828
+ e.dragPreviewEnd
829
+ ), r = e.getDisabledDatesInRange(
830
+ e.dragPreviewStart,
831
+ e.dragPreviewEnd
832
+ );
833
+ const d = 1e3 * 60 * 60 * 24, l = e.dragPreviewEnd.getTime() - e.dragPreviewStart.getTime();
834
+ n = Math.floor(l / d) + 1;
835
+ } else {
836
+ const l = e.dragPreviewEnd.getTime() - e.dragPreviewStart.getTime();
837
+ n = Math.floor(l / 864e5) + 1;
838
+ }
839
+ const i = n > 0 ? n - 1 : 0;
840
+ if (t.className = "drp-date-picker__summary drp-date-picker__summary--visible", e.options.formatSummaryCallback) {
841
+ const d = {
842
+ days: n,
843
+ nights: i,
844
+ startDate: e.dragPreviewStart,
845
+ endDate: e.dragPreviewEnd,
846
+ selectionMode: e.options.selectionMode,
847
+ disabledDatesHandling: e.options.disabledDatesHandling,
848
+ localeStrings: e.localeStrings,
849
+ isPreview: !0
850
+ };
851
+ a && (d.enabledDates = a), r && (d.disabledDates = r), o && (d.dates = o), s && (d.dateRanges = s), t.innerHTML = e.options.formatSummaryCallback(d);
852
+ } else
853
+ t.innerHTML = `
854
+ <span style="opacity: 0.7;">${e.localeStrings.preview}: </span>
855
+ <span class="drp-date-picker__summary-count">${n} ${n === 1 ? e.localeStrings.day : e.localeStrings.days}</span>
856
+ <span>, </span>
857
+ <span class="drp-date-picker__summary-count">${i} ${i === 1 ? e.localeStrings.night : e.localeStrings.nights}</span>
858
+ `;
859
+ }
860
+ }
861
+ function en(e) {
862
+ if (e.calendar.querySelectorAll(".drp-date-picker__day--drag-preview, .drp-date-picker__day--drag-invalid").forEach((r) => {
863
+ r.classList.remove("drp-date-picker__day--drag-preview", "drp-date-picker__day--drag-invalid");
864
+ }), !e.dragPreviewStart || !e.dragPreviewEnd) return;
865
+ const n = e.options.disabledDatesHandling === "block" && e.hasDisabledDatesInRange(e.dragPreviewStart, e.dragPreviewEnd);
866
+ e.calendar.querySelectorAll(".drp-date-picker__day").forEach((r) => {
867
+ const o = r.dataset.date;
868
+ if (!o) return;
869
+ const [s, i, d] = o.split("-").map(Number), l = new Date(s, i - 1, d);
870
+ l >= e.dragPreviewStart && l <= e.dragPreviewEnd && (r.classList.add("drp-date-picker__day--drag-preview"), n && r.classList.add("drp-date-picker__day--drag-invalid"));
871
+ }), st(e);
872
+ }
873
+ const ge = Math.min, ae = Math.max, _e = Math.round, W = (e) => ({
874
+ x: e,
875
+ y: e
876
+ }), tn = {
8
877
  left: "right",
9
878
  right: "left",
10
879
  bottom: "top",
11
880
  top: "bottom"
12
- }, qe = {
881
+ }, nn = {
13
882
  start: "end",
14
883
  end: "start"
15
884
  };
16
- function ue(n, e, t) {
17
- return V(n, re(e, t));
885
+ function $e(e, t, n) {
886
+ return ae(e, ge(t, n));
18
887
  }
19
- function G(n, e) {
20
- return typeof n == "function" ? n(e) : n;
888
+ function he(e, t) {
889
+ return typeof e == "function" ? e(t) : e;
21
890
  }
22
- function q(n) {
23
- return n.split("-")[0];
891
+ function ne(e) {
892
+ return e.split("-")[0];
24
893
  }
25
- function Q(n) {
26
- return n.split("-")[1];
894
+ function me(e) {
895
+ return e.split("-")[1];
27
896
  }
28
- function De(n) {
29
- return n === "x" ? "y" : "x";
897
+ function ot(e) {
898
+ return e === "x" ? "y" : "x";
30
899
  }
31
- function we(n) {
32
- return n === "y" ? "height" : "width";
900
+ function Ne(e) {
901
+ return e === "y" ? "height" : "width";
33
902
  }
34
- const Oe = /* @__PURE__ */ new Set(["top", "bottom"]);
35
- function L(n) {
36
- return Oe.has(q(n)) ? "y" : "x";
903
+ const an = /* @__PURE__ */ new Set(["top", "bottom"]);
904
+ function Q(e) {
905
+ return an.has(ne(e)) ? "y" : "x";
37
906
  }
38
- function xe(n) {
39
- return De(L(n));
907
+ function Oe(e) {
908
+ return ot(Q(e));
40
909
  }
41
- function Ve(n, e, t) {
42
- t === void 0 && (t = !1);
43
- const a = Q(n), i = xe(n), r = we(i);
44
- let o = i === "x" ? a === (t ? "end" : "start") ? "right" : "left" : a === "start" ? "bottom" : "top";
45
- return e.reference[r] > e.floating[r] && (o = J(o)), [o, J(o)];
910
+ function rn(e, t, n) {
911
+ n === void 0 && (n = !1);
912
+ const a = me(e), r = Oe(e), o = Ne(r);
913
+ let s = r === "x" ? a === (n ? "end" : "start") ? "right" : "left" : a === "start" ? "bottom" : "top";
914
+ return t.reference[o] > t.floating[o] && (s = we(s)), [s, we(s)];
46
915
  }
47
- function Ne(n) {
48
- const e = J(n);
49
- return [se(n), e, se(e)];
916
+ function sn(e) {
917
+ const t = we(e);
918
+ return [Pe(e), t, Pe(t)];
50
919
  }
51
- function se(n) {
52
- return n.replace(/start|end/g, (e) => qe[e]);
920
+ function Pe(e) {
921
+ return e.replace(/start|end/g, (t) => nn[t]);
53
922
  }
54
- const fe = ["left", "right"], ge = ["right", "left"], ze = ["top", "bottom"], He = ["bottom", "top"];
55
- function Be(n, e, t) {
56
- switch (n) {
923
+ const qe = ["left", "right"], Be = ["right", "left"], on = ["top", "bottom"], dn = ["bottom", "top"];
924
+ function ln(e, t, n) {
925
+ switch (e) {
57
926
  case "top":
58
927
  case "bottom":
59
- return t ? e ? ge : fe : e ? fe : ge;
928
+ return n ? t ? Be : qe : t ? qe : Be;
60
929
  case "left":
61
930
  case "right":
62
- return e ? ze : He;
931
+ return t ? on : dn;
63
932
  default:
64
933
  return [];
65
934
  }
66
935
  }
67
- function We(n, e, t, a) {
68
- const i = Q(n);
69
- let r = Be(q(n), t === "start", a);
70
- return i && (r = r.map((o) => o + "-" + i), e && (r = r.concat(r.map(se)))), r;
936
+ function cn(e, t, n, a) {
937
+ const r = me(e);
938
+ let o = ln(ne(e), n === "start", a);
939
+ return r && (o = o.map((s) => s + "-" + r), t && (o = o.concat(o.map(Pe)))), o;
71
940
  }
72
- function J(n) {
73
- return n.replace(/left|right|bottom|top/g, (e) => Ye[e]);
941
+ function we(e) {
942
+ return e.replace(/left|right|bottom|top/g, (t) => tn[t]);
74
943
  }
75
- function Ke(n) {
944
+ function pn(e) {
76
945
  return {
77
946
  top: 0,
78
947
  right: 0,
79
948
  bottom: 0,
80
949
  left: 0,
81
- ...n
950
+ ...e
82
951
  };
83
952
  }
84
- function je(n) {
85
- return typeof n != "number" ? Ke(n) : {
86
- top: n,
87
- right: n,
88
- bottom: n,
89
- left: n
953
+ function it(e) {
954
+ return typeof e != "number" ? pn(e) : {
955
+ top: e,
956
+ right: e,
957
+ bottom: e,
958
+ left: e
90
959
  };
91
960
  }
92
- function X(n) {
961
+ function xe(e) {
93
962
  const {
94
- x: e,
95
- y: t,
963
+ x: t,
964
+ y: n,
96
965
  width: a,
97
- height: i
98
- } = n;
966
+ height: r
967
+ } = e;
99
968
  return {
100
969
  width: a,
101
- height: i,
102
- top: t,
103
- left: e,
104
- right: e + a,
105
- bottom: t + i,
106
- x: e,
107
- y: t
970
+ height: r,
971
+ top: n,
972
+ left: t,
973
+ right: t + a,
974
+ bottom: n + r,
975
+ x: t,
976
+ y: n
108
977
  };
109
978
  }
110
- function ye(n, e, t) {
979
+ function We(e, t, n) {
111
980
  let {
112
981
  reference: a,
113
- floating: i
114
- } = n;
115
- const r = L(e), o = xe(e), s = we(o), l = q(e), c = r === "y", d = a.x + a.width / 2 - i.width / 2, p = a.y + a.height / 2 - i.height / 2, h = a[s] / 2 - i[s] / 2;
116
- let u;
117
- switch (l) {
982
+ floating: r
983
+ } = e;
984
+ const o = Q(t), s = Oe(t), i = Ne(s), d = ne(t), l = o === "y", c = a.x + a.width / 2 - r.width / 2, u = a.y + a.height / 2 - r.height / 2, p = a[i] / 2 - r[i] / 2;
985
+ let g;
986
+ switch (d) {
118
987
  case "top":
119
- u = {
120
- x: d,
121
- y: a.y - i.height
988
+ g = {
989
+ x: c,
990
+ y: a.y - r.height
122
991
  };
123
992
  break;
124
993
  case "bottom":
125
- u = {
126
- x: d,
994
+ g = {
995
+ x: c,
127
996
  y: a.y + a.height
128
997
  };
129
998
  break;
130
999
  case "right":
131
- u = {
1000
+ g = {
132
1001
  x: a.x + a.width,
133
- y: p
1002
+ y: u
134
1003
  };
135
1004
  break;
136
1005
  case "left":
137
- u = {
138
- x: a.x - i.width,
139
- y: p
1006
+ g = {
1007
+ x: a.x - r.width,
1008
+ y: u
140
1009
  };
141
1010
  break;
142
1011
  default:
143
- u = {
1012
+ g = {
144
1013
  x: a.x,
145
1014
  y: a.y
146
1015
  };
147
1016
  }
148
- switch (Q(e)) {
1017
+ switch (me(t)) {
149
1018
  case "start":
150
- u[o] -= h * (t && c ? -1 : 1);
1019
+ g[s] -= p * (n && l ? -1 : 1);
151
1020
  break;
152
1021
  case "end":
153
- u[o] += h * (t && c ? -1 : 1);
1022
+ g[s] += p * (n && l ? -1 : 1);
154
1023
  break;
155
1024
  }
156
- return u;
1025
+ return g;
157
1026
  }
158
- const Ue = async (n, e, t) => {
1027
+ const un = async (e, t, n) => {
159
1028
  const {
160
1029
  placement: a = "bottom",
161
- strategy: i = "absolute",
162
- middleware: r = [],
163
- platform: o
164
- } = t, s = r.filter(Boolean), l = await (o.isRTL == null ? void 0 : o.isRTL(e));
165
- let c = await o.getElementRects({
166
- reference: n,
167
- floating: e,
168
- strategy: i
1030
+ strategy: r = "absolute",
1031
+ middleware: o = [],
1032
+ platform: s
1033
+ } = n, i = o.filter(Boolean), d = await (s.isRTL == null ? void 0 : s.isRTL(t));
1034
+ let l = await s.getElementRects({
1035
+ reference: e,
1036
+ floating: t,
1037
+ strategy: r
169
1038
  }), {
170
- x: d,
171
- y: p
172
- } = ye(c, a, l), h = a, u = {}, f = 0;
173
- for (let g = 0; g < s.length; g++) {
1039
+ x: c,
1040
+ y: u
1041
+ } = We(l, a, d), p = a, g = {}, h = 0;
1042
+ for (let f = 0; f < i.length; f++) {
174
1043
  const {
175
1044
  name: y,
176
- fn: w
177
- } = s[g], {
178
- x: D,
179
- y: v,
180
- data: k,
181
- reset: m
182
- } = await w({
183
- x: d,
184
- y: p,
1045
+ fn: m
1046
+ } = i[f], {
1047
+ x,
1048
+ y: M,
1049
+ data: I,
1050
+ reset: b
1051
+ } = await m({
1052
+ x: c,
1053
+ y: u,
185
1054
  initialPlacement: a,
186
- placement: h,
187
- strategy: i,
188
- middlewareData: u,
189
- rects: c,
190
- platform: o,
1055
+ placement: p,
1056
+ strategy: r,
1057
+ middlewareData: g,
1058
+ rects: l,
1059
+ platform: s,
191
1060
  elements: {
192
- reference: n,
193
- floating: e
1061
+ reference: e,
1062
+ floating: t
194
1063
  }
195
1064
  });
196
- d = D ?? d, p = v ?? p, u = {
197
- ...u,
1065
+ c = x ?? c, u = M ?? u, g = {
1066
+ ...g,
198
1067
  [y]: {
199
- ...u[y],
200
- ...k
1068
+ ...g[y],
1069
+ ...I
201
1070
  }
202
- }, m && f <= 50 && (f++, typeof m == "object" && (m.placement && (h = m.placement), m.rects && (c = m.rects === !0 ? await o.getElementRects({
203
- reference: n,
204
- floating: e,
205
- strategy: i
206
- }) : m.rects), {
207
- x: d,
208
- y: p
209
- } = ye(c, h, l)), g = -1);
1071
+ }, b && h <= 50 && (h++, typeof b == "object" && (b.placement && (p = b.placement), b.rects && (l = b.rects === !0 ? await s.getElementRects({
1072
+ reference: e,
1073
+ floating: t,
1074
+ strategy: r
1075
+ }) : b.rects), {
1076
+ x: c,
1077
+ y: u
1078
+ } = We(l, p, d)), f = -1);
210
1079
  }
211
1080
  return {
212
- x: d,
213
- y: p,
214
- placement: h,
215
- strategy: i,
216
- middlewareData: u
1081
+ x: c,
1082
+ y: u,
1083
+ placement: p,
1084
+ strategy: r,
1085
+ middlewareData: g
217
1086
  };
218
1087
  };
219
- async function be(n, e) {
220
- var t;
221
- e === void 0 && (e = {});
1088
+ async function dt(e, t) {
1089
+ var n;
1090
+ t === void 0 && (t = {});
222
1091
  const {
223
1092
  x: a,
224
- y: i,
225
- platform: r,
226
- rects: o,
227
- elements: s,
228
- strategy: l
229
- } = n, {
230
- boundary: c = "clippingAncestors",
231
- rootBoundary: d = "viewport",
232
- elementContext: p = "floating",
233
- altBoundary: h = !1,
234
- padding: u = 0
235
- } = G(e, n), f = je(u), y = s[h ? p === "floating" ? "reference" : "floating" : p], w = X(await r.getClippingRect({
236
- element: (t = await (r.isElement == null ? void 0 : r.isElement(y))) == null || t ? y : y.contextElement || await (r.getDocumentElement == null ? void 0 : r.getDocumentElement(s.floating)),
237
- boundary: c,
238
- rootBoundary: d,
239
- strategy: l
240
- })), D = p === "floating" ? {
1093
+ y: r,
1094
+ platform: o,
1095
+ rects: s,
1096
+ elements: i,
1097
+ strategy: d
1098
+ } = e, {
1099
+ boundary: l = "clippingAncestors",
1100
+ rootBoundary: c = "viewport",
1101
+ elementContext: u = "floating",
1102
+ altBoundary: p = !1,
1103
+ padding: g = 0
1104
+ } = he(t, e), h = it(g), y = i[p ? u === "floating" ? "reference" : "floating" : u], m = xe(await o.getClippingRect({
1105
+ element: (n = await (o.isElement == null ? void 0 : o.isElement(y))) == null || n ? y : y.contextElement || await (o.getDocumentElement == null ? void 0 : o.getDocumentElement(i.floating)),
1106
+ boundary: l,
1107
+ rootBoundary: c,
1108
+ strategy: d
1109
+ })), x = u === "floating" ? {
241
1110
  x: a,
242
- y: i,
243
- width: o.floating.width,
244
- height: o.floating.height
245
- } : o.reference, v = await (r.getOffsetParent == null ? void 0 : r.getOffsetParent(s.floating)), k = await (r.isElement == null ? void 0 : r.isElement(v)) ? await (r.getScale == null ? void 0 : r.getScale(v)) || {
1111
+ y: r,
1112
+ width: s.floating.width,
1113
+ height: s.floating.height
1114
+ } : s.reference, M = await (o.getOffsetParent == null ? void 0 : o.getOffsetParent(i.floating)), I = await (o.isElement == null ? void 0 : o.isElement(M)) ? await (o.getScale == null ? void 0 : o.getScale(M)) || {
246
1115
  x: 1,
247
1116
  y: 1
248
1117
  } : {
249
1118
  x: 1,
250
1119
  y: 1
251
- }, m = X(r.convertOffsetParentRelativeRectToViewportRelativeRect ? await r.convertOffsetParentRelativeRectToViewportRelativeRect({
252
- elements: s,
253
- rect: D,
254
- offsetParent: v,
255
- strategy: l
256
- }) : D);
1120
+ }, b = xe(o.convertOffsetParentRelativeRectToViewportRelativeRect ? await o.convertOffsetParentRelativeRectToViewportRelativeRect({
1121
+ elements: i,
1122
+ rect: x,
1123
+ offsetParent: M,
1124
+ strategy: d
1125
+ }) : x);
257
1126
  return {
258
- top: (w.top - m.top + f.top) / k.y,
259
- bottom: (m.bottom - w.bottom + f.bottom) / k.y,
260
- left: (w.left - m.left + f.left) / k.x,
261
- right: (m.right - w.right + f.right) / k.x
1127
+ top: (m.top - b.top + h.top) / I.y,
1128
+ bottom: (b.bottom - m.bottom + h.bottom) / I.y,
1129
+ left: (m.left - b.left + h.left) / I.x,
1130
+ right: (b.right - m.right + h.right) / I.x
262
1131
  };
263
1132
  }
264
- const Je = function(n) {
265
- return n === void 0 && (n = {}), {
1133
+ const gn = (e) => ({
1134
+ name: "arrow",
1135
+ options: e,
1136
+ async fn(t) {
1137
+ const {
1138
+ x: n,
1139
+ y: a,
1140
+ placement: r,
1141
+ rects: o,
1142
+ platform: s,
1143
+ elements: i,
1144
+ middlewareData: d
1145
+ } = t, {
1146
+ element: l,
1147
+ padding: c = 0
1148
+ } = he(e, t) || {};
1149
+ if (l == null)
1150
+ return {};
1151
+ const u = it(c), p = {
1152
+ x: n,
1153
+ y: a
1154
+ }, g = Oe(r), h = Ne(g), f = await s.getDimensions(l), y = g === "y", m = y ? "top" : "left", x = y ? "bottom" : "right", M = y ? "clientHeight" : "clientWidth", I = o.reference[h] + o.reference[g] - p[g] - o.floating[h], b = p[g] - o.reference[g], v = await (s.getOffsetParent == null ? void 0 : s.getOffsetParent(l));
1155
+ let L = v ? v[M] : 0;
1156
+ (!L || !await (s.isElement == null ? void 0 : s.isElement(v))) && (L = i.floating[M] || o.floating[h]);
1157
+ const A = I / 2 - b / 2, w = L / 2 - f[h] / 2 - 1, _ = ge(u[m], w), S = ge(u[x], w), E = _, P = L - f[h] - S, R = L / 2 - f[h] / 2 + A, N = $e(E, R, P), O = !d.arrow && me(r) != null && R !== N && o.reference[h] / 2 - (R < E ? _ : S) - f[h] / 2 < 0, T = O ? R < E ? R - E : R - P : 0;
1158
+ return {
1159
+ [g]: p[g] + T,
1160
+ data: {
1161
+ [g]: N,
1162
+ centerOffset: R - N - T,
1163
+ ...O && {
1164
+ alignmentOffset: T
1165
+ }
1166
+ },
1167
+ reset: O
1168
+ };
1169
+ }
1170
+ }), fn = function(e) {
1171
+ return e === void 0 && (e = {}), {
266
1172
  name: "flip",
267
- options: n,
268
- async fn(e) {
269
- var t, a;
1173
+ options: e,
1174
+ async fn(t) {
1175
+ var n, a;
270
1176
  const {
271
- placement: i,
272
- middlewareData: r,
273
- rects: o,
274
- initialPlacement: s,
275
- platform: l,
276
- elements: c
277
- } = e, {
278
- mainAxis: d = !0,
279
- crossAxis: p = !0,
280
- fallbackPlacements: h,
281
- fallbackStrategy: u = "bestFit",
282
- fallbackAxisSideDirection: f = "none",
283
- flipAlignment: g = !0,
1177
+ placement: r,
1178
+ middlewareData: o,
1179
+ rects: s,
1180
+ initialPlacement: i,
1181
+ platform: d,
1182
+ elements: l
1183
+ } = t, {
1184
+ mainAxis: c = !0,
1185
+ crossAxis: u = !0,
1186
+ fallbackPlacements: p,
1187
+ fallbackStrategy: g = "bestFit",
1188
+ fallbackAxisSideDirection: h = "none",
1189
+ flipAlignment: f = !0,
284
1190
  ...y
285
- } = G(n, e);
286
- if ((t = r.arrow) != null && t.alignmentOffset)
1191
+ } = he(e, t);
1192
+ if ((n = o.arrow) != null && n.alignmentOffset)
287
1193
  return {};
288
- const w = q(i), D = L(s), v = q(s) === s, k = await (l.isRTL == null ? void 0 : l.isRTL(c.floating)), m = h || (v || !g ? [J(s)] : Ne(s)), b = f !== "none";
289
- !h && b && m.push(...We(s, g, f, k));
290
- const T = [s, ...m], P = await be(e, y), j = [];
291
- let O = ((a = r.flip) == null ? void 0 : a.overflows) || [];
292
- if (d && j.push(P[w]), p) {
293
- const F = Ve(i, o, k);
294
- j.push(P[F[0]], P[F[1]]);
1194
+ const m = ne(r), x = Q(i), M = ne(i) === i, I = await (d.isRTL == null ? void 0 : d.isRTL(l.floating)), b = p || (M || !f ? [we(i)] : sn(i)), v = h !== "none";
1195
+ !p && v && b.push(...cn(i, f, h, I));
1196
+ const L = [i, ...b], A = await dt(t, y), w = [];
1197
+ let _ = ((a = o.flip) == null ? void 0 : a.overflows) || [];
1198
+ if (c && w.push(A[m]), u) {
1199
+ const R = rn(r, s, I);
1200
+ w.push(A[R[0]], A[R[1]]);
295
1201
  }
296
- if (O = [...O, {
297
- placement: i,
298
- overflows: j
299
- }], !j.every((F) => F <= 0)) {
300
- var de, pe;
301
- const F = (((de = r.flip) == null ? void 0 : de.index) || 0) + 1, ne = T[F];
302
- if (ne && (!(p === "alignment" ? D !== L(ne) : !1) || // We leave the current main axis only if every placement on that axis
1202
+ if (_ = [..._, {
1203
+ placement: r,
1204
+ overflows: w
1205
+ }], !w.every((R) => R <= 0)) {
1206
+ var S, E;
1207
+ const R = (((S = o.flip) == null ? void 0 : S.index) || 0) + 1, N = L[R];
1208
+ if (N && (!(u === "alignment" ? x !== Q(N) : !1) || // We leave the current main axis only if every placement on that axis
303
1209
  // overflows the main axis.
304
- O.every((S) => L(S.placement) === D ? S.overflows[0] > 0 : !0)))
1210
+ _.every((H) => Q(H.placement) === x ? H.overflows[0] > 0 : !0)))
305
1211
  return {
306
1212
  data: {
307
- index: F,
308
- overflows: O
1213
+ index: R,
1214
+ overflows: _
309
1215
  },
310
1216
  reset: {
311
- placement: ne
1217
+ placement: N
312
1218
  }
313
1219
  };
314
- let B = (pe = O.filter((Y) => Y.overflows[0] <= 0).sort((Y, S) => Y.overflows[1] - S.overflows[1])[0]) == null ? void 0 : pe.placement;
315
- if (!B)
316
- switch (u) {
1220
+ let O = (E = _.filter((T) => T.overflows[0] <= 0).sort((T, H) => T.overflows[1] - H.overflows[1])[0]) == null ? void 0 : E.placement;
1221
+ if (!O)
1222
+ switch (g) {
317
1223
  case "bestFit": {
318
- var he;
319
- const Y = (he = O.filter((S) => {
320
- if (b) {
321
- const A = L(S.placement);
322
- return A === D || // Create a bias to the `y` side axis due to horizontal
1224
+ var P;
1225
+ const T = (P = _.filter((H) => {
1226
+ if (v) {
1227
+ const J = Q(H.placement);
1228
+ return J === x || // Create a bias to the `y` side axis due to horizontal
323
1229
  // reading directions favoring greater width.
324
- A === "y";
1230
+ J === "y";
325
1231
  }
326
1232
  return !0;
327
- }).map((S) => [S.placement, S.overflows.filter((A) => A > 0).reduce((A, Re) => A + Re, 0)]).sort((S, A) => S[1] - A[1])[0]) == null ? void 0 : he[0];
328
- Y && (B = Y);
1233
+ }).map((H) => [H.placement, H.overflows.filter((J) => J > 0).reduce((J, Lt) => J + Lt, 0)]).sort((H, J) => H[1] - J[1])[0]) == null ? void 0 : P[0];
1234
+ T && (O = T);
329
1235
  break;
330
1236
  }
331
1237
  case "initialPlacement":
332
- B = s;
1238
+ O = i;
333
1239
  break;
334
1240
  }
335
- if (i !== B)
1241
+ if (r !== O)
336
1242
  return {
337
1243
  reset: {
338
- placement: B
1244
+ placement: O
339
1245
  }
340
1246
  };
341
1247
  }
342
1248
  return {};
343
1249
  }
344
1250
  };
345
- }, Xe = /* @__PURE__ */ new Set(["left", "top"]);
346
- async function Ge(n, e) {
1251
+ }, hn = /* @__PURE__ */ new Set(["left", "top"]);
1252
+ async function mn(e, t) {
347
1253
  const {
348
- placement: t,
1254
+ placement: n,
349
1255
  platform: a,
350
- elements: i
351
- } = n, r = await (a.isRTL == null ? void 0 : a.isRTL(i.floating)), o = q(t), s = Q(t), l = L(t) === "y", c = Xe.has(o) ? -1 : 1, d = r && l ? -1 : 1, p = G(e, n);
1256
+ elements: r
1257
+ } = e, o = await (a.isRTL == null ? void 0 : a.isRTL(r.floating)), s = ne(n), i = me(n), d = Q(n) === "y", l = hn.has(s) ? -1 : 1, c = o && d ? -1 : 1, u = he(t, e);
352
1258
  let {
353
- mainAxis: h,
354
- crossAxis: u,
355
- alignmentAxis: f
356
- } = typeof p == "number" ? {
357
1259
  mainAxis: p,
1260
+ crossAxis: g,
1261
+ alignmentAxis: h
1262
+ } = typeof u == "number" ? {
1263
+ mainAxis: u,
358
1264
  crossAxis: 0,
359
1265
  alignmentAxis: null
360
1266
  } : {
361
- mainAxis: p.mainAxis || 0,
362
- crossAxis: p.crossAxis || 0,
363
- alignmentAxis: p.alignmentAxis
1267
+ mainAxis: u.mainAxis || 0,
1268
+ crossAxis: u.crossAxis || 0,
1269
+ alignmentAxis: u.alignmentAxis
364
1270
  };
365
- return s && typeof f == "number" && (u = s === "end" ? f * -1 : f), l ? {
366
- x: u * d,
367
- y: h * c
1271
+ return i && typeof h == "number" && (g = i === "end" ? h * -1 : h), d ? {
1272
+ x: g * c,
1273
+ y: p * l
368
1274
  } : {
369
- x: h * c,
370
- y: u * d
1275
+ x: p * l,
1276
+ y: g * c
371
1277
  };
372
1278
  }
373
- const Qe = function(n) {
374
- return n === void 0 && (n = 0), {
1279
+ const yn = function(e) {
1280
+ return e === void 0 && (e = 0), {
375
1281
  name: "offset",
376
- options: n,
377
- async fn(e) {
378
- var t, a;
1282
+ options: e,
1283
+ async fn(t) {
1284
+ var n, a;
379
1285
  const {
380
- x: i,
381
- y: r,
382
- placement: o,
383
- middlewareData: s
384
- } = e, l = await Ge(e, n);
385
- return o === ((t = s.offset) == null ? void 0 : t.placement) && (a = s.arrow) != null && a.alignmentOffset ? {} : {
386
- x: i + l.x,
387
- y: r + l.y,
1286
+ x: r,
1287
+ y: o,
1288
+ placement: s,
1289
+ middlewareData: i
1290
+ } = t, d = await mn(t, e);
1291
+ return s === ((n = i.offset) == null ? void 0 : n.placement) && (a = i.arrow) != null && a.alignmentOffset ? {} : {
1292
+ x: r + d.x,
1293
+ y: o + d.y,
388
1294
  data: {
389
- ...l,
390
- placement: o
1295
+ ...d,
1296
+ placement: s
391
1297
  }
392
1298
  };
393
1299
  }
394
1300
  };
395
- }, Ze = function(n) {
396
- return n === void 0 && (n = {}), {
1301
+ }, vn = function(e) {
1302
+ return e === void 0 && (e = {}), {
397
1303
  name: "shift",
398
- options: n,
399
- async fn(e) {
1304
+ options: e,
1305
+ async fn(t) {
400
1306
  const {
401
- x: t,
1307
+ x: n,
402
1308
  y: a,
403
- placement: i
404
- } = e, {
405
- mainAxis: r = !0,
406
- crossAxis: o = !1,
407
- limiter: s = {
1309
+ placement: r
1310
+ } = t, {
1311
+ mainAxis: o = !0,
1312
+ crossAxis: s = !1,
1313
+ limiter: i = {
408
1314
  fn: (y) => {
409
1315
  let {
410
- x: w,
411
- y: D
1316
+ x: m,
1317
+ y: x
412
1318
  } = y;
413
1319
  return {
414
- x: w,
415
- y: D
1320
+ x: m,
1321
+ y: x
416
1322
  };
417
1323
  }
418
1324
  },
419
- ...l
420
- } = G(n, e), c = {
421
- x: t,
1325
+ ...d
1326
+ } = he(e, t), l = {
1327
+ x: n,
422
1328
  y: a
423
- }, d = await be(e, l), p = L(q(i)), h = De(p);
424
- let u = c[h], f = c[p];
425
- if (r) {
426
- const y = h === "y" ? "top" : "left", w = h === "y" ? "bottom" : "right", D = u + d[y], v = u - d[w];
427
- u = ue(D, u, v);
428
- }
1329
+ }, c = await dt(t, d), u = Q(ne(r)), p = ot(u);
1330
+ let g = l[p], h = l[u];
429
1331
  if (o) {
430
- const y = p === "y" ? "top" : "left", w = p === "y" ? "bottom" : "right", D = f + d[y], v = f - d[w];
431
- f = ue(D, f, v);
1332
+ const y = p === "y" ? "top" : "left", m = p === "y" ? "bottom" : "right", x = g + c[y], M = g - c[m];
1333
+ g = $e(x, g, M);
1334
+ }
1335
+ if (s) {
1336
+ const y = u === "y" ? "top" : "left", m = u === "y" ? "bottom" : "right", x = h + c[y], M = h - c[m];
1337
+ h = $e(x, h, M);
432
1338
  }
433
- const g = s.fn({
434
- ...e,
435
- [h]: u,
436
- [p]: f
1339
+ const f = i.fn({
1340
+ ...t,
1341
+ [p]: g,
1342
+ [u]: h
437
1343
  });
438
1344
  return {
439
- ...g,
1345
+ ...f,
440
1346
  data: {
441
- x: g.x - t,
442
- y: g.y - a,
1347
+ x: f.x - n,
1348
+ y: f.y - a,
443
1349
  enabled: {
444
- [h]: r,
445
- [p]: o
1350
+ [p]: o,
1351
+ [u]: s
446
1352
  }
447
1353
  }
448
1354
  };
449
1355
  }
450
1356
  };
451
1357
  };
452
- function Z() {
1358
+ function Me() {
453
1359
  return typeof window < "u";
454
1360
  }
455
- function H(n) {
456
- return Se(n) ? (n.nodeName || "").toLowerCase() : "#document";
1361
+ function ie(e) {
1362
+ return lt(e) ? (e.nodeName || "").toLowerCase() : "#document";
457
1363
  }
458
- function x(n) {
459
- var e;
460
- return (n == null || (e = n.ownerDocument) == null ? void 0 : e.defaultView) || window;
1364
+ function z(e) {
1365
+ var t;
1366
+ return (e == null || (t = e.ownerDocument) == null ? void 0 : t.defaultView) || window;
461
1367
  }
462
- function $(n) {
463
- var e;
464
- return (e = (Se(n) ? n.ownerDocument : n.document) || window.document) == null ? void 0 : e.documentElement;
1368
+ function G(e) {
1369
+ var t;
1370
+ return (t = (lt(e) ? e.ownerDocument : e.document) || window.document) == null ? void 0 : t.documentElement;
465
1371
  }
466
- function Se(n) {
467
- return Z() ? n instanceof Node || n instanceof x(n).Node : !1;
1372
+ function lt(e) {
1373
+ return Me() ? e instanceof Node || e instanceof z(e).Node : !1;
468
1374
  }
469
- function I(n) {
470
- return Z() ? n instanceof Element || n instanceof x(n).Element : !1;
1375
+ function Y(e) {
1376
+ return Me() ? e instanceof Element || e instanceof z(e).Element : !1;
471
1377
  }
472
- function E(n) {
473
- return Z() ? n instanceof HTMLElement || n instanceof x(n).HTMLElement : !1;
1378
+ function j(e) {
1379
+ return Me() ? e instanceof HTMLElement || e instanceof z(e).HTMLElement : !1;
474
1380
  }
475
- function me(n) {
476
- return !Z() || typeof ShadowRoot > "u" ? !1 : n instanceof ShadowRoot || n instanceof x(n).ShadowRoot;
1381
+ function je(e) {
1382
+ return !Me() || typeof ShadowRoot > "u" ? !1 : e instanceof ShadowRoot || e instanceof z(e).ShadowRoot;
477
1383
  }
478
- const et = /* @__PURE__ */ new Set(["inline", "contents"]);
479
- function K(n) {
1384
+ const Dn = /* @__PURE__ */ new Set(["inline", "contents"]);
1385
+ function ye(e) {
480
1386
  const {
481
- overflow: e,
482
- overflowX: t,
1387
+ overflow: t,
1388
+ overflowX: n,
483
1389
  overflowY: a,
484
- display: i
485
- } = M(n);
486
- return /auto|scroll|overlay|hidden|clip/.test(e + a + t) && !et.has(i);
1390
+ display: r
1391
+ } = V(e);
1392
+ return /auto|scroll|overlay|hidden|clip/.test(t + a + n) && !Dn.has(r);
487
1393
  }
488
- const tt = /* @__PURE__ */ new Set(["table", "td", "th"]);
489
- function at(n) {
490
- return tt.has(H(n));
1394
+ const bn = /* @__PURE__ */ new Set(["table", "td", "th"]);
1395
+ function _n(e) {
1396
+ return bn.has(ie(e));
491
1397
  }
492
- const nt = [":popover-open", ":modal"];
493
- function ee(n) {
494
- return nt.some((e) => {
1398
+ const wn = [":popover-open", ":modal"];
1399
+ function Ie(e) {
1400
+ return wn.some((t) => {
495
1401
  try {
496
- return n.matches(e);
1402
+ return e.matches(t);
497
1403
  } catch {
498
1404
  return !1;
499
1405
  }
500
1406
  });
501
1407
  }
502
- const it = ["transform", "translate", "scale", "rotate", "perspective"], rt = ["transform", "translate", "scale", "rotate", "perspective", "filter"], st = ["paint", "layout", "strict", "content"];
503
- function ce(n) {
504
- const e = le(), t = I(n) ? M(n) : n;
505
- return it.some((a) => t[a] ? t[a] !== "none" : !1) || (t.containerType ? t.containerType !== "normal" : !1) || !e && (t.backdropFilter ? t.backdropFilter !== "none" : !1) || !e && (t.filter ? t.filter !== "none" : !1) || rt.some((a) => (t.willChange || "").includes(a)) || st.some((a) => (t.contain || "").includes(a));
506
- }
507
- function ot(n) {
508
- let e = R(n);
509
- for (; E(e) && !z(e); ) {
510
- if (ce(e))
511
- return e;
512
- if (ee(e))
1408
+ const xn = ["transform", "translate", "scale", "rotate", "perspective"], Sn = ["transform", "translate", "scale", "rotate", "perspective", "filter"], Mn = ["paint", "layout", "strict", "content"];
1409
+ function He(e) {
1410
+ const t = Ye(), n = Y(e) ? V(e) : e;
1411
+ return xn.some((a) => n[a] ? n[a] !== "none" : !1) || (n.containerType ? n.containerType !== "normal" : !1) || !t && (n.backdropFilter ? n.backdropFilter !== "none" : !1) || !t && (n.filter ? n.filter !== "none" : !1) || Sn.some((a) => (n.willChange || "").includes(a)) || Mn.some((a) => (n.contain || "").includes(a));
1412
+ }
1413
+ function In(e) {
1414
+ let t = ee(e);
1415
+ for (; j(t) && !se(t); ) {
1416
+ if (He(t))
1417
+ return t;
1418
+ if (Ie(t))
513
1419
  return null;
514
- e = R(e);
1420
+ t = ee(t);
515
1421
  }
516
1422
  return null;
517
1423
  }
518
- function le() {
1424
+ function Ye() {
519
1425
  return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
520
1426
  }
521
- const ct = /* @__PURE__ */ new Set(["html", "body", "#document"]);
522
- function z(n) {
523
- return ct.has(H(n));
1427
+ const En = /* @__PURE__ */ new Set(["html", "body", "#document"]);
1428
+ function se(e) {
1429
+ return En.has(ie(e));
524
1430
  }
525
- function M(n) {
526
- return x(n).getComputedStyle(n);
1431
+ function V(e) {
1432
+ return z(e).getComputedStyle(e);
527
1433
  }
528
- function te(n) {
529
- return I(n) ? {
530
- scrollLeft: n.scrollLeft,
531
- scrollTop: n.scrollTop
1434
+ function Ee(e) {
1435
+ return Y(e) ? {
1436
+ scrollLeft: e.scrollLeft,
1437
+ scrollTop: e.scrollTop
532
1438
  } : {
533
- scrollLeft: n.scrollX,
534
- scrollTop: n.scrollY
1439
+ scrollLeft: e.scrollX,
1440
+ scrollTop: e.scrollY
535
1441
  };
536
1442
  }
537
- function R(n) {
538
- if (H(n) === "html")
539
- return n;
540
- const e = (
1443
+ function ee(e) {
1444
+ if (ie(e) === "html")
1445
+ return e;
1446
+ const t = (
541
1447
  // Step into the shadow DOM of the parent of a slotted node.
542
- n.assignedSlot || // DOM Element detected.
543
- n.parentNode || // ShadowRoot detected.
544
- me(n) && n.host || // Fallback.
545
- $(n)
1448
+ e.assignedSlot || // DOM Element detected.
1449
+ e.parentNode || // ShadowRoot detected.
1450
+ je(e) && e.host || // Fallback.
1451
+ G(e)
546
1452
  );
547
- return me(e) ? e.host : e;
1453
+ return je(t) ? t.host : t;
548
1454
  }
549
- function Ie(n) {
550
- const e = R(n);
551
- return z(e) ? n.ownerDocument ? n.ownerDocument.body : n.body : E(e) && K(e) ? e : Ie(e);
1455
+ function ct(e) {
1456
+ const t = ee(e);
1457
+ return se(t) ? e.ownerDocument ? e.ownerDocument.body : e.body : j(t) && ye(t) ? t : ct(t);
552
1458
  }
553
- function Me(n, e, t) {
1459
+ function pt(e, t, n) {
554
1460
  var a;
555
- e === void 0 && (e = []);
556
- const i = Ie(n), r = i === ((a = n.ownerDocument) == null ? void 0 : a.body), o = x(i);
557
- return r ? (oe(o), e.concat(o, o.visualViewport || [], K(i) ? i : [], [])) : e.concat(i, Me(i, []));
558
- }
559
- function oe(n) {
560
- return n.parent && Object.getPrototypeOf(n.parent) ? n.frameElement : null;
561
- }
562
- function Ce(n) {
563
- const e = M(n);
564
- let t = parseFloat(e.width) || 0, a = parseFloat(e.height) || 0;
565
- const i = E(n), r = i ? n.offsetWidth : t, o = i ? n.offsetHeight : a, s = U(t) !== r || U(a) !== o;
566
- return s && (t = r, a = o), {
567
- width: t,
1461
+ t === void 0 && (t = []);
1462
+ const r = ct(e), o = r === ((a = e.ownerDocument) == null ? void 0 : a.body), s = z(r);
1463
+ return o ? (ke(s), t.concat(s, s.visualViewport || [], ye(r) ? r : [], [])) : t.concat(r, pt(r, []));
1464
+ }
1465
+ function ke(e) {
1466
+ return e.parent && Object.getPrototypeOf(e.parent) ? e.frameElement : null;
1467
+ }
1468
+ function ut(e) {
1469
+ const t = V(e);
1470
+ let n = parseFloat(t.width) || 0, a = parseFloat(t.height) || 0;
1471
+ const r = j(e), o = r ? e.offsetWidth : n, s = r ? e.offsetHeight : a, i = _e(n) !== o || _e(a) !== s;
1472
+ return i && (n = o, a = s), {
1473
+ width: n,
568
1474
  height: a,
569
- $: s
1475
+ $: i
570
1476
  };
571
1477
  }
572
- function Ee(n) {
573
- return I(n) ? n : n.contextElement;
1478
+ function gt(e) {
1479
+ return Y(e) ? e : e.contextElement;
574
1480
  }
575
- function N(n) {
576
- const e = Ee(n);
577
- if (!E(e))
578
- return C(1);
579
- const t = e.getBoundingClientRect(), {
1481
+ function re(e) {
1482
+ const t = gt(e);
1483
+ if (!j(t))
1484
+ return W(1);
1485
+ const n = t.getBoundingClientRect(), {
580
1486
  width: a,
581
- height: i,
582
- $: r
583
- } = Ce(e);
584
- let o = (r ? U(t.width) : t.width) / a, s = (r ? U(t.height) : t.height) / i;
585
- return (!o || !Number.isFinite(o)) && (o = 1), (!s || !Number.isFinite(s)) && (s = 1), {
586
- x: o,
587
- y: s
1487
+ height: r,
1488
+ $: o
1489
+ } = ut(t);
1490
+ let s = (o ? _e(n.width) : n.width) / a, i = (o ? _e(n.height) : n.height) / r;
1491
+ return (!s || !Number.isFinite(s)) && (s = 1), (!i || !Number.isFinite(i)) && (i = 1), {
1492
+ x: s,
1493
+ y: i
588
1494
  };
589
1495
  }
590
- const lt = /* @__PURE__ */ C(0);
591
- function Pe(n) {
592
- const e = x(n);
593
- return !le() || !e.visualViewport ? lt : {
594
- x: e.visualViewport.offsetLeft,
595
- y: e.visualViewport.offsetTop
1496
+ const Cn = /* @__PURE__ */ W(0);
1497
+ function ft(e) {
1498
+ const t = z(e);
1499
+ return !Ye() || !t.visualViewport ? Cn : {
1500
+ x: t.visualViewport.offsetLeft,
1501
+ y: t.visualViewport.offsetTop
596
1502
  };
597
1503
  }
598
- function dt(n, e, t) {
599
- return e === void 0 && (e = !1), !t || e && t !== x(n) ? !1 : e;
600
- }
601
- function W(n, e, t, a) {
602
- e === void 0 && (e = !1), t === void 0 && (t = !1);
603
- const i = n.getBoundingClientRect(), r = Ee(n);
604
- let o = C(1);
605
- e && (a ? I(a) && (o = N(a)) : o = N(n));
606
- const s = dt(r, t, a) ? Pe(r) : C(0);
607
- let l = (i.left + s.x) / o.x, c = (i.top + s.y) / o.y, d = i.width / o.x, p = i.height / o.y;
608
- if (r) {
609
- const h = x(r), u = a && I(a) ? x(a) : a;
610
- let f = h, g = oe(f);
611
- for (; g && a && u !== f; ) {
612
- const y = N(g), w = g.getBoundingClientRect(), D = M(g), v = w.left + (g.clientLeft + parseFloat(D.paddingLeft)) * y.x, k = w.top + (g.clientTop + parseFloat(D.paddingTop)) * y.y;
613
- l *= y.x, c *= y.y, d *= y.x, p *= y.y, l += v, c += k, f = x(g), g = oe(f);
1504
+ function Ln(e, t, n) {
1505
+ return t === void 0 && (t = !1), !n || t && n !== z(e) ? !1 : t;
1506
+ }
1507
+ function fe(e, t, n, a) {
1508
+ t === void 0 && (t = !1), n === void 0 && (n = !1);
1509
+ const r = e.getBoundingClientRect(), o = gt(e);
1510
+ let s = W(1);
1511
+ t && (a ? Y(a) && (s = re(a)) : s = re(e));
1512
+ const i = Ln(o, n, a) ? ft(o) : W(0);
1513
+ let d = (r.left + i.x) / s.x, l = (r.top + i.y) / s.y, c = r.width / s.x, u = r.height / s.y;
1514
+ if (o) {
1515
+ const p = z(o), g = a && Y(a) ? z(a) : a;
1516
+ let h = p, f = ke(h);
1517
+ for (; f && a && g !== h; ) {
1518
+ const y = re(f), m = f.getBoundingClientRect(), x = V(f), M = m.left + (f.clientLeft + parseFloat(x.paddingLeft)) * y.x, I = m.top + (f.clientTop + parseFloat(x.paddingTop)) * y.y;
1519
+ d *= y.x, l *= y.y, c *= y.x, u *= y.y, d += M, l += I, h = z(f), f = ke(h);
614
1520
  }
615
1521
  }
616
- return X({
617
- width: d,
618
- height: p,
619
- x: l,
620
- y: c
1522
+ return xe({
1523
+ width: c,
1524
+ height: u,
1525
+ x: d,
1526
+ y: l
621
1527
  });
622
1528
  }
623
- function ae(n, e) {
624
- const t = te(n).scrollLeft;
625
- return e ? e.left + t : W($(n)).left + t;
1529
+ function Ce(e, t) {
1530
+ const n = Ee(e).scrollLeft;
1531
+ return t ? t.left + n : fe(G(e)).left + n;
626
1532
  }
627
- function $e(n, e) {
628
- const t = n.getBoundingClientRect(), a = t.left + e.scrollLeft - ae(n, t), i = t.top + e.scrollTop;
1533
+ function ht(e, t) {
1534
+ const n = e.getBoundingClientRect(), a = n.left + t.scrollLeft - Ce(e, n), r = n.top + t.scrollTop;
629
1535
  return {
630
1536
  x: a,
631
- y: i
1537
+ y: r
632
1538
  };
633
1539
  }
634
- function pt(n) {
1540
+ function An(e) {
635
1541
  let {
636
- elements: e,
637
- rect: t,
1542
+ elements: t,
1543
+ rect: n,
638
1544
  offsetParent: a,
639
- strategy: i
640
- } = n;
641
- const r = i === "fixed", o = $(a), s = e ? ee(e.floating) : !1;
642
- if (a === o || s && r)
643
- return t;
644
- let l = {
1545
+ strategy: r
1546
+ } = e;
1547
+ const o = r === "fixed", s = G(a), i = t ? Ie(t.floating) : !1;
1548
+ if (a === s || i && o)
1549
+ return n;
1550
+ let d = {
645
1551
  scrollLeft: 0,
646
1552
  scrollTop: 0
647
- }, c = C(1);
648
- const d = C(0), p = E(a);
649
- if ((p || !p && !r) && ((H(a) !== "body" || K(o)) && (l = te(a)), E(a))) {
650
- const u = W(a);
651
- c = N(a), d.x = u.x + a.clientLeft, d.y = u.y + a.clientTop;
1553
+ }, l = W(1);
1554
+ const c = W(0), u = j(a);
1555
+ if ((u || !u && !o) && ((ie(a) !== "body" || ye(s)) && (d = Ee(a)), j(a))) {
1556
+ const g = fe(a);
1557
+ l = re(a), c.x = g.x + a.clientLeft, c.y = g.y + a.clientTop;
652
1558
  }
653
- const h = o && !p && !r ? $e(o, l) : C(0);
1559
+ const p = s && !u && !o ? ht(s, d) : W(0);
654
1560
  return {
655
- width: t.width * c.x,
656
- height: t.height * c.y,
657
- x: t.x * c.x - l.scrollLeft * c.x + d.x + h.x,
658
- y: t.y * c.y - l.scrollTop * c.y + d.y + h.y
1561
+ width: n.width * l.x,
1562
+ height: n.height * l.y,
1563
+ x: n.x * l.x - d.scrollLeft * l.x + c.x + p.x,
1564
+ y: n.y * l.y - d.scrollTop * l.y + c.y + p.y
659
1565
  };
660
1566
  }
661
- function ht(n) {
662
- return Array.from(n.getClientRects());
663
- }
664
- function ut(n) {
665
- const e = $(n), t = te(n), a = n.ownerDocument.body, i = V(e.scrollWidth, e.clientWidth, a.scrollWidth, a.clientWidth), r = V(e.scrollHeight, e.clientHeight, a.scrollHeight, a.clientHeight);
666
- let o = -t.scrollLeft + ae(n);
667
- const s = -t.scrollTop;
668
- return M(a).direction === "rtl" && (o += V(e.clientWidth, a.clientWidth) - i), {
669
- width: i,
670
- height: r,
671
- x: o,
672
- y: s
673
- };
1567
+ function Rn(e) {
1568
+ return Array.from(e.getClientRects());
674
1569
  }
675
- const ve = 25;
676
- function ft(n, e) {
677
- const t = x(n), a = $(n), i = t.visualViewport;
678
- let r = a.clientWidth, o = a.clientHeight, s = 0, l = 0;
679
- if (i) {
680
- r = i.width, o = i.height;
681
- const d = le();
682
- (!d || d && e === "fixed") && (s = i.offsetLeft, l = i.offsetTop);
683
- }
684
- const c = ae(a);
685
- if (c <= 0) {
686
- const d = a.ownerDocument, p = d.body, h = getComputedStyle(p), u = d.compatMode === "CSS1Compat" && parseFloat(h.marginLeft) + parseFloat(h.marginRight) || 0, f = Math.abs(a.clientWidth - p.clientWidth - u);
687
- f <= ve && (r -= f);
688
- } else c <= ve && (r += c);
689
- return {
1570
+ function $n(e) {
1571
+ const t = G(e), n = Ee(e), a = e.ownerDocument.body, r = ae(t.scrollWidth, t.clientWidth, a.scrollWidth, a.clientWidth), o = ae(t.scrollHeight, t.clientHeight, a.scrollHeight, a.clientHeight);
1572
+ let s = -n.scrollLeft + Ce(e);
1573
+ const i = -n.scrollTop;
1574
+ return V(a).direction === "rtl" && (s += ae(t.clientWidth, a.clientWidth) - r), {
690
1575
  width: r,
691
1576
  height: o,
692
1577
  x: s,
693
- y: l
1578
+ y: i
694
1579
  };
695
1580
  }
696
- const gt = /* @__PURE__ */ new Set(["absolute", "fixed"]);
697
- function yt(n, e) {
698
- const t = W(n, !0, e === "fixed"), a = t.top + n.clientTop, i = t.left + n.clientLeft, r = E(n) ? N(n) : C(1), o = n.clientWidth * r.x, s = n.clientHeight * r.y, l = i * r.x, c = a * r.y;
1581
+ const Ke = 25;
1582
+ function Pn(e, t) {
1583
+ const n = z(e), a = G(e), r = n.visualViewport;
1584
+ let o = a.clientWidth, s = a.clientHeight, i = 0, d = 0;
1585
+ if (r) {
1586
+ o = r.width, s = r.height;
1587
+ const c = Ye();
1588
+ (!c || c && t === "fixed") && (i = r.offsetLeft, d = r.offsetTop);
1589
+ }
1590
+ const l = Ce(a);
1591
+ if (l <= 0) {
1592
+ const c = a.ownerDocument, u = c.body, p = getComputedStyle(u), g = c.compatMode === "CSS1Compat" && parseFloat(p.marginLeft) + parseFloat(p.marginRight) || 0, h = Math.abs(a.clientWidth - u.clientWidth - g);
1593
+ h <= Ke && (o -= h);
1594
+ } else l <= Ke && (o += l);
699
1595
  return {
700
1596
  width: o,
701
1597
  height: s,
702
- x: l,
703
- y: c
1598
+ x: i,
1599
+ y: d
1600
+ };
1601
+ }
1602
+ const kn = /* @__PURE__ */ new Set(["absolute", "fixed"]);
1603
+ function Tn(e, t) {
1604
+ const n = fe(e, !0, t === "fixed"), a = n.top + e.clientTop, r = n.left + e.clientLeft, o = j(e) ? re(e) : W(1), s = e.clientWidth * o.x, i = e.clientHeight * o.y, d = r * o.x, l = a * o.y;
1605
+ return {
1606
+ width: s,
1607
+ height: i,
1608
+ x: d,
1609
+ y: l
704
1610
  };
705
1611
  }
706
- function _e(n, e, t) {
1612
+ function Ue(e, t, n) {
707
1613
  let a;
708
- if (e === "viewport")
709
- a = ft(n, t);
710
- else if (e === "document")
711
- a = ut($(n));
712
- else if (I(e))
713
- a = yt(e, t);
1614
+ if (t === "viewport")
1615
+ a = Pn(e, n);
1616
+ else if (t === "document")
1617
+ a = $n(G(e));
1618
+ else if (Y(t))
1619
+ a = Tn(t, n);
714
1620
  else {
715
- const i = Pe(n);
1621
+ const r = ft(e);
716
1622
  a = {
717
- x: e.x - i.x,
718
- y: e.y - i.y,
719
- width: e.width,
720
- height: e.height
1623
+ x: t.x - r.x,
1624
+ y: t.y - r.y,
1625
+ width: t.width,
1626
+ height: t.height
721
1627
  };
722
1628
  }
723
- return X(a);
1629
+ return xe(a);
724
1630
  }
725
- function Ae(n, e) {
726
- const t = R(n);
727
- return t === e || !I(t) || z(t) ? !1 : M(t).position === "fixed" || Ae(t, e);
1631
+ function mt(e, t) {
1632
+ const n = ee(e);
1633
+ return n === t || !Y(n) || se(n) ? !1 : V(n).position === "fixed" || mt(n, t);
728
1634
  }
729
- function mt(n, e) {
730
- const t = e.get(n);
731
- if (t)
732
- return t;
733
- let a = Me(n, []).filter((s) => I(s) && H(s) !== "body"), i = null;
734
- const r = M(n).position === "fixed";
735
- let o = r ? R(n) : n;
736
- for (; I(o) && !z(o); ) {
737
- const s = M(o), l = ce(o);
738
- !l && s.position === "fixed" && (i = null), (r ? !l && !i : !l && s.position === "static" && !!i && gt.has(i.position) || K(o) && !l && Ae(n, o)) ? a = a.filter((d) => d !== o) : i = s, o = R(o);
1635
+ function zn(e, t) {
1636
+ const n = t.get(e);
1637
+ if (n)
1638
+ return n;
1639
+ let a = pt(e, []).filter((i) => Y(i) && ie(i) !== "body"), r = null;
1640
+ const o = V(e).position === "fixed";
1641
+ let s = o ? ee(e) : e;
1642
+ for (; Y(s) && !se(s); ) {
1643
+ const i = V(s), d = He(s);
1644
+ !d && i.position === "fixed" && (r = null), (o ? !d && !r : !d && i.position === "static" && !!r && kn.has(r.position) || ye(s) && !d && mt(e, s)) ? a = a.filter((c) => c !== s) : r = i, s = ee(s);
739
1645
  }
740
- return e.set(n, a), a;
1646
+ return t.set(e, a), a;
741
1647
  }
742
- function vt(n) {
1648
+ function Fn(e) {
743
1649
  let {
744
- element: e,
745
- boundary: t,
1650
+ element: t,
1651
+ boundary: n,
746
1652
  rootBoundary: a,
747
- strategy: i
748
- } = n;
749
- const o = [...t === "clippingAncestors" ? ee(e) ? [] : mt(e, this._c) : [].concat(t), a], s = o[0], l = o.reduce((c, d) => {
750
- const p = _e(e, d, i);
751
- return c.top = V(p.top, c.top), c.right = re(p.right, c.right), c.bottom = re(p.bottom, c.bottom), c.left = V(p.left, c.left), c;
752
- }, _e(e, s, i));
1653
+ strategy: r
1654
+ } = e;
1655
+ const s = [...n === "clippingAncestors" ? Ie(t) ? [] : zn(t, this._c) : [].concat(n), a], i = s[0], d = s.reduce((l, c) => {
1656
+ const u = Ue(t, c, r);
1657
+ return l.top = ae(u.top, l.top), l.right = ge(u.right, l.right), l.bottom = ge(u.bottom, l.bottom), l.left = ae(u.left, l.left), l;
1658
+ }, Ue(t, i, r));
753
1659
  return {
754
- width: l.right - l.left,
755
- height: l.bottom - l.top,
756
- x: l.left,
757
- y: l.top
1660
+ width: d.right - d.left,
1661
+ height: d.bottom - d.top,
1662
+ x: d.left,
1663
+ y: d.top
758
1664
  };
759
1665
  }
760
- function _t(n) {
1666
+ function Nn(e) {
761
1667
  const {
762
- width: e,
763
- height: t
764
- } = Ce(n);
1668
+ width: t,
1669
+ height: n
1670
+ } = ut(e);
765
1671
  return {
766
- width: e,
767
- height: t
1672
+ width: t,
1673
+ height: n
768
1674
  };
769
1675
  }
770
- function kt(n, e, t) {
771
- const a = E(e), i = $(e), r = t === "fixed", o = W(n, !0, r, e);
772
- let s = {
1676
+ function On(e, t, n) {
1677
+ const a = j(t), r = G(t), o = n === "fixed", s = fe(e, !0, o, t);
1678
+ let i = {
773
1679
  scrollLeft: 0,
774
1680
  scrollTop: 0
775
1681
  };
776
- const l = C(0);
777
- function c() {
778
- l.x = ae(i);
779
- }
780
- if (a || !a && !r)
781
- if ((H(e) !== "body" || K(i)) && (s = te(e)), a) {
782
- const u = W(e, !0, r, e);
783
- l.x = u.x + e.clientLeft, l.y = u.y + e.clientTop;
784
- } else i && c();
785
- r && !a && i && c();
786
- const d = i && !a && !r ? $e(i, s) : C(0), p = o.left + s.scrollLeft - l.x - d.x, h = o.top + s.scrollTop - l.y - d.y;
1682
+ const d = W(0);
1683
+ function l() {
1684
+ d.x = Ce(r);
1685
+ }
1686
+ if (a || !a && !o)
1687
+ if ((ie(t) !== "body" || ye(r)) && (i = Ee(t)), a) {
1688
+ const g = fe(t, !0, o, t);
1689
+ d.x = g.x + t.clientLeft, d.y = g.y + t.clientTop;
1690
+ } else r && l();
1691
+ o && !a && r && l();
1692
+ const c = r && !a && !o ? ht(r, i) : W(0), u = s.left + i.scrollLeft - d.x - c.x, p = s.top + i.scrollTop - d.y - c.y;
787
1693
  return {
788
- x: p,
789
- y: h,
790
- width: o.width,
791
- height: o.height
1694
+ x: u,
1695
+ y: p,
1696
+ width: s.width,
1697
+ height: s.height
792
1698
  };
793
1699
  }
794
- function ie(n) {
795
- return M(n).position === "static";
1700
+ function Ae(e) {
1701
+ return V(e).position === "static";
796
1702
  }
797
- function ke(n, e) {
798
- if (!E(n) || M(n).position === "fixed")
1703
+ function Xe(e, t) {
1704
+ if (!j(e) || V(e).position === "fixed")
799
1705
  return null;
800
- if (e)
801
- return e(n);
802
- let t = n.offsetParent;
803
- return $(n) === t && (t = t.ownerDocument.body), t;
804
- }
805
- function Le(n, e) {
806
- const t = x(n);
807
- if (ee(n))
808
- return t;
809
- if (!E(n)) {
810
- let i = R(n);
811
- for (; i && !z(i); ) {
812
- if (I(i) && !ie(i))
813
- return i;
814
- i = R(i);
1706
+ if (t)
1707
+ return t(e);
1708
+ let n = e.offsetParent;
1709
+ return G(e) === n && (n = n.ownerDocument.body), n;
1710
+ }
1711
+ function yt(e, t) {
1712
+ const n = z(e);
1713
+ if (Ie(e))
1714
+ return n;
1715
+ if (!j(e)) {
1716
+ let r = ee(e);
1717
+ for (; r && !se(r); ) {
1718
+ if (Y(r) && !Ae(r))
1719
+ return r;
1720
+ r = ee(r);
815
1721
  }
816
- return t;
1722
+ return n;
817
1723
  }
818
- let a = ke(n, e);
819
- for (; a && at(a) && ie(a); )
820
- a = ke(a, e);
821
- return a && z(a) && ie(a) && !ce(a) ? t : a || ot(n) || t;
1724
+ let a = Xe(e, t);
1725
+ for (; a && _n(a) && Ae(a); )
1726
+ a = Xe(a, t);
1727
+ return a && se(a) && Ae(a) && !He(a) ? n : a || In(e) || n;
822
1728
  }
823
- const Dt = async function(n) {
824
- const e = this.getOffsetParent || Le, t = this.getDimensions, a = await t(n.floating);
1729
+ const Hn = async function(e) {
1730
+ const t = this.getOffsetParent || yt, n = this.getDimensions, a = await n(e.floating);
825
1731
  return {
826
- reference: kt(n.reference, await e(n.floating), n.strategy),
1732
+ reference: On(e.reference, await t(e.floating), e.strategy),
827
1733
  floating: {
828
1734
  x: 0,
829
1735
  y: 0,
@@ -832,837 +1738,1232 @@ const Dt = async function(n) {
832
1738
  }
833
1739
  };
834
1740
  };
835
- function wt(n) {
836
- return M(n).direction === "rtl";
837
- }
838
- const xt = {
839
- convertOffsetParentRelativeRectToViewportRelativeRect: pt,
840
- getDocumentElement: $,
841
- getClippingRect: vt,
842
- getOffsetParent: Le,
843
- getElementRects: Dt,
844
- getClientRects: ht,
845
- getDimensions: _t,
846
- getScale: N,
847
- isElement: I,
848
- isRTL: wt
849
- }, bt = Qe, St = Ze, It = Je, Mt = (n, e, t) => {
850
- const a = /* @__PURE__ */ new Map(), i = {
851
- platform: xt,
852
- ...t
853
- }, r = {
854
- ...i.platform,
1741
+ function Yn(e) {
1742
+ return V(e).direction === "rtl";
1743
+ }
1744
+ const Vn = {
1745
+ convertOffsetParentRelativeRectToViewportRelativeRect: An,
1746
+ getDocumentElement: G,
1747
+ getClippingRect: Fn,
1748
+ getOffsetParent: yt,
1749
+ getElementRects: Hn,
1750
+ getClientRects: Rn,
1751
+ getDimensions: Nn,
1752
+ getScale: re,
1753
+ isElement: Y,
1754
+ isRTL: Yn
1755
+ }, Te = yn, ze = vn, vt = fn, qn = gn, Dt = (e, t, n) => {
1756
+ const a = /* @__PURE__ */ new Map(), r = {
1757
+ platform: Vn,
1758
+ ...n
1759
+ }, o = {
1760
+ ...r.platform,
855
1761
  _c: a
856
1762
  };
857
- return Ue(n, e, {
858
- ...i,
859
- platform: r
1763
+ return un(e, t, {
1764
+ ...r,
1765
+ platform: o
860
1766
  });
861
1767
  };
862
- class Ct {
863
- constructor(e, t = {}) {
864
- _(this, "input");
865
- _(this, "options");
866
- _(this, "formatInfo");
867
- _(this, "_previousInputValue");
868
- _(this, "currentDate");
869
- _(this, "monthDates");
870
- _(this, "displayMonths");
871
- _(this, "selectedDate");
872
- _(this, "selectedStartDate");
873
- _(this, "selectedEndDate");
874
- _(this, "focusedDayIndex");
875
- _(this, "activeMonthIndex");
876
- _(this, "showingRollingSelector");
877
- _(this, "draggingType");
878
- _(this, "isDragging");
879
- _(this, "dragStartDate");
880
- _(this, "originalStartDate");
881
- _(this, "originalEndDate");
882
- _(this, "dragPreviewStart");
883
- _(this, "dragPreviewEnd");
884
- _(this, "autoScrollInterval");
885
- _(this, "navInterval");
886
- _(this, "calendar");
887
- _(this, "containerElement");
888
- _(this, "onDragMoveBound");
889
- _(this, "onDragEndBound");
890
- _(this, "clickOutsideHandler");
891
- _(this, "isFirstRender", !0);
892
- console.log("[DatePicker 4] Constructor called for input:", e), this.input = e, this.containerElement = t.container || document.body, this.options = {
893
- mode: t.mode || "single",
894
- position: t.position || "bottom-start",
895
- monthsToShow: t.monthsToShow || (t.mode === "range" ? 2 : 1),
896
- format: t.format || "YYYY-MM-DD",
897
- calendarTrigger: t.calendarTrigger || "auto",
898
- onSelect: t.onSelect || void 0,
899
- container: this.containerElement
900
- }, this.formatInfo = this.parseFormat(this.options.format), console.log("[DatePicker] Format info:", this.formatInfo), this._previousInputValue = "", this.currentDate = /* @__PURE__ */ new Date(), this.monthDates = [];
901
- const a = /* @__PURE__ */ new Date();
902
- for (let i = 0; i < this.options.monthsToShow; i++) {
903
- const r = new Date(a.getFullYear(), a.getMonth() + i, 1);
904
- this.monthDates.push(r), console.log(`[DatePicker Init] monthDates[${i}] = ${r.getFullYear()}-${r.getMonth() + 1}`);
1768
+ function bt(e) {
1769
+ e.options.positioningMode !== "inline" && (B.debug("show() - adding visible class"), e.isFirstRender && (e.renderCalendar(), e.isFirstRender = !1), e.calendar.classList.add("drp-date-picker--visible"), e.isCalendarActive = !0, B.debug("show() - calendar classes:", e.calendar.className), wt(e), setTimeout(() => {
1770
+ const t = window.getComputedStyle(e.calendar);
1771
+ B.debug("show() - computed styles - display:", t.display, "position:", t.position, "left:", t.left, "top:", t.top, "z-index:", t.zIndex);
1772
+ }, 100));
1773
+ }
1774
+ function _t(e) {
1775
+ if (e.options.positioningMode !== "inline" && e.calendar.classList.contains("drp-date-picker--visible")) {
1776
+ e.calendar.classList.remove("drp-date-picker--visible"), e.isCalendarActive = !1;
1777
+ for (let t = 0; t < e.showingRollingSelector.length; t++)
1778
+ e.showingRollingSelector[t] = !1;
1779
+ e.isFirstRender || e.renderCalendar(), e.lockedPlacement = void 0;
1780
+ }
1781
+ }
1782
+ function Bn(e) {
1783
+ e.calendar.classList.contains("drp-date-picker--visible") ? _t(e) : bt(e);
1784
+ }
1785
+ async function wt(e) {
1786
+ if (B.debug("position() - locked placement:", e.lockedPlacement), !e.input) return;
1787
+ const t = e.lockedPlacement ? [Te(8), ze({ padding: 8 })] : [Te(8), vt(), ze({ padding: 8 })], n = await Dt(e.input, e.calendar, {
1788
+ placement: e.lockedPlacement || e.options.calendarPlacement,
1789
+ middleware: t
1790
+ });
1791
+ B.debug("position() - FloatingUI computed - x:", n.x, "y:", n.y, "placement:", n.placement), e.lockedPlacement || (e.lockedPlacement = n.placement, B.debug("position() - locked placement to:", e.lockedPlacement)), e.calendar.style.left = `${n.x}px`, e.calendar.style.top = `${n.y}px`, B.debug("position() - applied styles to calendar");
1792
+ }
1793
+ async function Wn(e, t, n) {
1794
+ if (!e.tooltip || !e.tooltipArrow) return;
1795
+ e.currentTooltipTarget = t, e.tooltip.textContent = n, e.tooltip.appendChild(e.tooltipArrow), e.tooltip.classList.add("drp-date-picker__tooltip--visible");
1796
+ const { x: a, y: r, placement: o, middlewareData: s } = await Dt(t, e.tooltip, {
1797
+ placement: "top",
1798
+ middleware: [
1799
+ Te(6),
1800
+ vt(),
1801
+ ze({ padding: 5 }),
1802
+ qn({ element: e.tooltipArrow })
1803
+ ]
1804
+ });
1805
+ if (Object.assign(e.tooltip.style, {
1806
+ left: `${a}px`,
1807
+ top: `${r}px`
1808
+ }), s.arrow) {
1809
+ const { x: i, y: d } = s.arrow, l = {
1810
+ top: "bottom",
1811
+ right: "left",
1812
+ bottom: "top",
1813
+ left: "right"
1814
+ }[o.split("-")[0]];
1815
+ Object.assign(e.tooltipArrow.style, {
1816
+ left: i != null ? `${i}px` : "",
1817
+ top: d != null ? `${d}px` : "",
1818
+ right: "",
1819
+ bottom: "",
1820
+ [l]: "-4px"
1821
+ });
1822
+ }
1823
+ }
1824
+ function jn(e) {
1825
+ e.tooltip && (e.tooltip.classList.remove("drp-date-picker__tooltip--visible"), e.currentTooltipTarget = void 0);
1826
+ }
1827
+ function Kn(e) {
1828
+ if (e.loadingOverlay) return;
1829
+ const t = document.createElement("div");
1830
+ t.className = "drp-date-picker__loading-overlay", t.innerHTML = `
1831
+ <div class="drp-date-picker__loading-spinner"></div>
1832
+ `, e.calendar.appendChild(t), e.loadingOverlay = t;
1833
+ }
1834
+ function Ge(e) {
1835
+ e.loadingOverlay && (e.loadingOverlay.remove(), e.loadingOverlay = void 0);
1836
+ }
1837
+ async function xt(e, t, n) {
1838
+ if (U.debug(" validateRangeAsync called - mode:", e.options.disabledDatesHandling, "start:", t, "end:", n), e.options.disabledDatesHandling === "prevent") {
1839
+ if (U.debug(" Checking PREVENT mode"), e.hasDisabledDatesInRange(t, n))
1840
+ return U.debug(" PREVENT mode - range contains disabled dates"), { isValid: !1, message: "Range contains disabled dates" };
1841
+ } else if (e.options.disabledDatesHandling === "block" && (U.debug(" Checking BLOCK mode"), e.hasDisabledDatesInRange(t, n))) {
1842
+ U.debug(" BLOCK mode - range contains disabled dates, adjusting");
1843
+ const a = e.findLastEnabledBeforeGap(t, n);
1844
+ return U.debug(" BLOCK mode - adjusted end:", a), { isValid: !0, adjustedStart: t, adjustedEnd: a };
1845
+ }
1846
+ if (e.options.validateRangeCallback)
1847
+ try {
1848
+ e.isValidating = !0, Kn(e);
1849
+ const a = await e.options.validateRangeCallback(t, n);
1850
+ switch (Ge(e), e.isValidating = !1, a.action) {
1851
+ case "accept":
1852
+ return { isValid: !0 };
1853
+ case "adjust":
1854
+ return a.adjustedStartDate && a.adjustedEndDate ? {
1855
+ isValid: !0,
1856
+ adjustedStart: a.adjustedStartDate,
1857
+ adjustedEnd: a.adjustedEndDate,
1858
+ message: a.message
1859
+ } : { isValid: !1, message: a.message || "Invalid adjustment" };
1860
+ case "restore":
1861
+ return { isValid: !1, message: a.message };
1862
+ case "clear":
1863
+ return e.clearSelection(), { isValid: !1, message: a.message };
1864
+ default:
1865
+ return { isValid: !1, message: "Unknown validation action" };
1866
+ }
1867
+ } catch (a) {
1868
+ return Ge(e), e.isValidating = !1, k.error("validateRangeAsync() - async validation error:", a), { isValid: !1, message: "Validation error occurred" };
1869
+ }
1870
+ return { isValid: !0 };
1871
+ }
1872
+ async function Un(e, t) {
1873
+ if (t.classList.contains("drp-date-picker__day--disabled")) return;
1874
+ if (!t.dataset || !t.dataset.date) {
1875
+ k.warn("selectDay() - called with invalid element:", t);
1876
+ return;
1877
+ }
1878
+ const [n, a, r] = t.dataset.date.split("-").map(Number), o = new Date(n, a - 1, r);
1879
+ t.classList.contains("drp-date-picker__day--other-month");
1880
+ const s = t.closest(".drp-date-picker__days");
1881
+ if (s && s instanceof HTMLElement) {
1882
+ e.activeMonthIndex = parseInt(s.dataset.monthIndex || "0") || 0, te.debug(`Col${e.activeMonthIndex} selectDay - activeMonthIndex:`, e.activeMonthIndex);
1883
+ const i = s.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)");
1884
+ e.focusedDayIndex = Array.from(i).indexOf(t), te.debug(`Col${e.activeMonthIndex} selectDay - set focusedDayIndex to:`, e.focusedDayIndex);
1885
+ }
1886
+ if (e.options.selectionMode === "single")
1887
+ e.selectedDate = o, e.input && (e.input.value = e.formatDate(o)), e.options.onSelect && e.options.onSelect(o), e.options.positioningMode === "floating" && e.hide();
1888
+ else if (!e.selectedStartDate || e.selectedEndDate)
1889
+ e.selectedStartDate = o, e.selectedEndDate = null, e.input && (e.input.value = `${e.formatDate(e.selectedStartDate)} - ...`);
1890
+ else {
1891
+ let i = e.selectedStartDate, d = o;
1892
+ o < e.selectedStartDate && (d = e.selectedStartDate, i = o), te.debug(" selectDay - calling validateRangeAsync with:", i, d);
1893
+ const l = await xt(e, i, d);
1894
+ if (te.debug(" selectDay - validation result:", l), !l.isValid) {
1895
+ l.message && k.warn("selectDay() - range validation failed:", l.message), e.renderCalendar(), e.updateSummary();
1896
+ return;
1897
+ }
1898
+ e.selectedStartDate = l.adjustedStart || i, e.selectedEndDate = l.adjustedEnd || d, e.input && (e.input.value = `${e.formatDate(e.selectedStartDate)} - ${e.formatDate(e.selectedEndDate)}`), e.options.onSelect && e.options.onSelect({ start: e.selectedStartDate, end: e.selectedEndDate });
1899
+ }
1900
+ if (e.renderCalendar(), e.updateSummary(), e.options.selectionMode === "range" && e.selectedEndDate) {
1901
+ const i = e.selectedEndDate;
1902
+ for (let d = 0; d < e.monthDates.length; d++) {
1903
+ const l = e.monthDates[d];
1904
+ if (i.getFullYear() === l.getFullYear() && i.getMonth() === l.getMonth()) {
1905
+ e.activeMonthIndex = d;
1906
+ const c = e.calendar.querySelector(`.drp-date-picker__days[data-month-index="${d}"]`);
1907
+ if (c) {
1908
+ const u = c.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)"), p = Array.from(u).findIndex((g) => {
1909
+ const h = g.dataset.date;
1910
+ if (!h) return !1;
1911
+ const [f, y, m] = h.split("-").map(Number), x = new Date(f, y - 1, m);
1912
+ return e.isSameDay(x, i);
1913
+ });
1914
+ p !== -1 && (e.focusedDayIndex = p, u.forEach((g) => g.classList.remove("drp-date-picker__day--focused")), u[p] && u[p].classList.add("drp-date-picker__day--focused"));
1915
+ }
1916
+ break;
1917
+ }
1918
+ }
1919
+ }
1920
+ }
1921
+ function Xn(e) {
1922
+ e.monthDates[e.activeMonthIndex] = /* @__PURE__ */ new Date(), e.selectedDate = /* @__PURE__ */ new Date(), e.input && (e.input.value = e.formatDate(e.selectedDate)), e.options.onSelect && e.options.onSelect(e.selectedDate), e.renderCalendar(), e.options.selectionMode === "single" && e.hide();
1923
+ }
1924
+ function Gn(e) {
1925
+ e.selectedDate = null, e.selectedStartDate = null, e.selectedEndDate = null, e.input && (e.input.value = ""), e.renderCalendar(), e.updateSummary();
1926
+ }
1927
+ function Jn(e) {
1928
+ e.selectedStartDate && e.selectedEndDate && e.hide();
1929
+ }
1930
+ function Qn(e) {
1931
+ e.options.selectionMode === "range" && e.calendar.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--disabled):not(.drp-date-picker__day--other-month)").forEach((n) => {
1932
+ n.addEventListener("mousedown", (a) => {
1933
+ const r = a, o = n, s = r.clientX, i = r.clientY, d = 5;
1934
+ let l = !1, c = !1;
1935
+ const u = o.classList.contains("drp-date-picker__day--range-start"), p = o.classList.contains("drp-date-picker__day--range-end");
1936
+ let g;
1937
+ u && e.selectedStartDate && e.selectedEndDate ? g = "start" : p && e.selectedStartDate && e.selectedEndDate ? g = "end" : g = "start";
1938
+ const h = (y) => {
1939
+ const m = Math.abs(y.clientX - s), x = Math.abs(y.clientY - i);
1940
+ !l && (m > d || x > d) && (l = !0), l && !c && (c = !0, St(e, r, g, o), document.removeEventListener("mousemove", h), document.removeEventListener("mouseup", f));
1941
+ }, f = () => {
1942
+ document.removeEventListener("mousemove", h), document.removeEventListener("mouseup", f);
1943
+ };
1944
+ document.addEventListener("mousemove", h), document.addEventListener("mouseup", f);
1945
+ });
1946
+ });
1947
+ }
1948
+ function St(e, t, n, a) {
1949
+ t.preventDefault(), t.stopPropagation(), e.isDragging = !0, e.draggingType = n;
1950
+ const r = a, o = r.dataset.date;
1951
+ let s = null;
1952
+ if (o) {
1953
+ const [i, d, l] = o.split("-").map(Number);
1954
+ s = new Date(i, d - 1, l);
1955
+ }
1956
+ !e.selectedStartDate && !e.selectedEndDate ? s && (e.originalStartDate = s, e.originalEndDate = null, e.draggingType = "end") : s && e.selectedStartDate && !e.selectedEndDate ? s.getTime() === e.selectedStartDate.getTime() ? (e.originalStartDate = new Date(e.selectedStartDate), e.originalEndDate = null) : (e.selectedStartDate = null, e.selectedEndDate = null, e.focusedDayIndex = null, e.calendar.querySelectorAll(".drp-date-picker__day--range-start, .drp-date-picker__day--range-end, .drp-date-picker__day--selected, .drp-date-picker__day--focused").forEach((d) => {
1957
+ d.classList.remove("drp-date-picker__day--range-start", "drp-date-picker__day--range-end", "drp-date-picker__day--selected", "drp-date-picker__day--focused");
1958
+ }), e.originalStartDate = s, e.originalEndDate = null, e.draggingType = "end") : (e.selectedStartDate && (e.originalStartDate = new Date(e.selectedStartDate)), e.selectedEndDate && (e.originalEndDate = new Date(e.selectedEndDate))), r.classList.add("drp-date-picker__day--dragging"), F.debug(`Started dragging ${n} date`), e.onDragMoveBound = (i) => Mt(e, i), e.onDragEndBound = async (i) => await It(e), document.addEventListener("mousemove", e.onDragMoveBound), document.addEventListener("mouseup", e.onDragEndBound), document.body.style.cursor = "grabbing";
1959
+ }
1960
+ function Mt(e, t) {
1961
+ if (!e.isDragging) return;
1962
+ let n = null;
1963
+ e.containerElement instanceof ShadowRoot && "elementsFromPoint" in e.containerElement ? n = e.containerElement.elementsFromPoint(t.clientX, t.clientY)[0] || null : n = document.elementFromPoint(t.clientX, t.clientY);
1964
+ const a = n == null ? void 0 : n.closest(".drp-date-picker__nav--prev"), r = n == null ? void 0 : n.closest(".drp-date-picker__nav--next");
1965
+ if (a || r) {
1966
+ if (!e.navInterval) {
1967
+ const p = (a || r).closest(".drp-date-picker__month");
1968
+ if (p && p instanceof HTMLElement) {
1969
+ const g = parseInt(p.dataset.monthIndex || "0"), h = !!a;
1970
+ h ? e.prevMonth(g) : e.nextMonth(g), e.navInterval = window.setInterval(() => {
1971
+ h ? e.prevMonth(g) : e.nextMonth(g);
1972
+ }, 1e3);
1973
+ }
1974
+ }
1975
+ return;
1976
+ } else
1977
+ e.navInterval && (clearInterval(e.navInterval), e.navInterval = null);
1978
+ const o = n;
1979
+ if (!o || !o.classList.contains("drp-date-picker__day")) return;
1980
+ const s = o.dataset.date;
1981
+ if (!s) return;
1982
+ const [i, d, l] = s.split("-").map(Number);
1983
+ let c = new Date(i, d - 1, l);
1984
+ if (o.classList.contains("drp-date-picker__day--disabled")) {
1985
+ const u = e.draggingType === "start" ? e.originalEndDate && c > e.originalEndDate ? "backward" : "forward" : e.originalStartDate && c < e.originalStartDate ? "forward" : "backward";
1986
+ c = Se(e, c, u);
1987
+ }
1988
+ if (e.draggingType === "start" && e.originalEndDate ? (e.dragPreviewStart = c, e.dragPreviewEnd = e.originalEndDate, e.dragPreviewStart > e.dragPreviewEnd && ([e.dragPreviewStart, e.dragPreviewEnd] = [e.dragPreviewEnd, e.dragPreviewStart], e.draggingType = "end")) : e.originalStartDate && (e.dragPreviewStart = e.originalStartDate, e.dragPreviewEnd = c, e.dragPreviewEnd < e.dragPreviewStart && ([e.dragPreviewStart, e.dragPreviewEnd] = [e.dragPreviewEnd, e.dragPreviewStart], e.draggingType = "start")), e.dragPreviewStart && e.dragPreviewEnd) {
1989
+ const u = e.options.disabledDatesHandling;
1990
+ if (F.debug("onDragMove - mode:", u, "start:", e.dragPreviewStart, "end:", e.dragPreviewEnd), u === "prevent" && e.hasDisabledDatesInRange(e.dragPreviewStart, e.dragPreviewEnd)) {
1991
+ F.debug("PREVENT mode - range contains disabled dates, blocking preview update");
1992
+ return;
1993
+ } else if (u === "block" && e.hasDisabledDatesInRange(e.dragPreviewStart, e.dragPreviewEnd)) {
1994
+ if (F.debug("BLOCK mode - range contains disabled dates, adjusting preview"), e.draggingType === "start" && e.originalEndDate) {
1995
+ const p = e.findLastEnabledBeforeGap(e.dragPreviewStart, e.originalEndDate);
1996
+ F.debug("BLOCK mode - adjusted end (dragging start):", p), e.dragPreviewEnd = p;
1997
+ } else if (e.originalStartDate) {
1998
+ const p = e.findLastEnabledBeforeGap(e.originalStartDate, e.dragPreviewEnd);
1999
+ F.debug("BLOCK mode - adjusted end (dragging end):", p), e.dragPreviewEnd = p;
2000
+ }
2001
+ }
2002
+ }
2003
+ e.updateDragPreview();
2004
+ }
2005
+ async function It(e, t) {
2006
+ if (e.isDragging) {
2007
+ if (F.debug("Ended dragging, finalizing selection"), e.dragPreviewStart && e.dragPreviewEnd) {
2008
+ let n = Se(e, e.dragPreviewStart, "forward"), a = Se(e, e.dragPreviewEnd, "backward");
2009
+ n > a && ([n, a] = [a, n]), F.debug("onDragEnd - calling validateRangeAsync with:", n, a);
2010
+ const r = await xt(e, n, a);
2011
+ F.debug("onDragEnd - validation result:", r), r.isValid ? (e.selectedStartDate = r.adjustedStart || n, e.selectedEndDate = r.adjustedEnd || a, e.input && (e.input.value = `${e.formatDate(e.selectedStartDate)} - ${e.formatDate(e.selectedEndDate)}`), e.options.onSelect && e.options.onSelect({ start: e.selectedStartDate, end: e.selectedEndDate })) : r.message && k.warn("onDragEnd() - drag validation failed:", r.message);
2012
+ }
2013
+ if (e.isDragging = !1, e.draggingType = null, e.dragPreviewStart = null, e.dragPreviewEnd = null, e.calendar.querySelectorAll(".drp-date-picker__day--dragging").forEach((n) => {
2014
+ n.classList.remove("drp-date-picker__day--dragging");
2015
+ }), e.onDragMoveBound && document.removeEventListener("mousemove", e.onDragMoveBound), e.onDragEndBound && document.removeEventListener("mouseup", e.onDragEndBound), e.navInterval && (clearInterval(e.navInterval), e.navInterval = null), document.body.style.cursor = "", e.renderCalendar(), e.updateSummary(), e.selectedEndDate) {
2016
+ const n = e.selectedEndDate;
2017
+ for (let a = 0; a < e.monthDates.length; a++) {
2018
+ const r = e.monthDates[a];
2019
+ if (n.getFullYear() === r.getFullYear() && n.getMonth() === r.getMonth()) {
2020
+ e.activeMonthIndex = a;
2021
+ const o = e.calendar.querySelector(`.drp-date-picker__days[data-month-index="${a}"]`);
2022
+ if (o) {
2023
+ const s = o.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)"), i = Array.from(s).findIndex((d) => {
2024
+ const l = d.dataset.date;
2025
+ if (!l) return !1;
2026
+ const [c, u, p] = l.split("-").map(Number), g = new Date(c, u - 1, p);
2027
+ return e.isSameDay(g, n);
2028
+ });
2029
+ i !== -1 && (e.focusedDayIndex = i, s.forEach((d) => d.classList.remove("drp-date-picker__day--focused")), s[i] && s[i].classList.add("drp-date-picker__day--focused"));
2030
+ }
2031
+ break;
2032
+ }
2033
+ }
2034
+ }
2035
+ }
2036
+ }
2037
+ function Se(e, t, n = "forward") {
2038
+ let r = new Date(t);
2039
+ if (r.setHours(0, 0, 0, 0), !e.isDateDisabledInternal(r))
2040
+ return r;
2041
+ const o = n === "forward" ? 1 : -1;
2042
+ for (let i = 1; i <= 60; i++) {
2043
+ const d = new Date(t);
2044
+ if (d.setDate(d.getDate() + i * o), d.setHours(0, 0, 0, 0), !e.isDateDisabledInternal(d))
2045
+ return d;
2046
+ }
2047
+ const s = -o;
2048
+ for (let i = 1; i <= 60; i++) {
2049
+ const d = new Date(t);
2050
+ if (d.setDate(d.getDate() + i * s), d.setHours(0, 0, 0, 0), !e.isDateDisabledInternal(d))
2051
+ return d;
2052
+ }
2053
+ return t;
2054
+ }
2055
+ function Zn(e, t) {
2056
+ const n = t.target, a = n.value, r = n.selectionStart || 0, o = e._previousInputValue || "", s = a.length < o.length, { separator: i } = e.formatInfo;
2057
+ if (e.options.selectionMode === "range") {
2058
+ const d = a.replace(new RegExp(`[^0-9${i.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}to ]`, "gi"), ""), l = Et(e, d);
2059
+ if (l !== a) {
2060
+ n.value = l;
2061
+ let c = r;
2062
+ if (s)
2063
+ c = r;
2064
+ else if (l.length > a.length)
2065
+ if (l.includes(" to ") && !a.includes(" to ")) {
2066
+ const u = l.indexOf(" to ");
2067
+ r >= u && r <= u + 4 ? c = u + 4 : c = r + (l.length - a.length);
2068
+ } else
2069
+ c = r + (l.length - a.length);
2070
+ n.setSelectionRange(c, c);
2071
+ }
2072
+ } else {
2073
+ const d = a.replace(new RegExp(`[^0-9${i.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}]`, "g"), ""), l = oe(e, d);
2074
+ if (l !== a) {
2075
+ n.value = l;
2076
+ let c = r;
2077
+ if (s)
2078
+ c = r;
2079
+ else if (l.length > a.length && l[r] === i)
2080
+ c = r + 1;
2081
+ else if (l.length > a.length) {
2082
+ const u = (a.substring(0, r).match(new RegExp(i.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "g")) || []).length, g = (l.substring(0, r).match(new RegExp(i.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "g")) || []).length - u;
2083
+ c = r + g;
2084
+ }
2085
+ n.setSelectionRange(c, c);
2086
+ }
2087
+ }
2088
+ e._previousInputValue = n.value, Ve(e);
2089
+ }
2090
+ function oe(e, t) {
2091
+ var c, u, p;
2092
+ const { separator: n, parts: a, maxLength: r } = e.formatInfo, o = t.replace(new RegExp(n.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "g"), ""), s = a.year ? a.year.length : 4, i = [
2093
+ { type: "year", pos: ((c = a.year) == null ? void 0 : c.index) ?? 0, length: s },
2094
+ { type: "month", pos: ((u = a.month) == null ? void 0 : u.index) ?? 1, length: 2 },
2095
+ { type: "day", pos: ((p = a.day) == null ? void 0 : p.index) ?? 2, length: 2 }
2096
+ ].sort((g, h) => g.pos - h.pos);
2097
+ let d = "", l = 0;
2098
+ for (let g = 0; g < i.length; g++) {
2099
+ const h = i[g], f = o.substring(l, l + h.length);
2100
+ if (!f) break;
2101
+ d += f, l += f.length, g < i.length - 1 && f.length === h.length && (d += n);
2102
+ }
2103
+ return d.substring(0, r);
2104
+ }
2105
+ function Et(e, t) {
2106
+ const { separator: n, maxLength: a } = e.formatInfo, r = " to ";
2107
+ let o = "", s = "";
2108
+ if (t.includes(r)) {
2109
+ const d = t.split(r);
2110
+ o = d[0], s = d.slice(1).join(r);
2111
+ } else
2112
+ o = t;
2113
+ const i = oe(e, o);
2114
+ if (i.length === a)
2115
+ if (t.includes(r)) {
2116
+ const d = oe(e, s);
2117
+ return i + r + d;
2118
+ } else
2119
+ return i + r;
2120
+ else
2121
+ return i;
2122
+ }
2123
+ function ea(e, t) {
2124
+ const { key: n, ctrlKey: a, metaKey: r } = t, { separator: o } = e.formatInfo;
2125
+ if (e.calendar.classList.contains("drp-date-picker--visible") && ["ArrowUp", "ArrowDown", "Home", "End", "PageUp", "PageDown"].includes(n)) {
2126
+ t.preventDefault();
2127
+ return;
2128
+ }
2129
+ if (!([
2130
+ "Backspace",
2131
+ "Delete",
2132
+ "Tab",
2133
+ "Escape",
2134
+ "Enter",
2135
+ "ArrowLeft",
2136
+ "ArrowRight",
2137
+ "ArrowUp",
2138
+ "ArrowDown",
2139
+ "Home",
2140
+ "End"
2141
+ ].includes(n) || a || r)) {
2142
+ if (n === o) {
2143
+ const i = t.target, d = i.selectionStart || 0, l = i.value;
2144
+ let c = 0;
2145
+ for (let p = d - 1; p >= 0; p--)
2146
+ if (l[p] === o || l[p] === " ") {
2147
+ c = p + 1;
2148
+ break;
2149
+ }
2150
+ const u = l.substring(c, d);
2151
+ if (/^\d$/.test(u)) {
2152
+ t.preventDefault();
2153
+ const p = l.substring(0, c) + "0" + u + o + l.substring(d);
2154
+ i.value = p;
2155
+ const g = c + 2 + o.length;
2156
+ i.setSelectionRange(g, g), e._previousInputValue = p, i.dispatchEvent(new Event("input", { bubbles: !0 }));
2157
+ return;
2158
+ }
2159
+ }
2160
+ e.options.selectionMode === "range" ? !/^\d$/.test(n) && n !== o && n !== " " && n.toLowerCase() !== "t" && n.toLowerCase() !== "o" && t.preventDefault() : !/^\d$/.test(n) && n !== o && t.preventDefault();
2161
+ }
2162
+ }
2163
+ function ta(e, t) {
2164
+ var p;
2165
+ t.preventDefault();
2166
+ const n = ((p = t.clipboardData) == null ? void 0 : p.getData("text")) || "", { separator: a } = e.formatInfo, r = n.replace(new RegExp(`[^0-9${a.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}]`, "g"), ""), o = oe(e, r), s = t.target, i = s.selectionStart || 0, d = s.selectionEnd || 0, l = s.value, c = l.substring(0, i) + o + l.substring(d);
2167
+ s.value = oe(e, c);
2168
+ const u = i + o.length;
2169
+ s.setSelectionRange(u, u), s.dispatchEvent(new Event("input", { bubbles: !0 })), Ve(e);
2170
+ }
2171
+ function Ve(e) {
2172
+ if (!e.input) return;
2173
+ const t = e.input.value;
2174
+ if (Z.debug("updateCalendarFromInput - value:", t), !t) return;
2175
+ const { separator: n, parts: a, maxLength: r } = e.formatInfo;
2176
+ if (Z.debug("Format info:", { separator: n, parts: a, maxLength: r }), e.options.selectionMode === "range" && t.includes(" to ")) {
2177
+ const s = t.split(" to "), i = s[0], d = s[1];
2178
+ Z.debug("Range parts - start:", i, "end:", d), De(e, i, "start"), d && De(e, d, "end");
2179
+ return;
2180
+ }
2181
+ const o = e.options.selectionMode === "range" ? "start" : "single";
2182
+ De(e, t, o);
2183
+ }
2184
+ function De(e, t, n = "single") {
2185
+ const { separator: a, parts: r, maxLength: o } = e.formatInfo, s = t.split(a);
2186
+ let i = null, d = null, l = null;
2187
+ if (s.forEach((c, u) => {
2188
+ if (c) {
2189
+ if (r.year && r.year.index === u) {
2190
+ const p = parseInt(c, 10);
2191
+ r.year.length === 4 && c.length === 4 ? i = p : r.year.length === 2 && c.length === 2 && (i = p < 100 ? p + 2e3 : p);
2192
+ } else if (r.month && r.month.index === u) {
2193
+ const p = parseInt(c, 10);
2194
+ c.length === 2 && p >= 1 && p <= 12 && (d = p);
2195
+ } else if (r.day && r.day.index === u) {
2196
+ const p = parseInt(c, 10);
2197
+ c.length === 2 && p >= 1 && p <= 31 && (l = p);
2198
+ }
2199
+ }
2200
+ }), Z.debug(`parseAndUpdateSingleDate(${n}) - year:`, i, "month:", d, "day:", l), i !== null || d !== null) {
2201
+ const c = i || (/* @__PURE__ */ new Date()).getFullYear(), u = d !== null ? d - 1 : (/* @__PURE__ */ new Date()).getMonth();
2202
+ if (e.options.selectionMode === "single") {
2203
+ e.monthDates = [];
2204
+ for (let p = 0; p < e.options.visibleMonthsCount; p++) {
2205
+ const g = new Date(c, u + p, 1);
2206
+ e.monthDates.push(g);
2207
+ }
2208
+ } else if (e.options.selectionMode === "range" && (n === "start" || !e.selectedStartDate)) {
2209
+ if (e.displayMonths = [
2210
+ { month: u, year: c }
2211
+ ], e.options.visibleMonthsCount > 1) {
2212
+ const p = new Date(c, u + 1, 1);
2213
+ e.displayMonths.push({
2214
+ month: p.getMonth(),
2215
+ year: p.getFullYear()
2216
+ });
2217
+ }
2218
+ e.monthDates = [];
2219
+ for (let p = 0; p < e.options.visibleMonthsCount; p++) {
2220
+ const g = e.displayMonths[p], h = new Date(g.year, g.month, 1);
2221
+ e.monthDates.push(h);
2222
+ }
905
2223
  }
906
- if (this.options.mode === "range") {
2224
+ e.renderCalendar();
2225
+ }
2226
+ if (i !== null && d !== null && l !== null) {
2227
+ const c = new Date(i, d - 1, l);
2228
+ c.getMonth() === d - 1 && (n === "single" ? e.selectedDate = c : n === "start" ? e.selectedStartDate = c : n === "end" && (e.selectedEndDate = c), e.renderCalendar(), e.options.selectionMode === "range" && e.updateSummary(), Z.debug(`Set ${n} date:`, c));
2229
+ }
2230
+ }
2231
+ const Fe = {
2232
+ en: {
2233
+ today: "Today",
2234
+ clear: "Clear",
2235
+ apply: "Apply",
2236
+ preview: "Preview",
2237
+ day: "day",
2238
+ days: "days",
2239
+ night: "night",
2240
+ nights: "nights"
2241
+ },
2242
+ de: {
2243
+ today: "Heute",
2244
+ clear: "Löschen",
2245
+ apply: "Anwenden",
2246
+ preview: "Vorschau",
2247
+ day: "Tag",
2248
+ days: "Tage",
2249
+ night: "Nacht",
2250
+ nights: "Nächte"
2251
+ },
2252
+ fr: {
2253
+ today: "Aujourd'hui",
2254
+ clear: "Effacer",
2255
+ apply: "Appliquer",
2256
+ preview: "Aperçu",
2257
+ day: "jour",
2258
+ days: "jours",
2259
+ night: "nuit",
2260
+ nights: "nuits"
2261
+ },
2262
+ es: {
2263
+ today: "Hoy",
2264
+ clear: "Limpiar",
2265
+ apply: "Aplicar",
2266
+ preview: "Vista previa",
2267
+ day: "día",
2268
+ days: "días",
2269
+ night: "noche",
2270
+ nights: "noches"
2271
+ }
2272
+ };
2273
+ function Le(e) {
2274
+ if (e !== "auto")
2275
+ return e;
2276
+ if (typeof navigator < "u" && navigator.language) {
2277
+ const t = navigator.language.split("-")[0].toLowerCase();
2278
+ return Fe[t] ? t : "en";
2279
+ }
2280
+ return "en";
2281
+ }
2282
+ function na(e, t) {
2283
+ const n = Le(e), a = Fe[n] || Fe.en;
2284
+ return t ? { ...a, ...t } : a;
2285
+ }
2286
+ function aa(e) {
2287
+ const t = Le(e);
2288
+ try {
2289
+ const n = new Intl.DateTimeFormat(t, { weekday: "short" }), a = [];
2290
+ for (let r = 0; r < 7; r++) {
2291
+ const o = new Date(2017, 0, r + 1);
2292
+ a.push(n.format(o));
2293
+ }
2294
+ return a;
2295
+ } catch (n) {
2296
+ return k.warn("getWeekdayNames() - Intl.DateTimeFormat failed, using English weekdays", n), ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
2297
+ }
2298
+ }
2299
+ function ra(e) {
2300
+ const t = Le(e);
2301
+ try {
2302
+ const n = new Intl.DateTimeFormat(t, { month: "long" }), a = [];
2303
+ for (let r = 0; r < 12; r++) {
2304
+ const o = new Date(2017, r, 1);
2305
+ a.push(n.format(o));
2306
+ }
2307
+ return a;
2308
+ } catch (n) {
2309
+ return k.warn("getMonthNames() - Intl.DateTimeFormat failed, using English months", n), [
2310
+ "January",
2311
+ "February",
2312
+ "March",
2313
+ "April",
2314
+ "May",
2315
+ "June",
2316
+ "July",
2317
+ "August",
2318
+ "September",
2319
+ "October",
2320
+ "November",
2321
+ "December"
2322
+ ];
2323
+ }
2324
+ }
2325
+ class sa {
2326
+ constructor(t, n = {}) {
2327
+ D(this, "input");
2328
+ D(this, "options");
2329
+ D(this, "formatInfo");
2330
+ D(this, "_previousInputValue");
2331
+ D(this, "currentDate");
2332
+ D(this, "monthDates");
2333
+ D(this, "displayMonths");
2334
+ D(this, "selectedDate");
2335
+ D(this, "selectedStartDate");
2336
+ D(this, "selectedEndDate");
2337
+ D(this, "focusedDayIndex");
2338
+ D(this, "activeMonthIndex");
2339
+ D(this, "showingRollingSelector");
2340
+ D(this, "draggingType");
2341
+ D(this, "isDragging");
2342
+ D(this, "dragStartDate");
2343
+ D(this, "originalStartDate");
2344
+ D(this, "originalEndDate");
2345
+ D(this, "dragPreviewStart");
2346
+ D(this, "dragPreviewEnd");
2347
+ D(this, "autoScrollInterval");
2348
+ D(this, "navInterval");
2349
+ D(this, "calendar");
2350
+ D(this, "containerElement");
2351
+ D(this, "onDragMoveBound");
2352
+ D(this, "onDragEndBound");
2353
+ D(this, "clickOutsideHandler");
2354
+ D(this, "isFirstRender", !0);
2355
+ D(this, "lockedPlacement");
2356
+ // Store the initial placement to prevent jumping
2357
+ D(this, "calendarContentHeight");
2358
+ // Store calendar height for rolling selector
2359
+ D(this, "calendarContentWidth");
2360
+ // Store calendar width for rolling selector
2361
+ D(this, "isCalendarActive", !1);
2362
+ // Track if this calendar is actively focused (for inline mode)
2363
+ // Async validation state
2364
+ D(this, "isValidating", !1);
2365
+ D(this, "loadingOverlay");
2366
+ // Floating UI tooltips
2367
+ D(this, "tooltip");
2368
+ D(this, "tooltipArrow");
2369
+ D(this, "currentTooltipTarget");
2370
+ // Week start and date restrictions
2371
+ D(this, "weekStartDay", 0);
2372
+ // 0 = Sunday, 1 = Monday, etc.
2373
+ D(this, "normalizedMinDate", null);
2374
+ D(this, "normalizedMaxDate", null);
2375
+ D(this, "normalizedDisabledDates", /* @__PURE__ */ new Set());
2376
+ // Store as 'YYYY-MM-DD' strings
2377
+ D(this, "normalizedSpecialDates", /* @__PURE__ */ new Map());
2378
+ // Store as 'YYYY-MM-DD' -> DecoratedDate
2379
+ // Internationalization
2380
+ D(this, "locale", "en");
2381
+ D(this, "localeStrings");
2382
+ D(this, "weekdayNames", []);
2383
+ D(this, "monthNames", []);
2384
+ this.input = t, this.containerElement = n.container || document.body, this.options = {
2385
+ selectionMode: n.selectionMode || "single",
2386
+ calendarPlacement: n.calendarPlacement || (n.monthLayout === "grid" ? "bottom" : "bottom-start"),
2387
+ visibleMonthsCount: n.visibleMonthsCount || (n.selectionMode === "range" ? 2 : 1),
2388
+ dateFormatMask: n.dateFormatMask || "YYYY-MM-DD",
2389
+ calendarOpenTrigger: n.calendarOpenTrigger || "auto",
2390
+ onSelect: n.onSelect || void 0,
2391
+ container: this.containerElement,
2392
+ positioningMode: n.positioningMode || "floating",
2393
+ monthLayout: n.monthLayout || "horizontal",
2394
+ gridRows: n.gridRows,
2395
+ gridColumns: n.gridColumns,
2396
+ weekStartDay: n.weekStartDay !== void 0 ? n.weekStartDay : "auto",
2397
+ minDate: n.minDate,
2398
+ maxDate: n.maxDate,
2399
+ initialDate: n.initialDate,
2400
+ disabledDates: n.disabledDates,
2401
+ disabledWeekdays: n.disabledWeekdays,
2402
+ specialDates: n.specialDates,
2403
+ isDateDisabled: n.isDateDisabled,
2404
+ getDateMetadata: n.getDateMetadata,
2405
+ disabledDatesHandling: n.disabledDatesHandling || "allow",
2406
+ highlightDisabledInRange: n.highlightDisabledInRange !== void 0 ? n.highlightDisabledInRange : !0,
2407
+ locale: n.locale || "auto",
2408
+ displayFormatMask: n.displayFormatMask,
2409
+ customStrings: n.customStrings,
2410
+ formatSummaryCallback: n.formatSummaryCallback,
2411
+ validateRangeCallback: n.validateRangeCallback,
2412
+ showDebugInfo: n.showDebugInfo || !1,
2413
+ rollingYearRange: n.rollingYearRange,
2414
+ rollingMonthRange: n.rollingMonthRange,
2415
+ renderDay: n.renderDay,
2416
+ renderDayContent: n.renderDayContent
2417
+ }, Bt(this.options.showDebugInfo), this.weekStartDay = $t(this.options.weekStartDay), $.debug("Week starts on day:", this.weekStartDay), $.debug("disabledDatesHandling:", this.options.disabledDatesHandling), this.locale = Le(this.options.locale), this.localeStrings = na(this.locale, this.options.customStrings), this.weekdayNames = aa(this.locale), this.monthNames = ra(this.locale), $.debug("Locale:", this.locale, "Weekdays:", this.weekdayNames, "Months:", this.monthNames), this.initializeDateRestrictions(), this.formatInfo = this.parseFormat(this.options.dateFormatMask), $.debug("Format info:", this.formatInfo), this._previousInputValue = "", this.currentDate = /* @__PURE__ */ new Date();
2418
+ let a;
2419
+ if (this.options.initialDate)
2420
+ a = de(this.options.initialDate) || /* @__PURE__ */ new Date(), $.debug(`Using initialDate: ${a.toISOString()}`);
2421
+ else if (this.options.rollingYearRange || this.options.rollingMonthRange) {
2422
+ const r = this.options.rollingYearRange ? this.parseYearRange(this.options.rollingYearRange) : null, o = this.options.rollingMonthRange ? this.parseMonthRange(this.options.rollingMonthRange) : null, s = r ? r.min : (/* @__PURE__ */ new Date()).getFullYear(), i = o ? o.min - 1 : 0;
2423
+ a = new Date(s, i, 1), $.debug(`Using first allowed year/month as initial: ${a.toISOString()}`);
2424
+ } else this.normalizedMinDate && this.normalizedMinDate > /* @__PURE__ */ new Date() ? (a = new Date(this.normalizedMinDate), $.debug(`Using minDate as initial: ${a.toISOString()}`)) : this.normalizedMaxDate && this.normalizedMaxDate < /* @__PURE__ */ new Date() ? (a = new Date(this.normalizedMaxDate), $.debug(`Using maxDate as initial: ${a.toISOString()}`)) : (a = /* @__PURE__ */ new Date(), $.debug(`Using current date as initial: ${a.toISOString()}`));
2425
+ this.monthDates = [];
2426
+ for (let r = 0; r < this.options.visibleMonthsCount; r++) {
2427
+ const o = new Date(a.getFullYear(), a.getMonth() + r, 1);
2428
+ this.monthDates.push(o), $.debug(`monthDates[${r}] = ${o.getFullYear()}-${o.getMonth() + 1}`);
2429
+ }
2430
+ if (this.options.selectionMode === "range") {
907
2431
  this.displayMonths = [];
908
- for (let i = 0; i < this.options.monthsToShow; i++) {
909
- const r = new Date(a.getFullYear(), a.getMonth() + i, 1);
2432
+ for (let r = 0; r < this.options.visibleMonthsCount; r++) {
2433
+ const o = new Date(a.getFullYear(), a.getMonth() + r, 1);
910
2434
  this.displayMonths.push({
911
- month: r.getMonth(),
912
- year: r.getFullYear()
2435
+ month: o.getMonth(),
2436
+ year: o.getFullYear()
913
2437
  });
914
2438
  }
915
2439
  }
916
2440
  this.selectedDate = null, this.selectedStartDate = null, this.selectedEndDate = null, this.focusedDayIndex = null, this.activeMonthIndex = 0, this.showingRollingSelector = [];
917
- for (let i = 0; i < this.options.monthsToShow; i++)
2441
+ for (let r = 0; r < this.options.visibleMonthsCount; r++)
918
2442
  this.showingRollingSelector.push(!1);
919
2443
  this.draggingType = null, this.isDragging = !1, this.dragStartDate = null, this.originalStartDate = null, this.originalEndDate = null, this.dragPreviewStart = null, this.dragPreviewEnd = null, this.autoScrollInterval = null, this.init();
920
2444
  }
921
2445
  init() {
922
- console.log("[DatePicker 5] Init called"), this.createCalendar(), this.attachInputListeners(), console.log("[DatePicker 6] Init complete");
2446
+ $.debug("Init called"), this.createCalendar(), this.input && (this.attachInputListeners(), this.input.value && ($.debug("Parsing pre-filled value:", this.input.value), this.updateCalendarFromInput())), this.options.positioningMode === "inline" && (this.renderCalendar(), this.calendar.classList.add("drp-date-picker--visible", "drp-date-picker--inline"), this.isCalendarActive = !0, this.isFirstRender = !1), $.debug("Init complete");
2447
+ }
2448
+ /**
2449
+ * Initialize and normalize date restrictions
2450
+ */
2451
+ initializeDateRestrictions() {
2452
+ this.options.minDate && (this.normalizedMinDate = de(this.options.minDate)), this.options.maxDate && (this.normalizedMaxDate = de(this.options.maxDate)), this.options.disabledDates && this.options.disabledDates.length > 0 && this.options.disabledDates.forEach((t) => {
2453
+ const n = de(t);
2454
+ if (n) {
2455
+ const a = ve(n);
2456
+ this.normalizedDisabledDates.add(a);
2457
+ }
2458
+ }), this.options.specialDates && this.options.specialDates.length > 0 && this.options.specialDates.forEach((t) => {
2459
+ const n = de(t.date);
2460
+ if (n) {
2461
+ const a = ve(n);
2462
+ this.normalizedSpecialDates.set(a, t);
2463
+ }
2464
+ });
2465
+ }
2466
+ /**
2467
+ * Parse year range string to min/max values
2468
+ */
2469
+ parseYearRange(t) {
2470
+ if (t.includes("-")) {
2471
+ const [n, a] = t.split("-");
2472
+ return { min: parseInt(n, 10), max: parseInt(a, 10) };
2473
+ } else {
2474
+ const n = parseInt(t, 10);
2475
+ return { min: n, max: n };
2476
+ }
2477
+ }
2478
+ /**
2479
+ * Parse month range string to min/max values
2480
+ */
2481
+ parseMonthRange(t) {
2482
+ const [n, a] = t.split("-");
2483
+ return { min: parseInt(n, 10), max: parseInt(a, 10) };
2484
+ }
2485
+ /**
2486
+ * Check if a date should be disabled
2487
+ */
2488
+ isDateDisabledInternal(t) {
2489
+ if (this.options.rollingYearRange) {
2490
+ const n = this.parseYearRange(this.options.rollingYearRange), a = t.getFullYear();
2491
+ if (a < n.min || a > n.max)
2492
+ return !0;
2493
+ }
2494
+ if (this.options.rollingMonthRange) {
2495
+ const n = this.parseMonthRange(this.options.rollingMonthRange), a = t.getMonth() + 1;
2496
+ if (a < n.min || a > n.max)
2497
+ return !0;
2498
+ }
2499
+ return Pt(
2500
+ t,
2501
+ this.normalizedMinDate,
2502
+ this.normalizedMaxDate,
2503
+ this.normalizedDisabledDates,
2504
+ this.options.disabledWeekdays,
2505
+ this.options.isDateDisabled
2506
+ );
2507
+ }
2508
+ /**
2509
+ * Get additional info for a date (special styling, labels, etc.)
2510
+ */
2511
+ getDateInfoInternal(t) {
2512
+ const n = ve(t);
2513
+ if (this.normalizedSpecialDates.has(n)) {
2514
+ const a = this.normalizedSpecialDates.get(n);
2515
+ return {
2516
+ disabled: this.isDateDisabledInternal(t),
2517
+ class: a.class,
2518
+ label: a.label,
2519
+ tooltip: a.tooltip
2520
+ };
2521
+ }
2522
+ if (this.options.getDateMetadata) {
2523
+ const a = this.options.getDateMetadata(t);
2524
+ if (a)
2525
+ return {
2526
+ ...a,
2527
+ disabled: a.disabled !== void 0 ? a.disabled : this.isDateDisabledInternal(t)
2528
+ };
2529
+ }
2530
+ return null;
2531
+ }
2532
+ /**
2533
+ * Check if there are any disabled dates in a range
2534
+ */
2535
+ hasDisabledDatesInRange(t, n) {
2536
+ return Tt(t, n, (a) => this.isDateDisabledInternal(a));
2537
+ }
2538
+ /**
2539
+ * Get all enabled dates in a range
2540
+ */
2541
+ getEnabledDatesInRange(t, n) {
2542
+ return zt(t, n, (a) => this.isDateDisabledInternal(a));
2543
+ }
2544
+ /**
2545
+ * Get all disabled dates in a range
2546
+ */
2547
+ getDisabledDatesInRange(t, n) {
2548
+ return Ft(t, n, (a) => this.isDateDisabledInternal(a));
2549
+ }
2550
+ /**
2551
+ * For 'block' mode: Find the last enabled date before hitting a disabled date
2552
+ */
2553
+ findLastEnabledBeforeGap(t, n) {
2554
+ return Nt(t, n, (a) => this.isDateDisabledInternal(a));
2555
+ }
2556
+ /**
2557
+ * For 'split' mode: Split a range into multiple ranges separated by disabled dates
2558
+ */
2559
+ splitRangeByDisabled(t, n) {
2560
+ return Ot(t, n, (a) => this.isDateDisabledInternal(a));
2561
+ }
2562
+ isToday(t) {
2563
+ return Ht(t);
2564
+ }
2565
+ isSameDay(t, n) {
2566
+ return Je(t, n);
2567
+ }
2568
+ isInRange(t) {
2569
+ return Yt(t, this.selectedStartDate, this.selectedEndDate);
923
2570
  }
924
2571
  createCalendar() {
925
- console.log("[DatePicker 7] Creating calendar"), this.calendar = document.createElement("div"), this.calendar.className = "pa-date-picker";
926
- const e = document.createElement("div");
927
- e.className = "pa-date-picker__months";
928
- for (let a = 0; a < this.options.monthsToShow; a++) {
929
- const i = document.createElement("div");
930
- i.className = "pa-date-picker__month", i.dataset.monthIndex = a, i.innerHTML = `
931
- <div class="pa-date-picker__header">
932
- <button class="pa-date-picker__nav pa-date-picker__nav--prev" data-action="prev" data-month-index="${a}"></button>
933
- <div class="pa-date-picker__month-year" data-action="toggle-rolling" data-month-index="${a}"></div>
934
- <button class="pa-date-picker__nav pa-date-picker__nav--next" data-action="next" data-month-index="${a}"></button>
935
- </div>
936
- <div class="pa-date-picker__rolling-selector" data-month-index="${a}">
937
- <div class="pa-date-picker__rolling-list" data-list="years" data-month-index="${a}"></div>
938
- <div class="pa-date-picker__rolling-list" data-list="months" data-month-index="${a}"></div>
939
- </div>
940
- <div class="pa-date-picker__weekdays"></div>
941
- <div class="pa-date-picker__days" data-month-index="${a}"></div>
942
- `, e.appendChild(i);
2572
+ $.debug("Creating calendar"), this.calendar = document.createElement("div"), this.calendar.className = "drp-date-picker";
2573
+ const t = document.createElement("div");
2574
+ this.options.monthLayout === "grid" ? (t.className = "drp-date-picker__months drp-date-picker__months--grid", this.options.gridRows && t.style.setProperty("--drp-grid-rows", String(this.options.gridRows)), this.options.gridColumns && t.style.setProperty("--drp-grid-columns", String(this.options.gridColumns))) : t.className = "drp-date-picker__months drp-date-picker__months--horizontal";
2575
+ for (let a = 0; a < this.options.visibleMonthsCount; a++) {
2576
+ const r = document.createElement("div");
2577
+ r.className = "drp-date-picker__month", r.dataset.monthIndex = String(a), r.innerHTML = `
2578
+ <div class="drp-date-picker__header">
2579
+ <button class="drp-date-picker__nav drp-date-picker__nav--prev" data-action="prev" data-month-index="${a}"></button>
2580
+ <div class="drp-date-picker__month-year" data-action="toggle-rolling" data-month-index="${a}"></div>
2581
+ <button class="drp-date-picker__nav drp-date-picker__nav--next" data-action="next" data-month-index="${a}"></button>
2582
+ </div>
2583
+ <div class="drp-date-picker__rolling-selector" data-month-index="${a}">
2584
+ <div class="drp-date-picker__rolling-list" data-list="years" data-month-index="${a}"></div>
2585
+ <div class="drp-date-picker__rolling-list" data-list="months" data-month-index="${a}"></div>
2586
+ </div>
2587
+ <div class="drp-date-picker__weekdays"></div>
2588
+ <div class="drp-date-picker__days" data-month-index="${a}"></div>
2589
+ `, t.appendChild(r);
943
2590
  }
944
- if (this.calendar.appendChild(e), this.options.mode === "range") {
2591
+ if (this.calendar.appendChild(t), this.options.selectionMode === "range") {
945
2592
  const a = document.createElement("div");
946
- a.className = "pa-date-picker__summary pa-date-picker__summary--hidden", this.calendar.appendChild(a);
2593
+ a.className = "drp-date-picker__summary drp-date-picker__summary--hidden", this.calendar.appendChild(a);
947
2594
  }
948
- const t = document.createElement("div");
949
- t.className = "pa-date-picker__actions", t.innerHTML = `
950
- <button class="pa-date-picker__button pa-date-picker__button--today" data-action="today">Today</button>
951
- <button class="pa-date-picker__button pa-date-picker__button--clear" data-action="clear">Clear</button>
952
- ${this.options.mode === "range" ? '<button class="pa-date-picker__button pa-date-picker__button--apply" data-action="apply">Apply</button>' : ""}
953
- `, this.calendar.appendChild(t), this.containerElement.appendChild(this.calendar), console.log("[DatePicker 7b] Calendar appended to container:", this.calendar), this.attachCalendarListeners(), this.showingRollingSelector = new Array(this.options.monthsToShow).fill(!1);
2595
+ const n = document.createElement("div");
2596
+ n.className = "drp-date-picker__actions", n.innerHTML = `
2597
+ <button class="drp-date-picker__button drp-date-picker__button--today" data-action="today">${this.localeStrings.today}</button>
2598
+ <button class="drp-date-picker__button drp-date-picker__button--clear" data-action="clear">${this.localeStrings.clear}</button>
2599
+ ${this.options.selectionMode === "range" ? `<button class="drp-date-picker__button drp-date-picker__button--apply" data-action="apply">${this.localeStrings.apply}</button>` : ""}
2600
+ `, this.calendar.appendChild(n), this.containerElement.appendChild(this.calendar), $.debug("Calendar appended to container:", this.calendar), this.tooltip = document.createElement("div"), this.tooltip.className = "drp-date-picker__tooltip", this.tooltipArrow = document.createElement("div"), this.tooltipArrow.className = "drp-date-picker__tooltip-arrow", this.tooltip.appendChild(this.tooltipArrow), this.containerElement.appendChild(this.tooltip), this.attachCalendarListeners(), this.showingRollingSelector = new Array(this.options.visibleMonthsCount).fill(!1);
954
2601
  }
955
2602
  attachInputListeners() {
956
- console.log("[DatePicker 8] Attaching input listeners"), this.options.calendarTrigger === "auto" && (this.input.addEventListener("click", () => {
957
- console.log("[DatePicker 9] Input clicked"), this.show();
958
- }), this.input.addEventListener("focus", () => {
959
- console.log("[DatePicker 10] Input focused"), this.show();
960
- })), this.input.addEventListener("input", (e) => this.handleInputMask(e)), this.input.addEventListener("keydown", (e) => this.handleKeydown(e)), this.input.addEventListener("paste", (e) => this.handlePaste(e));
2603
+ if (!this.input) return;
2604
+ $.debug("Attaching input listeners");
2605
+ const t = this.options.calendarOpenTrigger || "focus";
2606
+ t === "focus" ? this.input.addEventListener("focus", () => {
2607
+ $.debug("Input focused - opening calendar"), this.show();
2608
+ }) : t === "typing" && this.input.addEventListener("input", (n) => {
2609
+ !this.isVisible && this.input && this.input.value.length > 0 && ($.debug("User started typing - opening calendar"), this.show());
2610
+ }), this.input.addEventListener("input", (n) => this.handleInputMask(n)), this.input.addEventListener("keydown", (n) => this.handleKeydown(n)), this.input.addEventListener("paste", (n) => this.handlePaste(n));
961
2611
  }
962
2612
  attachCalendarListeners() {
963
- this.calendar.addEventListener("click", (e) => {
964
- e.stopPropagation();
965
- const t = e.target.dataset.action, a = parseInt(e.target.dataset.monthIndex);
966
- if (t === "prev") this.prevMonth(a);
967
- else if (t === "next") this.nextMonth(a);
968
- else if (t === "toggle-rolling") this.toggleRollingSelector(a);
969
- else if (t === "today") this.selectToday();
970
- else if (t === "clear") this.clear();
971
- else if (t === "apply") this.apply();
972
- else if (e.target.closest(".pa-date-picker__day:not(.pa-date-picker__day--disabled)"))
973
- this.selectDay(e.target.closest(".pa-date-picker__day"));
974
- else if (e.target.closest("[data-year]")) {
975
- const i = e.target.closest("[data-year]");
976
- this.selectYear(parseInt(i.dataset.year), parseInt(i.dataset.monthIndex));
977
- } else if (e.target.closest("[data-month]")) {
978
- const i = e.target.closest("[data-month]");
979
- this.selectMonth(parseInt(i.dataset.month), parseInt(i.dataset.monthIndex));
2613
+ this.calendar.addEventListener("click", async (t) => {
2614
+ const n = t.target;
2615
+ t.stopPropagation();
2616
+ const a = n.dataset.action, r = n.dataset.monthIndex, o = r ? parseInt(r) : 0;
2617
+ if (a === "prev") this.prevMonth(o);
2618
+ else if (a === "next") this.nextMonth(o);
2619
+ else if (a === "toggle-rolling") this.toggleRollingSelector(o);
2620
+ else if (a === "today") this.selectToday();
2621
+ else if (a === "clear") this.clearSelection();
2622
+ else if (a === "apply") this.apply();
2623
+ else if (n.closest(".drp-date-picker__day:not(.drp-date-picker__day--disabled)"))
2624
+ await this.selectDay(n.closest(".drp-date-picker__day"));
2625
+ else if (n.closest("[data-year]")) {
2626
+ const s = n.closest("[data-year]");
2627
+ if (s.classList.contains("drp-date-picker__rolling-item--disabled"))
2628
+ return;
2629
+ const i = s.dataset.year, d = s.dataset.monthIndex;
2630
+ i && d && this.selectYear(parseInt(i), parseInt(d));
2631
+ } else if (n.closest("[data-month]")) {
2632
+ const s = n.closest("[data-month]");
2633
+ if (s.classList.contains("drp-date-picker__rolling-item--disabled"))
2634
+ return;
2635
+ const i = s.dataset.month, d = s.dataset.monthIndex;
2636
+ i && d && this.selectMonth(parseInt(i), parseInt(d));
2637
+ }
2638
+ }), this.calendar.addEventListener("mouseenter", (t) => {
2639
+ const n = t.target, a = n.closest(".drp-date-picker__day"), r = n.closest(".drp-date-picker__badge-cell"), o = a || r;
2640
+ if (o && o instanceof HTMLElement) {
2641
+ const s = o.dataset.tooltip;
2642
+ s && this.showTooltip(o, s);
980
2643
  }
981
- }), document.addEventListener("keydown", (e) => {
982
- var t, a, i, r, o;
983
- if (this.calendar.classList.contains("pa-date-picker--visible")) {
984
- if (console.log("[DatePicker Keydown]", e.key, "Ctrl:", e.ctrlKey, "Meta:", e.metaKey, "Shift:", e.shiftKey, "Alt:", e.altKey), e.key === "Escape")
985
- this.hide(), e.preventDefault();
986
- else if (e.key === "ArrowUp")
987
- this.moveFocus(-7), e.preventDefault();
988
- else if (e.key === "ArrowDown")
989
- this.moveFocus(7), e.preventDefault();
990
- else if (e.key === "ArrowLeft") {
991
- if (e.ctrlKey || e.metaKey) {
992
- console.log("[DatePicker] Ctrl+Left: Navigate to previous month");
2644
+ }, !0), this.calendar.addEventListener("mouseleave", (t) => {
2645
+ const n = t.target, a = n.closest(".drp-date-picker__day"), r = n.closest(".drp-date-picker__badge-cell"), o = a || r;
2646
+ o && this.currentTooltipTarget === o && this.hideTooltip();
2647
+ }, !0), this.calendar.addEventListener("mousedown", (t) => {
2648
+ this.isCalendarActive = !0, t.stopPropagation();
2649
+ }), this.calendar.addEventListener("focusin", () => {
2650
+ this.isCalendarActive = !0;
2651
+ }), document.addEventListener("mousedown", (t) => {
2652
+ this.calendar.contains(t.target) || (this.isCalendarActive = !1);
2653
+ }, !0), document.addEventListener("keydown", (t) => {
2654
+ var n, a, r, o;
2655
+ if (this.calendar.classList.contains("drp-date-picker--visible") && this.isCalendarActive) {
2656
+ if ($.debug("Keydown", t.key, "Ctrl:", t.ctrlKey, "Meta:", t.metaKey, "Shift:", t.shiftKey, "Alt:", t.altKey), t.key === "Escape")
2657
+ this.hide(), t.preventDefault();
2658
+ else if (t.key === "ArrowUp")
2659
+ this.moveFocus(-7), t.preventDefault();
2660
+ else if (t.key === "ArrowDown")
2661
+ this.moveFocus(7), t.preventDefault();
2662
+ else if (t.key === "ArrowLeft") {
2663
+ if (t.ctrlKey || t.metaKey) {
2664
+ C.debug("Ctrl+Left: Navigate to previous month");
993
2665
  const s = this.focusedDayIndex;
994
2666
  this.prevMonth(this.activeMonthIndex), setTimeout(() => {
995
- var d, p;
996
- const c = this.calendar.querySelector(`.pa-date-picker__days[data-month-index="${this.activeMonthIndex}"]`).querySelectorAll(".pa-date-picker__day:not(.pa-date-picker__day--other-month)");
997
- this.focusedDayIndex = Math.min(s !== null ? s : 0, c.length - 1), (d = c[this.focusedDayIndex]) == null || d.classList.add("pa-date-picker__day--focused"), (p = c[this.focusedDayIndex]) == null || p.scrollIntoView({ block: "nearest" });
2667
+ var l, c;
2668
+ const i = this.calendar.querySelector(`.drp-date-picker__days[data-month-index="${this.activeMonthIndex}"]`), d = i == null ? void 0 : i.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)");
2669
+ d && (this.focusedDayIndex = Math.min(s !== null ? s : 0, d.length - 1), (l = d[this.focusedDayIndex]) == null || l.classList.add("drp-date-picker__day--focused"), (c = d[this.focusedDayIndex]) == null || c.scrollIntoView({ block: "nearest" }));
998
2670
  }, 0);
999
2671
  } else
1000
2672
  this.moveFocus(-1);
1001
- e.preventDefault();
1002
- } else if (e.key === "ArrowRight") {
1003
- if (e.ctrlKey || e.metaKey) {
1004
- console.log("[DatePicker] Ctrl+Right: Navigate to next month");
2673
+ t.preventDefault();
2674
+ } else if (t.key === "ArrowRight") {
2675
+ if (t.ctrlKey || t.metaKey) {
2676
+ C.debug("Ctrl+Right: Navigate to next month");
1005
2677
  const s = this.focusedDayIndex;
1006
2678
  this.nextMonth(this.activeMonthIndex), setTimeout(() => {
1007
- var d, p;
1008
- const c = this.calendar.querySelector(`.pa-date-picker__days[data-month-index="${this.activeMonthIndex}"]`).querySelectorAll(".pa-date-picker__day:not(.pa-date-picker__day--other-month)");
1009
- this.focusedDayIndex = Math.min(s !== null ? s : 0, c.length - 1), (d = c[this.focusedDayIndex]) == null || d.classList.add("pa-date-picker__day--focused"), (p = c[this.focusedDayIndex]) == null || p.scrollIntoView({ block: "nearest" });
2679
+ var l, c;
2680
+ const i = this.calendar.querySelector(`.drp-date-picker__days[data-month-index="${this.activeMonthIndex}"]`), d = i == null ? void 0 : i.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)");
2681
+ d && (this.focusedDayIndex = Math.min(s !== null ? s : 0, d.length - 1), (l = d[this.focusedDayIndex]) == null || l.classList.add("drp-date-picker__day--focused"), (c = d[this.focusedDayIndex]) == null || c.scrollIntoView({ block: "nearest" }));
1010
2682
  }, 0);
1011
2683
  } else
1012
2684
  this.moveFocus(1);
1013
- e.preventDefault();
1014
- } else if (e.key === "Enter")
1015
- this.focusedDayIndex !== null ? (t = this.calendar.querySelector(`.pa-date-picker__days[data-month-index="${this.activeMonthIndex}"]`).querySelectorAll(".pa-date-picker__day:not(.pa-date-picker__day--other-month)")[this.focusedDayIndex]) == null || t.click() : this.hide(), e.preventDefault();
1016
- else if (e.key === "Tab") {
1017
- if (this.options.monthsToShow > 1) {
1018
- const s = e.shiftKey ? -1 : 1, l = this.activeMonthIndex + s;
1019
- if (l >= 0 && l < this.monthDates.length) {
1020
- console.log(`[DatePicker] Tab: switching from Col${this.activeMonthIndex} to Col${l}`);
1021
- const c = this.focusedDayIndex ?? 0;
1022
- this.activeMonthIndex = l;
1023
- const d = this.calendar.querySelector(`.pa-date-picker__days[data-month-index="${this.activeMonthIndex}"]`);
1024
- if (d) {
1025
- const p = d.querySelectorAll(".pa-date-picker__day:not(.pa-date-picker__day--other-month)");
1026
- this.focusedDayIndex = Math.min(c, p.length - 1), console.log(`[DatePicker Col${this.activeMonthIndex}] Tab: set focusedDayIndex to ${this.focusedDayIndex}`);
2685
+ t.preventDefault();
2686
+ } else if (t.key === "Enter") {
2687
+ if (this.focusedDayIndex !== null) {
2688
+ const s = this.calendar.querySelector(`.drp-date-picker__days[data-month-index="${this.activeMonthIndex}"]`), i = s == null ? void 0 : s.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)"), d = i == null ? void 0 : i[this.focusedDayIndex];
2689
+ d && d.click();
2690
+ } else
2691
+ this.hide();
2692
+ t.preventDefault();
2693
+ } else if (t.key === "Tab") {
2694
+ if (this.options.visibleMonthsCount > 1) {
2695
+ const s = t.shiftKey ? -1 : 1, i = this.activeMonthIndex + s;
2696
+ if (i >= 0 && i < this.monthDates.length) {
2697
+ C.debug(`Tab: switching from Col${this.activeMonthIndex} to Col${i}`);
2698
+ const d = this.focusedDayIndex ?? 0;
2699
+ this.activeMonthIndex = i;
2700
+ const l = this.calendar.querySelector(`.drp-date-picker__days[data-month-index="${this.activeMonthIndex}"]`);
2701
+ if (l) {
2702
+ const c = l.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)");
2703
+ this.focusedDayIndex = Math.min(d, c.length - 1), C.debug(`Col${this.activeMonthIndex} Tab: set focusedDayIndex to ${this.focusedDayIndex}`);
1027
2704
  }
1028
2705
  this.renderCalendar();
1029
2706
  }
1030
- e.preventDefault();
2707
+ t.preventDefault();
1031
2708
  }
1032
- } else if (e.key === "t" || e.key === "T")
2709
+ } else if (t.key === "t" || t.key === "T")
1033
2710
  this.monthDates[this.activeMonthIndex] = /* @__PURE__ */ new Date(), this.renderCalendar(), setTimeout(() => {
1034
- const l = this.calendar.querySelector(`.pa-date-picker__days[data-month-index="${this.activeMonthIndex}"]`).querySelectorAll(".pa-date-picker__day:not(.pa-date-picker__day--other-month)"), c = Array.from(l).findIndex((d) => d.classList.contains("pa-date-picker__day--today"));
1035
- c !== -1 && (this.focusedDayIndex = c, l[c].classList.add("pa-date-picker__day--focused"), l[c].scrollIntoView({ block: "nearest" }));
1036
- }, 0), e.preventDefault();
1037
- else if (e.key === "PageUp") {
2711
+ const s = this.calendar.querySelector(`.drp-date-picker__days[data-month-index="${this.activeMonthIndex}"]`), i = s == null ? void 0 : s.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)");
2712
+ if (i) {
2713
+ const d = Array.from(i).findIndex((l) => l.classList.contains("drp-date-picker__day--today"));
2714
+ d !== -1 && (this.focusedDayIndex = d, i[d].classList.add("drp-date-picker__day--focused"), i[d].scrollIntoView({ block: "nearest" }));
2715
+ }
2716
+ }, 0), t.preventDefault();
2717
+ else if (t.key === "PageUp") {
1038
2718
  const s = this.focusedDayIndex;
1039
2719
  this.prevMonth(this.activeMonthIndex), setTimeout(() => {
1040
- var d, p;
1041
- const c = this.calendar.querySelector(`.pa-date-picker__days[data-month-index="${this.activeMonthIndex}"]`).querySelectorAll(".pa-date-picker__day:not(.pa-date-picker__day--other-month)");
1042
- this.focusedDayIndex = Math.min(s !== null ? s : 0, c.length - 1), (d = c[this.focusedDayIndex]) == null || d.classList.add("pa-date-picker__day--focused"), (p = c[this.focusedDayIndex]) == null || p.scrollIntoView({ block: "nearest" });
1043
- }, 0), e.preventDefault();
1044
- } else if (e.key === "PageDown") {
2720
+ var l, c;
2721
+ const i = this.calendar.querySelector(`.drp-date-picker__days[data-month-index="${this.activeMonthIndex}"]`), d = i == null ? void 0 : i.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)");
2722
+ d && (this.focusedDayIndex = Math.min(s !== null ? s : 0, d.length - 1), (l = d[this.focusedDayIndex]) == null || l.classList.add("drp-date-picker__day--focused"), (c = d[this.focusedDayIndex]) == null || c.scrollIntoView({ block: "nearest" }));
2723
+ }, 0), t.preventDefault();
2724
+ } else if (t.key === "PageDown") {
1045
2725
  const s = this.focusedDayIndex;
1046
2726
  this.nextMonth(this.activeMonthIndex), setTimeout(() => {
1047
- var d, p;
1048
- const c = this.calendar.querySelector(`.pa-date-picker__days[data-month-index="${this.activeMonthIndex}"]`).querySelectorAll(".pa-date-picker__day:not(.pa-date-picker__day--other-month)");
1049
- this.focusedDayIndex = Math.min(s !== null ? s : 0, c.length - 1), (d = c[this.focusedDayIndex]) == null || d.classList.add("pa-date-picker__day--focused"), (p = c[this.focusedDayIndex]) == null || p.scrollIntoView({ block: "nearest" });
1050
- }, 0), e.preventDefault();
1051
- } else if (e.key === "Home") {
1052
- console.log("[DatePicker] Home key pressed, Ctrl:", e.ctrlKey, "Meta:", e.metaKey);
1053
- const s = this.monthDates[this.activeMonthIndex].getFullYear(), l = this.monthDates[this.activeMonthIndex].getMonth();
1054
- if (e.ctrlKey || e.metaKey) {
1055
- console.log("[DatePicker] Ctrl+Home: Navigate to year start");
1056
- const c = l === 0, d = this.focusedDayIndex === 0;
1057
- c && d ? (console.log("[DatePicker] Already at Jan 1, going to previous year"), this.monthDates[this.activeMonthIndex] = new Date(s - 1, 0, 1)) : (console.log("[DatePicker] Going to Jan 1 of current year"), this.monthDates[this.activeMonthIndex] = new Date(s, 0, 1)), this.renderCalendar(), setTimeout(() => {
1058
- var u, f;
1059
- const h = this.calendar.querySelector(`.pa-date-picker__days[data-month-index="${this.activeMonthIndex}"]`).querySelectorAll(".pa-date-picker__day:not(.pa-date-picker__day--other-month)");
1060
- this.focusedDayIndex = 0, (u = h[0]) == null || u.classList.add("pa-date-picker__day--focused"), (f = h[0]) == null || f.scrollIntoView({ block: "nearest" });
2727
+ var l, c;
2728
+ const i = this.calendar.querySelector(`.drp-date-picker__days[data-month-index="${this.activeMonthIndex}"]`), d = i == null ? void 0 : i.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)");
2729
+ d && (this.focusedDayIndex = Math.min(s !== null ? s : 0, d.length - 1), (l = d[this.focusedDayIndex]) == null || l.classList.add("drp-date-picker__day--focused"), (c = d[this.focusedDayIndex]) == null || c.scrollIntoView({ block: "nearest" }));
2730
+ }, 0), t.preventDefault();
2731
+ } else if (t.key === "Home") {
2732
+ C.debug("Home key pressed, Ctrl:", t.ctrlKey, "Meta:", t.metaKey);
2733
+ const s = this.monthDates[this.activeMonthIndex].getFullYear(), i = this.monthDates[this.activeMonthIndex].getMonth();
2734
+ if (t.ctrlKey || t.metaKey) {
2735
+ C.debug("Ctrl+Home: Navigate to year start");
2736
+ const d = i === 0, l = this.focusedDayIndex === 0;
2737
+ d && l ? (C.debug("Already at Jan 1, going to previous year"), this.monthDates[this.activeMonthIndex] = new Date(s - 1, 0, 1)) : (C.debug("Going to Jan 1 of current year"), this.monthDates[this.activeMonthIndex] = new Date(s, 0, 1)), this.renderCalendar(), setTimeout(() => {
2738
+ var p, g;
2739
+ const c = this.calendar.querySelector(`.drp-date-picker__days[data-month-index="${this.activeMonthIndex}"]`), u = c == null ? void 0 : c.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)");
2740
+ u && (this.focusedDayIndex = 0, (p = u[0]) == null || p.classList.add("drp-date-picker__day--focused"), (g = u[0]) == null || g.scrollIntoView({ block: "nearest" }));
1061
2741
  }, 0);
1062
- } else if (console.log("[DatePicker] Home: Navigate to first day (cycles to previous month if already there)"), this.focusedDayIndex === 0)
1063
- console.log("[DatePicker] Already on first day, going to previous month"), this.prevMonth(this.activeMonthIndex), setTimeout(() => {
1064
- var h, u;
1065
- const p = this.calendar.querySelector(`.pa-date-picker__days[data-month-index="${this.activeMonthIndex}"]`).querySelectorAll(".pa-date-picker__day:not(.pa-date-picker__day--other-month)");
1066
- this.focusedDayIndex = 0, this.calendar.querySelectorAll(".pa-date-picker__day--focused").forEach((f) => f.classList.remove("pa-date-picker__day--focused")), (h = p[0]) == null || h.classList.add("pa-date-picker__day--focused"), (u = p[0]) == null || u.scrollIntoView({ block: "nearest" });
2742
+ } else if (C.debug("Home: Navigate to first day (cycles to previous month if already there)"), this.focusedDayIndex === 0)
2743
+ C.debug("Already on first day, going to previous month"), this.prevMonth(this.activeMonthIndex), setTimeout(() => {
2744
+ var u, p;
2745
+ const l = this.calendar.querySelector(`.drp-date-picker__days[data-month-index="${this.activeMonthIndex}"]`), c = l == null ? void 0 : l.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)");
2746
+ c && (this.focusedDayIndex = 0, this.calendar.querySelectorAll(".drp-date-picker__day--focused").forEach((g) => g.classList.remove("drp-date-picker__day--focused")), (u = c[0]) == null || u.classList.add("drp-date-picker__day--focused"), (p = c[0]) == null || p.scrollIntoView({ block: "nearest" }));
1067
2747
  }, 0);
1068
2748
  else {
1069
2749
  this.focusedDayIndex = 0;
1070
- const p = this.calendar.querySelector(`.pa-date-picker__days[data-month-index="${this.activeMonthIndex}"]`).querySelectorAll(".pa-date-picker__day:not(.pa-date-picker__day--other-month)");
1071
- this.calendar.querySelectorAll(".pa-date-picker__day--focused").forEach((h) => h.classList.remove("pa-date-picker__day--focused")), (a = p[0]) == null || a.classList.add("pa-date-picker__day--focused"), (i = p[0]) == null || i.scrollIntoView({ block: "nearest" });
2750
+ const l = this.calendar.querySelector(`.drp-date-picker__days[data-month-index="${this.activeMonthIndex}"]`), c = l == null ? void 0 : l.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)");
2751
+ c && (this.calendar.querySelectorAll(".drp-date-picker__day--focused").forEach((u) => u.classList.remove("drp-date-picker__day--focused")), (n = c[0]) == null || n.classList.add("drp-date-picker__day--focused"), (a = c[0]) == null || a.scrollIntoView({ block: "nearest" }));
1072
2752
  }
1073
- e.preventDefault();
1074
- } else if (e.key === "End") {
1075
- console.log("[DatePicker] End key pressed, Ctrl:", e.ctrlKey, "Meta:", e.metaKey);
1076
- const s = this.monthDates[this.activeMonthIndex].getFullYear(), l = this.monthDates[this.activeMonthIndex].getMonth();
1077
- if (e.ctrlKey || e.metaKey) {
1078
- console.log("[DatePicker] Ctrl+End: Navigate to year end");
1079
- const c = l === 11, p = this.calendar.querySelector(`.pa-date-picker__days[data-month-index="${this.activeMonthIndex}"]`).querySelectorAll(".pa-date-picker__day:not(.pa-date-picker__day--other-month)"), h = this.focusedDayIndex === p.length - 1;
1080
- c && h ? this.monthDates[this.activeMonthIndex] = new Date(s + 1, 11, 31) : this.monthDates[this.activeMonthIndex] = new Date(s, 11, 31), this.renderCalendar(), setTimeout(() => {
1081
- var g, y;
1082
- const f = this.calendar.querySelector(`.pa-date-picker__days[data-month-index="${this.activeMonthIndex}"]`).querySelectorAll(".pa-date-picker__day:not(.pa-date-picker__day--other-month)");
1083
- this.focusedDayIndex = f.length - 1, (g = f[this.focusedDayIndex]) == null || g.classList.add("pa-date-picker__day--focused"), (y = f[this.focusedDayIndex]) == null || y.scrollIntoView({ block: "nearest" });
2753
+ t.preventDefault();
2754
+ } else if (t.key === "End") {
2755
+ C.debug("End key pressed, Ctrl:", t.ctrlKey, "Meta:", t.metaKey);
2756
+ const s = this.monthDates[this.activeMonthIndex].getFullYear(), i = this.monthDates[this.activeMonthIndex].getMonth();
2757
+ if (t.ctrlKey || t.metaKey) {
2758
+ C.debug("Ctrl+End: Navigate to year end");
2759
+ const d = i === 11, l = this.calendar.querySelector(`.drp-date-picker__days[data-month-index="${this.activeMonthIndex}"]`), c = l == null ? void 0 : l.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)"), u = c && this.focusedDayIndex === c.length - 1;
2760
+ d && u ? this.monthDates[this.activeMonthIndex] = new Date(s + 1, 11, 31) : this.monthDates[this.activeMonthIndex] = new Date(s, 11, 31), this.renderCalendar(), setTimeout(() => {
2761
+ var h, f;
2762
+ const p = this.calendar.querySelector(`.drp-date-picker__days[data-month-index="${this.activeMonthIndex}"]`), g = p == null ? void 0 : p.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)");
2763
+ g && (this.focusedDayIndex = g.length - 1, (h = g[this.focusedDayIndex]) == null || h.classList.add("drp-date-picker__day--focused"), (f = g[this.focusedDayIndex]) == null || f.scrollIntoView({ block: "nearest" }));
1084
2764
  }, 0);
1085
2765
  } else {
1086
- console.log("[DatePicker] End: Navigate to last day (cycles to next month if already there)");
1087
- const d = this.calendar.querySelector(`.pa-date-picker__days[data-month-index="${this.activeMonthIndex}"]`).querySelectorAll(".pa-date-picker__day:not(.pa-date-picker__day--other-month)");
1088
- this.focusedDayIndex === d.length - 1 ? (console.log("[DatePicker] Already on last day, going to next month"), this.nextMonth(this.activeMonthIndex), setTimeout(() => {
1089
- var f, g;
1090
- const u = this.calendar.querySelector(`.pa-date-picker__days[data-month-index="${this.activeMonthIndex}"]`).querySelectorAll(".pa-date-picker__day:not(.pa-date-picker__day--other-month)");
1091
- this.focusedDayIndex = u.length - 1, this.calendar.querySelectorAll(".pa-date-picker__day--focused").forEach((y) => y.classList.remove("pa-date-picker__day--focused")), (f = u[this.focusedDayIndex]) == null || f.classList.add("pa-date-picker__day--focused"), (g = u[this.focusedDayIndex]) == null || g.scrollIntoView({ block: "nearest" });
1092
- }, 0)) : (this.focusedDayIndex = d.length - 1, this.calendar.querySelectorAll(".pa-date-picker__day--focused").forEach((h) => h.classList.remove("pa-date-picker__day--focused")), (r = d[this.focusedDayIndex]) == null || r.classList.add("pa-date-picker__day--focused"), (o = d[this.focusedDayIndex]) == null || o.scrollIntoView({ block: "nearest" }));
2766
+ C.debug("End: Navigate to last day (cycles to next month if already there)");
2767
+ const d = this.calendar.querySelector(`.drp-date-picker__days[data-month-index="${this.activeMonthIndex}"]`), l = d == null ? void 0 : d.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)");
2768
+ if (!l) return;
2769
+ this.focusedDayIndex === l.length - 1 ? (C.debug("Already on last day, going to next month"), this.nextMonth(this.activeMonthIndex), setTimeout(() => {
2770
+ var g, h;
2771
+ const u = this.calendar.querySelector(`.drp-date-picker__days[data-month-index="${this.activeMonthIndex}"]`), p = u == null ? void 0 : u.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)");
2772
+ p && (this.focusedDayIndex = p.length - 1, this.calendar.querySelectorAll(".drp-date-picker__day--focused").forEach((f) => f.classList.remove("drp-date-picker__day--focused")), (g = p[this.focusedDayIndex]) == null || g.classList.add("drp-date-picker__day--focused"), (h = p[this.focusedDayIndex]) == null || h.scrollIntoView({ block: "nearest" }));
2773
+ }, 0)) : (this.focusedDayIndex = l.length - 1, this.calendar.querySelectorAll(".drp-date-picker__day--focused").forEach((u) => u.classList.remove("drp-date-picker__day--focused")), (r = l[this.focusedDayIndex]) == null || r.classList.add("drp-date-picker__day--focused"), (o = l[this.focusedDayIndex]) == null || o.scrollIntoView({ block: "nearest" }));
1093
2774
  }
1094
- e.preventDefault();
2775
+ t.preventDefault();
1095
2776
  }
1096
2777
  }
1097
- }), this.clickOutsideHandler = (e) => {
1098
- var s;
1099
- const t = e.composedPath(), a = t[0], i = t.includes(this.calendar), r = t.includes(this.input), o = (s = a.closest) == null ? void 0 : s.call(a, "[data-calendar-button]");
1100
- !i && !r && !o && this.hide();
1101
- }, document.addEventListener("click", this.clickOutsideHandler);
2778
+ }), this.options.positioningMode === "floating" && (this.clickOutsideHandler = (t) => {
2779
+ var i;
2780
+ const n = t.composedPath(), a = n[0], r = n.includes(this.calendar), o = this.input && n.includes(this.input), s = (i = a.closest) == null ? void 0 : i.call(a, "[data-calendar-button]");
2781
+ !r && !o && !s && this.hide();
2782
+ }, document.addEventListener("click", this.clickOutsideHandler));
2783
+ }
2784
+ // Helper methods
2785
+ parseFormat(t) {
2786
+ const n = {};
2787
+ let a = "";
2788
+ return t.includes("-") ? a = "-" : t.includes("/") ? a = "/" : t.includes(".") && (a = "."), t.split(a).forEach((o, s) => {
2789
+ o === "YYYY" || o === "YY" ? n.year = { index: s, length: o.length } : o === "MM" || o === "M" ? n.month = { index: s, length: 2 } : (o === "DD" || o === "D") && (n.day = { index: s, length: 2 });
2790
+ }), {
2791
+ format: t,
2792
+ separator: a,
2793
+ parts: n,
2794
+ maxLength: t.length
2795
+ };
2796
+ }
2797
+ formatDate(t) {
2798
+ if (!t) return "";
2799
+ const n = t.getFullYear(), a = String(t.getMonth() + 1).padStart(2, "0"), r = String(t.getDate()).padStart(2, "0"), { format: o, separator: s, parts: i } = this.formatInfo, d = [];
2800
+ for (let l = 0; l < 3; l++)
2801
+ i.year && i.year.index === l ? d.push(i.year.length === 2 ? String(n).slice(-2) : n) : i.month && i.month.index === l ? d.push(a) : i.day && i.day.index === l && d.push(r);
2802
+ return d.join(s);
1102
2803
  }
2804
+ destroy() {
2805
+ this.clickOutsideHandler && document.removeEventListener("click", this.clickOutsideHandler), this.calendar.remove(), this.tooltip && this.tooltip.remove();
2806
+ }
2807
+ // UI methods - wrappers for pure functions
1103
2808
  show() {
1104
- console.log("[DatePicker 11] Show called - adding visible class"), this.isFirstRender && (this.renderCalendar(), this.isFirstRender = !1), this.calendar.classList.add("pa-date-picker--visible"), console.log("[DatePicker 11a] Calendar classes:", this.calendar.className), this.position(), setTimeout(() => {
1105
- const e = window.getComputedStyle(this.calendar);
1106
- console.log("[DatePicker 11e] Calendar display:", e.display, "position:", e.position, "left:", e.left, "top:", e.top, "z-index:", e.zIndex);
1107
- }, 100);
2809
+ return bt(this);
1108
2810
  }
1109
2811
  hide() {
1110
- if (this.calendar.classList.contains("pa-date-picker--visible")) {
1111
- this.calendar.classList.remove("pa-date-picker--visible");
1112
- for (let e = 0; e < this.showingRollingSelector.length; e++)
1113
- this.showingRollingSelector[e] = !1;
1114
- this.isFirstRender || this.renderCalendar();
1115
- }
2812
+ return _t(this);
1116
2813
  }
1117
2814
  toggle() {
1118
- this.calendar.classList.contains("pa-date-picker--visible") ? this.hide() : this.show();
2815
+ return Bn(this);
1119
2816
  }
1120
- async position() {
1121
- console.log("[DatePicker 11b] Position method called");
1122
- const { x: e, y: t } = await Mt(this.input, this.calendar, {
1123
- placement: this.options.position,
1124
- middleware: [bt(8), It(), St({ padding: 8 })]
1125
- });
1126
- console.log("[DatePicker 11c] FloatingUI computed position - x:", e, "y:", t), this.calendar.style.left = `${e}px`, this.calendar.style.top = `${t}px`, console.log("[DatePicker 11d] Position applied to calendar");
2817
+ position() {
2818
+ return wt(this);
1127
2819
  }
1128
- renderCalendar() {
1129
- console.log("[DatePicker 18] renderCalendar called, showingRollingSelector:", this.showingRollingSelector, `activeCol: ${this.activeMonthIndex}`), console.log("[DatePicker 18] monthDates array:", this.monthDates.map((e, t) => `Col${t}: ${e.getFullYear()}-${e.getMonth() + 1}`).join(", "));
1130
- for (let e = 0; e < this.options.monthsToShow; e++)
1131
- this.showingRollingSelector[e] ? this.renderRollingSelector(e) : this.renderNormalView(e);
1132
- requestAnimationFrame(() => {
1133
- for (let e = 0; e < this.options.monthsToShow; e++) {
1134
- const t = this.calendar.querySelector(`.pa-date-picker__month[data-month-index="${e}"]`);
1135
- if (!t) continue;
1136
- const a = t.querySelector(".pa-date-picker__weekdays"), i = t.querySelector(".pa-date-picker__days"), r = t.querySelector(".pa-date-picker__rolling-selector");
1137
- if (a && i && r) {
1138
- const o = a.offsetHeight + i.offsetHeight;
1139
- r.style.height = `${o}px`;
1140
- }
1141
- }
1142
- }), this.options.mode === "range" && !this.isDragging && this.initDragListeners();
1143
- }
1144
- renderNormalView(e) {
1145
- console.log(`[DatePicker Col${e} 19] renderNormalView called for month`, e);
1146
- const t = this.calendar.querySelector(`.pa-date-picker__month[data-month-index="${e}"]`);
1147
- if (!t) return;
1148
- t.querySelector(".pa-date-picker__rolling-selector").classList.remove("pa-date-picker__rolling-selector--visible");
1149
- const i = this.monthDates[e], r = [
1150
- "January",
1151
- "February",
1152
- "March",
1153
- "April",
1154
- "May",
1155
- "June",
1156
- "July",
1157
- "August",
1158
- "September",
1159
- "October",
1160
- "November",
1161
- "December"
1162
- ], o = t.querySelector(".pa-date-picker__month-year");
1163
- o.textContent = `${r[i.getMonth()]} ${i.getFullYear()}`;
1164
- const s = t.querySelector(".pa-date-picker__weekdays");
1165
- s.innerHTML = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"].map((l) => `<div class="pa-date-picker__weekday">${l}</div>`).join(""), this.renderDays(e, i);
1166
- }
1167
- renderDays(e, t) {
1168
- console.log(`[DatePicker Col${e} 20] renderDays called for month`, e);
1169
- const a = this.calendar.querySelector(`.pa-date-picker__month[data-month-index="${e}"]`);
1170
- if (!a) return;
1171
- const i = a.querySelector(".pa-date-picker__days"), r = t.getFullYear(), o = t.getMonth();
1172
- console.log(`[DatePicker Col${e} 21] Rendering days for:`, r, o + 1);
1173
- const s = new Date(r, o, 1).getDay(), l = new Date(r, o + 1, 0).getDate(), c = new Date(r, o, 0).getDate(), d = new Date(r, o - 1, 1), p = d.getFullYear(), h = d.getMonth(), u = new Date(r, o + 1, 1), f = u.getFullYear(), g = u.getMonth();
1174
- let y = "";
1175
- for (let v = s - 1; v >= 0; v--) {
1176
- const k = c - v, m = new Date(p, h, k), b = ["pa-date-picker__day", "pa-date-picker__day--other-month"];
1177
- this.options.mode === "range" && (this.isSameDay(m, this.selectedStartDate) && b.push("pa-date-picker__day--range-start"), this.isSameDay(m, this.selectedEndDate) && b.push("pa-date-picker__day--range-end"), this.isInRange(m) && b.push("pa-date-picker__day--in-range")), y += `<div class="${b.join(" ")}" data-date="${p}-${h}-${k}">${k}</div>`;
1178
- }
1179
- for (let v = 1; v <= l; v++) {
1180
- const k = new Date(r, o, v), m = ["pa-date-picker__day"];
1181
- this.isToday(k) && m.push("pa-date-picker__day--today"), this.options.mode === "single" && this.isSameDay(k, this.selectedDate) && m.push("pa-date-picker__day--selected"), this.options.mode === "range" && (this.isSameDay(k, this.selectedStartDate) && m.push("pa-date-picker__day--range-start"), this.isSameDay(k, this.selectedEndDate) && m.push("pa-date-picker__day--range-end"), this.isInRange(k) && m.push("pa-date-picker__day--in-range")), y += `<div class="${m.join(" ")}" data-date="${r}-${o}-${v}">${v}</div>`;
1182
- }
1183
- const D = Math.ceil((s + l) / 7) * 7 - (s + l);
1184
- for (let v = 1; v <= D; v++) {
1185
- const k = new Date(f, g, v), m = ["pa-date-picker__day", "pa-date-picker__day--other-month"];
1186
- this.options.mode === "range" && (this.isSameDay(k, this.selectedStartDate) && m.push("pa-date-picker__day--range-start"), this.isSameDay(k, this.selectedEndDate) && m.push("pa-date-picker__day--range-end"), this.isInRange(k) && m.push("pa-date-picker__day--in-range")), y += `<div class="${m.join(" ")}" data-date="${f}-${g}-${v}">${v}</div>`;
1187
- }
1188
- i.innerHTML = y;
1189
- }
1190
- renderRollingSelector(e) {
1191
- var p, h;
1192
- const t = this.calendar.querySelector(`.pa-date-picker__month[data-month-index="${e}"]`);
1193
- if (!t) return;
1194
- const a = t.querySelector(".pa-date-picker__rolling-selector");
1195
- a.classList.add("pa-date-picker__rolling-selector--visible");
1196
- const i = this.monthDates[e], r = a.querySelector('[data-list="years"]'), o = i.getFullYear();
1197
- let s = "";
1198
- for (let u = o - 50; u <= o + 50; u++)
1199
- s += `<div class="pa-date-picker__rolling-item ${u === o ? "pa-date-picker__rolling-item--selected" : ""}" data-year="${u}" data-month-index="${e}">${u}</div>`;
1200
- r.innerHTML = s, (p = r.querySelector(".pa-date-picker__rolling-item--selected")) == null || p.scrollIntoView({ block: "center" });
1201
- const l = a.querySelector('[data-list="months"]'), c = [
1202
- "January",
1203
- "February",
1204
- "March",
1205
- "April",
1206
- "May",
1207
- "June",
1208
- "July",
1209
- "August",
1210
- "September",
1211
- "October",
1212
- "November",
1213
- "December"
1214
- ], d = i.getMonth();
1215
- l.innerHTML = c.map((u, f) => `<div class="pa-date-picker__rolling-item ${f === d ? "pa-date-picker__rolling-item--selected" : ""}" data-month="${f}" data-month-index="${e}">${u}</div>`).join(""), (h = l.querySelector(".pa-date-picker__rolling-item--selected")) == null || h.scrollIntoView({ block: "center" });
1216
- }
1217
- toggleRollingSelector(e) {
1218
- this.showingRollingSelector[e] = !this.showingRollingSelector[e], this.renderCalendar();
1219
- }
1220
- selectYear(e, t) {
1221
- const a = this.monthDates[t].getFullYear();
1222
- this.monthDates[t].setFullYear(e), console.log(`[DatePicker Col${t}] selectYear - changed from ${a} to ${e}`), this.checkAndResolveCollisions(t), this.showingRollingSelector[t] = !1, this.renderCalendar();
1223
- }
1224
- selectMonth(e, t) {
1225
- const a = this.monthDates[t].getMonth();
1226
- this.monthDates[t].setMonth(e), console.log(`[DatePicker Col${t}] selectMonth - changed from ${a + 1} to ${e + 1}`), this.checkAndResolveCollisions(t), this.showingRollingSelector[t] = !1, this.renderCalendar();
1227
- }
1228
- // Check and resolve collisions after changing a column's date
1229
- checkAndResolveCollisions(e) {
1230
- const t = this.monthDates[e];
1231
- if (e < this.monthDates.length - 1) {
1232
- const a = this.monthDates[e + 1];
1233
- if (this.isSameOrAfterMonth(t, a)) {
1234
- console.log(`[DatePicker Col${e}] Collision with Col${e + 1}, shifting forward`);
1235
- const i = new Date(t.getFullYear(), t.getMonth() + 1, 1);
1236
- this.monthDates[e + 1] = i, this.checkAndResolveCollisions(e + 1);
1237
- }
1238
- }
1239
- if (e > 0) {
1240
- const a = this.monthDates[e - 1];
1241
- if (this.isSameOrAfterMonth(a, t)) {
1242
- console.log(`[DatePicker Col${e}] Collision with Col${e - 1}, shifting backward`);
1243
- const i = new Date(t.getFullYear(), t.getMonth() - 1, 1);
1244
- this.monthDates[e - 1] = i, this.checkAndResolveCollisions(e - 1);
1245
- }
1246
- }
2820
+ showTooltip(t, n) {
2821
+ return Wn(this, t, n);
1247
2822
  }
1248
- // Helper: Compare if date1 >= date2 (by year-month only)
1249
- isSameOrAfterMonth(e, t) {
1250
- const a = e.getFullYear(), i = e.getMonth(), r = t.getFullYear(), o = t.getMonth();
1251
- return a > r || a === r && i >= o;
2823
+ hideTooltip() {
2824
+ return jn(this);
1252
2825
  }
1253
- prevMonth(e) {
1254
- const t = isNaN(e) ? this.activeMonthIndex : e, a = this.monthDates[t], i = new Date(a.getFullYear(), a.getMonth() - 1, 1);
1255
- if (this.monthDates[t] = i, console.log(`[DatePicker Col${t}] prevMonth - changed from ${a.getFullYear()}-${a.getMonth() + 1} to ${i.getFullYear()}-${i.getMonth() + 1}`), t > 0) {
1256
- const r = this.monthDates[t - 1];
1257
- this.isSameOrAfterMonth(r, i) && (console.log(`[DatePicker Col${t}] Collision detected with Col${t - 1}, shifting previous columns back`), this.prevMonth(t - 1));
1258
- }
1259
- this.renderCalendar();
2826
+ // Rendering methods - wrappers for pure functions
2827
+ renderCalendar() {
2828
+ return Jt(this);
1260
2829
  }
1261
- nextMonth(e) {
1262
- const t = isNaN(e) ? this.activeMonthIndex : e, a = this.monthDates[t], i = new Date(a.getFullYear(), a.getMonth() + 1, 1);
1263
- if (this.monthDates[t] = i, console.log(`[DatePicker Col${t}] nextMonth - changed from ${a.getFullYear()}-${a.getMonth() + 1} to ${i.getFullYear()}-${i.getMonth() + 1}`), t < this.monthDates.length - 1) {
1264
- const r = this.monthDates[t + 1];
1265
- this.isSameOrAfterMonth(i, r) && (console.log(`[DatePicker Col${t}] Collision detected with Col${t + 1}, shifting next columns forward`), this.nextMonth(t + 1));
1266
- }
1267
- this.renderCalendar();
2830
+ renderNormalView(t) {
2831
+ return nt(this, t);
1268
2832
  }
1269
- selectDay(e) {
1270
- if (e.classList.contains("pa-date-picker__day--disabled")) return;
1271
- if (!e.dataset || !e.dataset.date) {
1272
- console.warn("[DatePicker] selectDay called with invalid element:", e);
1273
- return;
1274
- }
1275
- const [t, a, i] = e.dataset.date.split("-").map(Number), r = new Date(t, a, i);
1276
- e.classList.contains("pa-date-picker__day--other-month");
1277
- const o = e.closest(".pa-date-picker__days");
1278
- if (o) {
1279
- this.activeMonthIndex = parseInt(o.dataset.monthIndex) || 0, console.log(`[DatePicker Col${this.activeMonthIndex}] selectDay - activeMonthIndex:`, this.activeMonthIndex);
1280
- const s = o.querySelectorAll(".pa-date-picker__day:not(.pa-date-picker__day--other-month)");
1281
- this.focusedDayIndex = Array.from(s).indexOf(e), console.log(`[DatePicker Col${this.activeMonthIndex}] selectDay - set focusedDayIndex to:`, this.focusedDayIndex);
1282
- }
1283
- this.options.mode === "single" ? (this.selectedDate = r, this.input.value = this.formatDate(r), this.options.onSelect && this.options.onSelect(r), this.hide()) : !this.selectedStartDate || this.selectedEndDate ? (this.selectedStartDate = r, this.selectedEndDate = null, this.input.value = `${this.formatDate(this.selectedStartDate)} - ...`) : (r >= this.selectedStartDate ? this.selectedEndDate = r : (this.selectedEndDate = this.selectedStartDate, this.selectedStartDate = r), this.input.value = `${this.formatDate(this.selectedStartDate)} - ${this.formatDate(this.selectedEndDate)}`, this.options.onSelect && this.options.onSelect({ start: this.selectedStartDate, end: this.selectedEndDate })), this.renderCalendar(), this.updateSummary();
2833
+ renderDays(t, n) {
2834
+ return at(this, t, n);
2835
+ }
2836
+ renderRollingSelector(t) {
2837
+ return rt(this, t);
1284
2838
  }
1285
2839
  updateSummary() {
1286
- if (this.options.mode !== "range") return;
1287
- const e = this.calendar.querySelector(".pa-date-picker__summary");
1288
- if (e)
1289
- if (this.selectedStartDate && this.selectedEndDate) {
1290
- const a = this.selectedEndDate - this.selectedStartDate, i = Math.floor(a / 864e5) + 1, r = i - 1;
1291
- e.className = "pa-date-picker__summary pa-date-picker__summary--visible", e.innerHTML = `
1292
- <span class="pa-date-picker__summary-count">${i} ${i === 1 ? "day" : "days"}</span>
1293
- <span>, </span>
1294
- <span class="pa-date-picker__summary-count">${r} ${r === 1 ? "night" : "nights"}</span>
1295
- `;
1296
- } else
1297
- e.className = "pa-date-picker__summary pa-date-picker__summary--hidden", e.innerHTML = "";
2840
+ return Zt(this);
2841
+ }
2842
+ updateSummaryWithPreview() {
2843
+ return st(this);
2844
+ }
2845
+ updateDragPreview() {
2846
+ return en(this);
2847
+ }
2848
+ // Navigation methods - wrappers for pure functions
2849
+ toggleRollingSelector(t) {
2850
+ return Wt(this, t);
2851
+ }
2852
+ selectYear(t, n) {
2853
+ return jt(this, t, n);
2854
+ }
2855
+ selectMonth(t, n) {
2856
+ return Kt(this, t, n);
2857
+ }
2858
+ checkAndResolveCollisions(t) {
2859
+ return ue(this, t);
2860
+ }
2861
+ prevMonth(t) {
2862
+ return ce(this, t);
2863
+ }
2864
+ nextMonth(t) {
2865
+ return pe(this, t);
2866
+ }
2867
+ findNextEnabledDayIndex(t, n, a, r) {
2868
+ return le(this, t, n, a);
2869
+ }
2870
+ moveFocus(t) {
2871
+ return Ut(this, t);
2872
+ }
2873
+ // Selection methods - wrappers for pure functions
2874
+ async selectDay(t) {
2875
+ return await Un(this, t);
1298
2876
  }
1299
2877
  selectToday() {
1300
- this.monthDates[this.activeMonthIndex] = /* @__PURE__ */ new Date(), this.selectedDate = /* @__PURE__ */ new Date(), this.input.value = this.formatDate(this.selectedDate), this.options.onSelect && this.options.onSelect(this.selectedDate), this.renderCalendar(), this.options.mode === "single" && this.hide();
2878
+ return Xn(this);
1301
2879
  }
1302
- clear() {
1303
- this.selectedDate = null, this.selectedStartDate = null, this.selectedEndDate = null, this.input.value = "", this.renderCalendar(), this.updateSummary();
2880
+ clearSelection() {
2881
+ return Gn(this);
1304
2882
  }
1305
2883
  apply() {
1306
- this.selectedStartDate && this.selectedEndDate && this.hide();
2884
+ return Jn(this);
1307
2885
  }
1308
- // === DRAG FUNCTIONALITY ===
2886
+ // Interaction methods - wrappers for pure functions
1309
2887
  initDragListeners() {
1310
- const e = this.calendar.querySelectorAll(".pa-date-picker__day--range-start"), t = this.calendar.querySelectorAll(".pa-date-picker__day--range-end");
1311
- e.forEach((a) => {
1312
- a.addEventListener("mousedown", (i) => this.startDrag(i, "start"));
1313
- }), t.forEach((a) => {
1314
- a.addEventListener("mousedown", (i) => this.startDrag(i, "end"));
1315
- });
1316
- }
1317
- startDrag(e, t) {
1318
- e.preventDefault(), e.stopPropagation(), this.isDragging = !0, this.draggingType = t, this.originalStartDate = new Date(this.selectedStartDate), this.originalEndDate = new Date(this.selectedEndDate), e.currentTarget.classList.add("pa-date-picker__day--dragging"), console.log(`[DatePicker Drag] Started dragging ${t} date`), this.onDragMoveBound = this.onDragMove.bind(this), this.onDragEndBound = this.onDragEnd.bind(this), document.addEventListener("mousemove", this.onDragMoveBound), document.addEventListener("mouseup", this.onDragEndBound), document.body.style.cursor = "grabbing";
1319
- }
1320
- onDragMove(e) {
1321
- if (!this.isDragging) return;
1322
- let t = null;
1323
- this.containerElement instanceof ShadowRoot && this.containerElement.elementsFromPoint ? t = this.containerElement.elementsFromPoint(e.clientX, e.clientY)[0] || null : t = document.elementFromPoint(e.clientX, e.clientY);
1324
- const a = t == null ? void 0 : t.closest(".pa-date-picker__nav--prev"), i = t == null ? void 0 : t.closest(".pa-date-picker__nav--next");
1325
- if (a || i) {
1326
- if (!this.navInterval) {
1327
- const p = (a || i).closest(".pa-date-picker__month");
1328
- if (p) {
1329
- const h = parseInt(p.dataset.monthIndex), u = !!a;
1330
- u ? this.prevMonth(h) : this.nextMonth(h), this.navInterval = setInterval(() => {
1331
- u ? this.prevMonth(h) : this.nextMonth(h);
1332
- }, 1e3);
1333
- }
1334
- }
1335
- return;
1336
- } else
1337
- this.navInterval && (clearInterval(this.navInterval), this.navInterval = null);
1338
- const r = t;
1339
- if (!r || !r.classList.contains("pa-date-picker__day") || r.classList.contains("pa-date-picker__day--disabled")) return;
1340
- const [o, s, l] = r.dataset.date.split("-").map(Number), c = new Date(o, s, l);
1341
- this.draggingType === "start" ? (this.dragPreviewStart = c, this.dragPreviewEnd = this.originalEndDate, this.dragPreviewStart > this.dragPreviewEnd && ([this.dragPreviewStart, this.dragPreviewEnd] = [this.dragPreviewEnd, this.dragPreviewStart], this.draggingType = "end")) : (this.dragPreviewStart = this.originalStartDate, this.dragPreviewEnd = c, this.dragPreviewEnd < this.dragPreviewStart && ([this.dragPreviewStart, this.dragPreviewEnd] = [this.dragPreviewEnd, this.dragPreviewStart], this.draggingType = "start")), this.updateDragPreview();
2888
+ return Qn(this);
1342
2889
  }
1343
- updateDragPreview() {
1344
- if (this.calendar.querySelectorAll(".pa-date-picker__day--drag-preview").forEach((t) => {
1345
- t.classList.remove("pa-date-picker__day--drag-preview");
1346
- }), !this.dragPreviewStart || !this.dragPreviewEnd) return;
1347
- this.calendar.querySelectorAll(".pa-date-picker__day").forEach((t) => {
1348
- const [a, i, r] = t.dataset.date.split("-").map(Number), o = new Date(a, i, r);
1349
- o >= this.dragPreviewStart && o <= this.dragPreviewEnd && t.classList.add("pa-date-picker__day--drag-preview");
1350
- }), this.updateSummaryWithPreview();
2890
+ startDrag(t, n) {
2891
+ return St(this, t, n);
1351
2892
  }
1352
- updateSummaryWithPreview() {
1353
- if (this.options.mode !== "range") return;
1354
- const e = this.calendar.querySelector(".pa-date-picker__summary");
1355
- if (e && this.dragPreviewStart && this.dragPreviewEnd) {
1356
- const a = this.dragPreviewEnd - this.dragPreviewStart, i = Math.floor(a / 864e5) + 1, r = i - 1;
1357
- e.className = "pa-date-picker__summary pa-date-picker__summary--visible", e.innerHTML = `
1358
- <span style="opacity: 0.7;">Preview: </span>
1359
- <span class="pa-date-picker__summary-count">${i} ${i === 1 ? "day" : "days"}</span>
1360
- <span>, </span>
1361
- <span class="pa-date-picker__summary-count">${r} ${r === 1 ? "night" : "nights"}</span>
1362
- `;
1363
- }
2893
+ onDragMove(t) {
2894
+ return Mt(this, t);
1364
2895
  }
1365
- onDragEnd(e) {
1366
- this.isDragging && (console.log("[DatePicker Drag] Ended dragging, finalizing selection"), this.dragPreviewStart && this.dragPreviewEnd && (this.selectedStartDate = this.dragPreviewStart, this.selectedEndDate = this.dragPreviewEnd, this.input.value = `${this.formatDate(this.selectedStartDate)} - ${this.formatDate(this.selectedEndDate)}`, this.options.onSelect && this.options.onSelect({ start: this.selectedStartDate, end: this.selectedEndDate })), this.isDragging = !1, this.draggingType = null, this.dragPreviewStart = null, this.dragPreviewEnd = null, this.calendar.querySelectorAll(".pa-date-picker__day--dragging").forEach((t) => {
1367
- t.classList.remove("pa-date-picker__day--dragging");
1368
- }), document.removeEventListener("mousemove", this.onDragMoveBound), document.removeEventListener("mouseup", this.onDragEndBound), this.navInterval && (clearInterval(this.navInterval), this.navInterval = null), document.body.style.cursor = "", this.renderCalendar(), this.updateSummary());
1369
- }
1370
- // === END DRAG FUNCTIONALITY ===
1371
- moveFocus(e) {
1372
- var r, o, s;
1373
- console.log(`[DatePicker Col${this.activeMonthIndex}] moveFocus(${e}) - focusedDayIndex:`, this.focusedDayIndex);
1374
- const t = this.calendar.querySelector(`.pa-date-picker__days[data-month-index="${this.activeMonthIndex}"]`);
1375
- if (!t) {
1376
- console.log(`[DatePicker Col${this.activeMonthIndex}] ERROR: daysContainer not found!`);
1377
- return;
1378
- }
1379
- const a = t.querySelectorAll(".pa-date-picker__day:not(.pa-date-picker__day--other-month)");
1380
- if (console.log(`[DatePicker Col${this.activeMonthIndex}] Found ${a.length} days in column`), a.length === 0) return;
1381
- if (this.focusedDayIndex === null) {
1382
- const l = Array.from(a).findIndex((c) => c.classList.contains("pa-date-picker__day--today"));
1383
- this.focusedDayIndex = l !== -1 ? l : 0, console.log(`[DatePicker Col${this.activeMonthIndex}] Initialized focusedDayIndex to ${this.focusedDayIndex} (today or first day), will move by offset ${e}`);
1384
- }
1385
- (r = a[this.focusedDayIndex]) == null || r.classList.remove("pa-date-picker__day--focused");
1386
- const i = this.focusedDayIndex + e;
1387
- if (i < 0) {
1388
- const l = this.activeMonthIndex;
1389
- if (e === -1)
1390
- console.log(`[DatePicker Col${l}] Edge navigation LEFT: going to last day of prev month`), this.prevMonth(this.activeMonthIndex), setTimeout(() => {
1391
- var p, h;
1392
- const c = this.calendar.querySelector(`.pa-date-picker__month[data-month-index="${l}"] .pa-date-picker__days`);
1393
- if (!c) return;
1394
- const d = c.querySelectorAll(".pa-date-picker__day:not(.pa-date-picker__day--other-month)");
1395
- this.focusedDayIndex = d.length - 1, (p = d[this.focusedDayIndex]) == null || p.classList.add("pa-date-picker__day--focused"), (h = d[this.focusedDayIndex]) == null || h.scrollIntoView({ block: "nearest" });
1396
- }, 0);
1397
- else {
1398
- const c = a[this.focusedDayIndex], [d, p, h] = c.dataset.date.split("-").map(Number), f = new Date(d, p, h).getDay();
1399
- console.log(`[DatePicker Col${l}] Edge navigation UP: current day ${h} is weekday ${f}, going to prev month`), this.prevMonth(this.activeMonthIndex), setTimeout(() => {
1400
- var T, P;
1401
- const g = this.calendar.querySelector(`.pa-date-picker__month[data-month-index="${l}"] .pa-date-picker__days`);
1402
- if (!g) return;
1403
- const y = g.querySelectorAll(".pa-date-picker__day:not(.pa-date-picker__day--other-month)"), [w, D, v] = y[y.length - 1].dataset.date.split("-").map(Number), m = new Date(w, D, v).getDay(), b = (m - f + 7) % 7;
1404
- this.focusedDayIndex = y.length - 1 - b, console.log(`[DatePicker Col${l}] Last day weekday ${m}, target ${f}, focusing on day ${this.focusedDayIndex + 1}`), (T = y[this.focusedDayIndex]) == null || T.classList.add("pa-date-picker__day--focused"), (P = y[this.focusedDayIndex]) == null || P.scrollIntoView({ block: "nearest" });
1405
- }, 0);
1406
- }
1407
- return;
1408
- } else if (i >= a.length) {
1409
- const l = this.activeMonthIndex;
1410
- if (e === 1)
1411
- console.log(`[DatePicker Col${l}] Edge navigation RIGHT: going to first day of next month`), this.nextMonth(this.activeMonthIndex), setTimeout(() => {
1412
- var p, h;
1413
- const c = this.calendar.querySelector(`.pa-date-picker__month[data-month-index="${l}"] .pa-date-picker__days`);
1414
- if (!c) return;
1415
- const d = c.querySelectorAll(".pa-date-picker__day:not(.pa-date-picker__day--other-month)");
1416
- this.focusedDayIndex = 0, (p = d[this.focusedDayIndex]) == null || p.classList.add("pa-date-picker__day--focused"), (h = d[this.focusedDayIndex]) == null || h.scrollIntoView({ block: "nearest" });
1417
- }, 0);
1418
- else {
1419
- const c = a[this.focusedDayIndex], [d, p, h] = c.dataset.date.split("-").map(Number), f = new Date(d, p, h).getDay();
1420
- console.log(`[DatePicker Col${l}] Edge navigation DOWN: current day ${h} is weekday ${f}, going to next month`), this.nextMonth(this.activeMonthIndex), setTimeout(() => {
1421
- var T, P;
1422
- const g = this.calendar.querySelector(`.pa-date-picker__month[data-month-index="${l}"] .pa-date-picker__days`);
1423
- if (!g) return;
1424
- const y = g.querySelectorAll(".pa-date-picker__day:not(.pa-date-picker__day--other-month)"), [w, D, v] = y[0].dataset.date.split("-").map(Number), m = new Date(w, D, v).getDay(), b = (f - m + 7) % 7;
1425
- this.focusedDayIndex = b, console.log(`[DatePicker Col${l}] First day weekday ${m}, target ${f}, focusing on day ${this.focusedDayIndex + 1}`), (T = y[this.focusedDayIndex]) == null || T.classList.add("pa-date-picker__day--focused"), (P = y[this.focusedDayIndex]) == null || P.scrollIntoView({ block: "nearest" });
1426
- }, 0);
1427
- }
1428
- return;
1429
- }
1430
- this.focusedDayIndex = i, (o = a[this.focusedDayIndex]) == null || o.classList.add("pa-date-picker__day--focused"), (s = a[this.focusedDayIndex]) == null || s.scrollIntoView({ block: "nearest" });
1431
- }
1432
- // === INPUT MASKING ===
1433
- handleInputMask(e) {
1434
- const t = e.target, a = t.value, i = t.selectionStart, r = this._previousInputValue || "", o = a.length < r.length, { separator: s } = this.formatInfo;
1435
- if (this.options.mode === "range") {
1436
- const l = a.replace(new RegExp(`[^0-9${s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}to ]`, "gi"), ""), c = this.applyRangeMask(l);
1437
- if (c !== a) {
1438
- t.value = c;
1439
- let d = i;
1440
- if (o)
1441
- d = i;
1442
- else if (c.length > a.length)
1443
- if (c.includes(" to ") && !a.includes(" to ")) {
1444
- const p = c.indexOf(" to ");
1445
- i >= p && i <= p + 4 ? d = p + 4 : d = i + (c.length - a.length);
1446
- } else
1447
- d = i + (c.length - a.length);
1448
- t.setSelectionRange(d, d);
1449
- }
1450
- } else {
1451
- const l = a.replace(new RegExp(`[^0-9${s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}]`, "g"), ""), c = this.applyMask(l);
1452
- if (c !== a) {
1453
- t.value = c;
1454
- let d = i;
1455
- if (o)
1456
- d = i;
1457
- else if (c.length > a.length && c[i] === s)
1458
- d = i + 1;
1459
- else if (c.length > a.length) {
1460
- const p = (a.substring(0, i).match(new RegExp(s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "g")) || []).length, u = (c.substring(0, i).match(new RegExp(s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "g")) || []).length - p;
1461
- d = i + u;
1462
- }
1463
- t.setSelectionRange(d, d);
1464
- }
1465
- }
1466
- this._previousInputValue = t.value, this.updateCalendarFromInput();
1467
- }
1468
- applyMask(e) {
1469
- var d, p, h;
1470
- const { separator: t, parts: a, maxLength: i } = this.formatInfo, r = e.replace(new RegExp(t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "g"), ""), o = a.year ? a.year.length : 4, s = [
1471
- { type: "year", pos: (d = a.year) == null ? void 0 : d.index, length: o },
1472
- { type: "month", pos: (p = a.month) == null ? void 0 : p.index, length: 2 },
1473
- { type: "day", pos: (h = a.day) == null ? void 0 : h.index, length: 2 }
1474
- ].sort((u, f) => u.pos - f.pos);
1475
- let l = "", c = 0;
1476
- for (let u = 0; u < s.length; u++) {
1477
- const f = s[u], g = r.substring(c, c + f.length);
1478
- if (!g) break;
1479
- l += g, c += g.length, u < s.length - 1 && g.length === f.length && (l += t);
1480
- }
1481
- return l.substring(0, i);
1482
- }
1483
- applyRangeMask(e) {
1484
- const { separator: t, maxLength: a } = this.formatInfo, i = " to ";
1485
- let r = "", o = "";
1486
- if (e.includes(i)) {
1487
- const l = e.split(i);
1488
- r = l[0], o = l.slice(1).join(i);
1489
- } else
1490
- r = e;
1491
- const s = this.applyMask(r);
1492
- if (s.length === a)
1493
- if (e.includes(i)) {
1494
- const l = this.applyMask(o);
1495
- return s + i + l;
1496
- } else
1497
- return s + i;
1498
- else
1499
- return s;
1500
- }
1501
- handleKeydown(e) {
1502
- const { key: t, ctrlKey: a, metaKey: i } = e, { separator: r } = this.formatInfo;
1503
- if (this.calendar.classList.contains("pa-date-picker--visible") && ["ArrowUp", "ArrowDown", "Home", "End", "PageUp", "PageDown"].includes(t)) {
1504
- e.preventDefault();
1505
- return;
1506
- }
1507
- if (!([
1508
- "Backspace",
1509
- "Delete",
1510
- "Tab",
1511
- "Escape",
1512
- "Enter",
1513
- "ArrowLeft",
1514
- "ArrowRight",
1515
- "ArrowUp",
1516
- "ArrowDown",
1517
- "Home",
1518
- "End"
1519
- ].includes(t) || a || i)) {
1520
- if (t === r) {
1521
- const s = e.target, l = s.selectionStart, c = s.value;
1522
- let d = 0;
1523
- for (let h = l - 1; h >= 0; h--)
1524
- if (c[h] === r || c[h] === " ") {
1525
- d = h + 1;
1526
- break;
1527
- }
1528
- const p = c.substring(d, l);
1529
- if (/^\d$/.test(p)) {
1530
- e.preventDefault();
1531
- const h = c.substring(0, d) + "0" + p + r + c.substring(l);
1532
- s.value = h;
1533
- const u = d + 2 + r.length;
1534
- s.setSelectionRange(u, u), this._previousInputValue = h, s.dispatchEvent(new Event("input", { bubbles: !0 }));
1535
- return;
1536
- }
1537
- }
1538
- this.options.mode === "range" ? !/^\d$/.test(t) && t !== r && t !== " " && t.toLowerCase() !== "t" && t.toLowerCase() !== "o" && e.preventDefault() : !/^\d$/.test(t) && t !== r && e.preventDefault();
1539
- }
2896
+ async onDragEnd(t) {
2897
+ return await It(this);
1540
2898
  }
1541
- handlePaste(e) {
1542
- e.preventDefault();
1543
- const t = (e.clipboardData || window.clipboardData).getData("text"), { separator: a } = this.formatInfo, i = t.replace(new RegExp(`[^0-9${a.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}]`, "g"), ""), r = this.applyMask(i), o = e.target, s = o.selectionStart, l = o.selectionEnd, c = o.value, d = c.substring(0, s) + r + c.substring(l);
1544
- o.value = this.applyMask(d);
1545
- const p = s + r.length;
1546
- o.setSelectionRange(p, p), o.dispatchEvent(new Event("input", { bubbles: !0 })), this.updateCalendarFromInput();
2899
+ findNearestEnabledDate(t, n = "forward") {
2900
+ return Se(this, t, n);
1547
2901
  }
1548
- // === END INPUT MASKING ===
1549
- // Helper methods
1550
- parseFormat(e) {
1551
- const t = {};
1552
- let a = "";
1553
- return e.includes("-") ? a = "-" : e.includes("/") ? a = "/" : e.includes(".") && (a = "."), e.split(a).forEach((r, o) => {
1554
- r === "YYYY" || r === "YY" ? t.year = { index: o, length: r.length } : r === "MM" || r === "M" ? t.month = { index: o, length: 2 } : (r === "DD" || r === "D") && (t.day = { index: o, length: 2 });
1555
- }), {
1556
- format: e,
1557
- separator: a,
1558
- parts: t,
1559
- maxLength: e.length
1560
- };
2902
+ handleInputMask(t) {
2903
+ return Zn(this, t);
1561
2904
  }
1562
- formatDate(e) {
1563
- if (!e) return "";
1564
- const t = e.getFullYear(), a = String(e.getMonth() + 1).padStart(2, "0"), i = String(e.getDate()).padStart(2, "0"), { format: r, separator: o, parts: s } = this.formatInfo, l = [];
1565
- for (let c = 0; c < 3; c++)
1566
- s.year && s.year.index === c ? l.push(s.year.length === 2 ? String(t).slice(-2) : t) : s.month && s.month.index === c ? l.push(a) : s.day && s.day.index === c && l.push(i);
1567
- return l.join(o);
1568
- }
1569
- parseInputValue(e) {
1570
- if (!e) return null;
1571
- const { separator: t, parts: a, maxLength: i } = this.formatInfo;
1572
- if (e.length !== i) return null;
1573
- const r = e.split(t);
1574
- if (r.length !== 3) return null;
1575
- let o, s, l;
1576
- if (r.forEach((d, p) => {
1577
- a.year && a.year.index === p ? (o = parseInt(d, 10), a.year.length === 2 && o < 100 && (o += 2e3)) : a.month && a.month.index === p ? s = parseInt(d, 10) : a.day && a.day.index === p && (l = parseInt(d, 10));
1578
- }), !o || !s || !l || s < 1 || s > 12 || l < 1 || l > 31) return null;
1579
- const c = new Date(o, s - 1, l);
1580
- return c.getMonth() !== s - 1 ? null : c;
1581
- }
1582
- parseAndUpdateSingleDate(e, t = "single") {
1583
- const { separator: a, parts: i, maxLength: r } = this.formatInfo, o = e.split(a);
1584
- let s = null, l = null, c = null;
1585
- if (o.forEach((d, p) => {
1586
- if (d) {
1587
- if (i.year && i.year.index === p) {
1588
- const h = parseInt(d, 10);
1589
- i.year.length === 4 && d.length === 4 ? s = h : i.year.length === 2 && d.length === 2 && (s = h < 100 ? h + 2e3 : h);
1590
- } else if (i.month && i.month.index === p) {
1591
- const h = parseInt(d, 10);
1592
- d.length === 2 && h >= 1 && h <= 12 && (l = h);
1593
- } else if (i.day && i.day.index === p) {
1594
- const h = parseInt(d, 10);
1595
- d.length === 2 && h >= 1 && h <= 31 && (c = h);
1596
- }
1597
- }
1598
- }), console.log(`[DatePicker] parseAndUpdateSingleDate(${t}) - year:`, s, "month:", l, "day:", c), s !== null || l !== null) {
1599
- const d = s || (/* @__PURE__ */ new Date()).getFullYear(), p = l !== null ? l - 1 : (/* @__PURE__ */ new Date()).getMonth();
1600
- if (this.options.mode === "single") {
1601
- this.currentYear = d, this.currentMonth = p, this.monthDates = [];
1602
- for (let h = 0; h < this.options.monthsToShow; h++) {
1603
- const u = new Date(d, p + h, 1);
1604
- this.monthDates.push(u);
1605
- }
1606
- } else if (this.options.mode === "range" && (t === "start" || !this.selectedStartDate)) {
1607
- if (this.displayMonths = [
1608
- { month: p, year: d }
1609
- ], this.options.monthsToShow > 1) {
1610
- const h = new Date(d, p + 1, 1);
1611
- this.displayMonths.push({
1612
- month: h.getMonth(),
1613
- year: h.getFullYear()
1614
- });
1615
- }
1616
- this.monthDates = [];
1617
- for (let h = 0; h < this.options.monthsToShow; h++) {
1618
- const u = this.displayMonths[h], f = new Date(u.year, u.month, 1);
1619
- this.monthDates.push(f);
1620
- }
1621
- }
1622
- this.renderCalendar();
1623
- }
1624
- if (s !== null && l !== null && c !== null) {
1625
- const d = new Date(s, l - 1, c);
1626
- d.getMonth() === l - 1 && (t === "single" ? this.selectedDate = d : t === "start" ? this.selectedStartDate = d : t === "end" && (this.selectedEndDate = d), this.renderCalendar(), this.options.mode === "range" && this.updateSummary(), console.log(`[DatePicker] Set ${t} date:`, d));
1627
- }
2905
+ applyMask(t) {
2906
+ return oe(this, t);
1628
2907
  }
1629
- updateCalendarFromInput() {
1630
- const e = this.input.value;
1631
- if (console.log("[DatePicker] updateCalendarFromInput - value:", e), !e) return;
1632
- const { separator: t, parts: a, maxLength: i } = this.formatInfo;
1633
- if (console.log("[DatePicker] Format info:", { separator: t, parts: a, maxLength: i }), this.options.mode === "range" && e.includes(" to ")) {
1634
- const o = e.split(" to "), s = o[0], l = o[1];
1635
- console.log("[DatePicker] Range parts - start:", s, "end:", l), this.parseAndUpdateSingleDate(s, "start"), l && this.parseAndUpdateSingleDate(l, "end");
1636
- return;
1637
- }
1638
- const r = this.options.mode === "range" ? "start" : "single";
1639
- this.parseAndUpdateSingleDate(e, r);
2908
+ applyRangeMask(t) {
2909
+ return Et(this, t);
1640
2910
  }
1641
- isToday(e) {
1642
- const t = /* @__PURE__ */ new Date();
1643
- return this.isSameDay(e, t);
2911
+ handleKeydown(t) {
2912
+ return ea(this, t);
1644
2913
  }
1645
- isSameDay(e, t) {
1646
- return !e || !t ? !1 : e.getFullYear() === t.getFullYear() && e.getMonth() === t.getMonth() && e.getDate() === t.getDate();
2914
+ handlePaste(t) {
2915
+ return ta(this, t);
1647
2916
  }
1648
- isInRange(e) {
1649
- return !this.selectedStartDate || !this.selectedEndDate ? !1 : e > this.selectedStartDate && e < this.selectedEndDate;
2917
+ updateCalendarFromInput() {
2918
+ return Ve(this);
1650
2919
  }
1651
- destroy() {
1652
- this.clickOutsideHandler && document.removeEventListener("click", this.clickOutsideHandler), this.calendar.remove();
2920
+ parseAndUpdateSingleDate(t, n = "single") {
2921
+ return De(this, t, n);
1653
2922
  }
1654
2923
  }
1655
- const Et = '@charset "UTF-8";:root{--drp-card-bg: #ffffff;--drp-border-color: #e5e7eb;--drp-primary-bg: #f3f4f6;--drp-primary-bg-hover: #e5e7eb;--drp-accent-color: #3b82f6;--drp-accent-color-hover: #2563eb;--drp-text-primary: #111827;--drp-text-secondary: #6b7280;--drp-spacing-xs: .25rem;--drp-spacing-sm: .5rem;--drp-spacing-md: 1rem;--drp-spacing-lg: 1.5rem;--drp-spacing-xl: 2rem;--drp-font-size-2xs: .625rem;--drp-font-size-xs: .75rem;--drp-font-size-sm: .875rem;--drp-font-size-base: 1rem;--drp-font-size-lg: 1.125rem;--drp-font-size-xl: 1.25rem;--drp-font-size-2xl: 1.5rem;--drp-font-weight-medium: 500;--drp-font-weight-semibold: 600;--drp-border-width-base: 1px;--drp-border-radius: .375rem;--drp-shadow-xl: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--drp-transition-fast: .15s;--drp-easing-snappy: cubic-bezier(.4, 0, .2, 1);--drp-input-padding-h: .75rem}.pa-date-picker-input{position:relative;cursor:pointer}.pa-date-picker-input:after{content:"📅";position:absolute;right:var(--drp-input-padding-h);top:50%;transform:translateY(-50%);pointer-events:none;opacity:.6}.pa-date-picker{position:absolute;z-index:9500;background:var(--drp-card-bg);border:var(--drp-border-width-base) solid var(--drp-border-color);border-radius:var(--drp-border-radius);box-shadow:var(--drp-shadow-xl);padding:var(--drp-spacing-md);min-width:280px;-webkit-user-select:none;user-select:none}.pa-date-picker:not(.pa-date-picker--visible){display:none}.pa-date-picker__months{display:flex;gap:var(--drp-spacing-lg)}.pa-date-picker__month{flex:1;min-width:280px}.pa-date-picker__header{display:flex;align-items:center;justify-content:space-between;margin-bottom:var(--drp-spacing-md);gap:var(--drp-spacing-sm)}.pa-date-picker__month-year{flex:1;text-align:center;font-weight:var(--drp-font-weight-semibold);font-size:var(--drp-font-size-base);padding:var(--drp-spacing-sm) var(--drp-spacing-md);border-radius:var(--drp-border-radius);cursor:pointer;transition:background-color var(--drp-transition-fast) var(--drp-easing-snappy)}.pa-date-picker__month-year:hover{background-color:var(--drp-primary-bg)}.pa-date-picker__month-year:active{background-color:var(--drp-primary-bg-hover)}.pa-date-picker__nav{width:2rem;height:2rem;display:flex;align-items:center;justify-content:center;border:var(--drp-border-width-base) solid var(--drp-border-color);border-radius:var(--drp-border-radius);background:transparent;cursor:pointer;transition:all var(--drp-transition-fast) var(--drp-easing-snappy);font-size:var(--drp-font-size-lg);color:var(--drp-text-primary)}.pa-date-picker__nav:hover{background-color:var(--drp-primary-bg);border-color:var(--drp-accent-color)}.pa-date-picker__nav:active{background-color:var(--drp-primary-bg-hover)}.pa-date-picker__nav--prev:before{content:"‹"}.pa-date-picker__nav--next:before{content:"›"}.pa-date-picker__rolling-selector{display:none}.pa-date-picker__rolling-selector.pa-date-picker__rolling-selector--visible{display:flex}.pa-date-picker__rolling-selector.pa-date-picker__rolling-selector--visible~.pa-date-picker__weekdays,.pa-date-picker__rolling-selector.pa-date-picker__rolling-selector--visible~.pa-date-picker__days{display:none}.pa-date-picker__rolling-selector{gap:var(--drp-spacing-md);margin-bottom:var(--drp-spacing-md)}.pa-date-picker__rolling-list{flex:1;height:100%;overflow-y:auto;border:var(--drp-border-width-base) solid var(--drp-border-color);border-radius:var(--drp-border-radius);scroll-behavior:smooth}.pa-date-picker__rolling-list::-webkit-scrollbar{width:6px}.pa-date-picker__rolling-list::-webkit-scrollbar-track{background:var(--drp-primary-bg)}.pa-date-picker__rolling-list::-webkit-scrollbar-thumb{background:var(--drp-border-color);border-radius:3px}.pa-date-picker__rolling-list::-webkit-scrollbar-thumb:hover{background:var(--drp-accent-color)}.pa-date-picker__rolling-item{padding:var(--drp-spacing-sm) var(--drp-spacing-md);text-align:center;cursor:pointer;font-size:var(--drp-font-size-sm);transition:background-color var(--drp-transition-fast) var(--drp-easing-snappy)}.pa-date-picker__rolling-item:hover{background-color:var(--drp-primary-bg)}.pa-date-picker__rolling-item--selected{background-color:var(--drp-accent-color);color:#fff;font-weight:var(--drp-font-weight-semibold)}.pa-date-picker__rolling-item--selected:hover{background-color:var(--drp-accent-color-hover)}.pa-date-picker__weekdays{display:grid;grid-template-columns:repeat(7,1fr);gap:var(--drp-spacing-xs);margin-bottom:var(--drp-spacing-sm)}.pa-date-picker__weekday{text-align:center;font-size:var(--drp-font-size-xs);font-weight:var(--drp-font-weight-semibold);color:var(--drp-text-secondary);padding:var(--drp-spacing-xs);text-transform:uppercase}.pa-date-picker__days{display:grid;grid-template-columns:repeat(7,1fr);gap:var(--drp-spacing-xs);margin-bottom:var(--drp-spacing-md)}.pa-date-picker__day{aspect-ratio:1;display:flex;align-items:center;justify-content:center;font-size:var(--drp-font-size-sm);border-radius:var(--drp-border-radius);cursor:pointer;transition:all var(--drp-transition-fast) var(--drp-easing-snappy);border:2px solid transparent}.pa-date-picker__day:hover:not(.pa-date-picker__day--disabled):not(.pa-date-picker__day--other-month){background-color:var(--drp-primary-bg);border-color:var(--drp-accent-color)}.pa-date-picker__day--today{border-color:var(--drp-accent-color);font-weight:var(--drp-font-weight-semibold)}.pa-date-picker__day--selected{background-color:var(--drp-accent-color);color:#fff;font-weight:var(--drp-font-weight-semibold)}.pa-date-picker__day--selected:hover{background-color:var(--drp-accent-color-hover)}.pa-date-picker__day--focused{outline:2px solid var(--drp-accent-color);outline-offset:2px}.pa-date-picker__day--disabled{color:var(--drp-text-secondary);opacity:.4;cursor:not-allowed}.pa-date-picker__day--disabled:hover{background-color:transparent;border-color:transparent}.pa-date-picker__day--other-month{color:var(--drp-text-secondary);opacity:.5}.pa-date-picker__day--other-month.pa-date-picker__day--range-start,.pa-date-picker__day--other-month.pa-date-picker__day--range-end,.pa-date-picker__day--other-month.pa-date-picker__day--in-range,.pa-date-picker__day--other-month.pa-date-picker__day--drag-preview{opacity:1}.pa-date-picker__day--range-start,.pa-date-picker__day--range-end{background-color:var(--drp-accent-color);color:#fff;font-weight:var(--drp-font-weight-semibold);cursor:grab;-webkit-user-select:none;user-select:none}.pa-date-picker__day--range-start:active,.pa-date-picker__day--range-end:active{cursor:grabbing}.pa-date-picker__day--in-range{background-color:color-mix(in srgb,var(--drp-accent-color) 15%,transparent)}.pa-date-picker__day--in-range:hover{background-color:color-mix(in srgb,var(--drp-accent-color) 25%,transparent)}.pa-date-picker__day--dragging{cursor:grabbing!important;opacity:.7;transform:scale(1.1);transition:transform var(--drp-transition-fast) var(--drp-easing-snappy)}.pa-date-picker__day--drag-preview{background-color:color-mix(in srgb,var(--drp-accent-color) 30%,transparent);border:2px dashed var(--drp-accent-color)}.pa-date-picker__day--drag-preview.pa-date-picker__day--range-start,.pa-date-picker__day--drag-preview.pa-date-picker__day--range-end{background-color:color-mix(in srgb,var(--drp-accent-color) 60%,transparent);color:#fff}.pa-date-picker__summary{text-align:center;padding:var(--drp-spacing-md);border-top:var(--drp-border-width-base) solid var(--drp-border-color);font-size:var(--drp-font-size-sm);color:var(--drp-text-secondary)}.pa-date-picker__summary--visible{display:block}.pa-date-picker__summary--hidden{display:none}.pa-date-picker__summary-count{font-weight:var(--drp-font-weight-semibold);color:var(--drp-accent-color);font-size:var(--drp-font-size-base)}.pa-date-picker__actions{display:flex;gap:var(--drp-spacing-sm);justify-content:space-between;padding-top:var(--drp-spacing-sm);border-top:var(--drp-border-width-base) solid var(--drp-border-color)}.pa-date-picker__button{flex:1;padding:var(--drp-spacing-sm) var(--drp-spacing-md);border:var(--drp-border-width-base) solid var(--drp-border-color);border-radius:var(--drp-border-radius);background:transparent;cursor:pointer;font-size:var(--drp-font-size-sm);font-weight:var(--drp-font-weight-medium);transition:all var(--drp-transition-fast) var(--drp-easing-snappy)}.pa-date-picker__button:hover{background-color:var(--drp-primary-bg);border-color:var(--drp-accent-color)}.pa-date-picker__button--today{color:var(--drp-accent-color)}.pa-date-picker__button--clear{color:var(--drp-text-secondary)}.pa-date-picker__button--apply{background-color:var(--drp-accent-color);color:#fff;border-color:var(--drp-accent-color)}.pa-date-picker__button--apply:hover{background-color:var(--drp-accent-color-hover)}.pa-date-picker__button--cancel{color:var(--drp-text-secondary)}.pa-date-picker--xs{padding:var(--drp-spacing-sm);min-width:240px}.pa-date-picker--xs .pa-date-picker__month-year{font-size:var(--drp-font-size-xs);padding:var(--drp-spacing-xs) var(--drp-spacing-sm)}.pa-date-picker--xs .pa-date-picker__nav{width:1.5rem;height:1.5rem;font-size:var(--drp-font-size-sm)}.pa-date-picker--xs .pa-date-picker__weekday{font-size:var(--drp-font-size-2xs)}.pa-date-picker--xs .pa-date-picker__day{font-size:var(--drp-font-size-xs)}.pa-date-picker--sm{padding:var(--drp-spacing-sm);min-width:260px}.pa-date-picker--sm .pa-date-picker__month-year{font-size:var(--drp-font-size-sm);padding:var(--drp-spacing-xs) var(--drp-spacing-sm)}.pa-date-picker--sm .pa-date-picker__nav{width:1.75rem;height:1.75rem;font-size:var(--drp-font-size-base)}.pa-date-picker--sm .pa-date-picker__day{font-size:var(--drp-font-size-xs)}.pa-date-picker--lg{padding:var(--drp-spacing-lg);min-width:320px}.pa-date-picker--lg .pa-date-picker__month-year{font-size:var(--drp-font-size-lg);padding:var(--drp-spacing-md) var(--drp-spacing-lg)}.pa-date-picker--lg .pa-date-picker__nav{width:2.5rem;height:2.5rem;font-size:var(--drp-font-size-xl)}.pa-date-picker--lg .pa-date-picker__day{font-size:var(--drp-font-size-base)}.pa-date-picker--xl{padding:var(--drp-spacing-xl);min-width:360px}.pa-date-picker--xl .pa-date-picker__month-year{font-size:var(--drp-font-size-xl);padding:var(--drp-spacing-lg) var(--drp-spacing-xl)}.pa-date-picker--xl .pa-date-picker__nav{width:3rem;height:3rem;font-size:var(--drp-font-size-2xl)}.pa-date-picker--xl .pa-date-picker__day{font-size:var(--drp-font-size-lg)}.pa-date-picker--inline{position:static;display:block;box-shadow:none}';
1656
- class Pt extends HTMLElement {
2924
+ const oa = '@charset "UTF-8";:host{--drp-card-bg: #ffffff;--drp-border-color: #e5e7eb;--drp-primary-bg: #f3f4f6;--drp-primary-bg-hover: #e5e7eb;--drp-accent-color: #3b82f6;--drp-accent-color-hover: #2563eb;--drp-text-primary: #111827;--drp-text-secondary: #6b7280;--drp-accent-text-color: #ffffff;--drp-button-text-color: #ffffff;--drp-spacing-xs: .25rem;--drp-spacing-sm: .5rem;--drp-spacing-md: 1rem;--drp-spacing-lg: 1.5rem;--drp-spacing-xl: 2rem;--drp-font-size-2xs: .625rem;--drp-font-size-xs: .75rem;--drp-font-size-sm: .875rem;--drp-font-size-base: 1rem;--drp-font-size-lg: 1.125rem;--drp-font-size-xl: 1.25rem;--drp-font-size-2xl: 1.5rem;--drp-font-weight-medium: 500;--drp-font-weight-semibold: 600;--drp-border-width-base: 1px;--drp-border-radius: .375rem;--drp-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, .1), 0 8px 10px -6px rgba(0, 0, 0, .1);--drp-transition-fast: .15s;--drp-easing-snappy: cubic-bezier(.4, 0, .2, 1);--drp-input-padding-h: .75rem;--drp-grid-columns: 3;--drp-grid-rows: 2}.drp-date-picker-input{position:relative;cursor:pointer}.drp-date-picker-input:after{content:"📅";position:absolute;right:var(--drp-input-padding-h);top:50%;transform:translateY(-50%);pointer-events:none;opacity:.6}.drp-date-picker{position:absolute;z-index:9500;background:var(--drp-card-bg);border:var(--drp-border-width-base) solid var(--drp-border-color);border-radius:var(--drp-border-radius);box-shadow:var(--drp-shadow-xl);padding:var(--drp-spacing-md);min-width:280px;max-width:calc(100vw - 2rem);box-sizing:border-box;-webkit-user-select:none;user-select:none}.drp-date-picker:not(.drp-date-picker--visible){display:none}.drp-date-picker--inline{position:relative!important;display:block!important;z-index:auto;min-width:0;max-width:100%;width:fit-content;box-sizing:border-box}.drp-date-picker__months{display:flex;gap:var(--drp-spacing-lg)}.drp-date-picker--inline .drp-date-picker__months{flex-wrap:wrap}.drp-date-picker__months--grid{display:grid;grid-template-columns:repeat(var(--drp-grid-columns, 3),minmax(0,1fr));grid-template-rows:repeat(var(--drp-grid-rows, 2),auto);gap:var(--drp-spacing-lg);width:100%}@media (max-width: 1200px){.drp-date-picker__months--grid{grid-template-columns:repeat(min(var(--drp-grid-columns, 3),3),minmax(0,1fr))}}@media (max-width: 768px){.drp-date-picker__months--grid{grid-template-columns:repeat(min(var(--drp-grid-columns, 3),2),minmax(0,1fr))}}@media (max-width: 480px){.drp-date-picker__months--grid{grid-template-columns:minmax(0,1fr)}}.drp-date-picker__month{flex:1;min-width:280px}.drp-date-picker--inline .drp-date-picker__month{min-width:250px}.drp-date-picker__months--grid .drp-date-picker__month{min-width:0;width:100%}.drp-date-picker__header{display:flex;align-items:center;justify-content:space-between;margin-bottom:var(--drp-spacing-md);gap:var(--drp-spacing-sm)}.drp-date-picker__month-year{flex:1;text-align:center;font-weight:var(--drp-font-weight-semibold);font-size:var(--drp-font-size-base);color:var(--drp-text-primary);padding:var(--drp-spacing-sm) var(--drp-spacing-md);border-radius:var(--drp-border-radius);cursor:pointer;transition:background-color var(--drp-transition-fast) var(--drp-easing-snappy)}.drp-date-picker__month-year:hover{background-color:var(--drp-primary-bg)}.drp-date-picker__month-year:active{background-color:var(--drp-primary-bg-hover)}.drp-date-picker__nav{width:2rem;height:2rem;display:flex;align-items:center;justify-content:center;border:var(--drp-border-width-base) solid var(--drp-border-color);border-radius:var(--drp-border-radius);background:transparent;cursor:pointer;transition:all var(--drp-transition-fast) var(--drp-easing-snappy);font-size:var(--drp-font-size-lg);color:var(--drp-text-primary)}.drp-date-picker__nav:hover{background-color:var(--drp-primary-bg);border-color:var(--drp-accent-color)}.drp-date-picker__nav:active{background-color:var(--drp-primary-bg-hover)}.drp-date-picker__nav--disabled,.drp-date-picker__nav[disabled]{opacity:.6;cursor:not-allowed;pointer-events:none}.drp-date-picker__nav--disabled:hover,.drp-date-picker__nav[disabled]:hover{background-color:transparent;border-color:var(--drp-border-color)}.drp-date-picker__nav--prev:before{content:"‹"}.drp-date-picker__nav--next:before{content:"›"}.drp-date-picker__rolling-selector{display:none}.drp-date-picker__rolling-selector.drp-date-picker__rolling-selector--visible{display:flex}.drp-date-picker__rolling-selector.drp-date-picker__rolling-selector--visible~.drp-date-picker__weekdays,.drp-date-picker__rolling-selector.drp-date-picker__rolling-selector--visible~.drp-date-picker__days{display:none}.drp-date-picker__rolling-selector{gap:var(--drp-spacing-xs);margin-bottom:var(--drp-spacing-md)}.drp-date-picker__rolling-list{flex:1;height:100%;overflow-y:auto;border:var(--drp-border-width-base) solid var(--drp-border-color);border-radius:var(--drp-border-radius);scroll-behavior:smooth}.drp-date-picker__rolling-list::-webkit-scrollbar{width:6px}.drp-date-picker__rolling-list::-webkit-scrollbar-track{background:var(--drp-primary-bg)}.drp-date-picker__rolling-list::-webkit-scrollbar-thumb{background:var(--drp-border-color);border-radius:3px}.drp-date-picker__rolling-list::-webkit-scrollbar-thumb:hover{background:var(--drp-accent-color)}.drp-date-picker__rolling-item{padding:var(--drp-spacing-sm) var(--drp-spacing-md);text-align:center;cursor:pointer;font-size:var(--drp-font-size-sm);transition:background-color var(--drp-transition-fast) var(--drp-easing-snappy)}.drp-date-picker__rolling-item:hover{background-color:var(--drp-primary-bg)}.drp-date-picker__rolling-item--selected{background-color:var(--drp-accent-color);color:var(--drp-accent-text-color);font-weight:var(--drp-font-weight-semibold)}.drp-date-picker__rolling-item--selected:hover{background-color:var(--drp-accent-color-hover)}.drp-date-picker__weekdays{display:grid;grid-template-columns:repeat(7,1fr);gap:var(--drp-spacing-xs);margin-bottom:var(--drp-spacing-sm)}.drp-date-picker__weekday{text-align:center;font-size:var(--drp-font-size-xs);font-weight:var(--drp-font-weight-semibold);color:var(--drp-text-secondary);padding:var(--drp-spacing-xs);text-transform:uppercase}.drp-date-picker__days{display:flex;flex-direction:column;gap:var(--drp-spacing-xs);margin-bottom:var(--drp-spacing-md)}.drp-date-picker__date-row{display:grid;grid-template-columns:repeat(7,1fr);gap:var(--drp-spacing-xs)}.drp-date-picker__day{aspect-ratio:1;display:flex;align-items:center;justify-content:center;font-size:var(--drp-font-size-sm);color:var(--drp-text-primary);border-radius:var(--drp-border-radius);cursor:pointer;transition:all var(--drp-transition-fast) var(--drp-easing-snappy);border:2px solid transparent;position:relative}.drp-date-picker__day:hover:not(.drp-date-picker__day--disabled):not(.drp-date-picker__day--other-month){background-color:var(--drp-primary-bg);border-color:var(--drp-accent-color)}.drp-date-picker__day--today{border-color:var(--drp-accent-color);font-weight:var(--drp-font-weight-semibold)}.drp-date-picker__day--selected{background-color:var(--drp-accent-color);color:var(--drp-accent-text-color);font-weight:var(--drp-font-weight-semibold)}.drp-date-picker__day--selected:hover{background-color:var(--drp-accent-color-hover)}.drp-date-picker__day--focused{outline:2px solid var(--drp-accent-color);outline-offset:2px}.drp-date-picker__day--disabled{color:var(--drp-text-secondary);opacity:.6;cursor:not-allowed;position:relative}.drp-date-picker__day--disabled:before{content:"";position:absolute;top:0;left:0;right:0;bottom:0;background-image:repeating-linear-gradient(45deg,rgba(0,0,0,.1) 0px,rgba(0,0,0,.1) 1px,transparent 1px,transparent 6px);border-radius:var(--drp-border-radius);pointer-events:none}.drp-date-picker__day--disabled:hover{background-color:transparent;border-color:transparent}.drp-date-picker__day--other-month{color:var(--drp-text-secondary);opacity:.5}.drp-date-picker__day--other-month.drp-date-picker__day--range-start,.drp-date-picker__day--other-month.drp-date-picker__day--range-end,.drp-date-picker__day--other-month.drp-date-picker__day--in-range,.drp-date-picker__day--other-month.drp-date-picker__day--drag-preview{opacity:1}.drp-date-picker__day--range-start,.drp-date-picker__day--range-end{background-color:var(--drp-accent-color);color:var(--drp-accent-text-color);font-weight:var(--drp-font-weight-semibold);cursor:grab;-webkit-user-select:none;user-select:none}.drp-date-picker__day--range-start:active,.drp-date-picker__day--range-end:active{cursor:grabbing}.drp-date-picker__day--in-range{background-color:color-mix(in srgb,var(--drp-accent-color) 15%,transparent)}.drp-date-picker__day--in-range:hover{background-color:color-mix(in srgb,var(--drp-accent-color) 25%,transparent)}.drp-date-picker__day--dragging{cursor:grabbing!important;opacity:.7;transform:scale(1.1);transition:transform var(--drp-transition-fast) var(--drp-easing-snappy)}.drp-date-picker__day--drag-preview{background-color:color-mix(in srgb,var(--drp-accent-color) 30%,transparent);border:2px dashed var(--drp-accent-color)}.drp-date-picker__day--drag-preview.drp-date-picker__day--range-start,.drp-date-picker__day--drag-preview.drp-date-picker__day--range-end{background-color:color-mix(in srgb,var(--drp-accent-color) 60%,transparent);color:var(--drp-accent-text-color)}.drp-date-picker__day--drag-invalid{background-color:color-mix(in srgb,#ef4444 20%,transparent)!important;border-color:#ef4444!important;border-style:dashed!important}.drp-date-picker__day.holiday{background-color:color-mix(in srgb,#ef4444 10%,transparent)}.drp-date-picker__day.holiday:hover:not(.drp-date-picker__day--disabled){background-color:color-mix(in srgb,#ef4444 20%,transparent)}.drp-date-picker__day.event{background-color:color-mix(in srgb,#10b981 10%,transparent)}.drp-date-picker__day.event:hover:not(.drp-date-picker__day--disabled){background-color:color-mix(in srgb,#10b981 20%,transparent)}.drp-date-picker__rolling-item--disabled{color:var(--drp-text-secondary);opacity:.4;cursor:not-allowed;pointer-events:none;text-decoration:line-through}.drp-date-picker__rolling-item--disabled:hover{background-color:transparent}.drp-date-picker__badge-row{display:grid;grid-template-columns:repeat(7,1fr);gap:var(--drp-spacing-xs);margin-bottom:var(--drp-spacing-xs);max-height:1rem;min-height:1rem}.drp-date-picker__badge-cell{display:flex;align-items:center;justify-content:center;font-size:var(--drp-font-size-2xs);padding:1px 2px;border-radius:2px;transition:all var(--drp-transition-fast) var(--drp-easing-snappy);cursor:pointer;height:100%;max-height:1rem}.drp-date-picker__badge-cell:empty{visibility:hidden}.drp-date-picker__badge-cell:hover:not(:empty){transform:scale(1.05)}.drp-date-picker__badge-cell.badge-number{background-color:#10b981;color:#fff;font-size:.7rem;font-weight:600}.drp-date-picker__badge-cell.badge-count{background-color:#ef4444;color:#fff;font-size:.7rem;font-weight:700}.drp-date-picker__badge-cell.badge-text{background-color:#6b7280;color:#fff;font-size:.65rem;font-weight:700;text-transform:uppercase}.drp-date-picker__summary{text-align:center;padding:var(--drp-spacing-md);border-top:var(--drp-border-width-base) solid var(--drp-border-color);font-size:var(--drp-font-size-sm);color:var(--drp-text-secondary)}.drp-date-picker__summary--visible{display:block}.drp-date-picker__summary--hidden{display:none}.drp-date-picker__summary-count{font-weight:var(--drp-font-weight-semibold);color:var(--drp-accent-color);font-size:var(--drp-font-size-base)}.drp-date-picker__actions{display:flex;gap:var(--drp-spacing-sm);justify-content:space-between;padding-top:var(--drp-spacing-sm);border-top:var(--drp-border-width-base) solid var(--drp-border-color)}.drp-date-picker__button{flex:1;padding:var(--drp-spacing-sm) var(--drp-spacing-md);border:var(--drp-border-width-base) solid var(--drp-border-color);border-radius:var(--drp-border-radius);background:transparent;cursor:pointer;font-size:var(--drp-font-size-sm);font-weight:var(--drp-font-weight-medium);transition:all var(--drp-transition-fast) var(--drp-easing-snappy)}.drp-date-picker__button:hover{background-color:var(--drp-primary-bg);border-color:var(--drp-accent-color)}.drp-date-picker__button--today{color:var(--drp-accent-color)}.drp-date-picker__button--clear{color:var(--drp-text-secondary)}.drp-date-picker__button--apply{background-color:var(--drp-accent-color);color:var(--drp-button-text-color);border-color:var(--drp-accent-color)}.drp-date-picker__button--apply:hover{background-color:var(--drp-accent-color-hover)}.drp-date-picker__button--cancel{color:var(--drp-text-secondary)}.drp-date-picker__tooltip{position:absolute;z-index:9999;background-color:var(--drp-text-primary);color:#fff;padding:var(--drp-spacing-xs) var(--drp-spacing-sm);border-radius:var(--drp-border-radius);font-size:var(--drp-font-size-xs);line-height:1.4;max-width:200px;word-wrap:break-word;pointer-events:none;opacity:0;transition:opacity var(--drp-transition-fast) var(--drp-easing-snappy)}.drp-date-picker__tooltip--visible{opacity:1}.drp-date-picker__tooltip-arrow{position:absolute;background-color:var(--drp-text-primary);width:8px;height:8px;transform:rotate(45deg)}.drp-date-picker__loading-overlay{position:absolute;top:0;left:0;right:0;bottom:0;background-color:#fffc;display:flex;align-items:center;justify-content:center;z-index:9500;border-radius:.375rem}.drp-date-picker__loading-spinner{width:40px;height:40px;border:4px solid #e5e7eb;border-top-color:#3b82f6;border-radius:50%;animation:drp-spin .8s linear infinite}@keyframes drp-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.drp-font-xs{--drp-font-size-2xs: .4375rem;--drp-font-size-xs: .525rem;--drp-font-size-sm: .6125rem;--drp-font-size-base: .7rem;--drp-font-size-lg: .7875rem;--drp-font-size-xl: .875rem;--drp-font-size-2xl: 1.05rem}.drp-font-sm{--drp-font-size-2xs: .53125rem;--drp-font-size-xs: .6375rem;--drp-font-size-sm: .74375rem;--drp-font-size-base: .85rem;--drp-font-size-lg: .95625rem;--drp-font-size-xl: 1.0625rem;--drp-font-size-2xl: 1.275rem}.drp-font-lg{--drp-font-size-2xs: .75rem;--drp-font-size-xs: .9rem;--drp-font-size-sm: 1.05rem;--drp-font-size-base: 1.2rem;--drp-font-size-lg: 1.35rem;--drp-font-size-xl: 1.5rem;--drp-font-size-2xl: 1.8rem}.drp-font-xl{--drp-font-size-2xs: .875rem;--drp-font-size-xs: 1.05rem;--drp-font-size-sm: 1.225rem;--drp-font-size-base: 1.4rem;--drp-font-size-lg: 1.575rem;--drp-font-size-xl: 1.75rem;--drp-font-size-2xl: 2.1rem}.drp-spacing-xs{--drp-spacing-xs: .175rem;--drp-spacing-sm: .35rem;--drp-spacing-md: .7rem;--drp-spacing-lg: 1.05rem;--drp-spacing-xl: 1.4rem}.drp-spacing-xs .drp-date-picker__month{min-width:196px}.drp-spacing-sm{--drp-spacing-xs: .2125rem;--drp-spacing-sm: .425rem;--drp-spacing-md: .85rem;--drp-spacing-lg: 1.275rem;--drp-spacing-xl: 1.7rem}.drp-spacing-sm .drp-date-picker__month{min-width:238px}.drp-spacing-lg{--drp-spacing-xs: .3rem;--drp-spacing-sm: .6rem;--drp-spacing-md: 1.2rem;--drp-spacing-lg: 1.8rem;--drp-spacing-xl: 2.4rem}.drp-spacing-lg .drp-date-picker__month{min-width:336px}.drp-spacing-xl{--drp-spacing-xs: .35rem;--drp-spacing-sm: .7rem;--drp-spacing-md: 1.4rem;--drp-spacing-lg: 2.1rem;--drp-spacing-xl: 2.8rem}.drp-spacing-xl .drp-date-picker__month{min-width:392px}@media (max-width: 1200px){.drp-responsive.drp-font-xl{--drp-font-size-2xs: .75rem;--drp-font-size-xs: .9rem;--drp-font-size-sm: 1.05rem;--drp-font-size-base: 1.2rem;--drp-font-size-lg: 1.35rem;--drp-font-size-xl: 1.5rem;--drp-font-size-2xl: 1.8rem}}@media (max-width: 768px){.drp-responsive.drp-font-xl{--drp-font-size-2xs: .625rem;--drp-font-size-xs: .75rem;--drp-font-size-sm: .875rem;--drp-font-size-base: 1rem;--drp-font-size-lg: 1.125rem;--drp-font-size-xl: 1.25rem;--drp-font-size-2xl: 1.5rem}}@media (max-width: 1200px){.drp-responsive.drp-font-lg{--drp-font-size-2xs: .625rem;--drp-font-size-xs: .75rem;--drp-font-size-sm: .875rem;--drp-font-size-base: 1rem;--drp-font-size-lg: 1.125rem;--drp-font-size-xl: 1.25rem;--drp-font-size-2xl: 1.5rem}}@media (max-width: 768px){.drp-responsive.drp-font-lg{--drp-font-size-2xs: .53125rem;--drp-font-size-xs: .6375rem;--drp-font-size-sm: .74375rem;--drp-font-size-base: .85rem;--drp-font-size-lg: .95625rem;--drp-font-size-xl: 1.0625rem;--drp-font-size-2xl: 1.275rem}}@media (max-width: 768px){.drp-responsive.drp-font-md{--drp-font-size-2xs: .53125rem;--drp-font-size-xs: .6375rem;--drp-font-size-sm: .74375rem;--drp-font-size-base: .85rem;--drp-font-size-lg: .95625rem;--drp-font-size-xl: 1.0625rem;--drp-font-size-2xl: 1.275rem}}@media (max-width: 768px){.drp-responsive.drp-font-sm{--drp-font-size-2xs: .4375rem;--drp-font-size-xs: .525rem;--drp-font-size-sm: .6125rem;--drp-font-size-base: .7rem;--drp-font-size-lg: .7875rem;--drp-font-size-xl: .875rem;--drp-font-size-2xl: 1.05rem}}@media (max-width: 1200px){.drp-responsive.drp-spacing-xl{--drp-spacing-xs: .3rem;--drp-spacing-sm: .6rem;--drp-spacing-md: 1.2rem;--drp-spacing-lg: 1.8rem;--drp-spacing-xl: 2.4rem}.drp-responsive.drp-spacing-xl .drp-date-picker__month{min-width:336px}}@media (max-width: 768px){.drp-responsive.drp-spacing-xl{--drp-spacing-xs: .25rem;--drp-spacing-sm: .5rem;--drp-spacing-md: 1rem;--drp-spacing-lg: 1.5rem;--drp-spacing-xl: 2rem}.drp-responsive.drp-spacing-xl .drp-date-picker__month{min-width:280px}}@media (max-width: 1200px){.drp-responsive.drp-spacing-lg{--drp-spacing-xs: .25rem;--drp-spacing-sm: .5rem;--drp-spacing-md: 1rem;--drp-spacing-lg: 1.5rem;--drp-spacing-xl: 2rem}.drp-responsive.drp-spacing-lg .drp-date-picker__month{min-width:280px}}@media (max-width: 768px){.drp-responsive.drp-spacing-lg{--drp-spacing-xs: .2125rem;--drp-spacing-sm: .425rem;--drp-spacing-md: .85rem;--drp-spacing-lg: 1.275rem;--drp-spacing-xl: 1.7rem}.drp-responsive.drp-spacing-lg .drp-date-picker__month{min-width:238px}}@media (max-width: 768px){.drp-responsive.drp-spacing-md{--drp-spacing-xs: .2125rem;--drp-spacing-sm: .425rem;--drp-spacing-md: .85rem;--drp-spacing-lg: 1.275rem;--drp-spacing-xl: 1.7rem}.drp-responsive.drp-spacing-md .drp-date-picker__month{min-width:238px}}@media (max-width: 768px){.drp-responsive.drp-spacing-sm{--drp-spacing-xs: .175rem;--drp-spacing-sm: .35rem;--drp-spacing-md: .7rem;--drp-spacing-lg: 1.05rem;--drp-spacing-xl: 1.4rem}.drp-responsive.drp-spacing-sm .drp-date-picker__month{min-width:196px}}.drp-date-picker--xs{padding:var(--drp-spacing-sm);min-width:240px}.drp-date-picker--xs .drp-date-picker__month-year{font-size:var(--drp-font-size-xs);padding:var(--drp-spacing-xs) var(--drp-spacing-sm)}.drp-date-picker--xs .drp-date-picker__nav{width:1.5rem;height:1.5rem;font-size:var(--drp-font-size-sm)}.drp-date-picker--xs .drp-date-picker__weekday{font-size:var(--drp-font-size-2xs)}.drp-date-picker--xs .drp-date-picker__day{font-size:var(--drp-font-size-xs)}.drp-date-picker--sm{padding:var(--drp-spacing-sm);min-width:260px}.drp-date-picker--sm .drp-date-picker__month-year{font-size:var(--drp-font-size-sm);padding:var(--drp-spacing-xs) var(--drp-spacing-sm)}.drp-date-picker--sm .drp-date-picker__nav{width:1.75rem;height:1.75rem;font-size:var(--drp-font-size-base)}.drp-date-picker--sm .drp-date-picker__day{font-size:var(--drp-font-size-xs)}.drp-date-picker--lg{padding:var(--drp-spacing-lg);min-width:320px}.drp-date-picker--lg .drp-date-picker__month-year{font-size:var(--drp-font-size-lg);padding:var(--drp-spacing-md) var(--drp-spacing-lg)}.drp-date-picker--lg .drp-date-picker__nav{width:2.5rem;height:2.5rem;font-size:var(--drp-font-size-xl)}.drp-date-picker--lg .drp-date-picker__day{font-size:var(--drp-font-size-base)}.drp-date-picker--xl{padding:var(--drp-spacing-xl);min-width:360px}.drp-date-picker--xl .drp-date-picker__month-year{font-size:var(--drp-font-size-xl);padding:var(--drp-spacing-lg) var(--drp-spacing-xl)}.drp-date-picker--xl .drp-date-picker__nav{width:3rem;height:3rem;font-size:var(--drp-font-size-2xl)}.drp-date-picker--xl .drp-date-picker__day{font-size:var(--drp-font-size-lg)}.drp-date-picker--inline{position:static;display:block;box-shadow:none}';
2925
+ class Ct extends HTMLElement {
1657
2926
  constructor() {
1658
2927
  super();
1659
- _(this, "picker");
1660
- _(this, "inputElement");
1661
- _(this, "shadow");
2928
+ D(this, "picker");
2929
+ D(this, "inputElement");
2930
+ D(this, "shadow");
2931
+ // Properties for complex data (not attributes)
2932
+ D(this, "_specialDates");
2933
+ D(this, "_disabledDates");
2934
+ D(this, "_isDateDisabled");
2935
+ D(this, "_getDateMetadata");
2936
+ D(this, "_renderDay");
2937
+ D(this, "_renderDayContent");
1662
2938
  this.shadow = this.attachShadow({ mode: "open" });
1663
2939
  }
1664
2940
  static get observedAttributes() {
1665
- return ["mode", "format", "months-to-show", "trigger", "value", "disabled", "placeholder"];
2941
+ return [
2942
+ "selection-mode",
2943
+ "date-format-mask",
2944
+ "visible-months-count",
2945
+ "calendar-open-trigger",
2946
+ "value",
2947
+ "disabled",
2948
+ "placeholder",
2949
+ "week-start-day",
2950
+ "min-date",
2951
+ "max-date",
2952
+ "disabled-weekdays",
2953
+ "disabled-dates-handling",
2954
+ "highlight-disabled-in-range",
2955
+ "positioning-mode",
2956
+ "month-layout",
2957
+ "grid-rows",
2958
+ "grid-columns",
2959
+ "calendar-placement",
2960
+ "locale",
2961
+ "display-format-mask",
2962
+ "show-debug-info",
2963
+ "initial-date",
2964
+ "rolling-year-range",
2965
+ "rolling-month-range"
2966
+ ];
1666
2967
  }
1667
2968
  connectedCallback() {
1668
2969
  this.render(), this.initializePicker();
@@ -1670,37 +2971,102 @@ class Pt extends HTMLElement {
1670
2971
  disconnectedCallback() {
1671
2972
  this.picker && this.picker.destroy();
1672
2973
  }
1673
- attributeChangedCallback(t, a, i) {
1674
- a !== i && (this.picker && t !== "value" && t !== "placeholder" && (this.picker.destroy(), this.initializePicker()), t === "value" && this.inputElement && i !== null && (this.inputElement.value = i), t === "placeholder" && this.inputElement && i !== null && (this.inputElement.placeholder = i), t === "disabled" && this.inputElement && (i !== null ? this.inputElement.disabled = !0 : this.inputElement.disabled = !1));
2974
+ attributeChangedCallback(n, a, r) {
2975
+ a !== r && (this.picker && n !== "value" && n !== "placeholder" && (this.picker.destroy(), this.initializePicker()), n === "value" && this.inputElement && r !== null && (this.inputElement.value = r), n === "placeholder" && this.inputElement && r !== null && (this.inputElement.placeholder = r), n === "disabled" && this.inputElement && (r !== null ? this.inputElement.disabled = !0 : this.inputElement.disabled = !1));
1675
2976
  }
1676
2977
  render() {
1677
- const t = document.createElement("style");
1678
- t.textContent = Et, this.inputElement = document.createElement("input"), this.inputElement.type = "text", this.inputElement.classList.add("pa-input", "pa-date-picker-input");
1679
- const a = this.getAttribute("placeholder");
1680
- a && (this.inputElement.placeholder = a);
1681
- const i = this.getAttribute("value");
1682
- i && (this.inputElement.value = i), this.hasAttribute("disabled") && (this.inputElement.disabled = !0), this.shadow.appendChild(t), this.shadow.appendChild(this.inputElement);
2978
+ const n = document.createElement("style");
2979
+ if (n.textContent = oa, this.shadow.appendChild(n), (this.getAttribute("positioning-mode") || "floating") === "floating") {
2980
+ this.inputElement = document.createElement("input"), this.inputElement.type = "text", this.inputElement.classList.add("drp-input", "drp-date-picker-input");
2981
+ const r = this.getAttribute("placeholder");
2982
+ r && (this.inputElement.placeholder = r);
2983
+ const o = this.getAttribute("value");
2984
+ o && (this.inputElement.value = o), this.hasAttribute("disabled") && (this.inputElement.disabled = !0), this.shadow.appendChild(this.inputElement);
2985
+ }
1683
2986
  }
1684
2987
  initializePicker() {
1685
- if (!this.inputElement) return;
1686
- const t = {
1687
- mode: this.getAttribute("mode") || "single",
1688
- format: this.getAttribute("format") || "YYYY-MM-DD",
1689
- monthsToShow: parseInt(this.getAttribute("months-to-show") || "0") || void 0,
1690
- calendarTrigger: this.getAttribute("trigger") || "auto",
1691
- onSelect: (a) => this.handleDateSelect(a),
1692
- container: this.shadow
2988
+ const n = this.getAttribute("positioning-mode") || "floating";
2989
+ if (n === "floating" && !this.inputElement) return;
2990
+ let a;
2991
+ const r = this.getAttribute("disabled-weekdays");
2992
+ r && (a = r.split(",").map((l) => parseInt(l.trim())).filter((l) => !isNaN(l) && l >= 0 && l <= 6));
2993
+ let o;
2994
+ const s = this.getAttribute("week-start-day");
2995
+ if (s)
2996
+ if (s === "auto")
2997
+ o = "auto";
2998
+ else {
2999
+ const l = parseInt(s);
3000
+ !isNaN(l) && l >= 0 && l <= 6 && (o = l);
3001
+ }
3002
+ const i = {
3003
+ selectionMode: this.getAttribute("selection-mode") || "single",
3004
+ dateFormatMask: this.getAttribute("date-format-mask") || "YYYY-MM-DD",
3005
+ visibleMonthsCount: parseInt(this.getAttribute("visible-months-count") || "0") || void 0,
3006
+ calendarOpenTrigger: this.getAttribute("calendar-open-trigger") || "focus",
3007
+ onSelect: (l) => this.handleDateSelect(l),
3008
+ container: this.shadow,
1693
3009
  // Append calendar to shadow root
1694
- };
1695
- this.picker = new Ct(this.inputElement, t);
1696
- }
1697
- handleDateSelect(t) {
1698
- var i;
3010
+ positioningMode: n,
3011
+ // Layout options
3012
+ monthLayout: this.getAttribute("month-layout") || void 0,
3013
+ gridRows: parseInt(this.getAttribute("grid-rows") || "0") || void 0,
3014
+ gridColumns: parseInt(this.getAttribute("grid-columns") || "0") || void 0,
3015
+ // Positioning
3016
+ calendarPlacement: this.getAttribute("calendar-placement") || void 0,
3017
+ // New options
3018
+ weekStartDay: o,
3019
+ minDate: this.getAttribute("min-date") || void 0,
3020
+ maxDate: this.getAttribute("max-date") || void 0,
3021
+ initialDate: this.getAttribute("initial-date") || void 0,
3022
+ disabledWeekdays: a,
3023
+ disabledDates: this._disabledDates,
3024
+ specialDates: this._specialDates,
3025
+ isDateDisabled: this._isDateDisabled,
3026
+ getDateMetadata: this._getDateMetadata,
3027
+ disabledDatesHandling: this.getAttribute("disabled-dates-handling") || void 0,
3028
+ highlightDisabledInRange: this.hasAttribute("highlight-disabled-in-range") ? this.getAttribute("highlight-disabled-in-range") === "true" : void 0,
3029
+ locale: this.getAttribute("locale") || "auto",
3030
+ displayFormatMask: this.getAttribute("display-format-mask") || void 0,
3031
+ showDebugInfo: this.hasAttribute("show-debug-info"),
3032
+ // Rolling selector configuration
3033
+ rollingYearRange: this.getAttribute("rolling-year-range") || void 0,
3034
+ rollingMonthRange: this.getAttribute("rolling-month-range") || void 0,
3035
+ // Custom rendering
3036
+ renderDay: this._renderDay,
3037
+ renderDayContent: this._renderDayContent
3038
+ }, d = n === "inline" ? null : this.inputElement;
3039
+ this.picker = new sa(d, i);
3040
+ }
3041
+ handleDateSelect(n) {
3042
+ var o;
1699
3043
  const a = {
1700
- date: t instanceof Date ? t : void 0,
1701
- dateRange: t instanceof Date ? void 0 : t,
1702
- formattedValue: ((i = this.inputElement) == null ? void 0 : i.value) || ""
3044
+ date: n instanceof Date ? n : void 0,
3045
+ dateRange: n instanceof Date ? void 0 : n,
3046
+ formattedValue: ((o = this.inputElement) == null ? void 0 : o.value) || ""
1703
3047
  };
3048
+ if (!this.picker) {
3049
+ this.dispatchEvent(new CustomEvent("date-select", { detail: a, bubbles: !0, composed: !0 })), this.dispatchEvent(new CustomEvent("change", { detail: a, bubbles: !0, composed: !0 }));
3050
+ return;
3051
+ }
3052
+ const r = this.picker.options.disabledDatesHandling;
3053
+ if (!(n instanceof Date) && n.start && n.end) {
3054
+ const s = n.start, i = n.end;
3055
+ switch (r) {
3056
+ case "allow":
3057
+ a.enabledDates = this.picker.getEnabledDatesInRange(s, i), a.disabledDates = this.picker.getDisabledDatesInRange(s, i), a.getEnabledDateCount = () => a.enabledDates.length, a.getTotalDays = () => Math.floor((i.getTime() - s.getTime()) / 864e5) + 1;
3058
+ break;
3059
+ case "split":
3060
+ a.dateRanges = this.picker.splitRangeByDisabled(s, i), a.dates = this.picker.getEnabledDatesInRange(s, i), a.dateRanges.length > 0 && (a.formattedValue = a.dateRanges.map((d) => `${this.picker.formatDate(d.start)} - ${this.picker.formatDate(d.end)}`).join(", "));
3061
+ break;
3062
+ case "individual":
3063
+ a.dates = this.picker.getEnabledDatesInRange(s, i), a.dateRange = null, a.dates.length > 0 && (a.formattedValue = a.dates.map((d) => this.picker.formatDate(d)).join(", "));
3064
+ break;
3065
+ case "block":
3066
+ a.dates = this.picker.getEnabledDatesInRange(s, i);
3067
+ break;
3068
+ }
3069
+ }
1704
3070
  this.dispatchEvent(new CustomEvent("date-select", {
1705
3071
  detail: a,
1706
3072
  bubbles: !0,
@@ -1713,56 +3079,144 @@ class Pt extends HTMLElement {
1713
3079
  }
1714
3080
  // Public API methods
1715
3081
  show() {
1716
- var t;
1717
- (t = this.picker) == null || t.show();
3082
+ var n;
3083
+ (n = this.picker) == null || n.show();
1718
3084
  }
1719
3085
  hide() {
1720
- var t;
1721
- (t = this.picker) == null || t.hide();
3086
+ var n;
3087
+ (n = this.picker) == null || n.hide();
1722
3088
  }
1723
3089
  toggle() {
1724
- var t;
1725
- (t = this.picker) == null || t.toggle();
3090
+ var n;
3091
+ (n = this.picker) == null || n.toggle();
1726
3092
  }
1727
- clear() {
1728
- var t;
1729
- (t = this.picker) == null || t.clear();
3093
+ clearSelection() {
3094
+ var n;
3095
+ (n = this.picker) == null || n.clearSelection();
1730
3096
  }
1731
- getValue() {
1732
- var t;
1733
- return ((t = this.inputElement) == null ? void 0 : t.value) || "";
3097
+ getInputValue() {
3098
+ var n;
3099
+ return ((n = this.inputElement) == null ? void 0 : n.value) || "";
1734
3100
  }
1735
- setValue(t) {
1736
- this.inputElement && (this.inputElement.value = t), this.setAttribute("value", t);
3101
+ setInputValue(n) {
3102
+ this.inputElement && (this.inputElement.value = n), this.setAttribute("value", n);
1737
3103
  }
1738
3104
  // Property accessors
1739
- get mode() {
1740
- return this.getAttribute("mode") || "single";
3105
+ get selectionMode() {
3106
+ return this.getAttribute("selection-mode") || "single";
1741
3107
  }
1742
- set mode(t) {
1743
- this.setAttribute("mode", t);
3108
+ set selectionMode(n) {
3109
+ this.setAttribute("selection-mode", n);
1744
3110
  }
1745
- get format() {
1746
- return this.getAttribute("format") || "YYYY-MM-DD";
3111
+ get dateFormatMask() {
3112
+ return this.getAttribute("date-format-mask") || "YYYY-MM-DD";
1747
3113
  }
1748
- set format(t) {
1749
- this.setAttribute("format", t);
3114
+ set dateFormatMask(n) {
3115
+ this.setAttribute("date-format-mask", n);
1750
3116
  }
1751
3117
  get value() {
1752
- return this.getValue();
3118
+ return this.getInputValue();
1753
3119
  }
1754
- set value(t) {
1755
- this.setValue(t);
3120
+ set value(n) {
3121
+ this.setInputValue(n);
1756
3122
  }
1757
3123
  get disabled() {
1758
3124
  return this.hasAttribute("disabled");
1759
3125
  }
1760
- set disabled(t) {
1761
- t ? this.setAttribute("disabled", "") : this.removeAttribute("disabled");
3126
+ set disabled(n) {
3127
+ n ? this.setAttribute("disabled", "") : this.removeAttribute("disabled");
3128
+ }
3129
+ // Week start day property
3130
+ get weekStartDay() {
3131
+ const n = this.getAttribute("week-start-day");
3132
+ if (n === "auto") return "auto";
3133
+ const a = parseInt(n || "");
3134
+ return !isNaN(a) && a >= 0 && a <= 6 ? a : "auto";
3135
+ }
3136
+ set weekStartDay(n) {
3137
+ this.setAttribute("week-start-day", n.toString());
3138
+ }
3139
+ // Min/Max date properties
3140
+ get minDate() {
3141
+ return this.getAttribute("min-date") || void 0;
3142
+ }
3143
+ set minDate(n) {
3144
+ n ? this.setAttribute("min-date", n) : this.removeAttribute("min-date");
3145
+ }
3146
+ get maxDate() {
3147
+ return this.getAttribute("max-date") || void 0;
3148
+ }
3149
+ set maxDate(n) {
3150
+ n ? this.setAttribute("max-date", n) : this.removeAttribute("max-date");
3151
+ }
3152
+ // Disabled weekdays property
3153
+ get disabledWeekdays() {
3154
+ const n = this.getAttribute("disabled-weekdays");
3155
+ if (n)
3156
+ return n.split(",").map((a) => parseInt(a.trim())).filter((a) => !isNaN(a) && a >= 0 && a <= 6);
3157
+ }
3158
+ set disabledWeekdays(n) {
3159
+ n && n.length > 0 ? this.setAttribute("disabled-weekdays", n.join(",")) : this.removeAttribute("disabled-weekdays");
3160
+ }
3161
+ // Complex data properties (not attributes)
3162
+ get specialDates() {
3163
+ return this._specialDates;
1762
3164
  }
3165
+ set specialDates(n) {
3166
+ this._specialDates = n, this.picker && (this.picker.destroy(), this.initializePicker());
3167
+ }
3168
+ get disabledDates() {
3169
+ return this._disabledDates;
3170
+ }
3171
+ set disabledDates(n) {
3172
+ this._disabledDates = n, this.picker && (this.picker.destroy(), this.initializePicker());
3173
+ }
3174
+ get isDateDisabled() {
3175
+ return this._isDateDisabled;
3176
+ }
3177
+ set isDateDisabled(n) {
3178
+ this._isDateDisabled = n, this.picker && (this.picker.destroy(), this.initializePicker());
3179
+ }
3180
+ get getDateMetadata() {
3181
+ return this._getDateMetadata;
3182
+ }
3183
+ set getDateMetadata(n) {
3184
+ this._getDateMetadata = n, this.picker && (this.picker.destroy(), this.initializePicker());
3185
+ }
3186
+ // Custom rendering properties
3187
+ get renderDay() {
3188
+ return this._renderDay;
3189
+ }
3190
+ set renderDay(n) {
3191
+ this._renderDay = n, this.picker && (this.picker.options.renderDay = n, this.picker.render());
3192
+ }
3193
+ get renderDayContent() {
3194
+ return this._renderDayContent;
3195
+ }
3196
+ set renderDayContent(n) {
3197
+ this._renderDayContent = n, this.picker && (this.picker.options.renderDayContent = n, this.picker.render());
3198
+ }
3199
+ }
3200
+ customElements.get("date-range-picker") || customElements.define("date-range-picker", Ct);
3201
+ function ia() {
3202
+ return Array.from(document.querySelectorAll("date-range-picker"));
1763
3203
  }
1764
- customElements.get("date-range-picker") || customElements.define("date-range-picker", Pt);
3204
+ typeof window < "u" && (window.keenmate = window.keenmate || {}, window.keenmate.daterangepicker = {
3205
+ version: () => "1.0.0-rc08",
3206
+ config: {
3207
+ name: "@keenmate/web-daterangepicker",
3208
+ version: "1.0.0-rc08",
3209
+ author: "Keenmate",
3210
+ license: "MIT",
3211
+ repository: "git+https://github.com/keenmate/web-daterangepicker.git",
3212
+ homepage: "https://github.com/keenmate/web-daterangepicker#readme"
3213
+ },
3214
+ register: () => {
3215
+ typeof customElements < "u" && !customElements.get("date-range-picker") && customElements.define("date-range-picker", Ct);
3216
+ },
3217
+ getInstances: () => ia()
3218
+ }, window.keenmate.daterangepicker.register());
1765
3219
  export {
1766
- Pt as DateRangePickerElement,
1767
- Ct as PureDatePicker
3220
+ Ct as DateRangePickerElement,
3221
+ sa as PureDatePicker
1768
3222
  };