@oslokommune/punkt-elements 11.12.3

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.
Files changed (35) hide show
  1. package/LICENSE +21 -0
  2. package/dist/converters-01e4a1b1.cjs +5 -0
  3. package/dist/converters-92631e0d.js +105 -0
  4. package/dist/directive-6900e150.cjs +23 -0
  5. package/dist/directive-720b7cc8.js +606 -0
  6. package/dist/index-34184de4.js +173 -0
  7. package/dist/index-51027300.cjs +13 -0
  8. package/dist/pkt-el-calendar.cjs +60 -0
  9. package/dist/pkt-el-calendar.js +1504 -0
  10. package/dist/pkt-el-component-template.cjs +29 -0
  11. package/dist/pkt-el-component-template.js +100 -0
  12. package/dist/pkt-el-element.cjs +1 -0
  13. package/dist/pkt-el-element.js +5 -0
  14. package/dist/pkt-el-icon.cjs +9 -0
  15. package/dist/pkt-el-icon.js +103 -0
  16. package/dist/pkt-el-index.cjs +1 -0
  17. package/dist/pkt-el-index.js +12 -0
  18. package/dist/property-0378afc0.js +47 -0
  19. package/dist/property-e170cbca.cjs +9 -0
  20. package/dist/src/components/calendar/index.d.ts +60 -0
  21. package/dist/src/components/component-template/index.d.ts +35 -0
  22. package/dist/src/components/element/index.d.ts +25 -0
  23. package/dist/src/components/icon/index.d.ts +30 -0
  24. package/dist/src/components/index.d.ts +3 -0
  25. package/dist/src/controllers/pkt-slot-controller.d.ts +12 -0
  26. package/dist/src/helpers/converters.d.ts +3 -0
  27. package/dist/src/index.d.ts +1 -0
  28. package/dist/src/translations/no.json.d.ts +43 -0
  29. package/dist/vite.config.d.ts +2 -0
  30. package/package.json +61 -0
  31. package/src/components/calendar/index.ts +375 -0
  32. package/src/components/component-template/index.ts +113 -0
  33. package/src/components/element/index.ts +37 -0
  34. package/src/components/icon/index.ts +100 -0
  35. package/src/components/index.ts +3 -0
