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

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