@oslokommune/punkt-elements 12.36.0 → 12.36.2
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.
- package/CHANGELOG.md +34 -0
- package/dist/calendar-CYY42kN4.cjs +108 -0
- package/dist/{calendar-mTDcujoj.js → calendar-KDcOWD6V.js} +263 -249
- package/dist/{datepicker-B6qk_tTl.js → datepicker-CpkTwszH.js} +1 -1
- package/dist/{datepicker-CskZMUib.cjs → datepicker-cR9MtXOh.cjs} +1 -1
- package/dist/pkt-calendar.cjs +1 -1
- package/dist/pkt-calendar.js +1 -1
- package/dist/pkt-datepicker.cjs +1 -1
- package/dist/pkt-datepicker.js +1 -1
- package/dist/pkt-index.cjs +1 -1
- package/dist/pkt-index.js +3 -3
- package/package.json +2 -2
- package/src/components/calendar/calendar.ts +3 -3
- package/dist/calendar-oX4HJomV.cjs +0 -108
|
@@ -1,46 +1,46 @@
|
|
|
1
1
|
import { e as ht } from "./class-map-KyMqi0fa.js";
|
|
2
|
-
import { P as dt, E as
|
|
3
|
-
import { r as
|
|
2
|
+
import { P as dt, E as _, x as D, n as m, a as ft } from "./element-DjjF_tEh.js";
|
|
3
|
+
import { r as F } from "./state-BtbpSrdV.js";
|
|
4
4
|
import "./icon-Beoxup8E.js";
|
|
5
|
-
const
|
|
5
|
+
const rt = 6048e5, mt = 864e5, gt = 36e5, X = Symbol.for("constructDateFrom");
|
|
6
6
|
function S(t, e) {
|
|
7
7
|
return typeof t == "function" ? t(e) : t && typeof t == "object" && X in t ? t[X](e) : t instanceof Date ? new t.constructor(e) : new Date(e);
|
|
8
8
|
}
|
|
9
|
-
function
|
|
9
|
+
function k(t, e) {
|
|
10
10
|
return S(e || t, t);
|
|
11
11
|
}
|
|
12
|
-
function
|
|
13
|
-
const r =
|
|
12
|
+
function U(t, e, n) {
|
|
13
|
+
const r = k(t, n == null ? void 0 : n.in);
|
|
14
14
|
return isNaN(e) ? S(t, NaN) : (e && r.setDate(r.getDate() + e), r);
|
|
15
15
|
}
|
|
16
16
|
function yt(t, e, n) {
|
|
17
|
-
return S(t, +
|
|
17
|
+
return S(t, +k(t) + e);
|
|
18
18
|
}
|
|
19
|
-
function
|
|
19
|
+
function at(t, e, n) {
|
|
20
20
|
return yt(t, e * gt);
|
|
21
21
|
}
|
|
22
22
|
let pt = {};
|
|
23
|
-
function
|
|
23
|
+
function q() {
|
|
24
24
|
return pt;
|
|
25
25
|
}
|
|
26
26
|
function H(t, e) {
|
|
27
27
|
var c, o, d, g;
|
|
28
|
-
const n =
|
|
28
|
+
const n = q(), r = (e == null ? void 0 : e.weekStartsOn) ?? ((o = (c = e == null ? void 0 : e.locale) == null ? void 0 : c.options) == null ? void 0 : o.weekStartsOn) ?? n.weekStartsOn ?? ((g = (d = n.locale) == null ? void 0 : d.options) == null ? void 0 : g.weekStartsOn) ?? 0, a = k(t, e == null ? void 0 : e.in), s = a.getDay(), i = (s < r ? 7 : 0) + s - r;
|
|
29
29
|
return a.setDate(a.getDate() - i), a.setHours(0, 0, 0, 0), a;
|
|
30
30
|
}
|
|
31
|
-
function
|
|
31
|
+
function I(t, e) {
|
|
32
32
|
return H(t, { ...e, weekStartsOn: 1 });
|
|
33
33
|
}
|
|
34
34
|
function st(t, e) {
|
|
35
|
-
const n =
|
|
35
|
+
const n = k(t, e == null ? void 0 : e.in), r = n.getFullYear(), a = S(n, 0);
|
|
36
36
|
a.setFullYear(r + 1, 0, 4), a.setHours(0, 0, 0, 0);
|
|
37
|
-
const s =
|
|
37
|
+
const s = I(a), i = S(n, 0);
|
|
38
38
|
i.setFullYear(r, 0, 4), i.setHours(0, 0, 0, 0);
|
|
39
|
-
const c =
|
|
39
|
+
const c = I(i);
|
|
40
40
|
return n.getTime() >= s.getTime() ? r + 1 : n.getTime() >= c.getTime() ? r : r - 1;
|
|
41
41
|
}
|
|
42
42
|
function V(t) {
|
|
43
|
-
const e =
|
|
43
|
+
const e = k(t), n = new Date(
|
|
44
44
|
Date.UTC(
|
|
45
45
|
e.getFullYear(),
|
|
46
46
|
e.getMonth(),
|
|
@@ -60,8 +60,8 @@ function it(t, ...e) {
|
|
|
60
60
|
);
|
|
61
61
|
return e.map(n);
|
|
62
62
|
}
|
|
63
|
-
function
|
|
64
|
-
const n =
|
|
63
|
+
function Q(t, e) {
|
|
64
|
+
const n = k(t, e == null ? void 0 : e.in);
|
|
65
65
|
return n.setHours(0, 0, 0, 0), n;
|
|
66
66
|
}
|
|
67
67
|
function wt(t, e, n) {
|
|
@@ -69,25 +69,29 @@ function wt(t, e, n) {
|
|
|
69
69
|
n == null ? void 0 : n.in,
|
|
70
70
|
t,
|
|
71
71
|
e
|
|
72
|
-
), s =
|
|
72
|
+
), s = Q(r), i = Q(a), c = +s - V(s), o = +i - V(i);
|
|
73
73
|
return Math.round((c - o) / mt);
|
|
74
74
|
}
|
|
75
75
|
function bt(t, e) {
|
|
76
76
|
const n = st(t, e), r = S(t, 0);
|
|
77
|
-
return r.setFullYear(n, 0, 4), r.setHours(0, 0, 0, 0),
|
|
77
|
+
return r.setFullYear(n, 0, 4), r.setHours(0, 0, 0, 0), I(r);
|
|
78
78
|
}
|
|
79
79
|
function kt(t) {
|
|
80
80
|
return t instanceof Date || typeof t == "object" && Object.prototype.toString.call(t) === "[object Date]";
|
|
81
81
|
}
|
|
82
82
|
function vt(t) {
|
|
83
|
-
return !(!kt(t) && typeof t != "number" || isNaN(+
|
|
83
|
+
return !(!kt(t) && typeof t != "number" || isNaN(+k(t)));
|
|
84
84
|
}
|
|
85
85
|
function Dt(t, e) {
|
|
86
|
+
const n = k(t, e == null ? void 0 : e.in);
|
|
87
|
+
return n.setHours(23, 59, 59, 999), n;
|
|
88
|
+
}
|
|
89
|
+
function St(t, e) {
|
|
86
90
|
const [n, r] = it(t, e.start, e.end);
|
|
87
91
|
return { start: n, end: r };
|
|
88
92
|
}
|
|
89
|
-
function
|
|
90
|
-
const { start: n, end: r } =
|
|
93
|
+
function z(t, e) {
|
|
94
|
+
const { start: n, end: r } = St(e == null ? void 0 : e.in, t);
|
|
91
95
|
let a = +n > +r;
|
|
92
96
|
const s = a ? +n : +r, i = a ? r : n;
|
|
93
97
|
i.setHours(0, 0, 0, 0);
|
|
@@ -97,11 +101,11 @@ function B(t, e) {
|
|
|
97
101
|
o.push(S(n, i)), i.setDate(i.getDate() + c), i.setHours(0, 0, 0, 0);
|
|
98
102
|
return a ? o.reverse() : o;
|
|
99
103
|
}
|
|
100
|
-
function
|
|
101
|
-
const n =
|
|
104
|
+
function Mt(t, e) {
|
|
105
|
+
const n = k(t, e == null ? void 0 : e.in);
|
|
102
106
|
return n.setFullYear(n.getFullYear(), 0, 1), n.setHours(0, 0, 0, 0), n;
|
|
103
107
|
}
|
|
104
|
-
const
|
|
108
|
+
const xt = {
|
|
105
109
|
lessThanXSeconds: {
|
|
106
110
|
one: "less than a second",
|
|
107
111
|
other: "less than {{count}} seconds"
|
|
@@ -163,54 +167,54 @@ const Mt = {
|
|
|
163
167
|
one: "almost 1 year",
|
|
164
168
|
other: "almost {{count}} years"
|
|
165
169
|
}
|
|
166
|
-
},
|
|
170
|
+
}, Tt = (t, e, n) => {
|
|
167
171
|
let r;
|
|
168
|
-
const a =
|
|
172
|
+
const a = xt[t];
|
|
169
173
|
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;
|
|
170
174
|
};
|
|
171
|
-
function
|
|
175
|
+
function B(t) {
|
|
172
176
|
return (e = {}) => {
|
|
173
177
|
const n = e.width ? String(e.width) : t.defaultWidth;
|
|
174
178
|
return t.formats[n] || t.formats[t.defaultWidth];
|
|
175
179
|
};
|
|
176
180
|
}
|
|
177
|
-
const
|
|
181
|
+
const Ot = {
|
|
178
182
|
full: "EEEE, MMMM do, y",
|
|
179
183
|
long: "MMMM do, y",
|
|
180
184
|
medium: "MMM d, y",
|
|
181
185
|
short: "MM/dd/yyyy"
|
|
182
|
-
},
|
|
186
|
+
}, Pt = {
|
|
183
187
|
full: "h:mm:ss a zzzz",
|
|
184
188
|
long: "h:mm:ss a z",
|
|
185
189
|
medium: "h:mm:ss a",
|
|
186
190
|
short: "h:mm a"
|
|
187
|
-
},
|
|
191
|
+
}, Ct = {
|
|
188
192
|
full: "{{date}} 'at' {{time}}",
|
|
189
193
|
long: "{{date}} 'at' {{time}}",
|
|
190
194
|
medium: "{{date}}, {{time}}",
|
|
191
195
|
short: "{{date}}, {{time}}"
|
|
192
|
-
},
|
|
193
|
-
date:
|
|
194
|
-
formats: Tt,
|
|
195
|
-
defaultWidth: "full"
|
|
196
|
-
}),
|
|
197
|
-
time: Q({
|
|
196
|
+
}, $t = {
|
|
197
|
+
date: B({
|
|
198
198
|
formats: Ot,
|
|
199
199
|
defaultWidth: "full"
|
|
200
200
|
}),
|
|
201
|
-
|
|
201
|
+
time: B({
|
|
202
202
|
formats: Pt,
|
|
203
203
|
defaultWidth: "full"
|
|
204
|
+
}),
|
|
205
|
+
dateTime: B({
|
|
206
|
+
formats: Ct,
|
|
207
|
+
defaultWidth: "full"
|
|
204
208
|
})
|
|
205
|
-
},
|
|
209
|
+
}, Et = {
|
|
206
210
|
lastWeek: "'last' eeee 'at' p",
|
|
207
211
|
yesterday: "'yesterday at' p",
|
|
208
212
|
today: "'today at' p",
|
|
209
213
|
tomorrow: "'tomorrow at' p",
|
|
210
214
|
nextWeek: "eeee 'at' p",
|
|
211
215
|
other: "P"
|
|
212
|
-
},
|
|
213
|
-
function
|
|
216
|
+
}, Wt = (t, e, n, r) => Et[t];
|
|
217
|
+
function W(t) {
|
|
214
218
|
return (e, n) => {
|
|
215
219
|
const r = n != null && n.context ? String(n.context) : "standalone";
|
|
216
220
|
let a;
|
|
@@ -225,15 +229,15 @@ function N(t) {
|
|
|
225
229
|
return a[s];
|
|
226
230
|
};
|
|
227
231
|
}
|
|
228
|
-
const
|
|
232
|
+
const Nt = {
|
|
229
233
|
narrow: ["B", "A"],
|
|
230
234
|
abbreviated: ["BC", "AD"],
|
|
231
235
|
wide: ["Before Christ", "Anno Domini"]
|
|
232
|
-
},
|
|
236
|
+
}, Yt = {
|
|
233
237
|
narrow: ["1", "2", "3", "4"],
|
|
234
238
|
abbreviated: ["Q1", "Q2", "Q3", "Q4"],
|
|
235
239
|
wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"]
|
|
236
|
-
},
|
|
240
|
+
}, At = {
|
|
237
241
|
narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"],
|
|
238
242
|
abbreviated: [
|
|
239
243
|
"Jan",
|
|
@@ -263,7 +267,7 @@ const Wt = {
|
|
|
263
267
|
"November",
|
|
264
268
|
"December"
|
|
265
269
|
]
|
|
266
|
-
},
|
|
270
|
+
}, Ht = {
|
|
267
271
|
narrow: ["S", "M", "T", "W", "T", "F", "S"],
|
|
268
272
|
short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
|
|
269
273
|
abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
|
|
@@ -307,7 +311,7 @@ const Wt = {
|
|
|
307
311
|
evening: "evening",
|
|
308
312
|
night: "night"
|
|
309
313
|
}
|
|
310
|
-
},
|
|
314
|
+
}, _t = {
|
|
311
315
|
narrow: {
|
|
312
316
|
am: "a",
|
|
313
317
|
pm: "p",
|
|
@@ -338,7 +342,7 @@ const Wt = {
|
|
|
338
342
|
evening: "in the evening",
|
|
339
343
|
night: "at night"
|
|
340
344
|
}
|
|
341
|
-
},
|
|
345
|
+
}, It = (t, e) => {
|
|
342
346
|
const n = Number(t), r = n % 100;
|
|
343
347
|
if (r > 20 || r < 10)
|
|
344
348
|
switch (r % 10) {
|
|
@@ -350,40 +354,40 @@ const Wt = {
|
|
|
350
354
|
return n + "rd";
|
|
351
355
|
}
|
|
352
356
|
return n + "th";
|
|
353
|
-
},
|
|
354
|
-
ordinalNumber:
|
|
355
|
-
era:
|
|
356
|
-
values:
|
|
357
|
+
}, qt = {
|
|
358
|
+
ordinalNumber: It,
|
|
359
|
+
era: W({
|
|
360
|
+
values: Nt,
|
|
357
361
|
defaultWidth: "wide"
|
|
358
362
|
}),
|
|
359
|
-
quarter:
|
|
360
|
-
values:
|
|
363
|
+
quarter: W({
|
|
364
|
+
values: Yt,
|
|
361
365
|
defaultWidth: "wide",
|
|
362
366
|
argumentCallback: (t) => t - 1
|
|
363
367
|
}),
|
|
364
|
-
month:
|
|
365
|
-
values:
|
|
368
|
+
month: W({
|
|
369
|
+
values: At,
|
|
366
370
|
defaultWidth: "wide"
|
|
367
371
|
}),
|
|
368
|
-
day:
|
|
369
|
-
values:
|
|
372
|
+
day: W({
|
|
373
|
+
values: Ht,
|
|
370
374
|
defaultWidth: "wide"
|
|
371
375
|
}),
|
|
372
|
-
dayPeriod:
|
|
376
|
+
dayPeriod: W({
|
|
373
377
|
values: Ft,
|
|
374
378
|
defaultWidth: "wide",
|
|
375
|
-
formattingValues:
|
|
379
|
+
formattingValues: _t,
|
|
376
380
|
defaultFormattingWidth: "wide"
|
|
377
381
|
})
|
|
378
382
|
};
|
|
379
|
-
function
|
|
383
|
+
function N(t) {
|
|
380
384
|
return (e, n = {}) => {
|
|
381
385
|
const r = n.width, a = r && t.matchPatterns[r] || t.matchPatterns[t.defaultMatchWidth], s = e.match(a);
|
|
382
386
|
if (!s)
|
|
383
387
|
return null;
|
|
384
|
-
const i = s[0], c = r && t.parsePatterns[r] || t.parsePatterns[t.defaultParseWidth], o = Array.isArray(c) ?
|
|
388
|
+
const i = s[0], c = r && t.parsePatterns[r] || t.parsePatterns[t.defaultParseWidth], o = Array.isArray(c) ? Rt(c, (y) => y.test(i)) : (
|
|
385
389
|
// [TODO] -- I challenge you to fix the type
|
|
386
|
-
|
|
390
|
+
Lt(c, (y) => y.test(i))
|
|
387
391
|
);
|
|
388
392
|
let d;
|
|
389
393
|
d = t.valueCallback ? t.valueCallback(o) : o, d = n.valueCallback ? (
|
|
@@ -394,17 +398,17 @@ function Y(t) {
|
|
|
394
398
|
return { value: d, rest: g };
|
|
395
399
|
};
|
|
396
400
|
}
|
|
397
|
-
function
|
|
401
|
+
function Lt(t, e) {
|
|
398
402
|
for (const n in t)
|
|
399
403
|
if (Object.prototype.hasOwnProperty.call(t, n) && e(t[n]))
|
|
400
404
|
return n;
|
|
401
405
|
}
|
|
402
|
-
function
|
|
406
|
+
function Rt(t, e) {
|
|
403
407
|
for (let n = 0; n < t.length; n++)
|
|
404
408
|
if (e(t[n]))
|
|
405
409
|
return n;
|
|
406
410
|
}
|
|
407
|
-
function
|
|
411
|
+
function Ut(t) {
|
|
408
412
|
return (e, n = {}) => {
|
|
409
413
|
const r = e.match(t.matchPattern);
|
|
410
414
|
if (!r) return null;
|
|
@@ -416,23 +420,23 @@ function Rt(t) {
|
|
|
416
420
|
return { value: i, rest: c };
|
|
417
421
|
};
|
|
418
422
|
}
|
|
419
|
-
const
|
|
423
|
+
const zt = /^(\d+)(th|st|nd|rd)?/i, Bt = /\d+/i, jt = {
|
|
420
424
|
narrow: /^(b|a)/i,
|
|
421
425
|
abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
|
|
422
426
|
wide: /^(before christ|before common era|anno domini|common era)/i
|
|
423
427
|
}, Qt = {
|
|
424
428
|
any: [/^b/i, /^(a|c)/i]
|
|
425
|
-
},
|
|
429
|
+
}, Gt = {
|
|
426
430
|
narrow: /^[1234]/i,
|
|
427
431
|
abbreviated: /^q[1234]/i,
|
|
428
432
|
wide: /^[1234](th|st|nd|rd)? quarter/i
|
|
429
|
-
}, Gt = {
|
|
430
|
-
any: [/1/i, /2/i, /3/i, /4/i]
|
|
431
433
|
}, Xt = {
|
|
434
|
+
any: [/1/i, /2/i, /3/i, /4/i]
|
|
435
|
+
}, Vt = {
|
|
432
436
|
narrow: /^[jfmasond]/i,
|
|
433
437
|
abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
|
|
434
438
|
wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
|
|
435
|
-
},
|
|
439
|
+
}, Jt = {
|
|
436
440
|
narrow: [
|
|
437
441
|
/^j/i,
|
|
438
442
|
/^f/i,
|
|
@@ -461,18 +465,18 @@ const Ut = /^(\d+)(th|st|nd|rd)?/i, zt = /\d+/i, Bt = {
|
|
|
461
465
|
/^n/i,
|
|
462
466
|
/^d/i
|
|
463
467
|
]
|
|
464
|
-
},
|
|
468
|
+
}, Kt = {
|
|
465
469
|
narrow: /^[smtwf]/i,
|
|
466
470
|
short: /^(su|mo|tu|we|th|fr|sa)/i,
|
|
467
471
|
abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
|
|
468
472
|
wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
|
|
469
|
-
},
|
|
473
|
+
}, Zt = {
|
|
470
474
|
narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
|
|
471
475
|
any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
|
|
472
|
-
},
|
|
476
|
+
}, te = {
|
|
473
477
|
narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
|
|
474
478
|
any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
|
|
475
|
-
},
|
|
479
|
+
}, ee = {
|
|
476
480
|
any: {
|
|
477
481
|
am: /^a/i,
|
|
478
482
|
pm: /^p/i,
|
|
@@ -483,80 +487,80 @@ const Ut = /^(\d+)(th|st|nd|rd)?/i, zt = /\d+/i, Bt = {
|
|
|
483
487
|
evening: /evening/i,
|
|
484
488
|
night: /night/i
|
|
485
489
|
}
|
|
486
|
-
},
|
|
487
|
-
ordinalNumber:
|
|
488
|
-
matchPattern:
|
|
489
|
-
parsePattern:
|
|
490
|
+
}, ne = {
|
|
491
|
+
ordinalNumber: Ut({
|
|
492
|
+
matchPattern: zt,
|
|
493
|
+
parsePattern: Bt,
|
|
490
494
|
valueCallback: (t) => parseInt(t, 10)
|
|
491
495
|
}),
|
|
492
|
-
era:
|
|
493
|
-
matchPatterns:
|
|
496
|
+
era: N({
|
|
497
|
+
matchPatterns: jt,
|
|
494
498
|
defaultMatchWidth: "wide",
|
|
495
499
|
parsePatterns: Qt,
|
|
496
500
|
defaultParseWidth: "any"
|
|
497
501
|
}),
|
|
498
|
-
quarter:
|
|
499
|
-
matchPatterns:
|
|
502
|
+
quarter: N({
|
|
503
|
+
matchPatterns: Gt,
|
|
500
504
|
defaultMatchWidth: "wide",
|
|
501
|
-
parsePatterns:
|
|
505
|
+
parsePatterns: Xt,
|
|
502
506
|
defaultParseWidth: "any",
|
|
503
507
|
valueCallback: (t) => t + 1
|
|
504
508
|
}),
|
|
505
|
-
month:
|
|
506
|
-
matchPatterns:
|
|
509
|
+
month: N({
|
|
510
|
+
matchPatterns: Vt,
|
|
507
511
|
defaultMatchWidth: "wide",
|
|
508
|
-
parsePatterns:
|
|
512
|
+
parsePatterns: Jt,
|
|
509
513
|
defaultParseWidth: "any"
|
|
510
514
|
}),
|
|
511
|
-
day:
|
|
512
|
-
matchPatterns:
|
|
515
|
+
day: N({
|
|
516
|
+
matchPatterns: Kt,
|
|
513
517
|
defaultMatchWidth: "wide",
|
|
514
|
-
parsePatterns:
|
|
518
|
+
parsePatterns: Zt,
|
|
515
519
|
defaultParseWidth: "any"
|
|
516
520
|
}),
|
|
517
|
-
dayPeriod:
|
|
518
|
-
matchPatterns:
|
|
521
|
+
dayPeriod: N({
|
|
522
|
+
matchPatterns: te,
|
|
519
523
|
defaultMatchWidth: "any",
|
|
520
|
-
parsePatterns:
|
|
524
|
+
parsePatterns: ee,
|
|
521
525
|
defaultParseWidth: "any"
|
|
522
526
|
})
|
|
523
|
-
},
|
|
527
|
+
}, re = {
|
|
524
528
|
code: "en-US",
|
|
525
|
-
formatDistance:
|
|
526
|
-
formatLong:
|
|
527
|
-
formatRelative:
|
|
528
|
-
localize:
|
|
529
|
-
match:
|
|
529
|
+
formatDistance: Tt,
|
|
530
|
+
formatLong: $t,
|
|
531
|
+
formatRelative: Wt,
|
|
532
|
+
localize: qt,
|
|
533
|
+
match: ne,
|
|
530
534
|
options: {
|
|
531
535
|
weekStartsOn: 0,
|
|
532
536
|
firstWeekContainsDate: 1
|
|
533
537
|
}
|
|
534
538
|
};
|
|
535
|
-
function re(t, e) {
|
|
536
|
-
const n = v(t, e == null ? void 0 : e.in);
|
|
537
|
-
return wt(n, St(n)) + 1;
|
|
538
|
-
}
|
|
539
539
|
function ae(t, e) {
|
|
540
|
-
const n =
|
|
541
|
-
return
|
|
540
|
+
const n = k(t, e == null ? void 0 : e.in);
|
|
541
|
+
return wt(n, Mt(n)) + 1;
|
|
542
|
+
}
|
|
543
|
+
function se(t, e) {
|
|
544
|
+
const n = k(t, e == null ? void 0 : e.in), r = +I(n) - +bt(n);
|
|
545
|
+
return Math.round(r / rt) + 1;
|
|
542
546
|
}
|
|
543
547
|
function ot(t, e) {
|
|
544
548
|
var g, y, f, x;
|
|
545
|
-
const n =
|
|
549
|
+
const n = k(t, e == null ? void 0 : e.in), r = n.getFullYear(), a = q(), s = (e == null ? void 0 : e.firstWeekContainsDate) ?? ((y = (g = e == null ? void 0 : e.locale) == null ? void 0 : g.options) == null ? void 0 : y.firstWeekContainsDate) ?? a.firstWeekContainsDate ?? ((x = (f = a.locale) == null ? void 0 : f.options) == null ? void 0 : x.firstWeekContainsDate) ?? 1, i = S((e == null ? void 0 : e.in) || t, 0);
|
|
546
550
|
i.setFullYear(r + 1, 0, s), i.setHours(0, 0, 0, 0);
|
|
547
551
|
const c = H(i, e), o = S((e == null ? void 0 : e.in) || t, 0);
|
|
548
552
|
o.setFullYear(r, 0, s), o.setHours(0, 0, 0, 0);
|
|
549
553
|
const d = H(o, e);
|
|
550
554
|
return +n >= +c ? r + 1 : +n >= +d ? r : r - 1;
|
|
551
555
|
}
|
|
552
|
-
function
|
|
556
|
+
function ie(t, e) {
|
|
553
557
|
var c, o, d, g;
|
|
554
|
-
const n =
|
|
558
|
+
const n = q(), r = (e == null ? void 0 : e.firstWeekContainsDate) ?? ((o = (c = e == null ? void 0 : e.locale) == null ? void 0 : c.options) == null ? void 0 : o.firstWeekContainsDate) ?? n.firstWeekContainsDate ?? ((g = (d = n.locale) == null ? void 0 : d.options) == null ? void 0 : g.firstWeekContainsDate) ?? 1, a = ot(t, e), s = S((e == null ? void 0 : e.in) || t, 0);
|
|
555
559
|
return s.setFullYear(a, 0, r), s.setHours(0, 0, 0, 0), H(s, e);
|
|
556
560
|
}
|
|
557
561
|
function ct(t, e) {
|
|
558
|
-
const n =
|
|
559
|
-
return Math.round(r /
|
|
562
|
+
const n = k(t, e == null ? void 0 : e.in), r = +H(n, e) - +ie(n, e);
|
|
563
|
+
return Math.round(r / rt) + 1;
|
|
560
564
|
}
|
|
561
565
|
function l(t, e) {
|
|
562
566
|
const n = t < 0 ? "-" : "", r = Math.abs(t).toString().padStart(e, "0");
|
|
@@ -623,7 +627,7 @@ const O = {
|
|
|
623
627
|
afternoon: "afternoon",
|
|
624
628
|
evening: "evening",
|
|
625
629
|
night: "night"
|
|
626
|
-
},
|
|
630
|
+
}, J = {
|
|
627
631
|
// Era
|
|
628
632
|
G: function(t, e, n) {
|
|
629
633
|
const r = t.getFullYear() > 0 ? 1 : 0;
|
|
@@ -786,7 +790,7 @@ const O = {
|
|
|
786
790
|
},
|
|
787
791
|
// ISO week of year
|
|
788
792
|
I: function(t, e, n) {
|
|
789
|
-
const r =
|
|
793
|
+
const r = se(t);
|
|
790
794
|
return e === "Io" ? n.ordinalNumber(r, { unit: "week" }) : l(r, e.length);
|
|
791
795
|
},
|
|
792
796
|
// Day of the month
|
|
@@ -795,7 +799,7 @@ const O = {
|
|
|
795
799
|
},
|
|
796
800
|
// Day of year
|
|
797
801
|
D: function(t, e, n) {
|
|
798
|
-
const r =
|
|
802
|
+
const r = ae(t);
|
|
799
803
|
return e === "Do" ? n.ordinalNumber(r, { unit: "dayOfYear" }) : l(r, e.length);
|
|
800
804
|
},
|
|
801
805
|
// Day of week
|
|
@@ -1049,7 +1053,7 @@ const O = {
|
|
|
1049
1053
|
return "Z";
|
|
1050
1054
|
switch (e) {
|
|
1051
1055
|
case "X":
|
|
1052
|
-
return
|
|
1056
|
+
return Z(r);
|
|
1053
1057
|
case "XXXX":
|
|
1054
1058
|
case "XX":
|
|
1055
1059
|
return $(r);
|
|
@@ -1064,7 +1068,7 @@ const O = {
|
|
|
1064
1068
|
const r = t.getTimezoneOffset();
|
|
1065
1069
|
switch (e) {
|
|
1066
1070
|
case "x":
|
|
1067
|
-
return
|
|
1071
|
+
return Z(r);
|
|
1068
1072
|
case "xxxx":
|
|
1069
1073
|
case "xx":
|
|
1070
1074
|
return $(r);
|
|
@@ -1081,7 +1085,7 @@ const O = {
|
|
|
1081
1085
|
case "O":
|
|
1082
1086
|
case "OO":
|
|
1083
1087
|
case "OOO":
|
|
1084
|
-
return "GMT" +
|
|
1088
|
+
return "GMT" + K(r, ":");
|
|
1085
1089
|
case "OOOO":
|
|
1086
1090
|
default:
|
|
1087
1091
|
return "GMT" + $(r, ":");
|
|
@@ -1094,7 +1098,7 @@ const O = {
|
|
|
1094
1098
|
case "z":
|
|
1095
1099
|
case "zz":
|
|
1096
1100
|
case "zzz":
|
|
1097
|
-
return "GMT" +
|
|
1101
|
+
return "GMT" + K(r, ":");
|
|
1098
1102
|
case "zzzz":
|
|
1099
1103
|
default:
|
|
1100
1104
|
return "GMT" + $(r, ":");
|
|
@@ -1110,18 +1114,18 @@ const O = {
|
|
|
1110
1114
|
return l(+t, e.length);
|
|
1111
1115
|
}
|
|
1112
1116
|
};
|
|
1113
|
-
function
|
|
1117
|
+
function K(t, e = "") {
|
|
1114
1118
|
const n = t > 0 ? "-" : "+", r = Math.abs(t), a = Math.trunc(r / 60), s = r % 60;
|
|
1115
1119
|
return s === 0 ? n + String(a) : n + String(a) + e + l(s, 2);
|
|
1116
1120
|
}
|
|
1117
|
-
function
|
|
1121
|
+
function Z(t, e) {
|
|
1118
1122
|
return t % 60 === 0 ? (t > 0 ? "-" : "+") + l(Math.abs(t) / 60, 2) : $(t, e);
|
|
1119
1123
|
}
|
|
1120
1124
|
function $(t, e = "") {
|
|
1121
1125
|
const n = t > 0 ? "-" : "+", r = Math.abs(t), a = l(Math.trunc(r / 60), 2), s = l(r % 60, 2);
|
|
1122
1126
|
return n + a + e + s;
|
|
1123
1127
|
}
|
|
1124
|
-
const
|
|
1128
|
+
const tt = (t, e) => {
|
|
1125
1129
|
switch (t) {
|
|
1126
1130
|
case "P":
|
|
1127
1131
|
return e.date({ width: "short" });
|
|
@@ -1145,10 +1149,10 @@ const et = (t, e) => {
|
|
|
1145
1149
|
default:
|
|
1146
1150
|
return e.time({ width: "full" });
|
|
1147
1151
|
}
|
|
1148
|
-
},
|
|
1152
|
+
}, oe = (t, e) => {
|
|
1149
1153
|
const n = t.match(/(P+)(p+)?/) || [], r = n[1], a = n[2];
|
|
1150
1154
|
if (!a)
|
|
1151
|
-
return
|
|
1155
|
+
return tt(t, e);
|
|
1152
1156
|
let s;
|
|
1153
1157
|
switch (r) {
|
|
1154
1158
|
case "P":
|
|
@@ -1165,51 +1169,51 @@ const et = (t, e) => {
|
|
|
1165
1169
|
s = e.dateTime({ width: "full" });
|
|
1166
1170
|
break;
|
|
1167
1171
|
}
|
|
1168
|
-
return s.replace("{{date}}",
|
|
1169
|
-
},
|
|
1172
|
+
return s.replace("{{date}}", tt(r, e)).replace("{{time}}", lt(a, e));
|
|
1173
|
+
}, ce = {
|
|
1170
1174
|
p: lt,
|
|
1171
|
-
P:
|
|
1172
|
-
},
|
|
1173
|
-
function he(t) {
|
|
1174
|
-
return ce.test(t);
|
|
1175
|
-
}
|
|
1175
|
+
P: oe
|
|
1176
|
+
}, le = /^D+$/, ue = /^Y+$/, he = ["D", "DD", "YY", "YYYY"];
|
|
1176
1177
|
function de(t) {
|
|
1177
1178
|
return le.test(t);
|
|
1178
1179
|
}
|
|
1179
|
-
function fe(t
|
|
1180
|
-
|
|
1181
|
-
if (console.warn(r), ue.includes(t)) throw new RangeError(r);
|
|
1180
|
+
function fe(t) {
|
|
1181
|
+
return ue.test(t);
|
|
1182
1182
|
}
|
|
1183
1183
|
function me(t, e, n) {
|
|
1184
|
+
const r = ge(t, e, n);
|
|
1185
|
+
if (console.warn(r), he.includes(t)) throw new RangeError(r);
|
|
1186
|
+
}
|
|
1187
|
+
function ge(t, e, n) {
|
|
1184
1188
|
const r = t[0] === "Y" ? "years" : "days of the month";
|
|
1185
1189
|
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`;
|
|
1186
1190
|
}
|
|
1187
|
-
const
|
|
1188
|
-
function
|
|
1191
|
+
const ye = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g, pe = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g, we = /^'([^]*?)'?$/, be = /''/g, ke = /[a-zA-Z]/;
|
|
1192
|
+
function ve(t, e, n) {
|
|
1189
1193
|
var g, y, f, x;
|
|
1190
|
-
const r =
|
|
1194
|
+
const r = q(), a = r.locale ?? re, s = r.firstWeekContainsDate ?? ((y = (g = r.locale) == null ? void 0 : g.options) == null ? void 0 : y.firstWeekContainsDate) ?? 1, i = r.weekStartsOn ?? ((x = (f = r.locale) == null ? void 0 : f.options) == null ? void 0 : x.weekStartsOn) ?? 0, c = k(t, n == null ? void 0 : n.in);
|
|
1191
1195
|
if (!vt(c))
|
|
1192
1196
|
throw new RangeError("Invalid time value");
|
|
1193
|
-
let o = e.match(
|
|
1194
|
-
const
|
|
1195
|
-
if (
|
|
1196
|
-
const
|
|
1197
|
-
return
|
|
1197
|
+
let o = e.match(pe).map((w) => {
|
|
1198
|
+
const v = w[0];
|
|
1199
|
+
if (v === "p" || v === "P") {
|
|
1200
|
+
const R = ce[v];
|
|
1201
|
+
return R(w, a.formatLong);
|
|
1198
1202
|
}
|
|
1199
|
-
return
|
|
1200
|
-
}).join("").match(
|
|
1201
|
-
if (
|
|
1203
|
+
return w;
|
|
1204
|
+
}).join("").match(ye).map((w) => {
|
|
1205
|
+
if (w === "''")
|
|
1202
1206
|
return { isToken: !1, value: "'" };
|
|
1203
|
-
const
|
|
1204
|
-
if (
|
|
1205
|
-
return { isToken: !1, value:
|
|
1206
|
-
if (
|
|
1207
|
-
return { isToken: !0, value:
|
|
1208
|
-
if (
|
|
1207
|
+
const v = w[0];
|
|
1208
|
+
if (v === "'")
|
|
1209
|
+
return { isToken: !1, value: De(w) };
|
|
1210
|
+
if (J[v])
|
|
1211
|
+
return { isToken: !0, value: w };
|
|
1212
|
+
if (v.match(ke))
|
|
1209
1213
|
throw new RangeError(
|
|
1210
|
-
"Format string contains an unescaped latin alphabet character `" +
|
|
1214
|
+
"Format string contains an unescaped latin alphabet character `" + v + "`"
|
|
1211
1215
|
);
|
|
1212
|
-
return { isToken: !1, value:
|
|
1216
|
+
return { isToken: !1, value: w };
|
|
1213
1217
|
});
|
|
1214
1218
|
a.localize.preprocessor && (o = a.localize.preprocessor(c, o));
|
|
1215
1219
|
const d = {
|
|
@@ -1217,46 +1221,50 @@ function ke(t, e, n) {
|
|
|
1217
1221
|
weekStartsOn: i,
|
|
1218
1222
|
locale: a
|
|
1219
1223
|
};
|
|
1220
|
-
return o.map((
|
|
1221
|
-
if (!
|
|
1222
|
-
const
|
|
1223
|
-
(
|
|
1224
|
-
const
|
|
1225
|
-
return
|
|
1224
|
+
return o.map((w) => {
|
|
1225
|
+
if (!w.isToken) return w.value;
|
|
1226
|
+
const v = w.value;
|
|
1227
|
+
(fe(v) || de(v)) && me(v, e, String(t));
|
|
1228
|
+
const R = J[v[0]];
|
|
1229
|
+
return R(c, v, a.localize, d);
|
|
1226
1230
|
}).join("");
|
|
1227
1231
|
}
|
|
1228
|
-
function
|
|
1229
|
-
const e = t.match(
|
|
1230
|
-
return e ? e[1].replace(
|
|
1232
|
+
function De(t) {
|
|
1233
|
+
const e = t.match(we);
|
|
1234
|
+
return e ? e[1].replace(be, "'") : t;
|
|
1231
1235
|
}
|
|
1232
|
-
function
|
|
1233
|
-
const n =
|
|
1236
|
+
function Se(t, e) {
|
|
1237
|
+
const n = k(t, e == null ? void 0 : e.in).getDay();
|
|
1234
1238
|
return n === 0 ? 7 : n;
|
|
1235
1239
|
}
|
|
1236
|
-
|
|
1237
|
-
|
|
1240
|
+
function Me(t, e, n) {
|
|
1241
|
+
const r = k(t, n == null ? void 0 : n.in);
|
|
1242
|
+
return r.setHours(e), r;
|
|
1243
|
+
}
|
|
1244
|
+
const j = {}, Y = {};
|
|
1245
|
+
function A(t, e) {
|
|
1238
1246
|
try {
|
|
1239
1247
|
const r = (j[t] || (j[t] = new Intl.DateTimeFormat("en-GB", {
|
|
1240
1248
|
timeZone: t,
|
|
1241
1249
|
hour: "numeric",
|
|
1242
1250
|
timeZoneName: "longOffset"
|
|
1243
1251
|
}).format))(e).split("GMT")[1] || "";
|
|
1244
|
-
return r in
|
|
1252
|
+
return r in Y ? Y[r] : et(r, r.split(":"));
|
|
1245
1253
|
} catch {
|
|
1246
|
-
if (t in
|
|
1247
|
-
const n = t == null ? void 0 : t.match(
|
|
1248
|
-
return n ?
|
|
1254
|
+
if (t in Y) return Y[t];
|
|
1255
|
+
const n = t == null ? void 0 : t.match(xe);
|
|
1256
|
+
return n ? et(t, n.slice(1)) : NaN;
|
|
1249
1257
|
}
|
|
1250
1258
|
}
|
|
1251
|
-
const
|
|
1252
|
-
function
|
|
1259
|
+
const xe = /([+-]\d\d):?(\d\d)?/;
|
|
1260
|
+
function et(t, e) {
|
|
1253
1261
|
const n = +e[0], r = +(e[1] || 0);
|
|
1254
|
-
return
|
|
1262
|
+
return Y[t] = n > 0 ? n * 60 + r : n * 60 - r;
|
|
1255
1263
|
}
|
|
1256
1264
|
class M extends Date {
|
|
1257
1265
|
//#region static
|
|
1258
1266
|
constructor(...e) {
|
|
1259
|
-
super(), e.length > 1 && typeof e[e.length - 1] == "string" && (this.timeZone = e.pop()), this.internal = /* @__PURE__ */ new Date(), isNaN(
|
|
1267
|
+
super(), e.length > 1 && typeof e[e.length - 1] == "string" && (this.timeZone = e.pop()), this.internal = /* @__PURE__ */ new Date(), isNaN(A(this.timeZone, this)) ? this.setTime(NaN) : e.length ? typeof e[0] == "number" && (e.length === 1 || e.length === 2 && typeof e[1] != "number") ? this.setTime(e[0]) : typeof e[0] == "string" ? this.setTime(+new Date(e[0])) : e[0] instanceof Date ? this.setTime(+e[0]) : (this.setTime(+new Date(...e)), ut(this), G(this)) : this.setTime(Date.now());
|
|
1260
1268
|
}
|
|
1261
1269
|
static tz(e, ...n) {
|
|
1262
1270
|
return n.length ? new M(...n, e) : new M(Date.now(), e);
|
|
@@ -1267,7 +1275,7 @@ class M extends Date {
|
|
|
1267
1275
|
return new M(+this, e);
|
|
1268
1276
|
}
|
|
1269
1277
|
getTimezoneOffset() {
|
|
1270
|
-
return -
|
|
1278
|
+
return -A(this.timeZone, this);
|
|
1271
1279
|
}
|
|
1272
1280
|
//#endregion
|
|
1273
1281
|
//#region time
|
|
@@ -1281,14 +1289,14 @@ class M extends Date {
|
|
|
1281
1289
|
}
|
|
1282
1290
|
//#endregion
|
|
1283
1291
|
}
|
|
1284
|
-
const
|
|
1292
|
+
const nt = /^(get|set)(?!UTC)/;
|
|
1285
1293
|
Object.getOwnPropertyNames(Date.prototype).forEach((t) => {
|
|
1286
|
-
if (!
|
|
1287
|
-
const e = t.replace(
|
|
1294
|
+
if (!nt.test(t)) return;
|
|
1295
|
+
const e = t.replace(nt, "$1UTC");
|
|
1288
1296
|
M.prototype[e] && (t.startsWith("get") ? M.prototype[t] = function() {
|
|
1289
1297
|
return this.internal[e]();
|
|
1290
1298
|
} : (M.prototype[t] = function() {
|
|
1291
|
-
return Date.prototype[e].apply(this.internal, arguments),
|
|
1299
|
+
return Date.prototype[e].apply(this.internal, arguments), Te(this), +this;
|
|
1292
1300
|
}, M.prototype[e] = function() {
|
|
1293
1301
|
return Date.prototype[e].apply(this, arguments), G(this), +this;
|
|
1294
1302
|
}));
|
|
@@ -1296,21 +1304,21 @@ Object.getOwnPropertyNames(Date.prototype).forEach((t) => {
|
|
|
1296
1304
|
function G(t) {
|
|
1297
1305
|
t.internal.setTime(+t), t.internal.setUTCMinutes(t.internal.getUTCMinutes() - t.getTimezoneOffset());
|
|
1298
1306
|
}
|
|
1299
|
-
function
|
|
1307
|
+
function Te(t) {
|
|
1300
1308
|
Date.prototype.setFullYear.call(t, t.internal.getUTCFullYear(), t.internal.getUTCMonth(), t.internal.getUTCDate()), Date.prototype.setHours.call(t, t.internal.getUTCHours(), t.internal.getUTCMinutes(), t.internal.getUTCSeconds(), t.internal.getUTCMilliseconds()), ut(t);
|
|
1301
1309
|
}
|
|
1302
1310
|
function ut(t) {
|
|
1303
|
-
const e =
|
|
1311
|
+
const e = A(t.timeZone, t), n = /* @__PURE__ */ new Date(+t);
|
|
1304
1312
|
n.setUTCHours(n.getUTCHours() - 1);
|
|
1305
1313
|
const r = -(/* @__PURE__ */ new Date(+t)).getTimezoneOffset(), a = -(/* @__PURE__ */ new Date(+n)).getTimezoneOffset(), s = r - a, i = Date.prototype.getHours.apply(t) !== t.internal.getUTCHours();
|
|
1306
1314
|
s && i && t.internal.setUTCMinutes(t.internal.getUTCMinutes() + s);
|
|
1307
1315
|
const c = r - e;
|
|
1308
1316
|
c && Date.prototype.setUTCMinutes.call(t, Date.prototype.getUTCMinutes.call(t) + c);
|
|
1309
|
-
const o =
|
|
1317
|
+
const o = A(t.timeZone, t), g = -(/* @__PURE__ */ new Date(+t)).getTimezoneOffset() - o, y = o !== e, f = g - c;
|
|
1310
1318
|
if (y && f) {
|
|
1311
1319
|
Date.prototype.setUTCMinutes.call(t, Date.prototype.getUTCMinutes.call(t) + f);
|
|
1312
|
-
const x =
|
|
1313
|
-
|
|
1320
|
+
const x = A(t.timeZone, t), w = o - x;
|
|
1321
|
+
w && (t.internal.setUTCMinutes(t.internal.getUTCMinutes() + w), Date.prototype.setUTCMinutes.call(t, Date.prototype.getUTCMinutes.call(t) + w));
|
|
1314
1322
|
}
|
|
1315
1323
|
}
|
|
1316
1324
|
class T extends M {
|
|
@@ -1333,7 +1341,7 @@ class T extends M {
|
|
|
1333
1341
|
}
|
|
1334
1342
|
toTimeString() {
|
|
1335
1343
|
const e = this.internal.toUTCString().split(" ")[4], [n, r, a] = this.tzComponents();
|
|
1336
|
-
return `${e} GMT${n}${r}${a} (${
|
|
1344
|
+
return `${e} GMT${n}${r}${a} (${Oe(this.timeZone, this)})`;
|
|
1337
1345
|
}
|
|
1338
1346
|
toLocaleString(e, n) {
|
|
1339
1347
|
return Date.prototype.toLocaleString.call(this, e, {
|
|
@@ -1369,34 +1377,40 @@ class T extends M {
|
|
|
1369
1377
|
}
|
|
1370
1378
|
//#endregion
|
|
1371
1379
|
}
|
|
1372
|
-
function
|
|
1380
|
+
function Oe(t, e) {
|
|
1373
1381
|
return new Intl.DateTimeFormat("en-GB", {
|
|
1374
1382
|
timeZone: t,
|
|
1375
1383
|
timeZoneName: "long"
|
|
1376
1384
|
}).format(e).slice(12);
|
|
1377
1385
|
}
|
|
1378
1386
|
window.pktTz = window.pktTz === void 0 ? "Europe/Oslo" : window.pktTz;
|
|
1379
|
-
const
|
|
1387
|
+
const b = (t) => t.toISOString().split("T")[0], Ie = (t) => {
|
|
1380
1388
|
if (!t)
|
|
1381
1389
|
return null;
|
|
1382
|
-
const e =
|
|
1390
|
+
const e = at(new T(t, window.pktTz), 12);
|
|
1383
1391
|
return isNaN(e.getTime()) ? null : e;
|
|
1384
|
-
},
|
|
1385
|
-
const n =
|
|
1386
|
-
return isNaN(n.getTime()) ? "" :
|
|
1387
|
-
},
|
|
1392
|
+
}, qe = (t, e) => {
|
|
1393
|
+
const n = p(t);
|
|
1394
|
+
return isNaN(n.getTime()) ? "" : ve(n, e);
|
|
1395
|
+
}, p = (t = "", e) => {
|
|
1396
|
+
const n = t === "" || !t ? /* @__PURE__ */ new Date() : t;
|
|
1397
|
+
return e ? new T(
|
|
1398
|
+
e === "end" ? Dt(n) : Q(n),
|
|
1399
|
+
window.pktTz
|
|
1400
|
+
) : Me(new T(n.toString(), window.pktTz), 12);
|
|
1401
|
+
}, P = (t, e, n = 1) => at(new T(t, e, n, window.pktTz), 12), Pe = (t) => new Intl.DateTimeFormat("no", { dateStyle: "full", timeZone: window.pktTz }).format(t), Ce = (t) => {
|
|
1388
1402
|
if (Array.isArray(t)) return t;
|
|
1389
1403
|
if (typeof t == "string") return t.split(",");
|
|
1390
|
-
},
|
|
1404
|
+
}, $e = (t) => t ? new Date(t) : null, Ee = (t) => {
|
|
1391
1405
|
if (typeof t == "string")
|
|
1392
1406
|
return t.split(",").map((e) => new Date(e));
|
|
1393
1407
|
if (Array.isArray(t))
|
|
1394
1408
|
return t.map((e) => new Date(e));
|
|
1395
|
-
},
|
|
1396
|
-
csvToArray:
|
|
1397
|
-
stringToDate:
|
|
1398
|
-
stringsToDate:
|
|
1399
|
-
},
|
|
1409
|
+
}, L = {
|
|
1410
|
+
csvToArray: Ce,
|
|
1411
|
+
stringToDate: $e,
|
|
1412
|
+
stringsToDate: Ee
|
|
1413
|
+
}, We = {
|
|
1400
1414
|
earliest: {
|
|
1401
1415
|
default: null
|
|
1402
1416
|
},
|
|
@@ -1419,12 +1433,12 @@ const w = (t) => t.toISOString().split("T")[0], He = (t) => {
|
|
|
1419
1433
|
default: !1
|
|
1420
1434
|
}
|
|
1421
1435
|
}, C = {
|
|
1422
|
-
props:
|
|
1436
|
+
props: We
|
|
1423
1437
|
};
|
|
1424
|
-
var
|
|
1425
|
-
for (var a = r > 1 ? void 0 : r ?
|
|
1438
|
+
var Ne = Object.defineProperty, Ye = Object.getOwnPropertyDescriptor, h = (t, e, n, r) => {
|
|
1439
|
+
for (var a = r > 1 ? void 0 : r ? Ye(e, n) : e, s = t.length - 1, i; s >= 0; s--)
|
|
1426
1440
|
(i = t[s]) && (a = (r ? i(e, n, a) : i(a)) || a);
|
|
1427
|
-
return r && a &&
|
|
1441
|
+
return r && a && Ne(e, n, a), a;
|
|
1428
1442
|
};
|
|
1429
1443
|
let u = class extends dt {
|
|
1430
1444
|
constructor() {
|
|
@@ -1449,15 +1463,15 @@ let u = class extends dt {
|
|
|
1449
1463
|
this.addEventListener("keydown", this.handleKeydown);
|
|
1450
1464
|
}
|
|
1451
1465
|
convertSelected() {
|
|
1452
|
-
if (typeof this.selected == "string" && (this.selected = this.selected.split(",")), this.selected.length === 1 && this.selected[0] === "" && (this.selected = []), this._selected = this.selected.map((t) =>
|
|
1453
|
-
const t =
|
|
1454
|
-
start:
|
|
1455
|
-
end:
|
|
1466
|
+
if (typeof this.selected == "string" && (this.selected = this.selected.split(",")), this.selected.length === 1 && this.selected[0] === "" && (this.selected = []), this._selected = this.selected.map((t) => p(t)), this.range && this.selected.length === 2) {
|
|
1467
|
+
const t = z({
|
|
1468
|
+
start: p(this.selected[0]),
|
|
1469
|
+
end: p(this.selected[1])
|
|
1456
1470
|
});
|
|
1457
1471
|
if (this.inRange = {}, Array.isArray(t) && t.length) {
|
|
1458
1472
|
const e = {};
|
|
1459
1473
|
for (let n = 0; n < t.length; n++)
|
|
1460
|
-
e[
|
|
1474
|
+
e[b(t[n])] = this.isInRange(t[n]);
|
|
1461
1475
|
this.inRange = e;
|
|
1462
1476
|
}
|
|
1463
1477
|
}
|
|
@@ -1468,7 +1482,7 @@ let u = class extends dt {
|
|
|
1468
1482
|
this.currentmonthtouched = !0;
|
|
1469
1483
|
return;
|
|
1470
1484
|
}
|
|
1471
|
-
this.selected.length && this.selected[0] !== "" ? this.currentmonth =
|
|
1485
|
+
this.selected.length && this.selected[0] !== "" ? this.currentmonth = p(this.selected[this.selected.length - 1]) : this.currentmonth === null && (this.currentmonth = p()), this.year = this.currentmonth.getFullYear(), this.month = this.currentmonth.getMonth();
|
|
1472
1486
|
}
|
|
1473
1487
|
handleKeydown(t) {
|
|
1474
1488
|
switch (t.key) {
|
|
@@ -1490,19 +1504,19 @@ let u = class extends dt {
|
|
|
1490
1504
|
var a, s, i;
|
|
1491
1505
|
if (((a = t.target) == null ? void 0 : a.nodeName) === "INPUT" || ((s = t.target) == null ? void 0 : s.nodeName) === "SELECT" || ((i = t.target) == null ? void 0 : i.nodeName) === "BUTTON") return;
|
|
1492
1506
|
t.preventDefault(), this.focusedDate || this.focusOnCurrentDate();
|
|
1493
|
-
const n = this.focusedDate ?
|
|
1494
|
-
let r =
|
|
1507
|
+
const n = this.focusedDate ? p(this.focusedDate) : P(this.year, this.month, 1);
|
|
1508
|
+
let r = U(n, e);
|
|
1495
1509
|
if (r) {
|
|
1496
|
-
let c = this.querySelector(`div[data-date="${
|
|
1510
|
+
let c = this.querySelector(`div[data-date="${b(r)}"]`);
|
|
1497
1511
|
if (c instanceof HTMLDivElement) {
|
|
1498
1512
|
if (c.dataset.disabled) {
|
|
1499
|
-
r =
|
|
1500
|
-
let o = this.querySelector(`div[data-date="${
|
|
1513
|
+
r = U(r, e);
|
|
1514
|
+
let o = this.querySelector(`div[data-date="${b(r)}"]`);
|
|
1501
1515
|
for (; o && o instanceof HTMLDivElement && o.dataset.disabled; )
|
|
1502
|
-
r =
|
|
1516
|
+
r = U(r, e), o = this.querySelector(`div[data-date="${b(r)}"]`);
|
|
1503
1517
|
c = o;
|
|
1504
1518
|
}
|
|
1505
|
-
c instanceof HTMLDivElement && !c.dataset.disabled && (this.focusedDate =
|
|
1519
|
+
c instanceof HTMLDivElement && !c.dataset.disabled && (this.focusedDate = b(r), c.focus());
|
|
1506
1520
|
}
|
|
1507
1521
|
}
|
|
1508
1522
|
}
|
|
@@ -1512,7 +1526,7 @@ let u = class extends dt {
|
|
|
1512
1526
|
render() {
|
|
1513
1527
|
return D`
|
|
1514
1528
|
<div
|
|
1515
|
-
class="pkt-calendar ${this.weeknumbers ? "pkt-cal-weeknumbers" :
|
|
1529
|
+
class="pkt-calendar ${this.weeknumbers ? "pkt-cal-weeknumbers" : _}"
|
|
1516
1530
|
@focusout=${this.closeEvent}
|
|
1517
1531
|
@keydown=${(t) => {
|
|
1518
1532
|
t.key === "Escape" && (t.preventDefault(), this.close());
|
|
@@ -1527,7 +1541,7 @@ let u = class extends dt {
|
|
|
1527
1541
|
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), this.isNextMonthAllowed() && this.prevMonth());
|
|
1528
1542
|
}}
|
|
1529
1543
|
class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only ${this.isPrevMonthAllowed() ? "" : "pkt-hide"}"
|
|
1530
|
-
.data-disabled=${this.isPrevMonthAllowed() ?
|
|
1544
|
+
.data-disabled=${this.isPrevMonthAllowed() ? _ : "disabled"}
|
|
1531
1545
|
?aria-disabled=${!this.isPrevMonthAllowed()}
|
|
1532
1546
|
tabindex=${this.isPrevMonthAllowed() ? "0" : "-1"}
|
|
1533
1547
|
>
|
|
@@ -1544,7 +1558,7 @@ let u = class extends dt {
|
|
|
1544
1558
|
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), this.isNextMonthAllowed() && this.nextMonth());
|
|
1545
1559
|
}}
|
|
1546
1560
|
class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only ${this.isNextMonthAllowed() ? "" : "pkt-hide"}"
|
|
1547
|
-
.data-disabled=${this.isNextMonthAllowed() ?
|
|
1561
|
+
.data-disabled=${this.isNextMonthAllowed() ? _ : "disabled"}
|
|
1548
1562
|
?aria-disabled=${!this.isNextMonthAllowed()}
|
|
1549
1563
|
tabindex=${this.isNextMonthAllowed() ? "0" : "-1"}
|
|
1550
1564
|
>
|
|
@@ -1618,7 +1632,7 @@ let u = class extends dt {
|
|
|
1618
1632
|
}
|
|
1619
1633
|
renderDayView(t, e, n) {
|
|
1620
1634
|
var y;
|
|
1621
|
-
const r = P(this.year, this.month, t), a =
|
|
1635
|
+
const r = P(this.year, this.month, t), a = b(r), s = a === b(e), i = this.selected.includes(a), c = Pe(r), o = this.isExcluded(n, r) || !i && this.multiple && this.maxMultiple > 0 && this.selected.length >= this.maxMultiple, d = this.focusedDate ? this.focusedDate === a && !o ? "0" : "-1" : !o && this.tabIndexSet === 0 || this.tabIndexSet === t ? "0" : "-1";
|
|
1622
1636
|
d === "0" && (this.tabIndexSet = t), this.selectableDates.push({ currentDateISO: a, isDisabled: o, tabindex: d });
|
|
1623
1637
|
const g = {
|
|
1624
1638
|
"pkt-cal-today": s,
|
|
@@ -1627,7 +1641,7 @@ let u = class extends dt {
|
|
|
1627
1641
|
"pkt-cal-excluded": this.isExcluded(n, r),
|
|
1628
1642
|
"pkt-cal-in-range-first": this.range && (this.selected.length === 2 || this.rangeHovered !== null) && a === this.selected[0],
|
|
1629
1643
|
"pkt-cal-in-range-last": this.range && this.selected.length === 2 && a === this.selected[1],
|
|
1630
|
-
"pkt-cal-range-hover": this.rangeHovered !== null && a ===
|
|
1644
|
+
"pkt-cal-range-hover": this.rangeHovered !== null && a === b(this.rangeHovered)
|
|
1631
1645
|
};
|
|
1632
1646
|
return D`<td class=${ht(g)}>
|
|
1633
1647
|
<div
|
|
@@ -1640,7 +1654,7 @@ let u = class extends dt {
|
|
|
1640
1654
|
}}
|
|
1641
1655
|
aria-label="${c}"
|
|
1642
1656
|
tabindex=${(y = this.selectableDates.find((f) => f.currentDateISO === a)) == null ? void 0 : y.tabindex}
|
|
1643
|
-
data-disabled=${o ? "disabled" :
|
|
1657
|
+
data-disabled=${o ? "disabled" : _}
|
|
1644
1658
|
data-date=${a}
|
|
1645
1659
|
@keydown=${(f) => {
|
|
1646
1660
|
(f.key === "Enter" || f.key === " ") && (f.preventDefault(), this.handleDateSelect(r));
|
|
@@ -1654,7 +1668,7 @@ let u = class extends dt {
|
|
|
1654
1668
|
</td>`;
|
|
1655
1669
|
}
|
|
1656
1670
|
renderCalendarBody() {
|
|
1657
|
-
const t =
|
|
1671
|
+
const t = p(), e = P(this.year, this.month, 1), n = P(this.year, this.month + 1, 0), r = (e.getDay() + 6) % 7, a = n.getDate(), s = Math.ceil((a + r) / 7), c = P(this.year, this.month, 0).getDate();
|
|
1658
1672
|
let o = 1;
|
|
1659
1673
|
this.week = ct(P(this.year, this.month, 1));
|
|
1660
1674
|
const d = [];
|
|
@@ -1693,11 +1707,11 @@ let u = class extends dt {
|
|
|
1693
1707
|
return d;
|
|
1694
1708
|
}
|
|
1695
1709
|
isExcluded(t, e) {
|
|
1696
|
-
return this.excludeweekdays.includes(t.toString()) || this.earliest &&
|
|
1710
|
+
return this.excludeweekdays.includes(t.toString()) || this.earliest && p(e, "end") < p(this.earliest, "start") || this.latest && p(e, "start") > p(this.latest, "end") ? !0 : this.excludedates.some((n) => typeof n == "string" ? n === b(e) : n.toDateString() === e.toDateString());
|
|
1697
1711
|
}
|
|
1698
1712
|
isPrevMonthAllowed() {
|
|
1699
1713
|
const t = P(this.year, this.month, 0);
|
|
1700
|
-
return !(this.earliest &&
|
|
1714
|
+
return !(this.earliest && p(this.earliest) > t);
|
|
1701
1715
|
}
|
|
1702
1716
|
prevMonth() {
|
|
1703
1717
|
const t = this.month === 0 ? 11 : this.month - 1, e = this.month === 0 ? this.year - 1 : this.year;
|
|
@@ -1709,7 +1723,7 @@ let u = class extends dt {
|
|
|
1709
1723
|
this.month === 11 ? 0 : this.month + 1,
|
|
1710
1724
|
1
|
|
1711
1725
|
);
|
|
1712
|
-
return !(this.latest &&
|
|
1726
|
+
return !(this.latest && p(this.latest) < t);
|
|
1713
1727
|
}
|
|
1714
1728
|
nextMonth() {
|
|
1715
1729
|
const t = this.month === 11 ? 0 : this.month + 1, e = this.month === 11 ? this.year + 1 : this.year;
|
|
@@ -1720,15 +1734,15 @@ let u = class extends dt {
|
|
|
1720
1734
|
}
|
|
1721
1735
|
isInRange(t) {
|
|
1722
1736
|
if (this.range && this.selected.length === 2) {
|
|
1723
|
-
if (t >
|
|
1724
|
-
} else if (this.range && this.selected.length === 1 && this.rangeHovered && t >
|
|
1737
|
+
if (t > p(this.selected[0]) && t < p(this.selected[1])) return !0;
|
|
1738
|
+
} else if (this.range && this.selected.length === 1 && this.rangeHovered && t > p(this.selected[0]) && t < this.rangeHovered)
|
|
1725
1739
|
return !0;
|
|
1726
1740
|
return !1;
|
|
1727
1741
|
}
|
|
1728
1742
|
isRangeAllowed(t) {
|
|
1729
1743
|
let e = !0;
|
|
1730
1744
|
if (this._selected.length === 1) {
|
|
1731
|
-
const n =
|
|
1745
|
+
const n = z({
|
|
1732
1746
|
start: this._selected[0],
|
|
1733
1747
|
end: t
|
|
1734
1748
|
});
|
|
@@ -1736,7 +1750,7 @@ let u = class extends dt {
|
|
|
1736
1750
|
for (let r = 0; r < n.length; r++)
|
|
1737
1751
|
this.excludedates.forEach((a) => {
|
|
1738
1752
|
a > this._selected[0] && a < t && (e = !1);
|
|
1739
|
-
}), this.excludeweekdays.includes(
|
|
1753
|
+
}), this.excludeweekdays.includes(Se(n[r]).toString()) && (e = !1);
|
|
1740
1754
|
}
|
|
1741
1755
|
return e;
|
|
1742
1756
|
}
|
|
@@ -1744,40 +1758,40 @@ let u = class extends dt {
|
|
|
1744
1758
|
this.selected = [], this._selected = [], this.inRange = {};
|
|
1745
1759
|
}
|
|
1746
1760
|
addToSelected(t) {
|
|
1747
|
-
this.selected.includes(
|
|
1761
|
+
this.selected.includes(b(t)) || (this.selected = [...this.selected, b(t)], this._selected = [...this._selected, t], this.range && this.selected.length === 2 && this.close());
|
|
1748
1762
|
}
|
|
1749
1763
|
removeFromSelected(t) {
|
|
1750
1764
|
if (this.selected.length === 1)
|
|
1751
1765
|
this.emptySelected();
|
|
1752
1766
|
else {
|
|
1753
|
-
const e = this.selected.indexOf(
|
|
1767
|
+
const e = this.selected.indexOf(b(t)), n = [...this.selected], r = [...this._selected];
|
|
1754
1768
|
n.splice(e, 1), r.splice(e, 1), this.selected = n, this._selected = r;
|
|
1755
1769
|
}
|
|
1756
1770
|
}
|
|
1757
1771
|
toggleSelected(t) {
|
|
1758
|
-
const e =
|
|
1772
|
+
const e = b(t);
|
|
1759
1773
|
this.selected.includes(e) ? this.removeFromSelected(t) : this.maxMultiple && this.selected.length >= this.maxMultiple || this.addToSelected(t);
|
|
1760
1774
|
}
|
|
1761
1775
|
handleRangeSelect(t) {
|
|
1762
|
-
const e =
|
|
1776
|
+
const e = b(t);
|
|
1763
1777
|
return 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)), Promise.resolve();
|
|
1764
1778
|
}
|
|
1765
1779
|
handleRangeHover(t) {
|
|
1766
1780
|
if (this.range && this._selected.length === 1 && this.isRangeAllowed(t) && this._selected[0] < t) {
|
|
1767
1781
|
this.rangeHovered = t, this.inRange = {};
|
|
1768
|
-
const e =
|
|
1782
|
+
const e = z({
|
|
1769
1783
|
start: this._selected[0],
|
|
1770
1784
|
end: t
|
|
1771
1785
|
});
|
|
1772
1786
|
if (Array.isArray(e) && e.length)
|
|
1773
1787
|
for (let n = 0; n < e.length; n++)
|
|
1774
|
-
this.inRange[
|
|
1788
|
+
this.inRange[b(e[n])] = this.isInRange(e[n]);
|
|
1775
1789
|
} else
|
|
1776
1790
|
this.rangeHovered = null;
|
|
1777
1791
|
}
|
|
1778
1792
|
handleDateSelect(t) {
|
|
1779
1793
|
if (t)
|
|
1780
|
-
return this.range ? this.handleRangeSelect(t) : this.multiple ? this.toggleSelected(t) : (this.selected.includes(
|
|
1794
|
+
return this.range ? this.handleRangeSelect(t) : this.multiple ? this.toggleSelected(t) : (this.selected.includes(b(t)) ? this.emptySelected() : (this.emptySelected(), this.addToSelected(t)), this.close()), this.dispatchEvent(
|
|
1781
1795
|
new CustomEvent("date-selected", {
|
|
1782
1796
|
detail: this.selected,
|
|
1783
1797
|
bubbles: !0,
|
|
@@ -1786,7 +1800,7 @@ let u = class extends dt {
|
|
|
1786
1800
|
), Promise.resolve();
|
|
1787
1801
|
}
|
|
1788
1802
|
focusOnCurrentDate() {
|
|
1789
|
-
const t =
|
|
1803
|
+
const t = b(p()), e = this.querySelector(`div[data-date="${t}"]`);
|
|
1790
1804
|
if (e instanceof HTMLDivElement)
|
|
1791
1805
|
this.focusedDate = t, e.focus();
|
|
1792
1806
|
else {
|
|
@@ -1828,7 +1842,7 @@ h([
|
|
|
1828
1842
|
m({ type: Boolean })
|
|
1829
1843
|
], u.prototype, "withcontrols", 2);
|
|
1830
1844
|
h([
|
|
1831
|
-
m({ converter:
|
|
1845
|
+
m({ converter: L.csvToArray })
|
|
1832
1846
|
], u.prototype, "selected", 2);
|
|
1833
1847
|
h([
|
|
1834
1848
|
m({ type: String })
|
|
@@ -1837,13 +1851,13 @@ h([
|
|
|
1837
1851
|
m({ type: String })
|
|
1838
1852
|
], u.prototype, "latest", 2);
|
|
1839
1853
|
h([
|
|
1840
|
-
m({ converter:
|
|
1854
|
+
m({ converter: L.stringsToDate })
|
|
1841
1855
|
], u.prototype, "excludedates", 2);
|
|
1842
1856
|
h([
|
|
1843
|
-
m({ converter:
|
|
1857
|
+
m({ converter: L.csvToArray })
|
|
1844
1858
|
], u.prototype, "excludeweekdays", 2);
|
|
1845
1859
|
h([
|
|
1846
|
-
m({ converter:
|
|
1860
|
+
m({ converter: L.stringToDate })
|
|
1847
1861
|
], u.prototype, "currentmonth", 2);
|
|
1848
1862
|
h([
|
|
1849
1863
|
m({ type: Array })
|
|
@@ -1879,29 +1893,29 @@ h([
|
|
|
1879
1893
|
m({ type: Date })
|
|
1880
1894
|
], u.prototype, "rangeHovered", 2);
|
|
1881
1895
|
h([
|
|
1882
|
-
|
|
1896
|
+
F()
|
|
1883
1897
|
], u.prototype, "inRange", 2);
|
|
1884
1898
|
h([
|
|
1885
|
-
|
|
1899
|
+
F()
|
|
1886
1900
|
], u.prototype, "focusedDate", 2);
|
|
1887
1901
|
h([
|
|
1888
|
-
|
|
1902
|
+
F()
|
|
1889
1903
|
], u.prototype, "selectableDates", 2);
|
|
1890
1904
|
h([
|
|
1891
|
-
|
|
1905
|
+
F()
|
|
1892
1906
|
], u.prototype, "currentmonthtouched", 2);
|
|
1893
1907
|
h([
|
|
1894
|
-
|
|
1908
|
+
F()
|
|
1895
1909
|
], u.prototype, "tabIndexSet", 2);
|
|
1896
1910
|
u = h([
|
|
1897
1911
|
ft("pkt-calendar")
|
|
1898
1912
|
], u);
|
|
1899
1913
|
export {
|
|
1900
1914
|
u as P,
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1915
|
+
b as a,
|
|
1916
|
+
qe as b,
|
|
1917
|
+
Ce as c,
|
|
1918
|
+
L as d,
|
|
1919
|
+
Ie as f,
|
|
1920
|
+
p as n
|
|
1907
1921
|
};
|