@@ -0,0 +1,1504 @@
1
+ import { x as v } from "./directive-720b7cc8.js";
2
+ import { n as l, t as z } from "./property-0378afc0.js";
3
+ import { t as P, e as K, s as A, c as L, a as Z } from "./converters-92631e0d.js";
4
+ import { P as tt } from "./index-34184de4.js";
5
+ import "./pkt-el-icon.js";
6
+ function w(t) {
7
+ const e = Object.prototype.toString.call(t);
8
+ return t instanceof Date || typeof t == "object" && e === "[object Date]" ? new t.constructor(+t) : typeof t == "number" || e === "[object Number]" || typeof t == "string" || e === "[object String]" ? new Date(t) : /* @__PURE__ */ new Date(NaN);
9
+ }
10
+ function O(t, e) {
11
+ return t instanceof Date ? new t.constructor(e) : new Date(e);
12
+ }
13
+ const G = 6048e5, et = 864e5;
14
+ let nt = {};
15
+ function N() {
16
+ return nt;
17
+ }
18
+ function Y(t, e) {
19
+ var o, u, f, m;
20
+ const n = N(), r = (e == null ? void 0 : e.weekStartsOn) ?? ((u = (o = e == null ? void 0 : e.locale) == null ? void 0 : o.options) == null ? void 0 : u.weekStartsOn) ?? n.weekStartsOn ?? ((m = (f = n.locale) == null ? void 0 : f.options) == null ? void 0 : m.weekStartsOn) ?? 0, a = w(t), s = a.getDay(), i = (s < r ? 7 : 0) + s - r;
21
+ return a.setDate(a.getDate() - i), a.setHours(0, 0, 0, 0), a;
22
+ }
23
+ function F(t) {
24
+ return Y(t, { weekStartsOn: 1 });
25
+ }
26
+ function V(t) {
27
+ const e = w(t), n = e.getFullYear(), r = O(t, 0);
28
+ r.setFullYear(n + 1, 0, 4), r.setHours(0, 0, 0, 0);
29
+ const a = F(r), s = O(t, 0);
30
+ s.setFullYear(n, 0, 4), s.setHours(0, 0, 0, 0);
31
+ const i = F(s);
32
+ return e.getTime() >= a.getTime() ? n + 1 : e.getTime() >= i.getTime() ? n : n - 1;
33
+ }
34
+ function I(t) {
35
+ const e = w(t);
36
+ return e.setHours(0, 0, 0, 0), e;
37
+ }
38
+ function R(t) {
39
+ const e = w(t), n = new Date(
40
+ Date.UTC(
41
+ e.getFullYear(),
42
+ e.getMonth(),
43
+ e.getDate(),
44
+ e.getHours(),
45
+ e.getMinutes(),
46
+ e.getSeconds(),
47
+ e.getMilliseconds()
48
+ )
49
+ );
50
+ return n.setUTCFullYear(e.getFullYear()), +t - +n;
51
+ }
52
+ function rt(t, e) {
53
+ const n = I(t), r = I(e), a = +n - R(n), s = +r - R(r);
54
+ return Math.round((a - s) / et);
55
+ }
56
+ function at(t) {
57
+ const e = V(t), n = O(t, 0);
58
+ return n.setFullYear(e, 0, 4), n.setHours(0, 0, 0, 0), F(n);
59
+ }
60
+ function st(t) {
61
+ return t instanceof Date || typeof t == "object" && Object.prototype.toString.call(t) === "[object Date]";
62
+ }
63
+ function it(t) {
64
+ if (!st(t) && typeof t != "number")
65
+ return !1;
66
+ const e = w(t);
67
+ return !isNaN(Number(e));
68
+ }
69
+ function ot(t, e) {
70
+ const n = w(t.start), r = w(t.end);
71
+ let a = +n > +r;
72
+ const s = a ? +n : +r, i = a ? r : n;
73
+ i.setHours(0, 0, 0, 0);
74
+ let o = (e == null ? void 0 : e.step) ?? 1;
75
+ if (!o)
76
+ return [];
77
+ o < 0 && (o = -o, a = !a);
78
+ const u = [];
79
+ for (; +i <= s; )
80
+ u.push(w(i)), i.setDate(i.getDate() + o), i.setHours(0, 0, 0, 0);
81
+ return a ? u.reverse() : u;
82
+ }
83
+ function ct(t) {
84
+ const e = w(t), n = O(t, 0);
85
+ return n.setFullYear(e.getFullYear(), 0, 1), n.setHours(0, 0, 0, 0), n;
86
+ }
87
+ const ut = {
88
+ lessThanXSeconds: {
89
+ one: "less than a second",
90
+ other: "less than {{count}} seconds"
91
+ },
92
+ xSeconds: {
93
+ one: "1 second",
94
+ other: "{{count}} seconds"
95
+ },
96
+ halfAMinute: "half a minute",
97
+ lessThanXMinutes: {
98
+ one: "less than a minute",
99
+ other: "less than {{count}} minutes"
100
+ },
101
+ xMinutes: {
102
+ one: "1 minute",
103
+ other: "{{count}} minutes"
104
+ },
105
+ aboutXHours: {
106
+ one: "about 1 hour",
107
+ other: "about {{count}} hours"
108
+ },
109
+ xHours: {
110
+ one: "1 hour",
111
+ other: "{{count}} hours"
112
+ },
113
+ xDays: {
114
+ one: "1 day",
115
+ other: "{{count}} days"
116
+ },
117
+ aboutXWeeks: {
118
+ one: "about 1 week",
119
+ other: "about {{count}} weeks"
120
+ },
121
+ xWeeks: {
122
+ one: "1 week",
123
+ other: "{{count}} weeks"
124
+ },
125
+ aboutXMonths: {
126
+ one: "about 1 month",
127
+ other: "about {{count}} months"
128
+ },
129
+ xMonths: {
130
+ one: "1 month",
131
+ other: "{{count}} months"
132
+ },
133
+ aboutXYears: {
134
+ one: "about 1 year",
135
+ other: "about {{count}} years"
136
+ },
137
+ xYears: {
138
+ one: "1 year",
139
+ other: "{{count}} years"
140
+ },
141
+ overXYears: {
142
+ one: "over 1 year",
143
+ other: "over {{count}} years"
144
+ },
145
+ almostXYears: {
146
+ one: "almost 1 year",
147
+ other: "almost {{count}} years"
148
+ }
149
+ }, ht = (t, e, n) => {
150
+ let r;
151
+ const a = ut[t];
152
+ return typeof a == "string" ? r = a : e === 1 ? r = a.one : r = a.other.replace("{{count}}", e.toString()), n != null && n.addSuffix ? n.comparison && n.comparison > 0 ? "in " + r : r + " ago" : r;
153
+ };
154
+ function $(t) {
155
+ return (e = {}) => {
156
+ const n = e.width ? String(e.width) : t.defaultWidth;
157
+ return t.formats[n] || t.formats[t.defaultWidth];
158
+ };
159
+ }
160
+ const dt = {
161
+ full: "EEEE, MMMM do, y",
162
+ long: "MMMM do, y",
163
+ medium: "MMM d, y",
164
+ short: "MM/dd/yyyy"
165
+ }, lt = {
166
+ full: "h:mm:ss a zzzz",
167
+ long: "h:mm:ss a z",
168
+ medium: "h:mm:ss a",
169
+ short: "h:mm a"
170
+ }, ft = {
171
+ full: "{{date}} 'at' {{time}}",
172
+ long: "{{date}} 'at' {{time}}",
173
+ medium: "{{date}}, {{time}}",
174
+ short: "{{date}}, {{time}}"
175
+ }, mt = {
176
+ date: $({
177
+ formats: dt,
178
+ defaultWidth: "full"
179
+ }),
180
+ time: $({
181
+ formats: lt,
182
+ defaultWidth: "full"
183
+ }),
184
+ dateTime: $({
185
+ formats: ft,
186
+ defaultWidth: "full"
187
+ })
188
+ }, gt = {
189
+ lastWeek: "'last' eeee 'at' p",
190
+ yesterday: "'yesterday at' p",
191
+ today: "'today at' p",
192
+ tomorrow: "'tomorrow at' p",
193
+ nextWeek: "eeee 'at' p",
194
+ other: "P"
195
+ }, yt = (t, e, n, r) => gt[t];
196
+ function W(t) {
197
+ return (e, n) => {
198
+ const r = n != null && n.context ? String(n.context) : "standalone";
199
+ let a;
200
+ if (r === "formatting" && t.formattingValues) {
201
+ const i = t.defaultFormattingWidth || t.defaultWidth, o = n != null && n.width ? String(n.width) : i;
202
+ a = t.formattingValues[o] || t.formattingValues[i];
203
+ } else {
204
+ const i = t.defaultWidth, o = n != null && n.width ? String(n.width) : t.defaultWidth;
205
+ a = t.values[o] || t.values[i];
206
+ }
207
+ const s = t.argumentCallback ? t.argumentCallback(e) : e;
208
+ return a[s];
209
+ };
210
+ }
211
+ const wt = {
212
+ narrow: ["B", "A"],
213
+ abbreviated: ["BC", "AD"],
214
+ wide: ["Before Christ", "Anno Domini"]
215
+ }, pt = {
216
+ narrow: ["1", "2", "3", "4"],
217
+ abbreviated: ["Q1", "Q2", "Q3", "Q4"],
218
+ wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"]
219
+ }, bt = {
220
+ narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"],
221
+ abbreviated: [
222
+ "Jan",
223
+ "Feb",
224
+ "Mar",
225
+ "Apr",
226
+ "May",
227
+ "Jun",
228
+ "Jul",
229
+ "Aug",
230
+ "Sep",
231
+ "Oct",
232
+ "Nov",
233
+ "Dec"
234
+ ],
235
+ wide: [
236
+ "January",
237
+ "February",
238
+ "March",
239
+ "April",
240
+ "May",
241
+ "June",
242
+ "July",
243
+ "August",
244
+ "September",
245
+ "October",
246
+ "November",
247
+ "December"
248
+ ]
249
+ }, kt = {
250
+ narrow: ["S", "M", "T", "W", "T", "F", "S"],
251
+ short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
252
+ abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
253
+ wide: [
254
+ "Sunday",
255
+ "Monday",
256
+ "Tuesday",
257
+ "Wednesday",
258
+ "Thursday",
259
+ "Friday",
260
+ "Saturday"
261
+ ]
262
+ }, vt = {
263
+ narrow: {
264
+ am: "a",
265
+ pm: "p",
266
+ midnight: "mi",
267
+ noon: "n",
268
+ morning: "morning",
269
+ afternoon: "afternoon",
270
+ evening: "evening",
271
+ night: "night"
272
+ },
273
+ abbreviated: {
274
+ am: "AM",
275
+ pm: "PM",
276
+ midnight: "midnight",
277
+ noon: "noon",
278
+ morning: "morning",
279
+ afternoon: "afternoon",
280
+ evening: "evening",
281
+ night: "night"
282
+ },
283
+ wide: {
284
+ am: "a.m.",
285
+ pm: "p.m.",
286
+ midnight: "midnight",
287
+ noon: "noon",
288
+ morning: "morning",
289
+ afternoon: "afternoon",
290
+ evening: "evening",
291
+ night: "night"
292
+ }
293
+ }, Mt = {
294
+ narrow: {
295
+ am: "a",
296
+ pm: "p",
297
+ midnight: "mi",
298
+ noon: "n",
299
+ morning: "in the morning",
300
+ afternoon: "in the afternoon",
301
+ evening: "in the evening",
302
+ night: "at night"
303
+ },
304
+ abbreviated: {
305
+ am: "AM",
306
+ pm: "PM",
307
+ midnight: "midnight",
308
+ noon: "noon",
309
+ morning: "in the morning",
310
+ afternoon: "in the afternoon",
311
+ evening: "in the evening",
312
+ night: "at night"
313
+ },
314
+ wide: {
315
+ am: "a.m.",
316
+ pm: "p.m.",
317
+ midnight: "midnight",
318
+ noon: "noon",
319
+ morning: "in the morning",
320
+ afternoon: "in the afternoon",
321
+ evening: "in the evening",
322
+ night: "at night"
323
+ }
324
+ }, St = (t, e) => {
325
+ const n = Number(t), r = n % 100;
326
+ if (r > 20 || r < 10)
327
+ switch (r % 10) {
328
+ case 1:
329
+ return n + "st";
330
+ case 2:
331
+ return n + "nd";
332
+ case 3:
333
+ return n + "rd";
334
+ }
335
+ return n + "th";
336
+ }, Dt = {
337
+ ordinalNumber: St,
338
+ era: W({
339
+ values: wt,
340
+ defaultWidth: "wide"
341
+ }),
342
+ quarter: W({
343
+ values: pt,
344
+ defaultWidth: "wide",
345
+ argumentCallback: (t) => t - 1
346
+ }),
347
+ month: W({
348
+ values: bt,
349
+ defaultWidth: "wide"
350
+ }),
351
+ day: W({
352
+ values: kt,
353
+ defaultWidth: "wide"
354
+ }),
355
+ dayPeriod: W({
356
+ values: vt,
357
+ defaultWidth: "wide",
358
+ formattingValues: Mt,
359
+ defaultFormattingWidth: "wide"
360
+ })
361
+ };
362
+ function T(t) {
363
+ return (e, n = {}) => {
364
+ const r = n.width, a = r && t.matchPatterns[r] || t.matchPatterns[t.defaultMatchWidth], s = e.match(a);
365
+ if (!s)
366
+ return null;
367
+ const i = s[0], o = r && t.parsePatterns[r] || t.parsePatterns[t.defaultParseWidth], u = Array.isArray(o) ? xt(o, (g) => g.test(i)) : (
368
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- I challange you to fix the type
369
+ Ot(o, (g) => g.test(i))
370
+ );
371
+ let f;
372
+ f = t.valueCallback ? t.valueCallback(u) : u, f = n.valueCallback ? (
373
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- I challange you to fix the type
374
+ n.valueCallback(f)
375
+ ) : f;
376
+ const m = e.slice(i.length);
377
+ return { value: f, rest: m };
378
+ };
379
+ }
380
+ function Ot(t, e) {
381
+ for (const n in t)
382
+ if (Object.prototype.hasOwnProperty.call(t, n) && e(t[n]))
383
+ return n;
384
+ }
385
+ function xt(t, e) {
386
+ for (let n = 0; n < t.length; n++)
387
+ if (e(t[n]))
388
+ return n;
389
+ }
390
+ function Pt(t) {
391
+ return (e, n = {}) => {
392
+ const r = e.match(t.matchPattern);
393
+ if (!r)
394
+ return null;
395
+ const a = r[0], s = e.match(t.parsePattern);
396
+ if (!s)
397
+ return null;
398
+ let i = t.valueCallback ? t.valueCallback(s[0]) : s[0];
399
+ i = n.valueCallback ? n.valueCallback(i) : i;
400
+ const o = e.slice(a.length);
401
+ return { value: i, rest: o };
402
+ };
403
+ }
404
+ const Wt = /^(\d+)(th|st|nd|rd)?/i, Tt = /\d+/i, Yt = {
405
+ narrow: /^(b|a)/i,
406
+ abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
407
+ wide: /^(before christ|before common era|anno domini|common era)/i
408
+ }, _t = {
409
+ any: [/^b/i, /^(a|c)/i]
410
+ }, Et = {
411
+ narrow: /^[1234]/i,
412
+ abbreviated: /^q[1234]/i,
413
+ wide: /^[1234](th|st|nd|rd)? quarter/i
414
+ }, Ct = {
415
+ any: [/1/i, /2/i, /3/i, /4/i]
416
+ }, Ft = {
417
+ narrow: /^[jfmasond]/i,
418
+ abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
419
+ wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
420
+ }, Nt = {
421
+ narrow: [
422
+ /^j/i,
423
+ /^f/i,
424
+ /^m/i,
425
+ /^a/i,
426
+ /^m/i,
427
+ /^j/i,
428
+ /^j/i,
429
+ /^a/i,
430
+ /^s/i,
431
+ /^o/i,
432
+ /^n/i,
433
+ /^d/i
434
+ ],
435
+ any: [
436
+ /^ja/i,
437
+ /^f/i,
438
+ /^mar/i,
439
+ /^ap/i,
440
+ /^may/i,
441
+ /^jun/i,
442
+ /^jul/i,
443
+ /^au/i,
444
+ /^s/i,
445
+ /^o/i,
446
+ /^n/i,
447
+ /^d/i
448
+ ]
449
+ }, Ht = {
450
+ narrow: /^[smtwf]/i,
451
+ short: /^(su|mo|tu|we|th|fr|sa)/i,
452
+ abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
453
+ wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
454
+ }, $t = {
455
+ narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
456
+ any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
457
+ }, qt = {
458
+ narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
459
+ any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
460
+ }, At = {
461
+ any: {
462
+ am: /^a/i,
463
+ pm: /^p/i,
464
+ midnight: /^mi/i,
465
+ noon: /^no/i,
466
+ morning: /morning/i,
467
+ afternoon: /afternoon/i,
468
+ evening: /evening/i,
469
+ night: /night/i
470
+ }
471
+ }, It = {
472
+ ordinalNumber: Pt({
473
+ matchPattern: Wt,
474
+ parsePattern: Tt,
475
+ valueCallback: (t) => parseInt(t, 10)
476
+ }),
477
+ era: T({
478
+ matchPatterns: Yt,
479
+ defaultMatchWidth: "wide",
480
+ parsePatterns: _t,
481
+ defaultParseWidth: "any"
482
+ }),
483
+ quarter: T({
484
+ matchPatterns: Et,
485
+ defaultMatchWidth: "wide",
486
+ parsePatterns: Ct,
487
+ defaultParseWidth: "any",
488
+ valueCallback: (t) => t + 1
489
+ }),
490
+ month: T({
491
+ matchPatterns: Ft,
492
+ defaultMatchWidth: "wide",
493
+ parsePatterns: Nt,
494
+ defaultParseWidth: "any"
495
+ }),
496
+ day: T({
497
+ matchPatterns: Ht,
498
+ defaultMatchWidth: "wide",
499
+ parsePatterns: $t,
500
+ defaultParseWidth: "any"
501
+ }),
502
+ dayPeriod: T({
503
+ matchPatterns: qt,
504
+ defaultMatchWidth: "any",
505
+ parsePatterns: At,
506
+ defaultParseWidth: "any"
507
+ })
508
+ }, Rt = {
509
+ code: "en-US",
510
+ formatDistance: ht,
511
+ formatLong: mt,
512
+ formatRelative: yt,
513
+ localize: Dt,
514
+ match: It,
515
+ options: {
516
+ weekStartsOn: 0,
517
+ firstWeekContainsDate: 1
518
+ }
519
+ };
520
+ function jt(t) {
521
+ const e = w(t);
522
+ return rt(e, ct(e)) + 1;
523
+ }
524
+ function Bt(t) {
525
+ const e = w(t), n = +F(e) - +at(e);
526
+ return Math.round(n / G) + 1;
527
+ }
528
+ function J(t, e) {
529
+ var m, g, b, y;
530
+ const n = w(t), r = n.getFullYear(), a = N(), s = (e == null ? void 0 : e.firstWeekContainsDate) ?? ((g = (m = e == null ? void 0 : e.locale) == null ? void 0 : m.options) == null ? void 0 : g.firstWeekContainsDate) ?? a.firstWeekContainsDate ?? ((y = (b = a.locale) == null ? void 0 : b.options) == null ? void 0 : y.firstWeekContainsDate) ?? 1, i = O(t, 0);
531
+ i.setFullYear(r + 1, 0, s), i.setHours(0, 0, 0, 0);
532
+ const o = Y(i, e), u = O(t, 0);
533
+ u.setFullYear(r, 0, s), u.setHours(0, 0, 0, 0);
534
+ const f = Y(u, e);
535
+ return n.getTime() >= o.getTime() ? r + 1 : n.getTime() >= f.getTime() ? r : r - 1;
536
+ }
537
+ function Qt(t, e) {
538
+ var o, u, f, m;
539
+ const n = N(), r = (e == null ? void 0 : e.firstWeekContainsDate) ?? ((u = (o = e == null ? void 0 : e.locale) == null ? void 0 : o.options) == null ? void 0 : u.firstWeekContainsDate) ?? n.firstWeekContainsDate ?? ((m = (f = n.locale) == null ? void 0 : f.options) == null ? void 0 : m.firstWeekContainsDate) ?? 1, a = J(t, e), s = O(t, 0);
540
+ return s.setFullYear(a, 0, r), s.setHours(0, 0, 0, 0), Y(s, e);
541
+ }
542
+ function q(t, e) {
543
+ const n = w(t), r = +Y(n, e) - +Qt(n, e);
544
+ return Math.round(r / G) + 1;
545
+ }
546
+ function c(t, e) {
547
+ const n = t < 0 ? "-" : "", r = Math.abs(t).toString().padStart(e, "0");
548
+ return n + r;
549
+ }
550
+ const S = {
551
+ // Year
552
+ y(t, e) {
553
+ const n = t.getFullYear(), r = n > 0 ? n : 1 - n;
554
+ return c(e === "yy" ? r % 100 : r, e.length);
555
+ },
556
+ // Month
557
+ M(t, e) {
558
+ const n = t.getMonth();
559
+ return e === "M" ? String(n + 1) : c(n + 1, 2);
560
+ },
561
+ // Day of the month
562
+ d(t, e) {
563
+ return c(t.getDate(), e.length);
564
+ },
565
+ // AM or PM
566
+ a(t, e) {
567
+ const n = t.getHours() / 12 >= 1 ? "pm" : "am";
568
+ switch (e) {
569
+ case "a":
570
+ case "aa":
571
+ return n.toUpperCase();
572
+ case "aaa":
573
+ return n;
574
+ case "aaaaa":
575
+ return n[0];
576
+ case "aaaa":
577
+ default:
578
+ return n === "am" ? "a.m." : "p.m.";
579
+ }
580
+ },
581
+ // Hour [1-12]
582
+ h(t, e) {
583
+ return c(t.getHours() % 12 || 12, e.length);
584
+ },
585
+ // Hour [0-23]
586
+ H(t, e) {
587
+ return c(t.getHours(), e.length);
588
+ },
589
+ // Minute
590
+ m(t, e) {
591
+ return c(t.getMinutes(), e.length);
592
+ },
593
+ // Second
594
+ s(t, e) {
595
+ return c(t.getSeconds(), e.length);
596
+ },
597
+ // Fraction of second
598
+ S(t, e) {
599
+ const n = e.length, r = t.getMilliseconds(), a = Math.trunc(
600
+ r * Math.pow(10, n - 3)
601
+ );
602
+ return c(a, e.length);
603
+ }
604
+ }, x = {
605
+ am: "am",
606
+ pm: "pm",
607
+ midnight: "midnight",
608
+ noon: "noon",
609
+ morning: "morning",
610
+ afternoon: "afternoon",
611
+ evening: "evening",
612
+ night: "night"
613
+ }, j = {
614
+ // Era
615
+ G: function(t, e, n) {
616
+ const r = t.getFullYear() > 0 ? 1 : 0;
617
+ switch (e) {
618
+ case "G":
619
+ case "GG":
620
+ case "GGG":
621
+ return n.era(r, { width: "abbreviated" });
622
+ case "GGGGG":
623
+ return n.era(r, { width: "narrow" });
624
+ case "GGGG":
625
+ default:
626
+ return n.era(r, { width: "wide" });
627
+ }
628
+ },
629
+ // Year
630
+ y: function(t, e, n) {
631
+ if (e === "yo") {
632
+ const r = t.getFullYear(), a = r > 0 ? r : 1 - r;
633
+ return n.ordinalNumber(a, { unit: "year" });
634
+ }
635
+ return S.y(t, e);
636
+ },
637
+ // Local week-numbering year
638
+ Y: function(t, e, n, r) {
639
+ const a = J(t, r), s = a > 0 ? a : 1 - a;
640
+ if (e === "YY") {
641
+ const i = s % 100;
642
+ return c(i, 2);
643
+ }
644
+ return e === "Yo" ? n.ordinalNumber(s, { unit: "year" }) : c(s, e.length);
645
+ },
646
+ // ISO week-numbering year
647
+ R: function(t, e) {
648
+ const n = V(t);
649
+ return c(n, e.length);
650
+ },
651
+ // Extended year. This is a single number designating the year of this calendar system.
652
+ // The main difference between `y` and `u` localizers are B.C. years:
653
+ // | Year | `y` | `u` |
654
+ // |------|-----|-----|
655
+ // | AC 1 | 1 | 1 |
656
+ // | BC 1 | 1 | 0 |
657
+ // | BC 2 | 2 | -1 |
658
+ // Also `yy` always returns the last two digits of a year,
659
+ // while `uu` pads single digit years to 2 characters and returns other years unchanged.
660
+ u: function(t, e) {
661
+ const n = t.getFullYear();
662
+ return c(n, e.length);
663
+ },
664
+ // Quarter
665
+ Q: function(t, e, n) {
666
+ const r = Math.ceil((t.getMonth() + 1) / 3);
667
+ switch (e) {
668
+ case "Q":
669
+ return String(r);
670
+ case "QQ":
671
+ return c(r, 2);
672
+ case "Qo":
673
+ return n.ordinalNumber(r, { unit: "quarter" });
674
+ case "QQQ":
675
+ return n.quarter(r, {
676
+ width: "abbreviated",
677
+ context: "formatting"
678
+ });
679
+ case "QQQQQ":
680
+ return n.quarter(r, {
681
+ width: "narrow",
682
+ context: "formatting"
683
+ });
684
+ case "QQQQ":
685
+ default:
686
+ return n.quarter(r, {
687
+ width: "wide",
688
+ context: "formatting"
689
+ });
690
+ }
691
+ },
692
+ // Stand-alone quarter
693
+ q: function(t, e, n) {
694
+ const r = Math.ceil((t.getMonth() + 1) / 3);
695
+ switch (e) {
696
+ case "q":
697
+ return String(r);
698
+ case "qq":
699
+ return c(r, 2);
700
+ case "qo":
701
+ return n.ordinalNumber(r, { unit: "quarter" });
702
+ case "qqq":
703
+ return n.quarter(r, {
704
+ width: "abbreviated",
705
+ context: "standalone"
706
+ });
707
+ case "qqqqq":
708
+ return n.quarter(r, {
709
+ width: "narrow",
710
+ context: "standalone"
711
+ });
712
+ case "qqqq":
713
+ default:
714
+ return n.quarter(r, {
715
+ width: "wide",
716
+ context: "standalone"
717
+ });
718
+ }
719
+ },
720
+ // Month
721
+ M: function(t, e, n) {
722
+ const r = t.getMonth();
723
+ switch (e) {
724
+ case "M":
725
+ case "MM":
726
+ return S.M(t, e);
727
+ case "Mo":
728
+ return n.ordinalNumber(r + 1, { unit: "month" });
729
+ case "MMM":
730
+ return n.month(r, {
731
+ width: "abbreviated",
732
+ context: "formatting"
733
+ });
734
+ case "MMMMM":
735
+ return n.month(r, {
736
+ width: "narrow",
737
+ context: "formatting"
738
+ });
739
+ case "MMMM":
740
+ default:
741
+ return n.month(r, { width: "wide", context: "formatting" });
742
+ }
743
+ },
744
+ // Stand-alone month
745
+ L: function(t, e, n) {
746
+ const r = t.getMonth();
747
+ switch (e) {
748
+ case "L":
749
+ return String(r + 1);
750
+ case "LL":
751
+ return c(r + 1, 2);
752
+ case "Lo":
753
+ return n.ordinalNumber(r + 1, { unit: "month" });
754
+ case "LLL":
755
+ return n.month(r, {
756
+ width: "abbreviated",
757
+ context: "standalone"
758
+ });
759
+ case "LLLLL":
760
+ return n.month(r, {
761
+ width: "narrow",
762
+ context: "standalone"
763
+ });
764
+ case "LLLL":
765
+ default:
766
+ return n.month(r, { width: "wide", context: "standalone" });
767
+ }
768
+ },
769
+ // Local week of year
770
+ w: function(t, e, n, r) {
771
+ const a = q(t, r);
772
+ return e === "wo" ? n.ordinalNumber(a, { unit: "week" }) : c(a, e.length);
773
+ },
774
+ // ISO week of year
775
+ I: function(t, e, n) {
776
+ const r = Bt(t);
777
+ return e === "Io" ? n.ordinalNumber(r, { unit: "week" }) : c(r, e.length);
778
+ },
779
+ // Day of the month
780
+ d: function(t, e, n) {
781
+ return e === "do" ? n.ordinalNumber(t.getDate(), { unit: "date" }) : S.d(t, e);
782
+ },
783
+ // Day of year
784
+ D: function(t, e, n) {
785
+ const r = jt(t);
786
+ return e === "Do" ? n.ordinalNumber(r, { unit: "dayOfYear" }) : c(r, e.length);
787
+ },
788
+ // Day of week
789
+ E: function(t, e, n) {
790
+ const r = t.getDay();
791
+ switch (e) {
792
+ case "E":
793
+ case "EE":
794
+ case "EEE":
795
+ return n.day(r, {
796
+ width: "abbreviated",
797
+ context: "formatting"
798
+ });
799
+ case "EEEEE":
800
+ return n.day(r, {
801
+ width: "narrow",
802
+ context: "formatting"
803
+ });
804
+ case "EEEEEE":
805
+ return n.day(r, {
806
+ width: "short",
807
+ context: "formatting"
808
+ });
809
+ case "EEEE":
810
+ default:
811
+ return n.day(r, {
812
+ width: "wide",
813
+ context: "formatting"
814
+ });
815
+ }
816
+ },
817
+ // Local day of week
818
+ e: function(t, e, n, r) {
819
+ const a = t.getDay(), s = (a - r.weekStartsOn + 8) % 7 || 7;
820
+ switch (e) {
821
+ case "e":
822
+ return String(s);
823
+ case "ee":
824
+ return c(s, 2);
825
+ case "eo":
826
+ return n.ordinalNumber(s, { unit: "day" });
827
+ case "eee":
828
+ return n.day(a, {
829
+ width: "abbreviated",
830
+ context: "formatting"
831
+ });
832
+ case "eeeee":
833
+ return n.day(a, {
834
+ width: "narrow",
835
+ context: "formatting"
836
+ });
837
+ case "eeeeee":
838
+ return n.day(a, {
839
+ width: "short",
840
+ context: "formatting"
841
+ });
842
+ case "eeee":
843
+ default:
844
+ return n.day(a, {
845
+ width: "wide",
846
+ context: "formatting"
847
+ });
848
+ }
849
+ },
850
+ // Stand-alone local day of week
851
+ c: function(t, e, n, r) {
852
+ const a = t.getDay(), s = (a - r.weekStartsOn + 8) % 7 || 7;
853
+ switch (e) {
854
+ case "c":
855
+ return String(s);
856
+ case "cc":
857
+ return c(s, e.length);
858
+ case "co":
859
+ return n.ordinalNumber(s, { unit: "day" });
860
+ case "ccc":
861
+ return n.day(a, {
862
+ width: "abbreviated",
863
+ context: "standalone"
864
+ });
865
+ case "ccccc":
866
+ return n.day(a, {
867
+ width: "narrow",
868
+ context: "standalone"
869
+ });
870
+ case "cccccc":
871
+ return n.day(a, {
872
+ width: "short",
873
+ context: "standalone"
874
+ });
875
+ case "cccc":
876
+ default:
877
+ return n.day(a, {
878
+ width: "wide",
879
+ context: "standalone"
880
+ });
881
+ }
882
+ },
883
+ // ISO day of week
884
+ i: function(t, e, n) {
885
+ const r = t.getDay(), a = r === 0 ? 7 : r;
886
+ switch (e) {
887
+ case "i":
888
+ return String(a);
889
+ case "ii":
890
+ return c(a, e.length);
891
+ case "io":
892
+ return n.ordinalNumber(a, { unit: "day" });
893
+ case "iii":
894
+ return n.day(r, {
895
+ width: "abbreviated",
896
+ context: "formatting"
897
+ });
898
+ case "iiiii":
899
+ return n.day(r, {
900
+ width: "narrow",
901
+ context: "formatting"
902
+ });
903
+ case "iiiiii":
904
+ return n.day(r, {
905
+ width: "short",
906
+ context: "formatting"
907
+ });
908
+ case "iiii":
909
+ default:
910
+ return n.day(r, {
911
+ width: "wide",
912
+ context: "formatting"
913
+ });
914
+ }
915
+ },
916
+ // AM or PM
917
+ a: function(t, e, n) {
918
+ const a = t.getHours() / 12 >= 1 ? "pm" : "am";
919
+ switch (e) {
920
+ case "a":
921
+ case "aa":
922
+ return n.dayPeriod(a, {
923
+ width: "abbreviated",
924
+ context: "formatting"
925
+ });
926
+ case "aaa":
927
+ return n.dayPeriod(a, {
928
+ width: "abbreviated",
929
+ context: "formatting"
930
+ }).toLowerCase();
931
+ case "aaaaa":
932
+ return n.dayPeriod(a, {
933
+ width: "narrow",
934
+ context: "formatting"
935
+ });
936
+ case "aaaa":
937
+ default:
938
+ return n.dayPeriod(a, {
939
+ width: "wide",
940
+ context: "formatting"
941
+ });
942
+ }
943
+ },
944
+ // AM, PM, midnight, noon
945
+ b: function(t, e, n) {
946
+ const r = t.getHours();
947
+ let a;
948
+ switch (r === 12 ? a = x.noon : r === 0 ? a = x.midnight : a = r / 12 >= 1 ? "pm" : "am", e) {
949
+ case "b":
950
+ case "bb":
951
+ return n.dayPeriod(a, {
952
+ width: "abbreviated",
953
+ context: "formatting"
954
+ });
955
+ case "bbb":
956
+ return n.dayPeriod(a, {
957
+ width: "abbreviated",
958
+ context: "formatting"
959
+ }).toLowerCase();
960
+ case "bbbbb":
961
+ return n.dayPeriod(a, {
962
+ width: "narrow",
963
+ context: "formatting"
964
+ });
965
+ case "bbbb":
966
+ default:
967
+ return n.dayPeriod(a, {
968
+ width: "wide",
969
+ context: "formatting"
970
+ });
971
+ }
972
+ },
973
+ // in the morning, in the afternoon, in the evening, at night
974
+ B: function(t, e, n) {
975
+ const r = t.getHours();
976
+ let a;
977
+ switch (r >= 17 ? a = x.evening : r >= 12 ? a = x.afternoon : r >= 4 ? a = x.morning : a = x.night, e) {
978
+ case "B":
979
+ case "BB":
980
+ case "BBB":
981
+ return n.dayPeriod(a, {
982
+ width: "abbreviated",
983
+ context: "formatting"
984
+ });
985
+ case "BBBBB":
986
+ return n.dayPeriod(a, {
987
+ width: "narrow",
988
+ context: "formatting"
989
+ });
990
+ case "BBBB":
991
+ default:
992
+ return n.dayPeriod(a, {
993
+ width: "wide",
994
+ context: "formatting"
995
+ });
996
+ }
997
+ },
998
+ // Hour [1-12]
999
+ h: function(t, e, n) {
1000
+ if (e === "ho") {
1001
+ let r = t.getHours() % 12;
1002
+ return r === 0 && (r = 12), n.ordinalNumber(r, { unit: "hour" });
1003
+ }
1004
+ return S.h(t, e);
1005
+ },
1006
+ // Hour [0-23]
1007
+ H: function(t, e, n) {
1008
+ return e === "Ho" ? n.ordinalNumber(t.getHours(), { unit: "hour" }) : S.H(t, e);
1009
+ },
1010
+ // Hour [0-11]
1011
+ K: function(t, e, n) {
1012
+ const r = t.getHours() % 12;
1013
+ return e === "Ko" ? n.ordinalNumber(r, { unit: "hour" }) : c(r, e.length);
1014
+ },
1015
+ // Hour [1-24]
1016
+ k: function(t, e, n) {
1017
+ let r = t.getHours();
1018
+ return r === 0 && (r = 24), e === "ko" ? n.ordinalNumber(r, { unit: "hour" }) : c(r, e.length);
1019
+ },
1020
+ // Minute
1021
+ m: function(t, e, n) {
1022
+ return e === "mo" ? n.ordinalNumber(t.getMinutes(), { unit: "minute" }) : S.m(t, e);
1023
+ },
1024
+ // Second
1025
+ s: function(t, e, n) {
1026
+ return e === "so" ? n.ordinalNumber(t.getSeconds(), { unit: "second" }) : S.s(t, e);
1027
+ },
1028
+ // Fraction of second
1029
+ S: function(t, e) {
1030
+ return S.S(t, e);
1031
+ },
1032
+ // Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
1033
+ X: function(t, e, n) {
1034
+ const r = t.getTimezoneOffset();
1035
+ if (r === 0)
1036
+ return "Z";
1037
+ switch (e) {
1038
+ case "X":
1039
+ return Q(r);
1040
+ case "XXXX":
1041
+ case "XX":
1042
+ return D(r);
1043
+ case "XXXXX":
1044
+ case "XXX":
1045
+ default:
1046
+ return D(r, ":");
1047
+ }
1048
+ },
1049
+ // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
1050
+ x: function(t, e, n) {
1051
+ const r = t.getTimezoneOffset();
1052
+ switch (e) {
1053
+ case "x":
1054
+ return Q(r);
1055
+ case "xxxx":
1056
+ case "xx":
1057
+ return D(r);
1058
+ case "xxxxx":
1059
+ case "xxx":
1060
+ default:
1061
+ return D(r, ":");
1062
+ }
1063
+ },
1064
+ // Timezone (GMT)
1065
+ O: function(t, e, n) {
1066
+ const r = t.getTimezoneOffset();
1067
+ switch (e) {
1068
+ case "O":
1069
+ case "OO":
1070
+ case "OOO":
1071
+ return "GMT" + B(r, ":");
1072
+ case "OOOO":
1073
+ default:
1074
+ return "GMT" + D(r, ":");
1075
+ }
1076
+ },
1077
+ // Timezone (specific non-location)
1078
+ z: function(t, e, n) {
1079
+ const r = t.getTimezoneOffset();
1080
+ switch (e) {
1081
+ case "z":
1082
+ case "zz":
1083
+ case "zzz":
1084
+ return "GMT" + B(r, ":");
1085
+ case "zzzz":
1086
+ default:
1087
+ return "GMT" + D(r, ":");
1088
+ }
1089
+ },
1090
+ // Seconds timestamp
1091
+ t: function(t, e, n) {
1092
+ const r = Math.trunc(t.getTime() / 1e3);
1093
+ return c(r, e.length);
1094
+ },
1095
+ // Milliseconds timestamp
1096
+ T: function(t, e, n) {
1097
+ const r = t.getTime();
1098
+ return c(r, e.length);
1099
+ }
1100
+ };
1101
+ function B(t, e = "") {
1102
+ const n = t > 0 ? "-" : "+", r = Math.abs(t), a = Math.trunc(r / 60), s = r % 60;
1103
+ return s === 0 ? n + String(a) : n + String(a) + e + c(s, 2);
1104
+ }
1105
+ function Q(t, e) {
1106
+ return t % 60 === 0 ? (t > 0 ? "-" : "+") + c(Math.abs(t) / 60, 2) : D(t, e);
1107
+ }
1108
+ function D(t, e = "") {
1109
+ const n = t > 0 ? "-" : "+", r = Math.abs(t), a = c(Math.trunc(r / 60), 2), s = c(r % 60, 2);
1110
+ return n + a + e + s;
1111
+ }
1112
+ const X = (t, e) => {
1113
+ switch (t) {
1114
+ case "P":
1115
+ return e.date({ width: "short" });
1116
+ case "PP":
1117
+ return e.date({ width: "medium" });
1118
+ case "PPP":
1119
+ return e.date({ width: "long" });
1120
+ case "PPPP":
1121
+ default:
1122
+ return e.date({ width: "full" });
1123
+ }
1124
+ }, U = (t, e) => {
1125
+ switch (t) {
1126
+ case "p":
1127
+ return e.time({ width: "short" });
1128
+ case "pp":
1129
+ return e.time({ width: "medium" });
1130
+ case "ppp":
1131
+ return e.time({ width: "long" });
1132
+ case "pppp":
1133
+ default:
1134
+ return e.time({ width: "full" });
1135
+ }
1136
+ }, Xt = (t, e) => {
1137
+ const n = t.match(/(P+)(p+)?/) || [], r = n[1], a = n[2];
1138
+ if (!a)
1139
+ return X(t, e);
1140
+ let s;
1141
+ switch (r) {
1142
+ case "P":
1143
+ s = e.dateTime({ width: "short" });
1144
+ break;
1145
+ case "PP":
1146
+ s = e.dateTime({ width: "medium" });
1147
+ break;
1148
+ case "PPP":
1149
+ s = e.dateTime({ width: "long" });
1150
+ break;
1151
+ case "PPPP":
1152
+ default:
1153
+ s = e.dateTime({ width: "full" });
1154
+ break;
1155
+ }
1156
+ return s.replace("{{date}}", X(r, e)).replace("{{time}}", U(a, e));
1157
+ }, Lt = {
1158
+ p: U,
1159
+ P: Xt
1160
+ }, Gt = /^D+$/, Vt = /^Y+$/, Jt = ["D", "DD", "YY", "YYYY"];
1161
+ function Ut(t) {
1162
+ return Gt.test(t);
1163
+ }
1164
+ function zt(t) {
1165
+ return Vt.test(t);
1166
+ }
1167
+ function Kt(t, e, n) {
1168
+ const r = Zt(t, e, n);
1169
+ if (console.warn(r), Jt.includes(t))
1170
+ throw new RangeError(r);
1171
+ }
1172
+ function Zt(t, e, n) {
1173
+ const r = t[0] === "Y" ? "years" : "days of the month";
1174
+ return `Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`;
1175
+ }
1176
+ const te = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g, ee = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g, ne = /^'([^]*?)'?$/, re = /''/g, ae = /[a-zA-Z]/;
1177
+ function se(t, e, n) {
1178
+ var m, g, b, y, M, _, E, C;
1179
+ const r = N(), a = (n == null ? void 0 : n.locale) ?? r.locale ?? Rt, s = (n == null ? void 0 : n.firstWeekContainsDate) ?? ((g = (m = n == null ? void 0 : n.locale) == null ? void 0 : m.options) == null ? void 0 : g.firstWeekContainsDate) ?? r.firstWeekContainsDate ?? ((y = (b = r.locale) == null ? void 0 : b.options) == null ? void 0 : y.firstWeekContainsDate) ?? 1, i = (n == null ? void 0 : n.weekStartsOn) ?? ((_ = (M = n == null ? void 0 : n.locale) == null ? void 0 : M.options) == null ? void 0 : _.weekStartsOn) ?? r.weekStartsOn ?? ((C = (E = r.locale) == null ? void 0 : E.options) == null ? void 0 : C.weekStartsOn) ?? 0, o = w(t);
1180
+ if (!it(o))
1181
+ throw new RangeError("Invalid time value");
1182
+ let u = e.match(ee).map((k) => {
1183
+ const p = k[0];
1184
+ if (p === "p" || p === "P") {
1185
+ const H = Lt[p];
1186
+ return H(k, a.formatLong);
1187
+ }
1188
+ return k;
1189
+ }).join("").match(te).map((k) => {
1190
+ if (k === "''")
1191
+ return { isToken: !1, value: "'" };
1192
+ const p = k[0];
1193
+ if (p === "'")
1194
+ return { isToken: !1, value: ie(k) };
1195
+ if (j[p])
1196
+ return { isToken: !0, value: k };
1197
+ if (p.match(ae))
1198
+ throw new RangeError(
1199
+ "Format string contains an unescaped latin alphabet character `" + p + "`"
1200
+ );
1201
+ return { isToken: !1, value: k };
1202
+ });
1203
+ a.localize.preprocessor && (u = a.localize.preprocessor(o, u));
1204
+ const f = {
1205
+ firstWeekContainsDate: s,
1206
+ weekStartsOn: i,
1207
+ locale: a
1208
+ };
1209
+ return u.map((k) => {
1210
+ if (!k.isToken)
1211
+ return k.value;
1212
+ const p = k.value;
1213
+ (!(n != null && n.useAdditionalWeekYearTokens) && zt(p) || !(n != null && n.useAdditionalDayOfYearTokens) && Ut(p)) && Kt(p, e, String(t));
1214
+ const H = j[p[0]];
1215
+ return H(o, p, a.localize, f);
1216
+ }).join("");
1217
+ }
1218
+ function ie(t) {
1219
+ const e = t.match(ne);
1220
+ return e ? e[1].replace(re, "'") : t;
1221
+ }
1222
+ function oe(t) {
1223
+ let n = w(t).getDay();
1224
+ return n === 0 && (n = 7), n;
1225
+ }
1226
+ var ce = Object.defineProperty, ue = Object.getOwnPropertyDescriptor, d = (t, e, n, r) => {
1227
+ for (var a = r > 1 ? void 0 : r ? ue(e, n) : e, s = t.length - 1, i; s >= 0; s--)
1228
+ (i = t[s]) && (a = (r ? i(e, n, a) : i(a)) || a);
1229
+ return r && a && ce(e, n, a), a;
1230
+ };
1231
+ let h = class extends tt {
1232
+ constructor() {
1233
+ super(...arguments), this.date = /* @__PURE__ */ new Date(), this.selected = [], this.excludeweekdays = [], this.excludedates = [], this.earliest = null, this.latest = null, this.weeknumbers = !1, this.withcontrols = !1, this.multiple = !1, this.range = !1, this.dayStrings = P.dates.daysShort, this.monthStrings = P.dates.months, this.weekString = P.dates.week, this.prevMonthString = P.dates.prevMonth, this.nextMonthString = P.dates.nextMonth, this._selected = [], this.year = 0, this.month = 0, this.week = 0, this.rangeHovered = null;
1234
+ }
1235
+ /**
1236
+ * Runs on mount, used to set up various values and whatever you need to run
1237
+ */
1238
+ connectedCallback() {
1239
+ const t = this.date;
1240
+ this.year = t.getFullYear(), this.month = t.getMonth(), this.week = q(new Date(this.year, this.month, 1)), this.selected.length && this.selected.forEach((e) => {
1241
+ this._selected.push(new Date(e));
1242
+ }), super.connectedCallback();
1243
+ }
1244
+ /**
1245
+ * Component functionality and render
1246
+ */
1247
+ render() {
1248
+ return v`
1249
+ <div class="pkt-calendar ${this.weeknumbers && "pkt-cal-weeknumbers"}">
1250
+ <nav class="pkt-cal-month-nav">
1251
+ <button
1252
+ @click=${this.isPrevMonthAllowed() && this.prevMonth}
1253
+ class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only"
1254
+ ?disabled=${!this.isPrevMonthAllowed()}
1255
+ >
1256
+ <pkt-el-icon class="pkt-btn__icon" name="chevron-thin-left"></pkt-el-icon>
1257
+ <span class="pkt-btn__text">${this.prevMonthString}</span>
1258
+ </button>
1259
+ ${this.renderMonthNav()}
1260
+ <button
1261
+ @click=${this.isNextMonthAllowed() && this.nextMonth}
1262
+ class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only"
1263
+ ?disabled=${!this.isNextMonthAllowed()}
1264
+ >
1265
+ <pkt-el-icon class="pkt-btn__icon" name="chevron-thin-right"></pkt-el-icon>
1266
+ <span class="pkt-btn__text">${this.nextMonthString}</span>
1267
+ </button>
1268
+ </nav>
1269
+ <ul class="pkt-cal-days pkt-txt-12-medium" role="grid">
1270
+ ${this.renderDayNames()} ${this.renderCalendarBody()}
1271
+ </ul>
1272
+ </div>
1273
+ `;
1274
+ }
1275
+ renderDayNames() {
1276
+ const t = [];
1277
+ this.weeknumbers && t.push(v`<li>${this.weekString}</li>`);
1278
+ for (let e = 0; e < this.dayStrings.length; e++)
1279
+ t.push(v`<li>${this.dayStrings[e]}</li>`);
1280
+ return t;
1281
+ }
1282
+ renderMonthNav() {
1283
+ let t = [];
1284
+ return this.withcontrols ? t.push(v`<div class="pkt-cal-month-picker">
1285
+ <select
1286
+ class="pkt-input pkt-input-compact"
1287
+ @change=${(e) => {
1288
+ this.changeMonth(this.year, e.target.value);
1289
+ }}
1290
+ >
1291
+ ${this.monthStrings.map(
1292
+ (e, n) => v`<option value=${n} ?selected=${this.month === n}>${e}</option>`
1293
+ )}
1294
+ </select>
1295
+ <input
1296
+ class="pkt-input pkt-cal-input-year pkt-input-compact"
1297
+ type="number"
1298
+ size="4"
1299
+ placeholder="0000"
1300
+ @change=${(e) => {
1301
+ this.changeMonth(e.target.value, this.month);
1302
+ }}
1303
+ value="${this.year}"
1304
+ />
1305
+ </div> `) : t.push(
1306
+ v`<div class="pkt-txt-16-medium" aria-live="polite">
1307
+ ${this.monthStrings[this.month]} ${this.year}
1308
+ </div>`
1309
+ ), t;
1310
+ }
1311
+ renderCalendarBody() {
1312
+ const t = /* @__PURE__ */ new Date(), e = new Date(this.year, this.month, 1), n = new Date(this.year, this.month + 1, 0), r = (e.getDay() + 6) % 7, a = n.getDate(), s = Math.ceil((a + r) / 7), o = new Date(this.year, this.month, 0).getDate();
1313
+ let u = 1;
1314
+ this.week = q(new Date(this.year, this.month, 1));
1315
+ const f = [];
1316
+ for (let m = 0; m < s; m++) {
1317
+ const g = [];
1318
+ this.weeknumbers && g.push(v`<li class="pkt-cal-week">${this.week}</li>`), this.week++;
1319
+ for (let b = 1; b < 8; b++)
1320
+ if (m === 0 && b < r) {
1321
+ const y = o - (r - b - 1);
1322
+ g.push(v`<li class="pkt-cal-other">
1323
+ <button class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--label-only" disabled>
1324
+ <span class="pkt-btn__text pkt-txt-14-light">${y}</span>
1325
+ </button>
1326
+ </li>`);
1327
+ } else if (u > a)
1328
+ g.push(v`<li class="pkt-cal-other">
1329
+ <button class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--label-only" disabled>
1330
+ <span class="pkt-btn__text pkt-txt-14-light">${u - a}</span>
1331
+ </button>
1332
+ </li>`), u++;
1333
+ else {
1334
+ const y = new Date(this.year, this.month, u), M = this.formatISODate(y), _ = M === this.formatISODate(t), E = this.selected.includes(M), C = {
1335
+ "pkt-cal-today": _,
1336
+ "pkt-cal-selected": E,
1337
+ "pkt-cal-in-range": this.isInRange(y),
1338
+ "pkt-cal-excluded": this.isExcluded(b, y),
1339
+ "pkt-cal-in-range-first": this.range && (this.selected.length === 2 || this.rangeHovered !== null) && M === this.selected[0],
1340
+ "pkt-cal-in-range-last": this.range && this.selected.length === 2 && M === this.selected[1],
1341
+ "pkt-cal-range-hover": this.rangeHovered !== null && M === this.formatISODate(this.rangeHovered)
1342
+ };
1343
+ g.push(
1344
+ v`<li class=${K(C)}>
1345
+ <button
1346
+ class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--label-only"
1347
+ @click=${() => this.handleDateSelect(y)}
1348
+ @mouseover=${() => this.range && !this.isExcluded(b, y) && this.handleRangeHover(y)}
1349
+ ?disabled=${this.isExcluded(b, y)}
1350
+ >
1351
+ <span class="pkt-btn__text pkt-txt-14-light">${u}</span>
1352
+ </button>
1353
+ </li>`
1354
+ ), u++;
1355
+ }
1356
+ f.push(v`${g}`);
1357
+ }
1358
+ return f;
1359
+ }
1360
+ isExcluded(t, e) {
1361
+ return this.excludeweekdays.includes(t.toString()) || this.earliest && e < this.earliest || this.latest && e > this.latest ? !0 : this.excludedates.some((n) => n.toDateString() === e.toDateString());
1362
+ }
1363
+ formatISODate(t) {
1364
+ return se(t, "yyyy-MM-dd");
1365
+ }
1366
+ isPrevMonthAllowed() {
1367
+ const t = new Date(this.year, this.month, 0);
1368
+ return !(this.earliest && this.earliest > t);
1369
+ }
1370
+ prevMonth() {
1371
+ const t = this.month === 0 ? 11 : this.month - 1, e = this.month === 0 ? this.year - 1 : this.year;
1372
+ this.changeMonth(e, t);
1373
+ }
1374
+ isNextMonthAllowed() {
1375
+ const t = new Date(this.year, this.month === 11 ? 0 : this.month + 1, 1);
1376
+ return !(this.latest && this.latest < t);
1377
+ }
1378
+ nextMonth() {
1379
+ const t = this.month === 11 ? 0 : this.month + 1, e = this.month === 11 ? this.year + 1 : this.year;
1380
+ this.changeMonth(e, t);
1381
+ }
1382
+ changeMonth(t, e) {
1383
+ this.year = t, this.month = e, this.requestUpdate();
1384
+ }
1385
+ isInRange(t) {
1386
+ if (this.range && this._selected.length === 2) {
1387
+ if (t > this._selected[0] && t < this._selected[1])
1388
+ return !0;
1389
+ } else if (this.range && this._selected.length === 1 && this.rangeHovered && t > this._selected[0] && t < this.rangeHovered)
1390
+ return !0;
1391
+ return !1;
1392
+ }
1393
+ isRangeAllowed(t) {
1394
+ let e = !0;
1395
+ if (this._selected.length === 1) {
1396
+ const n = ot({
1397
+ start: this._selected[0],
1398
+ end: t
1399
+ });
1400
+ if (Array.isArray(n) && n.length)
1401
+ for (let r = 0; r < n.length; r++)
1402
+ this.excludedates.forEach((a) => {
1403
+ a > this._selected[0] && a < t && (e = !1);
1404
+ }), this.excludeweekdays.includes(oe(n[r]).toString()) && (e = !1);
1405
+ }
1406
+ return e;
1407
+ }
1408
+ emptySelected() {
1409
+ this.selected.splice(0, this.selected.length), this._selected.splice(0, this._selected.length);
1410
+ }
1411
+ addToSelected(t) {
1412
+ this.selected.push(this.formatISODate(t)), this._selected.push(t), this.requestUpdate();
1413
+ }
1414
+ removeFromSelected(t) {
1415
+ const e = this.formatISODate(t);
1416
+ this.selected.splice(this.selected.indexOf(e), 1), this._selected.splice(this.selected.indexOf(e), 1);
1417
+ }
1418
+ toggleSelected(t) {
1419
+ const e = this.formatISODate(t);
1420
+ this.selected.includes(e) ? this.removeFromSelected(t) : this.addToSelected(t);
1421
+ }
1422
+ handleRangeSelect(t) {
1423
+ const e = this.formatISODate(t);
1424
+ this.selected.includes(e) ? this.selected.indexOf(e) === 0 ? this.emptySelected() : this.removeFromSelected(t) : this.selected.length > 1 ? (this.emptySelected(), this.addToSelected(t)) : (this.selected.length === 1 && !this.isRangeAllowed(t) && this.emptySelected(), this.selected.length === 1 && this._selected[0] > t && this.emptySelected(), this.addToSelected(t));
1425
+ }
1426
+ handleRangeHover(t) {
1427
+ this.range && this._selected.length === 1 && this.isRangeAllowed(t) && this._selected[0] < t ? this.rangeHovered = t : this.rangeHovered = null;
1428
+ }
1429
+ handleDateSelect(t) {
1430
+ this.range ? this.handleRangeSelect(t) : this.multiple ? this.toggleSelected(t) : (this.emptySelected(), this.addToSelected(t)), this.dispatchEvent(
1431
+ new CustomEvent("date-selected", {
1432
+ detail: this.selected,
1433
+ bubbles: !0,
1434
+ composed: !0
1435
+ })
1436
+ );
1437
+ }
1438
+ };
1439
+ d([
1440
+ l({ converter: A })
1441
+ ], h.prototype, "date", 2);
1442
+ d([
1443
+ l({ converter: L, reflect: !0 })
1444
+ ], h.prototype, "selected", 2);
1445
+ d([
1446
+ l({ converter: L })
1447
+ ], h.prototype, "excludeweekdays", 2);
1448
+ d([
1449
+ l({ converter: Z })
1450
+ ], h.prototype, "excludedates", 2);
1451
+ d([
1452
+ l({ converter: A })
1453
+ ], h.prototype, "earliest", 2);
1454
+ d([
1455
+ l({ converter: A })
1456
+ ], h.prototype, "latest", 2);
1457
+ d([
1458
+ l({ type: Boolean, reflect: !0 })
1459
+ ], h.prototype, "weeknumbers", 2);
1460
+ d([
1461
+ l({ type: Boolean, reflect: !0 })
1462
+ ], h.prototype, "withcontrols", 2);
1463
+ d([
1464
+ l({ type: Boolean, reflect: !0 })
1465
+ ], h.prototype, "multiple", 2);
1466
+ d([
1467
+ l({ type: Boolean, reflect: !0 })
1468
+ ], h.prototype, "range", 2);
1469
+ d([
1470
+ l({ type: Array })
1471
+ ], h.prototype, "dayStrings", 2);
1472
+ d([
1473
+ l({ type: Array })
1474
+ ], h.prototype, "monthStrings", 2);
1475
+ d([
1476
+ l({ type: String })
1477
+ ], h.prototype, "weekString", 2);
1478
+ d([
1479
+ l({ type: String })
1480
+ ], h.prototype, "prevMonthString", 2);
1481
+ d([
1482
+ l({ type: String })
1483
+ ], h.prototype, "nextMonthString", 2);
1484
+ d([
1485
+ l({ type: Array })
1486
+ ], h.prototype, "_selected", 2);
1487
+ d([
1488
+ l({ type: Number })
1489
+ ], h.prototype, "year", 2);
1490
+ d([
1491
+ l({ type: Number })
1492
+ ], h.prototype, "month", 2);
1493
+ d([
1494
+ l({ type: Number })
1495
+ ], h.prototype, "week", 2);
1496
+ d([
1497
+ l({ type: Date })
1498
+ ], h.prototype, "rangeHovered", 2);
1499
+ h = d([
1500
+ z("pkt-el-calendar")
1501
+ ], h);
1502
+ export {
1503
+ h as PktCalendar
1504
+ };